指定チャネルのステータスを取得します。
Ret = CanGetChannelStatus ( Id , ChannelNo , ChannelStatus , TxErrorCount , RxErrorCount)
Id
[ C: short ] [ Python: ctypes.c_short ]
CanInitで取得したデバイスIDを指定します。
ChannelNo
[ C: unsigned short ] [ Python: ctypes.c_ushort ]
チャネル番号を指定します。
ChannelStatus [
C: unsigned short * ] [ Python: ctypes.POINTER(ctypes.c_ushort) ]
指定チャネルのステータスを取得します。
定義 |
値 |
意味 |
CCAN_CH_STATUS_ERR_ACTIVE |
0x0000 |
エラーアクティブ |
CCAN_CH_STATUS_ERR_PASSIVE |
0x0001 |
エラーパッシブ |
CCAN_CH_STATUS_BUS_OFF |
0x0002 |
バスオフ |
TxErrorCount [
C: unsigned short * ] [ Python: ctypes.POINTER(ctypes.c_ushort) ]
送信エラーカウントを取得します。
RxErrorCount [
C: unsigned short * ] [ Python: ctypes.POINTER(ctypes.c_ushort) ]
受信エラーカウントを取得します。
Ret [ C: long ] [ Python: ctypes.c_long ]
定義 |
戻り値 |
内容 |
CAN_ERR_SUCCESS |
0 |
正常終了 |
CAN_ERR_DLL_INVALID_ID |
10001 |
無効なIDが指定されました。 |
CAN_ERR_DLL_CALL_DRIVER |
10002 |
ドライバを呼び出せません(ioctlに失敗)。 |
CAN_ERR_SYS_CH_NO |
20101 |
チャネル番号が設定可能範囲外です |
その他のエラー(参照:エラーコード詳細)
なし
指定チャネルのステータスを取得します。
ChannelNo = 1のステータスを取得します。
C |
long Ret; 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) )
|
CanBusConnect CanBusDisconnect