DeviceOpRead.parse constructor

DeviceOpRead.parse(
  1. ByteData data_
)

Implementation

factory DeviceOpRead.parse(ByteData data_) {
  if (data_.lengthInBytes < DeviceOpRead.mavlinkEncodedLength) {
    var len = DeviceOpRead.mavlinkEncodedLength - data_.lengthInBytes;
    var d = data_.buffer.asUint8List() + List<int>.filled(len, 0);
    data_ = Uint8List.fromList(d).buffer.asByteData();
  }
  var requestId = data_.getUint32(0, Endian.little);
  var targetSystem = data_.getUint8(4);
  var targetComponent = data_.getUint8(5);
  var bustype = data_.getUint8(6);
  var bus = data_.getUint8(7);
  var address = data_.getUint8(8);
  var busname = MavlinkMessage.asInt8List(data_, 9, 40);
  var regstart = data_.getUint8(49);
  var count = data_.getUint8(50);
  var bank = data_.getUint8(51);

  return DeviceOpRead(
      requestId: requestId,
      targetSystem: targetSystem,
      targetComponent: targetComponent,
      bustype: bustype,
      bus: bus,
      address: address,
      busname: busname,
      regstart: regstart,
      count: count,
      bank: bank);
}