User manual

CAN API reference
28 © 2007-2010 Analytica GmbH
CANDeviceConnectState
CANDeviceConnectState — Retrieves the current network connection state of the current AnaGate
connection.
Syntax
#include <AnaGateDllCAN.h>
int CANDeviceConnectState(int hHandle);
Parameter
hHandle Valid connection handle of a successful call to CANOpenDevice.
Return value
Returns the current network connection state. Following values are possible:
• 1 = DISCONNECTED: The connection to the AnaGate is disconnected.
• 2 = CONNECTING: The connection is connecting.
• 3 = CONNECTED : The connection is established.
• 4 = DISCONNECTING: The connection is disonnecting.
• 5 = NOT_INITIALIZED: The network protocol is not successfully initialized.
Description
This function can be used to check if an already connected device is disconnected.
The detection period of a state change depends on the use of internal AnaGate-ALIVE mechanism. This
ALIVE mechanism has to be switched on explicitly via CANStartAlive function. Once activated the
connection state is periodically checked by the ALIVE mechanism.
Remarks
The CANDeviceConnectState function is supported by library version 1.4-1.10 or higher.
See also
CANStartAlive