ResourceRequest.parse constructor

ResourceRequest.parse(
  1. ByteData data_
)

Implementation

factory ResourceRequest.parse(ByteData data_) {
  if (data_.lengthInBytes < ResourceRequest.mavlinkEncodedLength) {
    var len = ResourceRequest.mavlinkEncodedLength - data_.lengthInBytes;
    var d = data_.buffer.asUint8List() + List<int>.filled(len, 0);
    data_ = Uint8List.fromList(d).buffer.asByteData();
  }
  var requestId = data_.getUint8(0);
  var uriType = data_.getUint8(1);
  var uri = MavlinkMessage.asUint8List(data_, 2, 120);
  var transferType = data_.getUint8(122);
  var storage = MavlinkMessage.asUint8List(data_, 123, 120);

  return ResourceRequest(
      requestId: requestId,
      uriType: uriType,
      uri: uri,
      transferType: transferType,
      storage: storage);
}