[][src]Struct ruuvi_sensor_protocol::SensorValues

pub struct SensorValues { /* fields omitted */ }

Represents a set of values read from sensors on the device

Methods

impl SensorValues[src]

pub fn from_manufacturer_specific_data(
    id: u16,
    value: &[u8]
) -> Result<Self, ParseError>
[src]

Parses sensor values from the payload encoded in manufacturer specific data -field. The function returns a ParseError if the id does not match the exptected id in the manufacturer specific data, or the format of the value is not supported. At the moment only versions 3 and 5 of the format are supported.

Examples

use ruuvi_sensor_protocol::{SensorValues, Temperature};

let id = 0x0499;
let value = &[
    0x03, 0x17, 0x01, 0x45, 0x35, 0x58, 0x03, 0xE8, 0x04, 0xE7, 0x05, 0xE6, 0x08, 0x86,
];
let values = SensorValues::from_manufacturer_specific_data(id, value)?;
assert_eq!(values.temperature_as_millicelsius(), Some(1690));

Trait Implementations

impl Acceleration for SensorValues[src]

impl BatteryPotential for SensorValues[src]

impl Debug for SensorValues[src]

impl<'_, T> From<&'_ T> for SensorValues where
    T: Acceleration + BatteryPotential + TransmitterPower + Humidity + Temperature + Pressure + MovementCounter + MeasurementSequenceNumber + MacAddress
[src]

impl Humidity for SensorValues[src]

impl MacAddress for SensorValues[src]

impl MeasurementSequenceNumber for SensorValues[src]

impl MovementCounter for SensorValues[src]

impl PartialEq<SensorValues> for SensorValues[src]

impl Pressure for SensorValues[src]

impl StructuralPartialEq for SensorValues[src]

impl Temperature for SensorValues[src]

impl TransmitterPower for SensorValues[src]

Auto Trait Implementations

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.