HerelinkVideoStreamInformation.parse constructor

HerelinkVideoStreamInformation.parse(
  1. ByteData data_
)

Implementation

factory HerelinkVideoStreamInformation.parse(ByteData data_) {
  if (data_.lengthInBytes <
      HerelinkVideoStreamInformation.mavlinkEncodedLength) {
    var len = HerelinkVideoStreamInformation.mavlinkEncodedLength -
        data_.lengthInBytes;
    var d = data_.buffer.asUint8List() + List<int>.filled(len, 0);
    data_ = Uint8List.fromList(d).buffer.asByteData();
  }
  var framerate = data_.getFloat32(0, Endian.little);
  var bitrate = data_.getUint32(4, Endian.little);
  var resolutionH = data_.getUint16(8, Endian.little);
  var resolutionV = data_.getUint16(10, Endian.little);
  var rotation = data_.getUint16(12, Endian.little);
  var cameraId = data_.getUint8(14);
  var status = data_.getUint8(15);
  var uri = MavlinkMessage.asInt8List(data_, 16, 230);

  return HerelinkVideoStreamInformation(
      framerate: framerate,
      bitrate: bitrate,
      resolutionH: resolutionH,
      resolutionV: resolutionV,
      rotation: rotation,
      cameraId: cameraId,
      status: status,
      uri: uri);
}