Struct bsec::Bsec[][src]

pub struct Bsec<S: BmeSensor, C: Clock, B: Borrow<C>> { /* fields omitted */ }
Expand description

Handle to encapsulates the Bosch BSEC library and related state.

Implementations

impl<S: BmeSensor, C: Clock, B: Borrow<C>> Bsec<S, C, B>[src]

pub fn init(bme: S, clock: B) -> Result<Self, Error<S::Error>>[src]

Initialize the Bosch BSEC library and return a handle to interact with it.

  • bme: BmeSensor implementation to communicate with the BME sensor.
  • clock: Clock implementation to obtain timestamps.

pub fn update_subscription(
    &mut self,
    requests: &[SubscriptionRequest]
) -> Result<Vec<RequiredInput>, Error<S::Error>>
[src]

Change subscription to virtual sensor outputs.

  • requests: Configuration of virtual sensors and their sample rates to subscribe to.

Returns a vector describing physical sensor and sampling rates required as input to the BSEC algorithm.

pub fn next_measurement(&self) -> i64[src]

Returns the timestamp when the next measurement has to be triggered.

pub fn start_next_measurement(&mut self) -> Result<Duration, Error<S::Error>>[src]

Trigger the next measurement.

Returns the duration until the measurement becomes available. Call Self::process_last_measurement after the duration has passed.

pub fn process_last_measurement(
    &mut self
) -> Result<Vec<Output>, Error<S::Error>>
[src]

Process the last triggered measurement.

Call this method after the duration returned from a call to Self::start_next_measurement has passed.

Returns a vector of virtual sensor outputs calculated by the Bosch BSEC library.

pub fn get_state(&self) -> Result<Vec<u8>, Error<S::Error>>[src]

Get the current raw Bosch BSEC state, e.g. to persist it before shutdown.

pub fn set_state(&mut self, state: &[u8]) -> Result<(), Error<S::Error>>[src]

Set the raw Bosch BSEC state, e.g. to restore persisted state after shutdown.

pub fn get_configuration(&self) -> Result<Vec<u8>, Error<S::Error>>[src]

Get the current (raw) Bosch BSEC configuration.

pub fn set_configuration(
    &mut self,
    serialized_settings: &[u8]
) -> Result<(), Error<S::Error>>
[src]

Set the (raw) Bosch BSEC configuration.

Your copy of the Bosch BSEC library should contain several different configuration files. See the Bosch BSEC documentation for more information.

pub fn reset_output(
    &mut self,
    sensor: OutputKind
) -> Result<(), Error<S::Error>>
[src]

See documentation of bsec_reset_output in the Bosch BSEC documentation.

Trait Implementations

impl<S: BmeSensor, C: Clock, B: Borrow<C>> Drop for Bsec<S, C, B>[src]

fn drop(&mut self)[src]

Executes the destructor for this type. Read more

Auto Trait Implementations

impl<S, C, B> RefUnwindSafe for Bsec<S, C, B> where
    B: RefUnwindSafe,
    C: RefUnwindSafe,
    S: RefUnwindSafe

impl<S, C, B> Send for Bsec<S, C, B> where
    B: Send,
    C: Send,
    S: Send

impl<S, C, B> Sync for Bsec<S, C, B> where
    B: Sync,
    C: Sync,
    S: Sync

impl<S, C, B> Unpin for Bsec<S, C, B> where
    B: Unpin,
    C: Unpin,
    S: Unpin

impl<S, C, B> UnwindSafe for Bsec<S, C, B> where
    B: UnwindSafe,
    C: UnwindSafe,
    S: UnwindSafe

Blanket Implementations

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

pub fn type_id(&self) -> TypeId[src]

Gets the TypeId of self. Read more

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

pub fn borrow(&self) -> &T[src]

Immutably borrows from an owned value. Read more

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

pub fn borrow_mut(&mut self) -> &mut T[src]

Mutably borrows from an owned value. Read more

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

pub fn from(t: T) -> T[src]

Performs the conversion.

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

pub fn into(self) -> U[src]

Performs the conversion.

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.

pub fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>[src]

Performs the conversion.

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.

pub fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>[src]

Performs the conversion.