[][src]Trait ev3dev_lang_rust::core::Sensor

pub trait Sensor: Device {
    fn get_bin_data(&mut self) -> AttributeResult<String> { ... }
fn get_bin_data_format(&mut self) -> AttributeResult<String> { ... }
fn get_decimals(&mut self) -> AttributeResult<isize> { ... }
fn get_fw_version(&mut self) -> AttributeResult<String> { ... }
fn get_mode(&mut self) -> AttributeResult<String> { ... }
fn set_mode(&mut self, mode: String) -> AttributeResult<()> { ... }
fn get_modes(&mut self) -> AttributeResult<Vec<String>> { ... }
fn get_num_values(&mut self) -> AttributeResult<isize> { ... }
fn get_poll_ms(&mut self) -> AttributeResult<isize> { ... }
fn set_poll_ms(&mut self, poll_ms: isize) -> AttributeResult<()> { ... }
fn get_units(&mut self) -> AttributeResult<String> { ... }
fn get_value0(&mut self) -> AttributeResult<isize> { ... }
fn get_value1(&mut self) -> AttributeResult<isize> { ... }
fn get_value2(&mut self) -> AttributeResult<isize> { ... }
fn get_value3(&mut self) -> AttributeResult<isize> { ... }
fn get_value4(&mut self) -> AttributeResult<isize> { ... }
fn get_value5(&mut self) -> AttributeResult<isize> { ... }
fn get_value6(&mut self) -> AttributeResult<isize> { ... }
fn get_value7(&mut self) -> AttributeResult<isize> { ... }
fn get_text_value(&mut self) -> AttributeResult<String> { ... } }

Provided methods

fn get_bin_data(&mut self) -> AttributeResult<String>

Reading the file will give the unscaled raw values in the value<N> attributes. Use bin_data_format, num_values and the individual sensor documentation to determine how to interpret the data.

fn get_bin_data_format(&mut self) -> AttributeResult<String>

Returns the format of the values in bin_data for the current mode. Possible values are:

fn get_decimals(&mut self) -> AttributeResult<isize>

Returns the number of decimal places for the values in the value<N> attributes of the current mode.

fn get_fw_version(&mut self) -> AttributeResult<String>

Returns the firmware version of the sensor if available. Currently only NXT/I2C sensors support this.

fn get_mode(&mut self) -> AttributeResult<String>

Returns the current mode. See the individual sensor documentation for a description of the modes available for each type of sensor.

fn set_mode(&mut self, mode: String) -> AttributeResult<()>

Sets the sensor to that mode. See the individual sensor documentation for a description of the modes available for each type of sensor.

fn get_modes(&mut self) -> AttributeResult<Vec<String>>

Returns a list of the valid modes for the sensor.

fn get_num_values(&mut self) -> AttributeResult<isize>

Returns the number of value<N> attributes that will return a valid value for the current mode.

fn get_poll_ms(&mut self) -> AttributeResult<isize>

Returns the polling period of the sensor in milliseconds. Returns -EOPNOTSUPP if changing polling is not supported. Note: Setting poll_ms too high can cause the input port autodetection to fail. If this happens, use the mode attribute of the port to force the port to nxt-i2c mode. Values must not be negative.

fn set_poll_ms(&mut self, poll_ms: isize) -> AttributeResult<()>

Sets the polling period of the sensor in milliseconds. Setting to 0 disables polling. Note: Setting poll_ms too high can cause the input port autodetection to fail. If this happens, use the mode attribute of the port to force the port to nxt-i2c mode. Values must not be negative.

fn get_units(&mut self) -> AttributeResult<String>

Returns the units of the measured value for the current mode. May return empty string if units are unknown.

fn get_value0(&mut self) -> AttributeResult<isize>

fn get_value1(&mut self) -> AttributeResult<isize>

fn get_value2(&mut self) -> AttributeResult<isize>

fn get_value3(&mut self) -> AttributeResult<isize>

fn get_value4(&mut self) -> AttributeResult<isize>

fn get_value5(&mut self) -> AttributeResult<isize>

fn get_value6(&mut self) -> AttributeResult<isize>

fn get_value7(&mut self) -> AttributeResult<isize>

fn get_text_value(&mut self) -> AttributeResult<String>

Returns a space delimited string representing sensor-specific text values. Returns -EOPNOTSUPP if a sensor does not support text values.

Loading content...

Implementors

impl Sensor for ColorSensor[src]

impl Sensor for GyroSensor[src]

impl Sensor for InfraredSensor[src]

impl Sensor for TouchSensor[src]

impl Sensor for UltrasonicSensor[src]

Loading content...