Switch

Trait Switch 

Source
pub trait Switch:
    Device
    + Send
    + Sync {
Show 18 methods // Required methods fn max_switch<'this: 'async_trait, 'async_trait>( &'this self, ) -> ASCOMResultFuture<'async_trait, i32>; fn get_switch<'this: 'async_trait, 'async_trait>( &'this self, id: i32, ) -> ASCOMResultFuture<'async_trait, bool>; fn get_switch_description<'this: 'async_trait, 'async_trait>( &'this self, id: i32, ) -> ASCOMResultFuture<'async_trait, String>; fn get_switch_name<'this: 'async_trait, 'async_trait>( &'this self, id: i32, ) -> ASCOMResultFuture<'async_trait, String>; fn get_switch_value<'this: 'async_trait, 'async_trait>( &'this self, id: i32, ) -> ASCOMResultFuture<'async_trait, f64>; fn min_switch_value<'this: 'async_trait, 'async_trait>( &'this self, id: i32, ) -> ASCOMResultFuture<'async_trait, f64>; fn max_switch_value<'this: 'async_trait, 'async_trait>( &'this self, id: i32, ) -> ASCOMResultFuture<'async_trait, f64>; fn state_change_complete<'this: 'async_trait, 'async_trait>( &'this self, id: i32, ) -> ASCOMResultFuture<'async_trait, bool>; fn switch_step<'this: 'async_trait, 'async_trait>( &'this self, id: i32, ) -> ASCOMResultFuture<'async_trait, f64>; // Provided methods fn can_async<'this: 'async_trait, 'async_trait>( &'this self, id: i32, ) -> ASCOMResultFuture<'async_trait, bool> { ... } fn can_write<'this: 'async_trait, 'async_trait>( &'this self, id: i32, ) -> ASCOMResultFuture<'async_trait, bool> { ... } fn set_async<'this: 'async_trait, 'async_trait>( &'this self, id: i32, state: bool, ) -> ASCOMResultFuture<'async_trait, ()> { ... } fn set_async_value<'this: 'async_trait, 'async_trait>( &'this self, id: i32, value: f64, ) -> ASCOMResultFuture<'async_trait, ()> { ... } fn set_switch<'this: 'async_trait, 'async_trait>( &'this self, id: i32, state: bool, ) -> ASCOMResultFuture<'async_trait, ()> { ... } fn set_switch_name<'this: 'async_trait, 'async_trait>( &'this self, id: i32, name: String, ) -> ASCOMResultFuture<'async_trait, ()> { ... } fn set_switch_value<'this: 'async_trait, 'async_trait>( &'this self, id: i32, value: f64, ) -> ASCOMResultFuture<'async_trait, ()> { ... } fn interface_version<'this: 'async_trait, 'async_trait>( &'this self, ) -> ASCOMResultFuture<'async_trait, i32> { ... } fn device_state<'this: 'async_trait, 'async_trait>( &'this self, ) -> ASCOMResultFuture<'async_trait, TimestampedDeviceState<DeviceState>> { ... }
}
Available on crate feature switch only.
Expand description

Switch Specific Methods.

Required Methods§

Source

fn max_switch<'this: 'async_trait, 'async_trait>( &'this self, ) -> ASCOMResultFuture<'async_trait, i32>

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

Returns the number of switch devices managed by this driver.

Devices are numbered from 0 to MaxSwitch - 1.

Source

fn get_switch<'this: 'async_trait, 'async_trait>( &'this self, id: i32, ) -> ASCOMResultFuture<'async_trait, bool>

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

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

Source

fn get_switch_description<'this: 'async_trait, 'async_trait>( &'this self, id: i32, ) -> ASCOMResultFuture<'async_trait, String>

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

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.

Source

fn get_switch_name<'this: 'async_trait, 'async_trait>( &'this self, id: i32, ) -> ASCOMResultFuture<'async_trait, String>

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

Gets the name of the specified switch device.

Devices are numbered from 0 to MaxSwitch - 1.

Source

fn get_switch_value<'this: 'async_trait, 'async_trait>( &'this self, id: i32, ) -> ASCOMResultFuture<'async_trait, f64>

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

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.

Source

fn min_switch_value<'this: 'async_trait, 'async_trait>( &'this self, id: i32, ) -> ASCOMResultFuture<'async_trait, f64>

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

Gets the minimum value of the specified switch device as a double.

Devices are numbered from 0 to MaxSwitch - 1.

Source

fn max_switch_value<'this: 'async_trait, 'async_trait>( &'this self, id: i32, ) -> ASCOMResultFuture<'async_trait, f64>

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

Gets the maximum value of the specified switch device as a double.

Devices are numbered from 0 to MaxSwitch - 1.

Source

fn state_change_complete<'this: 'async_trait, 'async_trait>( &'this self, id: i32, ) -> ASCOMResultFuture<'async_trait, bool>

async fn state_change_complete(&self, id: i32) -> ASCOMResult<bool>

True if the state of the specified switch is changing, otherwise false.

ISwitchV3 and later.

Source

fn switch_step<'this: 'async_trait, 'async_trait>( &'this self, id: i32, ) -> ASCOMResultFuture<'async_trait, f64>

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

Returns the step size that this device supports (the difference between successive values of the device).

Devices are numbered from 0 to MaxSwitch - 1.

Provided Methods§

Source

fn can_async<'this: 'async_trait, 'async_trait>( &'this self, id: i32, ) -> ASCOMResultFuture<'async_trait, bool>

async fn can_async(&self, id: i32) -> ASCOMResult<bool>

This endpoint must be implemented and indicates whether the given switch can operate asynchronously.

ISwitchV3 and later.

Source

fn can_write<'this: 'async_trait, 'async_trait>( &'this self, id: i32, ) -> ASCOMResultFuture<'async_trait, bool>

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

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.

Source

fn set_async<'this: 'async_trait, 'async_trait>( &'this self, id: i32, state: bool, ) -> ASCOMResultFuture<'async_trait, ()>

async fn set_async(&self, id: i32, state: bool) -> ASCOMResult<()>

This is an asynchronous method that must return as soon as the state change operation has been successfully started, with StateChangeComplete(Int16) for the given switch Id = False. After the state change has completed StateChangeComplete(Int16) becomes True.

ISwitchV3 and later.

Source

fn set_async_value<'this: 'async_trait, 'async_trait>( &'this self, id: i32, value: f64, ) -> ASCOMResultFuture<'async_trait, ()>

async fn set_async_value(&self, id: i32, value: f64) -> ASCOMResult<()>

This is an asynchronous method that must return as soon as the state change operation has been successfully started, with StateChangeComplete(Int16) for the given switch Id = False. After the state change has completed StateChangeComplete(Int16) becomes True.

ISwitchV3 and later.

Source

fn set_switch<'this: 'async_trait, 'async_trait>( &'this self, id: i32, state: bool, ) -> ASCOMResultFuture<'async_trait, ()>

async fn set_switch(&self, id: i32, state: bool) -> ASCOMResult<()>

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

Source

fn set_switch_name<'this: 'async_trait, 'async_trait>( &'this self, id: i32, name: String, ) -> ASCOMResultFuture<'async_trait, ()>

async fn set_switch_name(&self, id: i32, name: String) -> ASCOMResult<()>

Sets a switch device name to the specified value.

Source

fn set_switch_value<'this: 'async_trait, 'async_trait>( &'this self, id: i32, value: f64, ) -> ASCOMResultFuture<'async_trait, ()>

async fn set_switch_value(&self, id: i32, value: f64) -> ASCOMResult<()>

Sets a switch device value to the specified value.

Source

fn interface_version<'this: 'async_trait, 'async_trait>( &'this self, ) -> ASCOMResultFuture<'async_trait, i32>

async fn interface_version(&self) -> ASCOMResult<i32>

This method returns the version of the ASCOM device interface contract to which this device complies.

Only one interface version is current at a moment in time and all new devices should be built to the latest interface version. Applications can choose which device interface versions they support and it is in their interest to support previous versions as well as the current version to ensure thay can use the largest number of devices.

Source

fn device_state<'this: 'async_trait, 'async_trait>( &'this self, ) -> ASCOMResultFuture<'async_trait, TimestampedDeviceState<DeviceState>>

Return all operational properties of this device.

See What is the “read all” feature and what are its rules?.

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

Tests for self and other values to be equal, and is used by ==.
1.0.0 · Source§

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

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§