機能
Modbus通信におけるレスポンスタイムアウト時間を取得します。
書式
ret = modbus_get_response_timeout( ctx , to_sec , to_usec )
引数
ctx [ C: modbus_t * ] [ Python:ctypes.POINTER(modbus_t) ]
libmodbus構造体へのポインタを指定下さい。
to_sec [ C: uint32_t * ] [ Python: ctypes.POINTER(ctypes.c_uint32) ]
タイムアウト時間における、1秒以上の部分(秒単位)を格納するポインタを指定下さい。
to_usec [ C: uint32_t * ] [ Python: ctypes.POINTER(ctypes.c_uint32) ]
タイムアウト時間における、1秒未満の部分(μ秒単位)を格納するポインタを指定下さい。
戻り値
ret [ C: int ] [ Python: ctypes.c_int ]
成功時には0が入ります。失敗時には-1が入り、以下の errno が設定されます。
定義 |
意味 |
EINVAL |
CTXが不正です。 |
説明
Modbus通信におけるレスポンスのタイムアウト時間を取得します。
使用例
タイムアウト時間を取得します。
C |
int Ret; modbus_t *ctx; uint32_t to_sec; uint32_t to_usec; Ret = modbus_get_response_timeout(ctx, &to_sec, &to_usec);
|
Python |
ret = ctypes.c_int ctx = ctypes.POINTER(modbus_t) uint32_to_sec = ctypes.c_ulong uint32_to_usec = ctypes.c_ulong ret = modbus.modbus_get_response_timeout(ctx,
sec, to_usec) |