Trait ascom_alpaca::api::Switch

source ·
pub trait Switch: Device + Send + Sync {
    // Provided methods
    fn max_switch<'life0, 'async_trait>(
        &'life0 self
    ) -> Pin<Box<dyn Future<Output = ASCOMResult<i32>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait { ... }
    fn can_write<'life0, 'async_trait>(
        &'life0 self,
        id: u32
    ) -> Pin<Box<dyn Future<Output = ASCOMResult<bool>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait { ... }
    fn get_switch<'life0, 'async_trait>(
        &'life0 self,
        id: u32
    ) -> Pin<Box<dyn Future<Output = ASCOMResult<bool>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait { ... }
    fn get_switch_description<'life0, 'async_trait>(
        &'life0 self,
        id: u32
    ) -> Pin<Box<dyn Future<Output = ASCOMResult<String>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait { ... }
    fn get_switch_name<'life0, 'async_trait>(
        &'life0 self,
        id: u32
    ) -> Pin<Box<dyn Future<Output = ASCOMResult<String>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait { ... }
    fn get_switch_value<'life0, 'async_trait>(
        &'life0 self,
        id: u32
    ) -> Pin<Box<dyn Future<Output = ASCOMResult<f64>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait { ... }
    fn min_switch_value<'life0, 'async_trait>(
        &'life0 self,
        id: u32
    ) -> Pin<Box<dyn Future<Output = ASCOMResult<f64>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait { ... }
    fn max_switch_value<'life0, 'async_trait>(
        &'life0 self,
        id: u32
    ) -> Pin<Box<dyn Future<Output = ASCOMResult<f64>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait { ... }
    fn set_switch<'life0, 'async_trait>(
        &'life0 self,
        id: u32,
        state: bool
    ) -> Pin<Box<dyn Future<Output = ASCOMResult> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait { ... }
    fn set_switch_name<'life0, 'async_trait>(
        &'life0 self,
        id: u32,
        name: String
    ) -> Pin<Box<dyn Future<Output = ASCOMResult> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait { ... }
    fn set_switch_value<'life0, 'async_trait>(
        &'life0 self,
        id: u32,
        value: f64
    ) -> Pin<Box<dyn Future<Output = ASCOMResult> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait { ... }
    fn switch_step<'life0, 'async_trait>(
        &'life0 self,
        id: u32
    ) -> Pin<Box<dyn Future<Output = ASCOMResult<f64>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait { ... }
}
Available on crate feature switch only.
Expand description

Switch Specific Methods

Provided Methods§

source

fn max_switch<'life0, 'async_trait>( &'life0 self ) -> Pin<Box<dyn Future<Output = ASCOMResult<i32>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Returns the number of switch devices managed by this driver. Devices are numbered from 0 to MaxSwitch - 1

Definition before the #[async_trait] expansion:

async fn max_switch(&self) -> ASCOMResult<i32>
source

fn can_write<'life0, 'async_trait>( &'life0 self, id: u32 ) -> Pin<Box<dyn Future<Output = ASCOMResult<bool>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Reports if the specified switch device can be written to, default true. This is false if the device cannot be written to, for example a limit switch or a sensor. Devices are numbered from 0 to MaxSwitch - 1

Definition before the #[async_trait] expansion:

async fn can_write(&self, id: u32) -> ASCOMResult<bool>
source

fn get_switch<'life0, 'async_trait>( &'life0 self, id: u32 ) -> Pin<Box<dyn Future<Output = ASCOMResult<bool>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Return the state of switch device id as a boolean. Devices are numbered from 0 to MaxSwitch - 1

Definition before the #[async_trait] expansion:

async fn get_switch(&self, id: u32) -> ASCOMResult<bool>
source

fn get_switch_description<'life0, 'async_trait>( &'life0 self, id: u32 ) -> Pin<Box<dyn Future<Output = ASCOMResult<String>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Gets the description of the specified switch device. This is to allow a fuller description of the device to be returned, for example for a tool tip. Devices are numbered from 0 to MaxSwitch - 1

Definition before the #[async_trait] expansion:

async fn get_switch_description(&self, id: u32) -> ASCOMResult<String>
source

fn get_switch_name<'life0, 'async_trait>( &'life0 self, id: u32 ) -> Pin<Box<dyn Future<Output = ASCOMResult<String>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Gets the name of the specified switch device. Devices are numbered from 0 to MaxSwitch - 1

Definition before the #[async_trait] expansion:

async fn get_switch_name(&self, id: u32) -> ASCOMResult<String>
source

fn get_switch_value<'life0, 'async_trait>( &'life0 self, id: u32 ) -> Pin<Box<dyn Future<Output = ASCOMResult<f64>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Gets the value of the specified switch device as a double. Devices are numbered from 0 to MaxSwitch - 1, The value of this switch is expected to be between MinSwitchValue and MaxSwitchValue.

Definition before the #[async_trait] expansion:

async fn get_switch_value(&self, id: u32) -> ASCOMResult<f64>
source

fn min_switch_value<'life0, 'async_trait>( &'life0 self, id: u32 ) -> Pin<Box<dyn Future<Output = ASCOMResult<f64>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Gets the minimum value of the specified switch device as a double. Devices are numbered from 0 to MaxSwitch - 1.

Definition before the #[async_trait] expansion:

async fn min_switch_value(&self, id: u32) -> ASCOMResult<f64>
source

fn max_switch_value<'life0, 'async_trait>( &'life0 self, id: u32 ) -> Pin<Box<dyn Future<Output = ASCOMResult<f64>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Gets the maximum value of the specified switch device as a double. Devices are numbered from 0 to MaxSwitch - 1.

Definition before the #[async_trait] expansion:

async fn max_switch_value(&self, id: u32) -> ASCOMResult<f64>
source

fn set_switch<'life0, 'async_trait>( &'life0 self, id: u32, state: bool ) -> Pin<Box<dyn Future<Output = ASCOMResult> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Sets a switch controller device to the specified state, true or false.

Definition before the #[async_trait] expansion:

async fn set_switch(&self, id: u32, state: bool) -> ASCOMResult
source

fn set_switch_name<'life0, 'async_trait>( &'life0 self, id: u32, name: String ) -> Pin<Box<dyn Future<Output = ASCOMResult> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Sets a switch device name to the specified value.

Definition before the #[async_trait] expansion:

async fn set_switch_name(&self, id: u32, name: String) -> ASCOMResult
source

fn set_switch_value<'life0, 'async_trait>( &'life0 self, id: u32, value: f64 ) -> Pin<Box<dyn Future<Output = ASCOMResult> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Sets a switch device value to the specified value.

Definition before the #[async_trait] expansion:

async fn set_switch_value(&self, id: u32, value: f64) -> ASCOMResult
source

fn switch_step<'life0, 'async_trait>( &'life0 self, id: u32 ) -> Pin<Box<dyn Future<Output = ASCOMResult<f64>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Returns the step size that this device supports (the difference between successive values of the device). Devices are numbered from 0 to MaxSwitch - 1.

Definition before the #[async_trait] expansion:

async fn switch_step(&self, id: u32) -> ASCOMResult<f64>

Trait Implementations§

source§

impl Hash for dyn Switch

source§

fn hash<H: Hasher>(&self, state: &mut H)

Feeds this value into the given Hasher. Read more
source§

impl PartialEq for dyn Switch

source§

fn eq(&self, other: &Self) -> bool

This method tests for self and other values to be equal, and is used by ==.
1.0.0 · source§

fn ne(&self, other: &Rhs) -> bool

This method tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
source§

impl Eq for dyn Switch

Implementors§