getReadRequest method

ModbusReadRequest getReadRequest({
  1. int? unitId,
  2. Duration? responseTimeout,
  3. ModbusEndianness? endianness,
})

Gets a read request from this element

Implementation

ModbusReadRequest getReadRequest(
    {int? unitId, Duration? responseTimeout, ModbusEndianness? endianness}) {
  var pdu = Uint8List(5);
  ByteData.view(pdu.buffer)
    ..setUint8(0, type.readFunction.code)
    ..setUint16(1, address)
    ..setUint16(3, byteCount > 1 ? byteCount ~/ 2 : 1);
  return ModbusReadRequest(this, pdu, type.readFunction,
      unitId: unitId,
      responseTimeout: responseTimeout,
      endianness: endianness ?? this.endianness);
}