There is the “StreamConfig” structure that helps to config settings for a stream in StreamConfig.h file.
In “StreamConfig” structure we can find the definition of the function that gets called whenever a stream status changes:
typedef bool (*StatusCallbackFunc)(bool isTx, const StreamStats* stats, void* userData);
As far as I understand, this callback can be used to get stream statistics using the StreamStats structure:
uint64_t timestamp{ 0 }; ///< The current timestamp of the stream.
int64_t bytesTransferred{ 0 }; ///< The total amount of bytes transferred.
int64_t packets{ 0 }; ///< The total amount of packets transferred.
FIFOStats FIFO; ///< The status of the FIFO queue.
float dataRate_Bps{ 0 }; ///< The current data transmission rate.
uint32_t overrun{ 0 }; ///< The amount of packets overrun.
uint32_t underrun{ 0 }; ///< The amount of packets underrun.
uint32_t loss{ 0 }; ///< The amount of packets that are lost.
uint32_t late{ 0 }; ///< The amount of packets that arrived late for transmitting and were dropped.
This is very useful data that allows you to assess the quality of data transmission.
I made my own “StaticCallback” function with the same signature as in StatusCallbackFunc:
static bool StaticCallback(bool isTx, const lime::StreamStats* stats, void* userData)
Next, I passed a pointer to my function to the “stream” structure of type “StreamConfig”:
stream.statusCallback = &LimeSDRDevice::StaticCallback; // StatusCallback registration
stream.userData = this;
The problem is that after starting the stream, the callback is not called. Can you explain why? Maybe I have something wrong in my code?