| cmdHB | Index |
Command Code:
The Packet Is Either:
| 0 | 1 | 2 | 3 | |||
| address | 2 | cmdHB | hbType |
| hbType - | The type of heartbeat, depending on whether the module is the router or not. |
Or:
| 0 | 1 | 2 | 3 | 4 | ||||
| address | 3 | cmdHB | hbType | returnAddr |
| hbType - | The type of heartbeat. This depends on whether the module is the router or not. |
| returnAddr - | The return address. This type of packet is only sent from modules that are not the router . |
Description:
The cmdHB packet is used to determine the status of the link to the host . The heartbeat type depends on the router setting . There are two cases to consider:
Module is Router
The module initiates the heartbeat by sending a cmdHB packet with the hbType set to s2h_HB_UP. This packet is received by the host and a reply cmdHB packet is sent back to the module with the type h2s_HB_UP. This round trip constitutes a healthy link and the module turns on its heartbeat LED. After an amount of time specified by the heartbeat rate (accessible via the cmdVAL_SET and cmdVAL_GET commands) the module sends another heartbeat. The exchange of heartbeat and reply is then repeated but the module sends a cmdHB packet with type set to s2h_HB_DOWN. The reply has a h2s_HB_DOWN type and the heartbeat LED is turned off. These commands continue to run and alternate between UP and DOWN.
Module is not Router
The module initiates by sending a cmdHB packet with the hbType set to m2r_HB_UP. The second data byte of this packet is the return address of the module so the router knows where to send a reply. This packet is received by the router and a reply cmdHB packet is sent back to the module using the return address with the type h2s_HB_UP. This round trip constitutes a healthy link and the module turns on its heartbeat LED . The sequence is then repeated but this time a cmdHB packet with heartbeat type set to m2r_HB_DOWN, again with the return address specified. The reply from the router has a h2s_HB_DOWN type and the heartbeat LED is turned off. These commands continue to run and alternate between UP and DOWN.
If the module doesn't receive the reply packet before trying to send the next s2h_HB_X command, the link is assumed down and a raw reflex input is generated. This allows you to configure a reflex to perform any action that a dead link may require.
Numeric values for the hbType codes are shown below. Stem-to-host heartbeats and module-to-router heartbeats require a reply before the heartbeat interval expires.
| hbType | Code (Binary) | Code (Decimal) | Reply with: |
| s2h_HB_UP | 00000000 | 0 | h2s_HB_UP |
| s2h_HB_DOWN | 00000001 | 1 | h2s_HB_DOWN |
| h2s_HB_UP | 00000010 | 2 | (n/a) |
| h2s_HB_DOWN | 00000011 | 3 | (n/a) |
| m2r_HB_UP | 00000100 | 4 | h2s_HB_UP |
| m2r_HB_DOWN | 00000101 | 5 | h2s_HB_DOWN |