FrameReceiver API Reference#
Decoders#
FrameDecoder#
-
class FrameDecoder : public OdinData::IVersionedObject#
Subclassed by FrameReceiver::FrameDecoderTCP, FrameReceiver::FrameDecoderUDP, FrameReceiver::FrameDecoderZMQ
Public Types
Public Functions
-
FrameDecoder()#
Constructor for the FrameDecoder class.
This method initialises the base class of each frame decoder, storing default values for base configuration parameters and variables.
-
inline virtual ~FrameDecoder() = 0#
-
virtual void init(LoggerPtr &logger, OdinData::IpcMessage &config_msg)#
This overload is scheduled for deletion; logger is unused.
-
virtual void init(OdinData::IpcMessage &config_msg)#
Initialise the FrameDecoder class
This method initialises the base FrameDecoder class, extracting and storing the appropriate parameters from the configuration message.
- Parameters:
config_msg – [in] - IpcMessage containing decoder configuration parameters
-
virtual void request_configuration(const std::string param_prefix, OdinData::IpcMessage &config_reply)#
Handle a configuration request from the controlling application.
This method handles a configuration request from the controlling application, populating the parameter block of the reply message with decoder parameters using the specified parameter prefix. This method should be overridden by derived decoder classes and then called by the overridden method to populate base class parameters.
- Parameters:
param_prefix – [in] - parameter prefix to use on all parameter names
config_reply – [inout] - reply IpcMessage to populate with parameters
-
virtual const size_t get_frame_buffer_size(void) const = 0#
-
virtual const size_t get_frame_header_size(void) const = 0#
Register a buffer manager with the decoder.
This method registers a SharedBufferManager instance with the decoder, to be used when receiving, decoding and storing incoming data.
- Parameters:
buffer_manager – [in] - pointer to a SharedBufferManager instance
-
void register_frame_ready_callback(FrameReadyCallback callback)#
Register a frame ready callback with the decoder.
This method is used to register a frame ready callback function with the decoder, which is called when the decoder determines that a frame is ready to be released to the downstream processing application.
- Parameters:
callback – [in] - callback function with the appropriate signature
-
void push_empty_buffer(int buffer_id)#
Push an buffer onto the empty buffer queue.
This method is used to add an empty buffer to the tail of the internal empty buffer queue for subsequent use receiving frame data
- Parameters:
buffer_id – [in] - SharedBufferManager buffer ID
-
const size_t get_num_empty_buffers(void) const#
Get the number of empty buffers queued.
This method returns the number of buffers currently queued by the decoder in the empty buffer queue
- Returns:
number of empty buffers queued
-
const size_t get_num_mapped_buffers(void) const#
Get the number of mapped buffers currently held.
This method returns the number of buffers currently mapped to incoming frames by the decoder, i.e. frames which are being filled but are not yet ready for processing.
- Returns:
- number of buffers currently mapped for incoming frames
-
void drop_all_buffers(void)#
Drop all buffers currently held by the decoder.
This method forces the decoder to drop all buffers currently held either in the empty buffer queue or currently mapped to incoming frames. It is intended to be used at configuration time where, e.g. the underlying shared buffer manager has been reconfigured and the current buffer references are thus invalid.
-
const unsigned int get_frame_timeout_ms(void) const#
Get the current frame timeout value.
This method returns the frame timeout in milliseconds currently configured in the decoder.
- Returns:
- current frame timeout in milliseconds
-
const unsigned int get_num_frames_timedout(void) const#
Get the number of frames timed out in the decoder
This method returns the number of frames that have timed out during reception by the frame decoder. This is typically determined by specialised decoders subclassed from this class.
- Returns:
- number of frames timed out
-
const unsigned int get_num_frames_dropped(void) const#
Get the number of frames dropped in the decoder
This method returns the number of frames that have been dropped by the frame decoder. This is typically determined by specialised decoders subclassed from this class.
- Returns:
- number of frames dropped
-
virtual void monitor_buffers(void) = 0#
-
virtual void get_status(const std::string param_prefix, OdinData::IpcMessage &status_msg) = 0#
-
void version(const std::string param_prefix, OdinData::IpcMessage &status)#
Collate version information for the decoder.
The version information is added to the status IpcMessage object.
- Parameters:
status – [inout] - Reference to an IpcMessage value to store the version.
-
virtual void reset_statistics(void)#
Reset frame decoder statistics.
This method resets the frame decoder statistics. In this base class this is limited to setting the timed-out frames count to zero. Dervied decoder classes which override this method should ensure the base class version is explicitly called.
Protected Attributes
-
LoggerPtr logger_#
Pointer to the logging facility.
-
bool enable_packet_logging_#
Flag to enable packet logging by decoder.
-
LoggerPtr packet_logger_#
Pointer to the packet logging facility.
-
OdinData::SharedBufferManagerPtr buffer_manager_#
Pointer to the shared buffer manager.
-
FrameReadyCallback ready_callback_#
Callback for frames ready to be processed.
-
EmptyBufferQueue empty_buffer_queue_#
Queue of empty buffers ready for use.
-
FrameBufferMap frame_buffer_map_#
Map of buffers currently receiving frame data.
-
unsigned int frame_timeout_ms_#
Incomplete frame timeout in ms.
-
unsigned int frames_timedout_#
Number of frames timed out in decoder.
-
unsigned int frames_dropped_#
Number of frames dropped due to lack of buffers.
-
FrameDecoder()#
FrameDecoderUDP#
-
class FrameDecoderUDP : public FrameReceiver::FrameDecoder#
Subclassed by FrameReceiver::DummyUDPFrameDecoder
Public Functions
-
inline FrameDecoderUDP()#
-
inline virtual ~FrameDecoderUDP() = 0#
-
virtual const bool requires_header_peek(void) const = 0#
-
virtual const size_t get_packet_header_size(void) const = 0#
-
virtual void *get_packet_header_buffer(void) = 0#
-
virtual void process_packet_header(size_t bytes_received, int port, struct sockaddr_in *from_addr) = 0#
-
virtual void *get_next_payload_buffer(void) const = 0#
-
virtual size_t get_next_payload_size(void) const = 0#
-
virtual FrameReceiveState process_packet(size_t bytes_received, int port, struct sockaddr_in *from_addr) = 0#
-
inline FrameDecoderUDP()#
FrameDecoderZMQ#
-
class FrameDecoderZMQ : public FrameReceiver::FrameDecoder#
DummyUDPFrameDecoder#
-
class DummyUDPFrameDecoder : public FrameReceiver::FrameDecoderUDP#
Public Functions
-
DummyUDPFrameDecoder()#
Constructor for the DummyUDPFrameDecoder.
This constructor sets up the decoder, setting up default values for the packet and frame handling logic of the decoder, and allocating buffers for packet headers, dropped frames and ignored packets.
-
~DummyUDPFrameDecoder()#
Destructor for DummyDUPFrameDecoder.
-
virtual int get_version_major()#
-
virtual int get_version_minor()#
-
virtual int get_version_patch()#
-
virtual std::string get_version_short()#
-
virtual std::string get_version_long()#
-
virtual void init(LoggerPtr &logger, OdinData::IpcMessage &config_msg)#
Initialise the frame decoder.
This method initialises the decoder based on a configuration message passed by the application controller. Parameters found in the decoder configuraiton are parsed and stored in the decoder as appropriate.
- Parameters:
logger – [in] - pointer to the message logger
config_msg – [in] - configuration message
-
virtual void request_configuration(const std::string param_prefix, OdinData::IpcMessage &config_reply)#
Handle a request for the current decoder configuration.
This method handles a request for the current decoder configuration, by populating an IPCMessage with all current configuration parameters.
- Parameters:
param_prefix – [in] string prefix to add to each parameter populated in reply
config_reply – [inout] IpcMessage to populate with current decoder parameters
-
virtual const size_t get_frame_buffer_size(void) const#
Get the size of the frame buffers required for current operation mode.
This method returns the frame buffer size required for the current operation mode, which is determined by the configured number of UDP packets.
- Returns:
size of frame buffer in bytes
-
virtual const size_t get_frame_header_size(void) const#
Get the size of the frame header.
This method returns the size of the frame header used by the decoder, which in this case is the DummyUDP frame header.
- Returns:
size of the frame header in bytes
-
inline virtual const bool requires_header_peek(void) const#
-
virtual const size_t get_packet_header_size(void) const#
Get the size of a packet header.
This method returns the size of a UDP packet header for the receiver thread, which in this case is the size of the DummyUDP packet header.
- Returns:
size of the packet header in bytes.
-
virtual void process_packet_header(size_t bytes_received, int port, struct sockaddr_in *from_addr)#
Process an incoming packet header.
This method is called to process the header of an incoming packet. The content of that header is used to determine where the route the payload of the packet on the next receive. Header information is used to determine which frame buffer the current packet should be routed to, and to request a new frame buffer when the first packet of a given frame is recevied. Buffer exhaustion is also handled by directing all packets for the current frame to a scratch buffer.
- Parameters:
bytes_recevied – [in] - number of bytes received
port – [in] - UDP port packet header was received on
from_addr – [in] - socket address structure with details of source packet
-
inline const bool trailer_mode(void) const#
-
virtual void *get_next_payload_buffer(void) const#
Get a pointer to the next payload buffer.
This method returns a pointer to the next packet payload buffer within the appropriate frame. The location of this is determined by state information set during the processing of the packet header.
- Returns:
pointer to the next payload buffer
-
virtual size_t get_next_payload_size(void) const#
Get the next packet payload size to receive
This method returns the payload size to receive for the next incoming packet.
- Returns:
size of the next packet payload in bytes
-
virtual FrameDecoder::FrameReceiveState process_packet(size_t bytes_received, int port, struct sockaddr_in *from_addr)#
Process a received packet payload.
This method is called once the payload of a packet has been recevied. In this dummy decoder there is no processing of the content of the payload performed, so this method simply updates the state of the current frame buffer header and the decoder accordingly. If all packets of the frame have been received then the frame state is marked as complete and the frame is handed off to downstream processing.
- Parameters:
bytes_received – [in] - number of packet payload bytes received
port – [in] - port the packet was received on
from_addr – [in] - socket address structure indicating source address of packet sender
- Returns:
current frame receive state
-
virtual void monitor_buffers(void)#
Monitor the state of currently mapped frame buffers.
This method, called periodically by a timer in the receive thread reactor, monitors the state of currently mapped frame buffers. In any frame buffers have been mapped for a sufficiently long time that indicates packets have been lost and the frame is incomplete, the frame is flagged as such and notified to the main thread via the ready callback.
-
virtual void get_status(const std::string param_prefix, OdinData::IpcMessage &status_msg)#
Get the current status of the frame decoder.
This method populates the IpcMessage passed by reference as an argument with decoder-specific status information, e.g. packet loss by source.
- Parameters:
param_prefix – [in] - path to be prefixed to each status parameter name
status_msg – [in] - reference to IpcMesssage to be populated with parameters
-
virtual void reset_statistics(void)#
Reset the decoder statistics.
This method resets the frame decoder statistics, including packets received and lost
-
virtual void *get_packet_header_buffer(void)#
Get a pointer to the packet header buffer.
This method returns a pointer to the next packet header buffer. For this decoder, the packet headers are discarded, so the current packet header is always returned.
- Returns:
pointer to the packet header buffer
-
uint32_t get_frame_number(void) const#
Get the current frame number.
This method extracts and returns the frame number from the current UDP packet header.
- Returns:
current frame number
-
uint32_t get_packet_number(void) const#
Get the current packet number.
This method extracts and returns the packet number from the current UDP packet header.
- Returns:
current packet number
Private Functions
-
void initialise_frame_header(DummyUDP::FrameHeader *header_ptr)#
Initialise a frame header
This method initialises the frame header specified by the pointer argument, setting fields to their default values, clearing packet counters and setting the active FEM fields as appropriate.
- Parameters:
header_ptr – [in] - pointer to frame header to initialise.
-
unsigned int elapsed_ms(struct timespec &start, struct timespec &end)#
Calculate and return an elapsed time in milliseconds.
This method calculates and returns an elapsed time in milliseconds based on the start and end timespec structs passed as arguments.
- Parameters:
start – [in] - start time in timespec struct format
end – [in] - end time in timespec struct format
- Returns:
elapsed time between start and end in milliseconds
Private Members
-
unsigned int udp_packets_per_frame_#
-
std::size_t udp_packet_size_#
-
unsigned int status_get_count_#
-
boost::shared_ptr<void> current_packet_header_#
-
boost::shared_ptr<void> dropped_frame_buffer_#
-
int current_frame_seen_#
-
int current_frame_buffer_id_#
-
void *current_frame_buffer_#
-
DummyUDP::FrameHeader *current_frame_header_#
-
std::size_t num_active_fems_#
-
bool dropping_frame_data_#
-
uint32_t packets_received_#
-
uint32_t packets_lost_#
-
uint32_t packets_dropped_#
-
DummyUDPFrameDecoder()#
Controller#
FrameReceiverController#
-
class FrameReceiverController#
Frame receiver controller class
This class implements the main controller of the FrameReceiver application, providing the overall framework for running the frame receiver, capturing frames of incoming data and handing them off to a processing application via shared memory. The controller communicates with the downstream processing (and internally) via ZeroMQ inter-process channels.
Public Functions
-
FrameReceiverController(unsigned int num_io_threads)#
Constructor for the FrameReceiverController class.
This constructor initialises the logger, IPC channels and state of the controller. Configuration and running are deferred to the configure() and run() methods respectively.
-
virtual ~FrameReceiverController()#
Destructor for the FrameReceiverController.
-
void configure(OdinData::IpcMessage &config_msg, OdinData::IpcMessage &config_reply)#
Configure the FrameReceiverController.
This method configures the controller based on configuration parameters received as an IpcMessage. Depending on the parameters present in that message, IPC channels the frame decoder, frame buffer manager and RX thread are conditionally configured.
- Parameters:
config_msg – [in] - IpcMessage containing configuration parameters
reply_msg – [out] - Reply IpcMessage indicating success or failure of actions.
-
void run(void)#
Run the FrameReceiverController.
This method runs the FrameReceiverController reactor event loop. Configuration of the controller and associated objects is performed by calls to the configure() method, either prior to calling run(), or in response to appropriate messages being received on the appropriate IPC channel.
-
void stop(const bool deferred = false)#
Stop the FrameReceiverController.
This method stops the controller by telling the reactor to stop. Execution of the stop can be deferred to allow the process to respond to the shutdown request cleanly.
- Parameters:
deferred – [in] - optional boolean flag indicating deferred execution requested
Private Functions
-
void configure_ipc_channels(OdinData::IpcMessage &config_msg)#
Configure the necessary IPC channels.
This method conditionally configures the IPC channels used by the controller to communicate with control clients, the receiver thread and a downstream frame processing application. Each of the channels is conditionally configured if necessary or when the endpoint specified in the supplied configuration message has changed.
- Parameters:
config_msg – [in] - IPCMessage containing configuration parameters
-
void setup_control_channel(const std::string &ctrl_endpoint)#
Set up the control channel.
This method sets up the control channel, binding to the specified endpoint and adding the channel to the reactor.
- Parameters:
control_endpoint – [in] - string URI of endpoint
-
void setup_rx_channel(const std::string &ctrl_endpoint)#
Set up the receiver thread channel.
This method sets up the receiver thread channel, binding to the specified endpoint and adding the channel to the reactor.
- Parameters:
control_endpoint – [in] - string URI of endpoint
-
void setup_frame_ready_channel(const std::string &ctrl_endpoint)#
Set up the frame ready notification channel.
This method sets up the frame ready notification, binding to the specified endpoint and adding the channel to the reactor.
- Parameters:
control_endpoint – [in] - string URI of endpoint
-
void setup_frame_release_channel(const std::string &ctrl_endpoint)#
Set up the frame release notification channel.
This method sets up the frame release notification, binding to the specified endpoint and adding the channel to the reactor.
- Parameters:
control_endpoint – [in] - string URI of endpoint
-
void unbind_channel(OdinData::IpcChannel *channel, std::string &endpoint, const bool deferred = false)#
Unbind an IpcChannel from an endpoint.
This method unbinds the specified IPCChannel from an endpoint. This can be done in a deferred reactor timer, allowing e.g. a response to be sent first to a command triggering the action, or immediately.
- Parameters:
channel – [in] - IpcChannel to unbind
endpoint – [in] - string URI of endpoint to unbind
deferred – [in] - optional boolean flag indicating deferred execution requested
-
void cleanup_ipc_channels(void)#
Clean up FrameReceiverController IPC channels.
This method cleans up controller IPC channels, removing them from the reactor and closing the channels as appropriate.
-
void configure_frame_decoder(OdinData::IpcMessage &config_msg)#
Configure the frame decoder.
This method configures a frame decoder by loading the resolving the appropriate library and class based on the input configuration.
- Parameters:
config_msg – [in] - IPC message containing configuration parameters
-
bool new_decoder_class(OdinData::IpcMessage &config_msg)#
Check if configuration message defines a new decoder class.
- Parameters:
config_msg – [in] - IPC message containing configuration parameters
bool – [out] - true if config_msg defines a new decoder class to be loaded, else false
-
void configure_buffer_manager(OdinData::IpcMessage &config_msg)#
Configure the frame buffer manager.
This method configures the shared frame buffer manager used by the FrameReceiver to store incoming frame data and hand over to downstream processing. The manager can only be configured if a frame decoder has been loaded and can be interrogated for the appropriate buffer information.
- Parameters:
config_msg – [in] - IpcMessage containing configuration parameters
-
void configure_rx_thread(OdinData::IpcMessage &config_msg)#
Configure the receiver thread.
This method configures and launches the appropriate type of receiver thread based on the configuration information specified in an IpcMessage.
- Parameters:
config_msg – [in] - IpcMessage containing configuration parameters
-
void stop_rx_thread(void)#
Stop the receiver thread.
This method stops the receiver thread cleanly and deletes the object instance by resetting the scoped pointer.
-
void handle_ctrl_channel(void)#
Handle control channel messages.
This method is the handler registered with the reactor to handle messages received on the client control channel. Since this channel is implemented as ROUTER-DEALER, the client identity of the incoming message is tracked and applied to the reply.
-
void handle_rx_channel(void)#
Handle receiver thread channel messages.
This method is the handler registered with the reactor to handle messages received on the receiver thread channel. Since this channel is implemented as ROUTER-DEALER, the client identity of the incoming message is tracked and applied to the reply. Frame ready notifications from the RX thread are passed onto the frame ready channel to notify downstream processing applications that a new frame buffer is ready.
-
void handle_frame_release_channel(void)#
Handle frame release channel messages.
This method is the handler registered with the reactor to handle messages received on the frame release channel. Released frames are passed on to the RX thread so the associated buffer can be queued for re-use in subsequent frame reception.
-
void precharge_buffers(void)#
Precharge empty frame buffers for use by the receiver thread.
This method precharges all the buffers available in the shared buffer manager onto the empty buffer queue in the receiver thread. This allows the receiver thread to obtain a pool of empty buffers at startup, and is done by sending a buffer precharge notification over the RX thread channel.
-
void notify_buffer_config(const bool deferred = false)#
Notify downstream processing applications of the current shared buffer configuration.
This method notifies processing applications subscribed to the frame ready channel of the current shared buffer notification. This is done at startup and any time the shared buffer configuration changes. Execution of the notification can be deferred by setting the optional argument, allowing time for IPC channels to be set up and downstream applications to be responsive to notifications.
- Parameters:
deferred – [in] - optional boolean flag indicating deferred execution requested
-
void store_rx_thread_status(OdinData::IpcMessage &rx_status_msg)#
Store the RX thread status.
This method stores all the parameters present in the RX thread status message passed as an argument, allowing them to be returned in subsequent get_status calls
- Parameters:
rx_status_msg – [in] - IpcMessage containing RX thread status parameters
-
void get_status(OdinData::IpcMessage &status_reply)#
Get the frame receiver status.
This method retrieves the status of the frame receiver in response to a client status request, filling salient information into the parameter block of the reply message passed as an argument.
- Parameters:
status_reply – [inout] - IpcMessage reply to status request
-
void get_version(OdinData::IpcMessage &version_reply)#
Get the frame receiver version information.
This method retrieves version information from the frame receiver in response to a client version request, filling salient information into the parameter block of the reply message passed as an argument.
- Parameters:
version_reply – [inout] - IpcMessage reply to version request
-
void reset_statistics(OdinData::IpcMessage &reset_reply)#
Reset the frame receiver statistics.
This method resets the frame receiver statistics present in status responses. If a frame decoder is configured, its reset method is called to clear any decoder specific values.
- Parameters:
reset_reply – [inout] - IpcMessage reply to reset request
-
void request_configuration(OdinData::IpcMessage &config_reply)#
Get the frame receiver configuration.
This method retrieves the current configuration of the frame receiver in response to a client status request. The configuration of each component of the receiver is filled into the parameter block of the reply message passed as an argument
- Parameters:
config_reply – [inout] - IpcMessage reply to configuration request
Private Members
-
log4cxx::LoggerPtr logger_#
Pointer to the logging facility.
-
boost::scoped_ptr<FrameReceiverRxThread> rx_thread_#
Receiver thread object.
-
FrameDecoderPtr frame_decoder_#
Frame decoder object.
-
SharedBufferManagerPtr buffer_manager_#
Buffer manager object.
-
FrameReceiverConfig config_#
Configuration storage object.
-
bool terminate_controller_#
Flag to signal termination of the controller.
-
bool need_ipc_reconfig_#
Flag to signal reconfiguration of IPC channels.
-
bool need_decoder_reconfig_#
Flag to signal reconfiguration of frame decoder.
-
bool need_rx_thread_reconfig_#
Flag to signal reconfiguration of RX thread.
-
bool need_buffer_manager_reconfig_#
Flag to signal reconfiguration of buffer manager.
-
bool ipc_configured_#
Indicates that IPC channels are configured.
-
bool decoder_configured_#
Indicates that the frame decoder is configured.
-
bool buffer_manager_configured_#
Indicates that the buffer manager is configured.
-
bool rx_thread_configured_#
Indicates that the RX thread is configured.
-
bool configuration_complete_#
Indicates that all components are configured.
-
IpcContext &ipc_context_#
ZMQ context for IPC channels.
-
IpcChannel rx_channel_#
Channel for communication with receiver thread.
-
IpcChannel ctrl_channel_#
Channel for communication with control clients.
-
IpcChannel frame_ready_channel_#
Channel for signalling to downstream processes.
-
IpcChannel frame_release_channel_#
Channel for receiving notification of released frames.
-
IpcReactor reactor_#
Reactor for multiplexing all communications.
-
unsigned int total_buffers_#
Record the total number of buffers in the system.
-
unsigned int frames_received_#
Counter for frames received.
-
unsigned int frames_released_#
Counter for frames released.
-
std::string rx_thread_identity_#
Identity of the RX thread dealer channel.
-
boost::scoped_ptr<OdinData::IpcMessage> rx_thread_status_#
Status of the receiver thread.
-
FrameReceiverController(unsigned int num_io_threads)#
FrameReceiverRxThread#
-
class FrameReceiverRxThread#
Subclassed by FrameReceiver::FrameReceiverTCPRxThread, FrameReceiver::FrameReceiverUDPRxThread, FrameReceiver::FrameReceiverZMQRxThread
Public Functions
Constructor for the FrameReceiverRxThread class.
This constructor initialises the member variables of the class. Startup of the thread itself is deferred to the start() method.
-
virtual ~FrameReceiverRxThread()#
Destructor for the FrameReceiverRxThread.
-
bool start()#
Start the FrameReceiverRxThread.
This method starts the RX thread proper, waiting until the thread is started or has timed out or signalled an initialisation error, in which event an error is returned.
- Returns:
- bool indicating if thread initialisation and startup succeeded
-
void stop()#
Stop the FrameReceiverRxThread.
This method stops the receiver thread, signalling for it to come to a controlled stop and waiting for the thead to join. Any cleanup of the specialised thread service type is also called.
-
void frame_ready(int buffer_id, int frame_number)#
Signal that a frame is ready for processing.
This method is called to signal to the main thread that a frame is ready (either complete or timed out) for processing by the downstream application. An IpcMessage is created with the appropriate parameters and passed to the amin thread via the RX channel.
- Parameters:
buffer_id – [in] - buffer manager ID that is ready
frame_number – [in] - frame number contained in that buffer
Protected Functions
-
virtual void run_specific_service(void) = 0#
-
virtual void cleanup_specific_service(void) = 0#
-
void set_thread_init_error(const std::string &msg)#
Set thread initialisation error condition.
This method is called by the RX thread initialisation to indicate that an error has occurred. The error message passed as an argument is stored so it can be retrieved by the calling process as appropriate.
- Parameters:
msg – [in] - error message associated with initialisation
-
void register_socket(int socket_fd, ReactorCallback callback)#
Register a socket with the RX thread reactor
This method registers a socket and associated callback with the RX thread reactor instance, to allow data arriving on that socket to be handled appropriately
- Parameters:
socket_fd – [in] - file descriptor of socket to register
callback – [in] - callback function to be called by reactor on this socket
Private Functions
-
void run_service(void)#
Run the RX thread event loop service
This method is the entry point for the RX thread and, having configured message channels and timers, runs the IPC reactor event loop, which blocks during normal operation. Once the reactor exits, the necessary cleanup of the thread is performed.
-
void advertise_identity(void)#
Advertise the RX thread channel identity.
This method advertises the identity of the RX thread endpoint on the channel communicating with the main thread. This allows the main thread to correctly route messages to the RX thread over the ROUTER-DEALER channel.
-
void request_buffer_precharge(void)#
Request frame buffer precharge.
This method requests precharge of the empty buffer queue from the main thread, allowing it to fill the empty buffer queue prior to receiving any frame data.
-
void handle_rx_channel(void)#
Handle messages on the RX channel.
This method is the handler registered with the thread reactor to handle incoming messages on the RX channel to the main thread.
-
void tick_timer(void)#
Tick timer handler for the RX thread.
This method is the tick timer handler for the RX thread and is called periodically by the thread reactor event loop. Its purpose is to detect external requests to stop the thread via the stop() method, which clears the run_thread condition.
-
void buffer_monitor_timer(void)#
Buffer monitor timer handler for the RX thread.
This method is the buffer monitor timer handler for the RX thread and is called periodically by the thread reactor event loop. It calls the frame decoder buffer montoring function to allow, e.g. timed out frames to be released. It also sends a status notification to the main thread to allow status information to be updated ready for client requests.
-
void fill_status_params(IpcMessage &status_msg)#
Fill status parameters into a message.
This method populates the parameter block of the IpcMessage passed as an argument with the current state of various RX thread and frame decoder values. This is used to build status messages for communication with the main thread.
- Parameters:
status_msg – [inout] - IpcMessage to fill with status parameters
Private Members
-
LoggerPtr logger_#
Pointer to the logging facility.
-
SharedBufferManagerPtr buffer_manager_#
Pointer to the shared buffer manager.
-
FrameDecoderPtr frame_decoder_#
Pointer to the frame decoder.
-
unsigned int tick_period_ms_#
Receiver thread tick timer period.
-
boost::shared_ptr<boost::thread> rx_thread_#
Pointer to RX thread.
-
IpcChannel rx_channel_#
Channel for communication with the main thread.
-
std::vector<int> recv_sockets_#
List of receive socket file descriptors.
-
bool run_thread_#
Flag signalling thread should run.
-
bool thread_running_#
Flag singalling if thread is running.
-
bool thread_init_error_#
Flag singalling thread initialisation error.
-
std::string thread_init_msg_#
Thread initialisation message.
FrameReceiverUDPRxThread#
-
class FrameReceiverUDPRxThread : public FrameReceiver::FrameReceiverRxThread#
FrameReceiverZMQRxThread#
-
class FrameReceiverZMQRxThread : public FrameReceiver::FrameReceiverRxThread#
FrameReceiverConfig#
-
class FrameReceiverConfig#
Public Functions
-
inline FrameReceiverConfig()#
-
inline void tokenize_port_list(std::vector<uint16_t> &port_list, const std::string port_list_str)#
-
inline std::string rx_port_list(void)#
-
inline void as_ipc_message(OdinData::IpcMessage &config_msg)#
Public Static Functions
-
static inline Defaults::RxType map_rx_name_to_type(std::string &rx_name)#
-
static inline std::string map_rx_type_to_name(Defaults::RxType rx_type)#
Private Members
-
std::size_t max_buffer_mem_#
Amount of shared buffer memory to allocate for frame buffers.
-
std::string decoder_path_#
Path to decoder library.
-
std::string decoder_type_#
Decoder type receiving data for - drives frame size.
-
boost::scoped_ptr<IpcMessage> decoder_config_#
Decoder configuration data as IpcMessage.
-
Defaults::RxType rx_type_#
Type of receiver interface (UDP or ZMQ)
-
std::vector<uint16_t> rx_ports_#
Port(s) to receive frame data on.
-
std::string rx_address_#
IP address to receive frame data on.
-
int rx_recv_buffer_size_#
Receive socket buffer size.
-
unsigned int io_threads_#
Number of IO threads for IPC channels.
-
std::string rx_channel_endpoint_#
IPC channel endpoint for RX thread communication.
-
std::string ctrl_channel_endpoint_#
IPC channel endpoint for control communication with other processes.
-
std::string frame_ready_endpoint_#
IPC channel endpoint for transmitting frame ready notifications to other processes.
-
std::string frame_release_endpoint_#
IPC channel endpoint for receiving frame release notifications from other processes.
Shared memory frame buffer name.
-
unsigned int frame_timeout_ms_#
Incomplete frame timeout in milliseconds.
-
unsigned int frame_count_#
Number of frames to receive before terminating.
-
bool enable_packet_logging_#
Enable packet diagnostic logging.
-
bool force_reconfig_#
Force a comlete reconfigure of the frame receiver.
Friends
- friend class FrameReceiverApp
- friend class FrameReceiverController
- friend class FrameReceiverRxThread
- friend class FrameReceiverUDPRxThread
- friend class FrameReceiverZMQRxThread
- friend class FrameReceiverTCPRxThread
- friend class FrameReceiverConfigTestProxy
- friend class FrameReceiverRxThreadTestProxy
-
inline FrameReceiverConfig()#