libcyberradio  22.01.24
FlowControlClient Class Reference

Flow control client class. More...

#include <FlowControlClient.h>

Inheritance diagram for FlowControlClient:
Thread Debuggable

Public Member Functions

 FlowControlClient (unsigned int ducChannel, bool config_tx, unsigned int updatesPerSecond, bool debug=false)
 Constructs a FlowControlClient object. More...
 
virtual ~FlowControlClient ()
 Destroys a FlowControlClient object.
 
virtual void run ()
 Executes the main processing loop for the thread.
 
void update (void)
 Updates the flow controller.
 
bool connectToRadio (const std::string &hostname, unsigned int port)
 Connects to the radio. More...
 
unsigned int setUpdateRate (unsigned int updatesPerSecond)
 Sets the update rate. More...
 
unsigned int getUpdateDelay ()
 Gets the update delay. More...
 
void setDucChannel (unsigned int ducChannel)
 Sets the DUC channel number. More...
 
bool isConnected (void)
 Gets whether or not the client is connected. More...
 
bool disconnect (void)
 Disconnects the flow control client. More...
 
void testQueries (void)
 Tests the flow control queries.
 
long unsigned int getUtc (void)
 Gets the radio's UTC time. More...
 
std::string getRadioMac (unsigned int tenGbeIndex)
 Gets the MAC address of a 10GigE port on the radio. More...
 
std::string getRadioIp (unsigned int tenGbeIndex)
 Gets the IP address of a 10GigE port on the radio. More...
 
bool disableDuc ()
 Disables the DUC. More...
 
bool enableDuc (unsigned int rateIndex, unsigned int txChannel, unsigned int streamId, unsigned int tenGbeIndex, float attenuation, double txFreq, long ducFreq, unsigned int txAtten, bool ducEnable=true)
 Enables the DUC. More...
 
bool setTxFrequency (double txFreq, bool applySetting=true)
 Sets the transmitter frequency. More...
 
bool setTxAttenuation (unsigned int txAttenuation, bool applySetting=true)
 Sets the transmitter attenuation. More...
 
bool setDucTxChannel (unsigned int txChannel, bool applySetting=true)
 Sets the DUC transmitter bitmap. More...
 
bool setDucRateIndex (unsigned int rateIndex, bool applySetting=true)
 Sets the DUC rate index. More...
 
bool setDucStreamId (unsigned int streamId, bool applySetting=true)
 Sets the Stream ID. More...
 
bool setDucAttenuation (float attenuation, bool applySetting=true)
 Sets the DUC attenuation. More...
 
bool setDucFrequency (long ducFreq, bool applySetting=true)
 Sets the DUC frequency. More...
 
bool setDucTxinvMode (unsigned int txinvMode, bool applySetting=true)
 Sets the DUC TX Inversion Mode. More...
 
bool setDucEnable (bool ducEnable, bool applySetting=true)
 Sets whether or not the DUC is enabled. More...
 
bool setDucTenGbePort (unsigned int ducTenGbePort, bool applySetting=true)
 Sets the 10GigE port used by the DUC. More...
 
bool okToSend (long int pendingSamples, bool lockIfOk)
 Determines if it is OK to send data. More...
 
long int getFreeSpace (void)
 Gets the amount of free space available. More...
 
bool sentNSamples (long int samplesSent)
 Updates status based on the number of samples sent. More...
 
virtual void start ()
 Starts thread processing.
 
virtual void interrupt ()
 Interrupts (stops) the thread.
 
virtual void sleep (double secs)
 Pauses thread execution for a given time, checking for user interrupts during that time. More...
 
virtual bool isRunning () const
 Determines if the thread is running or not. More...
 
virtual void setName (const std::string &name)
 Sets the name of the thread. More...
 
virtual void setClass (const std::string &cls)
 Sets the class identifer string for the thread. More...
 
virtual boost::thread::id getId () const
 Gets the identifier of the underlying Boost thread. More...
 
virtual std::string getIdString () const
 Gets the identifier string for this thread. More...
 
virtual void onInterrupt ()
 Executes code that must run when the thread is interrupted. More...
 
virtual void onException (const std::exception &ex)
 Executes code that must run when an unhandled exception occurs within the thread. 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

Flow control client class.

Definition at line 41 of file FlowControlClient.h.

Constructor & Destructor Documentation

◆ FlowControlClient()

FlowControlClient ( unsigned int  ducChannel,
bool  config_tx,
unsigned int  updatesPerSecond,
bool  debug = false 
)

Constructs a FlowControlClient object.

Parameters
ducChannelDUC channel number
config_txWhether or not to configure the transmitter
updatesPerSecondNumber of updates to make per second
debugWhether or not to produce debug output

Definition at line 27 of file FlowControlClient.cpp.

Member Function Documentation

◆ connectToRadio()

bool connectToRadio ( const std::string &  hostname,
unsigned int  port 
)

Connects to the radio.

Parameters
hostnameRadio host name
portRadio TCP port number
Returns
True if the action succeeded, false otherwise.

Definition at line 134 of file FlowControlClient.cpp.

◆ 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.

◆ disableDuc()

bool disableDuc ( )

Disables the DUC.

Returns
True if the action succeeds, false otherwise.

Definition at line 237 of file FlowControlClient.cpp.

◆ disconnect()

bool disconnect ( void  )

Disconnects the flow control client.

Returns
True if the action succeeds, false otherwise.

Definition at line 171 of file FlowControlClient.cpp.

◆ enableDuc()

bool enableDuc ( unsigned int  rateIndex,
unsigned int  txChannel,
unsigned int  streamId,
unsigned int  tenGbeIndex,
float  attenuation,
double  txFreq,
long  ducFreq,
unsigned int  txAtten,
bool  ducEnable = true 
)

Enables the DUC.

Parameters
rateIndexDUC rate index
txChannelBitmap of transmitters the DUC will use
streamIdStream ID
tenGbeIndex10GigE interface index
attenuationDUC attenuation (dB)
txFreqTransmitter frequency (Hz)
ducFreqDUC frequency (Hz)
txAttenTransmitter attenuation (dB)
ducEnableWhether or not to enable the DUC
Returns
True if the action succeeds, false otherwise.

Definition at line 245 of file FlowControlClient.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.

◆ getFreeSpace()

long int getFreeSpace ( void  )

Gets the amount of free space available.

Returns
Amount of free space.

Definition at line 349 of file FlowControlClient.cpp.

◆ getId()

boost::thread::id getId ( ) const
virtualinherited

Gets the identifier of the underlying Boost thread.

Returns
The thread identifier. If the thread is not running, this returns boost::thread().

Definition at line 91 of file Thread.cpp.

◆ getIdString()

std::string getIdString ( ) const
virtualinherited

Gets the identifier string for this thread.

Returns
The thread identifier string.

Definition at line 96 of file Thread.cpp.

◆ getRadioIp()

std::string getRadioIp ( unsigned int  tenGbeIndex)

Gets the IP address of a 10GigE port on the radio.

Parameters
tenGbeIndex10GigE interface index
Returns
The IP address string.

Definition at line 209 of file FlowControlClient.cpp.

◆ getRadioMac()

std::string getRadioMac ( unsigned int  tenGbeIndex)

Gets the MAC address of a 10GigE port on the radio.

Parameters
tenGbeIndex10GigE interface index
Returns
The MAC address string.

Definition at line 180 of file FlowControlClient.cpp.

◆ getUpdateDelay()

unsigned int getUpdateDelay ( )
inline

Gets the update delay.

Returns
The update delay.

Definition at line 84 of file FlowControlClient.h.

◆ getUtc()

long unsigned int getUtc ( void  )
inline

Gets the radio's UTC time.

Returns
The UTC time, in seconds from the Epoch.

Definition at line 109 of file FlowControlClient.h.

◆ isConnected()

bool isConnected ( void  )
inline

Gets whether or not the client is connected.

Returns
True if the client is connected, false otherwise.

Definition at line 94 of file FlowControlClient.h.

◆ 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.

◆ isRunning()

bool isRunning ( ) const
virtualinherited

Determines if the thread is running or not.

Returns
True if the thread is running, false otherwise.

Definition at line 72 of file Thread.cpp.

◆ okToSend()

bool okToSend ( long int  pendingSamples,
bool  lockIfOk 
)

Determines if it is OK to send data.

Parameters
pendingSamplesNumber of samples pending
lockIfOkWhether or not to lock sending if sending is OK
Returns
True if OK to send, false otherwise.

Definition at line 338 of file FlowControlClient.cpp.

◆ onException()

void onException ( const std::exception &  ex)
virtualinherited

Executes code that must run when an unhandled exception occurs within the thread.

The base-class method does nothing. Override this method in derived classes to perform custom exception processing.

Parameters
exThe exception that occurred.

Definition at line 110 of file Thread.cpp.

◆ onInterrupt()

void onInterrupt ( )
virtualinherited

Executes code that must run when the thread is interrupted.

The base-class method does nothing. Override this method in derived classes to perform custom interrupt processing.

Definition at line 87 of file Thread.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.

◆ sentNSamples()

bool sentNSamples ( long int  samplesSent)

Updates status based on the number of samples sent.

Parameters
samplesSentNumber of samples sent
Returns
True if there is free space available, false otherwise.

Definition at line 354 of file FlowControlClient.cpp.

◆ setClass()

void setClass ( const std::string &  cls)
virtualinherited

Sets the class identifer string for the thread.

Parameters
clsThe new class identifer for the thread.

Definition at line 82 of file Thread.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.

◆ setDucAttenuation()

bool setDucAttenuation ( float  attenuation,
bool  applySetting = true 
)

Sets the DUC attenuation.

Parameters
attenuationDUC attenuation (dB)
applySettingWhether or not to apply the new setting immediately
Returns
True if the action succeeds, false otherwise.

Definition at line 323 of file FlowControlClient.cpp.

◆ setDucChannel()

void setDucChannel ( unsigned int  ducChannel)

Sets the DUC channel number.

Parameters
ducChannelDUC channel number

Definition at line 164 of file FlowControlClient.cpp.

◆ setDucEnable()

bool setDucEnable ( bool  ducEnable,
bool  applySetting = true 
)

Sets whether or not the DUC is enabled.

Parameters
ducEnableWhether or not to enable the DUC
applySettingWhether or not to apply the new setting immediately
Returns
True if the action succeeds, false otherwise.

Definition at line 287 of file FlowControlClient.cpp.

◆ setDucFrequency()

bool setDucFrequency ( long  ducFreq,
bool  applySetting = true 
)

Sets the DUC frequency.

Parameters
ducFreqDUC frequency (Hz)
applySettingWhether or not to apply the new setting immediately
Returns
True if the action succeeds, false otherwise.

Definition at line 328 of file FlowControlClient.cpp.

◆ setDucRateIndex()

bool setDucRateIndex ( unsigned int  rateIndex,
bool  applySetting = true 
)

Sets the DUC rate index.

Parameters
rateIndexDUC rate index
applySettingWhether or not to apply the new setting immediately
Returns
True if the action succeeds, false otherwise.

Definition at line 310 of file FlowControlClient.cpp.

◆ setDucStreamId()

bool setDucStreamId ( unsigned int  streamId,
bool  applySetting = true 
)

Sets the Stream ID.

Parameters
streamIdStream ID
applySettingWhether or not to apply the new setting immediately
Returns
True if the action succeeds, false otherwise.

Definition at line 316 of file FlowControlClient.cpp.

◆ setDucTenGbePort()

bool setDucTenGbePort ( unsigned int  ducTenGbePort,
bool  applySetting = true 
)

Sets the 10GigE port used by the DUC.

Parameters
ducTenGbePort10GigE interface index
applySettingWhether or not to apply the new setting immediately
Returns
True if the action succeeds, false otherwise.

Definition at line 282 of file FlowControlClient.cpp.

◆ setDucTxChannel()

bool setDucTxChannel ( unsigned int  txChannel,
bool  applySetting = true 
)

Sets the DUC transmitter bitmap.

Parameters
txChannelBitmap of transmitters the DUC will use
applySettingWhether or not to apply the new setting immediately
Returns
True if the action succeeds, false otherwise.

Definition at line 298 of file FlowControlClient.cpp.

◆ setDucTxinvMode()

bool setDucTxinvMode ( unsigned int  txinvMode,
bool  applySetting = true 
)

Sets the DUC TX Inversion Mode.

Parameters
txinvModeTX Inversion Mode (0=normal, 1=inverted)
applySettingWhether or not to apply the new setting immediately
Returns
True if the action succeeds, false otherwise.

Definition at line 333 of file FlowControlClient.cpp.

◆ setName()

void setName ( const std::string &  name)
virtualinherited

Sets the name of the thread.

Parameters
nameThe new name of the thread.

Definition at line 77 of file Thread.cpp.

◆ setTxAttenuation()

bool setTxAttenuation ( unsigned int  txAttenuation,
bool  applySetting = true 
)

Sets the transmitter attenuation.

Parameters
txAttenuationTransmitter attenuation (dB)
applySettingWhether or not to apply the new setting immediately
Returns
True if the action succeeds, false otherwise.

Definition at line 276 of file FlowControlClient.cpp.

◆ setTxFrequency()

bool setTxFrequency ( double  txFreq,
bool  applySetting = true 
)

Sets the transmitter frequency.

Parameters
txFreqTransmitter frequency (Hz)
applySettingWhether or not to apply the new setting immediately
Returns
True if the action succeeds, false otherwise.

Definition at line 266 of file FlowControlClient.cpp.

◆ setUpdateRate()

unsigned int setUpdateRate ( unsigned int  updatesPerSecond)

Sets the update rate.

Parameters
updatesPerSecondNumber of updates to make per second
Returns
The new update rate.

Definition at line 157 of file FlowControlClient.cpp.

◆ sleep()

void sleep ( double  secs)
virtualinherited

Pauses thread execution for a given time, checking for user interrupts during that time.

The sleep timer has microsecond resolution.

Parameters
secsNumber of seconds to "sleep".

Definition at line 65 of file Thread.cpp.


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