APIs, concepts, guides, and more

◆ StartTheNetwork()

static void StartTheNetwork ( MotionController * controller)
static
Parameters
controllerPointer to the MotionController to start the network on.
Exceptions
std::runtime_errorThrown if the network does not reach the OPERATIONAL state.
static void StartTheNetwork(MotionController *controller)
{
// Initialize the Network
if (controller->NetworkStateGet() != RSINetworkState::RSINetworkStateOPERATIONAL) // Check if network is started already.
{
std::cout << "Starting Network.." << std::endl;
controller->NetworkStart(); // If not. Initialize The Network. (This can also be done from RapidSetup Tool)
}
if (controller->NetworkStateGet() != RSINetworkState::RSINetworkStateOPERATIONAL) // Check if network is started again.
{
int messagesToRead = controller->NetworkLogMessageCountGet(); // Some kind of error starting the network, read the network log messages
for (int i = 0; i < messagesToRead; i++)
{
std::cout << controller->NetworkLogMessageGet(i) << std::endl; // Print all the messages to help figure out the problem
}
throw std::runtime_error("Expected OPERATIONAL state but the network did not get there.");
}
else // Else, of network is operational.
{
std::cout << "Network Started" << std::endl << std::endl;
}
}
Examples
ControllerInterrupts.cpp, and SampleAppsHelper.h.

Definition at line 225 of file SampleAppsHelper.h.