[−][src]Struct ruuvi_sensor_protocol::SensorValues
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]
id: u16,
value: &[u8]
) -> Result<Self, ParseError>
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]
fn acceleration_vector_as_milli_g(&self) -> Option<AccelerationVector>
[src]
impl BatteryPotential for SensorValues
[src]
fn battery_potential_as_millivolts(&self) -> Option<u16>
[src]
impl Debug for SensorValues
[src]
impl<'_, T> From<&'_ T> for SensorValues where
T: Acceleration + BatteryPotential + TransmitterPower + Humidity + Temperature + Pressure + MovementCounter + MeasurementSequenceNumber + MacAddress,
[src]
T: Acceleration + BatteryPotential + TransmitterPower + Humidity + Temperature + Pressure + MovementCounter + MeasurementSequenceNumber + MacAddress,
fn from(values: &T) -> SensorValues
[src]
impl Humidity for SensorValues
[src]
fn humidity_as_ppm(&self) -> Option<u32>
[src]
impl MacAddress for SensorValues
[src]
impl MeasurementSequenceNumber for SensorValues
[src]
fn measurement_sequence_number(&self) -> Option<u32>
[src]
impl MovementCounter for SensorValues
[src]
fn movement_counter(&self) -> Option<u32>
[src]
impl PartialEq<SensorValues> for SensorValues
[src]
fn eq(&self, other: &SensorValues) -> bool
[src]
fn ne(&self, other: &SensorValues) -> bool
[src]
impl Pressure for SensorValues
[src]
fn pressure_as_pascals(&self) -> Option<u32>
[src]
impl StructuralPartialEq for SensorValues
[src]
impl Temperature for SensorValues
[src]
fn temperature_as_millikelvins(&self) -> Option<u32>
[src]
const ZERO_CELSIUS_IN_MILLIKELVINS: u32
[src]
fn temperature_as_millicelsius(&self) -> Option<i32>
[src]
impl TransmitterPower for SensorValues
[src]
fn tx_power_as_dbm(&self) -> Option<i8>
[src]
Auto Trait Implementations
impl RefUnwindSafe for SensorValues
impl Send for SensorValues
impl Sync for SensorValues
impl Unpin for SensorValues
impl UnwindSafe for SensorValues
Blanket Implementations
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> From<T> for T
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,