mav_sdk/grpc/
mavsdk.rpc.info.rs

1#[derive(Clone, PartialEq, ::prost::Message)]
2pub struct GetFlightInformationRequest {}
3#[derive(Clone, PartialEq, ::prost::Message)]
4pub struct GetFlightInformationResponse {
5    #[prost(message, optional, tag = "1")]
6    pub info_result: ::core::option::Option<InfoResult>,
7    /// Flight information of the system
8    #[prost(message, optional, tag = "2")]
9    pub flight_info: ::core::option::Option<FlightInfo>,
10}
11#[derive(Clone, PartialEq, ::prost::Message)]
12pub struct GetIdentificationRequest {}
13#[derive(Clone, PartialEq, ::prost::Message)]
14pub struct GetIdentificationResponse {
15    #[prost(message, optional, tag = "1")]
16    pub info_result: ::core::option::Option<InfoResult>,
17    /// Identification of the system
18    #[prost(message, optional, tag = "2")]
19    pub identification: ::core::option::Option<Identification>,
20}
21#[derive(Clone, PartialEq, ::prost::Message)]
22pub struct GetProductRequest {}
23#[derive(Clone, PartialEq, ::prost::Message)]
24pub struct GetProductResponse {
25    #[prost(message, optional, tag = "1")]
26    pub info_result: ::core::option::Option<InfoResult>,
27    /// Product information of the system
28    #[prost(message, optional, tag = "2")]
29    pub product: ::core::option::Option<Product>,
30}
31#[derive(Clone, PartialEq, ::prost::Message)]
32pub struct GetVersionRequest {}
33#[derive(Clone, PartialEq, ::prost::Message)]
34pub struct GetVersionResponse {
35    #[prost(message, optional, tag = "1")]
36    pub info_result: ::core::option::Option<InfoResult>,
37    /// Version information about the system
38    #[prost(message, optional, tag = "2")]
39    pub version: ::core::option::Option<Version>,
40}
41#[derive(Clone, PartialEq, ::prost::Message)]
42pub struct GetSpeedFactorRequest {}
43#[derive(Clone, PartialEq, ::prost::Message)]
44pub struct GetSpeedFactorResponse {
45    #[prost(message, optional, tag = "1")]
46    pub info_result: ::core::option::Option<InfoResult>,
47    /// Speed factor of simulation
48    #[prost(double, tag = "2")]
49    pub speed_factor: f64,
50}
51/// System flight information.
52#[derive(Clone, PartialEq, ::prost::Message)]
53pub struct FlightInfo {
54    /// Time since system boot
55    #[prost(uint32, tag = "1")]
56    pub time_boot_ms: u32,
57    /// Flight counter. Starts from zero, is incremented at every disarm and is never reset (even after reboot)
58    #[prost(uint64, tag = "2")]
59    pub flight_uid: u64,
60}
61/// System identification.
62#[derive(Clone, PartialEq, ::prost::Message)]
63pub struct Identification {
64    /// UID of the hardware. This refers to uid2 of MAVLink. If the system does not support uid2 yet, this is all zeros.
65    #[prost(string, tag = "1")]
66    pub hardware_uid: ::prost::alloc::string::String,
67}
68/// System product information.
69#[derive(Clone, PartialEq, ::prost::Message)]
70pub struct Product {
71    /// ID of the board vendor
72    #[prost(int32, tag = "1")]
73    pub vendor_id: i32,
74    /// Name of the vendor
75    #[prost(string, tag = "2")]
76    pub vendor_name: ::prost::alloc::string::String,
77    /// ID of the product
78    #[prost(int32, tag = "3")]
79    pub product_id: i32,
80    /// Name of the product
81    #[prost(string, tag = "4")]
82    pub product_name: ::prost::alloc::string::String,
83}
84/// System version information.
85#[derive(Clone, PartialEq, ::prost::Message)]
86pub struct Version {
87    /// Flight software major version
88    #[prost(int32, tag = "1")]
89    pub flight_sw_major: i32,
90    /// Flight software minor version
91    #[prost(int32, tag = "2")]
92    pub flight_sw_minor: i32,
93    /// Flight software patch version
94    #[prost(int32, tag = "3")]
95    pub flight_sw_patch: i32,
96    /// Flight software vendor major version
97    #[prost(int32, tag = "4")]
98    pub flight_sw_vendor_major: i32,
99    /// Flight software vendor minor version
100    #[prost(int32, tag = "5")]
101    pub flight_sw_vendor_minor: i32,
102    /// Flight software vendor patch version
103    #[prost(int32, tag = "6")]
104    pub flight_sw_vendor_patch: i32,
105    /// Operating system software major version
106    #[prost(int32, tag = "7")]
107    pub os_sw_major: i32,
108    /// Operating system software minor version
109    #[prost(int32, tag = "8")]
110    pub os_sw_minor: i32,
111    /// Operating system software patch version
112    #[prost(int32, tag = "9")]
113    pub os_sw_patch: i32,
114    /// Flight software git hash
115    #[prost(string, tag = "10")]
116    pub flight_sw_git_hash: ::prost::alloc::string::String,
117    /// Operating system software git hash
118    #[prost(string, tag = "11")]
119    pub os_sw_git_hash: ::prost::alloc::string::String,
120}
121/// Result type.
122#[derive(Clone, PartialEq, ::prost::Message)]
123pub struct InfoResult {
124    /// Result enum value
125    #[prost(enumeration = "info_result::Result", tag = "1")]
126    pub result: i32,
127    /// Human-readable English string describing the result
128    #[prost(string, tag = "2")]
129    pub result_str: ::prost::alloc::string::String,
130}
131/// Nested message and enum types in `InfoResult`.
132pub mod info_result {
133    /// Possible results returned for info requests.
134    #[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord, ::prost::Enumeration)]
135    #[repr(i32)]
136    pub enum Result {
137        /// Unknown result
138        Unknown = 0,
139        /// Request succeeded
140        Success = 1,
141        /// Information has not been received yet
142        InformationNotReceivedYet = 2,
143    }
144}
145#[doc = r" Generated client implementations."]
146pub mod info_service_client {
147    #![allow(unused_variables, dead_code, missing_docs, clippy::let_unit_value)]
148    use tonic::codegen::*;
149    #[doc = " Provide information about the hardware and/or software of a system."]
150    #[derive(Debug, Clone)]
151    pub struct InfoServiceClient<T> {
152        inner: tonic::client::Grpc<T>,
153    }
154    impl InfoServiceClient<tonic::transport::Channel> {
155        #[doc = r" Attempt to create a new client by connecting to a given endpoint."]
156        pub async fn connect<D>(dst: D) -> Result<Self, tonic::transport::Error>
157        where
158            D: std::convert::TryInto<tonic::transport::Endpoint>,
159            D::Error: Into<StdError>,
160        {
161            let conn = tonic::transport::Endpoint::new(dst)?.connect().await?;
162            Ok(Self::new(conn))
163        }
164    }
165    impl<T> InfoServiceClient<T>
166    where
167        T: tonic::client::GrpcService<tonic::body::BoxBody>,
168        T::ResponseBody: Body + Send + Sync + 'static,
169        T::Error: Into<StdError>,
170        <T::ResponseBody as Body>::Error: Into<StdError> + Send,
171    {
172        pub fn new(inner: T) -> Self {
173            let inner = tonic::client::Grpc::new(inner);
174            Self { inner }
175        }
176        pub fn with_interceptor<F>(
177            inner: T,
178            interceptor: F,
179        ) -> InfoServiceClient<InterceptedService<T, F>>
180        where
181            F: tonic::service::Interceptor,
182            T: tonic::codegen::Service<
183                http::Request<tonic::body::BoxBody>,
184                Response = http::Response<
185                    <T as tonic::client::GrpcService<tonic::body::BoxBody>>::ResponseBody,
186                >,
187            >,
188            <T as tonic::codegen::Service<http::Request<tonic::body::BoxBody>>>::Error:
189                Into<StdError> + Send + Sync,
190        {
191            InfoServiceClient::new(InterceptedService::new(inner, interceptor))
192        }
193        #[doc = r" Compress requests with `gzip`."]
194        #[doc = r""]
195        #[doc = r" This requires the server to support it otherwise it might respond with an"]
196        #[doc = r" error."]
197        pub fn send_gzip(mut self) -> Self {
198            self.inner = self.inner.send_gzip();
199            self
200        }
201        #[doc = r" Enable decompressing responses with `gzip`."]
202        pub fn accept_gzip(mut self) -> Self {
203            self.inner = self.inner.accept_gzip();
204            self
205        }
206        #[doc = " Get flight information of the system."]
207        pub async fn get_flight_information(
208            &mut self,
209            request: impl tonic::IntoRequest<super::GetFlightInformationRequest>,
210        ) -> Result<tonic::Response<super::GetFlightInformationResponse>, tonic::Status> {
211            self.inner.ready().await.map_err(|e| {
212                tonic::Status::new(
213                    tonic::Code::Unknown,
214                    format!("Service was not ready: {}", e.into()),
215                )
216            })?;
217            let codec = tonic::codec::ProstCodec::default();
218            let path = http::uri::PathAndQuery::from_static(
219                "/mavsdk.rpc.info.InfoService/GetFlightInformation",
220            );
221            self.inner.unary(request.into_request(), path, codec).await
222        }
223        #[doc = " Get the identification of the system."]
224        pub async fn get_identification(
225            &mut self,
226            request: impl tonic::IntoRequest<super::GetIdentificationRequest>,
227        ) -> Result<tonic::Response<super::GetIdentificationResponse>, tonic::Status> {
228            self.inner.ready().await.map_err(|e| {
229                tonic::Status::new(
230                    tonic::Code::Unknown,
231                    format!("Service was not ready: {}", e.into()),
232                )
233            })?;
234            let codec = tonic::codec::ProstCodec::default();
235            let path = http::uri::PathAndQuery::from_static(
236                "/mavsdk.rpc.info.InfoService/GetIdentification",
237            );
238            self.inner.unary(request.into_request(), path, codec).await
239        }
240        #[doc = " Get product information of the system."]
241        pub async fn get_product(
242            &mut self,
243            request: impl tonic::IntoRequest<super::GetProductRequest>,
244        ) -> Result<tonic::Response<super::GetProductResponse>, tonic::Status> {
245            self.inner.ready().await.map_err(|e| {
246                tonic::Status::new(
247                    tonic::Code::Unknown,
248                    format!("Service was not ready: {}", e.into()),
249                )
250            })?;
251            let codec = tonic::codec::ProstCodec::default();
252            let path =
253                http::uri::PathAndQuery::from_static("/mavsdk.rpc.info.InfoService/GetProduct");
254            self.inner.unary(request.into_request(), path, codec).await
255        }
256        #[doc = " Get the version information of the system."]
257        pub async fn get_version(
258            &mut self,
259            request: impl tonic::IntoRequest<super::GetVersionRequest>,
260        ) -> Result<tonic::Response<super::GetVersionResponse>, tonic::Status> {
261            self.inner.ready().await.map_err(|e| {
262                tonic::Status::new(
263                    tonic::Code::Unknown,
264                    format!("Service was not ready: {}", e.into()),
265                )
266            })?;
267            let codec = tonic::codec::ProstCodec::default();
268            let path =
269                http::uri::PathAndQuery::from_static("/mavsdk.rpc.info.InfoService/GetVersion");
270            self.inner.unary(request.into_request(), path, codec).await
271        }
272        #[doc = " Get the speed factor of a simulation (with lockstep a simulation can run faster or slower than realtime)."]
273        pub async fn get_speed_factor(
274            &mut self,
275            request: impl tonic::IntoRequest<super::GetSpeedFactorRequest>,
276        ) -> Result<tonic::Response<super::GetSpeedFactorResponse>, tonic::Status> {
277            self.inner.ready().await.map_err(|e| {
278                tonic::Status::new(
279                    tonic::Code::Unknown,
280                    format!("Service was not ready: {}", e.into()),
281                )
282            })?;
283            let codec = tonic::codec::ProstCodec::default();
284            let path =
285                http::uri::PathAndQuery::from_static("/mavsdk.rpc.info.InfoService/GetSpeedFactor");
286            self.inner.unary(request.into_request(), path, codec).await
287        }
288    }
289}
290#[doc = r" Generated server implementations."]
291pub mod info_service_server {
292    #![allow(unused_variables, dead_code, missing_docs, clippy::let_unit_value)]
293    use tonic::codegen::*;
294    #[doc = "Generated trait containing gRPC methods that should be implemented for use with InfoServiceServer."]
295    #[async_trait]
296    pub trait InfoService: Send + Sync + 'static {
297        #[doc = " Get flight information of the system."]
298        async fn get_flight_information(
299            &self,
300            request: tonic::Request<super::GetFlightInformationRequest>,
301        ) -> Result<tonic::Response<super::GetFlightInformationResponse>, tonic::Status>;
302        #[doc = " Get the identification of the system."]
303        async fn get_identification(
304            &self,
305            request: tonic::Request<super::GetIdentificationRequest>,
306        ) -> Result<tonic::Response<super::GetIdentificationResponse>, tonic::Status>;
307        #[doc = " Get product information of the system."]
308        async fn get_product(
309            &self,
310            request: tonic::Request<super::GetProductRequest>,
311        ) -> Result<tonic::Response<super::GetProductResponse>, tonic::Status>;
312        #[doc = " Get the version information of the system."]
313        async fn get_version(
314            &self,
315            request: tonic::Request<super::GetVersionRequest>,
316        ) -> Result<tonic::Response<super::GetVersionResponse>, tonic::Status>;
317        #[doc = " Get the speed factor of a simulation (with lockstep a simulation can run faster or slower than realtime)."]
318        async fn get_speed_factor(
319            &self,
320            request: tonic::Request<super::GetSpeedFactorRequest>,
321        ) -> Result<tonic::Response<super::GetSpeedFactorResponse>, tonic::Status>;
322    }
323    #[doc = " Provide information about the hardware and/or software of a system."]
324    #[derive(Debug)]
325    pub struct InfoServiceServer<T: InfoService> {
326        inner: _Inner<T>,
327        accept_compression_encodings: (),
328        send_compression_encodings: (),
329    }
330    struct _Inner<T>(Arc<T>);
331    impl<T: InfoService> InfoServiceServer<T> {
332        pub fn new(inner: T) -> Self {
333            let inner = Arc::new(inner);
334            let inner = _Inner(inner);
335            Self {
336                inner,
337                accept_compression_encodings: Default::default(),
338                send_compression_encodings: Default::default(),
339            }
340        }
341        pub fn with_interceptor<F>(inner: T, interceptor: F) -> InterceptedService<Self, F>
342        where
343            F: tonic::service::Interceptor,
344        {
345            InterceptedService::new(Self::new(inner), interceptor)
346        }
347    }
348    impl<T, B> tonic::codegen::Service<http::Request<B>> for InfoServiceServer<T>
349    where
350        T: InfoService,
351        B: Body + Send + Sync + 'static,
352        B::Error: Into<StdError> + Send + 'static,
353    {
354        type Response = http::Response<tonic::body::BoxBody>;
355        type Error = Never;
356        type Future = BoxFuture<Self::Response, Self::Error>;
357        fn poll_ready(&mut self, _cx: &mut Context<'_>) -> Poll<Result<(), Self::Error>> {
358            Poll::Ready(Ok(()))
359        }
360        fn call(&mut self, req: http::Request<B>) -> Self::Future {
361            let inner = self.inner.clone();
362            match req.uri().path() {
363                "/mavsdk.rpc.info.InfoService/GetFlightInformation" => {
364                    #[allow(non_camel_case_types)]
365                    struct GetFlightInformationSvc<T: InfoService>(pub Arc<T>);
366                    impl<T: InfoService>
367                        tonic::server::UnaryService<super::GetFlightInformationRequest>
368                        for GetFlightInformationSvc<T>
369                    {
370                        type Response = super::GetFlightInformationResponse;
371                        type Future = BoxFuture<tonic::Response<Self::Response>, tonic::Status>;
372                        fn call(
373                            &mut self,
374                            request: tonic::Request<super::GetFlightInformationRequest>,
375                        ) -> Self::Future {
376                            let inner = self.0.clone();
377                            let fut = async move { (*inner).get_flight_information(request).await };
378                            Box::pin(fut)
379                        }
380                    }
381                    let accept_compression_encodings = self.accept_compression_encodings;
382                    let send_compression_encodings = self.send_compression_encodings;
383                    let inner = self.inner.clone();
384                    let fut = async move {
385                        let inner = inner.0;
386                        let method = GetFlightInformationSvc(inner);
387                        let codec = tonic::codec::ProstCodec::default();
388                        let mut grpc = tonic::server::Grpc::new(codec).apply_compression_config(
389                            accept_compression_encodings,
390                            send_compression_encodings,
391                        );
392                        let res = grpc.unary(method, req).await;
393                        Ok(res)
394                    };
395                    Box::pin(fut)
396                }
397                "/mavsdk.rpc.info.InfoService/GetIdentification" => {
398                    #[allow(non_camel_case_types)]
399                    struct GetIdentificationSvc<T: InfoService>(pub Arc<T>);
400                    impl<T: InfoService>
401                        tonic::server::UnaryService<super::GetIdentificationRequest>
402                        for GetIdentificationSvc<T>
403                    {
404                        type Response = super::GetIdentificationResponse;
405                        type Future = BoxFuture<tonic::Response<Self::Response>, tonic::Status>;
406                        fn call(
407                            &mut self,
408                            request: tonic::Request<super::GetIdentificationRequest>,
409                        ) -> Self::Future {
410                            let inner = self.0.clone();
411                            let fut = async move { (*inner).get_identification(request).await };
412                            Box::pin(fut)
413                        }
414                    }
415                    let accept_compression_encodings = self.accept_compression_encodings;
416                    let send_compression_encodings = self.send_compression_encodings;
417                    let inner = self.inner.clone();
418                    let fut = async move {
419                        let inner = inner.0;
420                        let method = GetIdentificationSvc(inner);
421                        let codec = tonic::codec::ProstCodec::default();
422                        let mut grpc = tonic::server::Grpc::new(codec).apply_compression_config(
423                            accept_compression_encodings,
424                            send_compression_encodings,
425                        );
426                        let res = grpc.unary(method, req).await;
427                        Ok(res)
428                    };
429                    Box::pin(fut)
430                }
431                "/mavsdk.rpc.info.InfoService/GetProduct" => {
432                    #[allow(non_camel_case_types)]
433                    struct GetProductSvc<T: InfoService>(pub Arc<T>);
434                    impl<T: InfoService> tonic::server::UnaryService<super::GetProductRequest> for GetProductSvc<T> {
435                        type Response = super::GetProductResponse;
436                        type Future = BoxFuture<tonic::Response<Self::Response>, tonic::Status>;
437                        fn call(
438                            &mut self,
439                            request: tonic::Request<super::GetProductRequest>,
440                        ) -> Self::Future {
441                            let inner = self.0.clone();
442                            let fut = async move { (*inner).get_product(request).await };
443                            Box::pin(fut)
444                        }
445                    }
446                    let accept_compression_encodings = self.accept_compression_encodings;
447                    let send_compression_encodings = self.send_compression_encodings;
448                    let inner = self.inner.clone();
449                    let fut = async move {
450                        let inner = inner.0;
451                        let method = GetProductSvc(inner);
452                        let codec = tonic::codec::ProstCodec::default();
453                        let mut grpc = tonic::server::Grpc::new(codec).apply_compression_config(
454                            accept_compression_encodings,
455                            send_compression_encodings,
456                        );
457                        let res = grpc.unary(method, req).await;
458                        Ok(res)
459                    };
460                    Box::pin(fut)
461                }
462                "/mavsdk.rpc.info.InfoService/GetVersion" => {
463                    #[allow(non_camel_case_types)]
464                    struct GetVersionSvc<T: InfoService>(pub Arc<T>);
465                    impl<T: InfoService> tonic::server::UnaryService<super::GetVersionRequest> for GetVersionSvc<T> {
466                        type Response = super::GetVersionResponse;
467                        type Future = BoxFuture<tonic::Response<Self::Response>, tonic::Status>;
468                        fn call(
469                            &mut self,
470                            request: tonic::Request<super::GetVersionRequest>,
471                        ) -> Self::Future {
472                            let inner = self.0.clone();
473                            let fut = async move { (*inner).get_version(request).await };
474                            Box::pin(fut)
475                        }
476                    }
477                    let accept_compression_encodings = self.accept_compression_encodings;
478                    let send_compression_encodings = self.send_compression_encodings;
479                    let inner = self.inner.clone();
480                    let fut = async move {
481                        let inner = inner.0;
482                        let method = GetVersionSvc(inner);
483                        let codec = tonic::codec::ProstCodec::default();
484                        let mut grpc = tonic::server::Grpc::new(codec).apply_compression_config(
485                            accept_compression_encodings,
486                            send_compression_encodings,
487                        );
488                        let res = grpc.unary(method, req).await;
489                        Ok(res)
490                    };
491                    Box::pin(fut)
492                }
493                "/mavsdk.rpc.info.InfoService/GetSpeedFactor" => {
494                    #[allow(non_camel_case_types)]
495                    struct GetSpeedFactorSvc<T: InfoService>(pub Arc<T>);
496                    impl<T: InfoService> tonic::server::UnaryService<super::GetSpeedFactorRequest>
497                        for GetSpeedFactorSvc<T>
498                    {
499                        type Response = super::GetSpeedFactorResponse;
500                        type Future = BoxFuture<tonic::Response<Self::Response>, tonic::Status>;
501                        fn call(
502                            &mut self,
503                            request: tonic::Request<super::GetSpeedFactorRequest>,
504                        ) -> Self::Future {
505                            let inner = self.0.clone();
506                            let fut = async move { (*inner).get_speed_factor(request).await };
507                            Box::pin(fut)
508                        }
509                    }
510                    let accept_compression_encodings = self.accept_compression_encodings;
511                    let send_compression_encodings = self.send_compression_encodings;
512                    let inner = self.inner.clone();
513                    let fut = async move {
514                        let inner = inner.0;
515                        let method = GetSpeedFactorSvc(inner);
516                        let codec = tonic::codec::ProstCodec::default();
517                        let mut grpc = tonic::server::Grpc::new(codec).apply_compression_config(
518                            accept_compression_encodings,
519                            send_compression_encodings,
520                        );
521                        let res = grpc.unary(method, req).await;
522                        Ok(res)
523                    };
524                    Box::pin(fut)
525                }
526                _ => Box::pin(async move {
527                    Ok(http::Response::builder()
528                        .status(200)
529                        .header("grpc-status", "12")
530                        .header("content-type", "application/grpc")
531                        .body(empty_body())
532                        .unwrap())
533                }),
534            }
535        }
536    }
537    impl<T: InfoService> Clone for InfoServiceServer<T> {
538        fn clone(&self) -> Self {
539            let inner = self.inner.clone();
540            Self {
541                inner,
542                accept_compression_encodings: self.accept_compression_encodings,
543                send_compression_encodings: self.send_compression_encodings,
544            }
545        }
546    }
547    impl<T: InfoService> Clone for _Inner<T> {
548        fn clone(&self) -> Self {
549            Self(self.0.clone())
550        }
551    }
552    impl<T: std::fmt::Debug> std::fmt::Debug for _Inner<T> {
553        fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
554            write!(f, "{:?}", self.0)
555        }
556    }
557    impl<T: InfoService> tonic::transport::NamedService for InfoServiceServer<T> {
558        const NAME: &'static str = "mavsdk.rpc.info.InfoService";
559    }
560}