ascom_alpaca/api/
dome.rs

1use super::Device;
2use crate::{ASCOMError, ASCOMResult};
3use macro_rules_attribute::apply;
4use num_enum::{IntoPrimitive, TryFromPrimitive};
5use serde_repr::{Deserialize_repr, Serialize_repr};
6
7/// Dome Specific Methods.
8#[apply(rpc_trait)]
9pub trait Dome: Device + Send + Sync {
10    /// The dome altitude (degrees, horizon zero and increasing positive to 90 zenith).
11    #[http("altitude", method = Get, device_state = "Altitude")]
12    async fn altitude(&self) -> ASCOMResult<f64> {
13        Err(ASCOMError::NOT_IMPLEMENTED)
14    }
15
16    /// Indicates whether the dome is in the home position.
17    ///
18    /// This is normally used following a FindHome()  operation. The value is reset with any azimuth slew operation that moves the dome away from the home position. AtHome may also become true durng normal slew operations, if the dome passes through the home position and the dome controller hardware is capable of detecting that; or at the end of a slew operation if the dome comes to rest at the home position.
19    #[http("athome", method = Get, device_state = "AtHome")]
20    async fn at_home(&self) -> ASCOMResult<bool> {
21        Err(ASCOMError::NOT_IMPLEMENTED)
22    }
23
24    /// True if the dome is in the programmed park position.
25    ///
26    /// Set only following a Park() operation and reset with any slew operation.
27    #[http("atpark", method = Get, device_state = "AtPark")]
28    async fn at_park(&self) -> ASCOMResult<bool> {
29        Err(ASCOMError::NOT_IMPLEMENTED)
30    }
31
32    /// Returns the dome azimuth (degrees, North zero and increasing clockwise, i.e., 90 East, 180 South, 270 West).
33    #[http("azimuth", method = Get, device_state = "Azimuth")]
34    async fn azimuth(&self) -> ASCOMResult<f64> {
35        Err(ASCOMError::NOT_IMPLEMENTED)
36    }
37
38    /// True if the dome can move to the home position.
39    #[http("canfindhome", method = Get)]
40    async fn can_find_home(&self) -> ASCOMResult<bool> {
41        Ok(false)
42    }
43
44    /// True if the dome is capable of programmed parking (Park() method).
45    #[http("canpark", method = Get)]
46    async fn can_park(&self) -> ASCOMResult<bool> {
47        Ok(false)
48    }
49
50    /// True if driver is capable of setting the dome altitude.
51    #[http("cansetaltitude", method = Get)]
52    async fn can_set_altitude(&self) -> ASCOMResult<bool> {
53        Ok(false)
54    }
55
56    /// True if driver is capable of setting the dome azimuth.
57    #[http("cansetazimuth", method = Get)]
58    async fn can_set_azimuth(&self) -> ASCOMResult<bool> {
59        Ok(false)
60    }
61
62    /// True if driver is capable of setting the dome park position.
63    #[http("cansetpark", method = Get)]
64    async fn can_set_park(&self) -> ASCOMResult<bool> {
65        Ok(false)
66    }
67
68    /// True if driver is capable of automatically operating shutter.
69    #[http("cansetshutter", method = Get)]
70    async fn can_set_shutter(&self) -> ASCOMResult<bool> {
71        Ok(false)
72    }
73
74    /// True if driver is capable of slaving to a telescope.
75    #[http("canslave", method = Get)]
76    async fn can_slave(&self) -> ASCOMResult<bool> {
77        Ok(false)
78    }
79
80    /// True if driver is capable of synchronizing the dome azimuth position using the SyncToAzimuth(Double) method.
81    #[http("cansyncazimuth", method = Get)]
82    async fn can_sync_azimuth(&self) -> ASCOMResult<bool> {
83        Ok(false)
84    }
85
86    /// Returns the status of the dome shutter or roll-off roof.
87    #[http("shutterstatus", method = Get, device_state = "ShutterStatus")]
88    async fn shutter_status(&self) -> ASCOMResult<ShutterState> {
89        Err(ASCOMError::NOT_IMPLEMENTED)
90    }
91
92    /// True if the dome is slaved to the telescope in its hardware, else False.
93    #[http("slaved", method = Get)]
94    async fn slaved(&self) -> ASCOMResult<bool> {
95        Err(ASCOMError::NOT_IMPLEMENTED)
96    }
97
98    /// Sets the current subframe height.
99    #[http("slaved", method = Put)]
100    async fn set_slaved(&self, #[http("Slaved")] slaved: bool) -> ASCOMResult<()> {
101        Err(ASCOMError::NOT_IMPLEMENTED)
102    }
103
104    /// True if any part of the dome is currently moving, False if all dome components are steady.
105    #[http("slewing", method = Get, device_state = "Slewing")]
106    async fn slewing(&self) -> ASCOMResult<bool>;
107
108    /// Calling this method will immediately disable hardware slewing (Slaved will become False).
109    #[http("abortslew", method = Put)]
110    async fn abort_slew(&self) -> ASCOMResult<()>;
111
112    /// Start to close the shutter or otherwise shield the telescope from the sky.
113    #[http("closeshutter", method = Put)]
114    async fn close_shutter(&self) -> ASCOMResult<()> {
115        Err(ASCOMError::NOT_IMPLEMENTED)
116    }
117
118    /// After Home position is established initializes Azimuth to the default value and sets the AtHome flag.
119    #[http("findhome", method = Put)]
120    async fn find_home(&self) -> ASCOMResult<()> {
121        Err(ASCOMError::NOT_IMPLEMENTED)
122    }
123
124    /// Start to open shutter or otherwise expose telescope to the sky.
125    #[http("openshutter", method = Put)]
126    async fn open_shutter(&self) -> ASCOMResult<()> {
127        Err(ASCOMError::NOT_IMPLEMENTED)
128    }
129
130    /// Start slewing the dome to its park position.
131    #[http("park", method = Put)]
132    async fn park(&self) -> ASCOMResult<()> {
133        Err(ASCOMError::NOT_IMPLEMENTED)
134    }
135
136    /// Set the current azimuth, altitude position of dome to be the park position.
137    #[http("setpark", method = Put)]
138    async fn set_park(&self) -> ASCOMResult<()> {
139        Err(ASCOMError::NOT_IMPLEMENTED)
140    }
141
142    /// Start slewing so that requested viewing altitude (degrees) is available for observing.
143    #[http("slewtoaltitude", method = Put)]
144    async fn slew_to_altitude(&self, #[http("Altitude")] altitude: f64) -> ASCOMResult<()> {
145        Err(ASCOMError::NOT_IMPLEMENTED)
146    }
147
148    /// Start slewing so that requested viewing azimuth (degrees) is available for observing.
149    #[http("slewtoazimuth", method = Put)]
150    async fn slew_to_azimuth(&self, #[http("Azimuth")] azimuth: f64) -> ASCOMResult<()> {
151        Err(ASCOMError::NOT_IMPLEMENTED)
152    }
153
154    /// Synchronize the current azimuth of the dome (degrees) to the given azimuth.
155    #[http("synctoazimuth", method = Put)]
156    async fn sync_to_azimuth(&self, #[http("Azimuth")] azimuth: f64) -> ASCOMResult<()> {
157        Err(ASCOMError::NOT_IMPLEMENTED)
158    }
159
160    /// This method returns the version of the ASCOM device interface contract to which this device complies.
161    ///
162    /// 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.
163    #[http("interfaceversion", method = Get)]
164    async fn interface_version(&self) -> ASCOMResult<u16> {
165        Ok(3)
166    }
167}
168
169/// Indicates the current state of the shutter or roof.
170#[derive(
171    Debug,
172    PartialEq,
173    Eq,
174    Clone,
175    Copy,
176    Serialize_repr,
177    Deserialize_repr,
178    TryFromPrimitive,
179    IntoPrimitive,
180)]
181#[repr(i32)]
182pub enum ShutterState {
183    /// The shutter or roof is open.
184    Open = 0,
185
186    /// The shutter or roof is closed.
187    Closed = 1,
188
189    /// The shutter or roof is opening.
190    Opening = 2,
191
192    /// The shutter or roof is closing.
193    Closing = 3,
194
195    /// The shutter or roof has encountered a problem.
196    Error = 4,
197}