Skip to main content

fidl_fuchsia_bluetooth_gatt/
fidl_fuchsia_bluetooth_gatt.rs

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