Trait ascom_alpaca::api::Device

source ·
pub trait Device: Debug + Send + Sync {
Show 14 methods // Required methods fn static_name(&self) -> &str; fn unique_id(&self) -> &str; // Provided methods fn action<'life0, 'async_trait>( &'life0 self, action: String, parameters: String ) -> Pin<Box<dyn Future<Output = ASCOMResult<String>> + Send + 'async_trait>> where Self: 'async_trait, 'life0: 'async_trait { ... } fn command_blind<'life0, 'async_trait>( &'life0 self, command: String, raw: String ) -> Pin<Box<dyn Future<Output = ASCOMResult> + Send + 'async_trait>> where Self: 'async_trait, 'life0: 'async_trait { ... } fn command_bool<'life0, 'async_trait>( &'life0 self, command: String, raw: String ) -> Pin<Box<dyn Future<Output = ASCOMResult<bool>> + Send + 'async_trait>> where Self: 'async_trait, 'life0: 'async_trait { ... } fn command_string<'life0, 'async_trait>( &'life0 self, command: String, raw: String ) -> Pin<Box<dyn Future<Output = ASCOMResult<String>> + Send + 'async_trait>> where Self: 'async_trait, 'life0: 'async_trait { ... } fn connected<'life0, 'async_trait>( &'life0 self ) -> Pin<Box<dyn Future<Output = ASCOMResult<bool>> + Send + 'async_trait>> where Self: 'async_trait, 'life0: 'async_trait { ... } fn set_connected<'life0, 'async_trait>( &'life0 self, connected: bool ) -> Pin<Box<dyn Future<Output = ASCOMResult> + Send + 'async_trait>> where Self: 'async_trait, 'life0: 'async_trait { ... } fn description<'life0, 'async_trait>( &'life0 self ) -> Pin<Box<dyn Future<Output = ASCOMResult<String>> + Send + 'async_trait>> where Self: 'async_trait, 'life0: 'async_trait { ... } fn driver_info<'life0, 'async_trait>( &'life0 self ) -> Pin<Box<dyn Future<Output = ASCOMResult<String>> + Send + 'async_trait>> where Self: 'async_trait, 'life0: 'async_trait { ... } fn driver_version<'life0, 'async_trait>( &'life0 self ) -> Pin<Box<dyn Future<Output = ASCOMResult<String>> + Send + 'async_trait>> where Self: 'async_trait, 'life0: 'async_trait { ... } fn interface_version<'life0, 'async_trait>( &'life0 self ) -> Pin<Box<dyn Future<Output = ASCOMResult<i32>> + Send + 'async_trait>> where Self: 'async_trait, 'life0: 'async_trait { ... } fn name<'life0, 'async_trait>( &'life0 self ) -> Pin<Box<dyn Future<Output = ASCOMResult<String>> + Send + 'async_trait>> where Self: 'async_trait, 'life0: 'async_trait { ... } fn supported_actions<'life0, 'async_trait>( &'life0 self ) -> Pin<Box<dyn Future<Output = ASCOMResult<Vec<String>>> + Send + 'async_trait>> where Self: 'async_trait, 'life0: 'async_trait { ... }
}
Expand description

ASCOM Methods Common To All Devices

Required Methods§

source

fn static_name(&self) -> &str

Static device name for the configured list.

source

fn unique_id(&self) -> &str

Unique ID of this device.

Provided Methods§

source

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

Actions and SupportedActions are a standardised means for drivers to extend functionality beyond the built-in capabilities of the ASCOM device interfaces. The key advantage of using Actions is that drivers can expose any device specific functionality required. The downside is that, in order to use these unique features, every application author would need to create bespoke code to present or exploit them. The Action parameter and return strings are deceptively simple, but can support transmission of arbitrarily complex data structures, for example through JSON encoding.

This capability will be of primary value to:

  • bespoke software and hardware configurations where a single entity controls both the consuming application software and the hardware / driver environment.
  • a group of application and device authors to quickly formulate and try out new interface capabilities without requiring an immediate change to the ASCOM device interface, which will take a lot longer than just agreeing a name, input parameters and a standard response for an Action command.

The list of Action commands supported by a driver can be discovered through the SupportedActions property.

This method should return an error message and NotImplementedException error number (0x400) if the driver just implements the standard ASCOM device methods and has no bespoke, unique, functionality.

Definition before the #[async_trait] expansion:

async fn action(&self, action: String, parameters: String) -> ASCOMResult<String>
source

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

Transmits an arbitrary string to the device and does not wait for a response. Optionally, protocol framing characters may be added to the string before transmission.

Definition before the #[async_trait] expansion:

async fn command_blind(&self, command: String, raw: String) -> ASCOMResult
source

fn command_bool<'life0, 'async_trait>( &'life0 self, command: String, raw: String ) -> Pin<Box<dyn Future<Output = ASCOMResult<bool>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Transmits an arbitrary string to the device and waits for a boolean response. Optionally, protocol framing characters may be added to the string before transmission.

Definition before the #[async_trait] expansion:

async fn command_bool(&self, command: String, raw: String) -> ASCOMResult<bool>
source

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

Transmits an arbitrary string to the device and waits for a string response. Optionally, protocol framing characters may be added to the string before transmission.

Definition before the #[async_trait] expansion:

async fn command_string(&self, command: String, raw: String) -> ASCOMResult<String>
source

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

Retrieves the connected state of the device

Definition before the #[async_trait] expansion:

async fn connected(&self) -> ASCOMResult<bool>
source

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

Sets the connected state of the device

Definition before the #[async_trait] expansion:

async fn set_connected(&self, connected: bool) -> ASCOMResult
source

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

The description of the device

Definition before the #[async_trait] expansion:

async fn description(&self) -> ASCOMResult<String>
source

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

The description of the driver

Definition before the #[async_trait] expansion:

async fn driver_info(&self) -> ASCOMResult<String>
source

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

A string containing only the major and minor version of the driver.

Definition before the #[async_trait] expansion:

async fn driver_version(&self) -> ASCOMResult<String>
source

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

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.

Definition before the #[async_trait] expansion:

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

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

The name of the device

Definition before the #[async_trait] expansion:

async fn name(&self) -> ASCOMResult<String>
source

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

Returns the list of action names supported by this driver.

Definition before the #[async_trait] expansion:

async fn supported_actions(&self) -> ASCOMResult<Vec<String>>

Trait Implementations§

source§

impl Hash for dyn Device

source§

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

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

impl PartialEq for dyn Device

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 Device

Implementors§