機能
設定されているスレーブIDを取得します。
書式
ret = modbus_get_slave( ctx )
引数
ctx [ VB.NET: IntPtr ] [ C, C++: modbus_t * ] [ C#: IntPtr ] [ Python: ctypes.POINTER(modbus_t) ]
libmodbus構造体へのポインタを指定下さい。
戻り値
ret [ VB.NET:Integer ] [ C, C++: int ] [ C#: int ] [ Python: ctypes.c_int ]
成功時にはスレーブIDが入り、失敗時には-1が入り、errnoには以下が入ります。
定義 |
意味 |
EINVAL |
CTXが不正です。 |
説明
指定したModbus構造体内で設定されているスレーブIDを取得します。
使用例
スレーブIDを取得します。
VB.NET |
Dim ret As Integer Dim ctx As IntPtr ret = modbus_get_slave(ctx)
|
C, C++ |
int ret; modbus_t *ctx; ret = modbus_get_slave(ctx);
|
C# |
int ret; IntPtr ctx; ret = modbus.GetSlave(ctx); |
Python |
ret = ctypes.c_int ctx = ctypes.POINTER(modbus_t) ret = modbus.modbus_get_slave(ctx) |