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.

VitaFFTPacket

James Whiteway
edited February 2017 in SmartSDR API
Under the Library Flex.SmoothLake.Vita, there is a Class called : VitaFFTPacket.
Looking thru it's Methods it seems it provides the size of each bin, the number of bins
associated with a particular packet and on down the line.
But, for whatever reason, I cannot access Vita to the point to use any of this data.

I tried this as Stu suggested:

private void panadapter_DataReady(Panadapter pan, ushort data)
        {
            // WHAT GOES HERE???
        }

The //WHAT GOES HERE?? is what I added after trying, (and failing) several things
in Panadapter.cs to get the data packets needed for the Panadapter.

Wish Steve or Eric could drop a couple of hints this way. It sure would be appreciated.
(especially since they wrote this and are using C#) 
:-)

james
WD5GWY




Answers

  • Eric-KE5DTO
    Eric-KE5DTO Administrator, FlexRadio Employee admin
    edited February 2017
    James,

    What is it that you are trying to do?  If you use the Panadapter_DataReady event as shown in the code mentioned, you shouldn't need to deal with the VitaFFTPacket class as we pull the data out before it gets to this event and present it as an array of points (this is the ushort data parameter in the event).
  • James Whiteway
    edited June 2015
    Thanks Eric. I am trying to draw the panadapter. But, it was not clear to me which events and values I need to watch to get the spectrum display to draw correctly. (hope that makes sense as I'm sure I'm using the wrong nominclature to describe what I'm trying to do.) James WD5GWY
  • Eric-KE5DTO
    Eric-KE5DTO Administrator, FlexRadio Employee admin
    edited February 2017
    This makes perfect sense.  Stu is right.  You want to subscribe to the DataReady event in the Panadapter class.  This will provide you with formatted data based on the Width, Height, MindBm and MaxdBm parameters you have set for the Pandapter object.

    The data will be an array of points where the index is assumed to be the X position (so you would draw it left to right).  The values for the data are in pixels with the reference (0, 0) in the upper left corner.
  • James Whiteway
    edited June 2015
    Eric, one more question(for now).
    The array of pixels, they are for drawing a bitmap, that is refreshed X number of milliseconds, depending on the refresh rate set? Not for plotting the spectrum based on freq, (x value) and signal strength (-dBm for y value).
    is that correct? If so, that explains the difference between VitaFFTPacket.cs and Panadapter.cs
    Panadapter.cs takes all the proccessed FFT data and turns it into a bitmap to be drawn by the client.
    Or so it seems to me.
    james
    WD5GWY
  • Eric-KE5DTO
    Eric-KE5DTO Administrator, FlexRadio Employee admin
    edited February 2017
    Not exactly.  FFT packets are sent from the radio across the ethernet connection to the client as often as needed to keep the framerate selected.  Depending on the size of the display being shown, it may take more than one packet to hold a full frame of FFT data.  The expectation is that the client will use the most recent data and overwrite any previous data.  So no timing on the client side should be required other than handling the DataReady event.

    The data in the packets is already rendered to pixels with x_pixels representing the frequency and y_pixels representing log power (dB).  This data is collected and ordered in the Panadapter class before firing the DataReady event.  But the data really doesn't change -- it has the same units in the DataReady event as the FFT packet payload.  This is part of the point of doing the rendering in the radio -- to make it easier on the client to absorb the information.

    So the panadapter.cs class is really just the glue that presents a nice C# Object Oriented interface (Properties, Routines, Events) for interacting with the Panadapter that the radio interface exposes.  The details of the packets are handled for you and the myriad of rendering decisions that happen when changing the display window size or the bandwidth, etc are abstracted behind the scenes (mostly in the radio) so that the developer can just focus on how to make the data look nice in their application.

    I hope that helps.  Keep the questions coming if it is still as clear as mud.
  • James Whiteway
    edited June 2015
    Ok, do the packets for the panadapter include RGB values as well? Or is that in the data for the Waterfall? I ask that because when I think of pixels, I think of them as having color values associated with them james WD5GWY
  • Eric-KE5DTO
    Eric-KE5DTO Administrator, FlexRadio Employee admin
    edited February 2017
    The Panadapter just has rendered pixel data.  No colors.

    The Waterfall has rendered power density data that is then turned into colors in the client.
  • James Whiteway
    edited June 2015
    Thank you Eric. I "think" I am starting to get it now. I'm on the way to Phoenix and cannot test what I am thinking. But, I will this weekend. What think I need to do is start a DrawLine from 0,0 and use the values I load into an array.(from the PanadapterDataReady event) for the Y value. If the value (depending on where it is in the array) is 0, then no line is drawn to a higher point or lower point until the the next non-zero value is encountered. Once reaching the end of the line(based on the Width of the Panadapter) increment a counter for the loop that I have the DrawLine statement in(loop based on height of Panadapter--- lowdBm & HighdBm) and continue till loop count is zero or the array is empty. Then reset loop count and reload array. Is that anywhere near right? James I wrote all the above to help me remember what I'm thinking for when I get home and back to my computer.
  • Eric-KE5DTO
    Eric-KE5DTO Administrator, FlexRadio Employee admin
    edited February 2017
    This makes sense.  I would suggest that you grab the data and put it into an array of Points where x is just the index into the data (really, the x position) and Y is the incoming data from the DataReady event.  Then call the DrawLines function on the whole array.  This is more efficient than doing a bunch of 1 pixel line draws.

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.