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>> { ... }
}
switch
only.Expand description
Switch Specific Methods.
Required Methods§
Sourcefn max_switch<'this: 'async_trait, 'async_trait>(
&'this self,
) -> ASCOMResultFuture<'async_trait, i32>
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.
Sourcefn get_switch<'this: 'async_trait, 'async_trait>(
&'this self,
id: i32,
) -> ASCOMResultFuture<'async_trait, bool>
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.
Sourcefn get_switch_description<'this: 'async_trait, 'async_trait>(
&'this self,
id: i32,
) -> ASCOMResultFuture<'async_trait, String>
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.
Sourcefn get_switch_name<'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>
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.
Sourcefn get_switch_value<'this: 'async_trait, 'async_trait>(
&'this self,
id: i32,
) -> ASCOMResultFuture<'async_trait, f64>
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.
Sourcefn min_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>
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.
Sourcefn max_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>
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.
Sourcefn state_change_complete<'this: 'async_trait, 'async_trait>(
&'this self,
id: i32,
) -> ASCOMResultFuture<'async_trait, bool>
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.
Sourcefn switch_step<'this: 'async_trait, 'async_trait>(
&'this self,
id: i32,
) -> ASCOMResultFuture<'async_trait, f64>
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§
Sourcefn can_async<'this: 'async_trait, 'async_trait>(
&'this self,
id: i32,
) -> ASCOMResultFuture<'async_trait, bool>
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.
Sourcefn can_write<'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>
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.
Sourcefn set_async<'this: 'async_trait, 'async_trait>(
&'this self,
id: i32,
state: bool,
) -> ASCOMResultFuture<'async_trait, ()>
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.
Sourcefn set_async_value<'this: 'async_trait, 'async_trait>(
&'this self,
id: i32,
value: f64,
) -> ASCOMResultFuture<'async_trait, ()>
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.
Sourcefn set_switch<'this: 'async_trait, 'async_trait>(
&'this self,
id: i32,
state: bool,
) -> ASCOMResultFuture<'async_trait, ()>
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.
Sourcefn set_switch_name<'this: 'async_trait, 'async_trait>(
&'this self,
id: i32,
name: String,
) -> ASCOMResultFuture<'async_trait, ()>
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.
Sourcefn set_switch_value<'this: 'async_trait, 'async_trait>(
&'this self,
id: i32,
value: f64,
) -> ASCOMResultFuture<'async_trait, ()>
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.
Sourcefn interface_version<'this: 'async_trait, 'async_trait>(
&'this self,
) -> ASCOMResultFuture<'async_trait, i32>
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.
Sourcefn device_state<'this: 'async_trait, 'async_trait>(
&'this self,
) -> ASCOMResultFuture<'async_trait, TimestampedDeviceState<DeviceState>>
fn device_state<'this: 'async_trait, 'async_trait>( &'this self, ) -> ASCOMResultFuture<'async_trait, TimestampedDeviceState<DeviceState>>
Return all operational properties of this device.