OpenDroneIdAuthentication.parse constructor

OpenDroneIdAuthentication.parse(
  1. ByteData data_
)

Implementation

factory OpenDroneIdAuthentication.parse(ByteData data_) {
  if (data_.lengthInBytes < OpenDroneIdAuthentication.mavlinkEncodedLength) {
    var len =
        OpenDroneIdAuthentication.mavlinkEncodedLength - data_.lengthInBytes;
    var d = data_.buffer.asUint8List() + List<int>.filled(len, 0);
    data_ = Uint8List.fromList(d).buffer.asByteData();
  }
  var timestamp = data_.getUint32(0, Endian.little);
  var targetSystem = data_.getUint8(4);
  var targetComponent = data_.getUint8(5);
  var idOrMac = MavlinkMessage.asUint8List(data_, 6, 20);
  var authenticationType = data_.getUint8(26);
  var dataPage = data_.getUint8(27);
  var lastPageIndex = data_.getUint8(28);
  var length = data_.getUint8(29);
  var authenticationData = MavlinkMessage.asUint8List(data_, 30, 23);

  return OpenDroneIdAuthentication(
      timestamp: timestamp,
      targetSystem: targetSystem,
      targetComponent: targetComponent,
      idOrMac: idOrMac,
      authenticationType: authenticationType,
      dataPage: dataPage,
      lastPageIndex: lastPageIndex,
      length: length,
      authenticationData: authenticationData);
}