APIs, concepts, guides, and more

◆ ShutdownTheNetwork()

static void ShutdownTheNetwork ( MotionController * controller)
static
Parameters
controllerPointer to the MotionController to shut down the network on.
Exceptions
std::runtime_errorThrown if the network does not reach the SHUTDOWN or UNINITIALIZED state.
static void ShutdownTheNetwork(MotionController *controller)
{
// Check if the network is already shutdown
if (controller->NetworkStateGet() == RSINetworkState::RSINetworkStateUNINITIALIZED ||
controller->NetworkStateGet() == RSINetworkState::RSINetworkStateSHUTDOWN)
{
return;
}
// Shutdown the network
std::cout << "Shutting down the network.." << std::endl;
controller->NetworkShutdown();
if (controller->NetworkStateGet() != RSINetworkState::RSINetworkStateUNINITIALIZED &&
controller->NetworkStateGet() != RSINetworkState::RSINetworkStateSHUTDOWN) // Check if the network is shutdown.
{
int messagesToRead = controller->NetworkLogMessageCountGet(); // Some kind of error shutting down 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 SHUTDOWN state but the network did not get there.");
}
else // Else, of network is shutdown.
{
std::cout << "Network Shutdown" << std::endl << std::endl;
}
}
Examples
SampleAppsHelper.h.

Definition at line 258 of file SampleAppsHelper.h.