Api List And Descriptions - Acrosser Technology AR-V6002FL User Manual

Hide thumbs Also See for AR-V6002FL:
Table of Contents

Advertisement

5.3 API List and Descriptions

5.3.1 CAN Bus
1. Syntax:
unsigned int sendCanMessages( canmsg_t *buffer, u8 count )
Description: This function sends out CAN packages over the CAN bus.
Parameters: If there is more than one CAN package to send, these CAN packages are
stored in a 'canmsg_t' array. This function sends out packages in a sequential fashion.
The memory address of the first CAN package to send is pointed at by the parameter
'buffer'. The number of CAN packages to send is indicated by the parameter 'count'. If
the resource of sending out the CAN packages is temporarily unavailable, the process
which invokes this function will be blocked ( Block I/O) until the resource is available
again.
Return Value: If this function sends out the packages successfully, it returns
ERROR_API_SUCC. If this function fails to open the CAN device node, it returns
ERROR_API_CAN_OPEN_FAIL. If this function has any problem with sending out the
CAN packages, it returns ERROR_API_CANSENDMESSAGES.
Here is an example:
If the CAN packages in the array 'canAry[]' have been initialized. The code listed below
will send out the CAN packages in the 'canAry[]' over the CAN bus.
unsigned int result = 0;
canmsg_t canAry[30];
/* ...
Initialize the CAN packages in the canAry[30]
*/
result = sendCanMessages( canAry, 30 );
if( result == ERROR_API_CANSENDMESSAGES ||
result == ERROR_API_CAN_OPEN_FAIL )
fprintf( stderr, "Send CAN package error!\n");
71
Revision: 1.0

Advertisement

Table of Contents
loading

Table of Contents