Skip to main content

WriteableSensor

Trait WriteableSensor 

Source
pub trait WriteableSensor: Sensor {
    // Provided methods
    fn supported_write_sub_functions(&self) -> Vec<SensorSubFunctionType> { ... }
    fn supported_read_write_sub_functions(&self) -> Vec<SensorSubFunctionType> { ... }
    fn write_raw(
        &self,
        sub_type: SensorSubFunctionType,
        raw_value: &str,
    ) -> Result<(), Error> { ... }
    fn reset_history(&self) -> Result<(), Error> { ... }
    fn write_state(&self, state: &SensorState) -> Result<(), Error> { ... }
    fn write_state_lossy(&self, state: &SensorState) -> Result<(), Error> { ... }
}
Expand description

Base trait that all writeable sensors must implement.

Provided Methods§

Source

fn supported_write_sub_functions(&self) -> Vec<SensorSubFunctionType>

Returns a list of all writeable subfunction types supported by this sensor.

Source

fn supported_read_write_sub_functions(&self) -> Vec<SensorSubFunctionType>

Returns a list of all readable and writeable subfunction types supported by this sensor.

Source

fn write_raw( &self, sub_type: SensorSubFunctionType, raw_value: &str, ) -> Result<(), Error>

Writes the given raw string value to this sensor’s subfunction with the given type. You should usually prefer the specialized write functions like write_enable, because they ensure that no type mismatches occur. Returns an error, if this sensor doesn’t support the subtype.

Source

fn reset_history(&self) -> Result<(), Error>

Resets this sensor’s history. Returns an error if this functionality is not supported by the sensor.

Source

fn write_state(&self, state: &SensorState) -> Result<(), Error>

Writes the given state to this sensor. Returns an error and writes nothing if the given state contains one or more shared_subfunctions that this sensor does not support.

Source

fn write_state_lossy(&self, state: &SensorState) -> Result<(), Error>

Writes the given state to this sensor. All subfunction types contained in the given state that are not supported by this sensor will be ignored.

Dyn Compatibility§

This trait is dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementors§