CAN API for proconX CAN-ETH gateway - Header file. More...
Data Structures | |
| struct | CANFRAME |
| CAN message structure. More... | |
Typedefs | |
| typedef int | CanHandle |
| Handle to a CAN connection. Returned by canEthOpen(). | |
Functions | |
| int | canEthInit (void) |
| Initialises the CAN-ETH Ethernet interface. | |
| void | canEthShutdown (void) |
| Shutdown the CAN-ETH Ethernet interface. | |
| CanHandle | canEthOpen (const char *const hostName) |
| Open a CAN channel to a remote CAN-ETH gateway. | |
| void | canEthClose (CanHandle handle) |
| Close a CAN receive channel. | |
| int | canEthRecv (CanHandle handle, CANFRAME *msg) |
| Retrieves a CAN message from the receive buffer. | |
| int | canEthSendMsg (CanHandle handle, const CANFRAME *const msg) |
| Send a CAN message. | |
Error and Return Codes | |
|
| |
| #define | CANETH_SUCCESS 0 |
| Operation was successful. | |
| #define | CANETH_ILLEGAL_ARGUMENT_ERROR (-1) |
| Illegal argument error. | |
| #define | CANETH_NO_MSG (-2) |
| No messages. | |
| #define | CANETH_INVALID_HOST (-3) |
| Invalid IP address or hostname. | |
| #define | CANETH_MAX_OPEN (-4) |
| Maximum number of open connections exceeded. | |
| #define | CANETH_SOCKET_LIB_ERROR (-5) |
| Socket library error. | |
| #define | CANETH_PORT_ALREADY_BOUND (-6) |
| UDP port already bound. | |
| #define | CANETH_SOCKET_FAILED (-7) |
| Creation of socket failed. | |
| #define | CANETH_CREATE_THREAD_FAILED (-8) |
| Creation of background thread failed. | |
CAN API for proconX CAN-ETH gateway - Header file.
| #define CANETH_SUCCESS 0 |
Operation was successful.
This return codes indicates no error.
| #define CANETH_ILLEGAL_ARGUMENT_ERROR (-1) |
Illegal argument error.
A parameter passed to the function returning this error code is invalid or out of range.
| #define CANETH_NO_MSG (-2) |
No messages.
The receive buffer does not contain any messages.
| #define CANETH_INVALID_HOST (-3) |
Invalid IP address or hostname.
The IP address or hostname provided is invalid or cannot be reached.
| #define CANETH_MAX_OPEN (-4) |
Maximum number of open connections exceeded.
Maximum number of usable CAN connections were exceeded.
| #define CANETH_SOCKET_LIB_ERROR (-5) |
Socket library error.
The TCP/IP socket library (e.g. WINSOCK) could not be loaded or the DLL is missing or not installed.
| #define CANETH_PORT_ALREADY_BOUND (-6) |
UDP port already bound.
Indicates that the specified UDP port cannot be bound. The port might already be taken by another application or hasn't been released yet by the TCP/IP stack for re-use.
| #define CANETH_SOCKET_FAILED (-7) |
Creation of socket failed.
The creation of a UDP socket failed.
| #define CANETH_CREATE_THREAD_FAILED (-8) |
Creation of background thread failed.
The system could not create the background receive thread.
| int canEthInit | ( | void | ) |
Initialises the CAN-ETH Ethernet interface.
A background receive thread is created and started.
| void canEthShutdown | ( | void | ) |
Shutdown the CAN-ETH Ethernet interface.
The background receive thread is terminated.
| CanHandle canEthOpen | ( | const char *const | hostName | ) |
Open a CAN channel to a remote CAN-ETH gateway.
| hostName | String with IP address or host name of the remote CAN-ETH gateway. |
| void canEthClose | ( | CanHandle | handle | ) |
Close a CAN receive channel.
| handle | Handle to identify CAN channel. |
References MAX_CAN_GATEWAYS.
Retrieves a CAN message from the receive buffer.
If no messages if available, CANETH_NO_MSG is returned.
| handle | Handle to identify CAN channel. | |
| msg | Pointer to container for received CAN message |
References MAX_CAN_GATEWAYS.
Send a CAN message.
| handle | Handle to identify CAN channel. | |
| msg | Pointer to CAN message to be sent |
References MAX_CAN_GATEWAYS.