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