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.
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();
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++)
{
Console.WriteLine(controller.NetworkLogMessageGet(i)); // Print all the messages to help figure out the problem
}
throw new SystemException("Expected SHUTDOWN state but the network did not get there.");
}
else // Else, of network is shutdown.
{
Console.WriteLine("Network Shutdown");
}
}
See also
CheckErrors @[Shutdown-The-Network-cs]

Definition at line 96 of file HelperFunctionsCS.cs.