Struct Armband

Source
pub struct Armband(/* private fields */);
Expand description

Myo Armband

Implementations§

Source§

impl Armband

Source

pub fn raw_id(&self) -> usize

Raw ID

Examples found in repository?
examples/eventlog.rs (line 34)
30    fn on_arm_synced(&mut self, event: myo::ArmSyncedEvent) -> myo::HandlerResult
31    {
32        let device = event.device();
33        println!("{} {} Arm Synced! on {:?}, +x {:?}, warm? {:?}, estimated device rotation {} rad",
34            event.timestamp(), device.raw_id(), event.arm(), event.xdirection(), event.warmup_state(), event.rotation_on_arm());
35        /// Request RSSI and Battery Level immediately.
36        device.request_rssi().unwrap();
37        device.request_battery_level().unwrap();
38        // device.set_stream_emg(true).unwrap();
39        myo::HandlerResult::Continue
40    }
41    fn on_arm_unsynced(&mut self, event: myo::ArmUnsyncedEvent) -> myo::HandlerResult
42    {
43        let device = event.device();
44        println!("{} {} Arm Unsynced!", event.timestamp(), device.raw_id());
45        device.set_stream_emg(false).unwrap();
46        myo::HandlerResult::Continue
47    }
48    /*fn on_orientation_data(&mut self, event: myo::OrientationEvent) -> myo::HandlerResult
49    {
50        println!("{} {} Orientation Update: qrot {:?} acc {:?} gyro {:?}", event.timestamp(), event.device().raw_id(),
51            event.q_orientation(), event.v_accelerometer(), event.v_gyroscope());
52        myo::HandlerResult::Continue
53    }*/
54    fn on_pose(&mut self, event: myo::PoseEvent) -> myo::HandlerResult
55    {
56        println!("{} {} Pose Update: {:?}", event.timestamp(), event.device().raw_id(), event.pose());
57        myo::HandlerResult::Continue
58    }
59    fn on_rssi_value(&mut self, event: myo::RSSIEvent) -> myo::HandlerResult
60    {
61        println!("{} {} RSSI: {}", event.timestamp(), event.device().raw_id(), event.rssi());
62        myo::HandlerResult::Continue
63    }
64    fn on_unlocked(&mut self, event: myo::UnlockedEvent) -> myo::HandlerResult
65    {
66        println!("{} {} Unlocked!", event.timestamp(), event.device().raw_id());
67        myo::HandlerResult::Continue
68    }
69    fn on_locked(&mut self, event: myo::LockedEvent) -> myo::HandlerResult
70    {
71        println!("{} {} Locked!", event.timestamp(), event.device().raw_id());
72        myo::HandlerResult::Continue
73    }
74    fn on_emg_data(&mut self, event: myo::EMGEvent) -> myo::HandlerResult
75    {
76        println!("{} {} EMG: {:?}", event.timestamp(), event.device().raw_id(), event.emgs());
77        myo::HandlerResult::Continue
78    }
79    fn on_battery_level(&mut self, event: myo::BatteryLevelEvent) -> myo::HandlerResult
80    {
81        println!("{} {} Battery Level: {}", event.timestamp(), event.device().raw_id(), event.battery_level());
82        myo::HandlerResult::Continue
83    }
84    fn on_warmup_completed(&mut self, event: myo::WarmupCompletedEvent) -> myo::HandlerResult
85    {
86        println!("{} {} Warmup Completed! {:?}", event.timestamp(), event.device().raw_id(), event.result());
87        myo::HandlerResult::Continue
88    }
Source

pub fn vibrate(&self, vtype: VibrationType) -> Result<()>

Source

pub fn request_rssi(&self) -> Result<()>

Examples found in repository?
examples/eventlog.rs (line 36)
30    fn on_arm_synced(&mut self, event: myo::ArmSyncedEvent) -> myo::HandlerResult
31    {
32        let device = event.device();
33        println!("{} {} Arm Synced! on {:?}, +x {:?}, warm? {:?}, estimated device rotation {} rad",
34            event.timestamp(), device.raw_id(), event.arm(), event.xdirection(), event.warmup_state(), event.rotation_on_arm());
35        /// Request RSSI and Battery Level immediately.
36        device.request_rssi().unwrap();
37        device.request_battery_level().unwrap();
38        // device.set_stream_emg(true).unwrap();
39        myo::HandlerResult::Continue
40    }
Source

pub fn request_battery_level(&self) -> Result<()>

Examples found in repository?
examples/eventlog.rs (line 37)
30    fn on_arm_synced(&mut self, event: myo::ArmSyncedEvent) -> myo::HandlerResult
31    {
32        let device = event.device();
33        println!("{} {} Arm Synced! on {:?}, +x {:?}, warm? {:?}, estimated device rotation {} rad",
34            event.timestamp(), device.raw_id(), event.arm(), event.xdirection(), event.warmup_state(), event.rotation_on_arm());
35        /// Request RSSI and Battery Level immediately.
36        device.request_rssi().unwrap();
37        device.request_battery_level().unwrap();
38        // device.set_stream_emg(true).unwrap();
39        myo::HandlerResult::Continue
40    }
Source

pub fn set_stream_emg(&self, stream_emg_data: bool) -> Result<()>

Examples found in repository?
examples/eventlog.rs (line 45)
41    fn on_arm_unsynced(&mut self, event: myo::ArmUnsyncedEvent) -> myo::HandlerResult
42    {
43        let device = event.device();
44        println!("{} {} Arm Unsynced!", event.timestamp(), device.raw_id());
45        device.set_stream_emg(false).unwrap();
46        myo::HandlerResult::Continue
47    }
Source

pub fn lock(&self) -> Result<()>

Source

pub fn unlock(&self, unlock_type: UnlockType) -> Result<()>

Source

pub fn notify_user_action(&self) -> Result<()>

Trait Implementations§

Source§

impl Debug for Armband

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

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

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

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

Performs the conversion.