CanGetChannelStatus


Function

Get the status of the specified channel.

Format

Ret = CanGetChannelStatus ( Id , ChannelNo )

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.

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

RxErrorCount [ VB.NET: UShort ] [ C, C++: unsigned short * ] [ C#: out ushort ]
Get the reception error count.

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_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 );
 

See Also

CanBusConnect CanBusDisconnect