HygrometerSensor.parse constructor

HygrometerSensor.parse(
  1. ByteData data_
)

Implementation

factory HygrometerSensor.parse(ByteData data_) {
  if (data_.lengthInBytes < HygrometerSensor.mavlinkEncodedLength) {
    var len = HygrometerSensor.mavlinkEncodedLength - data_.lengthInBytes;
    var d = data_.buffer.asUint8List() + List<int>.filled(len, 0);
    data_ = Uint8List.fromList(d).buffer.asByteData();
  }
  var temperature = data_.getInt16(0, Endian.little);
  var humidity = data_.getUint16(2, Endian.little);
  var id = data_.getUint8(4);

  return HygrometerSensor(
      temperature: temperature, humidity: humidity, id: id);
}