ascom_alpaca/api/
rotator.rs

1use super::Device;
2use crate::{ASCOMError, ASCOMResult};
3use macro_rules_attribute::apply;
4
5/// Rotator Specific Methods.
6#[apply(rpc_trait)]
7pub trait Rotator: Device + Send + Sync {
8    /// True if the Rotator supports the Reverse method.
9    #[http("canreverse", method = Get)]
10    async fn can_reverse(&self) -> ASCOMResult<bool> {
11        Ok(false)
12    }
13
14    /// True if the rotator is currently moving to a new position.
15    ///
16    /// False if the focuser is stationary.
17    #[http("ismoving", method = Get, device_state = IsMoving)]
18    async fn is_moving(&self) -> ASCOMResult<bool>;
19
20    /// Returns the raw mechanical position of the rotator in degrees.
21    #[http("mechanicalposition", method = Get, device_state = MechanicalPosition)]
22    async fn mechanical_position(&self) -> ASCOMResult<f64>;
23
24    /// Current instantaneous Rotator position, in degrees.
25    #[http("position", method = Get, device_state = Position)]
26    async fn position(&self) -> ASCOMResult<f64>;
27
28    /// Returns the rotator’s Reverse state.
29    #[http("reverse", method = Get)]
30    async fn reverse(&self) -> ASCOMResult<bool>;
31
32    /// Sets the rotator’s Reverse state.
33    #[http("reverse", method = Put)]
34    async fn set_reverse(&self, #[http("Reverse")] reverse: bool) -> ASCOMResult<()>;
35
36    /// The minimum StepSize, in degrees.
37    #[http("stepsize", method = Get)]
38    async fn step_size(&self) -> ASCOMResult<f64> {
39        Err(ASCOMError::NOT_IMPLEMENTED)
40    }
41
42    /// The destination position angle for Move() and MoveAbsolute().
43    #[http("targetposition", method = Get)]
44    async fn target_position(&self) -> ASCOMResult<f64>;
45
46    /// Immediately stop any Rotator motion due to a previous Move or MoveAbsolute method call.
47    #[http("halt", method = Put)]
48    async fn halt(&self) -> ASCOMResult<()> {
49        Err(ASCOMError::NOT_IMPLEMENTED)
50    }
51
52    /// Causes the rotator to move Position degrees relative to the current Position value.
53    #[http("move", method = Put)]
54    async fn move_(&self, #[http("Position")] position: f64) -> ASCOMResult<()>;
55
56    /// Causes the rotator to move the absolute position of Position degrees.
57    #[http("moveabsolute", method = Put)]
58    async fn move_absolute(&self, #[http("Position")] position: f64) -> ASCOMResult<()>;
59
60    /// Causes the rotator to move the mechanical position of Position degrees.
61    #[http("movemechanical", method = Put)]
62    async fn move_mechanical(&self, #[http("Position")] position: f64) -> ASCOMResult<()>;
63
64    /// Causes the rotator to sync to the position of Position degrees.
65    #[http("sync", method = Put)]
66    async fn sync(&self, #[http("Position")] position: f64) -> ASCOMResult<()>;
67
68    /// This method returns the version of the ASCOM device interface contract to which this device complies.
69    ///
70    /// 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.
71    #[http("interfaceversion", method = Get)]
72    async fn interface_version(&self) -> ASCOMResult<i32> {
73        Ok(4_i32)
74    }
75}