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#[derive(Debug, Clone)]
476pub struct AccessProxy {
477 client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
478}
479
480impl fidl::endpoints::Proxy for AccessProxy {
481 type Protocol = AccessMarker;
482
483 fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
484 Self::new(inner)
485 }
486
487 fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
488 self.client.into_channel().map_err(|client| Self { client })
489 }
490
491 fn as_channel(&self) -> &::fidl::AsyncChannel {
492 self.client.as_channel()
493 }
494}
495
496impl AccessProxy {
497 pub fn new(channel: ::fidl::AsyncChannel) -> Self {
499 let protocol_name = <AccessMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
500 Self { client: fidl::client::Client::new(channel, protocol_name) }
501 }
502
503 pub fn take_event_stream(&self) -> AccessEventStream {
509 AccessEventStream { event_receiver: self.client.take_event_receiver() }
510 }
511
512 pub fn r#set_pairing_delegate(
525 &self,
526 mut input: InputCapability,
527 mut output: OutputCapability,
528 mut delegate: fidl::endpoints::ClientEnd<PairingDelegateMarker>,
529 ) -> Result<(), fidl::Error> {
530 AccessProxyInterface::r#set_pairing_delegate(self, input, output, delegate)
531 }
532
533 pub fn r#set_local_name(&self, mut name: &str) -> Result<(), fidl::Error> {
538 AccessProxyInterface::r#set_local_name(self, name)
539 }
540
541 pub fn r#set_device_class(
546 &self,
547 mut device_class: &fidl_fuchsia_bluetooth::DeviceClass,
548 ) -> Result<(), fidl::Error> {
549 AccessProxyInterface::r#set_device_class(self, device_class)
550 }
551
552 pub fn r#make_discoverable(
560 &self,
561 mut token: fidl::endpoints::ServerEnd<ProcedureTokenMarker>,
562 ) -> fidl::client::QueryResponseFut<
563 AccessMakeDiscoverableResult,
564 fidl::encoding::DefaultFuchsiaResourceDialect,
565 > {
566 AccessProxyInterface::r#make_discoverable(self, token)
567 }
568
569 pub fn r#set_connection_policy(
573 &self,
574 mut payload: AccessSetConnectionPolicyRequest,
575 ) -> fidl::client::QueryResponseFut<
576 AccessSetConnectionPolicyResult,
577 fidl::encoding::DefaultFuchsiaResourceDialect,
578 > {
579 AccessProxyInterface::r#set_connection_policy(self, payload)
580 }
581
582 pub fn r#start_discovery(
591 &self,
592 mut token: fidl::endpoints::ServerEnd<ProcedureTokenMarker>,
593 ) -> fidl::client::QueryResponseFut<
594 AccessStartDiscoveryResult,
595 fidl::encoding::DefaultFuchsiaResourceDialect,
596 > {
597 AccessProxyInterface::r#start_discovery(self, token)
598 }
599
600 pub fn r#watch_peers(
608 &self,
609 ) -> fidl::client::QueryResponseFut<
610 (Vec<Peer>, Vec<fidl_fuchsia_bluetooth::PeerId>),
611 fidl::encoding::DefaultFuchsiaResourceDialect,
612 > {
613 AccessProxyInterface::r#watch_peers(self)
614 }
615
616 pub fn r#connect(
623 &self,
624 mut id: &fidl_fuchsia_bluetooth::PeerId,
625 ) -> fidl::client::QueryResponseFut<
626 AccessConnectResult,
627 fidl::encoding::DefaultFuchsiaResourceDialect,
628 > {
629 AccessProxyInterface::r#connect(self, id)
630 }
631
632 pub fn r#disconnect(
639 &self,
640 mut id: &fidl_fuchsia_bluetooth::PeerId,
641 ) -> fidl::client::QueryResponseFut<
642 AccessDisconnectResult,
643 fidl::encoding::DefaultFuchsiaResourceDialect,
644 > {
645 AccessProxyInterface::r#disconnect(self, id)
646 }
647
648 pub fn r#pair(
667 &self,
668 mut id: &fidl_fuchsia_bluetooth::PeerId,
669 mut options: &PairingOptions,
670 ) -> fidl::client::QueryResponseFut<
671 AccessPairResult,
672 fidl::encoding::DefaultFuchsiaResourceDialect,
673 > {
674 AccessProxyInterface::r#pair(self, id, options)
675 }
676
677 pub fn r#forget(
683 &self,
684 mut id: &fidl_fuchsia_bluetooth::PeerId,
685 ) -> fidl::client::QueryResponseFut<
686 AccessForgetResult,
687 fidl::encoding::DefaultFuchsiaResourceDialect,
688 > {
689 AccessProxyInterface::r#forget(self, id)
690 }
691}
692
693impl AccessProxyInterface for AccessProxy {
694 fn r#set_pairing_delegate(
695 &self,
696 mut input: InputCapability,
697 mut output: OutputCapability,
698 mut delegate: fidl::endpoints::ClientEnd<PairingDelegateMarker>,
699 ) -> Result<(), fidl::Error> {
700 self.client.send::<AccessSetPairingDelegateRequest>(
701 (input, output, delegate),
702 0x4af398e1f4cdb40b,
703 fidl::encoding::DynamicFlags::empty(),
704 )
705 }
706
707 fn r#set_local_name(&self, mut name: &str) -> Result<(), fidl::Error> {
708 self.client.send::<AccessSetLocalNameRequest>(
709 (name,),
710 0x7d12cd2d902206eb,
711 fidl::encoding::DynamicFlags::empty(),
712 )
713 }
714
715 fn r#set_device_class(
716 &self,
717 mut device_class: &fidl_fuchsia_bluetooth::DeviceClass,
718 ) -> Result<(), fidl::Error> {
719 self.client.send::<AccessSetDeviceClassRequest>(
720 (device_class,),
721 0x58dd8f65f589035d,
722 fidl::encoding::DynamicFlags::empty(),
723 )
724 }
725
726 type MakeDiscoverableResponseFut = fidl::client::QueryResponseFut<
727 AccessMakeDiscoverableResult,
728 fidl::encoding::DefaultFuchsiaResourceDialect,
729 >;
730 fn r#make_discoverable(
731 &self,
732 mut token: fidl::endpoints::ServerEnd<ProcedureTokenMarker>,
733 ) -> Self::MakeDiscoverableResponseFut {
734 fn _decode(
735 mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
736 ) -> Result<AccessMakeDiscoverableResult, fidl::Error> {
737 let _response = fidl::client::decode_transaction_body::<
738 fidl::encoding::ResultType<fidl::encoding::EmptyStruct, Error>,
739 fidl::encoding::DefaultFuchsiaResourceDialect,
740 0x747cadf609c96fb1,
741 >(_buf?)?;
742 Ok(_response.map(|x| x))
743 }
744 self.client
745 .send_query_and_decode::<AccessMakeDiscoverableRequest, AccessMakeDiscoverableResult>(
746 (token,),
747 0x747cadf609c96fb1,
748 fidl::encoding::DynamicFlags::empty(),
749 _decode,
750 )
751 }
752
753 type SetConnectionPolicyResponseFut = fidl::client::QueryResponseFut<
754 AccessSetConnectionPolicyResult,
755 fidl::encoding::DefaultFuchsiaResourceDialect,
756 >;
757 fn r#set_connection_policy(
758 &self,
759 mut payload: AccessSetConnectionPolicyRequest,
760 ) -> Self::SetConnectionPolicyResponseFut {
761 fn _decode(
762 mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
763 ) -> Result<AccessSetConnectionPolicyResult, fidl::Error> {
764 let _response = fidl::client::decode_transaction_body::<
765 fidl::encoding::ResultType<fidl::encoding::EmptyStruct, Error>,
766 fidl::encoding::DefaultFuchsiaResourceDialect,
767 0x8e8c7354932fb5a,
768 >(_buf?)?;
769 Ok(_response.map(|x| x))
770 }
771 self.client.send_query_and_decode::<
772 AccessSetConnectionPolicyRequest,
773 AccessSetConnectionPolicyResult,
774 >(
775 &mut payload,
776 0x8e8c7354932fb5a,
777 fidl::encoding::DynamicFlags::empty(),
778 _decode,
779 )
780 }
781
782 type StartDiscoveryResponseFut = fidl::client::QueryResponseFut<
783 AccessStartDiscoveryResult,
784 fidl::encoding::DefaultFuchsiaResourceDialect,
785 >;
786 fn r#start_discovery(
787 &self,
788 mut token: fidl::endpoints::ServerEnd<ProcedureTokenMarker>,
789 ) -> Self::StartDiscoveryResponseFut {
790 fn _decode(
791 mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
792 ) -> Result<AccessStartDiscoveryResult, fidl::Error> {
793 let _response = fidl::client::decode_transaction_body::<
794 fidl::encoding::ResultType<fidl::encoding::EmptyStruct, Error>,
795 fidl::encoding::DefaultFuchsiaResourceDialect,
796 0x6907100d9b99439,
797 >(_buf?)?;
798 Ok(_response.map(|x| x))
799 }
800 self.client
801 .send_query_and_decode::<AccessStartDiscoveryRequest, AccessStartDiscoveryResult>(
802 (token,),
803 0x6907100d9b99439,
804 fidl::encoding::DynamicFlags::empty(),
805 _decode,
806 )
807 }
808
809 type WatchPeersResponseFut = fidl::client::QueryResponseFut<
810 (Vec<Peer>, Vec<fidl_fuchsia_bluetooth::PeerId>),
811 fidl::encoding::DefaultFuchsiaResourceDialect,
812 >;
813 fn r#watch_peers(&self) -> Self::WatchPeersResponseFut {
814 fn _decode(
815 mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
816 ) -> Result<(Vec<Peer>, Vec<fidl_fuchsia_bluetooth::PeerId>), fidl::Error> {
817 let _response = fidl::client::decode_transaction_body::<
818 AccessWatchPeersResponse,
819 fidl::encoding::DefaultFuchsiaResourceDialect,
820 0x1921fe1ed8e6eb7c,
821 >(_buf?)?;
822 Ok((_response.updated, _response.removed))
823 }
824 self.client.send_query_and_decode::<
825 fidl::encoding::EmptyPayload,
826 (Vec<Peer>, Vec<fidl_fuchsia_bluetooth::PeerId>),
827 >(
828 (),
829 0x1921fe1ed8e6eb7c,
830 fidl::encoding::DynamicFlags::empty(),
831 _decode,
832 )
833 }
834
835 type ConnectResponseFut = fidl::client::QueryResponseFut<
836 AccessConnectResult,
837 fidl::encoding::DefaultFuchsiaResourceDialect,
838 >;
839 fn r#connect(&self, mut id: &fidl_fuchsia_bluetooth::PeerId) -> Self::ConnectResponseFut {
840 fn _decode(
841 mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
842 ) -> Result<AccessConnectResult, fidl::Error> {
843 let _response = fidl::client::decode_transaction_body::<
844 fidl::encoding::ResultType<fidl::encoding::EmptyStruct, Error>,
845 fidl::encoding::DefaultFuchsiaResourceDialect,
846 0x1734199789fe7667,
847 >(_buf?)?;
848 Ok(_response.map(|x| x))
849 }
850 self.client.send_query_and_decode::<AccessConnectRequest, AccessConnectResult>(
851 (id,),
852 0x1734199789fe7667,
853 fidl::encoding::DynamicFlags::empty(),
854 _decode,
855 )
856 }
857
858 type DisconnectResponseFut = fidl::client::QueryResponseFut<
859 AccessDisconnectResult,
860 fidl::encoding::DefaultFuchsiaResourceDialect,
861 >;
862 fn r#disconnect(&self, mut id: &fidl_fuchsia_bluetooth::PeerId) -> Self::DisconnectResponseFut {
863 fn _decode(
864 mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
865 ) -> Result<AccessDisconnectResult, fidl::Error> {
866 let _response = fidl::client::decode_transaction_body::<
867 fidl::encoding::ResultType<fidl::encoding::EmptyStruct, Error>,
868 fidl::encoding::DefaultFuchsiaResourceDialect,
869 0x3a4e06d0c6185a5,
870 >(_buf?)?;
871 Ok(_response.map(|x| x))
872 }
873 self.client.send_query_and_decode::<AccessDisconnectRequest, AccessDisconnectResult>(
874 (id,),
875 0x3a4e06d0c6185a5,
876 fidl::encoding::DynamicFlags::empty(),
877 _decode,
878 )
879 }
880
881 type PairResponseFut = fidl::client::QueryResponseFut<
882 AccessPairResult,
883 fidl::encoding::DefaultFuchsiaResourceDialect,
884 >;
885 fn r#pair(
886 &self,
887 mut id: &fidl_fuchsia_bluetooth::PeerId,
888 mut options: &PairingOptions,
889 ) -> Self::PairResponseFut {
890 fn _decode(
891 mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
892 ) -> Result<AccessPairResult, fidl::Error> {
893 let _response = fidl::client::decode_transaction_body::<
894 fidl::encoding::ResultType<fidl::encoding::EmptyStruct, Error>,
895 fidl::encoding::DefaultFuchsiaResourceDialect,
896 0x1d08ea19db327779,
897 >(_buf?)?;
898 Ok(_response.map(|x| x))
899 }
900 self.client.send_query_and_decode::<AccessPairRequest, AccessPairResult>(
901 (id, options),
902 0x1d08ea19db327779,
903 fidl::encoding::DynamicFlags::empty(),
904 _decode,
905 )
906 }
907
908 type ForgetResponseFut = fidl::client::QueryResponseFut<
909 AccessForgetResult,
910 fidl::encoding::DefaultFuchsiaResourceDialect,
911 >;
912 fn r#forget(&self, mut id: &fidl_fuchsia_bluetooth::PeerId) -> Self::ForgetResponseFut {
913 fn _decode(
914 mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
915 ) -> Result<AccessForgetResult, fidl::Error> {
916 let _response = fidl::client::decode_transaction_body::<
917 fidl::encoding::ResultType<fidl::encoding::EmptyStruct, Error>,
918 fidl::encoding::DefaultFuchsiaResourceDialect,
919 0x1fd8e27202854c0,
920 >(_buf?)?;
921 Ok(_response.map(|x| x))
922 }
923 self.client.send_query_and_decode::<AccessForgetRequest, AccessForgetResult>(
924 (id,),
925 0x1fd8e27202854c0,
926 fidl::encoding::DynamicFlags::empty(),
927 _decode,
928 )
929 }
930}
931
932pub struct AccessEventStream {
933 event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
934}
935
936impl std::marker::Unpin for AccessEventStream {}
937
938impl futures::stream::FusedStream for AccessEventStream {
939 fn is_terminated(&self) -> bool {
940 self.event_receiver.is_terminated()
941 }
942}
943
944impl futures::Stream for AccessEventStream {
945 type Item = Result<AccessEvent, fidl::Error>;
946
947 fn poll_next(
948 mut self: std::pin::Pin<&mut Self>,
949 cx: &mut std::task::Context<'_>,
950 ) -> std::task::Poll<Option<Self::Item>> {
951 match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
952 &mut self.event_receiver,
953 cx
954 )?) {
955 Some(buf) => std::task::Poll::Ready(Some(AccessEvent::decode(buf))),
956 None => std::task::Poll::Ready(None),
957 }
958 }
959}
960
961#[derive(Debug)]
962pub enum AccessEvent {}
963
964impl AccessEvent {
965 fn decode(
967 mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
968 ) -> Result<AccessEvent, fidl::Error> {
969 let (bytes, _handles) = buf.split_mut();
970 let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
971 debug_assert_eq!(tx_header.tx_id, 0);
972 match tx_header.ordinal {
973 _ => Err(fidl::Error::UnknownOrdinal {
974 ordinal: tx_header.ordinal,
975 protocol_name: <AccessMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
976 }),
977 }
978 }
979}
980
981pub struct AccessRequestStream {
983 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
984 is_terminated: bool,
985}
986
987impl std::marker::Unpin for AccessRequestStream {}
988
989impl futures::stream::FusedStream for AccessRequestStream {
990 fn is_terminated(&self) -> bool {
991 self.is_terminated
992 }
993}
994
995impl fidl::endpoints::RequestStream for AccessRequestStream {
996 type Protocol = AccessMarker;
997 type ControlHandle = AccessControlHandle;
998
999 fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
1000 Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
1001 }
1002
1003 fn control_handle(&self) -> Self::ControlHandle {
1004 AccessControlHandle { inner: self.inner.clone() }
1005 }
1006
1007 fn into_inner(
1008 self,
1009 ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
1010 {
1011 (self.inner, self.is_terminated)
1012 }
1013
1014 fn from_inner(
1015 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
1016 is_terminated: bool,
1017 ) -> Self {
1018 Self { inner, is_terminated }
1019 }
1020}
1021
1022impl futures::Stream for AccessRequestStream {
1023 type Item = Result<AccessRequest, fidl::Error>;
1024
1025 fn poll_next(
1026 mut self: std::pin::Pin<&mut Self>,
1027 cx: &mut std::task::Context<'_>,
1028 ) -> std::task::Poll<Option<Self::Item>> {
1029 let this = &mut *self;
1030 if this.inner.check_shutdown(cx) {
1031 this.is_terminated = true;
1032 return std::task::Poll::Ready(None);
1033 }
1034 if this.is_terminated {
1035 panic!("polled AccessRequestStream after completion");
1036 }
1037 fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
1038 |bytes, handles| {
1039 match this.inner.channel().read_etc(cx, bytes, handles) {
1040 std::task::Poll::Ready(Ok(())) => {}
1041 std::task::Poll::Pending => return std::task::Poll::Pending,
1042 std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
1043 this.is_terminated = true;
1044 return std::task::Poll::Ready(None);
1045 }
1046 std::task::Poll::Ready(Err(e)) => {
1047 return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
1048 e.into(),
1049 ))))
1050 }
1051 }
1052
1053 let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
1055
1056 std::task::Poll::Ready(Some(match header.ordinal {
1057 0x4af398e1f4cdb40b => {
1058 header.validate_request_tx_id(fidl::MethodType::OneWay)?;
1059 let mut req = fidl::new_empty!(
1060 AccessSetPairingDelegateRequest,
1061 fidl::encoding::DefaultFuchsiaResourceDialect
1062 );
1063 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<AccessSetPairingDelegateRequest>(&header, _body_bytes, handles, &mut req)?;
1064 let control_handle = AccessControlHandle { inner: this.inner.clone() };
1065 Ok(AccessRequest::SetPairingDelegate {
1066 input: req.input,
1067 output: req.output,
1068 delegate: req.delegate,
1069
1070 control_handle,
1071 })
1072 }
1073 0x7d12cd2d902206eb => {
1074 header.validate_request_tx_id(fidl::MethodType::OneWay)?;
1075 let mut req = fidl::new_empty!(
1076 AccessSetLocalNameRequest,
1077 fidl::encoding::DefaultFuchsiaResourceDialect
1078 );
1079 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<AccessSetLocalNameRequest>(&header, _body_bytes, handles, &mut req)?;
1080 let control_handle = AccessControlHandle { inner: this.inner.clone() };
1081 Ok(AccessRequest::SetLocalName { name: req.name, control_handle })
1082 }
1083 0x58dd8f65f589035d => {
1084 header.validate_request_tx_id(fidl::MethodType::OneWay)?;
1085 let mut req = fidl::new_empty!(
1086 AccessSetDeviceClassRequest,
1087 fidl::encoding::DefaultFuchsiaResourceDialect
1088 );
1089 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<AccessSetDeviceClassRequest>(&header, _body_bytes, handles, &mut req)?;
1090 let control_handle = AccessControlHandle { inner: this.inner.clone() };
1091 Ok(AccessRequest::SetDeviceClass {
1092 device_class: req.device_class,
1093
1094 control_handle,
1095 })
1096 }
1097 0x747cadf609c96fb1 => {
1098 header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
1099 let mut req = fidl::new_empty!(
1100 AccessMakeDiscoverableRequest,
1101 fidl::encoding::DefaultFuchsiaResourceDialect
1102 );
1103 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<AccessMakeDiscoverableRequest>(&header, _body_bytes, handles, &mut req)?;
1104 let control_handle = AccessControlHandle { inner: this.inner.clone() };
1105 Ok(AccessRequest::MakeDiscoverable {
1106 token: req.token,
1107
1108 responder: AccessMakeDiscoverableResponder {
1109 control_handle: std::mem::ManuallyDrop::new(control_handle),
1110 tx_id: header.tx_id,
1111 },
1112 })
1113 }
1114 0x8e8c7354932fb5a => {
1115 header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
1116 let mut req = fidl::new_empty!(
1117 AccessSetConnectionPolicyRequest,
1118 fidl::encoding::DefaultFuchsiaResourceDialect
1119 );
1120 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<AccessSetConnectionPolicyRequest>(&header, _body_bytes, handles, &mut req)?;
1121 let control_handle = AccessControlHandle { inner: this.inner.clone() };
1122 Ok(AccessRequest::SetConnectionPolicy {
1123 payload: req,
1124 responder: AccessSetConnectionPolicyResponder {
1125 control_handle: std::mem::ManuallyDrop::new(control_handle),
1126 tx_id: header.tx_id,
1127 },
1128 })
1129 }
1130 0x6907100d9b99439 => {
1131 header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
1132 let mut req = fidl::new_empty!(
1133 AccessStartDiscoveryRequest,
1134 fidl::encoding::DefaultFuchsiaResourceDialect
1135 );
1136 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<AccessStartDiscoveryRequest>(&header, _body_bytes, handles, &mut req)?;
1137 let control_handle = AccessControlHandle { inner: this.inner.clone() };
1138 Ok(AccessRequest::StartDiscovery {
1139 token: req.token,
1140
1141 responder: AccessStartDiscoveryResponder {
1142 control_handle: std::mem::ManuallyDrop::new(control_handle),
1143 tx_id: header.tx_id,
1144 },
1145 })
1146 }
1147 0x1921fe1ed8e6eb7c => {
1148 header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
1149 let mut req = fidl::new_empty!(
1150 fidl::encoding::EmptyPayload,
1151 fidl::encoding::DefaultFuchsiaResourceDialect
1152 );
1153 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
1154 let control_handle = AccessControlHandle { inner: this.inner.clone() };
1155 Ok(AccessRequest::WatchPeers {
1156 responder: AccessWatchPeersResponder {
1157 control_handle: std::mem::ManuallyDrop::new(control_handle),
1158 tx_id: header.tx_id,
1159 },
1160 })
1161 }
1162 0x1734199789fe7667 => {
1163 header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
1164 let mut req = fidl::new_empty!(
1165 AccessConnectRequest,
1166 fidl::encoding::DefaultFuchsiaResourceDialect
1167 );
1168 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<AccessConnectRequest>(&header, _body_bytes, handles, &mut req)?;
1169 let control_handle = AccessControlHandle { inner: this.inner.clone() };
1170 Ok(AccessRequest::Connect {
1171 id: req.id,
1172
1173 responder: AccessConnectResponder {
1174 control_handle: std::mem::ManuallyDrop::new(control_handle),
1175 tx_id: header.tx_id,
1176 },
1177 })
1178 }
1179 0x3a4e06d0c6185a5 => {
1180 header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
1181 let mut req = fidl::new_empty!(
1182 AccessDisconnectRequest,
1183 fidl::encoding::DefaultFuchsiaResourceDialect
1184 );
1185 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<AccessDisconnectRequest>(&header, _body_bytes, handles, &mut req)?;
1186 let control_handle = AccessControlHandle { inner: this.inner.clone() };
1187 Ok(AccessRequest::Disconnect {
1188 id: req.id,
1189
1190 responder: AccessDisconnectResponder {
1191 control_handle: std::mem::ManuallyDrop::new(control_handle),
1192 tx_id: header.tx_id,
1193 },
1194 })
1195 }
1196 0x1d08ea19db327779 => {
1197 header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
1198 let mut req = fidl::new_empty!(
1199 AccessPairRequest,
1200 fidl::encoding::DefaultFuchsiaResourceDialect
1201 );
1202 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<AccessPairRequest>(&header, _body_bytes, handles, &mut req)?;
1203 let control_handle = AccessControlHandle { inner: this.inner.clone() };
1204 Ok(AccessRequest::Pair {
1205 id: req.id,
1206 options: req.options,
1207
1208 responder: AccessPairResponder {
1209 control_handle: std::mem::ManuallyDrop::new(control_handle),
1210 tx_id: header.tx_id,
1211 },
1212 })
1213 }
1214 0x1fd8e27202854c0 => {
1215 header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
1216 let mut req = fidl::new_empty!(
1217 AccessForgetRequest,
1218 fidl::encoding::DefaultFuchsiaResourceDialect
1219 );
1220 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<AccessForgetRequest>(&header, _body_bytes, handles, &mut req)?;
1221 let control_handle = AccessControlHandle { inner: this.inner.clone() };
1222 Ok(AccessRequest::Forget {
1223 id: req.id,
1224
1225 responder: AccessForgetResponder {
1226 control_handle: std::mem::ManuallyDrop::new(control_handle),
1227 tx_id: header.tx_id,
1228 },
1229 })
1230 }
1231 _ => Err(fidl::Error::UnknownOrdinal {
1232 ordinal: header.ordinal,
1233 protocol_name:
1234 <AccessMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
1235 }),
1236 }))
1237 },
1238 )
1239 }
1240}
1241
1242#[derive(Debug)]
1251pub enum AccessRequest {
1252 SetPairingDelegate {
1265 input: InputCapability,
1266 output: OutputCapability,
1267 delegate: fidl::endpoints::ClientEnd<PairingDelegateMarker>,
1268 control_handle: AccessControlHandle,
1269 },
1270 SetLocalName { name: String, control_handle: AccessControlHandle },
1275 SetDeviceClass {
1280 device_class: fidl_fuchsia_bluetooth::DeviceClass,
1281 control_handle: AccessControlHandle,
1282 },
1283 MakeDiscoverable {
1291 token: fidl::endpoints::ServerEnd<ProcedureTokenMarker>,
1292 responder: AccessMakeDiscoverableResponder,
1293 },
1294 SetConnectionPolicy {
1298 payload: AccessSetConnectionPolicyRequest,
1299 responder: AccessSetConnectionPolicyResponder,
1300 },
1301 StartDiscovery {
1310 token: fidl::endpoints::ServerEnd<ProcedureTokenMarker>,
1311 responder: AccessStartDiscoveryResponder,
1312 },
1313 WatchPeers { responder: AccessWatchPeersResponder },
1321 Connect { id: fidl_fuchsia_bluetooth::PeerId, responder: AccessConnectResponder },
1328 Disconnect { id: fidl_fuchsia_bluetooth::PeerId, responder: AccessDisconnectResponder },
1335 Pair {
1354 id: fidl_fuchsia_bluetooth::PeerId,
1355 options: PairingOptions,
1356 responder: AccessPairResponder,
1357 },
1358 Forget { id: fidl_fuchsia_bluetooth::PeerId, responder: AccessForgetResponder },
1364}
1365
1366impl AccessRequest {
1367 #[allow(irrefutable_let_patterns)]
1368 pub fn into_set_pairing_delegate(
1369 self,
1370 ) -> Option<(
1371 InputCapability,
1372 OutputCapability,
1373 fidl::endpoints::ClientEnd<PairingDelegateMarker>,
1374 AccessControlHandle,
1375 )> {
1376 if let AccessRequest::SetPairingDelegate { input, output, delegate, control_handle } = self
1377 {
1378 Some((input, output, delegate, control_handle))
1379 } else {
1380 None
1381 }
1382 }
1383
1384 #[allow(irrefutable_let_patterns)]
1385 pub fn into_set_local_name(self) -> Option<(String, AccessControlHandle)> {
1386 if let AccessRequest::SetLocalName { name, control_handle } = self {
1387 Some((name, control_handle))
1388 } else {
1389 None
1390 }
1391 }
1392
1393 #[allow(irrefutable_let_patterns)]
1394 pub fn into_set_device_class(
1395 self,
1396 ) -> Option<(fidl_fuchsia_bluetooth::DeviceClass, AccessControlHandle)> {
1397 if let AccessRequest::SetDeviceClass { device_class, control_handle } = self {
1398 Some((device_class, control_handle))
1399 } else {
1400 None
1401 }
1402 }
1403
1404 #[allow(irrefutable_let_patterns)]
1405 pub fn into_make_discoverable(
1406 self,
1407 ) -> Option<(fidl::endpoints::ServerEnd<ProcedureTokenMarker>, AccessMakeDiscoverableResponder)>
1408 {
1409 if let AccessRequest::MakeDiscoverable { token, responder } = self {
1410 Some((token, responder))
1411 } else {
1412 None
1413 }
1414 }
1415
1416 #[allow(irrefutable_let_patterns)]
1417 pub fn into_set_connection_policy(
1418 self,
1419 ) -> Option<(AccessSetConnectionPolicyRequest, AccessSetConnectionPolicyResponder)> {
1420 if let AccessRequest::SetConnectionPolicy { payload, responder } = self {
1421 Some((payload, responder))
1422 } else {
1423 None
1424 }
1425 }
1426
1427 #[allow(irrefutable_let_patterns)]
1428 pub fn into_start_discovery(
1429 self,
1430 ) -> Option<(fidl::endpoints::ServerEnd<ProcedureTokenMarker>, AccessStartDiscoveryResponder)>
1431 {
1432 if let AccessRequest::StartDiscovery { token, responder } = self {
1433 Some((token, responder))
1434 } else {
1435 None
1436 }
1437 }
1438
1439 #[allow(irrefutable_let_patterns)]
1440 pub fn into_watch_peers(self) -> Option<(AccessWatchPeersResponder)> {
1441 if let AccessRequest::WatchPeers { responder } = self {
1442 Some((responder))
1443 } else {
1444 None
1445 }
1446 }
1447
1448 #[allow(irrefutable_let_patterns)]
1449 pub fn into_connect(self) -> Option<(fidl_fuchsia_bluetooth::PeerId, AccessConnectResponder)> {
1450 if let AccessRequest::Connect { id, responder } = self {
1451 Some((id, responder))
1452 } else {
1453 None
1454 }
1455 }
1456
1457 #[allow(irrefutable_let_patterns)]
1458 pub fn into_disconnect(
1459 self,
1460 ) -> Option<(fidl_fuchsia_bluetooth::PeerId, AccessDisconnectResponder)> {
1461 if let AccessRequest::Disconnect { id, responder } = self {
1462 Some((id, responder))
1463 } else {
1464 None
1465 }
1466 }
1467
1468 #[allow(irrefutable_let_patterns)]
1469 pub fn into_pair(
1470 self,
1471 ) -> Option<(fidl_fuchsia_bluetooth::PeerId, PairingOptions, AccessPairResponder)> {
1472 if let AccessRequest::Pair { id, options, responder } = self {
1473 Some((id, options, responder))
1474 } else {
1475 None
1476 }
1477 }
1478
1479 #[allow(irrefutable_let_patterns)]
1480 pub fn into_forget(self) -> Option<(fidl_fuchsia_bluetooth::PeerId, AccessForgetResponder)> {
1481 if let AccessRequest::Forget { id, responder } = self {
1482 Some((id, responder))
1483 } else {
1484 None
1485 }
1486 }
1487
1488 pub fn method_name(&self) -> &'static str {
1490 match *self {
1491 AccessRequest::SetPairingDelegate { .. } => "set_pairing_delegate",
1492 AccessRequest::SetLocalName { .. } => "set_local_name",
1493 AccessRequest::SetDeviceClass { .. } => "set_device_class",
1494 AccessRequest::MakeDiscoverable { .. } => "make_discoverable",
1495 AccessRequest::SetConnectionPolicy { .. } => "set_connection_policy",
1496 AccessRequest::StartDiscovery { .. } => "start_discovery",
1497 AccessRequest::WatchPeers { .. } => "watch_peers",
1498 AccessRequest::Connect { .. } => "connect",
1499 AccessRequest::Disconnect { .. } => "disconnect",
1500 AccessRequest::Pair { .. } => "pair",
1501 AccessRequest::Forget { .. } => "forget",
1502 }
1503 }
1504}
1505
1506#[derive(Debug, Clone)]
1507pub struct AccessControlHandle {
1508 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
1509}
1510
1511impl fidl::endpoints::ControlHandle for AccessControlHandle {
1512 fn shutdown(&self) {
1513 self.inner.shutdown()
1514 }
1515 fn shutdown_with_epitaph(&self, status: zx_status::Status) {
1516 self.inner.shutdown_with_epitaph(status)
1517 }
1518
1519 fn is_closed(&self) -> bool {
1520 self.inner.channel().is_closed()
1521 }
1522 fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
1523 self.inner.channel().on_closed()
1524 }
1525
1526 #[cfg(target_os = "fuchsia")]
1527 fn signal_peer(
1528 &self,
1529 clear_mask: zx::Signals,
1530 set_mask: zx::Signals,
1531 ) -> Result<(), zx_status::Status> {
1532 use fidl::Peered;
1533 self.inner.channel().signal_peer(clear_mask, set_mask)
1534 }
1535}
1536
1537impl AccessControlHandle {}
1538
1539#[must_use = "FIDL methods require a response to be sent"]
1540#[derive(Debug)]
1541pub struct AccessMakeDiscoverableResponder {
1542 control_handle: std::mem::ManuallyDrop<AccessControlHandle>,
1543 tx_id: u32,
1544}
1545
1546impl std::ops::Drop for AccessMakeDiscoverableResponder {
1550 fn drop(&mut self) {
1551 self.control_handle.shutdown();
1552 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1554 }
1555}
1556
1557impl fidl::endpoints::Responder for AccessMakeDiscoverableResponder {
1558 type ControlHandle = AccessControlHandle;
1559
1560 fn control_handle(&self) -> &AccessControlHandle {
1561 &self.control_handle
1562 }
1563
1564 fn drop_without_shutdown(mut self) {
1565 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1567 std::mem::forget(self);
1569 }
1570}
1571
1572impl AccessMakeDiscoverableResponder {
1573 pub fn send(self, mut result: Result<(), Error>) -> Result<(), fidl::Error> {
1577 let _result = self.send_raw(result);
1578 if _result.is_err() {
1579 self.control_handle.shutdown();
1580 }
1581 self.drop_without_shutdown();
1582 _result
1583 }
1584
1585 pub fn send_no_shutdown_on_err(self, mut result: Result<(), Error>) -> Result<(), fidl::Error> {
1587 let _result = self.send_raw(result);
1588 self.drop_without_shutdown();
1589 _result
1590 }
1591
1592 fn send_raw(&self, mut result: Result<(), Error>) -> Result<(), fidl::Error> {
1593 self.control_handle
1594 .inner
1595 .send::<fidl::encoding::ResultType<fidl::encoding::EmptyStruct, Error>>(
1596 result,
1597 self.tx_id,
1598 0x747cadf609c96fb1,
1599 fidl::encoding::DynamicFlags::empty(),
1600 )
1601 }
1602}
1603
1604#[must_use = "FIDL methods require a response to be sent"]
1605#[derive(Debug)]
1606pub struct AccessSetConnectionPolicyResponder {
1607 control_handle: std::mem::ManuallyDrop<AccessControlHandle>,
1608 tx_id: u32,
1609}
1610
1611impl std::ops::Drop for AccessSetConnectionPolicyResponder {
1615 fn drop(&mut self) {
1616 self.control_handle.shutdown();
1617 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1619 }
1620}
1621
1622impl fidl::endpoints::Responder for AccessSetConnectionPolicyResponder {
1623 type ControlHandle = AccessControlHandle;
1624
1625 fn control_handle(&self) -> &AccessControlHandle {
1626 &self.control_handle
1627 }
1628
1629 fn drop_without_shutdown(mut self) {
1630 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1632 std::mem::forget(self);
1634 }
1635}
1636
1637impl AccessSetConnectionPolicyResponder {
1638 pub fn send(self, mut result: Result<(), Error>) -> Result<(), fidl::Error> {
1642 let _result = self.send_raw(result);
1643 if _result.is_err() {
1644 self.control_handle.shutdown();
1645 }
1646 self.drop_without_shutdown();
1647 _result
1648 }
1649
1650 pub fn send_no_shutdown_on_err(self, mut result: Result<(), Error>) -> Result<(), fidl::Error> {
1652 let _result = self.send_raw(result);
1653 self.drop_without_shutdown();
1654 _result
1655 }
1656
1657 fn send_raw(&self, mut result: Result<(), Error>) -> Result<(), fidl::Error> {
1658 self.control_handle
1659 .inner
1660 .send::<fidl::encoding::ResultType<fidl::encoding::EmptyStruct, Error>>(
1661 result,
1662 self.tx_id,
1663 0x8e8c7354932fb5a,
1664 fidl::encoding::DynamicFlags::empty(),
1665 )
1666 }
1667}
1668
1669#[must_use = "FIDL methods require a response to be sent"]
1670#[derive(Debug)]
1671pub struct AccessStartDiscoveryResponder {
1672 control_handle: std::mem::ManuallyDrop<AccessControlHandle>,
1673 tx_id: u32,
1674}
1675
1676impl std::ops::Drop for AccessStartDiscoveryResponder {
1680 fn drop(&mut self) {
1681 self.control_handle.shutdown();
1682 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1684 }
1685}
1686
1687impl fidl::endpoints::Responder for AccessStartDiscoveryResponder {
1688 type ControlHandle = AccessControlHandle;
1689
1690 fn control_handle(&self) -> &AccessControlHandle {
1691 &self.control_handle
1692 }
1693
1694 fn drop_without_shutdown(mut self) {
1695 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1697 std::mem::forget(self);
1699 }
1700}
1701
1702impl AccessStartDiscoveryResponder {
1703 pub fn send(self, mut result: Result<(), Error>) -> Result<(), fidl::Error> {
1707 let _result = self.send_raw(result);
1708 if _result.is_err() {
1709 self.control_handle.shutdown();
1710 }
1711 self.drop_without_shutdown();
1712 _result
1713 }
1714
1715 pub fn send_no_shutdown_on_err(self, mut result: Result<(), Error>) -> Result<(), fidl::Error> {
1717 let _result = self.send_raw(result);
1718 self.drop_without_shutdown();
1719 _result
1720 }
1721
1722 fn send_raw(&self, mut result: Result<(), Error>) -> Result<(), fidl::Error> {
1723 self.control_handle
1724 .inner
1725 .send::<fidl::encoding::ResultType<fidl::encoding::EmptyStruct, Error>>(
1726 result,
1727 self.tx_id,
1728 0x6907100d9b99439,
1729 fidl::encoding::DynamicFlags::empty(),
1730 )
1731 }
1732}
1733
1734#[must_use = "FIDL methods require a response to be sent"]
1735#[derive(Debug)]
1736pub struct AccessWatchPeersResponder {
1737 control_handle: std::mem::ManuallyDrop<AccessControlHandle>,
1738 tx_id: u32,
1739}
1740
1741impl std::ops::Drop for AccessWatchPeersResponder {
1745 fn drop(&mut self) {
1746 self.control_handle.shutdown();
1747 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1749 }
1750}
1751
1752impl fidl::endpoints::Responder for AccessWatchPeersResponder {
1753 type ControlHandle = AccessControlHandle;
1754
1755 fn control_handle(&self) -> &AccessControlHandle {
1756 &self.control_handle
1757 }
1758
1759 fn drop_without_shutdown(mut self) {
1760 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1762 std::mem::forget(self);
1764 }
1765}
1766
1767impl AccessWatchPeersResponder {
1768 pub fn send(
1772 self,
1773 mut updated: &[Peer],
1774 mut removed: &[fidl_fuchsia_bluetooth::PeerId],
1775 ) -> Result<(), fidl::Error> {
1776 let _result = self.send_raw(updated, removed);
1777 if _result.is_err() {
1778 self.control_handle.shutdown();
1779 }
1780 self.drop_without_shutdown();
1781 _result
1782 }
1783
1784 pub fn send_no_shutdown_on_err(
1786 self,
1787 mut updated: &[Peer],
1788 mut removed: &[fidl_fuchsia_bluetooth::PeerId],
1789 ) -> Result<(), fidl::Error> {
1790 let _result = self.send_raw(updated, removed);
1791 self.drop_without_shutdown();
1792 _result
1793 }
1794
1795 fn send_raw(
1796 &self,
1797 mut updated: &[Peer],
1798 mut removed: &[fidl_fuchsia_bluetooth::PeerId],
1799 ) -> Result<(), fidl::Error> {
1800 self.control_handle.inner.send::<AccessWatchPeersResponse>(
1801 (updated, removed),
1802 self.tx_id,
1803 0x1921fe1ed8e6eb7c,
1804 fidl::encoding::DynamicFlags::empty(),
1805 )
1806 }
1807}
1808
1809#[must_use = "FIDL methods require a response to be sent"]
1810#[derive(Debug)]
1811pub struct AccessConnectResponder {
1812 control_handle: std::mem::ManuallyDrop<AccessControlHandle>,
1813 tx_id: u32,
1814}
1815
1816impl std::ops::Drop for AccessConnectResponder {
1820 fn drop(&mut self) {
1821 self.control_handle.shutdown();
1822 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1824 }
1825}
1826
1827impl fidl::endpoints::Responder for AccessConnectResponder {
1828 type ControlHandle = AccessControlHandle;
1829
1830 fn control_handle(&self) -> &AccessControlHandle {
1831 &self.control_handle
1832 }
1833
1834 fn drop_without_shutdown(mut self) {
1835 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1837 std::mem::forget(self);
1839 }
1840}
1841
1842impl AccessConnectResponder {
1843 pub fn send(self, mut result: Result<(), Error>) -> Result<(), fidl::Error> {
1847 let _result = self.send_raw(result);
1848 if _result.is_err() {
1849 self.control_handle.shutdown();
1850 }
1851 self.drop_without_shutdown();
1852 _result
1853 }
1854
1855 pub fn send_no_shutdown_on_err(self, mut result: Result<(), Error>) -> Result<(), fidl::Error> {
1857 let _result = self.send_raw(result);
1858 self.drop_without_shutdown();
1859 _result
1860 }
1861
1862 fn send_raw(&self, mut result: Result<(), Error>) -> Result<(), fidl::Error> {
1863 self.control_handle
1864 .inner
1865 .send::<fidl::encoding::ResultType<fidl::encoding::EmptyStruct, Error>>(
1866 result,
1867 self.tx_id,
1868 0x1734199789fe7667,
1869 fidl::encoding::DynamicFlags::empty(),
1870 )
1871 }
1872}
1873
1874#[must_use = "FIDL methods require a response to be sent"]
1875#[derive(Debug)]
1876pub struct AccessDisconnectResponder {
1877 control_handle: std::mem::ManuallyDrop<AccessControlHandle>,
1878 tx_id: u32,
1879}
1880
1881impl std::ops::Drop for AccessDisconnectResponder {
1885 fn drop(&mut self) {
1886 self.control_handle.shutdown();
1887 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1889 }
1890}
1891
1892impl fidl::endpoints::Responder for AccessDisconnectResponder {
1893 type ControlHandle = AccessControlHandle;
1894
1895 fn control_handle(&self) -> &AccessControlHandle {
1896 &self.control_handle
1897 }
1898
1899 fn drop_without_shutdown(mut self) {
1900 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1902 std::mem::forget(self);
1904 }
1905}
1906
1907impl AccessDisconnectResponder {
1908 pub fn send(self, mut result: Result<(), Error>) -> Result<(), fidl::Error> {
1912 let _result = self.send_raw(result);
1913 if _result.is_err() {
1914 self.control_handle.shutdown();
1915 }
1916 self.drop_without_shutdown();
1917 _result
1918 }
1919
1920 pub fn send_no_shutdown_on_err(self, mut result: Result<(), Error>) -> Result<(), fidl::Error> {
1922 let _result = self.send_raw(result);
1923 self.drop_without_shutdown();
1924 _result
1925 }
1926
1927 fn send_raw(&self, mut result: Result<(), Error>) -> Result<(), fidl::Error> {
1928 self.control_handle
1929 .inner
1930 .send::<fidl::encoding::ResultType<fidl::encoding::EmptyStruct, Error>>(
1931 result,
1932 self.tx_id,
1933 0x3a4e06d0c6185a5,
1934 fidl::encoding::DynamicFlags::empty(),
1935 )
1936 }
1937}
1938
1939#[must_use = "FIDL methods require a response to be sent"]
1940#[derive(Debug)]
1941pub struct AccessPairResponder {
1942 control_handle: std::mem::ManuallyDrop<AccessControlHandle>,
1943 tx_id: u32,
1944}
1945
1946impl std::ops::Drop for AccessPairResponder {
1950 fn drop(&mut self) {
1951 self.control_handle.shutdown();
1952 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1954 }
1955}
1956
1957impl fidl::endpoints::Responder for AccessPairResponder {
1958 type ControlHandle = AccessControlHandle;
1959
1960 fn control_handle(&self) -> &AccessControlHandle {
1961 &self.control_handle
1962 }
1963
1964 fn drop_without_shutdown(mut self) {
1965 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1967 std::mem::forget(self);
1969 }
1970}
1971
1972impl AccessPairResponder {
1973 pub fn send(self, mut result: Result<(), Error>) -> Result<(), fidl::Error> {
1977 let _result = self.send_raw(result);
1978 if _result.is_err() {
1979 self.control_handle.shutdown();
1980 }
1981 self.drop_without_shutdown();
1982 _result
1983 }
1984
1985 pub fn send_no_shutdown_on_err(self, mut result: Result<(), Error>) -> Result<(), fidl::Error> {
1987 let _result = self.send_raw(result);
1988 self.drop_without_shutdown();
1989 _result
1990 }
1991
1992 fn send_raw(&self, mut result: Result<(), Error>) -> Result<(), fidl::Error> {
1993 self.control_handle
1994 .inner
1995 .send::<fidl::encoding::ResultType<fidl::encoding::EmptyStruct, Error>>(
1996 result,
1997 self.tx_id,
1998 0x1d08ea19db327779,
1999 fidl::encoding::DynamicFlags::empty(),
2000 )
2001 }
2002}
2003
2004#[must_use = "FIDL methods require a response to be sent"]
2005#[derive(Debug)]
2006pub struct AccessForgetResponder {
2007 control_handle: std::mem::ManuallyDrop<AccessControlHandle>,
2008 tx_id: u32,
2009}
2010
2011impl std::ops::Drop for AccessForgetResponder {
2015 fn drop(&mut self) {
2016 self.control_handle.shutdown();
2017 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
2019 }
2020}
2021
2022impl fidl::endpoints::Responder for AccessForgetResponder {
2023 type ControlHandle = AccessControlHandle;
2024
2025 fn control_handle(&self) -> &AccessControlHandle {
2026 &self.control_handle
2027 }
2028
2029 fn drop_without_shutdown(mut self) {
2030 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
2032 std::mem::forget(self);
2034 }
2035}
2036
2037impl AccessForgetResponder {
2038 pub fn send(self, mut result: Result<(), Error>) -> Result<(), fidl::Error> {
2042 let _result = self.send_raw(result);
2043 if _result.is_err() {
2044 self.control_handle.shutdown();
2045 }
2046 self.drop_without_shutdown();
2047 _result
2048 }
2049
2050 pub fn send_no_shutdown_on_err(self, mut result: Result<(), Error>) -> Result<(), fidl::Error> {
2052 let _result = self.send_raw(result);
2053 self.drop_without_shutdown();
2054 _result
2055 }
2056
2057 fn send_raw(&self, mut result: Result<(), Error>) -> Result<(), fidl::Error> {
2058 self.control_handle
2059 .inner
2060 .send::<fidl::encoding::ResultType<fidl::encoding::EmptyStruct, Error>>(
2061 result,
2062 self.tx_id,
2063 0x1fd8e27202854c0,
2064 fidl::encoding::DynamicFlags::empty(),
2065 )
2066 }
2067}
2068
2069#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
2070pub struct BootstrapMarker;
2071
2072impl fidl::endpoints::ProtocolMarker for BootstrapMarker {
2073 type Proxy = BootstrapProxy;
2074 type RequestStream = BootstrapRequestStream;
2075 #[cfg(target_os = "fuchsia")]
2076 type SynchronousProxy = BootstrapSynchronousProxy;
2077
2078 const DEBUG_NAME: &'static str = "fuchsia.bluetooth.sys.Bootstrap";
2079}
2080impl fidl::endpoints::DiscoverableProtocolMarker for BootstrapMarker {}
2081pub type BootstrapCommitResult = Result<(), BootstrapError>;
2082
2083pub trait BootstrapProxyInterface: Send + Sync {
2084 fn r#add_identities(&self, identities: &[Identity]) -> Result<(), fidl::Error>;
2085 type CommitResponseFut: std::future::Future<Output = Result<BootstrapCommitResult, fidl::Error>>
2086 + Send;
2087 fn r#commit(&self) -> Self::CommitResponseFut;
2088}
2089#[derive(Debug)]
2090#[cfg(target_os = "fuchsia")]
2091pub struct BootstrapSynchronousProxy {
2092 client: fidl::client::sync::Client,
2093}
2094
2095#[cfg(target_os = "fuchsia")]
2096impl fidl::endpoints::SynchronousProxy for BootstrapSynchronousProxy {
2097 type Proxy = BootstrapProxy;
2098 type Protocol = BootstrapMarker;
2099
2100 fn from_channel(inner: fidl::Channel) -> Self {
2101 Self::new(inner)
2102 }
2103
2104 fn into_channel(self) -> fidl::Channel {
2105 self.client.into_channel()
2106 }
2107
2108 fn as_channel(&self) -> &fidl::Channel {
2109 self.client.as_channel()
2110 }
2111}
2112
2113#[cfg(target_os = "fuchsia")]
2114impl BootstrapSynchronousProxy {
2115 pub fn new(channel: fidl::Channel) -> Self {
2116 let protocol_name = <BootstrapMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
2117 Self { client: fidl::client::sync::Client::new(channel, protocol_name) }
2118 }
2119
2120 pub fn into_channel(self) -> fidl::Channel {
2121 self.client.into_channel()
2122 }
2123
2124 pub fn wait_for_event(
2127 &self,
2128 deadline: zx::MonotonicInstant,
2129 ) -> Result<BootstrapEvent, fidl::Error> {
2130 BootstrapEvent::decode(self.client.wait_for_event(deadline)?)
2131 }
2132
2133 pub fn r#add_identities(&self, mut identities: &[Identity]) -> Result<(), fidl::Error> {
2137 self.client.send::<BootstrapAddIdentitiesRequest>(
2138 (identities,),
2139 0x92d7c849de29bb0,
2140 fidl::encoding::DynamicFlags::empty(),
2141 )
2142 }
2143
2144 pub fn r#commit(
2150 &self,
2151 ___deadline: zx::MonotonicInstant,
2152 ) -> Result<BootstrapCommitResult, fidl::Error> {
2153 let _response = self.client.send_query::<
2154 fidl::encoding::EmptyPayload,
2155 fidl::encoding::ResultType<fidl::encoding::EmptyStruct, BootstrapError>,
2156 >(
2157 (),
2158 0x5288006c9c7db6b7,
2159 fidl::encoding::DynamicFlags::empty(),
2160 ___deadline,
2161 )?;
2162 Ok(_response.map(|x| x))
2163 }
2164}
2165
2166#[cfg(target_os = "fuchsia")]
2167impl From<BootstrapSynchronousProxy> for zx::Handle {
2168 fn from(value: BootstrapSynchronousProxy) -> Self {
2169 value.into_channel().into()
2170 }
2171}
2172
2173#[cfg(target_os = "fuchsia")]
2174impl From<fidl::Channel> for BootstrapSynchronousProxy {
2175 fn from(value: fidl::Channel) -> Self {
2176 Self::new(value)
2177 }
2178}
2179
2180#[derive(Debug, Clone)]
2181pub struct BootstrapProxy {
2182 client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
2183}
2184
2185impl fidl::endpoints::Proxy for BootstrapProxy {
2186 type Protocol = BootstrapMarker;
2187
2188 fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
2189 Self::new(inner)
2190 }
2191
2192 fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
2193 self.client.into_channel().map_err(|client| Self { client })
2194 }
2195
2196 fn as_channel(&self) -> &::fidl::AsyncChannel {
2197 self.client.as_channel()
2198 }
2199}
2200
2201impl BootstrapProxy {
2202 pub fn new(channel: ::fidl::AsyncChannel) -> Self {
2204 let protocol_name = <BootstrapMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
2205 Self { client: fidl::client::Client::new(channel, protocol_name) }
2206 }
2207
2208 pub fn take_event_stream(&self) -> BootstrapEventStream {
2214 BootstrapEventStream { event_receiver: self.client.take_event_receiver() }
2215 }
2216
2217 pub fn r#add_identities(&self, mut identities: &[Identity]) -> Result<(), fidl::Error> {
2221 BootstrapProxyInterface::r#add_identities(self, identities)
2222 }
2223
2224 pub fn r#commit(
2230 &self,
2231 ) -> fidl::client::QueryResponseFut<
2232 BootstrapCommitResult,
2233 fidl::encoding::DefaultFuchsiaResourceDialect,
2234 > {
2235 BootstrapProxyInterface::r#commit(self)
2236 }
2237}
2238
2239impl BootstrapProxyInterface for BootstrapProxy {
2240 fn r#add_identities(&self, mut identities: &[Identity]) -> Result<(), fidl::Error> {
2241 self.client.send::<BootstrapAddIdentitiesRequest>(
2242 (identities,),
2243 0x92d7c849de29bb0,
2244 fidl::encoding::DynamicFlags::empty(),
2245 )
2246 }
2247
2248 type CommitResponseFut = fidl::client::QueryResponseFut<
2249 BootstrapCommitResult,
2250 fidl::encoding::DefaultFuchsiaResourceDialect,
2251 >;
2252 fn r#commit(&self) -> Self::CommitResponseFut {
2253 fn _decode(
2254 mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
2255 ) -> Result<BootstrapCommitResult, fidl::Error> {
2256 let _response = fidl::client::decode_transaction_body::<
2257 fidl::encoding::ResultType<fidl::encoding::EmptyStruct, BootstrapError>,
2258 fidl::encoding::DefaultFuchsiaResourceDialect,
2259 0x5288006c9c7db6b7,
2260 >(_buf?)?;
2261 Ok(_response.map(|x| x))
2262 }
2263 self.client.send_query_and_decode::<fidl::encoding::EmptyPayload, BootstrapCommitResult>(
2264 (),
2265 0x5288006c9c7db6b7,
2266 fidl::encoding::DynamicFlags::empty(),
2267 _decode,
2268 )
2269 }
2270}
2271
2272pub struct BootstrapEventStream {
2273 event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
2274}
2275
2276impl std::marker::Unpin for BootstrapEventStream {}
2277
2278impl futures::stream::FusedStream for BootstrapEventStream {
2279 fn is_terminated(&self) -> bool {
2280 self.event_receiver.is_terminated()
2281 }
2282}
2283
2284impl futures::Stream for BootstrapEventStream {
2285 type Item = Result<BootstrapEvent, fidl::Error>;
2286
2287 fn poll_next(
2288 mut self: std::pin::Pin<&mut Self>,
2289 cx: &mut std::task::Context<'_>,
2290 ) -> std::task::Poll<Option<Self::Item>> {
2291 match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
2292 &mut self.event_receiver,
2293 cx
2294 )?) {
2295 Some(buf) => std::task::Poll::Ready(Some(BootstrapEvent::decode(buf))),
2296 None => std::task::Poll::Ready(None),
2297 }
2298 }
2299}
2300
2301#[derive(Debug)]
2302pub enum BootstrapEvent {}
2303
2304impl BootstrapEvent {
2305 fn decode(
2307 mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
2308 ) -> Result<BootstrapEvent, fidl::Error> {
2309 let (bytes, _handles) = buf.split_mut();
2310 let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
2311 debug_assert_eq!(tx_header.tx_id, 0);
2312 match tx_header.ordinal {
2313 _ => Err(fidl::Error::UnknownOrdinal {
2314 ordinal: tx_header.ordinal,
2315 protocol_name: <BootstrapMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
2316 }),
2317 }
2318 }
2319}
2320
2321pub struct BootstrapRequestStream {
2323 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
2324 is_terminated: bool,
2325}
2326
2327impl std::marker::Unpin for BootstrapRequestStream {}
2328
2329impl futures::stream::FusedStream for BootstrapRequestStream {
2330 fn is_terminated(&self) -> bool {
2331 self.is_terminated
2332 }
2333}
2334
2335impl fidl::endpoints::RequestStream for BootstrapRequestStream {
2336 type Protocol = BootstrapMarker;
2337 type ControlHandle = BootstrapControlHandle;
2338
2339 fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
2340 Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
2341 }
2342
2343 fn control_handle(&self) -> Self::ControlHandle {
2344 BootstrapControlHandle { inner: self.inner.clone() }
2345 }
2346
2347 fn into_inner(
2348 self,
2349 ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
2350 {
2351 (self.inner, self.is_terminated)
2352 }
2353
2354 fn from_inner(
2355 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
2356 is_terminated: bool,
2357 ) -> Self {
2358 Self { inner, is_terminated }
2359 }
2360}
2361
2362impl futures::Stream for BootstrapRequestStream {
2363 type Item = Result<BootstrapRequest, fidl::Error>;
2364
2365 fn poll_next(
2366 mut self: std::pin::Pin<&mut Self>,
2367 cx: &mut std::task::Context<'_>,
2368 ) -> std::task::Poll<Option<Self::Item>> {
2369 let this = &mut *self;
2370 if this.inner.check_shutdown(cx) {
2371 this.is_terminated = true;
2372 return std::task::Poll::Ready(None);
2373 }
2374 if this.is_terminated {
2375 panic!("polled BootstrapRequestStream after completion");
2376 }
2377 fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
2378 |bytes, handles| {
2379 match this.inner.channel().read_etc(cx, bytes, handles) {
2380 std::task::Poll::Ready(Ok(())) => {}
2381 std::task::Poll::Pending => return std::task::Poll::Pending,
2382 std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
2383 this.is_terminated = true;
2384 return std::task::Poll::Ready(None);
2385 }
2386 std::task::Poll::Ready(Err(e)) => {
2387 return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
2388 e.into(),
2389 ))))
2390 }
2391 }
2392
2393 let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
2395
2396 std::task::Poll::Ready(Some(match header.ordinal {
2397 0x92d7c849de29bb0 => {
2398 header.validate_request_tx_id(fidl::MethodType::OneWay)?;
2399 let mut req = fidl::new_empty!(
2400 BootstrapAddIdentitiesRequest,
2401 fidl::encoding::DefaultFuchsiaResourceDialect
2402 );
2403 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<BootstrapAddIdentitiesRequest>(&header, _body_bytes, handles, &mut req)?;
2404 let control_handle = BootstrapControlHandle { inner: this.inner.clone() };
2405 Ok(BootstrapRequest::AddIdentities {
2406 identities: req.identities,
2407
2408 control_handle,
2409 })
2410 }
2411 0x5288006c9c7db6b7 => {
2412 header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
2413 let mut req = fidl::new_empty!(
2414 fidl::encoding::EmptyPayload,
2415 fidl::encoding::DefaultFuchsiaResourceDialect
2416 );
2417 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
2418 let control_handle = BootstrapControlHandle { inner: this.inner.clone() };
2419 Ok(BootstrapRequest::Commit {
2420 responder: BootstrapCommitResponder {
2421 control_handle: std::mem::ManuallyDrop::new(control_handle),
2422 tx_id: header.tx_id,
2423 },
2424 })
2425 }
2426 _ => Err(fidl::Error::UnknownOrdinal {
2427 ordinal: header.ordinal,
2428 protocol_name:
2429 <BootstrapMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
2430 }),
2431 }))
2432 },
2433 )
2434 }
2435}
2436
2437#[derive(Debug)]
2448pub enum BootstrapRequest {
2449 AddIdentities { identities: Vec<Identity>, control_handle: BootstrapControlHandle },
2453 Commit { responder: BootstrapCommitResponder },
2459}
2460
2461impl BootstrapRequest {
2462 #[allow(irrefutable_let_patterns)]
2463 pub fn into_add_identities(self) -> Option<(Vec<Identity>, BootstrapControlHandle)> {
2464 if let BootstrapRequest::AddIdentities { identities, control_handle } = self {
2465 Some((identities, control_handle))
2466 } else {
2467 None
2468 }
2469 }
2470
2471 #[allow(irrefutable_let_patterns)]
2472 pub fn into_commit(self) -> Option<(BootstrapCommitResponder)> {
2473 if let BootstrapRequest::Commit { responder } = self {
2474 Some((responder))
2475 } else {
2476 None
2477 }
2478 }
2479
2480 pub fn method_name(&self) -> &'static str {
2482 match *self {
2483 BootstrapRequest::AddIdentities { .. } => "add_identities",
2484 BootstrapRequest::Commit { .. } => "commit",
2485 }
2486 }
2487}
2488
2489#[derive(Debug, Clone)]
2490pub struct BootstrapControlHandle {
2491 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
2492}
2493
2494impl fidl::endpoints::ControlHandle for BootstrapControlHandle {
2495 fn shutdown(&self) {
2496 self.inner.shutdown()
2497 }
2498 fn shutdown_with_epitaph(&self, status: zx_status::Status) {
2499 self.inner.shutdown_with_epitaph(status)
2500 }
2501
2502 fn is_closed(&self) -> bool {
2503 self.inner.channel().is_closed()
2504 }
2505 fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
2506 self.inner.channel().on_closed()
2507 }
2508
2509 #[cfg(target_os = "fuchsia")]
2510 fn signal_peer(
2511 &self,
2512 clear_mask: zx::Signals,
2513 set_mask: zx::Signals,
2514 ) -> Result<(), zx_status::Status> {
2515 use fidl::Peered;
2516 self.inner.channel().signal_peer(clear_mask, set_mask)
2517 }
2518}
2519
2520impl BootstrapControlHandle {}
2521
2522#[must_use = "FIDL methods require a response to be sent"]
2523#[derive(Debug)]
2524pub struct BootstrapCommitResponder {
2525 control_handle: std::mem::ManuallyDrop<BootstrapControlHandle>,
2526 tx_id: u32,
2527}
2528
2529impl std::ops::Drop for BootstrapCommitResponder {
2533 fn drop(&mut self) {
2534 self.control_handle.shutdown();
2535 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
2537 }
2538}
2539
2540impl fidl::endpoints::Responder for BootstrapCommitResponder {
2541 type ControlHandle = BootstrapControlHandle;
2542
2543 fn control_handle(&self) -> &BootstrapControlHandle {
2544 &self.control_handle
2545 }
2546
2547 fn drop_without_shutdown(mut self) {
2548 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
2550 std::mem::forget(self);
2552 }
2553}
2554
2555impl BootstrapCommitResponder {
2556 pub fn send(self, mut result: Result<(), BootstrapError>) -> Result<(), fidl::Error> {
2560 let _result = self.send_raw(result);
2561 if _result.is_err() {
2562 self.control_handle.shutdown();
2563 }
2564 self.drop_without_shutdown();
2565 _result
2566 }
2567
2568 pub fn send_no_shutdown_on_err(
2570 self,
2571 mut result: Result<(), BootstrapError>,
2572 ) -> Result<(), fidl::Error> {
2573 let _result = self.send_raw(result);
2574 self.drop_without_shutdown();
2575 _result
2576 }
2577
2578 fn send_raw(&self, mut result: Result<(), BootstrapError>) -> Result<(), fidl::Error> {
2579 self.control_handle.inner.send::<fidl::encoding::ResultType<
2580 fidl::encoding::EmptyStruct,
2581 BootstrapError,
2582 >>(
2583 result,
2584 self.tx_id,
2585 0x5288006c9c7db6b7,
2586 fidl::encoding::DynamicFlags::empty(),
2587 )
2588 }
2589}
2590
2591#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
2592pub struct ConfigurationMarker;
2593
2594impl fidl::endpoints::ProtocolMarker for ConfigurationMarker {
2595 type Proxy = ConfigurationProxy;
2596 type RequestStream = ConfigurationRequestStream;
2597 #[cfg(target_os = "fuchsia")]
2598 type SynchronousProxy = ConfigurationSynchronousProxy;
2599
2600 const DEBUG_NAME: &'static str = "fuchsia.bluetooth.sys.Configuration";
2601}
2602impl fidl::endpoints::DiscoverableProtocolMarker for ConfigurationMarker {}
2603
2604pub trait ConfigurationProxyInterface: Send + Sync {
2605 type UpdateResponseFut: std::future::Future<Output = Result<Settings, fidl::Error>> + Send;
2606 fn r#update(&self, settings: &Settings) -> Self::UpdateResponseFut;
2607}
2608#[derive(Debug)]
2609#[cfg(target_os = "fuchsia")]
2610pub struct ConfigurationSynchronousProxy {
2611 client: fidl::client::sync::Client,
2612}
2613
2614#[cfg(target_os = "fuchsia")]
2615impl fidl::endpoints::SynchronousProxy for ConfigurationSynchronousProxy {
2616 type Proxy = ConfigurationProxy;
2617 type Protocol = ConfigurationMarker;
2618
2619 fn from_channel(inner: fidl::Channel) -> Self {
2620 Self::new(inner)
2621 }
2622
2623 fn into_channel(self) -> fidl::Channel {
2624 self.client.into_channel()
2625 }
2626
2627 fn as_channel(&self) -> &fidl::Channel {
2628 self.client.as_channel()
2629 }
2630}
2631
2632#[cfg(target_os = "fuchsia")]
2633impl ConfigurationSynchronousProxy {
2634 pub fn new(channel: fidl::Channel) -> Self {
2635 let protocol_name = <ConfigurationMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
2636 Self { client: fidl::client::sync::Client::new(channel, protocol_name) }
2637 }
2638
2639 pub fn into_channel(self) -> fidl::Channel {
2640 self.client.into_channel()
2641 }
2642
2643 pub fn wait_for_event(
2646 &self,
2647 deadline: zx::MonotonicInstant,
2648 ) -> Result<ConfigurationEvent, fidl::Error> {
2649 ConfigurationEvent::decode(self.client.wait_for_event(deadline)?)
2650 }
2651
2652 pub fn r#update(
2660 &self,
2661 mut settings: &Settings,
2662 ___deadline: zx::MonotonicInstant,
2663 ) -> Result<Settings, fidl::Error> {
2664 let _response =
2665 self.client.send_query::<ConfigurationUpdateRequest, ConfigurationUpdateResponse>(
2666 (settings,),
2667 0x27e9cfb72e7c6d01,
2668 fidl::encoding::DynamicFlags::empty(),
2669 ___deadline,
2670 )?;
2671 Ok(_response.result)
2672 }
2673}
2674
2675#[cfg(target_os = "fuchsia")]
2676impl From<ConfigurationSynchronousProxy> for zx::Handle {
2677 fn from(value: ConfigurationSynchronousProxy) -> Self {
2678 value.into_channel().into()
2679 }
2680}
2681
2682#[cfg(target_os = "fuchsia")]
2683impl From<fidl::Channel> for ConfigurationSynchronousProxy {
2684 fn from(value: fidl::Channel) -> Self {
2685 Self::new(value)
2686 }
2687}
2688
2689#[derive(Debug, Clone)]
2690pub struct ConfigurationProxy {
2691 client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
2692}
2693
2694impl fidl::endpoints::Proxy for ConfigurationProxy {
2695 type Protocol = ConfigurationMarker;
2696
2697 fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
2698 Self::new(inner)
2699 }
2700
2701 fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
2702 self.client.into_channel().map_err(|client| Self { client })
2703 }
2704
2705 fn as_channel(&self) -> &::fidl::AsyncChannel {
2706 self.client.as_channel()
2707 }
2708}
2709
2710impl ConfigurationProxy {
2711 pub fn new(channel: ::fidl::AsyncChannel) -> Self {
2713 let protocol_name = <ConfigurationMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
2714 Self { client: fidl::client::Client::new(channel, protocol_name) }
2715 }
2716
2717 pub fn take_event_stream(&self) -> ConfigurationEventStream {
2723 ConfigurationEventStream { event_receiver: self.client.take_event_receiver() }
2724 }
2725
2726 pub fn r#update(
2734 &self,
2735 mut settings: &Settings,
2736 ) -> fidl::client::QueryResponseFut<Settings, fidl::encoding::DefaultFuchsiaResourceDialect>
2737 {
2738 ConfigurationProxyInterface::r#update(self, settings)
2739 }
2740}
2741
2742impl ConfigurationProxyInterface for ConfigurationProxy {
2743 type UpdateResponseFut =
2744 fidl::client::QueryResponseFut<Settings, fidl::encoding::DefaultFuchsiaResourceDialect>;
2745 fn r#update(&self, mut settings: &Settings) -> Self::UpdateResponseFut {
2746 fn _decode(
2747 mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
2748 ) -> Result<Settings, fidl::Error> {
2749 let _response = fidl::client::decode_transaction_body::<
2750 ConfigurationUpdateResponse,
2751 fidl::encoding::DefaultFuchsiaResourceDialect,
2752 0x27e9cfb72e7c6d01,
2753 >(_buf?)?;
2754 Ok(_response.result)
2755 }
2756 self.client.send_query_and_decode::<ConfigurationUpdateRequest, Settings>(
2757 (settings,),
2758 0x27e9cfb72e7c6d01,
2759 fidl::encoding::DynamicFlags::empty(),
2760 _decode,
2761 )
2762 }
2763}
2764
2765pub struct ConfigurationEventStream {
2766 event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
2767}
2768
2769impl std::marker::Unpin for ConfigurationEventStream {}
2770
2771impl futures::stream::FusedStream for ConfigurationEventStream {
2772 fn is_terminated(&self) -> bool {
2773 self.event_receiver.is_terminated()
2774 }
2775}
2776
2777impl futures::Stream for ConfigurationEventStream {
2778 type Item = Result<ConfigurationEvent, fidl::Error>;
2779
2780 fn poll_next(
2781 mut self: std::pin::Pin<&mut Self>,
2782 cx: &mut std::task::Context<'_>,
2783 ) -> std::task::Poll<Option<Self::Item>> {
2784 match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
2785 &mut self.event_receiver,
2786 cx
2787 )?) {
2788 Some(buf) => std::task::Poll::Ready(Some(ConfigurationEvent::decode(buf))),
2789 None => std::task::Poll::Ready(None),
2790 }
2791 }
2792}
2793
2794#[derive(Debug)]
2795pub enum ConfigurationEvent {}
2796
2797impl ConfigurationEvent {
2798 fn decode(
2800 mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
2801 ) -> Result<ConfigurationEvent, fidl::Error> {
2802 let (bytes, _handles) = buf.split_mut();
2803 let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
2804 debug_assert_eq!(tx_header.tx_id, 0);
2805 match tx_header.ordinal {
2806 _ => Err(fidl::Error::UnknownOrdinal {
2807 ordinal: tx_header.ordinal,
2808 protocol_name: <ConfigurationMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
2809 }),
2810 }
2811 }
2812}
2813
2814pub struct ConfigurationRequestStream {
2816 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
2817 is_terminated: bool,
2818}
2819
2820impl std::marker::Unpin for ConfigurationRequestStream {}
2821
2822impl futures::stream::FusedStream for ConfigurationRequestStream {
2823 fn is_terminated(&self) -> bool {
2824 self.is_terminated
2825 }
2826}
2827
2828impl fidl::endpoints::RequestStream for ConfigurationRequestStream {
2829 type Protocol = ConfigurationMarker;
2830 type ControlHandle = ConfigurationControlHandle;
2831
2832 fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
2833 Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
2834 }
2835
2836 fn control_handle(&self) -> Self::ControlHandle {
2837 ConfigurationControlHandle { inner: self.inner.clone() }
2838 }
2839
2840 fn into_inner(
2841 self,
2842 ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
2843 {
2844 (self.inner, self.is_terminated)
2845 }
2846
2847 fn from_inner(
2848 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
2849 is_terminated: bool,
2850 ) -> Self {
2851 Self { inner, is_terminated }
2852 }
2853}
2854
2855impl futures::Stream for ConfigurationRequestStream {
2856 type Item = Result<ConfigurationRequest, fidl::Error>;
2857
2858 fn poll_next(
2859 mut self: std::pin::Pin<&mut Self>,
2860 cx: &mut std::task::Context<'_>,
2861 ) -> std::task::Poll<Option<Self::Item>> {
2862 let this = &mut *self;
2863 if this.inner.check_shutdown(cx) {
2864 this.is_terminated = true;
2865 return std::task::Poll::Ready(None);
2866 }
2867 if this.is_terminated {
2868 panic!("polled ConfigurationRequestStream after completion");
2869 }
2870 fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
2871 |bytes, handles| {
2872 match this.inner.channel().read_etc(cx, bytes, handles) {
2873 std::task::Poll::Ready(Ok(())) => {}
2874 std::task::Poll::Pending => return std::task::Poll::Pending,
2875 std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
2876 this.is_terminated = true;
2877 return std::task::Poll::Ready(None);
2878 }
2879 std::task::Poll::Ready(Err(e)) => {
2880 return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
2881 e.into(),
2882 ))))
2883 }
2884 }
2885
2886 let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
2888
2889 std::task::Poll::Ready(Some(match header.ordinal {
2890 0x27e9cfb72e7c6d01 => {
2891 header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
2892 let mut req = fidl::new_empty!(
2893 ConfigurationUpdateRequest,
2894 fidl::encoding::DefaultFuchsiaResourceDialect
2895 );
2896 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<ConfigurationUpdateRequest>(&header, _body_bytes, handles, &mut req)?;
2897 let control_handle =
2898 ConfigurationControlHandle { inner: this.inner.clone() };
2899 Ok(ConfigurationRequest::Update {
2900 settings: req.settings,
2901
2902 responder: ConfigurationUpdateResponder {
2903 control_handle: std::mem::ManuallyDrop::new(control_handle),
2904 tx_id: header.tx_id,
2905 },
2906 })
2907 }
2908 _ => Err(fidl::Error::UnknownOrdinal {
2909 ordinal: header.ordinal,
2910 protocol_name:
2911 <ConfigurationMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
2912 }),
2913 }))
2914 },
2915 )
2916 }
2917}
2918
2919#[derive(Debug)]
2925pub enum ConfigurationRequest {
2926 Update { settings: Settings, responder: ConfigurationUpdateResponder },
2934}
2935
2936impl ConfigurationRequest {
2937 #[allow(irrefutable_let_patterns)]
2938 pub fn into_update(self) -> Option<(Settings, ConfigurationUpdateResponder)> {
2939 if let ConfigurationRequest::Update { settings, responder } = self {
2940 Some((settings, responder))
2941 } else {
2942 None
2943 }
2944 }
2945
2946 pub fn method_name(&self) -> &'static str {
2948 match *self {
2949 ConfigurationRequest::Update { .. } => "update",
2950 }
2951 }
2952}
2953
2954#[derive(Debug, Clone)]
2955pub struct ConfigurationControlHandle {
2956 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
2957}
2958
2959impl fidl::endpoints::ControlHandle for ConfigurationControlHandle {
2960 fn shutdown(&self) {
2961 self.inner.shutdown()
2962 }
2963 fn shutdown_with_epitaph(&self, status: zx_status::Status) {
2964 self.inner.shutdown_with_epitaph(status)
2965 }
2966
2967 fn is_closed(&self) -> bool {
2968 self.inner.channel().is_closed()
2969 }
2970 fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
2971 self.inner.channel().on_closed()
2972 }
2973
2974 #[cfg(target_os = "fuchsia")]
2975 fn signal_peer(
2976 &self,
2977 clear_mask: zx::Signals,
2978 set_mask: zx::Signals,
2979 ) -> Result<(), zx_status::Status> {
2980 use fidl::Peered;
2981 self.inner.channel().signal_peer(clear_mask, set_mask)
2982 }
2983}
2984
2985impl ConfigurationControlHandle {}
2986
2987#[must_use = "FIDL methods require a response to be sent"]
2988#[derive(Debug)]
2989pub struct ConfigurationUpdateResponder {
2990 control_handle: std::mem::ManuallyDrop<ConfigurationControlHandle>,
2991 tx_id: u32,
2992}
2993
2994impl std::ops::Drop for ConfigurationUpdateResponder {
2998 fn drop(&mut self) {
2999 self.control_handle.shutdown();
3000 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
3002 }
3003}
3004
3005impl fidl::endpoints::Responder for ConfigurationUpdateResponder {
3006 type ControlHandle = ConfigurationControlHandle;
3007
3008 fn control_handle(&self) -> &ConfigurationControlHandle {
3009 &self.control_handle
3010 }
3011
3012 fn drop_without_shutdown(mut self) {
3013 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
3015 std::mem::forget(self);
3017 }
3018}
3019
3020impl ConfigurationUpdateResponder {
3021 pub fn send(self, mut result: &Settings) -> Result<(), fidl::Error> {
3025 let _result = self.send_raw(result);
3026 if _result.is_err() {
3027 self.control_handle.shutdown();
3028 }
3029 self.drop_without_shutdown();
3030 _result
3031 }
3032
3033 pub fn send_no_shutdown_on_err(self, mut result: &Settings) -> Result<(), fidl::Error> {
3035 let _result = self.send_raw(result);
3036 self.drop_without_shutdown();
3037 _result
3038 }
3039
3040 fn send_raw(&self, mut result: &Settings) -> Result<(), fidl::Error> {
3041 self.control_handle.inner.send::<ConfigurationUpdateResponse>(
3042 (result,),
3043 self.tx_id,
3044 0x27e9cfb72e7c6d01,
3045 fidl::encoding::DynamicFlags::empty(),
3046 )
3047 }
3048}
3049
3050#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
3051pub struct HostWatcherMarker;
3052
3053impl fidl::endpoints::ProtocolMarker for HostWatcherMarker {
3054 type Proxy = HostWatcherProxy;
3055 type RequestStream = HostWatcherRequestStream;
3056 #[cfg(target_os = "fuchsia")]
3057 type SynchronousProxy = HostWatcherSynchronousProxy;
3058
3059 const DEBUG_NAME: &'static str = "fuchsia.bluetooth.sys.HostWatcher";
3060}
3061impl fidl::endpoints::DiscoverableProtocolMarker for HostWatcherMarker {}
3062pub type HostWatcherSetActiveResult = Result<(), i32>;
3063
3064pub trait HostWatcherProxyInterface: Send + Sync {
3065 type WatchResponseFut: std::future::Future<Output = Result<Vec<HostInfo>, fidl::Error>> + Send;
3066 fn r#watch(&self) -> Self::WatchResponseFut;
3067 type SetActiveResponseFut: std::future::Future<Output = Result<HostWatcherSetActiveResult, fidl::Error>>
3068 + Send;
3069 fn r#set_active(&self, id: &fidl_fuchsia_bluetooth::HostId) -> Self::SetActiveResponseFut;
3070}
3071#[derive(Debug)]
3072#[cfg(target_os = "fuchsia")]
3073pub struct HostWatcherSynchronousProxy {
3074 client: fidl::client::sync::Client,
3075}
3076
3077#[cfg(target_os = "fuchsia")]
3078impl fidl::endpoints::SynchronousProxy for HostWatcherSynchronousProxy {
3079 type Proxy = HostWatcherProxy;
3080 type Protocol = HostWatcherMarker;
3081
3082 fn from_channel(inner: fidl::Channel) -> Self {
3083 Self::new(inner)
3084 }
3085
3086 fn into_channel(self) -> fidl::Channel {
3087 self.client.into_channel()
3088 }
3089
3090 fn as_channel(&self) -> &fidl::Channel {
3091 self.client.as_channel()
3092 }
3093}
3094
3095#[cfg(target_os = "fuchsia")]
3096impl HostWatcherSynchronousProxy {
3097 pub fn new(channel: fidl::Channel) -> Self {
3098 let protocol_name = <HostWatcherMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
3099 Self { client: fidl::client::sync::Client::new(channel, protocol_name) }
3100 }
3101
3102 pub fn into_channel(self) -> fidl::Channel {
3103 self.client.into_channel()
3104 }
3105
3106 pub fn wait_for_event(
3109 &self,
3110 deadline: zx::MonotonicInstant,
3111 ) -> Result<HostWatcherEvent, fidl::Error> {
3112 HostWatcherEvent::decode(self.client.wait_for_event(deadline)?)
3113 }
3114
3115 pub fn r#watch(&self, ___deadline: zx::MonotonicInstant) -> Result<Vec<HostInfo>, fidl::Error> {
3118 let _response =
3119 self.client.send_query::<fidl::encoding::EmptyPayload, HostWatcherWatchResponse>(
3120 (),
3121 0x4e2c2972a5b16f9c,
3122 fidl::encoding::DynamicFlags::empty(),
3123 ___deadline,
3124 )?;
3125 Ok(_response.hosts)
3126 }
3127
3128 pub fn r#set_active(
3134 &self,
3135 mut id: &fidl_fuchsia_bluetooth::HostId,
3136 ___deadline: zx::MonotonicInstant,
3137 ) -> Result<HostWatcherSetActiveResult, fidl::Error> {
3138 let _response = self.client.send_query::<
3139 HostWatcherSetActiveRequest,
3140 fidl::encoding::ResultType<fidl::encoding::EmptyStruct, i32>,
3141 >(
3142 (id,),
3143 0x83f311ecaf0ddf3,
3144 fidl::encoding::DynamicFlags::empty(),
3145 ___deadline,
3146 )?;
3147 Ok(_response.map(|x| x))
3148 }
3149}
3150
3151#[cfg(target_os = "fuchsia")]
3152impl From<HostWatcherSynchronousProxy> for zx::Handle {
3153 fn from(value: HostWatcherSynchronousProxy) -> Self {
3154 value.into_channel().into()
3155 }
3156}
3157
3158#[cfg(target_os = "fuchsia")]
3159impl From<fidl::Channel> for HostWatcherSynchronousProxy {
3160 fn from(value: fidl::Channel) -> Self {
3161 Self::new(value)
3162 }
3163}
3164
3165#[derive(Debug, Clone)]
3166pub struct HostWatcherProxy {
3167 client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
3168}
3169
3170impl fidl::endpoints::Proxy for HostWatcherProxy {
3171 type Protocol = HostWatcherMarker;
3172
3173 fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
3174 Self::new(inner)
3175 }
3176
3177 fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
3178 self.client.into_channel().map_err(|client| Self { client })
3179 }
3180
3181 fn as_channel(&self) -> &::fidl::AsyncChannel {
3182 self.client.as_channel()
3183 }
3184}
3185
3186impl HostWatcherProxy {
3187 pub fn new(channel: ::fidl::AsyncChannel) -> Self {
3189 let protocol_name = <HostWatcherMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
3190 Self { client: fidl::client::Client::new(channel, protocol_name) }
3191 }
3192
3193 pub fn take_event_stream(&self) -> HostWatcherEventStream {
3199 HostWatcherEventStream { event_receiver: self.client.take_event_receiver() }
3200 }
3201
3202 pub fn r#watch(
3205 &self,
3206 ) -> fidl::client::QueryResponseFut<Vec<HostInfo>, fidl::encoding::DefaultFuchsiaResourceDialect>
3207 {
3208 HostWatcherProxyInterface::r#watch(self)
3209 }
3210
3211 pub fn r#set_active(
3217 &self,
3218 mut id: &fidl_fuchsia_bluetooth::HostId,
3219 ) -> fidl::client::QueryResponseFut<
3220 HostWatcherSetActiveResult,
3221 fidl::encoding::DefaultFuchsiaResourceDialect,
3222 > {
3223 HostWatcherProxyInterface::r#set_active(self, id)
3224 }
3225}
3226
3227impl HostWatcherProxyInterface for HostWatcherProxy {
3228 type WatchResponseFut = fidl::client::QueryResponseFut<
3229 Vec<HostInfo>,
3230 fidl::encoding::DefaultFuchsiaResourceDialect,
3231 >;
3232 fn r#watch(&self) -> Self::WatchResponseFut {
3233 fn _decode(
3234 mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
3235 ) -> Result<Vec<HostInfo>, fidl::Error> {
3236 let _response = fidl::client::decode_transaction_body::<
3237 HostWatcherWatchResponse,
3238 fidl::encoding::DefaultFuchsiaResourceDialect,
3239 0x4e2c2972a5b16f9c,
3240 >(_buf?)?;
3241 Ok(_response.hosts)
3242 }
3243 self.client.send_query_and_decode::<fidl::encoding::EmptyPayload, Vec<HostInfo>>(
3244 (),
3245 0x4e2c2972a5b16f9c,
3246 fidl::encoding::DynamicFlags::empty(),
3247 _decode,
3248 )
3249 }
3250
3251 type SetActiveResponseFut = fidl::client::QueryResponseFut<
3252 HostWatcherSetActiveResult,
3253 fidl::encoding::DefaultFuchsiaResourceDialect,
3254 >;
3255 fn r#set_active(&self, mut id: &fidl_fuchsia_bluetooth::HostId) -> Self::SetActiveResponseFut {
3256 fn _decode(
3257 mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
3258 ) -> Result<HostWatcherSetActiveResult, fidl::Error> {
3259 let _response = fidl::client::decode_transaction_body::<
3260 fidl::encoding::ResultType<fidl::encoding::EmptyStruct, i32>,
3261 fidl::encoding::DefaultFuchsiaResourceDialect,
3262 0x83f311ecaf0ddf3,
3263 >(_buf?)?;
3264 Ok(_response.map(|x| x))
3265 }
3266 self.client
3267 .send_query_and_decode::<HostWatcherSetActiveRequest, HostWatcherSetActiveResult>(
3268 (id,),
3269 0x83f311ecaf0ddf3,
3270 fidl::encoding::DynamicFlags::empty(),
3271 _decode,
3272 )
3273 }
3274}
3275
3276pub struct HostWatcherEventStream {
3277 event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
3278}
3279
3280impl std::marker::Unpin for HostWatcherEventStream {}
3281
3282impl futures::stream::FusedStream for HostWatcherEventStream {
3283 fn is_terminated(&self) -> bool {
3284 self.event_receiver.is_terminated()
3285 }
3286}
3287
3288impl futures::Stream for HostWatcherEventStream {
3289 type Item = Result<HostWatcherEvent, fidl::Error>;
3290
3291 fn poll_next(
3292 mut self: std::pin::Pin<&mut Self>,
3293 cx: &mut std::task::Context<'_>,
3294 ) -> std::task::Poll<Option<Self::Item>> {
3295 match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
3296 &mut self.event_receiver,
3297 cx
3298 )?) {
3299 Some(buf) => std::task::Poll::Ready(Some(HostWatcherEvent::decode(buf))),
3300 None => std::task::Poll::Ready(None),
3301 }
3302 }
3303}
3304
3305#[derive(Debug)]
3306pub enum HostWatcherEvent {}
3307
3308impl HostWatcherEvent {
3309 fn decode(
3311 mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
3312 ) -> Result<HostWatcherEvent, fidl::Error> {
3313 let (bytes, _handles) = buf.split_mut();
3314 let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
3315 debug_assert_eq!(tx_header.tx_id, 0);
3316 match tx_header.ordinal {
3317 _ => Err(fidl::Error::UnknownOrdinal {
3318 ordinal: tx_header.ordinal,
3319 protocol_name: <HostWatcherMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
3320 }),
3321 }
3322 }
3323}
3324
3325pub struct HostWatcherRequestStream {
3327 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
3328 is_terminated: bool,
3329}
3330
3331impl std::marker::Unpin for HostWatcherRequestStream {}
3332
3333impl futures::stream::FusedStream for HostWatcherRequestStream {
3334 fn is_terminated(&self) -> bool {
3335 self.is_terminated
3336 }
3337}
3338
3339impl fidl::endpoints::RequestStream for HostWatcherRequestStream {
3340 type Protocol = HostWatcherMarker;
3341 type ControlHandle = HostWatcherControlHandle;
3342
3343 fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
3344 Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
3345 }
3346
3347 fn control_handle(&self) -> Self::ControlHandle {
3348 HostWatcherControlHandle { inner: self.inner.clone() }
3349 }
3350
3351 fn into_inner(
3352 self,
3353 ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
3354 {
3355 (self.inner, self.is_terminated)
3356 }
3357
3358 fn from_inner(
3359 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
3360 is_terminated: bool,
3361 ) -> Self {
3362 Self { inner, is_terminated }
3363 }
3364}
3365
3366impl futures::Stream for HostWatcherRequestStream {
3367 type Item = Result<HostWatcherRequest, fidl::Error>;
3368
3369 fn poll_next(
3370 mut self: std::pin::Pin<&mut Self>,
3371 cx: &mut std::task::Context<'_>,
3372 ) -> std::task::Poll<Option<Self::Item>> {
3373 let this = &mut *self;
3374 if this.inner.check_shutdown(cx) {
3375 this.is_terminated = true;
3376 return std::task::Poll::Ready(None);
3377 }
3378 if this.is_terminated {
3379 panic!("polled HostWatcherRequestStream after completion");
3380 }
3381 fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
3382 |bytes, handles| {
3383 match this.inner.channel().read_etc(cx, bytes, handles) {
3384 std::task::Poll::Ready(Ok(())) => {}
3385 std::task::Poll::Pending => return std::task::Poll::Pending,
3386 std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
3387 this.is_terminated = true;
3388 return std::task::Poll::Ready(None);
3389 }
3390 std::task::Poll::Ready(Err(e)) => {
3391 return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
3392 e.into(),
3393 ))))
3394 }
3395 }
3396
3397 let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
3399
3400 std::task::Poll::Ready(Some(match header.ordinal {
3401 0x4e2c2972a5b16f9c => {
3402 header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
3403 let mut req = fidl::new_empty!(
3404 fidl::encoding::EmptyPayload,
3405 fidl::encoding::DefaultFuchsiaResourceDialect
3406 );
3407 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
3408 let control_handle = HostWatcherControlHandle { inner: this.inner.clone() };
3409 Ok(HostWatcherRequest::Watch {
3410 responder: HostWatcherWatchResponder {
3411 control_handle: std::mem::ManuallyDrop::new(control_handle),
3412 tx_id: header.tx_id,
3413 },
3414 })
3415 }
3416 0x83f311ecaf0ddf3 => {
3417 header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
3418 let mut req = fidl::new_empty!(
3419 HostWatcherSetActiveRequest,
3420 fidl::encoding::DefaultFuchsiaResourceDialect
3421 );
3422 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<HostWatcherSetActiveRequest>(&header, _body_bytes, handles, &mut req)?;
3423 let control_handle = HostWatcherControlHandle { inner: this.inner.clone() };
3424 Ok(HostWatcherRequest::SetActive {
3425 id: req.id,
3426
3427 responder: HostWatcherSetActiveResponder {
3428 control_handle: std::mem::ManuallyDrop::new(control_handle),
3429 tx_id: header.tx_id,
3430 },
3431 })
3432 }
3433 _ => Err(fidl::Error::UnknownOrdinal {
3434 ordinal: header.ordinal,
3435 protocol_name:
3436 <HostWatcherMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
3437 }),
3438 }))
3439 },
3440 )
3441 }
3442}
3443
3444#[derive(Debug)]
3446pub enum HostWatcherRequest {
3447 Watch { responder: HostWatcherWatchResponder },
3450 SetActive { id: fidl_fuchsia_bluetooth::HostId, responder: HostWatcherSetActiveResponder },
3456}
3457
3458impl HostWatcherRequest {
3459 #[allow(irrefutable_let_patterns)]
3460 pub fn into_watch(self) -> Option<(HostWatcherWatchResponder)> {
3461 if let HostWatcherRequest::Watch { responder } = self {
3462 Some((responder))
3463 } else {
3464 None
3465 }
3466 }
3467
3468 #[allow(irrefutable_let_patterns)]
3469 pub fn into_set_active(
3470 self,
3471 ) -> Option<(fidl_fuchsia_bluetooth::HostId, HostWatcherSetActiveResponder)> {
3472 if let HostWatcherRequest::SetActive { id, responder } = self {
3473 Some((id, responder))
3474 } else {
3475 None
3476 }
3477 }
3478
3479 pub fn method_name(&self) -> &'static str {
3481 match *self {
3482 HostWatcherRequest::Watch { .. } => "watch",
3483 HostWatcherRequest::SetActive { .. } => "set_active",
3484 }
3485 }
3486}
3487
3488#[derive(Debug, Clone)]
3489pub struct HostWatcherControlHandle {
3490 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
3491}
3492
3493impl fidl::endpoints::ControlHandle for HostWatcherControlHandle {
3494 fn shutdown(&self) {
3495 self.inner.shutdown()
3496 }
3497 fn shutdown_with_epitaph(&self, status: zx_status::Status) {
3498 self.inner.shutdown_with_epitaph(status)
3499 }
3500
3501 fn is_closed(&self) -> bool {
3502 self.inner.channel().is_closed()
3503 }
3504 fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
3505 self.inner.channel().on_closed()
3506 }
3507
3508 #[cfg(target_os = "fuchsia")]
3509 fn signal_peer(
3510 &self,
3511 clear_mask: zx::Signals,
3512 set_mask: zx::Signals,
3513 ) -> Result<(), zx_status::Status> {
3514 use fidl::Peered;
3515 self.inner.channel().signal_peer(clear_mask, set_mask)
3516 }
3517}
3518
3519impl HostWatcherControlHandle {}
3520
3521#[must_use = "FIDL methods require a response to be sent"]
3522#[derive(Debug)]
3523pub struct HostWatcherWatchResponder {
3524 control_handle: std::mem::ManuallyDrop<HostWatcherControlHandle>,
3525 tx_id: u32,
3526}
3527
3528impl std::ops::Drop for HostWatcherWatchResponder {
3532 fn drop(&mut self) {
3533 self.control_handle.shutdown();
3534 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
3536 }
3537}
3538
3539impl fidl::endpoints::Responder for HostWatcherWatchResponder {
3540 type ControlHandle = HostWatcherControlHandle;
3541
3542 fn control_handle(&self) -> &HostWatcherControlHandle {
3543 &self.control_handle
3544 }
3545
3546 fn drop_without_shutdown(mut self) {
3547 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
3549 std::mem::forget(self);
3551 }
3552}
3553
3554impl HostWatcherWatchResponder {
3555 pub fn send(self, mut hosts: &[HostInfo]) -> Result<(), fidl::Error> {
3559 let _result = self.send_raw(hosts);
3560 if _result.is_err() {
3561 self.control_handle.shutdown();
3562 }
3563 self.drop_without_shutdown();
3564 _result
3565 }
3566
3567 pub fn send_no_shutdown_on_err(self, mut hosts: &[HostInfo]) -> Result<(), fidl::Error> {
3569 let _result = self.send_raw(hosts);
3570 self.drop_without_shutdown();
3571 _result
3572 }
3573
3574 fn send_raw(&self, mut hosts: &[HostInfo]) -> Result<(), fidl::Error> {
3575 self.control_handle.inner.send::<HostWatcherWatchResponse>(
3576 (hosts,),
3577 self.tx_id,
3578 0x4e2c2972a5b16f9c,
3579 fidl::encoding::DynamicFlags::empty(),
3580 )
3581 }
3582}
3583
3584#[must_use = "FIDL methods require a response to be sent"]
3585#[derive(Debug)]
3586pub struct HostWatcherSetActiveResponder {
3587 control_handle: std::mem::ManuallyDrop<HostWatcherControlHandle>,
3588 tx_id: u32,
3589}
3590
3591impl std::ops::Drop for HostWatcherSetActiveResponder {
3595 fn drop(&mut self) {
3596 self.control_handle.shutdown();
3597 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
3599 }
3600}
3601
3602impl fidl::endpoints::Responder for HostWatcherSetActiveResponder {
3603 type ControlHandle = HostWatcherControlHandle;
3604
3605 fn control_handle(&self) -> &HostWatcherControlHandle {
3606 &self.control_handle
3607 }
3608
3609 fn drop_without_shutdown(mut self) {
3610 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
3612 std::mem::forget(self);
3614 }
3615}
3616
3617impl HostWatcherSetActiveResponder {
3618 pub fn send(self, mut result: Result<(), i32>) -> Result<(), fidl::Error> {
3622 let _result = self.send_raw(result);
3623 if _result.is_err() {
3624 self.control_handle.shutdown();
3625 }
3626 self.drop_without_shutdown();
3627 _result
3628 }
3629
3630 pub fn send_no_shutdown_on_err(self, mut result: Result<(), i32>) -> Result<(), fidl::Error> {
3632 let _result = self.send_raw(result);
3633 self.drop_without_shutdown();
3634 _result
3635 }
3636
3637 fn send_raw(&self, mut result: Result<(), i32>) -> Result<(), fidl::Error> {
3638 self.control_handle
3639 .inner
3640 .send::<fidl::encoding::ResultType<fidl::encoding::EmptyStruct, i32>>(
3641 result,
3642 self.tx_id,
3643 0x83f311ecaf0ddf3,
3644 fidl::encoding::DynamicFlags::empty(),
3645 )
3646 }
3647}
3648
3649#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
3650pub struct PairingMarker;
3651
3652impl fidl::endpoints::ProtocolMarker for PairingMarker {
3653 type Proxy = PairingProxy;
3654 type RequestStream = PairingRequestStream;
3655 #[cfg(target_os = "fuchsia")]
3656 type SynchronousProxy = PairingSynchronousProxy;
3657
3658 const DEBUG_NAME: &'static str = "fuchsia.bluetooth.sys.Pairing";
3659}
3660impl fidl::endpoints::DiscoverableProtocolMarker for PairingMarker {}
3661
3662pub trait PairingProxyInterface: Send + Sync {
3663 fn r#set_pairing_delegate(
3664 &self,
3665 input: InputCapability,
3666 output: OutputCapability,
3667 delegate: fidl::endpoints::ClientEnd<PairingDelegateMarker>,
3668 ) -> Result<(), fidl::Error>;
3669 fn r#set_delegate(
3670 &self,
3671 input: InputCapability,
3672 output: OutputCapability,
3673 delegate: fidl::endpoints::ClientEnd<PairingDelegate2Marker>,
3674 ) -> Result<(), fidl::Error>;
3675}
3676#[derive(Debug)]
3677#[cfg(target_os = "fuchsia")]
3678pub struct PairingSynchronousProxy {
3679 client: fidl::client::sync::Client,
3680}
3681
3682#[cfg(target_os = "fuchsia")]
3683impl fidl::endpoints::SynchronousProxy for PairingSynchronousProxy {
3684 type Proxy = PairingProxy;
3685 type Protocol = PairingMarker;
3686
3687 fn from_channel(inner: fidl::Channel) -> Self {
3688 Self::new(inner)
3689 }
3690
3691 fn into_channel(self) -> fidl::Channel {
3692 self.client.into_channel()
3693 }
3694
3695 fn as_channel(&self) -> &fidl::Channel {
3696 self.client.as_channel()
3697 }
3698}
3699
3700#[cfg(target_os = "fuchsia")]
3701impl PairingSynchronousProxy {
3702 pub fn new(channel: fidl::Channel) -> Self {
3703 let protocol_name = <PairingMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
3704 Self { client: fidl::client::sync::Client::new(channel, protocol_name) }
3705 }
3706
3707 pub fn into_channel(self) -> fidl::Channel {
3708 self.client.into_channel()
3709 }
3710
3711 pub fn wait_for_event(
3714 &self,
3715 deadline: zx::MonotonicInstant,
3716 ) -> Result<PairingEvent, fidl::Error> {
3717 PairingEvent::decode(self.client.wait_for_event(deadline)?)
3718 }
3719
3720 pub fn r#set_pairing_delegate(
3735 &self,
3736 mut input: InputCapability,
3737 mut output: OutputCapability,
3738 mut delegate: fidl::endpoints::ClientEnd<PairingDelegateMarker>,
3739 ) -> Result<(), fidl::Error> {
3740 self.client.send::<PairingSetPairingDelegateRequest>(
3741 (input, output, delegate),
3742 0x19721a12cb80212c,
3743 fidl::encoding::DynamicFlags::empty(),
3744 )
3745 }
3746
3747 pub fn r#set_delegate(
3765 &self,
3766 mut input: InputCapability,
3767 mut output: OutputCapability,
3768 mut delegate: fidl::endpoints::ClientEnd<PairingDelegate2Marker>,
3769 ) -> Result<(), fidl::Error> {
3770 self.client.send::<PairingSetDelegateRequest>(
3771 (input, output, delegate),
3772 0x1da0568d2582a9a5,
3773 fidl::encoding::DynamicFlags::empty(),
3774 )
3775 }
3776}
3777
3778#[cfg(target_os = "fuchsia")]
3779impl From<PairingSynchronousProxy> for zx::Handle {
3780 fn from(value: PairingSynchronousProxy) -> Self {
3781 value.into_channel().into()
3782 }
3783}
3784
3785#[cfg(target_os = "fuchsia")]
3786impl From<fidl::Channel> for PairingSynchronousProxy {
3787 fn from(value: fidl::Channel) -> Self {
3788 Self::new(value)
3789 }
3790}
3791
3792#[derive(Debug, Clone)]
3793pub struct PairingProxy {
3794 client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
3795}
3796
3797impl fidl::endpoints::Proxy for PairingProxy {
3798 type Protocol = PairingMarker;
3799
3800 fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
3801 Self::new(inner)
3802 }
3803
3804 fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
3805 self.client.into_channel().map_err(|client| Self { client })
3806 }
3807
3808 fn as_channel(&self) -> &::fidl::AsyncChannel {
3809 self.client.as_channel()
3810 }
3811}
3812
3813impl PairingProxy {
3814 pub fn new(channel: ::fidl::AsyncChannel) -> Self {
3816 let protocol_name = <PairingMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
3817 Self { client: fidl::client::Client::new(channel, protocol_name) }
3818 }
3819
3820 pub fn take_event_stream(&self) -> PairingEventStream {
3826 PairingEventStream { event_receiver: self.client.take_event_receiver() }
3827 }
3828
3829 pub fn r#set_pairing_delegate(
3844 &self,
3845 mut input: InputCapability,
3846 mut output: OutputCapability,
3847 mut delegate: fidl::endpoints::ClientEnd<PairingDelegateMarker>,
3848 ) -> Result<(), fidl::Error> {
3849 PairingProxyInterface::r#set_pairing_delegate(self, input, output, delegate)
3850 }
3851
3852 pub fn r#set_delegate(
3870 &self,
3871 mut input: InputCapability,
3872 mut output: OutputCapability,
3873 mut delegate: fidl::endpoints::ClientEnd<PairingDelegate2Marker>,
3874 ) -> Result<(), fidl::Error> {
3875 PairingProxyInterface::r#set_delegate(self, input, output, delegate)
3876 }
3877}
3878
3879impl PairingProxyInterface for PairingProxy {
3880 fn r#set_pairing_delegate(
3881 &self,
3882 mut input: InputCapability,
3883 mut output: OutputCapability,
3884 mut delegate: fidl::endpoints::ClientEnd<PairingDelegateMarker>,
3885 ) -> Result<(), fidl::Error> {
3886 self.client.send::<PairingSetPairingDelegateRequest>(
3887 (input, output, delegate),
3888 0x19721a12cb80212c,
3889 fidl::encoding::DynamicFlags::empty(),
3890 )
3891 }
3892
3893 fn r#set_delegate(
3894 &self,
3895 mut input: InputCapability,
3896 mut output: OutputCapability,
3897 mut delegate: fidl::endpoints::ClientEnd<PairingDelegate2Marker>,
3898 ) -> Result<(), fidl::Error> {
3899 self.client.send::<PairingSetDelegateRequest>(
3900 (input, output, delegate),
3901 0x1da0568d2582a9a5,
3902 fidl::encoding::DynamicFlags::empty(),
3903 )
3904 }
3905}
3906
3907pub struct PairingEventStream {
3908 event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
3909}
3910
3911impl std::marker::Unpin for PairingEventStream {}
3912
3913impl futures::stream::FusedStream for PairingEventStream {
3914 fn is_terminated(&self) -> bool {
3915 self.event_receiver.is_terminated()
3916 }
3917}
3918
3919impl futures::Stream for PairingEventStream {
3920 type Item = Result<PairingEvent, fidl::Error>;
3921
3922 fn poll_next(
3923 mut self: std::pin::Pin<&mut Self>,
3924 cx: &mut std::task::Context<'_>,
3925 ) -> std::task::Poll<Option<Self::Item>> {
3926 match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
3927 &mut self.event_receiver,
3928 cx
3929 )?) {
3930 Some(buf) => std::task::Poll::Ready(Some(PairingEvent::decode(buf))),
3931 None => std::task::Poll::Ready(None),
3932 }
3933 }
3934}
3935
3936#[derive(Debug)]
3937pub enum PairingEvent {}
3938
3939impl PairingEvent {
3940 fn decode(
3942 mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
3943 ) -> Result<PairingEvent, fidl::Error> {
3944 let (bytes, _handles) = buf.split_mut();
3945 let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
3946 debug_assert_eq!(tx_header.tx_id, 0);
3947 match tx_header.ordinal {
3948 _ => Err(fidl::Error::UnknownOrdinal {
3949 ordinal: tx_header.ordinal,
3950 protocol_name: <PairingMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
3951 }),
3952 }
3953 }
3954}
3955
3956pub struct PairingRequestStream {
3958 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
3959 is_terminated: bool,
3960}
3961
3962impl std::marker::Unpin for PairingRequestStream {}
3963
3964impl futures::stream::FusedStream for PairingRequestStream {
3965 fn is_terminated(&self) -> bool {
3966 self.is_terminated
3967 }
3968}
3969
3970impl fidl::endpoints::RequestStream for PairingRequestStream {
3971 type Protocol = PairingMarker;
3972 type ControlHandle = PairingControlHandle;
3973
3974 fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
3975 Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
3976 }
3977
3978 fn control_handle(&self) -> Self::ControlHandle {
3979 PairingControlHandle { inner: self.inner.clone() }
3980 }
3981
3982 fn into_inner(
3983 self,
3984 ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
3985 {
3986 (self.inner, self.is_terminated)
3987 }
3988
3989 fn from_inner(
3990 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
3991 is_terminated: bool,
3992 ) -> Self {
3993 Self { inner, is_terminated }
3994 }
3995}
3996
3997impl futures::Stream for PairingRequestStream {
3998 type Item = Result<PairingRequest, fidl::Error>;
3999
4000 fn poll_next(
4001 mut self: std::pin::Pin<&mut Self>,
4002 cx: &mut std::task::Context<'_>,
4003 ) -> std::task::Poll<Option<Self::Item>> {
4004 let this = &mut *self;
4005 if this.inner.check_shutdown(cx) {
4006 this.is_terminated = true;
4007 return std::task::Poll::Ready(None);
4008 }
4009 if this.is_terminated {
4010 panic!("polled PairingRequestStream after completion");
4011 }
4012 fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
4013 |bytes, handles| {
4014 match this.inner.channel().read_etc(cx, bytes, handles) {
4015 std::task::Poll::Ready(Ok(())) => {}
4016 std::task::Poll::Pending => return std::task::Poll::Pending,
4017 std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
4018 this.is_terminated = true;
4019 return std::task::Poll::Ready(None);
4020 }
4021 std::task::Poll::Ready(Err(e)) => {
4022 return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
4023 e.into(),
4024 ))))
4025 }
4026 }
4027
4028 let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
4030
4031 std::task::Poll::Ready(Some(match header.ordinal {
4032 0x19721a12cb80212c => {
4033 header.validate_request_tx_id(fidl::MethodType::OneWay)?;
4034 let mut req = fidl::new_empty!(
4035 PairingSetPairingDelegateRequest,
4036 fidl::encoding::DefaultFuchsiaResourceDialect
4037 );
4038 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<PairingSetPairingDelegateRequest>(&header, _body_bytes, handles, &mut req)?;
4039 let control_handle = PairingControlHandle { inner: this.inner.clone() };
4040 Ok(PairingRequest::SetPairingDelegate {
4041 input: req.input,
4042 output: req.output,
4043 delegate: req.delegate,
4044
4045 control_handle,
4046 })
4047 }
4048 0x1da0568d2582a9a5 => {
4049 header.validate_request_tx_id(fidl::MethodType::OneWay)?;
4050 let mut req = fidl::new_empty!(
4051 PairingSetDelegateRequest,
4052 fidl::encoding::DefaultFuchsiaResourceDialect
4053 );
4054 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<PairingSetDelegateRequest>(&header, _body_bytes, handles, &mut req)?;
4055 let control_handle = PairingControlHandle { inner: this.inner.clone() };
4056 Ok(PairingRequest::SetDelegate {
4057 input: req.input,
4058 output: req.output,
4059 delegate: req.delegate,
4060
4061 control_handle,
4062 })
4063 }
4064 _ => Err(fidl::Error::UnknownOrdinal {
4065 ordinal: header.ordinal,
4066 protocol_name:
4067 <PairingMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
4068 }),
4069 }))
4070 },
4071 )
4072 }
4073}
4074
4075#[derive(Debug)]
4077pub enum PairingRequest {
4078 SetPairingDelegate {
4093 input: InputCapability,
4094 output: OutputCapability,
4095 delegate: fidl::endpoints::ClientEnd<PairingDelegateMarker>,
4096 control_handle: PairingControlHandle,
4097 },
4098 SetDelegate {
4116 input: InputCapability,
4117 output: OutputCapability,
4118 delegate: fidl::endpoints::ClientEnd<PairingDelegate2Marker>,
4119 control_handle: PairingControlHandle,
4120 },
4121}
4122
4123impl PairingRequest {
4124 #[allow(irrefutable_let_patterns)]
4125 pub fn into_set_pairing_delegate(
4126 self,
4127 ) -> Option<(
4128 InputCapability,
4129 OutputCapability,
4130 fidl::endpoints::ClientEnd<PairingDelegateMarker>,
4131 PairingControlHandle,
4132 )> {
4133 if let PairingRequest::SetPairingDelegate { input, output, delegate, control_handle } = self
4134 {
4135 Some((input, output, delegate, control_handle))
4136 } else {
4137 None
4138 }
4139 }
4140
4141 #[allow(irrefutable_let_patterns)]
4142 pub fn into_set_delegate(
4143 self,
4144 ) -> Option<(
4145 InputCapability,
4146 OutputCapability,
4147 fidl::endpoints::ClientEnd<PairingDelegate2Marker>,
4148 PairingControlHandle,
4149 )> {
4150 if let PairingRequest::SetDelegate { input, output, delegate, control_handle } = self {
4151 Some((input, output, delegate, control_handle))
4152 } else {
4153 None
4154 }
4155 }
4156
4157 pub fn method_name(&self) -> &'static str {
4159 match *self {
4160 PairingRequest::SetPairingDelegate { .. } => "set_pairing_delegate",
4161 PairingRequest::SetDelegate { .. } => "set_delegate",
4162 }
4163 }
4164}
4165
4166#[derive(Debug, Clone)]
4167pub struct PairingControlHandle {
4168 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
4169}
4170
4171impl fidl::endpoints::ControlHandle for PairingControlHandle {
4172 fn shutdown(&self) {
4173 self.inner.shutdown()
4174 }
4175 fn shutdown_with_epitaph(&self, status: zx_status::Status) {
4176 self.inner.shutdown_with_epitaph(status)
4177 }
4178
4179 fn is_closed(&self) -> bool {
4180 self.inner.channel().is_closed()
4181 }
4182 fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
4183 self.inner.channel().on_closed()
4184 }
4185
4186 #[cfg(target_os = "fuchsia")]
4187 fn signal_peer(
4188 &self,
4189 clear_mask: zx::Signals,
4190 set_mask: zx::Signals,
4191 ) -> Result<(), zx_status::Status> {
4192 use fidl::Peered;
4193 self.inner.channel().signal_peer(clear_mask, set_mask)
4194 }
4195}
4196
4197impl PairingControlHandle {}
4198
4199#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
4200pub struct PairingDelegateMarker;
4201
4202impl fidl::endpoints::ProtocolMarker for PairingDelegateMarker {
4203 type Proxy = PairingDelegateProxy;
4204 type RequestStream = PairingDelegateRequestStream;
4205 #[cfg(target_os = "fuchsia")]
4206 type SynchronousProxy = PairingDelegateSynchronousProxy;
4207
4208 const DEBUG_NAME: &'static str = "(anonymous) PairingDelegate";
4209}
4210
4211pub trait PairingDelegateProxyInterface: Send + Sync {
4212 type OnPairingRequestResponseFut: std::future::Future<Output = Result<(bool, u32), fidl::Error>>
4213 + Send;
4214 fn r#on_pairing_request(
4215 &self,
4216 peer: &Peer,
4217 method: PairingMethod,
4218 displayed_passkey: u32,
4219 ) -> Self::OnPairingRequestResponseFut;
4220 fn r#on_pairing_complete(
4221 &self,
4222 id: &fidl_fuchsia_bluetooth::PeerId,
4223 success: bool,
4224 ) -> Result<(), fidl::Error>;
4225 fn r#on_remote_keypress(
4226 &self,
4227 id: &fidl_fuchsia_bluetooth::PeerId,
4228 keypress: PairingKeypress,
4229 ) -> Result<(), fidl::Error>;
4230}
4231#[derive(Debug)]
4232#[cfg(target_os = "fuchsia")]
4233pub struct PairingDelegateSynchronousProxy {
4234 client: fidl::client::sync::Client,
4235}
4236
4237#[cfg(target_os = "fuchsia")]
4238impl fidl::endpoints::SynchronousProxy for PairingDelegateSynchronousProxy {
4239 type Proxy = PairingDelegateProxy;
4240 type Protocol = PairingDelegateMarker;
4241
4242 fn from_channel(inner: fidl::Channel) -> Self {
4243 Self::new(inner)
4244 }
4245
4246 fn into_channel(self) -> fidl::Channel {
4247 self.client.into_channel()
4248 }
4249
4250 fn as_channel(&self) -> &fidl::Channel {
4251 self.client.as_channel()
4252 }
4253}
4254
4255#[cfg(target_os = "fuchsia")]
4256impl PairingDelegateSynchronousProxy {
4257 pub fn new(channel: fidl::Channel) -> Self {
4258 let protocol_name = <PairingDelegateMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
4259 Self { client: fidl::client::sync::Client::new(channel, protocol_name) }
4260 }
4261
4262 pub fn into_channel(self) -> fidl::Channel {
4263 self.client.into_channel()
4264 }
4265
4266 pub fn wait_for_event(
4269 &self,
4270 deadline: zx::MonotonicInstant,
4271 ) -> Result<PairingDelegateEvent, fidl::Error> {
4272 PairingDelegateEvent::decode(self.client.wait_for_event(deadline)?)
4273 }
4274
4275 pub fn r#on_pairing_request(
4294 &self,
4295 mut peer: &Peer,
4296 mut method: PairingMethod,
4297 mut displayed_passkey: u32,
4298 ___deadline: zx::MonotonicInstant,
4299 ) -> Result<(bool, u32), fidl::Error> {
4300 let _response = self.client.send_query::<
4301 PairingDelegateOnPairingRequestRequest,
4302 PairingDelegateOnPairingRequestResponse,
4303 >(
4304 (peer, method, displayed_passkey,),
4305 0x5c483a8f97b226b3,
4306 fidl::encoding::DynamicFlags::empty(),
4307 ___deadline,
4308 )?;
4309 Ok((_response.accept, _response.entered_passkey))
4310 }
4311
4312 pub fn r#on_pairing_complete(
4318 &self,
4319 mut id: &fidl_fuchsia_bluetooth::PeerId,
4320 mut success: bool,
4321 ) -> Result<(), fidl::Error> {
4322 self.client.send::<PairingDelegateOnPairingCompleteRequest>(
4323 (id, success),
4324 0x5ad8fc9864eba757,
4325 fidl::encoding::DynamicFlags::empty(),
4326 )
4327 }
4328
4329 pub fn r#on_remote_keypress(
4343 &self,
4344 mut id: &fidl_fuchsia_bluetooth::PeerId,
4345 mut keypress: PairingKeypress,
4346 ) -> Result<(), fidl::Error> {
4347 self.client.send::<PairingDelegateOnRemoteKeypressRequest>(
4348 (id, keypress),
4349 0x4e341e41c604c724,
4350 fidl::encoding::DynamicFlags::empty(),
4351 )
4352 }
4353}
4354
4355#[cfg(target_os = "fuchsia")]
4356impl From<PairingDelegateSynchronousProxy> for zx::Handle {
4357 fn from(value: PairingDelegateSynchronousProxy) -> Self {
4358 value.into_channel().into()
4359 }
4360}
4361
4362#[cfg(target_os = "fuchsia")]
4363impl From<fidl::Channel> for PairingDelegateSynchronousProxy {
4364 fn from(value: fidl::Channel) -> Self {
4365 Self::new(value)
4366 }
4367}
4368
4369#[derive(Debug, Clone)]
4370pub struct PairingDelegateProxy {
4371 client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
4372}
4373
4374impl fidl::endpoints::Proxy for PairingDelegateProxy {
4375 type Protocol = PairingDelegateMarker;
4376
4377 fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
4378 Self::new(inner)
4379 }
4380
4381 fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
4382 self.client.into_channel().map_err(|client| Self { client })
4383 }
4384
4385 fn as_channel(&self) -> &::fidl::AsyncChannel {
4386 self.client.as_channel()
4387 }
4388}
4389
4390impl PairingDelegateProxy {
4391 pub fn new(channel: ::fidl::AsyncChannel) -> Self {
4393 let protocol_name = <PairingDelegateMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
4394 Self { client: fidl::client::Client::new(channel, protocol_name) }
4395 }
4396
4397 pub fn take_event_stream(&self) -> PairingDelegateEventStream {
4403 PairingDelegateEventStream { event_receiver: self.client.take_event_receiver() }
4404 }
4405
4406 pub fn r#on_pairing_request(
4425 &self,
4426 mut peer: &Peer,
4427 mut method: PairingMethod,
4428 mut displayed_passkey: u32,
4429 ) -> fidl::client::QueryResponseFut<(bool, u32), fidl::encoding::DefaultFuchsiaResourceDialect>
4430 {
4431 PairingDelegateProxyInterface::r#on_pairing_request(self, peer, method, displayed_passkey)
4432 }
4433
4434 pub fn r#on_pairing_complete(
4440 &self,
4441 mut id: &fidl_fuchsia_bluetooth::PeerId,
4442 mut success: bool,
4443 ) -> Result<(), fidl::Error> {
4444 PairingDelegateProxyInterface::r#on_pairing_complete(self, id, success)
4445 }
4446
4447 pub fn r#on_remote_keypress(
4461 &self,
4462 mut id: &fidl_fuchsia_bluetooth::PeerId,
4463 mut keypress: PairingKeypress,
4464 ) -> Result<(), fidl::Error> {
4465 PairingDelegateProxyInterface::r#on_remote_keypress(self, id, keypress)
4466 }
4467}
4468
4469impl PairingDelegateProxyInterface for PairingDelegateProxy {
4470 type OnPairingRequestResponseFut =
4471 fidl::client::QueryResponseFut<(bool, u32), fidl::encoding::DefaultFuchsiaResourceDialect>;
4472 fn r#on_pairing_request(
4473 &self,
4474 mut peer: &Peer,
4475 mut method: PairingMethod,
4476 mut displayed_passkey: u32,
4477 ) -> Self::OnPairingRequestResponseFut {
4478 fn _decode(
4479 mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
4480 ) -> Result<(bool, u32), fidl::Error> {
4481 let _response = fidl::client::decode_transaction_body::<
4482 PairingDelegateOnPairingRequestResponse,
4483 fidl::encoding::DefaultFuchsiaResourceDialect,
4484 0x5c483a8f97b226b3,
4485 >(_buf?)?;
4486 Ok((_response.accept, _response.entered_passkey))
4487 }
4488 self.client.send_query_and_decode::<PairingDelegateOnPairingRequestRequest, (bool, u32)>(
4489 (peer, method, displayed_passkey),
4490 0x5c483a8f97b226b3,
4491 fidl::encoding::DynamicFlags::empty(),
4492 _decode,
4493 )
4494 }
4495
4496 fn r#on_pairing_complete(
4497 &self,
4498 mut id: &fidl_fuchsia_bluetooth::PeerId,
4499 mut success: bool,
4500 ) -> Result<(), fidl::Error> {
4501 self.client.send::<PairingDelegateOnPairingCompleteRequest>(
4502 (id, success),
4503 0x5ad8fc9864eba757,
4504 fidl::encoding::DynamicFlags::empty(),
4505 )
4506 }
4507
4508 fn r#on_remote_keypress(
4509 &self,
4510 mut id: &fidl_fuchsia_bluetooth::PeerId,
4511 mut keypress: PairingKeypress,
4512 ) -> Result<(), fidl::Error> {
4513 self.client.send::<PairingDelegateOnRemoteKeypressRequest>(
4514 (id, keypress),
4515 0x4e341e41c604c724,
4516 fidl::encoding::DynamicFlags::empty(),
4517 )
4518 }
4519}
4520
4521pub struct PairingDelegateEventStream {
4522 event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
4523}
4524
4525impl std::marker::Unpin for PairingDelegateEventStream {}
4526
4527impl futures::stream::FusedStream for PairingDelegateEventStream {
4528 fn is_terminated(&self) -> bool {
4529 self.event_receiver.is_terminated()
4530 }
4531}
4532
4533impl futures::Stream for PairingDelegateEventStream {
4534 type Item = Result<PairingDelegateEvent, fidl::Error>;
4535
4536 fn poll_next(
4537 mut self: std::pin::Pin<&mut Self>,
4538 cx: &mut std::task::Context<'_>,
4539 ) -> std::task::Poll<Option<Self::Item>> {
4540 match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
4541 &mut self.event_receiver,
4542 cx
4543 )?) {
4544 Some(buf) => std::task::Poll::Ready(Some(PairingDelegateEvent::decode(buf))),
4545 None => std::task::Poll::Ready(None),
4546 }
4547 }
4548}
4549
4550#[derive(Debug)]
4551pub enum PairingDelegateEvent {
4552 OnLocalKeypress { id: fidl_fuchsia_bluetooth::PeerId, keypress: PairingKeypress },
4553}
4554
4555impl PairingDelegateEvent {
4556 #[allow(irrefutable_let_patterns)]
4557 pub fn into_on_local_keypress(
4558 self,
4559 ) -> Option<(fidl_fuchsia_bluetooth::PeerId, PairingKeypress)> {
4560 if let PairingDelegateEvent::OnLocalKeypress { id, keypress } = self {
4561 Some((id, keypress))
4562 } else {
4563 None
4564 }
4565 }
4566
4567 fn decode(
4569 mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
4570 ) -> Result<PairingDelegateEvent, fidl::Error> {
4571 let (bytes, _handles) = buf.split_mut();
4572 let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
4573 debug_assert_eq!(tx_header.tx_id, 0);
4574 match tx_header.ordinal {
4575 0x1a764c0428878889 => {
4576 let mut out = fidl::new_empty!(
4577 PairingDelegateOnLocalKeypressRequest,
4578 fidl::encoding::DefaultFuchsiaResourceDialect
4579 );
4580 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<PairingDelegateOnLocalKeypressRequest>(&tx_header, _body_bytes, _handles, &mut out)?;
4581 Ok((PairingDelegateEvent::OnLocalKeypress { id: out.id, keypress: out.keypress }))
4582 }
4583 _ => Err(fidl::Error::UnknownOrdinal {
4584 ordinal: tx_header.ordinal,
4585 protocol_name:
4586 <PairingDelegateMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
4587 }),
4588 }
4589 }
4590}
4591
4592pub struct PairingDelegateRequestStream {
4594 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
4595 is_terminated: bool,
4596}
4597
4598impl std::marker::Unpin for PairingDelegateRequestStream {}
4599
4600impl futures::stream::FusedStream for PairingDelegateRequestStream {
4601 fn is_terminated(&self) -> bool {
4602 self.is_terminated
4603 }
4604}
4605
4606impl fidl::endpoints::RequestStream for PairingDelegateRequestStream {
4607 type Protocol = PairingDelegateMarker;
4608 type ControlHandle = PairingDelegateControlHandle;
4609
4610 fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
4611 Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
4612 }
4613
4614 fn control_handle(&self) -> Self::ControlHandle {
4615 PairingDelegateControlHandle { inner: self.inner.clone() }
4616 }
4617
4618 fn into_inner(
4619 self,
4620 ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
4621 {
4622 (self.inner, self.is_terminated)
4623 }
4624
4625 fn from_inner(
4626 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
4627 is_terminated: bool,
4628 ) -> Self {
4629 Self { inner, is_terminated }
4630 }
4631}
4632
4633impl futures::Stream for PairingDelegateRequestStream {
4634 type Item = Result<PairingDelegateRequest, fidl::Error>;
4635
4636 fn poll_next(
4637 mut self: std::pin::Pin<&mut Self>,
4638 cx: &mut std::task::Context<'_>,
4639 ) -> std::task::Poll<Option<Self::Item>> {
4640 let this = &mut *self;
4641 if this.inner.check_shutdown(cx) {
4642 this.is_terminated = true;
4643 return std::task::Poll::Ready(None);
4644 }
4645 if this.is_terminated {
4646 panic!("polled PairingDelegateRequestStream after completion");
4647 }
4648 fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
4649 |bytes, handles| {
4650 match this.inner.channel().read_etc(cx, bytes, handles) {
4651 std::task::Poll::Ready(Ok(())) => {}
4652 std::task::Poll::Pending => return std::task::Poll::Pending,
4653 std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
4654 this.is_terminated = true;
4655 return std::task::Poll::Ready(None);
4656 }
4657 std::task::Poll::Ready(Err(e)) => {
4658 return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
4659 e.into(),
4660 ))))
4661 }
4662 }
4663
4664 let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
4666
4667 std::task::Poll::Ready(Some(match header.ordinal {
4668 0x5c483a8f97b226b3 => {
4669 header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
4670 let mut req = fidl::new_empty!(
4671 PairingDelegateOnPairingRequestRequest,
4672 fidl::encoding::DefaultFuchsiaResourceDialect
4673 );
4674 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<PairingDelegateOnPairingRequestRequest>(&header, _body_bytes, handles, &mut req)?;
4675 let control_handle =
4676 PairingDelegateControlHandle { inner: this.inner.clone() };
4677 Ok(PairingDelegateRequest::OnPairingRequest {
4678 peer: req.peer,
4679 method: req.method,
4680 displayed_passkey: req.displayed_passkey,
4681
4682 responder: PairingDelegateOnPairingRequestResponder {
4683 control_handle: std::mem::ManuallyDrop::new(control_handle),
4684 tx_id: header.tx_id,
4685 },
4686 })
4687 }
4688 0x5ad8fc9864eba757 => {
4689 header.validate_request_tx_id(fidl::MethodType::OneWay)?;
4690 let mut req = fidl::new_empty!(
4691 PairingDelegateOnPairingCompleteRequest,
4692 fidl::encoding::DefaultFuchsiaResourceDialect
4693 );
4694 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<PairingDelegateOnPairingCompleteRequest>(&header, _body_bytes, handles, &mut req)?;
4695 let control_handle =
4696 PairingDelegateControlHandle { inner: this.inner.clone() };
4697 Ok(PairingDelegateRequest::OnPairingComplete {
4698 id: req.id,
4699 success: req.success,
4700
4701 control_handle,
4702 })
4703 }
4704 0x4e341e41c604c724 => {
4705 header.validate_request_tx_id(fidl::MethodType::OneWay)?;
4706 let mut req = fidl::new_empty!(
4707 PairingDelegateOnRemoteKeypressRequest,
4708 fidl::encoding::DefaultFuchsiaResourceDialect
4709 );
4710 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<PairingDelegateOnRemoteKeypressRequest>(&header, _body_bytes, handles, &mut req)?;
4711 let control_handle =
4712 PairingDelegateControlHandle { inner: this.inner.clone() };
4713 Ok(PairingDelegateRequest::OnRemoteKeypress {
4714 id: req.id,
4715 keypress: req.keypress,
4716
4717 control_handle,
4718 })
4719 }
4720 _ => Err(fidl::Error::UnknownOrdinal {
4721 ordinal: header.ordinal,
4722 protocol_name:
4723 <PairingDelegateMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
4724 }),
4725 }))
4726 },
4727 )
4728 }
4729}
4730
4731#[derive(Debug)]
4743pub enum PairingDelegateRequest {
4744 OnPairingRequest {
4763 peer: Peer,
4764 method: PairingMethod,
4765 displayed_passkey: u32,
4766 responder: PairingDelegateOnPairingRequestResponder,
4767 },
4768 OnPairingComplete {
4774 id: fidl_fuchsia_bluetooth::PeerId,
4775 success: bool,
4776 control_handle: PairingDelegateControlHandle,
4777 },
4778 OnRemoteKeypress {
4792 id: fidl_fuchsia_bluetooth::PeerId,
4793 keypress: PairingKeypress,
4794 control_handle: PairingDelegateControlHandle,
4795 },
4796}
4797
4798impl PairingDelegateRequest {
4799 #[allow(irrefutable_let_patterns)]
4800 pub fn into_on_pairing_request(
4801 self,
4802 ) -> Option<(Peer, PairingMethod, u32, PairingDelegateOnPairingRequestResponder)> {
4803 if let PairingDelegateRequest::OnPairingRequest {
4804 peer,
4805 method,
4806 displayed_passkey,
4807 responder,
4808 } = self
4809 {
4810 Some((peer, method, displayed_passkey, responder))
4811 } else {
4812 None
4813 }
4814 }
4815
4816 #[allow(irrefutable_let_patterns)]
4817 pub fn into_on_pairing_complete(
4818 self,
4819 ) -> Option<(fidl_fuchsia_bluetooth::PeerId, bool, PairingDelegateControlHandle)> {
4820 if let PairingDelegateRequest::OnPairingComplete { id, success, control_handle } = self {
4821 Some((id, success, control_handle))
4822 } else {
4823 None
4824 }
4825 }
4826
4827 #[allow(irrefutable_let_patterns)]
4828 pub fn into_on_remote_keypress(
4829 self,
4830 ) -> Option<(fidl_fuchsia_bluetooth::PeerId, PairingKeypress, PairingDelegateControlHandle)>
4831 {
4832 if let PairingDelegateRequest::OnRemoteKeypress { id, keypress, control_handle } = self {
4833 Some((id, keypress, control_handle))
4834 } else {
4835 None
4836 }
4837 }
4838
4839 pub fn method_name(&self) -> &'static str {
4841 match *self {
4842 PairingDelegateRequest::OnPairingRequest { .. } => "on_pairing_request",
4843 PairingDelegateRequest::OnPairingComplete { .. } => "on_pairing_complete",
4844 PairingDelegateRequest::OnRemoteKeypress { .. } => "on_remote_keypress",
4845 }
4846 }
4847}
4848
4849#[derive(Debug, Clone)]
4850pub struct PairingDelegateControlHandle {
4851 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
4852}
4853
4854impl fidl::endpoints::ControlHandle for PairingDelegateControlHandle {
4855 fn shutdown(&self) {
4856 self.inner.shutdown()
4857 }
4858 fn shutdown_with_epitaph(&self, status: zx_status::Status) {
4859 self.inner.shutdown_with_epitaph(status)
4860 }
4861
4862 fn is_closed(&self) -> bool {
4863 self.inner.channel().is_closed()
4864 }
4865 fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
4866 self.inner.channel().on_closed()
4867 }
4868
4869 #[cfg(target_os = "fuchsia")]
4870 fn signal_peer(
4871 &self,
4872 clear_mask: zx::Signals,
4873 set_mask: zx::Signals,
4874 ) -> Result<(), zx_status::Status> {
4875 use fidl::Peered;
4876 self.inner.channel().signal_peer(clear_mask, set_mask)
4877 }
4878}
4879
4880impl PairingDelegateControlHandle {
4881 pub fn send_on_local_keypress(
4882 &self,
4883 mut id: &fidl_fuchsia_bluetooth::PeerId,
4884 mut keypress: PairingKeypress,
4885 ) -> Result<(), fidl::Error> {
4886 self.inner.send::<PairingDelegateOnLocalKeypressRequest>(
4887 (id, keypress),
4888 0,
4889 0x1a764c0428878889,
4890 fidl::encoding::DynamicFlags::empty(),
4891 )
4892 }
4893}
4894
4895#[must_use = "FIDL methods require a response to be sent"]
4896#[derive(Debug)]
4897pub struct PairingDelegateOnPairingRequestResponder {
4898 control_handle: std::mem::ManuallyDrop<PairingDelegateControlHandle>,
4899 tx_id: u32,
4900}
4901
4902impl std::ops::Drop for PairingDelegateOnPairingRequestResponder {
4906 fn drop(&mut self) {
4907 self.control_handle.shutdown();
4908 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
4910 }
4911}
4912
4913impl fidl::endpoints::Responder for PairingDelegateOnPairingRequestResponder {
4914 type ControlHandle = PairingDelegateControlHandle;
4915
4916 fn control_handle(&self) -> &PairingDelegateControlHandle {
4917 &self.control_handle
4918 }
4919
4920 fn drop_without_shutdown(mut self) {
4921 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
4923 std::mem::forget(self);
4925 }
4926}
4927
4928impl PairingDelegateOnPairingRequestResponder {
4929 pub fn send(self, mut accept: bool, mut entered_passkey: u32) -> Result<(), fidl::Error> {
4933 let _result = self.send_raw(accept, entered_passkey);
4934 if _result.is_err() {
4935 self.control_handle.shutdown();
4936 }
4937 self.drop_without_shutdown();
4938 _result
4939 }
4940
4941 pub fn send_no_shutdown_on_err(
4943 self,
4944 mut accept: bool,
4945 mut entered_passkey: u32,
4946 ) -> Result<(), fidl::Error> {
4947 let _result = self.send_raw(accept, entered_passkey);
4948 self.drop_without_shutdown();
4949 _result
4950 }
4951
4952 fn send_raw(&self, mut accept: bool, mut entered_passkey: u32) -> Result<(), fidl::Error> {
4953 self.control_handle.inner.send::<PairingDelegateOnPairingRequestResponse>(
4954 (accept, entered_passkey),
4955 self.tx_id,
4956 0x5c483a8f97b226b3,
4957 fidl::encoding::DynamicFlags::empty(),
4958 )
4959 }
4960}
4961
4962#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
4963pub struct PairingDelegate2Marker;
4964
4965impl fidl::endpoints::ProtocolMarker for PairingDelegate2Marker {
4966 type Proxy = PairingDelegate2Proxy;
4967 type RequestStream = PairingDelegate2RequestStream;
4968 #[cfg(target_os = "fuchsia")]
4969 type SynchronousProxy = PairingDelegate2SynchronousProxy;
4970
4971 const DEBUG_NAME: &'static str = "(anonymous) PairingDelegate2";
4972}
4973
4974pub trait PairingDelegate2ProxyInterface: Send + Sync {
4975 fn r#start_request(
4976 &self,
4977 payload: PairingDelegate2StartRequestRequest,
4978 ) -> Result<(), fidl::Error>;
4979 fn r#request_complete(
4980 &self,
4981 id: &fidl_fuchsia_bluetooth::PeerId,
4982 success: bool,
4983 ) -> Result<(), fidl::Error>;
4984}
4985#[derive(Debug)]
4986#[cfg(target_os = "fuchsia")]
4987pub struct PairingDelegate2SynchronousProxy {
4988 client: fidl::client::sync::Client,
4989}
4990
4991#[cfg(target_os = "fuchsia")]
4992impl fidl::endpoints::SynchronousProxy for PairingDelegate2SynchronousProxy {
4993 type Proxy = PairingDelegate2Proxy;
4994 type Protocol = PairingDelegate2Marker;
4995
4996 fn from_channel(inner: fidl::Channel) -> Self {
4997 Self::new(inner)
4998 }
4999
5000 fn into_channel(self) -> fidl::Channel {
5001 self.client.into_channel()
5002 }
5003
5004 fn as_channel(&self) -> &fidl::Channel {
5005 self.client.as_channel()
5006 }
5007}
5008
5009#[cfg(target_os = "fuchsia")]
5010impl PairingDelegate2SynchronousProxy {
5011 pub fn new(channel: fidl::Channel) -> Self {
5012 let protocol_name = <PairingDelegate2Marker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
5013 Self { client: fidl::client::sync::Client::new(channel, protocol_name) }
5014 }
5015
5016 pub fn into_channel(self) -> fidl::Channel {
5017 self.client.into_channel()
5018 }
5019
5020 pub fn wait_for_event(
5023 &self,
5024 deadline: zx::MonotonicInstant,
5025 ) -> Result<PairingDelegate2Event, fidl::Error> {
5026 PairingDelegate2Event::decode(self.client.wait_for_event(deadline)?)
5027 }
5028
5029 pub fn r#start_request(
5041 &self,
5042 mut payload: PairingDelegate2StartRequestRequest,
5043 ) -> Result<(), fidl::Error> {
5044 self.client.send::<PairingDelegate2StartRequestRequest>(
5045 &mut payload,
5046 0x2a5ab8092a961a01,
5047 fidl::encoding::DynamicFlags::empty(),
5048 )
5049 }
5050
5051 pub fn r#request_complete(
5058 &self,
5059 mut id: &fidl_fuchsia_bluetooth::PeerId,
5060 mut success: bool,
5061 ) -> Result<(), fidl::Error> {
5062 self.client.send::<PairingDelegate2RequestCompleteRequest>(
5063 (id, success),
5064 0x4b63b44d5dbca192,
5065 fidl::encoding::DynamicFlags::empty(),
5066 )
5067 }
5068}
5069
5070#[cfg(target_os = "fuchsia")]
5071impl From<PairingDelegate2SynchronousProxy> for zx::Handle {
5072 fn from(value: PairingDelegate2SynchronousProxy) -> Self {
5073 value.into_channel().into()
5074 }
5075}
5076
5077#[cfg(target_os = "fuchsia")]
5078impl From<fidl::Channel> for PairingDelegate2SynchronousProxy {
5079 fn from(value: fidl::Channel) -> Self {
5080 Self::new(value)
5081 }
5082}
5083
5084#[derive(Debug, Clone)]
5085pub struct PairingDelegate2Proxy {
5086 client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
5087}
5088
5089impl fidl::endpoints::Proxy for PairingDelegate2Proxy {
5090 type Protocol = PairingDelegate2Marker;
5091
5092 fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
5093 Self::new(inner)
5094 }
5095
5096 fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
5097 self.client.into_channel().map_err(|client| Self { client })
5098 }
5099
5100 fn as_channel(&self) -> &::fidl::AsyncChannel {
5101 self.client.as_channel()
5102 }
5103}
5104
5105impl PairingDelegate2Proxy {
5106 pub fn new(channel: ::fidl::AsyncChannel) -> Self {
5108 let protocol_name = <PairingDelegate2Marker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
5109 Self { client: fidl::client::Client::new(channel, protocol_name) }
5110 }
5111
5112 pub fn take_event_stream(&self) -> PairingDelegate2EventStream {
5118 PairingDelegate2EventStream { event_receiver: self.client.take_event_receiver() }
5119 }
5120
5121 pub fn r#start_request(
5133 &self,
5134 mut payload: PairingDelegate2StartRequestRequest,
5135 ) -> Result<(), fidl::Error> {
5136 PairingDelegate2ProxyInterface::r#start_request(self, payload)
5137 }
5138
5139 pub fn r#request_complete(
5146 &self,
5147 mut id: &fidl_fuchsia_bluetooth::PeerId,
5148 mut success: bool,
5149 ) -> Result<(), fidl::Error> {
5150 PairingDelegate2ProxyInterface::r#request_complete(self, id, success)
5151 }
5152}
5153
5154impl PairingDelegate2ProxyInterface for PairingDelegate2Proxy {
5155 fn r#start_request(
5156 &self,
5157 mut payload: PairingDelegate2StartRequestRequest,
5158 ) -> Result<(), fidl::Error> {
5159 self.client.send::<PairingDelegate2StartRequestRequest>(
5160 &mut payload,
5161 0x2a5ab8092a961a01,
5162 fidl::encoding::DynamicFlags::empty(),
5163 )
5164 }
5165
5166 fn r#request_complete(
5167 &self,
5168 mut id: &fidl_fuchsia_bluetooth::PeerId,
5169 mut success: bool,
5170 ) -> Result<(), fidl::Error> {
5171 self.client.send::<PairingDelegate2RequestCompleteRequest>(
5172 (id, success),
5173 0x4b63b44d5dbca192,
5174 fidl::encoding::DynamicFlags::empty(),
5175 )
5176 }
5177}
5178
5179pub struct PairingDelegate2EventStream {
5180 event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
5181}
5182
5183impl std::marker::Unpin for PairingDelegate2EventStream {}
5184
5185impl futures::stream::FusedStream for PairingDelegate2EventStream {
5186 fn is_terminated(&self) -> bool {
5187 self.event_receiver.is_terminated()
5188 }
5189}
5190
5191impl futures::Stream for PairingDelegate2EventStream {
5192 type Item = Result<PairingDelegate2Event, fidl::Error>;
5193
5194 fn poll_next(
5195 mut self: std::pin::Pin<&mut Self>,
5196 cx: &mut std::task::Context<'_>,
5197 ) -> std::task::Poll<Option<Self::Item>> {
5198 match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
5199 &mut self.event_receiver,
5200 cx
5201 )?) {
5202 Some(buf) => std::task::Poll::Ready(Some(PairingDelegate2Event::decode(buf))),
5203 None => std::task::Poll::Ready(None),
5204 }
5205 }
5206}
5207
5208#[derive(Debug)]
5209pub enum PairingDelegate2Event {}
5210
5211impl PairingDelegate2Event {
5212 fn decode(
5214 mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
5215 ) -> Result<PairingDelegate2Event, fidl::Error> {
5216 let (bytes, _handles) = buf.split_mut();
5217 let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
5218 debug_assert_eq!(tx_header.tx_id, 0);
5219 match tx_header.ordinal {
5220 _ => Err(fidl::Error::UnknownOrdinal {
5221 ordinal: tx_header.ordinal,
5222 protocol_name:
5223 <PairingDelegate2Marker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
5224 }),
5225 }
5226 }
5227}
5228
5229pub struct PairingDelegate2RequestStream {
5231 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
5232 is_terminated: bool,
5233}
5234
5235impl std::marker::Unpin for PairingDelegate2RequestStream {}
5236
5237impl futures::stream::FusedStream for PairingDelegate2RequestStream {
5238 fn is_terminated(&self) -> bool {
5239 self.is_terminated
5240 }
5241}
5242
5243impl fidl::endpoints::RequestStream for PairingDelegate2RequestStream {
5244 type Protocol = PairingDelegate2Marker;
5245 type ControlHandle = PairingDelegate2ControlHandle;
5246
5247 fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
5248 Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
5249 }
5250
5251 fn control_handle(&self) -> Self::ControlHandle {
5252 PairingDelegate2ControlHandle { inner: self.inner.clone() }
5253 }
5254
5255 fn into_inner(
5256 self,
5257 ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
5258 {
5259 (self.inner, self.is_terminated)
5260 }
5261
5262 fn from_inner(
5263 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
5264 is_terminated: bool,
5265 ) -> Self {
5266 Self { inner, is_terminated }
5267 }
5268}
5269
5270impl futures::Stream for PairingDelegate2RequestStream {
5271 type Item = Result<PairingDelegate2Request, fidl::Error>;
5272
5273 fn poll_next(
5274 mut self: std::pin::Pin<&mut Self>,
5275 cx: &mut std::task::Context<'_>,
5276 ) -> std::task::Poll<Option<Self::Item>> {
5277 let this = &mut *self;
5278 if this.inner.check_shutdown(cx) {
5279 this.is_terminated = true;
5280 return std::task::Poll::Ready(None);
5281 }
5282 if this.is_terminated {
5283 panic!("polled PairingDelegate2RequestStream after completion");
5284 }
5285 fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
5286 |bytes, handles| {
5287 match this.inner.channel().read_etc(cx, bytes, handles) {
5288 std::task::Poll::Ready(Ok(())) => {}
5289 std::task::Poll::Pending => return std::task::Poll::Pending,
5290 std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
5291 this.is_terminated = true;
5292 return std::task::Poll::Ready(None);
5293 }
5294 std::task::Poll::Ready(Err(e)) => {
5295 return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
5296 e.into(),
5297 ))))
5298 }
5299 }
5300
5301 let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
5303
5304 std::task::Poll::Ready(Some(match header.ordinal {
5305 0x2a5ab8092a961a01 => {
5306 header.validate_request_tx_id(fidl::MethodType::OneWay)?;
5307 let mut req = fidl::new_empty!(
5308 PairingDelegate2StartRequestRequest,
5309 fidl::encoding::DefaultFuchsiaResourceDialect
5310 );
5311 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<PairingDelegate2StartRequestRequest>(&header, _body_bytes, handles, &mut req)?;
5312 let control_handle =
5313 PairingDelegate2ControlHandle { inner: this.inner.clone() };
5314 Ok(PairingDelegate2Request::StartRequest { payload: req, control_handle })
5315 }
5316 0x4b63b44d5dbca192 => {
5317 header.validate_request_tx_id(fidl::MethodType::OneWay)?;
5318 let mut req = fidl::new_empty!(
5319 PairingDelegate2RequestCompleteRequest,
5320 fidl::encoding::DefaultFuchsiaResourceDialect
5321 );
5322 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<PairingDelegate2RequestCompleteRequest>(&header, _body_bytes, handles, &mut req)?;
5323 let control_handle =
5324 PairingDelegate2ControlHandle { inner: this.inner.clone() };
5325 Ok(PairingDelegate2Request::RequestComplete {
5326 id: req.id,
5327 success: req.success,
5328
5329 control_handle,
5330 })
5331 }
5332 _ => Err(fidl::Error::UnknownOrdinal {
5333 ordinal: header.ordinal,
5334 protocol_name:
5335 <PairingDelegate2Marker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
5336 }),
5337 }))
5338 },
5339 )
5340 }
5341}
5342
5343#[derive(Debug)]
5355pub enum PairingDelegate2Request {
5356 StartRequest {
5368 payload: PairingDelegate2StartRequestRequest,
5369 control_handle: PairingDelegate2ControlHandle,
5370 },
5371 RequestComplete {
5378 id: fidl_fuchsia_bluetooth::PeerId,
5379 success: bool,
5380 control_handle: PairingDelegate2ControlHandle,
5381 },
5382}
5383
5384impl PairingDelegate2Request {
5385 #[allow(irrefutable_let_patterns)]
5386 pub fn into_start_request(
5387 self,
5388 ) -> Option<(PairingDelegate2StartRequestRequest, PairingDelegate2ControlHandle)> {
5389 if let PairingDelegate2Request::StartRequest { payload, control_handle } = self {
5390 Some((payload, control_handle))
5391 } else {
5392 None
5393 }
5394 }
5395
5396 #[allow(irrefutable_let_patterns)]
5397 pub fn into_request_complete(
5398 self,
5399 ) -> Option<(fidl_fuchsia_bluetooth::PeerId, bool, PairingDelegate2ControlHandle)> {
5400 if let PairingDelegate2Request::RequestComplete { id, success, control_handle } = self {
5401 Some((id, success, control_handle))
5402 } else {
5403 None
5404 }
5405 }
5406
5407 pub fn method_name(&self) -> &'static str {
5409 match *self {
5410 PairingDelegate2Request::StartRequest { .. } => "start_request",
5411 PairingDelegate2Request::RequestComplete { .. } => "request_complete",
5412 }
5413 }
5414}
5415
5416#[derive(Debug, Clone)]
5417pub struct PairingDelegate2ControlHandle {
5418 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
5419}
5420
5421impl fidl::endpoints::ControlHandle for PairingDelegate2ControlHandle {
5422 fn shutdown(&self) {
5423 self.inner.shutdown()
5424 }
5425 fn shutdown_with_epitaph(&self, status: zx_status::Status) {
5426 self.inner.shutdown_with_epitaph(status)
5427 }
5428
5429 fn is_closed(&self) -> bool {
5430 self.inner.channel().is_closed()
5431 }
5432 fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
5433 self.inner.channel().on_closed()
5434 }
5435
5436 #[cfg(target_os = "fuchsia")]
5437 fn signal_peer(
5438 &self,
5439 clear_mask: zx::Signals,
5440 set_mask: zx::Signals,
5441 ) -> Result<(), zx_status::Status> {
5442 use fidl::Peered;
5443 self.inner.channel().signal_peer(clear_mask, set_mask)
5444 }
5445}
5446
5447impl PairingDelegate2ControlHandle {}
5448
5449#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
5450pub struct PairingRequestMarker;
5451
5452impl fidl::endpoints::ProtocolMarker for PairingRequestMarker {
5453 type Proxy = PairingRequestProxy;
5454 type RequestStream = PairingRequestRequestStream;
5455 #[cfg(target_os = "fuchsia")]
5456 type SynchronousProxy = PairingRequestSynchronousProxy;
5457
5458 const DEBUG_NAME: &'static str = "(anonymous) PairingRequest";
5459}
5460
5461pub trait PairingRequestProxyInterface: Send + Sync {
5462 fn r#accept(&self, payload: &PairingRequestAcceptRequest) -> Result<(), fidl::Error>;
5463 fn r#reject(&self) -> Result<(), fidl::Error>;
5464 type KeypressResponseFut: std::future::Future<Output = Result<(), fidl::Error>> + Send;
5465 fn r#keypress(&self, keypress: PairingKeypress) -> Self::KeypressResponseFut;
5466}
5467#[derive(Debug)]
5468#[cfg(target_os = "fuchsia")]
5469pub struct PairingRequestSynchronousProxy {
5470 client: fidl::client::sync::Client,
5471}
5472
5473#[cfg(target_os = "fuchsia")]
5474impl fidl::endpoints::SynchronousProxy for PairingRequestSynchronousProxy {
5475 type Proxy = PairingRequestProxy;
5476 type Protocol = PairingRequestMarker;
5477
5478 fn from_channel(inner: fidl::Channel) -> Self {
5479 Self::new(inner)
5480 }
5481
5482 fn into_channel(self) -> fidl::Channel {
5483 self.client.into_channel()
5484 }
5485
5486 fn as_channel(&self) -> &fidl::Channel {
5487 self.client.as_channel()
5488 }
5489}
5490
5491#[cfg(target_os = "fuchsia")]
5492impl PairingRequestSynchronousProxy {
5493 pub fn new(channel: fidl::Channel) -> Self {
5494 let protocol_name = <PairingRequestMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
5495 Self { client: fidl::client::sync::Client::new(channel, protocol_name) }
5496 }
5497
5498 pub fn into_channel(self) -> fidl::Channel {
5499 self.client.into_channel()
5500 }
5501
5502 pub fn wait_for_event(
5505 &self,
5506 deadline: zx::MonotonicInstant,
5507 ) -> Result<PairingRequestEvent, fidl::Error> {
5508 PairingRequestEvent::decode(self.client.wait_for_event(deadline)?)
5509 }
5510
5511 pub fn r#accept(&self, mut payload: &PairingRequestAcceptRequest) -> Result<(), fidl::Error> {
5515 self.client.send::<PairingRequestAcceptRequest>(
5516 payload,
5517 0x67278857ae043a5,
5518 fidl::encoding::DynamicFlags::empty(),
5519 )
5520 }
5521
5522 pub fn r#reject(&self) -> Result<(), fidl::Error> {
5525 self.client.send::<fidl::encoding::EmptyPayload>(
5526 (),
5527 0x550414aec8155cf5,
5528 fidl::encoding::DynamicFlags::empty(),
5529 )
5530 }
5531
5532 pub fn r#keypress(
5536 &self,
5537 mut keypress: PairingKeypress,
5538 ___deadline: zx::MonotonicInstant,
5539 ) -> Result<(), fidl::Error> {
5540 let _response =
5541 self.client.send_query::<PairingRequestKeypressRequest, fidl::encoding::EmptyPayload>(
5542 (keypress,),
5543 0x53948ecc921fbe9b,
5544 fidl::encoding::DynamicFlags::empty(),
5545 ___deadline,
5546 )?;
5547 Ok(_response)
5548 }
5549}
5550
5551#[cfg(target_os = "fuchsia")]
5552impl From<PairingRequestSynchronousProxy> for zx::Handle {
5553 fn from(value: PairingRequestSynchronousProxy) -> Self {
5554 value.into_channel().into()
5555 }
5556}
5557
5558#[cfg(target_os = "fuchsia")]
5559impl From<fidl::Channel> for PairingRequestSynchronousProxy {
5560 fn from(value: fidl::Channel) -> Self {
5561 Self::new(value)
5562 }
5563}
5564
5565#[derive(Debug, Clone)]
5566pub struct PairingRequestProxy {
5567 client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
5568}
5569
5570impl fidl::endpoints::Proxy for PairingRequestProxy {
5571 type Protocol = PairingRequestMarker;
5572
5573 fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
5574 Self::new(inner)
5575 }
5576
5577 fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
5578 self.client.into_channel().map_err(|client| Self { client })
5579 }
5580
5581 fn as_channel(&self) -> &::fidl::AsyncChannel {
5582 self.client.as_channel()
5583 }
5584}
5585
5586impl PairingRequestProxy {
5587 pub fn new(channel: ::fidl::AsyncChannel) -> Self {
5589 let protocol_name = <PairingRequestMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
5590 Self { client: fidl::client::Client::new(channel, protocol_name) }
5591 }
5592
5593 pub fn take_event_stream(&self) -> PairingRequestEventStream {
5599 PairingRequestEventStream { event_receiver: self.client.take_event_receiver() }
5600 }
5601
5602 pub fn r#accept(&self, mut payload: &PairingRequestAcceptRequest) -> Result<(), fidl::Error> {
5606 PairingRequestProxyInterface::r#accept(self, payload)
5607 }
5608
5609 pub fn r#reject(&self) -> Result<(), fidl::Error> {
5612 PairingRequestProxyInterface::r#reject(self)
5613 }
5614
5615 pub fn r#keypress(
5619 &self,
5620 mut keypress: PairingKeypress,
5621 ) -> fidl::client::QueryResponseFut<(), fidl::encoding::DefaultFuchsiaResourceDialect> {
5622 PairingRequestProxyInterface::r#keypress(self, keypress)
5623 }
5624}
5625
5626impl PairingRequestProxyInterface for PairingRequestProxy {
5627 fn r#accept(&self, mut payload: &PairingRequestAcceptRequest) -> Result<(), fidl::Error> {
5628 self.client.send::<PairingRequestAcceptRequest>(
5629 payload,
5630 0x67278857ae043a5,
5631 fidl::encoding::DynamicFlags::empty(),
5632 )
5633 }
5634
5635 fn r#reject(&self) -> Result<(), fidl::Error> {
5636 self.client.send::<fidl::encoding::EmptyPayload>(
5637 (),
5638 0x550414aec8155cf5,
5639 fidl::encoding::DynamicFlags::empty(),
5640 )
5641 }
5642
5643 type KeypressResponseFut =
5644 fidl::client::QueryResponseFut<(), fidl::encoding::DefaultFuchsiaResourceDialect>;
5645 fn r#keypress(&self, mut keypress: PairingKeypress) -> Self::KeypressResponseFut {
5646 fn _decode(
5647 mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
5648 ) -> Result<(), fidl::Error> {
5649 let _response = fidl::client::decode_transaction_body::<
5650 fidl::encoding::EmptyPayload,
5651 fidl::encoding::DefaultFuchsiaResourceDialect,
5652 0x53948ecc921fbe9b,
5653 >(_buf?)?;
5654 Ok(_response)
5655 }
5656 self.client.send_query_and_decode::<PairingRequestKeypressRequest, ()>(
5657 (keypress,),
5658 0x53948ecc921fbe9b,
5659 fidl::encoding::DynamicFlags::empty(),
5660 _decode,
5661 )
5662 }
5663}
5664
5665pub struct PairingRequestEventStream {
5666 event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
5667}
5668
5669impl std::marker::Unpin for PairingRequestEventStream {}
5670
5671impl futures::stream::FusedStream for PairingRequestEventStream {
5672 fn is_terminated(&self) -> bool {
5673 self.event_receiver.is_terminated()
5674 }
5675}
5676
5677impl futures::Stream for PairingRequestEventStream {
5678 type Item = Result<PairingRequestEvent, fidl::Error>;
5679
5680 fn poll_next(
5681 mut self: std::pin::Pin<&mut Self>,
5682 cx: &mut std::task::Context<'_>,
5683 ) -> std::task::Poll<Option<Self::Item>> {
5684 match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
5685 &mut self.event_receiver,
5686 cx
5687 )?) {
5688 Some(buf) => std::task::Poll::Ready(Some(PairingRequestEvent::decode(buf))),
5689 None => std::task::Poll::Ready(None),
5690 }
5691 }
5692}
5693
5694#[derive(Debug)]
5695pub enum PairingRequestEvent {
5696 OnKeypress { keypress: PairingKeypress },
5697 OnComplete { success: bool },
5698}
5699
5700impl PairingRequestEvent {
5701 #[allow(irrefutable_let_patterns)]
5702 pub fn into_on_keypress(self) -> Option<PairingKeypress> {
5703 if let PairingRequestEvent::OnKeypress { keypress } = self {
5704 Some((keypress))
5705 } else {
5706 None
5707 }
5708 }
5709 #[allow(irrefutable_let_patterns)]
5710 pub fn into_on_complete(self) -> Option<bool> {
5711 if let PairingRequestEvent::OnComplete { success } = self {
5712 Some((success))
5713 } else {
5714 None
5715 }
5716 }
5717
5718 fn decode(
5720 mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
5721 ) -> Result<PairingRequestEvent, fidl::Error> {
5722 let (bytes, _handles) = buf.split_mut();
5723 let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
5724 debug_assert_eq!(tx_header.tx_id, 0);
5725 match tx_header.ordinal {
5726 0x71a4802e6a5d1aca => {
5727 let mut out = fidl::new_empty!(
5728 PairingRequestOnKeypressRequest,
5729 fidl::encoding::DefaultFuchsiaResourceDialect
5730 );
5731 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<PairingRequestOnKeypressRequest>(&tx_header, _body_bytes, _handles, &mut out)?;
5732 Ok((PairingRequestEvent::OnKeypress { keypress: out.keypress }))
5733 }
5734 0xd38d3220987bc79 => {
5735 let mut out = fidl::new_empty!(
5736 PairingRequestOnCompleteRequest,
5737 fidl::encoding::DefaultFuchsiaResourceDialect
5738 );
5739 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<PairingRequestOnCompleteRequest>(&tx_header, _body_bytes, _handles, &mut out)?;
5740 Ok((PairingRequestEvent::OnComplete { success: out.success }))
5741 }
5742 _ => Err(fidl::Error::UnknownOrdinal {
5743 ordinal: tx_header.ordinal,
5744 protocol_name:
5745 <PairingRequestMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
5746 }),
5747 }
5748 }
5749}
5750
5751pub struct PairingRequestRequestStream {
5753 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
5754 is_terminated: bool,
5755}
5756
5757impl std::marker::Unpin for PairingRequestRequestStream {}
5758
5759impl futures::stream::FusedStream for PairingRequestRequestStream {
5760 fn is_terminated(&self) -> bool {
5761 self.is_terminated
5762 }
5763}
5764
5765impl fidl::endpoints::RequestStream for PairingRequestRequestStream {
5766 type Protocol = PairingRequestMarker;
5767 type ControlHandle = PairingRequestControlHandle;
5768
5769 fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
5770 Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
5771 }
5772
5773 fn control_handle(&self) -> Self::ControlHandle {
5774 PairingRequestControlHandle { inner: self.inner.clone() }
5775 }
5776
5777 fn into_inner(
5778 self,
5779 ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
5780 {
5781 (self.inner, self.is_terminated)
5782 }
5783
5784 fn from_inner(
5785 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
5786 is_terminated: bool,
5787 ) -> Self {
5788 Self { inner, is_terminated }
5789 }
5790}
5791
5792impl futures::Stream for PairingRequestRequestStream {
5793 type Item = Result<PairingRequestRequest, fidl::Error>;
5794
5795 fn poll_next(
5796 mut self: std::pin::Pin<&mut Self>,
5797 cx: &mut std::task::Context<'_>,
5798 ) -> std::task::Poll<Option<Self::Item>> {
5799 let this = &mut *self;
5800 if this.inner.check_shutdown(cx) {
5801 this.is_terminated = true;
5802 return std::task::Poll::Ready(None);
5803 }
5804 if this.is_terminated {
5805 panic!("polled PairingRequestRequestStream after completion");
5806 }
5807 fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
5808 |bytes, handles| {
5809 match this.inner.channel().read_etc(cx, bytes, handles) {
5810 std::task::Poll::Ready(Ok(())) => {}
5811 std::task::Poll::Pending => return std::task::Poll::Pending,
5812 std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
5813 this.is_terminated = true;
5814 return std::task::Poll::Ready(None);
5815 }
5816 std::task::Poll::Ready(Err(e)) => {
5817 return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
5818 e.into(),
5819 ))))
5820 }
5821 }
5822
5823 let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
5825
5826 std::task::Poll::Ready(Some(match header.ordinal {
5827 0x67278857ae043a5 => {
5828 header.validate_request_tx_id(fidl::MethodType::OneWay)?;
5829 let mut req = fidl::new_empty!(
5830 PairingRequestAcceptRequest,
5831 fidl::encoding::DefaultFuchsiaResourceDialect
5832 );
5833 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<PairingRequestAcceptRequest>(&header, _body_bytes, handles, &mut req)?;
5834 let control_handle =
5835 PairingRequestControlHandle { inner: this.inner.clone() };
5836 Ok(PairingRequestRequest::Accept { payload: req, control_handle })
5837 }
5838 0x550414aec8155cf5 => {
5839 header.validate_request_tx_id(fidl::MethodType::OneWay)?;
5840 let mut req = fidl::new_empty!(
5841 fidl::encoding::EmptyPayload,
5842 fidl::encoding::DefaultFuchsiaResourceDialect
5843 );
5844 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
5845 let control_handle =
5846 PairingRequestControlHandle { inner: this.inner.clone() };
5847 Ok(PairingRequestRequest::Reject { control_handle })
5848 }
5849 0x53948ecc921fbe9b => {
5850 header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
5851 let mut req = fidl::new_empty!(
5852 PairingRequestKeypressRequest,
5853 fidl::encoding::DefaultFuchsiaResourceDialect
5854 );
5855 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<PairingRequestKeypressRequest>(&header, _body_bytes, handles, &mut req)?;
5856 let control_handle =
5857 PairingRequestControlHandle { inner: this.inner.clone() };
5858 Ok(PairingRequestRequest::Keypress {
5859 keypress: req.keypress,
5860
5861 responder: PairingRequestKeypressResponder {
5862 control_handle: std::mem::ManuallyDrop::new(control_handle),
5863 tx_id: header.tx_id,
5864 },
5865 })
5866 }
5867 _ => Err(fidl::Error::UnknownOrdinal {
5868 ordinal: header.ordinal,
5869 protocol_name:
5870 <PairingRequestMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
5871 }),
5872 }))
5873 },
5874 )
5875 }
5876}
5877
5878#[derive(Debug)]
5888pub enum PairingRequestRequest {
5889 Accept { payload: PairingRequestAcceptRequest, control_handle: PairingRequestControlHandle },
5893 Reject { control_handle: PairingRequestControlHandle },
5896 Keypress { keypress: PairingKeypress, responder: PairingRequestKeypressResponder },
5900}
5901
5902impl PairingRequestRequest {
5903 #[allow(irrefutable_let_patterns)]
5904 pub fn into_accept(self) -> Option<(PairingRequestAcceptRequest, PairingRequestControlHandle)> {
5905 if let PairingRequestRequest::Accept { payload, control_handle } = self {
5906 Some((payload, control_handle))
5907 } else {
5908 None
5909 }
5910 }
5911
5912 #[allow(irrefutable_let_patterns)]
5913 pub fn into_reject(self) -> Option<(PairingRequestControlHandle)> {
5914 if let PairingRequestRequest::Reject { control_handle } = self {
5915 Some((control_handle))
5916 } else {
5917 None
5918 }
5919 }
5920
5921 #[allow(irrefutable_let_patterns)]
5922 pub fn into_keypress(self) -> Option<(PairingKeypress, PairingRequestKeypressResponder)> {
5923 if let PairingRequestRequest::Keypress { keypress, responder } = self {
5924 Some((keypress, responder))
5925 } else {
5926 None
5927 }
5928 }
5929
5930 pub fn method_name(&self) -> &'static str {
5932 match *self {
5933 PairingRequestRequest::Accept { .. } => "accept",
5934 PairingRequestRequest::Reject { .. } => "reject",
5935 PairingRequestRequest::Keypress { .. } => "keypress",
5936 }
5937 }
5938}
5939
5940#[derive(Debug, Clone)]
5941pub struct PairingRequestControlHandle {
5942 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
5943}
5944
5945impl fidl::endpoints::ControlHandle for PairingRequestControlHandle {
5946 fn shutdown(&self) {
5947 self.inner.shutdown()
5948 }
5949 fn shutdown_with_epitaph(&self, status: zx_status::Status) {
5950 self.inner.shutdown_with_epitaph(status)
5951 }
5952
5953 fn is_closed(&self) -> bool {
5954 self.inner.channel().is_closed()
5955 }
5956 fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
5957 self.inner.channel().on_closed()
5958 }
5959
5960 #[cfg(target_os = "fuchsia")]
5961 fn signal_peer(
5962 &self,
5963 clear_mask: zx::Signals,
5964 set_mask: zx::Signals,
5965 ) -> Result<(), zx_status::Status> {
5966 use fidl::Peered;
5967 self.inner.channel().signal_peer(clear_mask, set_mask)
5968 }
5969}
5970
5971impl PairingRequestControlHandle {
5972 pub fn send_on_keypress(&self, mut keypress: PairingKeypress) -> Result<(), fidl::Error> {
5973 self.inner.send::<PairingRequestOnKeypressRequest>(
5974 (keypress,),
5975 0,
5976 0x71a4802e6a5d1aca,
5977 fidl::encoding::DynamicFlags::empty(),
5978 )
5979 }
5980
5981 pub fn send_on_complete(&self, mut success: bool) -> Result<(), fidl::Error> {
5982 self.inner.send::<PairingRequestOnCompleteRequest>(
5983 (success,),
5984 0,
5985 0xd38d3220987bc79,
5986 fidl::encoding::DynamicFlags::empty(),
5987 )
5988 }
5989}
5990
5991#[must_use = "FIDL methods require a response to be sent"]
5992#[derive(Debug)]
5993pub struct PairingRequestKeypressResponder {
5994 control_handle: std::mem::ManuallyDrop<PairingRequestControlHandle>,
5995 tx_id: u32,
5996}
5997
5998impl std::ops::Drop for PairingRequestKeypressResponder {
6002 fn drop(&mut self) {
6003 self.control_handle.shutdown();
6004 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
6006 }
6007}
6008
6009impl fidl::endpoints::Responder for PairingRequestKeypressResponder {
6010 type ControlHandle = PairingRequestControlHandle;
6011
6012 fn control_handle(&self) -> &PairingRequestControlHandle {
6013 &self.control_handle
6014 }
6015
6016 fn drop_without_shutdown(mut self) {
6017 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
6019 std::mem::forget(self);
6021 }
6022}
6023
6024impl PairingRequestKeypressResponder {
6025 pub fn send(self) -> Result<(), fidl::Error> {
6029 let _result = self.send_raw();
6030 if _result.is_err() {
6031 self.control_handle.shutdown();
6032 }
6033 self.drop_without_shutdown();
6034 _result
6035 }
6036
6037 pub fn send_no_shutdown_on_err(self) -> Result<(), fidl::Error> {
6039 let _result = self.send_raw();
6040 self.drop_without_shutdown();
6041 _result
6042 }
6043
6044 fn send_raw(&self) -> Result<(), fidl::Error> {
6045 self.control_handle.inner.send::<fidl::encoding::EmptyPayload>(
6046 (),
6047 self.tx_id,
6048 0x53948ecc921fbe9b,
6049 fidl::encoding::DynamicFlags::empty(),
6050 )
6051 }
6052}
6053
6054#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
6055pub struct ProcedureTokenMarker;
6056
6057impl fidl::endpoints::ProtocolMarker for ProcedureTokenMarker {
6058 type Proxy = ProcedureTokenProxy;
6059 type RequestStream = ProcedureTokenRequestStream;
6060 #[cfg(target_os = "fuchsia")]
6061 type SynchronousProxy = ProcedureTokenSynchronousProxy;
6062
6063 const DEBUG_NAME: &'static str = "(anonymous) ProcedureToken";
6064}
6065
6066pub trait ProcedureTokenProxyInterface: Send + Sync {}
6067#[derive(Debug)]
6068#[cfg(target_os = "fuchsia")]
6069pub struct ProcedureTokenSynchronousProxy {
6070 client: fidl::client::sync::Client,
6071}
6072
6073#[cfg(target_os = "fuchsia")]
6074impl fidl::endpoints::SynchronousProxy for ProcedureTokenSynchronousProxy {
6075 type Proxy = ProcedureTokenProxy;
6076 type Protocol = ProcedureTokenMarker;
6077
6078 fn from_channel(inner: fidl::Channel) -> Self {
6079 Self::new(inner)
6080 }
6081
6082 fn into_channel(self) -> fidl::Channel {
6083 self.client.into_channel()
6084 }
6085
6086 fn as_channel(&self) -> &fidl::Channel {
6087 self.client.as_channel()
6088 }
6089}
6090
6091#[cfg(target_os = "fuchsia")]
6092impl ProcedureTokenSynchronousProxy {
6093 pub fn new(channel: fidl::Channel) -> Self {
6094 let protocol_name = <ProcedureTokenMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
6095 Self { client: fidl::client::sync::Client::new(channel, protocol_name) }
6096 }
6097
6098 pub fn into_channel(self) -> fidl::Channel {
6099 self.client.into_channel()
6100 }
6101
6102 pub fn wait_for_event(
6105 &self,
6106 deadline: zx::MonotonicInstant,
6107 ) -> Result<ProcedureTokenEvent, fidl::Error> {
6108 ProcedureTokenEvent::decode(self.client.wait_for_event(deadline)?)
6109 }
6110}
6111
6112#[cfg(target_os = "fuchsia")]
6113impl From<ProcedureTokenSynchronousProxy> for zx::Handle {
6114 fn from(value: ProcedureTokenSynchronousProxy) -> Self {
6115 value.into_channel().into()
6116 }
6117}
6118
6119#[cfg(target_os = "fuchsia")]
6120impl From<fidl::Channel> for ProcedureTokenSynchronousProxy {
6121 fn from(value: fidl::Channel) -> Self {
6122 Self::new(value)
6123 }
6124}
6125
6126#[derive(Debug, Clone)]
6127pub struct ProcedureTokenProxy {
6128 client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
6129}
6130
6131impl fidl::endpoints::Proxy for ProcedureTokenProxy {
6132 type Protocol = ProcedureTokenMarker;
6133
6134 fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
6135 Self::new(inner)
6136 }
6137
6138 fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
6139 self.client.into_channel().map_err(|client| Self { client })
6140 }
6141
6142 fn as_channel(&self) -> &::fidl::AsyncChannel {
6143 self.client.as_channel()
6144 }
6145}
6146
6147impl ProcedureTokenProxy {
6148 pub fn new(channel: ::fidl::AsyncChannel) -> Self {
6150 let protocol_name = <ProcedureTokenMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
6151 Self { client: fidl::client::Client::new(channel, protocol_name) }
6152 }
6153
6154 pub fn take_event_stream(&self) -> ProcedureTokenEventStream {
6160 ProcedureTokenEventStream { event_receiver: self.client.take_event_receiver() }
6161 }
6162}
6163
6164impl ProcedureTokenProxyInterface for ProcedureTokenProxy {}
6165
6166pub struct ProcedureTokenEventStream {
6167 event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
6168}
6169
6170impl std::marker::Unpin for ProcedureTokenEventStream {}
6171
6172impl futures::stream::FusedStream for ProcedureTokenEventStream {
6173 fn is_terminated(&self) -> bool {
6174 self.event_receiver.is_terminated()
6175 }
6176}
6177
6178impl futures::Stream for ProcedureTokenEventStream {
6179 type Item = Result<ProcedureTokenEvent, fidl::Error>;
6180
6181 fn poll_next(
6182 mut self: std::pin::Pin<&mut Self>,
6183 cx: &mut std::task::Context<'_>,
6184 ) -> std::task::Poll<Option<Self::Item>> {
6185 match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
6186 &mut self.event_receiver,
6187 cx
6188 )?) {
6189 Some(buf) => std::task::Poll::Ready(Some(ProcedureTokenEvent::decode(buf))),
6190 None => std::task::Poll::Ready(None),
6191 }
6192 }
6193}
6194
6195#[derive(Debug)]
6196pub enum ProcedureTokenEvent {}
6197
6198impl ProcedureTokenEvent {
6199 fn decode(
6201 mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
6202 ) -> Result<ProcedureTokenEvent, fidl::Error> {
6203 let (bytes, _handles) = buf.split_mut();
6204 let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
6205 debug_assert_eq!(tx_header.tx_id, 0);
6206 match tx_header.ordinal {
6207 _ => Err(fidl::Error::UnknownOrdinal {
6208 ordinal: tx_header.ordinal,
6209 protocol_name:
6210 <ProcedureTokenMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
6211 }),
6212 }
6213 }
6214}
6215
6216pub struct ProcedureTokenRequestStream {
6218 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
6219 is_terminated: bool,
6220}
6221
6222impl std::marker::Unpin for ProcedureTokenRequestStream {}
6223
6224impl futures::stream::FusedStream for ProcedureTokenRequestStream {
6225 fn is_terminated(&self) -> bool {
6226 self.is_terminated
6227 }
6228}
6229
6230impl fidl::endpoints::RequestStream for ProcedureTokenRequestStream {
6231 type Protocol = ProcedureTokenMarker;
6232 type ControlHandle = ProcedureTokenControlHandle;
6233
6234 fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
6235 Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
6236 }
6237
6238 fn control_handle(&self) -> Self::ControlHandle {
6239 ProcedureTokenControlHandle { inner: self.inner.clone() }
6240 }
6241
6242 fn into_inner(
6243 self,
6244 ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
6245 {
6246 (self.inner, self.is_terminated)
6247 }
6248
6249 fn from_inner(
6250 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
6251 is_terminated: bool,
6252 ) -> Self {
6253 Self { inner, is_terminated }
6254 }
6255}
6256
6257impl futures::Stream for ProcedureTokenRequestStream {
6258 type Item = Result<ProcedureTokenRequest, fidl::Error>;
6259
6260 fn poll_next(
6261 mut self: std::pin::Pin<&mut Self>,
6262 cx: &mut std::task::Context<'_>,
6263 ) -> std::task::Poll<Option<Self::Item>> {
6264 let this = &mut *self;
6265 if this.inner.check_shutdown(cx) {
6266 this.is_terminated = true;
6267 return std::task::Poll::Ready(None);
6268 }
6269 if this.is_terminated {
6270 panic!("polled ProcedureTokenRequestStream after completion");
6271 }
6272 fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
6273 |bytes, handles| {
6274 match this.inner.channel().read_etc(cx, bytes, handles) {
6275 std::task::Poll::Ready(Ok(())) => {}
6276 std::task::Poll::Pending => return std::task::Poll::Pending,
6277 std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
6278 this.is_terminated = true;
6279 return std::task::Poll::Ready(None);
6280 }
6281 std::task::Poll::Ready(Err(e)) => {
6282 return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
6283 e.into(),
6284 ))))
6285 }
6286 }
6287
6288 let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
6290
6291 std::task::Poll::Ready(Some(match header.ordinal {
6292 _ => Err(fidl::Error::UnknownOrdinal {
6293 ordinal: header.ordinal,
6294 protocol_name:
6295 <ProcedureTokenMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
6296 }),
6297 }))
6298 },
6299 )
6300 }
6301}
6302
6303#[derive(Debug)]
6309pub enum ProcedureTokenRequest {}
6310
6311impl ProcedureTokenRequest {
6312 pub fn method_name(&self) -> &'static str {
6314 match *self {}
6315 }
6316}
6317
6318#[derive(Debug, Clone)]
6319pub struct ProcedureTokenControlHandle {
6320 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
6321}
6322
6323impl fidl::endpoints::ControlHandle for ProcedureTokenControlHandle {
6324 fn shutdown(&self) {
6325 self.inner.shutdown()
6326 }
6327 fn shutdown_with_epitaph(&self, status: zx_status::Status) {
6328 self.inner.shutdown_with_epitaph(status)
6329 }
6330
6331 fn is_closed(&self) -> bool {
6332 self.inner.channel().is_closed()
6333 }
6334 fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
6335 self.inner.channel().on_closed()
6336 }
6337
6338 #[cfg(target_os = "fuchsia")]
6339 fn signal_peer(
6340 &self,
6341 clear_mask: zx::Signals,
6342 set_mask: zx::Signals,
6343 ) -> Result<(), zx_status::Status> {
6344 use fidl::Peered;
6345 self.inner.channel().signal_peer(clear_mask, set_mask)
6346 }
6347}
6348
6349impl ProcedureTokenControlHandle {}
6350
6351mod internal {
6352 use super::*;
6353
6354 impl fidl::encoding::ResourceTypeMarker for AccessMakeDiscoverableRequest {
6355 type Borrowed<'a> = &'a mut Self;
6356 fn take_or_borrow<'a>(
6357 value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
6358 ) -> Self::Borrowed<'a> {
6359 value
6360 }
6361 }
6362
6363 unsafe impl fidl::encoding::TypeMarker for AccessMakeDiscoverableRequest {
6364 type Owned = Self;
6365
6366 #[inline(always)]
6367 fn inline_align(_context: fidl::encoding::Context) -> usize {
6368 4
6369 }
6370
6371 #[inline(always)]
6372 fn inline_size(_context: fidl::encoding::Context) -> usize {
6373 4
6374 }
6375 }
6376
6377 unsafe impl
6378 fidl::encoding::Encode<
6379 AccessMakeDiscoverableRequest,
6380 fidl::encoding::DefaultFuchsiaResourceDialect,
6381 > for &mut AccessMakeDiscoverableRequest
6382 {
6383 #[inline]
6384 unsafe fn encode(
6385 self,
6386 encoder: &mut fidl::encoding::Encoder<
6387 '_,
6388 fidl::encoding::DefaultFuchsiaResourceDialect,
6389 >,
6390 offset: usize,
6391 _depth: fidl::encoding::Depth,
6392 ) -> fidl::Result<()> {
6393 encoder.debug_check_bounds::<AccessMakeDiscoverableRequest>(offset);
6394 fidl::encoding::Encode::<AccessMakeDiscoverableRequest, fidl::encoding::DefaultFuchsiaResourceDialect>::encode(
6396 (
6397 <fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<ProcedureTokenMarker>> as fidl::encoding::ResourceTypeMarker>::take_or_borrow(&mut self.token),
6398 ),
6399 encoder, offset, _depth
6400 )
6401 }
6402 }
6403 unsafe impl<
6404 T0: fidl::encoding::Encode<
6405 fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<ProcedureTokenMarker>>,
6406 fidl::encoding::DefaultFuchsiaResourceDialect,
6407 >,
6408 >
6409 fidl::encoding::Encode<
6410 AccessMakeDiscoverableRequest,
6411 fidl::encoding::DefaultFuchsiaResourceDialect,
6412 > for (T0,)
6413 {
6414 #[inline]
6415 unsafe fn encode(
6416 self,
6417 encoder: &mut fidl::encoding::Encoder<
6418 '_,
6419 fidl::encoding::DefaultFuchsiaResourceDialect,
6420 >,
6421 offset: usize,
6422 depth: fidl::encoding::Depth,
6423 ) -> fidl::Result<()> {
6424 encoder.debug_check_bounds::<AccessMakeDiscoverableRequest>(offset);
6425 self.0.encode(encoder, offset + 0, depth)?;
6429 Ok(())
6430 }
6431 }
6432
6433 impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
6434 for AccessMakeDiscoverableRequest
6435 {
6436 #[inline(always)]
6437 fn new_empty() -> Self {
6438 Self {
6439 token: fidl::new_empty!(
6440 fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<ProcedureTokenMarker>>,
6441 fidl::encoding::DefaultFuchsiaResourceDialect
6442 ),
6443 }
6444 }
6445
6446 #[inline]
6447 unsafe fn decode(
6448 &mut self,
6449 decoder: &mut fidl::encoding::Decoder<
6450 '_,
6451 fidl::encoding::DefaultFuchsiaResourceDialect,
6452 >,
6453 offset: usize,
6454 _depth: fidl::encoding::Depth,
6455 ) -> fidl::Result<()> {
6456 decoder.debug_check_bounds::<Self>(offset);
6457 fidl::decode!(
6459 fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<ProcedureTokenMarker>>,
6460 fidl::encoding::DefaultFuchsiaResourceDialect,
6461 &mut self.token,
6462 decoder,
6463 offset + 0,
6464 _depth
6465 )?;
6466 Ok(())
6467 }
6468 }
6469
6470 impl fidl::encoding::ResourceTypeMarker for AccessSetPairingDelegateRequest {
6471 type Borrowed<'a> = &'a mut Self;
6472 fn take_or_borrow<'a>(
6473 value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
6474 ) -> Self::Borrowed<'a> {
6475 value
6476 }
6477 }
6478
6479 unsafe impl fidl::encoding::TypeMarker for AccessSetPairingDelegateRequest {
6480 type Owned = Self;
6481
6482 #[inline(always)]
6483 fn inline_align(_context: fidl::encoding::Context) -> usize {
6484 4
6485 }
6486
6487 #[inline(always)]
6488 fn inline_size(_context: fidl::encoding::Context) -> usize {
6489 12
6490 }
6491 }
6492
6493 unsafe impl
6494 fidl::encoding::Encode<
6495 AccessSetPairingDelegateRequest,
6496 fidl::encoding::DefaultFuchsiaResourceDialect,
6497 > for &mut AccessSetPairingDelegateRequest
6498 {
6499 #[inline]
6500 unsafe fn encode(
6501 self,
6502 encoder: &mut fidl::encoding::Encoder<
6503 '_,
6504 fidl::encoding::DefaultFuchsiaResourceDialect,
6505 >,
6506 offset: usize,
6507 _depth: fidl::encoding::Depth,
6508 ) -> fidl::Result<()> {
6509 encoder.debug_check_bounds::<AccessSetPairingDelegateRequest>(offset);
6510 fidl::encoding::Encode::<AccessSetPairingDelegateRequest, fidl::encoding::DefaultFuchsiaResourceDialect>::encode(
6512 (
6513 <InputCapability as fidl::encoding::ValueTypeMarker>::borrow(&self.input),
6514 <OutputCapability as fidl::encoding::ValueTypeMarker>::borrow(&self.output),
6515 <fidl::encoding::Endpoint<fidl::endpoints::ClientEnd<PairingDelegateMarker>> as fidl::encoding::ResourceTypeMarker>::take_or_borrow(&mut self.delegate),
6516 ),
6517 encoder, offset, _depth
6518 )
6519 }
6520 }
6521 unsafe impl<
6522 T0: fidl::encoding::Encode<InputCapability, fidl::encoding::DefaultFuchsiaResourceDialect>,
6523 T1: fidl::encoding::Encode<OutputCapability, fidl::encoding::DefaultFuchsiaResourceDialect>,
6524 T2: fidl::encoding::Encode<
6525 fidl::encoding::Endpoint<fidl::endpoints::ClientEnd<PairingDelegateMarker>>,
6526 fidl::encoding::DefaultFuchsiaResourceDialect,
6527 >,
6528 >
6529 fidl::encoding::Encode<
6530 AccessSetPairingDelegateRequest,
6531 fidl::encoding::DefaultFuchsiaResourceDialect,
6532 > for (T0, T1, T2)
6533 {
6534 #[inline]
6535 unsafe fn encode(
6536 self,
6537 encoder: &mut fidl::encoding::Encoder<
6538 '_,
6539 fidl::encoding::DefaultFuchsiaResourceDialect,
6540 >,
6541 offset: usize,
6542 depth: fidl::encoding::Depth,
6543 ) -> fidl::Result<()> {
6544 encoder.debug_check_bounds::<AccessSetPairingDelegateRequest>(offset);
6545 self.0.encode(encoder, offset + 0, depth)?;
6549 self.1.encode(encoder, offset + 4, depth)?;
6550 self.2.encode(encoder, offset + 8, depth)?;
6551 Ok(())
6552 }
6553 }
6554
6555 impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
6556 for AccessSetPairingDelegateRequest
6557 {
6558 #[inline(always)]
6559 fn new_empty() -> Self {
6560 Self {
6561 input: fidl::new_empty!(
6562 InputCapability,
6563 fidl::encoding::DefaultFuchsiaResourceDialect
6564 ),
6565 output: fidl::new_empty!(
6566 OutputCapability,
6567 fidl::encoding::DefaultFuchsiaResourceDialect
6568 ),
6569 delegate: fidl::new_empty!(
6570 fidl::encoding::Endpoint<fidl::endpoints::ClientEnd<PairingDelegateMarker>>,
6571 fidl::encoding::DefaultFuchsiaResourceDialect
6572 ),
6573 }
6574 }
6575
6576 #[inline]
6577 unsafe fn decode(
6578 &mut self,
6579 decoder: &mut fidl::encoding::Decoder<
6580 '_,
6581 fidl::encoding::DefaultFuchsiaResourceDialect,
6582 >,
6583 offset: usize,
6584 _depth: fidl::encoding::Depth,
6585 ) -> fidl::Result<()> {
6586 decoder.debug_check_bounds::<Self>(offset);
6587 fidl::decode!(
6589 InputCapability,
6590 fidl::encoding::DefaultFuchsiaResourceDialect,
6591 &mut self.input,
6592 decoder,
6593 offset + 0,
6594 _depth
6595 )?;
6596 fidl::decode!(
6597 OutputCapability,
6598 fidl::encoding::DefaultFuchsiaResourceDialect,
6599 &mut self.output,
6600 decoder,
6601 offset + 4,
6602 _depth
6603 )?;
6604 fidl::decode!(
6605 fidl::encoding::Endpoint<fidl::endpoints::ClientEnd<PairingDelegateMarker>>,
6606 fidl::encoding::DefaultFuchsiaResourceDialect,
6607 &mut self.delegate,
6608 decoder,
6609 offset + 8,
6610 _depth
6611 )?;
6612 Ok(())
6613 }
6614 }
6615
6616 impl fidl::encoding::ResourceTypeMarker for AccessStartDiscoveryRequest {
6617 type Borrowed<'a> = &'a mut Self;
6618 fn take_or_borrow<'a>(
6619 value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
6620 ) -> Self::Borrowed<'a> {
6621 value
6622 }
6623 }
6624
6625 unsafe impl fidl::encoding::TypeMarker for AccessStartDiscoveryRequest {
6626 type Owned = Self;
6627
6628 #[inline(always)]
6629 fn inline_align(_context: fidl::encoding::Context) -> usize {
6630 4
6631 }
6632
6633 #[inline(always)]
6634 fn inline_size(_context: fidl::encoding::Context) -> usize {
6635 4
6636 }
6637 }
6638
6639 unsafe impl
6640 fidl::encoding::Encode<
6641 AccessStartDiscoveryRequest,
6642 fidl::encoding::DefaultFuchsiaResourceDialect,
6643 > for &mut AccessStartDiscoveryRequest
6644 {
6645 #[inline]
6646 unsafe fn encode(
6647 self,
6648 encoder: &mut fidl::encoding::Encoder<
6649 '_,
6650 fidl::encoding::DefaultFuchsiaResourceDialect,
6651 >,
6652 offset: usize,
6653 _depth: fidl::encoding::Depth,
6654 ) -> fidl::Result<()> {
6655 encoder.debug_check_bounds::<AccessStartDiscoveryRequest>(offset);
6656 fidl::encoding::Encode::<AccessStartDiscoveryRequest, fidl::encoding::DefaultFuchsiaResourceDialect>::encode(
6658 (
6659 <fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<ProcedureTokenMarker>> as fidl::encoding::ResourceTypeMarker>::take_or_borrow(&mut self.token),
6660 ),
6661 encoder, offset, _depth
6662 )
6663 }
6664 }
6665 unsafe impl<
6666 T0: fidl::encoding::Encode<
6667 fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<ProcedureTokenMarker>>,
6668 fidl::encoding::DefaultFuchsiaResourceDialect,
6669 >,
6670 >
6671 fidl::encoding::Encode<
6672 AccessStartDiscoveryRequest,
6673 fidl::encoding::DefaultFuchsiaResourceDialect,
6674 > for (T0,)
6675 {
6676 #[inline]
6677 unsafe fn encode(
6678 self,
6679 encoder: &mut fidl::encoding::Encoder<
6680 '_,
6681 fidl::encoding::DefaultFuchsiaResourceDialect,
6682 >,
6683 offset: usize,
6684 depth: fidl::encoding::Depth,
6685 ) -> fidl::Result<()> {
6686 encoder.debug_check_bounds::<AccessStartDiscoveryRequest>(offset);
6687 self.0.encode(encoder, offset + 0, depth)?;
6691 Ok(())
6692 }
6693 }
6694
6695 impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
6696 for AccessStartDiscoveryRequest
6697 {
6698 #[inline(always)]
6699 fn new_empty() -> Self {
6700 Self {
6701 token: fidl::new_empty!(
6702 fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<ProcedureTokenMarker>>,
6703 fidl::encoding::DefaultFuchsiaResourceDialect
6704 ),
6705 }
6706 }
6707
6708 #[inline]
6709 unsafe fn decode(
6710 &mut self,
6711 decoder: &mut fidl::encoding::Decoder<
6712 '_,
6713 fidl::encoding::DefaultFuchsiaResourceDialect,
6714 >,
6715 offset: usize,
6716 _depth: fidl::encoding::Depth,
6717 ) -> fidl::Result<()> {
6718 decoder.debug_check_bounds::<Self>(offset);
6719 fidl::decode!(
6721 fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<ProcedureTokenMarker>>,
6722 fidl::encoding::DefaultFuchsiaResourceDialect,
6723 &mut self.token,
6724 decoder,
6725 offset + 0,
6726 _depth
6727 )?;
6728 Ok(())
6729 }
6730 }
6731
6732 impl fidl::encoding::ResourceTypeMarker for PairingSetDelegateRequest {
6733 type Borrowed<'a> = &'a mut Self;
6734 fn take_or_borrow<'a>(
6735 value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
6736 ) -> Self::Borrowed<'a> {
6737 value
6738 }
6739 }
6740
6741 unsafe impl fidl::encoding::TypeMarker for PairingSetDelegateRequest {
6742 type Owned = Self;
6743
6744 #[inline(always)]
6745 fn inline_align(_context: fidl::encoding::Context) -> usize {
6746 4
6747 }
6748
6749 #[inline(always)]
6750 fn inline_size(_context: fidl::encoding::Context) -> usize {
6751 12
6752 }
6753 }
6754
6755 unsafe impl
6756 fidl::encoding::Encode<
6757 PairingSetDelegateRequest,
6758 fidl::encoding::DefaultFuchsiaResourceDialect,
6759 > for &mut PairingSetDelegateRequest
6760 {
6761 #[inline]
6762 unsafe fn encode(
6763 self,
6764 encoder: &mut fidl::encoding::Encoder<
6765 '_,
6766 fidl::encoding::DefaultFuchsiaResourceDialect,
6767 >,
6768 offset: usize,
6769 _depth: fidl::encoding::Depth,
6770 ) -> fidl::Result<()> {
6771 encoder.debug_check_bounds::<PairingSetDelegateRequest>(offset);
6772 fidl::encoding::Encode::<PairingSetDelegateRequest, fidl::encoding::DefaultFuchsiaResourceDialect>::encode(
6774 (
6775 <InputCapability as fidl::encoding::ValueTypeMarker>::borrow(&self.input),
6776 <OutputCapability as fidl::encoding::ValueTypeMarker>::borrow(&self.output),
6777 <fidl::encoding::Endpoint<fidl::endpoints::ClientEnd<PairingDelegate2Marker>> as fidl::encoding::ResourceTypeMarker>::take_or_borrow(&mut self.delegate),
6778 ),
6779 encoder, offset, _depth
6780 )
6781 }
6782 }
6783 unsafe impl<
6784 T0: fidl::encoding::Encode<InputCapability, fidl::encoding::DefaultFuchsiaResourceDialect>,
6785 T1: fidl::encoding::Encode<OutputCapability, fidl::encoding::DefaultFuchsiaResourceDialect>,
6786 T2: fidl::encoding::Encode<
6787 fidl::encoding::Endpoint<fidl::endpoints::ClientEnd<PairingDelegate2Marker>>,
6788 fidl::encoding::DefaultFuchsiaResourceDialect,
6789 >,
6790 >
6791 fidl::encoding::Encode<
6792 PairingSetDelegateRequest,
6793 fidl::encoding::DefaultFuchsiaResourceDialect,
6794 > for (T0, T1, T2)
6795 {
6796 #[inline]
6797 unsafe fn encode(
6798 self,
6799 encoder: &mut fidl::encoding::Encoder<
6800 '_,
6801 fidl::encoding::DefaultFuchsiaResourceDialect,
6802 >,
6803 offset: usize,
6804 depth: fidl::encoding::Depth,
6805 ) -> fidl::Result<()> {
6806 encoder.debug_check_bounds::<PairingSetDelegateRequest>(offset);
6807 self.0.encode(encoder, offset + 0, depth)?;
6811 self.1.encode(encoder, offset + 4, depth)?;
6812 self.2.encode(encoder, offset + 8, depth)?;
6813 Ok(())
6814 }
6815 }
6816
6817 impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
6818 for PairingSetDelegateRequest
6819 {
6820 #[inline(always)]
6821 fn new_empty() -> Self {
6822 Self {
6823 input: fidl::new_empty!(
6824 InputCapability,
6825 fidl::encoding::DefaultFuchsiaResourceDialect
6826 ),
6827 output: fidl::new_empty!(
6828 OutputCapability,
6829 fidl::encoding::DefaultFuchsiaResourceDialect
6830 ),
6831 delegate: fidl::new_empty!(
6832 fidl::encoding::Endpoint<fidl::endpoints::ClientEnd<PairingDelegate2Marker>>,
6833 fidl::encoding::DefaultFuchsiaResourceDialect
6834 ),
6835 }
6836 }
6837
6838 #[inline]
6839 unsafe fn decode(
6840 &mut self,
6841 decoder: &mut fidl::encoding::Decoder<
6842 '_,
6843 fidl::encoding::DefaultFuchsiaResourceDialect,
6844 >,
6845 offset: usize,
6846 _depth: fidl::encoding::Depth,
6847 ) -> fidl::Result<()> {
6848 decoder.debug_check_bounds::<Self>(offset);
6849 fidl::decode!(
6851 InputCapability,
6852 fidl::encoding::DefaultFuchsiaResourceDialect,
6853 &mut self.input,
6854 decoder,
6855 offset + 0,
6856 _depth
6857 )?;
6858 fidl::decode!(
6859 OutputCapability,
6860 fidl::encoding::DefaultFuchsiaResourceDialect,
6861 &mut self.output,
6862 decoder,
6863 offset + 4,
6864 _depth
6865 )?;
6866 fidl::decode!(
6867 fidl::encoding::Endpoint<fidl::endpoints::ClientEnd<PairingDelegate2Marker>>,
6868 fidl::encoding::DefaultFuchsiaResourceDialect,
6869 &mut self.delegate,
6870 decoder,
6871 offset + 8,
6872 _depth
6873 )?;
6874 Ok(())
6875 }
6876 }
6877
6878 impl fidl::encoding::ResourceTypeMarker for PairingSetPairingDelegateRequest {
6879 type Borrowed<'a> = &'a mut Self;
6880 fn take_or_borrow<'a>(
6881 value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
6882 ) -> Self::Borrowed<'a> {
6883 value
6884 }
6885 }
6886
6887 unsafe impl fidl::encoding::TypeMarker for PairingSetPairingDelegateRequest {
6888 type Owned = Self;
6889
6890 #[inline(always)]
6891 fn inline_align(_context: fidl::encoding::Context) -> usize {
6892 4
6893 }
6894
6895 #[inline(always)]
6896 fn inline_size(_context: fidl::encoding::Context) -> usize {
6897 12
6898 }
6899 }
6900
6901 unsafe impl
6902 fidl::encoding::Encode<
6903 PairingSetPairingDelegateRequest,
6904 fidl::encoding::DefaultFuchsiaResourceDialect,
6905 > for &mut PairingSetPairingDelegateRequest
6906 {
6907 #[inline]
6908 unsafe fn encode(
6909 self,
6910 encoder: &mut fidl::encoding::Encoder<
6911 '_,
6912 fidl::encoding::DefaultFuchsiaResourceDialect,
6913 >,
6914 offset: usize,
6915 _depth: fidl::encoding::Depth,
6916 ) -> fidl::Result<()> {
6917 encoder.debug_check_bounds::<PairingSetPairingDelegateRequest>(offset);
6918 fidl::encoding::Encode::<PairingSetPairingDelegateRequest, fidl::encoding::DefaultFuchsiaResourceDialect>::encode(
6920 (
6921 <InputCapability as fidl::encoding::ValueTypeMarker>::borrow(&self.input),
6922 <OutputCapability as fidl::encoding::ValueTypeMarker>::borrow(&self.output),
6923 <fidl::encoding::Endpoint<fidl::endpoints::ClientEnd<PairingDelegateMarker>> as fidl::encoding::ResourceTypeMarker>::take_or_borrow(&mut self.delegate),
6924 ),
6925 encoder, offset, _depth
6926 )
6927 }
6928 }
6929 unsafe impl<
6930 T0: fidl::encoding::Encode<InputCapability, fidl::encoding::DefaultFuchsiaResourceDialect>,
6931 T1: fidl::encoding::Encode<OutputCapability, fidl::encoding::DefaultFuchsiaResourceDialect>,
6932 T2: fidl::encoding::Encode<
6933 fidl::encoding::Endpoint<fidl::endpoints::ClientEnd<PairingDelegateMarker>>,
6934 fidl::encoding::DefaultFuchsiaResourceDialect,
6935 >,
6936 >
6937 fidl::encoding::Encode<
6938 PairingSetPairingDelegateRequest,
6939 fidl::encoding::DefaultFuchsiaResourceDialect,
6940 > for (T0, T1, T2)
6941 {
6942 #[inline]
6943 unsafe fn encode(
6944 self,
6945 encoder: &mut fidl::encoding::Encoder<
6946 '_,
6947 fidl::encoding::DefaultFuchsiaResourceDialect,
6948 >,
6949 offset: usize,
6950 depth: fidl::encoding::Depth,
6951 ) -> fidl::Result<()> {
6952 encoder.debug_check_bounds::<PairingSetPairingDelegateRequest>(offset);
6953 self.0.encode(encoder, offset + 0, depth)?;
6957 self.1.encode(encoder, offset + 4, depth)?;
6958 self.2.encode(encoder, offset + 8, depth)?;
6959 Ok(())
6960 }
6961 }
6962
6963 impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
6964 for PairingSetPairingDelegateRequest
6965 {
6966 #[inline(always)]
6967 fn new_empty() -> Self {
6968 Self {
6969 input: fidl::new_empty!(
6970 InputCapability,
6971 fidl::encoding::DefaultFuchsiaResourceDialect
6972 ),
6973 output: fidl::new_empty!(
6974 OutputCapability,
6975 fidl::encoding::DefaultFuchsiaResourceDialect
6976 ),
6977 delegate: fidl::new_empty!(
6978 fidl::encoding::Endpoint<fidl::endpoints::ClientEnd<PairingDelegateMarker>>,
6979 fidl::encoding::DefaultFuchsiaResourceDialect
6980 ),
6981 }
6982 }
6983
6984 #[inline]
6985 unsafe fn decode(
6986 &mut self,
6987 decoder: &mut fidl::encoding::Decoder<
6988 '_,
6989 fidl::encoding::DefaultFuchsiaResourceDialect,
6990 >,
6991 offset: usize,
6992 _depth: fidl::encoding::Depth,
6993 ) -> fidl::Result<()> {
6994 decoder.debug_check_bounds::<Self>(offset);
6995 fidl::decode!(
6997 InputCapability,
6998 fidl::encoding::DefaultFuchsiaResourceDialect,
6999 &mut self.input,
7000 decoder,
7001 offset + 0,
7002 _depth
7003 )?;
7004 fidl::decode!(
7005 OutputCapability,
7006 fidl::encoding::DefaultFuchsiaResourceDialect,
7007 &mut self.output,
7008 decoder,
7009 offset + 4,
7010 _depth
7011 )?;
7012 fidl::decode!(
7013 fidl::encoding::Endpoint<fidl::endpoints::ClientEnd<PairingDelegateMarker>>,
7014 fidl::encoding::DefaultFuchsiaResourceDialect,
7015 &mut self.delegate,
7016 decoder,
7017 offset + 8,
7018 _depth
7019 )?;
7020 Ok(())
7021 }
7022 }
7023
7024 impl AccessSetConnectionPolicyRequest {
7025 #[inline(always)]
7026 fn max_ordinal_present(&self) -> u64 {
7027 if let Some(_) = self.suppress_bredr_connections {
7028 return 1;
7029 }
7030 0
7031 }
7032 }
7033
7034 impl fidl::encoding::ResourceTypeMarker for AccessSetConnectionPolicyRequest {
7035 type Borrowed<'a> = &'a mut Self;
7036 fn take_or_borrow<'a>(
7037 value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
7038 ) -> Self::Borrowed<'a> {
7039 value
7040 }
7041 }
7042
7043 unsafe impl fidl::encoding::TypeMarker for AccessSetConnectionPolicyRequest {
7044 type Owned = Self;
7045
7046 #[inline(always)]
7047 fn inline_align(_context: fidl::encoding::Context) -> usize {
7048 8
7049 }
7050
7051 #[inline(always)]
7052 fn inline_size(_context: fidl::encoding::Context) -> usize {
7053 16
7054 }
7055 }
7056
7057 unsafe impl
7058 fidl::encoding::Encode<
7059 AccessSetConnectionPolicyRequest,
7060 fidl::encoding::DefaultFuchsiaResourceDialect,
7061 > for &mut AccessSetConnectionPolicyRequest
7062 {
7063 unsafe fn encode(
7064 self,
7065 encoder: &mut fidl::encoding::Encoder<
7066 '_,
7067 fidl::encoding::DefaultFuchsiaResourceDialect,
7068 >,
7069 offset: usize,
7070 mut depth: fidl::encoding::Depth,
7071 ) -> fidl::Result<()> {
7072 encoder.debug_check_bounds::<AccessSetConnectionPolicyRequest>(offset);
7073 let max_ordinal: u64 = self.max_ordinal_present();
7075 encoder.write_num(max_ordinal, offset);
7076 encoder.write_num(fidl::encoding::ALLOC_PRESENT_U64, offset + 8);
7077 if max_ordinal == 0 {
7079 return Ok(());
7080 }
7081 depth.increment()?;
7082 let envelope_size = 8;
7083 let bytes_len = max_ordinal as usize * envelope_size;
7084 #[allow(unused_variables)]
7085 let offset = encoder.out_of_line_offset(bytes_len);
7086 let mut _prev_end_offset: usize = 0;
7087 if 1 > max_ordinal {
7088 return Ok(());
7089 }
7090
7091 let cur_offset: usize = (1 - 1) * envelope_size;
7094
7095 encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
7097
7098 fidl::encoding::encode_in_envelope_optional::<fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<ProcedureTokenMarker>>, fidl::encoding::DefaultFuchsiaResourceDialect>(
7103 self.suppress_bredr_connections.as_mut().map(<fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<ProcedureTokenMarker>> as fidl::encoding::ResourceTypeMarker>::take_or_borrow),
7104 encoder, offset + cur_offset, depth
7105 )?;
7106
7107 _prev_end_offset = cur_offset + envelope_size;
7108
7109 Ok(())
7110 }
7111 }
7112
7113 impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
7114 for AccessSetConnectionPolicyRequest
7115 {
7116 #[inline(always)]
7117 fn new_empty() -> Self {
7118 Self::default()
7119 }
7120
7121 unsafe fn decode(
7122 &mut self,
7123 decoder: &mut fidl::encoding::Decoder<
7124 '_,
7125 fidl::encoding::DefaultFuchsiaResourceDialect,
7126 >,
7127 offset: usize,
7128 mut depth: fidl::encoding::Depth,
7129 ) -> fidl::Result<()> {
7130 decoder.debug_check_bounds::<Self>(offset);
7131 let len = match fidl::encoding::decode_vector_header(decoder, offset)? {
7132 None => return Err(fidl::Error::NotNullable),
7133 Some(len) => len,
7134 };
7135 if len == 0 {
7137 return Ok(());
7138 };
7139 depth.increment()?;
7140 let envelope_size = 8;
7141 let bytes_len = len * envelope_size;
7142 let offset = decoder.out_of_line_offset(bytes_len)?;
7143 let mut _next_ordinal_to_read = 0;
7145 let mut next_offset = offset;
7146 let end_offset = offset + bytes_len;
7147 _next_ordinal_to_read += 1;
7148 if next_offset >= end_offset {
7149 return Ok(());
7150 }
7151
7152 while _next_ordinal_to_read < 1 {
7154 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
7155 _next_ordinal_to_read += 1;
7156 next_offset += envelope_size;
7157 }
7158
7159 let next_out_of_line = decoder.next_out_of_line();
7160 let handles_before = decoder.remaining_handles();
7161 if let Some((inlined, num_bytes, num_handles)) =
7162 fidl::encoding::decode_envelope_header(decoder, next_offset)?
7163 {
7164 let member_inline_size = <fidl::encoding::Endpoint<
7165 fidl::endpoints::ServerEnd<ProcedureTokenMarker>,
7166 > as fidl::encoding::TypeMarker>::inline_size(
7167 decoder.context
7168 );
7169 if inlined != (member_inline_size <= 4) {
7170 return Err(fidl::Error::InvalidInlineBitInEnvelope);
7171 }
7172 let inner_offset;
7173 let mut inner_depth = depth.clone();
7174 if inlined {
7175 decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
7176 inner_offset = next_offset;
7177 } else {
7178 inner_offset = decoder.out_of_line_offset(member_inline_size)?;
7179 inner_depth.increment()?;
7180 }
7181 let val_ref = self.suppress_bredr_connections.get_or_insert_with(|| {
7182 fidl::new_empty!(
7183 fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<ProcedureTokenMarker>>,
7184 fidl::encoding::DefaultFuchsiaResourceDialect
7185 )
7186 });
7187 fidl::decode!(
7188 fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<ProcedureTokenMarker>>,
7189 fidl::encoding::DefaultFuchsiaResourceDialect,
7190 val_ref,
7191 decoder,
7192 inner_offset,
7193 inner_depth
7194 )?;
7195 if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
7196 {
7197 return Err(fidl::Error::InvalidNumBytesInEnvelope);
7198 }
7199 if handles_before != decoder.remaining_handles() + (num_handles as usize) {
7200 return Err(fidl::Error::InvalidNumHandlesInEnvelope);
7201 }
7202 }
7203
7204 next_offset += envelope_size;
7205
7206 while next_offset < end_offset {
7208 _next_ordinal_to_read += 1;
7209 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
7210 next_offset += envelope_size;
7211 }
7212
7213 Ok(())
7214 }
7215 }
7216
7217 impl PairingDelegate2StartRequestRequest {
7218 #[inline(always)]
7219 fn max_ordinal_present(&self) -> u64 {
7220 if let Some(_) = self.request {
7221 return 3;
7222 }
7223 if let Some(_) = self.info {
7224 return 2;
7225 }
7226 if let Some(_) = self.peer {
7227 return 1;
7228 }
7229 0
7230 }
7231 }
7232
7233 impl fidl::encoding::ResourceTypeMarker for PairingDelegate2StartRequestRequest {
7234 type Borrowed<'a> = &'a mut Self;
7235 fn take_or_borrow<'a>(
7236 value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
7237 ) -> Self::Borrowed<'a> {
7238 value
7239 }
7240 }
7241
7242 unsafe impl fidl::encoding::TypeMarker for PairingDelegate2StartRequestRequest {
7243 type Owned = Self;
7244
7245 #[inline(always)]
7246 fn inline_align(_context: fidl::encoding::Context) -> usize {
7247 8
7248 }
7249
7250 #[inline(always)]
7251 fn inline_size(_context: fidl::encoding::Context) -> usize {
7252 16
7253 }
7254 }
7255
7256 unsafe impl
7257 fidl::encoding::Encode<
7258 PairingDelegate2StartRequestRequest,
7259 fidl::encoding::DefaultFuchsiaResourceDialect,
7260 > for &mut PairingDelegate2StartRequestRequest
7261 {
7262 unsafe fn encode(
7263 self,
7264 encoder: &mut fidl::encoding::Encoder<
7265 '_,
7266 fidl::encoding::DefaultFuchsiaResourceDialect,
7267 >,
7268 offset: usize,
7269 mut depth: fidl::encoding::Depth,
7270 ) -> fidl::Result<()> {
7271 encoder.debug_check_bounds::<PairingDelegate2StartRequestRequest>(offset);
7272 let max_ordinal: u64 = self.max_ordinal_present();
7274 encoder.write_num(max_ordinal, offset);
7275 encoder.write_num(fidl::encoding::ALLOC_PRESENT_U64, offset + 8);
7276 if max_ordinal == 0 {
7278 return Ok(());
7279 }
7280 depth.increment()?;
7281 let envelope_size = 8;
7282 let bytes_len = max_ordinal as usize * envelope_size;
7283 #[allow(unused_variables)]
7284 let offset = encoder.out_of_line_offset(bytes_len);
7285 let mut _prev_end_offset: usize = 0;
7286 if 1 > max_ordinal {
7287 return Ok(());
7288 }
7289
7290 let cur_offset: usize = (1 - 1) * envelope_size;
7293
7294 encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
7296
7297 fidl::encoding::encode_in_envelope_optional::<
7302 Peer,
7303 fidl::encoding::DefaultFuchsiaResourceDialect,
7304 >(
7305 self.peer.as_ref().map(<Peer as fidl::encoding::ValueTypeMarker>::borrow),
7306 encoder,
7307 offset + cur_offset,
7308 depth,
7309 )?;
7310
7311 _prev_end_offset = cur_offset + envelope_size;
7312 if 2 > max_ordinal {
7313 return Ok(());
7314 }
7315
7316 let cur_offset: usize = (2 - 1) * envelope_size;
7319
7320 encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
7322
7323 fidl::encoding::encode_in_envelope_optional::<
7328 PairingProperties,
7329 fidl::encoding::DefaultFuchsiaResourceDialect,
7330 >(
7331 self.info
7332 .as_ref()
7333 .map(<PairingProperties as fidl::encoding::ValueTypeMarker>::borrow),
7334 encoder,
7335 offset + cur_offset,
7336 depth,
7337 )?;
7338
7339 _prev_end_offset = cur_offset + envelope_size;
7340 if 3 > max_ordinal {
7341 return Ok(());
7342 }
7343
7344 let cur_offset: usize = (3 - 1) * envelope_size;
7347
7348 encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
7350
7351 fidl::encoding::encode_in_envelope_optional::<fidl::encoding::Endpoint<fidl::endpoints::ClientEnd<PairingRequestMarker>>, fidl::encoding::DefaultFuchsiaResourceDialect>(
7356 self.request.as_mut().map(<fidl::encoding::Endpoint<fidl::endpoints::ClientEnd<PairingRequestMarker>> as fidl::encoding::ResourceTypeMarker>::take_or_borrow),
7357 encoder, offset + cur_offset, depth
7358 )?;
7359
7360 _prev_end_offset = cur_offset + envelope_size;
7361
7362 Ok(())
7363 }
7364 }
7365
7366 impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
7367 for PairingDelegate2StartRequestRequest
7368 {
7369 #[inline(always)]
7370 fn new_empty() -> Self {
7371 Self::default()
7372 }
7373
7374 unsafe fn decode(
7375 &mut self,
7376 decoder: &mut fidl::encoding::Decoder<
7377 '_,
7378 fidl::encoding::DefaultFuchsiaResourceDialect,
7379 >,
7380 offset: usize,
7381 mut depth: fidl::encoding::Depth,
7382 ) -> fidl::Result<()> {
7383 decoder.debug_check_bounds::<Self>(offset);
7384 let len = match fidl::encoding::decode_vector_header(decoder, offset)? {
7385 None => return Err(fidl::Error::NotNullable),
7386 Some(len) => len,
7387 };
7388 if len == 0 {
7390 return Ok(());
7391 };
7392 depth.increment()?;
7393 let envelope_size = 8;
7394 let bytes_len = len * envelope_size;
7395 let offset = decoder.out_of_line_offset(bytes_len)?;
7396 let mut _next_ordinal_to_read = 0;
7398 let mut next_offset = offset;
7399 let end_offset = offset + bytes_len;
7400 _next_ordinal_to_read += 1;
7401 if next_offset >= end_offset {
7402 return Ok(());
7403 }
7404
7405 while _next_ordinal_to_read < 1 {
7407 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
7408 _next_ordinal_to_read += 1;
7409 next_offset += envelope_size;
7410 }
7411
7412 let next_out_of_line = decoder.next_out_of_line();
7413 let handles_before = decoder.remaining_handles();
7414 if let Some((inlined, num_bytes, num_handles)) =
7415 fidl::encoding::decode_envelope_header(decoder, next_offset)?
7416 {
7417 let member_inline_size =
7418 <Peer as fidl::encoding::TypeMarker>::inline_size(decoder.context);
7419 if inlined != (member_inline_size <= 4) {
7420 return Err(fidl::Error::InvalidInlineBitInEnvelope);
7421 }
7422 let inner_offset;
7423 let mut inner_depth = depth.clone();
7424 if inlined {
7425 decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
7426 inner_offset = next_offset;
7427 } else {
7428 inner_offset = decoder.out_of_line_offset(member_inline_size)?;
7429 inner_depth.increment()?;
7430 }
7431 let val_ref = self.peer.get_or_insert_with(|| {
7432 fidl::new_empty!(Peer, fidl::encoding::DefaultFuchsiaResourceDialect)
7433 });
7434 fidl::decode!(
7435 Peer,
7436 fidl::encoding::DefaultFuchsiaResourceDialect,
7437 val_ref,
7438 decoder,
7439 inner_offset,
7440 inner_depth
7441 )?;
7442 if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
7443 {
7444 return Err(fidl::Error::InvalidNumBytesInEnvelope);
7445 }
7446 if handles_before != decoder.remaining_handles() + (num_handles as usize) {
7447 return Err(fidl::Error::InvalidNumHandlesInEnvelope);
7448 }
7449 }
7450
7451 next_offset += envelope_size;
7452 _next_ordinal_to_read += 1;
7453 if next_offset >= end_offset {
7454 return Ok(());
7455 }
7456
7457 while _next_ordinal_to_read < 2 {
7459 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
7460 _next_ordinal_to_read += 1;
7461 next_offset += envelope_size;
7462 }
7463
7464 let next_out_of_line = decoder.next_out_of_line();
7465 let handles_before = decoder.remaining_handles();
7466 if let Some((inlined, num_bytes, num_handles)) =
7467 fidl::encoding::decode_envelope_header(decoder, next_offset)?
7468 {
7469 let member_inline_size =
7470 <PairingProperties as fidl::encoding::TypeMarker>::inline_size(decoder.context);
7471 if inlined != (member_inline_size <= 4) {
7472 return Err(fidl::Error::InvalidInlineBitInEnvelope);
7473 }
7474 let inner_offset;
7475 let mut inner_depth = depth.clone();
7476 if inlined {
7477 decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
7478 inner_offset = next_offset;
7479 } else {
7480 inner_offset = decoder.out_of_line_offset(member_inline_size)?;
7481 inner_depth.increment()?;
7482 }
7483 let val_ref = self.info.get_or_insert_with(|| {
7484 fidl::new_empty!(
7485 PairingProperties,
7486 fidl::encoding::DefaultFuchsiaResourceDialect
7487 )
7488 });
7489 fidl::decode!(
7490 PairingProperties,
7491 fidl::encoding::DefaultFuchsiaResourceDialect,
7492 val_ref,
7493 decoder,
7494 inner_offset,
7495 inner_depth
7496 )?;
7497 if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
7498 {
7499 return Err(fidl::Error::InvalidNumBytesInEnvelope);
7500 }
7501 if handles_before != decoder.remaining_handles() + (num_handles as usize) {
7502 return Err(fidl::Error::InvalidNumHandlesInEnvelope);
7503 }
7504 }
7505
7506 next_offset += envelope_size;
7507 _next_ordinal_to_read += 1;
7508 if next_offset >= end_offset {
7509 return Ok(());
7510 }
7511
7512 while _next_ordinal_to_read < 3 {
7514 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
7515 _next_ordinal_to_read += 1;
7516 next_offset += envelope_size;
7517 }
7518
7519 let next_out_of_line = decoder.next_out_of_line();
7520 let handles_before = decoder.remaining_handles();
7521 if let Some((inlined, num_bytes, num_handles)) =
7522 fidl::encoding::decode_envelope_header(decoder, next_offset)?
7523 {
7524 let member_inline_size = <fidl::encoding::Endpoint<
7525 fidl::endpoints::ClientEnd<PairingRequestMarker>,
7526 > as fidl::encoding::TypeMarker>::inline_size(
7527 decoder.context
7528 );
7529 if inlined != (member_inline_size <= 4) {
7530 return Err(fidl::Error::InvalidInlineBitInEnvelope);
7531 }
7532 let inner_offset;
7533 let mut inner_depth = depth.clone();
7534 if inlined {
7535 decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
7536 inner_offset = next_offset;
7537 } else {
7538 inner_offset = decoder.out_of_line_offset(member_inline_size)?;
7539 inner_depth.increment()?;
7540 }
7541 let val_ref = self.request.get_or_insert_with(|| {
7542 fidl::new_empty!(
7543 fidl::encoding::Endpoint<fidl::endpoints::ClientEnd<PairingRequestMarker>>,
7544 fidl::encoding::DefaultFuchsiaResourceDialect
7545 )
7546 });
7547 fidl::decode!(
7548 fidl::encoding::Endpoint<fidl::endpoints::ClientEnd<PairingRequestMarker>>,
7549 fidl::encoding::DefaultFuchsiaResourceDialect,
7550 val_ref,
7551 decoder,
7552 inner_offset,
7553 inner_depth
7554 )?;
7555 if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
7556 {
7557 return Err(fidl::Error::InvalidNumBytesInEnvelope);
7558 }
7559 if handles_before != decoder.remaining_handles() + (num_handles as usize) {
7560 return Err(fidl::Error::InvalidNumHandlesInEnvelope);
7561 }
7562 }
7563
7564 next_offset += envelope_size;
7565
7566 while next_offset < end_offset {
7568 _next_ordinal_to_read += 1;
7569 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
7570 next_offset += envelope_size;
7571 }
7572
7573 Ok(())
7574 }
7575 }
7576}