1#[derive(Clone, PartialEq, ::prost::Message)]
2pub struct SetPitchAndYawRequest {
3 #[prost(float, tag = "1")]
5 pub pitch_deg: f32,
6 #[prost(float, tag = "2")]
8 pub yaw_deg: f32,
9}
10#[derive(Clone, PartialEq, ::prost::Message)]
11pub struct SetPitchAndYawResponse {
12 #[prost(message, optional, tag = "1")]
13 pub gimbal_result: ::core::option::Option<GimbalResult>,
14}
15#[derive(Clone, PartialEq, ::prost::Message)]
16pub struct SetModeRequest {
17 #[prost(enumeration = "GimbalMode", tag = "1")]
19 pub gimbal_mode: i32,
20}
21#[derive(Clone, PartialEq, ::prost::Message)]
22pub struct SetModeResponse {
23 #[prost(message, optional, tag = "1")]
24 pub gimbal_result: ::core::option::Option<GimbalResult>,
25}
26#[derive(Clone, PartialEq, ::prost::Message)]
27pub struct SetRoiLocationRequest {
28 #[prost(double, tag = "1")]
30 pub latitude_deg: f64,
31 #[prost(double, tag = "2")]
33 pub longitude_deg: f64,
34 #[prost(float, tag = "3")]
36 pub altitude_m: f32,
37}
38#[derive(Clone, PartialEq, ::prost::Message)]
39pub struct SetRoiLocationResponse {
40 #[prost(message, optional, tag = "1")]
41 pub gimbal_result: ::core::option::Option<GimbalResult>,
42}
43#[derive(Clone, PartialEq, ::prost::Message)]
45pub struct GimbalResult {
46 #[prost(enumeration = "gimbal_result::Result", tag = "1")]
48 pub result: i32,
49 #[prost(string, tag = "2")]
51 pub result_str: ::prost::alloc::string::String,
52}
53pub mod gimbal_result {
55 #[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord, ::prost::Enumeration)]
57 #[repr(i32)]
58 pub enum Result {
59 Unknown = 0,
61 Success = 1,
63 Error = 2,
65 Timeout = 3,
67 Unsupported = 4,
69 }
70}
71#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord, ::prost::Enumeration)]
73#[repr(i32)]
74pub enum GimbalMode {
75 YawFollow = 0,
77 YawLock = 1,
79}
80#[doc = r" Generated client implementations."]
81pub mod gimbal_service_client {
82 #![allow(unused_variables, dead_code, missing_docs, clippy::let_unit_value)]
83 use tonic::codegen::*;
84 #[doc = " Provide control over a gimbal."]
85 #[derive(Debug, Clone)]
86 pub struct GimbalServiceClient<T> {
87 inner: tonic::client::Grpc<T>,
88 }
89 impl GimbalServiceClient<tonic::transport::Channel> {
90 #[doc = r" Attempt to create a new client by connecting to a given endpoint."]
91 pub async fn connect<D>(dst: D) -> Result<Self, tonic::transport::Error>
92 where
93 D: std::convert::TryInto<tonic::transport::Endpoint>,
94 D::Error: Into<StdError>,
95 {
96 let conn = tonic::transport::Endpoint::new(dst)?.connect().await?;
97 Ok(Self::new(conn))
98 }
99 }
100 impl<T> GimbalServiceClient<T>
101 where
102 T: tonic::client::GrpcService<tonic::body::BoxBody>,
103 T::ResponseBody: Body + Send + Sync + 'static,
104 T::Error: Into<StdError>,
105 <T::ResponseBody as Body>::Error: Into<StdError> + Send,
106 {
107 pub fn new(inner: T) -> Self {
108 let inner = tonic::client::Grpc::new(inner);
109 Self { inner }
110 }
111 pub fn with_interceptor<F>(
112 inner: T,
113 interceptor: F,
114 ) -> GimbalServiceClient<InterceptedService<T, F>>
115 where
116 F: tonic::service::Interceptor,
117 T: tonic::codegen::Service<
118 http::Request<tonic::body::BoxBody>,
119 Response = http::Response<
120 <T as tonic::client::GrpcService<tonic::body::BoxBody>>::ResponseBody,
121 >,
122 >,
123 <T as tonic::codegen::Service<http::Request<tonic::body::BoxBody>>>::Error:
124 Into<StdError> + Send + Sync,
125 {
126 GimbalServiceClient::new(InterceptedService::new(inner, interceptor))
127 }
128 #[doc = r" Compress requests with `gzip`."]
129 #[doc = r""]
130 #[doc = r" This requires the server to support it otherwise it might respond with an"]
131 #[doc = r" error."]
132 pub fn send_gzip(mut self) -> Self {
133 self.inner = self.inner.send_gzip();
134 self
135 }
136 #[doc = r" Enable decompressing responses with `gzip`."]
137 pub fn accept_gzip(mut self) -> Self {
138 self.inner = self.inner.accept_gzip();
139 self
140 }
141 #[doc = ""]
142 #[doc = ""]
143 #[doc = " Set gimbal pitch and yaw angles."]
144 #[doc = ""]
145 #[doc = " This sets the desired pitch and yaw angles of a gimbal."]
146 #[doc = " Will return when the command is accepted, however, it might"]
147 #[doc = " take the gimbal longer to actually be set to the new angles."]
148 pub async fn set_pitch_and_yaw(
149 &mut self,
150 request: impl tonic::IntoRequest<super::SetPitchAndYawRequest>,
151 ) -> Result<tonic::Response<super::SetPitchAndYawResponse>, tonic::Status> {
152 self.inner.ready().await.map_err(|e| {
153 tonic::Status::new(
154 tonic::Code::Unknown,
155 format!("Service was not ready: {}", e.into()),
156 )
157 })?;
158 let codec = tonic::codec::ProstCodec::default();
159 let path = http::uri::PathAndQuery::from_static(
160 "/mavsdk.rpc.gimbal.GimbalService/SetPitchAndYaw",
161 );
162 self.inner.unary(request.into_request(), path, codec).await
163 }
164 #[doc = ""]
165 #[doc = " Set gimbal mode."]
166 #[doc = ""]
167 #[doc = " This sets the desired yaw mode of a gimbal."]
168 #[doc = " Will return when the command is accepted. However, it might"]
169 #[doc = " take the gimbal longer to actually be set to the new angles."]
170 pub async fn set_mode(
171 &mut self,
172 request: impl tonic::IntoRequest<super::SetModeRequest>,
173 ) -> Result<tonic::Response<super::SetModeResponse>, tonic::Status> {
174 self.inner.ready().await.map_err(|e| {
175 tonic::Status::new(
176 tonic::Code::Unknown,
177 format!("Service was not ready: {}", e.into()),
178 )
179 })?;
180 let codec = tonic::codec::ProstCodec::default();
181 let path =
182 http::uri::PathAndQuery::from_static("/mavsdk.rpc.gimbal.GimbalService/SetMode");
183 self.inner.unary(request.into_request(), path, codec).await
184 }
185 #[doc = ""]
186 #[doc = " Set gimbal region of interest (ROI)."]
187 #[doc = ""]
188 #[doc = " This sets a region of interest that the gimbal will point to."]
189 #[doc = " The gimbal will continue to point to the specified region until it"]
190 #[doc = " receives a new command."]
191 #[doc = " The function will return when the command is accepted, however, it might"]
192 #[doc = " take the gimbal longer to actually rotate to the ROI."]
193 pub async fn set_roi_location(
194 &mut self,
195 request: impl tonic::IntoRequest<super::SetRoiLocationRequest>,
196 ) -> Result<tonic::Response<super::SetRoiLocationResponse>, tonic::Status> {
197 self.inner.ready().await.map_err(|e| {
198 tonic::Status::new(
199 tonic::Code::Unknown,
200 format!("Service was not ready: {}", e.into()),
201 )
202 })?;
203 let codec = tonic::codec::ProstCodec::default();
204 let path = http::uri::PathAndQuery::from_static(
205 "/mavsdk.rpc.gimbal.GimbalService/SetRoiLocation",
206 );
207 self.inner.unary(request.into_request(), path, codec).await
208 }
209 }
210}
211#[doc = r" Generated server implementations."]
212pub mod gimbal_service_server {
213 #![allow(unused_variables, dead_code, missing_docs, clippy::let_unit_value)]
214 use tonic::codegen::*;
215 #[doc = "Generated trait containing gRPC methods that should be implemented for use with GimbalServiceServer."]
216 #[async_trait]
217 pub trait GimbalService: Send + Sync + 'static {
218 #[doc = ""]
219 #[doc = ""]
220 #[doc = " Set gimbal pitch and yaw angles."]
221 #[doc = ""]
222 #[doc = " This sets the desired pitch and yaw angles of a gimbal."]
223 #[doc = " Will return when the command is accepted, however, it might"]
224 #[doc = " take the gimbal longer to actually be set to the new angles."]
225 async fn set_pitch_and_yaw(
226 &self,
227 request: tonic::Request<super::SetPitchAndYawRequest>,
228 ) -> Result<tonic::Response<super::SetPitchAndYawResponse>, tonic::Status>;
229 #[doc = ""]
230 #[doc = " Set gimbal mode."]
231 #[doc = ""]
232 #[doc = " This sets the desired yaw mode of a gimbal."]
233 #[doc = " Will return when the command is accepted. However, it might"]
234 #[doc = " take the gimbal longer to actually be set to the new angles."]
235 async fn set_mode(
236 &self,
237 request: tonic::Request<super::SetModeRequest>,
238 ) -> Result<tonic::Response<super::SetModeResponse>, tonic::Status>;
239 #[doc = ""]
240 #[doc = " Set gimbal region of interest (ROI)."]
241 #[doc = ""]
242 #[doc = " This sets a region of interest that the gimbal will point to."]
243 #[doc = " The gimbal will continue to point to the specified region until it"]
244 #[doc = " receives a new command."]
245 #[doc = " The function will return when the command is accepted, however, it might"]
246 #[doc = " take the gimbal longer to actually rotate to the ROI."]
247 async fn set_roi_location(
248 &self,
249 request: tonic::Request<super::SetRoiLocationRequest>,
250 ) -> Result<tonic::Response<super::SetRoiLocationResponse>, tonic::Status>;
251 }
252 #[doc = " Provide control over a gimbal."]
253 #[derive(Debug)]
254 pub struct GimbalServiceServer<T: GimbalService> {
255 inner: _Inner<T>,
256 accept_compression_encodings: (),
257 send_compression_encodings: (),
258 }
259 struct _Inner<T>(Arc<T>);
260 impl<T: GimbalService> GimbalServiceServer<T> {
261 pub fn new(inner: T) -> Self {
262 let inner = Arc::new(inner);
263 let inner = _Inner(inner);
264 Self {
265 inner,
266 accept_compression_encodings: Default::default(),
267 send_compression_encodings: Default::default(),
268 }
269 }
270 pub fn with_interceptor<F>(inner: T, interceptor: F) -> InterceptedService<Self, F>
271 where
272 F: tonic::service::Interceptor,
273 {
274 InterceptedService::new(Self::new(inner), interceptor)
275 }
276 }
277 impl<T, B> tonic::codegen::Service<http::Request<B>> for GimbalServiceServer<T>
278 where
279 T: GimbalService,
280 B: Body + Send + Sync + 'static,
281 B::Error: Into<StdError> + Send + 'static,
282 {
283 type Response = http::Response<tonic::body::BoxBody>;
284 type Error = Never;
285 type Future = BoxFuture<Self::Response, Self::Error>;
286 fn poll_ready(&mut self, _cx: &mut Context<'_>) -> Poll<Result<(), Self::Error>> {
287 Poll::Ready(Ok(()))
288 }
289 fn call(&mut self, req: http::Request<B>) -> Self::Future {
290 let inner = self.inner.clone();
291 match req.uri().path() {
292 "/mavsdk.rpc.gimbal.GimbalService/SetPitchAndYaw" => {
293 #[allow(non_camel_case_types)]
294 struct SetPitchAndYawSvc<T: GimbalService>(pub Arc<T>);
295 impl<T: GimbalService> tonic::server::UnaryService<super::SetPitchAndYawRequest>
296 for SetPitchAndYawSvc<T>
297 {
298 type Response = super::SetPitchAndYawResponse;
299 type Future = BoxFuture<tonic::Response<Self::Response>, tonic::Status>;
300 fn call(
301 &mut self,
302 request: tonic::Request<super::SetPitchAndYawRequest>,
303 ) -> Self::Future {
304 let inner = self.0.clone();
305 let fut = async move { (*inner).set_pitch_and_yaw(request).await };
306 Box::pin(fut)
307 }
308 }
309 let accept_compression_encodings = self.accept_compression_encodings;
310 let send_compression_encodings = self.send_compression_encodings;
311 let inner = self.inner.clone();
312 let fut = async move {
313 let inner = inner.0;
314 let method = SetPitchAndYawSvc(inner);
315 let codec = tonic::codec::ProstCodec::default();
316 let mut grpc = tonic::server::Grpc::new(codec).apply_compression_config(
317 accept_compression_encodings,
318 send_compression_encodings,
319 );
320 let res = grpc.unary(method, req).await;
321 Ok(res)
322 };
323 Box::pin(fut)
324 }
325 "/mavsdk.rpc.gimbal.GimbalService/SetMode" => {
326 #[allow(non_camel_case_types)]
327 struct SetModeSvc<T: GimbalService>(pub Arc<T>);
328 impl<T: GimbalService> tonic::server::UnaryService<super::SetModeRequest> for SetModeSvc<T> {
329 type Response = super::SetModeResponse;
330 type Future = BoxFuture<tonic::Response<Self::Response>, tonic::Status>;
331 fn call(
332 &mut self,
333 request: tonic::Request<super::SetModeRequest>,
334 ) -> Self::Future {
335 let inner = self.0.clone();
336 let fut = async move { (*inner).set_mode(request).await };
337 Box::pin(fut)
338 }
339 }
340 let accept_compression_encodings = self.accept_compression_encodings;
341 let send_compression_encodings = self.send_compression_encodings;
342 let inner = self.inner.clone();
343 let fut = async move {
344 let inner = inner.0;
345 let method = SetModeSvc(inner);
346 let codec = tonic::codec::ProstCodec::default();
347 let mut grpc = tonic::server::Grpc::new(codec).apply_compression_config(
348 accept_compression_encodings,
349 send_compression_encodings,
350 );
351 let res = grpc.unary(method, req).await;
352 Ok(res)
353 };
354 Box::pin(fut)
355 }
356 "/mavsdk.rpc.gimbal.GimbalService/SetRoiLocation" => {
357 #[allow(non_camel_case_types)]
358 struct SetRoiLocationSvc<T: GimbalService>(pub Arc<T>);
359 impl<T: GimbalService> tonic::server::UnaryService<super::SetRoiLocationRequest>
360 for SetRoiLocationSvc<T>
361 {
362 type Response = super::SetRoiLocationResponse;
363 type Future = BoxFuture<tonic::Response<Self::Response>, tonic::Status>;
364 fn call(
365 &mut self,
366 request: tonic::Request<super::SetRoiLocationRequest>,
367 ) -> Self::Future {
368 let inner = self.0.clone();
369 let fut = async move { (*inner).set_roi_location(request).await };
370 Box::pin(fut)
371 }
372 }
373 let accept_compression_encodings = self.accept_compression_encodings;
374 let send_compression_encodings = self.send_compression_encodings;
375 let inner = self.inner.clone();
376 let fut = async move {
377 let inner = inner.0;
378 let method = SetRoiLocationSvc(inner);
379 let codec = tonic::codec::ProstCodec::default();
380 let mut grpc = tonic::server::Grpc::new(codec).apply_compression_config(
381 accept_compression_encodings,
382 send_compression_encodings,
383 );
384 let res = grpc.unary(method, req).await;
385 Ok(res)
386 };
387 Box::pin(fut)
388 }
389 _ => Box::pin(async move {
390 Ok(http::Response::builder()
391 .status(200)
392 .header("grpc-status", "12")
393 .header("content-type", "application/grpc")
394 .body(empty_body())
395 .unwrap())
396 }),
397 }
398 }
399 }
400 impl<T: GimbalService> Clone for GimbalServiceServer<T> {
401 fn clone(&self) -> Self {
402 let inner = self.inner.clone();
403 Self {
404 inner,
405 accept_compression_encodings: self.accept_compression_encodings,
406 send_compression_encodings: self.send_compression_encodings,
407 }
408 }
409 }
410 impl<T: GimbalService> Clone for _Inner<T> {
411 fn clone(&self) -> Self {
412 Self(self.0.clone())
413 }
414 }
415 impl<T: std::fmt::Debug> std::fmt::Debug for _Inner<T> {
416 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
417 write!(f, "{:?}", self.0)
418 }
419 }
420 impl<T: GimbalService> tonic::transport::NamedService for GimbalServiceServer<T> {
421 const NAME: &'static str = "mavsdk.rpc.gimbal.GimbalService";
422 }
423}