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#[apply(rpc_trait)]
9pub trait Dome: Device + Send + Sync {
10 #[http("altitude", method = Get, device_state = "Altitude")]
12 async fn altitude(&self) -> ASCOMResult<f64> {
13 Err(ASCOMError::NOT_IMPLEMENTED)
14 }
15
16 #[http("athome", method = Get, device_state = "AtHome")]
20 async fn at_home(&self) -> ASCOMResult<bool> {
21 Err(ASCOMError::NOT_IMPLEMENTED)
22 }
23
24 #[http("atpark", method = Get, device_state = "AtPark")]
28 async fn at_park(&self) -> ASCOMResult<bool> {
29 Err(ASCOMError::NOT_IMPLEMENTED)
30 }
31
32 #[http("azimuth", method = Get, device_state = "Azimuth")]
34 async fn azimuth(&self) -> ASCOMResult<f64> {
35 Err(ASCOMError::NOT_IMPLEMENTED)
36 }
37
38 #[http("canfindhome", method = Get)]
40 async fn can_find_home(&self) -> ASCOMResult<bool> {
41 Ok(false)
42 }
43
44 #[http("canpark", method = Get)]
46 async fn can_park(&self) -> ASCOMResult<bool> {
47 Ok(false)
48 }
49
50 #[http("cansetaltitude", method = Get)]
52 async fn can_set_altitude(&self) -> ASCOMResult<bool> {
53 Ok(false)
54 }
55
56 #[http("cansetazimuth", method = Get)]
58 async fn can_set_azimuth(&self) -> ASCOMResult<bool> {
59 Ok(false)
60 }
61
62 #[http("cansetpark", method = Get)]
64 async fn can_set_park(&self) -> ASCOMResult<bool> {
65 Ok(false)
66 }
67
68 #[http("cansetshutter", method = Get)]
70 async fn can_set_shutter(&self) -> ASCOMResult<bool> {
71 Ok(false)
72 }
73
74 #[http("canslave", method = Get)]
76 async fn can_slave(&self) -> ASCOMResult<bool> {
77 Ok(false)
78 }
79
80 #[http("cansyncazimuth", method = Get)]
82 async fn can_sync_azimuth(&self) -> ASCOMResult<bool> {
83 Ok(false)
84 }
85
86 #[http("shutterstatus", method = Get, device_state = "ShutterStatus")]
88 async fn shutter_status(&self) -> ASCOMResult<ShutterState> {
89 Err(ASCOMError::NOT_IMPLEMENTED)
90 }
91
92 #[http("slaved", method = Get)]
94 async fn slaved(&self) -> ASCOMResult<bool> {
95 Err(ASCOMError::NOT_IMPLEMENTED)
96 }
97
98 #[http("slaved", method = Put)]
100 async fn set_slaved(&self, #[http("Slaved")] slaved: bool) -> ASCOMResult<()> {
101 Err(ASCOMError::NOT_IMPLEMENTED)
102 }
103
104 #[http("slewing", method = Get, device_state = "Slewing")]
106 async fn slewing(&self) -> ASCOMResult<bool>;
107
108 #[http("abortslew", method = Put)]
110 async fn abort_slew(&self) -> ASCOMResult<()>;
111
112 #[http("closeshutter", method = Put)]
114 async fn close_shutter(&self) -> ASCOMResult<()> {
115 Err(ASCOMError::NOT_IMPLEMENTED)
116 }
117
118 #[http("findhome", method = Put)]
120 async fn find_home(&self) -> ASCOMResult<()> {
121 Err(ASCOMError::NOT_IMPLEMENTED)
122 }
123
124 #[http("openshutter", method = Put)]
126 async fn open_shutter(&self) -> ASCOMResult<()> {
127 Err(ASCOMError::NOT_IMPLEMENTED)
128 }
129
130 #[http("park", method = Put)]
132 async fn park(&self) -> ASCOMResult<()> {
133 Err(ASCOMError::NOT_IMPLEMENTED)
134 }
135
136 #[http("setpark", method = Put)]
138 async fn set_park(&self) -> ASCOMResult<()> {
139 Err(ASCOMError::NOT_IMPLEMENTED)
140 }
141
142 #[http("slewtoaltitude", method = Put)]
144 async fn slew_to_altitude(&self, #[http("Altitude")] altitude: f64) -> ASCOMResult<()> {
145 Err(ASCOMError::NOT_IMPLEMENTED)
146 }
147
148 #[http("slewtoazimuth", method = Put)]
150 async fn slew_to_azimuth(&self, #[http("Azimuth")] azimuth: f64) -> ASCOMResult<()> {
151 Err(ASCOMError::NOT_IMPLEMENTED)
152 }
153
154 #[http("synctoazimuth", method = Put)]
156 async fn sync_to_azimuth(&self, #[http("Azimuth")] azimuth: f64) -> ASCOMResult<()> {
157 Err(ASCOMError::NOT_IMPLEMENTED)
158 }
159
160 #[http("interfaceversion", method = Get)]
164 async fn interface_version(&self) -> ASCOMResult<u16> {
165 Ok(3)
166 }
167}
168
169#[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 Open = 0,
185
186 Closed = 1,
188
189 Opening = 2,
191
192 Closing = 3,
194
195 Error = 4,
197}