使用可能なデバイスの一覧を取得します。
Ret = CanQueryDeviceName ( Index , DeviceName , Device )
Index
[ C: short ] [ Python: ctypes.c_short ]
最初に0を指定し、以降+1づつ値を指定します。
DeviceName
[ C: char * ]
[ Python: ctypes.c_char_p ]
デバイス名を返します。(例:"CAN000")
Device
[ C: char * ] [ Python: ctypes.c_char_p ]
デバイス名称を返します。(例:"CAN-4P-PE")
Ret [ C: long ] [ Python: ctypes.c_long ]
定義 |
戻り値 |
内容 |
CAN_ERR_SUCCESS |
0 |
正常終了 |
CAN_ERR_INFO_NOT_FIND_DEVICE |
10051 |
利用可能なデバイスが見つかりません。 |
その他のエラー(参照:エラーコード詳細)
なし
使用するデバイスを選択させるような、汎用的なアプリケーションを作成する場合に利用します。
Indexを0から順に+1していき、エラーになるまで処理を繰り返してください。
C, C++の場合、
for (int Index = 0; Ret CAN_ERR_SUCCESS;
Index++){
Ret = CanQueryDeviceName ( Index , DeviceName ,
Device );
}
Index=0で情報を取得します。
C |
long Ret; |
Python |
Ret = ctypes.c_long() DeviceName = ctypes.create_string_buffer(256) Device = ctypes.create_string_buffer(256) Ret.value = ccan.CanQueryDeviceName
( 0 , DeviceName , Device ) |
なし