2.2.2. Status Node

This kind of node Subscribe to 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 is the main agent of Monitor Network State Scenario.

2.2.2.1. Example of Usage

This node kind does require few interaction with the user once it is running. User must 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. By destroying the node it stops if running, and every internal entity is correctly destroyed.

2.2.2.1.1. Steps

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

  • Start processing status data of the network calling process_status_async.

  • Stop processing data 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()