pub trait Device {
// Required method
fn get_attribute(&self, name: &str) -> Attribute;
// Provided methods
fn get_address(&self) -> Ev3Result<String> { ... }
fn set_command(&self, command: &str) -> Ev3Result<()> { ... }
fn get_commands(&self) -> Ev3Result<Vec<String>> { ... }
fn get_driver_name(&self) -> Ev3Result<String> { ... }
}
Expand description
The ev3dev device base trait
Required Methods§
Sourcefn get_attribute(&self, name: &str) -> Attribute
fn get_attribute(&self, name: &str) -> Attribute
Returns the attribute wrapper for an attribute name.
Provided Methods§
Sourcefn get_address(&self) -> Ev3Result<String>
fn get_address(&self) -> Ev3Result<String>
Returns the name of the port that the motor is connected to.
Sourcefn set_command(&self, command: &str) -> Ev3Result<()>
fn set_command(&self, command: &str) -> Ev3Result<()>
Sends a command to the device controller.
Sourcefn get_commands(&self) -> Ev3Result<Vec<String>>
fn get_commands(&self) -> Ev3Result<Vec<String>>
Returns a space separated list of commands that are supported by the device controller.
Sourcefn get_driver_name(&self) -> Ev3Result<String>
fn get_driver_name(&self) -> Ev3Result<String>
Returns the name of the driver that provides this device.