Implements the RIP Farm Test Tool as an example usage of the RIP Farm. More...
Data Structures | |
struct | FARM_REPLY_CTXT |
Structure used by relay_message_callback(). It is anonymously passed to rf_iface_start() and returned in callbacks from the libripfarm interface. More... | |
Macros | |
#define | FARM_REPLY_PIPE "inproc://farm_reply_pipe" |
Name of internal push-pull ZeroMQ pipe for sending messages between relay_message_callback() and farm_reply_handler(). | |
Functions | |
HqBool | relay_message_callback (FARM_REPLY_CTXT *farm_reply_ctxt, RF_FARM_REPLY *farm_reply) |
Relay a message received from the farm to farm_reply_handler() in the main UI thread via a ZeroMQ pipe. More... | |
static int | farm_reply_handler (zloop_t *loop, zsock_t *socket, void *arg) |
Receives ZeroMQ messages from relay_message_callback() via the test tool reactor, then sends the message to process_farm_reply() for processing. More... | |
void | destroy_farm_reply_ctxt (FARM_REPLY_CTXT **p_farm_reply_ctxt) |
Free resources allocated by create_farm_reply_ctxt(). More... | |
FARM_REPLY_CTXT * | create_farm_reply_ctxt (void) |
Create a context that is used for ZeroMQ messaging from the DFE Interface thread to farm_reply_handler(). The context is passed back by the libripfarm interface as a handle in message_callback(). More... | |
HqBool | testtool_reactor (struct RF_IFACE_CTXT *iface_ctxt) |
Runs the test tool reactor which monitors ZeroMQ messages from both keyboard_worker() and message_callback(). More... | |
Implements the RIP Farm Test Tool as an example usage of the RIP Farm.
This file implements the inter-thread messaging between the DFE Interface and UI threads. The reactor must also handle the inter-thread messaging related to the keyboard commands.
Refer to the design notes and data flow diagrams in ripfarmtesttool.c.
Keyboard input. A dedicated thread runs keyboard_worker() which simply runs the keyboard_loop() for the UI to implement. A separate thread is used because it is otherwise difficult to monitor both keyboard input and ZeroMQ messages in the same thread, at least on Windows.
Lines of text are passed from relay_keyboard_string() to keyboard_event(), running in keyboard_worker and main UI threads respectively, using a ZeroMQ socket and the test tool reactor.
The exit and waitms data items are passed in the reverse direction over the same ZeroMQ socket.
Copyright (C) 2023 Global Graphics Software Ltd. All rights reserved. Global Graphics Software Ltd. Confidential Information.
FARM_REPLY_CTXT* create_farm_reply_ctxt | ( | void | ) |
Create a context that is used for ZeroMQ messaging from the DFE Interface thread to farm_reply_handler(). The context is passed back by the libripfarm interface as a handle in message_callback().
This function runs in the main UI thread.
void destroy_farm_reply_ctxt | ( | FARM_REPLY_CTXT ** | p_farm_reply_ctxt | ) |
Free resources allocated by create_farm_reply_ctxt().
Safe against a NULL
value of p_farm_reply_ctxt, which is always set to NULL
on exit.
This function runs in the main UI thread.
p_farm_reply_ctxt | The pointer to the context returned by create_farm_reply_ctxt(). |
|
static |
Receives ZeroMQ messages from relay_message_callback() via the test tool reactor, then sends the message to process_farm_reply() for processing.
This function runs in the main UI thread.
loop | Unused. | |
[in] | socket | The ZeroMQ socket which the message is received from. |
[in] | arg | Unused. |
0 | Normal value. |
-1 | Abort the test tool reactor. This should not normally happen even in many error conditions. |
HqBool relay_message_callback | ( | FARM_REPLY_CTXT * | farm_reply_ctxt, |
RF_FARM_REPLY * | farm_reply | ||
) |
Relay a message received from the farm to farm_reply_handler() in the main UI thread via a ZeroMQ pipe.
This function runs in the DFE Interface thread.
[in] | farm_reply_ctxt | Contains the ZeroMQ socket for comms with farm_reply_handler(). |
[in] | farm_reply | A message sent by the rip farm. |
TRUE | Normal value. |
FALSE | catastrophic error in sending the message. Results in |
HqBool testtool_reactor | ( | struct RF_IFACE_CTXT * | iface_ctxt | ) |
Runs the test tool reactor which monitors ZeroMQ messages from both keyboard_worker() and message_callback().
Simple commands are input via the keyboard and the responses from the farm are displayed on the monitor.
This function runs in the main UI thread.
[in] | iface_ctxt | The libripfarm interface context for use in keyboard_event(). |