Receives encoder frames on a UDP socket in its own thread, stores each one as a Dgram in a queue, and reports missing and out-of-order frames to the collection server.
More...
#include <UdpEncoder.hh>
|
| | UdpReceiver (const UdpParameters ¶, size_t nBuffers) |
| | Size the frame queue and free list for nBuffers entries, connect the error PUSH socket to the collection server, and create the UDP socket on the loopback port if one is set, else on UdpEncoder::DefaultDataPort.
|
| |
| | ~UdpReceiver () |
| | Close the UDP socket if it was opened.
|
| |
| const std::string | name () const |
| | Return the string encoder (the code marks this FIXME).
|
| |
| void | start () |
| | Reset the frame counter, (re)initialize the queue and free list with one buffer per entry (a Dgram plus one frame), start the receiver thread and, when a loopback port is set, open the loopback socket.
|
| |
| void | stop () |
| | Stop and join the receiver thread and shut down the queues.
|
| |
| void | setOutOfOrder (std::string errMsg) |
| | On the first call, set the out-of-order flag, log errMsg as critical and send it as an asynchronous error message; later calls do nothing.
|
| |
| bool | getOutOfOrder () |
| | Return the out-of-order flag.
|
| |
| void | setMissingData (std::string errMsg) |
| | On the first call, set the missing-data flag, log errMsg as critical and send it as an asynchronous error message; later calls do nothing.
|
| |
| bool | getMissingData () |
| | Return the missing-data flag.
|
| |
| void | process () |
| | Read one frame into a free buffer and push it onto the frame queue; if no buffer is free, count it as missed and discard the frame.
|
| |
| bool | consume () |
| | Pop the oldest frame from the queue and return its buffer to the free list; returns false if the queue was empty.
|
| |
| void | drain () |
| | Consume all queued frames, printing a line for each.
|
| |
| void | loopbackSend () |
| | Send one simulated frame (incremented frame count, encoder value 170000, timing 54321, scale 1 over 150, hardware ID LOOPBACK SIM) to the loopback port on 127.0.0.1.
|
| |
| int | drainDataFd () |
| | Read and discard every frame waiting on the UDP socket (logging the count); returns the last recvfrom() result.
|
| |
| int | reset () |
| | Call drainDataFd() if the socket is open and return its result, otherwise return -1.
|
| |
| SPSCQueue< XtcData::Dgram * > & | encQueue () |
| | Return the queue of received frames (each a Dgram holding one encoder_frame_t).
|
| |
| uint64_t | nUpdates () |
| | Return the number of frames processed since the receiver thread started.
|
| |
| uint64_t | nMissed () |
| | Return the number of frames dropped because no buffer was free.
|
| |
Receives encoder frames on a UDP socket in its own thread, stores each one as a Dgram in a queue, and reports missing and out-of-order frames to the collection server.
◆ UdpReceiver()
| Drp::UdpReceiver::UdpReceiver |
( |
const UdpParameters & |
para, |
|
|
size_t |
nBuffers |
|
) |
| |
Size the frame queue and free list for nBuffers entries, connect the error PUSH socket to the collection server, and create the UDP socket on the loopback port if one is set, else on UdpEncoder::DefaultDataPort.
◆ ~UdpReceiver()
| Drp::UdpReceiver::~UdpReceiver |
( |
| ) |
|
Close the UDP socket if it was opened.
◆ consume()
| bool Drp::UdpReceiver::consume |
( |
| ) |
|
Pop the oldest frame from the queue and return its buffer to the free list; returns false if the queue was empty.
◆ drain()
| void Drp::UdpReceiver::drain |
( |
| ) |
|
Consume all queued frames, printing a line for each.
◆ drainDataFd()
| int Drp::UdpReceiver::drainDataFd |
( |
| ) |
|
Read and discard every frame waiting on the UDP socket (logging the count); returns the last recvfrom() result.
◆ encQueue()
Return the queue of received frames (each a Dgram holding one encoder_frame_t).
◆ getMissingData()
| bool Drp::UdpReceiver::getMissingData |
( |
| ) |
|
|
inline |
Return the missing-data flag.
◆ getOutOfOrder()
| bool Drp::UdpReceiver::getOutOfOrder |
( |
| ) |
|
|
inline |
Return the out-of-order flag.
◆ loopbackSend()
| void Drp::UdpReceiver::loopbackSend |
( |
| ) |
|
Send one simulated frame (incremented frame count, encoder value 170000, timing 54321, scale 1 over 150, hardware ID LOOPBACK SIM) to the loopback port on 127.0.0.1.
◆ name()
| const std::string Drp::UdpReceiver::name |
( |
| ) |
const |
|
inline |
Return the string encoder (the code marks this FIXME).
◆ nMissed()
| uint64_t Drp::UdpReceiver::nMissed |
( |
| ) |
|
|
inline |
Return the number of frames dropped because no buffer was free.
◆ nUpdates()
| uint64_t Drp::UdpReceiver::nUpdates |
( |
| ) |
|
|
inline |
Return the number of frames processed since the receiver thread started.
◆ process()
| void Drp::UdpReceiver::process |
( |
| ) |
|
Read one frame into a free buffer and push it onto the frame queue; if no buffer is free, count it as missed and discard the frame.
◆ reset()
| int Drp::UdpReceiver::reset |
( |
| ) |
|
Call drainDataFd() if the socket is open and return its result, otherwise return -1.
◆ setMissingData()
| void Drp::UdpReceiver::setMissingData |
( |
std::string |
errMsg | ) |
|
On the first call, set the missing-data flag, log errMsg as critical and send it as an asynchronous error message; later calls do nothing.
◆ setOutOfOrder()
| void Drp::UdpReceiver::setOutOfOrder |
( |
std::string |
errMsg | ) |
|
On the first call, set the out-of-order flag, log errMsg as critical and send it as an asynchronous error message; later calls do nothing.
◆ start()
| void Drp::UdpReceiver::start |
( |
| ) |
|
Reset the frame counter, (re)initialize the queue and free list with one buffer per entry (a Dgram plus one frame), start the receiver thread and, when a loopback port is set, open the loopback socket.
◆ stop()
| void Drp::UdpReceiver::stop |
( |
| ) |
|
Stop and join the receiver thread and shut down the queues.
The documentation for this class was generated from the following file: