CanGetChannelStatus


Function

Get the status of the specified channel.

Format

Ret = CanGetChannelStatus ( Id , ChannelNo , ChannelStatus , TxErrorCount , RxErrorCount)

Parameters

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

ChannelNo [ C, C++: unsigned short ] [ Python: ctypes.c_ushort ]
Specify the channel number.

ChannelStatus [ C, C++: unsigned short * ] [ Python: ctypes.POINTER(ctypes.c_ushort) ]
Get the status of the specified channel.

Definition

Value
[Hex]

Description

CCAN_CH_STATUS_ERR_ACTIVE

0x0000

Error active

CCAN_CH_STATUS_ERR_PASSIVE

0x0001

Error passive

CCAN_CH_STATUS_BUS_OFF

0x0002

Bus off

TxErrorCount [ C, C++: unsigned short * ] [ Python: ctypes.POINTER(ctypes.c_ushort) ]
Get the send error count.

RxErrorCount [ C, C++: unsigned short * ] [ Python: ctypes.POINTER(ctypes.c_ushort) ]
Get the reception error count.

Return Value

Ret [ C, C++: long ] [ Python: ctypes.c_long ]

Definition

Value
[Dec]

Description

CAN_ERR_SUCCESS

0

Normality completion

CAN_ERR_DLL_INVALID_ID

10001

Invalid ID specified.

CAN_ERR_DLL_CALL_DRIVER

10002

Driver can't be called (Failed in the ioctl).

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

Get the status of the specified channel.

Example

Get the status of ChannelNo = 1.

C, C++

long Ret;
unsigned short ChannelStatus;

unsigned short TxErrorCount;

unsigned short RxErrorCount;

Ret = CanGetChannelStatus ( Id , 1 , &ChannelStatus , &TxErrorCount , &RxErrorCount );
 

Python

Ret = ctypes.c_long()

ChannelStatus = ctypes.c_ushort()

TxErrorCount = ctypes.c_ushort()

RxErrorCount = ctypes.c_ushort()

 

Ret.value = ccan.CanGetChannelStatus ( Id , 1 , ctypes.byref(ChannelStatus) , ctypes.byref(TxErrorCount) , ctypes.byref(RxErrorCount) )

 

See Also

CanBusConnect, CanBusDisconnect