FencePoint.parse constructor

FencePoint.parse(
  1. ByteData data_
)

Implementation

factory FencePoint.parse(ByteData data_) {
  if (data_.lengthInBytes < FencePoint.mavlinkEncodedLength) {
    var len = FencePoint.mavlinkEncodedLength - data_.lengthInBytes;
    var d = data_.buffer.asUint8List() + List<int>.filled(len, 0);
    data_ = Uint8List.fromList(d).buffer.asByteData();
  }
  var lat = data_.getFloat32(0, Endian.little);
  var lng = data_.getFloat32(4, Endian.little);
  var targetSystem = data_.getUint8(8);
  var targetComponent = data_.getUint8(9);
  var idx = data_.getUint8(10);
  var count = data_.getUint8(11);

  return FencePoint(
      lat: lat,
      lng: lng,
      targetSystem: targetSystem,
      targetComponent: targetComponent,
      idx: idx,
      count: count);
}