public override OpResult <short> ReadInt16(string address) { var result = new OpResult <short>(); var encoder = new FinsReadCommand(); var decoder = new FinsReadResponseCommand(); Read(address, result, encoder, decoder, (r, en, de) => { var val = decoder.DataAsInt16; if (result.CheckNotNull(val, SR.DecodeError)) { result.Content = val.Value; } }); return(result); }
public override OpResult <byte[]> ReadUInt16Bytes(string address, int count) { var result = new OpResult <byte[]>(); var encoder = new FinsReadCommand() { Length = (ushort)(1 * count) }; var decoder = new FinsReadResponseCommand(); Read(address, result, encoder, decoder, (r, en, de) => { if (result.CheckNotNull(decoder.Data, SR.DecodeError)) { result.Content = decoder.Data; } }); return(result); }
public override OpResult <bool> ReadBoolean(string address) { var result = new OpResult <bool>(); var encoder = new FinsReadCommand() { Length = 1 }; var decoder = new FinsReadResponseCommand(); Read(address, result, encoder, decoder, (r, en, de) => { var val = decoder.DataAsBoolean; if (result.CheckNotNull(val, SR.DecodeError)) { result.Content = val.Value; } }); return(result); }
public override OpResult <uint[]> ReadUInt32(string address, int count) { var result = new OpResult <uint[]>(); var encoder = new FinsReadCommand() { Length = (ushort)(2 * count) }; var decoder = new FinsReadResponseCommand(); Read(address, result, encoder, decoder, (r, en, de) => { var val = decoder.DataAsUInt32Array; if (result.CheckNotNull(val, SR.DecodeError)) { result.Content = val; } }); return(result); }