1.2.9. Status Node

This type of node subscribes to the Status Topic. Thus it receives every Status data from all the other nodes in the network. This node runs a function that will be executed with each message received. This node is the primary component of the Monitor Network State Scenario scenario.

1.2.9.1. Example Usage

This type of node requires minimal interaction with the user once it is running. User can start and stop this node as desired using methods process_status_async and stop_processing. Also, user must yield a callback (function) that will be executed with every Status message received. When the node is destroyed, it automatically stops any ongoing processes, ensuring that all internal entities are properly cleaned up.

1.2.9.1.1. Steps

  • Instantiate the Status Node creating an object of this class with a name.

  • Start processing the status data of the network by calling process_status_async.

  • Stop processing data by calling stop_processing.

// Create a new Status Node
auto node = eprosima::amlip::StatusNode("My_Status_Node");

// Process arrival data by printing it in stdout (defined by std::function)
node.process_status_async(
    []( const eprosima::amlip::types::StatusDataType& status ){ std::cout << status << std::endl; });

// Do other cool things here

// Stop processing data
node.stop_processing()