Skip to main content

fidl_fuchsia_bluetooth_gatt/
fidl_fuchsia_bluetooth_gatt.rs

1// WARNING: This file is machine generated by fidlgen.
2
3#![warn(clippy::all)]
4#![allow(unused_parens, unused_mut, unused_imports, nonstandard_style)]
5
6use bitflags::bitflags;
7use fidl::client::QueryResponseFut;
8use fidl::encoding::{MessageBufFor, ProxyChannelBox, ResourceDialect};
9use fidl::endpoints::{ControlHandle as _, Responder as _};
10pub use fidl_fuchsia_bluetooth_gatt__common::*;
11use futures::future::{self, MaybeDone, TryFutureExt};
12use zx_status;
13
14#[derive(Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
15pub struct ClientConnectToServiceRequest {
16    pub id: u64,
17    pub service: fidl::endpoints::ServerEnd<RemoteServiceMarker>,
18}
19
20impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect>
21    for ClientConnectToServiceRequest
22{
23}
24
25#[derive(Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
26pub struct ServerPublishServiceRequest {
27    pub info: ServiceInfo,
28    pub delegate: fidl::endpoints::ClientEnd<LocalServiceDelegateMarker>,
29    pub service: fidl::endpoints::ServerEnd<LocalServiceMarker>,
30}
31
32impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect>
33    for ServerPublishServiceRequest
34{
35}
36
37#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
38pub struct ClientMarker;
39
40impl fidl::endpoints::ProtocolMarker for ClientMarker {
41    type Proxy = ClientProxy;
42    type RequestStream = ClientRequestStream;
43    #[cfg(target_os = "fuchsia")]
44    type SynchronousProxy = ClientSynchronousProxy;
45
46    const DEBUG_NAME: &'static str = "(anonymous) Client";
47}
48
49pub trait ClientProxyInterface: Send + Sync {
50    type ListServicesResponseFut: std::future::Future<
51            Output = Result<(fidl_fuchsia_bluetooth::Status, Vec<ServiceInfo>), fidl::Error>,
52        > + Send;
53    fn r#list_services(&self, uuids: Option<&[String]>) -> Self::ListServicesResponseFut;
54    fn r#connect_to_service(
55        &self,
56        id: u64,
57        service: fidl::endpoints::ServerEnd<RemoteServiceMarker>,
58    ) -> Result<(), fidl::Error>;
59}
60#[derive(Debug)]
61#[cfg(target_os = "fuchsia")]
62pub struct ClientSynchronousProxy {
63    client: fidl::client::sync::Client,
64}
65
66#[cfg(target_os = "fuchsia")]
67impl fidl::endpoints::SynchronousProxy for ClientSynchronousProxy {
68    type Proxy = ClientProxy;
69    type Protocol = ClientMarker;
70
71    fn from_channel(inner: fidl::Channel) -> Self {
72        Self::new(inner)
73    }
74
75    fn into_channel(self) -> fidl::Channel {
76        self.client.into_channel()
77    }
78
79    fn as_channel(&self) -> &fidl::Channel {
80        self.client.as_channel()
81    }
82}
83
84#[cfg(target_os = "fuchsia")]
85impl ClientSynchronousProxy {
86    pub fn new(channel: fidl::Channel) -> Self {
87        Self { client: fidl::client::sync::Client::new(channel) }
88    }
89
90    pub fn into_channel(self) -> fidl::Channel {
91        self.client.into_channel()
92    }
93
94    /// Waits until an event arrives and returns it. It is safe for other
95    /// threads to make concurrent requests while waiting for an event.
96    pub fn wait_for_event(
97        &self,
98        deadline: zx::MonotonicInstant,
99    ) -> Result<ClientEvent, fidl::Error> {
100        ClientEvent::decode(self.client.wait_for_event::<ClientMarker>(deadline)?)
101    }
102
103    /// Enumerates services found on the peer that this Client represents. Results
104    /// can be restricted by specifying a list of UUIDs in `uuids`. The returned
105    /// ServiceInfo structures will contain only basic information about each
106    /// service and the `characteristics` and `includes` fields will be null.
107    ///
108    /// To further interact with services, clients must obtain a RemoteService
109    /// handle by calling ConnectToService().
110    pub fn r#list_services(
111        &self,
112        mut uuids: Option<&[String]>,
113        ___deadline: zx::MonotonicInstant,
114    ) -> Result<(fidl_fuchsia_bluetooth::Status, Vec<ServiceInfo>), fidl::Error> {
115        let _response = self
116            .client
117            .send_query::<ClientListServicesRequest, ClientListServicesResponse, ClientMarker>(
118                (uuids,),
119                0x367b6c1e1540fb99,
120                fidl::encoding::DynamicFlags::empty(),
121                ___deadline,
122            )?;
123        Ok((_response.status, _response.services))
124    }
125
126    /// Connects the RemoteService with the given identifier.
127    pub fn r#connect_to_service(
128        &self,
129        mut id: u64,
130        mut service: fidl::endpoints::ServerEnd<RemoteServiceMarker>,
131    ) -> Result<(), fidl::Error> {
132        self.client.send::<ClientConnectToServiceRequest>(
133            (id, service),
134            0x45ca1666a35cd25,
135            fidl::encoding::DynamicFlags::empty(),
136        )
137    }
138}
139
140#[cfg(target_os = "fuchsia")]
141impl From<ClientSynchronousProxy> for zx::NullableHandle {
142    fn from(value: ClientSynchronousProxy) -> Self {
143        value.into_channel().into()
144    }
145}
146
147#[cfg(target_os = "fuchsia")]
148impl From<fidl::Channel> for ClientSynchronousProxy {
149    fn from(value: fidl::Channel) -> Self {
150        Self::new(value)
151    }
152}
153
154#[cfg(target_os = "fuchsia")]
155impl fidl::endpoints::FromClient for ClientSynchronousProxy {
156    type Protocol = ClientMarker;
157
158    fn from_client(value: fidl::endpoints::ClientEnd<ClientMarker>) -> Self {
159        Self::new(value.into_channel())
160    }
161}
162
163#[derive(Debug, Clone)]
164pub struct ClientProxy {
165    client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
166}
167
168impl fidl::endpoints::Proxy for ClientProxy {
169    type Protocol = ClientMarker;
170
171    fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
172        Self::new(inner)
173    }
174
175    fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
176        self.client.into_channel().map_err(|client| Self { client })
177    }
178
179    fn as_channel(&self) -> &::fidl::AsyncChannel {
180        self.client.as_channel()
181    }
182}
183
184impl ClientProxy {
185    /// Create a new Proxy for fuchsia.bluetooth.gatt/Client.
186    pub fn new(channel: ::fidl::AsyncChannel) -> Self {
187        let protocol_name = <ClientMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
188        Self { client: fidl::client::Client::new(channel, protocol_name) }
189    }
190
191    /// Get a Stream of events from the remote end of the protocol.
192    ///
193    /// # Panics
194    ///
195    /// Panics if the event stream was already taken.
196    pub fn take_event_stream(&self) -> ClientEventStream {
197        ClientEventStream { event_receiver: self.client.take_event_receiver() }
198    }
199
200    /// Enumerates services found on the peer that this Client represents. Results
201    /// can be restricted by specifying a list of UUIDs in `uuids`. The returned
202    /// ServiceInfo structures will contain only basic information about each
203    /// service and the `characteristics` and `includes` fields will be null.
204    ///
205    /// To further interact with services, clients must obtain a RemoteService
206    /// handle by calling ConnectToService().
207    pub fn r#list_services(
208        &self,
209        mut uuids: Option<&[String]>,
210    ) -> fidl::client::QueryResponseFut<
211        (fidl_fuchsia_bluetooth::Status, Vec<ServiceInfo>),
212        fidl::encoding::DefaultFuchsiaResourceDialect,
213    > {
214        ClientProxyInterface::r#list_services(self, uuids)
215    }
216
217    /// Connects the RemoteService with the given identifier.
218    pub fn r#connect_to_service(
219        &self,
220        mut id: u64,
221        mut service: fidl::endpoints::ServerEnd<RemoteServiceMarker>,
222    ) -> Result<(), fidl::Error> {
223        ClientProxyInterface::r#connect_to_service(self, id, service)
224    }
225}
226
227impl ClientProxyInterface for ClientProxy {
228    type ListServicesResponseFut = fidl::client::QueryResponseFut<
229        (fidl_fuchsia_bluetooth::Status, Vec<ServiceInfo>),
230        fidl::encoding::DefaultFuchsiaResourceDialect,
231    >;
232    fn r#list_services(&self, mut uuids: Option<&[String]>) -> Self::ListServicesResponseFut {
233        fn _decode(
234            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
235        ) -> Result<(fidl_fuchsia_bluetooth::Status, Vec<ServiceInfo>), fidl::Error> {
236            let _response = fidl::client::decode_transaction_body::<
237                ClientListServicesResponse,
238                fidl::encoding::DefaultFuchsiaResourceDialect,
239                0x367b6c1e1540fb99,
240            >(_buf?)?;
241            Ok((_response.status, _response.services))
242        }
243        self.client.send_query_and_decode::<
244            ClientListServicesRequest,
245            (fidl_fuchsia_bluetooth::Status, Vec<ServiceInfo>),
246        >(
247            (uuids,),
248            0x367b6c1e1540fb99,
249            fidl::encoding::DynamicFlags::empty(),
250            _decode,
251        )
252    }
253
254    fn r#connect_to_service(
255        &self,
256        mut id: u64,
257        mut service: fidl::endpoints::ServerEnd<RemoteServiceMarker>,
258    ) -> Result<(), fidl::Error> {
259        self.client.send::<ClientConnectToServiceRequest>(
260            (id, service),
261            0x45ca1666a35cd25,
262            fidl::encoding::DynamicFlags::empty(),
263        )
264    }
265}
266
267pub struct ClientEventStream {
268    event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
269}
270
271impl std::marker::Unpin for ClientEventStream {}
272
273impl futures::stream::FusedStream for ClientEventStream {
274    fn is_terminated(&self) -> bool {
275        self.event_receiver.is_terminated()
276    }
277}
278
279impl futures::Stream for ClientEventStream {
280    type Item = Result<ClientEvent, fidl::Error>;
281
282    fn poll_next(
283        mut self: std::pin::Pin<&mut Self>,
284        cx: &mut std::task::Context<'_>,
285    ) -> std::task::Poll<Option<Self::Item>> {
286        match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
287            &mut self.event_receiver,
288            cx
289        )?) {
290            Some(buf) => std::task::Poll::Ready(Some(ClientEvent::decode(buf))),
291            None => std::task::Poll::Ready(None),
292        }
293    }
294}
295
296#[derive(Debug)]
297pub enum ClientEvent {}
298
299impl ClientEvent {
300    /// Decodes a message buffer as a [`ClientEvent`].
301    fn decode(
302        mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
303    ) -> Result<ClientEvent, fidl::Error> {
304        let (bytes, _handles) = buf.split_mut();
305        let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
306        debug_assert_eq!(tx_header.tx_id, 0);
307        match tx_header.ordinal {
308            _ => Err(fidl::Error::UnknownOrdinal {
309                ordinal: tx_header.ordinal,
310                protocol_name: <ClientMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
311            }),
312        }
313    }
314}
315
316/// A Stream of incoming requests for fuchsia.bluetooth.gatt/Client.
317pub struct ClientRequestStream {
318    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
319    is_terminated: bool,
320}
321
322impl std::marker::Unpin for ClientRequestStream {}
323
324impl futures::stream::FusedStream for ClientRequestStream {
325    fn is_terminated(&self) -> bool {
326        self.is_terminated
327    }
328}
329
330impl fidl::endpoints::RequestStream for ClientRequestStream {
331    type Protocol = ClientMarker;
332    type ControlHandle = ClientControlHandle;
333
334    fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
335        Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
336    }
337
338    fn control_handle(&self) -> Self::ControlHandle {
339        ClientControlHandle { inner: self.inner.clone() }
340    }
341
342    fn into_inner(
343        self,
344    ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
345    {
346        (self.inner, self.is_terminated)
347    }
348
349    fn from_inner(
350        inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
351        is_terminated: bool,
352    ) -> Self {
353        Self { inner, is_terminated }
354    }
355}
356
357impl futures::Stream for ClientRequestStream {
358    type Item = Result<ClientRequest, fidl::Error>;
359
360    fn poll_next(
361        mut self: std::pin::Pin<&mut Self>,
362        cx: &mut std::task::Context<'_>,
363    ) -> std::task::Poll<Option<Self::Item>> {
364        let this = &mut *self;
365        if this.inner.check_shutdown(cx) {
366            this.is_terminated = true;
367            return std::task::Poll::Ready(None);
368        }
369        if this.is_terminated {
370            panic!("polled ClientRequestStream after completion");
371        }
372        fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
373            |bytes, handles| {
374                match this.inner.channel().read_etc(cx, bytes, handles) {
375                    std::task::Poll::Ready(Ok(())) => {}
376                    std::task::Poll::Pending => return std::task::Poll::Pending,
377                    std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
378                        this.is_terminated = true;
379                        return std::task::Poll::Ready(None);
380                    }
381                    std::task::Poll::Ready(Err(e)) => {
382                        return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
383                            e.into(),
384                        ))));
385                    }
386                }
387
388                // A message has been received from the channel
389                let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
390
391                std::task::Poll::Ready(Some(match header.ordinal {
392                    0x367b6c1e1540fb99 => {
393                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
394                        let mut req = fidl::new_empty!(
395                            ClientListServicesRequest,
396                            fidl::encoding::DefaultFuchsiaResourceDialect
397                        );
398                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<ClientListServicesRequest>(&header, _body_bytes, handles, &mut req)?;
399                        let control_handle = ClientControlHandle { inner: this.inner.clone() };
400                        Ok(ClientRequest::ListServices {
401                            uuids: req.uuids,
402
403                            responder: ClientListServicesResponder {
404                                control_handle: std::mem::ManuallyDrop::new(control_handle),
405                                tx_id: header.tx_id,
406                            },
407                        })
408                    }
409                    0x45ca1666a35cd25 => {
410                        header.validate_request_tx_id(fidl::MethodType::OneWay)?;
411                        let mut req = fidl::new_empty!(
412                            ClientConnectToServiceRequest,
413                            fidl::encoding::DefaultFuchsiaResourceDialect
414                        );
415                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<ClientConnectToServiceRequest>(&header, _body_bytes, handles, &mut req)?;
416                        let control_handle = ClientControlHandle { inner: this.inner.clone() };
417                        Ok(ClientRequest::ConnectToService {
418                            id: req.id,
419                            service: req.service,
420
421                            control_handle,
422                        })
423                    }
424                    _ => Err(fidl::Error::UnknownOrdinal {
425                        ordinal: header.ordinal,
426                        protocol_name:
427                            <ClientMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
428                    }),
429                }))
430            },
431        )
432    }
433}
434
435#[derive(Debug)]
436pub enum ClientRequest {
437    /// Enumerates services found on the peer that this Client represents. Results
438    /// can be restricted by specifying a list of UUIDs in `uuids`. The returned
439    /// ServiceInfo structures will contain only basic information about each
440    /// service and the `characteristics` and `includes` fields will be null.
441    ///
442    /// To further interact with services, clients must obtain a RemoteService
443    /// handle by calling ConnectToService().
444    ListServices { uuids: Option<Vec<String>>, responder: ClientListServicesResponder },
445    /// Connects the RemoteService with the given identifier.
446    ConnectToService {
447        id: u64,
448        service: fidl::endpoints::ServerEnd<RemoteServiceMarker>,
449        control_handle: ClientControlHandle,
450    },
451}
452
453impl ClientRequest {
454    #[allow(irrefutable_let_patterns)]
455    pub fn into_list_services(self) -> Option<(Option<Vec<String>>, ClientListServicesResponder)> {
456        if let ClientRequest::ListServices { uuids, responder } = self {
457            Some((uuids, responder))
458        } else {
459            None
460        }
461    }
462
463    #[allow(irrefutable_let_patterns)]
464    pub fn into_connect_to_service(
465        self,
466    ) -> Option<(u64, fidl::endpoints::ServerEnd<RemoteServiceMarker>, ClientControlHandle)> {
467        if let ClientRequest::ConnectToService { id, service, control_handle } = self {
468            Some((id, service, control_handle))
469        } else {
470            None
471        }
472    }
473
474    /// Name of the method defined in FIDL
475    pub fn method_name(&self) -> &'static str {
476        match *self {
477            ClientRequest::ListServices { .. } => "list_services",
478            ClientRequest::ConnectToService { .. } => "connect_to_service",
479        }
480    }
481}
482
483#[derive(Debug, Clone)]
484pub struct ClientControlHandle {
485    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
486}
487
488impl fidl::endpoints::ControlHandle for ClientControlHandle {
489    fn shutdown(&self) {
490        self.inner.shutdown()
491    }
492
493    fn shutdown_with_epitaph(&self, status: zx_status::Status) {
494        self.inner.shutdown_with_epitaph(status)
495    }
496
497    fn is_closed(&self) -> bool {
498        self.inner.channel().is_closed()
499    }
500    fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
501        self.inner.channel().on_closed()
502    }
503
504    #[cfg(target_os = "fuchsia")]
505    fn signal_peer(
506        &self,
507        clear_mask: zx::Signals,
508        set_mask: zx::Signals,
509    ) -> Result<(), zx_status::Status> {
510        use fidl::Peered;
511        self.inner.channel().signal_peer(clear_mask, set_mask)
512    }
513}
514
515impl ClientControlHandle {}
516
517#[must_use = "FIDL methods require a response to be sent"]
518#[derive(Debug)]
519pub struct ClientListServicesResponder {
520    control_handle: std::mem::ManuallyDrop<ClientControlHandle>,
521    tx_id: u32,
522}
523
524/// Set the the channel to be shutdown (see [`ClientControlHandle::shutdown`])
525/// if the responder is dropped without sending a response, so that the client
526/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
527impl std::ops::Drop for ClientListServicesResponder {
528    fn drop(&mut self) {
529        self.control_handle.shutdown();
530        // Safety: drops once, never accessed again
531        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
532    }
533}
534
535impl fidl::endpoints::Responder for ClientListServicesResponder {
536    type ControlHandle = ClientControlHandle;
537
538    fn control_handle(&self) -> &ClientControlHandle {
539        &self.control_handle
540    }
541
542    fn drop_without_shutdown(mut self) {
543        // Safety: drops once, never accessed again due to mem::forget
544        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
545        // Prevent Drop from running (which would shut down the channel)
546        std::mem::forget(self);
547    }
548}
549
550impl ClientListServicesResponder {
551    /// Sends a response to the FIDL transaction.
552    ///
553    /// Sets the channel to shutdown if an error occurs.
554    pub fn send(
555        self,
556        mut status: &fidl_fuchsia_bluetooth::Status,
557        mut services: &[ServiceInfo],
558    ) -> Result<(), fidl::Error> {
559        let _result = self.send_raw(status, services);
560        if _result.is_err() {
561            self.control_handle.shutdown();
562        }
563        self.drop_without_shutdown();
564        _result
565    }
566
567    /// Similar to "send" but does not shutdown the channel if an error occurs.
568    pub fn send_no_shutdown_on_err(
569        self,
570        mut status: &fidl_fuchsia_bluetooth::Status,
571        mut services: &[ServiceInfo],
572    ) -> Result<(), fidl::Error> {
573        let _result = self.send_raw(status, services);
574        self.drop_without_shutdown();
575        _result
576    }
577
578    fn send_raw(
579        &self,
580        mut status: &fidl_fuchsia_bluetooth::Status,
581        mut services: &[ServiceInfo],
582    ) -> Result<(), fidl::Error> {
583        self.control_handle.inner.send::<ClientListServicesResponse>(
584            (status, services),
585            self.tx_id,
586            0x367b6c1e1540fb99,
587            fidl::encoding::DynamicFlags::empty(),
588        )
589    }
590}
591
592#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
593pub struct LocalServiceMarker;
594
595impl fidl::endpoints::ProtocolMarker for LocalServiceMarker {
596    type Proxy = LocalServiceProxy;
597    type RequestStream = LocalServiceRequestStream;
598    #[cfg(target_os = "fuchsia")]
599    type SynchronousProxy = LocalServiceSynchronousProxy;
600
601    const DEBUG_NAME: &'static str = "(anonymous) LocalService";
602}
603
604pub trait LocalServiceProxyInterface: Send + Sync {
605    fn r#remove_service(&self) -> Result<(), fidl::Error>;
606    fn r#notify_value(
607        &self,
608        characteristic_id: u64,
609        peer_id: &str,
610        value: &[u8],
611        confirm: bool,
612    ) -> Result<(), fidl::Error>;
613}
614#[derive(Debug)]
615#[cfg(target_os = "fuchsia")]
616pub struct LocalServiceSynchronousProxy {
617    client: fidl::client::sync::Client,
618}
619
620#[cfg(target_os = "fuchsia")]
621impl fidl::endpoints::SynchronousProxy for LocalServiceSynchronousProxy {
622    type Proxy = LocalServiceProxy;
623    type Protocol = LocalServiceMarker;
624
625    fn from_channel(inner: fidl::Channel) -> Self {
626        Self::new(inner)
627    }
628
629    fn into_channel(self) -> fidl::Channel {
630        self.client.into_channel()
631    }
632
633    fn as_channel(&self) -> &fidl::Channel {
634        self.client.as_channel()
635    }
636}
637
638#[cfg(target_os = "fuchsia")]
639impl LocalServiceSynchronousProxy {
640    pub fn new(channel: fidl::Channel) -> Self {
641        Self { client: fidl::client::sync::Client::new(channel) }
642    }
643
644    pub fn into_channel(self) -> fidl::Channel {
645        self.client.into_channel()
646    }
647
648    /// Waits until an event arrives and returns it. It is safe for other
649    /// threads to make concurrent requests while waiting for an event.
650    pub fn wait_for_event(
651        &self,
652        deadline: zx::MonotonicInstant,
653    ) -> Result<LocalServiceEvent, fidl::Error> {
654        LocalServiceEvent::decode(self.client.wait_for_event::<LocalServiceMarker>(deadline)?)
655    }
656
657    /// Removes the service that this interface instance corresponds to. Does
658    /// nothing if the service is already removed.
659    pub fn r#remove_service(&self) -> Result<(), fidl::Error> {
660        self.client.send::<fidl::encoding::EmptyPayload>(
661            (),
662            0x53c92ea8871606f1,
663            fidl::encoding::DynamicFlags::empty(),
664        )
665    }
666
667    /// Sends a notification carrying the `value` of the characteristic with the
668    /// given `characteristic_id` to the device with `peer_id`.
669    ///
670    /// If `confirm` is true, then this method sends an indication instead. If the
671    /// peer fails to confirm the indication, the link between the peer and the
672    /// local adapter will be closed.
673    ///
674    /// This method has no effect if the peer has not enabled notifications or
675    /// indications on the requested characteristic.
676    pub fn r#notify_value(
677        &self,
678        mut characteristic_id: u64,
679        mut peer_id: &str,
680        mut value: &[u8],
681        mut confirm: bool,
682    ) -> Result<(), fidl::Error> {
683        self.client.send::<LocalServiceNotifyValueRequest>(
684            (characteristic_id, peer_id, value, confirm),
685            0x5bb142dfdd6d1fa9,
686            fidl::encoding::DynamicFlags::empty(),
687        )
688    }
689}
690
691#[cfg(target_os = "fuchsia")]
692impl From<LocalServiceSynchronousProxy> for zx::NullableHandle {
693    fn from(value: LocalServiceSynchronousProxy) -> Self {
694        value.into_channel().into()
695    }
696}
697
698#[cfg(target_os = "fuchsia")]
699impl From<fidl::Channel> for LocalServiceSynchronousProxy {
700    fn from(value: fidl::Channel) -> Self {
701        Self::new(value)
702    }
703}
704
705#[cfg(target_os = "fuchsia")]
706impl fidl::endpoints::FromClient for LocalServiceSynchronousProxy {
707    type Protocol = LocalServiceMarker;
708
709    fn from_client(value: fidl::endpoints::ClientEnd<LocalServiceMarker>) -> Self {
710        Self::new(value.into_channel())
711    }
712}
713
714#[derive(Debug, Clone)]
715pub struct LocalServiceProxy {
716    client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
717}
718
719impl fidl::endpoints::Proxy for LocalServiceProxy {
720    type Protocol = LocalServiceMarker;
721
722    fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
723        Self::new(inner)
724    }
725
726    fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
727        self.client.into_channel().map_err(|client| Self { client })
728    }
729
730    fn as_channel(&self) -> &::fidl::AsyncChannel {
731        self.client.as_channel()
732    }
733}
734
735impl LocalServiceProxy {
736    /// Create a new Proxy for fuchsia.bluetooth.gatt/LocalService.
737    pub fn new(channel: ::fidl::AsyncChannel) -> Self {
738        let protocol_name = <LocalServiceMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
739        Self { client: fidl::client::Client::new(channel, protocol_name) }
740    }
741
742    /// Get a Stream of events from the remote end of the protocol.
743    ///
744    /// # Panics
745    ///
746    /// Panics if the event stream was already taken.
747    pub fn take_event_stream(&self) -> LocalServiceEventStream {
748        LocalServiceEventStream { event_receiver: self.client.take_event_receiver() }
749    }
750
751    /// Removes the service that this interface instance corresponds to. Does
752    /// nothing if the service is already removed.
753    pub fn r#remove_service(&self) -> Result<(), fidl::Error> {
754        LocalServiceProxyInterface::r#remove_service(self)
755    }
756
757    /// Sends a notification carrying the `value` of the characteristic with the
758    /// given `characteristic_id` to the device with `peer_id`.
759    ///
760    /// If `confirm` is true, then this method sends an indication instead. If the
761    /// peer fails to confirm the indication, the link between the peer and the
762    /// local adapter will be closed.
763    ///
764    /// This method has no effect if the peer has not enabled notifications or
765    /// indications on the requested characteristic.
766    pub fn r#notify_value(
767        &self,
768        mut characteristic_id: u64,
769        mut peer_id: &str,
770        mut value: &[u8],
771        mut confirm: bool,
772    ) -> Result<(), fidl::Error> {
773        LocalServiceProxyInterface::r#notify_value(self, characteristic_id, peer_id, value, confirm)
774    }
775}
776
777impl LocalServiceProxyInterface for LocalServiceProxy {
778    fn r#remove_service(&self) -> Result<(), fidl::Error> {
779        self.client.send::<fidl::encoding::EmptyPayload>(
780            (),
781            0x53c92ea8871606f1,
782            fidl::encoding::DynamicFlags::empty(),
783        )
784    }
785
786    fn r#notify_value(
787        &self,
788        mut characteristic_id: u64,
789        mut peer_id: &str,
790        mut value: &[u8],
791        mut confirm: bool,
792    ) -> Result<(), fidl::Error> {
793        self.client.send::<LocalServiceNotifyValueRequest>(
794            (characteristic_id, peer_id, value, confirm),
795            0x5bb142dfdd6d1fa9,
796            fidl::encoding::DynamicFlags::empty(),
797        )
798    }
799}
800
801pub struct LocalServiceEventStream {
802    event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
803}
804
805impl std::marker::Unpin for LocalServiceEventStream {}
806
807impl futures::stream::FusedStream for LocalServiceEventStream {
808    fn is_terminated(&self) -> bool {
809        self.event_receiver.is_terminated()
810    }
811}
812
813impl futures::Stream for LocalServiceEventStream {
814    type Item = Result<LocalServiceEvent, fidl::Error>;
815
816    fn poll_next(
817        mut self: std::pin::Pin<&mut Self>,
818        cx: &mut std::task::Context<'_>,
819    ) -> std::task::Poll<Option<Self::Item>> {
820        match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
821            &mut self.event_receiver,
822            cx
823        )?) {
824            Some(buf) => std::task::Poll::Ready(Some(LocalServiceEvent::decode(buf))),
825            None => std::task::Poll::Ready(None),
826        }
827    }
828}
829
830#[derive(Debug)]
831pub enum LocalServiceEvent {}
832
833impl LocalServiceEvent {
834    /// Decodes a message buffer as a [`LocalServiceEvent`].
835    fn decode(
836        mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
837    ) -> Result<LocalServiceEvent, fidl::Error> {
838        let (bytes, _handles) = buf.split_mut();
839        let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
840        debug_assert_eq!(tx_header.tx_id, 0);
841        match tx_header.ordinal {
842            _ => Err(fidl::Error::UnknownOrdinal {
843                ordinal: tx_header.ordinal,
844                protocol_name: <LocalServiceMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
845            }),
846        }
847    }
848}
849
850/// A Stream of incoming requests for fuchsia.bluetooth.gatt/LocalService.
851pub struct LocalServiceRequestStream {
852    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
853    is_terminated: bool,
854}
855
856impl std::marker::Unpin for LocalServiceRequestStream {}
857
858impl futures::stream::FusedStream for LocalServiceRequestStream {
859    fn is_terminated(&self) -> bool {
860        self.is_terminated
861    }
862}
863
864impl fidl::endpoints::RequestStream for LocalServiceRequestStream {
865    type Protocol = LocalServiceMarker;
866    type ControlHandle = LocalServiceControlHandle;
867
868    fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
869        Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
870    }
871
872    fn control_handle(&self) -> Self::ControlHandle {
873        LocalServiceControlHandle { inner: self.inner.clone() }
874    }
875
876    fn into_inner(
877        self,
878    ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
879    {
880        (self.inner, self.is_terminated)
881    }
882
883    fn from_inner(
884        inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
885        is_terminated: bool,
886    ) -> Self {
887        Self { inner, is_terminated }
888    }
889}
890
891impl futures::Stream for LocalServiceRequestStream {
892    type Item = Result<LocalServiceRequest, fidl::Error>;
893
894    fn poll_next(
895        mut self: std::pin::Pin<&mut Self>,
896        cx: &mut std::task::Context<'_>,
897    ) -> std::task::Poll<Option<Self::Item>> {
898        let this = &mut *self;
899        if this.inner.check_shutdown(cx) {
900            this.is_terminated = true;
901            return std::task::Poll::Ready(None);
902        }
903        if this.is_terminated {
904            panic!("polled LocalServiceRequestStream after completion");
905        }
906        fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
907            |bytes, handles| {
908                match this.inner.channel().read_etc(cx, bytes, handles) {
909                    std::task::Poll::Ready(Ok(())) => {}
910                    std::task::Poll::Pending => return std::task::Poll::Pending,
911                    std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
912                        this.is_terminated = true;
913                        return std::task::Poll::Ready(None);
914                    }
915                    std::task::Poll::Ready(Err(e)) => {
916                        return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
917                            e.into(),
918                        ))));
919                    }
920                }
921
922                // A message has been received from the channel
923                let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
924
925                std::task::Poll::Ready(Some(match header.ordinal {
926                    0x53c92ea8871606f1 => {
927                        header.validate_request_tx_id(fidl::MethodType::OneWay)?;
928                        let mut req = fidl::new_empty!(
929                            fidl::encoding::EmptyPayload,
930                            fidl::encoding::DefaultFuchsiaResourceDialect
931                        );
932                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
933                        let control_handle =
934                            LocalServiceControlHandle { inner: this.inner.clone() };
935                        Ok(LocalServiceRequest::RemoveService { control_handle })
936                    }
937                    0x5bb142dfdd6d1fa9 => {
938                        header.validate_request_tx_id(fidl::MethodType::OneWay)?;
939                        let mut req = fidl::new_empty!(
940                            LocalServiceNotifyValueRequest,
941                            fidl::encoding::DefaultFuchsiaResourceDialect
942                        );
943                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<LocalServiceNotifyValueRequest>(&header, _body_bytes, handles, &mut req)?;
944                        let control_handle =
945                            LocalServiceControlHandle { inner: this.inner.clone() };
946                        Ok(LocalServiceRequest::NotifyValue {
947                            characteristic_id: req.characteristic_id,
948                            peer_id: req.peer_id,
949                            value: req.value,
950                            confirm: req.confirm,
951
952                            control_handle,
953                        })
954                    }
955                    _ => Err(fidl::Error::UnknownOrdinal {
956                        ordinal: header.ordinal,
957                        protocol_name:
958                            <LocalServiceMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
959                    }),
960                }))
961            },
962        )
963    }
964}
965
966/// Interface for communicating with a published service.
967#[derive(Debug)]
968pub enum LocalServiceRequest {
969    /// Removes the service that this interface instance corresponds to. Does
970    /// nothing if the service is already removed.
971    RemoveService { control_handle: LocalServiceControlHandle },
972    /// Sends a notification carrying the `value` of the characteristic with the
973    /// given `characteristic_id` to the device with `peer_id`.
974    ///
975    /// If `confirm` is true, then this method sends an indication instead. If the
976    /// peer fails to confirm the indication, the link between the peer and the
977    /// local adapter will be closed.
978    ///
979    /// This method has no effect if the peer has not enabled notifications or
980    /// indications on the requested characteristic.
981    NotifyValue {
982        characteristic_id: u64,
983        peer_id: String,
984        value: Vec<u8>,
985        confirm: bool,
986        control_handle: LocalServiceControlHandle,
987    },
988}
989
990impl LocalServiceRequest {
991    #[allow(irrefutable_let_patterns)]
992    pub fn into_remove_service(self) -> Option<(LocalServiceControlHandle)> {
993        if let LocalServiceRequest::RemoveService { control_handle } = self {
994            Some((control_handle))
995        } else {
996            None
997        }
998    }
999
1000    #[allow(irrefutable_let_patterns)]
1001    pub fn into_notify_value(
1002        self,
1003    ) -> Option<(u64, String, Vec<u8>, bool, LocalServiceControlHandle)> {
1004        if let LocalServiceRequest::NotifyValue {
1005            characteristic_id,
1006            peer_id,
1007            value,
1008            confirm,
1009            control_handle,
1010        } = self
1011        {
1012            Some((characteristic_id, peer_id, value, confirm, control_handle))
1013        } else {
1014            None
1015        }
1016    }
1017
1018    /// Name of the method defined in FIDL
1019    pub fn method_name(&self) -> &'static str {
1020        match *self {
1021            LocalServiceRequest::RemoveService { .. } => "remove_service",
1022            LocalServiceRequest::NotifyValue { .. } => "notify_value",
1023        }
1024    }
1025}
1026
1027#[derive(Debug, Clone)]
1028pub struct LocalServiceControlHandle {
1029    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
1030}
1031
1032impl fidl::endpoints::ControlHandle for LocalServiceControlHandle {
1033    fn shutdown(&self) {
1034        self.inner.shutdown()
1035    }
1036
1037    fn shutdown_with_epitaph(&self, status: zx_status::Status) {
1038        self.inner.shutdown_with_epitaph(status)
1039    }
1040
1041    fn is_closed(&self) -> bool {
1042        self.inner.channel().is_closed()
1043    }
1044    fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
1045        self.inner.channel().on_closed()
1046    }
1047
1048    #[cfg(target_os = "fuchsia")]
1049    fn signal_peer(
1050        &self,
1051        clear_mask: zx::Signals,
1052        set_mask: zx::Signals,
1053    ) -> Result<(), zx_status::Status> {
1054        use fidl::Peered;
1055        self.inner.channel().signal_peer(clear_mask, set_mask)
1056    }
1057}
1058
1059impl LocalServiceControlHandle {}
1060
1061#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
1062pub struct LocalServiceDelegateMarker;
1063
1064impl fidl::endpoints::ProtocolMarker for LocalServiceDelegateMarker {
1065    type Proxy = LocalServiceDelegateProxy;
1066    type RequestStream = LocalServiceDelegateRequestStream;
1067    #[cfg(target_os = "fuchsia")]
1068    type SynchronousProxy = LocalServiceDelegateSynchronousProxy;
1069
1070    const DEBUG_NAME: &'static str = "(anonymous) LocalServiceDelegate";
1071}
1072
1073pub trait LocalServiceDelegateProxyInterface: Send + Sync {
1074    fn r#on_characteristic_configuration(
1075        &self,
1076        characteristic_id: u64,
1077        peer_id: &str,
1078        notify: bool,
1079        indicate: bool,
1080    ) -> Result<(), fidl::Error>;
1081    type OnReadValueResponseFut: std::future::Future<Output = Result<(Option<Vec<u8>>, ErrorCode), fidl::Error>>
1082        + Send;
1083    fn r#on_read_value(&self, id: u64, offset: i32) -> Self::OnReadValueResponseFut;
1084    type OnWriteValueResponseFut: std::future::Future<Output = Result<ErrorCode, fidl::Error>>
1085        + Send;
1086    fn r#on_write_value(&self, id: u64, offset: u16, value: &[u8])
1087    -> Self::OnWriteValueResponseFut;
1088    fn r#on_write_without_response(
1089        &self,
1090        id: u64,
1091        offset: u16,
1092        value: &[u8],
1093    ) -> Result<(), fidl::Error>;
1094}
1095#[derive(Debug)]
1096#[cfg(target_os = "fuchsia")]
1097pub struct LocalServiceDelegateSynchronousProxy {
1098    client: fidl::client::sync::Client,
1099}
1100
1101#[cfg(target_os = "fuchsia")]
1102impl fidl::endpoints::SynchronousProxy for LocalServiceDelegateSynchronousProxy {
1103    type Proxy = LocalServiceDelegateProxy;
1104    type Protocol = LocalServiceDelegateMarker;
1105
1106    fn from_channel(inner: fidl::Channel) -> Self {
1107        Self::new(inner)
1108    }
1109
1110    fn into_channel(self) -> fidl::Channel {
1111        self.client.into_channel()
1112    }
1113
1114    fn as_channel(&self) -> &fidl::Channel {
1115        self.client.as_channel()
1116    }
1117}
1118
1119#[cfg(target_os = "fuchsia")]
1120impl LocalServiceDelegateSynchronousProxy {
1121    pub fn new(channel: fidl::Channel) -> Self {
1122        Self { client: fidl::client::sync::Client::new(channel) }
1123    }
1124
1125    pub fn into_channel(self) -> fidl::Channel {
1126        self.client.into_channel()
1127    }
1128
1129    /// Waits until an event arrives and returns it. It is safe for other
1130    /// threads to make concurrent requests while waiting for an event.
1131    pub fn wait_for_event(
1132        &self,
1133        deadline: zx::MonotonicInstant,
1134    ) -> Result<LocalServiceDelegateEvent, fidl::Error> {
1135        LocalServiceDelegateEvent::decode(
1136            self.client.wait_for_event::<LocalServiceDelegateMarker>(deadline)?,
1137        )
1138    }
1139
1140    /// Notifies the delegate when a remote device with `peer_id` enables or
1141    /// disables notifications or indications on the characteristic with the given
1142    /// `characteristic_id`.
1143    pub fn r#on_characteristic_configuration(
1144        &self,
1145        mut characteristic_id: u64,
1146        mut peer_id: &str,
1147        mut notify: bool,
1148        mut indicate: bool,
1149    ) -> Result<(), fidl::Error> {
1150        self.client.send::<LocalServiceDelegateOnCharacteristicConfigurationRequest>(
1151            (characteristic_id, peer_id, notify, indicate),
1152            0x71384022749a6e90,
1153            fidl::encoding::DynamicFlags::empty(),
1154        )
1155    }
1156
1157    /// Called when a remote device issues a request to read the value of the
1158    /// of the characteristic or descriptor with given identifier. The delegate
1159    /// must respond to the request by returning the characteristic value. If the
1160    /// read request resulted in an error it should be returned in `error_code`.
1161    /// On success, `error_code` should be set to NO_ERROR and a `value` should be
1162    /// provided.
1163    pub fn r#on_read_value(
1164        &self,
1165        mut id: u64,
1166        mut offset: i32,
1167        ___deadline: zx::MonotonicInstant,
1168    ) -> Result<(Option<Vec<u8>>, ErrorCode), fidl::Error> {
1169        let _response = self.client.send_query::<
1170            LocalServiceDelegateOnReadValueRequest,
1171            LocalServiceDelegateOnReadValueResponse,
1172            LocalServiceDelegateMarker,
1173        >(
1174            (id, offset,),
1175            0x2f11da4cc774629,
1176            fidl::encoding::DynamicFlags::empty(),
1177            ___deadline,
1178        )?;
1179        Ok((_response.value, _response.status))
1180    }
1181
1182    /// Called when a remote device issues a request to write the value of the
1183    /// characteristic or descriptor with the given identifier.
1184    pub fn r#on_write_value(
1185        &self,
1186        mut id: u64,
1187        mut offset: u16,
1188        mut value: &[u8],
1189        ___deadline: zx::MonotonicInstant,
1190    ) -> Result<ErrorCode, fidl::Error> {
1191        let _response = self.client.send_query::<
1192            LocalServiceDelegateOnWriteValueRequest,
1193            LocalServiceDelegateOnWriteValueResponse,
1194            LocalServiceDelegateMarker,
1195        >(
1196            (id, offset, value,),
1197            0x2869075d462d3ea5,
1198            fidl::encoding::DynamicFlags::empty(),
1199            ___deadline,
1200        )?;
1201        Ok(_response.status)
1202    }
1203
1204    /// Called when a remote device issues a request to write the value of the
1205    /// characteristic with the given identifier. This can be called on a
1206    /// characteristic with the WRITE_WITHOUT_RESPONSE property.
1207    pub fn r#on_write_without_response(
1208        &self,
1209        mut id: u64,
1210        mut offset: u16,
1211        mut value: &[u8],
1212    ) -> Result<(), fidl::Error> {
1213        self.client.send::<LocalServiceDelegateOnWriteWithoutResponseRequest>(
1214            (id, offset, value),
1215            0x66ec30d296fd8d64,
1216            fidl::encoding::DynamicFlags::empty(),
1217        )
1218    }
1219}
1220
1221#[cfg(target_os = "fuchsia")]
1222impl From<LocalServiceDelegateSynchronousProxy> for zx::NullableHandle {
1223    fn from(value: LocalServiceDelegateSynchronousProxy) -> Self {
1224        value.into_channel().into()
1225    }
1226}
1227
1228#[cfg(target_os = "fuchsia")]
1229impl From<fidl::Channel> for LocalServiceDelegateSynchronousProxy {
1230    fn from(value: fidl::Channel) -> Self {
1231        Self::new(value)
1232    }
1233}
1234
1235#[cfg(target_os = "fuchsia")]
1236impl fidl::endpoints::FromClient for LocalServiceDelegateSynchronousProxy {
1237    type Protocol = LocalServiceDelegateMarker;
1238
1239    fn from_client(value: fidl::endpoints::ClientEnd<LocalServiceDelegateMarker>) -> Self {
1240        Self::new(value.into_channel())
1241    }
1242}
1243
1244#[derive(Debug, Clone)]
1245pub struct LocalServiceDelegateProxy {
1246    client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
1247}
1248
1249impl fidl::endpoints::Proxy for LocalServiceDelegateProxy {
1250    type Protocol = LocalServiceDelegateMarker;
1251
1252    fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
1253        Self::new(inner)
1254    }
1255
1256    fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
1257        self.client.into_channel().map_err(|client| Self { client })
1258    }
1259
1260    fn as_channel(&self) -> &::fidl::AsyncChannel {
1261        self.client.as_channel()
1262    }
1263}
1264
1265impl LocalServiceDelegateProxy {
1266    /// Create a new Proxy for fuchsia.bluetooth.gatt/LocalServiceDelegate.
1267    pub fn new(channel: ::fidl::AsyncChannel) -> Self {
1268        let protocol_name =
1269            <LocalServiceDelegateMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
1270        Self { client: fidl::client::Client::new(channel, protocol_name) }
1271    }
1272
1273    /// Get a Stream of events from the remote end of the protocol.
1274    ///
1275    /// # Panics
1276    ///
1277    /// Panics if the event stream was already taken.
1278    pub fn take_event_stream(&self) -> LocalServiceDelegateEventStream {
1279        LocalServiceDelegateEventStream { event_receiver: self.client.take_event_receiver() }
1280    }
1281
1282    /// Notifies the delegate when a remote device with `peer_id` enables or
1283    /// disables notifications or indications on the characteristic with the given
1284    /// `characteristic_id`.
1285    pub fn r#on_characteristic_configuration(
1286        &self,
1287        mut characteristic_id: u64,
1288        mut peer_id: &str,
1289        mut notify: bool,
1290        mut indicate: bool,
1291    ) -> Result<(), fidl::Error> {
1292        LocalServiceDelegateProxyInterface::r#on_characteristic_configuration(
1293            self,
1294            characteristic_id,
1295            peer_id,
1296            notify,
1297            indicate,
1298        )
1299    }
1300
1301    /// Called when a remote device issues a request to read the value of the
1302    /// of the characteristic or descriptor with given identifier. The delegate
1303    /// must respond to the request by returning the characteristic value. If the
1304    /// read request resulted in an error it should be returned in `error_code`.
1305    /// On success, `error_code` should be set to NO_ERROR and a `value` should be
1306    /// provided.
1307    pub fn r#on_read_value(
1308        &self,
1309        mut id: u64,
1310        mut offset: i32,
1311    ) -> fidl::client::QueryResponseFut<
1312        (Option<Vec<u8>>, ErrorCode),
1313        fidl::encoding::DefaultFuchsiaResourceDialect,
1314    > {
1315        LocalServiceDelegateProxyInterface::r#on_read_value(self, id, offset)
1316    }
1317
1318    /// Called when a remote device issues a request to write the value of the
1319    /// characteristic or descriptor with the given identifier.
1320    pub fn r#on_write_value(
1321        &self,
1322        mut id: u64,
1323        mut offset: u16,
1324        mut value: &[u8],
1325    ) -> fidl::client::QueryResponseFut<ErrorCode, fidl::encoding::DefaultFuchsiaResourceDialect>
1326    {
1327        LocalServiceDelegateProxyInterface::r#on_write_value(self, id, offset, value)
1328    }
1329
1330    /// Called when a remote device issues a request to write the value of the
1331    /// characteristic with the given identifier. This can be called on a
1332    /// characteristic with the WRITE_WITHOUT_RESPONSE property.
1333    pub fn r#on_write_without_response(
1334        &self,
1335        mut id: u64,
1336        mut offset: u16,
1337        mut value: &[u8],
1338    ) -> Result<(), fidl::Error> {
1339        LocalServiceDelegateProxyInterface::r#on_write_without_response(self, id, offset, value)
1340    }
1341}
1342
1343impl LocalServiceDelegateProxyInterface for LocalServiceDelegateProxy {
1344    fn r#on_characteristic_configuration(
1345        &self,
1346        mut characteristic_id: u64,
1347        mut peer_id: &str,
1348        mut notify: bool,
1349        mut indicate: bool,
1350    ) -> Result<(), fidl::Error> {
1351        self.client.send::<LocalServiceDelegateOnCharacteristicConfigurationRequest>(
1352            (characteristic_id, peer_id, notify, indicate),
1353            0x71384022749a6e90,
1354            fidl::encoding::DynamicFlags::empty(),
1355        )
1356    }
1357
1358    type OnReadValueResponseFut = fidl::client::QueryResponseFut<
1359        (Option<Vec<u8>>, ErrorCode),
1360        fidl::encoding::DefaultFuchsiaResourceDialect,
1361    >;
1362    fn r#on_read_value(&self, mut id: u64, mut offset: i32) -> Self::OnReadValueResponseFut {
1363        fn _decode(
1364            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
1365        ) -> Result<(Option<Vec<u8>>, ErrorCode), fidl::Error> {
1366            let _response = fidl::client::decode_transaction_body::<
1367                LocalServiceDelegateOnReadValueResponse,
1368                fidl::encoding::DefaultFuchsiaResourceDialect,
1369                0x2f11da4cc774629,
1370            >(_buf?)?;
1371            Ok((_response.value, _response.status))
1372        }
1373        self.client.send_query_and_decode::<
1374            LocalServiceDelegateOnReadValueRequest,
1375            (Option<Vec<u8>>, ErrorCode),
1376        >(
1377            (id, offset,),
1378            0x2f11da4cc774629,
1379            fidl::encoding::DynamicFlags::empty(),
1380            _decode,
1381        )
1382    }
1383
1384    type OnWriteValueResponseFut =
1385        fidl::client::QueryResponseFut<ErrorCode, fidl::encoding::DefaultFuchsiaResourceDialect>;
1386    fn r#on_write_value(
1387        &self,
1388        mut id: u64,
1389        mut offset: u16,
1390        mut value: &[u8],
1391    ) -> Self::OnWriteValueResponseFut {
1392        fn _decode(
1393            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
1394        ) -> Result<ErrorCode, fidl::Error> {
1395            let _response = fidl::client::decode_transaction_body::<
1396                LocalServiceDelegateOnWriteValueResponse,
1397                fidl::encoding::DefaultFuchsiaResourceDialect,
1398                0x2869075d462d3ea5,
1399            >(_buf?)?;
1400            Ok(_response.status)
1401        }
1402        self.client.send_query_and_decode::<LocalServiceDelegateOnWriteValueRequest, ErrorCode>(
1403            (id, offset, value),
1404            0x2869075d462d3ea5,
1405            fidl::encoding::DynamicFlags::empty(),
1406            _decode,
1407        )
1408    }
1409
1410    fn r#on_write_without_response(
1411        &self,
1412        mut id: u64,
1413        mut offset: u16,
1414        mut value: &[u8],
1415    ) -> Result<(), fidl::Error> {
1416        self.client.send::<LocalServiceDelegateOnWriteWithoutResponseRequest>(
1417            (id, offset, value),
1418            0x66ec30d296fd8d64,
1419            fidl::encoding::DynamicFlags::empty(),
1420        )
1421    }
1422}
1423
1424pub struct LocalServiceDelegateEventStream {
1425    event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
1426}
1427
1428impl std::marker::Unpin for LocalServiceDelegateEventStream {}
1429
1430impl futures::stream::FusedStream for LocalServiceDelegateEventStream {
1431    fn is_terminated(&self) -> bool {
1432        self.event_receiver.is_terminated()
1433    }
1434}
1435
1436impl futures::Stream for LocalServiceDelegateEventStream {
1437    type Item = Result<LocalServiceDelegateEvent, fidl::Error>;
1438
1439    fn poll_next(
1440        mut self: std::pin::Pin<&mut Self>,
1441        cx: &mut std::task::Context<'_>,
1442    ) -> std::task::Poll<Option<Self::Item>> {
1443        match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
1444            &mut self.event_receiver,
1445            cx
1446        )?) {
1447            Some(buf) => std::task::Poll::Ready(Some(LocalServiceDelegateEvent::decode(buf))),
1448            None => std::task::Poll::Ready(None),
1449        }
1450    }
1451}
1452
1453#[derive(Debug)]
1454pub enum LocalServiceDelegateEvent {}
1455
1456impl LocalServiceDelegateEvent {
1457    /// Decodes a message buffer as a [`LocalServiceDelegateEvent`].
1458    fn decode(
1459        mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
1460    ) -> Result<LocalServiceDelegateEvent, fidl::Error> {
1461        let (bytes, _handles) = buf.split_mut();
1462        let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
1463        debug_assert_eq!(tx_header.tx_id, 0);
1464        match tx_header.ordinal {
1465            _ => Err(fidl::Error::UnknownOrdinal {
1466                ordinal: tx_header.ordinal,
1467                protocol_name:
1468                    <LocalServiceDelegateMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
1469            }),
1470        }
1471    }
1472}
1473
1474/// A Stream of incoming requests for fuchsia.bluetooth.gatt/LocalServiceDelegate.
1475pub struct LocalServiceDelegateRequestStream {
1476    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
1477    is_terminated: bool,
1478}
1479
1480impl std::marker::Unpin for LocalServiceDelegateRequestStream {}
1481
1482impl futures::stream::FusedStream for LocalServiceDelegateRequestStream {
1483    fn is_terminated(&self) -> bool {
1484        self.is_terminated
1485    }
1486}
1487
1488impl fidl::endpoints::RequestStream for LocalServiceDelegateRequestStream {
1489    type Protocol = LocalServiceDelegateMarker;
1490    type ControlHandle = LocalServiceDelegateControlHandle;
1491
1492    fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
1493        Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
1494    }
1495
1496    fn control_handle(&self) -> Self::ControlHandle {
1497        LocalServiceDelegateControlHandle { inner: self.inner.clone() }
1498    }
1499
1500    fn into_inner(
1501        self,
1502    ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
1503    {
1504        (self.inner, self.is_terminated)
1505    }
1506
1507    fn from_inner(
1508        inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
1509        is_terminated: bool,
1510    ) -> Self {
1511        Self { inner, is_terminated }
1512    }
1513}
1514
1515impl futures::Stream for LocalServiceDelegateRequestStream {
1516    type Item = Result<LocalServiceDelegateRequest, fidl::Error>;
1517
1518    fn poll_next(
1519        mut self: std::pin::Pin<&mut Self>,
1520        cx: &mut std::task::Context<'_>,
1521    ) -> std::task::Poll<Option<Self::Item>> {
1522        let this = &mut *self;
1523        if this.inner.check_shutdown(cx) {
1524            this.is_terminated = true;
1525            return std::task::Poll::Ready(None);
1526        }
1527        if this.is_terminated {
1528            panic!("polled LocalServiceDelegateRequestStream after completion");
1529        }
1530        fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
1531            |bytes, handles| {
1532                match this.inner.channel().read_etc(cx, bytes, handles) {
1533                    std::task::Poll::Ready(Ok(())) => {}
1534                    std::task::Poll::Pending => return std::task::Poll::Pending,
1535                    std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
1536                        this.is_terminated = true;
1537                        return std::task::Poll::Ready(None);
1538                    }
1539                    std::task::Poll::Ready(Err(e)) => {
1540                        return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
1541                            e.into(),
1542                        ))));
1543                    }
1544                }
1545
1546                // A message has been received from the channel
1547                let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
1548
1549                std::task::Poll::Ready(Some(match header.ordinal {
1550                0x71384022749a6e90 => {
1551                    header.validate_request_tx_id(fidl::MethodType::OneWay)?;
1552                    let mut req = fidl::new_empty!(LocalServiceDelegateOnCharacteristicConfigurationRequest, fidl::encoding::DefaultFuchsiaResourceDialect);
1553                    fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<LocalServiceDelegateOnCharacteristicConfigurationRequest>(&header, _body_bytes, handles, &mut req)?;
1554                    let control_handle = LocalServiceDelegateControlHandle {
1555                        inner: this.inner.clone(),
1556                    };
1557                    Ok(LocalServiceDelegateRequest::OnCharacteristicConfiguration {characteristic_id: req.characteristic_id,
1558peer_id: req.peer_id,
1559notify: req.notify,
1560indicate: req.indicate,
1561
1562                        control_handle,
1563                    })
1564                }
1565                0x2f11da4cc774629 => {
1566                    header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
1567                    let mut req = fidl::new_empty!(LocalServiceDelegateOnReadValueRequest, fidl::encoding::DefaultFuchsiaResourceDialect);
1568                    fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<LocalServiceDelegateOnReadValueRequest>(&header, _body_bytes, handles, &mut req)?;
1569                    let control_handle = LocalServiceDelegateControlHandle {
1570                        inner: this.inner.clone(),
1571                    };
1572                    Ok(LocalServiceDelegateRequest::OnReadValue {id: req.id,
1573offset: req.offset,
1574
1575                        responder: LocalServiceDelegateOnReadValueResponder {
1576                            control_handle: std::mem::ManuallyDrop::new(control_handle),
1577                            tx_id: header.tx_id,
1578                        },
1579                    })
1580                }
1581                0x2869075d462d3ea5 => {
1582                    header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
1583                    let mut req = fidl::new_empty!(LocalServiceDelegateOnWriteValueRequest, fidl::encoding::DefaultFuchsiaResourceDialect);
1584                    fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<LocalServiceDelegateOnWriteValueRequest>(&header, _body_bytes, handles, &mut req)?;
1585                    let control_handle = LocalServiceDelegateControlHandle {
1586                        inner: this.inner.clone(),
1587                    };
1588                    Ok(LocalServiceDelegateRequest::OnWriteValue {id: req.id,
1589offset: req.offset,
1590value: req.value,
1591
1592                        responder: LocalServiceDelegateOnWriteValueResponder {
1593                            control_handle: std::mem::ManuallyDrop::new(control_handle),
1594                            tx_id: header.tx_id,
1595                        },
1596                    })
1597                }
1598                0x66ec30d296fd8d64 => {
1599                    header.validate_request_tx_id(fidl::MethodType::OneWay)?;
1600                    let mut req = fidl::new_empty!(LocalServiceDelegateOnWriteWithoutResponseRequest, fidl::encoding::DefaultFuchsiaResourceDialect);
1601                    fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<LocalServiceDelegateOnWriteWithoutResponseRequest>(&header, _body_bytes, handles, &mut req)?;
1602                    let control_handle = LocalServiceDelegateControlHandle {
1603                        inner: this.inner.clone(),
1604                    };
1605                    Ok(LocalServiceDelegateRequest::OnWriteWithoutResponse {id: req.id,
1606offset: req.offset,
1607value: req.value,
1608
1609                        control_handle,
1610                    })
1611                }
1612                _ => Err(fidl::Error::UnknownOrdinal {
1613                    ordinal: header.ordinal,
1614                    protocol_name: <LocalServiceDelegateMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
1615                }),
1616            }))
1617            },
1618        )
1619    }
1620}
1621
1622/// Interface for responding to requests on a local service.
1623#[derive(Debug)]
1624pub enum LocalServiceDelegateRequest {
1625    /// Notifies the delegate when a remote device with `peer_id` enables or
1626    /// disables notifications or indications on the characteristic with the given
1627    /// `characteristic_id`.
1628    OnCharacteristicConfiguration {
1629        characteristic_id: u64,
1630        peer_id: String,
1631        notify: bool,
1632        indicate: bool,
1633        control_handle: LocalServiceDelegateControlHandle,
1634    },
1635    /// Called when a remote device issues a request to read the value of the
1636    /// of the characteristic or descriptor with given identifier. The delegate
1637    /// must respond to the request by returning the characteristic value. If the
1638    /// read request resulted in an error it should be returned in `error_code`.
1639    /// On success, `error_code` should be set to NO_ERROR and a `value` should be
1640    /// provided.
1641    OnReadValue { id: u64, offset: i32, responder: LocalServiceDelegateOnReadValueResponder },
1642    /// Called when a remote device issues a request to write the value of the
1643    /// characteristic or descriptor with the given identifier.
1644    OnWriteValue {
1645        id: u64,
1646        offset: u16,
1647        value: Vec<u8>,
1648        responder: LocalServiceDelegateOnWriteValueResponder,
1649    },
1650    /// Called when a remote device issues a request to write the value of the
1651    /// characteristic with the given identifier. This can be called on a
1652    /// characteristic with the WRITE_WITHOUT_RESPONSE property.
1653    OnWriteWithoutResponse {
1654        id: u64,
1655        offset: u16,
1656        value: Vec<u8>,
1657        control_handle: LocalServiceDelegateControlHandle,
1658    },
1659}
1660
1661impl LocalServiceDelegateRequest {
1662    #[allow(irrefutable_let_patterns)]
1663    pub fn into_on_characteristic_configuration(
1664        self,
1665    ) -> Option<(u64, String, bool, bool, LocalServiceDelegateControlHandle)> {
1666        if let LocalServiceDelegateRequest::OnCharacteristicConfiguration {
1667            characteristic_id,
1668            peer_id,
1669            notify,
1670            indicate,
1671            control_handle,
1672        } = self
1673        {
1674            Some((characteristic_id, peer_id, notify, indicate, control_handle))
1675        } else {
1676            None
1677        }
1678    }
1679
1680    #[allow(irrefutable_let_patterns)]
1681    pub fn into_on_read_value(
1682        self,
1683    ) -> Option<(u64, i32, LocalServiceDelegateOnReadValueResponder)> {
1684        if let LocalServiceDelegateRequest::OnReadValue { id, offset, responder } = self {
1685            Some((id, offset, responder))
1686        } else {
1687            None
1688        }
1689    }
1690
1691    #[allow(irrefutable_let_patterns)]
1692    pub fn into_on_write_value(
1693        self,
1694    ) -> Option<(u64, u16, Vec<u8>, LocalServiceDelegateOnWriteValueResponder)> {
1695        if let LocalServiceDelegateRequest::OnWriteValue { id, offset, value, responder } = self {
1696            Some((id, offset, value, responder))
1697        } else {
1698            None
1699        }
1700    }
1701
1702    #[allow(irrefutable_let_patterns)]
1703    pub fn into_on_write_without_response(
1704        self,
1705    ) -> Option<(u64, u16, Vec<u8>, LocalServiceDelegateControlHandle)> {
1706        if let LocalServiceDelegateRequest::OnWriteWithoutResponse {
1707            id,
1708            offset,
1709            value,
1710            control_handle,
1711        } = self
1712        {
1713            Some((id, offset, value, control_handle))
1714        } else {
1715            None
1716        }
1717    }
1718
1719    /// Name of the method defined in FIDL
1720    pub fn method_name(&self) -> &'static str {
1721        match *self {
1722            LocalServiceDelegateRequest::OnCharacteristicConfiguration { .. } => {
1723                "on_characteristic_configuration"
1724            }
1725            LocalServiceDelegateRequest::OnReadValue { .. } => "on_read_value",
1726            LocalServiceDelegateRequest::OnWriteValue { .. } => "on_write_value",
1727            LocalServiceDelegateRequest::OnWriteWithoutResponse { .. } => {
1728                "on_write_without_response"
1729            }
1730        }
1731    }
1732}
1733
1734#[derive(Debug, Clone)]
1735pub struct LocalServiceDelegateControlHandle {
1736    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
1737}
1738
1739impl fidl::endpoints::ControlHandle for LocalServiceDelegateControlHandle {
1740    fn shutdown(&self) {
1741        self.inner.shutdown()
1742    }
1743
1744    fn shutdown_with_epitaph(&self, status: zx_status::Status) {
1745        self.inner.shutdown_with_epitaph(status)
1746    }
1747
1748    fn is_closed(&self) -> bool {
1749        self.inner.channel().is_closed()
1750    }
1751    fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
1752        self.inner.channel().on_closed()
1753    }
1754
1755    #[cfg(target_os = "fuchsia")]
1756    fn signal_peer(
1757        &self,
1758        clear_mask: zx::Signals,
1759        set_mask: zx::Signals,
1760    ) -> Result<(), zx_status::Status> {
1761        use fidl::Peered;
1762        self.inner.channel().signal_peer(clear_mask, set_mask)
1763    }
1764}
1765
1766impl LocalServiceDelegateControlHandle {}
1767
1768#[must_use = "FIDL methods require a response to be sent"]
1769#[derive(Debug)]
1770pub struct LocalServiceDelegateOnReadValueResponder {
1771    control_handle: std::mem::ManuallyDrop<LocalServiceDelegateControlHandle>,
1772    tx_id: u32,
1773}
1774
1775/// Set the the channel to be shutdown (see [`LocalServiceDelegateControlHandle::shutdown`])
1776/// if the responder is dropped without sending a response, so that the client
1777/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
1778impl std::ops::Drop for LocalServiceDelegateOnReadValueResponder {
1779    fn drop(&mut self) {
1780        self.control_handle.shutdown();
1781        // Safety: drops once, never accessed again
1782        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1783    }
1784}
1785
1786impl fidl::endpoints::Responder for LocalServiceDelegateOnReadValueResponder {
1787    type ControlHandle = LocalServiceDelegateControlHandle;
1788
1789    fn control_handle(&self) -> &LocalServiceDelegateControlHandle {
1790        &self.control_handle
1791    }
1792
1793    fn drop_without_shutdown(mut self) {
1794        // Safety: drops once, never accessed again due to mem::forget
1795        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1796        // Prevent Drop from running (which would shut down the channel)
1797        std::mem::forget(self);
1798    }
1799}
1800
1801impl LocalServiceDelegateOnReadValueResponder {
1802    /// Sends a response to the FIDL transaction.
1803    ///
1804    /// Sets the channel to shutdown if an error occurs.
1805    pub fn send(self, mut value: Option<&[u8]>, mut status: ErrorCode) -> Result<(), fidl::Error> {
1806        let _result = self.send_raw(value, status);
1807        if _result.is_err() {
1808            self.control_handle.shutdown();
1809        }
1810        self.drop_without_shutdown();
1811        _result
1812    }
1813
1814    /// Similar to "send" but does not shutdown the channel if an error occurs.
1815    pub fn send_no_shutdown_on_err(
1816        self,
1817        mut value: Option<&[u8]>,
1818        mut status: ErrorCode,
1819    ) -> Result<(), fidl::Error> {
1820        let _result = self.send_raw(value, status);
1821        self.drop_without_shutdown();
1822        _result
1823    }
1824
1825    fn send_raw(&self, mut value: Option<&[u8]>, mut status: ErrorCode) -> Result<(), fidl::Error> {
1826        self.control_handle.inner.send::<LocalServiceDelegateOnReadValueResponse>(
1827            (value, status),
1828            self.tx_id,
1829            0x2f11da4cc774629,
1830            fidl::encoding::DynamicFlags::empty(),
1831        )
1832    }
1833}
1834
1835#[must_use = "FIDL methods require a response to be sent"]
1836#[derive(Debug)]
1837pub struct LocalServiceDelegateOnWriteValueResponder {
1838    control_handle: std::mem::ManuallyDrop<LocalServiceDelegateControlHandle>,
1839    tx_id: u32,
1840}
1841
1842/// Set the the channel to be shutdown (see [`LocalServiceDelegateControlHandle::shutdown`])
1843/// if the responder is dropped without sending a response, so that the client
1844/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
1845impl std::ops::Drop for LocalServiceDelegateOnWriteValueResponder {
1846    fn drop(&mut self) {
1847        self.control_handle.shutdown();
1848        // Safety: drops once, never accessed again
1849        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1850    }
1851}
1852
1853impl fidl::endpoints::Responder for LocalServiceDelegateOnWriteValueResponder {
1854    type ControlHandle = LocalServiceDelegateControlHandle;
1855
1856    fn control_handle(&self) -> &LocalServiceDelegateControlHandle {
1857        &self.control_handle
1858    }
1859
1860    fn drop_without_shutdown(mut self) {
1861        // Safety: drops once, never accessed again due to mem::forget
1862        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1863        // Prevent Drop from running (which would shut down the channel)
1864        std::mem::forget(self);
1865    }
1866}
1867
1868impl LocalServiceDelegateOnWriteValueResponder {
1869    /// Sends a response to the FIDL transaction.
1870    ///
1871    /// Sets the channel to shutdown if an error occurs.
1872    pub fn send(self, mut status: ErrorCode) -> Result<(), fidl::Error> {
1873        let _result = self.send_raw(status);
1874        if _result.is_err() {
1875            self.control_handle.shutdown();
1876        }
1877        self.drop_without_shutdown();
1878        _result
1879    }
1880
1881    /// Similar to "send" but does not shutdown the channel if an error occurs.
1882    pub fn send_no_shutdown_on_err(self, mut status: ErrorCode) -> Result<(), fidl::Error> {
1883        let _result = self.send_raw(status);
1884        self.drop_without_shutdown();
1885        _result
1886    }
1887
1888    fn send_raw(&self, mut status: ErrorCode) -> Result<(), fidl::Error> {
1889        self.control_handle.inner.send::<LocalServiceDelegateOnWriteValueResponse>(
1890            (status,),
1891            self.tx_id,
1892            0x2869075d462d3ea5,
1893            fidl::encoding::DynamicFlags::empty(),
1894        )
1895    }
1896}
1897
1898#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
1899pub struct RemoteServiceMarker;
1900
1901impl fidl::endpoints::ProtocolMarker for RemoteServiceMarker {
1902    type Proxy = RemoteServiceProxy;
1903    type RequestStream = RemoteServiceRequestStream;
1904    #[cfg(target_os = "fuchsia")]
1905    type SynchronousProxy = RemoteServiceSynchronousProxy;
1906
1907    const DEBUG_NAME: &'static str = "(anonymous) RemoteService";
1908}
1909pub type RemoteServiceReadByTypeResult = Result<Vec<ReadByTypeResult>, Error>;
1910
1911pub trait RemoteServiceProxyInterface: Send + Sync {
1912    type DiscoverCharacteristicsResponseFut: std::future::Future<
1913            Output = Result<(fidl_fuchsia_bluetooth::Status, Vec<Characteristic>), fidl::Error>,
1914        > + Send;
1915    fn r#discover_characteristics(&self) -> Self::DiscoverCharacteristicsResponseFut;
1916    type ReadCharacteristicResponseFut: std::future::Future<Output = Result<(fidl_fuchsia_bluetooth::Status, Vec<u8>), fidl::Error>>
1917        + Send;
1918    fn r#read_characteristic(&self, id: u64) -> Self::ReadCharacteristicResponseFut;
1919    type ReadLongCharacteristicResponseFut: std::future::Future<Output = Result<(fidl_fuchsia_bluetooth::Status, Vec<u8>), fidl::Error>>
1920        + Send;
1921    fn r#read_long_characteristic(
1922        &self,
1923        id: u64,
1924        offset: u16,
1925        max_bytes: u16,
1926    ) -> Self::ReadLongCharacteristicResponseFut;
1927    type WriteCharacteristicResponseFut: std::future::Future<Output = Result<fidl_fuchsia_bluetooth::Status, fidl::Error>>
1928        + Send;
1929    fn r#write_characteristic(&self, id: u64, value: &[u8])
1930    -> Self::WriteCharacteristicResponseFut;
1931    type WriteLongCharacteristicResponseFut: std::future::Future<Output = Result<fidl_fuchsia_bluetooth::Status, fidl::Error>>
1932        + Send;
1933    fn r#write_long_characteristic(
1934        &self,
1935        id: u64,
1936        offset: u16,
1937        value: &[u8],
1938        write_options: &WriteOptions,
1939    ) -> Self::WriteLongCharacteristicResponseFut;
1940    fn r#write_characteristic_without_response(
1941        &self,
1942        id: u64,
1943        value: &[u8],
1944    ) -> Result<(), fidl::Error>;
1945    type ReadDescriptorResponseFut: std::future::Future<Output = Result<(fidl_fuchsia_bluetooth::Status, Vec<u8>), fidl::Error>>
1946        + Send;
1947    fn r#read_descriptor(&self, id: u64) -> Self::ReadDescriptorResponseFut;
1948    type ReadLongDescriptorResponseFut: std::future::Future<Output = Result<(fidl_fuchsia_bluetooth::Status, Vec<u8>), fidl::Error>>
1949        + Send;
1950    fn r#read_long_descriptor(
1951        &self,
1952        id: u64,
1953        offset: u16,
1954        max_bytes: u16,
1955    ) -> Self::ReadLongDescriptorResponseFut;
1956    type WriteDescriptorResponseFut: std::future::Future<Output = Result<fidl_fuchsia_bluetooth::Status, fidl::Error>>
1957        + Send;
1958    fn r#write_descriptor(&self, id: u64, value: &[u8]) -> Self::WriteDescriptorResponseFut;
1959    type WriteLongDescriptorResponseFut: std::future::Future<Output = Result<fidl_fuchsia_bluetooth::Status, fidl::Error>>
1960        + Send;
1961    fn r#write_long_descriptor(
1962        &self,
1963        id: u64,
1964        offset: u16,
1965        value: &[u8],
1966    ) -> Self::WriteLongDescriptorResponseFut;
1967    type ReadByTypeResponseFut: std::future::Future<Output = Result<RemoteServiceReadByTypeResult, fidl::Error>>
1968        + Send;
1969    fn r#read_by_type(&self, uuid: &fidl_fuchsia_bluetooth::Uuid) -> Self::ReadByTypeResponseFut;
1970    type NotifyCharacteristicResponseFut: std::future::Future<Output = Result<fidl_fuchsia_bluetooth::Status, fidl::Error>>
1971        + Send;
1972    fn r#notify_characteristic(
1973        &self,
1974        id: u64,
1975        enable: bool,
1976    ) -> Self::NotifyCharacteristicResponseFut;
1977}
1978#[derive(Debug)]
1979#[cfg(target_os = "fuchsia")]
1980pub struct RemoteServiceSynchronousProxy {
1981    client: fidl::client::sync::Client,
1982}
1983
1984#[cfg(target_os = "fuchsia")]
1985impl fidl::endpoints::SynchronousProxy for RemoteServiceSynchronousProxy {
1986    type Proxy = RemoteServiceProxy;
1987    type Protocol = RemoteServiceMarker;
1988
1989    fn from_channel(inner: fidl::Channel) -> Self {
1990        Self::new(inner)
1991    }
1992
1993    fn into_channel(self) -> fidl::Channel {
1994        self.client.into_channel()
1995    }
1996
1997    fn as_channel(&self) -> &fidl::Channel {
1998        self.client.as_channel()
1999    }
2000}
2001
2002#[cfg(target_os = "fuchsia")]
2003impl RemoteServiceSynchronousProxy {
2004    pub fn new(channel: fidl::Channel) -> Self {
2005        Self { client: fidl::client::sync::Client::new(channel) }
2006    }
2007
2008    pub fn into_channel(self) -> fidl::Channel {
2009        self.client.into_channel()
2010    }
2011
2012    /// Waits until an event arrives and returns it. It is safe for other
2013    /// threads to make concurrent requests while waiting for an event.
2014    pub fn wait_for_event(
2015        &self,
2016        deadline: zx::MonotonicInstant,
2017    ) -> Result<RemoteServiceEvent, fidl::Error> {
2018        RemoteServiceEvent::decode(self.client.wait_for_event::<RemoteServiceMarker>(deadline)?)
2019    }
2020
2021    /// Returns the characteristics and characteristic descriptors that belong to
2022    /// this service.
2023    pub fn r#discover_characteristics(
2024        &self,
2025        ___deadline: zx::MonotonicInstant,
2026    ) -> Result<(fidl_fuchsia_bluetooth::Status, Vec<Characteristic>), fidl::Error> {
2027        let _response = self.client.send_query::<
2028            fidl::encoding::EmptyPayload,
2029            RemoteServiceDiscoverCharacteristicsResponse,
2030            RemoteServiceMarker,
2031        >(
2032            (),
2033            0x4c13b72543a8aa16,
2034            fidl::encoding::DynamicFlags::empty(),
2035            ___deadline,
2036        )?;
2037        Ok((_response.status, _response.characteristics))
2038    }
2039
2040    /// Reads the value of the characteristic with `id` and returns it in the
2041    /// reply. If `status` indicates an error `value` will be empty.
2042    ///
2043    /// If the characteristic has a long value (i.e. larger than the current MTU)
2044    /// this method will return only the first (MTU - 1) bytes of the value. Use
2045    /// ReadLongCharacteristic() to read larger values or starting at a non-zero
2046    /// offset.
2047    pub fn r#read_characteristic(
2048        &self,
2049        mut id: u64,
2050        ___deadline: zx::MonotonicInstant,
2051    ) -> Result<(fidl_fuchsia_bluetooth::Status, Vec<u8>), fidl::Error> {
2052        let _response = self.client.send_query::<
2053            RemoteServiceReadCharacteristicRequest,
2054            RemoteServiceReadCharacteristicResponse,
2055            RemoteServiceMarker,
2056        >(
2057            (id,),
2058            0x200a5253bc0771c8,
2059            fidl::encoding::DynamicFlags::empty(),
2060            ___deadline,
2061        )?;
2062        Ok((_response.status, _response.value))
2063    }
2064
2065    /// Reads the complete value of a characteristic with the given `id`. This
2066    /// procedure should be used if the characteristic is known to have a value
2067    /// that can not be read in a single request.
2068    ///
2069    /// Returns up to `max_bytes` octets of the characteristic value starting at
2070    /// the given `offset`.
2071    ///
2072    /// This may return an error if:
2073    ///   a. `max_bytes` is 0;
2074    ///   b. The `offset` is invalid;
2075    ///   c. The characteristic does not have a long value;
2076    ///   d. The server does not support the long read procedure.
2077    pub fn r#read_long_characteristic(
2078        &self,
2079        mut id: u64,
2080        mut offset: u16,
2081        mut max_bytes: u16,
2082        ___deadline: zx::MonotonicInstant,
2083    ) -> Result<(fidl_fuchsia_bluetooth::Status, Vec<u8>), fidl::Error> {
2084        let _response = self.client.send_query::<
2085            RemoteServiceReadLongCharacteristicRequest,
2086            RemoteServiceReadLongCharacteristicResponse,
2087            RemoteServiceMarker,
2088        >(
2089            (id, offset, max_bytes,),
2090            0x2df2f20845555766,
2091            fidl::encoding::DynamicFlags::empty(),
2092            ___deadline,
2093        )?;
2094        Ok((_response.status, _response.value))
2095    }
2096
2097    /// Writes `value` to the characteristic with `id`. This operation may return
2098    /// an error if:
2099    ///   a. The size of `value` exceeds the current MTU.
2100    ///   b. The characteristic referred to by `id` does not have the 'write'
2101    ///      property.
2102    pub fn r#write_characteristic(
2103        &self,
2104        mut id: u64,
2105        mut value: &[u8],
2106        ___deadline: zx::MonotonicInstant,
2107    ) -> Result<fidl_fuchsia_bluetooth::Status, fidl::Error> {
2108        let _response = self.client.send_query::<
2109            RemoteServiceWriteCharacteristicRequest,
2110            RemoteServiceWriteCharacteristicResponse,
2111            RemoteServiceMarker,
2112        >(
2113            (id, value,),
2114            0x5c1f529653cdad04,
2115            fidl::encoding::DynamicFlags::empty(),
2116            ___deadline,
2117        )?;
2118        Ok(_response.status)
2119    }
2120
2121    /// Writes `value` to the characteristic with `id`, beginning at `offset` using
2122    /// the provided `write_options`.
2123    ///
2124    /// This procedure should be used if the value to be written is too long to
2125    /// fit in a single request or needs to be written at an offset. This may
2126    /// return an error if:
2127    ///   a. The `offset` is invalid;
2128    ///   b. The server does not support the long write procedure.
2129    ///
2130    /// Long Writes require multiple messages to the remote service and take longer
2131    /// to execute than Short Writes. It is not recommended to send a short write
2132    /// while a long write is in process to the same id and data range. The order
2133    /// of the responses from this function signify the order in which the remote
2134    /// service received them, not necessarily the order in which it is called.
2135    pub fn r#write_long_characteristic(
2136        &self,
2137        mut id: u64,
2138        mut offset: u16,
2139        mut value: &[u8],
2140        mut write_options: &WriteOptions,
2141        ___deadline: zx::MonotonicInstant,
2142    ) -> Result<fidl_fuchsia_bluetooth::Status, fidl::Error> {
2143        let _response = self.client.send_query::<
2144            RemoteServiceWriteLongCharacteristicRequest,
2145            RemoteServiceWriteLongCharacteristicResponse,
2146            RemoteServiceMarker,
2147        >(
2148            (id, offset, value, write_options,),
2149            0x2d358800658043e1,
2150            fidl::encoding::DynamicFlags::empty(),
2151            ___deadline,
2152        )?;
2153        Ok(_response.status)
2154    }
2155
2156    /// Writes `value` to the characteristic with `id` without soliciting an
2157    /// acknowledgement from the peer. This method has no response and its delivery
2158    /// cannot be confirmed.
2159    pub fn r#write_characteristic_without_response(
2160        &self,
2161        mut id: u64,
2162        mut value: &[u8],
2163    ) -> Result<(), fidl::Error> {
2164        self.client.send::<RemoteServiceWriteCharacteristicWithoutResponseRequest>(
2165            (id, value),
2166            0x6eee4a248275f56e,
2167            fidl::encoding::DynamicFlags::empty(),
2168        )
2169    }
2170
2171    /// Reads the value of the characteristic descriptor with `id` and returns it
2172    /// in the reply. If `status` indicates an error, `value` can be ignored.
2173    ///
2174    /// If the descriptor has a long value (i.e. larger than the current MTU)
2175    /// this method will return only the first (MTU - 1) bytes of the value. Use
2176    /// ReadLongDescriptor() to read larger values or starting at a non-zero
2177    /// offset.
2178    pub fn r#read_descriptor(
2179        &self,
2180        mut id: u64,
2181        ___deadline: zx::MonotonicInstant,
2182    ) -> Result<(fidl_fuchsia_bluetooth::Status, Vec<u8>), fidl::Error> {
2183        let _response = self.client.send_query::<
2184            RemoteServiceReadDescriptorRequest,
2185            RemoteServiceReadDescriptorResponse,
2186            RemoteServiceMarker,
2187        >(
2188            (id,),
2189            0x3d72215c1d23037a,
2190            fidl::encoding::DynamicFlags::empty(),
2191            ___deadline,
2192        )?;
2193        Ok((_response.status, _response.value))
2194    }
2195
2196    /// Reads the complete value of a characteristic descriptor with the given `id`.
2197    /// This procedure should be used if the descriptor is known to have a value
2198    /// that can not be read in a single request.
2199    ///
2200    /// Returns up to `max_bytes` octets of the characteristic value starting at
2201    /// the given `offset`.
2202    ///
2203    /// This may return an error if:
2204    ///   a. `max_bytes` is 0;
2205    ///   b. The `offset` is invalid;
2206    ///   c. The server does not support the long read procedure.
2207    pub fn r#read_long_descriptor(
2208        &self,
2209        mut id: u64,
2210        mut offset: u16,
2211        mut max_bytes: u16,
2212        ___deadline: zx::MonotonicInstant,
2213    ) -> Result<(fidl_fuchsia_bluetooth::Status, Vec<u8>), fidl::Error> {
2214        let _response = self.client.send_query::<
2215            RemoteServiceReadLongDescriptorRequest,
2216            RemoteServiceReadLongDescriptorResponse,
2217            RemoteServiceMarker,
2218        >(
2219            (id, offset, max_bytes,),
2220            0x779efe322414240b,
2221            fidl::encoding::DynamicFlags::empty(),
2222            ___deadline,
2223        )?;
2224        Ok((_response.status, _response.value))
2225    }
2226
2227    /// Writes `value` to the characteristic descriptor with `id`. This operation
2228    /// may return an error if:
2229    ///   a. The size of `value` exceeds the current MTU.
2230    ///   b. `id` refers to an internally reserved descriptor type (e.g. the Client
2231    ///      Characteristic Configuration descriptor).
2232    pub fn r#write_descriptor(
2233        &self,
2234        mut id: u64,
2235        mut value: &[u8],
2236        ___deadline: zx::MonotonicInstant,
2237    ) -> Result<fidl_fuchsia_bluetooth::Status, fidl::Error> {
2238        let _response = self.client.send_query::<
2239            RemoteServiceWriteDescriptorRequest,
2240            RemoteServiceWriteDescriptorResponse,
2241            RemoteServiceMarker,
2242        >(
2243            (id, value,),
2244            0x24c813d96509895,
2245            fidl::encoding::DynamicFlags::empty(),
2246            ___deadline,
2247        )?;
2248        Ok(_response.status)
2249    }
2250
2251    /// Writes `value` to the characteristic descriptor with `id`, beginning at
2252    /// `offset`. This procedure should be used if the value to be written is too
2253    /// long to fit in a single request or needs to be written at an offset. This
2254    /// may return an error if:
2255    ///   a. The `offset` is invalid;
2256    ///   b. The server does not support the long write procedure.
2257    ///   c. `id` refers to an internally reserved descriptor type (e.g. the Client
2258    ///      Characteristic Configuration descriptor).
2259    ///
2260    /// Long Writes require multiple messages to the remote service and take longer
2261    /// to execute than Short Writes. It is not recommended to send a short write
2262    /// while a long write is in process to the same id and data range. The order
2263    /// of the responses from this function signify the order in which the remote
2264    /// service received them, not necessarily the order in which it is called.
2265    pub fn r#write_long_descriptor(
2266        &self,
2267        mut id: u64,
2268        mut offset: u16,
2269        mut value: &[u8],
2270        ___deadline: zx::MonotonicInstant,
2271    ) -> Result<fidl_fuchsia_bluetooth::Status, fidl::Error> {
2272        let _response = self.client.send_query::<
2273            RemoteServiceWriteLongDescriptorRequest,
2274            RemoteServiceWriteLongDescriptorResponse,
2275            RemoteServiceMarker,
2276        >(
2277            (id, offset, value,),
2278            0x653c9dbe0138b47,
2279            fidl::encoding::DynamicFlags::empty(),
2280            ___deadline,
2281        )?;
2282        Ok(_response.status)
2283    }
2284
2285    /// Reads characteristics and descriptors with the given `uuid`. If no values are
2286    /// read, `results` will be empty. If reading a value results in a permission error,
2287    /// the handle and error will be included in `results`.
2288    ///
2289    /// NOTE: Values in `results` will be truncated to `MAX_READ_BY_TYPE_VALUE_LENGTH`
2290    /// bytes. `ReadCharacteristic`, `ReadLongCharacteristic()`, `ReadDescriptor`, or
2291    /// `ReadLongDescriptor()` should be used to read the complete values.
2292    ///
2293    /// This method is useful for reading values before discovery has completed, thereby
2294    /// reducing latency.
2295    pub fn r#read_by_type(
2296        &self,
2297        mut uuid: &fidl_fuchsia_bluetooth::Uuid,
2298        ___deadline: zx::MonotonicInstant,
2299    ) -> Result<RemoteServiceReadByTypeResult, fidl::Error> {
2300        let _response = self.client.send_query::<
2301            RemoteServiceReadByTypeRequest,
2302            fidl::encoding::ResultType<RemoteServiceReadByTypeResponse, Error>,
2303            RemoteServiceMarker,
2304        >(
2305            (uuid,),
2306            0x72e84b1d5eb5c245,
2307            fidl::encoding::DynamicFlags::empty(),
2308            ___deadline,
2309        )?;
2310        Ok(_response.map(|x| x.results))
2311    }
2312
2313    /// Subscribe or unsubscribe to notifications/indications from the characteristic with
2314    /// the given `id`. Notifications or indications will be enabled if `enable` is
2315    /// true or disabled if `enable` is false and they have been enabled for this
2316    /// client.
2317    ///
2318    /// Either notifications or indications will be enabled depending on
2319    /// characteristic properties. Indications will be preferred if they are
2320    /// supported.
2321    ///
2322    /// This operation fails if the characteristic does not have the "notify" or
2323    /// "indicate" property.
2324    ///
2325    /// A write request will be issued to configure the characteristic for notifications/indications
2326    /// if it contains a Client Characteristic Configuration descriptor. This method fails if an
2327    /// error occurs while writing to the descriptor.
2328    ///
2329    /// On success, the OnCharacteristicValueUpdated event will be sent whenever
2330    /// the peer sends a notification or indication. The local host will
2331    /// automically confirm indications.
2332    pub fn r#notify_characteristic(
2333        &self,
2334        mut id: u64,
2335        mut enable: bool,
2336        ___deadline: zx::MonotonicInstant,
2337    ) -> Result<fidl_fuchsia_bluetooth::Status, fidl::Error> {
2338        let _response = self.client.send_query::<
2339            RemoteServiceNotifyCharacteristicRequest,
2340            RemoteServiceNotifyCharacteristicResponse,
2341            RemoteServiceMarker,
2342        >(
2343            (id, enable,),
2344            0x615750fd68cbd159,
2345            fidl::encoding::DynamicFlags::empty(),
2346            ___deadline,
2347        )?;
2348        Ok(_response.status)
2349    }
2350}
2351
2352#[cfg(target_os = "fuchsia")]
2353impl From<RemoteServiceSynchronousProxy> for zx::NullableHandle {
2354    fn from(value: RemoteServiceSynchronousProxy) -> Self {
2355        value.into_channel().into()
2356    }
2357}
2358
2359#[cfg(target_os = "fuchsia")]
2360impl From<fidl::Channel> for RemoteServiceSynchronousProxy {
2361    fn from(value: fidl::Channel) -> Self {
2362        Self::new(value)
2363    }
2364}
2365
2366#[cfg(target_os = "fuchsia")]
2367impl fidl::endpoints::FromClient for RemoteServiceSynchronousProxy {
2368    type Protocol = RemoteServiceMarker;
2369
2370    fn from_client(value: fidl::endpoints::ClientEnd<RemoteServiceMarker>) -> Self {
2371        Self::new(value.into_channel())
2372    }
2373}
2374
2375#[derive(Debug, Clone)]
2376pub struct RemoteServiceProxy {
2377    client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
2378}
2379
2380impl fidl::endpoints::Proxy for RemoteServiceProxy {
2381    type Protocol = RemoteServiceMarker;
2382
2383    fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
2384        Self::new(inner)
2385    }
2386
2387    fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
2388        self.client.into_channel().map_err(|client| Self { client })
2389    }
2390
2391    fn as_channel(&self) -> &::fidl::AsyncChannel {
2392        self.client.as_channel()
2393    }
2394}
2395
2396impl RemoteServiceProxy {
2397    /// Create a new Proxy for fuchsia.bluetooth.gatt/RemoteService.
2398    pub fn new(channel: ::fidl::AsyncChannel) -> Self {
2399        let protocol_name = <RemoteServiceMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
2400        Self { client: fidl::client::Client::new(channel, protocol_name) }
2401    }
2402
2403    /// Get a Stream of events from the remote end of the protocol.
2404    ///
2405    /// # Panics
2406    ///
2407    /// Panics if the event stream was already taken.
2408    pub fn take_event_stream(&self) -> RemoteServiceEventStream {
2409        RemoteServiceEventStream { event_receiver: self.client.take_event_receiver() }
2410    }
2411
2412    /// Returns the characteristics and characteristic descriptors that belong to
2413    /// this service.
2414    pub fn r#discover_characteristics(
2415        &self,
2416    ) -> fidl::client::QueryResponseFut<
2417        (fidl_fuchsia_bluetooth::Status, Vec<Characteristic>),
2418        fidl::encoding::DefaultFuchsiaResourceDialect,
2419    > {
2420        RemoteServiceProxyInterface::r#discover_characteristics(self)
2421    }
2422
2423    /// Reads the value of the characteristic with `id` and returns it in the
2424    /// reply. If `status` indicates an error `value` will be empty.
2425    ///
2426    /// If the characteristic has a long value (i.e. larger than the current MTU)
2427    /// this method will return only the first (MTU - 1) bytes of the value. Use
2428    /// ReadLongCharacteristic() to read larger values or starting at a non-zero
2429    /// offset.
2430    pub fn r#read_characteristic(
2431        &self,
2432        mut id: u64,
2433    ) -> fidl::client::QueryResponseFut<
2434        (fidl_fuchsia_bluetooth::Status, Vec<u8>),
2435        fidl::encoding::DefaultFuchsiaResourceDialect,
2436    > {
2437        RemoteServiceProxyInterface::r#read_characteristic(self, id)
2438    }
2439
2440    /// Reads the complete value of a characteristic with the given `id`. This
2441    /// procedure should be used if the characteristic is known to have a value
2442    /// that can not be read in a single request.
2443    ///
2444    /// Returns up to `max_bytes` octets of the characteristic value starting at
2445    /// the given `offset`.
2446    ///
2447    /// This may return an error if:
2448    ///   a. `max_bytes` is 0;
2449    ///   b. The `offset` is invalid;
2450    ///   c. The characteristic does not have a long value;
2451    ///   d. The server does not support the long read procedure.
2452    pub fn r#read_long_characteristic(
2453        &self,
2454        mut id: u64,
2455        mut offset: u16,
2456        mut max_bytes: u16,
2457    ) -> fidl::client::QueryResponseFut<
2458        (fidl_fuchsia_bluetooth::Status, Vec<u8>),
2459        fidl::encoding::DefaultFuchsiaResourceDialect,
2460    > {
2461        RemoteServiceProxyInterface::r#read_long_characteristic(self, id, offset, max_bytes)
2462    }
2463
2464    /// Writes `value` to the characteristic with `id`. This operation may return
2465    /// an error if:
2466    ///   a. The size of `value` exceeds the current MTU.
2467    ///   b. The characteristic referred to by `id` does not have the 'write'
2468    ///      property.
2469    pub fn r#write_characteristic(
2470        &self,
2471        mut id: u64,
2472        mut value: &[u8],
2473    ) -> fidl::client::QueryResponseFut<
2474        fidl_fuchsia_bluetooth::Status,
2475        fidl::encoding::DefaultFuchsiaResourceDialect,
2476    > {
2477        RemoteServiceProxyInterface::r#write_characteristic(self, id, value)
2478    }
2479
2480    /// Writes `value` to the characteristic with `id`, beginning at `offset` using
2481    /// the provided `write_options`.
2482    ///
2483    /// This procedure should be used if the value to be written is too long to
2484    /// fit in a single request or needs to be written at an offset. This may
2485    /// return an error if:
2486    ///   a. The `offset` is invalid;
2487    ///   b. The server does not support the long write procedure.
2488    ///
2489    /// Long Writes require multiple messages to the remote service and take longer
2490    /// to execute than Short Writes. It is not recommended to send a short write
2491    /// while a long write is in process to the same id and data range. The order
2492    /// of the responses from this function signify the order in which the remote
2493    /// service received them, not necessarily the order in which it is called.
2494    pub fn r#write_long_characteristic(
2495        &self,
2496        mut id: u64,
2497        mut offset: u16,
2498        mut value: &[u8],
2499        mut write_options: &WriteOptions,
2500    ) -> fidl::client::QueryResponseFut<
2501        fidl_fuchsia_bluetooth::Status,
2502        fidl::encoding::DefaultFuchsiaResourceDialect,
2503    > {
2504        RemoteServiceProxyInterface::r#write_long_characteristic(
2505            self,
2506            id,
2507            offset,
2508            value,
2509            write_options,
2510        )
2511    }
2512
2513    /// Writes `value` to the characteristic with `id` without soliciting an
2514    /// acknowledgement from the peer. This method has no response and its delivery
2515    /// cannot be confirmed.
2516    pub fn r#write_characteristic_without_response(
2517        &self,
2518        mut id: u64,
2519        mut value: &[u8],
2520    ) -> Result<(), fidl::Error> {
2521        RemoteServiceProxyInterface::r#write_characteristic_without_response(self, id, value)
2522    }
2523
2524    /// Reads the value of the characteristic descriptor with `id` and returns it
2525    /// in the reply. If `status` indicates an error, `value` can be ignored.
2526    ///
2527    /// If the descriptor has a long value (i.e. larger than the current MTU)
2528    /// this method will return only the first (MTU - 1) bytes of the value. Use
2529    /// ReadLongDescriptor() to read larger values or starting at a non-zero
2530    /// offset.
2531    pub fn r#read_descriptor(
2532        &self,
2533        mut id: u64,
2534    ) -> fidl::client::QueryResponseFut<
2535        (fidl_fuchsia_bluetooth::Status, Vec<u8>),
2536        fidl::encoding::DefaultFuchsiaResourceDialect,
2537    > {
2538        RemoteServiceProxyInterface::r#read_descriptor(self, id)
2539    }
2540
2541    /// Reads the complete value of a characteristic descriptor with the given `id`.
2542    /// This procedure should be used if the descriptor is known to have a value
2543    /// that can not be read in a single request.
2544    ///
2545    /// Returns up to `max_bytes` octets of the characteristic value starting at
2546    /// the given `offset`.
2547    ///
2548    /// This may return an error if:
2549    ///   a. `max_bytes` is 0;
2550    ///   b. The `offset` is invalid;
2551    ///   c. The server does not support the long read procedure.
2552    pub fn r#read_long_descriptor(
2553        &self,
2554        mut id: u64,
2555        mut offset: u16,
2556        mut max_bytes: u16,
2557    ) -> fidl::client::QueryResponseFut<
2558        (fidl_fuchsia_bluetooth::Status, Vec<u8>),
2559        fidl::encoding::DefaultFuchsiaResourceDialect,
2560    > {
2561        RemoteServiceProxyInterface::r#read_long_descriptor(self, id, offset, max_bytes)
2562    }
2563
2564    /// Writes `value` to the characteristic descriptor with `id`. This operation
2565    /// may return an error if:
2566    ///   a. The size of `value` exceeds the current MTU.
2567    ///   b. `id` refers to an internally reserved descriptor type (e.g. the Client
2568    ///      Characteristic Configuration descriptor).
2569    pub fn r#write_descriptor(
2570        &self,
2571        mut id: u64,
2572        mut value: &[u8],
2573    ) -> fidl::client::QueryResponseFut<
2574        fidl_fuchsia_bluetooth::Status,
2575        fidl::encoding::DefaultFuchsiaResourceDialect,
2576    > {
2577        RemoteServiceProxyInterface::r#write_descriptor(self, id, value)
2578    }
2579
2580    /// Writes `value` to the characteristic descriptor with `id`, beginning at
2581    /// `offset`. This procedure should be used if the value to be written is too
2582    /// long to fit in a single request or needs to be written at an offset. This
2583    /// may return an error if:
2584    ///   a. The `offset` is invalid;
2585    ///   b. The server does not support the long write procedure.
2586    ///   c. `id` refers to an internally reserved descriptor type (e.g. the Client
2587    ///      Characteristic Configuration descriptor).
2588    ///
2589    /// Long Writes require multiple messages to the remote service and take longer
2590    /// to execute than Short Writes. It is not recommended to send a short write
2591    /// while a long write is in process to the same id and data range. The order
2592    /// of the responses from this function signify the order in which the remote
2593    /// service received them, not necessarily the order in which it is called.
2594    pub fn r#write_long_descriptor(
2595        &self,
2596        mut id: u64,
2597        mut offset: u16,
2598        mut value: &[u8],
2599    ) -> fidl::client::QueryResponseFut<
2600        fidl_fuchsia_bluetooth::Status,
2601        fidl::encoding::DefaultFuchsiaResourceDialect,
2602    > {
2603        RemoteServiceProxyInterface::r#write_long_descriptor(self, id, offset, value)
2604    }
2605
2606    /// Reads characteristics and descriptors with the given `uuid`. If no values are
2607    /// read, `results` will be empty. If reading a value results in a permission error,
2608    /// the handle and error will be included in `results`.
2609    ///
2610    /// NOTE: Values in `results` will be truncated to `MAX_READ_BY_TYPE_VALUE_LENGTH`
2611    /// bytes. `ReadCharacteristic`, `ReadLongCharacteristic()`, `ReadDescriptor`, or
2612    /// `ReadLongDescriptor()` should be used to read the complete values.
2613    ///
2614    /// This method is useful for reading values before discovery has completed, thereby
2615    /// reducing latency.
2616    pub fn r#read_by_type(
2617        &self,
2618        mut uuid: &fidl_fuchsia_bluetooth::Uuid,
2619    ) -> fidl::client::QueryResponseFut<
2620        RemoteServiceReadByTypeResult,
2621        fidl::encoding::DefaultFuchsiaResourceDialect,
2622    > {
2623        RemoteServiceProxyInterface::r#read_by_type(self, uuid)
2624    }
2625
2626    /// Subscribe or unsubscribe to notifications/indications from the characteristic with
2627    /// the given `id`. Notifications or indications will be enabled if `enable` is
2628    /// true or disabled if `enable` is false and they have been enabled for this
2629    /// client.
2630    ///
2631    /// Either notifications or indications will be enabled depending on
2632    /// characteristic properties. Indications will be preferred if they are
2633    /// supported.
2634    ///
2635    /// This operation fails if the characteristic does not have the "notify" or
2636    /// "indicate" property.
2637    ///
2638    /// A write request will be issued to configure the characteristic for notifications/indications
2639    /// if it contains a Client Characteristic Configuration descriptor. This method fails if an
2640    /// error occurs while writing to the descriptor.
2641    ///
2642    /// On success, the OnCharacteristicValueUpdated event will be sent whenever
2643    /// the peer sends a notification or indication. The local host will
2644    /// automically confirm indications.
2645    pub fn r#notify_characteristic(
2646        &self,
2647        mut id: u64,
2648        mut enable: bool,
2649    ) -> fidl::client::QueryResponseFut<
2650        fidl_fuchsia_bluetooth::Status,
2651        fidl::encoding::DefaultFuchsiaResourceDialect,
2652    > {
2653        RemoteServiceProxyInterface::r#notify_characteristic(self, id, enable)
2654    }
2655}
2656
2657impl RemoteServiceProxyInterface for RemoteServiceProxy {
2658    type DiscoverCharacteristicsResponseFut = fidl::client::QueryResponseFut<
2659        (fidl_fuchsia_bluetooth::Status, Vec<Characteristic>),
2660        fidl::encoding::DefaultFuchsiaResourceDialect,
2661    >;
2662    fn r#discover_characteristics(&self) -> Self::DiscoverCharacteristicsResponseFut {
2663        fn _decode(
2664            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
2665        ) -> Result<(fidl_fuchsia_bluetooth::Status, Vec<Characteristic>), fidl::Error> {
2666            let _response = fidl::client::decode_transaction_body::<
2667                RemoteServiceDiscoverCharacteristicsResponse,
2668                fidl::encoding::DefaultFuchsiaResourceDialect,
2669                0x4c13b72543a8aa16,
2670            >(_buf?)?;
2671            Ok((_response.status, _response.characteristics))
2672        }
2673        self.client.send_query_and_decode::<
2674            fidl::encoding::EmptyPayload,
2675            (fidl_fuchsia_bluetooth::Status, Vec<Characteristic>),
2676        >(
2677            (),
2678            0x4c13b72543a8aa16,
2679            fidl::encoding::DynamicFlags::empty(),
2680            _decode,
2681        )
2682    }
2683
2684    type ReadCharacteristicResponseFut = fidl::client::QueryResponseFut<
2685        (fidl_fuchsia_bluetooth::Status, Vec<u8>),
2686        fidl::encoding::DefaultFuchsiaResourceDialect,
2687    >;
2688    fn r#read_characteristic(&self, mut id: u64) -> Self::ReadCharacteristicResponseFut {
2689        fn _decode(
2690            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
2691        ) -> Result<(fidl_fuchsia_bluetooth::Status, Vec<u8>), fidl::Error> {
2692            let _response = fidl::client::decode_transaction_body::<
2693                RemoteServiceReadCharacteristicResponse,
2694                fidl::encoding::DefaultFuchsiaResourceDialect,
2695                0x200a5253bc0771c8,
2696            >(_buf?)?;
2697            Ok((_response.status, _response.value))
2698        }
2699        self.client.send_query_and_decode::<
2700            RemoteServiceReadCharacteristicRequest,
2701            (fidl_fuchsia_bluetooth::Status, Vec<u8>),
2702        >(
2703            (id,),
2704            0x200a5253bc0771c8,
2705            fidl::encoding::DynamicFlags::empty(),
2706            _decode,
2707        )
2708    }
2709
2710    type ReadLongCharacteristicResponseFut = fidl::client::QueryResponseFut<
2711        (fidl_fuchsia_bluetooth::Status, Vec<u8>),
2712        fidl::encoding::DefaultFuchsiaResourceDialect,
2713    >;
2714    fn r#read_long_characteristic(
2715        &self,
2716        mut id: u64,
2717        mut offset: u16,
2718        mut max_bytes: u16,
2719    ) -> Self::ReadLongCharacteristicResponseFut {
2720        fn _decode(
2721            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
2722        ) -> Result<(fidl_fuchsia_bluetooth::Status, Vec<u8>), fidl::Error> {
2723            let _response = fidl::client::decode_transaction_body::<
2724                RemoteServiceReadLongCharacteristicResponse,
2725                fidl::encoding::DefaultFuchsiaResourceDialect,
2726                0x2df2f20845555766,
2727            >(_buf?)?;
2728            Ok((_response.status, _response.value))
2729        }
2730        self.client.send_query_and_decode::<
2731            RemoteServiceReadLongCharacteristicRequest,
2732            (fidl_fuchsia_bluetooth::Status, Vec<u8>),
2733        >(
2734            (id, offset, max_bytes,),
2735            0x2df2f20845555766,
2736            fidl::encoding::DynamicFlags::empty(),
2737            _decode,
2738        )
2739    }
2740
2741    type WriteCharacteristicResponseFut = fidl::client::QueryResponseFut<
2742        fidl_fuchsia_bluetooth::Status,
2743        fidl::encoding::DefaultFuchsiaResourceDialect,
2744    >;
2745    fn r#write_characteristic(
2746        &self,
2747        mut id: u64,
2748        mut value: &[u8],
2749    ) -> Self::WriteCharacteristicResponseFut {
2750        fn _decode(
2751            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
2752        ) -> Result<fidl_fuchsia_bluetooth::Status, fidl::Error> {
2753            let _response = fidl::client::decode_transaction_body::<
2754                RemoteServiceWriteCharacteristicResponse,
2755                fidl::encoding::DefaultFuchsiaResourceDialect,
2756                0x5c1f529653cdad04,
2757            >(_buf?)?;
2758            Ok(_response.status)
2759        }
2760        self.client.send_query_and_decode::<
2761            RemoteServiceWriteCharacteristicRequest,
2762            fidl_fuchsia_bluetooth::Status,
2763        >(
2764            (id, value,),
2765            0x5c1f529653cdad04,
2766            fidl::encoding::DynamicFlags::empty(),
2767            _decode,
2768        )
2769    }
2770
2771    type WriteLongCharacteristicResponseFut = fidl::client::QueryResponseFut<
2772        fidl_fuchsia_bluetooth::Status,
2773        fidl::encoding::DefaultFuchsiaResourceDialect,
2774    >;
2775    fn r#write_long_characteristic(
2776        &self,
2777        mut id: u64,
2778        mut offset: u16,
2779        mut value: &[u8],
2780        mut write_options: &WriteOptions,
2781    ) -> Self::WriteLongCharacteristicResponseFut {
2782        fn _decode(
2783            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
2784        ) -> Result<fidl_fuchsia_bluetooth::Status, fidl::Error> {
2785            let _response = fidl::client::decode_transaction_body::<
2786                RemoteServiceWriteLongCharacteristicResponse,
2787                fidl::encoding::DefaultFuchsiaResourceDialect,
2788                0x2d358800658043e1,
2789            >(_buf?)?;
2790            Ok(_response.status)
2791        }
2792        self.client.send_query_and_decode::<
2793            RemoteServiceWriteLongCharacteristicRequest,
2794            fidl_fuchsia_bluetooth::Status,
2795        >(
2796            (id, offset, value, write_options,),
2797            0x2d358800658043e1,
2798            fidl::encoding::DynamicFlags::empty(),
2799            _decode,
2800        )
2801    }
2802
2803    fn r#write_characteristic_without_response(
2804        &self,
2805        mut id: u64,
2806        mut value: &[u8],
2807    ) -> Result<(), fidl::Error> {
2808        self.client.send::<RemoteServiceWriteCharacteristicWithoutResponseRequest>(
2809            (id, value),
2810            0x6eee4a248275f56e,
2811            fidl::encoding::DynamicFlags::empty(),
2812        )
2813    }
2814
2815    type ReadDescriptorResponseFut = fidl::client::QueryResponseFut<
2816        (fidl_fuchsia_bluetooth::Status, Vec<u8>),
2817        fidl::encoding::DefaultFuchsiaResourceDialect,
2818    >;
2819    fn r#read_descriptor(&self, mut id: u64) -> Self::ReadDescriptorResponseFut {
2820        fn _decode(
2821            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
2822        ) -> Result<(fidl_fuchsia_bluetooth::Status, Vec<u8>), fidl::Error> {
2823            let _response = fidl::client::decode_transaction_body::<
2824                RemoteServiceReadDescriptorResponse,
2825                fidl::encoding::DefaultFuchsiaResourceDialect,
2826                0x3d72215c1d23037a,
2827            >(_buf?)?;
2828            Ok((_response.status, _response.value))
2829        }
2830        self.client.send_query_and_decode::<
2831            RemoteServiceReadDescriptorRequest,
2832            (fidl_fuchsia_bluetooth::Status, Vec<u8>),
2833        >(
2834            (id,),
2835            0x3d72215c1d23037a,
2836            fidl::encoding::DynamicFlags::empty(),
2837            _decode,
2838        )
2839    }
2840
2841    type ReadLongDescriptorResponseFut = fidl::client::QueryResponseFut<
2842        (fidl_fuchsia_bluetooth::Status, Vec<u8>),
2843        fidl::encoding::DefaultFuchsiaResourceDialect,
2844    >;
2845    fn r#read_long_descriptor(
2846        &self,
2847        mut id: u64,
2848        mut offset: u16,
2849        mut max_bytes: u16,
2850    ) -> Self::ReadLongDescriptorResponseFut {
2851        fn _decode(
2852            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
2853        ) -> Result<(fidl_fuchsia_bluetooth::Status, Vec<u8>), fidl::Error> {
2854            let _response = fidl::client::decode_transaction_body::<
2855                RemoteServiceReadLongDescriptorResponse,
2856                fidl::encoding::DefaultFuchsiaResourceDialect,
2857                0x779efe322414240b,
2858            >(_buf?)?;
2859            Ok((_response.status, _response.value))
2860        }
2861        self.client.send_query_and_decode::<
2862            RemoteServiceReadLongDescriptorRequest,
2863            (fidl_fuchsia_bluetooth::Status, Vec<u8>),
2864        >(
2865            (id, offset, max_bytes,),
2866            0x779efe322414240b,
2867            fidl::encoding::DynamicFlags::empty(),
2868            _decode,
2869        )
2870    }
2871
2872    type WriteDescriptorResponseFut = fidl::client::QueryResponseFut<
2873        fidl_fuchsia_bluetooth::Status,
2874        fidl::encoding::DefaultFuchsiaResourceDialect,
2875    >;
2876    fn r#write_descriptor(
2877        &self,
2878        mut id: u64,
2879        mut value: &[u8],
2880    ) -> Self::WriteDescriptorResponseFut {
2881        fn _decode(
2882            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
2883        ) -> Result<fidl_fuchsia_bluetooth::Status, fidl::Error> {
2884            let _response = fidl::client::decode_transaction_body::<
2885                RemoteServiceWriteDescriptorResponse,
2886                fidl::encoding::DefaultFuchsiaResourceDialect,
2887                0x24c813d96509895,
2888            >(_buf?)?;
2889            Ok(_response.status)
2890        }
2891        self.client.send_query_and_decode::<
2892            RemoteServiceWriteDescriptorRequest,
2893            fidl_fuchsia_bluetooth::Status,
2894        >(
2895            (id, value,),
2896            0x24c813d96509895,
2897            fidl::encoding::DynamicFlags::empty(),
2898            _decode,
2899        )
2900    }
2901
2902    type WriteLongDescriptorResponseFut = fidl::client::QueryResponseFut<
2903        fidl_fuchsia_bluetooth::Status,
2904        fidl::encoding::DefaultFuchsiaResourceDialect,
2905    >;
2906    fn r#write_long_descriptor(
2907        &self,
2908        mut id: u64,
2909        mut offset: u16,
2910        mut value: &[u8],
2911    ) -> Self::WriteLongDescriptorResponseFut {
2912        fn _decode(
2913            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
2914        ) -> Result<fidl_fuchsia_bluetooth::Status, fidl::Error> {
2915            let _response = fidl::client::decode_transaction_body::<
2916                RemoteServiceWriteLongDescriptorResponse,
2917                fidl::encoding::DefaultFuchsiaResourceDialect,
2918                0x653c9dbe0138b47,
2919            >(_buf?)?;
2920            Ok(_response.status)
2921        }
2922        self.client.send_query_and_decode::<
2923            RemoteServiceWriteLongDescriptorRequest,
2924            fidl_fuchsia_bluetooth::Status,
2925        >(
2926            (id, offset, value,),
2927            0x653c9dbe0138b47,
2928            fidl::encoding::DynamicFlags::empty(),
2929            _decode,
2930        )
2931    }
2932
2933    type ReadByTypeResponseFut = fidl::client::QueryResponseFut<
2934        RemoteServiceReadByTypeResult,
2935        fidl::encoding::DefaultFuchsiaResourceDialect,
2936    >;
2937    fn r#read_by_type(
2938        &self,
2939        mut uuid: &fidl_fuchsia_bluetooth::Uuid,
2940    ) -> Self::ReadByTypeResponseFut {
2941        fn _decode(
2942            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
2943        ) -> Result<RemoteServiceReadByTypeResult, fidl::Error> {
2944            let _response = fidl::client::decode_transaction_body::<
2945                fidl::encoding::ResultType<RemoteServiceReadByTypeResponse, Error>,
2946                fidl::encoding::DefaultFuchsiaResourceDialect,
2947                0x72e84b1d5eb5c245,
2948            >(_buf?)?;
2949            Ok(_response.map(|x| x.results))
2950        }
2951        self.client
2952            .send_query_and_decode::<RemoteServiceReadByTypeRequest, RemoteServiceReadByTypeResult>(
2953                (uuid,),
2954                0x72e84b1d5eb5c245,
2955                fidl::encoding::DynamicFlags::empty(),
2956                _decode,
2957            )
2958    }
2959
2960    type NotifyCharacteristicResponseFut = fidl::client::QueryResponseFut<
2961        fidl_fuchsia_bluetooth::Status,
2962        fidl::encoding::DefaultFuchsiaResourceDialect,
2963    >;
2964    fn r#notify_characteristic(
2965        &self,
2966        mut id: u64,
2967        mut enable: bool,
2968    ) -> Self::NotifyCharacteristicResponseFut {
2969        fn _decode(
2970            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
2971        ) -> Result<fidl_fuchsia_bluetooth::Status, fidl::Error> {
2972            let _response = fidl::client::decode_transaction_body::<
2973                RemoteServiceNotifyCharacteristicResponse,
2974                fidl::encoding::DefaultFuchsiaResourceDialect,
2975                0x615750fd68cbd159,
2976            >(_buf?)?;
2977            Ok(_response.status)
2978        }
2979        self.client.send_query_and_decode::<
2980            RemoteServiceNotifyCharacteristicRequest,
2981            fidl_fuchsia_bluetooth::Status,
2982        >(
2983            (id, enable,),
2984            0x615750fd68cbd159,
2985            fidl::encoding::DynamicFlags::empty(),
2986            _decode,
2987        )
2988    }
2989}
2990
2991pub struct RemoteServiceEventStream {
2992    event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
2993}
2994
2995impl std::marker::Unpin for RemoteServiceEventStream {}
2996
2997impl futures::stream::FusedStream for RemoteServiceEventStream {
2998    fn is_terminated(&self) -> bool {
2999        self.event_receiver.is_terminated()
3000    }
3001}
3002
3003impl futures::Stream for RemoteServiceEventStream {
3004    type Item = Result<RemoteServiceEvent, fidl::Error>;
3005
3006    fn poll_next(
3007        mut self: std::pin::Pin<&mut Self>,
3008        cx: &mut std::task::Context<'_>,
3009    ) -> std::task::Poll<Option<Self::Item>> {
3010        match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
3011            &mut self.event_receiver,
3012            cx
3013        )?) {
3014            Some(buf) => std::task::Poll::Ready(Some(RemoteServiceEvent::decode(buf))),
3015            None => std::task::Poll::Ready(None),
3016        }
3017    }
3018}
3019
3020#[derive(Debug)]
3021pub enum RemoteServiceEvent {
3022    OnCharacteristicValueUpdated { id: u64, value: Vec<u8> },
3023}
3024
3025impl RemoteServiceEvent {
3026    #[allow(irrefutable_let_patterns)]
3027    pub fn into_on_characteristic_value_updated(self) -> Option<(u64, Vec<u8>)> {
3028        if let RemoteServiceEvent::OnCharacteristicValueUpdated { id, value } = self {
3029            Some((id, value))
3030        } else {
3031            None
3032        }
3033    }
3034
3035    /// Decodes a message buffer as a [`RemoteServiceEvent`].
3036    fn decode(
3037        mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
3038    ) -> Result<RemoteServiceEvent, fidl::Error> {
3039        let (bytes, _handles) = buf.split_mut();
3040        let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
3041        debug_assert_eq!(tx_header.tx_id, 0);
3042        match tx_header.ordinal {
3043            0x304debe9d0408fac => {
3044                let mut out = fidl::new_empty!(
3045                    RemoteServiceOnCharacteristicValueUpdatedRequest,
3046                    fidl::encoding::DefaultFuchsiaResourceDialect
3047                );
3048                fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<RemoteServiceOnCharacteristicValueUpdatedRequest>(&tx_header, _body_bytes, _handles, &mut out)?;
3049                Ok((RemoteServiceEvent::OnCharacteristicValueUpdated {
3050                    id: out.id,
3051                    value: out.value,
3052                }))
3053            }
3054            _ => Err(fidl::Error::UnknownOrdinal {
3055                ordinal: tx_header.ordinal,
3056                protocol_name: <RemoteServiceMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
3057            }),
3058        }
3059    }
3060}
3061
3062/// A Stream of incoming requests for fuchsia.bluetooth.gatt/RemoteService.
3063pub struct RemoteServiceRequestStream {
3064    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
3065    is_terminated: bool,
3066}
3067
3068impl std::marker::Unpin for RemoteServiceRequestStream {}
3069
3070impl futures::stream::FusedStream for RemoteServiceRequestStream {
3071    fn is_terminated(&self) -> bool {
3072        self.is_terminated
3073    }
3074}
3075
3076impl fidl::endpoints::RequestStream for RemoteServiceRequestStream {
3077    type Protocol = RemoteServiceMarker;
3078    type ControlHandle = RemoteServiceControlHandle;
3079
3080    fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
3081        Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
3082    }
3083
3084    fn control_handle(&self) -> Self::ControlHandle {
3085        RemoteServiceControlHandle { inner: self.inner.clone() }
3086    }
3087
3088    fn into_inner(
3089        self,
3090    ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
3091    {
3092        (self.inner, self.is_terminated)
3093    }
3094
3095    fn from_inner(
3096        inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
3097        is_terminated: bool,
3098    ) -> Self {
3099        Self { inner, is_terminated }
3100    }
3101}
3102
3103impl futures::Stream for RemoteServiceRequestStream {
3104    type Item = Result<RemoteServiceRequest, fidl::Error>;
3105
3106    fn poll_next(
3107        mut self: std::pin::Pin<&mut Self>,
3108        cx: &mut std::task::Context<'_>,
3109    ) -> std::task::Poll<Option<Self::Item>> {
3110        let this = &mut *self;
3111        if this.inner.check_shutdown(cx) {
3112            this.is_terminated = true;
3113            return std::task::Poll::Ready(None);
3114        }
3115        if this.is_terminated {
3116            panic!("polled RemoteServiceRequestStream after completion");
3117        }
3118        fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
3119            |bytes, handles| {
3120                match this.inner.channel().read_etc(cx, bytes, handles) {
3121                    std::task::Poll::Ready(Ok(())) => {}
3122                    std::task::Poll::Pending => return std::task::Poll::Pending,
3123                    std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
3124                        this.is_terminated = true;
3125                        return std::task::Poll::Ready(None);
3126                    }
3127                    std::task::Poll::Ready(Err(e)) => {
3128                        return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
3129                            e.into(),
3130                        ))));
3131                    }
3132                }
3133
3134                // A message has been received from the channel
3135                let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
3136
3137                std::task::Poll::Ready(Some(match header.ordinal {
3138                    0x4c13b72543a8aa16 => {
3139                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
3140                        let mut req = fidl::new_empty!(
3141                            fidl::encoding::EmptyPayload,
3142                            fidl::encoding::DefaultFuchsiaResourceDialect
3143                        );
3144                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
3145                        let control_handle =
3146                            RemoteServiceControlHandle { inner: this.inner.clone() };
3147                        Ok(RemoteServiceRequest::DiscoverCharacteristics {
3148                            responder: RemoteServiceDiscoverCharacteristicsResponder {
3149                                control_handle: std::mem::ManuallyDrop::new(control_handle),
3150                                tx_id: header.tx_id,
3151                            },
3152                        })
3153                    }
3154                    0x200a5253bc0771c8 => {
3155                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
3156                        let mut req = fidl::new_empty!(
3157                            RemoteServiceReadCharacteristicRequest,
3158                            fidl::encoding::DefaultFuchsiaResourceDialect
3159                        );
3160                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<RemoteServiceReadCharacteristicRequest>(&header, _body_bytes, handles, &mut req)?;
3161                        let control_handle =
3162                            RemoteServiceControlHandle { inner: this.inner.clone() };
3163                        Ok(RemoteServiceRequest::ReadCharacteristic {
3164                            id: req.id,
3165
3166                            responder: RemoteServiceReadCharacteristicResponder {
3167                                control_handle: std::mem::ManuallyDrop::new(control_handle),
3168                                tx_id: header.tx_id,
3169                            },
3170                        })
3171                    }
3172                    0x2df2f20845555766 => {
3173                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
3174                        let mut req = fidl::new_empty!(
3175                            RemoteServiceReadLongCharacteristicRequest,
3176                            fidl::encoding::DefaultFuchsiaResourceDialect
3177                        );
3178                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<RemoteServiceReadLongCharacteristicRequest>(&header, _body_bytes, handles, &mut req)?;
3179                        let control_handle =
3180                            RemoteServiceControlHandle { inner: this.inner.clone() };
3181                        Ok(RemoteServiceRequest::ReadLongCharacteristic {
3182                            id: req.id,
3183                            offset: req.offset,
3184                            max_bytes: req.max_bytes,
3185
3186                            responder: RemoteServiceReadLongCharacteristicResponder {
3187                                control_handle: std::mem::ManuallyDrop::new(control_handle),
3188                                tx_id: header.tx_id,
3189                            },
3190                        })
3191                    }
3192                    0x5c1f529653cdad04 => {
3193                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
3194                        let mut req = fidl::new_empty!(
3195                            RemoteServiceWriteCharacteristicRequest,
3196                            fidl::encoding::DefaultFuchsiaResourceDialect
3197                        );
3198                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<RemoteServiceWriteCharacteristicRequest>(&header, _body_bytes, handles, &mut req)?;
3199                        let control_handle =
3200                            RemoteServiceControlHandle { inner: this.inner.clone() };
3201                        Ok(RemoteServiceRequest::WriteCharacteristic {
3202                            id: req.id,
3203                            value: req.value,
3204
3205                            responder: RemoteServiceWriteCharacteristicResponder {
3206                                control_handle: std::mem::ManuallyDrop::new(control_handle),
3207                                tx_id: header.tx_id,
3208                            },
3209                        })
3210                    }
3211                    0x2d358800658043e1 => {
3212                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
3213                        let mut req = fidl::new_empty!(
3214                            RemoteServiceWriteLongCharacteristicRequest,
3215                            fidl::encoding::DefaultFuchsiaResourceDialect
3216                        );
3217                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<RemoteServiceWriteLongCharacteristicRequest>(&header, _body_bytes, handles, &mut req)?;
3218                        let control_handle =
3219                            RemoteServiceControlHandle { inner: this.inner.clone() };
3220                        Ok(RemoteServiceRequest::WriteLongCharacteristic {
3221                            id: req.id,
3222                            offset: req.offset,
3223                            value: req.value,
3224                            write_options: req.write_options,
3225
3226                            responder: RemoteServiceWriteLongCharacteristicResponder {
3227                                control_handle: std::mem::ManuallyDrop::new(control_handle),
3228                                tx_id: header.tx_id,
3229                            },
3230                        })
3231                    }
3232                    0x6eee4a248275f56e => {
3233                        header.validate_request_tx_id(fidl::MethodType::OneWay)?;
3234                        let mut req = fidl::new_empty!(
3235                            RemoteServiceWriteCharacteristicWithoutResponseRequest,
3236                            fidl::encoding::DefaultFuchsiaResourceDialect
3237                        );
3238                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<RemoteServiceWriteCharacteristicWithoutResponseRequest>(&header, _body_bytes, handles, &mut req)?;
3239                        let control_handle =
3240                            RemoteServiceControlHandle { inner: this.inner.clone() };
3241                        Ok(RemoteServiceRequest::WriteCharacteristicWithoutResponse {
3242                            id: req.id,
3243                            value: req.value,
3244
3245                            control_handle,
3246                        })
3247                    }
3248                    0x3d72215c1d23037a => {
3249                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
3250                        let mut req = fidl::new_empty!(
3251                            RemoteServiceReadDescriptorRequest,
3252                            fidl::encoding::DefaultFuchsiaResourceDialect
3253                        );
3254                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<RemoteServiceReadDescriptorRequest>(&header, _body_bytes, handles, &mut req)?;
3255                        let control_handle =
3256                            RemoteServiceControlHandle { inner: this.inner.clone() };
3257                        Ok(RemoteServiceRequest::ReadDescriptor {
3258                            id: req.id,
3259
3260                            responder: RemoteServiceReadDescriptorResponder {
3261                                control_handle: std::mem::ManuallyDrop::new(control_handle),
3262                                tx_id: header.tx_id,
3263                            },
3264                        })
3265                    }
3266                    0x779efe322414240b => {
3267                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
3268                        let mut req = fidl::new_empty!(
3269                            RemoteServiceReadLongDescriptorRequest,
3270                            fidl::encoding::DefaultFuchsiaResourceDialect
3271                        );
3272                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<RemoteServiceReadLongDescriptorRequest>(&header, _body_bytes, handles, &mut req)?;
3273                        let control_handle =
3274                            RemoteServiceControlHandle { inner: this.inner.clone() };
3275                        Ok(RemoteServiceRequest::ReadLongDescriptor {
3276                            id: req.id,
3277                            offset: req.offset,
3278                            max_bytes: req.max_bytes,
3279
3280                            responder: RemoteServiceReadLongDescriptorResponder {
3281                                control_handle: std::mem::ManuallyDrop::new(control_handle),
3282                                tx_id: header.tx_id,
3283                            },
3284                        })
3285                    }
3286                    0x24c813d96509895 => {
3287                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
3288                        let mut req = fidl::new_empty!(
3289                            RemoteServiceWriteDescriptorRequest,
3290                            fidl::encoding::DefaultFuchsiaResourceDialect
3291                        );
3292                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<RemoteServiceWriteDescriptorRequest>(&header, _body_bytes, handles, &mut req)?;
3293                        let control_handle =
3294                            RemoteServiceControlHandle { inner: this.inner.clone() };
3295                        Ok(RemoteServiceRequest::WriteDescriptor {
3296                            id: req.id,
3297                            value: req.value,
3298
3299                            responder: RemoteServiceWriteDescriptorResponder {
3300                                control_handle: std::mem::ManuallyDrop::new(control_handle),
3301                                tx_id: header.tx_id,
3302                            },
3303                        })
3304                    }
3305                    0x653c9dbe0138b47 => {
3306                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
3307                        let mut req = fidl::new_empty!(
3308                            RemoteServiceWriteLongDescriptorRequest,
3309                            fidl::encoding::DefaultFuchsiaResourceDialect
3310                        );
3311                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<RemoteServiceWriteLongDescriptorRequest>(&header, _body_bytes, handles, &mut req)?;
3312                        let control_handle =
3313                            RemoteServiceControlHandle { inner: this.inner.clone() };
3314                        Ok(RemoteServiceRequest::WriteLongDescriptor {
3315                            id: req.id,
3316                            offset: req.offset,
3317                            value: req.value,
3318
3319                            responder: RemoteServiceWriteLongDescriptorResponder {
3320                                control_handle: std::mem::ManuallyDrop::new(control_handle),
3321                                tx_id: header.tx_id,
3322                            },
3323                        })
3324                    }
3325                    0x72e84b1d5eb5c245 => {
3326                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
3327                        let mut req = fidl::new_empty!(
3328                            RemoteServiceReadByTypeRequest,
3329                            fidl::encoding::DefaultFuchsiaResourceDialect
3330                        );
3331                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<RemoteServiceReadByTypeRequest>(&header, _body_bytes, handles, &mut req)?;
3332                        let control_handle =
3333                            RemoteServiceControlHandle { inner: this.inner.clone() };
3334                        Ok(RemoteServiceRequest::ReadByType {
3335                            uuid: req.uuid,
3336
3337                            responder: RemoteServiceReadByTypeResponder {
3338                                control_handle: std::mem::ManuallyDrop::new(control_handle),
3339                                tx_id: header.tx_id,
3340                            },
3341                        })
3342                    }
3343                    0x615750fd68cbd159 => {
3344                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
3345                        let mut req = fidl::new_empty!(
3346                            RemoteServiceNotifyCharacteristicRequest,
3347                            fidl::encoding::DefaultFuchsiaResourceDialect
3348                        );
3349                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<RemoteServiceNotifyCharacteristicRequest>(&header, _body_bytes, handles, &mut req)?;
3350                        let control_handle =
3351                            RemoteServiceControlHandle { inner: this.inner.clone() };
3352                        Ok(RemoteServiceRequest::NotifyCharacteristic {
3353                            id: req.id,
3354                            enable: req.enable,
3355
3356                            responder: RemoteServiceNotifyCharacteristicResponder {
3357                                control_handle: std::mem::ManuallyDrop::new(control_handle),
3358                                tx_id: header.tx_id,
3359                            },
3360                        })
3361                    }
3362                    _ => Err(fidl::Error::UnknownOrdinal {
3363                        ordinal: header.ordinal,
3364                        protocol_name:
3365                            <RemoteServiceMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
3366                    }),
3367                }))
3368            },
3369        )
3370    }
3371}
3372
3373#[derive(Debug)]
3374pub enum RemoteServiceRequest {
3375    /// Returns the characteristics and characteristic descriptors that belong to
3376    /// this service.
3377    DiscoverCharacteristics { responder: RemoteServiceDiscoverCharacteristicsResponder },
3378    /// Reads the value of the characteristic with `id` and returns it in the
3379    /// reply. If `status` indicates an error `value` will be empty.
3380    ///
3381    /// If the characteristic has a long value (i.e. larger than the current MTU)
3382    /// this method will return only the first (MTU - 1) bytes of the value. Use
3383    /// ReadLongCharacteristic() to read larger values or starting at a non-zero
3384    /// offset.
3385    ReadCharacteristic { id: u64, responder: RemoteServiceReadCharacteristicResponder },
3386    /// Reads the complete value of a characteristic with the given `id`. This
3387    /// procedure should be used if the characteristic is known to have a value
3388    /// that can not be read in a single request.
3389    ///
3390    /// Returns up to `max_bytes` octets of the characteristic value starting at
3391    /// the given `offset`.
3392    ///
3393    /// This may return an error if:
3394    ///   a. `max_bytes` is 0;
3395    ///   b. The `offset` is invalid;
3396    ///   c. The characteristic does not have a long value;
3397    ///   d. The server does not support the long read procedure.
3398    ReadLongCharacteristic {
3399        id: u64,
3400        offset: u16,
3401        max_bytes: u16,
3402        responder: RemoteServiceReadLongCharacteristicResponder,
3403    },
3404    /// Writes `value` to the characteristic with `id`. This operation may return
3405    /// an error if:
3406    ///   a. The size of `value` exceeds the current MTU.
3407    ///   b. The characteristic referred to by `id` does not have the 'write'
3408    ///      property.
3409    WriteCharacteristic {
3410        id: u64,
3411        value: Vec<u8>,
3412        responder: RemoteServiceWriteCharacteristicResponder,
3413    },
3414    /// Writes `value` to the characteristic with `id`, beginning at `offset` using
3415    /// the provided `write_options`.
3416    ///
3417    /// This procedure should be used if the value to be written is too long to
3418    /// fit in a single request or needs to be written at an offset. This may
3419    /// return an error if:
3420    ///   a. The `offset` is invalid;
3421    ///   b. The server does not support the long write procedure.
3422    ///
3423    /// Long Writes require multiple messages to the remote service and take longer
3424    /// to execute than Short Writes. It is not recommended to send a short write
3425    /// while a long write is in process to the same id and data range. The order
3426    /// of the responses from this function signify the order in which the remote
3427    /// service received them, not necessarily the order in which it is called.
3428    WriteLongCharacteristic {
3429        id: u64,
3430        offset: u16,
3431        value: Vec<u8>,
3432        write_options: WriteOptions,
3433        responder: RemoteServiceWriteLongCharacteristicResponder,
3434    },
3435    /// Writes `value` to the characteristic with `id` without soliciting an
3436    /// acknowledgement from the peer. This method has no response and its delivery
3437    /// cannot be confirmed.
3438    WriteCharacteristicWithoutResponse {
3439        id: u64,
3440        value: Vec<u8>,
3441        control_handle: RemoteServiceControlHandle,
3442    },
3443    /// Reads the value of the characteristic descriptor with `id` and returns it
3444    /// in the reply. If `status` indicates an error, `value` can be ignored.
3445    ///
3446    /// If the descriptor has a long value (i.e. larger than the current MTU)
3447    /// this method will return only the first (MTU - 1) bytes of the value. Use
3448    /// ReadLongDescriptor() to read larger values or starting at a non-zero
3449    /// offset.
3450    ReadDescriptor { id: u64, responder: RemoteServiceReadDescriptorResponder },
3451    /// Reads the complete value of a characteristic descriptor with the given `id`.
3452    /// This procedure should be used if the descriptor is known to have a value
3453    /// that can not be read in a single request.
3454    ///
3455    /// Returns up to `max_bytes` octets of the characteristic value starting at
3456    /// the given `offset`.
3457    ///
3458    /// This may return an error if:
3459    ///   a. `max_bytes` is 0;
3460    ///   b. The `offset` is invalid;
3461    ///   c. The server does not support the long read procedure.
3462    ReadLongDescriptor {
3463        id: u64,
3464        offset: u16,
3465        max_bytes: u16,
3466        responder: RemoteServiceReadLongDescriptorResponder,
3467    },
3468    /// Writes `value` to the characteristic descriptor with `id`. This operation
3469    /// may return an error if:
3470    ///   a. The size of `value` exceeds the current MTU.
3471    ///   b. `id` refers to an internally reserved descriptor type (e.g. the Client
3472    ///      Characteristic Configuration descriptor).
3473    WriteDescriptor { id: u64, value: Vec<u8>, responder: RemoteServiceWriteDescriptorResponder },
3474    /// Writes `value` to the characteristic descriptor with `id`, beginning at
3475    /// `offset`. This procedure should be used if the value to be written is too
3476    /// long to fit in a single request or needs to be written at an offset. This
3477    /// may return an error if:
3478    ///   a. The `offset` is invalid;
3479    ///   b. The server does not support the long write procedure.
3480    ///   c. `id` refers to an internally reserved descriptor type (e.g. the Client
3481    ///      Characteristic Configuration descriptor).
3482    ///
3483    /// Long Writes require multiple messages to the remote service and take longer
3484    /// to execute than Short Writes. It is not recommended to send a short write
3485    /// while a long write is in process to the same id and data range. The order
3486    /// of the responses from this function signify the order in which the remote
3487    /// service received them, not necessarily the order in which it is called.
3488    WriteLongDescriptor {
3489        id: u64,
3490        offset: u16,
3491        value: Vec<u8>,
3492        responder: RemoteServiceWriteLongDescriptorResponder,
3493    },
3494    /// Reads characteristics and descriptors with the given `uuid`. If no values are
3495    /// read, `results` will be empty. If reading a value results in a permission error,
3496    /// the handle and error will be included in `results`.
3497    ///
3498    /// NOTE: Values in `results` will be truncated to `MAX_READ_BY_TYPE_VALUE_LENGTH`
3499    /// bytes. `ReadCharacteristic`, `ReadLongCharacteristic()`, `ReadDescriptor`, or
3500    /// `ReadLongDescriptor()` should be used to read the complete values.
3501    ///
3502    /// This method is useful for reading values before discovery has completed, thereby
3503    /// reducing latency.
3504    ReadByType { uuid: fidl_fuchsia_bluetooth::Uuid, responder: RemoteServiceReadByTypeResponder },
3505    /// Subscribe or unsubscribe to notifications/indications from the characteristic with
3506    /// the given `id`. Notifications or indications will be enabled if `enable` is
3507    /// true or disabled if `enable` is false and they have been enabled for this
3508    /// client.
3509    ///
3510    /// Either notifications or indications will be enabled depending on
3511    /// characteristic properties. Indications will be preferred if they are
3512    /// supported.
3513    ///
3514    /// This operation fails if the characteristic does not have the "notify" or
3515    /// "indicate" property.
3516    ///
3517    /// A write request will be issued to configure the characteristic for notifications/indications
3518    /// if it contains a Client Characteristic Configuration descriptor. This method fails if an
3519    /// error occurs while writing to the descriptor.
3520    ///
3521    /// On success, the OnCharacteristicValueUpdated event will be sent whenever
3522    /// the peer sends a notification or indication. The local host will
3523    /// automically confirm indications.
3524    NotifyCharacteristic {
3525        id: u64,
3526        enable: bool,
3527        responder: RemoteServiceNotifyCharacteristicResponder,
3528    },
3529}
3530
3531impl RemoteServiceRequest {
3532    #[allow(irrefutable_let_patterns)]
3533    pub fn into_discover_characteristics(
3534        self,
3535    ) -> Option<(RemoteServiceDiscoverCharacteristicsResponder)> {
3536        if let RemoteServiceRequest::DiscoverCharacteristics { responder } = self {
3537            Some((responder))
3538        } else {
3539            None
3540        }
3541    }
3542
3543    #[allow(irrefutable_let_patterns)]
3544    pub fn into_read_characteristic(
3545        self,
3546    ) -> Option<(u64, RemoteServiceReadCharacteristicResponder)> {
3547        if let RemoteServiceRequest::ReadCharacteristic { id, responder } = self {
3548            Some((id, responder))
3549        } else {
3550            None
3551        }
3552    }
3553
3554    #[allow(irrefutable_let_patterns)]
3555    pub fn into_read_long_characteristic(
3556        self,
3557    ) -> Option<(u64, u16, u16, RemoteServiceReadLongCharacteristicResponder)> {
3558        if let RemoteServiceRequest::ReadLongCharacteristic { id, offset, max_bytes, responder } =
3559            self
3560        {
3561            Some((id, offset, max_bytes, responder))
3562        } else {
3563            None
3564        }
3565    }
3566
3567    #[allow(irrefutable_let_patterns)]
3568    pub fn into_write_characteristic(
3569        self,
3570    ) -> Option<(u64, Vec<u8>, RemoteServiceWriteCharacteristicResponder)> {
3571        if let RemoteServiceRequest::WriteCharacteristic { id, value, responder } = self {
3572            Some((id, value, responder))
3573        } else {
3574            None
3575        }
3576    }
3577
3578    #[allow(irrefutable_let_patterns)]
3579    pub fn into_write_long_characteristic(
3580        self,
3581    ) -> Option<(u64, u16, Vec<u8>, WriteOptions, RemoteServiceWriteLongCharacteristicResponder)>
3582    {
3583        if let RemoteServiceRequest::WriteLongCharacteristic {
3584            id,
3585            offset,
3586            value,
3587            write_options,
3588            responder,
3589        } = self
3590        {
3591            Some((id, offset, value, write_options, responder))
3592        } else {
3593            None
3594        }
3595    }
3596
3597    #[allow(irrefutable_let_patterns)]
3598    pub fn into_write_characteristic_without_response(
3599        self,
3600    ) -> Option<(u64, Vec<u8>, RemoteServiceControlHandle)> {
3601        if let RemoteServiceRequest::WriteCharacteristicWithoutResponse {
3602            id,
3603            value,
3604            control_handle,
3605        } = self
3606        {
3607            Some((id, value, control_handle))
3608        } else {
3609            None
3610        }
3611    }
3612
3613    #[allow(irrefutable_let_patterns)]
3614    pub fn into_read_descriptor(self) -> Option<(u64, RemoteServiceReadDescriptorResponder)> {
3615        if let RemoteServiceRequest::ReadDescriptor { id, responder } = self {
3616            Some((id, responder))
3617        } else {
3618            None
3619        }
3620    }
3621
3622    #[allow(irrefutable_let_patterns)]
3623    pub fn into_read_long_descriptor(
3624        self,
3625    ) -> Option<(u64, u16, u16, RemoteServiceReadLongDescriptorResponder)> {
3626        if let RemoteServiceRequest::ReadLongDescriptor { id, offset, max_bytes, responder } = self
3627        {
3628            Some((id, offset, max_bytes, responder))
3629        } else {
3630            None
3631        }
3632    }
3633
3634    #[allow(irrefutable_let_patterns)]
3635    pub fn into_write_descriptor(
3636        self,
3637    ) -> Option<(u64, Vec<u8>, RemoteServiceWriteDescriptorResponder)> {
3638        if let RemoteServiceRequest::WriteDescriptor { id, value, responder } = self {
3639            Some((id, value, responder))
3640        } else {
3641            None
3642        }
3643    }
3644
3645    #[allow(irrefutable_let_patterns)]
3646    pub fn into_write_long_descriptor(
3647        self,
3648    ) -> Option<(u64, u16, Vec<u8>, RemoteServiceWriteLongDescriptorResponder)> {
3649        if let RemoteServiceRequest::WriteLongDescriptor { id, offset, value, responder } = self {
3650            Some((id, offset, value, responder))
3651        } else {
3652            None
3653        }
3654    }
3655
3656    #[allow(irrefutable_let_patterns)]
3657    pub fn into_read_by_type(
3658        self,
3659    ) -> Option<(fidl_fuchsia_bluetooth::Uuid, RemoteServiceReadByTypeResponder)> {
3660        if let RemoteServiceRequest::ReadByType { uuid, responder } = self {
3661            Some((uuid, responder))
3662        } else {
3663            None
3664        }
3665    }
3666
3667    #[allow(irrefutable_let_patterns)]
3668    pub fn into_notify_characteristic(
3669        self,
3670    ) -> Option<(u64, bool, RemoteServiceNotifyCharacteristicResponder)> {
3671        if let RemoteServiceRequest::NotifyCharacteristic { id, enable, responder } = self {
3672            Some((id, enable, responder))
3673        } else {
3674            None
3675        }
3676    }
3677
3678    /// Name of the method defined in FIDL
3679    pub fn method_name(&self) -> &'static str {
3680        match *self {
3681            RemoteServiceRequest::DiscoverCharacteristics { .. } => "discover_characteristics",
3682            RemoteServiceRequest::ReadCharacteristic { .. } => "read_characteristic",
3683            RemoteServiceRequest::ReadLongCharacteristic { .. } => "read_long_characteristic",
3684            RemoteServiceRequest::WriteCharacteristic { .. } => "write_characteristic",
3685            RemoteServiceRequest::WriteLongCharacteristic { .. } => "write_long_characteristic",
3686            RemoteServiceRequest::WriteCharacteristicWithoutResponse { .. } => {
3687                "write_characteristic_without_response"
3688            }
3689            RemoteServiceRequest::ReadDescriptor { .. } => "read_descriptor",
3690            RemoteServiceRequest::ReadLongDescriptor { .. } => "read_long_descriptor",
3691            RemoteServiceRequest::WriteDescriptor { .. } => "write_descriptor",
3692            RemoteServiceRequest::WriteLongDescriptor { .. } => "write_long_descriptor",
3693            RemoteServiceRequest::ReadByType { .. } => "read_by_type",
3694            RemoteServiceRequest::NotifyCharacteristic { .. } => "notify_characteristic",
3695        }
3696    }
3697}
3698
3699#[derive(Debug, Clone)]
3700pub struct RemoteServiceControlHandle {
3701    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
3702}
3703
3704impl fidl::endpoints::ControlHandle for RemoteServiceControlHandle {
3705    fn shutdown(&self) {
3706        self.inner.shutdown()
3707    }
3708
3709    fn shutdown_with_epitaph(&self, status: zx_status::Status) {
3710        self.inner.shutdown_with_epitaph(status)
3711    }
3712
3713    fn is_closed(&self) -> bool {
3714        self.inner.channel().is_closed()
3715    }
3716    fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
3717        self.inner.channel().on_closed()
3718    }
3719
3720    #[cfg(target_os = "fuchsia")]
3721    fn signal_peer(
3722        &self,
3723        clear_mask: zx::Signals,
3724        set_mask: zx::Signals,
3725    ) -> Result<(), zx_status::Status> {
3726        use fidl::Peered;
3727        self.inner.channel().signal_peer(clear_mask, set_mask)
3728    }
3729}
3730
3731impl RemoteServiceControlHandle {
3732    pub fn send_on_characteristic_value_updated(
3733        &self,
3734        mut id: u64,
3735        mut value: &[u8],
3736    ) -> Result<(), fidl::Error> {
3737        self.inner.send::<RemoteServiceOnCharacteristicValueUpdatedRequest>(
3738            (id, value),
3739            0,
3740            0x304debe9d0408fac,
3741            fidl::encoding::DynamicFlags::empty(),
3742        )
3743    }
3744}
3745
3746#[must_use = "FIDL methods require a response to be sent"]
3747#[derive(Debug)]
3748pub struct RemoteServiceDiscoverCharacteristicsResponder {
3749    control_handle: std::mem::ManuallyDrop<RemoteServiceControlHandle>,
3750    tx_id: u32,
3751}
3752
3753/// Set the the channel to be shutdown (see [`RemoteServiceControlHandle::shutdown`])
3754/// if the responder is dropped without sending a response, so that the client
3755/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
3756impl std::ops::Drop for RemoteServiceDiscoverCharacteristicsResponder {
3757    fn drop(&mut self) {
3758        self.control_handle.shutdown();
3759        // Safety: drops once, never accessed again
3760        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
3761    }
3762}
3763
3764impl fidl::endpoints::Responder for RemoteServiceDiscoverCharacteristicsResponder {
3765    type ControlHandle = RemoteServiceControlHandle;
3766
3767    fn control_handle(&self) -> &RemoteServiceControlHandle {
3768        &self.control_handle
3769    }
3770
3771    fn drop_without_shutdown(mut self) {
3772        // Safety: drops once, never accessed again due to mem::forget
3773        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
3774        // Prevent Drop from running (which would shut down the channel)
3775        std::mem::forget(self);
3776    }
3777}
3778
3779impl RemoteServiceDiscoverCharacteristicsResponder {
3780    /// Sends a response to the FIDL transaction.
3781    ///
3782    /// Sets the channel to shutdown if an error occurs.
3783    pub fn send(
3784        self,
3785        mut status: &fidl_fuchsia_bluetooth::Status,
3786        mut characteristics: &[Characteristic],
3787    ) -> Result<(), fidl::Error> {
3788        let _result = self.send_raw(status, characteristics);
3789        if _result.is_err() {
3790            self.control_handle.shutdown();
3791        }
3792        self.drop_without_shutdown();
3793        _result
3794    }
3795
3796    /// Similar to "send" but does not shutdown the channel if an error occurs.
3797    pub fn send_no_shutdown_on_err(
3798        self,
3799        mut status: &fidl_fuchsia_bluetooth::Status,
3800        mut characteristics: &[Characteristic],
3801    ) -> Result<(), fidl::Error> {
3802        let _result = self.send_raw(status, characteristics);
3803        self.drop_without_shutdown();
3804        _result
3805    }
3806
3807    fn send_raw(
3808        &self,
3809        mut status: &fidl_fuchsia_bluetooth::Status,
3810        mut characteristics: &[Characteristic],
3811    ) -> Result<(), fidl::Error> {
3812        self.control_handle.inner.send::<RemoteServiceDiscoverCharacteristicsResponse>(
3813            (status, characteristics),
3814            self.tx_id,
3815            0x4c13b72543a8aa16,
3816            fidl::encoding::DynamicFlags::empty(),
3817        )
3818    }
3819}
3820
3821#[must_use = "FIDL methods require a response to be sent"]
3822#[derive(Debug)]
3823pub struct RemoteServiceReadCharacteristicResponder {
3824    control_handle: std::mem::ManuallyDrop<RemoteServiceControlHandle>,
3825    tx_id: u32,
3826}
3827
3828/// Set the the channel to be shutdown (see [`RemoteServiceControlHandle::shutdown`])
3829/// if the responder is dropped without sending a response, so that the client
3830/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
3831impl std::ops::Drop for RemoteServiceReadCharacteristicResponder {
3832    fn drop(&mut self) {
3833        self.control_handle.shutdown();
3834        // Safety: drops once, never accessed again
3835        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
3836    }
3837}
3838
3839impl fidl::endpoints::Responder for RemoteServiceReadCharacteristicResponder {
3840    type ControlHandle = RemoteServiceControlHandle;
3841
3842    fn control_handle(&self) -> &RemoteServiceControlHandle {
3843        &self.control_handle
3844    }
3845
3846    fn drop_without_shutdown(mut self) {
3847        // Safety: drops once, never accessed again due to mem::forget
3848        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
3849        // Prevent Drop from running (which would shut down the channel)
3850        std::mem::forget(self);
3851    }
3852}
3853
3854impl RemoteServiceReadCharacteristicResponder {
3855    /// Sends a response to the FIDL transaction.
3856    ///
3857    /// Sets the channel to shutdown if an error occurs.
3858    pub fn send(
3859        self,
3860        mut status: &fidl_fuchsia_bluetooth::Status,
3861        mut value: &[u8],
3862    ) -> Result<(), fidl::Error> {
3863        let _result = self.send_raw(status, value);
3864        if _result.is_err() {
3865            self.control_handle.shutdown();
3866        }
3867        self.drop_without_shutdown();
3868        _result
3869    }
3870
3871    /// Similar to "send" but does not shutdown the channel if an error occurs.
3872    pub fn send_no_shutdown_on_err(
3873        self,
3874        mut status: &fidl_fuchsia_bluetooth::Status,
3875        mut value: &[u8],
3876    ) -> Result<(), fidl::Error> {
3877        let _result = self.send_raw(status, value);
3878        self.drop_without_shutdown();
3879        _result
3880    }
3881
3882    fn send_raw(
3883        &self,
3884        mut status: &fidl_fuchsia_bluetooth::Status,
3885        mut value: &[u8],
3886    ) -> Result<(), fidl::Error> {
3887        self.control_handle.inner.send::<RemoteServiceReadCharacteristicResponse>(
3888            (status, value),
3889            self.tx_id,
3890            0x200a5253bc0771c8,
3891            fidl::encoding::DynamicFlags::empty(),
3892        )
3893    }
3894}
3895
3896#[must_use = "FIDL methods require a response to be sent"]
3897#[derive(Debug)]
3898pub struct RemoteServiceReadLongCharacteristicResponder {
3899    control_handle: std::mem::ManuallyDrop<RemoteServiceControlHandle>,
3900    tx_id: u32,
3901}
3902
3903/// Set the the channel to be shutdown (see [`RemoteServiceControlHandle::shutdown`])
3904/// if the responder is dropped without sending a response, so that the client
3905/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
3906impl std::ops::Drop for RemoteServiceReadLongCharacteristicResponder {
3907    fn drop(&mut self) {
3908        self.control_handle.shutdown();
3909        // Safety: drops once, never accessed again
3910        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
3911    }
3912}
3913
3914impl fidl::endpoints::Responder for RemoteServiceReadLongCharacteristicResponder {
3915    type ControlHandle = RemoteServiceControlHandle;
3916
3917    fn control_handle(&self) -> &RemoteServiceControlHandle {
3918        &self.control_handle
3919    }
3920
3921    fn drop_without_shutdown(mut self) {
3922        // Safety: drops once, never accessed again due to mem::forget
3923        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
3924        // Prevent Drop from running (which would shut down the channel)
3925        std::mem::forget(self);
3926    }
3927}
3928
3929impl RemoteServiceReadLongCharacteristicResponder {
3930    /// Sends a response to the FIDL transaction.
3931    ///
3932    /// Sets the channel to shutdown if an error occurs.
3933    pub fn send(
3934        self,
3935        mut status: &fidl_fuchsia_bluetooth::Status,
3936        mut value: &[u8],
3937    ) -> Result<(), fidl::Error> {
3938        let _result = self.send_raw(status, value);
3939        if _result.is_err() {
3940            self.control_handle.shutdown();
3941        }
3942        self.drop_without_shutdown();
3943        _result
3944    }
3945
3946    /// Similar to "send" but does not shutdown the channel if an error occurs.
3947    pub fn send_no_shutdown_on_err(
3948        self,
3949        mut status: &fidl_fuchsia_bluetooth::Status,
3950        mut value: &[u8],
3951    ) -> Result<(), fidl::Error> {
3952        let _result = self.send_raw(status, value);
3953        self.drop_without_shutdown();
3954        _result
3955    }
3956
3957    fn send_raw(
3958        &self,
3959        mut status: &fidl_fuchsia_bluetooth::Status,
3960        mut value: &[u8],
3961    ) -> Result<(), fidl::Error> {
3962        self.control_handle.inner.send::<RemoteServiceReadLongCharacteristicResponse>(
3963            (status, value),
3964            self.tx_id,
3965            0x2df2f20845555766,
3966            fidl::encoding::DynamicFlags::empty(),
3967        )
3968    }
3969}
3970
3971#[must_use = "FIDL methods require a response to be sent"]
3972#[derive(Debug)]
3973pub struct RemoteServiceWriteCharacteristicResponder {
3974    control_handle: std::mem::ManuallyDrop<RemoteServiceControlHandle>,
3975    tx_id: u32,
3976}
3977
3978/// Set the the channel to be shutdown (see [`RemoteServiceControlHandle::shutdown`])
3979/// if the responder is dropped without sending a response, so that the client
3980/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
3981impl std::ops::Drop for RemoteServiceWriteCharacteristicResponder {
3982    fn drop(&mut self) {
3983        self.control_handle.shutdown();
3984        // Safety: drops once, never accessed again
3985        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
3986    }
3987}
3988
3989impl fidl::endpoints::Responder for RemoteServiceWriteCharacteristicResponder {
3990    type ControlHandle = RemoteServiceControlHandle;
3991
3992    fn control_handle(&self) -> &RemoteServiceControlHandle {
3993        &self.control_handle
3994    }
3995
3996    fn drop_without_shutdown(mut self) {
3997        // Safety: drops once, never accessed again due to mem::forget
3998        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
3999        // Prevent Drop from running (which would shut down the channel)
4000        std::mem::forget(self);
4001    }
4002}
4003
4004impl RemoteServiceWriteCharacteristicResponder {
4005    /// Sends a response to the FIDL transaction.
4006    ///
4007    /// Sets the channel to shutdown if an error occurs.
4008    pub fn send(self, mut status: &fidl_fuchsia_bluetooth::Status) -> Result<(), fidl::Error> {
4009        let _result = self.send_raw(status);
4010        if _result.is_err() {
4011            self.control_handle.shutdown();
4012        }
4013        self.drop_without_shutdown();
4014        _result
4015    }
4016
4017    /// Similar to "send" but does not shutdown the channel if an error occurs.
4018    pub fn send_no_shutdown_on_err(
4019        self,
4020        mut status: &fidl_fuchsia_bluetooth::Status,
4021    ) -> Result<(), fidl::Error> {
4022        let _result = self.send_raw(status);
4023        self.drop_without_shutdown();
4024        _result
4025    }
4026
4027    fn send_raw(&self, mut status: &fidl_fuchsia_bluetooth::Status) -> Result<(), fidl::Error> {
4028        self.control_handle.inner.send::<RemoteServiceWriteCharacteristicResponse>(
4029            (status,),
4030            self.tx_id,
4031            0x5c1f529653cdad04,
4032            fidl::encoding::DynamicFlags::empty(),
4033        )
4034    }
4035}
4036
4037#[must_use = "FIDL methods require a response to be sent"]
4038#[derive(Debug)]
4039pub struct RemoteServiceWriteLongCharacteristicResponder {
4040    control_handle: std::mem::ManuallyDrop<RemoteServiceControlHandle>,
4041    tx_id: u32,
4042}
4043
4044/// Set the the channel to be shutdown (see [`RemoteServiceControlHandle::shutdown`])
4045/// if the responder is dropped without sending a response, so that the client
4046/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
4047impl std::ops::Drop for RemoteServiceWriteLongCharacteristicResponder {
4048    fn drop(&mut self) {
4049        self.control_handle.shutdown();
4050        // Safety: drops once, never accessed again
4051        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
4052    }
4053}
4054
4055impl fidl::endpoints::Responder for RemoteServiceWriteLongCharacteristicResponder {
4056    type ControlHandle = RemoteServiceControlHandle;
4057
4058    fn control_handle(&self) -> &RemoteServiceControlHandle {
4059        &self.control_handle
4060    }
4061
4062    fn drop_without_shutdown(mut self) {
4063        // Safety: drops once, never accessed again due to mem::forget
4064        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
4065        // Prevent Drop from running (which would shut down the channel)
4066        std::mem::forget(self);
4067    }
4068}
4069
4070impl RemoteServiceWriteLongCharacteristicResponder {
4071    /// Sends a response to the FIDL transaction.
4072    ///
4073    /// Sets the channel to shutdown if an error occurs.
4074    pub fn send(self, mut status: &fidl_fuchsia_bluetooth::Status) -> Result<(), fidl::Error> {
4075        let _result = self.send_raw(status);
4076        if _result.is_err() {
4077            self.control_handle.shutdown();
4078        }
4079        self.drop_without_shutdown();
4080        _result
4081    }
4082
4083    /// Similar to "send" but does not shutdown the channel if an error occurs.
4084    pub fn send_no_shutdown_on_err(
4085        self,
4086        mut status: &fidl_fuchsia_bluetooth::Status,
4087    ) -> Result<(), fidl::Error> {
4088        let _result = self.send_raw(status);
4089        self.drop_without_shutdown();
4090        _result
4091    }
4092
4093    fn send_raw(&self, mut status: &fidl_fuchsia_bluetooth::Status) -> Result<(), fidl::Error> {
4094        self.control_handle.inner.send::<RemoteServiceWriteLongCharacteristicResponse>(
4095            (status,),
4096            self.tx_id,
4097            0x2d358800658043e1,
4098            fidl::encoding::DynamicFlags::empty(),
4099        )
4100    }
4101}
4102
4103#[must_use = "FIDL methods require a response to be sent"]
4104#[derive(Debug)]
4105pub struct RemoteServiceReadDescriptorResponder {
4106    control_handle: std::mem::ManuallyDrop<RemoteServiceControlHandle>,
4107    tx_id: u32,
4108}
4109
4110/// Set the the channel to be shutdown (see [`RemoteServiceControlHandle::shutdown`])
4111/// if the responder is dropped without sending a response, so that the client
4112/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
4113impl std::ops::Drop for RemoteServiceReadDescriptorResponder {
4114    fn drop(&mut self) {
4115        self.control_handle.shutdown();
4116        // Safety: drops once, never accessed again
4117        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
4118    }
4119}
4120
4121impl fidl::endpoints::Responder for RemoteServiceReadDescriptorResponder {
4122    type ControlHandle = RemoteServiceControlHandle;
4123
4124    fn control_handle(&self) -> &RemoteServiceControlHandle {
4125        &self.control_handle
4126    }
4127
4128    fn drop_without_shutdown(mut self) {
4129        // Safety: drops once, never accessed again due to mem::forget
4130        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
4131        // Prevent Drop from running (which would shut down the channel)
4132        std::mem::forget(self);
4133    }
4134}
4135
4136impl RemoteServiceReadDescriptorResponder {
4137    /// Sends a response to the FIDL transaction.
4138    ///
4139    /// Sets the channel to shutdown if an error occurs.
4140    pub fn send(
4141        self,
4142        mut status: &fidl_fuchsia_bluetooth::Status,
4143        mut value: &[u8],
4144    ) -> Result<(), fidl::Error> {
4145        let _result = self.send_raw(status, value);
4146        if _result.is_err() {
4147            self.control_handle.shutdown();
4148        }
4149        self.drop_without_shutdown();
4150        _result
4151    }
4152
4153    /// Similar to "send" but does not shutdown the channel if an error occurs.
4154    pub fn send_no_shutdown_on_err(
4155        self,
4156        mut status: &fidl_fuchsia_bluetooth::Status,
4157        mut value: &[u8],
4158    ) -> Result<(), fidl::Error> {
4159        let _result = self.send_raw(status, value);
4160        self.drop_without_shutdown();
4161        _result
4162    }
4163
4164    fn send_raw(
4165        &self,
4166        mut status: &fidl_fuchsia_bluetooth::Status,
4167        mut value: &[u8],
4168    ) -> Result<(), fidl::Error> {
4169        self.control_handle.inner.send::<RemoteServiceReadDescriptorResponse>(
4170            (status, value),
4171            self.tx_id,
4172            0x3d72215c1d23037a,
4173            fidl::encoding::DynamicFlags::empty(),
4174        )
4175    }
4176}
4177
4178#[must_use = "FIDL methods require a response to be sent"]
4179#[derive(Debug)]
4180pub struct RemoteServiceReadLongDescriptorResponder {
4181    control_handle: std::mem::ManuallyDrop<RemoteServiceControlHandle>,
4182    tx_id: u32,
4183}
4184
4185/// Set the the channel to be shutdown (see [`RemoteServiceControlHandle::shutdown`])
4186/// if the responder is dropped without sending a response, so that the client
4187/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
4188impl std::ops::Drop for RemoteServiceReadLongDescriptorResponder {
4189    fn drop(&mut self) {
4190        self.control_handle.shutdown();
4191        // Safety: drops once, never accessed again
4192        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
4193    }
4194}
4195
4196impl fidl::endpoints::Responder for RemoteServiceReadLongDescriptorResponder {
4197    type ControlHandle = RemoteServiceControlHandle;
4198
4199    fn control_handle(&self) -> &RemoteServiceControlHandle {
4200        &self.control_handle
4201    }
4202
4203    fn drop_without_shutdown(mut self) {
4204        // Safety: drops once, never accessed again due to mem::forget
4205        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
4206        // Prevent Drop from running (which would shut down the channel)
4207        std::mem::forget(self);
4208    }
4209}
4210
4211impl RemoteServiceReadLongDescriptorResponder {
4212    /// Sends a response to the FIDL transaction.
4213    ///
4214    /// Sets the channel to shutdown if an error occurs.
4215    pub fn send(
4216        self,
4217        mut status: &fidl_fuchsia_bluetooth::Status,
4218        mut value: &[u8],
4219    ) -> Result<(), fidl::Error> {
4220        let _result = self.send_raw(status, value);
4221        if _result.is_err() {
4222            self.control_handle.shutdown();
4223        }
4224        self.drop_without_shutdown();
4225        _result
4226    }
4227
4228    /// Similar to "send" but does not shutdown the channel if an error occurs.
4229    pub fn send_no_shutdown_on_err(
4230        self,
4231        mut status: &fidl_fuchsia_bluetooth::Status,
4232        mut value: &[u8],
4233    ) -> Result<(), fidl::Error> {
4234        let _result = self.send_raw(status, value);
4235        self.drop_without_shutdown();
4236        _result
4237    }
4238
4239    fn send_raw(
4240        &self,
4241        mut status: &fidl_fuchsia_bluetooth::Status,
4242        mut value: &[u8],
4243    ) -> Result<(), fidl::Error> {
4244        self.control_handle.inner.send::<RemoteServiceReadLongDescriptorResponse>(
4245            (status, value),
4246            self.tx_id,
4247            0x779efe322414240b,
4248            fidl::encoding::DynamicFlags::empty(),
4249        )
4250    }
4251}
4252
4253#[must_use = "FIDL methods require a response to be sent"]
4254#[derive(Debug)]
4255pub struct RemoteServiceWriteDescriptorResponder {
4256    control_handle: std::mem::ManuallyDrop<RemoteServiceControlHandle>,
4257    tx_id: u32,
4258}
4259
4260/// Set the the channel to be shutdown (see [`RemoteServiceControlHandle::shutdown`])
4261/// if the responder is dropped without sending a response, so that the client
4262/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
4263impl std::ops::Drop for RemoteServiceWriteDescriptorResponder {
4264    fn drop(&mut self) {
4265        self.control_handle.shutdown();
4266        // Safety: drops once, never accessed again
4267        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
4268    }
4269}
4270
4271impl fidl::endpoints::Responder for RemoteServiceWriteDescriptorResponder {
4272    type ControlHandle = RemoteServiceControlHandle;
4273
4274    fn control_handle(&self) -> &RemoteServiceControlHandle {
4275        &self.control_handle
4276    }
4277
4278    fn drop_without_shutdown(mut self) {
4279        // Safety: drops once, never accessed again due to mem::forget
4280        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
4281        // Prevent Drop from running (which would shut down the channel)
4282        std::mem::forget(self);
4283    }
4284}
4285
4286impl RemoteServiceWriteDescriptorResponder {
4287    /// Sends a response to the FIDL transaction.
4288    ///
4289    /// Sets the channel to shutdown if an error occurs.
4290    pub fn send(self, mut status: &fidl_fuchsia_bluetooth::Status) -> Result<(), fidl::Error> {
4291        let _result = self.send_raw(status);
4292        if _result.is_err() {
4293            self.control_handle.shutdown();
4294        }
4295        self.drop_without_shutdown();
4296        _result
4297    }
4298
4299    /// Similar to "send" but does not shutdown the channel if an error occurs.
4300    pub fn send_no_shutdown_on_err(
4301        self,
4302        mut status: &fidl_fuchsia_bluetooth::Status,
4303    ) -> Result<(), fidl::Error> {
4304        let _result = self.send_raw(status);
4305        self.drop_without_shutdown();
4306        _result
4307    }
4308
4309    fn send_raw(&self, mut status: &fidl_fuchsia_bluetooth::Status) -> Result<(), fidl::Error> {
4310        self.control_handle.inner.send::<RemoteServiceWriteDescriptorResponse>(
4311            (status,),
4312            self.tx_id,
4313            0x24c813d96509895,
4314            fidl::encoding::DynamicFlags::empty(),
4315        )
4316    }
4317}
4318
4319#[must_use = "FIDL methods require a response to be sent"]
4320#[derive(Debug)]
4321pub struct RemoteServiceWriteLongDescriptorResponder {
4322    control_handle: std::mem::ManuallyDrop<RemoteServiceControlHandle>,
4323    tx_id: u32,
4324}
4325
4326/// Set the the channel to be shutdown (see [`RemoteServiceControlHandle::shutdown`])
4327/// if the responder is dropped without sending a response, so that the client
4328/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
4329impl std::ops::Drop for RemoteServiceWriteLongDescriptorResponder {
4330    fn drop(&mut self) {
4331        self.control_handle.shutdown();
4332        // Safety: drops once, never accessed again
4333        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
4334    }
4335}
4336
4337impl fidl::endpoints::Responder for RemoteServiceWriteLongDescriptorResponder {
4338    type ControlHandle = RemoteServiceControlHandle;
4339
4340    fn control_handle(&self) -> &RemoteServiceControlHandle {
4341        &self.control_handle
4342    }
4343
4344    fn drop_without_shutdown(mut self) {
4345        // Safety: drops once, never accessed again due to mem::forget
4346        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
4347        // Prevent Drop from running (which would shut down the channel)
4348        std::mem::forget(self);
4349    }
4350}
4351
4352impl RemoteServiceWriteLongDescriptorResponder {
4353    /// Sends a response to the FIDL transaction.
4354    ///
4355    /// Sets the channel to shutdown if an error occurs.
4356    pub fn send(self, mut status: &fidl_fuchsia_bluetooth::Status) -> Result<(), fidl::Error> {
4357        let _result = self.send_raw(status);
4358        if _result.is_err() {
4359            self.control_handle.shutdown();
4360        }
4361        self.drop_without_shutdown();
4362        _result
4363    }
4364
4365    /// Similar to "send" but does not shutdown the channel if an error occurs.
4366    pub fn send_no_shutdown_on_err(
4367        self,
4368        mut status: &fidl_fuchsia_bluetooth::Status,
4369    ) -> Result<(), fidl::Error> {
4370        let _result = self.send_raw(status);
4371        self.drop_without_shutdown();
4372        _result
4373    }
4374
4375    fn send_raw(&self, mut status: &fidl_fuchsia_bluetooth::Status) -> Result<(), fidl::Error> {
4376        self.control_handle.inner.send::<RemoteServiceWriteLongDescriptorResponse>(
4377            (status,),
4378            self.tx_id,
4379            0x653c9dbe0138b47,
4380            fidl::encoding::DynamicFlags::empty(),
4381        )
4382    }
4383}
4384
4385#[must_use = "FIDL methods require a response to be sent"]
4386#[derive(Debug)]
4387pub struct RemoteServiceReadByTypeResponder {
4388    control_handle: std::mem::ManuallyDrop<RemoteServiceControlHandle>,
4389    tx_id: u32,
4390}
4391
4392/// Set the the channel to be shutdown (see [`RemoteServiceControlHandle::shutdown`])
4393/// if the responder is dropped without sending a response, so that the client
4394/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
4395impl std::ops::Drop for RemoteServiceReadByTypeResponder {
4396    fn drop(&mut self) {
4397        self.control_handle.shutdown();
4398        // Safety: drops once, never accessed again
4399        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
4400    }
4401}
4402
4403impl fidl::endpoints::Responder for RemoteServiceReadByTypeResponder {
4404    type ControlHandle = RemoteServiceControlHandle;
4405
4406    fn control_handle(&self) -> &RemoteServiceControlHandle {
4407        &self.control_handle
4408    }
4409
4410    fn drop_without_shutdown(mut self) {
4411        // Safety: drops once, never accessed again due to mem::forget
4412        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
4413        // Prevent Drop from running (which would shut down the channel)
4414        std::mem::forget(self);
4415    }
4416}
4417
4418impl RemoteServiceReadByTypeResponder {
4419    /// Sends a response to the FIDL transaction.
4420    ///
4421    /// Sets the channel to shutdown if an error occurs.
4422    pub fn send(self, mut result: Result<&[ReadByTypeResult], Error>) -> Result<(), fidl::Error> {
4423        let _result = self.send_raw(result);
4424        if _result.is_err() {
4425            self.control_handle.shutdown();
4426        }
4427        self.drop_without_shutdown();
4428        _result
4429    }
4430
4431    /// Similar to "send" but does not shutdown the channel if an error occurs.
4432    pub fn send_no_shutdown_on_err(
4433        self,
4434        mut result: Result<&[ReadByTypeResult], Error>,
4435    ) -> Result<(), fidl::Error> {
4436        let _result = self.send_raw(result);
4437        self.drop_without_shutdown();
4438        _result
4439    }
4440
4441    fn send_raw(&self, mut result: Result<&[ReadByTypeResult], Error>) -> Result<(), fidl::Error> {
4442        self.control_handle
4443            .inner
4444            .send::<fidl::encoding::ResultType<RemoteServiceReadByTypeResponse, Error>>(
4445                result.map(|results| (results,)),
4446                self.tx_id,
4447                0x72e84b1d5eb5c245,
4448                fidl::encoding::DynamicFlags::empty(),
4449            )
4450    }
4451}
4452
4453#[must_use = "FIDL methods require a response to be sent"]
4454#[derive(Debug)]
4455pub struct RemoteServiceNotifyCharacteristicResponder {
4456    control_handle: std::mem::ManuallyDrop<RemoteServiceControlHandle>,
4457    tx_id: u32,
4458}
4459
4460/// Set the the channel to be shutdown (see [`RemoteServiceControlHandle::shutdown`])
4461/// if the responder is dropped without sending a response, so that the client
4462/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
4463impl std::ops::Drop for RemoteServiceNotifyCharacteristicResponder {
4464    fn drop(&mut self) {
4465        self.control_handle.shutdown();
4466        // Safety: drops once, never accessed again
4467        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
4468    }
4469}
4470
4471impl fidl::endpoints::Responder for RemoteServiceNotifyCharacteristicResponder {
4472    type ControlHandle = RemoteServiceControlHandle;
4473
4474    fn control_handle(&self) -> &RemoteServiceControlHandle {
4475        &self.control_handle
4476    }
4477
4478    fn drop_without_shutdown(mut self) {
4479        // Safety: drops once, never accessed again due to mem::forget
4480        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
4481        // Prevent Drop from running (which would shut down the channel)
4482        std::mem::forget(self);
4483    }
4484}
4485
4486impl RemoteServiceNotifyCharacteristicResponder {
4487    /// Sends a response to the FIDL transaction.
4488    ///
4489    /// Sets the channel to shutdown if an error occurs.
4490    pub fn send(self, mut status: &fidl_fuchsia_bluetooth::Status) -> Result<(), fidl::Error> {
4491        let _result = self.send_raw(status);
4492        if _result.is_err() {
4493            self.control_handle.shutdown();
4494        }
4495        self.drop_without_shutdown();
4496        _result
4497    }
4498
4499    /// Similar to "send" but does not shutdown the channel if an error occurs.
4500    pub fn send_no_shutdown_on_err(
4501        self,
4502        mut status: &fidl_fuchsia_bluetooth::Status,
4503    ) -> Result<(), fidl::Error> {
4504        let _result = self.send_raw(status);
4505        self.drop_without_shutdown();
4506        _result
4507    }
4508
4509    fn send_raw(&self, mut status: &fidl_fuchsia_bluetooth::Status) -> Result<(), fidl::Error> {
4510        self.control_handle.inner.send::<RemoteServiceNotifyCharacteristicResponse>(
4511            (status,),
4512            self.tx_id,
4513            0x615750fd68cbd159,
4514            fidl::encoding::DynamicFlags::empty(),
4515        )
4516    }
4517}
4518
4519#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
4520pub struct Server_Marker;
4521
4522impl fidl::endpoints::ProtocolMarker for Server_Marker {
4523    type Proxy = Server_Proxy;
4524    type RequestStream = Server_RequestStream;
4525    #[cfg(target_os = "fuchsia")]
4526    type SynchronousProxy = Server_SynchronousProxy;
4527
4528    const DEBUG_NAME: &'static str = "fuchsia.bluetooth.gatt.Server";
4529}
4530impl fidl::endpoints::DiscoverableProtocolMarker for Server_Marker {}
4531
4532pub trait Server_ProxyInterface: Send + Sync {
4533    type PublishServiceResponseFut: std::future::Future<Output = Result<fidl_fuchsia_bluetooth::Status, fidl::Error>>
4534        + Send;
4535    fn r#publish_service(
4536        &self,
4537        info: &ServiceInfo,
4538        delegate: fidl::endpoints::ClientEnd<LocalServiceDelegateMarker>,
4539        service: fidl::endpoints::ServerEnd<LocalServiceMarker>,
4540    ) -> Self::PublishServiceResponseFut;
4541}
4542#[derive(Debug)]
4543#[cfg(target_os = "fuchsia")]
4544pub struct Server_SynchronousProxy {
4545    client: fidl::client::sync::Client,
4546}
4547
4548#[cfg(target_os = "fuchsia")]
4549impl fidl::endpoints::SynchronousProxy for Server_SynchronousProxy {
4550    type Proxy = Server_Proxy;
4551    type Protocol = Server_Marker;
4552
4553    fn from_channel(inner: fidl::Channel) -> Self {
4554        Self::new(inner)
4555    }
4556
4557    fn into_channel(self) -> fidl::Channel {
4558        self.client.into_channel()
4559    }
4560
4561    fn as_channel(&self) -> &fidl::Channel {
4562        self.client.as_channel()
4563    }
4564}
4565
4566#[cfg(target_os = "fuchsia")]
4567impl Server_SynchronousProxy {
4568    pub fn new(channel: fidl::Channel) -> Self {
4569        Self { client: fidl::client::sync::Client::new(channel) }
4570    }
4571
4572    pub fn into_channel(self) -> fidl::Channel {
4573        self.client.into_channel()
4574    }
4575
4576    /// Waits until an event arrives and returns it. It is safe for other
4577    /// threads to make concurrent requests while waiting for an event.
4578    pub fn wait_for_event(
4579        &self,
4580        deadline: zx::MonotonicInstant,
4581    ) -> Result<Server_Event, fidl::Error> {
4582        Server_Event::decode(self.client.wait_for_event::<Server_Marker>(deadline)?)
4583    }
4584
4585    /// Publishes the given service so that it is available to all remote peers.
4586    /// A LocalServiceDelegate must be provided over which to receive service requests.
4587    ///
4588    /// The caller must assign distinct identifiers to the characteristics and
4589    /// descriptors listed in `info`. These identifiers will be used in requests
4590    /// sent to `delegate`.
4591    ///
4592    /// `service` can be used to interact with the pubished service. If this
4593    /// service cannot be published then the handle for `service` will be closed.
4594    ///
4595    /// Returns the success or failure status of the call and a unique identifier
4596    /// that can be used to unregister the service.
4597    pub fn r#publish_service(
4598        &self,
4599        mut info: &ServiceInfo,
4600        mut delegate: fidl::endpoints::ClientEnd<LocalServiceDelegateMarker>,
4601        mut service: fidl::endpoints::ServerEnd<LocalServiceMarker>,
4602        ___deadline: zx::MonotonicInstant,
4603    ) -> Result<fidl_fuchsia_bluetooth::Status, fidl::Error> {
4604        let _response = self
4605            .client
4606            .send_query::<ServerPublishServiceRequest, ServerPublishServiceResponse, Server_Marker>(
4607                (info, delegate, service),
4608                0x3b8b6f0988adb8c2,
4609                fidl::encoding::DynamicFlags::empty(),
4610                ___deadline,
4611            )?;
4612        Ok(_response.status)
4613    }
4614}
4615
4616#[cfg(target_os = "fuchsia")]
4617impl From<Server_SynchronousProxy> for zx::NullableHandle {
4618    fn from(value: Server_SynchronousProxy) -> Self {
4619        value.into_channel().into()
4620    }
4621}
4622
4623#[cfg(target_os = "fuchsia")]
4624impl From<fidl::Channel> for Server_SynchronousProxy {
4625    fn from(value: fidl::Channel) -> Self {
4626        Self::new(value)
4627    }
4628}
4629
4630#[cfg(target_os = "fuchsia")]
4631impl fidl::endpoints::FromClient for Server_SynchronousProxy {
4632    type Protocol = Server_Marker;
4633
4634    fn from_client(value: fidl::endpoints::ClientEnd<Server_Marker>) -> Self {
4635        Self::new(value.into_channel())
4636    }
4637}
4638
4639#[derive(Debug, Clone)]
4640pub struct Server_Proxy {
4641    client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
4642}
4643
4644impl fidl::endpoints::Proxy for Server_Proxy {
4645    type Protocol = Server_Marker;
4646
4647    fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
4648        Self::new(inner)
4649    }
4650
4651    fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
4652        self.client.into_channel().map_err(|client| Self { client })
4653    }
4654
4655    fn as_channel(&self) -> &::fidl::AsyncChannel {
4656        self.client.as_channel()
4657    }
4658}
4659
4660impl Server_Proxy {
4661    /// Create a new Proxy for fuchsia.bluetooth.gatt/Server.
4662    pub fn new(channel: ::fidl::AsyncChannel) -> Self {
4663        let protocol_name = <Server_Marker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
4664        Self { client: fidl::client::Client::new(channel, protocol_name) }
4665    }
4666
4667    /// Get a Stream of events from the remote end of the protocol.
4668    ///
4669    /// # Panics
4670    ///
4671    /// Panics if the event stream was already taken.
4672    pub fn take_event_stream(&self) -> Server_EventStream {
4673        Server_EventStream { event_receiver: self.client.take_event_receiver() }
4674    }
4675
4676    /// Publishes the given service so that it is available to all remote peers.
4677    /// A LocalServiceDelegate must be provided over which to receive service requests.
4678    ///
4679    /// The caller must assign distinct identifiers to the characteristics and
4680    /// descriptors listed in `info`. These identifiers will be used in requests
4681    /// sent to `delegate`.
4682    ///
4683    /// `service` can be used to interact with the pubished service. If this
4684    /// service cannot be published then the handle for `service` will be closed.
4685    ///
4686    /// Returns the success or failure status of the call and a unique identifier
4687    /// that can be used to unregister the service.
4688    pub fn r#publish_service(
4689        &self,
4690        mut info: &ServiceInfo,
4691        mut delegate: fidl::endpoints::ClientEnd<LocalServiceDelegateMarker>,
4692        mut service: fidl::endpoints::ServerEnd<LocalServiceMarker>,
4693    ) -> fidl::client::QueryResponseFut<
4694        fidl_fuchsia_bluetooth::Status,
4695        fidl::encoding::DefaultFuchsiaResourceDialect,
4696    > {
4697        Server_ProxyInterface::r#publish_service(self, info, delegate, service)
4698    }
4699}
4700
4701impl Server_ProxyInterface for Server_Proxy {
4702    type PublishServiceResponseFut = fidl::client::QueryResponseFut<
4703        fidl_fuchsia_bluetooth::Status,
4704        fidl::encoding::DefaultFuchsiaResourceDialect,
4705    >;
4706    fn r#publish_service(
4707        &self,
4708        mut info: &ServiceInfo,
4709        mut delegate: fidl::endpoints::ClientEnd<LocalServiceDelegateMarker>,
4710        mut service: fidl::endpoints::ServerEnd<LocalServiceMarker>,
4711    ) -> Self::PublishServiceResponseFut {
4712        fn _decode(
4713            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
4714        ) -> Result<fidl_fuchsia_bluetooth::Status, fidl::Error> {
4715            let _response = fidl::client::decode_transaction_body::<
4716                ServerPublishServiceResponse,
4717                fidl::encoding::DefaultFuchsiaResourceDialect,
4718                0x3b8b6f0988adb8c2,
4719            >(_buf?)?;
4720            Ok(_response.status)
4721        }
4722        self.client
4723            .send_query_and_decode::<ServerPublishServiceRequest, fidl_fuchsia_bluetooth::Status>(
4724                (info, delegate, service),
4725                0x3b8b6f0988adb8c2,
4726                fidl::encoding::DynamicFlags::empty(),
4727                _decode,
4728            )
4729    }
4730}
4731
4732pub struct Server_EventStream {
4733    event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
4734}
4735
4736impl std::marker::Unpin for Server_EventStream {}
4737
4738impl futures::stream::FusedStream for Server_EventStream {
4739    fn is_terminated(&self) -> bool {
4740        self.event_receiver.is_terminated()
4741    }
4742}
4743
4744impl futures::Stream for Server_EventStream {
4745    type Item = Result<Server_Event, fidl::Error>;
4746
4747    fn poll_next(
4748        mut self: std::pin::Pin<&mut Self>,
4749        cx: &mut std::task::Context<'_>,
4750    ) -> std::task::Poll<Option<Self::Item>> {
4751        match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
4752            &mut self.event_receiver,
4753            cx
4754        )?) {
4755            Some(buf) => std::task::Poll::Ready(Some(Server_Event::decode(buf))),
4756            None => std::task::Poll::Ready(None),
4757        }
4758    }
4759}
4760
4761#[derive(Debug)]
4762pub enum Server_Event {}
4763
4764impl Server_Event {
4765    /// Decodes a message buffer as a [`Server_Event`].
4766    fn decode(
4767        mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
4768    ) -> Result<Server_Event, fidl::Error> {
4769        let (bytes, _handles) = buf.split_mut();
4770        let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
4771        debug_assert_eq!(tx_header.tx_id, 0);
4772        match tx_header.ordinal {
4773            _ => Err(fidl::Error::UnknownOrdinal {
4774                ordinal: tx_header.ordinal,
4775                protocol_name: <Server_Marker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
4776            }),
4777        }
4778    }
4779}
4780
4781/// A Stream of incoming requests for fuchsia.bluetooth.gatt/Server.
4782pub struct Server_RequestStream {
4783    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
4784    is_terminated: bool,
4785}
4786
4787impl std::marker::Unpin for Server_RequestStream {}
4788
4789impl futures::stream::FusedStream for Server_RequestStream {
4790    fn is_terminated(&self) -> bool {
4791        self.is_terminated
4792    }
4793}
4794
4795impl fidl::endpoints::RequestStream for Server_RequestStream {
4796    type Protocol = Server_Marker;
4797    type ControlHandle = Server_ControlHandle;
4798
4799    fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
4800        Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
4801    }
4802
4803    fn control_handle(&self) -> Self::ControlHandle {
4804        Server_ControlHandle { inner: self.inner.clone() }
4805    }
4806
4807    fn into_inner(
4808        self,
4809    ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
4810    {
4811        (self.inner, self.is_terminated)
4812    }
4813
4814    fn from_inner(
4815        inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
4816        is_terminated: bool,
4817    ) -> Self {
4818        Self { inner, is_terminated }
4819    }
4820}
4821
4822impl futures::Stream for Server_RequestStream {
4823    type Item = Result<Server_Request, fidl::Error>;
4824
4825    fn poll_next(
4826        mut self: std::pin::Pin<&mut Self>,
4827        cx: &mut std::task::Context<'_>,
4828    ) -> std::task::Poll<Option<Self::Item>> {
4829        let this = &mut *self;
4830        if this.inner.check_shutdown(cx) {
4831            this.is_terminated = true;
4832            return std::task::Poll::Ready(None);
4833        }
4834        if this.is_terminated {
4835            panic!("polled Server_RequestStream after completion");
4836        }
4837        fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
4838            |bytes, handles| {
4839                match this.inner.channel().read_etc(cx, bytes, handles) {
4840                    std::task::Poll::Ready(Ok(())) => {}
4841                    std::task::Poll::Pending => return std::task::Poll::Pending,
4842                    std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
4843                        this.is_terminated = true;
4844                        return std::task::Poll::Ready(None);
4845                    }
4846                    std::task::Poll::Ready(Err(e)) => {
4847                        return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
4848                            e.into(),
4849                        ))));
4850                    }
4851                }
4852
4853                // A message has been received from the channel
4854                let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
4855
4856                std::task::Poll::Ready(Some(match header.ordinal {
4857                    0x3b8b6f0988adb8c2 => {
4858                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
4859                        let mut req = fidl::new_empty!(
4860                            ServerPublishServiceRequest,
4861                            fidl::encoding::DefaultFuchsiaResourceDialect
4862                        );
4863                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<ServerPublishServiceRequest>(&header, _body_bytes, handles, &mut req)?;
4864                        let control_handle = Server_ControlHandle { inner: this.inner.clone() };
4865                        Ok(Server_Request::PublishService {
4866                            info: req.info,
4867                            delegate: req.delegate,
4868                            service: req.service,
4869
4870                            responder: Server_PublishServiceResponder {
4871                                control_handle: std::mem::ManuallyDrop::new(control_handle),
4872                                tx_id: header.tx_id,
4873                            },
4874                        })
4875                    }
4876                    _ => Err(fidl::Error::UnknownOrdinal {
4877                        ordinal: header.ordinal,
4878                        protocol_name:
4879                            <Server_Marker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
4880                    }),
4881                }))
4882            },
4883        )
4884    }
4885}
4886
4887#[derive(Debug)]
4888pub enum Server_Request {
4889    /// Publishes the given service so that it is available to all remote peers.
4890    /// A LocalServiceDelegate must be provided over which to receive service requests.
4891    ///
4892    /// The caller must assign distinct identifiers to the characteristics and
4893    /// descriptors listed in `info`. These identifiers will be used in requests
4894    /// sent to `delegate`.
4895    ///
4896    /// `service` can be used to interact with the pubished service. If this
4897    /// service cannot be published then the handle for `service` will be closed.
4898    ///
4899    /// Returns the success or failure status of the call and a unique identifier
4900    /// that can be used to unregister the service.
4901    PublishService {
4902        info: ServiceInfo,
4903        delegate: fidl::endpoints::ClientEnd<LocalServiceDelegateMarker>,
4904        service: fidl::endpoints::ServerEnd<LocalServiceMarker>,
4905        responder: Server_PublishServiceResponder,
4906    },
4907}
4908
4909impl Server_Request {
4910    #[allow(irrefutable_let_patterns)]
4911    pub fn into_publish_service(
4912        self,
4913    ) -> Option<(
4914        ServiceInfo,
4915        fidl::endpoints::ClientEnd<LocalServiceDelegateMarker>,
4916        fidl::endpoints::ServerEnd<LocalServiceMarker>,
4917        Server_PublishServiceResponder,
4918    )> {
4919        if let Server_Request::PublishService { info, delegate, service, responder } = self {
4920            Some((info, delegate, service, responder))
4921        } else {
4922            None
4923        }
4924    }
4925
4926    /// Name of the method defined in FIDL
4927    pub fn method_name(&self) -> &'static str {
4928        match *self {
4929            Server_Request::PublishService { .. } => "publish_service",
4930        }
4931    }
4932}
4933
4934#[derive(Debug, Clone)]
4935pub struct Server_ControlHandle {
4936    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
4937}
4938
4939impl fidl::endpoints::ControlHandle for Server_ControlHandle {
4940    fn shutdown(&self) {
4941        self.inner.shutdown()
4942    }
4943
4944    fn shutdown_with_epitaph(&self, status: zx_status::Status) {
4945        self.inner.shutdown_with_epitaph(status)
4946    }
4947
4948    fn is_closed(&self) -> bool {
4949        self.inner.channel().is_closed()
4950    }
4951    fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
4952        self.inner.channel().on_closed()
4953    }
4954
4955    #[cfg(target_os = "fuchsia")]
4956    fn signal_peer(
4957        &self,
4958        clear_mask: zx::Signals,
4959        set_mask: zx::Signals,
4960    ) -> Result<(), zx_status::Status> {
4961        use fidl::Peered;
4962        self.inner.channel().signal_peer(clear_mask, set_mask)
4963    }
4964}
4965
4966impl Server_ControlHandle {}
4967
4968#[must_use = "FIDL methods require a response to be sent"]
4969#[derive(Debug)]
4970pub struct Server_PublishServiceResponder {
4971    control_handle: std::mem::ManuallyDrop<Server_ControlHandle>,
4972    tx_id: u32,
4973}
4974
4975/// Set the the channel to be shutdown (see [`Server_ControlHandle::shutdown`])
4976/// if the responder is dropped without sending a response, so that the client
4977/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
4978impl std::ops::Drop for Server_PublishServiceResponder {
4979    fn drop(&mut self) {
4980        self.control_handle.shutdown();
4981        // Safety: drops once, never accessed again
4982        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
4983    }
4984}
4985
4986impl fidl::endpoints::Responder for Server_PublishServiceResponder {
4987    type ControlHandle = Server_ControlHandle;
4988
4989    fn control_handle(&self) -> &Server_ControlHandle {
4990        &self.control_handle
4991    }
4992
4993    fn drop_without_shutdown(mut self) {
4994        // Safety: drops once, never accessed again due to mem::forget
4995        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
4996        // Prevent Drop from running (which would shut down the channel)
4997        std::mem::forget(self);
4998    }
4999}
5000
5001impl Server_PublishServiceResponder {
5002    /// Sends a response to the FIDL transaction.
5003    ///
5004    /// Sets the channel to shutdown if an error occurs.
5005    pub fn send(self, mut status: &fidl_fuchsia_bluetooth::Status) -> Result<(), fidl::Error> {
5006        let _result = self.send_raw(status);
5007        if _result.is_err() {
5008            self.control_handle.shutdown();
5009        }
5010        self.drop_without_shutdown();
5011        _result
5012    }
5013
5014    /// Similar to "send" but does not shutdown the channel if an error occurs.
5015    pub fn send_no_shutdown_on_err(
5016        self,
5017        mut status: &fidl_fuchsia_bluetooth::Status,
5018    ) -> Result<(), fidl::Error> {
5019        let _result = self.send_raw(status);
5020        self.drop_without_shutdown();
5021        _result
5022    }
5023
5024    fn send_raw(&self, mut status: &fidl_fuchsia_bluetooth::Status) -> Result<(), fidl::Error> {
5025        self.control_handle.inner.send::<ServerPublishServiceResponse>(
5026            (status,),
5027            self.tx_id,
5028            0x3b8b6f0988adb8c2,
5029            fidl::encoding::DynamicFlags::empty(),
5030        )
5031    }
5032}
5033
5034mod internal {
5035    use super::*;
5036
5037    impl fidl::encoding::ResourceTypeMarker for ClientConnectToServiceRequest {
5038        type Borrowed<'a> = &'a mut Self;
5039        fn take_or_borrow<'a>(
5040            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
5041        ) -> Self::Borrowed<'a> {
5042            value
5043        }
5044    }
5045
5046    unsafe impl fidl::encoding::TypeMarker for ClientConnectToServiceRequest {
5047        type Owned = Self;
5048
5049        #[inline(always)]
5050        fn inline_align(_context: fidl::encoding::Context) -> usize {
5051            8
5052        }
5053
5054        #[inline(always)]
5055        fn inline_size(_context: fidl::encoding::Context) -> usize {
5056            16
5057        }
5058    }
5059
5060    unsafe impl
5061        fidl::encoding::Encode<
5062            ClientConnectToServiceRequest,
5063            fidl::encoding::DefaultFuchsiaResourceDialect,
5064        > for &mut ClientConnectToServiceRequest
5065    {
5066        #[inline]
5067        unsafe fn encode(
5068            self,
5069            encoder: &mut fidl::encoding::Encoder<
5070                '_,
5071                fidl::encoding::DefaultFuchsiaResourceDialect,
5072            >,
5073            offset: usize,
5074            _depth: fidl::encoding::Depth,
5075        ) -> fidl::Result<()> {
5076            encoder.debug_check_bounds::<ClientConnectToServiceRequest>(offset);
5077            // Delegate to tuple encoding.
5078            fidl::encoding::Encode::<ClientConnectToServiceRequest, fidl::encoding::DefaultFuchsiaResourceDialect>::encode(
5079                (
5080                    <u64 as fidl::encoding::ValueTypeMarker>::borrow(&self.id),
5081                    <fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<RemoteServiceMarker>> as fidl::encoding::ResourceTypeMarker>::take_or_borrow(&mut self.service),
5082                ),
5083                encoder, offset, _depth
5084            )
5085        }
5086    }
5087    unsafe impl<
5088        T0: fidl::encoding::Encode<u64, fidl::encoding::DefaultFuchsiaResourceDialect>,
5089        T1: fidl::encoding::Encode<
5090                fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<RemoteServiceMarker>>,
5091                fidl::encoding::DefaultFuchsiaResourceDialect,
5092            >,
5093    >
5094        fidl::encoding::Encode<
5095            ClientConnectToServiceRequest,
5096            fidl::encoding::DefaultFuchsiaResourceDialect,
5097        > for (T0, T1)
5098    {
5099        #[inline]
5100        unsafe fn encode(
5101            self,
5102            encoder: &mut fidl::encoding::Encoder<
5103                '_,
5104                fidl::encoding::DefaultFuchsiaResourceDialect,
5105            >,
5106            offset: usize,
5107            depth: fidl::encoding::Depth,
5108        ) -> fidl::Result<()> {
5109            encoder.debug_check_bounds::<ClientConnectToServiceRequest>(offset);
5110            // Zero out padding regions. There's no need to apply masks
5111            // because the unmasked parts will be overwritten by fields.
5112            unsafe {
5113                let ptr = encoder.buf.as_mut_ptr().add(offset).offset(8);
5114                (ptr as *mut u64).write_unaligned(0);
5115            }
5116            // Write the fields.
5117            self.0.encode(encoder, offset + 0, depth)?;
5118            self.1.encode(encoder, offset + 8, depth)?;
5119            Ok(())
5120        }
5121    }
5122
5123    impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
5124        for ClientConnectToServiceRequest
5125    {
5126        #[inline(always)]
5127        fn new_empty() -> Self {
5128            Self {
5129                id: fidl::new_empty!(u64, fidl::encoding::DefaultFuchsiaResourceDialect),
5130                service: fidl::new_empty!(
5131                    fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<RemoteServiceMarker>>,
5132                    fidl::encoding::DefaultFuchsiaResourceDialect
5133                ),
5134            }
5135        }
5136
5137        #[inline]
5138        unsafe fn decode(
5139            &mut self,
5140            decoder: &mut fidl::encoding::Decoder<
5141                '_,
5142                fidl::encoding::DefaultFuchsiaResourceDialect,
5143            >,
5144            offset: usize,
5145            _depth: fidl::encoding::Depth,
5146        ) -> fidl::Result<()> {
5147            decoder.debug_check_bounds::<Self>(offset);
5148            // Verify that padding bytes are zero.
5149            let ptr = unsafe { decoder.buf.as_ptr().add(offset).offset(8) };
5150            let padval = unsafe { (ptr as *const u64).read_unaligned() };
5151            let mask = 0xffffffff00000000u64;
5152            let maskedval = padval & mask;
5153            if maskedval != 0 {
5154                return Err(fidl::Error::NonZeroPadding {
5155                    padding_start: offset + 8 + ((mask as u64).trailing_zeros() / 8) as usize,
5156                });
5157            }
5158            fidl::decode!(
5159                u64,
5160                fidl::encoding::DefaultFuchsiaResourceDialect,
5161                &mut self.id,
5162                decoder,
5163                offset + 0,
5164                _depth
5165            )?;
5166            fidl::decode!(
5167                fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<RemoteServiceMarker>>,
5168                fidl::encoding::DefaultFuchsiaResourceDialect,
5169                &mut self.service,
5170                decoder,
5171                offset + 8,
5172                _depth
5173            )?;
5174            Ok(())
5175        }
5176    }
5177
5178    impl fidl::encoding::ResourceTypeMarker for ServerPublishServiceRequest {
5179        type Borrowed<'a> = &'a mut Self;
5180        fn take_or_borrow<'a>(
5181            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
5182        ) -> Self::Borrowed<'a> {
5183            value
5184        }
5185    }
5186
5187    unsafe impl fidl::encoding::TypeMarker for ServerPublishServiceRequest {
5188        type Owned = Self;
5189
5190        #[inline(always)]
5191        fn inline_align(_context: fidl::encoding::Context) -> usize {
5192            8
5193        }
5194
5195        #[inline(always)]
5196        fn inline_size(_context: fidl::encoding::Context) -> usize {
5197            72
5198        }
5199    }
5200
5201    unsafe impl
5202        fidl::encoding::Encode<
5203            ServerPublishServiceRequest,
5204            fidl::encoding::DefaultFuchsiaResourceDialect,
5205        > for &mut ServerPublishServiceRequest
5206    {
5207        #[inline]
5208        unsafe fn encode(
5209            self,
5210            encoder: &mut fidl::encoding::Encoder<
5211                '_,
5212                fidl::encoding::DefaultFuchsiaResourceDialect,
5213            >,
5214            offset: usize,
5215            _depth: fidl::encoding::Depth,
5216        ) -> fidl::Result<()> {
5217            encoder.debug_check_bounds::<ServerPublishServiceRequest>(offset);
5218            // Delegate to tuple encoding.
5219            fidl::encoding::Encode::<ServerPublishServiceRequest, fidl::encoding::DefaultFuchsiaResourceDialect>::encode(
5220                (
5221                    <ServiceInfo as fidl::encoding::ValueTypeMarker>::borrow(&self.info),
5222                    <fidl::encoding::Endpoint<fidl::endpoints::ClientEnd<LocalServiceDelegateMarker>> as fidl::encoding::ResourceTypeMarker>::take_or_borrow(&mut self.delegate),
5223                    <fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<LocalServiceMarker>> as fidl::encoding::ResourceTypeMarker>::take_or_borrow(&mut self.service),
5224                ),
5225                encoder, offset, _depth
5226            )
5227        }
5228    }
5229    unsafe impl<
5230        T0: fidl::encoding::Encode<ServiceInfo, fidl::encoding::DefaultFuchsiaResourceDialect>,
5231        T1: fidl::encoding::Encode<
5232                fidl::encoding::Endpoint<fidl::endpoints::ClientEnd<LocalServiceDelegateMarker>>,
5233                fidl::encoding::DefaultFuchsiaResourceDialect,
5234            >,
5235        T2: fidl::encoding::Encode<
5236                fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<LocalServiceMarker>>,
5237                fidl::encoding::DefaultFuchsiaResourceDialect,
5238            >,
5239    >
5240        fidl::encoding::Encode<
5241            ServerPublishServiceRequest,
5242            fidl::encoding::DefaultFuchsiaResourceDialect,
5243        > for (T0, T1, T2)
5244    {
5245        #[inline]
5246        unsafe fn encode(
5247            self,
5248            encoder: &mut fidl::encoding::Encoder<
5249                '_,
5250                fidl::encoding::DefaultFuchsiaResourceDialect,
5251            >,
5252            offset: usize,
5253            depth: fidl::encoding::Depth,
5254        ) -> fidl::Result<()> {
5255            encoder.debug_check_bounds::<ServerPublishServiceRequest>(offset);
5256            // Zero out padding regions. There's no need to apply masks
5257            // because the unmasked parts will be overwritten by fields.
5258            // Write the fields.
5259            self.0.encode(encoder, offset + 0, depth)?;
5260            self.1.encode(encoder, offset + 64, depth)?;
5261            self.2.encode(encoder, offset + 68, depth)?;
5262            Ok(())
5263        }
5264    }
5265
5266    impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
5267        for ServerPublishServiceRequest
5268    {
5269        #[inline(always)]
5270        fn new_empty() -> Self {
5271            Self {
5272                info: fidl::new_empty!(ServiceInfo, fidl::encoding::DefaultFuchsiaResourceDialect),
5273                delegate: fidl::new_empty!(
5274                    fidl::encoding::Endpoint<
5275                        fidl::endpoints::ClientEnd<LocalServiceDelegateMarker>,
5276                    >,
5277                    fidl::encoding::DefaultFuchsiaResourceDialect
5278                ),
5279                service: fidl::new_empty!(
5280                    fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<LocalServiceMarker>>,
5281                    fidl::encoding::DefaultFuchsiaResourceDialect
5282                ),
5283            }
5284        }
5285
5286        #[inline]
5287        unsafe fn decode(
5288            &mut self,
5289            decoder: &mut fidl::encoding::Decoder<
5290                '_,
5291                fidl::encoding::DefaultFuchsiaResourceDialect,
5292            >,
5293            offset: usize,
5294            _depth: fidl::encoding::Depth,
5295        ) -> fidl::Result<()> {
5296            decoder.debug_check_bounds::<Self>(offset);
5297            // Verify that padding bytes are zero.
5298            fidl::decode!(
5299                ServiceInfo,
5300                fidl::encoding::DefaultFuchsiaResourceDialect,
5301                &mut self.info,
5302                decoder,
5303                offset + 0,
5304                _depth
5305            )?;
5306            fidl::decode!(
5307                fidl::encoding::Endpoint<fidl::endpoints::ClientEnd<LocalServiceDelegateMarker>>,
5308                fidl::encoding::DefaultFuchsiaResourceDialect,
5309                &mut self.delegate,
5310                decoder,
5311                offset + 64,
5312                _depth
5313            )?;
5314            fidl::decode!(
5315                fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<LocalServiceMarker>>,
5316                fidl::encoding::DefaultFuchsiaResourceDialect,
5317                &mut self.service,
5318                decoder,
5319                offset + 68,
5320                _depth
5321            )?;
5322            Ok(())
5323        }
5324    }
5325}