Welcome to the new FlexRadio Community! Please review the new Community Rules and other important new Community information on the Message Board.
If you are having a problem, please refer to the product documentation or check the Help Center for known solutions.
Need technical support from FlexRadio? It's as simple as Creating a HelpDesk ticket.

Problem with Radio.MemoryList Property in FlexLib

Options
K9DUR
K9DUR Member ✭✭
edited February 2018 in SmartSDR API

I am trying to add memories from an external program & am experiencing anomalous behavior from FlexLib (v1.4.3).

My process is:

1. Call Memory.RequestMemoryFromRadio

2. Capture MemoryAdded event to get index of new memory

3. Use index of new memory to change memory settings to desired values..

The process works as expected.

With no memories stored in the radio, the Radio.MemoryList collection has a count of 0 as it should.  Then I use the above process to add 2 memories to the radio.  All is well -- the 2 new memories show up in the memories window in SmartSDR & Radio,MemoryList.Count = 2 like it should.

Then I repeat the process to add 2 more memories, using the same settings for each of the 2 new memories as I used before.  Now the problem arises -- All 4 memories show up in the memories window in SmartSDR (expected), BUT Radio,MemoryList.Count = 2, not 4 as it should be.  If I then delete the 2 new memories, the 2 remaining memories are displayed in the window, but the MemoryList count is now 0.  I have to stop & re-start the client to get the number of memories in the collection back in sync with what is displayed in the memories window.

Am I missing something?

73, Ray, K9DUR

Comments

  • rfoust
    rfoust Member ✭✭
    edited March 2017
    Options
    After you added the second 2 memory entries, are you still able to access all 4 memories using their index numbers?  Or did the first 2 just disappear from the collection completely?


  • Eric-KE5DTO
    Eric-KE5DTO Administrator, FlexRadio Employee admin
    edited February 2017
    Options
    I just verified that the new Memory object should be added to the Radio.MemoryList before you ever see the MemoryAdded event fire.  Something strange is definitely going on based on your description.  We will look into this and see what we can find.  Thanks for bringing this to our attention.

    It may help if you share the code you are using to interface to FlexLib.
  • Abed - AB5ED
    Abed - AB5ED Inactive Employee
    edited January 2017
    Options
    Ray, when you say that you're adding 2 memories using the same settings for each one, how are you doing this? If you are calling RequestMemoryFromRadio() from the exact same memory object more than once, something like this can happen.
  • K9DUR
    K9DUR Member ✭✭
    edited September 2016
    Options

    Abed,

    I have a function that allows me to read a .csv file (same format as the .csv file that SmartSDR creates when you export memories.)

    I added 2 memories using the SmartSDR client & exported them to a .csv file.  Then I deleted the memories, again using the client.

    Then I added the 2 memories back to SmartSDR using my program.  The procedure is:

    1. Read a memory record from the file.
    2. Call the RequestMemoryFromRadio function.

    3. Wait for the MemoryAdded event to fire & get the index of the new memory.

    4. Step through the MemoryList collection looking for the memory that was added, using the index returned by the MemoryAdded event as the search criteria.

    5. Change the properties of the memory object to the values read from the .csv file record.

    6. Repeat steps 1-5 for the 2nd memory in the file.

    When  I do this the first time, all is as it should be.  The problem arises when I repeat the procedure using the same file.  All 4 memories appear in the memory window in the client, but the MemoryList.Count property returns = 2 instead of 4.

    Ray

  • K9DUR
    K9DUR Member ✭✭
    edited September 2016
    Options

    Abed,

    Your question got me to thinking.  I guess I was overcomplicating the procedure.  I have changed my procedure as follows:

    1. Read a memory record from the .csv file.

    2. Create a new Memory object

    3. Call the RequestMemoryFromRadio function on the new Memory

    4. Change the properties of the Memory object to the values read from the .csv file.

    5. Repeat steps 1-4 for the 2nd memory in the file.

    I now have simpler, cleaner code, but the issue still remains.

    Ray


  • Mark_W3II
    Mark_W3II Member ✭✭✭
    edited February 2018
    Options

    I am not seeing this issue. Make sure your modifications are thread safe. The call to RquestMemoryFromRadio returns but the new memory object is not completely initialized. index is -1 until memory create response and RadioAck is false until memory initial properties from radio are received. So you should not update the memory object until RadioAck is true.

    I am performing the following steps and have no issues

    1. Hook the Radio object's MemoryAdded event

    2. Create Memory object and "save a reference" to object that holds new memory details and a reference to new memory object, lets call it NewRadioMemory.

    3. Call RequestMemoryFromRadio on new Memory object.

    4. Wait for Radio MemoryAdded event. In the event handler make sure you check the create memory came from your invoke of RquestMemoryFromRadio  by calling  object.ReferenceEquals(mem, NewRadioMemory).  Note MemoryAdded will provide a reference to newly created memory object (called mem). Now update your new memory object's properties using saved details object reference.  If you are creating multiple memories then repeat step 2 & 3.



Leave a Comment

Rich Text Editor. To edit a paragraph's style, hit tab to get to the paragraph menu. From there you will be able to pick one style. Nothing defaults to paragraph. An inline formatting menu will show up when you select text. Hit tab to get into that menu. Some elements, such as rich link embeds, images, loading indicators, and error messages may get inserted into the editor. You may navigate to these using the arrow keys inside of the editor and delete them with the delete or backspace key.