APIs, concepts, guides, and more

◆ ShutdownTheNetwork()

static void ShutdownTheNetwork ( MotionController controller)
static
Parameters
controllerPointer to the MotionController to shut down the network on.
Exceptions
ExceptionThrown if the network does not reach the SHUTDOWN or UNINITIALIZED state.
Code Snippet
public 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
Console.WriteLine("Shutting down the network..");
controller.NetworkShutdown();
// check if the network is shutdown
var networkState = controller.NetworkStateGet();
if (networkState != RSINetworkState.RSINetworkStateUNINITIALIZED &&
networkState != RSINetworkState.RSINetworkStateSHUTDOWN)
{
// some kind of error shutting down the network, read the network log messages
int messagesToRead = controller.NetworkLogMessageCountGet();
// print all the messages to help figure out the problem
for (int i = 0; i < messagesToRead; i++)
Console.WriteLine(controller.NetworkLogMessageGet(i));
throw new SystemException("Expected SHUTDOWN state but the network did not get there.");
}
else
{
Console.WriteLine("Network Shutdown");
}
}
See also
CheckErrors

Definition at line 86 of file _helpers.cs.