CanNotifyEvent


Function

Enable received data notifications.

Format

Ret = CanNotifyEvent ( Id , ChannelNo , EventType , CallBackProc , Param)

Parameters

Id [ VB.NET: Short ] [ C, C++: short ] [ C#: short ] [ Python: ctypes.c_short ]
Specify the device ID retrieved from CanInit.

ChannelNo [ VB.NET: UShort ] [ C, C++: unsigned short ] [ C#: ushort ] [ Python: ctypes.c_ushort ]
Specify the channel number.

EventType [ VB.NET: UShort ] [ C, C++: unsigned short ] [ C#: ushort ] [ Python: ctypes.c_ushort ]
Specify the event type.

Definition

Value
[Hex]

Description

CCAN_EVENT_RECEIVE

0x01

Reception event

CallBackProc [ VB.NET: IntPtr ] [ C, C++: PCAN_EVENT_CALLBACK ] [ C#: IntPtr ] [ Python: PCAN_EVENT_CALLBACK ]
Specify the pointer to callback function.

Param [ VB.NET: IntPtr ] [ C, C++: void * ] [ C#: void * ] [ Python: ctypes.c_void_p ]
Specify additional parameters for the callback.

Return Value

Ret [ VB.NET: Integer ] [ C, C++: long ] [ C#: int ] [ Python: ctypes.c_long ]

Definition

Value
[Dec]

Description

CAN_ERR_SUCCESS

0

Normality completion

CAN_ERR_SYS_RECOVERED_FROM_STANDBY

7

Execute CanResetDevice function because the device has recovered from standby mode.

CAN_ERR_DLL_INVALID_ID

10001

Invalid ID specified.

CAN_ERR_DLL_CALL_DRIVER

10002

Driver can't be called (Failed in the device I/O control).

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)

Initial Value

None

Remarks

By registering a callback function using this function, the callback function will be called when an event occurs.

Example

Register the callback function that will be called when a message is received (CCAN_EVENT_RECEIVE) in ChannelNo = 1.

VB.NET

Please refer to Notes on Using Visual Basic .NET.
 

C, C++

long Ret;
Ret = CanNotifyEvent ( Id , 1 , CCAN_EVENT_RECEIVE , CallBackProc , NULL );
 

C#

Please refer to Notes on Using Visual C#.
 

Python

Ret = ctypes.long()
Ret.value = ccan.CanNotifyEvent ( Id , 1 , ccan.CCAN_EVENT_RECEIVE , CallBackProc , 0 )

See Also

CanStopNotifyEvent


Callback Function

Format

void CallBackProc ( Id , wParam , lParam , Param )

Parameters

Id [ VB.NET: Short ] [ C, C++: short ] [ C#: short ] [ Python: ctypes.c_short ]
The driver passes the device ID for which the event notification is intended.

wParam [ VB.NET: Integer ] [ C, C++: WPARAM ] [ C#: int ] [Python: ctypes.wintypes.WPARAM]
This parameter is passed from the driver.

Definition

Value
[Dec]

Description

CCAN_EVENT_RECEIVE

0x01

Reception event

lParam [ VB.NET: Integer ] [ C, C++: LPARAM ] [ C#: int ] [Python: ctypes.wintypes.LPARAM]
The channel number on which the received data is located is passed.

Param [ VB.NET: IntPtr ] [ C, C++: void * ] [ 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.

Return Value

None