r_modbus_write static method

Tuple4<int, int, int, int>? r_modbus_write(
  1. Uint8List msg
)

Implementation

static Tuple4<int,int,int,int>? r_modbus_write(Uint8List msg){

  assert(msg.length == 8);

  var tmpdata = msg.sublist(0);

  var crc = msg[msg.length-2]<<8 | msg[msg.length-1];

  if (crc16(tmpdata) == crc ){
    return Tuple4(msg[0],msg[1], byte2int(msg[3], msg[2]),byte2int(msg[5], msg[4]) );
  }else{
    print('crc failed.');
    return null;
  }
}