libcyberradio  22.01.24
VitaIqSource Class Reference

A generic VITA 49-compatible I/Q data source object. More...

#include <VitaIqSource.h>

Inheritance diagram for VitaIqSource:
Debuggable

Public Member Functions

 VitaIqSource (const std::string &name="VitaIqSource", int vita_type=0, size_t payload_size=8192, size_t vita_header_size=0, size_t vita_tail_size=0, bool byte_swapped=false, bool iq_swapped=false, const std::string &host="0.0.0.0", unsigned short port=0, bool debug=false)
 Creates a VitaIqSource object. More...
 
virtual ~VitaIqSource ()
 Destroys a vita_iq_source object.
 
virtual int getPackets (int noutput_items, Vita49PacketVector &output_items)
 Gets VITA 49 or I/Q data packets. More...
 
virtual int getPacketSize () const
 Gets the VITA 49 or I/Q packet size. More...
 
virtual int getPacketsPayloadData (int noutput_items, void *buff)
 Gets VITA 49 or I/Q data packets. More...
 
bool isByteSwapped () const
 Gets the byte-swapping state. More...
 
bool isIqSwapped () const
 Gets the I/Q-swapping state. More...
 
size_t getPayloadSize () const
 Gets the payload size. More...
 
size_t getVitaHeaderSize () const
 Gets the VITA 49 frame header size. More...
 
size_t getVitaTailSize () const
 Gets the VITA 49 frame trailer size. More...
 
int getVitaType () const
 Gets the VITA type. More...
 
virtual void setDebugName (const std::string &debug_name)
 Sets the debug name for this object. More...
 
virtual void setDebugFile (FILE *debug_fp)
 Sets the debug file pointer for this object. More...
 
virtual void setDebugTimeFormat (const std::string &debug_timefmt)
 Sets the debug time format for this object. More...
 
virtual int debug (const char *format,...)
 Outputs debug information. More...
 
virtual const char * debugBool (bool x)
 Gets a debug output string for a Boolean value. More...
 
virtual bool isDebug () const
 Gets whether this object produces debug output. More...
 
virtual std::string getDebugName () const
 Gets the debug name for this object. More...
 
virtual std::string rawString (const std::string &data)
 Gets a "raw" string representation of a given data string. More...
 

Detailed Description

A generic VITA 49-compatible I/Q data source object.

The vita_iq_source object provides VITA 49 or raw I/Q data coming from an NDR-class radio via UDP.

This class is designed to be as flexible as possible in dealing with data streams, since each NDR-class radio varies in how it packages data streams.

Definition at line 44 of file VitaIqSource.h.

Constructor & Destructor Documentation

◆ VitaIqSource()

VitaIqSource ( const std::string &  name = "VitaIqSource",
int  vita_type = 0,
size_t  payload_size = 8192,
size_t  vita_header_size = 0,
size_t  vita_tail_size = 0,
bool  byte_swapped = false,
bool  iq_swapped = false,
const std::string &  host = "0.0.0.0",
unsigned short  port = 0,
bool  debug = false 
)

Creates a VitaIqSource object.

Parameters
nameAn identifying name for this source object.
vita_typeThe VITA 49 enable option value. The range of valid values depends on the radio, but 0 always disables VITA 49 formatting. In that case, the data format is raw I/Q.
payload_sizeThe VITA 49 or I/Q payload size for the radio, in bytes. If VITA 49 output is disabled, then this parameter provides the total size of all raw I/Q data transmitted in a single packet.
vita_header_sizeThe VITA 49 header size for the radio, in bytes. If VITA 49 output is disabled, then this parameter is ignored.
vita_tail_sizeThe VITA 49 tail size for the radio, in bytes. If VITA 49 output is disabled, then this parameter is ignored.
byte_swappedWhether the bytes in the packet are swapped (with respect to the endianness employed by the host operating system).
iq_swappedWhether I and Q data in the payload are swapped.
hostThe IP address or host name to bind listening UDP ports on. Specify this as "0.0.0.0" to listen on all network interfaces.
portThe UDP port number to listen on.
debugWhether the block should produce debug output. Defaults to False.

Definition at line 21 of file VitaIqSource.cpp.

Member Function Documentation

◆ debug()

int debug ( const char *  format,
  ... 
)
virtualinherited

Outputs debug information.

This method follows the same semantics as printf(). Output is preceded by a timestamp and the name of the object, if provided.

Parameters
formatThe printf()-style format string.
...Comma-separated list of arguments to print. Note that these need to be arguments that can be supported natively through printf().
Returns
The number of characters outputted.

Definition at line 95 of file Debuggable.cpp.

◆ debugBool()

const char * debugBool ( bool  x)
virtualinherited

Gets a debug output string for a Boolean value.

Parameters
xBoolean value
Returns
A constant string, either "true" or "false".

Definition at line 126 of file Debuggable.cpp.

◆ getDebugName()

std::string getDebugName ( ) const
virtualinherited

Gets the debug name for this object.

Returns
The debug name, as a string.

Definition at line 138 of file Debuggable.cpp.

◆ getPackets()

int getPackets ( int  noutput_items,
Vita49PacketVector &  output_items 
)
virtual

Gets VITA 49 or I/Q data packets.

Parameters
noutput_itemsNumber of packets requested.
output_itemsVector of output packets.
Returns
The number of output packets actually retrieved.

Definition at line 61 of file VitaIqSource.cpp.

◆ getPacketSize()

int getPacketSize ( ) const
virtual

Gets the VITA 49 or I/Q packet size.

Returns
The packet size.

Definition at line 154 of file VitaIqSource.cpp.

◆ getPacketsPayloadData()

int getPacketsPayloadData ( int  noutput_items,
void *  buff 
)
virtual

Gets VITA 49 or I/Q data packets.

Parameters
noutput_itemsNumber of samples requested.
output_itemsVector of output samples of complext data samples.
Returns
The number of output samples actually retrieved.

Definition at line 115 of file VitaIqSource.cpp.

◆ getPayloadSize()

size_t getPayloadSize ( ) const

Gets the payload size.

Returns
The payload size.

Definition at line 169 of file VitaIqSource.cpp.

◆ getVitaHeaderSize()

size_t getVitaHeaderSize ( ) const

Gets the VITA 49 frame header size.

Returns
The header size.

Definition at line 174 of file VitaIqSource.cpp.

◆ getVitaTailSize()

size_t getVitaTailSize ( ) const

Gets the VITA 49 frame trailer size.

Returns
The trailer size.

Definition at line 179 of file VitaIqSource.cpp.

◆ getVitaType()

int getVitaType ( ) const

Gets the VITA type.

Supported VITA types vary by radio, but VITA type 0 always represents raw (unframed) I/Q data.

Returns
The VITA type.

Definition at line 184 of file VitaIqSource.cpp.

◆ isByteSwapped()

bool isByteSwapped ( ) const

Gets the byte-swapping state.

Returns
True if the packet is byte-swapped, false otherwise.

Definition at line 159 of file VitaIqSource.cpp.

◆ isDebug()

bool isDebug ( ) const
virtualinherited

Gets whether this object produces debug output.

Returns
True if producing debug, false otherwise.

Definition at line 133 of file Debuggable.cpp.

◆ isIqSwapped()

bool isIqSwapped ( ) const

Gets the I/Q-swapping state.

Returns
True if the packet is I/Q-swapped, false otherwise.

Definition at line 164 of file VitaIqSource.cpp.

◆ rawString()

std::string rawString ( const std::string &  data)
virtualinherited

Gets a "raw" string representation of a given data string.

"Raw" string representations mimic Python string representations. Whitespace characters are denoted by backslash representations ("\\r", "\\n", "\\t", "\\v", "\\f"), while other non-printable characters are represented with hex representation ("\\x00", etc.)

Parameters
dataData string
Returns
The data's "raw" representation.

Definition at line 143 of file Debuggable.cpp.

◆ setDebugFile()

void setDebugFile ( FILE *  debug_fp)
virtualinherited

Sets the debug file pointer for this object.

Parameters
debug_fpFile to send debug output to.

Definition at line 81 of file Debuggable.cpp.

◆ setDebugName()

void setDebugName ( const std::string &  debug_name)
virtualinherited

Sets the debug name for this object.

Use this method to set unique debug names for objects of the same class for easy differentiation.

Parameters
debug_nameName for identifying this object in debug output.

Definition at line 74 of file Debuggable.cpp.

◆ setDebugTimeFormat()

void setDebugTimeFormat ( const std::string &  debug_timefmt)
virtualinherited

Sets the debug time format for this object.

Parameters
debug_timefmtFormat string for displaying timestamp, as compatible with strftime(). If this is an empty string, don't display a timestamp.

Definition at line 88 of file Debuggable.cpp.


The documentation for this class was generated from the following files: