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