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
async fn action(
&self,
action: String,
parameters: String
) -> ASCOMResult<String> { ... }
async fn command_blind(&self, command: String, raw: String) -> ASCOMResult { ... }
async fn command_bool(
&self,
command: String,
raw: String
) -> ASCOMResult<bool> { ... }
async fn command_string(
&self,
command: String,
raw: String
) -> ASCOMResult<String> { ... }
async fn connected(&self) -> ASCOMResult<bool> { ... }
async fn set_connected(&self, connected: bool) -> ASCOMResult { ... }
async fn description(&self) -> ASCOMResult<String> { ... }
async fn driver_info(&self) -> ASCOMResult<String> { ... }
async fn driver_version(&self) -> ASCOMResult<String> { ... }
async fn interface_version(&self) -> ASCOMResult<i32> { ... }
async fn name(&self) -> ASCOMResult<String> { ... }
async fn supported_actions(&self) -> ASCOMResult<Vec<String>> { ... }
}Expand description
ASCOM Methods Common To All Devices
Required Methods§
sourcefn static_name(&self) -> &str
fn static_name(&self) -> &str
Static device name for the configured list.
Provided Methods§
sourceasync fn action(
&self,
action: String,
parameters: String
) -> ASCOMResult<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.
sourceasync fn command_blind(&self, command: String, raw: String) -> ASCOMResult
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.
sourceasync fn command_bool(&self, command: String, raw: String) -> ASCOMResult<bool>
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.
sourceasync fn command_string(
&self,
command: String,
raw: String
) -> ASCOMResult<String>
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.
sourceasync fn connected(&self) -> ASCOMResult<bool>
async fn connected(&self) -> ASCOMResult<bool>
Retrieves the connected state of the device
sourceasync fn set_connected(&self, connected: bool) -> ASCOMResult
async fn set_connected(&self, connected: bool) -> ASCOMResult
Sets the connected state of the device
sourceasync fn description(&self) -> ASCOMResult<String>
async fn description(&self) -> ASCOMResult<String>
The description of the device
sourceasync fn driver_info(&self) -> ASCOMResult<String>
async fn driver_info(&self) -> ASCOMResult<String>
The description of the driver
sourceasync fn driver_version(&self) -> ASCOMResult<String>
async fn driver_version(&self) -> ASCOMResult<String>
A string containing only the major and minor version of the driver.
sourceasync fn interface_version(&self) -> ASCOMResult<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.
sourceasync fn name(&self) -> ASCOMResult<String>
async fn name(&self) -> ASCOMResult<String>
The name of the device
sourceasync fn supported_actions(&self) -> ASCOMResult<Vec<String>>
async fn supported_actions(&self) -> ASCOMResult<Vec<String>>
Returns the list of action names supported by this driver.