CanGetChannelStatus


Function

Get the status of the specified channel.

Format

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

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.

ChannelStatus [ VB.NET: UShort ] [ C, C++: unsigned short * ] [ C#: out ushort ] [ 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 [ VB.NET: UShort ] [ C, C++: unsigned short * ] [ C#: out ushort ] [ Python: ctypes.POINTER(ctypes.c_ushort) ]
Get the send error count.

RxErrorCount [ VB.NET: UShort ] [ C, C++: unsigned short * ] [ C#: out ushort ] [ Python: ctypes.POINTER(ctypes.c_ushort) ]
Get the reception error count.

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

VB.NET

Dim Ret As Integer
Dim ChannelStatus As UShort

Dim TxErrorCount As UShort

Dim RxErrorCount As UShort

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

C, C++

long Ret;
unsigned short ChannelStatus;

unsigned short TxErrorCount;

unsigned short RxErrorCount;

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

C#

int Ret;
ushort ChannelStatus;
ushort TxErrorCount;
ushort RxErrorCount;

Ret = can.GetChannelStatus ( Id , 1 , out ChannelStatus , out TxErrorCount , out 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