CanNotifyEvent


Function

Enable received data notifications.

Format

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

Parameters

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

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

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

Definition

Value
[Hex]

Description

CCAN_EVENT_RECEIVE

0x01

Reception event

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

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

Return Value

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

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#.
 

See Also

CanStopNotifyEvent


Callback Function

Format

void CallBackProc ( Id , wParam , lParam , Param )

Parameters

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

wParam [ VB.NET: Integer ] [ C, C++: WPARAM ] [ C#: int ]
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 ]
The channel number on which the received data is located is passed.

Param [ VB.NET: IntPtr ] [ C, C++: void * ] [ C#: void * ]
The parameter specified by the CanNotifyEvent function is passed.
It will be NULL when the Param parameter was specified to NULL.

Return Value

None