API Documentation

Record and Replay

The Record and Replay (RnR) API is used to instruct active runtime nodes to perform various PolySync Logfile API tasks, such as recording and replaying logfile sessions.

The RnR API publishes a message with instructions on which mode to be in and which logfile session to read/write to. All active nodes that are expected to log or replay data must subscribe, and have the code, to handle the ps_rnr_msg. The Dynamic Driver and supported sensors natively support this message type, and will respond to RnR messages published to the bus.

There are two examples in the examples repo that implement the record and replay API.

  • rnr_control
    • A node that packages up a ps_rnr_msg based on command line arguments and publishes it to the bus to command active nodes to record or replay data
  • rnr_node
    • A runtime node that listens for the ps_rnr_msg and implements both the record and replay API and the logfile API to record data to a plog file and to replay the data when instructed, much like a dynamic driver node but without hardware dependence

Usage #include <polysync_rnr.h>

Functions

psync_rnr_enumerate_sessions ( … )

This will enumerate all RnR session information available on the host.

psync_rnr_enumerate_sessions fills a DDS_sequence_ps_rnr_session with all RnR sessions in the host’s RnR session directory.

Parameters
in/out type name description
in const ps_node_ref node_ref A node reference that stores the environment information.
out DDS_sequence_ps_rnr_session * const sessions A pointer to DDS_sequence_ps_rnr_session that receives the session data.
Returns

psync_rnr_fill_logfile_replay_seek ( … )

This will fill ps_rnr_msg data with a command to seek the listening node’s logfile replay start time.

Nodes listening for ps_rnr_msg will handle this message using the Logfile API routine psync_logfile_reader_seek_to.

Parameters
in/out type name description
in const ps_node_ref node_ref A node reference that stores the configuration.
in const ps_timestamp timestamp The timestamp to seek to in the logfile. [microseconds]
out ps_rnr_msg * const message A pointer to ps_rnr_msg that receives the command data.
Returns

psync_rnr_fill_logfile_set_clock_scale ( … )

This will fill the ps_rnr_msg data with a command to set the clock scale on the listening node’s host.

Nodes listening for ps_rnr_msg will handle this message using the Logfile API routine psync_logfile_set_replay_clock_scaler.

Parameters
in/out type name description
in const ps_node_ref node_ref A node reference that stores the configuration.
in const double scale The replay clock scale value.
out ps_rnr_msg * const message A pointer to ps_rnr_msg that receives the command data.
Returns

psync_rnr_fill_logfile_set_file_path ( … )

This will fill ps_rnr_msg data with a command to set the listening node’s logfile file path.

Nodes listening for ps_rnr_msg will handle this message using the Logfile API routine psync_logfile_set_file_path.

Parameters
in/out type name description
in const ps_node_ref node_ref A node reference that stores the configuration.
in const char * const file_path A pointer to char buffer that specifies the file path string to use. If NULL, override is disabled/ The Logfile API uses default logic.
out ps_rnr_msg * const message A pointer to ps_rnr_msg that receives the command data.
Returns

psync_rnr_fill_logfile_set_mode (…)

This will fill ps_rnr_msg data with a command to set the listening node’s logfile mode.

Nodes listening for ps_rnr_msg will handle this message using the Logfile API routine psync_logfile_set_mode.

Parameters
in/out type name description
in const ps_node_ref node_ref A node reference that stores the configuration.
in const ps_logfile_mode_kind mode The desired mode, either LOGFILE_MODE_OFF, LOGFILE_MODE_READ, or LOGFILE_MODE_WRITE.
in const ps_rnr_session_id session_id The session identifier associated with the mode, not used for LOGFILE_MODE_OFF.
out ps_rnr_msg * const message A pointer to ps_rnr_msg that receives the command data.
Returns

psync_rnr_fill_logfile_set_state ( … )

This will fill ps_rnr_msg data with a command to set the listening node’s logfile state.

Nodes listening for ps_rnr_msg will handle this message using the Logfile API routine psync_logfile_set_state.

Parameters
in/out type name description
in const ps_node_ref node_ref A node reference that stores the configuration.
in const ps_logfile_state_kind state The desired state, either LOGFILE_STATE_DISABLED, or LOGFILE_STATE_ENABLED.
in const ps_timestamp start_time The absolute time to perform the enable state operation. [UTC timestamp]
out ps_rnr_msg * const message A pointer to ps_rnr_msg that receives the command data.
Returns