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_sys__common::*;
11use futures::future::{self, MaybeDone, TryFutureExt};
12use zx_status;
13
14#[derive(Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
15pub struct AccessMakeDiscoverableRequest {
16 pub token: fidl::endpoints::ServerEnd<ProcedureTokenMarker>,
17}
18
19impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect>
20 for AccessMakeDiscoverableRequest
21{
22}
23
24#[derive(Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
25pub struct AccessSetPairingDelegateRequest {
26 pub input: InputCapability,
27 pub output: OutputCapability,
28 pub delegate: fidl::endpoints::ClientEnd<PairingDelegateMarker>,
29}
30
31impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect>
32 for AccessSetPairingDelegateRequest
33{
34}
35
36#[derive(Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
37pub struct AccessStartDiscoveryRequest {
38 pub token: fidl::endpoints::ServerEnd<ProcedureTokenMarker>,
39}
40
41impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect>
42 for AccessStartDiscoveryRequest
43{
44}
45
46#[derive(Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
47pub struct PairingSetDelegateRequest {
48 pub input: InputCapability,
49 pub output: OutputCapability,
50 pub delegate: fidl::endpoints::ClientEnd<PairingDelegate2Marker>,
51}
52
53impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect> for PairingSetDelegateRequest {}
54
55#[derive(Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
56pub struct PairingSetPairingDelegateRequest {
57 pub input: InputCapability,
58 pub output: OutputCapability,
59 pub delegate: fidl::endpoints::ClientEnd<PairingDelegateMarker>,
60}
61
62impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect>
63 for PairingSetPairingDelegateRequest
64{
65}
66
67#[derive(Debug, Default, PartialEq)]
68pub struct AccessSetConnectionPolicyRequest {
69 pub suppress_bredr_connections: Option<fidl::endpoints::ServerEnd<ProcedureTokenMarker>>,
74 #[doc(hidden)]
75 pub __source_breaking: fidl::marker::SourceBreaking,
76}
77
78impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect>
79 for AccessSetConnectionPolicyRequest
80{
81}
82
83#[derive(Debug, Default, PartialEq)]
84pub struct PairingDelegate2StartRequestRequest {
85 pub peer: Option<Peer>,
87 pub info: Option<PairingProperties>,
89 pub request: Option<fidl::endpoints::ClientEnd<PairingRequestMarker>>,
91 #[doc(hidden)]
92 pub __source_breaking: fidl::marker::SourceBreaking,
93}
94
95impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect>
96 for PairingDelegate2StartRequestRequest
97{
98}
99
100#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
101pub struct AccessMarker;
102
103impl fidl::endpoints::ProtocolMarker for AccessMarker {
104 type Proxy = AccessProxy;
105 type RequestStream = AccessRequestStream;
106 #[cfg(target_os = "fuchsia")]
107 type SynchronousProxy = AccessSynchronousProxy;
108
109 const DEBUG_NAME: &'static str = "fuchsia.bluetooth.sys.Access";
110}
111impl fidl::endpoints::DiscoverableProtocolMarker for AccessMarker {}
112pub type AccessMakeDiscoverableResult = Result<(), Error>;
113pub type AccessSetConnectionPolicyResult = Result<(), Error>;
114pub type AccessStartDiscoveryResult = Result<(), Error>;
115pub type AccessConnectResult = Result<(), Error>;
116pub type AccessDisconnectResult = Result<(), Error>;
117pub type AccessPairResult = Result<(), Error>;
118pub type AccessForgetResult = Result<(), Error>;
119
120pub trait AccessProxyInterface: Send + Sync {
121 fn r#set_pairing_delegate(
122 &self,
123 input: InputCapability,
124 output: OutputCapability,
125 delegate: fidl::endpoints::ClientEnd<PairingDelegateMarker>,
126 ) -> Result<(), fidl::Error>;
127 fn r#set_local_name(&self, name: &str) -> Result<(), fidl::Error>;
128 fn r#set_device_class(
129 &self,
130 device_class: &fidl_fuchsia_bluetooth::DeviceClass,
131 ) -> Result<(), fidl::Error>;
132 type MakeDiscoverableResponseFut: std::future::Future<Output = Result<AccessMakeDiscoverableResult, fidl::Error>>
133 + Send;
134 fn r#make_discoverable(
135 &self,
136 token: fidl::endpoints::ServerEnd<ProcedureTokenMarker>,
137 ) -> Self::MakeDiscoverableResponseFut;
138 type SetConnectionPolicyResponseFut: std::future::Future<Output = Result<AccessSetConnectionPolicyResult, fidl::Error>>
139 + Send;
140 fn r#set_connection_policy(
141 &self,
142 payload: AccessSetConnectionPolicyRequest,
143 ) -> Self::SetConnectionPolicyResponseFut;
144 type StartDiscoveryResponseFut: std::future::Future<Output = Result<AccessStartDiscoveryResult, fidl::Error>>
145 + Send;
146 fn r#start_discovery(
147 &self,
148 token: fidl::endpoints::ServerEnd<ProcedureTokenMarker>,
149 ) -> Self::StartDiscoveryResponseFut;
150 type WatchPeersResponseFut: std::future::Future<
151 Output = Result<(Vec<Peer>, Vec<fidl_fuchsia_bluetooth::PeerId>), fidl::Error>,
152 > + Send;
153 fn r#watch_peers(&self) -> Self::WatchPeersResponseFut;
154 type ConnectResponseFut: std::future::Future<Output = Result<AccessConnectResult, fidl::Error>>
155 + Send;
156 fn r#connect(&self, id: &fidl_fuchsia_bluetooth::PeerId) -> Self::ConnectResponseFut;
157 type DisconnectResponseFut: std::future::Future<Output = Result<AccessDisconnectResult, fidl::Error>>
158 + Send;
159 fn r#disconnect(&self, id: &fidl_fuchsia_bluetooth::PeerId) -> Self::DisconnectResponseFut;
160 type PairResponseFut: std::future::Future<Output = Result<AccessPairResult, fidl::Error>> + Send;
161 fn r#pair(
162 &self,
163 id: &fidl_fuchsia_bluetooth::PeerId,
164 options: &PairingOptions,
165 ) -> Self::PairResponseFut;
166 type ForgetResponseFut: std::future::Future<Output = Result<AccessForgetResult, fidl::Error>>
167 + Send;
168 fn r#forget(&self, id: &fidl_fuchsia_bluetooth::PeerId) -> Self::ForgetResponseFut;
169}
170#[derive(Debug)]
171#[cfg(target_os = "fuchsia")]
172pub struct AccessSynchronousProxy {
173 client: fidl::client::sync::Client,
174}
175
176#[cfg(target_os = "fuchsia")]
177impl fidl::endpoints::SynchronousProxy for AccessSynchronousProxy {
178 type Proxy = AccessProxy;
179 type Protocol = AccessMarker;
180
181 fn from_channel(inner: fidl::Channel) -> Self {
182 Self::new(inner)
183 }
184
185 fn into_channel(self) -> fidl::Channel {
186 self.client.into_channel()
187 }
188
189 fn as_channel(&self) -> &fidl::Channel {
190 self.client.as_channel()
191 }
192}
193
194#[cfg(target_os = "fuchsia")]
195impl AccessSynchronousProxy {
196 pub fn new(channel: fidl::Channel) -> Self {
197 let protocol_name = <AccessMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
198 Self { client: fidl::client::sync::Client::new(channel, protocol_name) }
199 }
200
201 pub fn into_channel(self) -> fidl::Channel {
202 self.client.into_channel()
203 }
204
205 pub fn wait_for_event(
208 &self,
209 deadline: zx::MonotonicInstant,
210 ) -> Result<AccessEvent, fidl::Error> {
211 AccessEvent::decode(self.client.wait_for_event(deadline)?)
212 }
213
214 pub fn r#set_pairing_delegate(
227 &self,
228 mut input: InputCapability,
229 mut output: OutputCapability,
230 mut delegate: fidl::endpoints::ClientEnd<PairingDelegateMarker>,
231 ) -> Result<(), fidl::Error> {
232 self.client.send::<AccessSetPairingDelegateRequest>(
233 (input, output, delegate),
234 0x4af398e1f4cdb40b,
235 fidl::encoding::DynamicFlags::empty(),
236 )
237 }
238
239 pub fn r#set_local_name(&self, mut name: &str) -> Result<(), fidl::Error> {
244 self.client.send::<AccessSetLocalNameRequest>(
245 (name,),
246 0x7d12cd2d902206eb,
247 fidl::encoding::DynamicFlags::empty(),
248 )
249 }
250
251 pub fn r#set_device_class(
256 &self,
257 mut device_class: &fidl_fuchsia_bluetooth::DeviceClass,
258 ) -> Result<(), fidl::Error> {
259 self.client.send::<AccessSetDeviceClassRequest>(
260 (device_class,),
261 0x58dd8f65f589035d,
262 fidl::encoding::DynamicFlags::empty(),
263 )
264 }
265
266 pub fn r#make_discoverable(
274 &self,
275 mut token: fidl::endpoints::ServerEnd<ProcedureTokenMarker>,
276 ___deadline: zx::MonotonicInstant,
277 ) -> Result<AccessMakeDiscoverableResult, fidl::Error> {
278 let _response = self.client.send_query::<
279 AccessMakeDiscoverableRequest,
280 fidl::encoding::ResultType<fidl::encoding::EmptyStruct, Error>,
281 >(
282 (token,),
283 0x747cadf609c96fb1,
284 fidl::encoding::DynamicFlags::empty(),
285 ___deadline,
286 )?;
287 Ok(_response.map(|x| x))
288 }
289
290 pub fn r#set_connection_policy(
294 &self,
295 mut payload: AccessSetConnectionPolicyRequest,
296 ___deadline: zx::MonotonicInstant,
297 ) -> Result<AccessSetConnectionPolicyResult, fidl::Error> {
298 let _response = self.client.send_query::<
299 AccessSetConnectionPolicyRequest,
300 fidl::encoding::ResultType<fidl::encoding::EmptyStruct, Error>,
301 >(
302 &mut payload,
303 0x8e8c7354932fb5a,
304 fidl::encoding::DynamicFlags::empty(),
305 ___deadline,
306 )?;
307 Ok(_response.map(|x| x))
308 }
309
310 pub fn r#start_discovery(
319 &self,
320 mut token: fidl::endpoints::ServerEnd<ProcedureTokenMarker>,
321 ___deadline: zx::MonotonicInstant,
322 ) -> Result<AccessStartDiscoveryResult, fidl::Error> {
323 let _response = self.client.send_query::<
324 AccessStartDiscoveryRequest,
325 fidl::encoding::ResultType<fidl::encoding::EmptyStruct, Error>,
326 >(
327 (token,),
328 0x6907100d9b99439,
329 fidl::encoding::DynamicFlags::empty(),
330 ___deadline,
331 )?;
332 Ok(_response.map(|x| x))
333 }
334
335 pub fn r#watch_peers(
343 &self,
344 ___deadline: zx::MonotonicInstant,
345 ) -> Result<(Vec<Peer>, Vec<fidl_fuchsia_bluetooth::PeerId>), fidl::Error> {
346 let _response =
347 self.client.send_query::<fidl::encoding::EmptyPayload, AccessWatchPeersResponse>(
348 (),
349 0x1921fe1ed8e6eb7c,
350 fidl::encoding::DynamicFlags::empty(),
351 ___deadline,
352 )?;
353 Ok((_response.updated, _response.removed))
354 }
355
356 pub fn r#connect(
363 &self,
364 mut id: &fidl_fuchsia_bluetooth::PeerId,
365 ___deadline: zx::MonotonicInstant,
366 ) -> Result<AccessConnectResult, fidl::Error> {
367 let _response = self.client.send_query::<AccessConnectRequest, fidl::encoding::ResultType<
368 fidl::encoding::EmptyStruct,
369 Error,
370 >>(
371 (id,),
372 0x1734199789fe7667,
373 fidl::encoding::DynamicFlags::empty(),
374 ___deadline,
375 )?;
376 Ok(_response.map(|x| x))
377 }
378
379 pub fn r#disconnect(
386 &self,
387 mut id: &fidl_fuchsia_bluetooth::PeerId,
388 ___deadline: zx::MonotonicInstant,
389 ) -> Result<AccessDisconnectResult, fidl::Error> {
390 let _response = self.client.send_query::<
391 AccessDisconnectRequest,
392 fidl::encoding::ResultType<fidl::encoding::EmptyStruct, Error>,
393 >(
394 (id,),
395 0x3a4e06d0c6185a5,
396 fidl::encoding::DynamicFlags::empty(),
397 ___deadline,
398 )?;
399 Ok(_response.map(|x| x))
400 }
401
402 pub fn r#pair(
421 &self,
422 mut id: &fidl_fuchsia_bluetooth::PeerId,
423 mut options: &PairingOptions,
424 ___deadline: zx::MonotonicInstant,
425 ) -> Result<AccessPairResult, fidl::Error> {
426 let _response = self.client.send_query::<AccessPairRequest, fidl::encoding::ResultType<
427 fidl::encoding::EmptyStruct,
428 Error,
429 >>(
430 (id, options),
431 0x1d08ea19db327779,
432 fidl::encoding::DynamicFlags::empty(),
433 ___deadline,
434 )?;
435 Ok(_response.map(|x| x))
436 }
437
438 pub fn r#forget(
444 &self,
445 mut id: &fidl_fuchsia_bluetooth::PeerId,
446 ___deadline: zx::MonotonicInstant,
447 ) -> Result<AccessForgetResult, fidl::Error> {
448 let _response = self.client.send_query::<AccessForgetRequest, fidl::encoding::ResultType<
449 fidl::encoding::EmptyStruct,
450 Error,
451 >>(
452 (id,),
453 0x1fd8e27202854c0,
454 fidl::encoding::DynamicFlags::empty(),
455 ___deadline,
456 )?;
457 Ok(_response.map(|x| x))
458 }
459}
460
461#[cfg(target_os = "fuchsia")]
462impl From<AccessSynchronousProxy> for zx::Handle {
463 fn from(value: AccessSynchronousProxy) -> Self {
464 value.into_channel().into()
465 }
466}
467
468#[cfg(target_os = "fuchsia")]
469impl From<fidl::Channel> for AccessSynchronousProxy {
470 fn from(value: fidl::Channel) -> Self {
471 Self::new(value)
472 }
473}
474
475#[cfg(target_os = "fuchsia")]
476impl fidl::endpoints::FromClient for AccessSynchronousProxy {
477 type Protocol = AccessMarker;
478
479 fn from_client(value: fidl::endpoints::ClientEnd<AccessMarker>) -> Self {
480 Self::new(value.into_channel())
481 }
482}
483
484#[derive(Debug, Clone)]
485pub struct AccessProxy {
486 client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
487}
488
489impl fidl::endpoints::Proxy for AccessProxy {
490 type Protocol = AccessMarker;
491
492 fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
493 Self::new(inner)
494 }
495
496 fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
497 self.client.into_channel().map_err(|client| Self { client })
498 }
499
500 fn as_channel(&self) -> &::fidl::AsyncChannel {
501 self.client.as_channel()
502 }
503}
504
505impl AccessProxy {
506 pub fn new(channel: ::fidl::AsyncChannel) -> Self {
508 let protocol_name = <AccessMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
509 Self { client: fidl::client::Client::new(channel, protocol_name) }
510 }
511
512 pub fn take_event_stream(&self) -> AccessEventStream {
518 AccessEventStream { event_receiver: self.client.take_event_receiver() }
519 }
520
521 pub fn r#set_pairing_delegate(
534 &self,
535 mut input: InputCapability,
536 mut output: OutputCapability,
537 mut delegate: fidl::endpoints::ClientEnd<PairingDelegateMarker>,
538 ) -> Result<(), fidl::Error> {
539 AccessProxyInterface::r#set_pairing_delegate(self, input, output, delegate)
540 }
541
542 pub fn r#set_local_name(&self, mut name: &str) -> Result<(), fidl::Error> {
547 AccessProxyInterface::r#set_local_name(self, name)
548 }
549
550 pub fn r#set_device_class(
555 &self,
556 mut device_class: &fidl_fuchsia_bluetooth::DeviceClass,
557 ) -> Result<(), fidl::Error> {
558 AccessProxyInterface::r#set_device_class(self, device_class)
559 }
560
561 pub fn r#make_discoverable(
569 &self,
570 mut token: fidl::endpoints::ServerEnd<ProcedureTokenMarker>,
571 ) -> fidl::client::QueryResponseFut<
572 AccessMakeDiscoverableResult,
573 fidl::encoding::DefaultFuchsiaResourceDialect,
574 > {
575 AccessProxyInterface::r#make_discoverable(self, token)
576 }
577
578 pub fn r#set_connection_policy(
582 &self,
583 mut payload: AccessSetConnectionPolicyRequest,
584 ) -> fidl::client::QueryResponseFut<
585 AccessSetConnectionPolicyResult,
586 fidl::encoding::DefaultFuchsiaResourceDialect,
587 > {
588 AccessProxyInterface::r#set_connection_policy(self, payload)
589 }
590
591 pub fn r#start_discovery(
600 &self,
601 mut token: fidl::endpoints::ServerEnd<ProcedureTokenMarker>,
602 ) -> fidl::client::QueryResponseFut<
603 AccessStartDiscoveryResult,
604 fidl::encoding::DefaultFuchsiaResourceDialect,
605 > {
606 AccessProxyInterface::r#start_discovery(self, token)
607 }
608
609 pub fn r#watch_peers(
617 &self,
618 ) -> fidl::client::QueryResponseFut<
619 (Vec<Peer>, Vec<fidl_fuchsia_bluetooth::PeerId>),
620 fidl::encoding::DefaultFuchsiaResourceDialect,
621 > {
622 AccessProxyInterface::r#watch_peers(self)
623 }
624
625 pub fn r#connect(
632 &self,
633 mut id: &fidl_fuchsia_bluetooth::PeerId,
634 ) -> fidl::client::QueryResponseFut<
635 AccessConnectResult,
636 fidl::encoding::DefaultFuchsiaResourceDialect,
637 > {
638 AccessProxyInterface::r#connect(self, id)
639 }
640
641 pub fn r#disconnect(
648 &self,
649 mut id: &fidl_fuchsia_bluetooth::PeerId,
650 ) -> fidl::client::QueryResponseFut<
651 AccessDisconnectResult,
652 fidl::encoding::DefaultFuchsiaResourceDialect,
653 > {
654 AccessProxyInterface::r#disconnect(self, id)
655 }
656
657 pub fn r#pair(
676 &self,
677 mut id: &fidl_fuchsia_bluetooth::PeerId,
678 mut options: &PairingOptions,
679 ) -> fidl::client::QueryResponseFut<
680 AccessPairResult,
681 fidl::encoding::DefaultFuchsiaResourceDialect,
682 > {
683 AccessProxyInterface::r#pair(self, id, options)
684 }
685
686 pub fn r#forget(
692 &self,
693 mut id: &fidl_fuchsia_bluetooth::PeerId,
694 ) -> fidl::client::QueryResponseFut<
695 AccessForgetResult,
696 fidl::encoding::DefaultFuchsiaResourceDialect,
697 > {
698 AccessProxyInterface::r#forget(self, id)
699 }
700}
701
702impl AccessProxyInterface for AccessProxy {
703 fn r#set_pairing_delegate(
704 &self,
705 mut input: InputCapability,
706 mut output: OutputCapability,
707 mut delegate: fidl::endpoints::ClientEnd<PairingDelegateMarker>,
708 ) -> Result<(), fidl::Error> {
709 self.client.send::<AccessSetPairingDelegateRequest>(
710 (input, output, delegate),
711 0x4af398e1f4cdb40b,
712 fidl::encoding::DynamicFlags::empty(),
713 )
714 }
715
716 fn r#set_local_name(&self, mut name: &str) -> Result<(), fidl::Error> {
717 self.client.send::<AccessSetLocalNameRequest>(
718 (name,),
719 0x7d12cd2d902206eb,
720 fidl::encoding::DynamicFlags::empty(),
721 )
722 }
723
724 fn r#set_device_class(
725 &self,
726 mut device_class: &fidl_fuchsia_bluetooth::DeviceClass,
727 ) -> Result<(), fidl::Error> {
728 self.client.send::<AccessSetDeviceClassRequest>(
729 (device_class,),
730 0x58dd8f65f589035d,
731 fidl::encoding::DynamicFlags::empty(),
732 )
733 }
734
735 type MakeDiscoverableResponseFut = fidl::client::QueryResponseFut<
736 AccessMakeDiscoverableResult,
737 fidl::encoding::DefaultFuchsiaResourceDialect,
738 >;
739 fn r#make_discoverable(
740 &self,
741 mut token: fidl::endpoints::ServerEnd<ProcedureTokenMarker>,
742 ) -> Self::MakeDiscoverableResponseFut {
743 fn _decode(
744 mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
745 ) -> Result<AccessMakeDiscoverableResult, fidl::Error> {
746 let _response = fidl::client::decode_transaction_body::<
747 fidl::encoding::ResultType<fidl::encoding::EmptyStruct, Error>,
748 fidl::encoding::DefaultFuchsiaResourceDialect,
749 0x747cadf609c96fb1,
750 >(_buf?)?;
751 Ok(_response.map(|x| x))
752 }
753 self.client
754 .send_query_and_decode::<AccessMakeDiscoverableRequest, AccessMakeDiscoverableResult>(
755 (token,),
756 0x747cadf609c96fb1,
757 fidl::encoding::DynamicFlags::empty(),
758 _decode,
759 )
760 }
761
762 type SetConnectionPolicyResponseFut = fidl::client::QueryResponseFut<
763 AccessSetConnectionPolicyResult,
764 fidl::encoding::DefaultFuchsiaResourceDialect,
765 >;
766 fn r#set_connection_policy(
767 &self,
768 mut payload: AccessSetConnectionPolicyRequest,
769 ) -> Self::SetConnectionPolicyResponseFut {
770 fn _decode(
771 mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
772 ) -> Result<AccessSetConnectionPolicyResult, fidl::Error> {
773 let _response = fidl::client::decode_transaction_body::<
774 fidl::encoding::ResultType<fidl::encoding::EmptyStruct, Error>,
775 fidl::encoding::DefaultFuchsiaResourceDialect,
776 0x8e8c7354932fb5a,
777 >(_buf?)?;
778 Ok(_response.map(|x| x))
779 }
780 self.client.send_query_and_decode::<
781 AccessSetConnectionPolicyRequest,
782 AccessSetConnectionPolicyResult,
783 >(
784 &mut payload,
785 0x8e8c7354932fb5a,
786 fidl::encoding::DynamicFlags::empty(),
787 _decode,
788 )
789 }
790
791 type StartDiscoveryResponseFut = fidl::client::QueryResponseFut<
792 AccessStartDiscoveryResult,
793 fidl::encoding::DefaultFuchsiaResourceDialect,
794 >;
795 fn r#start_discovery(
796 &self,
797 mut token: fidl::endpoints::ServerEnd<ProcedureTokenMarker>,
798 ) -> Self::StartDiscoveryResponseFut {
799 fn _decode(
800 mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
801 ) -> Result<AccessStartDiscoveryResult, fidl::Error> {
802 let _response = fidl::client::decode_transaction_body::<
803 fidl::encoding::ResultType<fidl::encoding::EmptyStruct, Error>,
804 fidl::encoding::DefaultFuchsiaResourceDialect,
805 0x6907100d9b99439,
806 >(_buf?)?;
807 Ok(_response.map(|x| x))
808 }
809 self.client
810 .send_query_and_decode::<AccessStartDiscoveryRequest, AccessStartDiscoveryResult>(
811 (token,),
812 0x6907100d9b99439,
813 fidl::encoding::DynamicFlags::empty(),
814 _decode,
815 )
816 }
817
818 type WatchPeersResponseFut = fidl::client::QueryResponseFut<
819 (Vec<Peer>, Vec<fidl_fuchsia_bluetooth::PeerId>),
820 fidl::encoding::DefaultFuchsiaResourceDialect,
821 >;
822 fn r#watch_peers(&self) -> Self::WatchPeersResponseFut {
823 fn _decode(
824 mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
825 ) -> Result<(Vec<Peer>, Vec<fidl_fuchsia_bluetooth::PeerId>), fidl::Error> {
826 let _response = fidl::client::decode_transaction_body::<
827 AccessWatchPeersResponse,
828 fidl::encoding::DefaultFuchsiaResourceDialect,
829 0x1921fe1ed8e6eb7c,
830 >(_buf?)?;
831 Ok((_response.updated, _response.removed))
832 }
833 self.client.send_query_and_decode::<
834 fidl::encoding::EmptyPayload,
835 (Vec<Peer>, Vec<fidl_fuchsia_bluetooth::PeerId>),
836 >(
837 (),
838 0x1921fe1ed8e6eb7c,
839 fidl::encoding::DynamicFlags::empty(),
840 _decode,
841 )
842 }
843
844 type ConnectResponseFut = fidl::client::QueryResponseFut<
845 AccessConnectResult,
846 fidl::encoding::DefaultFuchsiaResourceDialect,
847 >;
848 fn r#connect(&self, mut id: &fidl_fuchsia_bluetooth::PeerId) -> Self::ConnectResponseFut {
849 fn _decode(
850 mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
851 ) -> Result<AccessConnectResult, fidl::Error> {
852 let _response = fidl::client::decode_transaction_body::<
853 fidl::encoding::ResultType<fidl::encoding::EmptyStruct, Error>,
854 fidl::encoding::DefaultFuchsiaResourceDialect,
855 0x1734199789fe7667,
856 >(_buf?)?;
857 Ok(_response.map(|x| x))
858 }
859 self.client.send_query_and_decode::<AccessConnectRequest, AccessConnectResult>(
860 (id,),
861 0x1734199789fe7667,
862 fidl::encoding::DynamicFlags::empty(),
863 _decode,
864 )
865 }
866
867 type DisconnectResponseFut = fidl::client::QueryResponseFut<
868 AccessDisconnectResult,
869 fidl::encoding::DefaultFuchsiaResourceDialect,
870 >;
871 fn r#disconnect(&self, mut id: &fidl_fuchsia_bluetooth::PeerId) -> Self::DisconnectResponseFut {
872 fn _decode(
873 mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
874 ) -> Result<AccessDisconnectResult, fidl::Error> {
875 let _response = fidl::client::decode_transaction_body::<
876 fidl::encoding::ResultType<fidl::encoding::EmptyStruct, Error>,
877 fidl::encoding::DefaultFuchsiaResourceDialect,
878 0x3a4e06d0c6185a5,
879 >(_buf?)?;
880 Ok(_response.map(|x| x))
881 }
882 self.client.send_query_and_decode::<AccessDisconnectRequest, AccessDisconnectResult>(
883 (id,),
884 0x3a4e06d0c6185a5,
885 fidl::encoding::DynamicFlags::empty(),
886 _decode,
887 )
888 }
889
890 type PairResponseFut = fidl::client::QueryResponseFut<
891 AccessPairResult,
892 fidl::encoding::DefaultFuchsiaResourceDialect,
893 >;
894 fn r#pair(
895 &self,
896 mut id: &fidl_fuchsia_bluetooth::PeerId,
897 mut options: &PairingOptions,
898 ) -> Self::PairResponseFut {
899 fn _decode(
900 mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
901 ) -> Result<AccessPairResult, fidl::Error> {
902 let _response = fidl::client::decode_transaction_body::<
903 fidl::encoding::ResultType<fidl::encoding::EmptyStruct, Error>,
904 fidl::encoding::DefaultFuchsiaResourceDialect,
905 0x1d08ea19db327779,
906 >(_buf?)?;
907 Ok(_response.map(|x| x))
908 }
909 self.client.send_query_and_decode::<AccessPairRequest, AccessPairResult>(
910 (id, options),
911 0x1d08ea19db327779,
912 fidl::encoding::DynamicFlags::empty(),
913 _decode,
914 )
915 }
916
917 type ForgetResponseFut = fidl::client::QueryResponseFut<
918 AccessForgetResult,
919 fidl::encoding::DefaultFuchsiaResourceDialect,
920 >;
921 fn r#forget(&self, mut id: &fidl_fuchsia_bluetooth::PeerId) -> Self::ForgetResponseFut {
922 fn _decode(
923 mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
924 ) -> Result<AccessForgetResult, fidl::Error> {
925 let _response = fidl::client::decode_transaction_body::<
926 fidl::encoding::ResultType<fidl::encoding::EmptyStruct, Error>,
927 fidl::encoding::DefaultFuchsiaResourceDialect,
928 0x1fd8e27202854c0,
929 >(_buf?)?;
930 Ok(_response.map(|x| x))
931 }
932 self.client.send_query_and_decode::<AccessForgetRequest, AccessForgetResult>(
933 (id,),
934 0x1fd8e27202854c0,
935 fidl::encoding::DynamicFlags::empty(),
936 _decode,
937 )
938 }
939}
940
941pub struct AccessEventStream {
942 event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
943}
944
945impl std::marker::Unpin for AccessEventStream {}
946
947impl futures::stream::FusedStream for AccessEventStream {
948 fn is_terminated(&self) -> bool {
949 self.event_receiver.is_terminated()
950 }
951}
952
953impl futures::Stream for AccessEventStream {
954 type Item = Result<AccessEvent, fidl::Error>;
955
956 fn poll_next(
957 mut self: std::pin::Pin<&mut Self>,
958 cx: &mut std::task::Context<'_>,
959 ) -> std::task::Poll<Option<Self::Item>> {
960 match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
961 &mut self.event_receiver,
962 cx
963 )?) {
964 Some(buf) => std::task::Poll::Ready(Some(AccessEvent::decode(buf))),
965 None => std::task::Poll::Ready(None),
966 }
967 }
968}
969
970#[derive(Debug)]
971pub enum AccessEvent {}
972
973impl AccessEvent {
974 fn decode(
976 mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
977 ) -> Result<AccessEvent, fidl::Error> {
978 let (bytes, _handles) = buf.split_mut();
979 let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
980 debug_assert_eq!(tx_header.tx_id, 0);
981 match tx_header.ordinal {
982 _ => Err(fidl::Error::UnknownOrdinal {
983 ordinal: tx_header.ordinal,
984 protocol_name: <AccessMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
985 }),
986 }
987 }
988}
989
990pub struct AccessRequestStream {
992 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
993 is_terminated: bool,
994}
995
996impl std::marker::Unpin for AccessRequestStream {}
997
998impl futures::stream::FusedStream for AccessRequestStream {
999 fn is_terminated(&self) -> bool {
1000 self.is_terminated
1001 }
1002}
1003
1004impl fidl::endpoints::RequestStream for AccessRequestStream {
1005 type Protocol = AccessMarker;
1006 type ControlHandle = AccessControlHandle;
1007
1008 fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
1009 Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
1010 }
1011
1012 fn control_handle(&self) -> Self::ControlHandle {
1013 AccessControlHandle { inner: self.inner.clone() }
1014 }
1015
1016 fn into_inner(
1017 self,
1018 ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
1019 {
1020 (self.inner, self.is_terminated)
1021 }
1022
1023 fn from_inner(
1024 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
1025 is_terminated: bool,
1026 ) -> Self {
1027 Self { inner, is_terminated }
1028 }
1029}
1030
1031impl futures::Stream for AccessRequestStream {
1032 type Item = Result<AccessRequest, fidl::Error>;
1033
1034 fn poll_next(
1035 mut self: std::pin::Pin<&mut Self>,
1036 cx: &mut std::task::Context<'_>,
1037 ) -> std::task::Poll<Option<Self::Item>> {
1038 let this = &mut *self;
1039 if this.inner.check_shutdown(cx) {
1040 this.is_terminated = true;
1041 return std::task::Poll::Ready(None);
1042 }
1043 if this.is_terminated {
1044 panic!("polled AccessRequestStream after completion");
1045 }
1046 fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
1047 |bytes, handles| {
1048 match this.inner.channel().read_etc(cx, bytes, handles) {
1049 std::task::Poll::Ready(Ok(())) => {}
1050 std::task::Poll::Pending => return std::task::Poll::Pending,
1051 std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
1052 this.is_terminated = true;
1053 return std::task::Poll::Ready(None);
1054 }
1055 std::task::Poll::Ready(Err(e)) => {
1056 return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
1057 e.into(),
1058 ))))
1059 }
1060 }
1061
1062 let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
1064
1065 std::task::Poll::Ready(Some(match header.ordinal {
1066 0x4af398e1f4cdb40b => {
1067 header.validate_request_tx_id(fidl::MethodType::OneWay)?;
1068 let mut req = fidl::new_empty!(
1069 AccessSetPairingDelegateRequest,
1070 fidl::encoding::DefaultFuchsiaResourceDialect
1071 );
1072 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<AccessSetPairingDelegateRequest>(&header, _body_bytes, handles, &mut req)?;
1073 let control_handle = AccessControlHandle { inner: this.inner.clone() };
1074 Ok(AccessRequest::SetPairingDelegate {
1075 input: req.input,
1076 output: req.output,
1077 delegate: req.delegate,
1078
1079 control_handle,
1080 })
1081 }
1082 0x7d12cd2d902206eb => {
1083 header.validate_request_tx_id(fidl::MethodType::OneWay)?;
1084 let mut req = fidl::new_empty!(
1085 AccessSetLocalNameRequest,
1086 fidl::encoding::DefaultFuchsiaResourceDialect
1087 );
1088 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<AccessSetLocalNameRequest>(&header, _body_bytes, handles, &mut req)?;
1089 let control_handle = AccessControlHandle { inner: this.inner.clone() };
1090 Ok(AccessRequest::SetLocalName { name: req.name, control_handle })
1091 }
1092 0x58dd8f65f589035d => {
1093 header.validate_request_tx_id(fidl::MethodType::OneWay)?;
1094 let mut req = fidl::new_empty!(
1095 AccessSetDeviceClassRequest,
1096 fidl::encoding::DefaultFuchsiaResourceDialect
1097 );
1098 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<AccessSetDeviceClassRequest>(&header, _body_bytes, handles, &mut req)?;
1099 let control_handle = AccessControlHandle { inner: this.inner.clone() };
1100 Ok(AccessRequest::SetDeviceClass {
1101 device_class: req.device_class,
1102
1103 control_handle,
1104 })
1105 }
1106 0x747cadf609c96fb1 => {
1107 header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
1108 let mut req = fidl::new_empty!(
1109 AccessMakeDiscoverableRequest,
1110 fidl::encoding::DefaultFuchsiaResourceDialect
1111 );
1112 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<AccessMakeDiscoverableRequest>(&header, _body_bytes, handles, &mut req)?;
1113 let control_handle = AccessControlHandle { inner: this.inner.clone() };
1114 Ok(AccessRequest::MakeDiscoverable {
1115 token: req.token,
1116
1117 responder: AccessMakeDiscoverableResponder {
1118 control_handle: std::mem::ManuallyDrop::new(control_handle),
1119 tx_id: header.tx_id,
1120 },
1121 })
1122 }
1123 0x8e8c7354932fb5a => {
1124 header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
1125 let mut req = fidl::new_empty!(
1126 AccessSetConnectionPolicyRequest,
1127 fidl::encoding::DefaultFuchsiaResourceDialect
1128 );
1129 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<AccessSetConnectionPolicyRequest>(&header, _body_bytes, handles, &mut req)?;
1130 let control_handle = AccessControlHandle { inner: this.inner.clone() };
1131 Ok(AccessRequest::SetConnectionPolicy {
1132 payload: req,
1133 responder: AccessSetConnectionPolicyResponder {
1134 control_handle: std::mem::ManuallyDrop::new(control_handle),
1135 tx_id: header.tx_id,
1136 },
1137 })
1138 }
1139 0x6907100d9b99439 => {
1140 header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
1141 let mut req = fidl::new_empty!(
1142 AccessStartDiscoveryRequest,
1143 fidl::encoding::DefaultFuchsiaResourceDialect
1144 );
1145 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<AccessStartDiscoveryRequest>(&header, _body_bytes, handles, &mut req)?;
1146 let control_handle = AccessControlHandle { inner: this.inner.clone() };
1147 Ok(AccessRequest::StartDiscovery {
1148 token: req.token,
1149
1150 responder: AccessStartDiscoveryResponder {
1151 control_handle: std::mem::ManuallyDrop::new(control_handle),
1152 tx_id: header.tx_id,
1153 },
1154 })
1155 }
1156 0x1921fe1ed8e6eb7c => {
1157 header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
1158 let mut req = fidl::new_empty!(
1159 fidl::encoding::EmptyPayload,
1160 fidl::encoding::DefaultFuchsiaResourceDialect
1161 );
1162 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
1163 let control_handle = AccessControlHandle { inner: this.inner.clone() };
1164 Ok(AccessRequest::WatchPeers {
1165 responder: AccessWatchPeersResponder {
1166 control_handle: std::mem::ManuallyDrop::new(control_handle),
1167 tx_id: header.tx_id,
1168 },
1169 })
1170 }
1171 0x1734199789fe7667 => {
1172 header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
1173 let mut req = fidl::new_empty!(
1174 AccessConnectRequest,
1175 fidl::encoding::DefaultFuchsiaResourceDialect
1176 );
1177 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<AccessConnectRequest>(&header, _body_bytes, handles, &mut req)?;
1178 let control_handle = AccessControlHandle { inner: this.inner.clone() };
1179 Ok(AccessRequest::Connect {
1180 id: req.id,
1181
1182 responder: AccessConnectResponder {
1183 control_handle: std::mem::ManuallyDrop::new(control_handle),
1184 tx_id: header.tx_id,
1185 },
1186 })
1187 }
1188 0x3a4e06d0c6185a5 => {
1189 header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
1190 let mut req = fidl::new_empty!(
1191 AccessDisconnectRequest,
1192 fidl::encoding::DefaultFuchsiaResourceDialect
1193 );
1194 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<AccessDisconnectRequest>(&header, _body_bytes, handles, &mut req)?;
1195 let control_handle = AccessControlHandle { inner: this.inner.clone() };
1196 Ok(AccessRequest::Disconnect {
1197 id: req.id,
1198
1199 responder: AccessDisconnectResponder {
1200 control_handle: std::mem::ManuallyDrop::new(control_handle),
1201 tx_id: header.tx_id,
1202 },
1203 })
1204 }
1205 0x1d08ea19db327779 => {
1206 header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
1207 let mut req = fidl::new_empty!(
1208 AccessPairRequest,
1209 fidl::encoding::DefaultFuchsiaResourceDialect
1210 );
1211 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<AccessPairRequest>(&header, _body_bytes, handles, &mut req)?;
1212 let control_handle = AccessControlHandle { inner: this.inner.clone() };
1213 Ok(AccessRequest::Pair {
1214 id: req.id,
1215 options: req.options,
1216
1217 responder: AccessPairResponder {
1218 control_handle: std::mem::ManuallyDrop::new(control_handle),
1219 tx_id: header.tx_id,
1220 },
1221 })
1222 }
1223 0x1fd8e27202854c0 => {
1224 header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
1225 let mut req = fidl::new_empty!(
1226 AccessForgetRequest,
1227 fidl::encoding::DefaultFuchsiaResourceDialect
1228 );
1229 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<AccessForgetRequest>(&header, _body_bytes, handles, &mut req)?;
1230 let control_handle = AccessControlHandle { inner: this.inner.clone() };
1231 Ok(AccessRequest::Forget {
1232 id: req.id,
1233
1234 responder: AccessForgetResponder {
1235 control_handle: std::mem::ManuallyDrop::new(control_handle),
1236 tx_id: header.tx_id,
1237 },
1238 })
1239 }
1240 _ => Err(fidl::Error::UnknownOrdinal {
1241 ordinal: header.ordinal,
1242 protocol_name:
1243 <AccessMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
1244 }),
1245 }))
1246 },
1247 )
1248 }
1249}
1250
1251#[derive(Debug)]
1260pub enum AccessRequest {
1261 SetPairingDelegate {
1274 input: InputCapability,
1275 output: OutputCapability,
1276 delegate: fidl::endpoints::ClientEnd<PairingDelegateMarker>,
1277 control_handle: AccessControlHandle,
1278 },
1279 SetLocalName { name: String, control_handle: AccessControlHandle },
1284 SetDeviceClass {
1289 device_class: fidl_fuchsia_bluetooth::DeviceClass,
1290 control_handle: AccessControlHandle,
1291 },
1292 MakeDiscoverable {
1300 token: fidl::endpoints::ServerEnd<ProcedureTokenMarker>,
1301 responder: AccessMakeDiscoverableResponder,
1302 },
1303 SetConnectionPolicy {
1307 payload: AccessSetConnectionPolicyRequest,
1308 responder: AccessSetConnectionPolicyResponder,
1309 },
1310 StartDiscovery {
1319 token: fidl::endpoints::ServerEnd<ProcedureTokenMarker>,
1320 responder: AccessStartDiscoveryResponder,
1321 },
1322 WatchPeers { responder: AccessWatchPeersResponder },
1330 Connect { id: fidl_fuchsia_bluetooth::PeerId, responder: AccessConnectResponder },
1337 Disconnect { id: fidl_fuchsia_bluetooth::PeerId, responder: AccessDisconnectResponder },
1344 Pair {
1363 id: fidl_fuchsia_bluetooth::PeerId,
1364 options: PairingOptions,
1365 responder: AccessPairResponder,
1366 },
1367 Forget { id: fidl_fuchsia_bluetooth::PeerId, responder: AccessForgetResponder },
1373}
1374
1375impl AccessRequest {
1376 #[allow(irrefutable_let_patterns)]
1377 pub fn into_set_pairing_delegate(
1378 self,
1379 ) -> Option<(
1380 InputCapability,
1381 OutputCapability,
1382 fidl::endpoints::ClientEnd<PairingDelegateMarker>,
1383 AccessControlHandle,
1384 )> {
1385 if let AccessRequest::SetPairingDelegate { input, output, delegate, control_handle } = self
1386 {
1387 Some((input, output, delegate, control_handle))
1388 } else {
1389 None
1390 }
1391 }
1392
1393 #[allow(irrefutable_let_patterns)]
1394 pub fn into_set_local_name(self) -> Option<(String, AccessControlHandle)> {
1395 if let AccessRequest::SetLocalName { name, control_handle } = self {
1396 Some((name, control_handle))
1397 } else {
1398 None
1399 }
1400 }
1401
1402 #[allow(irrefutable_let_patterns)]
1403 pub fn into_set_device_class(
1404 self,
1405 ) -> Option<(fidl_fuchsia_bluetooth::DeviceClass, AccessControlHandle)> {
1406 if let AccessRequest::SetDeviceClass { device_class, control_handle } = self {
1407 Some((device_class, control_handle))
1408 } else {
1409 None
1410 }
1411 }
1412
1413 #[allow(irrefutable_let_patterns)]
1414 pub fn into_make_discoverable(
1415 self,
1416 ) -> Option<(fidl::endpoints::ServerEnd<ProcedureTokenMarker>, AccessMakeDiscoverableResponder)>
1417 {
1418 if let AccessRequest::MakeDiscoverable { token, responder } = self {
1419 Some((token, responder))
1420 } else {
1421 None
1422 }
1423 }
1424
1425 #[allow(irrefutable_let_patterns)]
1426 pub fn into_set_connection_policy(
1427 self,
1428 ) -> Option<(AccessSetConnectionPolicyRequest, AccessSetConnectionPolicyResponder)> {
1429 if let AccessRequest::SetConnectionPolicy { payload, responder } = self {
1430 Some((payload, responder))
1431 } else {
1432 None
1433 }
1434 }
1435
1436 #[allow(irrefutable_let_patterns)]
1437 pub fn into_start_discovery(
1438 self,
1439 ) -> Option<(fidl::endpoints::ServerEnd<ProcedureTokenMarker>, AccessStartDiscoveryResponder)>
1440 {
1441 if let AccessRequest::StartDiscovery { token, responder } = self {
1442 Some((token, responder))
1443 } else {
1444 None
1445 }
1446 }
1447
1448 #[allow(irrefutable_let_patterns)]
1449 pub fn into_watch_peers(self) -> Option<(AccessWatchPeersResponder)> {
1450 if let AccessRequest::WatchPeers { responder } = self {
1451 Some((responder))
1452 } else {
1453 None
1454 }
1455 }
1456
1457 #[allow(irrefutable_let_patterns)]
1458 pub fn into_connect(self) -> Option<(fidl_fuchsia_bluetooth::PeerId, AccessConnectResponder)> {
1459 if let AccessRequest::Connect { id, responder } = self {
1460 Some((id, responder))
1461 } else {
1462 None
1463 }
1464 }
1465
1466 #[allow(irrefutable_let_patterns)]
1467 pub fn into_disconnect(
1468 self,
1469 ) -> Option<(fidl_fuchsia_bluetooth::PeerId, AccessDisconnectResponder)> {
1470 if let AccessRequest::Disconnect { id, responder } = self {
1471 Some((id, responder))
1472 } else {
1473 None
1474 }
1475 }
1476
1477 #[allow(irrefutable_let_patterns)]
1478 pub fn into_pair(
1479 self,
1480 ) -> Option<(fidl_fuchsia_bluetooth::PeerId, PairingOptions, AccessPairResponder)> {
1481 if let AccessRequest::Pair { id, options, responder } = self {
1482 Some((id, options, responder))
1483 } else {
1484 None
1485 }
1486 }
1487
1488 #[allow(irrefutable_let_patterns)]
1489 pub fn into_forget(self) -> Option<(fidl_fuchsia_bluetooth::PeerId, AccessForgetResponder)> {
1490 if let AccessRequest::Forget { id, responder } = self {
1491 Some((id, responder))
1492 } else {
1493 None
1494 }
1495 }
1496
1497 pub fn method_name(&self) -> &'static str {
1499 match *self {
1500 AccessRequest::SetPairingDelegate { .. } => "set_pairing_delegate",
1501 AccessRequest::SetLocalName { .. } => "set_local_name",
1502 AccessRequest::SetDeviceClass { .. } => "set_device_class",
1503 AccessRequest::MakeDiscoverable { .. } => "make_discoverable",
1504 AccessRequest::SetConnectionPolicy { .. } => "set_connection_policy",
1505 AccessRequest::StartDiscovery { .. } => "start_discovery",
1506 AccessRequest::WatchPeers { .. } => "watch_peers",
1507 AccessRequest::Connect { .. } => "connect",
1508 AccessRequest::Disconnect { .. } => "disconnect",
1509 AccessRequest::Pair { .. } => "pair",
1510 AccessRequest::Forget { .. } => "forget",
1511 }
1512 }
1513}
1514
1515#[derive(Debug, Clone)]
1516pub struct AccessControlHandle {
1517 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
1518}
1519
1520impl fidl::endpoints::ControlHandle for AccessControlHandle {
1521 fn shutdown(&self) {
1522 self.inner.shutdown()
1523 }
1524 fn shutdown_with_epitaph(&self, status: zx_status::Status) {
1525 self.inner.shutdown_with_epitaph(status)
1526 }
1527
1528 fn is_closed(&self) -> bool {
1529 self.inner.channel().is_closed()
1530 }
1531 fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
1532 self.inner.channel().on_closed()
1533 }
1534
1535 #[cfg(target_os = "fuchsia")]
1536 fn signal_peer(
1537 &self,
1538 clear_mask: zx::Signals,
1539 set_mask: zx::Signals,
1540 ) -> Result<(), zx_status::Status> {
1541 use fidl::Peered;
1542 self.inner.channel().signal_peer(clear_mask, set_mask)
1543 }
1544}
1545
1546impl AccessControlHandle {}
1547
1548#[must_use = "FIDL methods require a response to be sent"]
1549#[derive(Debug)]
1550pub struct AccessMakeDiscoverableResponder {
1551 control_handle: std::mem::ManuallyDrop<AccessControlHandle>,
1552 tx_id: u32,
1553}
1554
1555impl std::ops::Drop for AccessMakeDiscoverableResponder {
1559 fn drop(&mut self) {
1560 self.control_handle.shutdown();
1561 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1563 }
1564}
1565
1566impl fidl::endpoints::Responder for AccessMakeDiscoverableResponder {
1567 type ControlHandle = AccessControlHandle;
1568
1569 fn control_handle(&self) -> &AccessControlHandle {
1570 &self.control_handle
1571 }
1572
1573 fn drop_without_shutdown(mut self) {
1574 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1576 std::mem::forget(self);
1578 }
1579}
1580
1581impl AccessMakeDiscoverableResponder {
1582 pub fn send(self, mut result: Result<(), Error>) -> Result<(), fidl::Error> {
1586 let _result = self.send_raw(result);
1587 if _result.is_err() {
1588 self.control_handle.shutdown();
1589 }
1590 self.drop_without_shutdown();
1591 _result
1592 }
1593
1594 pub fn send_no_shutdown_on_err(self, mut result: Result<(), Error>) -> Result<(), fidl::Error> {
1596 let _result = self.send_raw(result);
1597 self.drop_without_shutdown();
1598 _result
1599 }
1600
1601 fn send_raw(&self, mut result: Result<(), Error>) -> Result<(), fidl::Error> {
1602 self.control_handle
1603 .inner
1604 .send::<fidl::encoding::ResultType<fidl::encoding::EmptyStruct, Error>>(
1605 result,
1606 self.tx_id,
1607 0x747cadf609c96fb1,
1608 fidl::encoding::DynamicFlags::empty(),
1609 )
1610 }
1611}
1612
1613#[must_use = "FIDL methods require a response to be sent"]
1614#[derive(Debug)]
1615pub struct AccessSetConnectionPolicyResponder {
1616 control_handle: std::mem::ManuallyDrop<AccessControlHandle>,
1617 tx_id: u32,
1618}
1619
1620impl std::ops::Drop for AccessSetConnectionPolicyResponder {
1624 fn drop(&mut self) {
1625 self.control_handle.shutdown();
1626 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1628 }
1629}
1630
1631impl fidl::endpoints::Responder for AccessSetConnectionPolicyResponder {
1632 type ControlHandle = AccessControlHandle;
1633
1634 fn control_handle(&self) -> &AccessControlHandle {
1635 &self.control_handle
1636 }
1637
1638 fn drop_without_shutdown(mut self) {
1639 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1641 std::mem::forget(self);
1643 }
1644}
1645
1646impl AccessSetConnectionPolicyResponder {
1647 pub fn send(self, mut result: Result<(), Error>) -> Result<(), fidl::Error> {
1651 let _result = self.send_raw(result);
1652 if _result.is_err() {
1653 self.control_handle.shutdown();
1654 }
1655 self.drop_without_shutdown();
1656 _result
1657 }
1658
1659 pub fn send_no_shutdown_on_err(self, mut result: Result<(), Error>) -> Result<(), fidl::Error> {
1661 let _result = self.send_raw(result);
1662 self.drop_without_shutdown();
1663 _result
1664 }
1665
1666 fn send_raw(&self, mut result: Result<(), Error>) -> Result<(), fidl::Error> {
1667 self.control_handle
1668 .inner
1669 .send::<fidl::encoding::ResultType<fidl::encoding::EmptyStruct, Error>>(
1670 result,
1671 self.tx_id,
1672 0x8e8c7354932fb5a,
1673 fidl::encoding::DynamicFlags::empty(),
1674 )
1675 }
1676}
1677
1678#[must_use = "FIDL methods require a response to be sent"]
1679#[derive(Debug)]
1680pub struct AccessStartDiscoveryResponder {
1681 control_handle: std::mem::ManuallyDrop<AccessControlHandle>,
1682 tx_id: u32,
1683}
1684
1685impl std::ops::Drop for AccessStartDiscoveryResponder {
1689 fn drop(&mut self) {
1690 self.control_handle.shutdown();
1691 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1693 }
1694}
1695
1696impl fidl::endpoints::Responder for AccessStartDiscoveryResponder {
1697 type ControlHandle = AccessControlHandle;
1698
1699 fn control_handle(&self) -> &AccessControlHandle {
1700 &self.control_handle
1701 }
1702
1703 fn drop_without_shutdown(mut self) {
1704 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1706 std::mem::forget(self);
1708 }
1709}
1710
1711impl AccessStartDiscoveryResponder {
1712 pub fn send(self, mut result: Result<(), Error>) -> Result<(), fidl::Error> {
1716 let _result = self.send_raw(result);
1717 if _result.is_err() {
1718 self.control_handle.shutdown();
1719 }
1720 self.drop_without_shutdown();
1721 _result
1722 }
1723
1724 pub fn send_no_shutdown_on_err(self, mut result: Result<(), Error>) -> Result<(), fidl::Error> {
1726 let _result = self.send_raw(result);
1727 self.drop_without_shutdown();
1728 _result
1729 }
1730
1731 fn send_raw(&self, mut result: Result<(), Error>) -> Result<(), fidl::Error> {
1732 self.control_handle
1733 .inner
1734 .send::<fidl::encoding::ResultType<fidl::encoding::EmptyStruct, Error>>(
1735 result,
1736 self.tx_id,
1737 0x6907100d9b99439,
1738 fidl::encoding::DynamicFlags::empty(),
1739 )
1740 }
1741}
1742
1743#[must_use = "FIDL methods require a response to be sent"]
1744#[derive(Debug)]
1745pub struct AccessWatchPeersResponder {
1746 control_handle: std::mem::ManuallyDrop<AccessControlHandle>,
1747 tx_id: u32,
1748}
1749
1750impl std::ops::Drop for AccessWatchPeersResponder {
1754 fn drop(&mut self) {
1755 self.control_handle.shutdown();
1756 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1758 }
1759}
1760
1761impl fidl::endpoints::Responder for AccessWatchPeersResponder {
1762 type ControlHandle = AccessControlHandle;
1763
1764 fn control_handle(&self) -> &AccessControlHandle {
1765 &self.control_handle
1766 }
1767
1768 fn drop_without_shutdown(mut self) {
1769 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1771 std::mem::forget(self);
1773 }
1774}
1775
1776impl AccessWatchPeersResponder {
1777 pub fn send(
1781 self,
1782 mut updated: &[Peer],
1783 mut removed: &[fidl_fuchsia_bluetooth::PeerId],
1784 ) -> Result<(), fidl::Error> {
1785 let _result = self.send_raw(updated, removed);
1786 if _result.is_err() {
1787 self.control_handle.shutdown();
1788 }
1789 self.drop_without_shutdown();
1790 _result
1791 }
1792
1793 pub fn send_no_shutdown_on_err(
1795 self,
1796 mut updated: &[Peer],
1797 mut removed: &[fidl_fuchsia_bluetooth::PeerId],
1798 ) -> Result<(), fidl::Error> {
1799 let _result = self.send_raw(updated, removed);
1800 self.drop_without_shutdown();
1801 _result
1802 }
1803
1804 fn send_raw(
1805 &self,
1806 mut updated: &[Peer],
1807 mut removed: &[fidl_fuchsia_bluetooth::PeerId],
1808 ) -> Result<(), fidl::Error> {
1809 self.control_handle.inner.send::<AccessWatchPeersResponse>(
1810 (updated, removed),
1811 self.tx_id,
1812 0x1921fe1ed8e6eb7c,
1813 fidl::encoding::DynamicFlags::empty(),
1814 )
1815 }
1816}
1817
1818#[must_use = "FIDL methods require a response to be sent"]
1819#[derive(Debug)]
1820pub struct AccessConnectResponder {
1821 control_handle: std::mem::ManuallyDrop<AccessControlHandle>,
1822 tx_id: u32,
1823}
1824
1825impl std::ops::Drop for AccessConnectResponder {
1829 fn drop(&mut self) {
1830 self.control_handle.shutdown();
1831 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1833 }
1834}
1835
1836impl fidl::endpoints::Responder for AccessConnectResponder {
1837 type ControlHandle = AccessControlHandle;
1838
1839 fn control_handle(&self) -> &AccessControlHandle {
1840 &self.control_handle
1841 }
1842
1843 fn drop_without_shutdown(mut self) {
1844 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1846 std::mem::forget(self);
1848 }
1849}
1850
1851impl AccessConnectResponder {
1852 pub fn send(self, mut result: Result<(), Error>) -> Result<(), fidl::Error> {
1856 let _result = self.send_raw(result);
1857 if _result.is_err() {
1858 self.control_handle.shutdown();
1859 }
1860 self.drop_without_shutdown();
1861 _result
1862 }
1863
1864 pub fn send_no_shutdown_on_err(self, mut result: Result<(), Error>) -> Result<(), fidl::Error> {
1866 let _result = self.send_raw(result);
1867 self.drop_without_shutdown();
1868 _result
1869 }
1870
1871 fn send_raw(&self, mut result: Result<(), Error>) -> Result<(), fidl::Error> {
1872 self.control_handle
1873 .inner
1874 .send::<fidl::encoding::ResultType<fidl::encoding::EmptyStruct, Error>>(
1875 result,
1876 self.tx_id,
1877 0x1734199789fe7667,
1878 fidl::encoding::DynamicFlags::empty(),
1879 )
1880 }
1881}
1882
1883#[must_use = "FIDL methods require a response to be sent"]
1884#[derive(Debug)]
1885pub struct AccessDisconnectResponder {
1886 control_handle: std::mem::ManuallyDrop<AccessControlHandle>,
1887 tx_id: u32,
1888}
1889
1890impl std::ops::Drop for AccessDisconnectResponder {
1894 fn drop(&mut self) {
1895 self.control_handle.shutdown();
1896 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1898 }
1899}
1900
1901impl fidl::endpoints::Responder for AccessDisconnectResponder {
1902 type ControlHandle = AccessControlHandle;
1903
1904 fn control_handle(&self) -> &AccessControlHandle {
1905 &self.control_handle
1906 }
1907
1908 fn drop_without_shutdown(mut self) {
1909 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1911 std::mem::forget(self);
1913 }
1914}
1915
1916impl AccessDisconnectResponder {
1917 pub fn send(self, mut result: Result<(), Error>) -> Result<(), fidl::Error> {
1921 let _result = self.send_raw(result);
1922 if _result.is_err() {
1923 self.control_handle.shutdown();
1924 }
1925 self.drop_without_shutdown();
1926 _result
1927 }
1928
1929 pub fn send_no_shutdown_on_err(self, mut result: Result<(), Error>) -> Result<(), fidl::Error> {
1931 let _result = self.send_raw(result);
1932 self.drop_without_shutdown();
1933 _result
1934 }
1935
1936 fn send_raw(&self, mut result: Result<(), Error>) -> Result<(), fidl::Error> {
1937 self.control_handle
1938 .inner
1939 .send::<fidl::encoding::ResultType<fidl::encoding::EmptyStruct, Error>>(
1940 result,
1941 self.tx_id,
1942 0x3a4e06d0c6185a5,
1943 fidl::encoding::DynamicFlags::empty(),
1944 )
1945 }
1946}
1947
1948#[must_use = "FIDL methods require a response to be sent"]
1949#[derive(Debug)]
1950pub struct AccessPairResponder {
1951 control_handle: std::mem::ManuallyDrop<AccessControlHandle>,
1952 tx_id: u32,
1953}
1954
1955impl std::ops::Drop for AccessPairResponder {
1959 fn drop(&mut self) {
1960 self.control_handle.shutdown();
1961 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1963 }
1964}
1965
1966impl fidl::endpoints::Responder for AccessPairResponder {
1967 type ControlHandle = AccessControlHandle;
1968
1969 fn control_handle(&self) -> &AccessControlHandle {
1970 &self.control_handle
1971 }
1972
1973 fn drop_without_shutdown(mut self) {
1974 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1976 std::mem::forget(self);
1978 }
1979}
1980
1981impl AccessPairResponder {
1982 pub fn send(self, mut result: Result<(), Error>) -> Result<(), fidl::Error> {
1986 let _result = self.send_raw(result);
1987 if _result.is_err() {
1988 self.control_handle.shutdown();
1989 }
1990 self.drop_without_shutdown();
1991 _result
1992 }
1993
1994 pub fn send_no_shutdown_on_err(self, mut result: Result<(), Error>) -> Result<(), fidl::Error> {
1996 let _result = self.send_raw(result);
1997 self.drop_without_shutdown();
1998 _result
1999 }
2000
2001 fn send_raw(&self, mut result: Result<(), Error>) -> Result<(), fidl::Error> {
2002 self.control_handle
2003 .inner
2004 .send::<fidl::encoding::ResultType<fidl::encoding::EmptyStruct, Error>>(
2005 result,
2006 self.tx_id,
2007 0x1d08ea19db327779,
2008 fidl::encoding::DynamicFlags::empty(),
2009 )
2010 }
2011}
2012
2013#[must_use = "FIDL methods require a response to be sent"]
2014#[derive(Debug)]
2015pub struct AccessForgetResponder {
2016 control_handle: std::mem::ManuallyDrop<AccessControlHandle>,
2017 tx_id: u32,
2018}
2019
2020impl std::ops::Drop for AccessForgetResponder {
2024 fn drop(&mut self) {
2025 self.control_handle.shutdown();
2026 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
2028 }
2029}
2030
2031impl fidl::endpoints::Responder for AccessForgetResponder {
2032 type ControlHandle = AccessControlHandle;
2033
2034 fn control_handle(&self) -> &AccessControlHandle {
2035 &self.control_handle
2036 }
2037
2038 fn drop_without_shutdown(mut self) {
2039 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
2041 std::mem::forget(self);
2043 }
2044}
2045
2046impl AccessForgetResponder {
2047 pub fn send(self, mut result: Result<(), Error>) -> Result<(), fidl::Error> {
2051 let _result = self.send_raw(result);
2052 if _result.is_err() {
2053 self.control_handle.shutdown();
2054 }
2055 self.drop_without_shutdown();
2056 _result
2057 }
2058
2059 pub fn send_no_shutdown_on_err(self, mut result: Result<(), Error>) -> Result<(), fidl::Error> {
2061 let _result = self.send_raw(result);
2062 self.drop_without_shutdown();
2063 _result
2064 }
2065
2066 fn send_raw(&self, mut result: Result<(), Error>) -> Result<(), fidl::Error> {
2067 self.control_handle
2068 .inner
2069 .send::<fidl::encoding::ResultType<fidl::encoding::EmptyStruct, Error>>(
2070 result,
2071 self.tx_id,
2072 0x1fd8e27202854c0,
2073 fidl::encoding::DynamicFlags::empty(),
2074 )
2075 }
2076}
2077
2078#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
2079pub struct AddressLookupMarker;
2080
2081impl fidl::endpoints::ProtocolMarker for AddressLookupMarker {
2082 type Proxy = AddressLookupProxy;
2083 type RequestStream = AddressLookupRequestStream;
2084 #[cfg(target_os = "fuchsia")]
2085 type SynchronousProxy = AddressLookupSynchronousProxy;
2086
2087 const DEBUG_NAME: &'static str = "fuchsia.bluetooth.sys.AddressLookup";
2088}
2089impl fidl::endpoints::DiscoverableProtocolMarker for AddressLookupMarker {}
2090pub type AddressLookupLookupResult = Result<fidl_fuchsia_bluetooth::Address, LookupError>;
2091
2092pub trait AddressLookupProxyInterface: Send + Sync {
2093 type LookupResponseFut: std::future::Future<Output = Result<AddressLookupLookupResult, fidl::Error>>
2094 + Send;
2095 fn r#lookup(&self, payload: &AddressLookupLookupRequest) -> Self::LookupResponseFut;
2096}
2097#[derive(Debug)]
2098#[cfg(target_os = "fuchsia")]
2099pub struct AddressLookupSynchronousProxy {
2100 client: fidl::client::sync::Client,
2101}
2102
2103#[cfg(target_os = "fuchsia")]
2104impl fidl::endpoints::SynchronousProxy for AddressLookupSynchronousProxy {
2105 type Proxy = AddressLookupProxy;
2106 type Protocol = AddressLookupMarker;
2107
2108 fn from_channel(inner: fidl::Channel) -> Self {
2109 Self::new(inner)
2110 }
2111
2112 fn into_channel(self) -> fidl::Channel {
2113 self.client.into_channel()
2114 }
2115
2116 fn as_channel(&self) -> &fidl::Channel {
2117 self.client.as_channel()
2118 }
2119}
2120
2121#[cfg(target_os = "fuchsia")]
2122impl AddressLookupSynchronousProxy {
2123 pub fn new(channel: fidl::Channel) -> Self {
2124 let protocol_name = <AddressLookupMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
2125 Self { client: fidl::client::sync::Client::new(channel, protocol_name) }
2126 }
2127
2128 pub fn into_channel(self) -> fidl::Channel {
2129 self.client.into_channel()
2130 }
2131
2132 pub fn wait_for_event(
2135 &self,
2136 deadline: zx::MonotonicInstant,
2137 ) -> Result<AddressLookupEvent, fidl::Error> {
2138 AddressLookupEvent::decode(self.client.wait_for_event(deadline)?)
2139 }
2140
2141 pub fn r#lookup(
2142 &self,
2143 mut payload: &AddressLookupLookupRequest,
2144 ___deadline: zx::MonotonicInstant,
2145 ) -> Result<AddressLookupLookupResult, fidl::Error> {
2146 let _response = self.client.send_query::<
2147 AddressLookupLookupRequest,
2148 fidl::encoding::FlexibleResultType<AddressLookupLookupResponse, LookupError>,
2149 >(
2150 payload,
2151 0x65d2ae252ec22587,
2152 fidl::encoding::DynamicFlags::FLEXIBLE,
2153 ___deadline,
2154 )?
2155 .into_result::<AddressLookupMarker>("lookup")?;
2156 Ok(_response.map(|x| x.bd_addr))
2157 }
2158}
2159
2160#[cfg(target_os = "fuchsia")]
2161impl From<AddressLookupSynchronousProxy> for zx::Handle {
2162 fn from(value: AddressLookupSynchronousProxy) -> Self {
2163 value.into_channel().into()
2164 }
2165}
2166
2167#[cfg(target_os = "fuchsia")]
2168impl From<fidl::Channel> for AddressLookupSynchronousProxy {
2169 fn from(value: fidl::Channel) -> Self {
2170 Self::new(value)
2171 }
2172}
2173
2174#[cfg(target_os = "fuchsia")]
2175impl fidl::endpoints::FromClient for AddressLookupSynchronousProxy {
2176 type Protocol = AddressLookupMarker;
2177
2178 fn from_client(value: fidl::endpoints::ClientEnd<AddressLookupMarker>) -> Self {
2179 Self::new(value.into_channel())
2180 }
2181}
2182
2183#[derive(Debug, Clone)]
2184pub struct AddressLookupProxy {
2185 client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
2186}
2187
2188impl fidl::endpoints::Proxy for AddressLookupProxy {
2189 type Protocol = AddressLookupMarker;
2190
2191 fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
2192 Self::new(inner)
2193 }
2194
2195 fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
2196 self.client.into_channel().map_err(|client| Self { client })
2197 }
2198
2199 fn as_channel(&self) -> &::fidl::AsyncChannel {
2200 self.client.as_channel()
2201 }
2202}
2203
2204impl AddressLookupProxy {
2205 pub fn new(channel: ::fidl::AsyncChannel) -> Self {
2207 let protocol_name = <AddressLookupMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
2208 Self { client: fidl::client::Client::new(channel, protocol_name) }
2209 }
2210
2211 pub fn take_event_stream(&self) -> AddressLookupEventStream {
2217 AddressLookupEventStream { event_receiver: self.client.take_event_receiver() }
2218 }
2219
2220 pub fn r#lookup(
2221 &self,
2222 mut payload: &AddressLookupLookupRequest,
2223 ) -> fidl::client::QueryResponseFut<
2224 AddressLookupLookupResult,
2225 fidl::encoding::DefaultFuchsiaResourceDialect,
2226 > {
2227 AddressLookupProxyInterface::r#lookup(self, payload)
2228 }
2229}
2230
2231impl AddressLookupProxyInterface for AddressLookupProxy {
2232 type LookupResponseFut = fidl::client::QueryResponseFut<
2233 AddressLookupLookupResult,
2234 fidl::encoding::DefaultFuchsiaResourceDialect,
2235 >;
2236 fn r#lookup(&self, mut payload: &AddressLookupLookupRequest) -> Self::LookupResponseFut {
2237 fn _decode(
2238 mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
2239 ) -> Result<AddressLookupLookupResult, fidl::Error> {
2240 let _response = fidl::client::decode_transaction_body::<
2241 fidl::encoding::FlexibleResultType<AddressLookupLookupResponse, LookupError>,
2242 fidl::encoding::DefaultFuchsiaResourceDialect,
2243 0x65d2ae252ec22587,
2244 >(_buf?)?
2245 .into_result::<AddressLookupMarker>("lookup")?;
2246 Ok(_response.map(|x| x.bd_addr))
2247 }
2248 self.client.send_query_and_decode::<AddressLookupLookupRequest, AddressLookupLookupResult>(
2249 payload,
2250 0x65d2ae252ec22587,
2251 fidl::encoding::DynamicFlags::FLEXIBLE,
2252 _decode,
2253 )
2254 }
2255}
2256
2257pub struct AddressLookupEventStream {
2258 event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
2259}
2260
2261impl std::marker::Unpin for AddressLookupEventStream {}
2262
2263impl futures::stream::FusedStream for AddressLookupEventStream {
2264 fn is_terminated(&self) -> bool {
2265 self.event_receiver.is_terminated()
2266 }
2267}
2268
2269impl futures::Stream for AddressLookupEventStream {
2270 type Item = Result<AddressLookupEvent, fidl::Error>;
2271
2272 fn poll_next(
2273 mut self: std::pin::Pin<&mut Self>,
2274 cx: &mut std::task::Context<'_>,
2275 ) -> std::task::Poll<Option<Self::Item>> {
2276 match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
2277 &mut self.event_receiver,
2278 cx
2279 )?) {
2280 Some(buf) => std::task::Poll::Ready(Some(AddressLookupEvent::decode(buf))),
2281 None => std::task::Poll::Ready(None),
2282 }
2283 }
2284}
2285
2286#[derive(Debug)]
2287pub enum AddressLookupEvent {
2288 #[non_exhaustive]
2289 _UnknownEvent {
2290 ordinal: u64,
2292 },
2293}
2294
2295impl AddressLookupEvent {
2296 fn decode(
2298 mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
2299 ) -> Result<AddressLookupEvent, fidl::Error> {
2300 let (bytes, _handles) = buf.split_mut();
2301 let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
2302 debug_assert_eq!(tx_header.tx_id, 0);
2303 match tx_header.ordinal {
2304 _ if tx_header.dynamic_flags().contains(fidl::encoding::DynamicFlags::FLEXIBLE) => {
2305 Ok(AddressLookupEvent::_UnknownEvent { ordinal: tx_header.ordinal })
2306 }
2307 _ => Err(fidl::Error::UnknownOrdinal {
2308 ordinal: tx_header.ordinal,
2309 protocol_name: <AddressLookupMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
2310 }),
2311 }
2312 }
2313}
2314
2315pub struct AddressLookupRequestStream {
2317 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
2318 is_terminated: bool,
2319}
2320
2321impl std::marker::Unpin for AddressLookupRequestStream {}
2322
2323impl futures::stream::FusedStream for AddressLookupRequestStream {
2324 fn is_terminated(&self) -> bool {
2325 self.is_terminated
2326 }
2327}
2328
2329impl fidl::endpoints::RequestStream for AddressLookupRequestStream {
2330 type Protocol = AddressLookupMarker;
2331 type ControlHandle = AddressLookupControlHandle;
2332
2333 fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
2334 Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
2335 }
2336
2337 fn control_handle(&self) -> Self::ControlHandle {
2338 AddressLookupControlHandle { inner: self.inner.clone() }
2339 }
2340
2341 fn into_inner(
2342 self,
2343 ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
2344 {
2345 (self.inner, self.is_terminated)
2346 }
2347
2348 fn from_inner(
2349 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
2350 is_terminated: bool,
2351 ) -> Self {
2352 Self { inner, is_terminated }
2353 }
2354}
2355
2356impl futures::Stream for AddressLookupRequestStream {
2357 type Item = Result<AddressLookupRequest, fidl::Error>;
2358
2359 fn poll_next(
2360 mut self: std::pin::Pin<&mut Self>,
2361 cx: &mut std::task::Context<'_>,
2362 ) -> std::task::Poll<Option<Self::Item>> {
2363 let this = &mut *self;
2364 if this.inner.check_shutdown(cx) {
2365 this.is_terminated = true;
2366 return std::task::Poll::Ready(None);
2367 }
2368 if this.is_terminated {
2369 panic!("polled AddressLookupRequestStream after completion");
2370 }
2371 fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
2372 |bytes, handles| {
2373 match this.inner.channel().read_etc(cx, bytes, handles) {
2374 std::task::Poll::Ready(Ok(())) => {}
2375 std::task::Poll::Pending => return std::task::Poll::Pending,
2376 std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
2377 this.is_terminated = true;
2378 return std::task::Poll::Ready(None);
2379 }
2380 std::task::Poll::Ready(Err(e)) => {
2381 return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
2382 e.into(),
2383 ))))
2384 }
2385 }
2386
2387 let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
2389
2390 std::task::Poll::Ready(Some(match header.ordinal {
2391 0x65d2ae252ec22587 => {
2392 header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
2393 let mut req = fidl::new_empty!(
2394 AddressLookupLookupRequest,
2395 fidl::encoding::DefaultFuchsiaResourceDialect
2396 );
2397 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<AddressLookupLookupRequest>(&header, _body_bytes, handles, &mut req)?;
2398 let control_handle =
2399 AddressLookupControlHandle { inner: this.inner.clone() };
2400 Ok(AddressLookupRequest::Lookup {
2401 payload: req,
2402 responder: AddressLookupLookupResponder {
2403 control_handle: std::mem::ManuallyDrop::new(control_handle),
2404 tx_id: header.tx_id,
2405 },
2406 })
2407 }
2408 _ if header.tx_id == 0
2409 && header
2410 .dynamic_flags()
2411 .contains(fidl::encoding::DynamicFlags::FLEXIBLE) =>
2412 {
2413 Ok(AddressLookupRequest::_UnknownMethod {
2414 ordinal: header.ordinal,
2415 control_handle: AddressLookupControlHandle {
2416 inner: this.inner.clone(),
2417 },
2418 method_type: fidl::MethodType::OneWay,
2419 })
2420 }
2421 _ if header
2422 .dynamic_flags()
2423 .contains(fidl::encoding::DynamicFlags::FLEXIBLE) =>
2424 {
2425 this.inner.send_framework_err(
2426 fidl::encoding::FrameworkErr::UnknownMethod,
2427 header.tx_id,
2428 header.ordinal,
2429 header.dynamic_flags(),
2430 (bytes, handles),
2431 )?;
2432 Ok(AddressLookupRequest::_UnknownMethod {
2433 ordinal: header.ordinal,
2434 control_handle: AddressLookupControlHandle {
2435 inner: this.inner.clone(),
2436 },
2437 method_type: fidl::MethodType::TwoWay,
2438 })
2439 }
2440 _ => Err(fidl::Error::UnknownOrdinal {
2441 ordinal: header.ordinal,
2442 protocol_name:
2443 <AddressLookupMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
2444 }),
2445 }))
2446 },
2447 )
2448 }
2449}
2450
2451#[derive(Debug)]
2453pub enum AddressLookupRequest {
2454 Lookup {
2455 payload: AddressLookupLookupRequest,
2456 responder: AddressLookupLookupResponder,
2457 },
2458 #[non_exhaustive]
2460 _UnknownMethod {
2461 ordinal: u64,
2463 control_handle: AddressLookupControlHandle,
2464 method_type: fidl::MethodType,
2465 },
2466}
2467
2468impl AddressLookupRequest {
2469 #[allow(irrefutable_let_patterns)]
2470 pub fn into_lookup(self) -> Option<(AddressLookupLookupRequest, AddressLookupLookupResponder)> {
2471 if let AddressLookupRequest::Lookup { payload, responder } = self {
2472 Some((payload, responder))
2473 } else {
2474 None
2475 }
2476 }
2477
2478 pub fn method_name(&self) -> &'static str {
2480 match *self {
2481 AddressLookupRequest::Lookup { .. } => "lookup",
2482 AddressLookupRequest::_UnknownMethod {
2483 method_type: fidl::MethodType::OneWay, ..
2484 } => "unknown one-way method",
2485 AddressLookupRequest::_UnknownMethod {
2486 method_type: fidl::MethodType::TwoWay, ..
2487 } => "unknown two-way method",
2488 }
2489 }
2490}
2491
2492#[derive(Debug, Clone)]
2493pub struct AddressLookupControlHandle {
2494 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
2495}
2496
2497impl fidl::endpoints::ControlHandle for AddressLookupControlHandle {
2498 fn shutdown(&self) {
2499 self.inner.shutdown()
2500 }
2501 fn shutdown_with_epitaph(&self, status: zx_status::Status) {
2502 self.inner.shutdown_with_epitaph(status)
2503 }
2504
2505 fn is_closed(&self) -> bool {
2506 self.inner.channel().is_closed()
2507 }
2508 fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
2509 self.inner.channel().on_closed()
2510 }
2511
2512 #[cfg(target_os = "fuchsia")]
2513 fn signal_peer(
2514 &self,
2515 clear_mask: zx::Signals,
2516 set_mask: zx::Signals,
2517 ) -> Result<(), zx_status::Status> {
2518 use fidl::Peered;
2519 self.inner.channel().signal_peer(clear_mask, set_mask)
2520 }
2521}
2522
2523impl AddressLookupControlHandle {}
2524
2525#[must_use = "FIDL methods require a response to be sent"]
2526#[derive(Debug)]
2527pub struct AddressLookupLookupResponder {
2528 control_handle: std::mem::ManuallyDrop<AddressLookupControlHandle>,
2529 tx_id: u32,
2530}
2531
2532impl std::ops::Drop for AddressLookupLookupResponder {
2536 fn drop(&mut self) {
2537 self.control_handle.shutdown();
2538 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
2540 }
2541}
2542
2543impl fidl::endpoints::Responder for AddressLookupLookupResponder {
2544 type ControlHandle = AddressLookupControlHandle;
2545
2546 fn control_handle(&self) -> &AddressLookupControlHandle {
2547 &self.control_handle
2548 }
2549
2550 fn drop_without_shutdown(mut self) {
2551 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
2553 std::mem::forget(self);
2555 }
2556}
2557
2558impl AddressLookupLookupResponder {
2559 pub fn send(
2563 self,
2564 mut result: Result<&fidl_fuchsia_bluetooth::Address, LookupError>,
2565 ) -> Result<(), fidl::Error> {
2566 let _result = self.send_raw(result);
2567 if _result.is_err() {
2568 self.control_handle.shutdown();
2569 }
2570 self.drop_without_shutdown();
2571 _result
2572 }
2573
2574 pub fn send_no_shutdown_on_err(
2576 self,
2577 mut result: Result<&fidl_fuchsia_bluetooth::Address, LookupError>,
2578 ) -> Result<(), fidl::Error> {
2579 let _result = self.send_raw(result);
2580 self.drop_without_shutdown();
2581 _result
2582 }
2583
2584 fn send_raw(
2585 &self,
2586 mut result: Result<&fidl_fuchsia_bluetooth::Address, LookupError>,
2587 ) -> Result<(), fidl::Error> {
2588 self.control_handle.inner.send::<fidl::encoding::FlexibleResultType<
2589 AddressLookupLookupResponse,
2590 LookupError,
2591 >>(
2592 fidl::encoding::FlexibleResult::new(result.map(|bd_addr| (bd_addr,))),
2593 self.tx_id,
2594 0x65d2ae252ec22587,
2595 fidl::encoding::DynamicFlags::FLEXIBLE,
2596 )
2597 }
2598}
2599
2600#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
2601pub struct BootstrapMarker;
2602
2603impl fidl::endpoints::ProtocolMarker for BootstrapMarker {
2604 type Proxy = BootstrapProxy;
2605 type RequestStream = BootstrapRequestStream;
2606 #[cfg(target_os = "fuchsia")]
2607 type SynchronousProxy = BootstrapSynchronousProxy;
2608
2609 const DEBUG_NAME: &'static str = "fuchsia.bluetooth.sys.Bootstrap";
2610}
2611impl fidl::endpoints::DiscoverableProtocolMarker for BootstrapMarker {}
2612pub type BootstrapCommitResult = Result<(), BootstrapError>;
2613
2614pub trait BootstrapProxyInterface: Send + Sync {
2615 fn r#add_identities(&self, identities: &[Identity]) -> Result<(), fidl::Error>;
2616 type CommitResponseFut: std::future::Future<Output = Result<BootstrapCommitResult, fidl::Error>>
2617 + Send;
2618 fn r#commit(&self) -> Self::CommitResponseFut;
2619}
2620#[derive(Debug)]
2621#[cfg(target_os = "fuchsia")]
2622pub struct BootstrapSynchronousProxy {
2623 client: fidl::client::sync::Client,
2624}
2625
2626#[cfg(target_os = "fuchsia")]
2627impl fidl::endpoints::SynchronousProxy for BootstrapSynchronousProxy {
2628 type Proxy = BootstrapProxy;
2629 type Protocol = BootstrapMarker;
2630
2631 fn from_channel(inner: fidl::Channel) -> Self {
2632 Self::new(inner)
2633 }
2634
2635 fn into_channel(self) -> fidl::Channel {
2636 self.client.into_channel()
2637 }
2638
2639 fn as_channel(&self) -> &fidl::Channel {
2640 self.client.as_channel()
2641 }
2642}
2643
2644#[cfg(target_os = "fuchsia")]
2645impl BootstrapSynchronousProxy {
2646 pub fn new(channel: fidl::Channel) -> Self {
2647 let protocol_name = <BootstrapMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
2648 Self { client: fidl::client::sync::Client::new(channel, protocol_name) }
2649 }
2650
2651 pub fn into_channel(self) -> fidl::Channel {
2652 self.client.into_channel()
2653 }
2654
2655 pub fn wait_for_event(
2658 &self,
2659 deadline: zx::MonotonicInstant,
2660 ) -> Result<BootstrapEvent, fidl::Error> {
2661 BootstrapEvent::decode(self.client.wait_for_event(deadline)?)
2662 }
2663
2664 pub fn r#add_identities(&self, mut identities: &[Identity]) -> Result<(), fidl::Error> {
2668 self.client.send::<BootstrapAddIdentitiesRequest>(
2669 (identities,),
2670 0x92d7c849de29bb0,
2671 fidl::encoding::DynamicFlags::empty(),
2672 )
2673 }
2674
2675 pub fn r#commit(
2681 &self,
2682 ___deadline: zx::MonotonicInstant,
2683 ) -> Result<BootstrapCommitResult, fidl::Error> {
2684 let _response = self.client.send_query::<
2685 fidl::encoding::EmptyPayload,
2686 fidl::encoding::ResultType<fidl::encoding::EmptyStruct, BootstrapError>,
2687 >(
2688 (),
2689 0x5288006c9c7db6b7,
2690 fidl::encoding::DynamicFlags::empty(),
2691 ___deadline,
2692 )?;
2693 Ok(_response.map(|x| x))
2694 }
2695}
2696
2697#[cfg(target_os = "fuchsia")]
2698impl From<BootstrapSynchronousProxy> for zx::Handle {
2699 fn from(value: BootstrapSynchronousProxy) -> Self {
2700 value.into_channel().into()
2701 }
2702}
2703
2704#[cfg(target_os = "fuchsia")]
2705impl From<fidl::Channel> for BootstrapSynchronousProxy {
2706 fn from(value: fidl::Channel) -> Self {
2707 Self::new(value)
2708 }
2709}
2710
2711#[cfg(target_os = "fuchsia")]
2712impl fidl::endpoints::FromClient for BootstrapSynchronousProxy {
2713 type Protocol = BootstrapMarker;
2714
2715 fn from_client(value: fidl::endpoints::ClientEnd<BootstrapMarker>) -> Self {
2716 Self::new(value.into_channel())
2717 }
2718}
2719
2720#[derive(Debug, Clone)]
2721pub struct BootstrapProxy {
2722 client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
2723}
2724
2725impl fidl::endpoints::Proxy for BootstrapProxy {
2726 type Protocol = BootstrapMarker;
2727
2728 fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
2729 Self::new(inner)
2730 }
2731
2732 fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
2733 self.client.into_channel().map_err(|client| Self { client })
2734 }
2735
2736 fn as_channel(&self) -> &::fidl::AsyncChannel {
2737 self.client.as_channel()
2738 }
2739}
2740
2741impl BootstrapProxy {
2742 pub fn new(channel: ::fidl::AsyncChannel) -> Self {
2744 let protocol_name = <BootstrapMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
2745 Self { client: fidl::client::Client::new(channel, protocol_name) }
2746 }
2747
2748 pub fn take_event_stream(&self) -> BootstrapEventStream {
2754 BootstrapEventStream { event_receiver: self.client.take_event_receiver() }
2755 }
2756
2757 pub fn r#add_identities(&self, mut identities: &[Identity]) -> Result<(), fidl::Error> {
2761 BootstrapProxyInterface::r#add_identities(self, identities)
2762 }
2763
2764 pub fn r#commit(
2770 &self,
2771 ) -> fidl::client::QueryResponseFut<
2772 BootstrapCommitResult,
2773 fidl::encoding::DefaultFuchsiaResourceDialect,
2774 > {
2775 BootstrapProxyInterface::r#commit(self)
2776 }
2777}
2778
2779impl BootstrapProxyInterface for BootstrapProxy {
2780 fn r#add_identities(&self, mut identities: &[Identity]) -> Result<(), fidl::Error> {
2781 self.client.send::<BootstrapAddIdentitiesRequest>(
2782 (identities,),
2783 0x92d7c849de29bb0,
2784 fidl::encoding::DynamicFlags::empty(),
2785 )
2786 }
2787
2788 type CommitResponseFut = fidl::client::QueryResponseFut<
2789 BootstrapCommitResult,
2790 fidl::encoding::DefaultFuchsiaResourceDialect,
2791 >;
2792 fn r#commit(&self) -> Self::CommitResponseFut {
2793 fn _decode(
2794 mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
2795 ) -> Result<BootstrapCommitResult, fidl::Error> {
2796 let _response = fidl::client::decode_transaction_body::<
2797 fidl::encoding::ResultType<fidl::encoding::EmptyStruct, BootstrapError>,
2798 fidl::encoding::DefaultFuchsiaResourceDialect,
2799 0x5288006c9c7db6b7,
2800 >(_buf?)?;
2801 Ok(_response.map(|x| x))
2802 }
2803 self.client.send_query_and_decode::<fidl::encoding::EmptyPayload, BootstrapCommitResult>(
2804 (),
2805 0x5288006c9c7db6b7,
2806 fidl::encoding::DynamicFlags::empty(),
2807 _decode,
2808 )
2809 }
2810}
2811
2812pub struct BootstrapEventStream {
2813 event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
2814}
2815
2816impl std::marker::Unpin for BootstrapEventStream {}
2817
2818impl futures::stream::FusedStream for BootstrapEventStream {
2819 fn is_terminated(&self) -> bool {
2820 self.event_receiver.is_terminated()
2821 }
2822}
2823
2824impl futures::Stream for BootstrapEventStream {
2825 type Item = Result<BootstrapEvent, fidl::Error>;
2826
2827 fn poll_next(
2828 mut self: std::pin::Pin<&mut Self>,
2829 cx: &mut std::task::Context<'_>,
2830 ) -> std::task::Poll<Option<Self::Item>> {
2831 match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
2832 &mut self.event_receiver,
2833 cx
2834 )?) {
2835 Some(buf) => std::task::Poll::Ready(Some(BootstrapEvent::decode(buf))),
2836 None => std::task::Poll::Ready(None),
2837 }
2838 }
2839}
2840
2841#[derive(Debug)]
2842pub enum BootstrapEvent {}
2843
2844impl BootstrapEvent {
2845 fn decode(
2847 mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
2848 ) -> Result<BootstrapEvent, fidl::Error> {
2849 let (bytes, _handles) = buf.split_mut();
2850 let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
2851 debug_assert_eq!(tx_header.tx_id, 0);
2852 match tx_header.ordinal {
2853 _ => Err(fidl::Error::UnknownOrdinal {
2854 ordinal: tx_header.ordinal,
2855 protocol_name: <BootstrapMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
2856 }),
2857 }
2858 }
2859}
2860
2861pub struct BootstrapRequestStream {
2863 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
2864 is_terminated: bool,
2865}
2866
2867impl std::marker::Unpin for BootstrapRequestStream {}
2868
2869impl futures::stream::FusedStream for BootstrapRequestStream {
2870 fn is_terminated(&self) -> bool {
2871 self.is_terminated
2872 }
2873}
2874
2875impl fidl::endpoints::RequestStream for BootstrapRequestStream {
2876 type Protocol = BootstrapMarker;
2877 type ControlHandle = BootstrapControlHandle;
2878
2879 fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
2880 Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
2881 }
2882
2883 fn control_handle(&self) -> Self::ControlHandle {
2884 BootstrapControlHandle { inner: self.inner.clone() }
2885 }
2886
2887 fn into_inner(
2888 self,
2889 ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
2890 {
2891 (self.inner, self.is_terminated)
2892 }
2893
2894 fn from_inner(
2895 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
2896 is_terminated: bool,
2897 ) -> Self {
2898 Self { inner, is_terminated }
2899 }
2900}
2901
2902impl futures::Stream for BootstrapRequestStream {
2903 type Item = Result<BootstrapRequest, fidl::Error>;
2904
2905 fn poll_next(
2906 mut self: std::pin::Pin<&mut Self>,
2907 cx: &mut std::task::Context<'_>,
2908 ) -> std::task::Poll<Option<Self::Item>> {
2909 let this = &mut *self;
2910 if this.inner.check_shutdown(cx) {
2911 this.is_terminated = true;
2912 return std::task::Poll::Ready(None);
2913 }
2914 if this.is_terminated {
2915 panic!("polled BootstrapRequestStream after completion");
2916 }
2917 fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
2918 |bytes, handles| {
2919 match this.inner.channel().read_etc(cx, bytes, handles) {
2920 std::task::Poll::Ready(Ok(())) => {}
2921 std::task::Poll::Pending => return std::task::Poll::Pending,
2922 std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
2923 this.is_terminated = true;
2924 return std::task::Poll::Ready(None);
2925 }
2926 std::task::Poll::Ready(Err(e)) => {
2927 return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
2928 e.into(),
2929 ))))
2930 }
2931 }
2932
2933 let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
2935
2936 std::task::Poll::Ready(Some(match header.ordinal {
2937 0x92d7c849de29bb0 => {
2938 header.validate_request_tx_id(fidl::MethodType::OneWay)?;
2939 let mut req = fidl::new_empty!(
2940 BootstrapAddIdentitiesRequest,
2941 fidl::encoding::DefaultFuchsiaResourceDialect
2942 );
2943 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<BootstrapAddIdentitiesRequest>(&header, _body_bytes, handles, &mut req)?;
2944 let control_handle = BootstrapControlHandle { inner: this.inner.clone() };
2945 Ok(BootstrapRequest::AddIdentities {
2946 identities: req.identities,
2947
2948 control_handle,
2949 })
2950 }
2951 0x5288006c9c7db6b7 => {
2952 header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
2953 let mut req = fidl::new_empty!(
2954 fidl::encoding::EmptyPayload,
2955 fidl::encoding::DefaultFuchsiaResourceDialect
2956 );
2957 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
2958 let control_handle = BootstrapControlHandle { inner: this.inner.clone() };
2959 Ok(BootstrapRequest::Commit {
2960 responder: BootstrapCommitResponder {
2961 control_handle: std::mem::ManuallyDrop::new(control_handle),
2962 tx_id: header.tx_id,
2963 },
2964 })
2965 }
2966 _ => Err(fidl::Error::UnknownOrdinal {
2967 ordinal: header.ordinal,
2968 protocol_name:
2969 <BootstrapMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
2970 }),
2971 }))
2972 },
2973 )
2974 }
2975}
2976
2977#[derive(Debug)]
2988pub enum BootstrapRequest {
2989 AddIdentities { identities: Vec<Identity>, control_handle: BootstrapControlHandle },
2993 Commit { responder: BootstrapCommitResponder },
2999}
3000
3001impl BootstrapRequest {
3002 #[allow(irrefutable_let_patterns)]
3003 pub fn into_add_identities(self) -> Option<(Vec<Identity>, BootstrapControlHandle)> {
3004 if let BootstrapRequest::AddIdentities { identities, control_handle } = self {
3005 Some((identities, control_handle))
3006 } else {
3007 None
3008 }
3009 }
3010
3011 #[allow(irrefutable_let_patterns)]
3012 pub fn into_commit(self) -> Option<(BootstrapCommitResponder)> {
3013 if let BootstrapRequest::Commit { responder } = self {
3014 Some((responder))
3015 } else {
3016 None
3017 }
3018 }
3019
3020 pub fn method_name(&self) -> &'static str {
3022 match *self {
3023 BootstrapRequest::AddIdentities { .. } => "add_identities",
3024 BootstrapRequest::Commit { .. } => "commit",
3025 }
3026 }
3027}
3028
3029#[derive(Debug, Clone)]
3030pub struct BootstrapControlHandle {
3031 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
3032}
3033
3034impl fidl::endpoints::ControlHandle for BootstrapControlHandle {
3035 fn shutdown(&self) {
3036 self.inner.shutdown()
3037 }
3038 fn shutdown_with_epitaph(&self, status: zx_status::Status) {
3039 self.inner.shutdown_with_epitaph(status)
3040 }
3041
3042 fn is_closed(&self) -> bool {
3043 self.inner.channel().is_closed()
3044 }
3045 fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
3046 self.inner.channel().on_closed()
3047 }
3048
3049 #[cfg(target_os = "fuchsia")]
3050 fn signal_peer(
3051 &self,
3052 clear_mask: zx::Signals,
3053 set_mask: zx::Signals,
3054 ) -> Result<(), zx_status::Status> {
3055 use fidl::Peered;
3056 self.inner.channel().signal_peer(clear_mask, set_mask)
3057 }
3058}
3059
3060impl BootstrapControlHandle {}
3061
3062#[must_use = "FIDL methods require a response to be sent"]
3063#[derive(Debug)]
3064pub struct BootstrapCommitResponder {
3065 control_handle: std::mem::ManuallyDrop<BootstrapControlHandle>,
3066 tx_id: u32,
3067}
3068
3069impl std::ops::Drop for BootstrapCommitResponder {
3073 fn drop(&mut self) {
3074 self.control_handle.shutdown();
3075 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
3077 }
3078}
3079
3080impl fidl::endpoints::Responder for BootstrapCommitResponder {
3081 type ControlHandle = BootstrapControlHandle;
3082
3083 fn control_handle(&self) -> &BootstrapControlHandle {
3084 &self.control_handle
3085 }
3086
3087 fn drop_without_shutdown(mut self) {
3088 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
3090 std::mem::forget(self);
3092 }
3093}
3094
3095impl BootstrapCommitResponder {
3096 pub fn send(self, mut result: Result<(), BootstrapError>) -> Result<(), fidl::Error> {
3100 let _result = self.send_raw(result);
3101 if _result.is_err() {
3102 self.control_handle.shutdown();
3103 }
3104 self.drop_without_shutdown();
3105 _result
3106 }
3107
3108 pub fn send_no_shutdown_on_err(
3110 self,
3111 mut result: Result<(), BootstrapError>,
3112 ) -> Result<(), fidl::Error> {
3113 let _result = self.send_raw(result);
3114 self.drop_without_shutdown();
3115 _result
3116 }
3117
3118 fn send_raw(&self, mut result: Result<(), BootstrapError>) -> Result<(), fidl::Error> {
3119 self.control_handle.inner.send::<fidl::encoding::ResultType<
3120 fidl::encoding::EmptyStruct,
3121 BootstrapError,
3122 >>(
3123 result,
3124 self.tx_id,
3125 0x5288006c9c7db6b7,
3126 fidl::encoding::DynamicFlags::empty(),
3127 )
3128 }
3129}
3130
3131#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
3132pub struct ConfigurationMarker;
3133
3134impl fidl::endpoints::ProtocolMarker for ConfigurationMarker {
3135 type Proxy = ConfigurationProxy;
3136 type RequestStream = ConfigurationRequestStream;
3137 #[cfg(target_os = "fuchsia")]
3138 type SynchronousProxy = ConfigurationSynchronousProxy;
3139
3140 const DEBUG_NAME: &'static str = "fuchsia.bluetooth.sys.Configuration";
3141}
3142impl fidl::endpoints::DiscoverableProtocolMarker for ConfigurationMarker {}
3143
3144pub trait ConfigurationProxyInterface: Send + Sync {
3145 type UpdateResponseFut: std::future::Future<Output = Result<Settings, fidl::Error>> + Send;
3146 fn r#update(&self, settings: &Settings) -> Self::UpdateResponseFut;
3147}
3148#[derive(Debug)]
3149#[cfg(target_os = "fuchsia")]
3150pub struct ConfigurationSynchronousProxy {
3151 client: fidl::client::sync::Client,
3152}
3153
3154#[cfg(target_os = "fuchsia")]
3155impl fidl::endpoints::SynchronousProxy for ConfigurationSynchronousProxy {
3156 type Proxy = ConfigurationProxy;
3157 type Protocol = ConfigurationMarker;
3158
3159 fn from_channel(inner: fidl::Channel) -> Self {
3160 Self::new(inner)
3161 }
3162
3163 fn into_channel(self) -> fidl::Channel {
3164 self.client.into_channel()
3165 }
3166
3167 fn as_channel(&self) -> &fidl::Channel {
3168 self.client.as_channel()
3169 }
3170}
3171
3172#[cfg(target_os = "fuchsia")]
3173impl ConfigurationSynchronousProxy {
3174 pub fn new(channel: fidl::Channel) -> Self {
3175 let protocol_name = <ConfigurationMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
3176 Self { client: fidl::client::sync::Client::new(channel, protocol_name) }
3177 }
3178
3179 pub fn into_channel(self) -> fidl::Channel {
3180 self.client.into_channel()
3181 }
3182
3183 pub fn wait_for_event(
3186 &self,
3187 deadline: zx::MonotonicInstant,
3188 ) -> Result<ConfigurationEvent, fidl::Error> {
3189 ConfigurationEvent::decode(self.client.wait_for_event(deadline)?)
3190 }
3191
3192 pub fn r#update(
3200 &self,
3201 mut settings: &Settings,
3202 ___deadline: zx::MonotonicInstant,
3203 ) -> Result<Settings, fidl::Error> {
3204 let _response =
3205 self.client.send_query::<ConfigurationUpdateRequest, ConfigurationUpdateResponse>(
3206 (settings,),
3207 0x27e9cfb72e7c6d01,
3208 fidl::encoding::DynamicFlags::empty(),
3209 ___deadline,
3210 )?;
3211 Ok(_response.result)
3212 }
3213}
3214
3215#[cfg(target_os = "fuchsia")]
3216impl From<ConfigurationSynchronousProxy> for zx::Handle {
3217 fn from(value: ConfigurationSynchronousProxy) -> Self {
3218 value.into_channel().into()
3219 }
3220}
3221
3222#[cfg(target_os = "fuchsia")]
3223impl From<fidl::Channel> for ConfigurationSynchronousProxy {
3224 fn from(value: fidl::Channel) -> Self {
3225 Self::new(value)
3226 }
3227}
3228
3229#[cfg(target_os = "fuchsia")]
3230impl fidl::endpoints::FromClient for ConfigurationSynchronousProxy {
3231 type Protocol = ConfigurationMarker;
3232
3233 fn from_client(value: fidl::endpoints::ClientEnd<ConfigurationMarker>) -> Self {
3234 Self::new(value.into_channel())
3235 }
3236}
3237
3238#[derive(Debug, Clone)]
3239pub struct ConfigurationProxy {
3240 client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
3241}
3242
3243impl fidl::endpoints::Proxy for ConfigurationProxy {
3244 type Protocol = ConfigurationMarker;
3245
3246 fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
3247 Self::new(inner)
3248 }
3249
3250 fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
3251 self.client.into_channel().map_err(|client| Self { client })
3252 }
3253
3254 fn as_channel(&self) -> &::fidl::AsyncChannel {
3255 self.client.as_channel()
3256 }
3257}
3258
3259impl ConfigurationProxy {
3260 pub fn new(channel: ::fidl::AsyncChannel) -> Self {
3262 let protocol_name = <ConfigurationMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
3263 Self { client: fidl::client::Client::new(channel, protocol_name) }
3264 }
3265
3266 pub fn take_event_stream(&self) -> ConfigurationEventStream {
3272 ConfigurationEventStream { event_receiver: self.client.take_event_receiver() }
3273 }
3274
3275 pub fn r#update(
3283 &self,
3284 mut settings: &Settings,
3285 ) -> fidl::client::QueryResponseFut<Settings, fidl::encoding::DefaultFuchsiaResourceDialect>
3286 {
3287 ConfigurationProxyInterface::r#update(self, settings)
3288 }
3289}
3290
3291impl ConfigurationProxyInterface for ConfigurationProxy {
3292 type UpdateResponseFut =
3293 fidl::client::QueryResponseFut<Settings, fidl::encoding::DefaultFuchsiaResourceDialect>;
3294 fn r#update(&self, mut settings: &Settings) -> Self::UpdateResponseFut {
3295 fn _decode(
3296 mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
3297 ) -> Result<Settings, fidl::Error> {
3298 let _response = fidl::client::decode_transaction_body::<
3299 ConfigurationUpdateResponse,
3300 fidl::encoding::DefaultFuchsiaResourceDialect,
3301 0x27e9cfb72e7c6d01,
3302 >(_buf?)?;
3303 Ok(_response.result)
3304 }
3305 self.client.send_query_and_decode::<ConfigurationUpdateRequest, Settings>(
3306 (settings,),
3307 0x27e9cfb72e7c6d01,
3308 fidl::encoding::DynamicFlags::empty(),
3309 _decode,
3310 )
3311 }
3312}
3313
3314pub struct ConfigurationEventStream {
3315 event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
3316}
3317
3318impl std::marker::Unpin for ConfigurationEventStream {}
3319
3320impl futures::stream::FusedStream for ConfigurationEventStream {
3321 fn is_terminated(&self) -> bool {
3322 self.event_receiver.is_terminated()
3323 }
3324}
3325
3326impl futures::Stream for ConfigurationEventStream {
3327 type Item = Result<ConfigurationEvent, fidl::Error>;
3328
3329 fn poll_next(
3330 mut self: std::pin::Pin<&mut Self>,
3331 cx: &mut std::task::Context<'_>,
3332 ) -> std::task::Poll<Option<Self::Item>> {
3333 match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
3334 &mut self.event_receiver,
3335 cx
3336 )?) {
3337 Some(buf) => std::task::Poll::Ready(Some(ConfigurationEvent::decode(buf))),
3338 None => std::task::Poll::Ready(None),
3339 }
3340 }
3341}
3342
3343#[derive(Debug)]
3344pub enum ConfigurationEvent {}
3345
3346impl ConfigurationEvent {
3347 fn decode(
3349 mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
3350 ) -> Result<ConfigurationEvent, fidl::Error> {
3351 let (bytes, _handles) = buf.split_mut();
3352 let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
3353 debug_assert_eq!(tx_header.tx_id, 0);
3354 match tx_header.ordinal {
3355 _ => Err(fidl::Error::UnknownOrdinal {
3356 ordinal: tx_header.ordinal,
3357 protocol_name: <ConfigurationMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
3358 }),
3359 }
3360 }
3361}
3362
3363pub struct ConfigurationRequestStream {
3365 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
3366 is_terminated: bool,
3367}
3368
3369impl std::marker::Unpin for ConfigurationRequestStream {}
3370
3371impl futures::stream::FusedStream for ConfigurationRequestStream {
3372 fn is_terminated(&self) -> bool {
3373 self.is_terminated
3374 }
3375}
3376
3377impl fidl::endpoints::RequestStream for ConfigurationRequestStream {
3378 type Protocol = ConfigurationMarker;
3379 type ControlHandle = ConfigurationControlHandle;
3380
3381 fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
3382 Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
3383 }
3384
3385 fn control_handle(&self) -> Self::ControlHandle {
3386 ConfigurationControlHandle { inner: self.inner.clone() }
3387 }
3388
3389 fn into_inner(
3390 self,
3391 ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
3392 {
3393 (self.inner, self.is_terminated)
3394 }
3395
3396 fn from_inner(
3397 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
3398 is_terminated: bool,
3399 ) -> Self {
3400 Self { inner, is_terminated }
3401 }
3402}
3403
3404impl futures::Stream for ConfigurationRequestStream {
3405 type Item = Result<ConfigurationRequest, fidl::Error>;
3406
3407 fn poll_next(
3408 mut self: std::pin::Pin<&mut Self>,
3409 cx: &mut std::task::Context<'_>,
3410 ) -> std::task::Poll<Option<Self::Item>> {
3411 let this = &mut *self;
3412 if this.inner.check_shutdown(cx) {
3413 this.is_terminated = true;
3414 return std::task::Poll::Ready(None);
3415 }
3416 if this.is_terminated {
3417 panic!("polled ConfigurationRequestStream after completion");
3418 }
3419 fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
3420 |bytes, handles| {
3421 match this.inner.channel().read_etc(cx, bytes, handles) {
3422 std::task::Poll::Ready(Ok(())) => {}
3423 std::task::Poll::Pending => return std::task::Poll::Pending,
3424 std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
3425 this.is_terminated = true;
3426 return std::task::Poll::Ready(None);
3427 }
3428 std::task::Poll::Ready(Err(e)) => {
3429 return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
3430 e.into(),
3431 ))))
3432 }
3433 }
3434
3435 let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
3437
3438 std::task::Poll::Ready(Some(match header.ordinal {
3439 0x27e9cfb72e7c6d01 => {
3440 header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
3441 let mut req = fidl::new_empty!(
3442 ConfigurationUpdateRequest,
3443 fidl::encoding::DefaultFuchsiaResourceDialect
3444 );
3445 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<ConfigurationUpdateRequest>(&header, _body_bytes, handles, &mut req)?;
3446 let control_handle =
3447 ConfigurationControlHandle { inner: this.inner.clone() };
3448 Ok(ConfigurationRequest::Update {
3449 settings: req.settings,
3450
3451 responder: ConfigurationUpdateResponder {
3452 control_handle: std::mem::ManuallyDrop::new(control_handle),
3453 tx_id: header.tx_id,
3454 },
3455 })
3456 }
3457 _ => Err(fidl::Error::UnknownOrdinal {
3458 ordinal: header.ordinal,
3459 protocol_name:
3460 <ConfigurationMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
3461 }),
3462 }))
3463 },
3464 )
3465 }
3466}
3467
3468#[derive(Debug)]
3474pub enum ConfigurationRequest {
3475 Update { settings: Settings, responder: ConfigurationUpdateResponder },
3483}
3484
3485impl ConfigurationRequest {
3486 #[allow(irrefutable_let_patterns)]
3487 pub fn into_update(self) -> Option<(Settings, ConfigurationUpdateResponder)> {
3488 if let ConfigurationRequest::Update { settings, responder } = self {
3489 Some((settings, responder))
3490 } else {
3491 None
3492 }
3493 }
3494
3495 pub fn method_name(&self) -> &'static str {
3497 match *self {
3498 ConfigurationRequest::Update { .. } => "update",
3499 }
3500 }
3501}
3502
3503#[derive(Debug, Clone)]
3504pub struct ConfigurationControlHandle {
3505 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
3506}
3507
3508impl fidl::endpoints::ControlHandle for ConfigurationControlHandle {
3509 fn shutdown(&self) {
3510 self.inner.shutdown()
3511 }
3512 fn shutdown_with_epitaph(&self, status: zx_status::Status) {
3513 self.inner.shutdown_with_epitaph(status)
3514 }
3515
3516 fn is_closed(&self) -> bool {
3517 self.inner.channel().is_closed()
3518 }
3519 fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
3520 self.inner.channel().on_closed()
3521 }
3522
3523 #[cfg(target_os = "fuchsia")]
3524 fn signal_peer(
3525 &self,
3526 clear_mask: zx::Signals,
3527 set_mask: zx::Signals,
3528 ) -> Result<(), zx_status::Status> {
3529 use fidl::Peered;
3530 self.inner.channel().signal_peer(clear_mask, set_mask)
3531 }
3532}
3533
3534impl ConfigurationControlHandle {}
3535
3536#[must_use = "FIDL methods require a response to be sent"]
3537#[derive(Debug)]
3538pub struct ConfigurationUpdateResponder {
3539 control_handle: std::mem::ManuallyDrop<ConfigurationControlHandle>,
3540 tx_id: u32,
3541}
3542
3543impl std::ops::Drop for ConfigurationUpdateResponder {
3547 fn drop(&mut self) {
3548 self.control_handle.shutdown();
3549 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
3551 }
3552}
3553
3554impl fidl::endpoints::Responder for ConfigurationUpdateResponder {
3555 type ControlHandle = ConfigurationControlHandle;
3556
3557 fn control_handle(&self) -> &ConfigurationControlHandle {
3558 &self.control_handle
3559 }
3560
3561 fn drop_without_shutdown(mut self) {
3562 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
3564 std::mem::forget(self);
3566 }
3567}
3568
3569impl ConfigurationUpdateResponder {
3570 pub fn send(self, mut result: &Settings) -> Result<(), fidl::Error> {
3574 let _result = self.send_raw(result);
3575 if _result.is_err() {
3576 self.control_handle.shutdown();
3577 }
3578 self.drop_without_shutdown();
3579 _result
3580 }
3581
3582 pub fn send_no_shutdown_on_err(self, mut result: &Settings) -> Result<(), fidl::Error> {
3584 let _result = self.send_raw(result);
3585 self.drop_without_shutdown();
3586 _result
3587 }
3588
3589 fn send_raw(&self, mut result: &Settings) -> Result<(), fidl::Error> {
3590 self.control_handle.inner.send::<ConfigurationUpdateResponse>(
3591 (result,),
3592 self.tx_id,
3593 0x27e9cfb72e7c6d01,
3594 fidl::encoding::DynamicFlags::empty(),
3595 )
3596 }
3597}
3598
3599#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
3600pub struct HostWatcherMarker;
3601
3602impl fidl::endpoints::ProtocolMarker for HostWatcherMarker {
3603 type Proxy = HostWatcherProxy;
3604 type RequestStream = HostWatcherRequestStream;
3605 #[cfg(target_os = "fuchsia")]
3606 type SynchronousProxy = HostWatcherSynchronousProxy;
3607
3608 const DEBUG_NAME: &'static str = "fuchsia.bluetooth.sys.HostWatcher";
3609}
3610impl fidl::endpoints::DiscoverableProtocolMarker for HostWatcherMarker {}
3611pub type HostWatcherSetActiveResult = Result<(), i32>;
3612
3613pub trait HostWatcherProxyInterface: Send + Sync {
3614 type WatchResponseFut: std::future::Future<Output = Result<Vec<HostInfo>, fidl::Error>> + Send;
3615 fn r#watch(&self) -> Self::WatchResponseFut;
3616 type SetActiveResponseFut: std::future::Future<Output = Result<HostWatcherSetActiveResult, fidl::Error>>
3617 + Send;
3618 fn r#set_active(&self, id: &fidl_fuchsia_bluetooth::HostId) -> Self::SetActiveResponseFut;
3619}
3620#[derive(Debug)]
3621#[cfg(target_os = "fuchsia")]
3622pub struct HostWatcherSynchronousProxy {
3623 client: fidl::client::sync::Client,
3624}
3625
3626#[cfg(target_os = "fuchsia")]
3627impl fidl::endpoints::SynchronousProxy for HostWatcherSynchronousProxy {
3628 type Proxy = HostWatcherProxy;
3629 type Protocol = HostWatcherMarker;
3630
3631 fn from_channel(inner: fidl::Channel) -> Self {
3632 Self::new(inner)
3633 }
3634
3635 fn into_channel(self) -> fidl::Channel {
3636 self.client.into_channel()
3637 }
3638
3639 fn as_channel(&self) -> &fidl::Channel {
3640 self.client.as_channel()
3641 }
3642}
3643
3644#[cfg(target_os = "fuchsia")]
3645impl HostWatcherSynchronousProxy {
3646 pub fn new(channel: fidl::Channel) -> Self {
3647 let protocol_name = <HostWatcherMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
3648 Self { client: fidl::client::sync::Client::new(channel, protocol_name) }
3649 }
3650
3651 pub fn into_channel(self) -> fidl::Channel {
3652 self.client.into_channel()
3653 }
3654
3655 pub fn wait_for_event(
3658 &self,
3659 deadline: zx::MonotonicInstant,
3660 ) -> Result<HostWatcherEvent, fidl::Error> {
3661 HostWatcherEvent::decode(self.client.wait_for_event(deadline)?)
3662 }
3663
3664 pub fn r#watch(&self, ___deadline: zx::MonotonicInstant) -> Result<Vec<HostInfo>, fidl::Error> {
3667 let _response =
3668 self.client.send_query::<fidl::encoding::EmptyPayload, HostWatcherWatchResponse>(
3669 (),
3670 0x4e2c2972a5b16f9c,
3671 fidl::encoding::DynamicFlags::empty(),
3672 ___deadline,
3673 )?;
3674 Ok(_response.hosts)
3675 }
3676
3677 pub fn r#set_active(
3683 &self,
3684 mut id: &fidl_fuchsia_bluetooth::HostId,
3685 ___deadline: zx::MonotonicInstant,
3686 ) -> Result<HostWatcherSetActiveResult, fidl::Error> {
3687 let _response = self.client.send_query::<
3688 HostWatcherSetActiveRequest,
3689 fidl::encoding::ResultType<fidl::encoding::EmptyStruct, i32>,
3690 >(
3691 (id,),
3692 0x83f311ecaf0ddf3,
3693 fidl::encoding::DynamicFlags::empty(),
3694 ___deadline,
3695 )?;
3696 Ok(_response.map(|x| x))
3697 }
3698}
3699
3700#[cfg(target_os = "fuchsia")]
3701impl From<HostWatcherSynchronousProxy> for zx::Handle {
3702 fn from(value: HostWatcherSynchronousProxy) -> Self {
3703 value.into_channel().into()
3704 }
3705}
3706
3707#[cfg(target_os = "fuchsia")]
3708impl From<fidl::Channel> for HostWatcherSynchronousProxy {
3709 fn from(value: fidl::Channel) -> Self {
3710 Self::new(value)
3711 }
3712}
3713
3714#[cfg(target_os = "fuchsia")]
3715impl fidl::endpoints::FromClient for HostWatcherSynchronousProxy {
3716 type Protocol = HostWatcherMarker;
3717
3718 fn from_client(value: fidl::endpoints::ClientEnd<HostWatcherMarker>) -> Self {
3719 Self::new(value.into_channel())
3720 }
3721}
3722
3723#[derive(Debug, Clone)]
3724pub struct HostWatcherProxy {
3725 client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
3726}
3727
3728impl fidl::endpoints::Proxy for HostWatcherProxy {
3729 type Protocol = HostWatcherMarker;
3730
3731 fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
3732 Self::new(inner)
3733 }
3734
3735 fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
3736 self.client.into_channel().map_err(|client| Self { client })
3737 }
3738
3739 fn as_channel(&self) -> &::fidl::AsyncChannel {
3740 self.client.as_channel()
3741 }
3742}
3743
3744impl HostWatcherProxy {
3745 pub fn new(channel: ::fidl::AsyncChannel) -> Self {
3747 let protocol_name = <HostWatcherMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
3748 Self { client: fidl::client::Client::new(channel, protocol_name) }
3749 }
3750
3751 pub fn take_event_stream(&self) -> HostWatcherEventStream {
3757 HostWatcherEventStream { event_receiver: self.client.take_event_receiver() }
3758 }
3759
3760 pub fn r#watch(
3763 &self,
3764 ) -> fidl::client::QueryResponseFut<Vec<HostInfo>, fidl::encoding::DefaultFuchsiaResourceDialect>
3765 {
3766 HostWatcherProxyInterface::r#watch(self)
3767 }
3768
3769 pub fn r#set_active(
3775 &self,
3776 mut id: &fidl_fuchsia_bluetooth::HostId,
3777 ) -> fidl::client::QueryResponseFut<
3778 HostWatcherSetActiveResult,
3779 fidl::encoding::DefaultFuchsiaResourceDialect,
3780 > {
3781 HostWatcherProxyInterface::r#set_active(self, id)
3782 }
3783}
3784
3785impl HostWatcherProxyInterface for HostWatcherProxy {
3786 type WatchResponseFut = fidl::client::QueryResponseFut<
3787 Vec<HostInfo>,
3788 fidl::encoding::DefaultFuchsiaResourceDialect,
3789 >;
3790 fn r#watch(&self) -> Self::WatchResponseFut {
3791 fn _decode(
3792 mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
3793 ) -> Result<Vec<HostInfo>, fidl::Error> {
3794 let _response = fidl::client::decode_transaction_body::<
3795 HostWatcherWatchResponse,
3796 fidl::encoding::DefaultFuchsiaResourceDialect,
3797 0x4e2c2972a5b16f9c,
3798 >(_buf?)?;
3799 Ok(_response.hosts)
3800 }
3801 self.client.send_query_and_decode::<fidl::encoding::EmptyPayload, Vec<HostInfo>>(
3802 (),
3803 0x4e2c2972a5b16f9c,
3804 fidl::encoding::DynamicFlags::empty(),
3805 _decode,
3806 )
3807 }
3808
3809 type SetActiveResponseFut = fidl::client::QueryResponseFut<
3810 HostWatcherSetActiveResult,
3811 fidl::encoding::DefaultFuchsiaResourceDialect,
3812 >;
3813 fn r#set_active(&self, mut id: &fidl_fuchsia_bluetooth::HostId) -> Self::SetActiveResponseFut {
3814 fn _decode(
3815 mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
3816 ) -> Result<HostWatcherSetActiveResult, fidl::Error> {
3817 let _response = fidl::client::decode_transaction_body::<
3818 fidl::encoding::ResultType<fidl::encoding::EmptyStruct, i32>,
3819 fidl::encoding::DefaultFuchsiaResourceDialect,
3820 0x83f311ecaf0ddf3,
3821 >(_buf?)?;
3822 Ok(_response.map(|x| x))
3823 }
3824 self.client
3825 .send_query_and_decode::<HostWatcherSetActiveRequest, HostWatcherSetActiveResult>(
3826 (id,),
3827 0x83f311ecaf0ddf3,
3828 fidl::encoding::DynamicFlags::empty(),
3829 _decode,
3830 )
3831 }
3832}
3833
3834pub struct HostWatcherEventStream {
3835 event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
3836}
3837
3838impl std::marker::Unpin for HostWatcherEventStream {}
3839
3840impl futures::stream::FusedStream for HostWatcherEventStream {
3841 fn is_terminated(&self) -> bool {
3842 self.event_receiver.is_terminated()
3843 }
3844}
3845
3846impl futures::Stream for HostWatcherEventStream {
3847 type Item = Result<HostWatcherEvent, fidl::Error>;
3848
3849 fn poll_next(
3850 mut self: std::pin::Pin<&mut Self>,
3851 cx: &mut std::task::Context<'_>,
3852 ) -> std::task::Poll<Option<Self::Item>> {
3853 match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
3854 &mut self.event_receiver,
3855 cx
3856 )?) {
3857 Some(buf) => std::task::Poll::Ready(Some(HostWatcherEvent::decode(buf))),
3858 None => std::task::Poll::Ready(None),
3859 }
3860 }
3861}
3862
3863#[derive(Debug)]
3864pub enum HostWatcherEvent {}
3865
3866impl HostWatcherEvent {
3867 fn decode(
3869 mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
3870 ) -> Result<HostWatcherEvent, fidl::Error> {
3871 let (bytes, _handles) = buf.split_mut();
3872 let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
3873 debug_assert_eq!(tx_header.tx_id, 0);
3874 match tx_header.ordinal {
3875 _ => Err(fidl::Error::UnknownOrdinal {
3876 ordinal: tx_header.ordinal,
3877 protocol_name: <HostWatcherMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
3878 }),
3879 }
3880 }
3881}
3882
3883pub struct HostWatcherRequestStream {
3885 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
3886 is_terminated: bool,
3887}
3888
3889impl std::marker::Unpin for HostWatcherRequestStream {}
3890
3891impl futures::stream::FusedStream for HostWatcherRequestStream {
3892 fn is_terminated(&self) -> bool {
3893 self.is_terminated
3894 }
3895}
3896
3897impl fidl::endpoints::RequestStream for HostWatcherRequestStream {
3898 type Protocol = HostWatcherMarker;
3899 type ControlHandle = HostWatcherControlHandle;
3900
3901 fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
3902 Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
3903 }
3904
3905 fn control_handle(&self) -> Self::ControlHandle {
3906 HostWatcherControlHandle { inner: self.inner.clone() }
3907 }
3908
3909 fn into_inner(
3910 self,
3911 ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
3912 {
3913 (self.inner, self.is_terminated)
3914 }
3915
3916 fn from_inner(
3917 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
3918 is_terminated: bool,
3919 ) -> Self {
3920 Self { inner, is_terminated }
3921 }
3922}
3923
3924impl futures::Stream for HostWatcherRequestStream {
3925 type Item = Result<HostWatcherRequest, fidl::Error>;
3926
3927 fn poll_next(
3928 mut self: std::pin::Pin<&mut Self>,
3929 cx: &mut std::task::Context<'_>,
3930 ) -> std::task::Poll<Option<Self::Item>> {
3931 let this = &mut *self;
3932 if this.inner.check_shutdown(cx) {
3933 this.is_terminated = true;
3934 return std::task::Poll::Ready(None);
3935 }
3936 if this.is_terminated {
3937 panic!("polled HostWatcherRequestStream after completion");
3938 }
3939 fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
3940 |bytes, handles| {
3941 match this.inner.channel().read_etc(cx, bytes, handles) {
3942 std::task::Poll::Ready(Ok(())) => {}
3943 std::task::Poll::Pending => return std::task::Poll::Pending,
3944 std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
3945 this.is_terminated = true;
3946 return std::task::Poll::Ready(None);
3947 }
3948 std::task::Poll::Ready(Err(e)) => {
3949 return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
3950 e.into(),
3951 ))))
3952 }
3953 }
3954
3955 let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
3957
3958 std::task::Poll::Ready(Some(match header.ordinal {
3959 0x4e2c2972a5b16f9c => {
3960 header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
3961 let mut req = fidl::new_empty!(
3962 fidl::encoding::EmptyPayload,
3963 fidl::encoding::DefaultFuchsiaResourceDialect
3964 );
3965 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
3966 let control_handle = HostWatcherControlHandle { inner: this.inner.clone() };
3967 Ok(HostWatcherRequest::Watch {
3968 responder: HostWatcherWatchResponder {
3969 control_handle: std::mem::ManuallyDrop::new(control_handle),
3970 tx_id: header.tx_id,
3971 },
3972 })
3973 }
3974 0x83f311ecaf0ddf3 => {
3975 header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
3976 let mut req = fidl::new_empty!(
3977 HostWatcherSetActiveRequest,
3978 fidl::encoding::DefaultFuchsiaResourceDialect
3979 );
3980 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<HostWatcherSetActiveRequest>(&header, _body_bytes, handles, &mut req)?;
3981 let control_handle = HostWatcherControlHandle { inner: this.inner.clone() };
3982 Ok(HostWatcherRequest::SetActive {
3983 id: req.id,
3984
3985 responder: HostWatcherSetActiveResponder {
3986 control_handle: std::mem::ManuallyDrop::new(control_handle),
3987 tx_id: header.tx_id,
3988 },
3989 })
3990 }
3991 _ => Err(fidl::Error::UnknownOrdinal {
3992 ordinal: header.ordinal,
3993 protocol_name:
3994 <HostWatcherMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
3995 }),
3996 }))
3997 },
3998 )
3999 }
4000}
4001
4002#[derive(Debug)]
4004pub enum HostWatcherRequest {
4005 Watch { responder: HostWatcherWatchResponder },
4008 SetActive { id: fidl_fuchsia_bluetooth::HostId, responder: HostWatcherSetActiveResponder },
4014}
4015
4016impl HostWatcherRequest {
4017 #[allow(irrefutable_let_patterns)]
4018 pub fn into_watch(self) -> Option<(HostWatcherWatchResponder)> {
4019 if let HostWatcherRequest::Watch { responder } = self {
4020 Some((responder))
4021 } else {
4022 None
4023 }
4024 }
4025
4026 #[allow(irrefutable_let_patterns)]
4027 pub fn into_set_active(
4028 self,
4029 ) -> Option<(fidl_fuchsia_bluetooth::HostId, HostWatcherSetActiveResponder)> {
4030 if let HostWatcherRequest::SetActive { id, responder } = self {
4031 Some((id, responder))
4032 } else {
4033 None
4034 }
4035 }
4036
4037 pub fn method_name(&self) -> &'static str {
4039 match *self {
4040 HostWatcherRequest::Watch { .. } => "watch",
4041 HostWatcherRequest::SetActive { .. } => "set_active",
4042 }
4043 }
4044}
4045
4046#[derive(Debug, Clone)]
4047pub struct HostWatcherControlHandle {
4048 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
4049}
4050
4051impl fidl::endpoints::ControlHandle for HostWatcherControlHandle {
4052 fn shutdown(&self) {
4053 self.inner.shutdown()
4054 }
4055 fn shutdown_with_epitaph(&self, status: zx_status::Status) {
4056 self.inner.shutdown_with_epitaph(status)
4057 }
4058
4059 fn is_closed(&self) -> bool {
4060 self.inner.channel().is_closed()
4061 }
4062 fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
4063 self.inner.channel().on_closed()
4064 }
4065
4066 #[cfg(target_os = "fuchsia")]
4067 fn signal_peer(
4068 &self,
4069 clear_mask: zx::Signals,
4070 set_mask: zx::Signals,
4071 ) -> Result<(), zx_status::Status> {
4072 use fidl::Peered;
4073 self.inner.channel().signal_peer(clear_mask, set_mask)
4074 }
4075}
4076
4077impl HostWatcherControlHandle {}
4078
4079#[must_use = "FIDL methods require a response to be sent"]
4080#[derive(Debug)]
4081pub struct HostWatcherWatchResponder {
4082 control_handle: std::mem::ManuallyDrop<HostWatcherControlHandle>,
4083 tx_id: u32,
4084}
4085
4086impl std::ops::Drop for HostWatcherWatchResponder {
4090 fn drop(&mut self) {
4091 self.control_handle.shutdown();
4092 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
4094 }
4095}
4096
4097impl fidl::endpoints::Responder for HostWatcherWatchResponder {
4098 type ControlHandle = HostWatcherControlHandle;
4099
4100 fn control_handle(&self) -> &HostWatcherControlHandle {
4101 &self.control_handle
4102 }
4103
4104 fn drop_without_shutdown(mut self) {
4105 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
4107 std::mem::forget(self);
4109 }
4110}
4111
4112impl HostWatcherWatchResponder {
4113 pub fn send(self, mut hosts: &[HostInfo]) -> Result<(), fidl::Error> {
4117 let _result = self.send_raw(hosts);
4118 if _result.is_err() {
4119 self.control_handle.shutdown();
4120 }
4121 self.drop_without_shutdown();
4122 _result
4123 }
4124
4125 pub fn send_no_shutdown_on_err(self, mut hosts: &[HostInfo]) -> Result<(), fidl::Error> {
4127 let _result = self.send_raw(hosts);
4128 self.drop_without_shutdown();
4129 _result
4130 }
4131
4132 fn send_raw(&self, mut hosts: &[HostInfo]) -> Result<(), fidl::Error> {
4133 self.control_handle.inner.send::<HostWatcherWatchResponse>(
4134 (hosts,),
4135 self.tx_id,
4136 0x4e2c2972a5b16f9c,
4137 fidl::encoding::DynamicFlags::empty(),
4138 )
4139 }
4140}
4141
4142#[must_use = "FIDL methods require a response to be sent"]
4143#[derive(Debug)]
4144pub struct HostWatcherSetActiveResponder {
4145 control_handle: std::mem::ManuallyDrop<HostWatcherControlHandle>,
4146 tx_id: u32,
4147}
4148
4149impl std::ops::Drop for HostWatcherSetActiveResponder {
4153 fn drop(&mut self) {
4154 self.control_handle.shutdown();
4155 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
4157 }
4158}
4159
4160impl fidl::endpoints::Responder for HostWatcherSetActiveResponder {
4161 type ControlHandle = HostWatcherControlHandle;
4162
4163 fn control_handle(&self) -> &HostWatcherControlHandle {
4164 &self.control_handle
4165 }
4166
4167 fn drop_without_shutdown(mut self) {
4168 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
4170 std::mem::forget(self);
4172 }
4173}
4174
4175impl HostWatcherSetActiveResponder {
4176 pub fn send(self, mut result: Result<(), i32>) -> Result<(), fidl::Error> {
4180 let _result = self.send_raw(result);
4181 if _result.is_err() {
4182 self.control_handle.shutdown();
4183 }
4184 self.drop_without_shutdown();
4185 _result
4186 }
4187
4188 pub fn send_no_shutdown_on_err(self, mut result: Result<(), i32>) -> Result<(), fidl::Error> {
4190 let _result = self.send_raw(result);
4191 self.drop_without_shutdown();
4192 _result
4193 }
4194
4195 fn send_raw(&self, mut result: Result<(), i32>) -> Result<(), fidl::Error> {
4196 self.control_handle
4197 .inner
4198 .send::<fidl::encoding::ResultType<fidl::encoding::EmptyStruct, i32>>(
4199 result,
4200 self.tx_id,
4201 0x83f311ecaf0ddf3,
4202 fidl::encoding::DynamicFlags::empty(),
4203 )
4204 }
4205}
4206
4207#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
4208pub struct PairingMarker;
4209
4210impl fidl::endpoints::ProtocolMarker for PairingMarker {
4211 type Proxy = PairingProxy;
4212 type RequestStream = PairingRequestStream;
4213 #[cfg(target_os = "fuchsia")]
4214 type SynchronousProxy = PairingSynchronousProxy;
4215
4216 const DEBUG_NAME: &'static str = "fuchsia.bluetooth.sys.Pairing";
4217}
4218impl fidl::endpoints::DiscoverableProtocolMarker for PairingMarker {}
4219
4220pub trait PairingProxyInterface: Send + Sync {
4221 fn r#set_pairing_delegate(
4222 &self,
4223 input: InputCapability,
4224 output: OutputCapability,
4225 delegate: fidl::endpoints::ClientEnd<PairingDelegateMarker>,
4226 ) -> Result<(), fidl::Error>;
4227 fn r#set_delegate(
4228 &self,
4229 input: InputCapability,
4230 output: OutputCapability,
4231 delegate: fidl::endpoints::ClientEnd<PairingDelegate2Marker>,
4232 ) -> Result<(), fidl::Error>;
4233}
4234#[derive(Debug)]
4235#[cfg(target_os = "fuchsia")]
4236pub struct PairingSynchronousProxy {
4237 client: fidl::client::sync::Client,
4238}
4239
4240#[cfg(target_os = "fuchsia")]
4241impl fidl::endpoints::SynchronousProxy for PairingSynchronousProxy {
4242 type Proxy = PairingProxy;
4243 type Protocol = PairingMarker;
4244
4245 fn from_channel(inner: fidl::Channel) -> Self {
4246 Self::new(inner)
4247 }
4248
4249 fn into_channel(self) -> fidl::Channel {
4250 self.client.into_channel()
4251 }
4252
4253 fn as_channel(&self) -> &fidl::Channel {
4254 self.client.as_channel()
4255 }
4256}
4257
4258#[cfg(target_os = "fuchsia")]
4259impl PairingSynchronousProxy {
4260 pub fn new(channel: fidl::Channel) -> Self {
4261 let protocol_name = <PairingMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
4262 Self { client: fidl::client::sync::Client::new(channel, protocol_name) }
4263 }
4264
4265 pub fn into_channel(self) -> fidl::Channel {
4266 self.client.into_channel()
4267 }
4268
4269 pub fn wait_for_event(
4272 &self,
4273 deadline: zx::MonotonicInstant,
4274 ) -> Result<PairingEvent, fidl::Error> {
4275 PairingEvent::decode(self.client.wait_for_event(deadline)?)
4276 }
4277
4278 pub fn r#set_pairing_delegate(
4293 &self,
4294 mut input: InputCapability,
4295 mut output: OutputCapability,
4296 mut delegate: fidl::endpoints::ClientEnd<PairingDelegateMarker>,
4297 ) -> Result<(), fidl::Error> {
4298 self.client.send::<PairingSetPairingDelegateRequest>(
4299 (input, output, delegate),
4300 0x19721a12cb80212c,
4301 fidl::encoding::DynamicFlags::empty(),
4302 )
4303 }
4304
4305 pub fn r#set_delegate(
4323 &self,
4324 mut input: InputCapability,
4325 mut output: OutputCapability,
4326 mut delegate: fidl::endpoints::ClientEnd<PairingDelegate2Marker>,
4327 ) -> Result<(), fidl::Error> {
4328 self.client.send::<PairingSetDelegateRequest>(
4329 (input, output, delegate),
4330 0x1da0568d2582a9a5,
4331 fidl::encoding::DynamicFlags::empty(),
4332 )
4333 }
4334}
4335
4336#[cfg(target_os = "fuchsia")]
4337impl From<PairingSynchronousProxy> for zx::Handle {
4338 fn from(value: PairingSynchronousProxy) -> Self {
4339 value.into_channel().into()
4340 }
4341}
4342
4343#[cfg(target_os = "fuchsia")]
4344impl From<fidl::Channel> for PairingSynchronousProxy {
4345 fn from(value: fidl::Channel) -> Self {
4346 Self::new(value)
4347 }
4348}
4349
4350#[cfg(target_os = "fuchsia")]
4351impl fidl::endpoints::FromClient for PairingSynchronousProxy {
4352 type Protocol = PairingMarker;
4353
4354 fn from_client(value: fidl::endpoints::ClientEnd<PairingMarker>) -> Self {
4355 Self::new(value.into_channel())
4356 }
4357}
4358
4359#[derive(Debug, Clone)]
4360pub struct PairingProxy {
4361 client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
4362}
4363
4364impl fidl::endpoints::Proxy for PairingProxy {
4365 type Protocol = PairingMarker;
4366
4367 fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
4368 Self::new(inner)
4369 }
4370
4371 fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
4372 self.client.into_channel().map_err(|client| Self { client })
4373 }
4374
4375 fn as_channel(&self) -> &::fidl::AsyncChannel {
4376 self.client.as_channel()
4377 }
4378}
4379
4380impl PairingProxy {
4381 pub fn new(channel: ::fidl::AsyncChannel) -> Self {
4383 let protocol_name = <PairingMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
4384 Self { client: fidl::client::Client::new(channel, protocol_name) }
4385 }
4386
4387 pub fn take_event_stream(&self) -> PairingEventStream {
4393 PairingEventStream { event_receiver: self.client.take_event_receiver() }
4394 }
4395
4396 pub fn r#set_pairing_delegate(
4411 &self,
4412 mut input: InputCapability,
4413 mut output: OutputCapability,
4414 mut delegate: fidl::endpoints::ClientEnd<PairingDelegateMarker>,
4415 ) -> Result<(), fidl::Error> {
4416 PairingProxyInterface::r#set_pairing_delegate(self, input, output, delegate)
4417 }
4418
4419 pub fn r#set_delegate(
4437 &self,
4438 mut input: InputCapability,
4439 mut output: OutputCapability,
4440 mut delegate: fidl::endpoints::ClientEnd<PairingDelegate2Marker>,
4441 ) -> Result<(), fidl::Error> {
4442 PairingProxyInterface::r#set_delegate(self, input, output, delegate)
4443 }
4444}
4445
4446impl PairingProxyInterface for PairingProxy {
4447 fn r#set_pairing_delegate(
4448 &self,
4449 mut input: InputCapability,
4450 mut output: OutputCapability,
4451 mut delegate: fidl::endpoints::ClientEnd<PairingDelegateMarker>,
4452 ) -> Result<(), fidl::Error> {
4453 self.client.send::<PairingSetPairingDelegateRequest>(
4454 (input, output, delegate),
4455 0x19721a12cb80212c,
4456 fidl::encoding::DynamicFlags::empty(),
4457 )
4458 }
4459
4460 fn r#set_delegate(
4461 &self,
4462 mut input: InputCapability,
4463 mut output: OutputCapability,
4464 mut delegate: fidl::endpoints::ClientEnd<PairingDelegate2Marker>,
4465 ) -> Result<(), fidl::Error> {
4466 self.client.send::<PairingSetDelegateRequest>(
4467 (input, output, delegate),
4468 0x1da0568d2582a9a5,
4469 fidl::encoding::DynamicFlags::empty(),
4470 )
4471 }
4472}
4473
4474pub struct PairingEventStream {
4475 event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
4476}
4477
4478impl std::marker::Unpin for PairingEventStream {}
4479
4480impl futures::stream::FusedStream for PairingEventStream {
4481 fn is_terminated(&self) -> bool {
4482 self.event_receiver.is_terminated()
4483 }
4484}
4485
4486impl futures::Stream for PairingEventStream {
4487 type Item = Result<PairingEvent, fidl::Error>;
4488
4489 fn poll_next(
4490 mut self: std::pin::Pin<&mut Self>,
4491 cx: &mut std::task::Context<'_>,
4492 ) -> std::task::Poll<Option<Self::Item>> {
4493 match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
4494 &mut self.event_receiver,
4495 cx
4496 )?) {
4497 Some(buf) => std::task::Poll::Ready(Some(PairingEvent::decode(buf))),
4498 None => std::task::Poll::Ready(None),
4499 }
4500 }
4501}
4502
4503#[derive(Debug)]
4504pub enum PairingEvent {}
4505
4506impl PairingEvent {
4507 fn decode(
4509 mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
4510 ) -> Result<PairingEvent, fidl::Error> {
4511 let (bytes, _handles) = buf.split_mut();
4512 let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
4513 debug_assert_eq!(tx_header.tx_id, 0);
4514 match tx_header.ordinal {
4515 _ => Err(fidl::Error::UnknownOrdinal {
4516 ordinal: tx_header.ordinal,
4517 protocol_name: <PairingMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
4518 }),
4519 }
4520 }
4521}
4522
4523pub struct PairingRequestStream {
4525 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
4526 is_terminated: bool,
4527}
4528
4529impl std::marker::Unpin for PairingRequestStream {}
4530
4531impl futures::stream::FusedStream for PairingRequestStream {
4532 fn is_terminated(&self) -> bool {
4533 self.is_terminated
4534 }
4535}
4536
4537impl fidl::endpoints::RequestStream for PairingRequestStream {
4538 type Protocol = PairingMarker;
4539 type ControlHandle = PairingControlHandle;
4540
4541 fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
4542 Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
4543 }
4544
4545 fn control_handle(&self) -> Self::ControlHandle {
4546 PairingControlHandle { inner: self.inner.clone() }
4547 }
4548
4549 fn into_inner(
4550 self,
4551 ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
4552 {
4553 (self.inner, self.is_terminated)
4554 }
4555
4556 fn from_inner(
4557 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
4558 is_terminated: bool,
4559 ) -> Self {
4560 Self { inner, is_terminated }
4561 }
4562}
4563
4564impl futures::Stream for PairingRequestStream {
4565 type Item = Result<PairingRequest, fidl::Error>;
4566
4567 fn poll_next(
4568 mut self: std::pin::Pin<&mut Self>,
4569 cx: &mut std::task::Context<'_>,
4570 ) -> std::task::Poll<Option<Self::Item>> {
4571 let this = &mut *self;
4572 if this.inner.check_shutdown(cx) {
4573 this.is_terminated = true;
4574 return std::task::Poll::Ready(None);
4575 }
4576 if this.is_terminated {
4577 panic!("polled PairingRequestStream after completion");
4578 }
4579 fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
4580 |bytes, handles| {
4581 match this.inner.channel().read_etc(cx, bytes, handles) {
4582 std::task::Poll::Ready(Ok(())) => {}
4583 std::task::Poll::Pending => return std::task::Poll::Pending,
4584 std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
4585 this.is_terminated = true;
4586 return std::task::Poll::Ready(None);
4587 }
4588 std::task::Poll::Ready(Err(e)) => {
4589 return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
4590 e.into(),
4591 ))))
4592 }
4593 }
4594
4595 let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
4597
4598 std::task::Poll::Ready(Some(match header.ordinal {
4599 0x19721a12cb80212c => {
4600 header.validate_request_tx_id(fidl::MethodType::OneWay)?;
4601 let mut req = fidl::new_empty!(
4602 PairingSetPairingDelegateRequest,
4603 fidl::encoding::DefaultFuchsiaResourceDialect
4604 );
4605 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<PairingSetPairingDelegateRequest>(&header, _body_bytes, handles, &mut req)?;
4606 let control_handle = PairingControlHandle { inner: this.inner.clone() };
4607 Ok(PairingRequest::SetPairingDelegate {
4608 input: req.input,
4609 output: req.output,
4610 delegate: req.delegate,
4611
4612 control_handle,
4613 })
4614 }
4615 0x1da0568d2582a9a5 => {
4616 header.validate_request_tx_id(fidl::MethodType::OneWay)?;
4617 let mut req = fidl::new_empty!(
4618 PairingSetDelegateRequest,
4619 fidl::encoding::DefaultFuchsiaResourceDialect
4620 );
4621 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<PairingSetDelegateRequest>(&header, _body_bytes, handles, &mut req)?;
4622 let control_handle = PairingControlHandle { inner: this.inner.clone() };
4623 Ok(PairingRequest::SetDelegate {
4624 input: req.input,
4625 output: req.output,
4626 delegate: req.delegate,
4627
4628 control_handle,
4629 })
4630 }
4631 _ => Err(fidl::Error::UnknownOrdinal {
4632 ordinal: header.ordinal,
4633 protocol_name:
4634 <PairingMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
4635 }),
4636 }))
4637 },
4638 )
4639 }
4640}
4641
4642#[derive(Debug)]
4644pub enum PairingRequest {
4645 SetPairingDelegate {
4660 input: InputCapability,
4661 output: OutputCapability,
4662 delegate: fidl::endpoints::ClientEnd<PairingDelegateMarker>,
4663 control_handle: PairingControlHandle,
4664 },
4665 SetDelegate {
4683 input: InputCapability,
4684 output: OutputCapability,
4685 delegate: fidl::endpoints::ClientEnd<PairingDelegate2Marker>,
4686 control_handle: PairingControlHandle,
4687 },
4688}
4689
4690impl PairingRequest {
4691 #[allow(irrefutable_let_patterns)]
4692 pub fn into_set_pairing_delegate(
4693 self,
4694 ) -> Option<(
4695 InputCapability,
4696 OutputCapability,
4697 fidl::endpoints::ClientEnd<PairingDelegateMarker>,
4698 PairingControlHandle,
4699 )> {
4700 if let PairingRequest::SetPairingDelegate { input, output, delegate, control_handle } = self
4701 {
4702 Some((input, output, delegate, control_handle))
4703 } else {
4704 None
4705 }
4706 }
4707
4708 #[allow(irrefutable_let_patterns)]
4709 pub fn into_set_delegate(
4710 self,
4711 ) -> Option<(
4712 InputCapability,
4713 OutputCapability,
4714 fidl::endpoints::ClientEnd<PairingDelegate2Marker>,
4715 PairingControlHandle,
4716 )> {
4717 if let PairingRequest::SetDelegate { input, output, delegate, control_handle } = self {
4718 Some((input, output, delegate, control_handle))
4719 } else {
4720 None
4721 }
4722 }
4723
4724 pub fn method_name(&self) -> &'static str {
4726 match *self {
4727 PairingRequest::SetPairingDelegate { .. } => "set_pairing_delegate",
4728 PairingRequest::SetDelegate { .. } => "set_delegate",
4729 }
4730 }
4731}
4732
4733#[derive(Debug, Clone)]
4734pub struct PairingControlHandle {
4735 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
4736}
4737
4738impl fidl::endpoints::ControlHandle for PairingControlHandle {
4739 fn shutdown(&self) {
4740 self.inner.shutdown()
4741 }
4742 fn shutdown_with_epitaph(&self, status: zx_status::Status) {
4743 self.inner.shutdown_with_epitaph(status)
4744 }
4745
4746 fn is_closed(&self) -> bool {
4747 self.inner.channel().is_closed()
4748 }
4749 fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
4750 self.inner.channel().on_closed()
4751 }
4752
4753 #[cfg(target_os = "fuchsia")]
4754 fn signal_peer(
4755 &self,
4756 clear_mask: zx::Signals,
4757 set_mask: zx::Signals,
4758 ) -> Result<(), zx_status::Status> {
4759 use fidl::Peered;
4760 self.inner.channel().signal_peer(clear_mask, set_mask)
4761 }
4762}
4763
4764impl PairingControlHandle {}
4765
4766#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
4767pub struct PairingDelegateMarker;
4768
4769impl fidl::endpoints::ProtocolMarker for PairingDelegateMarker {
4770 type Proxy = PairingDelegateProxy;
4771 type RequestStream = PairingDelegateRequestStream;
4772 #[cfg(target_os = "fuchsia")]
4773 type SynchronousProxy = PairingDelegateSynchronousProxy;
4774
4775 const DEBUG_NAME: &'static str = "(anonymous) PairingDelegate";
4776}
4777
4778pub trait PairingDelegateProxyInterface: Send + Sync {
4779 type OnPairingRequestResponseFut: std::future::Future<Output = Result<(bool, u32), fidl::Error>>
4780 + Send;
4781 fn r#on_pairing_request(
4782 &self,
4783 peer: &Peer,
4784 method: PairingMethod,
4785 displayed_passkey: u32,
4786 ) -> Self::OnPairingRequestResponseFut;
4787 fn r#on_pairing_complete(
4788 &self,
4789 id: &fidl_fuchsia_bluetooth::PeerId,
4790 success: bool,
4791 ) -> Result<(), fidl::Error>;
4792 fn r#on_remote_keypress(
4793 &self,
4794 id: &fidl_fuchsia_bluetooth::PeerId,
4795 keypress: PairingKeypress,
4796 ) -> Result<(), fidl::Error>;
4797}
4798#[derive(Debug)]
4799#[cfg(target_os = "fuchsia")]
4800pub struct PairingDelegateSynchronousProxy {
4801 client: fidl::client::sync::Client,
4802}
4803
4804#[cfg(target_os = "fuchsia")]
4805impl fidl::endpoints::SynchronousProxy for PairingDelegateSynchronousProxy {
4806 type Proxy = PairingDelegateProxy;
4807 type Protocol = PairingDelegateMarker;
4808
4809 fn from_channel(inner: fidl::Channel) -> Self {
4810 Self::new(inner)
4811 }
4812
4813 fn into_channel(self) -> fidl::Channel {
4814 self.client.into_channel()
4815 }
4816
4817 fn as_channel(&self) -> &fidl::Channel {
4818 self.client.as_channel()
4819 }
4820}
4821
4822#[cfg(target_os = "fuchsia")]
4823impl PairingDelegateSynchronousProxy {
4824 pub fn new(channel: fidl::Channel) -> Self {
4825 let protocol_name = <PairingDelegateMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
4826 Self { client: fidl::client::sync::Client::new(channel, protocol_name) }
4827 }
4828
4829 pub fn into_channel(self) -> fidl::Channel {
4830 self.client.into_channel()
4831 }
4832
4833 pub fn wait_for_event(
4836 &self,
4837 deadline: zx::MonotonicInstant,
4838 ) -> Result<PairingDelegateEvent, fidl::Error> {
4839 PairingDelegateEvent::decode(self.client.wait_for_event(deadline)?)
4840 }
4841
4842 pub fn r#on_pairing_request(
4861 &self,
4862 mut peer: &Peer,
4863 mut method: PairingMethod,
4864 mut displayed_passkey: u32,
4865 ___deadline: zx::MonotonicInstant,
4866 ) -> Result<(bool, u32), fidl::Error> {
4867 let _response = self.client.send_query::<
4868 PairingDelegateOnPairingRequestRequest,
4869 PairingDelegateOnPairingRequestResponse,
4870 >(
4871 (peer, method, displayed_passkey,),
4872 0x5c483a8f97b226b3,
4873 fidl::encoding::DynamicFlags::empty(),
4874 ___deadline,
4875 )?;
4876 Ok((_response.accept, _response.entered_passkey))
4877 }
4878
4879 pub fn r#on_pairing_complete(
4885 &self,
4886 mut id: &fidl_fuchsia_bluetooth::PeerId,
4887 mut success: bool,
4888 ) -> Result<(), fidl::Error> {
4889 self.client.send::<PairingDelegateOnPairingCompleteRequest>(
4890 (id, success),
4891 0x5ad8fc9864eba757,
4892 fidl::encoding::DynamicFlags::empty(),
4893 )
4894 }
4895
4896 pub fn r#on_remote_keypress(
4910 &self,
4911 mut id: &fidl_fuchsia_bluetooth::PeerId,
4912 mut keypress: PairingKeypress,
4913 ) -> Result<(), fidl::Error> {
4914 self.client.send::<PairingDelegateOnRemoteKeypressRequest>(
4915 (id, keypress),
4916 0x4e341e41c604c724,
4917 fidl::encoding::DynamicFlags::empty(),
4918 )
4919 }
4920}
4921
4922#[cfg(target_os = "fuchsia")]
4923impl From<PairingDelegateSynchronousProxy> for zx::Handle {
4924 fn from(value: PairingDelegateSynchronousProxy) -> Self {
4925 value.into_channel().into()
4926 }
4927}
4928
4929#[cfg(target_os = "fuchsia")]
4930impl From<fidl::Channel> for PairingDelegateSynchronousProxy {
4931 fn from(value: fidl::Channel) -> Self {
4932 Self::new(value)
4933 }
4934}
4935
4936#[cfg(target_os = "fuchsia")]
4937impl fidl::endpoints::FromClient for PairingDelegateSynchronousProxy {
4938 type Protocol = PairingDelegateMarker;
4939
4940 fn from_client(value: fidl::endpoints::ClientEnd<PairingDelegateMarker>) -> Self {
4941 Self::new(value.into_channel())
4942 }
4943}
4944
4945#[derive(Debug, Clone)]
4946pub struct PairingDelegateProxy {
4947 client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
4948}
4949
4950impl fidl::endpoints::Proxy for PairingDelegateProxy {
4951 type Protocol = PairingDelegateMarker;
4952
4953 fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
4954 Self::new(inner)
4955 }
4956
4957 fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
4958 self.client.into_channel().map_err(|client| Self { client })
4959 }
4960
4961 fn as_channel(&self) -> &::fidl::AsyncChannel {
4962 self.client.as_channel()
4963 }
4964}
4965
4966impl PairingDelegateProxy {
4967 pub fn new(channel: ::fidl::AsyncChannel) -> Self {
4969 let protocol_name = <PairingDelegateMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
4970 Self { client: fidl::client::Client::new(channel, protocol_name) }
4971 }
4972
4973 pub fn take_event_stream(&self) -> PairingDelegateEventStream {
4979 PairingDelegateEventStream { event_receiver: self.client.take_event_receiver() }
4980 }
4981
4982 pub fn r#on_pairing_request(
5001 &self,
5002 mut peer: &Peer,
5003 mut method: PairingMethod,
5004 mut displayed_passkey: u32,
5005 ) -> fidl::client::QueryResponseFut<(bool, u32), fidl::encoding::DefaultFuchsiaResourceDialect>
5006 {
5007 PairingDelegateProxyInterface::r#on_pairing_request(self, peer, method, displayed_passkey)
5008 }
5009
5010 pub fn r#on_pairing_complete(
5016 &self,
5017 mut id: &fidl_fuchsia_bluetooth::PeerId,
5018 mut success: bool,
5019 ) -> Result<(), fidl::Error> {
5020 PairingDelegateProxyInterface::r#on_pairing_complete(self, id, success)
5021 }
5022
5023 pub fn r#on_remote_keypress(
5037 &self,
5038 mut id: &fidl_fuchsia_bluetooth::PeerId,
5039 mut keypress: PairingKeypress,
5040 ) -> Result<(), fidl::Error> {
5041 PairingDelegateProxyInterface::r#on_remote_keypress(self, id, keypress)
5042 }
5043}
5044
5045impl PairingDelegateProxyInterface for PairingDelegateProxy {
5046 type OnPairingRequestResponseFut =
5047 fidl::client::QueryResponseFut<(bool, u32), fidl::encoding::DefaultFuchsiaResourceDialect>;
5048 fn r#on_pairing_request(
5049 &self,
5050 mut peer: &Peer,
5051 mut method: PairingMethod,
5052 mut displayed_passkey: u32,
5053 ) -> Self::OnPairingRequestResponseFut {
5054 fn _decode(
5055 mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
5056 ) -> Result<(bool, u32), fidl::Error> {
5057 let _response = fidl::client::decode_transaction_body::<
5058 PairingDelegateOnPairingRequestResponse,
5059 fidl::encoding::DefaultFuchsiaResourceDialect,
5060 0x5c483a8f97b226b3,
5061 >(_buf?)?;
5062 Ok((_response.accept, _response.entered_passkey))
5063 }
5064 self.client.send_query_and_decode::<PairingDelegateOnPairingRequestRequest, (bool, u32)>(
5065 (peer, method, displayed_passkey),
5066 0x5c483a8f97b226b3,
5067 fidl::encoding::DynamicFlags::empty(),
5068 _decode,
5069 )
5070 }
5071
5072 fn r#on_pairing_complete(
5073 &self,
5074 mut id: &fidl_fuchsia_bluetooth::PeerId,
5075 mut success: bool,
5076 ) -> Result<(), fidl::Error> {
5077 self.client.send::<PairingDelegateOnPairingCompleteRequest>(
5078 (id, success),
5079 0x5ad8fc9864eba757,
5080 fidl::encoding::DynamicFlags::empty(),
5081 )
5082 }
5083
5084 fn r#on_remote_keypress(
5085 &self,
5086 mut id: &fidl_fuchsia_bluetooth::PeerId,
5087 mut keypress: PairingKeypress,
5088 ) -> Result<(), fidl::Error> {
5089 self.client.send::<PairingDelegateOnRemoteKeypressRequest>(
5090 (id, keypress),
5091 0x4e341e41c604c724,
5092 fidl::encoding::DynamicFlags::empty(),
5093 )
5094 }
5095}
5096
5097pub struct PairingDelegateEventStream {
5098 event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
5099}
5100
5101impl std::marker::Unpin for PairingDelegateEventStream {}
5102
5103impl futures::stream::FusedStream for PairingDelegateEventStream {
5104 fn is_terminated(&self) -> bool {
5105 self.event_receiver.is_terminated()
5106 }
5107}
5108
5109impl futures::Stream for PairingDelegateEventStream {
5110 type Item = Result<PairingDelegateEvent, fidl::Error>;
5111
5112 fn poll_next(
5113 mut self: std::pin::Pin<&mut Self>,
5114 cx: &mut std::task::Context<'_>,
5115 ) -> std::task::Poll<Option<Self::Item>> {
5116 match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
5117 &mut self.event_receiver,
5118 cx
5119 )?) {
5120 Some(buf) => std::task::Poll::Ready(Some(PairingDelegateEvent::decode(buf))),
5121 None => std::task::Poll::Ready(None),
5122 }
5123 }
5124}
5125
5126#[derive(Debug)]
5127pub enum PairingDelegateEvent {
5128 OnLocalKeypress { id: fidl_fuchsia_bluetooth::PeerId, keypress: PairingKeypress },
5129}
5130
5131impl PairingDelegateEvent {
5132 #[allow(irrefutable_let_patterns)]
5133 pub fn into_on_local_keypress(
5134 self,
5135 ) -> Option<(fidl_fuchsia_bluetooth::PeerId, PairingKeypress)> {
5136 if let PairingDelegateEvent::OnLocalKeypress { id, keypress } = self {
5137 Some((id, keypress))
5138 } else {
5139 None
5140 }
5141 }
5142
5143 fn decode(
5145 mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
5146 ) -> Result<PairingDelegateEvent, fidl::Error> {
5147 let (bytes, _handles) = buf.split_mut();
5148 let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
5149 debug_assert_eq!(tx_header.tx_id, 0);
5150 match tx_header.ordinal {
5151 0x1a764c0428878889 => {
5152 let mut out = fidl::new_empty!(
5153 PairingDelegateOnLocalKeypressRequest,
5154 fidl::encoding::DefaultFuchsiaResourceDialect
5155 );
5156 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<PairingDelegateOnLocalKeypressRequest>(&tx_header, _body_bytes, _handles, &mut out)?;
5157 Ok((PairingDelegateEvent::OnLocalKeypress { id: out.id, keypress: out.keypress }))
5158 }
5159 _ => Err(fidl::Error::UnknownOrdinal {
5160 ordinal: tx_header.ordinal,
5161 protocol_name:
5162 <PairingDelegateMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
5163 }),
5164 }
5165 }
5166}
5167
5168pub struct PairingDelegateRequestStream {
5170 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
5171 is_terminated: bool,
5172}
5173
5174impl std::marker::Unpin for PairingDelegateRequestStream {}
5175
5176impl futures::stream::FusedStream for PairingDelegateRequestStream {
5177 fn is_terminated(&self) -> bool {
5178 self.is_terminated
5179 }
5180}
5181
5182impl fidl::endpoints::RequestStream for PairingDelegateRequestStream {
5183 type Protocol = PairingDelegateMarker;
5184 type ControlHandle = PairingDelegateControlHandle;
5185
5186 fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
5187 Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
5188 }
5189
5190 fn control_handle(&self) -> Self::ControlHandle {
5191 PairingDelegateControlHandle { inner: self.inner.clone() }
5192 }
5193
5194 fn into_inner(
5195 self,
5196 ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
5197 {
5198 (self.inner, self.is_terminated)
5199 }
5200
5201 fn from_inner(
5202 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
5203 is_terminated: bool,
5204 ) -> Self {
5205 Self { inner, is_terminated }
5206 }
5207}
5208
5209impl futures::Stream for PairingDelegateRequestStream {
5210 type Item = Result<PairingDelegateRequest, fidl::Error>;
5211
5212 fn poll_next(
5213 mut self: std::pin::Pin<&mut Self>,
5214 cx: &mut std::task::Context<'_>,
5215 ) -> std::task::Poll<Option<Self::Item>> {
5216 let this = &mut *self;
5217 if this.inner.check_shutdown(cx) {
5218 this.is_terminated = true;
5219 return std::task::Poll::Ready(None);
5220 }
5221 if this.is_terminated {
5222 panic!("polled PairingDelegateRequestStream after completion");
5223 }
5224 fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
5225 |bytes, handles| {
5226 match this.inner.channel().read_etc(cx, bytes, handles) {
5227 std::task::Poll::Ready(Ok(())) => {}
5228 std::task::Poll::Pending => return std::task::Poll::Pending,
5229 std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
5230 this.is_terminated = true;
5231 return std::task::Poll::Ready(None);
5232 }
5233 std::task::Poll::Ready(Err(e)) => {
5234 return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
5235 e.into(),
5236 ))))
5237 }
5238 }
5239
5240 let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
5242
5243 std::task::Poll::Ready(Some(match header.ordinal {
5244 0x5c483a8f97b226b3 => {
5245 header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
5246 let mut req = fidl::new_empty!(
5247 PairingDelegateOnPairingRequestRequest,
5248 fidl::encoding::DefaultFuchsiaResourceDialect
5249 );
5250 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<PairingDelegateOnPairingRequestRequest>(&header, _body_bytes, handles, &mut req)?;
5251 let control_handle =
5252 PairingDelegateControlHandle { inner: this.inner.clone() };
5253 Ok(PairingDelegateRequest::OnPairingRequest {
5254 peer: req.peer,
5255 method: req.method,
5256 displayed_passkey: req.displayed_passkey,
5257
5258 responder: PairingDelegateOnPairingRequestResponder {
5259 control_handle: std::mem::ManuallyDrop::new(control_handle),
5260 tx_id: header.tx_id,
5261 },
5262 })
5263 }
5264 0x5ad8fc9864eba757 => {
5265 header.validate_request_tx_id(fidl::MethodType::OneWay)?;
5266 let mut req = fidl::new_empty!(
5267 PairingDelegateOnPairingCompleteRequest,
5268 fidl::encoding::DefaultFuchsiaResourceDialect
5269 );
5270 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<PairingDelegateOnPairingCompleteRequest>(&header, _body_bytes, handles, &mut req)?;
5271 let control_handle =
5272 PairingDelegateControlHandle { inner: this.inner.clone() };
5273 Ok(PairingDelegateRequest::OnPairingComplete {
5274 id: req.id,
5275 success: req.success,
5276
5277 control_handle,
5278 })
5279 }
5280 0x4e341e41c604c724 => {
5281 header.validate_request_tx_id(fidl::MethodType::OneWay)?;
5282 let mut req = fidl::new_empty!(
5283 PairingDelegateOnRemoteKeypressRequest,
5284 fidl::encoding::DefaultFuchsiaResourceDialect
5285 );
5286 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<PairingDelegateOnRemoteKeypressRequest>(&header, _body_bytes, handles, &mut req)?;
5287 let control_handle =
5288 PairingDelegateControlHandle { inner: this.inner.clone() };
5289 Ok(PairingDelegateRequest::OnRemoteKeypress {
5290 id: req.id,
5291 keypress: req.keypress,
5292
5293 control_handle,
5294 })
5295 }
5296 _ => Err(fidl::Error::UnknownOrdinal {
5297 ordinal: header.ordinal,
5298 protocol_name:
5299 <PairingDelegateMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
5300 }),
5301 }))
5302 },
5303 )
5304 }
5305}
5306
5307#[derive(Debug)]
5319pub enum PairingDelegateRequest {
5320 OnPairingRequest {
5339 peer: Peer,
5340 method: PairingMethod,
5341 displayed_passkey: u32,
5342 responder: PairingDelegateOnPairingRequestResponder,
5343 },
5344 OnPairingComplete {
5350 id: fidl_fuchsia_bluetooth::PeerId,
5351 success: bool,
5352 control_handle: PairingDelegateControlHandle,
5353 },
5354 OnRemoteKeypress {
5368 id: fidl_fuchsia_bluetooth::PeerId,
5369 keypress: PairingKeypress,
5370 control_handle: PairingDelegateControlHandle,
5371 },
5372}
5373
5374impl PairingDelegateRequest {
5375 #[allow(irrefutable_let_patterns)]
5376 pub fn into_on_pairing_request(
5377 self,
5378 ) -> Option<(Peer, PairingMethod, u32, PairingDelegateOnPairingRequestResponder)> {
5379 if let PairingDelegateRequest::OnPairingRequest {
5380 peer,
5381 method,
5382 displayed_passkey,
5383 responder,
5384 } = self
5385 {
5386 Some((peer, method, displayed_passkey, responder))
5387 } else {
5388 None
5389 }
5390 }
5391
5392 #[allow(irrefutable_let_patterns)]
5393 pub fn into_on_pairing_complete(
5394 self,
5395 ) -> Option<(fidl_fuchsia_bluetooth::PeerId, bool, PairingDelegateControlHandle)> {
5396 if let PairingDelegateRequest::OnPairingComplete { id, success, control_handle } = self {
5397 Some((id, success, control_handle))
5398 } else {
5399 None
5400 }
5401 }
5402
5403 #[allow(irrefutable_let_patterns)]
5404 pub fn into_on_remote_keypress(
5405 self,
5406 ) -> Option<(fidl_fuchsia_bluetooth::PeerId, PairingKeypress, PairingDelegateControlHandle)>
5407 {
5408 if let PairingDelegateRequest::OnRemoteKeypress { id, keypress, control_handle } = self {
5409 Some((id, keypress, control_handle))
5410 } else {
5411 None
5412 }
5413 }
5414
5415 pub fn method_name(&self) -> &'static str {
5417 match *self {
5418 PairingDelegateRequest::OnPairingRequest { .. } => "on_pairing_request",
5419 PairingDelegateRequest::OnPairingComplete { .. } => "on_pairing_complete",
5420 PairingDelegateRequest::OnRemoteKeypress { .. } => "on_remote_keypress",
5421 }
5422 }
5423}
5424
5425#[derive(Debug, Clone)]
5426pub struct PairingDelegateControlHandle {
5427 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
5428}
5429
5430impl fidl::endpoints::ControlHandle for PairingDelegateControlHandle {
5431 fn shutdown(&self) {
5432 self.inner.shutdown()
5433 }
5434 fn shutdown_with_epitaph(&self, status: zx_status::Status) {
5435 self.inner.shutdown_with_epitaph(status)
5436 }
5437
5438 fn is_closed(&self) -> bool {
5439 self.inner.channel().is_closed()
5440 }
5441 fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
5442 self.inner.channel().on_closed()
5443 }
5444
5445 #[cfg(target_os = "fuchsia")]
5446 fn signal_peer(
5447 &self,
5448 clear_mask: zx::Signals,
5449 set_mask: zx::Signals,
5450 ) -> Result<(), zx_status::Status> {
5451 use fidl::Peered;
5452 self.inner.channel().signal_peer(clear_mask, set_mask)
5453 }
5454}
5455
5456impl PairingDelegateControlHandle {
5457 pub fn send_on_local_keypress(
5458 &self,
5459 mut id: &fidl_fuchsia_bluetooth::PeerId,
5460 mut keypress: PairingKeypress,
5461 ) -> Result<(), fidl::Error> {
5462 self.inner.send::<PairingDelegateOnLocalKeypressRequest>(
5463 (id, keypress),
5464 0,
5465 0x1a764c0428878889,
5466 fidl::encoding::DynamicFlags::empty(),
5467 )
5468 }
5469}
5470
5471#[must_use = "FIDL methods require a response to be sent"]
5472#[derive(Debug)]
5473pub struct PairingDelegateOnPairingRequestResponder {
5474 control_handle: std::mem::ManuallyDrop<PairingDelegateControlHandle>,
5475 tx_id: u32,
5476}
5477
5478impl std::ops::Drop for PairingDelegateOnPairingRequestResponder {
5482 fn drop(&mut self) {
5483 self.control_handle.shutdown();
5484 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
5486 }
5487}
5488
5489impl fidl::endpoints::Responder for PairingDelegateOnPairingRequestResponder {
5490 type ControlHandle = PairingDelegateControlHandle;
5491
5492 fn control_handle(&self) -> &PairingDelegateControlHandle {
5493 &self.control_handle
5494 }
5495
5496 fn drop_without_shutdown(mut self) {
5497 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
5499 std::mem::forget(self);
5501 }
5502}
5503
5504impl PairingDelegateOnPairingRequestResponder {
5505 pub fn send(self, mut accept: bool, mut entered_passkey: u32) -> Result<(), fidl::Error> {
5509 let _result = self.send_raw(accept, entered_passkey);
5510 if _result.is_err() {
5511 self.control_handle.shutdown();
5512 }
5513 self.drop_without_shutdown();
5514 _result
5515 }
5516
5517 pub fn send_no_shutdown_on_err(
5519 self,
5520 mut accept: bool,
5521 mut entered_passkey: u32,
5522 ) -> Result<(), fidl::Error> {
5523 let _result = self.send_raw(accept, entered_passkey);
5524 self.drop_without_shutdown();
5525 _result
5526 }
5527
5528 fn send_raw(&self, mut accept: bool, mut entered_passkey: u32) -> Result<(), fidl::Error> {
5529 self.control_handle.inner.send::<PairingDelegateOnPairingRequestResponse>(
5530 (accept, entered_passkey),
5531 self.tx_id,
5532 0x5c483a8f97b226b3,
5533 fidl::encoding::DynamicFlags::empty(),
5534 )
5535 }
5536}
5537
5538#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
5539pub struct PairingDelegate2Marker;
5540
5541impl fidl::endpoints::ProtocolMarker for PairingDelegate2Marker {
5542 type Proxy = PairingDelegate2Proxy;
5543 type RequestStream = PairingDelegate2RequestStream;
5544 #[cfg(target_os = "fuchsia")]
5545 type SynchronousProxy = PairingDelegate2SynchronousProxy;
5546
5547 const DEBUG_NAME: &'static str = "(anonymous) PairingDelegate2";
5548}
5549
5550pub trait PairingDelegate2ProxyInterface: Send + Sync {
5551 fn r#start_request(
5552 &self,
5553 payload: PairingDelegate2StartRequestRequest,
5554 ) -> Result<(), fidl::Error>;
5555 fn r#request_complete(
5556 &self,
5557 id: &fidl_fuchsia_bluetooth::PeerId,
5558 success: bool,
5559 ) -> Result<(), fidl::Error>;
5560}
5561#[derive(Debug)]
5562#[cfg(target_os = "fuchsia")]
5563pub struct PairingDelegate2SynchronousProxy {
5564 client: fidl::client::sync::Client,
5565}
5566
5567#[cfg(target_os = "fuchsia")]
5568impl fidl::endpoints::SynchronousProxy for PairingDelegate2SynchronousProxy {
5569 type Proxy = PairingDelegate2Proxy;
5570 type Protocol = PairingDelegate2Marker;
5571
5572 fn from_channel(inner: fidl::Channel) -> Self {
5573 Self::new(inner)
5574 }
5575
5576 fn into_channel(self) -> fidl::Channel {
5577 self.client.into_channel()
5578 }
5579
5580 fn as_channel(&self) -> &fidl::Channel {
5581 self.client.as_channel()
5582 }
5583}
5584
5585#[cfg(target_os = "fuchsia")]
5586impl PairingDelegate2SynchronousProxy {
5587 pub fn new(channel: fidl::Channel) -> Self {
5588 let protocol_name = <PairingDelegate2Marker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
5589 Self { client: fidl::client::sync::Client::new(channel, protocol_name) }
5590 }
5591
5592 pub fn into_channel(self) -> fidl::Channel {
5593 self.client.into_channel()
5594 }
5595
5596 pub fn wait_for_event(
5599 &self,
5600 deadline: zx::MonotonicInstant,
5601 ) -> Result<PairingDelegate2Event, fidl::Error> {
5602 PairingDelegate2Event::decode(self.client.wait_for_event(deadline)?)
5603 }
5604
5605 pub fn r#start_request(
5617 &self,
5618 mut payload: PairingDelegate2StartRequestRequest,
5619 ) -> Result<(), fidl::Error> {
5620 self.client.send::<PairingDelegate2StartRequestRequest>(
5621 &mut payload,
5622 0x2a5ab8092a961a01,
5623 fidl::encoding::DynamicFlags::empty(),
5624 )
5625 }
5626
5627 pub fn r#request_complete(
5634 &self,
5635 mut id: &fidl_fuchsia_bluetooth::PeerId,
5636 mut success: bool,
5637 ) -> Result<(), fidl::Error> {
5638 self.client.send::<PairingDelegate2RequestCompleteRequest>(
5639 (id, success),
5640 0x4b63b44d5dbca192,
5641 fidl::encoding::DynamicFlags::empty(),
5642 )
5643 }
5644}
5645
5646#[cfg(target_os = "fuchsia")]
5647impl From<PairingDelegate2SynchronousProxy> for zx::Handle {
5648 fn from(value: PairingDelegate2SynchronousProxy) -> Self {
5649 value.into_channel().into()
5650 }
5651}
5652
5653#[cfg(target_os = "fuchsia")]
5654impl From<fidl::Channel> for PairingDelegate2SynchronousProxy {
5655 fn from(value: fidl::Channel) -> Self {
5656 Self::new(value)
5657 }
5658}
5659
5660#[cfg(target_os = "fuchsia")]
5661impl fidl::endpoints::FromClient for PairingDelegate2SynchronousProxy {
5662 type Protocol = PairingDelegate2Marker;
5663
5664 fn from_client(value: fidl::endpoints::ClientEnd<PairingDelegate2Marker>) -> Self {
5665 Self::new(value.into_channel())
5666 }
5667}
5668
5669#[derive(Debug, Clone)]
5670pub struct PairingDelegate2Proxy {
5671 client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
5672}
5673
5674impl fidl::endpoints::Proxy for PairingDelegate2Proxy {
5675 type Protocol = PairingDelegate2Marker;
5676
5677 fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
5678 Self::new(inner)
5679 }
5680
5681 fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
5682 self.client.into_channel().map_err(|client| Self { client })
5683 }
5684
5685 fn as_channel(&self) -> &::fidl::AsyncChannel {
5686 self.client.as_channel()
5687 }
5688}
5689
5690impl PairingDelegate2Proxy {
5691 pub fn new(channel: ::fidl::AsyncChannel) -> Self {
5693 let protocol_name = <PairingDelegate2Marker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
5694 Self { client: fidl::client::Client::new(channel, protocol_name) }
5695 }
5696
5697 pub fn take_event_stream(&self) -> PairingDelegate2EventStream {
5703 PairingDelegate2EventStream { event_receiver: self.client.take_event_receiver() }
5704 }
5705
5706 pub fn r#start_request(
5718 &self,
5719 mut payload: PairingDelegate2StartRequestRequest,
5720 ) -> Result<(), fidl::Error> {
5721 PairingDelegate2ProxyInterface::r#start_request(self, payload)
5722 }
5723
5724 pub fn r#request_complete(
5731 &self,
5732 mut id: &fidl_fuchsia_bluetooth::PeerId,
5733 mut success: bool,
5734 ) -> Result<(), fidl::Error> {
5735 PairingDelegate2ProxyInterface::r#request_complete(self, id, success)
5736 }
5737}
5738
5739impl PairingDelegate2ProxyInterface for PairingDelegate2Proxy {
5740 fn r#start_request(
5741 &self,
5742 mut payload: PairingDelegate2StartRequestRequest,
5743 ) -> Result<(), fidl::Error> {
5744 self.client.send::<PairingDelegate2StartRequestRequest>(
5745 &mut payload,
5746 0x2a5ab8092a961a01,
5747 fidl::encoding::DynamicFlags::empty(),
5748 )
5749 }
5750
5751 fn r#request_complete(
5752 &self,
5753 mut id: &fidl_fuchsia_bluetooth::PeerId,
5754 mut success: bool,
5755 ) -> Result<(), fidl::Error> {
5756 self.client.send::<PairingDelegate2RequestCompleteRequest>(
5757 (id, success),
5758 0x4b63b44d5dbca192,
5759 fidl::encoding::DynamicFlags::empty(),
5760 )
5761 }
5762}
5763
5764pub struct PairingDelegate2EventStream {
5765 event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
5766}
5767
5768impl std::marker::Unpin for PairingDelegate2EventStream {}
5769
5770impl futures::stream::FusedStream for PairingDelegate2EventStream {
5771 fn is_terminated(&self) -> bool {
5772 self.event_receiver.is_terminated()
5773 }
5774}
5775
5776impl futures::Stream for PairingDelegate2EventStream {
5777 type Item = Result<PairingDelegate2Event, fidl::Error>;
5778
5779 fn poll_next(
5780 mut self: std::pin::Pin<&mut Self>,
5781 cx: &mut std::task::Context<'_>,
5782 ) -> std::task::Poll<Option<Self::Item>> {
5783 match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
5784 &mut self.event_receiver,
5785 cx
5786 )?) {
5787 Some(buf) => std::task::Poll::Ready(Some(PairingDelegate2Event::decode(buf))),
5788 None => std::task::Poll::Ready(None),
5789 }
5790 }
5791}
5792
5793#[derive(Debug)]
5794pub enum PairingDelegate2Event {}
5795
5796impl PairingDelegate2Event {
5797 fn decode(
5799 mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
5800 ) -> Result<PairingDelegate2Event, fidl::Error> {
5801 let (bytes, _handles) = buf.split_mut();
5802 let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
5803 debug_assert_eq!(tx_header.tx_id, 0);
5804 match tx_header.ordinal {
5805 _ => Err(fidl::Error::UnknownOrdinal {
5806 ordinal: tx_header.ordinal,
5807 protocol_name:
5808 <PairingDelegate2Marker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
5809 }),
5810 }
5811 }
5812}
5813
5814pub struct PairingDelegate2RequestStream {
5816 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
5817 is_terminated: bool,
5818}
5819
5820impl std::marker::Unpin for PairingDelegate2RequestStream {}
5821
5822impl futures::stream::FusedStream for PairingDelegate2RequestStream {
5823 fn is_terminated(&self) -> bool {
5824 self.is_terminated
5825 }
5826}
5827
5828impl fidl::endpoints::RequestStream for PairingDelegate2RequestStream {
5829 type Protocol = PairingDelegate2Marker;
5830 type ControlHandle = PairingDelegate2ControlHandle;
5831
5832 fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
5833 Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
5834 }
5835
5836 fn control_handle(&self) -> Self::ControlHandle {
5837 PairingDelegate2ControlHandle { inner: self.inner.clone() }
5838 }
5839
5840 fn into_inner(
5841 self,
5842 ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
5843 {
5844 (self.inner, self.is_terminated)
5845 }
5846
5847 fn from_inner(
5848 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
5849 is_terminated: bool,
5850 ) -> Self {
5851 Self { inner, is_terminated }
5852 }
5853}
5854
5855impl futures::Stream for PairingDelegate2RequestStream {
5856 type Item = Result<PairingDelegate2Request, fidl::Error>;
5857
5858 fn poll_next(
5859 mut self: std::pin::Pin<&mut Self>,
5860 cx: &mut std::task::Context<'_>,
5861 ) -> std::task::Poll<Option<Self::Item>> {
5862 let this = &mut *self;
5863 if this.inner.check_shutdown(cx) {
5864 this.is_terminated = true;
5865 return std::task::Poll::Ready(None);
5866 }
5867 if this.is_terminated {
5868 panic!("polled PairingDelegate2RequestStream after completion");
5869 }
5870 fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
5871 |bytes, handles| {
5872 match this.inner.channel().read_etc(cx, bytes, handles) {
5873 std::task::Poll::Ready(Ok(())) => {}
5874 std::task::Poll::Pending => return std::task::Poll::Pending,
5875 std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
5876 this.is_terminated = true;
5877 return std::task::Poll::Ready(None);
5878 }
5879 std::task::Poll::Ready(Err(e)) => {
5880 return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
5881 e.into(),
5882 ))))
5883 }
5884 }
5885
5886 let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
5888
5889 std::task::Poll::Ready(Some(match header.ordinal {
5890 0x2a5ab8092a961a01 => {
5891 header.validate_request_tx_id(fidl::MethodType::OneWay)?;
5892 let mut req = fidl::new_empty!(
5893 PairingDelegate2StartRequestRequest,
5894 fidl::encoding::DefaultFuchsiaResourceDialect
5895 );
5896 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<PairingDelegate2StartRequestRequest>(&header, _body_bytes, handles, &mut req)?;
5897 let control_handle =
5898 PairingDelegate2ControlHandle { inner: this.inner.clone() };
5899 Ok(PairingDelegate2Request::StartRequest { payload: req, control_handle })
5900 }
5901 0x4b63b44d5dbca192 => {
5902 header.validate_request_tx_id(fidl::MethodType::OneWay)?;
5903 let mut req = fidl::new_empty!(
5904 PairingDelegate2RequestCompleteRequest,
5905 fidl::encoding::DefaultFuchsiaResourceDialect
5906 );
5907 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<PairingDelegate2RequestCompleteRequest>(&header, _body_bytes, handles, &mut req)?;
5908 let control_handle =
5909 PairingDelegate2ControlHandle { inner: this.inner.clone() };
5910 Ok(PairingDelegate2Request::RequestComplete {
5911 id: req.id,
5912 success: req.success,
5913
5914 control_handle,
5915 })
5916 }
5917 _ => Err(fidl::Error::UnknownOrdinal {
5918 ordinal: header.ordinal,
5919 protocol_name:
5920 <PairingDelegate2Marker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
5921 }),
5922 }))
5923 },
5924 )
5925 }
5926}
5927
5928#[derive(Debug)]
5940pub enum PairingDelegate2Request {
5941 StartRequest {
5953 payload: PairingDelegate2StartRequestRequest,
5954 control_handle: PairingDelegate2ControlHandle,
5955 },
5956 RequestComplete {
5963 id: fidl_fuchsia_bluetooth::PeerId,
5964 success: bool,
5965 control_handle: PairingDelegate2ControlHandle,
5966 },
5967}
5968
5969impl PairingDelegate2Request {
5970 #[allow(irrefutable_let_patterns)]
5971 pub fn into_start_request(
5972 self,
5973 ) -> Option<(PairingDelegate2StartRequestRequest, PairingDelegate2ControlHandle)> {
5974 if let PairingDelegate2Request::StartRequest { payload, control_handle } = self {
5975 Some((payload, control_handle))
5976 } else {
5977 None
5978 }
5979 }
5980
5981 #[allow(irrefutable_let_patterns)]
5982 pub fn into_request_complete(
5983 self,
5984 ) -> Option<(fidl_fuchsia_bluetooth::PeerId, bool, PairingDelegate2ControlHandle)> {
5985 if let PairingDelegate2Request::RequestComplete { id, success, control_handle } = self {
5986 Some((id, success, control_handle))
5987 } else {
5988 None
5989 }
5990 }
5991
5992 pub fn method_name(&self) -> &'static str {
5994 match *self {
5995 PairingDelegate2Request::StartRequest { .. } => "start_request",
5996 PairingDelegate2Request::RequestComplete { .. } => "request_complete",
5997 }
5998 }
5999}
6000
6001#[derive(Debug, Clone)]
6002pub struct PairingDelegate2ControlHandle {
6003 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
6004}
6005
6006impl fidl::endpoints::ControlHandle for PairingDelegate2ControlHandle {
6007 fn shutdown(&self) {
6008 self.inner.shutdown()
6009 }
6010 fn shutdown_with_epitaph(&self, status: zx_status::Status) {
6011 self.inner.shutdown_with_epitaph(status)
6012 }
6013
6014 fn is_closed(&self) -> bool {
6015 self.inner.channel().is_closed()
6016 }
6017 fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
6018 self.inner.channel().on_closed()
6019 }
6020
6021 #[cfg(target_os = "fuchsia")]
6022 fn signal_peer(
6023 &self,
6024 clear_mask: zx::Signals,
6025 set_mask: zx::Signals,
6026 ) -> Result<(), zx_status::Status> {
6027 use fidl::Peered;
6028 self.inner.channel().signal_peer(clear_mask, set_mask)
6029 }
6030}
6031
6032impl PairingDelegate2ControlHandle {}
6033
6034#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
6035pub struct PairingRequestMarker;
6036
6037impl fidl::endpoints::ProtocolMarker for PairingRequestMarker {
6038 type Proxy = PairingRequestProxy;
6039 type RequestStream = PairingRequestRequestStream;
6040 #[cfg(target_os = "fuchsia")]
6041 type SynchronousProxy = PairingRequestSynchronousProxy;
6042
6043 const DEBUG_NAME: &'static str = "(anonymous) PairingRequest";
6044}
6045
6046pub trait PairingRequestProxyInterface: Send + Sync {
6047 fn r#accept(&self, payload: &PairingRequestAcceptRequest) -> Result<(), fidl::Error>;
6048 fn r#reject(&self) -> Result<(), fidl::Error>;
6049 type KeypressResponseFut: std::future::Future<Output = Result<(), fidl::Error>> + Send;
6050 fn r#keypress(&self, keypress: PairingKeypress) -> Self::KeypressResponseFut;
6051}
6052#[derive(Debug)]
6053#[cfg(target_os = "fuchsia")]
6054pub struct PairingRequestSynchronousProxy {
6055 client: fidl::client::sync::Client,
6056}
6057
6058#[cfg(target_os = "fuchsia")]
6059impl fidl::endpoints::SynchronousProxy for PairingRequestSynchronousProxy {
6060 type Proxy = PairingRequestProxy;
6061 type Protocol = PairingRequestMarker;
6062
6063 fn from_channel(inner: fidl::Channel) -> Self {
6064 Self::new(inner)
6065 }
6066
6067 fn into_channel(self) -> fidl::Channel {
6068 self.client.into_channel()
6069 }
6070
6071 fn as_channel(&self) -> &fidl::Channel {
6072 self.client.as_channel()
6073 }
6074}
6075
6076#[cfg(target_os = "fuchsia")]
6077impl PairingRequestSynchronousProxy {
6078 pub fn new(channel: fidl::Channel) -> Self {
6079 let protocol_name = <PairingRequestMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
6080 Self { client: fidl::client::sync::Client::new(channel, protocol_name) }
6081 }
6082
6083 pub fn into_channel(self) -> fidl::Channel {
6084 self.client.into_channel()
6085 }
6086
6087 pub fn wait_for_event(
6090 &self,
6091 deadline: zx::MonotonicInstant,
6092 ) -> Result<PairingRequestEvent, fidl::Error> {
6093 PairingRequestEvent::decode(self.client.wait_for_event(deadline)?)
6094 }
6095
6096 pub fn r#accept(&self, mut payload: &PairingRequestAcceptRequest) -> Result<(), fidl::Error> {
6100 self.client.send::<PairingRequestAcceptRequest>(
6101 payload,
6102 0x67278857ae043a5,
6103 fidl::encoding::DynamicFlags::empty(),
6104 )
6105 }
6106
6107 pub fn r#reject(&self) -> Result<(), fidl::Error> {
6110 self.client.send::<fidl::encoding::EmptyPayload>(
6111 (),
6112 0x550414aec8155cf5,
6113 fidl::encoding::DynamicFlags::empty(),
6114 )
6115 }
6116
6117 pub fn r#keypress(
6121 &self,
6122 mut keypress: PairingKeypress,
6123 ___deadline: zx::MonotonicInstant,
6124 ) -> Result<(), fidl::Error> {
6125 let _response =
6126 self.client.send_query::<PairingRequestKeypressRequest, fidl::encoding::EmptyPayload>(
6127 (keypress,),
6128 0x53948ecc921fbe9b,
6129 fidl::encoding::DynamicFlags::empty(),
6130 ___deadline,
6131 )?;
6132 Ok(_response)
6133 }
6134}
6135
6136#[cfg(target_os = "fuchsia")]
6137impl From<PairingRequestSynchronousProxy> for zx::Handle {
6138 fn from(value: PairingRequestSynchronousProxy) -> Self {
6139 value.into_channel().into()
6140 }
6141}
6142
6143#[cfg(target_os = "fuchsia")]
6144impl From<fidl::Channel> for PairingRequestSynchronousProxy {
6145 fn from(value: fidl::Channel) -> Self {
6146 Self::new(value)
6147 }
6148}
6149
6150#[cfg(target_os = "fuchsia")]
6151impl fidl::endpoints::FromClient for PairingRequestSynchronousProxy {
6152 type Protocol = PairingRequestMarker;
6153
6154 fn from_client(value: fidl::endpoints::ClientEnd<PairingRequestMarker>) -> Self {
6155 Self::new(value.into_channel())
6156 }
6157}
6158
6159#[derive(Debug, Clone)]
6160pub struct PairingRequestProxy {
6161 client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
6162}
6163
6164impl fidl::endpoints::Proxy for PairingRequestProxy {
6165 type Protocol = PairingRequestMarker;
6166
6167 fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
6168 Self::new(inner)
6169 }
6170
6171 fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
6172 self.client.into_channel().map_err(|client| Self { client })
6173 }
6174
6175 fn as_channel(&self) -> &::fidl::AsyncChannel {
6176 self.client.as_channel()
6177 }
6178}
6179
6180impl PairingRequestProxy {
6181 pub fn new(channel: ::fidl::AsyncChannel) -> Self {
6183 let protocol_name = <PairingRequestMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
6184 Self { client: fidl::client::Client::new(channel, protocol_name) }
6185 }
6186
6187 pub fn take_event_stream(&self) -> PairingRequestEventStream {
6193 PairingRequestEventStream { event_receiver: self.client.take_event_receiver() }
6194 }
6195
6196 pub fn r#accept(&self, mut payload: &PairingRequestAcceptRequest) -> Result<(), fidl::Error> {
6200 PairingRequestProxyInterface::r#accept(self, payload)
6201 }
6202
6203 pub fn r#reject(&self) -> Result<(), fidl::Error> {
6206 PairingRequestProxyInterface::r#reject(self)
6207 }
6208
6209 pub fn r#keypress(
6213 &self,
6214 mut keypress: PairingKeypress,
6215 ) -> fidl::client::QueryResponseFut<(), fidl::encoding::DefaultFuchsiaResourceDialect> {
6216 PairingRequestProxyInterface::r#keypress(self, keypress)
6217 }
6218}
6219
6220impl PairingRequestProxyInterface for PairingRequestProxy {
6221 fn r#accept(&self, mut payload: &PairingRequestAcceptRequest) -> Result<(), fidl::Error> {
6222 self.client.send::<PairingRequestAcceptRequest>(
6223 payload,
6224 0x67278857ae043a5,
6225 fidl::encoding::DynamicFlags::empty(),
6226 )
6227 }
6228
6229 fn r#reject(&self) -> Result<(), fidl::Error> {
6230 self.client.send::<fidl::encoding::EmptyPayload>(
6231 (),
6232 0x550414aec8155cf5,
6233 fidl::encoding::DynamicFlags::empty(),
6234 )
6235 }
6236
6237 type KeypressResponseFut =
6238 fidl::client::QueryResponseFut<(), fidl::encoding::DefaultFuchsiaResourceDialect>;
6239 fn r#keypress(&self, mut keypress: PairingKeypress) -> Self::KeypressResponseFut {
6240 fn _decode(
6241 mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
6242 ) -> Result<(), fidl::Error> {
6243 let _response = fidl::client::decode_transaction_body::<
6244 fidl::encoding::EmptyPayload,
6245 fidl::encoding::DefaultFuchsiaResourceDialect,
6246 0x53948ecc921fbe9b,
6247 >(_buf?)?;
6248 Ok(_response)
6249 }
6250 self.client.send_query_and_decode::<PairingRequestKeypressRequest, ()>(
6251 (keypress,),
6252 0x53948ecc921fbe9b,
6253 fidl::encoding::DynamicFlags::empty(),
6254 _decode,
6255 )
6256 }
6257}
6258
6259pub struct PairingRequestEventStream {
6260 event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
6261}
6262
6263impl std::marker::Unpin for PairingRequestEventStream {}
6264
6265impl futures::stream::FusedStream for PairingRequestEventStream {
6266 fn is_terminated(&self) -> bool {
6267 self.event_receiver.is_terminated()
6268 }
6269}
6270
6271impl futures::Stream for PairingRequestEventStream {
6272 type Item = Result<PairingRequestEvent, fidl::Error>;
6273
6274 fn poll_next(
6275 mut self: std::pin::Pin<&mut Self>,
6276 cx: &mut std::task::Context<'_>,
6277 ) -> std::task::Poll<Option<Self::Item>> {
6278 match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
6279 &mut self.event_receiver,
6280 cx
6281 )?) {
6282 Some(buf) => std::task::Poll::Ready(Some(PairingRequestEvent::decode(buf))),
6283 None => std::task::Poll::Ready(None),
6284 }
6285 }
6286}
6287
6288#[derive(Debug)]
6289pub enum PairingRequestEvent {
6290 OnKeypress { keypress: PairingKeypress },
6291 OnComplete { success: bool },
6292}
6293
6294impl PairingRequestEvent {
6295 #[allow(irrefutable_let_patterns)]
6296 pub fn into_on_keypress(self) -> Option<PairingKeypress> {
6297 if let PairingRequestEvent::OnKeypress { keypress } = self {
6298 Some((keypress))
6299 } else {
6300 None
6301 }
6302 }
6303 #[allow(irrefutable_let_patterns)]
6304 pub fn into_on_complete(self) -> Option<bool> {
6305 if let PairingRequestEvent::OnComplete { success } = self {
6306 Some((success))
6307 } else {
6308 None
6309 }
6310 }
6311
6312 fn decode(
6314 mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
6315 ) -> Result<PairingRequestEvent, fidl::Error> {
6316 let (bytes, _handles) = buf.split_mut();
6317 let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
6318 debug_assert_eq!(tx_header.tx_id, 0);
6319 match tx_header.ordinal {
6320 0x71a4802e6a5d1aca => {
6321 let mut out = fidl::new_empty!(
6322 PairingRequestOnKeypressRequest,
6323 fidl::encoding::DefaultFuchsiaResourceDialect
6324 );
6325 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<PairingRequestOnKeypressRequest>(&tx_header, _body_bytes, _handles, &mut out)?;
6326 Ok((PairingRequestEvent::OnKeypress { keypress: out.keypress }))
6327 }
6328 0xd38d3220987bc79 => {
6329 let mut out = fidl::new_empty!(
6330 PairingRequestOnCompleteRequest,
6331 fidl::encoding::DefaultFuchsiaResourceDialect
6332 );
6333 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<PairingRequestOnCompleteRequest>(&tx_header, _body_bytes, _handles, &mut out)?;
6334 Ok((PairingRequestEvent::OnComplete { success: out.success }))
6335 }
6336 _ => Err(fidl::Error::UnknownOrdinal {
6337 ordinal: tx_header.ordinal,
6338 protocol_name:
6339 <PairingRequestMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
6340 }),
6341 }
6342 }
6343}
6344
6345pub struct PairingRequestRequestStream {
6347 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
6348 is_terminated: bool,
6349}
6350
6351impl std::marker::Unpin for PairingRequestRequestStream {}
6352
6353impl futures::stream::FusedStream for PairingRequestRequestStream {
6354 fn is_terminated(&self) -> bool {
6355 self.is_terminated
6356 }
6357}
6358
6359impl fidl::endpoints::RequestStream for PairingRequestRequestStream {
6360 type Protocol = PairingRequestMarker;
6361 type ControlHandle = PairingRequestControlHandle;
6362
6363 fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
6364 Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
6365 }
6366
6367 fn control_handle(&self) -> Self::ControlHandle {
6368 PairingRequestControlHandle { inner: self.inner.clone() }
6369 }
6370
6371 fn into_inner(
6372 self,
6373 ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
6374 {
6375 (self.inner, self.is_terminated)
6376 }
6377
6378 fn from_inner(
6379 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
6380 is_terminated: bool,
6381 ) -> Self {
6382 Self { inner, is_terminated }
6383 }
6384}
6385
6386impl futures::Stream for PairingRequestRequestStream {
6387 type Item = Result<PairingRequestRequest, fidl::Error>;
6388
6389 fn poll_next(
6390 mut self: std::pin::Pin<&mut Self>,
6391 cx: &mut std::task::Context<'_>,
6392 ) -> std::task::Poll<Option<Self::Item>> {
6393 let this = &mut *self;
6394 if this.inner.check_shutdown(cx) {
6395 this.is_terminated = true;
6396 return std::task::Poll::Ready(None);
6397 }
6398 if this.is_terminated {
6399 panic!("polled PairingRequestRequestStream after completion");
6400 }
6401 fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
6402 |bytes, handles| {
6403 match this.inner.channel().read_etc(cx, bytes, handles) {
6404 std::task::Poll::Ready(Ok(())) => {}
6405 std::task::Poll::Pending => return std::task::Poll::Pending,
6406 std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
6407 this.is_terminated = true;
6408 return std::task::Poll::Ready(None);
6409 }
6410 std::task::Poll::Ready(Err(e)) => {
6411 return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
6412 e.into(),
6413 ))))
6414 }
6415 }
6416
6417 let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
6419
6420 std::task::Poll::Ready(Some(match header.ordinal {
6421 0x67278857ae043a5 => {
6422 header.validate_request_tx_id(fidl::MethodType::OneWay)?;
6423 let mut req = fidl::new_empty!(
6424 PairingRequestAcceptRequest,
6425 fidl::encoding::DefaultFuchsiaResourceDialect
6426 );
6427 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<PairingRequestAcceptRequest>(&header, _body_bytes, handles, &mut req)?;
6428 let control_handle =
6429 PairingRequestControlHandle { inner: this.inner.clone() };
6430 Ok(PairingRequestRequest::Accept { payload: req, control_handle })
6431 }
6432 0x550414aec8155cf5 => {
6433 header.validate_request_tx_id(fidl::MethodType::OneWay)?;
6434 let mut req = fidl::new_empty!(
6435 fidl::encoding::EmptyPayload,
6436 fidl::encoding::DefaultFuchsiaResourceDialect
6437 );
6438 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
6439 let control_handle =
6440 PairingRequestControlHandle { inner: this.inner.clone() };
6441 Ok(PairingRequestRequest::Reject { control_handle })
6442 }
6443 0x53948ecc921fbe9b => {
6444 header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
6445 let mut req = fidl::new_empty!(
6446 PairingRequestKeypressRequest,
6447 fidl::encoding::DefaultFuchsiaResourceDialect
6448 );
6449 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<PairingRequestKeypressRequest>(&header, _body_bytes, handles, &mut req)?;
6450 let control_handle =
6451 PairingRequestControlHandle { inner: this.inner.clone() };
6452 Ok(PairingRequestRequest::Keypress {
6453 keypress: req.keypress,
6454
6455 responder: PairingRequestKeypressResponder {
6456 control_handle: std::mem::ManuallyDrop::new(control_handle),
6457 tx_id: header.tx_id,
6458 },
6459 })
6460 }
6461 _ => Err(fidl::Error::UnknownOrdinal {
6462 ordinal: header.ordinal,
6463 protocol_name:
6464 <PairingRequestMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
6465 }),
6466 }))
6467 },
6468 )
6469 }
6470}
6471
6472#[derive(Debug)]
6482pub enum PairingRequestRequest {
6483 Accept { payload: PairingRequestAcceptRequest, control_handle: PairingRequestControlHandle },
6487 Reject { control_handle: PairingRequestControlHandle },
6490 Keypress { keypress: PairingKeypress, responder: PairingRequestKeypressResponder },
6494}
6495
6496impl PairingRequestRequest {
6497 #[allow(irrefutable_let_patterns)]
6498 pub fn into_accept(self) -> Option<(PairingRequestAcceptRequest, PairingRequestControlHandle)> {
6499 if let PairingRequestRequest::Accept { payload, control_handle } = self {
6500 Some((payload, control_handle))
6501 } else {
6502 None
6503 }
6504 }
6505
6506 #[allow(irrefutable_let_patterns)]
6507 pub fn into_reject(self) -> Option<(PairingRequestControlHandle)> {
6508 if let PairingRequestRequest::Reject { control_handle } = self {
6509 Some((control_handle))
6510 } else {
6511 None
6512 }
6513 }
6514
6515 #[allow(irrefutable_let_patterns)]
6516 pub fn into_keypress(self) -> Option<(PairingKeypress, PairingRequestKeypressResponder)> {
6517 if let PairingRequestRequest::Keypress { keypress, responder } = self {
6518 Some((keypress, responder))
6519 } else {
6520 None
6521 }
6522 }
6523
6524 pub fn method_name(&self) -> &'static str {
6526 match *self {
6527 PairingRequestRequest::Accept { .. } => "accept",
6528 PairingRequestRequest::Reject { .. } => "reject",
6529 PairingRequestRequest::Keypress { .. } => "keypress",
6530 }
6531 }
6532}
6533
6534#[derive(Debug, Clone)]
6535pub struct PairingRequestControlHandle {
6536 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
6537}
6538
6539impl fidl::endpoints::ControlHandle for PairingRequestControlHandle {
6540 fn shutdown(&self) {
6541 self.inner.shutdown()
6542 }
6543 fn shutdown_with_epitaph(&self, status: zx_status::Status) {
6544 self.inner.shutdown_with_epitaph(status)
6545 }
6546
6547 fn is_closed(&self) -> bool {
6548 self.inner.channel().is_closed()
6549 }
6550 fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
6551 self.inner.channel().on_closed()
6552 }
6553
6554 #[cfg(target_os = "fuchsia")]
6555 fn signal_peer(
6556 &self,
6557 clear_mask: zx::Signals,
6558 set_mask: zx::Signals,
6559 ) -> Result<(), zx_status::Status> {
6560 use fidl::Peered;
6561 self.inner.channel().signal_peer(clear_mask, set_mask)
6562 }
6563}
6564
6565impl PairingRequestControlHandle {
6566 pub fn send_on_keypress(&self, mut keypress: PairingKeypress) -> Result<(), fidl::Error> {
6567 self.inner.send::<PairingRequestOnKeypressRequest>(
6568 (keypress,),
6569 0,
6570 0x71a4802e6a5d1aca,
6571 fidl::encoding::DynamicFlags::empty(),
6572 )
6573 }
6574
6575 pub fn send_on_complete(&self, mut success: bool) -> Result<(), fidl::Error> {
6576 self.inner.send::<PairingRequestOnCompleteRequest>(
6577 (success,),
6578 0,
6579 0xd38d3220987bc79,
6580 fidl::encoding::DynamicFlags::empty(),
6581 )
6582 }
6583}
6584
6585#[must_use = "FIDL methods require a response to be sent"]
6586#[derive(Debug)]
6587pub struct PairingRequestKeypressResponder {
6588 control_handle: std::mem::ManuallyDrop<PairingRequestControlHandle>,
6589 tx_id: u32,
6590}
6591
6592impl std::ops::Drop for PairingRequestKeypressResponder {
6596 fn drop(&mut self) {
6597 self.control_handle.shutdown();
6598 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
6600 }
6601}
6602
6603impl fidl::endpoints::Responder for PairingRequestKeypressResponder {
6604 type ControlHandle = PairingRequestControlHandle;
6605
6606 fn control_handle(&self) -> &PairingRequestControlHandle {
6607 &self.control_handle
6608 }
6609
6610 fn drop_without_shutdown(mut self) {
6611 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
6613 std::mem::forget(self);
6615 }
6616}
6617
6618impl PairingRequestKeypressResponder {
6619 pub fn send(self) -> Result<(), fidl::Error> {
6623 let _result = self.send_raw();
6624 if _result.is_err() {
6625 self.control_handle.shutdown();
6626 }
6627 self.drop_without_shutdown();
6628 _result
6629 }
6630
6631 pub fn send_no_shutdown_on_err(self) -> Result<(), fidl::Error> {
6633 let _result = self.send_raw();
6634 self.drop_without_shutdown();
6635 _result
6636 }
6637
6638 fn send_raw(&self) -> Result<(), fidl::Error> {
6639 self.control_handle.inner.send::<fidl::encoding::EmptyPayload>(
6640 (),
6641 self.tx_id,
6642 0x53948ecc921fbe9b,
6643 fidl::encoding::DynamicFlags::empty(),
6644 )
6645 }
6646}
6647
6648#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
6649pub struct ProcedureTokenMarker;
6650
6651impl fidl::endpoints::ProtocolMarker for ProcedureTokenMarker {
6652 type Proxy = ProcedureTokenProxy;
6653 type RequestStream = ProcedureTokenRequestStream;
6654 #[cfg(target_os = "fuchsia")]
6655 type SynchronousProxy = ProcedureTokenSynchronousProxy;
6656
6657 const DEBUG_NAME: &'static str = "(anonymous) ProcedureToken";
6658}
6659
6660pub trait ProcedureTokenProxyInterface: Send + Sync {}
6661#[derive(Debug)]
6662#[cfg(target_os = "fuchsia")]
6663pub struct ProcedureTokenSynchronousProxy {
6664 client: fidl::client::sync::Client,
6665}
6666
6667#[cfg(target_os = "fuchsia")]
6668impl fidl::endpoints::SynchronousProxy for ProcedureTokenSynchronousProxy {
6669 type Proxy = ProcedureTokenProxy;
6670 type Protocol = ProcedureTokenMarker;
6671
6672 fn from_channel(inner: fidl::Channel) -> Self {
6673 Self::new(inner)
6674 }
6675
6676 fn into_channel(self) -> fidl::Channel {
6677 self.client.into_channel()
6678 }
6679
6680 fn as_channel(&self) -> &fidl::Channel {
6681 self.client.as_channel()
6682 }
6683}
6684
6685#[cfg(target_os = "fuchsia")]
6686impl ProcedureTokenSynchronousProxy {
6687 pub fn new(channel: fidl::Channel) -> Self {
6688 let protocol_name = <ProcedureTokenMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
6689 Self { client: fidl::client::sync::Client::new(channel, protocol_name) }
6690 }
6691
6692 pub fn into_channel(self) -> fidl::Channel {
6693 self.client.into_channel()
6694 }
6695
6696 pub fn wait_for_event(
6699 &self,
6700 deadline: zx::MonotonicInstant,
6701 ) -> Result<ProcedureTokenEvent, fidl::Error> {
6702 ProcedureTokenEvent::decode(self.client.wait_for_event(deadline)?)
6703 }
6704}
6705
6706#[cfg(target_os = "fuchsia")]
6707impl From<ProcedureTokenSynchronousProxy> for zx::Handle {
6708 fn from(value: ProcedureTokenSynchronousProxy) -> Self {
6709 value.into_channel().into()
6710 }
6711}
6712
6713#[cfg(target_os = "fuchsia")]
6714impl From<fidl::Channel> for ProcedureTokenSynchronousProxy {
6715 fn from(value: fidl::Channel) -> Self {
6716 Self::new(value)
6717 }
6718}
6719
6720#[cfg(target_os = "fuchsia")]
6721impl fidl::endpoints::FromClient for ProcedureTokenSynchronousProxy {
6722 type Protocol = ProcedureTokenMarker;
6723
6724 fn from_client(value: fidl::endpoints::ClientEnd<ProcedureTokenMarker>) -> Self {
6725 Self::new(value.into_channel())
6726 }
6727}
6728
6729#[derive(Debug, Clone)]
6730pub struct ProcedureTokenProxy {
6731 client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
6732}
6733
6734impl fidl::endpoints::Proxy for ProcedureTokenProxy {
6735 type Protocol = ProcedureTokenMarker;
6736
6737 fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
6738 Self::new(inner)
6739 }
6740
6741 fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
6742 self.client.into_channel().map_err(|client| Self { client })
6743 }
6744
6745 fn as_channel(&self) -> &::fidl::AsyncChannel {
6746 self.client.as_channel()
6747 }
6748}
6749
6750impl ProcedureTokenProxy {
6751 pub fn new(channel: ::fidl::AsyncChannel) -> Self {
6753 let protocol_name = <ProcedureTokenMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
6754 Self { client: fidl::client::Client::new(channel, protocol_name) }
6755 }
6756
6757 pub fn take_event_stream(&self) -> ProcedureTokenEventStream {
6763 ProcedureTokenEventStream { event_receiver: self.client.take_event_receiver() }
6764 }
6765}
6766
6767impl ProcedureTokenProxyInterface for ProcedureTokenProxy {}
6768
6769pub struct ProcedureTokenEventStream {
6770 event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
6771}
6772
6773impl std::marker::Unpin for ProcedureTokenEventStream {}
6774
6775impl futures::stream::FusedStream for ProcedureTokenEventStream {
6776 fn is_terminated(&self) -> bool {
6777 self.event_receiver.is_terminated()
6778 }
6779}
6780
6781impl futures::Stream for ProcedureTokenEventStream {
6782 type Item = Result<ProcedureTokenEvent, fidl::Error>;
6783
6784 fn poll_next(
6785 mut self: std::pin::Pin<&mut Self>,
6786 cx: &mut std::task::Context<'_>,
6787 ) -> std::task::Poll<Option<Self::Item>> {
6788 match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
6789 &mut self.event_receiver,
6790 cx
6791 )?) {
6792 Some(buf) => std::task::Poll::Ready(Some(ProcedureTokenEvent::decode(buf))),
6793 None => std::task::Poll::Ready(None),
6794 }
6795 }
6796}
6797
6798#[derive(Debug)]
6799pub enum ProcedureTokenEvent {}
6800
6801impl ProcedureTokenEvent {
6802 fn decode(
6804 mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
6805 ) -> Result<ProcedureTokenEvent, fidl::Error> {
6806 let (bytes, _handles) = buf.split_mut();
6807 let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
6808 debug_assert_eq!(tx_header.tx_id, 0);
6809 match tx_header.ordinal {
6810 _ => Err(fidl::Error::UnknownOrdinal {
6811 ordinal: tx_header.ordinal,
6812 protocol_name:
6813 <ProcedureTokenMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
6814 }),
6815 }
6816 }
6817}
6818
6819pub struct ProcedureTokenRequestStream {
6821 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
6822 is_terminated: bool,
6823}
6824
6825impl std::marker::Unpin for ProcedureTokenRequestStream {}
6826
6827impl futures::stream::FusedStream for ProcedureTokenRequestStream {
6828 fn is_terminated(&self) -> bool {
6829 self.is_terminated
6830 }
6831}
6832
6833impl fidl::endpoints::RequestStream for ProcedureTokenRequestStream {
6834 type Protocol = ProcedureTokenMarker;
6835 type ControlHandle = ProcedureTokenControlHandle;
6836
6837 fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
6838 Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
6839 }
6840
6841 fn control_handle(&self) -> Self::ControlHandle {
6842 ProcedureTokenControlHandle { inner: self.inner.clone() }
6843 }
6844
6845 fn into_inner(
6846 self,
6847 ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
6848 {
6849 (self.inner, self.is_terminated)
6850 }
6851
6852 fn from_inner(
6853 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
6854 is_terminated: bool,
6855 ) -> Self {
6856 Self { inner, is_terminated }
6857 }
6858}
6859
6860impl futures::Stream for ProcedureTokenRequestStream {
6861 type Item = Result<ProcedureTokenRequest, fidl::Error>;
6862
6863 fn poll_next(
6864 mut self: std::pin::Pin<&mut Self>,
6865 cx: &mut std::task::Context<'_>,
6866 ) -> std::task::Poll<Option<Self::Item>> {
6867 let this = &mut *self;
6868 if this.inner.check_shutdown(cx) {
6869 this.is_terminated = true;
6870 return std::task::Poll::Ready(None);
6871 }
6872 if this.is_terminated {
6873 panic!("polled ProcedureTokenRequestStream after completion");
6874 }
6875 fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
6876 |bytes, handles| {
6877 match this.inner.channel().read_etc(cx, bytes, handles) {
6878 std::task::Poll::Ready(Ok(())) => {}
6879 std::task::Poll::Pending => return std::task::Poll::Pending,
6880 std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
6881 this.is_terminated = true;
6882 return std::task::Poll::Ready(None);
6883 }
6884 std::task::Poll::Ready(Err(e)) => {
6885 return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
6886 e.into(),
6887 ))))
6888 }
6889 }
6890
6891 let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
6893
6894 std::task::Poll::Ready(Some(match header.ordinal {
6895 _ => Err(fidl::Error::UnknownOrdinal {
6896 ordinal: header.ordinal,
6897 protocol_name:
6898 <ProcedureTokenMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
6899 }),
6900 }))
6901 },
6902 )
6903 }
6904}
6905
6906#[derive(Debug)]
6912pub enum ProcedureTokenRequest {}
6913
6914impl ProcedureTokenRequest {
6915 pub fn method_name(&self) -> &'static str {
6917 match *self {}
6918 }
6919}
6920
6921#[derive(Debug, Clone)]
6922pub struct ProcedureTokenControlHandle {
6923 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
6924}
6925
6926impl fidl::endpoints::ControlHandle for ProcedureTokenControlHandle {
6927 fn shutdown(&self) {
6928 self.inner.shutdown()
6929 }
6930 fn shutdown_with_epitaph(&self, status: zx_status::Status) {
6931 self.inner.shutdown_with_epitaph(status)
6932 }
6933
6934 fn is_closed(&self) -> bool {
6935 self.inner.channel().is_closed()
6936 }
6937 fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
6938 self.inner.channel().on_closed()
6939 }
6940
6941 #[cfg(target_os = "fuchsia")]
6942 fn signal_peer(
6943 &self,
6944 clear_mask: zx::Signals,
6945 set_mask: zx::Signals,
6946 ) -> Result<(), zx_status::Status> {
6947 use fidl::Peered;
6948 self.inner.channel().signal_peer(clear_mask, set_mask)
6949 }
6950}
6951
6952impl ProcedureTokenControlHandle {}
6953
6954mod internal {
6955 use super::*;
6956
6957 impl fidl::encoding::ResourceTypeMarker for AccessMakeDiscoverableRequest {
6958 type Borrowed<'a> = &'a mut Self;
6959 fn take_or_borrow<'a>(
6960 value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
6961 ) -> Self::Borrowed<'a> {
6962 value
6963 }
6964 }
6965
6966 unsafe impl fidl::encoding::TypeMarker for AccessMakeDiscoverableRequest {
6967 type Owned = Self;
6968
6969 #[inline(always)]
6970 fn inline_align(_context: fidl::encoding::Context) -> usize {
6971 4
6972 }
6973
6974 #[inline(always)]
6975 fn inline_size(_context: fidl::encoding::Context) -> usize {
6976 4
6977 }
6978 }
6979
6980 unsafe impl
6981 fidl::encoding::Encode<
6982 AccessMakeDiscoverableRequest,
6983 fidl::encoding::DefaultFuchsiaResourceDialect,
6984 > for &mut AccessMakeDiscoverableRequest
6985 {
6986 #[inline]
6987 unsafe fn encode(
6988 self,
6989 encoder: &mut fidl::encoding::Encoder<
6990 '_,
6991 fidl::encoding::DefaultFuchsiaResourceDialect,
6992 >,
6993 offset: usize,
6994 _depth: fidl::encoding::Depth,
6995 ) -> fidl::Result<()> {
6996 encoder.debug_check_bounds::<AccessMakeDiscoverableRequest>(offset);
6997 fidl::encoding::Encode::<AccessMakeDiscoverableRequest, fidl::encoding::DefaultFuchsiaResourceDialect>::encode(
6999 (
7000 <fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<ProcedureTokenMarker>> as fidl::encoding::ResourceTypeMarker>::take_or_borrow(&mut self.token),
7001 ),
7002 encoder, offset, _depth
7003 )
7004 }
7005 }
7006 unsafe impl<
7007 T0: fidl::encoding::Encode<
7008 fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<ProcedureTokenMarker>>,
7009 fidl::encoding::DefaultFuchsiaResourceDialect,
7010 >,
7011 >
7012 fidl::encoding::Encode<
7013 AccessMakeDiscoverableRequest,
7014 fidl::encoding::DefaultFuchsiaResourceDialect,
7015 > for (T0,)
7016 {
7017 #[inline]
7018 unsafe fn encode(
7019 self,
7020 encoder: &mut fidl::encoding::Encoder<
7021 '_,
7022 fidl::encoding::DefaultFuchsiaResourceDialect,
7023 >,
7024 offset: usize,
7025 depth: fidl::encoding::Depth,
7026 ) -> fidl::Result<()> {
7027 encoder.debug_check_bounds::<AccessMakeDiscoverableRequest>(offset);
7028 self.0.encode(encoder, offset + 0, depth)?;
7032 Ok(())
7033 }
7034 }
7035
7036 impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
7037 for AccessMakeDiscoverableRequest
7038 {
7039 #[inline(always)]
7040 fn new_empty() -> Self {
7041 Self {
7042 token: fidl::new_empty!(
7043 fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<ProcedureTokenMarker>>,
7044 fidl::encoding::DefaultFuchsiaResourceDialect
7045 ),
7046 }
7047 }
7048
7049 #[inline]
7050 unsafe fn decode(
7051 &mut self,
7052 decoder: &mut fidl::encoding::Decoder<
7053 '_,
7054 fidl::encoding::DefaultFuchsiaResourceDialect,
7055 >,
7056 offset: usize,
7057 _depth: fidl::encoding::Depth,
7058 ) -> fidl::Result<()> {
7059 decoder.debug_check_bounds::<Self>(offset);
7060 fidl::decode!(
7062 fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<ProcedureTokenMarker>>,
7063 fidl::encoding::DefaultFuchsiaResourceDialect,
7064 &mut self.token,
7065 decoder,
7066 offset + 0,
7067 _depth
7068 )?;
7069 Ok(())
7070 }
7071 }
7072
7073 impl fidl::encoding::ResourceTypeMarker for AccessSetPairingDelegateRequest {
7074 type Borrowed<'a> = &'a mut Self;
7075 fn take_or_borrow<'a>(
7076 value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
7077 ) -> Self::Borrowed<'a> {
7078 value
7079 }
7080 }
7081
7082 unsafe impl fidl::encoding::TypeMarker for AccessSetPairingDelegateRequest {
7083 type Owned = Self;
7084
7085 #[inline(always)]
7086 fn inline_align(_context: fidl::encoding::Context) -> usize {
7087 4
7088 }
7089
7090 #[inline(always)]
7091 fn inline_size(_context: fidl::encoding::Context) -> usize {
7092 12
7093 }
7094 }
7095
7096 unsafe impl
7097 fidl::encoding::Encode<
7098 AccessSetPairingDelegateRequest,
7099 fidl::encoding::DefaultFuchsiaResourceDialect,
7100 > for &mut AccessSetPairingDelegateRequest
7101 {
7102 #[inline]
7103 unsafe fn encode(
7104 self,
7105 encoder: &mut fidl::encoding::Encoder<
7106 '_,
7107 fidl::encoding::DefaultFuchsiaResourceDialect,
7108 >,
7109 offset: usize,
7110 _depth: fidl::encoding::Depth,
7111 ) -> fidl::Result<()> {
7112 encoder.debug_check_bounds::<AccessSetPairingDelegateRequest>(offset);
7113 fidl::encoding::Encode::<AccessSetPairingDelegateRequest, fidl::encoding::DefaultFuchsiaResourceDialect>::encode(
7115 (
7116 <InputCapability as fidl::encoding::ValueTypeMarker>::borrow(&self.input),
7117 <OutputCapability as fidl::encoding::ValueTypeMarker>::borrow(&self.output),
7118 <fidl::encoding::Endpoint<fidl::endpoints::ClientEnd<PairingDelegateMarker>> as fidl::encoding::ResourceTypeMarker>::take_or_borrow(&mut self.delegate),
7119 ),
7120 encoder, offset, _depth
7121 )
7122 }
7123 }
7124 unsafe impl<
7125 T0: fidl::encoding::Encode<InputCapability, fidl::encoding::DefaultFuchsiaResourceDialect>,
7126 T1: fidl::encoding::Encode<OutputCapability, fidl::encoding::DefaultFuchsiaResourceDialect>,
7127 T2: fidl::encoding::Encode<
7128 fidl::encoding::Endpoint<fidl::endpoints::ClientEnd<PairingDelegateMarker>>,
7129 fidl::encoding::DefaultFuchsiaResourceDialect,
7130 >,
7131 >
7132 fidl::encoding::Encode<
7133 AccessSetPairingDelegateRequest,
7134 fidl::encoding::DefaultFuchsiaResourceDialect,
7135 > for (T0, T1, T2)
7136 {
7137 #[inline]
7138 unsafe fn encode(
7139 self,
7140 encoder: &mut fidl::encoding::Encoder<
7141 '_,
7142 fidl::encoding::DefaultFuchsiaResourceDialect,
7143 >,
7144 offset: usize,
7145 depth: fidl::encoding::Depth,
7146 ) -> fidl::Result<()> {
7147 encoder.debug_check_bounds::<AccessSetPairingDelegateRequest>(offset);
7148 self.0.encode(encoder, offset + 0, depth)?;
7152 self.1.encode(encoder, offset + 4, depth)?;
7153 self.2.encode(encoder, offset + 8, depth)?;
7154 Ok(())
7155 }
7156 }
7157
7158 impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
7159 for AccessSetPairingDelegateRequest
7160 {
7161 #[inline(always)]
7162 fn new_empty() -> Self {
7163 Self {
7164 input: fidl::new_empty!(
7165 InputCapability,
7166 fidl::encoding::DefaultFuchsiaResourceDialect
7167 ),
7168 output: fidl::new_empty!(
7169 OutputCapability,
7170 fidl::encoding::DefaultFuchsiaResourceDialect
7171 ),
7172 delegate: fidl::new_empty!(
7173 fidl::encoding::Endpoint<fidl::endpoints::ClientEnd<PairingDelegateMarker>>,
7174 fidl::encoding::DefaultFuchsiaResourceDialect
7175 ),
7176 }
7177 }
7178
7179 #[inline]
7180 unsafe fn decode(
7181 &mut self,
7182 decoder: &mut fidl::encoding::Decoder<
7183 '_,
7184 fidl::encoding::DefaultFuchsiaResourceDialect,
7185 >,
7186 offset: usize,
7187 _depth: fidl::encoding::Depth,
7188 ) -> fidl::Result<()> {
7189 decoder.debug_check_bounds::<Self>(offset);
7190 fidl::decode!(
7192 InputCapability,
7193 fidl::encoding::DefaultFuchsiaResourceDialect,
7194 &mut self.input,
7195 decoder,
7196 offset + 0,
7197 _depth
7198 )?;
7199 fidl::decode!(
7200 OutputCapability,
7201 fidl::encoding::DefaultFuchsiaResourceDialect,
7202 &mut self.output,
7203 decoder,
7204 offset + 4,
7205 _depth
7206 )?;
7207 fidl::decode!(
7208 fidl::encoding::Endpoint<fidl::endpoints::ClientEnd<PairingDelegateMarker>>,
7209 fidl::encoding::DefaultFuchsiaResourceDialect,
7210 &mut self.delegate,
7211 decoder,
7212 offset + 8,
7213 _depth
7214 )?;
7215 Ok(())
7216 }
7217 }
7218
7219 impl fidl::encoding::ResourceTypeMarker for AccessStartDiscoveryRequest {
7220 type Borrowed<'a> = &'a mut Self;
7221 fn take_or_borrow<'a>(
7222 value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
7223 ) -> Self::Borrowed<'a> {
7224 value
7225 }
7226 }
7227
7228 unsafe impl fidl::encoding::TypeMarker for AccessStartDiscoveryRequest {
7229 type Owned = Self;
7230
7231 #[inline(always)]
7232 fn inline_align(_context: fidl::encoding::Context) -> usize {
7233 4
7234 }
7235
7236 #[inline(always)]
7237 fn inline_size(_context: fidl::encoding::Context) -> usize {
7238 4
7239 }
7240 }
7241
7242 unsafe impl
7243 fidl::encoding::Encode<
7244 AccessStartDiscoveryRequest,
7245 fidl::encoding::DefaultFuchsiaResourceDialect,
7246 > for &mut AccessStartDiscoveryRequest
7247 {
7248 #[inline]
7249 unsafe fn encode(
7250 self,
7251 encoder: &mut fidl::encoding::Encoder<
7252 '_,
7253 fidl::encoding::DefaultFuchsiaResourceDialect,
7254 >,
7255 offset: usize,
7256 _depth: fidl::encoding::Depth,
7257 ) -> fidl::Result<()> {
7258 encoder.debug_check_bounds::<AccessStartDiscoveryRequest>(offset);
7259 fidl::encoding::Encode::<AccessStartDiscoveryRequest, fidl::encoding::DefaultFuchsiaResourceDialect>::encode(
7261 (
7262 <fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<ProcedureTokenMarker>> as fidl::encoding::ResourceTypeMarker>::take_or_borrow(&mut self.token),
7263 ),
7264 encoder, offset, _depth
7265 )
7266 }
7267 }
7268 unsafe impl<
7269 T0: fidl::encoding::Encode<
7270 fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<ProcedureTokenMarker>>,
7271 fidl::encoding::DefaultFuchsiaResourceDialect,
7272 >,
7273 >
7274 fidl::encoding::Encode<
7275 AccessStartDiscoveryRequest,
7276 fidl::encoding::DefaultFuchsiaResourceDialect,
7277 > for (T0,)
7278 {
7279 #[inline]
7280 unsafe fn encode(
7281 self,
7282 encoder: &mut fidl::encoding::Encoder<
7283 '_,
7284 fidl::encoding::DefaultFuchsiaResourceDialect,
7285 >,
7286 offset: usize,
7287 depth: fidl::encoding::Depth,
7288 ) -> fidl::Result<()> {
7289 encoder.debug_check_bounds::<AccessStartDiscoveryRequest>(offset);
7290 self.0.encode(encoder, offset + 0, depth)?;
7294 Ok(())
7295 }
7296 }
7297
7298 impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
7299 for AccessStartDiscoveryRequest
7300 {
7301 #[inline(always)]
7302 fn new_empty() -> Self {
7303 Self {
7304 token: fidl::new_empty!(
7305 fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<ProcedureTokenMarker>>,
7306 fidl::encoding::DefaultFuchsiaResourceDialect
7307 ),
7308 }
7309 }
7310
7311 #[inline]
7312 unsafe fn decode(
7313 &mut self,
7314 decoder: &mut fidl::encoding::Decoder<
7315 '_,
7316 fidl::encoding::DefaultFuchsiaResourceDialect,
7317 >,
7318 offset: usize,
7319 _depth: fidl::encoding::Depth,
7320 ) -> fidl::Result<()> {
7321 decoder.debug_check_bounds::<Self>(offset);
7322 fidl::decode!(
7324 fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<ProcedureTokenMarker>>,
7325 fidl::encoding::DefaultFuchsiaResourceDialect,
7326 &mut self.token,
7327 decoder,
7328 offset + 0,
7329 _depth
7330 )?;
7331 Ok(())
7332 }
7333 }
7334
7335 impl fidl::encoding::ResourceTypeMarker for PairingSetDelegateRequest {
7336 type Borrowed<'a> = &'a mut Self;
7337 fn take_or_borrow<'a>(
7338 value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
7339 ) -> Self::Borrowed<'a> {
7340 value
7341 }
7342 }
7343
7344 unsafe impl fidl::encoding::TypeMarker for PairingSetDelegateRequest {
7345 type Owned = Self;
7346
7347 #[inline(always)]
7348 fn inline_align(_context: fidl::encoding::Context) -> usize {
7349 4
7350 }
7351
7352 #[inline(always)]
7353 fn inline_size(_context: fidl::encoding::Context) -> usize {
7354 12
7355 }
7356 }
7357
7358 unsafe impl
7359 fidl::encoding::Encode<
7360 PairingSetDelegateRequest,
7361 fidl::encoding::DefaultFuchsiaResourceDialect,
7362 > for &mut PairingSetDelegateRequest
7363 {
7364 #[inline]
7365 unsafe fn encode(
7366 self,
7367 encoder: &mut fidl::encoding::Encoder<
7368 '_,
7369 fidl::encoding::DefaultFuchsiaResourceDialect,
7370 >,
7371 offset: usize,
7372 _depth: fidl::encoding::Depth,
7373 ) -> fidl::Result<()> {
7374 encoder.debug_check_bounds::<PairingSetDelegateRequest>(offset);
7375 fidl::encoding::Encode::<PairingSetDelegateRequest, fidl::encoding::DefaultFuchsiaResourceDialect>::encode(
7377 (
7378 <InputCapability as fidl::encoding::ValueTypeMarker>::borrow(&self.input),
7379 <OutputCapability as fidl::encoding::ValueTypeMarker>::borrow(&self.output),
7380 <fidl::encoding::Endpoint<fidl::endpoints::ClientEnd<PairingDelegate2Marker>> as fidl::encoding::ResourceTypeMarker>::take_or_borrow(&mut self.delegate),
7381 ),
7382 encoder, offset, _depth
7383 )
7384 }
7385 }
7386 unsafe impl<
7387 T0: fidl::encoding::Encode<InputCapability, fidl::encoding::DefaultFuchsiaResourceDialect>,
7388 T1: fidl::encoding::Encode<OutputCapability, fidl::encoding::DefaultFuchsiaResourceDialect>,
7389 T2: fidl::encoding::Encode<
7390 fidl::encoding::Endpoint<fidl::endpoints::ClientEnd<PairingDelegate2Marker>>,
7391 fidl::encoding::DefaultFuchsiaResourceDialect,
7392 >,
7393 >
7394 fidl::encoding::Encode<
7395 PairingSetDelegateRequest,
7396 fidl::encoding::DefaultFuchsiaResourceDialect,
7397 > for (T0, T1, T2)
7398 {
7399 #[inline]
7400 unsafe fn encode(
7401 self,
7402 encoder: &mut fidl::encoding::Encoder<
7403 '_,
7404 fidl::encoding::DefaultFuchsiaResourceDialect,
7405 >,
7406 offset: usize,
7407 depth: fidl::encoding::Depth,
7408 ) -> fidl::Result<()> {
7409 encoder.debug_check_bounds::<PairingSetDelegateRequest>(offset);
7410 self.0.encode(encoder, offset + 0, depth)?;
7414 self.1.encode(encoder, offset + 4, depth)?;
7415 self.2.encode(encoder, offset + 8, depth)?;
7416 Ok(())
7417 }
7418 }
7419
7420 impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
7421 for PairingSetDelegateRequest
7422 {
7423 #[inline(always)]
7424 fn new_empty() -> Self {
7425 Self {
7426 input: fidl::new_empty!(
7427 InputCapability,
7428 fidl::encoding::DefaultFuchsiaResourceDialect
7429 ),
7430 output: fidl::new_empty!(
7431 OutputCapability,
7432 fidl::encoding::DefaultFuchsiaResourceDialect
7433 ),
7434 delegate: fidl::new_empty!(
7435 fidl::encoding::Endpoint<fidl::endpoints::ClientEnd<PairingDelegate2Marker>>,
7436 fidl::encoding::DefaultFuchsiaResourceDialect
7437 ),
7438 }
7439 }
7440
7441 #[inline]
7442 unsafe fn decode(
7443 &mut self,
7444 decoder: &mut fidl::encoding::Decoder<
7445 '_,
7446 fidl::encoding::DefaultFuchsiaResourceDialect,
7447 >,
7448 offset: usize,
7449 _depth: fidl::encoding::Depth,
7450 ) -> fidl::Result<()> {
7451 decoder.debug_check_bounds::<Self>(offset);
7452 fidl::decode!(
7454 InputCapability,
7455 fidl::encoding::DefaultFuchsiaResourceDialect,
7456 &mut self.input,
7457 decoder,
7458 offset + 0,
7459 _depth
7460 )?;
7461 fidl::decode!(
7462 OutputCapability,
7463 fidl::encoding::DefaultFuchsiaResourceDialect,
7464 &mut self.output,
7465 decoder,
7466 offset + 4,
7467 _depth
7468 )?;
7469 fidl::decode!(
7470 fidl::encoding::Endpoint<fidl::endpoints::ClientEnd<PairingDelegate2Marker>>,
7471 fidl::encoding::DefaultFuchsiaResourceDialect,
7472 &mut self.delegate,
7473 decoder,
7474 offset + 8,
7475 _depth
7476 )?;
7477 Ok(())
7478 }
7479 }
7480
7481 impl fidl::encoding::ResourceTypeMarker for PairingSetPairingDelegateRequest {
7482 type Borrowed<'a> = &'a mut Self;
7483 fn take_or_borrow<'a>(
7484 value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
7485 ) -> Self::Borrowed<'a> {
7486 value
7487 }
7488 }
7489
7490 unsafe impl fidl::encoding::TypeMarker for PairingSetPairingDelegateRequest {
7491 type Owned = Self;
7492
7493 #[inline(always)]
7494 fn inline_align(_context: fidl::encoding::Context) -> usize {
7495 4
7496 }
7497
7498 #[inline(always)]
7499 fn inline_size(_context: fidl::encoding::Context) -> usize {
7500 12
7501 }
7502 }
7503
7504 unsafe impl
7505 fidl::encoding::Encode<
7506 PairingSetPairingDelegateRequest,
7507 fidl::encoding::DefaultFuchsiaResourceDialect,
7508 > for &mut PairingSetPairingDelegateRequest
7509 {
7510 #[inline]
7511 unsafe fn encode(
7512 self,
7513 encoder: &mut fidl::encoding::Encoder<
7514 '_,
7515 fidl::encoding::DefaultFuchsiaResourceDialect,
7516 >,
7517 offset: usize,
7518 _depth: fidl::encoding::Depth,
7519 ) -> fidl::Result<()> {
7520 encoder.debug_check_bounds::<PairingSetPairingDelegateRequest>(offset);
7521 fidl::encoding::Encode::<PairingSetPairingDelegateRequest, fidl::encoding::DefaultFuchsiaResourceDialect>::encode(
7523 (
7524 <InputCapability as fidl::encoding::ValueTypeMarker>::borrow(&self.input),
7525 <OutputCapability as fidl::encoding::ValueTypeMarker>::borrow(&self.output),
7526 <fidl::encoding::Endpoint<fidl::endpoints::ClientEnd<PairingDelegateMarker>> as fidl::encoding::ResourceTypeMarker>::take_or_borrow(&mut self.delegate),
7527 ),
7528 encoder, offset, _depth
7529 )
7530 }
7531 }
7532 unsafe impl<
7533 T0: fidl::encoding::Encode<InputCapability, fidl::encoding::DefaultFuchsiaResourceDialect>,
7534 T1: fidl::encoding::Encode<OutputCapability, fidl::encoding::DefaultFuchsiaResourceDialect>,
7535 T2: fidl::encoding::Encode<
7536 fidl::encoding::Endpoint<fidl::endpoints::ClientEnd<PairingDelegateMarker>>,
7537 fidl::encoding::DefaultFuchsiaResourceDialect,
7538 >,
7539 >
7540 fidl::encoding::Encode<
7541 PairingSetPairingDelegateRequest,
7542 fidl::encoding::DefaultFuchsiaResourceDialect,
7543 > for (T0, T1, T2)
7544 {
7545 #[inline]
7546 unsafe fn encode(
7547 self,
7548 encoder: &mut fidl::encoding::Encoder<
7549 '_,
7550 fidl::encoding::DefaultFuchsiaResourceDialect,
7551 >,
7552 offset: usize,
7553 depth: fidl::encoding::Depth,
7554 ) -> fidl::Result<()> {
7555 encoder.debug_check_bounds::<PairingSetPairingDelegateRequest>(offset);
7556 self.0.encode(encoder, offset + 0, depth)?;
7560 self.1.encode(encoder, offset + 4, depth)?;
7561 self.2.encode(encoder, offset + 8, depth)?;
7562 Ok(())
7563 }
7564 }
7565
7566 impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
7567 for PairingSetPairingDelegateRequest
7568 {
7569 #[inline(always)]
7570 fn new_empty() -> Self {
7571 Self {
7572 input: fidl::new_empty!(
7573 InputCapability,
7574 fidl::encoding::DefaultFuchsiaResourceDialect
7575 ),
7576 output: fidl::new_empty!(
7577 OutputCapability,
7578 fidl::encoding::DefaultFuchsiaResourceDialect
7579 ),
7580 delegate: fidl::new_empty!(
7581 fidl::encoding::Endpoint<fidl::endpoints::ClientEnd<PairingDelegateMarker>>,
7582 fidl::encoding::DefaultFuchsiaResourceDialect
7583 ),
7584 }
7585 }
7586
7587 #[inline]
7588 unsafe fn decode(
7589 &mut self,
7590 decoder: &mut fidl::encoding::Decoder<
7591 '_,
7592 fidl::encoding::DefaultFuchsiaResourceDialect,
7593 >,
7594 offset: usize,
7595 _depth: fidl::encoding::Depth,
7596 ) -> fidl::Result<()> {
7597 decoder.debug_check_bounds::<Self>(offset);
7598 fidl::decode!(
7600 InputCapability,
7601 fidl::encoding::DefaultFuchsiaResourceDialect,
7602 &mut self.input,
7603 decoder,
7604 offset + 0,
7605 _depth
7606 )?;
7607 fidl::decode!(
7608 OutputCapability,
7609 fidl::encoding::DefaultFuchsiaResourceDialect,
7610 &mut self.output,
7611 decoder,
7612 offset + 4,
7613 _depth
7614 )?;
7615 fidl::decode!(
7616 fidl::encoding::Endpoint<fidl::endpoints::ClientEnd<PairingDelegateMarker>>,
7617 fidl::encoding::DefaultFuchsiaResourceDialect,
7618 &mut self.delegate,
7619 decoder,
7620 offset + 8,
7621 _depth
7622 )?;
7623 Ok(())
7624 }
7625 }
7626
7627 impl AccessSetConnectionPolicyRequest {
7628 #[inline(always)]
7629 fn max_ordinal_present(&self) -> u64 {
7630 if let Some(_) = self.suppress_bredr_connections {
7631 return 1;
7632 }
7633 0
7634 }
7635 }
7636
7637 impl fidl::encoding::ResourceTypeMarker for AccessSetConnectionPolicyRequest {
7638 type Borrowed<'a> = &'a mut Self;
7639 fn take_or_borrow<'a>(
7640 value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
7641 ) -> Self::Borrowed<'a> {
7642 value
7643 }
7644 }
7645
7646 unsafe impl fidl::encoding::TypeMarker for AccessSetConnectionPolicyRequest {
7647 type Owned = Self;
7648
7649 #[inline(always)]
7650 fn inline_align(_context: fidl::encoding::Context) -> usize {
7651 8
7652 }
7653
7654 #[inline(always)]
7655 fn inline_size(_context: fidl::encoding::Context) -> usize {
7656 16
7657 }
7658 }
7659
7660 unsafe impl
7661 fidl::encoding::Encode<
7662 AccessSetConnectionPolicyRequest,
7663 fidl::encoding::DefaultFuchsiaResourceDialect,
7664 > for &mut AccessSetConnectionPolicyRequest
7665 {
7666 unsafe fn encode(
7667 self,
7668 encoder: &mut fidl::encoding::Encoder<
7669 '_,
7670 fidl::encoding::DefaultFuchsiaResourceDialect,
7671 >,
7672 offset: usize,
7673 mut depth: fidl::encoding::Depth,
7674 ) -> fidl::Result<()> {
7675 encoder.debug_check_bounds::<AccessSetConnectionPolicyRequest>(offset);
7676 let max_ordinal: u64 = self.max_ordinal_present();
7678 encoder.write_num(max_ordinal, offset);
7679 encoder.write_num(fidl::encoding::ALLOC_PRESENT_U64, offset + 8);
7680 if max_ordinal == 0 {
7682 return Ok(());
7683 }
7684 depth.increment()?;
7685 let envelope_size = 8;
7686 let bytes_len = max_ordinal as usize * envelope_size;
7687 #[allow(unused_variables)]
7688 let offset = encoder.out_of_line_offset(bytes_len);
7689 let mut _prev_end_offset: usize = 0;
7690 if 1 > max_ordinal {
7691 return Ok(());
7692 }
7693
7694 let cur_offset: usize = (1 - 1) * envelope_size;
7697
7698 encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
7700
7701 fidl::encoding::encode_in_envelope_optional::<fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<ProcedureTokenMarker>>, fidl::encoding::DefaultFuchsiaResourceDialect>(
7706 self.suppress_bredr_connections.as_mut().map(<fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<ProcedureTokenMarker>> as fidl::encoding::ResourceTypeMarker>::take_or_borrow),
7707 encoder, offset + cur_offset, depth
7708 )?;
7709
7710 _prev_end_offset = cur_offset + envelope_size;
7711
7712 Ok(())
7713 }
7714 }
7715
7716 impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
7717 for AccessSetConnectionPolicyRequest
7718 {
7719 #[inline(always)]
7720 fn new_empty() -> Self {
7721 Self::default()
7722 }
7723
7724 unsafe fn decode(
7725 &mut self,
7726 decoder: &mut fidl::encoding::Decoder<
7727 '_,
7728 fidl::encoding::DefaultFuchsiaResourceDialect,
7729 >,
7730 offset: usize,
7731 mut depth: fidl::encoding::Depth,
7732 ) -> fidl::Result<()> {
7733 decoder.debug_check_bounds::<Self>(offset);
7734 let len = match fidl::encoding::decode_vector_header(decoder, offset)? {
7735 None => return Err(fidl::Error::NotNullable),
7736 Some(len) => len,
7737 };
7738 if len == 0 {
7740 return Ok(());
7741 };
7742 depth.increment()?;
7743 let envelope_size = 8;
7744 let bytes_len = len * envelope_size;
7745 let offset = decoder.out_of_line_offset(bytes_len)?;
7746 let mut _next_ordinal_to_read = 0;
7748 let mut next_offset = offset;
7749 let end_offset = offset + bytes_len;
7750 _next_ordinal_to_read += 1;
7751 if next_offset >= end_offset {
7752 return Ok(());
7753 }
7754
7755 while _next_ordinal_to_read < 1 {
7757 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
7758 _next_ordinal_to_read += 1;
7759 next_offset += envelope_size;
7760 }
7761
7762 let next_out_of_line = decoder.next_out_of_line();
7763 let handles_before = decoder.remaining_handles();
7764 if let Some((inlined, num_bytes, num_handles)) =
7765 fidl::encoding::decode_envelope_header(decoder, next_offset)?
7766 {
7767 let member_inline_size = <fidl::encoding::Endpoint<
7768 fidl::endpoints::ServerEnd<ProcedureTokenMarker>,
7769 > as fidl::encoding::TypeMarker>::inline_size(
7770 decoder.context
7771 );
7772 if inlined != (member_inline_size <= 4) {
7773 return Err(fidl::Error::InvalidInlineBitInEnvelope);
7774 }
7775 let inner_offset;
7776 let mut inner_depth = depth.clone();
7777 if inlined {
7778 decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
7779 inner_offset = next_offset;
7780 } else {
7781 inner_offset = decoder.out_of_line_offset(member_inline_size)?;
7782 inner_depth.increment()?;
7783 }
7784 let val_ref = self.suppress_bredr_connections.get_or_insert_with(|| {
7785 fidl::new_empty!(
7786 fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<ProcedureTokenMarker>>,
7787 fidl::encoding::DefaultFuchsiaResourceDialect
7788 )
7789 });
7790 fidl::decode!(
7791 fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<ProcedureTokenMarker>>,
7792 fidl::encoding::DefaultFuchsiaResourceDialect,
7793 val_ref,
7794 decoder,
7795 inner_offset,
7796 inner_depth
7797 )?;
7798 if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
7799 {
7800 return Err(fidl::Error::InvalidNumBytesInEnvelope);
7801 }
7802 if handles_before != decoder.remaining_handles() + (num_handles as usize) {
7803 return Err(fidl::Error::InvalidNumHandlesInEnvelope);
7804 }
7805 }
7806
7807 next_offset += envelope_size;
7808
7809 while next_offset < end_offset {
7811 _next_ordinal_to_read += 1;
7812 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
7813 next_offset += envelope_size;
7814 }
7815
7816 Ok(())
7817 }
7818 }
7819
7820 impl PairingDelegate2StartRequestRequest {
7821 #[inline(always)]
7822 fn max_ordinal_present(&self) -> u64 {
7823 if let Some(_) = self.request {
7824 return 3;
7825 }
7826 if let Some(_) = self.info {
7827 return 2;
7828 }
7829 if let Some(_) = self.peer {
7830 return 1;
7831 }
7832 0
7833 }
7834 }
7835
7836 impl fidl::encoding::ResourceTypeMarker for PairingDelegate2StartRequestRequest {
7837 type Borrowed<'a> = &'a mut Self;
7838 fn take_or_borrow<'a>(
7839 value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
7840 ) -> Self::Borrowed<'a> {
7841 value
7842 }
7843 }
7844
7845 unsafe impl fidl::encoding::TypeMarker for PairingDelegate2StartRequestRequest {
7846 type Owned = Self;
7847
7848 #[inline(always)]
7849 fn inline_align(_context: fidl::encoding::Context) -> usize {
7850 8
7851 }
7852
7853 #[inline(always)]
7854 fn inline_size(_context: fidl::encoding::Context) -> usize {
7855 16
7856 }
7857 }
7858
7859 unsafe impl
7860 fidl::encoding::Encode<
7861 PairingDelegate2StartRequestRequest,
7862 fidl::encoding::DefaultFuchsiaResourceDialect,
7863 > for &mut PairingDelegate2StartRequestRequest
7864 {
7865 unsafe fn encode(
7866 self,
7867 encoder: &mut fidl::encoding::Encoder<
7868 '_,
7869 fidl::encoding::DefaultFuchsiaResourceDialect,
7870 >,
7871 offset: usize,
7872 mut depth: fidl::encoding::Depth,
7873 ) -> fidl::Result<()> {
7874 encoder.debug_check_bounds::<PairingDelegate2StartRequestRequest>(offset);
7875 let max_ordinal: u64 = self.max_ordinal_present();
7877 encoder.write_num(max_ordinal, offset);
7878 encoder.write_num(fidl::encoding::ALLOC_PRESENT_U64, offset + 8);
7879 if max_ordinal == 0 {
7881 return Ok(());
7882 }
7883 depth.increment()?;
7884 let envelope_size = 8;
7885 let bytes_len = max_ordinal as usize * envelope_size;
7886 #[allow(unused_variables)]
7887 let offset = encoder.out_of_line_offset(bytes_len);
7888 let mut _prev_end_offset: usize = 0;
7889 if 1 > max_ordinal {
7890 return Ok(());
7891 }
7892
7893 let cur_offset: usize = (1 - 1) * envelope_size;
7896
7897 encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
7899
7900 fidl::encoding::encode_in_envelope_optional::<
7905 Peer,
7906 fidl::encoding::DefaultFuchsiaResourceDialect,
7907 >(
7908 self.peer.as_ref().map(<Peer as fidl::encoding::ValueTypeMarker>::borrow),
7909 encoder,
7910 offset + cur_offset,
7911 depth,
7912 )?;
7913
7914 _prev_end_offset = cur_offset + envelope_size;
7915 if 2 > max_ordinal {
7916 return Ok(());
7917 }
7918
7919 let cur_offset: usize = (2 - 1) * envelope_size;
7922
7923 encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
7925
7926 fidl::encoding::encode_in_envelope_optional::<
7931 PairingProperties,
7932 fidl::encoding::DefaultFuchsiaResourceDialect,
7933 >(
7934 self.info
7935 .as_ref()
7936 .map(<PairingProperties as fidl::encoding::ValueTypeMarker>::borrow),
7937 encoder,
7938 offset + cur_offset,
7939 depth,
7940 )?;
7941
7942 _prev_end_offset = cur_offset + envelope_size;
7943 if 3 > max_ordinal {
7944 return Ok(());
7945 }
7946
7947 let cur_offset: usize = (3 - 1) * envelope_size;
7950
7951 encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
7953
7954 fidl::encoding::encode_in_envelope_optional::<fidl::encoding::Endpoint<fidl::endpoints::ClientEnd<PairingRequestMarker>>, fidl::encoding::DefaultFuchsiaResourceDialect>(
7959 self.request.as_mut().map(<fidl::encoding::Endpoint<fidl::endpoints::ClientEnd<PairingRequestMarker>> as fidl::encoding::ResourceTypeMarker>::take_or_borrow),
7960 encoder, offset + cur_offset, depth
7961 )?;
7962
7963 _prev_end_offset = cur_offset + envelope_size;
7964
7965 Ok(())
7966 }
7967 }
7968
7969 impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
7970 for PairingDelegate2StartRequestRequest
7971 {
7972 #[inline(always)]
7973 fn new_empty() -> Self {
7974 Self::default()
7975 }
7976
7977 unsafe fn decode(
7978 &mut self,
7979 decoder: &mut fidl::encoding::Decoder<
7980 '_,
7981 fidl::encoding::DefaultFuchsiaResourceDialect,
7982 >,
7983 offset: usize,
7984 mut depth: fidl::encoding::Depth,
7985 ) -> fidl::Result<()> {
7986 decoder.debug_check_bounds::<Self>(offset);
7987 let len = match fidl::encoding::decode_vector_header(decoder, offset)? {
7988 None => return Err(fidl::Error::NotNullable),
7989 Some(len) => len,
7990 };
7991 if len == 0 {
7993 return Ok(());
7994 };
7995 depth.increment()?;
7996 let envelope_size = 8;
7997 let bytes_len = len * envelope_size;
7998 let offset = decoder.out_of_line_offset(bytes_len)?;
7999 let mut _next_ordinal_to_read = 0;
8001 let mut next_offset = offset;
8002 let end_offset = offset + bytes_len;
8003 _next_ordinal_to_read += 1;
8004 if next_offset >= end_offset {
8005 return Ok(());
8006 }
8007
8008 while _next_ordinal_to_read < 1 {
8010 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
8011 _next_ordinal_to_read += 1;
8012 next_offset += envelope_size;
8013 }
8014
8015 let next_out_of_line = decoder.next_out_of_line();
8016 let handles_before = decoder.remaining_handles();
8017 if let Some((inlined, num_bytes, num_handles)) =
8018 fidl::encoding::decode_envelope_header(decoder, next_offset)?
8019 {
8020 let member_inline_size =
8021 <Peer as fidl::encoding::TypeMarker>::inline_size(decoder.context);
8022 if inlined != (member_inline_size <= 4) {
8023 return Err(fidl::Error::InvalidInlineBitInEnvelope);
8024 }
8025 let inner_offset;
8026 let mut inner_depth = depth.clone();
8027 if inlined {
8028 decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
8029 inner_offset = next_offset;
8030 } else {
8031 inner_offset = decoder.out_of_line_offset(member_inline_size)?;
8032 inner_depth.increment()?;
8033 }
8034 let val_ref = self.peer.get_or_insert_with(|| {
8035 fidl::new_empty!(Peer, fidl::encoding::DefaultFuchsiaResourceDialect)
8036 });
8037 fidl::decode!(
8038 Peer,
8039 fidl::encoding::DefaultFuchsiaResourceDialect,
8040 val_ref,
8041 decoder,
8042 inner_offset,
8043 inner_depth
8044 )?;
8045 if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
8046 {
8047 return Err(fidl::Error::InvalidNumBytesInEnvelope);
8048 }
8049 if handles_before != decoder.remaining_handles() + (num_handles as usize) {
8050 return Err(fidl::Error::InvalidNumHandlesInEnvelope);
8051 }
8052 }
8053
8054 next_offset += envelope_size;
8055 _next_ordinal_to_read += 1;
8056 if next_offset >= end_offset {
8057 return Ok(());
8058 }
8059
8060 while _next_ordinal_to_read < 2 {
8062 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
8063 _next_ordinal_to_read += 1;
8064 next_offset += envelope_size;
8065 }
8066
8067 let next_out_of_line = decoder.next_out_of_line();
8068 let handles_before = decoder.remaining_handles();
8069 if let Some((inlined, num_bytes, num_handles)) =
8070 fidl::encoding::decode_envelope_header(decoder, next_offset)?
8071 {
8072 let member_inline_size =
8073 <PairingProperties as fidl::encoding::TypeMarker>::inline_size(decoder.context);
8074 if inlined != (member_inline_size <= 4) {
8075 return Err(fidl::Error::InvalidInlineBitInEnvelope);
8076 }
8077 let inner_offset;
8078 let mut inner_depth = depth.clone();
8079 if inlined {
8080 decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
8081 inner_offset = next_offset;
8082 } else {
8083 inner_offset = decoder.out_of_line_offset(member_inline_size)?;
8084 inner_depth.increment()?;
8085 }
8086 let val_ref = self.info.get_or_insert_with(|| {
8087 fidl::new_empty!(
8088 PairingProperties,
8089 fidl::encoding::DefaultFuchsiaResourceDialect
8090 )
8091 });
8092 fidl::decode!(
8093 PairingProperties,
8094 fidl::encoding::DefaultFuchsiaResourceDialect,
8095 val_ref,
8096 decoder,
8097 inner_offset,
8098 inner_depth
8099 )?;
8100 if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
8101 {
8102 return Err(fidl::Error::InvalidNumBytesInEnvelope);
8103 }
8104 if handles_before != decoder.remaining_handles() + (num_handles as usize) {
8105 return Err(fidl::Error::InvalidNumHandlesInEnvelope);
8106 }
8107 }
8108
8109 next_offset += envelope_size;
8110 _next_ordinal_to_read += 1;
8111 if next_offset >= end_offset {
8112 return Ok(());
8113 }
8114
8115 while _next_ordinal_to_read < 3 {
8117 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
8118 _next_ordinal_to_read += 1;
8119 next_offset += envelope_size;
8120 }
8121
8122 let next_out_of_line = decoder.next_out_of_line();
8123 let handles_before = decoder.remaining_handles();
8124 if let Some((inlined, num_bytes, num_handles)) =
8125 fidl::encoding::decode_envelope_header(decoder, next_offset)?
8126 {
8127 let member_inline_size = <fidl::encoding::Endpoint<
8128 fidl::endpoints::ClientEnd<PairingRequestMarker>,
8129 > as fidl::encoding::TypeMarker>::inline_size(
8130 decoder.context
8131 );
8132 if inlined != (member_inline_size <= 4) {
8133 return Err(fidl::Error::InvalidInlineBitInEnvelope);
8134 }
8135 let inner_offset;
8136 let mut inner_depth = depth.clone();
8137 if inlined {
8138 decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
8139 inner_offset = next_offset;
8140 } else {
8141 inner_offset = decoder.out_of_line_offset(member_inline_size)?;
8142 inner_depth.increment()?;
8143 }
8144 let val_ref = self.request.get_or_insert_with(|| {
8145 fidl::new_empty!(
8146 fidl::encoding::Endpoint<fidl::endpoints::ClientEnd<PairingRequestMarker>>,
8147 fidl::encoding::DefaultFuchsiaResourceDialect
8148 )
8149 });
8150 fidl::decode!(
8151 fidl::encoding::Endpoint<fidl::endpoints::ClientEnd<PairingRequestMarker>>,
8152 fidl::encoding::DefaultFuchsiaResourceDialect,
8153 val_ref,
8154 decoder,
8155 inner_offset,
8156 inner_depth
8157 )?;
8158 if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
8159 {
8160 return Err(fidl::Error::InvalidNumBytesInEnvelope);
8161 }
8162 if handles_before != decoder.remaining_handles() + (num_handles as usize) {
8163 return Err(fidl::Error::InvalidNumHandlesInEnvelope);
8164 }
8165 }
8166
8167 next_offset += envelope_size;
8168
8169 while next_offset < end_offset {
8171 _next_ordinal_to_read += 1;
8172 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
8173 next_offset += envelope_size;
8174 }
8175
8176 Ok(())
8177 }
8178 }
8179}