pub struct Bsec<S: BmeSensor, C: Clock, B: Borrow<C>> { /* private fields */ }
Expand description
Handle to encapsulates the Bosch BSEC library and related state.
Implementations§
source§impl<S: BmeSensor, C: Clock, B: Borrow<C>> Bsec<S, C, B>
impl<S: BmeSensor, C: Clock, B: Borrow<C>> Bsec<S, C, B>
sourcepub fn update_subscription(
&mut self,
requests: &[SubscriptionRequest]
) -> Result<Vec<RequiredInput>, Error<S::Error>>
pub fn update_subscription( &mut self, requests: &[SubscriptionRequest] ) -> Result<Vec<RequiredInput>, Error<S::Error>>
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.
sourcepub fn next_measurement(&self) -> i64
pub fn next_measurement(&self) -> i64
Returns the timestamp when the next measurement has to be triggered.
sourcepub fn start_next_measurement(&mut self) -> Result<Duration, Error<S::Error>>
pub fn start_next_measurement(&mut self) -> Result<Duration, Error<S::Error>>
Trigger the next measurement.
Returns the duration until the measurement becomes available. Call
Self::process_last_measurement
after the duration has passed.
sourcepub fn process_last_measurement(
&mut self
) -> Result<Vec<Output>, Error<S::Error>>
pub fn process_last_measurement( &mut self ) -> Result<Vec<Output>, Error<S::Error>>
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.
sourcepub fn get_state(&self) -> Result<Vec<u8>, Error<S::Error>>
pub fn get_state(&self) -> Result<Vec<u8>, Error<S::Error>>
Get the current raw Bosch BSEC state, e.g. to persist it before shutdown.
sourcepub fn set_state(&mut self, state: &[u8]) -> Result<(), Error<S::Error>>
pub fn set_state(&mut self, state: &[u8]) -> Result<(), Error<S::Error>>
Set the raw Bosch BSEC state, e.g. to restore persisted state after shutdown.
sourcepub fn get_configuration(&self) -> Result<Vec<u8>, Error<S::Error>>
pub fn get_configuration(&self) -> Result<Vec<u8>, Error<S::Error>>
Get the current (raw) Bosch BSEC configuration.
sourcepub fn set_configuration(
&mut self,
serialized_settings: &[u8]
) -> Result<(), Error<S::Error>>
pub fn set_configuration( &mut self, serialized_settings: &[u8] ) -> Result<(), Error<S::Error>>
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.
sourcepub fn reset_output(&mut self, sensor: OutputKind) -> Result<(), Error<S::Error>>
pub fn reset_output(&mut self, sensor: OutputKind) -> Result<(), Error<S::Error>>
See documentation of bsec_reset_output
in the Bosch BSEC
documentation.