Functions

Can

Functions

int canEthInit (void)
 defgroup can CAN Functions
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.

Function Documentation

int canEthInit ( void   ) 

defgroup can CAN Functions

This module documents the functions to send and receive CAN messages and to initialise the library. Initialises the CAN-ETH Ethernet interface. A background receive thread is created and started.

Returns:
CANETH_SUCCESS or a negative error code

References canWorker().

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.

Parameters:
hostName String with IP address or host name of the remote CAN-ETH gateway.
Returns:
Handle to CAN channel or negative error code
void canEthClose ( CanHandle  handle  ) 

Close a CAN receive channel.

Parameters:
handle Handle to identify CAN channel.

References MAX_CAN_GATEWAYS.

int canEthRecv ( CanHandle  handle,
CANFRAME msg 
)

Retrieves a CAN message from the receive buffer.

If no messages if available, CANETH_NO_MSG is returned.

Parameters:
handle Handle to identify CAN channel.
msg Pointer to container for received CAN message
Returns:
CANETH_SUCCESS if OK or CANETH_NO_MSG if no message received.

References MAX_CAN_GATEWAYS.

int canEthSendMsg ( CanHandle  handle,
const CANFRAME *const   msg 
)

Send a CAN message.

Parameters:
handle Handle to identify CAN channel.
msg Pointer to CAN message to be sent
Returns:
CANETH_SUCCESS if sent

References MAX_CAN_GATEWAYS.


CAN-ETH C Library
Draft Version