| | |
| | | return res?.IsSuccess == true; |
| | | } |
| | | |
| | | public bool ReadDIInt(string address, out int? res, out string msg) |
| | | public bool ReadDIInt16(string address, out int res, out string msg) |
| | | { |
| | | var result = client?.ReadInt32($"x=2;{address}"); |
| | | var result = client?.ReadInt16($"x=2;{address}"); |
| | | msg = result?.Message; |
| | | res = result?.Content; |
| | | res = result?.Content ?? 0; |
| | | return result?.IsSuccess == true; |
| | | } |
| | | |
| | | public bool ReadDOInt(string address, out int? res, out string msg) |
| | | public bool ReadDOInt16(string address, out int res, out string msg) |
| | | { |
| | | var result = client?.ReadInt32(address); |
| | | var result = client?.ReadInt16(address); |
| | | msg = result?.Message; |
| | | res = result?.Content; |
| | | res = result?.Content ?? 0; |
| | | return result?.IsSuccess == true; |
| | | } |
| | | |
| | | public bool WriteInt(string address, int value, out string msg) |
| | | public bool WriteInt16(string address, short value, out string msg) |
| | | { |
| | | msg = string.Empty; |
| | | var res = client?.Write(address, value); |
| | | msg = res.Message; |
| | | return res?.IsSuccess == true; |
| | | } |
| | | |
| | | public bool ReadUInt16(string address, out ushort res, out string msg) |
| | | { |
| | | var result = client?.ReadUInt16(address); |
| | | msg = result?.Message; |
| | | res = result?.Content ?? 0; |
| | | return result?.IsSuccess == true; |
| | | } |
| | | |
| | | public bool WriteUInt16(string address, ushort value, out string msg) |
| | | { |
| | | msg = string.Empty; |
| | | var res = client?.Write(address, value); |