Returns the state (open or closed) of each relay on the device specified
Gx6256GetRelayStates (nHandle, nBlock, padwRelayStates, pnMaxLen, pnStatus)
Name |
Type |
Comments |
nHandle |
SHORT |
Handle to a GX6192/GX6256/GX6864 board. |
nBlock |
SHORT |
The device to read the relay count from0. GX6256_BLOCK_BOARD: Read relay count for all relays on the switching board1. GX6256_BLOCK_RTM: Read relay count for all relays on the connected Rear Transition Module if it exists2. GX6256_BLOCK_SR: Read relay count for all relays on the connected Switching Router if it exists |
padwRelayStates |
PDWORD |
Returns an array containing each relay's state (open or closed) |
pnMaxLen |
PSHORT |
Size of the array passed into the padwRelayStates parameterThe function returns the actual number of elements written to the array in this variable as well. |
pnStatus |
PSHORT |
Returned status: 0 on success, negative number on failure. |
Each board, Rear Transition Module, and Switching Router contain many relays.
Each element in the relay count array, padwRelayCount, represents the current state a relay. The element index corresponds with the relay designation number minus one. For example, element 0 in the array contains the relay state for the relay designated "K1", element 1 in the array contains the relay state for the relay designated "K2", and so on.
The following example returns the relay state for relay K200 on a rear transition board that is connected to slot 5:
SHORT nHandle, nStatus;
DWORD adwRelayStates[256];
Gx6256Initialize(5, &nHandle, &nStatus);
Gx6256GetRelayStates(nHandle, GX6256_BLOCK_RTM, adwRelayStates, 256, &nStatus);
if (adwRelayStates[199]==0)
printf("Relay K200 is open");
else
printf("Relay K200 is closed");