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