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