Device

Trait Device 

Source
pub trait Device:
    Debug
    + Send
    + Sync {
Show 15 methods // Required methods fn connected<'this: 'async_trait, 'async_trait>( &'this self, ) -> ASCOMResultFuture<'async_trait, bool>; fn set_connected<'this: 'async_trait, 'async_trait>( &'this self, connected: bool, ) -> ASCOMResultFuture<'async_trait, ()>; fn description<'this: 'async_trait, 'async_trait>( &'this self, ) -> ASCOMResultFuture<'async_trait, String>; fn driver_info<'this: 'async_trait, 'async_trait>( &'this self, ) -> ASCOMResultFuture<'async_trait, String>; fn driver_version<'this: 'async_trait, 'async_trait>( &'this self, ) -> ASCOMResultFuture<'async_trait, String>; fn static_name(&self) -> &str; fn unique_id(&self) -> &str; // Provided methods fn action<'this: 'async_trait, 'async_trait>( &'this self, action: String, parameters: String, ) -> ASCOMResultFuture<'async_trait, String> { ... } fn command_blind<'this: 'async_trait, 'async_trait>( &'this self, command: String, raw: String, ) -> ASCOMResultFuture<'async_trait, ()> { ... } fn command_bool<'this: 'async_trait, 'async_trait>( &'this self, command: String, raw: String, ) -> ASCOMResultFuture<'async_trait, bool> { ... } fn command_string<'this: 'async_trait, 'async_trait>( &'this self, command: String, raw: String, ) -> ASCOMResultFuture<'async_trait, String> { ... } fn connecting<'this: 'async_trait, 'async_trait>( &'this self, ) -> ASCOMResultFuture<'async_trait, bool> { ... } fn name<'this: 'async_trait, 'async_trait>( &'this self, ) -> ASCOMResultFuture<'async_trait, String> { ... } fn supported_actions<'this: 'async_trait, 'async_trait>( &'this self, ) -> ASCOMResultFuture<'async_trait, Vec<String>> { ... } fn setup(&self) -> BoxFuture<'_, Result<String>> { ... }
}
Expand description

ASCOM Methods Common To All Devices.

Required Methods§

Source

fn connected<'this: 'async_trait, 'async_trait>( &'this self, ) -> ASCOMResultFuture<'async_trait, bool>

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

Retrieves the connected state of the device.

Source

fn set_connected<'this: 'async_trait, 'async_trait>( &'this self, connected: bool, ) -> ASCOMResultFuture<'async_trait, ()>

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

Sets the connected state of the device.

Source

fn description<'this: 'async_trait, 'async_trait>( &'this self, ) -> ASCOMResultFuture<'async_trait, String>

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

The description of the device.

Source

fn driver_info<'this: 'async_trait, 'async_trait>( &'this self, ) -> ASCOMResultFuture<'async_trait, String>

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

The description of the driver.

Source

fn driver_version<'this: 'async_trait, 'async_trait>( &'this self, ) -> ASCOMResultFuture<'async_trait, String>

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

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

This must be in the form “n.n”.

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<'this: 'async_trait, 'async_trait>( &'this self, action: String, parameters: String, ) -> ASCOMResultFuture<'async_trait, String>

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

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.

Source

fn command_blind<'this: 'async_trait, 'async_trait>( &'this self, command: String, raw: String, ) -> ASCOMResultFuture<'async_trait, ()>

👎Deprecated: Use the more flexible Action and SupportedActions mechanic.
async fn command_blind(&self, command: String, raw: String) -> ASCOMResult<()>

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.

Source

fn command_bool<'this: 'async_trait, 'async_trait>( &'this self, command: String, raw: String, ) -> ASCOMResultFuture<'async_trait, bool>

👎Deprecated: Use the more flexible Action and SupportedActions mechanic.
async fn command_bool(&self, command: String, raw: String) -> ASCOMResult<bool>

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.

Source

fn command_string<'this: 'async_trait, 'async_trait>( &'this self, command: String, raw: String, ) -> ASCOMResultFuture<'async_trait, String>

👎Deprecated: Use the more flexible Action and SupportedActions mechanic.
async fn command_string(&self, command: String, raw: String) -> ASCOMResult<String>

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.

Source

fn connecting<'this: 'async_trait, 'async_trait>( &'this self, ) -> ASCOMResultFuture<'async_trait, bool>

async fn connecting(&self) -> ASCOMResult<bool>

Returns true while the device is connecting or disconnecting.

Platform 7 onward.

Source

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

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

The name of the device.

Source

fn supported_actions<'this: 'async_trait, 'async_trait>( &'this self, ) -> ASCOMResultFuture<'async_trait, Vec<String>>

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

Returns the list of action names supported by this driver.

Source

fn setup(&self) -> BoxFuture<'_, Result<String>>

async fn setup(&self) -> eyre::Result<String>

Web page user interface that enables device specific configuration to be set for each available device.

The server should implement this to return HTML string. You can use Self::action to store the configuration.

Note: on the client side you almost never want to just retrieve HTML to show it in the browser, as that breaks relative URLs. Use the /{device_type}/{device_number}/setup URL instead.

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

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 Device

Implementors§