fidl_fuchsia_bluetooth_gatt/
fidl_fuchsia_bluetooth_gatt.rs

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