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 PairingDelegate2StartRequestRequest {
69 pub peer: Option<Peer>,
71 pub info: Option<PairingProperties>,
73 pub request: Option<fidl::endpoints::ClientEnd<PairingRequestMarker>>,
75 #[doc(hidden)]
76 pub __source_breaking: fidl::marker::SourceBreaking,
77}
78
79impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect>
80 for PairingDelegate2StartRequestRequest
81{
82}
83
84#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
85pub struct AccessMarker;
86
87impl fidl::endpoints::ProtocolMarker for AccessMarker {
88 type Proxy = AccessProxy;
89 type RequestStream = AccessRequestStream;
90 #[cfg(target_os = "fuchsia")]
91 type SynchronousProxy = AccessSynchronousProxy;
92
93 const DEBUG_NAME: &'static str = "fuchsia.bluetooth.sys.Access";
94}
95impl fidl::endpoints::DiscoverableProtocolMarker for AccessMarker {}
96pub type AccessMakeDiscoverableResult = Result<(), Error>;
97pub type AccessStartDiscoveryResult = Result<(), Error>;
98pub type AccessConnectResult = Result<(), Error>;
99pub type AccessDisconnectResult = Result<(), Error>;
100pub type AccessPairResult = Result<(), Error>;
101pub type AccessForgetResult = Result<(), Error>;
102
103pub trait AccessProxyInterface: Send + Sync {
104 fn r#set_pairing_delegate(
105 &self,
106 input: InputCapability,
107 output: OutputCapability,
108 delegate: fidl::endpoints::ClientEnd<PairingDelegateMarker>,
109 ) -> Result<(), fidl::Error>;
110 fn r#set_local_name(&self, name: &str) -> Result<(), fidl::Error>;
111 fn r#set_device_class(
112 &self,
113 device_class: &fidl_fuchsia_bluetooth::DeviceClass,
114 ) -> Result<(), fidl::Error>;
115 type MakeDiscoverableResponseFut: std::future::Future<Output = Result<AccessMakeDiscoverableResult, fidl::Error>>
116 + Send;
117 fn r#make_discoverable(
118 &self,
119 token: fidl::endpoints::ServerEnd<ProcedureTokenMarker>,
120 ) -> Self::MakeDiscoverableResponseFut;
121 type StartDiscoveryResponseFut: std::future::Future<Output = Result<AccessStartDiscoveryResult, fidl::Error>>
122 + Send;
123 fn r#start_discovery(
124 &self,
125 token: fidl::endpoints::ServerEnd<ProcedureTokenMarker>,
126 ) -> Self::StartDiscoveryResponseFut;
127 type WatchPeersResponseFut: std::future::Future<
128 Output = Result<(Vec<Peer>, Vec<fidl_fuchsia_bluetooth::PeerId>), fidl::Error>,
129 > + Send;
130 fn r#watch_peers(&self) -> Self::WatchPeersResponseFut;
131 type ConnectResponseFut: std::future::Future<Output = Result<AccessConnectResult, fidl::Error>>
132 + Send;
133 fn r#connect(&self, id: &fidl_fuchsia_bluetooth::PeerId) -> Self::ConnectResponseFut;
134 type DisconnectResponseFut: std::future::Future<Output = Result<AccessDisconnectResult, fidl::Error>>
135 + Send;
136 fn r#disconnect(&self, id: &fidl_fuchsia_bluetooth::PeerId) -> Self::DisconnectResponseFut;
137 type PairResponseFut: std::future::Future<Output = Result<AccessPairResult, fidl::Error>> + Send;
138 fn r#pair(
139 &self,
140 id: &fidl_fuchsia_bluetooth::PeerId,
141 options: &PairingOptions,
142 ) -> Self::PairResponseFut;
143 type ForgetResponseFut: std::future::Future<Output = Result<AccessForgetResult, fidl::Error>>
144 + Send;
145 fn r#forget(&self, id: &fidl_fuchsia_bluetooth::PeerId) -> Self::ForgetResponseFut;
146}
147#[derive(Debug)]
148#[cfg(target_os = "fuchsia")]
149pub struct AccessSynchronousProxy {
150 client: fidl::client::sync::Client,
151}
152
153#[cfg(target_os = "fuchsia")]
154impl fidl::endpoints::SynchronousProxy for AccessSynchronousProxy {
155 type Proxy = AccessProxy;
156 type Protocol = AccessMarker;
157
158 fn from_channel(inner: fidl::Channel) -> Self {
159 Self::new(inner)
160 }
161
162 fn into_channel(self) -> fidl::Channel {
163 self.client.into_channel()
164 }
165
166 fn as_channel(&self) -> &fidl::Channel {
167 self.client.as_channel()
168 }
169}
170
171#[cfg(target_os = "fuchsia")]
172impl AccessSynchronousProxy {
173 pub fn new(channel: fidl::Channel) -> Self {
174 let protocol_name = <AccessMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
175 Self { client: fidl::client::sync::Client::new(channel, protocol_name) }
176 }
177
178 pub fn into_channel(self) -> fidl::Channel {
179 self.client.into_channel()
180 }
181
182 pub fn wait_for_event(
185 &self,
186 deadline: zx::MonotonicInstant,
187 ) -> Result<AccessEvent, fidl::Error> {
188 AccessEvent::decode(self.client.wait_for_event(deadline)?)
189 }
190
191 pub fn r#set_pairing_delegate(
204 &self,
205 mut input: InputCapability,
206 mut output: OutputCapability,
207 mut delegate: fidl::endpoints::ClientEnd<PairingDelegateMarker>,
208 ) -> Result<(), fidl::Error> {
209 self.client.send::<AccessSetPairingDelegateRequest>(
210 (input, output, delegate),
211 0x4af398e1f4cdb40b,
212 fidl::encoding::DynamicFlags::empty(),
213 )
214 }
215
216 pub fn r#set_local_name(&self, mut name: &str) -> Result<(), fidl::Error> {
221 self.client.send::<AccessSetLocalNameRequest>(
222 (name,),
223 0x7d12cd2d902206eb,
224 fidl::encoding::DynamicFlags::empty(),
225 )
226 }
227
228 pub fn r#set_device_class(
233 &self,
234 mut device_class: &fidl_fuchsia_bluetooth::DeviceClass,
235 ) -> Result<(), fidl::Error> {
236 self.client.send::<AccessSetDeviceClassRequest>(
237 (device_class,),
238 0x58dd8f65f589035d,
239 fidl::encoding::DynamicFlags::empty(),
240 )
241 }
242
243 pub fn r#make_discoverable(
251 &self,
252 mut token: fidl::endpoints::ServerEnd<ProcedureTokenMarker>,
253 ___deadline: zx::MonotonicInstant,
254 ) -> Result<AccessMakeDiscoverableResult, fidl::Error> {
255 let _response = self.client.send_query::<
256 AccessMakeDiscoverableRequest,
257 fidl::encoding::ResultType<fidl::encoding::EmptyStruct, Error>,
258 >(
259 (token,),
260 0x747cadf609c96fb1,
261 fidl::encoding::DynamicFlags::empty(),
262 ___deadline,
263 )?;
264 Ok(_response.map(|x| x))
265 }
266
267 pub fn r#start_discovery(
276 &self,
277 mut token: fidl::endpoints::ServerEnd<ProcedureTokenMarker>,
278 ___deadline: zx::MonotonicInstant,
279 ) -> Result<AccessStartDiscoveryResult, fidl::Error> {
280 let _response = self.client.send_query::<
281 AccessStartDiscoveryRequest,
282 fidl::encoding::ResultType<fidl::encoding::EmptyStruct, Error>,
283 >(
284 (token,),
285 0x6907100d9b99439,
286 fidl::encoding::DynamicFlags::empty(),
287 ___deadline,
288 )?;
289 Ok(_response.map(|x| x))
290 }
291
292 pub fn r#watch_peers(
300 &self,
301 ___deadline: zx::MonotonicInstant,
302 ) -> Result<(Vec<Peer>, Vec<fidl_fuchsia_bluetooth::PeerId>), fidl::Error> {
303 let _response =
304 self.client.send_query::<fidl::encoding::EmptyPayload, AccessWatchPeersResponse>(
305 (),
306 0x1921fe1ed8e6eb7c,
307 fidl::encoding::DynamicFlags::empty(),
308 ___deadline,
309 )?;
310 Ok((_response.updated, _response.removed))
311 }
312
313 pub fn r#connect(
320 &self,
321 mut id: &fidl_fuchsia_bluetooth::PeerId,
322 ___deadline: zx::MonotonicInstant,
323 ) -> Result<AccessConnectResult, fidl::Error> {
324 let _response = self.client.send_query::<AccessConnectRequest, fidl::encoding::ResultType<
325 fidl::encoding::EmptyStruct,
326 Error,
327 >>(
328 (id,),
329 0x1734199789fe7667,
330 fidl::encoding::DynamicFlags::empty(),
331 ___deadline,
332 )?;
333 Ok(_response.map(|x| x))
334 }
335
336 pub fn r#disconnect(
343 &self,
344 mut id: &fidl_fuchsia_bluetooth::PeerId,
345 ___deadline: zx::MonotonicInstant,
346 ) -> Result<AccessDisconnectResult, fidl::Error> {
347 let _response = self.client.send_query::<
348 AccessDisconnectRequest,
349 fidl::encoding::ResultType<fidl::encoding::EmptyStruct, Error>,
350 >(
351 (id,),
352 0x3a4e06d0c6185a5,
353 fidl::encoding::DynamicFlags::empty(),
354 ___deadline,
355 )?;
356 Ok(_response.map(|x| x))
357 }
358
359 pub fn r#pair(
378 &self,
379 mut id: &fidl_fuchsia_bluetooth::PeerId,
380 mut options: &PairingOptions,
381 ___deadline: zx::MonotonicInstant,
382 ) -> Result<AccessPairResult, fidl::Error> {
383 let _response = self.client.send_query::<AccessPairRequest, fidl::encoding::ResultType<
384 fidl::encoding::EmptyStruct,
385 Error,
386 >>(
387 (id, options),
388 0x1d08ea19db327779,
389 fidl::encoding::DynamicFlags::empty(),
390 ___deadline,
391 )?;
392 Ok(_response.map(|x| x))
393 }
394
395 pub fn r#forget(
401 &self,
402 mut id: &fidl_fuchsia_bluetooth::PeerId,
403 ___deadline: zx::MonotonicInstant,
404 ) -> Result<AccessForgetResult, fidl::Error> {
405 let _response = self.client.send_query::<AccessForgetRequest, fidl::encoding::ResultType<
406 fidl::encoding::EmptyStruct,
407 Error,
408 >>(
409 (id,),
410 0x1fd8e27202854c0,
411 fidl::encoding::DynamicFlags::empty(),
412 ___deadline,
413 )?;
414 Ok(_response.map(|x| x))
415 }
416}
417
418#[derive(Debug, Clone)]
419pub struct AccessProxy {
420 client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
421}
422
423impl fidl::endpoints::Proxy for AccessProxy {
424 type Protocol = AccessMarker;
425
426 fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
427 Self::new(inner)
428 }
429
430 fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
431 self.client.into_channel().map_err(|client| Self { client })
432 }
433
434 fn as_channel(&self) -> &::fidl::AsyncChannel {
435 self.client.as_channel()
436 }
437}
438
439impl AccessProxy {
440 pub fn new(channel: ::fidl::AsyncChannel) -> Self {
442 let protocol_name = <AccessMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
443 Self { client: fidl::client::Client::new(channel, protocol_name) }
444 }
445
446 pub fn take_event_stream(&self) -> AccessEventStream {
452 AccessEventStream { event_receiver: self.client.take_event_receiver() }
453 }
454
455 pub fn r#set_pairing_delegate(
468 &self,
469 mut input: InputCapability,
470 mut output: OutputCapability,
471 mut delegate: fidl::endpoints::ClientEnd<PairingDelegateMarker>,
472 ) -> Result<(), fidl::Error> {
473 AccessProxyInterface::r#set_pairing_delegate(self, input, output, delegate)
474 }
475
476 pub fn r#set_local_name(&self, mut name: &str) -> Result<(), fidl::Error> {
481 AccessProxyInterface::r#set_local_name(self, name)
482 }
483
484 pub fn r#set_device_class(
489 &self,
490 mut device_class: &fidl_fuchsia_bluetooth::DeviceClass,
491 ) -> Result<(), fidl::Error> {
492 AccessProxyInterface::r#set_device_class(self, device_class)
493 }
494
495 pub fn r#make_discoverable(
503 &self,
504 mut token: fidl::endpoints::ServerEnd<ProcedureTokenMarker>,
505 ) -> fidl::client::QueryResponseFut<
506 AccessMakeDiscoverableResult,
507 fidl::encoding::DefaultFuchsiaResourceDialect,
508 > {
509 AccessProxyInterface::r#make_discoverable(self, token)
510 }
511
512 pub fn r#start_discovery(
521 &self,
522 mut token: fidl::endpoints::ServerEnd<ProcedureTokenMarker>,
523 ) -> fidl::client::QueryResponseFut<
524 AccessStartDiscoveryResult,
525 fidl::encoding::DefaultFuchsiaResourceDialect,
526 > {
527 AccessProxyInterface::r#start_discovery(self, token)
528 }
529
530 pub fn r#watch_peers(
538 &self,
539 ) -> fidl::client::QueryResponseFut<
540 (Vec<Peer>, Vec<fidl_fuchsia_bluetooth::PeerId>),
541 fidl::encoding::DefaultFuchsiaResourceDialect,
542 > {
543 AccessProxyInterface::r#watch_peers(self)
544 }
545
546 pub fn r#connect(
553 &self,
554 mut id: &fidl_fuchsia_bluetooth::PeerId,
555 ) -> fidl::client::QueryResponseFut<
556 AccessConnectResult,
557 fidl::encoding::DefaultFuchsiaResourceDialect,
558 > {
559 AccessProxyInterface::r#connect(self, id)
560 }
561
562 pub fn r#disconnect(
569 &self,
570 mut id: &fidl_fuchsia_bluetooth::PeerId,
571 ) -> fidl::client::QueryResponseFut<
572 AccessDisconnectResult,
573 fidl::encoding::DefaultFuchsiaResourceDialect,
574 > {
575 AccessProxyInterface::r#disconnect(self, id)
576 }
577
578 pub fn r#pair(
597 &self,
598 mut id: &fidl_fuchsia_bluetooth::PeerId,
599 mut options: &PairingOptions,
600 ) -> fidl::client::QueryResponseFut<
601 AccessPairResult,
602 fidl::encoding::DefaultFuchsiaResourceDialect,
603 > {
604 AccessProxyInterface::r#pair(self, id, options)
605 }
606
607 pub fn r#forget(
613 &self,
614 mut id: &fidl_fuchsia_bluetooth::PeerId,
615 ) -> fidl::client::QueryResponseFut<
616 AccessForgetResult,
617 fidl::encoding::DefaultFuchsiaResourceDialect,
618 > {
619 AccessProxyInterface::r#forget(self, id)
620 }
621}
622
623impl AccessProxyInterface for AccessProxy {
624 fn r#set_pairing_delegate(
625 &self,
626 mut input: InputCapability,
627 mut output: OutputCapability,
628 mut delegate: fidl::endpoints::ClientEnd<PairingDelegateMarker>,
629 ) -> Result<(), fidl::Error> {
630 self.client.send::<AccessSetPairingDelegateRequest>(
631 (input, output, delegate),
632 0x4af398e1f4cdb40b,
633 fidl::encoding::DynamicFlags::empty(),
634 )
635 }
636
637 fn r#set_local_name(&self, mut name: &str) -> Result<(), fidl::Error> {
638 self.client.send::<AccessSetLocalNameRequest>(
639 (name,),
640 0x7d12cd2d902206eb,
641 fidl::encoding::DynamicFlags::empty(),
642 )
643 }
644
645 fn r#set_device_class(
646 &self,
647 mut device_class: &fidl_fuchsia_bluetooth::DeviceClass,
648 ) -> Result<(), fidl::Error> {
649 self.client.send::<AccessSetDeviceClassRequest>(
650 (device_class,),
651 0x58dd8f65f589035d,
652 fidl::encoding::DynamicFlags::empty(),
653 )
654 }
655
656 type MakeDiscoverableResponseFut = fidl::client::QueryResponseFut<
657 AccessMakeDiscoverableResult,
658 fidl::encoding::DefaultFuchsiaResourceDialect,
659 >;
660 fn r#make_discoverable(
661 &self,
662 mut token: fidl::endpoints::ServerEnd<ProcedureTokenMarker>,
663 ) -> Self::MakeDiscoverableResponseFut {
664 fn _decode(
665 mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
666 ) -> Result<AccessMakeDiscoverableResult, fidl::Error> {
667 let _response = fidl::client::decode_transaction_body::<
668 fidl::encoding::ResultType<fidl::encoding::EmptyStruct, Error>,
669 fidl::encoding::DefaultFuchsiaResourceDialect,
670 0x747cadf609c96fb1,
671 >(_buf?)?;
672 Ok(_response.map(|x| x))
673 }
674 self.client
675 .send_query_and_decode::<AccessMakeDiscoverableRequest, AccessMakeDiscoverableResult>(
676 (token,),
677 0x747cadf609c96fb1,
678 fidl::encoding::DynamicFlags::empty(),
679 _decode,
680 )
681 }
682
683 type StartDiscoveryResponseFut = fidl::client::QueryResponseFut<
684 AccessStartDiscoveryResult,
685 fidl::encoding::DefaultFuchsiaResourceDialect,
686 >;
687 fn r#start_discovery(
688 &self,
689 mut token: fidl::endpoints::ServerEnd<ProcedureTokenMarker>,
690 ) -> Self::StartDiscoveryResponseFut {
691 fn _decode(
692 mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
693 ) -> Result<AccessStartDiscoveryResult, fidl::Error> {
694 let _response = fidl::client::decode_transaction_body::<
695 fidl::encoding::ResultType<fidl::encoding::EmptyStruct, Error>,
696 fidl::encoding::DefaultFuchsiaResourceDialect,
697 0x6907100d9b99439,
698 >(_buf?)?;
699 Ok(_response.map(|x| x))
700 }
701 self.client
702 .send_query_and_decode::<AccessStartDiscoveryRequest, AccessStartDiscoveryResult>(
703 (token,),
704 0x6907100d9b99439,
705 fidl::encoding::DynamicFlags::empty(),
706 _decode,
707 )
708 }
709
710 type WatchPeersResponseFut = fidl::client::QueryResponseFut<
711 (Vec<Peer>, Vec<fidl_fuchsia_bluetooth::PeerId>),
712 fidl::encoding::DefaultFuchsiaResourceDialect,
713 >;
714 fn r#watch_peers(&self) -> Self::WatchPeersResponseFut {
715 fn _decode(
716 mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
717 ) -> Result<(Vec<Peer>, Vec<fidl_fuchsia_bluetooth::PeerId>), fidl::Error> {
718 let _response = fidl::client::decode_transaction_body::<
719 AccessWatchPeersResponse,
720 fidl::encoding::DefaultFuchsiaResourceDialect,
721 0x1921fe1ed8e6eb7c,
722 >(_buf?)?;
723 Ok((_response.updated, _response.removed))
724 }
725 self.client.send_query_and_decode::<
726 fidl::encoding::EmptyPayload,
727 (Vec<Peer>, Vec<fidl_fuchsia_bluetooth::PeerId>),
728 >(
729 (),
730 0x1921fe1ed8e6eb7c,
731 fidl::encoding::DynamicFlags::empty(),
732 _decode,
733 )
734 }
735
736 type ConnectResponseFut = fidl::client::QueryResponseFut<
737 AccessConnectResult,
738 fidl::encoding::DefaultFuchsiaResourceDialect,
739 >;
740 fn r#connect(&self, mut id: &fidl_fuchsia_bluetooth::PeerId) -> Self::ConnectResponseFut {
741 fn _decode(
742 mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
743 ) -> Result<AccessConnectResult, fidl::Error> {
744 let _response = fidl::client::decode_transaction_body::<
745 fidl::encoding::ResultType<fidl::encoding::EmptyStruct, Error>,
746 fidl::encoding::DefaultFuchsiaResourceDialect,
747 0x1734199789fe7667,
748 >(_buf?)?;
749 Ok(_response.map(|x| x))
750 }
751 self.client.send_query_and_decode::<AccessConnectRequest, AccessConnectResult>(
752 (id,),
753 0x1734199789fe7667,
754 fidl::encoding::DynamicFlags::empty(),
755 _decode,
756 )
757 }
758
759 type DisconnectResponseFut = fidl::client::QueryResponseFut<
760 AccessDisconnectResult,
761 fidl::encoding::DefaultFuchsiaResourceDialect,
762 >;
763 fn r#disconnect(&self, mut id: &fidl_fuchsia_bluetooth::PeerId) -> Self::DisconnectResponseFut {
764 fn _decode(
765 mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
766 ) -> Result<AccessDisconnectResult, fidl::Error> {
767 let _response = fidl::client::decode_transaction_body::<
768 fidl::encoding::ResultType<fidl::encoding::EmptyStruct, Error>,
769 fidl::encoding::DefaultFuchsiaResourceDialect,
770 0x3a4e06d0c6185a5,
771 >(_buf?)?;
772 Ok(_response.map(|x| x))
773 }
774 self.client.send_query_and_decode::<AccessDisconnectRequest, AccessDisconnectResult>(
775 (id,),
776 0x3a4e06d0c6185a5,
777 fidl::encoding::DynamicFlags::empty(),
778 _decode,
779 )
780 }
781
782 type PairResponseFut = fidl::client::QueryResponseFut<
783 AccessPairResult,
784 fidl::encoding::DefaultFuchsiaResourceDialect,
785 >;
786 fn r#pair(
787 &self,
788 mut id: &fidl_fuchsia_bluetooth::PeerId,
789 mut options: &PairingOptions,
790 ) -> Self::PairResponseFut {
791 fn _decode(
792 mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
793 ) -> Result<AccessPairResult, fidl::Error> {
794 let _response = fidl::client::decode_transaction_body::<
795 fidl::encoding::ResultType<fidl::encoding::EmptyStruct, Error>,
796 fidl::encoding::DefaultFuchsiaResourceDialect,
797 0x1d08ea19db327779,
798 >(_buf?)?;
799 Ok(_response.map(|x| x))
800 }
801 self.client.send_query_and_decode::<AccessPairRequest, AccessPairResult>(
802 (id, options),
803 0x1d08ea19db327779,
804 fidl::encoding::DynamicFlags::empty(),
805 _decode,
806 )
807 }
808
809 type ForgetResponseFut = fidl::client::QueryResponseFut<
810 AccessForgetResult,
811 fidl::encoding::DefaultFuchsiaResourceDialect,
812 >;
813 fn r#forget(&self, mut id: &fidl_fuchsia_bluetooth::PeerId) -> Self::ForgetResponseFut {
814 fn _decode(
815 mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
816 ) -> Result<AccessForgetResult, fidl::Error> {
817 let _response = fidl::client::decode_transaction_body::<
818 fidl::encoding::ResultType<fidl::encoding::EmptyStruct, Error>,
819 fidl::encoding::DefaultFuchsiaResourceDialect,
820 0x1fd8e27202854c0,
821 >(_buf?)?;
822 Ok(_response.map(|x| x))
823 }
824 self.client.send_query_and_decode::<AccessForgetRequest, AccessForgetResult>(
825 (id,),
826 0x1fd8e27202854c0,
827 fidl::encoding::DynamicFlags::empty(),
828 _decode,
829 )
830 }
831}
832
833pub struct AccessEventStream {
834 event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
835}
836
837impl std::marker::Unpin for AccessEventStream {}
838
839impl futures::stream::FusedStream for AccessEventStream {
840 fn is_terminated(&self) -> bool {
841 self.event_receiver.is_terminated()
842 }
843}
844
845impl futures::Stream for AccessEventStream {
846 type Item = Result<AccessEvent, fidl::Error>;
847
848 fn poll_next(
849 mut self: std::pin::Pin<&mut Self>,
850 cx: &mut std::task::Context<'_>,
851 ) -> std::task::Poll<Option<Self::Item>> {
852 match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
853 &mut self.event_receiver,
854 cx
855 )?) {
856 Some(buf) => std::task::Poll::Ready(Some(AccessEvent::decode(buf))),
857 None => std::task::Poll::Ready(None),
858 }
859 }
860}
861
862#[derive(Debug)]
863pub enum AccessEvent {}
864
865impl AccessEvent {
866 fn decode(
868 mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
869 ) -> Result<AccessEvent, fidl::Error> {
870 let (bytes, _handles) = buf.split_mut();
871 let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
872 debug_assert_eq!(tx_header.tx_id, 0);
873 match tx_header.ordinal {
874 _ => Err(fidl::Error::UnknownOrdinal {
875 ordinal: tx_header.ordinal,
876 protocol_name: <AccessMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
877 }),
878 }
879 }
880}
881
882pub struct AccessRequestStream {
884 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
885 is_terminated: bool,
886}
887
888impl std::marker::Unpin for AccessRequestStream {}
889
890impl futures::stream::FusedStream for AccessRequestStream {
891 fn is_terminated(&self) -> bool {
892 self.is_terminated
893 }
894}
895
896impl fidl::endpoints::RequestStream for AccessRequestStream {
897 type Protocol = AccessMarker;
898 type ControlHandle = AccessControlHandle;
899
900 fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
901 Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
902 }
903
904 fn control_handle(&self) -> Self::ControlHandle {
905 AccessControlHandle { inner: self.inner.clone() }
906 }
907
908 fn into_inner(
909 self,
910 ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
911 {
912 (self.inner, self.is_terminated)
913 }
914
915 fn from_inner(
916 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
917 is_terminated: bool,
918 ) -> Self {
919 Self { inner, is_terminated }
920 }
921}
922
923impl futures::Stream for AccessRequestStream {
924 type Item = Result<AccessRequest, fidl::Error>;
925
926 fn poll_next(
927 mut self: std::pin::Pin<&mut Self>,
928 cx: &mut std::task::Context<'_>,
929 ) -> std::task::Poll<Option<Self::Item>> {
930 let this = &mut *self;
931 if this.inner.check_shutdown(cx) {
932 this.is_terminated = true;
933 return std::task::Poll::Ready(None);
934 }
935 if this.is_terminated {
936 panic!("polled AccessRequestStream after completion");
937 }
938 fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
939 |bytes, handles| {
940 match this.inner.channel().read_etc(cx, bytes, handles) {
941 std::task::Poll::Ready(Ok(())) => {}
942 std::task::Poll::Pending => return std::task::Poll::Pending,
943 std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
944 this.is_terminated = true;
945 return std::task::Poll::Ready(None);
946 }
947 std::task::Poll::Ready(Err(e)) => {
948 return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
949 e.into(),
950 ))))
951 }
952 }
953
954 let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
956
957 std::task::Poll::Ready(Some(match header.ordinal {
958 0x4af398e1f4cdb40b => {
959 header.validate_request_tx_id(fidl::MethodType::OneWay)?;
960 let mut req = fidl::new_empty!(
961 AccessSetPairingDelegateRequest,
962 fidl::encoding::DefaultFuchsiaResourceDialect
963 );
964 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<AccessSetPairingDelegateRequest>(&header, _body_bytes, handles, &mut req)?;
965 let control_handle = AccessControlHandle { inner: this.inner.clone() };
966 Ok(AccessRequest::SetPairingDelegate {
967 input: req.input,
968 output: req.output,
969 delegate: req.delegate,
970
971 control_handle,
972 })
973 }
974 0x7d12cd2d902206eb => {
975 header.validate_request_tx_id(fidl::MethodType::OneWay)?;
976 let mut req = fidl::new_empty!(
977 AccessSetLocalNameRequest,
978 fidl::encoding::DefaultFuchsiaResourceDialect
979 );
980 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<AccessSetLocalNameRequest>(&header, _body_bytes, handles, &mut req)?;
981 let control_handle = AccessControlHandle { inner: this.inner.clone() };
982 Ok(AccessRequest::SetLocalName { name: req.name, control_handle })
983 }
984 0x58dd8f65f589035d => {
985 header.validate_request_tx_id(fidl::MethodType::OneWay)?;
986 let mut req = fidl::new_empty!(
987 AccessSetDeviceClassRequest,
988 fidl::encoding::DefaultFuchsiaResourceDialect
989 );
990 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<AccessSetDeviceClassRequest>(&header, _body_bytes, handles, &mut req)?;
991 let control_handle = AccessControlHandle { inner: this.inner.clone() };
992 Ok(AccessRequest::SetDeviceClass {
993 device_class: req.device_class,
994
995 control_handle,
996 })
997 }
998 0x747cadf609c96fb1 => {
999 header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
1000 let mut req = fidl::new_empty!(
1001 AccessMakeDiscoverableRequest,
1002 fidl::encoding::DefaultFuchsiaResourceDialect
1003 );
1004 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<AccessMakeDiscoverableRequest>(&header, _body_bytes, handles, &mut req)?;
1005 let control_handle = AccessControlHandle { inner: this.inner.clone() };
1006 Ok(AccessRequest::MakeDiscoverable {
1007 token: req.token,
1008
1009 responder: AccessMakeDiscoverableResponder {
1010 control_handle: std::mem::ManuallyDrop::new(control_handle),
1011 tx_id: header.tx_id,
1012 },
1013 })
1014 }
1015 0x6907100d9b99439 => {
1016 header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
1017 let mut req = fidl::new_empty!(
1018 AccessStartDiscoveryRequest,
1019 fidl::encoding::DefaultFuchsiaResourceDialect
1020 );
1021 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<AccessStartDiscoveryRequest>(&header, _body_bytes, handles, &mut req)?;
1022 let control_handle = AccessControlHandle { inner: this.inner.clone() };
1023 Ok(AccessRequest::StartDiscovery {
1024 token: req.token,
1025
1026 responder: AccessStartDiscoveryResponder {
1027 control_handle: std::mem::ManuallyDrop::new(control_handle),
1028 tx_id: header.tx_id,
1029 },
1030 })
1031 }
1032 0x1921fe1ed8e6eb7c => {
1033 header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
1034 let mut req = fidl::new_empty!(
1035 fidl::encoding::EmptyPayload,
1036 fidl::encoding::DefaultFuchsiaResourceDialect
1037 );
1038 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
1039 let control_handle = AccessControlHandle { inner: this.inner.clone() };
1040 Ok(AccessRequest::WatchPeers {
1041 responder: AccessWatchPeersResponder {
1042 control_handle: std::mem::ManuallyDrop::new(control_handle),
1043 tx_id: header.tx_id,
1044 },
1045 })
1046 }
1047 0x1734199789fe7667 => {
1048 header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
1049 let mut req = fidl::new_empty!(
1050 AccessConnectRequest,
1051 fidl::encoding::DefaultFuchsiaResourceDialect
1052 );
1053 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<AccessConnectRequest>(&header, _body_bytes, handles, &mut req)?;
1054 let control_handle = AccessControlHandle { inner: this.inner.clone() };
1055 Ok(AccessRequest::Connect {
1056 id: req.id,
1057
1058 responder: AccessConnectResponder {
1059 control_handle: std::mem::ManuallyDrop::new(control_handle),
1060 tx_id: header.tx_id,
1061 },
1062 })
1063 }
1064 0x3a4e06d0c6185a5 => {
1065 header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
1066 let mut req = fidl::new_empty!(
1067 AccessDisconnectRequest,
1068 fidl::encoding::DefaultFuchsiaResourceDialect
1069 );
1070 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<AccessDisconnectRequest>(&header, _body_bytes, handles, &mut req)?;
1071 let control_handle = AccessControlHandle { inner: this.inner.clone() };
1072 Ok(AccessRequest::Disconnect {
1073 id: req.id,
1074
1075 responder: AccessDisconnectResponder {
1076 control_handle: std::mem::ManuallyDrop::new(control_handle),
1077 tx_id: header.tx_id,
1078 },
1079 })
1080 }
1081 0x1d08ea19db327779 => {
1082 header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
1083 let mut req = fidl::new_empty!(
1084 AccessPairRequest,
1085 fidl::encoding::DefaultFuchsiaResourceDialect
1086 );
1087 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<AccessPairRequest>(&header, _body_bytes, handles, &mut req)?;
1088 let control_handle = AccessControlHandle { inner: this.inner.clone() };
1089 Ok(AccessRequest::Pair {
1090 id: req.id,
1091 options: req.options,
1092
1093 responder: AccessPairResponder {
1094 control_handle: std::mem::ManuallyDrop::new(control_handle),
1095 tx_id: header.tx_id,
1096 },
1097 })
1098 }
1099 0x1fd8e27202854c0 => {
1100 header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
1101 let mut req = fidl::new_empty!(
1102 AccessForgetRequest,
1103 fidl::encoding::DefaultFuchsiaResourceDialect
1104 );
1105 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<AccessForgetRequest>(&header, _body_bytes, handles, &mut req)?;
1106 let control_handle = AccessControlHandle { inner: this.inner.clone() };
1107 Ok(AccessRequest::Forget {
1108 id: req.id,
1109
1110 responder: AccessForgetResponder {
1111 control_handle: std::mem::ManuallyDrop::new(control_handle),
1112 tx_id: header.tx_id,
1113 },
1114 })
1115 }
1116 _ => Err(fidl::Error::UnknownOrdinal {
1117 ordinal: header.ordinal,
1118 protocol_name:
1119 <AccessMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
1120 }),
1121 }))
1122 },
1123 )
1124 }
1125}
1126
1127#[derive(Debug)]
1136pub enum AccessRequest {
1137 SetPairingDelegate {
1150 input: InputCapability,
1151 output: OutputCapability,
1152 delegate: fidl::endpoints::ClientEnd<PairingDelegateMarker>,
1153 control_handle: AccessControlHandle,
1154 },
1155 SetLocalName { name: String, control_handle: AccessControlHandle },
1160 SetDeviceClass {
1165 device_class: fidl_fuchsia_bluetooth::DeviceClass,
1166 control_handle: AccessControlHandle,
1167 },
1168 MakeDiscoverable {
1176 token: fidl::endpoints::ServerEnd<ProcedureTokenMarker>,
1177 responder: AccessMakeDiscoverableResponder,
1178 },
1179 StartDiscovery {
1188 token: fidl::endpoints::ServerEnd<ProcedureTokenMarker>,
1189 responder: AccessStartDiscoveryResponder,
1190 },
1191 WatchPeers { responder: AccessWatchPeersResponder },
1199 Connect { id: fidl_fuchsia_bluetooth::PeerId, responder: AccessConnectResponder },
1206 Disconnect { id: fidl_fuchsia_bluetooth::PeerId, responder: AccessDisconnectResponder },
1213 Pair {
1232 id: fidl_fuchsia_bluetooth::PeerId,
1233 options: PairingOptions,
1234 responder: AccessPairResponder,
1235 },
1236 Forget { id: fidl_fuchsia_bluetooth::PeerId, responder: AccessForgetResponder },
1242}
1243
1244impl AccessRequest {
1245 #[allow(irrefutable_let_patterns)]
1246 pub fn into_set_pairing_delegate(
1247 self,
1248 ) -> Option<(
1249 InputCapability,
1250 OutputCapability,
1251 fidl::endpoints::ClientEnd<PairingDelegateMarker>,
1252 AccessControlHandle,
1253 )> {
1254 if let AccessRequest::SetPairingDelegate { input, output, delegate, control_handle } = self
1255 {
1256 Some((input, output, delegate, control_handle))
1257 } else {
1258 None
1259 }
1260 }
1261
1262 #[allow(irrefutable_let_patterns)]
1263 pub fn into_set_local_name(self) -> Option<(String, AccessControlHandle)> {
1264 if let AccessRequest::SetLocalName { name, control_handle } = self {
1265 Some((name, control_handle))
1266 } else {
1267 None
1268 }
1269 }
1270
1271 #[allow(irrefutable_let_patterns)]
1272 pub fn into_set_device_class(
1273 self,
1274 ) -> Option<(fidl_fuchsia_bluetooth::DeviceClass, AccessControlHandle)> {
1275 if let AccessRequest::SetDeviceClass { device_class, control_handle } = self {
1276 Some((device_class, control_handle))
1277 } else {
1278 None
1279 }
1280 }
1281
1282 #[allow(irrefutable_let_patterns)]
1283 pub fn into_make_discoverable(
1284 self,
1285 ) -> Option<(fidl::endpoints::ServerEnd<ProcedureTokenMarker>, AccessMakeDiscoverableResponder)>
1286 {
1287 if let AccessRequest::MakeDiscoverable { token, responder } = self {
1288 Some((token, responder))
1289 } else {
1290 None
1291 }
1292 }
1293
1294 #[allow(irrefutable_let_patterns)]
1295 pub fn into_start_discovery(
1296 self,
1297 ) -> Option<(fidl::endpoints::ServerEnd<ProcedureTokenMarker>, AccessStartDiscoveryResponder)>
1298 {
1299 if let AccessRequest::StartDiscovery { token, responder } = self {
1300 Some((token, responder))
1301 } else {
1302 None
1303 }
1304 }
1305
1306 #[allow(irrefutable_let_patterns)]
1307 pub fn into_watch_peers(self) -> Option<(AccessWatchPeersResponder)> {
1308 if let AccessRequest::WatchPeers { responder } = self {
1309 Some((responder))
1310 } else {
1311 None
1312 }
1313 }
1314
1315 #[allow(irrefutable_let_patterns)]
1316 pub fn into_connect(self) -> Option<(fidl_fuchsia_bluetooth::PeerId, AccessConnectResponder)> {
1317 if let AccessRequest::Connect { id, responder } = self {
1318 Some((id, responder))
1319 } else {
1320 None
1321 }
1322 }
1323
1324 #[allow(irrefutable_let_patterns)]
1325 pub fn into_disconnect(
1326 self,
1327 ) -> Option<(fidl_fuchsia_bluetooth::PeerId, AccessDisconnectResponder)> {
1328 if let AccessRequest::Disconnect { id, responder } = self {
1329 Some((id, responder))
1330 } else {
1331 None
1332 }
1333 }
1334
1335 #[allow(irrefutable_let_patterns)]
1336 pub fn into_pair(
1337 self,
1338 ) -> Option<(fidl_fuchsia_bluetooth::PeerId, PairingOptions, AccessPairResponder)> {
1339 if let AccessRequest::Pair { id, options, responder } = self {
1340 Some((id, options, responder))
1341 } else {
1342 None
1343 }
1344 }
1345
1346 #[allow(irrefutable_let_patterns)]
1347 pub fn into_forget(self) -> Option<(fidl_fuchsia_bluetooth::PeerId, AccessForgetResponder)> {
1348 if let AccessRequest::Forget { id, responder } = self {
1349 Some((id, responder))
1350 } else {
1351 None
1352 }
1353 }
1354
1355 pub fn method_name(&self) -> &'static str {
1357 match *self {
1358 AccessRequest::SetPairingDelegate { .. } => "set_pairing_delegate",
1359 AccessRequest::SetLocalName { .. } => "set_local_name",
1360 AccessRequest::SetDeviceClass { .. } => "set_device_class",
1361 AccessRequest::MakeDiscoverable { .. } => "make_discoverable",
1362 AccessRequest::StartDiscovery { .. } => "start_discovery",
1363 AccessRequest::WatchPeers { .. } => "watch_peers",
1364 AccessRequest::Connect { .. } => "connect",
1365 AccessRequest::Disconnect { .. } => "disconnect",
1366 AccessRequest::Pair { .. } => "pair",
1367 AccessRequest::Forget { .. } => "forget",
1368 }
1369 }
1370}
1371
1372#[derive(Debug, Clone)]
1373pub struct AccessControlHandle {
1374 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
1375}
1376
1377impl fidl::endpoints::ControlHandle for AccessControlHandle {
1378 fn shutdown(&self) {
1379 self.inner.shutdown()
1380 }
1381 fn shutdown_with_epitaph(&self, status: zx_status::Status) {
1382 self.inner.shutdown_with_epitaph(status)
1383 }
1384
1385 fn is_closed(&self) -> bool {
1386 self.inner.channel().is_closed()
1387 }
1388 fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
1389 self.inner.channel().on_closed()
1390 }
1391
1392 #[cfg(target_os = "fuchsia")]
1393 fn signal_peer(
1394 &self,
1395 clear_mask: zx::Signals,
1396 set_mask: zx::Signals,
1397 ) -> Result<(), zx_status::Status> {
1398 use fidl::Peered;
1399 self.inner.channel().signal_peer(clear_mask, set_mask)
1400 }
1401}
1402
1403impl AccessControlHandle {}
1404
1405#[must_use = "FIDL methods require a response to be sent"]
1406#[derive(Debug)]
1407pub struct AccessMakeDiscoverableResponder {
1408 control_handle: std::mem::ManuallyDrop<AccessControlHandle>,
1409 tx_id: u32,
1410}
1411
1412impl std::ops::Drop for AccessMakeDiscoverableResponder {
1416 fn drop(&mut self) {
1417 self.control_handle.shutdown();
1418 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1420 }
1421}
1422
1423impl fidl::endpoints::Responder for AccessMakeDiscoverableResponder {
1424 type ControlHandle = AccessControlHandle;
1425
1426 fn control_handle(&self) -> &AccessControlHandle {
1427 &self.control_handle
1428 }
1429
1430 fn drop_without_shutdown(mut self) {
1431 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1433 std::mem::forget(self);
1435 }
1436}
1437
1438impl AccessMakeDiscoverableResponder {
1439 pub fn send(self, mut result: Result<(), Error>) -> Result<(), fidl::Error> {
1443 let _result = self.send_raw(result);
1444 if _result.is_err() {
1445 self.control_handle.shutdown();
1446 }
1447 self.drop_without_shutdown();
1448 _result
1449 }
1450
1451 pub fn send_no_shutdown_on_err(self, mut result: Result<(), Error>) -> Result<(), fidl::Error> {
1453 let _result = self.send_raw(result);
1454 self.drop_without_shutdown();
1455 _result
1456 }
1457
1458 fn send_raw(&self, mut result: Result<(), Error>) -> Result<(), fidl::Error> {
1459 self.control_handle
1460 .inner
1461 .send::<fidl::encoding::ResultType<fidl::encoding::EmptyStruct, Error>>(
1462 result,
1463 self.tx_id,
1464 0x747cadf609c96fb1,
1465 fidl::encoding::DynamicFlags::empty(),
1466 )
1467 }
1468}
1469
1470#[must_use = "FIDL methods require a response to be sent"]
1471#[derive(Debug)]
1472pub struct AccessStartDiscoveryResponder {
1473 control_handle: std::mem::ManuallyDrop<AccessControlHandle>,
1474 tx_id: u32,
1475}
1476
1477impl std::ops::Drop for AccessStartDiscoveryResponder {
1481 fn drop(&mut self) {
1482 self.control_handle.shutdown();
1483 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1485 }
1486}
1487
1488impl fidl::endpoints::Responder for AccessStartDiscoveryResponder {
1489 type ControlHandle = AccessControlHandle;
1490
1491 fn control_handle(&self) -> &AccessControlHandle {
1492 &self.control_handle
1493 }
1494
1495 fn drop_without_shutdown(mut self) {
1496 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1498 std::mem::forget(self);
1500 }
1501}
1502
1503impl AccessStartDiscoveryResponder {
1504 pub fn send(self, mut result: Result<(), Error>) -> Result<(), fidl::Error> {
1508 let _result = self.send_raw(result);
1509 if _result.is_err() {
1510 self.control_handle.shutdown();
1511 }
1512 self.drop_without_shutdown();
1513 _result
1514 }
1515
1516 pub fn send_no_shutdown_on_err(self, mut result: Result<(), Error>) -> Result<(), fidl::Error> {
1518 let _result = self.send_raw(result);
1519 self.drop_without_shutdown();
1520 _result
1521 }
1522
1523 fn send_raw(&self, mut result: Result<(), Error>) -> Result<(), fidl::Error> {
1524 self.control_handle
1525 .inner
1526 .send::<fidl::encoding::ResultType<fidl::encoding::EmptyStruct, Error>>(
1527 result,
1528 self.tx_id,
1529 0x6907100d9b99439,
1530 fidl::encoding::DynamicFlags::empty(),
1531 )
1532 }
1533}
1534
1535#[must_use = "FIDL methods require a response to be sent"]
1536#[derive(Debug)]
1537pub struct AccessWatchPeersResponder {
1538 control_handle: std::mem::ManuallyDrop<AccessControlHandle>,
1539 tx_id: u32,
1540}
1541
1542impl std::ops::Drop for AccessWatchPeersResponder {
1546 fn drop(&mut self) {
1547 self.control_handle.shutdown();
1548 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1550 }
1551}
1552
1553impl fidl::endpoints::Responder for AccessWatchPeersResponder {
1554 type ControlHandle = AccessControlHandle;
1555
1556 fn control_handle(&self) -> &AccessControlHandle {
1557 &self.control_handle
1558 }
1559
1560 fn drop_without_shutdown(mut self) {
1561 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1563 std::mem::forget(self);
1565 }
1566}
1567
1568impl AccessWatchPeersResponder {
1569 pub fn send(
1573 self,
1574 mut updated: &[Peer],
1575 mut removed: &[fidl_fuchsia_bluetooth::PeerId],
1576 ) -> Result<(), fidl::Error> {
1577 let _result = self.send_raw(updated, removed);
1578 if _result.is_err() {
1579 self.control_handle.shutdown();
1580 }
1581 self.drop_without_shutdown();
1582 _result
1583 }
1584
1585 pub fn send_no_shutdown_on_err(
1587 self,
1588 mut updated: &[Peer],
1589 mut removed: &[fidl_fuchsia_bluetooth::PeerId],
1590 ) -> Result<(), fidl::Error> {
1591 let _result = self.send_raw(updated, removed);
1592 self.drop_without_shutdown();
1593 _result
1594 }
1595
1596 fn send_raw(
1597 &self,
1598 mut updated: &[Peer],
1599 mut removed: &[fidl_fuchsia_bluetooth::PeerId],
1600 ) -> Result<(), fidl::Error> {
1601 self.control_handle.inner.send::<AccessWatchPeersResponse>(
1602 (updated, removed),
1603 self.tx_id,
1604 0x1921fe1ed8e6eb7c,
1605 fidl::encoding::DynamicFlags::empty(),
1606 )
1607 }
1608}
1609
1610#[must_use = "FIDL methods require a response to be sent"]
1611#[derive(Debug)]
1612pub struct AccessConnectResponder {
1613 control_handle: std::mem::ManuallyDrop<AccessControlHandle>,
1614 tx_id: u32,
1615}
1616
1617impl std::ops::Drop for AccessConnectResponder {
1621 fn drop(&mut self) {
1622 self.control_handle.shutdown();
1623 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1625 }
1626}
1627
1628impl fidl::endpoints::Responder for AccessConnectResponder {
1629 type ControlHandle = AccessControlHandle;
1630
1631 fn control_handle(&self) -> &AccessControlHandle {
1632 &self.control_handle
1633 }
1634
1635 fn drop_without_shutdown(mut self) {
1636 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1638 std::mem::forget(self);
1640 }
1641}
1642
1643impl AccessConnectResponder {
1644 pub fn send(self, mut result: Result<(), Error>) -> Result<(), fidl::Error> {
1648 let _result = self.send_raw(result);
1649 if _result.is_err() {
1650 self.control_handle.shutdown();
1651 }
1652 self.drop_without_shutdown();
1653 _result
1654 }
1655
1656 pub fn send_no_shutdown_on_err(self, mut result: Result<(), Error>) -> Result<(), fidl::Error> {
1658 let _result = self.send_raw(result);
1659 self.drop_without_shutdown();
1660 _result
1661 }
1662
1663 fn send_raw(&self, mut result: Result<(), Error>) -> Result<(), fidl::Error> {
1664 self.control_handle
1665 .inner
1666 .send::<fidl::encoding::ResultType<fidl::encoding::EmptyStruct, Error>>(
1667 result,
1668 self.tx_id,
1669 0x1734199789fe7667,
1670 fidl::encoding::DynamicFlags::empty(),
1671 )
1672 }
1673}
1674
1675#[must_use = "FIDL methods require a response to be sent"]
1676#[derive(Debug)]
1677pub struct AccessDisconnectResponder {
1678 control_handle: std::mem::ManuallyDrop<AccessControlHandle>,
1679 tx_id: u32,
1680}
1681
1682impl std::ops::Drop for AccessDisconnectResponder {
1686 fn drop(&mut self) {
1687 self.control_handle.shutdown();
1688 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1690 }
1691}
1692
1693impl fidl::endpoints::Responder for AccessDisconnectResponder {
1694 type ControlHandle = AccessControlHandle;
1695
1696 fn control_handle(&self) -> &AccessControlHandle {
1697 &self.control_handle
1698 }
1699
1700 fn drop_without_shutdown(mut self) {
1701 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1703 std::mem::forget(self);
1705 }
1706}
1707
1708impl AccessDisconnectResponder {
1709 pub fn send(self, mut result: Result<(), Error>) -> Result<(), fidl::Error> {
1713 let _result = self.send_raw(result);
1714 if _result.is_err() {
1715 self.control_handle.shutdown();
1716 }
1717 self.drop_without_shutdown();
1718 _result
1719 }
1720
1721 pub fn send_no_shutdown_on_err(self, mut result: Result<(), Error>) -> Result<(), fidl::Error> {
1723 let _result = self.send_raw(result);
1724 self.drop_without_shutdown();
1725 _result
1726 }
1727
1728 fn send_raw(&self, mut result: Result<(), Error>) -> Result<(), fidl::Error> {
1729 self.control_handle
1730 .inner
1731 .send::<fidl::encoding::ResultType<fidl::encoding::EmptyStruct, Error>>(
1732 result,
1733 self.tx_id,
1734 0x3a4e06d0c6185a5,
1735 fidl::encoding::DynamicFlags::empty(),
1736 )
1737 }
1738}
1739
1740#[must_use = "FIDL methods require a response to be sent"]
1741#[derive(Debug)]
1742pub struct AccessPairResponder {
1743 control_handle: std::mem::ManuallyDrop<AccessControlHandle>,
1744 tx_id: u32,
1745}
1746
1747impl std::ops::Drop for AccessPairResponder {
1751 fn drop(&mut self) {
1752 self.control_handle.shutdown();
1753 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1755 }
1756}
1757
1758impl fidl::endpoints::Responder for AccessPairResponder {
1759 type ControlHandle = AccessControlHandle;
1760
1761 fn control_handle(&self) -> &AccessControlHandle {
1762 &self.control_handle
1763 }
1764
1765 fn drop_without_shutdown(mut self) {
1766 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1768 std::mem::forget(self);
1770 }
1771}
1772
1773impl AccessPairResponder {
1774 pub fn send(self, mut result: Result<(), Error>) -> Result<(), fidl::Error> {
1778 let _result = self.send_raw(result);
1779 if _result.is_err() {
1780 self.control_handle.shutdown();
1781 }
1782 self.drop_without_shutdown();
1783 _result
1784 }
1785
1786 pub fn send_no_shutdown_on_err(self, mut result: Result<(), Error>) -> Result<(), fidl::Error> {
1788 let _result = self.send_raw(result);
1789 self.drop_without_shutdown();
1790 _result
1791 }
1792
1793 fn send_raw(&self, mut result: Result<(), Error>) -> Result<(), fidl::Error> {
1794 self.control_handle
1795 .inner
1796 .send::<fidl::encoding::ResultType<fidl::encoding::EmptyStruct, Error>>(
1797 result,
1798 self.tx_id,
1799 0x1d08ea19db327779,
1800 fidl::encoding::DynamicFlags::empty(),
1801 )
1802 }
1803}
1804
1805#[must_use = "FIDL methods require a response to be sent"]
1806#[derive(Debug)]
1807pub struct AccessForgetResponder {
1808 control_handle: std::mem::ManuallyDrop<AccessControlHandle>,
1809 tx_id: u32,
1810}
1811
1812impl std::ops::Drop for AccessForgetResponder {
1816 fn drop(&mut self) {
1817 self.control_handle.shutdown();
1818 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1820 }
1821}
1822
1823impl fidl::endpoints::Responder for AccessForgetResponder {
1824 type ControlHandle = AccessControlHandle;
1825
1826 fn control_handle(&self) -> &AccessControlHandle {
1827 &self.control_handle
1828 }
1829
1830 fn drop_without_shutdown(mut self) {
1831 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1833 std::mem::forget(self);
1835 }
1836}
1837
1838impl AccessForgetResponder {
1839 pub fn send(self, mut result: Result<(), Error>) -> Result<(), fidl::Error> {
1843 let _result = self.send_raw(result);
1844 if _result.is_err() {
1845 self.control_handle.shutdown();
1846 }
1847 self.drop_without_shutdown();
1848 _result
1849 }
1850
1851 pub fn send_no_shutdown_on_err(self, mut result: Result<(), Error>) -> Result<(), fidl::Error> {
1853 let _result = self.send_raw(result);
1854 self.drop_without_shutdown();
1855 _result
1856 }
1857
1858 fn send_raw(&self, mut result: Result<(), Error>) -> Result<(), fidl::Error> {
1859 self.control_handle
1860 .inner
1861 .send::<fidl::encoding::ResultType<fidl::encoding::EmptyStruct, Error>>(
1862 result,
1863 self.tx_id,
1864 0x1fd8e27202854c0,
1865 fidl::encoding::DynamicFlags::empty(),
1866 )
1867 }
1868}
1869
1870#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
1871pub struct BootstrapMarker;
1872
1873impl fidl::endpoints::ProtocolMarker for BootstrapMarker {
1874 type Proxy = BootstrapProxy;
1875 type RequestStream = BootstrapRequestStream;
1876 #[cfg(target_os = "fuchsia")]
1877 type SynchronousProxy = BootstrapSynchronousProxy;
1878
1879 const DEBUG_NAME: &'static str = "fuchsia.bluetooth.sys.Bootstrap";
1880}
1881impl fidl::endpoints::DiscoverableProtocolMarker for BootstrapMarker {}
1882pub type BootstrapCommitResult = Result<(), BootstrapError>;
1883
1884pub trait BootstrapProxyInterface: Send + Sync {
1885 fn r#add_identities(&self, identities: &[Identity]) -> Result<(), fidl::Error>;
1886 type CommitResponseFut: std::future::Future<Output = Result<BootstrapCommitResult, fidl::Error>>
1887 + Send;
1888 fn r#commit(&self) -> Self::CommitResponseFut;
1889}
1890#[derive(Debug)]
1891#[cfg(target_os = "fuchsia")]
1892pub struct BootstrapSynchronousProxy {
1893 client: fidl::client::sync::Client,
1894}
1895
1896#[cfg(target_os = "fuchsia")]
1897impl fidl::endpoints::SynchronousProxy for BootstrapSynchronousProxy {
1898 type Proxy = BootstrapProxy;
1899 type Protocol = BootstrapMarker;
1900
1901 fn from_channel(inner: fidl::Channel) -> Self {
1902 Self::new(inner)
1903 }
1904
1905 fn into_channel(self) -> fidl::Channel {
1906 self.client.into_channel()
1907 }
1908
1909 fn as_channel(&self) -> &fidl::Channel {
1910 self.client.as_channel()
1911 }
1912}
1913
1914#[cfg(target_os = "fuchsia")]
1915impl BootstrapSynchronousProxy {
1916 pub fn new(channel: fidl::Channel) -> Self {
1917 let protocol_name = <BootstrapMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
1918 Self { client: fidl::client::sync::Client::new(channel, protocol_name) }
1919 }
1920
1921 pub fn into_channel(self) -> fidl::Channel {
1922 self.client.into_channel()
1923 }
1924
1925 pub fn wait_for_event(
1928 &self,
1929 deadline: zx::MonotonicInstant,
1930 ) -> Result<BootstrapEvent, fidl::Error> {
1931 BootstrapEvent::decode(self.client.wait_for_event(deadline)?)
1932 }
1933
1934 pub fn r#add_identities(&self, mut identities: &[Identity]) -> Result<(), fidl::Error> {
1938 self.client.send::<BootstrapAddIdentitiesRequest>(
1939 (identities,),
1940 0x92d7c849de29bb0,
1941 fidl::encoding::DynamicFlags::empty(),
1942 )
1943 }
1944
1945 pub fn r#commit(
1951 &self,
1952 ___deadline: zx::MonotonicInstant,
1953 ) -> Result<BootstrapCommitResult, fidl::Error> {
1954 let _response = self.client.send_query::<
1955 fidl::encoding::EmptyPayload,
1956 fidl::encoding::ResultType<fidl::encoding::EmptyStruct, BootstrapError>,
1957 >(
1958 (),
1959 0x5288006c9c7db6b7,
1960 fidl::encoding::DynamicFlags::empty(),
1961 ___deadline,
1962 )?;
1963 Ok(_response.map(|x| x))
1964 }
1965}
1966
1967#[derive(Debug, Clone)]
1968pub struct BootstrapProxy {
1969 client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
1970}
1971
1972impl fidl::endpoints::Proxy for BootstrapProxy {
1973 type Protocol = BootstrapMarker;
1974
1975 fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
1976 Self::new(inner)
1977 }
1978
1979 fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
1980 self.client.into_channel().map_err(|client| Self { client })
1981 }
1982
1983 fn as_channel(&self) -> &::fidl::AsyncChannel {
1984 self.client.as_channel()
1985 }
1986}
1987
1988impl BootstrapProxy {
1989 pub fn new(channel: ::fidl::AsyncChannel) -> Self {
1991 let protocol_name = <BootstrapMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
1992 Self { client: fidl::client::Client::new(channel, protocol_name) }
1993 }
1994
1995 pub fn take_event_stream(&self) -> BootstrapEventStream {
2001 BootstrapEventStream { event_receiver: self.client.take_event_receiver() }
2002 }
2003
2004 pub fn r#add_identities(&self, mut identities: &[Identity]) -> Result<(), fidl::Error> {
2008 BootstrapProxyInterface::r#add_identities(self, identities)
2009 }
2010
2011 pub fn r#commit(
2017 &self,
2018 ) -> fidl::client::QueryResponseFut<
2019 BootstrapCommitResult,
2020 fidl::encoding::DefaultFuchsiaResourceDialect,
2021 > {
2022 BootstrapProxyInterface::r#commit(self)
2023 }
2024}
2025
2026impl BootstrapProxyInterface for BootstrapProxy {
2027 fn r#add_identities(&self, mut identities: &[Identity]) -> Result<(), fidl::Error> {
2028 self.client.send::<BootstrapAddIdentitiesRequest>(
2029 (identities,),
2030 0x92d7c849de29bb0,
2031 fidl::encoding::DynamicFlags::empty(),
2032 )
2033 }
2034
2035 type CommitResponseFut = fidl::client::QueryResponseFut<
2036 BootstrapCommitResult,
2037 fidl::encoding::DefaultFuchsiaResourceDialect,
2038 >;
2039 fn r#commit(&self) -> Self::CommitResponseFut {
2040 fn _decode(
2041 mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
2042 ) -> Result<BootstrapCommitResult, fidl::Error> {
2043 let _response = fidl::client::decode_transaction_body::<
2044 fidl::encoding::ResultType<fidl::encoding::EmptyStruct, BootstrapError>,
2045 fidl::encoding::DefaultFuchsiaResourceDialect,
2046 0x5288006c9c7db6b7,
2047 >(_buf?)?;
2048 Ok(_response.map(|x| x))
2049 }
2050 self.client.send_query_and_decode::<fidl::encoding::EmptyPayload, BootstrapCommitResult>(
2051 (),
2052 0x5288006c9c7db6b7,
2053 fidl::encoding::DynamicFlags::empty(),
2054 _decode,
2055 )
2056 }
2057}
2058
2059pub struct BootstrapEventStream {
2060 event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
2061}
2062
2063impl std::marker::Unpin for BootstrapEventStream {}
2064
2065impl futures::stream::FusedStream for BootstrapEventStream {
2066 fn is_terminated(&self) -> bool {
2067 self.event_receiver.is_terminated()
2068 }
2069}
2070
2071impl futures::Stream for BootstrapEventStream {
2072 type Item = Result<BootstrapEvent, fidl::Error>;
2073
2074 fn poll_next(
2075 mut self: std::pin::Pin<&mut Self>,
2076 cx: &mut std::task::Context<'_>,
2077 ) -> std::task::Poll<Option<Self::Item>> {
2078 match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
2079 &mut self.event_receiver,
2080 cx
2081 )?) {
2082 Some(buf) => std::task::Poll::Ready(Some(BootstrapEvent::decode(buf))),
2083 None => std::task::Poll::Ready(None),
2084 }
2085 }
2086}
2087
2088#[derive(Debug)]
2089pub enum BootstrapEvent {}
2090
2091impl BootstrapEvent {
2092 fn decode(
2094 mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
2095 ) -> Result<BootstrapEvent, fidl::Error> {
2096 let (bytes, _handles) = buf.split_mut();
2097 let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
2098 debug_assert_eq!(tx_header.tx_id, 0);
2099 match tx_header.ordinal {
2100 _ => Err(fidl::Error::UnknownOrdinal {
2101 ordinal: tx_header.ordinal,
2102 protocol_name: <BootstrapMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
2103 }),
2104 }
2105 }
2106}
2107
2108pub struct BootstrapRequestStream {
2110 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
2111 is_terminated: bool,
2112}
2113
2114impl std::marker::Unpin for BootstrapRequestStream {}
2115
2116impl futures::stream::FusedStream for BootstrapRequestStream {
2117 fn is_terminated(&self) -> bool {
2118 self.is_terminated
2119 }
2120}
2121
2122impl fidl::endpoints::RequestStream for BootstrapRequestStream {
2123 type Protocol = BootstrapMarker;
2124 type ControlHandle = BootstrapControlHandle;
2125
2126 fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
2127 Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
2128 }
2129
2130 fn control_handle(&self) -> Self::ControlHandle {
2131 BootstrapControlHandle { inner: self.inner.clone() }
2132 }
2133
2134 fn into_inner(
2135 self,
2136 ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
2137 {
2138 (self.inner, self.is_terminated)
2139 }
2140
2141 fn from_inner(
2142 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
2143 is_terminated: bool,
2144 ) -> Self {
2145 Self { inner, is_terminated }
2146 }
2147}
2148
2149impl futures::Stream for BootstrapRequestStream {
2150 type Item = Result<BootstrapRequest, fidl::Error>;
2151
2152 fn poll_next(
2153 mut self: std::pin::Pin<&mut Self>,
2154 cx: &mut std::task::Context<'_>,
2155 ) -> std::task::Poll<Option<Self::Item>> {
2156 let this = &mut *self;
2157 if this.inner.check_shutdown(cx) {
2158 this.is_terminated = true;
2159 return std::task::Poll::Ready(None);
2160 }
2161 if this.is_terminated {
2162 panic!("polled BootstrapRequestStream after completion");
2163 }
2164 fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
2165 |bytes, handles| {
2166 match this.inner.channel().read_etc(cx, bytes, handles) {
2167 std::task::Poll::Ready(Ok(())) => {}
2168 std::task::Poll::Pending => return std::task::Poll::Pending,
2169 std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
2170 this.is_terminated = true;
2171 return std::task::Poll::Ready(None);
2172 }
2173 std::task::Poll::Ready(Err(e)) => {
2174 return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
2175 e.into(),
2176 ))))
2177 }
2178 }
2179
2180 let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
2182
2183 std::task::Poll::Ready(Some(match header.ordinal {
2184 0x92d7c849de29bb0 => {
2185 header.validate_request_tx_id(fidl::MethodType::OneWay)?;
2186 let mut req = fidl::new_empty!(
2187 BootstrapAddIdentitiesRequest,
2188 fidl::encoding::DefaultFuchsiaResourceDialect
2189 );
2190 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<BootstrapAddIdentitiesRequest>(&header, _body_bytes, handles, &mut req)?;
2191 let control_handle = BootstrapControlHandle { inner: this.inner.clone() };
2192 Ok(BootstrapRequest::AddIdentities {
2193 identities: req.identities,
2194
2195 control_handle,
2196 })
2197 }
2198 0x5288006c9c7db6b7 => {
2199 header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
2200 let mut req = fidl::new_empty!(
2201 fidl::encoding::EmptyPayload,
2202 fidl::encoding::DefaultFuchsiaResourceDialect
2203 );
2204 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
2205 let control_handle = BootstrapControlHandle { inner: this.inner.clone() };
2206 Ok(BootstrapRequest::Commit {
2207 responder: BootstrapCommitResponder {
2208 control_handle: std::mem::ManuallyDrop::new(control_handle),
2209 tx_id: header.tx_id,
2210 },
2211 })
2212 }
2213 _ => Err(fidl::Error::UnknownOrdinal {
2214 ordinal: header.ordinal,
2215 protocol_name:
2216 <BootstrapMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
2217 }),
2218 }))
2219 },
2220 )
2221 }
2222}
2223
2224#[derive(Debug)]
2235pub enum BootstrapRequest {
2236 AddIdentities { identities: Vec<Identity>, control_handle: BootstrapControlHandle },
2240 Commit { responder: BootstrapCommitResponder },
2246}
2247
2248impl BootstrapRequest {
2249 #[allow(irrefutable_let_patterns)]
2250 pub fn into_add_identities(self) -> Option<(Vec<Identity>, BootstrapControlHandle)> {
2251 if let BootstrapRequest::AddIdentities { identities, control_handle } = self {
2252 Some((identities, control_handle))
2253 } else {
2254 None
2255 }
2256 }
2257
2258 #[allow(irrefutable_let_patterns)]
2259 pub fn into_commit(self) -> Option<(BootstrapCommitResponder)> {
2260 if let BootstrapRequest::Commit { responder } = self {
2261 Some((responder))
2262 } else {
2263 None
2264 }
2265 }
2266
2267 pub fn method_name(&self) -> &'static str {
2269 match *self {
2270 BootstrapRequest::AddIdentities { .. } => "add_identities",
2271 BootstrapRequest::Commit { .. } => "commit",
2272 }
2273 }
2274}
2275
2276#[derive(Debug, Clone)]
2277pub struct BootstrapControlHandle {
2278 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
2279}
2280
2281impl fidl::endpoints::ControlHandle for BootstrapControlHandle {
2282 fn shutdown(&self) {
2283 self.inner.shutdown()
2284 }
2285 fn shutdown_with_epitaph(&self, status: zx_status::Status) {
2286 self.inner.shutdown_with_epitaph(status)
2287 }
2288
2289 fn is_closed(&self) -> bool {
2290 self.inner.channel().is_closed()
2291 }
2292 fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
2293 self.inner.channel().on_closed()
2294 }
2295
2296 #[cfg(target_os = "fuchsia")]
2297 fn signal_peer(
2298 &self,
2299 clear_mask: zx::Signals,
2300 set_mask: zx::Signals,
2301 ) -> Result<(), zx_status::Status> {
2302 use fidl::Peered;
2303 self.inner.channel().signal_peer(clear_mask, set_mask)
2304 }
2305}
2306
2307impl BootstrapControlHandle {}
2308
2309#[must_use = "FIDL methods require a response to be sent"]
2310#[derive(Debug)]
2311pub struct BootstrapCommitResponder {
2312 control_handle: std::mem::ManuallyDrop<BootstrapControlHandle>,
2313 tx_id: u32,
2314}
2315
2316impl std::ops::Drop for BootstrapCommitResponder {
2320 fn drop(&mut self) {
2321 self.control_handle.shutdown();
2322 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
2324 }
2325}
2326
2327impl fidl::endpoints::Responder for BootstrapCommitResponder {
2328 type ControlHandle = BootstrapControlHandle;
2329
2330 fn control_handle(&self) -> &BootstrapControlHandle {
2331 &self.control_handle
2332 }
2333
2334 fn drop_without_shutdown(mut self) {
2335 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
2337 std::mem::forget(self);
2339 }
2340}
2341
2342impl BootstrapCommitResponder {
2343 pub fn send(self, mut result: Result<(), BootstrapError>) -> Result<(), fidl::Error> {
2347 let _result = self.send_raw(result);
2348 if _result.is_err() {
2349 self.control_handle.shutdown();
2350 }
2351 self.drop_without_shutdown();
2352 _result
2353 }
2354
2355 pub fn send_no_shutdown_on_err(
2357 self,
2358 mut result: Result<(), BootstrapError>,
2359 ) -> Result<(), fidl::Error> {
2360 let _result = self.send_raw(result);
2361 self.drop_without_shutdown();
2362 _result
2363 }
2364
2365 fn send_raw(&self, mut result: Result<(), BootstrapError>) -> Result<(), fidl::Error> {
2366 self.control_handle.inner.send::<fidl::encoding::ResultType<
2367 fidl::encoding::EmptyStruct,
2368 BootstrapError,
2369 >>(
2370 result,
2371 self.tx_id,
2372 0x5288006c9c7db6b7,
2373 fidl::encoding::DynamicFlags::empty(),
2374 )
2375 }
2376}
2377
2378#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
2379pub struct ConfigurationMarker;
2380
2381impl fidl::endpoints::ProtocolMarker for ConfigurationMarker {
2382 type Proxy = ConfigurationProxy;
2383 type RequestStream = ConfigurationRequestStream;
2384 #[cfg(target_os = "fuchsia")]
2385 type SynchronousProxy = ConfigurationSynchronousProxy;
2386
2387 const DEBUG_NAME: &'static str = "fuchsia.bluetooth.sys.Configuration";
2388}
2389impl fidl::endpoints::DiscoverableProtocolMarker for ConfigurationMarker {}
2390
2391pub trait ConfigurationProxyInterface: Send + Sync {
2392 type UpdateResponseFut: std::future::Future<Output = Result<Settings, fidl::Error>> + Send;
2393 fn r#update(&self, settings: &Settings) -> Self::UpdateResponseFut;
2394}
2395#[derive(Debug)]
2396#[cfg(target_os = "fuchsia")]
2397pub struct ConfigurationSynchronousProxy {
2398 client: fidl::client::sync::Client,
2399}
2400
2401#[cfg(target_os = "fuchsia")]
2402impl fidl::endpoints::SynchronousProxy for ConfigurationSynchronousProxy {
2403 type Proxy = ConfigurationProxy;
2404 type Protocol = ConfigurationMarker;
2405
2406 fn from_channel(inner: fidl::Channel) -> Self {
2407 Self::new(inner)
2408 }
2409
2410 fn into_channel(self) -> fidl::Channel {
2411 self.client.into_channel()
2412 }
2413
2414 fn as_channel(&self) -> &fidl::Channel {
2415 self.client.as_channel()
2416 }
2417}
2418
2419#[cfg(target_os = "fuchsia")]
2420impl ConfigurationSynchronousProxy {
2421 pub fn new(channel: fidl::Channel) -> Self {
2422 let protocol_name = <ConfigurationMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
2423 Self { client: fidl::client::sync::Client::new(channel, protocol_name) }
2424 }
2425
2426 pub fn into_channel(self) -> fidl::Channel {
2427 self.client.into_channel()
2428 }
2429
2430 pub fn wait_for_event(
2433 &self,
2434 deadline: zx::MonotonicInstant,
2435 ) -> Result<ConfigurationEvent, fidl::Error> {
2436 ConfigurationEvent::decode(self.client.wait_for_event(deadline)?)
2437 }
2438
2439 pub fn r#update(
2447 &self,
2448 mut settings: &Settings,
2449 ___deadline: zx::MonotonicInstant,
2450 ) -> Result<Settings, fidl::Error> {
2451 let _response =
2452 self.client.send_query::<ConfigurationUpdateRequest, ConfigurationUpdateResponse>(
2453 (settings,),
2454 0x27e9cfb72e7c6d01,
2455 fidl::encoding::DynamicFlags::empty(),
2456 ___deadline,
2457 )?;
2458 Ok(_response.result)
2459 }
2460}
2461
2462#[derive(Debug, Clone)]
2463pub struct ConfigurationProxy {
2464 client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
2465}
2466
2467impl fidl::endpoints::Proxy for ConfigurationProxy {
2468 type Protocol = ConfigurationMarker;
2469
2470 fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
2471 Self::new(inner)
2472 }
2473
2474 fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
2475 self.client.into_channel().map_err(|client| Self { client })
2476 }
2477
2478 fn as_channel(&self) -> &::fidl::AsyncChannel {
2479 self.client.as_channel()
2480 }
2481}
2482
2483impl ConfigurationProxy {
2484 pub fn new(channel: ::fidl::AsyncChannel) -> Self {
2486 let protocol_name = <ConfigurationMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
2487 Self { client: fidl::client::Client::new(channel, protocol_name) }
2488 }
2489
2490 pub fn take_event_stream(&self) -> ConfigurationEventStream {
2496 ConfigurationEventStream { event_receiver: self.client.take_event_receiver() }
2497 }
2498
2499 pub fn r#update(
2507 &self,
2508 mut settings: &Settings,
2509 ) -> fidl::client::QueryResponseFut<Settings, fidl::encoding::DefaultFuchsiaResourceDialect>
2510 {
2511 ConfigurationProxyInterface::r#update(self, settings)
2512 }
2513}
2514
2515impl ConfigurationProxyInterface for ConfigurationProxy {
2516 type UpdateResponseFut =
2517 fidl::client::QueryResponseFut<Settings, fidl::encoding::DefaultFuchsiaResourceDialect>;
2518 fn r#update(&self, mut settings: &Settings) -> Self::UpdateResponseFut {
2519 fn _decode(
2520 mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
2521 ) -> Result<Settings, fidl::Error> {
2522 let _response = fidl::client::decode_transaction_body::<
2523 ConfigurationUpdateResponse,
2524 fidl::encoding::DefaultFuchsiaResourceDialect,
2525 0x27e9cfb72e7c6d01,
2526 >(_buf?)?;
2527 Ok(_response.result)
2528 }
2529 self.client.send_query_and_decode::<ConfigurationUpdateRequest, Settings>(
2530 (settings,),
2531 0x27e9cfb72e7c6d01,
2532 fidl::encoding::DynamicFlags::empty(),
2533 _decode,
2534 )
2535 }
2536}
2537
2538pub struct ConfigurationEventStream {
2539 event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
2540}
2541
2542impl std::marker::Unpin for ConfigurationEventStream {}
2543
2544impl futures::stream::FusedStream for ConfigurationEventStream {
2545 fn is_terminated(&self) -> bool {
2546 self.event_receiver.is_terminated()
2547 }
2548}
2549
2550impl futures::Stream for ConfigurationEventStream {
2551 type Item = Result<ConfigurationEvent, fidl::Error>;
2552
2553 fn poll_next(
2554 mut self: std::pin::Pin<&mut Self>,
2555 cx: &mut std::task::Context<'_>,
2556 ) -> std::task::Poll<Option<Self::Item>> {
2557 match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
2558 &mut self.event_receiver,
2559 cx
2560 )?) {
2561 Some(buf) => std::task::Poll::Ready(Some(ConfigurationEvent::decode(buf))),
2562 None => std::task::Poll::Ready(None),
2563 }
2564 }
2565}
2566
2567#[derive(Debug)]
2568pub enum ConfigurationEvent {}
2569
2570impl ConfigurationEvent {
2571 fn decode(
2573 mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
2574 ) -> Result<ConfigurationEvent, fidl::Error> {
2575 let (bytes, _handles) = buf.split_mut();
2576 let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
2577 debug_assert_eq!(tx_header.tx_id, 0);
2578 match tx_header.ordinal {
2579 _ => Err(fidl::Error::UnknownOrdinal {
2580 ordinal: tx_header.ordinal,
2581 protocol_name: <ConfigurationMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
2582 }),
2583 }
2584 }
2585}
2586
2587pub struct ConfigurationRequestStream {
2589 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
2590 is_terminated: bool,
2591}
2592
2593impl std::marker::Unpin for ConfigurationRequestStream {}
2594
2595impl futures::stream::FusedStream for ConfigurationRequestStream {
2596 fn is_terminated(&self) -> bool {
2597 self.is_terminated
2598 }
2599}
2600
2601impl fidl::endpoints::RequestStream for ConfigurationRequestStream {
2602 type Protocol = ConfigurationMarker;
2603 type ControlHandle = ConfigurationControlHandle;
2604
2605 fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
2606 Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
2607 }
2608
2609 fn control_handle(&self) -> Self::ControlHandle {
2610 ConfigurationControlHandle { inner: self.inner.clone() }
2611 }
2612
2613 fn into_inner(
2614 self,
2615 ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
2616 {
2617 (self.inner, self.is_terminated)
2618 }
2619
2620 fn from_inner(
2621 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
2622 is_terminated: bool,
2623 ) -> Self {
2624 Self { inner, is_terminated }
2625 }
2626}
2627
2628impl futures::Stream for ConfigurationRequestStream {
2629 type Item = Result<ConfigurationRequest, fidl::Error>;
2630
2631 fn poll_next(
2632 mut self: std::pin::Pin<&mut Self>,
2633 cx: &mut std::task::Context<'_>,
2634 ) -> std::task::Poll<Option<Self::Item>> {
2635 let this = &mut *self;
2636 if this.inner.check_shutdown(cx) {
2637 this.is_terminated = true;
2638 return std::task::Poll::Ready(None);
2639 }
2640 if this.is_terminated {
2641 panic!("polled ConfigurationRequestStream after completion");
2642 }
2643 fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
2644 |bytes, handles| {
2645 match this.inner.channel().read_etc(cx, bytes, handles) {
2646 std::task::Poll::Ready(Ok(())) => {}
2647 std::task::Poll::Pending => return std::task::Poll::Pending,
2648 std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
2649 this.is_terminated = true;
2650 return std::task::Poll::Ready(None);
2651 }
2652 std::task::Poll::Ready(Err(e)) => {
2653 return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
2654 e.into(),
2655 ))))
2656 }
2657 }
2658
2659 let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
2661
2662 std::task::Poll::Ready(Some(match header.ordinal {
2663 0x27e9cfb72e7c6d01 => {
2664 header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
2665 let mut req = fidl::new_empty!(
2666 ConfigurationUpdateRequest,
2667 fidl::encoding::DefaultFuchsiaResourceDialect
2668 );
2669 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<ConfigurationUpdateRequest>(&header, _body_bytes, handles, &mut req)?;
2670 let control_handle =
2671 ConfigurationControlHandle { inner: this.inner.clone() };
2672 Ok(ConfigurationRequest::Update {
2673 settings: req.settings,
2674
2675 responder: ConfigurationUpdateResponder {
2676 control_handle: std::mem::ManuallyDrop::new(control_handle),
2677 tx_id: header.tx_id,
2678 },
2679 })
2680 }
2681 _ => Err(fidl::Error::UnknownOrdinal {
2682 ordinal: header.ordinal,
2683 protocol_name:
2684 <ConfigurationMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
2685 }),
2686 }))
2687 },
2688 )
2689 }
2690}
2691
2692#[derive(Debug)]
2698pub enum ConfigurationRequest {
2699 Update { settings: Settings, responder: ConfigurationUpdateResponder },
2707}
2708
2709impl ConfigurationRequest {
2710 #[allow(irrefutable_let_patterns)]
2711 pub fn into_update(self) -> Option<(Settings, ConfigurationUpdateResponder)> {
2712 if let ConfigurationRequest::Update { settings, responder } = self {
2713 Some((settings, responder))
2714 } else {
2715 None
2716 }
2717 }
2718
2719 pub fn method_name(&self) -> &'static str {
2721 match *self {
2722 ConfigurationRequest::Update { .. } => "update",
2723 }
2724 }
2725}
2726
2727#[derive(Debug, Clone)]
2728pub struct ConfigurationControlHandle {
2729 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
2730}
2731
2732impl fidl::endpoints::ControlHandle for ConfigurationControlHandle {
2733 fn shutdown(&self) {
2734 self.inner.shutdown()
2735 }
2736 fn shutdown_with_epitaph(&self, status: zx_status::Status) {
2737 self.inner.shutdown_with_epitaph(status)
2738 }
2739
2740 fn is_closed(&self) -> bool {
2741 self.inner.channel().is_closed()
2742 }
2743 fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
2744 self.inner.channel().on_closed()
2745 }
2746
2747 #[cfg(target_os = "fuchsia")]
2748 fn signal_peer(
2749 &self,
2750 clear_mask: zx::Signals,
2751 set_mask: zx::Signals,
2752 ) -> Result<(), zx_status::Status> {
2753 use fidl::Peered;
2754 self.inner.channel().signal_peer(clear_mask, set_mask)
2755 }
2756}
2757
2758impl ConfigurationControlHandle {}
2759
2760#[must_use = "FIDL methods require a response to be sent"]
2761#[derive(Debug)]
2762pub struct ConfigurationUpdateResponder {
2763 control_handle: std::mem::ManuallyDrop<ConfigurationControlHandle>,
2764 tx_id: u32,
2765}
2766
2767impl std::ops::Drop for ConfigurationUpdateResponder {
2771 fn drop(&mut self) {
2772 self.control_handle.shutdown();
2773 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
2775 }
2776}
2777
2778impl fidl::endpoints::Responder for ConfigurationUpdateResponder {
2779 type ControlHandle = ConfigurationControlHandle;
2780
2781 fn control_handle(&self) -> &ConfigurationControlHandle {
2782 &self.control_handle
2783 }
2784
2785 fn drop_without_shutdown(mut self) {
2786 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
2788 std::mem::forget(self);
2790 }
2791}
2792
2793impl ConfigurationUpdateResponder {
2794 pub fn send(self, mut result: &Settings) -> Result<(), fidl::Error> {
2798 let _result = self.send_raw(result);
2799 if _result.is_err() {
2800 self.control_handle.shutdown();
2801 }
2802 self.drop_without_shutdown();
2803 _result
2804 }
2805
2806 pub fn send_no_shutdown_on_err(self, mut result: &Settings) -> Result<(), fidl::Error> {
2808 let _result = self.send_raw(result);
2809 self.drop_without_shutdown();
2810 _result
2811 }
2812
2813 fn send_raw(&self, mut result: &Settings) -> Result<(), fidl::Error> {
2814 self.control_handle.inner.send::<ConfigurationUpdateResponse>(
2815 (result,),
2816 self.tx_id,
2817 0x27e9cfb72e7c6d01,
2818 fidl::encoding::DynamicFlags::empty(),
2819 )
2820 }
2821}
2822
2823#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
2824pub struct HostWatcherMarker;
2825
2826impl fidl::endpoints::ProtocolMarker for HostWatcherMarker {
2827 type Proxy = HostWatcherProxy;
2828 type RequestStream = HostWatcherRequestStream;
2829 #[cfg(target_os = "fuchsia")]
2830 type SynchronousProxy = HostWatcherSynchronousProxy;
2831
2832 const DEBUG_NAME: &'static str = "fuchsia.bluetooth.sys.HostWatcher";
2833}
2834impl fidl::endpoints::DiscoverableProtocolMarker for HostWatcherMarker {}
2835pub type HostWatcherSetActiveResult = Result<(), i32>;
2836
2837pub trait HostWatcherProxyInterface: Send + Sync {
2838 type WatchResponseFut: std::future::Future<Output = Result<Vec<HostInfo>, fidl::Error>> + Send;
2839 fn r#watch(&self) -> Self::WatchResponseFut;
2840 type SetActiveResponseFut: std::future::Future<Output = Result<HostWatcherSetActiveResult, fidl::Error>>
2841 + Send;
2842 fn r#set_active(&self, id: &fidl_fuchsia_bluetooth::HostId) -> Self::SetActiveResponseFut;
2843}
2844#[derive(Debug)]
2845#[cfg(target_os = "fuchsia")]
2846pub struct HostWatcherSynchronousProxy {
2847 client: fidl::client::sync::Client,
2848}
2849
2850#[cfg(target_os = "fuchsia")]
2851impl fidl::endpoints::SynchronousProxy for HostWatcherSynchronousProxy {
2852 type Proxy = HostWatcherProxy;
2853 type Protocol = HostWatcherMarker;
2854
2855 fn from_channel(inner: fidl::Channel) -> Self {
2856 Self::new(inner)
2857 }
2858
2859 fn into_channel(self) -> fidl::Channel {
2860 self.client.into_channel()
2861 }
2862
2863 fn as_channel(&self) -> &fidl::Channel {
2864 self.client.as_channel()
2865 }
2866}
2867
2868#[cfg(target_os = "fuchsia")]
2869impl HostWatcherSynchronousProxy {
2870 pub fn new(channel: fidl::Channel) -> Self {
2871 let protocol_name = <HostWatcherMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
2872 Self { client: fidl::client::sync::Client::new(channel, protocol_name) }
2873 }
2874
2875 pub fn into_channel(self) -> fidl::Channel {
2876 self.client.into_channel()
2877 }
2878
2879 pub fn wait_for_event(
2882 &self,
2883 deadline: zx::MonotonicInstant,
2884 ) -> Result<HostWatcherEvent, fidl::Error> {
2885 HostWatcherEvent::decode(self.client.wait_for_event(deadline)?)
2886 }
2887
2888 pub fn r#watch(&self, ___deadline: zx::MonotonicInstant) -> Result<Vec<HostInfo>, fidl::Error> {
2891 let _response =
2892 self.client.send_query::<fidl::encoding::EmptyPayload, HostWatcherWatchResponse>(
2893 (),
2894 0x4e2c2972a5b16f9c,
2895 fidl::encoding::DynamicFlags::empty(),
2896 ___deadline,
2897 )?;
2898 Ok(_response.hosts)
2899 }
2900
2901 pub fn r#set_active(
2907 &self,
2908 mut id: &fidl_fuchsia_bluetooth::HostId,
2909 ___deadline: zx::MonotonicInstant,
2910 ) -> Result<HostWatcherSetActiveResult, fidl::Error> {
2911 let _response = self.client.send_query::<
2912 HostWatcherSetActiveRequest,
2913 fidl::encoding::ResultType<fidl::encoding::EmptyStruct, i32>,
2914 >(
2915 (id,),
2916 0x83f311ecaf0ddf3,
2917 fidl::encoding::DynamicFlags::empty(),
2918 ___deadline,
2919 )?;
2920 Ok(_response.map(|x| x))
2921 }
2922}
2923
2924#[derive(Debug, Clone)]
2925pub struct HostWatcherProxy {
2926 client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
2927}
2928
2929impl fidl::endpoints::Proxy for HostWatcherProxy {
2930 type Protocol = HostWatcherMarker;
2931
2932 fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
2933 Self::new(inner)
2934 }
2935
2936 fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
2937 self.client.into_channel().map_err(|client| Self { client })
2938 }
2939
2940 fn as_channel(&self) -> &::fidl::AsyncChannel {
2941 self.client.as_channel()
2942 }
2943}
2944
2945impl HostWatcherProxy {
2946 pub fn new(channel: ::fidl::AsyncChannel) -> Self {
2948 let protocol_name = <HostWatcherMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
2949 Self { client: fidl::client::Client::new(channel, protocol_name) }
2950 }
2951
2952 pub fn take_event_stream(&self) -> HostWatcherEventStream {
2958 HostWatcherEventStream { event_receiver: self.client.take_event_receiver() }
2959 }
2960
2961 pub fn r#watch(
2964 &self,
2965 ) -> fidl::client::QueryResponseFut<Vec<HostInfo>, fidl::encoding::DefaultFuchsiaResourceDialect>
2966 {
2967 HostWatcherProxyInterface::r#watch(self)
2968 }
2969
2970 pub fn r#set_active(
2976 &self,
2977 mut id: &fidl_fuchsia_bluetooth::HostId,
2978 ) -> fidl::client::QueryResponseFut<
2979 HostWatcherSetActiveResult,
2980 fidl::encoding::DefaultFuchsiaResourceDialect,
2981 > {
2982 HostWatcherProxyInterface::r#set_active(self, id)
2983 }
2984}
2985
2986impl HostWatcherProxyInterface for HostWatcherProxy {
2987 type WatchResponseFut = fidl::client::QueryResponseFut<
2988 Vec<HostInfo>,
2989 fidl::encoding::DefaultFuchsiaResourceDialect,
2990 >;
2991 fn r#watch(&self) -> Self::WatchResponseFut {
2992 fn _decode(
2993 mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
2994 ) -> Result<Vec<HostInfo>, fidl::Error> {
2995 let _response = fidl::client::decode_transaction_body::<
2996 HostWatcherWatchResponse,
2997 fidl::encoding::DefaultFuchsiaResourceDialect,
2998 0x4e2c2972a5b16f9c,
2999 >(_buf?)?;
3000 Ok(_response.hosts)
3001 }
3002 self.client.send_query_and_decode::<fidl::encoding::EmptyPayload, Vec<HostInfo>>(
3003 (),
3004 0x4e2c2972a5b16f9c,
3005 fidl::encoding::DynamicFlags::empty(),
3006 _decode,
3007 )
3008 }
3009
3010 type SetActiveResponseFut = fidl::client::QueryResponseFut<
3011 HostWatcherSetActiveResult,
3012 fidl::encoding::DefaultFuchsiaResourceDialect,
3013 >;
3014 fn r#set_active(&self, mut id: &fidl_fuchsia_bluetooth::HostId) -> Self::SetActiveResponseFut {
3015 fn _decode(
3016 mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
3017 ) -> Result<HostWatcherSetActiveResult, fidl::Error> {
3018 let _response = fidl::client::decode_transaction_body::<
3019 fidl::encoding::ResultType<fidl::encoding::EmptyStruct, i32>,
3020 fidl::encoding::DefaultFuchsiaResourceDialect,
3021 0x83f311ecaf0ddf3,
3022 >(_buf?)?;
3023 Ok(_response.map(|x| x))
3024 }
3025 self.client
3026 .send_query_and_decode::<HostWatcherSetActiveRequest, HostWatcherSetActiveResult>(
3027 (id,),
3028 0x83f311ecaf0ddf3,
3029 fidl::encoding::DynamicFlags::empty(),
3030 _decode,
3031 )
3032 }
3033}
3034
3035pub struct HostWatcherEventStream {
3036 event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
3037}
3038
3039impl std::marker::Unpin for HostWatcherEventStream {}
3040
3041impl futures::stream::FusedStream for HostWatcherEventStream {
3042 fn is_terminated(&self) -> bool {
3043 self.event_receiver.is_terminated()
3044 }
3045}
3046
3047impl futures::Stream for HostWatcherEventStream {
3048 type Item = Result<HostWatcherEvent, fidl::Error>;
3049
3050 fn poll_next(
3051 mut self: std::pin::Pin<&mut Self>,
3052 cx: &mut std::task::Context<'_>,
3053 ) -> std::task::Poll<Option<Self::Item>> {
3054 match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
3055 &mut self.event_receiver,
3056 cx
3057 )?) {
3058 Some(buf) => std::task::Poll::Ready(Some(HostWatcherEvent::decode(buf))),
3059 None => std::task::Poll::Ready(None),
3060 }
3061 }
3062}
3063
3064#[derive(Debug)]
3065pub enum HostWatcherEvent {}
3066
3067impl HostWatcherEvent {
3068 fn decode(
3070 mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
3071 ) -> Result<HostWatcherEvent, fidl::Error> {
3072 let (bytes, _handles) = buf.split_mut();
3073 let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
3074 debug_assert_eq!(tx_header.tx_id, 0);
3075 match tx_header.ordinal {
3076 _ => Err(fidl::Error::UnknownOrdinal {
3077 ordinal: tx_header.ordinal,
3078 protocol_name: <HostWatcherMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
3079 }),
3080 }
3081 }
3082}
3083
3084pub struct HostWatcherRequestStream {
3086 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
3087 is_terminated: bool,
3088}
3089
3090impl std::marker::Unpin for HostWatcherRequestStream {}
3091
3092impl futures::stream::FusedStream for HostWatcherRequestStream {
3093 fn is_terminated(&self) -> bool {
3094 self.is_terminated
3095 }
3096}
3097
3098impl fidl::endpoints::RequestStream for HostWatcherRequestStream {
3099 type Protocol = HostWatcherMarker;
3100 type ControlHandle = HostWatcherControlHandle;
3101
3102 fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
3103 Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
3104 }
3105
3106 fn control_handle(&self) -> Self::ControlHandle {
3107 HostWatcherControlHandle { inner: self.inner.clone() }
3108 }
3109
3110 fn into_inner(
3111 self,
3112 ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
3113 {
3114 (self.inner, self.is_terminated)
3115 }
3116
3117 fn from_inner(
3118 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
3119 is_terminated: bool,
3120 ) -> Self {
3121 Self { inner, is_terminated }
3122 }
3123}
3124
3125impl futures::Stream for HostWatcherRequestStream {
3126 type Item = Result<HostWatcherRequest, fidl::Error>;
3127
3128 fn poll_next(
3129 mut self: std::pin::Pin<&mut Self>,
3130 cx: &mut std::task::Context<'_>,
3131 ) -> std::task::Poll<Option<Self::Item>> {
3132 let this = &mut *self;
3133 if this.inner.check_shutdown(cx) {
3134 this.is_terminated = true;
3135 return std::task::Poll::Ready(None);
3136 }
3137 if this.is_terminated {
3138 panic!("polled HostWatcherRequestStream after completion");
3139 }
3140 fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
3141 |bytes, handles| {
3142 match this.inner.channel().read_etc(cx, bytes, handles) {
3143 std::task::Poll::Ready(Ok(())) => {}
3144 std::task::Poll::Pending => return std::task::Poll::Pending,
3145 std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
3146 this.is_terminated = true;
3147 return std::task::Poll::Ready(None);
3148 }
3149 std::task::Poll::Ready(Err(e)) => {
3150 return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
3151 e.into(),
3152 ))))
3153 }
3154 }
3155
3156 let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
3158
3159 std::task::Poll::Ready(Some(match header.ordinal {
3160 0x4e2c2972a5b16f9c => {
3161 header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
3162 let mut req = fidl::new_empty!(
3163 fidl::encoding::EmptyPayload,
3164 fidl::encoding::DefaultFuchsiaResourceDialect
3165 );
3166 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
3167 let control_handle = HostWatcherControlHandle { inner: this.inner.clone() };
3168 Ok(HostWatcherRequest::Watch {
3169 responder: HostWatcherWatchResponder {
3170 control_handle: std::mem::ManuallyDrop::new(control_handle),
3171 tx_id: header.tx_id,
3172 },
3173 })
3174 }
3175 0x83f311ecaf0ddf3 => {
3176 header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
3177 let mut req = fidl::new_empty!(
3178 HostWatcherSetActiveRequest,
3179 fidl::encoding::DefaultFuchsiaResourceDialect
3180 );
3181 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<HostWatcherSetActiveRequest>(&header, _body_bytes, handles, &mut req)?;
3182 let control_handle = HostWatcherControlHandle { inner: this.inner.clone() };
3183 Ok(HostWatcherRequest::SetActive {
3184 id: req.id,
3185
3186 responder: HostWatcherSetActiveResponder {
3187 control_handle: std::mem::ManuallyDrop::new(control_handle),
3188 tx_id: header.tx_id,
3189 },
3190 })
3191 }
3192 _ => Err(fidl::Error::UnknownOrdinal {
3193 ordinal: header.ordinal,
3194 protocol_name:
3195 <HostWatcherMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
3196 }),
3197 }))
3198 },
3199 )
3200 }
3201}
3202
3203#[derive(Debug)]
3205pub enum HostWatcherRequest {
3206 Watch { responder: HostWatcherWatchResponder },
3209 SetActive { id: fidl_fuchsia_bluetooth::HostId, responder: HostWatcherSetActiveResponder },
3215}
3216
3217impl HostWatcherRequest {
3218 #[allow(irrefutable_let_patterns)]
3219 pub fn into_watch(self) -> Option<(HostWatcherWatchResponder)> {
3220 if let HostWatcherRequest::Watch { responder } = self {
3221 Some((responder))
3222 } else {
3223 None
3224 }
3225 }
3226
3227 #[allow(irrefutable_let_patterns)]
3228 pub fn into_set_active(
3229 self,
3230 ) -> Option<(fidl_fuchsia_bluetooth::HostId, HostWatcherSetActiveResponder)> {
3231 if let HostWatcherRequest::SetActive { id, responder } = self {
3232 Some((id, responder))
3233 } else {
3234 None
3235 }
3236 }
3237
3238 pub fn method_name(&self) -> &'static str {
3240 match *self {
3241 HostWatcherRequest::Watch { .. } => "watch",
3242 HostWatcherRequest::SetActive { .. } => "set_active",
3243 }
3244 }
3245}
3246
3247#[derive(Debug, Clone)]
3248pub struct HostWatcherControlHandle {
3249 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
3250}
3251
3252impl fidl::endpoints::ControlHandle for HostWatcherControlHandle {
3253 fn shutdown(&self) {
3254 self.inner.shutdown()
3255 }
3256 fn shutdown_with_epitaph(&self, status: zx_status::Status) {
3257 self.inner.shutdown_with_epitaph(status)
3258 }
3259
3260 fn is_closed(&self) -> bool {
3261 self.inner.channel().is_closed()
3262 }
3263 fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
3264 self.inner.channel().on_closed()
3265 }
3266
3267 #[cfg(target_os = "fuchsia")]
3268 fn signal_peer(
3269 &self,
3270 clear_mask: zx::Signals,
3271 set_mask: zx::Signals,
3272 ) -> Result<(), zx_status::Status> {
3273 use fidl::Peered;
3274 self.inner.channel().signal_peer(clear_mask, set_mask)
3275 }
3276}
3277
3278impl HostWatcherControlHandle {}
3279
3280#[must_use = "FIDL methods require a response to be sent"]
3281#[derive(Debug)]
3282pub struct HostWatcherWatchResponder {
3283 control_handle: std::mem::ManuallyDrop<HostWatcherControlHandle>,
3284 tx_id: u32,
3285}
3286
3287impl std::ops::Drop for HostWatcherWatchResponder {
3291 fn drop(&mut self) {
3292 self.control_handle.shutdown();
3293 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
3295 }
3296}
3297
3298impl fidl::endpoints::Responder for HostWatcherWatchResponder {
3299 type ControlHandle = HostWatcherControlHandle;
3300
3301 fn control_handle(&self) -> &HostWatcherControlHandle {
3302 &self.control_handle
3303 }
3304
3305 fn drop_without_shutdown(mut self) {
3306 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
3308 std::mem::forget(self);
3310 }
3311}
3312
3313impl HostWatcherWatchResponder {
3314 pub fn send(self, mut hosts: &[HostInfo]) -> Result<(), fidl::Error> {
3318 let _result = self.send_raw(hosts);
3319 if _result.is_err() {
3320 self.control_handle.shutdown();
3321 }
3322 self.drop_without_shutdown();
3323 _result
3324 }
3325
3326 pub fn send_no_shutdown_on_err(self, mut hosts: &[HostInfo]) -> Result<(), fidl::Error> {
3328 let _result = self.send_raw(hosts);
3329 self.drop_without_shutdown();
3330 _result
3331 }
3332
3333 fn send_raw(&self, mut hosts: &[HostInfo]) -> Result<(), fidl::Error> {
3334 self.control_handle.inner.send::<HostWatcherWatchResponse>(
3335 (hosts,),
3336 self.tx_id,
3337 0x4e2c2972a5b16f9c,
3338 fidl::encoding::DynamicFlags::empty(),
3339 )
3340 }
3341}
3342
3343#[must_use = "FIDL methods require a response to be sent"]
3344#[derive(Debug)]
3345pub struct HostWatcherSetActiveResponder {
3346 control_handle: std::mem::ManuallyDrop<HostWatcherControlHandle>,
3347 tx_id: u32,
3348}
3349
3350impl std::ops::Drop for HostWatcherSetActiveResponder {
3354 fn drop(&mut self) {
3355 self.control_handle.shutdown();
3356 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
3358 }
3359}
3360
3361impl fidl::endpoints::Responder for HostWatcherSetActiveResponder {
3362 type ControlHandle = HostWatcherControlHandle;
3363
3364 fn control_handle(&self) -> &HostWatcherControlHandle {
3365 &self.control_handle
3366 }
3367
3368 fn drop_without_shutdown(mut self) {
3369 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
3371 std::mem::forget(self);
3373 }
3374}
3375
3376impl HostWatcherSetActiveResponder {
3377 pub fn send(self, mut result: Result<(), i32>) -> Result<(), fidl::Error> {
3381 let _result = self.send_raw(result);
3382 if _result.is_err() {
3383 self.control_handle.shutdown();
3384 }
3385 self.drop_without_shutdown();
3386 _result
3387 }
3388
3389 pub fn send_no_shutdown_on_err(self, mut result: Result<(), i32>) -> Result<(), fidl::Error> {
3391 let _result = self.send_raw(result);
3392 self.drop_without_shutdown();
3393 _result
3394 }
3395
3396 fn send_raw(&self, mut result: Result<(), i32>) -> Result<(), fidl::Error> {
3397 self.control_handle
3398 .inner
3399 .send::<fidl::encoding::ResultType<fidl::encoding::EmptyStruct, i32>>(
3400 result,
3401 self.tx_id,
3402 0x83f311ecaf0ddf3,
3403 fidl::encoding::DynamicFlags::empty(),
3404 )
3405 }
3406}
3407
3408#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
3409pub struct PairingMarker;
3410
3411impl fidl::endpoints::ProtocolMarker for PairingMarker {
3412 type Proxy = PairingProxy;
3413 type RequestStream = PairingRequestStream;
3414 #[cfg(target_os = "fuchsia")]
3415 type SynchronousProxy = PairingSynchronousProxy;
3416
3417 const DEBUG_NAME: &'static str = "fuchsia.bluetooth.sys.Pairing";
3418}
3419impl fidl::endpoints::DiscoverableProtocolMarker for PairingMarker {}
3420
3421pub trait PairingProxyInterface: Send + Sync {
3422 fn r#set_pairing_delegate(
3423 &self,
3424 input: InputCapability,
3425 output: OutputCapability,
3426 delegate: fidl::endpoints::ClientEnd<PairingDelegateMarker>,
3427 ) -> Result<(), fidl::Error>;
3428 fn r#set_delegate(
3429 &self,
3430 input: InputCapability,
3431 output: OutputCapability,
3432 delegate: fidl::endpoints::ClientEnd<PairingDelegate2Marker>,
3433 ) -> Result<(), fidl::Error>;
3434}
3435#[derive(Debug)]
3436#[cfg(target_os = "fuchsia")]
3437pub struct PairingSynchronousProxy {
3438 client: fidl::client::sync::Client,
3439}
3440
3441#[cfg(target_os = "fuchsia")]
3442impl fidl::endpoints::SynchronousProxy for PairingSynchronousProxy {
3443 type Proxy = PairingProxy;
3444 type Protocol = PairingMarker;
3445
3446 fn from_channel(inner: fidl::Channel) -> Self {
3447 Self::new(inner)
3448 }
3449
3450 fn into_channel(self) -> fidl::Channel {
3451 self.client.into_channel()
3452 }
3453
3454 fn as_channel(&self) -> &fidl::Channel {
3455 self.client.as_channel()
3456 }
3457}
3458
3459#[cfg(target_os = "fuchsia")]
3460impl PairingSynchronousProxy {
3461 pub fn new(channel: fidl::Channel) -> Self {
3462 let protocol_name = <PairingMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
3463 Self { client: fidl::client::sync::Client::new(channel, protocol_name) }
3464 }
3465
3466 pub fn into_channel(self) -> fidl::Channel {
3467 self.client.into_channel()
3468 }
3469
3470 pub fn wait_for_event(
3473 &self,
3474 deadline: zx::MonotonicInstant,
3475 ) -> Result<PairingEvent, fidl::Error> {
3476 PairingEvent::decode(self.client.wait_for_event(deadline)?)
3477 }
3478
3479 pub fn r#set_pairing_delegate(
3494 &self,
3495 mut input: InputCapability,
3496 mut output: OutputCapability,
3497 mut delegate: fidl::endpoints::ClientEnd<PairingDelegateMarker>,
3498 ) -> Result<(), fidl::Error> {
3499 self.client.send::<PairingSetPairingDelegateRequest>(
3500 (input, output, delegate),
3501 0x19721a12cb80212c,
3502 fidl::encoding::DynamicFlags::empty(),
3503 )
3504 }
3505
3506 pub fn r#set_delegate(
3524 &self,
3525 mut input: InputCapability,
3526 mut output: OutputCapability,
3527 mut delegate: fidl::endpoints::ClientEnd<PairingDelegate2Marker>,
3528 ) -> Result<(), fidl::Error> {
3529 self.client.send::<PairingSetDelegateRequest>(
3530 (input, output, delegate),
3531 0x1da0568d2582a9a5,
3532 fidl::encoding::DynamicFlags::empty(),
3533 )
3534 }
3535}
3536
3537#[derive(Debug, Clone)]
3538pub struct PairingProxy {
3539 client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
3540}
3541
3542impl fidl::endpoints::Proxy for PairingProxy {
3543 type Protocol = PairingMarker;
3544
3545 fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
3546 Self::new(inner)
3547 }
3548
3549 fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
3550 self.client.into_channel().map_err(|client| Self { client })
3551 }
3552
3553 fn as_channel(&self) -> &::fidl::AsyncChannel {
3554 self.client.as_channel()
3555 }
3556}
3557
3558impl PairingProxy {
3559 pub fn new(channel: ::fidl::AsyncChannel) -> Self {
3561 let protocol_name = <PairingMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
3562 Self { client: fidl::client::Client::new(channel, protocol_name) }
3563 }
3564
3565 pub fn take_event_stream(&self) -> PairingEventStream {
3571 PairingEventStream { event_receiver: self.client.take_event_receiver() }
3572 }
3573
3574 pub fn r#set_pairing_delegate(
3589 &self,
3590 mut input: InputCapability,
3591 mut output: OutputCapability,
3592 mut delegate: fidl::endpoints::ClientEnd<PairingDelegateMarker>,
3593 ) -> Result<(), fidl::Error> {
3594 PairingProxyInterface::r#set_pairing_delegate(self, input, output, delegate)
3595 }
3596
3597 pub fn r#set_delegate(
3615 &self,
3616 mut input: InputCapability,
3617 mut output: OutputCapability,
3618 mut delegate: fidl::endpoints::ClientEnd<PairingDelegate2Marker>,
3619 ) -> Result<(), fidl::Error> {
3620 PairingProxyInterface::r#set_delegate(self, input, output, delegate)
3621 }
3622}
3623
3624impl PairingProxyInterface for PairingProxy {
3625 fn r#set_pairing_delegate(
3626 &self,
3627 mut input: InputCapability,
3628 mut output: OutputCapability,
3629 mut delegate: fidl::endpoints::ClientEnd<PairingDelegateMarker>,
3630 ) -> Result<(), fidl::Error> {
3631 self.client.send::<PairingSetPairingDelegateRequest>(
3632 (input, output, delegate),
3633 0x19721a12cb80212c,
3634 fidl::encoding::DynamicFlags::empty(),
3635 )
3636 }
3637
3638 fn r#set_delegate(
3639 &self,
3640 mut input: InputCapability,
3641 mut output: OutputCapability,
3642 mut delegate: fidl::endpoints::ClientEnd<PairingDelegate2Marker>,
3643 ) -> Result<(), fidl::Error> {
3644 self.client.send::<PairingSetDelegateRequest>(
3645 (input, output, delegate),
3646 0x1da0568d2582a9a5,
3647 fidl::encoding::DynamicFlags::empty(),
3648 )
3649 }
3650}
3651
3652pub struct PairingEventStream {
3653 event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
3654}
3655
3656impl std::marker::Unpin for PairingEventStream {}
3657
3658impl futures::stream::FusedStream for PairingEventStream {
3659 fn is_terminated(&self) -> bool {
3660 self.event_receiver.is_terminated()
3661 }
3662}
3663
3664impl futures::Stream for PairingEventStream {
3665 type Item = Result<PairingEvent, fidl::Error>;
3666
3667 fn poll_next(
3668 mut self: std::pin::Pin<&mut Self>,
3669 cx: &mut std::task::Context<'_>,
3670 ) -> std::task::Poll<Option<Self::Item>> {
3671 match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
3672 &mut self.event_receiver,
3673 cx
3674 )?) {
3675 Some(buf) => std::task::Poll::Ready(Some(PairingEvent::decode(buf))),
3676 None => std::task::Poll::Ready(None),
3677 }
3678 }
3679}
3680
3681#[derive(Debug)]
3682pub enum PairingEvent {}
3683
3684impl PairingEvent {
3685 fn decode(
3687 mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
3688 ) -> Result<PairingEvent, fidl::Error> {
3689 let (bytes, _handles) = buf.split_mut();
3690 let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
3691 debug_assert_eq!(tx_header.tx_id, 0);
3692 match tx_header.ordinal {
3693 _ => Err(fidl::Error::UnknownOrdinal {
3694 ordinal: tx_header.ordinal,
3695 protocol_name: <PairingMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
3696 }),
3697 }
3698 }
3699}
3700
3701pub struct PairingRequestStream {
3703 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
3704 is_terminated: bool,
3705}
3706
3707impl std::marker::Unpin for PairingRequestStream {}
3708
3709impl futures::stream::FusedStream for PairingRequestStream {
3710 fn is_terminated(&self) -> bool {
3711 self.is_terminated
3712 }
3713}
3714
3715impl fidl::endpoints::RequestStream for PairingRequestStream {
3716 type Protocol = PairingMarker;
3717 type ControlHandle = PairingControlHandle;
3718
3719 fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
3720 Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
3721 }
3722
3723 fn control_handle(&self) -> Self::ControlHandle {
3724 PairingControlHandle { inner: self.inner.clone() }
3725 }
3726
3727 fn into_inner(
3728 self,
3729 ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
3730 {
3731 (self.inner, self.is_terminated)
3732 }
3733
3734 fn from_inner(
3735 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
3736 is_terminated: bool,
3737 ) -> Self {
3738 Self { inner, is_terminated }
3739 }
3740}
3741
3742impl futures::Stream for PairingRequestStream {
3743 type Item = Result<PairingRequest, fidl::Error>;
3744
3745 fn poll_next(
3746 mut self: std::pin::Pin<&mut Self>,
3747 cx: &mut std::task::Context<'_>,
3748 ) -> std::task::Poll<Option<Self::Item>> {
3749 let this = &mut *self;
3750 if this.inner.check_shutdown(cx) {
3751 this.is_terminated = true;
3752 return std::task::Poll::Ready(None);
3753 }
3754 if this.is_terminated {
3755 panic!("polled PairingRequestStream after completion");
3756 }
3757 fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
3758 |bytes, handles| {
3759 match this.inner.channel().read_etc(cx, bytes, handles) {
3760 std::task::Poll::Ready(Ok(())) => {}
3761 std::task::Poll::Pending => return std::task::Poll::Pending,
3762 std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
3763 this.is_terminated = true;
3764 return std::task::Poll::Ready(None);
3765 }
3766 std::task::Poll::Ready(Err(e)) => {
3767 return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
3768 e.into(),
3769 ))))
3770 }
3771 }
3772
3773 let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
3775
3776 std::task::Poll::Ready(Some(match header.ordinal {
3777 0x19721a12cb80212c => {
3778 header.validate_request_tx_id(fidl::MethodType::OneWay)?;
3779 let mut req = fidl::new_empty!(
3780 PairingSetPairingDelegateRequest,
3781 fidl::encoding::DefaultFuchsiaResourceDialect
3782 );
3783 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<PairingSetPairingDelegateRequest>(&header, _body_bytes, handles, &mut req)?;
3784 let control_handle = PairingControlHandle { inner: this.inner.clone() };
3785 Ok(PairingRequest::SetPairingDelegate {
3786 input: req.input,
3787 output: req.output,
3788 delegate: req.delegate,
3789
3790 control_handle,
3791 })
3792 }
3793 0x1da0568d2582a9a5 => {
3794 header.validate_request_tx_id(fidl::MethodType::OneWay)?;
3795 let mut req = fidl::new_empty!(
3796 PairingSetDelegateRequest,
3797 fidl::encoding::DefaultFuchsiaResourceDialect
3798 );
3799 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<PairingSetDelegateRequest>(&header, _body_bytes, handles, &mut req)?;
3800 let control_handle = PairingControlHandle { inner: this.inner.clone() };
3801 Ok(PairingRequest::SetDelegate {
3802 input: req.input,
3803 output: req.output,
3804 delegate: req.delegate,
3805
3806 control_handle,
3807 })
3808 }
3809 _ => Err(fidl::Error::UnknownOrdinal {
3810 ordinal: header.ordinal,
3811 protocol_name:
3812 <PairingMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
3813 }),
3814 }))
3815 },
3816 )
3817 }
3818}
3819
3820#[derive(Debug)]
3822pub enum PairingRequest {
3823 SetPairingDelegate {
3838 input: InputCapability,
3839 output: OutputCapability,
3840 delegate: fidl::endpoints::ClientEnd<PairingDelegateMarker>,
3841 control_handle: PairingControlHandle,
3842 },
3843 SetDelegate {
3861 input: InputCapability,
3862 output: OutputCapability,
3863 delegate: fidl::endpoints::ClientEnd<PairingDelegate2Marker>,
3864 control_handle: PairingControlHandle,
3865 },
3866}
3867
3868impl PairingRequest {
3869 #[allow(irrefutable_let_patterns)]
3870 pub fn into_set_pairing_delegate(
3871 self,
3872 ) -> Option<(
3873 InputCapability,
3874 OutputCapability,
3875 fidl::endpoints::ClientEnd<PairingDelegateMarker>,
3876 PairingControlHandle,
3877 )> {
3878 if let PairingRequest::SetPairingDelegate { input, output, delegate, control_handle } = self
3879 {
3880 Some((input, output, delegate, control_handle))
3881 } else {
3882 None
3883 }
3884 }
3885
3886 #[allow(irrefutable_let_patterns)]
3887 pub fn into_set_delegate(
3888 self,
3889 ) -> Option<(
3890 InputCapability,
3891 OutputCapability,
3892 fidl::endpoints::ClientEnd<PairingDelegate2Marker>,
3893 PairingControlHandle,
3894 )> {
3895 if let PairingRequest::SetDelegate { input, output, delegate, control_handle } = self {
3896 Some((input, output, delegate, control_handle))
3897 } else {
3898 None
3899 }
3900 }
3901
3902 pub fn method_name(&self) -> &'static str {
3904 match *self {
3905 PairingRequest::SetPairingDelegate { .. } => "set_pairing_delegate",
3906 PairingRequest::SetDelegate { .. } => "set_delegate",
3907 }
3908 }
3909}
3910
3911#[derive(Debug, Clone)]
3912pub struct PairingControlHandle {
3913 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
3914}
3915
3916impl fidl::endpoints::ControlHandle for PairingControlHandle {
3917 fn shutdown(&self) {
3918 self.inner.shutdown()
3919 }
3920 fn shutdown_with_epitaph(&self, status: zx_status::Status) {
3921 self.inner.shutdown_with_epitaph(status)
3922 }
3923
3924 fn is_closed(&self) -> bool {
3925 self.inner.channel().is_closed()
3926 }
3927 fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
3928 self.inner.channel().on_closed()
3929 }
3930
3931 #[cfg(target_os = "fuchsia")]
3932 fn signal_peer(
3933 &self,
3934 clear_mask: zx::Signals,
3935 set_mask: zx::Signals,
3936 ) -> Result<(), zx_status::Status> {
3937 use fidl::Peered;
3938 self.inner.channel().signal_peer(clear_mask, set_mask)
3939 }
3940}
3941
3942impl PairingControlHandle {}
3943
3944#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
3945pub struct PairingDelegateMarker;
3946
3947impl fidl::endpoints::ProtocolMarker for PairingDelegateMarker {
3948 type Proxy = PairingDelegateProxy;
3949 type RequestStream = PairingDelegateRequestStream;
3950 #[cfg(target_os = "fuchsia")]
3951 type SynchronousProxy = PairingDelegateSynchronousProxy;
3952
3953 const DEBUG_NAME: &'static str = "(anonymous) PairingDelegate";
3954}
3955
3956pub trait PairingDelegateProxyInterface: Send + Sync {
3957 type OnPairingRequestResponseFut: std::future::Future<Output = Result<(bool, u32), fidl::Error>>
3958 + Send;
3959 fn r#on_pairing_request(
3960 &self,
3961 peer: &Peer,
3962 method: PairingMethod,
3963 displayed_passkey: u32,
3964 ) -> Self::OnPairingRequestResponseFut;
3965 fn r#on_pairing_complete(
3966 &self,
3967 id: &fidl_fuchsia_bluetooth::PeerId,
3968 success: bool,
3969 ) -> Result<(), fidl::Error>;
3970 fn r#on_remote_keypress(
3971 &self,
3972 id: &fidl_fuchsia_bluetooth::PeerId,
3973 keypress: PairingKeypress,
3974 ) -> Result<(), fidl::Error>;
3975}
3976#[derive(Debug)]
3977#[cfg(target_os = "fuchsia")]
3978pub struct PairingDelegateSynchronousProxy {
3979 client: fidl::client::sync::Client,
3980}
3981
3982#[cfg(target_os = "fuchsia")]
3983impl fidl::endpoints::SynchronousProxy for PairingDelegateSynchronousProxy {
3984 type Proxy = PairingDelegateProxy;
3985 type Protocol = PairingDelegateMarker;
3986
3987 fn from_channel(inner: fidl::Channel) -> Self {
3988 Self::new(inner)
3989 }
3990
3991 fn into_channel(self) -> fidl::Channel {
3992 self.client.into_channel()
3993 }
3994
3995 fn as_channel(&self) -> &fidl::Channel {
3996 self.client.as_channel()
3997 }
3998}
3999
4000#[cfg(target_os = "fuchsia")]
4001impl PairingDelegateSynchronousProxy {
4002 pub fn new(channel: fidl::Channel) -> Self {
4003 let protocol_name = <PairingDelegateMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
4004 Self { client: fidl::client::sync::Client::new(channel, protocol_name) }
4005 }
4006
4007 pub fn into_channel(self) -> fidl::Channel {
4008 self.client.into_channel()
4009 }
4010
4011 pub fn wait_for_event(
4014 &self,
4015 deadline: zx::MonotonicInstant,
4016 ) -> Result<PairingDelegateEvent, fidl::Error> {
4017 PairingDelegateEvent::decode(self.client.wait_for_event(deadline)?)
4018 }
4019
4020 pub fn r#on_pairing_request(
4039 &self,
4040 mut peer: &Peer,
4041 mut method: PairingMethod,
4042 mut displayed_passkey: u32,
4043 ___deadline: zx::MonotonicInstant,
4044 ) -> Result<(bool, u32), fidl::Error> {
4045 let _response = self.client.send_query::<
4046 PairingDelegateOnPairingRequestRequest,
4047 PairingDelegateOnPairingRequestResponse,
4048 >(
4049 (peer, method, displayed_passkey,),
4050 0x5c483a8f97b226b3,
4051 fidl::encoding::DynamicFlags::empty(),
4052 ___deadline,
4053 )?;
4054 Ok((_response.accept, _response.entered_passkey))
4055 }
4056
4057 pub fn r#on_pairing_complete(
4063 &self,
4064 mut id: &fidl_fuchsia_bluetooth::PeerId,
4065 mut success: bool,
4066 ) -> Result<(), fidl::Error> {
4067 self.client.send::<PairingDelegateOnPairingCompleteRequest>(
4068 (id, success),
4069 0x5ad8fc9864eba757,
4070 fidl::encoding::DynamicFlags::empty(),
4071 )
4072 }
4073
4074 pub fn r#on_remote_keypress(
4088 &self,
4089 mut id: &fidl_fuchsia_bluetooth::PeerId,
4090 mut keypress: PairingKeypress,
4091 ) -> Result<(), fidl::Error> {
4092 self.client.send::<PairingDelegateOnRemoteKeypressRequest>(
4093 (id, keypress),
4094 0x4e341e41c604c724,
4095 fidl::encoding::DynamicFlags::empty(),
4096 )
4097 }
4098}
4099
4100#[derive(Debug, Clone)]
4101pub struct PairingDelegateProxy {
4102 client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
4103}
4104
4105impl fidl::endpoints::Proxy for PairingDelegateProxy {
4106 type Protocol = PairingDelegateMarker;
4107
4108 fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
4109 Self::new(inner)
4110 }
4111
4112 fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
4113 self.client.into_channel().map_err(|client| Self { client })
4114 }
4115
4116 fn as_channel(&self) -> &::fidl::AsyncChannel {
4117 self.client.as_channel()
4118 }
4119}
4120
4121impl PairingDelegateProxy {
4122 pub fn new(channel: ::fidl::AsyncChannel) -> Self {
4124 let protocol_name = <PairingDelegateMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
4125 Self { client: fidl::client::Client::new(channel, protocol_name) }
4126 }
4127
4128 pub fn take_event_stream(&self) -> PairingDelegateEventStream {
4134 PairingDelegateEventStream { event_receiver: self.client.take_event_receiver() }
4135 }
4136
4137 pub fn r#on_pairing_request(
4156 &self,
4157 mut peer: &Peer,
4158 mut method: PairingMethod,
4159 mut displayed_passkey: u32,
4160 ) -> fidl::client::QueryResponseFut<(bool, u32), fidl::encoding::DefaultFuchsiaResourceDialect>
4161 {
4162 PairingDelegateProxyInterface::r#on_pairing_request(self, peer, method, displayed_passkey)
4163 }
4164
4165 pub fn r#on_pairing_complete(
4171 &self,
4172 mut id: &fidl_fuchsia_bluetooth::PeerId,
4173 mut success: bool,
4174 ) -> Result<(), fidl::Error> {
4175 PairingDelegateProxyInterface::r#on_pairing_complete(self, id, success)
4176 }
4177
4178 pub fn r#on_remote_keypress(
4192 &self,
4193 mut id: &fidl_fuchsia_bluetooth::PeerId,
4194 mut keypress: PairingKeypress,
4195 ) -> Result<(), fidl::Error> {
4196 PairingDelegateProxyInterface::r#on_remote_keypress(self, id, keypress)
4197 }
4198}
4199
4200impl PairingDelegateProxyInterface for PairingDelegateProxy {
4201 type OnPairingRequestResponseFut =
4202 fidl::client::QueryResponseFut<(bool, u32), fidl::encoding::DefaultFuchsiaResourceDialect>;
4203 fn r#on_pairing_request(
4204 &self,
4205 mut peer: &Peer,
4206 mut method: PairingMethod,
4207 mut displayed_passkey: u32,
4208 ) -> Self::OnPairingRequestResponseFut {
4209 fn _decode(
4210 mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
4211 ) -> Result<(bool, u32), fidl::Error> {
4212 let _response = fidl::client::decode_transaction_body::<
4213 PairingDelegateOnPairingRequestResponse,
4214 fidl::encoding::DefaultFuchsiaResourceDialect,
4215 0x5c483a8f97b226b3,
4216 >(_buf?)?;
4217 Ok((_response.accept, _response.entered_passkey))
4218 }
4219 self.client.send_query_and_decode::<PairingDelegateOnPairingRequestRequest, (bool, u32)>(
4220 (peer, method, displayed_passkey),
4221 0x5c483a8f97b226b3,
4222 fidl::encoding::DynamicFlags::empty(),
4223 _decode,
4224 )
4225 }
4226
4227 fn r#on_pairing_complete(
4228 &self,
4229 mut id: &fidl_fuchsia_bluetooth::PeerId,
4230 mut success: bool,
4231 ) -> Result<(), fidl::Error> {
4232 self.client.send::<PairingDelegateOnPairingCompleteRequest>(
4233 (id, success),
4234 0x5ad8fc9864eba757,
4235 fidl::encoding::DynamicFlags::empty(),
4236 )
4237 }
4238
4239 fn r#on_remote_keypress(
4240 &self,
4241 mut id: &fidl_fuchsia_bluetooth::PeerId,
4242 mut keypress: PairingKeypress,
4243 ) -> Result<(), fidl::Error> {
4244 self.client.send::<PairingDelegateOnRemoteKeypressRequest>(
4245 (id, keypress),
4246 0x4e341e41c604c724,
4247 fidl::encoding::DynamicFlags::empty(),
4248 )
4249 }
4250}
4251
4252pub struct PairingDelegateEventStream {
4253 event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
4254}
4255
4256impl std::marker::Unpin for PairingDelegateEventStream {}
4257
4258impl futures::stream::FusedStream for PairingDelegateEventStream {
4259 fn is_terminated(&self) -> bool {
4260 self.event_receiver.is_terminated()
4261 }
4262}
4263
4264impl futures::Stream for PairingDelegateEventStream {
4265 type Item = Result<PairingDelegateEvent, fidl::Error>;
4266
4267 fn poll_next(
4268 mut self: std::pin::Pin<&mut Self>,
4269 cx: &mut std::task::Context<'_>,
4270 ) -> std::task::Poll<Option<Self::Item>> {
4271 match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
4272 &mut self.event_receiver,
4273 cx
4274 )?) {
4275 Some(buf) => std::task::Poll::Ready(Some(PairingDelegateEvent::decode(buf))),
4276 None => std::task::Poll::Ready(None),
4277 }
4278 }
4279}
4280
4281#[derive(Debug)]
4282pub enum PairingDelegateEvent {
4283 OnLocalKeypress { id: fidl_fuchsia_bluetooth::PeerId, keypress: PairingKeypress },
4284}
4285
4286impl PairingDelegateEvent {
4287 #[allow(irrefutable_let_patterns)]
4288 pub fn into_on_local_keypress(
4289 self,
4290 ) -> Option<(fidl_fuchsia_bluetooth::PeerId, PairingKeypress)> {
4291 if let PairingDelegateEvent::OnLocalKeypress { id, keypress } = self {
4292 Some((id, keypress))
4293 } else {
4294 None
4295 }
4296 }
4297
4298 fn decode(
4300 mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
4301 ) -> Result<PairingDelegateEvent, fidl::Error> {
4302 let (bytes, _handles) = buf.split_mut();
4303 let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
4304 debug_assert_eq!(tx_header.tx_id, 0);
4305 match tx_header.ordinal {
4306 0x1a764c0428878889 => {
4307 let mut out = fidl::new_empty!(
4308 PairingDelegateOnLocalKeypressRequest,
4309 fidl::encoding::DefaultFuchsiaResourceDialect
4310 );
4311 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<PairingDelegateOnLocalKeypressRequest>(&tx_header, _body_bytes, _handles, &mut out)?;
4312 Ok((PairingDelegateEvent::OnLocalKeypress { id: out.id, keypress: out.keypress }))
4313 }
4314 _ => Err(fidl::Error::UnknownOrdinal {
4315 ordinal: tx_header.ordinal,
4316 protocol_name:
4317 <PairingDelegateMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
4318 }),
4319 }
4320 }
4321}
4322
4323pub struct PairingDelegateRequestStream {
4325 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
4326 is_terminated: bool,
4327}
4328
4329impl std::marker::Unpin for PairingDelegateRequestStream {}
4330
4331impl futures::stream::FusedStream for PairingDelegateRequestStream {
4332 fn is_terminated(&self) -> bool {
4333 self.is_terminated
4334 }
4335}
4336
4337impl fidl::endpoints::RequestStream for PairingDelegateRequestStream {
4338 type Protocol = PairingDelegateMarker;
4339 type ControlHandle = PairingDelegateControlHandle;
4340
4341 fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
4342 Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
4343 }
4344
4345 fn control_handle(&self) -> Self::ControlHandle {
4346 PairingDelegateControlHandle { inner: self.inner.clone() }
4347 }
4348
4349 fn into_inner(
4350 self,
4351 ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
4352 {
4353 (self.inner, self.is_terminated)
4354 }
4355
4356 fn from_inner(
4357 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
4358 is_terminated: bool,
4359 ) -> Self {
4360 Self { inner, is_terminated }
4361 }
4362}
4363
4364impl futures::Stream for PairingDelegateRequestStream {
4365 type Item = Result<PairingDelegateRequest, fidl::Error>;
4366
4367 fn poll_next(
4368 mut self: std::pin::Pin<&mut Self>,
4369 cx: &mut std::task::Context<'_>,
4370 ) -> std::task::Poll<Option<Self::Item>> {
4371 let this = &mut *self;
4372 if this.inner.check_shutdown(cx) {
4373 this.is_terminated = true;
4374 return std::task::Poll::Ready(None);
4375 }
4376 if this.is_terminated {
4377 panic!("polled PairingDelegateRequestStream after completion");
4378 }
4379 fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
4380 |bytes, handles| {
4381 match this.inner.channel().read_etc(cx, bytes, handles) {
4382 std::task::Poll::Ready(Ok(())) => {}
4383 std::task::Poll::Pending => return std::task::Poll::Pending,
4384 std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
4385 this.is_terminated = true;
4386 return std::task::Poll::Ready(None);
4387 }
4388 std::task::Poll::Ready(Err(e)) => {
4389 return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
4390 e.into(),
4391 ))))
4392 }
4393 }
4394
4395 let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
4397
4398 std::task::Poll::Ready(Some(match header.ordinal {
4399 0x5c483a8f97b226b3 => {
4400 header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
4401 let mut req = fidl::new_empty!(
4402 PairingDelegateOnPairingRequestRequest,
4403 fidl::encoding::DefaultFuchsiaResourceDialect
4404 );
4405 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<PairingDelegateOnPairingRequestRequest>(&header, _body_bytes, handles, &mut req)?;
4406 let control_handle =
4407 PairingDelegateControlHandle { inner: this.inner.clone() };
4408 Ok(PairingDelegateRequest::OnPairingRequest {
4409 peer: req.peer,
4410 method: req.method,
4411 displayed_passkey: req.displayed_passkey,
4412
4413 responder: PairingDelegateOnPairingRequestResponder {
4414 control_handle: std::mem::ManuallyDrop::new(control_handle),
4415 tx_id: header.tx_id,
4416 },
4417 })
4418 }
4419 0x5ad8fc9864eba757 => {
4420 header.validate_request_tx_id(fidl::MethodType::OneWay)?;
4421 let mut req = fidl::new_empty!(
4422 PairingDelegateOnPairingCompleteRequest,
4423 fidl::encoding::DefaultFuchsiaResourceDialect
4424 );
4425 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<PairingDelegateOnPairingCompleteRequest>(&header, _body_bytes, handles, &mut req)?;
4426 let control_handle =
4427 PairingDelegateControlHandle { inner: this.inner.clone() };
4428 Ok(PairingDelegateRequest::OnPairingComplete {
4429 id: req.id,
4430 success: req.success,
4431
4432 control_handle,
4433 })
4434 }
4435 0x4e341e41c604c724 => {
4436 header.validate_request_tx_id(fidl::MethodType::OneWay)?;
4437 let mut req = fidl::new_empty!(
4438 PairingDelegateOnRemoteKeypressRequest,
4439 fidl::encoding::DefaultFuchsiaResourceDialect
4440 );
4441 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<PairingDelegateOnRemoteKeypressRequest>(&header, _body_bytes, handles, &mut req)?;
4442 let control_handle =
4443 PairingDelegateControlHandle { inner: this.inner.clone() };
4444 Ok(PairingDelegateRequest::OnRemoteKeypress {
4445 id: req.id,
4446 keypress: req.keypress,
4447
4448 control_handle,
4449 })
4450 }
4451 _ => Err(fidl::Error::UnknownOrdinal {
4452 ordinal: header.ordinal,
4453 protocol_name:
4454 <PairingDelegateMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
4455 }),
4456 }))
4457 },
4458 )
4459 }
4460}
4461
4462#[derive(Debug)]
4474pub enum PairingDelegateRequest {
4475 OnPairingRequest {
4494 peer: Peer,
4495 method: PairingMethod,
4496 displayed_passkey: u32,
4497 responder: PairingDelegateOnPairingRequestResponder,
4498 },
4499 OnPairingComplete {
4505 id: fidl_fuchsia_bluetooth::PeerId,
4506 success: bool,
4507 control_handle: PairingDelegateControlHandle,
4508 },
4509 OnRemoteKeypress {
4523 id: fidl_fuchsia_bluetooth::PeerId,
4524 keypress: PairingKeypress,
4525 control_handle: PairingDelegateControlHandle,
4526 },
4527}
4528
4529impl PairingDelegateRequest {
4530 #[allow(irrefutable_let_patterns)]
4531 pub fn into_on_pairing_request(
4532 self,
4533 ) -> Option<(Peer, PairingMethod, u32, PairingDelegateOnPairingRequestResponder)> {
4534 if let PairingDelegateRequest::OnPairingRequest {
4535 peer,
4536 method,
4537 displayed_passkey,
4538 responder,
4539 } = self
4540 {
4541 Some((peer, method, displayed_passkey, responder))
4542 } else {
4543 None
4544 }
4545 }
4546
4547 #[allow(irrefutable_let_patterns)]
4548 pub fn into_on_pairing_complete(
4549 self,
4550 ) -> Option<(fidl_fuchsia_bluetooth::PeerId, bool, PairingDelegateControlHandle)> {
4551 if let PairingDelegateRequest::OnPairingComplete { id, success, control_handle } = self {
4552 Some((id, success, control_handle))
4553 } else {
4554 None
4555 }
4556 }
4557
4558 #[allow(irrefutable_let_patterns)]
4559 pub fn into_on_remote_keypress(
4560 self,
4561 ) -> Option<(fidl_fuchsia_bluetooth::PeerId, PairingKeypress, PairingDelegateControlHandle)>
4562 {
4563 if let PairingDelegateRequest::OnRemoteKeypress { id, keypress, control_handle } = self {
4564 Some((id, keypress, control_handle))
4565 } else {
4566 None
4567 }
4568 }
4569
4570 pub fn method_name(&self) -> &'static str {
4572 match *self {
4573 PairingDelegateRequest::OnPairingRequest { .. } => "on_pairing_request",
4574 PairingDelegateRequest::OnPairingComplete { .. } => "on_pairing_complete",
4575 PairingDelegateRequest::OnRemoteKeypress { .. } => "on_remote_keypress",
4576 }
4577 }
4578}
4579
4580#[derive(Debug, Clone)]
4581pub struct PairingDelegateControlHandle {
4582 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
4583}
4584
4585impl fidl::endpoints::ControlHandle for PairingDelegateControlHandle {
4586 fn shutdown(&self) {
4587 self.inner.shutdown()
4588 }
4589 fn shutdown_with_epitaph(&self, status: zx_status::Status) {
4590 self.inner.shutdown_with_epitaph(status)
4591 }
4592
4593 fn is_closed(&self) -> bool {
4594 self.inner.channel().is_closed()
4595 }
4596 fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
4597 self.inner.channel().on_closed()
4598 }
4599
4600 #[cfg(target_os = "fuchsia")]
4601 fn signal_peer(
4602 &self,
4603 clear_mask: zx::Signals,
4604 set_mask: zx::Signals,
4605 ) -> Result<(), zx_status::Status> {
4606 use fidl::Peered;
4607 self.inner.channel().signal_peer(clear_mask, set_mask)
4608 }
4609}
4610
4611impl PairingDelegateControlHandle {
4612 pub fn send_on_local_keypress(
4613 &self,
4614 mut id: &fidl_fuchsia_bluetooth::PeerId,
4615 mut keypress: PairingKeypress,
4616 ) -> Result<(), fidl::Error> {
4617 self.inner.send::<PairingDelegateOnLocalKeypressRequest>(
4618 (id, keypress),
4619 0,
4620 0x1a764c0428878889,
4621 fidl::encoding::DynamicFlags::empty(),
4622 )
4623 }
4624}
4625
4626#[must_use = "FIDL methods require a response to be sent"]
4627#[derive(Debug)]
4628pub struct PairingDelegateOnPairingRequestResponder {
4629 control_handle: std::mem::ManuallyDrop<PairingDelegateControlHandle>,
4630 tx_id: u32,
4631}
4632
4633impl std::ops::Drop for PairingDelegateOnPairingRequestResponder {
4637 fn drop(&mut self) {
4638 self.control_handle.shutdown();
4639 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
4641 }
4642}
4643
4644impl fidl::endpoints::Responder for PairingDelegateOnPairingRequestResponder {
4645 type ControlHandle = PairingDelegateControlHandle;
4646
4647 fn control_handle(&self) -> &PairingDelegateControlHandle {
4648 &self.control_handle
4649 }
4650
4651 fn drop_without_shutdown(mut self) {
4652 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
4654 std::mem::forget(self);
4656 }
4657}
4658
4659impl PairingDelegateOnPairingRequestResponder {
4660 pub fn send(self, mut accept: bool, mut entered_passkey: u32) -> Result<(), fidl::Error> {
4664 let _result = self.send_raw(accept, entered_passkey);
4665 if _result.is_err() {
4666 self.control_handle.shutdown();
4667 }
4668 self.drop_without_shutdown();
4669 _result
4670 }
4671
4672 pub fn send_no_shutdown_on_err(
4674 self,
4675 mut accept: bool,
4676 mut entered_passkey: u32,
4677 ) -> Result<(), fidl::Error> {
4678 let _result = self.send_raw(accept, entered_passkey);
4679 self.drop_without_shutdown();
4680 _result
4681 }
4682
4683 fn send_raw(&self, mut accept: bool, mut entered_passkey: u32) -> Result<(), fidl::Error> {
4684 self.control_handle.inner.send::<PairingDelegateOnPairingRequestResponse>(
4685 (accept, entered_passkey),
4686 self.tx_id,
4687 0x5c483a8f97b226b3,
4688 fidl::encoding::DynamicFlags::empty(),
4689 )
4690 }
4691}
4692
4693#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
4694pub struct PairingDelegate2Marker;
4695
4696impl fidl::endpoints::ProtocolMarker for PairingDelegate2Marker {
4697 type Proxy = PairingDelegate2Proxy;
4698 type RequestStream = PairingDelegate2RequestStream;
4699 #[cfg(target_os = "fuchsia")]
4700 type SynchronousProxy = PairingDelegate2SynchronousProxy;
4701
4702 const DEBUG_NAME: &'static str = "(anonymous) PairingDelegate2";
4703}
4704
4705pub trait PairingDelegate2ProxyInterface: Send + Sync {
4706 fn r#start_request(
4707 &self,
4708 payload: PairingDelegate2StartRequestRequest,
4709 ) -> Result<(), fidl::Error>;
4710 fn r#request_complete(
4711 &self,
4712 id: &fidl_fuchsia_bluetooth::PeerId,
4713 success: bool,
4714 ) -> Result<(), fidl::Error>;
4715}
4716#[derive(Debug)]
4717#[cfg(target_os = "fuchsia")]
4718pub struct PairingDelegate2SynchronousProxy {
4719 client: fidl::client::sync::Client,
4720}
4721
4722#[cfg(target_os = "fuchsia")]
4723impl fidl::endpoints::SynchronousProxy for PairingDelegate2SynchronousProxy {
4724 type Proxy = PairingDelegate2Proxy;
4725 type Protocol = PairingDelegate2Marker;
4726
4727 fn from_channel(inner: fidl::Channel) -> Self {
4728 Self::new(inner)
4729 }
4730
4731 fn into_channel(self) -> fidl::Channel {
4732 self.client.into_channel()
4733 }
4734
4735 fn as_channel(&self) -> &fidl::Channel {
4736 self.client.as_channel()
4737 }
4738}
4739
4740#[cfg(target_os = "fuchsia")]
4741impl PairingDelegate2SynchronousProxy {
4742 pub fn new(channel: fidl::Channel) -> Self {
4743 let protocol_name = <PairingDelegate2Marker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
4744 Self { client: fidl::client::sync::Client::new(channel, protocol_name) }
4745 }
4746
4747 pub fn into_channel(self) -> fidl::Channel {
4748 self.client.into_channel()
4749 }
4750
4751 pub fn wait_for_event(
4754 &self,
4755 deadline: zx::MonotonicInstant,
4756 ) -> Result<PairingDelegate2Event, fidl::Error> {
4757 PairingDelegate2Event::decode(self.client.wait_for_event(deadline)?)
4758 }
4759
4760 pub fn r#start_request(
4772 &self,
4773 mut payload: PairingDelegate2StartRequestRequest,
4774 ) -> Result<(), fidl::Error> {
4775 self.client.send::<PairingDelegate2StartRequestRequest>(
4776 &mut payload,
4777 0x2a5ab8092a961a01,
4778 fidl::encoding::DynamicFlags::empty(),
4779 )
4780 }
4781
4782 pub fn r#request_complete(
4789 &self,
4790 mut id: &fidl_fuchsia_bluetooth::PeerId,
4791 mut success: bool,
4792 ) -> Result<(), fidl::Error> {
4793 self.client.send::<PairingDelegate2RequestCompleteRequest>(
4794 (id, success),
4795 0x4b63b44d5dbca192,
4796 fidl::encoding::DynamicFlags::empty(),
4797 )
4798 }
4799}
4800
4801#[derive(Debug, Clone)]
4802pub struct PairingDelegate2Proxy {
4803 client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
4804}
4805
4806impl fidl::endpoints::Proxy for PairingDelegate2Proxy {
4807 type Protocol = PairingDelegate2Marker;
4808
4809 fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
4810 Self::new(inner)
4811 }
4812
4813 fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
4814 self.client.into_channel().map_err(|client| Self { client })
4815 }
4816
4817 fn as_channel(&self) -> &::fidl::AsyncChannel {
4818 self.client.as_channel()
4819 }
4820}
4821
4822impl PairingDelegate2Proxy {
4823 pub fn new(channel: ::fidl::AsyncChannel) -> Self {
4825 let protocol_name = <PairingDelegate2Marker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
4826 Self { client: fidl::client::Client::new(channel, protocol_name) }
4827 }
4828
4829 pub fn take_event_stream(&self) -> PairingDelegate2EventStream {
4835 PairingDelegate2EventStream { event_receiver: self.client.take_event_receiver() }
4836 }
4837
4838 pub fn r#start_request(
4850 &self,
4851 mut payload: PairingDelegate2StartRequestRequest,
4852 ) -> Result<(), fidl::Error> {
4853 PairingDelegate2ProxyInterface::r#start_request(self, payload)
4854 }
4855
4856 pub fn r#request_complete(
4863 &self,
4864 mut id: &fidl_fuchsia_bluetooth::PeerId,
4865 mut success: bool,
4866 ) -> Result<(), fidl::Error> {
4867 PairingDelegate2ProxyInterface::r#request_complete(self, id, success)
4868 }
4869}
4870
4871impl PairingDelegate2ProxyInterface for PairingDelegate2Proxy {
4872 fn r#start_request(
4873 &self,
4874 mut payload: PairingDelegate2StartRequestRequest,
4875 ) -> Result<(), fidl::Error> {
4876 self.client.send::<PairingDelegate2StartRequestRequest>(
4877 &mut payload,
4878 0x2a5ab8092a961a01,
4879 fidl::encoding::DynamicFlags::empty(),
4880 )
4881 }
4882
4883 fn r#request_complete(
4884 &self,
4885 mut id: &fidl_fuchsia_bluetooth::PeerId,
4886 mut success: bool,
4887 ) -> Result<(), fidl::Error> {
4888 self.client.send::<PairingDelegate2RequestCompleteRequest>(
4889 (id, success),
4890 0x4b63b44d5dbca192,
4891 fidl::encoding::DynamicFlags::empty(),
4892 )
4893 }
4894}
4895
4896pub struct PairingDelegate2EventStream {
4897 event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
4898}
4899
4900impl std::marker::Unpin for PairingDelegate2EventStream {}
4901
4902impl futures::stream::FusedStream for PairingDelegate2EventStream {
4903 fn is_terminated(&self) -> bool {
4904 self.event_receiver.is_terminated()
4905 }
4906}
4907
4908impl futures::Stream for PairingDelegate2EventStream {
4909 type Item = Result<PairingDelegate2Event, fidl::Error>;
4910
4911 fn poll_next(
4912 mut self: std::pin::Pin<&mut Self>,
4913 cx: &mut std::task::Context<'_>,
4914 ) -> std::task::Poll<Option<Self::Item>> {
4915 match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
4916 &mut self.event_receiver,
4917 cx
4918 )?) {
4919 Some(buf) => std::task::Poll::Ready(Some(PairingDelegate2Event::decode(buf))),
4920 None => std::task::Poll::Ready(None),
4921 }
4922 }
4923}
4924
4925#[derive(Debug)]
4926pub enum PairingDelegate2Event {}
4927
4928impl PairingDelegate2Event {
4929 fn decode(
4931 mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
4932 ) -> Result<PairingDelegate2Event, fidl::Error> {
4933 let (bytes, _handles) = buf.split_mut();
4934 let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
4935 debug_assert_eq!(tx_header.tx_id, 0);
4936 match tx_header.ordinal {
4937 _ => Err(fidl::Error::UnknownOrdinal {
4938 ordinal: tx_header.ordinal,
4939 protocol_name:
4940 <PairingDelegate2Marker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
4941 }),
4942 }
4943 }
4944}
4945
4946pub struct PairingDelegate2RequestStream {
4948 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
4949 is_terminated: bool,
4950}
4951
4952impl std::marker::Unpin for PairingDelegate2RequestStream {}
4953
4954impl futures::stream::FusedStream for PairingDelegate2RequestStream {
4955 fn is_terminated(&self) -> bool {
4956 self.is_terminated
4957 }
4958}
4959
4960impl fidl::endpoints::RequestStream for PairingDelegate2RequestStream {
4961 type Protocol = PairingDelegate2Marker;
4962 type ControlHandle = PairingDelegate2ControlHandle;
4963
4964 fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
4965 Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
4966 }
4967
4968 fn control_handle(&self) -> Self::ControlHandle {
4969 PairingDelegate2ControlHandle { inner: self.inner.clone() }
4970 }
4971
4972 fn into_inner(
4973 self,
4974 ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
4975 {
4976 (self.inner, self.is_terminated)
4977 }
4978
4979 fn from_inner(
4980 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
4981 is_terminated: bool,
4982 ) -> Self {
4983 Self { inner, is_terminated }
4984 }
4985}
4986
4987impl futures::Stream for PairingDelegate2RequestStream {
4988 type Item = Result<PairingDelegate2Request, fidl::Error>;
4989
4990 fn poll_next(
4991 mut self: std::pin::Pin<&mut Self>,
4992 cx: &mut std::task::Context<'_>,
4993 ) -> std::task::Poll<Option<Self::Item>> {
4994 let this = &mut *self;
4995 if this.inner.check_shutdown(cx) {
4996 this.is_terminated = true;
4997 return std::task::Poll::Ready(None);
4998 }
4999 if this.is_terminated {
5000 panic!("polled PairingDelegate2RequestStream after completion");
5001 }
5002 fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
5003 |bytes, handles| {
5004 match this.inner.channel().read_etc(cx, bytes, handles) {
5005 std::task::Poll::Ready(Ok(())) => {}
5006 std::task::Poll::Pending => return std::task::Poll::Pending,
5007 std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
5008 this.is_terminated = true;
5009 return std::task::Poll::Ready(None);
5010 }
5011 std::task::Poll::Ready(Err(e)) => {
5012 return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
5013 e.into(),
5014 ))))
5015 }
5016 }
5017
5018 let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
5020
5021 std::task::Poll::Ready(Some(match header.ordinal {
5022 0x2a5ab8092a961a01 => {
5023 header.validate_request_tx_id(fidl::MethodType::OneWay)?;
5024 let mut req = fidl::new_empty!(
5025 PairingDelegate2StartRequestRequest,
5026 fidl::encoding::DefaultFuchsiaResourceDialect
5027 );
5028 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<PairingDelegate2StartRequestRequest>(&header, _body_bytes, handles, &mut req)?;
5029 let control_handle =
5030 PairingDelegate2ControlHandle { inner: this.inner.clone() };
5031 Ok(PairingDelegate2Request::StartRequest { payload: req, control_handle })
5032 }
5033 0x4b63b44d5dbca192 => {
5034 header.validate_request_tx_id(fidl::MethodType::OneWay)?;
5035 let mut req = fidl::new_empty!(
5036 PairingDelegate2RequestCompleteRequest,
5037 fidl::encoding::DefaultFuchsiaResourceDialect
5038 );
5039 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<PairingDelegate2RequestCompleteRequest>(&header, _body_bytes, handles, &mut req)?;
5040 let control_handle =
5041 PairingDelegate2ControlHandle { inner: this.inner.clone() };
5042 Ok(PairingDelegate2Request::RequestComplete {
5043 id: req.id,
5044 success: req.success,
5045
5046 control_handle,
5047 })
5048 }
5049 _ => Err(fidl::Error::UnknownOrdinal {
5050 ordinal: header.ordinal,
5051 protocol_name:
5052 <PairingDelegate2Marker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
5053 }),
5054 }))
5055 },
5056 )
5057 }
5058}
5059
5060#[derive(Debug)]
5072pub enum PairingDelegate2Request {
5073 StartRequest {
5085 payload: PairingDelegate2StartRequestRequest,
5086 control_handle: PairingDelegate2ControlHandle,
5087 },
5088 RequestComplete {
5095 id: fidl_fuchsia_bluetooth::PeerId,
5096 success: bool,
5097 control_handle: PairingDelegate2ControlHandle,
5098 },
5099}
5100
5101impl PairingDelegate2Request {
5102 #[allow(irrefutable_let_patterns)]
5103 pub fn into_start_request(
5104 self,
5105 ) -> Option<(PairingDelegate2StartRequestRequest, PairingDelegate2ControlHandle)> {
5106 if let PairingDelegate2Request::StartRequest { payload, control_handle } = self {
5107 Some((payload, control_handle))
5108 } else {
5109 None
5110 }
5111 }
5112
5113 #[allow(irrefutable_let_patterns)]
5114 pub fn into_request_complete(
5115 self,
5116 ) -> Option<(fidl_fuchsia_bluetooth::PeerId, bool, PairingDelegate2ControlHandle)> {
5117 if let PairingDelegate2Request::RequestComplete { id, success, control_handle } = self {
5118 Some((id, success, control_handle))
5119 } else {
5120 None
5121 }
5122 }
5123
5124 pub fn method_name(&self) -> &'static str {
5126 match *self {
5127 PairingDelegate2Request::StartRequest { .. } => "start_request",
5128 PairingDelegate2Request::RequestComplete { .. } => "request_complete",
5129 }
5130 }
5131}
5132
5133#[derive(Debug, Clone)]
5134pub struct PairingDelegate2ControlHandle {
5135 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
5136}
5137
5138impl fidl::endpoints::ControlHandle for PairingDelegate2ControlHandle {
5139 fn shutdown(&self) {
5140 self.inner.shutdown()
5141 }
5142 fn shutdown_with_epitaph(&self, status: zx_status::Status) {
5143 self.inner.shutdown_with_epitaph(status)
5144 }
5145
5146 fn is_closed(&self) -> bool {
5147 self.inner.channel().is_closed()
5148 }
5149 fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
5150 self.inner.channel().on_closed()
5151 }
5152
5153 #[cfg(target_os = "fuchsia")]
5154 fn signal_peer(
5155 &self,
5156 clear_mask: zx::Signals,
5157 set_mask: zx::Signals,
5158 ) -> Result<(), zx_status::Status> {
5159 use fidl::Peered;
5160 self.inner.channel().signal_peer(clear_mask, set_mask)
5161 }
5162}
5163
5164impl PairingDelegate2ControlHandle {}
5165
5166#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
5167pub struct PairingRequestMarker;
5168
5169impl fidl::endpoints::ProtocolMarker for PairingRequestMarker {
5170 type Proxy = PairingRequestProxy;
5171 type RequestStream = PairingRequestRequestStream;
5172 #[cfg(target_os = "fuchsia")]
5173 type SynchronousProxy = PairingRequestSynchronousProxy;
5174
5175 const DEBUG_NAME: &'static str = "(anonymous) PairingRequest";
5176}
5177
5178pub trait PairingRequestProxyInterface: Send + Sync {
5179 fn r#accept(&self, payload: &PairingRequestAcceptRequest) -> Result<(), fidl::Error>;
5180 fn r#reject(&self) -> Result<(), fidl::Error>;
5181 type KeypressResponseFut: std::future::Future<Output = Result<(), fidl::Error>> + Send;
5182 fn r#keypress(&self, keypress: PairingKeypress) -> Self::KeypressResponseFut;
5183}
5184#[derive(Debug)]
5185#[cfg(target_os = "fuchsia")]
5186pub struct PairingRequestSynchronousProxy {
5187 client: fidl::client::sync::Client,
5188}
5189
5190#[cfg(target_os = "fuchsia")]
5191impl fidl::endpoints::SynchronousProxy for PairingRequestSynchronousProxy {
5192 type Proxy = PairingRequestProxy;
5193 type Protocol = PairingRequestMarker;
5194
5195 fn from_channel(inner: fidl::Channel) -> Self {
5196 Self::new(inner)
5197 }
5198
5199 fn into_channel(self) -> fidl::Channel {
5200 self.client.into_channel()
5201 }
5202
5203 fn as_channel(&self) -> &fidl::Channel {
5204 self.client.as_channel()
5205 }
5206}
5207
5208#[cfg(target_os = "fuchsia")]
5209impl PairingRequestSynchronousProxy {
5210 pub fn new(channel: fidl::Channel) -> Self {
5211 let protocol_name = <PairingRequestMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
5212 Self { client: fidl::client::sync::Client::new(channel, protocol_name) }
5213 }
5214
5215 pub fn into_channel(self) -> fidl::Channel {
5216 self.client.into_channel()
5217 }
5218
5219 pub fn wait_for_event(
5222 &self,
5223 deadline: zx::MonotonicInstant,
5224 ) -> Result<PairingRequestEvent, fidl::Error> {
5225 PairingRequestEvent::decode(self.client.wait_for_event(deadline)?)
5226 }
5227
5228 pub fn r#accept(&self, mut payload: &PairingRequestAcceptRequest) -> Result<(), fidl::Error> {
5232 self.client.send::<PairingRequestAcceptRequest>(
5233 payload,
5234 0x67278857ae043a5,
5235 fidl::encoding::DynamicFlags::empty(),
5236 )
5237 }
5238
5239 pub fn r#reject(&self) -> Result<(), fidl::Error> {
5242 self.client.send::<fidl::encoding::EmptyPayload>(
5243 (),
5244 0x550414aec8155cf5,
5245 fidl::encoding::DynamicFlags::empty(),
5246 )
5247 }
5248
5249 pub fn r#keypress(
5253 &self,
5254 mut keypress: PairingKeypress,
5255 ___deadline: zx::MonotonicInstant,
5256 ) -> Result<(), fidl::Error> {
5257 let _response =
5258 self.client.send_query::<PairingRequestKeypressRequest, fidl::encoding::EmptyPayload>(
5259 (keypress,),
5260 0x53948ecc921fbe9b,
5261 fidl::encoding::DynamicFlags::empty(),
5262 ___deadline,
5263 )?;
5264 Ok(_response)
5265 }
5266}
5267
5268#[derive(Debug, Clone)]
5269pub struct PairingRequestProxy {
5270 client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
5271}
5272
5273impl fidl::endpoints::Proxy for PairingRequestProxy {
5274 type Protocol = PairingRequestMarker;
5275
5276 fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
5277 Self::new(inner)
5278 }
5279
5280 fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
5281 self.client.into_channel().map_err(|client| Self { client })
5282 }
5283
5284 fn as_channel(&self) -> &::fidl::AsyncChannel {
5285 self.client.as_channel()
5286 }
5287}
5288
5289impl PairingRequestProxy {
5290 pub fn new(channel: ::fidl::AsyncChannel) -> Self {
5292 let protocol_name = <PairingRequestMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
5293 Self { client: fidl::client::Client::new(channel, protocol_name) }
5294 }
5295
5296 pub fn take_event_stream(&self) -> PairingRequestEventStream {
5302 PairingRequestEventStream { event_receiver: self.client.take_event_receiver() }
5303 }
5304
5305 pub fn r#accept(&self, mut payload: &PairingRequestAcceptRequest) -> Result<(), fidl::Error> {
5309 PairingRequestProxyInterface::r#accept(self, payload)
5310 }
5311
5312 pub fn r#reject(&self) -> Result<(), fidl::Error> {
5315 PairingRequestProxyInterface::r#reject(self)
5316 }
5317
5318 pub fn r#keypress(
5322 &self,
5323 mut keypress: PairingKeypress,
5324 ) -> fidl::client::QueryResponseFut<(), fidl::encoding::DefaultFuchsiaResourceDialect> {
5325 PairingRequestProxyInterface::r#keypress(self, keypress)
5326 }
5327}
5328
5329impl PairingRequestProxyInterface for PairingRequestProxy {
5330 fn r#accept(&self, mut payload: &PairingRequestAcceptRequest) -> Result<(), fidl::Error> {
5331 self.client.send::<PairingRequestAcceptRequest>(
5332 payload,
5333 0x67278857ae043a5,
5334 fidl::encoding::DynamicFlags::empty(),
5335 )
5336 }
5337
5338 fn r#reject(&self) -> Result<(), fidl::Error> {
5339 self.client.send::<fidl::encoding::EmptyPayload>(
5340 (),
5341 0x550414aec8155cf5,
5342 fidl::encoding::DynamicFlags::empty(),
5343 )
5344 }
5345
5346 type KeypressResponseFut =
5347 fidl::client::QueryResponseFut<(), fidl::encoding::DefaultFuchsiaResourceDialect>;
5348 fn r#keypress(&self, mut keypress: PairingKeypress) -> Self::KeypressResponseFut {
5349 fn _decode(
5350 mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
5351 ) -> Result<(), fidl::Error> {
5352 let _response = fidl::client::decode_transaction_body::<
5353 fidl::encoding::EmptyPayload,
5354 fidl::encoding::DefaultFuchsiaResourceDialect,
5355 0x53948ecc921fbe9b,
5356 >(_buf?)?;
5357 Ok(_response)
5358 }
5359 self.client.send_query_and_decode::<PairingRequestKeypressRequest, ()>(
5360 (keypress,),
5361 0x53948ecc921fbe9b,
5362 fidl::encoding::DynamicFlags::empty(),
5363 _decode,
5364 )
5365 }
5366}
5367
5368pub struct PairingRequestEventStream {
5369 event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
5370}
5371
5372impl std::marker::Unpin for PairingRequestEventStream {}
5373
5374impl futures::stream::FusedStream for PairingRequestEventStream {
5375 fn is_terminated(&self) -> bool {
5376 self.event_receiver.is_terminated()
5377 }
5378}
5379
5380impl futures::Stream for PairingRequestEventStream {
5381 type Item = Result<PairingRequestEvent, fidl::Error>;
5382
5383 fn poll_next(
5384 mut self: std::pin::Pin<&mut Self>,
5385 cx: &mut std::task::Context<'_>,
5386 ) -> std::task::Poll<Option<Self::Item>> {
5387 match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
5388 &mut self.event_receiver,
5389 cx
5390 )?) {
5391 Some(buf) => std::task::Poll::Ready(Some(PairingRequestEvent::decode(buf))),
5392 None => std::task::Poll::Ready(None),
5393 }
5394 }
5395}
5396
5397#[derive(Debug)]
5398pub enum PairingRequestEvent {
5399 OnKeypress { keypress: PairingKeypress },
5400 OnComplete { success: bool },
5401}
5402
5403impl PairingRequestEvent {
5404 #[allow(irrefutable_let_patterns)]
5405 pub fn into_on_keypress(self) -> Option<PairingKeypress> {
5406 if let PairingRequestEvent::OnKeypress { keypress } = self {
5407 Some((keypress))
5408 } else {
5409 None
5410 }
5411 }
5412 #[allow(irrefutable_let_patterns)]
5413 pub fn into_on_complete(self) -> Option<bool> {
5414 if let PairingRequestEvent::OnComplete { success } = self {
5415 Some((success))
5416 } else {
5417 None
5418 }
5419 }
5420
5421 fn decode(
5423 mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
5424 ) -> Result<PairingRequestEvent, fidl::Error> {
5425 let (bytes, _handles) = buf.split_mut();
5426 let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
5427 debug_assert_eq!(tx_header.tx_id, 0);
5428 match tx_header.ordinal {
5429 0x71a4802e6a5d1aca => {
5430 let mut out = fidl::new_empty!(
5431 PairingRequestOnKeypressRequest,
5432 fidl::encoding::DefaultFuchsiaResourceDialect
5433 );
5434 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<PairingRequestOnKeypressRequest>(&tx_header, _body_bytes, _handles, &mut out)?;
5435 Ok((PairingRequestEvent::OnKeypress { keypress: out.keypress }))
5436 }
5437 0xd38d3220987bc79 => {
5438 let mut out = fidl::new_empty!(
5439 PairingRequestOnCompleteRequest,
5440 fidl::encoding::DefaultFuchsiaResourceDialect
5441 );
5442 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<PairingRequestOnCompleteRequest>(&tx_header, _body_bytes, _handles, &mut out)?;
5443 Ok((PairingRequestEvent::OnComplete { success: out.success }))
5444 }
5445 _ => Err(fidl::Error::UnknownOrdinal {
5446 ordinal: tx_header.ordinal,
5447 protocol_name:
5448 <PairingRequestMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
5449 }),
5450 }
5451 }
5452}
5453
5454pub struct PairingRequestRequestStream {
5456 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
5457 is_terminated: bool,
5458}
5459
5460impl std::marker::Unpin for PairingRequestRequestStream {}
5461
5462impl futures::stream::FusedStream for PairingRequestRequestStream {
5463 fn is_terminated(&self) -> bool {
5464 self.is_terminated
5465 }
5466}
5467
5468impl fidl::endpoints::RequestStream for PairingRequestRequestStream {
5469 type Protocol = PairingRequestMarker;
5470 type ControlHandle = PairingRequestControlHandle;
5471
5472 fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
5473 Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
5474 }
5475
5476 fn control_handle(&self) -> Self::ControlHandle {
5477 PairingRequestControlHandle { inner: self.inner.clone() }
5478 }
5479
5480 fn into_inner(
5481 self,
5482 ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
5483 {
5484 (self.inner, self.is_terminated)
5485 }
5486
5487 fn from_inner(
5488 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
5489 is_terminated: bool,
5490 ) -> Self {
5491 Self { inner, is_terminated }
5492 }
5493}
5494
5495impl futures::Stream for PairingRequestRequestStream {
5496 type Item = Result<PairingRequestRequest, fidl::Error>;
5497
5498 fn poll_next(
5499 mut self: std::pin::Pin<&mut Self>,
5500 cx: &mut std::task::Context<'_>,
5501 ) -> std::task::Poll<Option<Self::Item>> {
5502 let this = &mut *self;
5503 if this.inner.check_shutdown(cx) {
5504 this.is_terminated = true;
5505 return std::task::Poll::Ready(None);
5506 }
5507 if this.is_terminated {
5508 panic!("polled PairingRequestRequestStream after completion");
5509 }
5510 fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
5511 |bytes, handles| {
5512 match this.inner.channel().read_etc(cx, bytes, handles) {
5513 std::task::Poll::Ready(Ok(())) => {}
5514 std::task::Poll::Pending => return std::task::Poll::Pending,
5515 std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
5516 this.is_terminated = true;
5517 return std::task::Poll::Ready(None);
5518 }
5519 std::task::Poll::Ready(Err(e)) => {
5520 return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
5521 e.into(),
5522 ))))
5523 }
5524 }
5525
5526 let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
5528
5529 std::task::Poll::Ready(Some(match header.ordinal {
5530 0x67278857ae043a5 => {
5531 header.validate_request_tx_id(fidl::MethodType::OneWay)?;
5532 let mut req = fidl::new_empty!(
5533 PairingRequestAcceptRequest,
5534 fidl::encoding::DefaultFuchsiaResourceDialect
5535 );
5536 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<PairingRequestAcceptRequest>(&header, _body_bytes, handles, &mut req)?;
5537 let control_handle =
5538 PairingRequestControlHandle { inner: this.inner.clone() };
5539 Ok(PairingRequestRequest::Accept { payload: req, control_handle })
5540 }
5541 0x550414aec8155cf5 => {
5542 header.validate_request_tx_id(fidl::MethodType::OneWay)?;
5543 let mut req = fidl::new_empty!(
5544 fidl::encoding::EmptyPayload,
5545 fidl::encoding::DefaultFuchsiaResourceDialect
5546 );
5547 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
5548 let control_handle =
5549 PairingRequestControlHandle { inner: this.inner.clone() };
5550 Ok(PairingRequestRequest::Reject { control_handle })
5551 }
5552 0x53948ecc921fbe9b => {
5553 header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
5554 let mut req = fidl::new_empty!(
5555 PairingRequestKeypressRequest,
5556 fidl::encoding::DefaultFuchsiaResourceDialect
5557 );
5558 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<PairingRequestKeypressRequest>(&header, _body_bytes, handles, &mut req)?;
5559 let control_handle =
5560 PairingRequestControlHandle { inner: this.inner.clone() };
5561 Ok(PairingRequestRequest::Keypress {
5562 keypress: req.keypress,
5563
5564 responder: PairingRequestKeypressResponder {
5565 control_handle: std::mem::ManuallyDrop::new(control_handle),
5566 tx_id: header.tx_id,
5567 },
5568 })
5569 }
5570 _ => Err(fidl::Error::UnknownOrdinal {
5571 ordinal: header.ordinal,
5572 protocol_name:
5573 <PairingRequestMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
5574 }),
5575 }))
5576 },
5577 )
5578 }
5579}
5580
5581#[derive(Debug)]
5591pub enum PairingRequestRequest {
5592 Accept { payload: PairingRequestAcceptRequest, control_handle: PairingRequestControlHandle },
5596 Reject { control_handle: PairingRequestControlHandle },
5599 Keypress { keypress: PairingKeypress, responder: PairingRequestKeypressResponder },
5603}
5604
5605impl PairingRequestRequest {
5606 #[allow(irrefutable_let_patterns)]
5607 pub fn into_accept(self) -> Option<(PairingRequestAcceptRequest, PairingRequestControlHandle)> {
5608 if let PairingRequestRequest::Accept { payload, control_handle } = self {
5609 Some((payload, control_handle))
5610 } else {
5611 None
5612 }
5613 }
5614
5615 #[allow(irrefutable_let_patterns)]
5616 pub fn into_reject(self) -> Option<(PairingRequestControlHandle)> {
5617 if let PairingRequestRequest::Reject { control_handle } = self {
5618 Some((control_handle))
5619 } else {
5620 None
5621 }
5622 }
5623
5624 #[allow(irrefutable_let_patterns)]
5625 pub fn into_keypress(self) -> Option<(PairingKeypress, PairingRequestKeypressResponder)> {
5626 if let PairingRequestRequest::Keypress { keypress, responder } = self {
5627 Some((keypress, responder))
5628 } else {
5629 None
5630 }
5631 }
5632
5633 pub fn method_name(&self) -> &'static str {
5635 match *self {
5636 PairingRequestRequest::Accept { .. } => "accept",
5637 PairingRequestRequest::Reject { .. } => "reject",
5638 PairingRequestRequest::Keypress { .. } => "keypress",
5639 }
5640 }
5641}
5642
5643#[derive(Debug, Clone)]
5644pub struct PairingRequestControlHandle {
5645 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
5646}
5647
5648impl fidl::endpoints::ControlHandle for PairingRequestControlHandle {
5649 fn shutdown(&self) {
5650 self.inner.shutdown()
5651 }
5652 fn shutdown_with_epitaph(&self, status: zx_status::Status) {
5653 self.inner.shutdown_with_epitaph(status)
5654 }
5655
5656 fn is_closed(&self) -> bool {
5657 self.inner.channel().is_closed()
5658 }
5659 fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
5660 self.inner.channel().on_closed()
5661 }
5662
5663 #[cfg(target_os = "fuchsia")]
5664 fn signal_peer(
5665 &self,
5666 clear_mask: zx::Signals,
5667 set_mask: zx::Signals,
5668 ) -> Result<(), zx_status::Status> {
5669 use fidl::Peered;
5670 self.inner.channel().signal_peer(clear_mask, set_mask)
5671 }
5672}
5673
5674impl PairingRequestControlHandle {
5675 pub fn send_on_keypress(&self, mut keypress: PairingKeypress) -> Result<(), fidl::Error> {
5676 self.inner.send::<PairingRequestOnKeypressRequest>(
5677 (keypress,),
5678 0,
5679 0x71a4802e6a5d1aca,
5680 fidl::encoding::DynamicFlags::empty(),
5681 )
5682 }
5683
5684 pub fn send_on_complete(&self, mut success: bool) -> Result<(), fidl::Error> {
5685 self.inner.send::<PairingRequestOnCompleteRequest>(
5686 (success,),
5687 0,
5688 0xd38d3220987bc79,
5689 fidl::encoding::DynamicFlags::empty(),
5690 )
5691 }
5692}
5693
5694#[must_use = "FIDL methods require a response to be sent"]
5695#[derive(Debug)]
5696pub struct PairingRequestKeypressResponder {
5697 control_handle: std::mem::ManuallyDrop<PairingRequestControlHandle>,
5698 tx_id: u32,
5699}
5700
5701impl std::ops::Drop for PairingRequestKeypressResponder {
5705 fn drop(&mut self) {
5706 self.control_handle.shutdown();
5707 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
5709 }
5710}
5711
5712impl fidl::endpoints::Responder for PairingRequestKeypressResponder {
5713 type ControlHandle = PairingRequestControlHandle;
5714
5715 fn control_handle(&self) -> &PairingRequestControlHandle {
5716 &self.control_handle
5717 }
5718
5719 fn drop_without_shutdown(mut self) {
5720 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
5722 std::mem::forget(self);
5724 }
5725}
5726
5727impl PairingRequestKeypressResponder {
5728 pub fn send(self) -> Result<(), fidl::Error> {
5732 let _result = self.send_raw();
5733 if _result.is_err() {
5734 self.control_handle.shutdown();
5735 }
5736 self.drop_without_shutdown();
5737 _result
5738 }
5739
5740 pub fn send_no_shutdown_on_err(self) -> Result<(), fidl::Error> {
5742 let _result = self.send_raw();
5743 self.drop_without_shutdown();
5744 _result
5745 }
5746
5747 fn send_raw(&self) -> Result<(), fidl::Error> {
5748 self.control_handle.inner.send::<fidl::encoding::EmptyPayload>(
5749 (),
5750 self.tx_id,
5751 0x53948ecc921fbe9b,
5752 fidl::encoding::DynamicFlags::empty(),
5753 )
5754 }
5755}
5756
5757#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
5758pub struct ProcedureTokenMarker;
5759
5760impl fidl::endpoints::ProtocolMarker for ProcedureTokenMarker {
5761 type Proxy = ProcedureTokenProxy;
5762 type RequestStream = ProcedureTokenRequestStream;
5763 #[cfg(target_os = "fuchsia")]
5764 type SynchronousProxy = ProcedureTokenSynchronousProxy;
5765
5766 const DEBUG_NAME: &'static str = "(anonymous) ProcedureToken";
5767}
5768
5769pub trait ProcedureTokenProxyInterface: Send + Sync {}
5770#[derive(Debug)]
5771#[cfg(target_os = "fuchsia")]
5772pub struct ProcedureTokenSynchronousProxy {
5773 client: fidl::client::sync::Client,
5774}
5775
5776#[cfg(target_os = "fuchsia")]
5777impl fidl::endpoints::SynchronousProxy for ProcedureTokenSynchronousProxy {
5778 type Proxy = ProcedureTokenProxy;
5779 type Protocol = ProcedureTokenMarker;
5780
5781 fn from_channel(inner: fidl::Channel) -> Self {
5782 Self::new(inner)
5783 }
5784
5785 fn into_channel(self) -> fidl::Channel {
5786 self.client.into_channel()
5787 }
5788
5789 fn as_channel(&self) -> &fidl::Channel {
5790 self.client.as_channel()
5791 }
5792}
5793
5794#[cfg(target_os = "fuchsia")]
5795impl ProcedureTokenSynchronousProxy {
5796 pub fn new(channel: fidl::Channel) -> Self {
5797 let protocol_name = <ProcedureTokenMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
5798 Self { client: fidl::client::sync::Client::new(channel, protocol_name) }
5799 }
5800
5801 pub fn into_channel(self) -> fidl::Channel {
5802 self.client.into_channel()
5803 }
5804
5805 pub fn wait_for_event(
5808 &self,
5809 deadline: zx::MonotonicInstant,
5810 ) -> Result<ProcedureTokenEvent, fidl::Error> {
5811 ProcedureTokenEvent::decode(self.client.wait_for_event(deadline)?)
5812 }
5813}
5814
5815#[derive(Debug, Clone)]
5816pub struct ProcedureTokenProxy {
5817 client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
5818}
5819
5820impl fidl::endpoints::Proxy for ProcedureTokenProxy {
5821 type Protocol = ProcedureTokenMarker;
5822
5823 fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
5824 Self::new(inner)
5825 }
5826
5827 fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
5828 self.client.into_channel().map_err(|client| Self { client })
5829 }
5830
5831 fn as_channel(&self) -> &::fidl::AsyncChannel {
5832 self.client.as_channel()
5833 }
5834}
5835
5836impl ProcedureTokenProxy {
5837 pub fn new(channel: ::fidl::AsyncChannel) -> Self {
5839 let protocol_name = <ProcedureTokenMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
5840 Self { client: fidl::client::Client::new(channel, protocol_name) }
5841 }
5842
5843 pub fn take_event_stream(&self) -> ProcedureTokenEventStream {
5849 ProcedureTokenEventStream { event_receiver: self.client.take_event_receiver() }
5850 }
5851}
5852
5853impl ProcedureTokenProxyInterface for ProcedureTokenProxy {}
5854
5855pub struct ProcedureTokenEventStream {
5856 event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
5857}
5858
5859impl std::marker::Unpin for ProcedureTokenEventStream {}
5860
5861impl futures::stream::FusedStream for ProcedureTokenEventStream {
5862 fn is_terminated(&self) -> bool {
5863 self.event_receiver.is_terminated()
5864 }
5865}
5866
5867impl futures::Stream for ProcedureTokenEventStream {
5868 type Item = Result<ProcedureTokenEvent, fidl::Error>;
5869
5870 fn poll_next(
5871 mut self: std::pin::Pin<&mut Self>,
5872 cx: &mut std::task::Context<'_>,
5873 ) -> std::task::Poll<Option<Self::Item>> {
5874 match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
5875 &mut self.event_receiver,
5876 cx
5877 )?) {
5878 Some(buf) => std::task::Poll::Ready(Some(ProcedureTokenEvent::decode(buf))),
5879 None => std::task::Poll::Ready(None),
5880 }
5881 }
5882}
5883
5884#[derive(Debug)]
5885pub enum ProcedureTokenEvent {}
5886
5887impl ProcedureTokenEvent {
5888 fn decode(
5890 mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
5891 ) -> Result<ProcedureTokenEvent, fidl::Error> {
5892 let (bytes, _handles) = buf.split_mut();
5893 let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
5894 debug_assert_eq!(tx_header.tx_id, 0);
5895 match tx_header.ordinal {
5896 _ => Err(fidl::Error::UnknownOrdinal {
5897 ordinal: tx_header.ordinal,
5898 protocol_name:
5899 <ProcedureTokenMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
5900 }),
5901 }
5902 }
5903}
5904
5905pub struct ProcedureTokenRequestStream {
5907 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
5908 is_terminated: bool,
5909}
5910
5911impl std::marker::Unpin for ProcedureTokenRequestStream {}
5912
5913impl futures::stream::FusedStream for ProcedureTokenRequestStream {
5914 fn is_terminated(&self) -> bool {
5915 self.is_terminated
5916 }
5917}
5918
5919impl fidl::endpoints::RequestStream for ProcedureTokenRequestStream {
5920 type Protocol = ProcedureTokenMarker;
5921 type ControlHandle = ProcedureTokenControlHandle;
5922
5923 fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
5924 Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
5925 }
5926
5927 fn control_handle(&self) -> Self::ControlHandle {
5928 ProcedureTokenControlHandle { inner: self.inner.clone() }
5929 }
5930
5931 fn into_inner(
5932 self,
5933 ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
5934 {
5935 (self.inner, self.is_terminated)
5936 }
5937
5938 fn from_inner(
5939 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
5940 is_terminated: bool,
5941 ) -> Self {
5942 Self { inner, is_terminated }
5943 }
5944}
5945
5946impl futures::Stream for ProcedureTokenRequestStream {
5947 type Item = Result<ProcedureTokenRequest, fidl::Error>;
5948
5949 fn poll_next(
5950 mut self: std::pin::Pin<&mut Self>,
5951 cx: &mut std::task::Context<'_>,
5952 ) -> std::task::Poll<Option<Self::Item>> {
5953 let this = &mut *self;
5954 if this.inner.check_shutdown(cx) {
5955 this.is_terminated = true;
5956 return std::task::Poll::Ready(None);
5957 }
5958 if this.is_terminated {
5959 panic!("polled ProcedureTokenRequestStream after completion");
5960 }
5961 fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
5962 |bytes, handles| {
5963 match this.inner.channel().read_etc(cx, bytes, handles) {
5964 std::task::Poll::Ready(Ok(())) => {}
5965 std::task::Poll::Pending => return std::task::Poll::Pending,
5966 std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
5967 this.is_terminated = true;
5968 return std::task::Poll::Ready(None);
5969 }
5970 std::task::Poll::Ready(Err(e)) => {
5971 return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
5972 e.into(),
5973 ))))
5974 }
5975 }
5976
5977 let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
5979
5980 std::task::Poll::Ready(Some(match header.ordinal {
5981 _ => Err(fidl::Error::UnknownOrdinal {
5982 ordinal: header.ordinal,
5983 protocol_name:
5984 <ProcedureTokenMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
5985 }),
5986 }))
5987 },
5988 )
5989 }
5990}
5991
5992#[derive(Debug)]
5998pub enum ProcedureTokenRequest {}
5999
6000impl ProcedureTokenRequest {
6001 pub fn method_name(&self) -> &'static str {
6003 match *self {}
6004 }
6005}
6006
6007#[derive(Debug, Clone)]
6008pub struct ProcedureTokenControlHandle {
6009 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
6010}
6011
6012impl fidl::endpoints::ControlHandle for ProcedureTokenControlHandle {
6013 fn shutdown(&self) {
6014 self.inner.shutdown()
6015 }
6016 fn shutdown_with_epitaph(&self, status: zx_status::Status) {
6017 self.inner.shutdown_with_epitaph(status)
6018 }
6019
6020 fn is_closed(&self) -> bool {
6021 self.inner.channel().is_closed()
6022 }
6023 fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
6024 self.inner.channel().on_closed()
6025 }
6026
6027 #[cfg(target_os = "fuchsia")]
6028 fn signal_peer(
6029 &self,
6030 clear_mask: zx::Signals,
6031 set_mask: zx::Signals,
6032 ) -> Result<(), zx_status::Status> {
6033 use fidl::Peered;
6034 self.inner.channel().signal_peer(clear_mask, set_mask)
6035 }
6036}
6037
6038impl ProcedureTokenControlHandle {}
6039
6040mod internal {
6041 use super::*;
6042
6043 impl fidl::encoding::ResourceTypeMarker for AccessMakeDiscoverableRequest {
6044 type Borrowed<'a> = &'a mut Self;
6045 fn take_or_borrow<'a>(
6046 value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
6047 ) -> Self::Borrowed<'a> {
6048 value
6049 }
6050 }
6051
6052 unsafe impl fidl::encoding::TypeMarker for AccessMakeDiscoverableRequest {
6053 type Owned = Self;
6054
6055 #[inline(always)]
6056 fn inline_align(_context: fidl::encoding::Context) -> usize {
6057 4
6058 }
6059
6060 #[inline(always)]
6061 fn inline_size(_context: fidl::encoding::Context) -> usize {
6062 4
6063 }
6064 }
6065
6066 unsafe impl
6067 fidl::encoding::Encode<
6068 AccessMakeDiscoverableRequest,
6069 fidl::encoding::DefaultFuchsiaResourceDialect,
6070 > for &mut AccessMakeDiscoverableRequest
6071 {
6072 #[inline]
6073 unsafe fn encode(
6074 self,
6075 encoder: &mut fidl::encoding::Encoder<
6076 '_,
6077 fidl::encoding::DefaultFuchsiaResourceDialect,
6078 >,
6079 offset: usize,
6080 _depth: fidl::encoding::Depth,
6081 ) -> fidl::Result<()> {
6082 encoder.debug_check_bounds::<AccessMakeDiscoverableRequest>(offset);
6083 fidl::encoding::Encode::<AccessMakeDiscoverableRequest, fidl::encoding::DefaultFuchsiaResourceDialect>::encode(
6085 (
6086 <fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<ProcedureTokenMarker>> as fidl::encoding::ResourceTypeMarker>::take_or_borrow(&mut self.token),
6087 ),
6088 encoder, offset, _depth
6089 )
6090 }
6091 }
6092 unsafe impl<
6093 T0: fidl::encoding::Encode<
6094 fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<ProcedureTokenMarker>>,
6095 fidl::encoding::DefaultFuchsiaResourceDialect,
6096 >,
6097 >
6098 fidl::encoding::Encode<
6099 AccessMakeDiscoverableRequest,
6100 fidl::encoding::DefaultFuchsiaResourceDialect,
6101 > for (T0,)
6102 {
6103 #[inline]
6104 unsafe fn encode(
6105 self,
6106 encoder: &mut fidl::encoding::Encoder<
6107 '_,
6108 fidl::encoding::DefaultFuchsiaResourceDialect,
6109 >,
6110 offset: usize,
6111 depth: fidl::encoding::Depth,
6112 ) -> fidl::Result<()> {
6113 encoder.debug_check_bounds::<AccessMakeDiscoverableRequest>(offset);
6114 self.0.encode(encoder, offset + 0, depth)?;
6118 Ok(())
6119 }
6120 }
6121
6122 impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
6123 for AccessMakeDiscoverableRequest
6124 {
6125 #[inline(always)]
6126 fn new_empty() -> Self {
6127 Self {
6128 token: fidl::new_empty!(
6129 fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<ProcedureTokenMarker>>,
6130 fidl::encoding::DefaultFuchsiaResourceDialect
6131 ),
6132 }
6133 }
6134
6135 #[inline]
6136 unsafe fn decode(
6137 &mut self,
6138 decoder: &mut fidl::encoding::Decoder<
6139 '_,
6140 fidl::encoding::DefaultFuchsiaResourceDialect,
6141 >,
6142 offset: usize,
6143 _depth: fidl::encoding::Depth,
6144 ) -> fidl::Result<()> {
6145 decoder.debug_check_bounds::<Self>(offset);
6146 fidl::decode!(
6148 fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<ProcedureTokenMarker>>,
6149 fidl::encoding::DefaultFuchsiaResourceDialect,
6150 &mut self.token,
6151 decoder,
6152 offset + 0,
6153 _depth
6154 )?;
6155 Ok(())
6156 }
6157 }
6158
6159 impl fidl::encoding::ResourceTypeMarker for AccessSetPairingDelegateRequest {
6160 type Borrowed<'a> = &'a mut Self;
6161 fn take_or_borrow<'a>(
6162 value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
6163 ) -> Self::Borrowed<'a> {
6164 value
6165 }
6166 }
6167
6168 unsafe impl fidl::encoding::TypeMarker for AccessSetPairingDelegateRequest {
6169 type Owned = Self;
6170
6171 #[inline(always)]
6172 fn inline_align(_context: fidl::encoding::Context) -> usize {
6173 4
6174 }
6175
6176 #[inline(always)]
6177 fn inline_size(_context: fidl::encoding::Context) -> usize {
6178 12
6179 }
6180 }
6181
6182 unsafe impl
6183 fidl::encoding::Encode<
6184 AccessSetPairingDelegateRequest,
6185 fidl::encoding::DefaultFuchsiaResourceDialect,
6186 > for &mut AccessSetPairingDelegateRequest
6187 {
6188 #[inline]
6189 unsafe fn encode(
6190 self,
6191 encoder: &mut fidl::encoding::Encoder<
6192 '_,
6193 fidl::encoding::DefaultFuchsiaResourceDialect,
6194 >,
6195 offset: usize,
6196 _depth: fidl::encoding::Depth,
6197 ) -> fidl::Result<()> {
6198 encoder.debug_check_bounds::<AccessSetPairingDelegateRequest>(offset);
6199 fidl::encoding::Encode::<AccessSetPairingDelegateRequest, fidl::encoding::DefaultFuchsiaResourceDialect>::encode(
6201 (
6202 <InputCapability as fidl::encoding::ValueTypeMarker>::borrow(&self.input),
6203 <OutputCapability as fidl::encoding::ValueTypeMarker>::borrow(&self.output),
6204 <fidl::encoding::Endpoint<fidl::endpoints::ClientEnd<PairingDelegateMarker>> as fidl::encoding::ResourceTypeMarker>::take_or_borrow(&mut self.delegate),
6205 ),
6206 encoder, offset, _depth
6207 )
6208 }
6209 }
6210 unsafe impl<
6211 T0: fidl::encoding::Encode<InputCapability, fidl::encoding::DefaultFuchsiaResourceDialect>,
6212 T1: fidl::encoding::Encode<OutputCapability, fidl::encoding::DefaultFuchsiaResourceDialect>,
6213 T2: fidl::encoding::Encode<
6214 fidl::encoding::Endpoint<fidl::endpoints::ClientEnd<PairingDelegateMarker>>,
6215 fidl::encoding::DefaultFuchsiaResourceDialect,
6216 >,
6217 >
6218 fidl::encoding::Encode<
6219 AccessSetPairingDelegateRequest,
6220 fidl::encoding::DefaultFuchsiaResourceDialect,
6221 > for (T0, T1, T2)
6222 {
6223 #[inline]
6224 unsafe fn encode(
6225 self,
6226 encoder: &mut fidl::encoding::Encoder<
6227 '_,
6228 fidl::encoding::DefaultFuchsiaResourceDialect,
6229 >,
6230 offset: usize,
6231 depth: fidl::encoding::Depth,
6232 ) -> fidl::Result<()> {
6233 encoder.debug_check_bounds::<AccessSetPairingDelegateRequest>(offset);
6234 self.0.encode(encoder, offset + 0, depth)?;
6238 self.1.encode(encoder, offset + 4, depth)?;
6239 self.2.encode(encoder, offset + 8, depth)?;
6240 Ok(())
6241 }
6242 }
6243
6244 impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
6245 for AccessSetPairingDelegateRequest
6246 {
6247 #[inline(always)]
6248 fn new_empty() -> Self {
6249 Self {
6250 input: fidl::new_empty!(
6251 InputCapability,
6252 fidl::encoding::DefaultFuchsiaResourceDialect
6253 ),
6254 output: fidl::new_empty!(
6255 OutputCapability,
6256 fidl::encoding::DefaultFuchsiaResourceDialect
6257 ),
6258 delegate: fidl::new_empty!(
6259 fidl::encoding::Endpoint<fidl::endpoints::ClientEnd<PairingDelegateMarker>>,
6260 fidl::encoding::DefaultFuchsiaResourceDialect
6261 ),
6262 }
6263 }
6264
6265 #[inline]
6266 unsafe fn decode(
6267 &mut self,
6268 decoder: &mut fidl::encoding::Decoder<
6269 '_,
6270 fidl::encoding::DefaultFuchsiaResourceDialect,
6271 >,
6272 offset: usize,
6273 _depth: fidl::encoding::Depth,
6274 ) -> fidl::Result<()> {
6275 decoder.debug_check_bounds::<Self>(offset);
6276 fidl::decode!(
6278 InputCapability,
6279 fidl::encoding::DefaultFuchsiaResourceDialect,
6280 &mut self.input,
6281 decoder,
6282 offset + 0,
6283 _depth
6284 )?;
6285 fidl::decode!(
6286 OutputCapability,
6287 fidl::encoding::DefaultFuchsiaResourceDialect,
6288 &mut self.output,
6289 decoder,
6290 offset + 4,
6291 _depth
6292 )?;
6293 fidl::decode!(
6294 fidl::encoding::Endpoint<fidl::endpoints::ClientEnd<PairingDelegateMarker>>,
6295 fidl::encoding::DefaultFuchsiaResourceDialect,
6296 &mut self.delegate,
6297 decoder,
6298 offset + 8,
6299 _depth
6300 )?;
6301 Ok(())
6302 }
6303 }
6304
6305 impl fidl::encoding::ResourceTypeMarker for AccessStartDiscoveryRequest {
6306 type Borrowed<'a> = &'a mut Self;
6307 fn take_or_borrow<'a>(
6308 value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
6309 ) -> Self::Borrowed<'a> {
6310 value
6311 }
6312 }
6313
6314 unsafe impl fidl::encoding::TypeMarker for AccessStartDiscoveryRequest {
6315 type Owned = Self;
6316
6317 #[inline(always)]
6318 fn inline_align(_context: fidl::encoding::Context) -> usize {
6319 4
6320 }
6321
6322 #[inline(always)]
6323 fn inline_size(_context: fidl::encoding::Context) -> usize {
6324 4
6325 }
6326 }
6327
6328 unsafe impl
6329 fidl::encoding::Encode<
6330 AccessStartDiscoveryRequest,
6331 fidl::encoding::DefaultFuchsiaResourceDialect,
6332 > for &mut AccessStartDiscoveryRequest
6333 {
6334 #[inline]
6335 unsafe fn encode(
6336 self,
6337 encoder: &mut fidl::encoding::Encoder<
6338 '_,
6339 fidl::encoding::DefaultFuchsiaResourceDialect,
6340 >,
6341 offset: usize,
6342 _depth: fidl::encoding::Depth,
6343 ) -> fidl::Result<()> {
6344 encoder.debug_check_bounds::<AccessStartDiscoveryRequest>(offset);
6345 fidl::encoding::Encode::<AccessStartDiscoveryRequest, fidl::encoding::DefaultFuchsiaResourceDialect>::encode(
6347 (
6348 <fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<ProcedureTokenMarker>> as fidl::encoding::ResourceTypeMarker>::take_or_borrow(&mut self.token),
6349 ),
6350 encoder, offset, _depth
6351 )
6352 }
6353 }
6354 unsafe impl<
6355 T0: fidl::encoding::Encode<
6356 fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<ProcedureTokenMarker>>,
6357 fidl::encoding::DefaultFuchsiaResourceDialect,
6358 >,
6359 >
6360 fidl::encoding::Encode<
6361 AccessStartDiscoveryRequest,
6362 fidl::encoding::DefaultFuchsiaResourceDialect,
6363 > for (T0,)
6364 {
6365 #[inline]
6366 unsafe fn encode(
6367 self,
6368 encoder: &mut fidl::encoding::Encoder<
6369 '_,
6370 fidl::encoding::DefaultFuchsiaResourceDialect,
6371 >,
6372 offset: usize,
6373 depth: fidl::encoding::Depth,
6374 ) -> fidl::Result<()> {
6375 encoder.debug_check_bounds::<AccessStartDiscoveryRequest>(offset);
6376 self.0.encode(encoder, offset + 0, depth)?;
6380 Ok(())
6381 }
6382 }
6383
6384 impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
6385 for AccessStartDiscoveryRequest
6386 {
6387 #[inline(always)]
6388 fn new_empty() -> Self {
6389 Self {
6390 token: fidl::new_empty!(
6391 fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<ProcedureTokenMarker>>,
6392 fidl::encoding::DefaultFuchsiaResourceDialect
6393 ),
6394 }
6395 }
6396
6397 #[inline]
6398 unsafe fn decode(
6399 &mut self,
6400 decoder: &mut fidl::encoding::Decoder<
6401 '_,
6402 fidl::encoding::DefaultFuchsiaResourceDialect,
6403 >,
6404 offset: usize,
6405 _depth: fidl::encoding::Depth,
6406 ) -> fidl::Result<()> {
6407 decoder.debug_check_bounds::<Self>(offset);
6408 fidl::decode!(
6410 fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<ProcedureTokenMarker>>,
6411 fidl::encoding::DefaultFuchsiaResourceDialect,
6412 &mut self.token,
6413 decoder,
6414 offset + 0,
6415 _depth
6416 )?;
6417 Ok(())
6418 }
6419 }
6420
6421 impl fidl::encoding::ResourceTypeMarker for PairingSetDelegateRequest {
6422 type Borrowed<'a> = &'a mut Self;
6423 fn take_or_borrow<'a>(
6424 value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
6425 ) -> Self::Borrowed<'a> {
6426 value
6427 }
6428 }
6429
6430 unsafe impl fidl::encoding::TypeMarker for PairingSetDelegateRequest {
6431 type Owned = Self;
6432
6433 #[inline(always)]
6434 fn inline_align(_context: fidl::encoding::Context) -> usize {
6435 4
6436 }
6437
6438 #[inline(always)]
6439 fn inline_size(_context: fidl::encoding::Context) -> usize {
6440 12
6441 }
6442 }
6443
6444 unsafe impl
6445 fidl::encoding::Encode<
6446 PairingSetDelegateRequest,
6447 fidl::encoding::DefaultFuchsiaResourceDialect,
6448 > for &mut PairingSetDelegateRequest
6449 {
6450 #[inline]
6451 unsafe fn encode(
6452 self,
6453 encoder: &mut fidl::encoding::Encoder<
6454 '_,
6455 fidl::encoding::DefaultFuchsiaResourceDialect,
6456 >,
6457 offset: usize,
6458 _depth: fidl::encoding::Depth,
6459 ) -> fidl::Result<()> {
6460 encoder.debug_check_bounds::<PairingSetDelegateRequest>(offset);
6461 fidl::encoding::Encode::<PairingSetDelegateRequest, fidl::encoding::DefaultFuchsiaResourceDialect>::encode(
6463 (
6464 <InputCapability as fidl::encoding::ValueTypeMarker>::borrow(&self.input),
6465 <OutputCapability as fidl::encoding::ValueTypeMarker>::borrow(&self.output),
6466 <fidl::encoding::Endpoint<fidl::endpoints::ClientEnd<PairingDelegate2Marker>> as fidl::encoding::ResourceTypeMarker>::take_or_borrow(&mut self.delegate),
6467 ),
6468 encoder, offset, _depth
6469 )
6470 }
6471 }
6472 unsafe impl<
6473 T0: fidl::encoding::Encode<InputCapability, fidl::encoding::DefaultFuchsiaResourceDialect>,
6474 T1: fidl::encoding::Encode<OutputCapability, fidl::encoding::DefaultFuchsiaResourceDialect>,
6475 T2: fidl::encoding::Encode<
6476 fidl::encoding::Endpoint<fidl::endpoints::ClientEnd<PairingDelegate2Marker>>,
6477 fidl::encoding::DefaultFuchsiaResourceDialect,
6478 >,
6479 >
6480 fidl::encoding::Encode<
6481 PairingSetDelegateRequest,
6482 fidl::encoding::DefaultFuchsiaResourceDialect,
6483 > for (T0, T1, T2)
6484 {
6485 #[inline]
6486 unsafe fn encode(
6487 self,
6488 encoder: &mut fidl::encoding::Encoder<
6489 '_,
6490 fidl::encoding::DefaultFuchsiaResourceDialect,
6491 >,
6492 offset: usize,
6493 depth: fidl::encoding::Depth,
6494 ) -> fidl::Result<()> {
6495 encoder.debug_check_bounds::<PairingSetDelegateRequest>(offset);
6496 self.0.encode(encoder, offset + 0, depth)?;
6500 self.1.encode(encoder, offset + 4, depth)?;
6501 self.2.encode(encoder, offset + 8, depth)?;
6502 Ok(())
6503 }
6504 }
6505
6506 impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
6507 for PairingSetDelegateRequest
6508 {
6509 #[inline(always)]
6510 fn new_empty() -> Self {
6511 Self {
6512 input: fidl::new_empty!(
6513 InputCapability,
6514 fidl::encoding::DefaultFuchsiaResourceDialect
6515 ),
6516 output: fidl::new_empty!(
6517 OutputCapability,
6518 fidl::encoding::DefaultFuchsiaResourceDialect
6519 ),
6520 delegate: fidl::new_empty!(
6521 fidl::encoding::Endpoint<fidl::endpoints::ClientEnd<PairingDelegate2Marker>>,
6522 fidl::encoding::DefaultFuchsiaResourceDialect
6523 ),
6524 }
6525 }
6526
6527 #[inline]
6528 unsafe fn decode(
6529 &mut self,
6530 decoder: &mut fidl::encoding::Decoder<
6531 '_,
6532 fidl::encoding::DefaultFuchsiaResourceDialect,
6533 >,
6534 offset: usize,
6535 _depth: fidl::encoding::Depth,
6536 ) -> fidl::Result<()> {
6537 decoder.debug_check_bounds::<Self>(offset);
6538 fidl::decode!(
6540 InputCapability,
6541 fidl::encoding::DefaultFuchsiaResourceDialect,
6542 &mut self.input,
6543 decoder,
6544 offset + 0,
6545 _depth
6546 )?;
6547 fidl::decode!(
6548 OutputCapability,
6549 fidl::encoding::DefaultFuchsiaResourceDialect,
6550 &mut self.output,
6551 decoder,
6552 offset + 4,
6553 _depth
6554 )?;
6555 fidl::decode!(
6556 fidl::encoding::Endpoint<fidl::endpoints::ClientEnd<PairingDelegate2Marker>>,
6557 fidl::encoding::DefaultFuchsiaResourceDialect,
6558 &mut self.delegate,
6559 decoder,
6560 offset + 8,
6561 _depth
6562 )?;
6563 Ok(())
6564 }
6565 }
6566
6567 impl fidl::encoding::ResourceTypeMarker for PairingSetPairingDelegateRequest {
6568 type Borrowed<'a> = &'a mut Self;
6569 fn take_or_borrow<'a>(
6570 value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
6571 ) -> Self::Borrowed<'a> {
6572 value
6573 }
6574 }
6575
6576 unsafe impl fidl::encoding::TypeMarker for PairingSetPairingDelegateRequest {
6577 type Owned = Self;
6578
6579 #[inline(always)]
6580 fn inline_align(_context: fidl::encoding::Context) -> usize {
6581 4
6582 }
6583
6584 #[inline(always)]
6585 fn inline_size(_context: fidl::encoding::Context) -> usize {
6586 12
6587 }
6588 }
6589
6590 unsafe impl
6591 fidl::encoding::Encode<
6592 PairingSetPairingDelegateRequest,
6593 fidl::encoding::DefaultFuchsiaResourceDialect,
6594 > for &mut PairingSetPairingDelegateRequest
6595 {
6596 #[inline]
6597 unsafe fn encode(
6598 self,
6599 encoder: &mut fidl::encoding::Encoder<
6600 '_,
6601 fidl::encoding::DefaultFuchsiaResourceDialect,
6602 >,
6603 offset: usize,
6604 _depth: fidl::encoding::Depth,
6605 ) -> fidl::Result<()> {
6606 encoder.debug_check_bounds::<PairingSetPairingDelegateRequest>(offset);
6607 fidl::encoding::Encode::<PairingSetPairingDelegateRequest, fidl::encoding::DefaultFuchsiaResourceDialect>::encode(
6609 (
6610 <InputCapability as fidl::encoding::ValueTypeMarker>::borrow(&self.input),
6611 <OutputCapability as fidl::encoding::ValueTypeMarker>::borrow(&self.output),
6612 <fidl::encoding::Endpoint<fidl::endpoints::ClientEnd<PairingDelegateMarker>> as fidl::encoding::ResourceTypeMarker>::take_or_borrow(&mut self.delegate),
6613 ),
6614 encoder, offset, _depth
6615 )
6616 }
6617 }
6618 unsafe impl<
6619 T0: fidl::encoding::Encode<InputCapability, fidl::encoding::DefaultFuchsiaResourceDialect>,
6620 T1: fidl::encoding::Encode<OutputCapability, fidl::encoding::DefaultFuchsiaResourceDialect>,
6621 T2: fidl::encoding::Encode<
6622 fidl::encoding::Endpoint<fidl::endpoints::ClientEnd<PairingDelegateMarker>>,
6623 fidl::encoding::DefaultFuchsiaResourceDialect,
6624 >,
6625 >
6626 fidl::encoding::Encode<
6627 PairingSetPairingDelegateRequest,
6628 fidl::encoding::DefaultFuchsiaResourceDialect,
6629 > for (T0, T1, T2)
6630 {
6631 #[inline]
6632 unsafe fn encode(
6633 self,
6634 encoder: &mut fidl::encoding::Encoder<
6635 '_,
6636 fidl::encoding::DefaultFuchsiaResourceDialect,
6637 >,
6638 offset: usize,
6639 depth: fidl::encoding::Depth,
6640 ) -> fidl::Result<()> {
6641 encoder.debug_check_bounds::<PairingSetPairingDelegateRequest>(offset);
6642 self.0.encode(encoder, offset + 0, depth)?;
6646 self.1.encode(encoder, offset + 4, depth)?;
6647 self.2.encode(encoder, offset + 8, depth)?;
6648 Ok(())
6649 }
6650 }
6651
6652 impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
6653 for PairingSetPairingDelegateRequest
6654 {
6655 #[inline(always)]
6656 fn new_empty() -> Self {
6657 Self {
6658 input: fidl::new_empty!(
6659 InputCapability,
6660 fidl::encoding::DefaultFuchsiaResourceDialect
6661 ),
6662 output: fidl::new_empty!(
6663 OutputCapability,
6664 fidl::encoding::DefaultFuchsiaResourceDialect
6665 ),
6666 delegate: fidl::new_empty!(
6667 fidl::encoding::Endpoint<fidl::endpoints::ClientEnd<PairingDelegateMarker>>,
6668 fidl::encoding::DefaultFuchsiaResourceDialect
6669 ),
6670 }
6671 }
6672
6673 #[inline]
6674 unsafe fn decode(
6675 &mut self,
6676 decoder: &mut fidl::encoding::Decoder<
6677 '_,
6678 fidl::encoding::DefaultFuchsiaResourceDialect,
6679 >,
6680 offset: usize,
6681 _depth: fidl::encoding::Depth,
6682 ) -> fidl::Result<()> {
6683 decoder.debug_check_bounds::<Self>(offset);
6684 fidl::decode!(
6686 InputCapability,
6687 fidl::encoding::DefaultFuchsiaResourceDialect,
6688 &mut self.input,
6689 decoder,
6690 offset + 0,
6691 _depth
6692 )?;
6693 fidl::decode!(
6694 OutputCapability,
6695 fidl::encoding::DefaultFuchsiaResourceDialect,
6696 &mut self.output,
6697 decoder,
6698 offset + 4,
6699 _depth
6700 )?;
6701 fidl::decode!(
6702 fidl::encoding::Endpoint<fidl::endpoints::ClientEnd<PairingDelegateMarker>>,
6703 fidl::encoding::DefaultFuchsiaResourceDialect,
6704 &mut self.delegate,
6705 decoder,
6706 offset + 8,
6707 _depth
6708 )?;
6709 Ok(())
6710 }
6711 }
6712
6713 impl PairingDelegate2StartRequestRequest {
6714 #[inline(always)]
6715 fn max_ordinal_present(&self) -> u64 {
6716 if let Some(_) = self.request {
6717 return 3;
6718 }
6719 if let Some(_) = self.info {
6720 return 2;
6721 }
6722 if let Some(_) = self.peer {
6723 return 1;
6724 }
6725 0
6726 }
6727 }
6728
6729 impl fidl::encoding::ResourceTypeMarker for PairingDelegate2StartRequestRequest {
6730 type Borrowed<'a> = &'a mut Self;
6731 fn take_or_borrow<'a>(
6732 value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
6733 ) -> Self::Borrowed<'a> {
6734 value
6735 }
6736 }
6737
6738 unsafe impl fidl::encoding::TypeMarker for PairingDelegate2StartRequestRequest {
6739 type Owned = Self;
6740
6741 #[inline(always)]
6742 fn inline_align(_context: fidl::encoding::Context) -> usize {
6743 8
6744 }
6745
6746 #[inline(always)]
6747 fn inline_size(_context: fidl::encoding::Context) -> usize {
6748 16
6749 }
6750 }
6751
6752 unsafe impl
6753 fidl::encoding::Encode<
6754 PairingDelegate2StartRequestRequest,
6755 fidl::encoding::DefaultFuchsiaResourceDialect,
6756 > for &mut PairingDelegate2StartRequestRequest
6757 {
6758 unsafe fn encode(
6759 self,
6760 encoder: &mut fidl::encoding::Encoder<
6761 '_,
6762 fidl::encoding::DefaultFuchsiaResourceDialect,
6763 >,
6764 offset: usize,
6765 mut depth: fidl::encoding::Depth,
6766 ) -> fidl::Result<()> {
6767 encoder.debug_check_bounds::<PairingDelegate2StartRequestRequest>(offset);
6768 let max_ordinal: u64 = self.max_ordinal_present();
6770 encoder.write_num(max_ordinal, offset);
6771 encoder.write_num(fidl::encoding::ALLOC_PRESENT_U64, offset + 8);
6772 if max_ordinal == 0 {
6774 return Ok(());
6775 }
6776 depth.increment()?;
6777 let envelope_size = 8;
6778 let bytes_len = max_ordinal as usize * envelope_size;
6779 #[allow(unused_variables)]
6780 let offset = encoder.out_of_line_offset(bytes_len);
6781 let mut _prev_end_offset: usize = 0;
6782 if 1 > max_ordinal {
6783 return Ok(());
6784 }
6785
6786 let cur_offset: usize = (1 - 1) * envelope_size;
6789
6790 encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
6792
6793 fidl::encoding::encode_in_envelope_optional::<
6798 Peer,
6799 fidl::encoding::DefaultFuchsiaResourceDialect,
6800 >(
6801 self.peer.as_ref().map(<Peer as fidl::encoding::ValueTypeMarker>::borrow),
6802 encoder,
6803 offset + cur_offset,
6804 depth,
6805 )?;
6806
6807 _prev_end_offset = cur_offset + envelope_size;
6808 if 2 > max_ordinal {
6809 return Ok(());
6810 }
6811
6812 let cur_offset: usize = (2 - 1) * envelope_size;
6815
6816 encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
6818
6819 fidl::encoding::encode_in_envelope_optional::<
6824 PairingProperties,
6825 fidl::encoding::DefaultFuchsiaResourceDialect,
6826 >(
6827 self.info
6828 .as_ref()
6829 .map(<PairingProperties as fidl::encoding::ValueTypeMarker>::borrow),
6830 encoder,
6831 offset + cur_offset,
6832 depth,
6833 )?;
6834
6835 _prev_end_offset = cur_offset + envelope_size;
6836 if 3 > max_ordinal {
6837 return Ok(());
6838 }
6839
6840 let cur_offset: usize = (3 - 1) * envelope_size;
6843
6844 encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
6846
6847 fidl::encoding::encode_in_envelope_optional::<fidl::encoding::Endpoint<fidl::endpoints::ClientEnd<PairingRequestMarker>>, fidl::encoding::DefaultFuchsiaResourceDialect>(
6852 self.request.as_mut().map(<fidl::encoding::Endpoint<fidl::endpoints::ClientEnd<PairingRequestMarker>> as fidl::encoding::ResourceTypeMarker>::take_or_borrow),
6853 encoder, offset + cur_offset, depth
6854 )?;
6855
6856 _prev_end_offset = cur_offset + envelope_size;
6857
6858 Ok(())
6859 }
6860 }
6861
6862 impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
6863 for PairingDelegate2StartRequestRequest
6864 {
6865 #[inline(always)]
6866 fn new_empty() -> Self {
6867 Self::default()
6868 }
6869
6870 unsafe fn decode(
6871 &mut self,
6872 decoder: &mut fidl::encoding::Decoder<
6873 '_,
6874 fidl::encoding::DefaultFuchsiaResourceDialect,
6875 >,
6876 offset: usize,
6877 mut depth: fidl::encoding::Depth,
6878 ) -> fidl::Result<()> {
6879 decoder.debug_check_bounds::<Self>(offset);
6880 let len = match fidl::encoding::decode_vector_header(decoder, offset)? {
6881 None => return Err(fidl::Error::NotNullable),
6882 Some(len) => len,
6883 };
6884 if len == 0 {
6886 return Ok(());
6887 };
6888 depth.increment()?;
6889 let envelope_size = 8;
6890 let bytes_len = len * envelope_size;
6891 let offset = decoder.out_of_line_offset(bytes_len)?;
6892 let mut _next_ordinal_to_read = 0;
6894 let mut next_offset = offset;
6895 let end_offset = offset + bytes_len;
6896 _next_ordinal_to_read += 1;
6897 if next_offset >= end_offset {
6898 return Ok(());
6899 }
6900
6901 while _next_ordinal_to_read < 1 {
6903 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
6904 _next_ordinal_to_read += 1;
6905 next_offset += envelope_size;
6906 }
6907
6908 let next_out_of_line = decoder.next_out_of_line();
6909 let handles_before = decoder.remaining_handles();
6910 if let Some((inlined, num_bytes, num_handles)) =
6911 fidl::encoding::decode_envelope_header(decoder, next_offset)?
6912 {
6913 let member_inline_size =
6914 <Peer as fidl::encoding::TypeMarker>::inline_size(decoder.context);
6915 if inlined != (member_inline_size <= 4) {
6916 return Err(fidl::Error::InvalidInlineBitInEnvelope);
6917 }
6918 let inner_offset;
6919 let mut inner_depth = depth.clone();
6920 if inlined {
6921 decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
6922 inner_offset = next_offset;
6923 } else {
6924 inner_offset = decoder.out_of_line_offset(member_inline_size)?;
6925 inner_depth.increment()?;
6926 }
6927 let val_ref = self.peer.get_or_insert_with(|| {
6928 fidl::new_empty!(Peer, fidl::encoding::DefaultFuchsiaResourceDialect)
6929 });
6930 fidl::decode!(
6931 Peer,
6932 fidl::encoding::DefaultFuchsiaResourceDialect,
6933 val_ref,
6934 decoder,
6935 inner_offset,
6936 inner_depth
6937 )?;
6938 if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
6939 {
6940 return Err(fidl::Error::InvalidNumBytesInEnvelope);
6941 }
6942 if handles_before != decoder.remaining_handles() + (num_handles as usize) {
6943 return Err(fidl::Error::InvalidNumHandlesInEnvelope);
6944 }
6945 }
6946
6947 next_offset += envelope_size;
6948 _next_ordinal_to_read += 1;
6949 if next_offset >= end_offset {
6950 return Ok(());
6951 }
6952
6953 while _next_ordinal_to_read < 2 {
6955 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
6956 _next_ordinal_to_read += 1;
6957 next_offset += envelope_size;
6958 }
6959
6960 let next_out_of_line = decoder.next_out_of_line();
6961 let handles_before = decoder.remaining_handles();
6962 if let Some((inlined, num_bytes, num_handles)) =
6963 fidl::encoding::decode_envelope_header(decoder, next_offset)?
6964 {
6965 let member_inline_size =
6966 <PairingProperties as fidl::encoding::TypeMarker>::inline_size(decoder.context);
6967 if inlined != (member_inline_size <= 4) {
6968 return Err(fidl::Error::InvalidInlineBitInEnvelope);
6969 }
6970 let inner_offset;
6971 let mut inner_depth = depth.clone();
6972 if inlined {
6973 decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
6974 inner_offset = next_offset;
6975 } else {
6976 inner_offset = decoder.out_of_line_offset(member_inline_size)?;
6977 inner_depth.increment()?;
6978 }
6979 let val_ref = self.info.get_or_insert_with(|| {
6980 fidl::new_empty!(
6981 PairingProperties,
6982 fidl::encoding::DefaultFuchsiaResourceDialect
6983 )
6984 });
6985 fidl::decode!(
6986 PairingProperties,
6987 fidl::encoding::DefaultFuchsiaResourceDialect,
6988 val_ref,
6989 decoder,
6990 inner_offset,
6991 inner_depth
6992 )?;
6993 if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
6994 {
6995 return Err(fidl::Error::InvalidNumBytesInEnvelope);
6996 }
6997 if handles_before != decoder.remaining_handles() + (num_handles as usize) {
6998 return Err(fidl::Error::InvalidNumHandlesInEnvelope);
6999 }
7000 }
7001
7002 next_offset += envelope_size;
7003 _next_ordinal_to_read += 1;
7004 if next_offset >= end_offset {
7005 return Ok(());
7006 }
7007
7008 while _next_ordinal_to_read < 3 {
7010 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
7011 _next_ordinal_to_read += 1;
7012 next_offset += envelope_size;
7013 }
7014
7015 let next_out_of_line = decoder.next_out_of_line();
7016 let handles_before = decoder.remaining_handles();
7017 if let Some((inlined, num_bytes, num_handles)) =
7018 fidl::encoding::decode_envelope_header(decoder, next_offset)?
7019 {
7020 let member_inline_size = <fidl::encoding::Endpoint<
7021 fidl::endpoints::ClientEnd<PairingRequestMarker>,
7022 > as fidl::encoding::TypeMarker>::inline_size(
7023 decoder.context
7024 );
7025 if inlined != (member_inline_size <= 4) {
7026 return Err(fidl::Error::InvalidInlineBitInEnvelope);
7027 }
7028 let inner_offset;
7029 let mut inner_depth = depth.clone();
7030 if inlined {
7031 decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
7032 inner_offset = next_offset;
7033 } else {
7034 inner_offset = decoder.out_of_line_offset(member_inline_size)?;
7035 inner_depth.increment()?;
7036 }
7037 let val_ref = self.request.get_or_insert_with(|| {
7038 fidl::new_empty!(
7039 fidl::encoding::Endpoint<fidl::endpoints::ClientEnd<PairingRequestMarker>>,
7040 fidl::encoding::DefaultFuchsiaResourceDialect
7041 )
7042 });
7043 fidl::decode!(
7044 fidl::encoding::Endpoint<fidl::endpoints::ClientEnd<PairingRequestMarker>>,
7045 fidl::encoding::DefaultFuchsiaResourceDialect,
7046 val_ref,
7047 decoder,
7048 inner_offset,
7049 inner_depth
7050 )?;
7051 if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
7052 {
7053 return Err(fidl::Error::InvalidNumBytesInEnvelope);
7054 }
7055 if handles_before != decoder.remaining_handles() + (num_handles as usize) {
7056 return Err(fidl::Error::InvalidNumHandlesInEnvelope);
7057 }
7058 }
7059
7060 next_offset += envelope_size;
7061
7062 while next_offset < end_offset {
7064 _next_ordinal_to_read += 1;
7065 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
7066 next_offset += envelope_size;
7067 }
7068
7069 Ok(())
7070 }
7071 }
7072}