SM API
I/Q Streaming (VRT)

The API provides the ability to stream I/Q samples contained in data packets that conform to the ANSI/VITA 49 Radio Transport (VRT) standard.

Examples

For a list of all examples, please see the examples/cpp/vita49 folder in the SDK.

/*
* Get a VRT Context packet from a Signal Hound SM Series device followed by a block of 1000 Signal Data packets
*
*/
#include "sm_api.h"
#include "sm_api_vrt.h"
#pragma comment(lib, "sm_api")
void getVRTPackets() {
// Set up device
int device = -1;
//SmStatus status = smOpenDevice(&device); // USB
if(status != smNoError) {
// Could not open Sm Series device
}
// Set IQ parameters
smSetIQCenterFreq(device, 3.0e9);
smSetIQSampleRate(device, 2);
smSetIQBandwidth(device, smTrue, 20.0e6);
smSetRefLevel(device, -20);
// Set VRt parameters
smSetVrtStreamID(device, 1);
smSetVrtPacketSize(device, 16384);
// Configure
status = smConfigure(device, smModeIQStreaming); // VRT mode
if(status != smNoError) {
// Could not configure SM Series device
}
// Allocate memory
uint32_t contextWordCount;
status = smGetVrtContextPktSize(device, &contextWordCount);
if(status != smNoError) {
// Could not get context packet size
}
const int dataPacketCount = 1000;
uint16_t samplesPerPkt;
uint32_t dataWordCount;
status = smGetVrtPacketSize(device, &samplesPerPkt, &dataWordCount);
if(status != smNoError) {
// Could not get data packet size and word count
}
uint32_t wordCount = contextWordCount + dataWordCount * dataPacketCount;
uint32_t *words = new uint32_t[wordCount];
uint32_t *curr = words;
// Get context packet
uint32_t actualContextWordCount;
status = smGetVrtContextPkt(device, curr, &actualContextWordCount);
if(status != smNoError) {
// Could not get context packet
}
if(actualContextWordCount != contextWordCount) {
// Context packet is not the expected size
}
curr += contextWordCount;
// Get data packets
uint32_t actualDataWordCount;
status = smGetVrtPackets(device, curr, &actualDataWordCount, dataPacketCount, smFalse);
if(status != smNoError) {
// Could not get data packets
}
if(actualDataWordCount != dataWordCount * dataPacketCount) {
// Block of data packets is not the expected size
}
smCloseDevice(device);
if(words) delete[] words;
}
API functions for the SM435/SM200 spectrum analyzers.
SM_API SmStatus smSetIQCenterFreq(int device, double centerFreqHz)
#define SM_DEFAULT_PORT
Definition: sm_api.h:64
#define SM_DEFAULT_ADDR
Definition: sm_api.h:62
SM_API SmStatus smSetIQBandwidth(int device, SmBool enableSoftwareFilter, double bandwidth)
SM_API SmStatus smOpenNetworkedDevice(int *device, const char *hostAddr, const char *deviceAddr, uint16_t port)
@ smFalse
Definition: sm_api.h:378
@ smTrue
Definition: sm_api.h:380
@ smModeIQStreaming
Definition: sm_api.h:250
SM_API SmStatus smSetIQSampleRate(int device, int decimation)
SM_API SmStatus smSetRefLevel(int device, double refLevel)
SM_API SmStatus smCloseDevice(int device)
SM_API SmStatus smConfigure(int device, SmMode mode)
SmStatus
Definition: sm_api.h:142
@ smNoError
Definition: sm_api.h:203
#define SM_ADDR_ANY
Definition: sm_api.h:60
VITA 49 interface.
SM_API SmStatus smSetVrtStreamID(int device, uint32_t sid)
SM_API SmStatus smSetVrtPacketSize(int device, uint16_t samplesPerPkt)
SM_API SmStatus smGetVrtPackets(int device, uint32_t *words, uint32_t *wordCount, uint32_t packetCount, SmBool purgeBeforeAcquire)
SM_API SmStatus smGetVrtPacketSize(int device, uint16_t *samplesPerPkt, uint32_t *wordCount)
SM_API SmStatus smGetVrtContextPkt(int device, uint32_t *words, uint32_t *wordCount)
SM_API SmStatus smGetVrtContextPktSize(int device, uint32_t *wordCount)

Parsing Example

The parsing example demonstrates how to ingest VRT packets. The code can be used directly in projects that wish to use the VRT functionality.

It is located in examples/cpp/vita49/gui.

GUI Example

The GUI application provides a user-friendly graphical interface to easily experiment with the VRT functionality.

It is located in examples/cpp/vita49/gui, and uses the Qt library.

Basics

VRT is an open radio transport protocol used to transmit and receive sample data between devices. It is defined by the VITA 49 standard. Signal Hound uses the latest version of the standard, 49.2 (2017).

At a high level, blocks of I/Q samples and information about the receiver's state are wrapped/embedded in packets with standard formats.

Type and Function of Packets

VRT uses Signal Data packets and Context packets. Both types contain headers with metadata which includes a Stream Identifier and timestamp.

Signal Data Packets

Signal Data packets encapsulate variable-sized blocks of IQ data, along with a 32-bit trailer to convey additional critical information about the state of the receiver at the time the samples were obtained. For example, if the system was being overdriven this would be reported by an indicator in the trailer.

Context Packets

Context packets contain information about the receiver’s settings. They are of variable size, depending on how many of the possible ~25 fields are used. Which fields are used is communicated by the Context Indicator field, a 32-bit value which precedes the context fields. Signal Hound uses 10 of the possible context fields.

Specification

For a full, precise specification, please see the VRT Manual in the SDK.