User manual

CAN API reference
10 © 2007-2010 Analytica GmbH
CANOpenDevice, CANOpenDeviceEx
CANOpenDevice, CANOpenDeviceEx — Opens an network connection (TCP or UDP) to an AnaGate
CAN device.
Syntax
#include <AnaGateDllCan.h>
int CANOpenDevice(int *pHandle, BOOL bSendDataConfirm, BOOL
bSendDataInd, int nCANPort, const char * pcIPAddress, int nTimeout );
int CANOpenDeviceEx(int *pHandle, BOOL bSendDataConfirm, BOOL
bSendDataInd, int nCANPort, const char * pcIPAddress, int nTimeout ,
int nSocketType );
Parameter
pHandle Pointer to a variable, in which the access handle is saved in the event of a
successful connection to the AnaGate device.
bSendDataConfirm It set to TRUE, all incoming and outgoing Data requests are confirmed by
the internal message protocol. Without confirmations a better transmittion
performance is reached.
bSendDataInd If set to FALSE, all incoming telegrams are discarded.
nCANPort CAN port number. Allowed values are:
0 for port A (Modells AnaGate CAN uno, AnaGate CAN duo, AnaGate CAN
quattro, AnaGate CAN USB and AnaGate CAN)
1 for port B (AnaGate CAN duo, AnaGate CAN quattro)
2 for port C (AnaGate CAN quattro)
3 for port D (AnaGate CAN quattro)
pcIPAddress Network address of the AnaGate partner.
nTimeout Default timeout for accessing the AnaGate in milliseconds.
A timeout is reported if the AnaGate partner does not respond within the
defined timeout period. This global timeout value is valid on the current network
connection for all commands and functions which do not offer a specific timeout
value.
nSocketType Specifies the socket type (ethernet layer 4) which is to be used for the new
connection. Only two different types are supported: TCP and UDP. The funttion
CANOpenDevice alyways uses TCP sockets. Use the following constants fpr
the parameter:
1 (SOCK_STREAM) TCP (Transmission Control Protocol)
2 (SOCK_DGRAM) UDP (User Datagram Protocol)