Enable received data notifications.
Ret = CanNotifyEvent ( Id , ChannelNo , EventType , CallBackProc , Param)
Id
[ C: short ] [ Python: ctypes.c_short ]
Specify the device ID retrieved from CanInit.
ChannelNo
[ C: unsigned short ] [ Python: ctypes.c_ushort ]
Specify the channel number.
EventType
[ C: unsigned short ] [ Python: ctypes.c_ushort ]
Specify the event type.
Definition |
Value |
Description |
CCAN_EVENT_RECEIVE |
0x01 |
Reception event |
CallBackProc
[ C : PCAN_EVENT_CALLBACK ] [ Python: PCAN_EVENT_CALLBACK ]
Specify the pointer to callback function.
The callback function is specified by a function pointer, but please note that the method of specification varies depending on the language.
Param [
C: void * ] [ Python: ctypes.c_void_p ]
Specify additional parameters for the callback.
Ret [ C: long ] [ Python: ctypes.c_long ]
Definition |
Value |
Description |
CAN_ERR_SUCCESS |
0 |
Normality completion |
CAN_ERR_DLL_INVALID_ID |
10001 |
Invalid ID was specified. |
CAN_ERR_DLL_CALL_DRIVER |
10002 |
Driver can't be called (Failed in the ioctl). |
CAN_ERR_DLL_EVENT_TYPE |
10300 |
Event type beyond the limit. |
CAN_ERR_SYS_CH_NO |
20101 |
Channel number is outside the settable range. |
The others (See also: Details of Error Code)
None
By registering a callback function using this function, the callback function will be called when an event occurs.
Register the callback function that will be called when a message is received (CCAN_EVENT_RECEIVE) in ChannelNo = 1.
C |
long Ret; |
Python |
Ret = ctypes.long() |
This is the form of event notification callback.
void CallBackProc ( Id , Message , wParam , lParam , Param )
Id
[ C: short ] [ Python: ctypes.c_short ]
Specify the device ID retrieved from CanInit.
The device ID of the device that generated the event is passed from the driver.
Message
[C: short ] [ Python: ctypes.c_short ]
The message number that caused the callback function to be called is passed.
Definition |
Value |
Description |
CCAN_EVENT_RECEIVE |
0x01 |
Reception event |
wParam [C:
int] [Python: ctypes.c_int]
This parameter is passed from the driver. Not used at present.
lParam [C:
int] [Python: ctypes.c_int]
The channel number on which the received data is located is passed.
Param [C:
void *] [Python: ctypes.c_void_p]
The parameter specified by the CanNotifyEvent function is passed.
It will be NULL when the Param parameter was specified to NULL.
None