41#define WINAPI __stdcall
48#define CAN_MAX_STANDARD_ID 0x7ff
49#define CAN_MAX_EXTENDED_ID 0x1fffffff
58#define CANAL_MAIN_VERSION 1
59#define CANAL_MINOR_VERSION 0
60#define CANAL_SUB_VERSION 14
64#define CANAL_LEVEL_STANDARD 1
65#define CANAL_LEVEL_USES_TCPIP 2
68#define POS_VSCPD_MAJOR_VERSION 1
69#define POS_VSCPD_MINOR_VERSION 2
70#define POS_VSCPD_SUB_VERSION 3
74#define CANAL_COMMAND_OPEN_VSCP_LEVEL1 1
75#define CANAL_COMMAND_OPEN_VSCP_LEVEL2 2
76#define CANAL_COMMAND_OPEN_VSCP_CONTROL 3
79#define COMMAND_FAILURE 0
80#define COMMAND_SUCCESS 1
87#define PACKAGE_TIMEOUT -1
88#define PACKAGE_UNKNOWN -1
90#define PACKAGE_FAILURE 0
91#define PACKAGE_SUCCESS 1
106typedef struct structCanalMsg {
110 unsigned char sizeData;
111 unsigned char data[8];
112 unsigned long timestamp;
115typedef canalMsg * PCANALMSG;
124typedef struct structCanalStatistics {
125 unsigned long cntReceiveFrames;
126 unsigned long cntTransmitFrames;
127 unsigned long cntReceiveData;
128 unsigned long cntTransmitData;
129 unsigned long cntOverruns;
130 unsigned long cntBusWarnings;
131 unsigned long cntBusOff;
134typedef canalStatistics *PCANALSTATISTICS;
142typedef struct structCanalStatus {
143 unsigned long channel_status;
144 unsigned long lasterrorcode;
145 unsigned long lasterrorsubcode;
146 char lasterrorstr[80];
150typedef canalStatus * PCANALSTATUS;
155typedef void ( __stdcall * LPFNDLL_CANAL_RECEIVE_CALLBACK) ( canalMsg *pMsg );
159typedef long CANHANDLE;
173long WINAPI EXPORT CanalOpen(
const char *pDevice,
unsigned long flags );
175long CanalOpen(
const char *pDevice,
unsigned long flags );
186int WINAPI EXPORT CanalClose(
long handle );
188int CanalClose(
long handle );
197unsigned long WINAPI EXPORT CanalGetLevel(
long handle );
199unsigned long CanalGetLevel(
long handle );
213int WINAPI EXPORT CanalSend(
long handle,
const PCANALMSG pCanalMsg );
215int CanalSend(
long handle, PCANALMSG pCanalMsg );
231int WINAPI EXPORT CanalBlockingSend(
long handle, PCANALMSG pCanalMsg,
unsigned long timeout );
233int CanalBlockingSend(
long handle, PCANALMSG pCanalMsg,
unsigned long timeout );
247int WINAPI EXPORT CanalReceive(
long handle, PCANALMSG pCanalMsg );
249int CanalReceive(
long handle, PCANALMSG pCanalMsg );
265int WINAPI EXPORT CanalBlockingReceive(
long handle, PCANALMSG pCanalMsg,
unsigned long timeout );
267int CanalBlockingReceive(
long handle, PCANALMSG pCanalMsg,
unsigned long timeout );
278int WINAPI EXPORT CanalDataAvailable(
long handle );
280int CanalDataAvailable(
long handle );
291int WINAPI EXPORT CanalGetStatus(
long handle, PCANALSTATUS pCanalStatus );
293int CanalGetStatus(
long handle, PCANALSTATUS pCanalStatus );
304int WINAPI EXPORT CanalGetStatistics(
long handle, PCANALSTATISTICS pCanalStatistics );
306int CanalGetStatistics(
long handle, PCANALSTATISTICS pCanalStatistics );
317int WINAPI EXPORT CanalSetFilter(
long handle,
unsigned long filter );
319int CanalSetFilter(
long handle,
unsigned long filter );
330int WINAPI EXPORT CanalSetMask(
long handle,
unsigned long mask );
332int CanalSetMask(
long handle,
unsigned long mask );
343int WINAPI EXPORT CanalSetBaudrate(
long handle,
unsigned long baudrate );
345int CanalSetBaudrate(
long handle,
unsigned long baudrate );
354unsigned long WINAPI EXPORT CanalGetVersion(
void );
356unsigned long CanalGetVersion(
void );
365unsigned long WINAPI EXPORT CanalGetDllVersion(
void );
367unsigned long CanalGetDllVersion(
void );
376const char * WINAPI EXPORT CanalGetVendorString(
void );
378const char * CanalGetVendorString(
void );
385const char * WINAPI EXPORT CanalGetDriverInfo(
void );
387const char * CanalGetDriverInfo(
void );
393#define CANAL_NONBLOCK 1
399#define CANAL_IDFLAG_STANDARD 0x00000000
400#define CANAL_IDFLAG_EXTENDED 0x00000001
401#define CANAL_IDFLAG_RTR 0x00000002
402#define CANAL_IDFLAG_STATUS 0x00000004
403#define CANAL_IDFLAG_SEND 0x80000000
406#define CANAL_BAUD_USER 0
407#define CANAL_BAUD_1000 1
408#define CANAL_BAUD_800 2
409#define CANAL_BAUD_500 3
410#define CANAL_BAUD_250 4
411#define CANAL_BAUD_125 5
412#define CANAL_BAUD_100 6
413#define CANAL_BAUD_50 7
414#define CANAL_BAUD_20 8
415#define CANAL_BAUD_10 9
418#define CANAL_STATUSMSG_OK 0x00
419#define CANAL_STATUSMSG_OVERRUN 0x01
420#define CANAL_STATUSMSG_BUSLIGHT 0x02
421#define CANAL_STATUSMSG_BUSHEAVY 0x03
422#define CANAL_STATUSMSG_BUSOFF 0x04
424#define CANAL_STATUSMSG_STUFF 0x20
425#define CANAL_STATUSMSG_FORM 0x21
426#define CANAL_STATUSMSG_ACK 0x23
427#define CANAL_STATUSMSG_BIT1 0x24
428#define CANAL_STATUSMSG_BIT0 0x25
429#define CANAL_STATUSMSG_CRC 0x27
432#define CANAL_STATUS_NONE 0x00000000
433#define CANAL_STATUS_ACTIVE 0x10000000
434#define CANAL_STATUS_PASSIVE 0x40000000
435#define CANAL_STATUS_BUS_OFF 0x80000000
436#define CANAL_STATUS_BUS_WARN 0x20000000
437#define CANAL_STATUS_PHY_FAULT 0x08000000
438#define CANAL_STATUS_PHY_H 0x04000000
439#define CANAL_STATUS_PHY_L 0x02000000
440#define CANAL_STATUS_SLEEPING 0x01000000
441#define CANAL_STATUS_STOPPED 0x00800000
442#define CANAL_STATUS_RECIVE_BUFFER_FULL 0x00400000
443#define CANAL_STATUS_TRANSMIT_BUFFER_FULL 0x00200000
446#define CANAL_ERROR_SUCCESS 0
447#define CANAL_ERROR_BAUDRATE 1
448#define CANAL_ERROR_BUS_OFF 2
449#define CANAL_ERROR_BUS_PASSIVE 3
450#define CANAL_ERROR_BUS_WARNING 4
451#define CANAL_ERROR_CAN_ID 5
452#define CANAL_ERROR_CAN_MESSAGE 6
453#define CANAL_ERROR_CHANNEL 7
454#define CANAL_ERROR_FIFO_EMPTY 8
455#define CANAL_ERROR_FIFO_FULL 9
456#define CANAL_ERROR_FIFO_SIZE 10
457#define CANAL_ERROR_FIFO_WAIT 11
458#define CANAL_ERROR_GENERIC 12
459#define CANAL_ERROR_HARDWARE 13
460#define CANAL_ERROR_INIT_FAIL 14
461#define CANAL_ERROR_INIT_MISSING 15
462#define CANAL_ERROR_INIT_READY 16
463#define CANAL_ERROR_NOT_SUPPORTED 17
464#define CANAL_ERROR_OVERRUN 18
465#define CANAL_ERROR_RCV_EMPTY 19
466#define CANAL_ERROR_REGISTER 20
467#define CANAL_ERROR_TRM_FULL 21
468#define CANAL_ERROR_ERRFRM_STUFF 22
469#define CANAL_ERROR_ERRFRM_FORM 23
470#define CANAL_ERROR_ERRFRM_ACK 24
471#define CANAL_ERROR_ERRFRM_BIT1 25
472#define CANAL_ERROR_ERRFRM_BIT0 26
473#define CANAL_ERROR_ERRFRM_CRC 27
474#define CANAL_ERROR_LIBRARY 28
475#define CANAL_ERROR_PROCADDRESS 29
476#define CANAL_ERROR_ONLY_ONE_INSTANCE 30
477#define CANAL_ERROR_SUB_DRIVER 31
478#define CANAL_ERROR_TIMEOUT 32
479#define CANAL_ERROR_NOT_OPEN 33
480#define CANAL_ERROR_PARAMETER 34
481#define CANAL_ERROR_MEMORY 35
482#define CANAL_ERROR_INTERNAL 36
483#define CANAL_ERROR_COMMUNICATION 37
484#define CANAL_ERROR_USER 38
487#define CANAL_COMMAND_NOOP 0
488#define CANAL_COMMAND_OPEN 1
489#define CANAL_COMMAND_CLOSE 2
490#define CANAL_COMMAND_SEND 3
491#define CANAL_COMMAND_RECEIVE 4
492#define CANAL_COMMAND_CHECKDATA 5
493#define CANAL_COMMAND_BAUDRATE 6
494#define CANAL_COMMAND_STATUS 7
495#define CANAL_COMMAND_STATISTICS 8
496#define CANAL_COMMAND_FILTER 9
497#define CANAL_COMMAND_MASK 10
498#define CANAL_COMMAND_VERSION 11
499#define CANAL_COMMAND_DLL_VERSION 12
500#define CANAL_COMMAND_VENDOR_STRING 13
501#define CANAL_COMMAND_LEVEL 14
504#define CANAL_RESPONSE_NONE 0
505#define CANAL_RESPONSE_SUCCESS 1
506#define CANAL_RESPONSE_ERROR 2
507#define CANAL_RESPONSE_MESSAGE 3
511#define CANAL_IFERROR_GENERAL 128
512#define CANAL_IFERROR_UNKNOWN_COMMAND 129
513#define CANAL_IFERROR_CHANNEL_OPEN 130
514#define CANAL_IFERROR_CHANNEL_CLOSED 131
515#define CANAL_IFERROR_SEND_SUCCESS 132
516#define CANAL_IFERROR_SEND_MSG_ALLOCATON 133
517#define CANAL_IFERROR_BUFFER_EMPTY 134
518#define CANAL_IFERROR_BUFFER_FULL 135
519#define CANAL_IFERROR_READ_FAILURE 136
520#define CANAL_IFERROR_SEND_STORAGE 137
526#define CANAL_BINARY_FRAME_TYPE_VSCP 0
527#define CANAL_BINARY_FRAME_TYPE_ERROR 1
528#define CANAL_BINARY_FRAME_TYPE_COMMAND 2
529#define CANAL_BINARY_FRAME_TYPE_CAN 3
531#define CANAL_BINARY_COMMAND_NOOP 0
532#define CANAL_BINARY_COMMAND_READ 1
533#define CANAL_BINARY_COMMAND_CLOSE 2
536#define CANAL_BINARY_ERROR_NONE 0
537#define CANAL_BINARY_ERROR_GENERAL 1
538#define CANAL_BINARY_ERROR_TO_SMALL 2
539#define CANAL_BINARY_ERROR_FORMAT 3
540#define CANAL_BINARY_ERROR_UNKNOW_FRAME 4
541#define CANAL_BINARY_ERROR_MEMORY 5
542#define CANAL_BINARY_ERROR_NO_DATA 6
543#define CANAL_BINARY_ERROR_INVALID_CMD 7
546#define CANUSB_ACCEPTANCE_FILTER_ALL 0x00000000
547#define CANUSB_ACCEPTANCE_MASK_ALL 0xFFFFFFFF