ascom_alpaca/api/
focuser.rs

1use super::Device;
2use crate::{ASCOMError, ASCOMResult};
3use macro_rules_attribute::apply;
4
5/// Focuser Specific Methods.
6#[apply(rpc_trait)]
7pub trait Focuser: Device + Send + Sync {
8    /// True if the focuser is capable of absolute position; that is, being commanded to a specific step location.
9    #[http("absolute", method = Get)]
10    async fn absolute(&self) -> ASCOMResult<bool>;
11
12    /// True if the focuser is currently moving to a new position.
13    ///
14    /// False if the focuser is stationary.
15    #[http("ismoving", method = Get, device_state = IsMoving)]
16    async fn is_moving(&self) -> ASCOMResult<bool>;
17
18    /// Maximum increment size allowed by the focuser; i.e. the maximum number of steps allowed in one move operation.
19    #[http("maxincrement", method = Get)]
20    async fn max_increment(&self) -> ASCOMResult<i32>;
21
22    /// Maximum step position permitted.
23    #[http("maxstep", method = Get)]
24    async fn max_step(&self) -> ASCOMResult<i32>;
25
26    /// Current focuser position, in steps.
27    #[http("position", method = Get, device_state = Position)]
28    async fn position(&self) -> ASCOMResult<i32> {
29        Err(ASCOMError::NOT_IMPLEMENTED)
30    }
31
32    /// Step size (microns) for the focuser.
33    #[http("stepsize", method = Get)]
34    async fn step_size(&self) -> ASCOMResult<f64> {
35        Err(ASCOMError::NOT_IMPLEMENTED)
36    }
37
38    /// Gets the state of temperature compensation mode (if available), else always False.
39    #[http("tempcomp", method = Get)]
40    async fn temp_comp(&self) -> ASCOMResult<bool>;
41
42    /// Sets the state of temperature compensation mode.
43    #[http("tempcomp", method = Put)]
44    async fn set_temp_comp(&self, #[http("TempComp")] temp_comp: bool) -> ASCOMResult<()> {
45        Err(ASCOMError::NOT_IMPLEMENTED)
46    }
47
48    /// True if focuser has temperature compensation available.
49    #[http("tempcompavailable", method = Get)]
50    async fn temp_comp_available(&self) -> ASCOMResult<bool>;
51
52    /// Current ambient temperature as measured by the focuser.
53    #[http("temperature", method = Get, device_state = Temperature)]
54    async fn temperature(&self) -> ASCOMResult<f64> {
55        Err(ASCOMError::NOT_IMPLEMENTED)
56    }
57
58    /// Immediately stop any focuser motion due to a previous Move(Int32) method call.
59    #[http("halt", method = Put)]
60    async fn halt(&self) -> ASCOMResult<()> {
61        Err(ASCOMError::NOT_IMPLEMENTED)
62    }
63
64    /// Starts moving the focuser by the specified amount or to the specified position depending on the value of the Absolute property.
65    #[http("move", method = Put)]
66    async fn move_(&self, #[http("Position")] position: i32) -> 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}