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