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.

New discovery protocol

Steve-N5AC
Steve-N5AC Community Manager admin
edited May 2020 in SmartSDR API
For all versions after v1.1.3, there will be a new discovery protocol for the radio.  The new protocol uses VITA-49 instead of the FlexRadio proprietary format for encapsulation and is sent to the standard VITA-49 port along with all other streaming data (4991).  to port 4992 just like the older protocol.  The old protocol was designed for one of our first Ethernet based radios, the CDRX-3200, and so we decided to use the same protocol for SmartSDR.  The primary issues with the protocol is that it is not name/value pair encoded, it is really field encoded so it makes it difficult to add new fields without causing an issue.  

In the new format, it is sent as a VITA-49 extension packet with stream ID 0x800 and a class ID of 0x534CFFFF.  The only payload present in the protocol is a string that looks like a status string we emit now so that you can share a parsing mechanism.  The string formatter (C) is currently:
model=%s serial=%s version=%s name=%s callsign=%s ip=%u.%u.%u.%u port=%u

The only deviation from what we've done before is that any spaces in the name field are converted to underscores (_) for this packet so you should convert underscores to spaces for any kind of display.  The preamble of the packet is just a standard VITA-49 format.  Here is the C struct:

typedef struct _vita_ext_data_discovery
{
uint32 header;
uint32 stream_id;
uint32 class_id_h;
uint32 class_id_l;
uint32 timestamp_int;
uint32 timestamp_frac_h;
uint32 timestamp_frac_l;
char payload[MAX_DISCOVERY_PAYLOAD_SIZE];
} vita_ext_data_discovery, *VitaExtDataDiscovery;

And the population is as such (consult the VITA-49 standard):

discovery_packet.header = htonl(
VITA_PACKET_TYPE_EXT_DATA_WITH_STREAM_ID |
VITA_HEADER_CLASS_ID_PRESENT |
VITA_TSI_OTHER |
VITA_TSF_SAMPLE_COUNT |
((packet_count++ & 0xF) << 16) |
(packet_len_words & 0xFFFF));
discovery_packet.stream_id = htonl(stream_id);
discovery_packet.class_id_h =  htonl(class_id_h);
discovery_packet.class_id_l =  htonl(class_id_l);
discovery_packet.timestamp_int = 0;
discovery_packet.timestamp_frac_h = 0;
discovery_packet.timestamp_frac_l = 0;
// the copy ensures that we are on a 4-byte boundary per VITA-49 rules
memcpy(discovery_packet.payload, discovery_string, payload_len_bytes + 4);  // copy extra 4 bytes of zeroes to be sure we get to 32-bits

Through the next release of SmartSDR (v1.2), we will be emitting both packets at the same time.  You will be required to adopt this protocol in order for your application to work with SmartSDR v1.3 and later.

If you are not using the SmartSDR API, but are using FlexLib, then this is all taken care of for you and you do not need to do anything other than update FlexLib and ensure it works with your application.  FlexLib now uses only the new protocol.

Steve

Comments

  • Steve - K5FR
    Steve - K5FR Member ✭✭
    edited April 2019
    I did an update from the GIT and am now receiving the following errors when I compile. Looks like I may need an additional reference(s).

    Error 1 Source file 'C:UsersDevDocumentsGitHubsmartsdr-winVitaVitaFlex.cs' could not be opened ('Unspecified error ')

    Error 2 The type or namespace name 'VitaDiscoveryPacket' could not be found (are you missing a using directive or an assembly reference?) C:UsersDevDocumentsGitHubsmartsdr-winFlexLibAPI.cs 143 56

    Error 3 The name 'VitaFlex' does not exist in the current context C:UsersDevDocumentsGitHubsmartsdr-winFlexLibAPI.cs 122 30

  • Richard G7EIX
    Richard G7EIX Member ✭✭
    edited February 2017
    Where can I get the new FlexLib codebase?  Is there a GIT to download from?  I only have the original release that was issued by email.
  • Stu Phillips - K6TU
    Stu Phillips - K6TU Member ✭✭
    edited May 2020
    Steve,

    Your comment above about:

    The only deviation from what we've done before is that any spaces in the name field are converted to underscores (_) for this packet so you should convert underscores to spaces for any kind of display.

    Does this mean that the Name and Callsign fields should be guaranteed NOT to include (_)?

    I'm thinking about contest stations that might have multiple radios and use either a name or callsign with one embedded.

    The currently isn't a spec for either field that defines what may (or not) be in it...

    Very much appreciate the heads up - I'll make sure that both methods are supported and also that the VITA support I add for Objective C doesn't automagically drag in pan or stream support unless desired.

    Stu K6TU

  • Steve-N5AC
    Steve-N5AC Community Manager admin
    edited December 2016
    You may send the radio an underscore, but it will probably be displayed in the radio as a space.
  • Eric-KE5DTO
    Eric-KE5DTO Administrator, FlexRadio Employee admin
    edited December 2016
    There is not a public repo at this point.  We have been sending out zipped snapshots to those that are in the ADP that are interested in FlexLib.
  • Richard G7EIX
    Richard G7EIX Member ✭✭
    edited March 2015

    Ok.  Understood.  Could you add me to the list for the updated version when ready please.  Thanks!

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.