CameraInformation.parse constructor

CameraInformation.parse(
  1. ByteData data_
)

Implementation

factory CameraInformation.parse(ByteData data_) {
  if (data_.lengthInBytes < CameraInformation.mavlinkEncodedLength) {
    var len = CameraInformation.mavlinkEncodedLength - data_.lengthInBytes;
    var d = data_.buffer.asUint8List() + List<int>.filled(len, 0);
    data_ = Uint8List.fromList(d).buffer.asByteData();
  }
  var timeBootMs = data_.getUint32(0, Endian.little);
  var firmwareVersion = data_.getUint32(4, Endian.little);
  var focalLength = data_.getFloat32(8, Endian.little);
  var sensorSizeH = data_.getFloat32(12, Endian.little);
  var sensorSizeV = data_.getFloat32(16, Endian.little);
  var flags = data_.getUint32(20, Endian.little);
  var resolutionH = data_.getUint16(24, Endian.little);
  var resolutionV = data_.getUint16(26, Endian.little);
  var camDefinitionVersion = data_.getUint16(28, Endian.little);
  var vendorName = MavlinkMessage.asUint8List(data_, 30, 32);
  var modelName = MavlinkMessage.asUint8List(data_, 62, 32);
  var lensId = data_.getUint8(94);
  var camDefinitionUri = MavlinkMessage.asInt8List(data_, 95, 140);
  var gimbalDeviceId = data_.getUint8(235);

  return CameraInformation(
      timeBootMs: timeBootMs,
      firmwareVersion: firmwareVersion,
      focalLength: focalLength,
      sensorSizeH: sensorSizeH,
      sensorSizeV: sensorSizeV,
      flags: flags,
      resolutionH: resolutionH,
      resolutionV: resolutionV,
      camDefinitionVersion: camDefinitionVersion,
      vendorName: vendorName,
      modelName: modelName,
      lensId: lensId,
      camDefinitionUri: camDefinitionUri,
      gimbalDeviceId: gimbalDeviceId);
}