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 check the Help Center for known solutions.
Need technical support from FlexRadio? It's as simple as Creating a HelpDesk ticket.

Panadapter OnDataReady Event

James Whiteway
edited February 2017 in SmartSDR API
In Panadapter.cs I find this:

public delegate void DataReadyEventHandler(Panadapter pan, ushort[] data);
        public event DataReadyEventHandler DataReady;
        private void OnDataReady(Panadapter pan, ushort[] data)
        {
            if (DataReady != null)
                DataReady(pan, data);
        }

My confusion is, which of the events do I subscribe to? I thought I had it figured out and subscribed to this event first:

 private void radio_panadapterDataReady(Panadapter pan, ushort data)
        {
          
          

        }

But, none of the code I tried within that event did anything. No return values at all.
And putting a breakpoint in the code I wrote, ( I know, I didn't list the code I tried as it did not work)
shows that the event, as far as I can tell, is not fired. No data seems to get written to the array I created. I even tried dumping the data to a file to see if anything happened. The file is never written!

Same issue with the event if I use the below subscription method:

       private  void DataReadyEventHandler(Panadapter pan, ushort[] data)
        {
       

       }

So, maybe, I'm using the wrong event?
james
WD5GWY

Answers

  • Eric-KE5DTO
    Eric-KE5DTO Administrator, FlexRadio Employee admin
    edited February 2017
    The DataReady event is definitely the right event.  HOWEVER, today the radio will only support a single client running Panadapters.  So if you're running a different client like SmartSDR at the same time, what will happen is that the Panadapter information you are all setup to receive will be sent to the port for the client that set the API.IsGUI (in FlexLib, or "client gui" over the wire) command.  Thus, the data will never get to your application.

    This is a limitation we plan to address at some point in the future to allow more than one "GUI" application.
  • James Whiteway
    edited June 2015
    Eric, my app runs and controls the radio without SSDR running or even being on the same computer. I just never can get any response/feedback from the DataReady event, no matter which version I try from my first post. Setting a Breakpoint at the start of the event, and then running my program, the running code never breaks at the DataReady event. Which it should if it ever receives data for the panadapter. I think I have not wrote the subscription event correctly. But, I get no errors reported in Visual Studio. I have even tried writing other events incorrectly to see if intellisense catches it and it does. So, I'm at a loss as to what is missing or that I've failed to add elsewhere in my program.(oh, and isGUI is set to true in my program. Otherwisw, it would not connect and control the radio without SSDR tunning) James WD5GWY
  • Eric-KE5DTO
    Eric-KE5DTO Administrator, FlexRadio Employee admin
    edited February 2017
    James,

    1. Are you setting API.IsGUI = true?  This is necessary to do any work with Panadapter or Waterfall data.  Note that without setting this, you can interact with these objects (set properties like bandwidth, etc), but you will not receive the data.

    2. Does the radio version match the FirmwareRequiredVersion of the API that you are using?  If not, FlexLib will automatically shut off persistence assuming that the client will need to load a new version.

    With those things out of the way, I don't know of a reason why you wouldn't see the DataReady event.  Make sure that you have the firewall running that you have an exception for your program.  As a quick test to see if this is the issue, you might just disable the firewall and run the test.
  • James Whiteway
    edited June 2015
    1. Yes. API.isGUI= true is set. If set it to false, I cannot control the radio without SSDR running at the same time. Otherwise, everything else works fine, tuning, band changes etc. When I first start my program, it comes up in the same mode, band and other settings from the previous session. So, persistance is working as well. 2. The radio firmware was updated when I upgraded to SSDR v 1.4.11. And I am using the newest version of Flexlib as well. (updated all my References in Visual Studio to v 1.4.11 after compiling the dll's again for that version) Firewall came up the first time I ran my program with the updated dll's. Set it to allow the program to access the network and all worked as it should.(well, except for the OnDataReady event for the panadapter) Only other thing I can think of if it's not an incorrectly constructed event, is, in my other events that do work, such as the PanadapterAdded event and the SliceAdded event, I have something like this: radio_SliceAdded+= _thisRadio.SliceAdded; (Not exactly that as I am not at my computer) I have tried doing something similar in the panadapterDataReady event and could never get intellisense to allow it. Nor would it offer any hints! (it does sometimes) That could be the issue. But, I don't know where, if not in the DataReady event, it would go. james WD5GWY Thanks for your patience Eric.
  • Eric-KE5DTO
    Eric-KE5DTO Administrator, FlexRadio Employee admin
    edited February 2017
    This may be closer to the root of the problem.  You probably need a call to subscribe to the DataReady event inside the PanadapterAdded event using your handler is a parameter.  This is very similar to adding the PropertyChanged handlers for that event.
  • James Whiteway
    edited June 2015
    Thank you Eric. I suspected that was the issue. When I get back home Friday, I'll dive into it again. I'm guessing the syntax should be similar to the other events I subscribe to.(like the example I gave earlier) James WD5GWY

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.