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_hardware_bluetooth_common::*;
11use futures::future::{self, MaybeDone, TryFutureExt};
12use zx_status;
13
14#[derive(Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
15pub struct HciOpenAclDataChannelRequest {
16 pub channel: fidl::Channel,
17}
18
19impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect>
20 for HciOpenAclDataChannelRequest
21{
22}
23
24#[derive(Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
25pub struct HciOpenCommandChannelRequest {
26 pub channel: fidl::Channel,
27}
28
29impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect>
30 for HciOpenCommandChannelRequest
31{
32}
33
34#[derive(Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
35pub struct HciOpenIsoDataChannelRequest {
36 pub channel: fidl::Channel,
37}
38
39impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect>
40 for HciOpenIsoDataChannelRequest
41{
42}
43
44#[derive(Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
45pub struct HciOpenScoDataChannelRequest {
46 pub channel: fidl::Channel,
47}
48
49impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect>
50 for HciOpenScoDataChannelRequest
51{
52}
53
54#[derive(Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
55pub struct HciOpenSnoopChannelRequest {
56 pub channel: fidl::Channel,
57}
58
59impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect>
60 for HciOpenSnoopChannelRequest
61{
62}
63
64#[derive(Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
65pub struct VendorOpenHciTransportResponse {
66 pub channel: fidl::endpoints::ClientEnd<HciTransportMarker>,
67}
68
69impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect>
70 for VendorOpenHciTransportResponse
71{
72}
73
74#[derive(Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
75pub struct VendorOpenHciResponse {
76 pub channel: fidl::endpoints::ClientEnd<HciMarker>,
77}
78
79impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect> for VendorOpenHciResponse {}
80
81#[derive(Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
82pub struct VendorOpenSnoopResponse {
83 pub channel: fidl::endpoints::ClientEnd<SnoopMarker>,
84}
85
86impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect> for VendorOpenSnoopResponse {}
87
88#[derive(Debug, Default, PartialEq)]
89pub struct HciTransportConfigureScoRequest {
90 pub coding_format: Option<ScoCodingFormat>,
92 pub encoding: Option<ScoEncoding>,
94 pub sample_rate: Option<ScoSampleRate>,
96 pub connection: Option<fidl::endpoints::ServerEnd<ScoConnectionMarker>>,
98 #[doc(hidden)]
99 pub __source_breaking: fidl::marker::SourceBreaking,
100}
101
102impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect>
103 for HciTransportConfigureScoRequest
104{
105}
106
107#[derive(Debug, Default, PartialEq)]
109pub struct PeerParameters {
110 pub address: Option<fidl_fuchsia_bluetooth::Address>,
112 pub connectable: Option<bool>,
115 pub channel: Option<fidl::endpoints::ServerEnd<PeerMarker>>,
117 #[doc(hidden)]
118 pub __source_breaking: fidl::marker::SourceBreaking,
119}
120
121impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect> for PeerParameters {}
122
123#[derive(Debug, Default, PartialEq)]
124pub struct VirtualControllerCreateLoopbackDeviceRequest {
125 pub uart_channel: Option<fidl::Channel>,
126 #[doc(hidden)]
127 pub __source_breaking: fidl::marker::SourceBreaking,
128}
129
130impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect>
131 for VirtualControllerCreateLoopbackDeviceRequest
132{
133}
134
135#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
136pub struct EmulatorMarker;
137
138impl fidl::endpoints::ProtocolMarker for EmulatorMarker {
139 type Proxy = EmulatorProxy;
140 type RequestStream = EmulatorRequestStream;
141 #[cfg(target_os = "fuchsia")]
142 type SynchronousProxy = EmulatorSynchronousProxy;
143
144 const DEBUG_NAME: &'static str = "fuchsia.hardware.bluetooth.Emulator";
145}
146impl fidl::endpoints::DiscoverableProtocolMarker for EmulatorMarker {}
147pub type EmulatorPublishResult = Result<(), EmulatorError>;
148pub type EmulatorAddLowEnergyPeerResult = Result<(), EmulatorPeerError>;
149pub type EmulatorAddBredrPeerResult = Result<(), EmulatorPeerError>;
150
151pub trait EmulatorProxyInterface: Send + Sync {
152 type PublishResponseFut: std::future::Future<Output = Result<EmulatorPublishResult, fidl::Error>>
153 + Send;
154 fn r#publish(&self, payload: &EmulatorSettings) -> Self::PublishResponseFut;
155 type AddLowEnergyPeerResponseFut: std::future::Future<Output = Result<EmulatorAddLowEnergyPeerResult, fidl::Error>>
156 + Send;
157 fn r#add_low_energy_peer(&self, payload: PeerParameters) -> Self::AddLowEnergyPeerResponseFut;
158 type AddBredrPeerResponseFut: std::future::Future<Output = Result<EmulatorAddBredrPeerResult, fidl::Error>>
159 + Send;
160 fn r#add_bredr_peer(&self, payload: PeerParameters) -> Self::AddBredrPeerResponseFut;
161 type WatchControllerParametersResponseFut: std::future::Future<Output = Result<ControllerParameters, fidl::Error>>
162 + Send;
163 fn r#watch_controller_parameters(&self) -> Self::WatchControllerParametersResponseFut;
164 type WatchLeScanStatesResponseFut: std::future::Future<Output = Result<Vec<LeScanState>, fidl::Error>>
165 + Send;
166 fn r#watch_le_scan_states(&self) -> Self::WatchLeScanStatesResponseFut;
167 type WatchLegacyAdvertisingStatesResponseFut: std::future::Future<Output = Result<Vec<LegacyAdvertisingState>, fidl::Error>>
168 + Send;
169 fn r#watch_legacy_advertising_states(&self) -> Self::WatchLegacyAdvertisingStatesResponseFut;
170}
171#[derive(Debug)]
172#[cfg(target_os = "fuchsia")]
173pub struct EmulatorSynchronousProxy {
174 client: fidl::client::sync::Client,
175}
176
177#[cfg(target_os = "fuchsia")]
178impl fidl::endpoints::SynchronousProxy for EmulatorSynchronousProxy {
179 type Proxy = EmulatorProxy;
180 type Protocol = EmulatorMarker;
181
182 fn from_channel(inner: fidl::Channel) -> Self {
183 Self::new(inner)
184 }
185
186 fn into_channel(self) -> fidl::Channel {
187 self.client.into_channel()
188 }
189
190 fn as_channel(&self) -> &fidl::Channel {
191 self.client.as_channel()
192 }
193}
194
195#[cfg(target_os = "fuchsia")]
196impl EmulatorSynchronousProxy {
197 pub fn new(channel: fidl::Channel) -> Self {
198 let protocol_name = <EmulatorMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
199 Self { client: fidl::client::sync::Client::new(channel, protocol_name) }
200 }
201
202 pub fn into_channel(self) -> fidl::Channel {
203 self.client.into_channel()
204 }
205
206 pub fn wait_for_event(
209 &self,
210 deadline: zx::MonotonicInstant,
211 ) -> Result<EmulatorEvent, fidl::Error> {
212 EmulatorEvent::decode(self.client.wait_for_event(deadline)?)
213 }
214
215 pub fn r#publish(
219 &self,
220 mut payload: &EmulatorSettings,
221 ___deadline: zx::MonotonicInstant,
222 ) -> Result<EmulatorPublishResult, fidl::Error> {
223 let _response = self.client.send_query::<
224 EmulatorSettings,
225 fidl::encoding::FlexibleResultType<fidl::encoding::EmptyStruct, EmulatorError>,
226 >(
227 payload,
228 0x5b8aeb2ece853c39,
229 fidl::encoding::DynamicFlags::FLEXIBLE,
230 ___deadline,
231 )?
232 .into_result::<EmulatorMarker>("publish")?;
233 Ok(_response.map(|x| x))
234 }
235
236 pub fn r#add_low_energy_peer(
249 &self,
250 mut payload: PeerParameters,
251 ___deadline: zx::MonotonicInstant,
252 ) -> Result<EmulatorAddLowEnergyPeerResult, fidl::Error> {
253 let _response = self.client.send_query::<
254 PeerParameters,
255 fidl::encoding::FlexibleResultType<fidl::encoding::EmptyStruct, EmulatorPeerError>,
256 >(
257 &mut payload,
258 0x4e1fb7adbebc6946,
259 fidl::encoding::DynamicFlags::FLEXIBLE,
260 ___deadline,
261 )?
262 .into_result::<EmulatorMarker>("add_low_energy_peer")?;
263 Ok(_response.map(|x| x))
264 }
265
266 pub fn r#add_bredr_peer(
279 &self,
280 mut payload: PeerParameters,
281 ___deadline: zx::MonotonicInstant,
282 ) -> Result<EmulatorAddBredrPeerResult, fidl::Error> {
283 let _response = self.client.send_query::<
284 PeerParameters,
285 fidl::encoding::FlexibleResultType<fidl::encoding::EmptyStruct, EmulatorPeerError>,
286 >(
287 &mut payload,
288 0x6d15989a0373e07,
289 fidl::encoding::DynamicFlags::FLEXIBLE,
290 ___deadline,
291 )?
292 .into_result::<EmulatorMarker>("add_bredr_peer")?;
293 Ok(_response.map(|x| x))
294 }
295
296 pub fn r#watch_controller_parameters(
299 &self,
300 ___deadline: zx::MonotonicInstant,
301 ) -> Result<ControllerParameters, fidl::Error> {
302 let _response = self.client.send_query::<
303 fidl::encoding::EmptyPayload,
304 fidl::encoding::FlexibleType<ControllerParameters>,
305 >(
306 (),
307 0x6ed7a918b5800270,
308 fidl::encoding::DynamicFlags::FLEXIBLE,
309 ___deadline,
310 )?
311 .into_result::<EmulatorMarker>("watch_controller_parameters")?;
312 Ok(_response)
313 }
314
315 pub fn r#watch_le_scan_states(
322 &self,
323 ___deadline: zx::MonotonicInstant,
324 ) -> Result<Vec<LeScanState>, fidl::Error> {
325 let _response = self.client.send_query::<
326 fidl::encoding::EmptyPayload,
327 fidl::encoding::FlexibleType<EmulatorWatchLeScanStatesResponse>,
328 >(
329 (),
330 0x10e6c845831f3b4a,
331 fidl::encoding::DynamicFlags::FLEXIBLE,
332 ___deadline,
333 )?
334 .into_result::<EmulatorMarker>("watch_le_scan_states")?;
335 Ok(_response.states)
336 }
337
338 pub fn r#watch_legacy_advertising_states(
345 &self,
346 ___deadline: zx::MonotonicInstant,
347 ) -> Result<Vec<LegacyAdvertisingState>, fidl::Error> {
348 let _response = self.client.send_query::<
349 fidl::encoding::EmptyPayload,
350 fidl::encoding::FlexibleType<EmulatorWatchLegacyAdvertisingStatesResponse>,
351 >(
352 (),
353 0x7067acbe275d0219,
354 fidl::encoding::DynamicFlags::FLEXIBLE,
355 ___deadline,
356 )?
357 .into_result::<EmulatorMarker>("watch_legacy_advertising_states")?;
358 Ok(_response.states)
359 }
360}
361
362#[cfg(target_os = "fuchsia")]
363impl From<EmulatorSynchronousProxy> for zx::Handle {
364 fn from(value: EmulatorSynchronousProxy) -> Self {
365 value.into_channel().into()
366 }
367}
368
369#[cfg(target_os = "fuchsia")]
370impl From<fidl::Channel> for EmulatorSynchronousProxy {
371 fn from(value: fidl::Channel) -> Self {
372 Self::new(value)
373 }
374}
375
376#[derive(Debug, Clone)]
377pub struct EmulatorProxy {
378 client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
379}
380
381impl fidl::endpoints::Proxy for EmulatorProxy {
382 type Protocol = EmulatorMarker;
383
384 fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
385 Self::new(inner)
386 }
387
388 fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
389 self.client.into_channel().map_err(|client| Self { client })
390 }
391
392 fn as_channel(&self) -> &::fidl::AsyncChannel {
393 self.client.as_channel()
394 }
395}
396
397impl EmulatorProxy {
398 pub fn new(channel: ::fidl::AsyncChannel) -> Self {
400 let protocol_name = <EmulatorMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
401 Self { client: fidl::client::Client::new(channel, protocol_name) }
402 }
403
404 pub fn take_event_stream(&self) -> EmulatorEventStream {
410 EmulatorEventStream { event_receiver: self.client.take_event_receiver() }
411 }
412
413 pub fn r#publish(
417 &self,
418 mut payload: &EmulatorSettings,
419 ) -> fidl::client::QueryResponseFut<
420 EmulatorPublishResult,
421 fidl::encoding::DefaultFuchsiaResourceDialect,
422 > {
423 EmulatorProxyInterface::r#publish(self, payload)
424 }
425
426 pub fn r#add_low_energy_peer(
439 &self,
440 mut payload: PeerParameters,
441 ) -> fidl::client::QueryResponseFut<
442 EmulatorAddLowEnergyPeerResult,
443 fidl::encoding::DefaultFuchsiaResourceDialect,
444 > {
445 EmulatorProxyInterface::r#add_low_energy_peer(self, payload)
446 }
447
448 pub fn r#add_bredr_peer(
461 &self,
462 mut payload: PeerParameters,
463 ) -> fidl::client::QueryResponseFut<
464 EmulatorAddBredrPeerResult,
465 fidl::encoding::DefaultFuchsiaResourceDialect,
466 > {
467 EmulatorProxyInterface::r#add_bredr_peer(self, payload)
468 }
469
470 pub fn r#watch_controller_parameters(
473 &self,
474 ) -> fidl::client::QueryResponseFut<
475 ControllerParameters,
476 fidl::encoding::DefaultFuchsiaResourceDialect,
477 > {
478 EmulatorProxyInterface::r#watch_controller_parameters(self)
479 }
480
481 pub fn r#watch_le_scan_states(
488 &self,
489 ) -> fidl::client::QueryResponseFut<
490 Vec<LeScanState>,
491 fidl::encoding::DefaultFuchsiaResourceDialect,
492 > {
493 EmulatorProxyInterface::r#watch_le_scan_states(self)
494 }
495
496 pub fn r#watch_legacy_advertising_states(
503 &self,
504 ) -> fidl::client::QueryResponseFut<
505 Vec<LegacyAdvertisingState>,
506 fidl::encoding::DefaultFuchsiaResourceDialect,
507 > {
508 EmulatorProxyInterface::r#watch_legacy_advertising_states(self)
509 }
510}
511
512impl EmulatorProxyInterface for EmulatorProxy {
513 type PublishResponseFut = fidl::client::QueryResponseFut<
514 EmulatorPublishResult,
515 fidl::encoding::DefaultFuchsiaResourceDialect,
516 >;
517 fn r#publish(&self, mut payload: &EmulatorSettings) -> Self::PublishResponseFut {
518 fn _decode(
519 mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
520 ) -> Result<EmulatorPublishResult, fidl::Error> {
521 let _response = fidl::client::decode_transaction_body::<
522 fidl::encoding::FlexibleResultType<fidl::encoding::EmptyStruct, EmulatorError>,
523 fidl::encoding::DefaultFuchsiaResourceDialect,
524 0x5b8aeb2ece853c39,
525 >(_buf?)?
526 .into_result::<EmulatorMarker>("publish")?;
527 Ok(_response.map(|x| x))
528 }
529 self.client.send_query_and_decode::<EmulatorSettings, EmulatorPublishResult>(
530 payload,
531 0x5b8aeb2ece853c39,
532 fidl::encoding::DynamicFlags::FLEXIBLE,
533 _decode,
534 )
535 }
536
537 type AddLowEnergyPeerResponseFut = fidl::client::QueryResponseFut<
538 EmulatorAddLowEnergyPeerResult,
539 fidl::encoding::DefaultFuchsiaResourceDialect,
540 >;
541 fn r#add_low_energy_peer(
542 &self,
543 mut payload: PeerParameters,
544 ) -> Self::AddLowEnergyPeerResponseFut {
545 fn _decode(
546 mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
547 ) -> Result<EmulatorAddLowEnergyPeerResult, fidl::Error> {
548 let _response = fidl::client::decode_transaction_body::<
549 fidl::encoding::FlexibleResultType<fidl::encoding::EmptyStruct, EmulatorPeerError>,
550 fidl::encoding::DefaultFuchsiaResourceDialect,
551 0x4e1fb7adbebc6946,
552 >(_buf?)?
553 .into_result::<EmulatorMarker>("add_low_energy_peer")?;
554 Ok(_response.map(|x| x))
555 }
556 self.client.send_query_and_decode::<PeerParameters, EmulatorAddLowEnergyPeerResult>(
557 &mut payload,
558 0x4e1fb7adbebc6946,
559 fidl::encoding::DynamicFlags::FLEXIBLE,
560 _decode,
561 )
562 }
563
564 type AddBredrPeerResponseFut = fidl::client::QueryResponseFut<
565 EmulatorAddBredrPeerResult,
566 fidl::encoding::DefaultFuchsiaResourceDialect,
567 >;
568 fn r#add_bredr_peer(&self, mut payload: PeerParameters) -> Self::AddBredrPeerResponseFut {
569 fn _decode(
570 mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
571 ) -> Result<EmulatorAddBredrPeerResult, fidl::Error> {
572 let _response = fidl::client::decode_transaction_body::<
573 fidl::encoding::FlexibleResultType<fidl::encoding::EmptyStruct, EmulatorPeerError>,
574 fidl::encoding::DefaultFuchsiaResourceDialect,
575 0x6d15989a0373e07,
576 >(_buf?)?
577 .into_result::<EmulatorMarker>("add_bredr_peer")?;
578 Ok(_response.map(|x| x))
579 }
580 self.client.send_query_and_decode::<PeerParameters, EmulatorAddBredrPeerResult>(
581 &mut payload,
582 0x6d15989a0373e07,
583 fidl::encoding::DynamicFlags::FLEXIBLE,
584 _decode,
585 )
586 }
587
588 type WatchControllerParametersResponseFut = fidl::client::QueryResponseFut<
589 ControllerParameters,
590 fidl::encoding::DefaultFuchsiaResourceDialect,
591 >;
592 fn r#watch_controller_parameters(&self) -> Self::WatchControllerParametersResponseFut {
593 fn _decode(
594 mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
595 ) -> Result<ControllerParameters, fidl::Error> {
596 let _response = fidl::client::decode_transaction_body::<
597 fidl::encoding::FlexibleType<ControllerParameters>,
598 fidl::encoding::DefaultFuchsiaResourceDialect,
599 0x6ed7a918b5800270,
600 >(_buf?)?
601 .into_result::<EmulatorMarker>("watch_controller_parameters")?;
602 Ok(_response)
603 }
604 self.client.send_query_and_decode::<fidl::encoding::EmptyPayload, ControllerParameters>(
605 (),
606 0x6ed7a918b5800270,
607 fidl::encoding::DynamicFlags::FLEXIBLE,
608 _decode,
609 )
610 }
611
612 type WatchLeScanStatesResponseFut = fidl::client::QueryResponseFut<
613 Vec<LeScanState>,
614 fidl::encoding::DefaultFuchsiaResourceDialect,
615 >;
616 fn r#watch_le_scan_states(&self) -> Self::WatchLeScanStatesResponseFut {
617 fn _decode(
618 mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
619 ) -> Result<Vec<LeScanState>, fidl::Error> {
620 let _response = fidl::client::decode_transaction_body::<
621 fidl::encoding::FlexibleType<EmulatorWatchLeScanStatesResponse>,
622 fidl::encoding::DefaultFuchsiaResourceDialect,
623 0x10e6c845831f3b4a,
624 >(_buf?)?
625 .into_result::<EmulatorMarker>("watch_le_scan_states")?;
626 Ok(_response.states)
627 }
628 self.client.send_query_and_decode::<fidl::encoding::EmptyPayload, Vec<LeScanState>>(
629 (),
630 0x10e6c845831f3b4a,
631 fidl::encoding::DynamicFlags::FLEXIBLE,
632 _decode,
633 )
634 }
635
636 type WatchLegacyAdvertisingStatesResponseFut = fidl::client::QueryResponseFut<
637 Vec<LegacyAdvertisingState>,
638 fidl::encoding::DefaultFuchsiaResourceDialect,
639 >;
640 fn r#watch_legacy_advertising_states(&self) -> Self::WatchLegacyAdvertisingStatesResponseFut {
641 fn _decode(
642 mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
643 ) -> Result<Vec<LegacyAdvertisingState>, fidl::Error> {
644 let _response = fidl::client::decode_transaction_body::<
645 fidl::encoding::FlexibleType<EmulatorWatchLegacyAdvertisingStatesResponse>,
646 fidl::encoding::DefaultFuchsiaResourceDialect,
647 0x7067acbe275d0219,
648 >(_buf?)?
649 .into_result::<EmulatorMarker>("watch_legacy_advertising_states")?;
650 Ok(_response.states)
651 }
652 self.client
653 .send_query_and_decode::<fidl::encoding::EmptyPayload, Vec<LegacyAdvertisingState>>(
654 (),
655 0x7067acbe275d0219,
656 fidl::encoding::DynamicFlags::FLEXIBLE,
657 _decode,
658 )
659 }
660}
661
662pub struct EmulatorEventStream {
663 event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
664}
665
666impl std::marker::Unpin for EmulatorEventStream {}
667
668impl futures::stream::FusedStream for EmulatorEventStream {
669 fn is_terminated(&self) -> bool {
670 self.event_receiver.is_terminated()
671 }
672}
673
674impl futures::Stream for EmulatorEventStream {
675 type Item = Result<EmulatorEvent, fidl::Error>;
676
677 fn poll_next(
678 mut self: std::pin::Pin<&mut Self>,
679 cx: &mut std::task::Context<'_>,
680 ) -> std::task::Poll<Option<Self::Item>> {
681 match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
682 &mut self.event_receiver,
683 cx
684 )?) {
685 Some(buf) => std::task::Poll::Ready(Some(EmulatorEvent::decode(buf))),
686 None => std::task::Poll::Ready(None),
687 }
688 }
689}
690
691#[derive(Debug)]
692pub enum EmulatorEvent {
693 #[non_exhaustive]
694 _UnknownEvent {
695 ordinal: u64,
697 },
698}
699
700impl EmulatorEvent {
701 fn decode(
703 mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
704 ) -> Result<EmulatorEvent, fidl::Error> {
705 let (bytes, _handles) = buf.split_mut();
706 let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
707 debug_assert_eq!(tx_header.tx_id, 0);
708 match tx_header.ordinal {
709 _ if tx_header.dynamic_flags().contains(fidl::encoding::DynamicFlags::FLEXIBLE) => {
710 Ok(EmulatorEvent::_UnknownEvent { ordinal: tx_header.ordinal })
711 }
712 _ => Err(fidl::Error::UnknownOrdinal {
713 ordinal: tx_header.ordinal,
714 protocol_name: <EmulatorMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
715 }),
716 }
717 }
718}
719
720pub struct EmulatorRequestStream {
722 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
723 is_terminated: bool,
724}
725
726impl std::marker::Unpin for EmulatorRequestStream {}
727
728impl futures::stream::FusedStream for EmulatorRequestStream {
729 fn is_terminated(&self) -> bool {
730 self.is_terminated
731 }
732}
733
734impl fidl::endpoints::RequestStream for EmulatorRequestStream {
735 type Protocol = EmulatorMarker;
736 type ControlHandle = EmulatorControlHandle;
737
738 fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
739 Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
740 }
741
742 fn control_handle(&self) -> Self::ControlHandle {
743 EmulatorControlHandle { inner: self.inner.clone() }
744 }
745
746 fn into_inner(
747 self,
748 ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
749 {
750 (self.inner, self.is_terminated)
751 }
752
753 fn from_inner(
754 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
755 is_terminated: bool,
756 ) -> Self {
757 Self { inner, is_terminated }
758 }
759}
760
761impl futures::Stream for EmulatorRequestStream {
762 type Item = Result<EmulatorRequest, fidl::Error>;
763
764 fn poll_next(
765 mut self: std::pin::Pin<&mut Self>,
766 cx: &mut std::task::Context<'_>,
767 ) -> std::task::Poll<Option<Self::Item>> {
768 let this = &mut *self;
769 if this.inner.check_shutdown(cx) {
770 this.is_terminated = true;
771 return std::task::Poll::Ready(None);
772 }
773 if this.is_terminated {
774 panic!("polled EmulatorRequestStream after completion");
775 }
776 fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
777 |bytes, handles| {
778 match this.inner.channel().read_etc(cx, bytes, handles) {
779 std::task::Poll::Ready(Ok(())) => {}
780 std::task::Poll::Pending => return std::task::Poll::Pending,
781 std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
782 this.is_terminated = true;
783 return std::task::Poll::Ready(None);
784 }
785 std::task::Poll::Ready(Err(e)) => {
786 return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
787 e.into(),
788 ))))
789 }
790 }
791
792 let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
794
795 std::task::Poll::Ready(Some(match header.ordinal {
796 0x5b8aeb2ece853c39 => {
797 header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
798 let mut req = fidl::new_empty!(
799 EmulatorSettings,
800 fidl::encoding::DefaultFuchsiaResourceDialect
801 );
802 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<EmulatorSettings>(&header, _body_bytes, handles, &mut req)?;
803 let control_handle = EmulatorControlHandle { inner: this.inner.clone() };
804 Ok(EmulatorRequest::Publish {
805 payload: req,
806 responder: EmulatorPublishResponder {
807 control_handle: std::mem::ManuallyDrop::new(control_handle),
808 tx_id: header.tx_id,
809 },
810 })
811 }
812 0x4e1fb7adbebc6946 => {
813 header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
814 let mut req = fidl::new_empty!(
815 PeerParameters,
816 fidl::encoding::DefaultFuchsiaResourceDialect
817 );
818 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<PeerParameters>(&header, _body_bytes, handles, &mut req)?;
819 let control_handle = EmulatorControlHandle { inner: this.inner.clone() };
820 Ok(EmulatorRequest::AddLowEnergyPeer {
821 payload: req,
822 responder: EmulatorAddLowEnergyPeerResponder {
823 control_handle: std::mem::ManuallyDrop::new(control_handle),
824 tx_id: header.tx_id,
825 },
826 })
827 }
828 0x6d15989a0373e07 => {
829 header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
830 let mut req = fidl::new_empty!(
831 PeerParameters,
832 fidl::encoding::DefaultFuchsiaResourceDialect
833 );
834 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<PeerParameters>(&header, _body_bytes, handles, &mut req)?;
835 let control_handle = EmulatorControlHandle { inner: this.inner.clone() };
836 Ok(EmulatorRequest::AddBredrPeer {
837 payload: req,
838 responder: EmulatorAddBredrPeerResponder {
839 control_handle: std::mem::ManuallyDrop::new(control_handle),
840 tx_id: header.tx_id,
841 },
842 })
843 }
844 0x6ed7a918b5800270 => {
845 header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
846 let mut req = fidl::new_empty!(
847 fidl::encoding::EmptyPayload,
848 fidl::encoding::DefaultFuchsiaResourceDialect
849 );
850 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
851 let control_handle = EmulatorControlHandle { inner: this.inner.clone() };
852 Ok(EmulatorRequest::WatchControllerParameters {
853 responder: EmulatorWatchControllerParametersResponder {
854 control_handle: std::mem::ManuallyDrop::new(control_handle),
855 tx_id: header.tx_id,
856 },
857 })
858 }
859 0x10e6c845831f3b4a => {
860 header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
861 let mut req = fidl::new_empty!(
862 fidl::encoding::EmptyPayload,
863 fidl::encoding::DefaultFuchsiaResourceDialect
864 );
865 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
866 let control_handle = EmulatorControlHandle { inner: this.inner.clone() };
867 Ok(EmulatorRequest::WatchLeScanStates {
868 responder: EmulatorWatchLeScanStatesResponder {
869 control_handle: std::mem::ManuallyDrop::new(control_handle),
870 tx_id: header.tx_id,
871 },
872 })
873 }
874 0x7067acbe275d0219 => {
875 header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
876 let mut req = fidl::new_empty!(
877 fidl::encoding::EmptyPayload,
878 fidl::encoding::DefaultFuchsiaResourceDialect
879 );
880 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
881 let control_handle = EmulatorControlHandle { inner: this.inner.clone() };
882 Ok(EmulatorRequest::WatchLegacyAdvertisingStates {
883 responder: EmulatorWatchLegacyAdvertisingStatesResponder {
884 control_handle: std::mem::ManuallyDrop::new(control_handle),
885 tx_id: header.tx_id,
886 },
887 })
888 }
889 _ if header.tx_id == 0
890 && header
891 .dynamic_flags()
892 .contains(fidl::encoding::DynamicFlags::FLEXIBLE) =>
893 {
894 Ok(EmulatorRequest::_UnknownMethod {
895 ordinal: header.ordinal,
896 control_handle: EmulatorControlHandle { inner: this.inner.clone() },
897 method_type: fidl::MethodType::OneWay,
898 })
899 }
900 _ if header
901 .dynamic_flags()
902 .contains(fidl::encoding::DynamicFlags::FLEXIBLE) =>
903 {
904 this.inner.send_framework_err(
905 fidl::encoding::FrameworkErr::UnknownMethod,
906 header.tx_id,
907 header.ordinal,
908 header.dynamic_flags(),
909 (bytes, handles),
910 )?;
911 Ok(EmulatorRequest::_UnknownMethod {
912 ordinal: header.ordinal,
913 control_handle: EmulatorControlHandle { inner: this.inner.clone() },
914 method_type: fidl::MethodType::TwoWay,
915 })
916 }
917 _ => Err(fidl::Error::UnknownOrdinal {
918 ordinal: header.ordinal,
919 protocol_name:
920 <EmulatorMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
921 }),
922 }))
923 },
924 )
925 }
926}
927
928#[derive(Debug)]
932pub enum EmulatorRequest {
933 Publish { payload: EmulatorSettings, responder: EmulatorPublishResponder },
937 AddLowEnergyPeer { payload: PeerParameters, responder: EmulatorAddLowEnergyPeerResponder },
950 AddBredrPeer { payload: PeerParameters, responder: EmulatorAddBredrPeerResponder },
963 WatchControllerParameters { responder: EmulatorWatchControllerParametersResponder },
966 WatchLeScanStates { responder: EmulatorWatchLeScanStatesResponder },
973 WatchLegacyAdvertisingStates { responder: EmulatorWatchLegacyAdvertisingStatesResponder },
980 #[non_exhaustive]
982 _UnknownMethod {
983 ordinal: u64,
985 control_handle: EmulatorControlHandle,
986 method_type: fidl::MethodType,
987 },
988}
989
990impl EmulatorRequest {
991 #[allow(irrefutable_let_patterns)]
992 pub fn into_publish(self) -> Option<(EmulatorSettings, EmulatorPublishResponder)> {
993 if let EmulatorRequest::Publish { payload, responder } = self {
994 Some((payload, responder))
995 } else {
996 None
997 }
998 }
999
1000 #[allow(irrefutable_let_patterns)]
1001 pub fn into_add_low_energy_peer(
1002 self,
1003 ) -> Option<(PeerParameters, EmulatorAddLowEnergyPeerResponder)> {
1004 if let EmulatorRequest::AddLowEnergyPeer { payload, responder } = self {
1005 Some((payload, responder))
1006 } else {
1007 None
1008 }
1009 }
1010
1011 #[allow(irrefutable_let_patterns)]
1012 pub fn into_add_bredr_peer(self) -> Option<(PeerParameters, EmulatorAddBredrPeerResponder)> {
1013 if let EmulatorRequest::AddBredrPeer { payload, responder } = self {
1014 Some((payload, responder))
1015 } else {
1016 None
1017 }
1018 }
1019
1020 #[allow(irrefutable_let_patterns)]
1021 pub fn into_watch_controller_parameters(
1022 self,
1023 ) -> Option<(EmulatorWatchControllerParametersResponder)> {
1024 if let EmulatorRequest::WatchControllerParameters { responder } = self {
1025 Some((responder))
1026 } else {
1027 None
1028 }
1029 }
1030
1031 #[allow(irrefutable_let_patterns)]
1032 pub fn into_watch_le_scan_states(self) -> Option<(EmulatorWatchLeScanStatesResponder)> {
1033 if let EmulatorRequest::WatchLeScanStates { responder } = self {
1034 Some((responder))
1035 } else {
1036 None
1037 }
1038 }
1039
1040 #[allow(irrefutable_let_patterns)]
1041 pub fn into_watch_legacy_advertising_states(
1042 self,
1043 ) -> Option<(EmulatorWatchLegacyAdvertisingStatesResponder)> {
1044 if let EmulatorRequest::WatchLegacyAdvertisingStates { responder } = self {
1045 Some((responder))
1046 } else {
1047 None
1048 }
1049 }
1050
1051 pub fn method_name(&self) -> &'static str {
1053 match *self {
1054 EmulatorRequest::Publish { .. } => "publish",
1055 EmulatorRequest::AddLowEnergyPeer { .. } => "add_low_energy_peer",
1056 EmulatorRequest::AddBredrPeer { .. } => "add_bredr_peer",
1057 EmulatorRequest::WatchControllerParameters { .. } => "watch_controller_parameters",
1058 EmulatorRequest::WatchLeScanStates { .. } => "watch_le_scan_states",
1059 EmulatorRequest::WatchLegacyAdvertisingStates { .. } => {
1060 "watch_legacy_advertising_states"
1061 }
1062 EmulatorRequest::_UnknownMethod { method_type: fidl::MethodType::OneWay, .. } => {
1063 "unknown one-way method"
1064 }
1065 EmulatorRequest::_UnknownMethod { method_type: fidl::MethodType::TwoWay, .. } => {
1066 "unknown two-way method"
1067 }
1068 }
1069 }
1070}
1071
1072#[derive(Debug, Clone)]
1073pub struct EmulatorControlHandle {
1074 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
1075}
1076
1077impl fidl::endpoints::ControlHandle for EmulatorControlHandle {
1078 fn shutdown(&self) {
1079 self.inner.shutdown()
1080 }
1081 fn shutdown_with_epitaph(&self, status: zx_status::Status) {
1082 self.inner.shutdown_with_epitaph(status)
1083 }
1084
1085 fn is_closed(&self) -> bool {
1086 self.inner.channel().is_closed()
1087 }
1088 fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
1089 self.inner.channel().on_closed()
1090 }
1091
1092 #[cfg(target_os = "fuchsia")]
1093 fn signal_peer(
1094 &self,
1095 clear_mask: zx::Signals,
1096 set_mask: zx::Signals,
1097 ) -> Result<(), zx_status::Status> {
1098 use fidl::Peered;
1099 self.inner.channel().signal_peer(clear_mask, set_mask)
1100 }
1101}
1102
1103impl EmulatorControlHandle {}
1104
1105#[must_use = "FIDL methods require a response to be sent"]
1106#[derive(Debug)]
1107pub struct EmulatorPublishResponder {
1108 control_handle: std::mem::ManuallyDrop<EmulatorControlHandle>,
1109 tx_id: u32,
1110}
1111
1112impl std::ops::Drop for EmulatorPublishResponder {
1116 fn drop(&mut self) {
1117 self.control_handle.shutdown();
1118 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1120 }
1121}
1122
1123impl fidl::endpoints::Responder for EmulatorPublishResponder {
1124 type ControlHandle = EmulatorControlHandle;
1125
1126 fn control_handle(&self) -> &EmulatorControlHandle {
1127 &self.control_handle
1128 }
1129
1130 fn drop_without_shutdown(mut self) {
1131 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1133 std::mem::forget(self);
1135 }
1136}
1137
1138impl EmulatorPublishResponder {
1139 pub fn send(self, mut result: Result<(), EmulatorError>) -> Result<(), fidl::Error> {
1143 let _result = self.send_raw(result);
1144 if _result.is_err() {
1145 self.control_handle.shutdown();
1146 }
1147 self.drop_without_shutdown();
1148 _result
1149 }
1150
1151 pub fn send_no_shutdown_on_err(
1153 self,
1154 mut result: Result<(), EmulatorError>,
1155 ) -> Result<(), fidl::Error> {
1156 let _result = self.send_raw(result);
1157 self.drop_without_shutdown();
1158 _result
1159 }
1160
1161 fn send_raw(&self, mut result: Result<(), EmulatorError>) -> Result<(), fidl::Error> {
1162 self.control_handle.inner.send::<fidl::encoding::FlexibleResultType<
1163 fidl::encoding::EmptyStruct,
1164 EmulatorError,
1165 >>(
1166 fidl::encoding::FlexibleResult::new(result),
1167 self.tx_id,
1168 0x5b8aeb2ece853c39,
1169 fidl::encoding::DynamicFlags::FLEXIBLE,
1170 )
1171 }
1172}
1173
1174#[must_use = "FIDL methods require a response to be sent"]
1175#[derive(Debug)]
1176pub struct EmulatorAddLowEnergyPeerResponder {
1177 control_handle: std::mem::ManuallyDrop<EmulatorControlHandle>,
1178 tx_id: u32,
1179}
1180
1181impl std::ops::Drop for EmulatorAddLowEnergyPeerResponder {
1185 fn drop(&mut self) {
1186 self.control_handle.shutdown();
1187 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1189 }
1190}
1191
1192impl fidl::endpoints::Responder for EmulatorAddLowEnergyPeerResponder {
1193 type ControlHandle = EmulatorControlHandle;
1194
1195 fn control_handle(&self) -> &EmulatorControlHandle {
1196 &self.control_handle
1197 }
1198
1199 fn drop_without_shutdown(mut self) {
1200 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1202 std::mem::forget(self);
1204 }
1205}
1206
1207impl EmulatorAddLowEnergyPeerResponder {
1208 pub fn send(self, mut result: Result<(), EmulatorPeerError>) -> Result<(), fidl::Error> {
1212 let _result = self.send_raw(result);
1213 if _result.is_err() {
1214 self.control_handle.shutdown();
1215 }
1216 self.drop_without_shutdown();
1217 _result
1218 }
1219
1220 pub fn send_no_shutdown_on_err(
1222 self,
1223 mut result: Result<(), EmulatorPeerError>,
1224 ) -> Result<(), fidl::Error> {
1225 let _result = self.send_raw(result);
1226 self.drop_without_shutdown();
1227 _result
1228 }
1229
1230 fn send_raw(&self, mut result: Result<(), EmulatorPeerError>) -> Result<(), fidl::Error> {
1231 self.control_handle.inner.send::<fidl::encoding::FlexibleResultType<
1232 fidl::encoding::EmptyStruct,
1233 EmulatorPeerError,
1234 >>(
1235 fidl::encoding::FlexibleResult::new(result),
1236 self.tx_id,
1237 0x4e1fb7adbebc6946,
1238 fidl::encoding::DynamicFlags::FLEXIBLE,
1239 )
1240 }
1241}
1242
1243#[must_use = "FIDL methods require a response to be sent"]
1244#[derive(Debug)]
1245pub struct EmulatorAddBredrPeerResponder {
1246 control_handle: std::mem::ManuallyDrop<EmulatorControlHandle>,
1247 tx_id: u32,
1248}
1249
1250impl std::ops::Drop for EmulatorAddBredrPeerResponder {
1254 fn drop(&mut self) {
1255 self.control_handle.shutdown();
1256 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1258 }
1259}
1260
1261impl fidl::endpoints::Responder for EmulatorAddBredrPeerResponder {
1262 type ControlHandle = EmulatorControlHandle;
1263
1264 fn control_handle(&self) -> &EmulatorControlHandle {
1265 &self.control_handle
1266 }
1267
1268 fn drop_without_shutdown(mut self) {
1269 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1271 std::mem::forget(self);
1273 }
1274}
1275
1276impl EmulatorAddBredrPeerResponder {
1277 pub fn send(self, mut result: Result<(), EmulatorPeerError>) -> Result<(), fidl::Error> {
1281 let _result = self.send_raw(result);
1282 if _result.is_err() {
1283 self.control_handle.shutdown();
1284 }
1285 self.drop_without_shutdown();
1286 _result
1287 }
1288
1289 pub fn send_no_shutdown_on_err(
1291 self,
1292 mut result: Result<(), EmulatorPeerError>,
1293 ) -> Result<(), fidl::Error> {
1294 let _result = self.send_raw(result);
1295 self.drop_without_shutdown();
1296 _result
1297 }
1298
1299 fn send_raw(&self, mut result: Result<(), EmulatorPeerError>) -> Result<(), fidl::Error> {
1300 self.control_handle.inner.send::<fidl::encoding::FlexibleResultType<
1301 fidl::encoding::EmptyStruct,
1302 EmulatorPeerError,
1303 >>(
1304 fidl::encoding::FlexibleResult::new(result),
1305 self.tx_id,
1306 0x6d15989a0373e07,
1307 fidl::encoding::DynamicFlags::FLEXIBLE,
1308 )
1309 }
1310}
1311
1312#[must_use = "FIDL methods require a response to be sent"]
1313#[derive(Debug)]
1314pub struct EmulatorWatchControllerParametersResponder {
1315 control_handle: std::mem::ManuallyDrop<EmulatorControlHandle>,
1316 tx_id: u32,
1317}
1318
1319impl std::ops::Drop for EmulatorWatchControllerParametersResponder {
1323 fn drop(&mut self) {
1324 self.control_handle.shutdown();
1325 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1327 }
1328}
1329
1330impl fidl::endpoints::Responder for EmulatorWatchControllerParametersResponder {
1331 type ControlHandle = EmulatorControlHandle;
1332
1333 fn control_handle(&self) -> &EmulatorControlHandle {
1334 &self.control_handle
1335 }
1336
1337 fn drop_without_shutdown(mut self) {
1338 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1340 std::mem::forget(self);
1342 }
1343}
1344
1345impl EmulatorWatchControllerParametersResponder {
1346 pub fn send(self, mut payload: &ControllerParameters) -> Result<(), fidl::Error> {
1350 let _result = self.send_raw(payload);
1351 if _result.is_err() {
1352 self.control_handle.shutdown();
1353 }
1354 self.drop_without_shutdown();
1355 _result
1356 }
1357
1358 pub fn send_no_shutdown_on_err(
1360 self,
1361 mut payload: &ControllerParameters,
1362 ) -> Result<(), fidl::Error> {
1363 let _result = self.send_raw(payload);
1364 self.drop_without_shutdown();
1365 _result
1366 }
1367
1368 fn send_raw(&self, mut payload: &ControllerParameters) -> Result<(), fidl::Error> {
1369 self.control_handle.inner.send::<fidl::encoding::FlexibleType<ControllerParameters>>(
1370 fidl::encoding::Flexible::new(payload),
1371 self.tx_id,
1372 0x6ed7a918b5800270,
1373 fidl::encoding::DynamicFlags::FLEXIBLE,
1374 )
1375 }
1376}
1377
1378#[must_use = "FIDL methods require a response to be sent"]
1379#[derive(Debug)]
1380pub struct EmulatorWatchLeScanStatesResponder {
1381 control_handle: std::mem::ManuallyDrop<EmulatorControlHandle>,
1382 tx_id: u32,
1383}
1384
1385impl std::ops::Drop for EmulatorWatchLeScanStatesResponder {
1389 fn drop(&mut self) {
1390 self.control_handle.shutdown();
1391 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1393 }
1394}
1395
1396impl fidl::endpoints::Responder for EmulatorWatchLeScanStatesResponder {
1397 type ControlHandle = EmulatorControlHandle;
1398
1399 fn control_handle(&self) -> &EmulatorControlHandle {
1400 &self.control_handle
1401 }
1402
1403 fn drop_without_shutdown(mut self) {
1404 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1406 std::mem::forget(self);
1408 }
1409}
1410
1411impl EmulatorWatchLeScanStatesResponder {
1412 pub fn send(self, mut states: &[LeScanState]) -> Result<(), fidl::Error> {
1416 let _result = self.send_raw(states);
1417 if _result.is_err() {
1418 self.control_handle.shutdown();
1419 }
1420 self.drop_without_shutdown();
1421 _result
1422 }
1423
1424 pub fn send_no_shutdown_on_err(self, mut states: &[LeScanState]) -> Result<(), fidl::Error> {
1426 let _result = self.send_raw(states);
1427 self.drop_without_shutdown();
1428 _result
1429 }
1430
1431 fn send_raw(&self, mut states: &[LeScanState]) -> Result<(), fidl::Error> {
1432 self.control_handle
1433 .inner
1434 .send::<fidl::encoding::FlexibleType<EmulatorWatchLeScanStatesResponse>>(
1435 fidl::encoding::Flexible::new((states,)),
1436 self.tx_id,
1437 0x10e6c845831f3b4a,
1438 fidl::encoding::DynamicFlags::FLEXIBLE,
1439 )
1440 }
1441}
1442
1443#[must_use = "FIDL methods require a response to be sent"]
1444#[derive(Debug)]
1445pub struct EmulatorWatchLegacyAdvertisingStatesResponder {
1446 control_handle: std::mem::ManuallyDrop<EmulatorControlHandle>,
1447 tx_id: u32,
1448}
1449
1450impl std::ops::Drop for EmulatorWatchLegacyAdvertisingStatesResponder {
1454 fn drop(&mut self) {
1455 self.control_handle.shutdown();
1456 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1458 }
1459}
1460
1461impl fidl::endpoints::Responder for EmulatorWatchLegacyAdvertisingStatesResponder {
1462 type ControlHandle = EmulatorControlHandle;
1463
1464 fn control_handle(&self) -> &EmulatorControlHandle {
1465 &self.control_handle
1466 }
1467
1468 fn drop_without_shutdown(mut self) {
1469 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1471 std::mem::forget(self);
1473 }
1474}
1475
1476impl EmulatorWatchLegacyAdvertisingStatesResponder {
1477 pub fn send(self, mut states: &[LegacyAdvertisingState]) -> Result<(), fidl::Error> {
1481 let _result = self.send_raw(states);
1482 if _result.is_err() {
1483 self.control_handle.shutdown();
1484 }
1485 self.drop_without_shutdown();
1486 _result
1487 }
1488
1489 pub fn send_no_shutdown_on_err(
1491 self,
1492 mut states: &[LegacyAdvertisingState],
1493 ) -> Result<(), fidl::Error> {
1494 let _result = self.send_raw(states);
1495 self.drop_without_shutdown();
1496 _result
1497 }
1498
1499 fn send_raw(&self, mut states: &[LegacyAdvertisingState]) -> Result<(), fidl::Error> {
1500 self.control_handle.inner.send::<fidl::encoding::FlexibleType<
1501 EmulatorWatchLegacyAdvertisingStatesResponse,
1502 >>(
1503 fidl::encoding::Flexible::new((states,)),
1504 self.tx_id,
1505 0x7067acbe275d0219,
1506 fidl::encoding::DynamicFlags::FLEXIBLE,
1507 )
1508 }
1509}
1510
1511#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
1512pub struct HciMarker;
1513
1514impl fidl::endpoints::ProtocolMarker for HciMarker {
1515 type Proxy = HciProxy;
1516 type RequestStream = HciRequestStream;
1517 #[cfg(target_os = "fuchsia")]
1518 type SynchronousProxy = HciSynchronousProxy;
1519
1520 const DEBUG_NAME: &'static str = "(anonymous) Hci";
1521}
1522pub type HciOpenCommandChannelResult = Result<(), i32>;
1523pub type HciOpenAclDataChannelResult = Result<(), i32>;
1524pub type HciOpenScoDataChannelResult = Result<(), i32>;
1525pub type HciConfigureScoResult = Result<(), i32>;
1526pub type HciResetScoResult = Result<(), i32>;
1527pub type HciOpenIsoDataChannelResult = Result<(), i32>;
1528pub type HciOpenSnoopChannelResult = Result<(), i32>;
1529
1530pub trait HciProxyInterface: Send + Sync {
1531 type OpenCommandChannelResponseFut: std::future::Future<Output = Result<HciOpenCommandChannelResult, fidl::Error>>
1532 + Send;
1533 fn r#open_command_channel(&self, channel: fidl::Channel)
1534 -> Self::OpenCommandChannelResponseFut;
1535 type OpenAclDataChannelResponseFut: std::future::Future<Output = Result<HciOpenAclDataChannelResult, fidl::Error>>
1536 + Send;
1537 fn r#open_acl_data_channel(
1538 &self,
1539 channel: fidl::Channel,
1540 ) -> Self::OpenAclDataChannelResponseFut;
1541 type OpenScoDataChannelResponseFut: std::future::Future<Output = Result<HciOpenScoDataChannelResult, fidl::Error>>
1542 + Send;
1543 fn r#open_sco_data_channel(
1544 &self,
1545 channel: fidl::Channel,
1546 ) -> Self::OpenScoDataChannelResponseFut;
1547 type ConfigureScoResponseFut: std::future::Future<Output = Result<HciConfigureScoResult, fidl::Error>>
1548 + Send;
1549 fn r#configure_sco(
1550 &self,
1551 coding_format: ScoCodingFormat,
1552 encoding: ScoEncoding,
1553 sample_rate: ScoSampleRate,
1554 ) -> Self::ConfigureScoResponseFut;
1555 type ResetScoResponseFut: std::future::Future<Output = Result<HciResetScoResult, fidl::Error>>
1556 + Send;
1557 fn r#reset_sco(&self) -> Self::ResetScoResponseFut;
1558 type OpenIsoDataChannelResponseFut: std::future::Future<Output = Result<HciOpenIsoDataChannelResult, fidl::Error>>
1559 + Send;
1560 fn r#open_iso_data_channel(
1561 &self,
1562 channel: fidl::Channel,
1563 ) -> Self::OpenIsoDataChannelResponseFut;
1564 type OpenSnoopChannelResponseFut: std::future::Future<Output = Result<HciOpenSnoopChannelResult, fidl::Error>>
1565 + Send;
1566 fn r#open_snoop_channel(&self, channel: fidl::Channel) -> Self::OpenSnoopChannelResponseFut;
1567}
1568#[derive(Debug)]
1569#[cfg(target_os = "fuchsia")]
1570pub struct HciSynchronousProxy {
1571 client: fidl::client::sync::Client,
1572}
1573
1574#[cfg(target_os = "fuchsia")]
1575impl fidl::endpoints::SynchronousProxy for HciSynchronousProxy {
1576 type Proxy = HciProxy;
1577 type Protocol = HciMarker;
1578
1579 fn from_channel(inner: fidl::Channel) -> Self {
1580 Self::new(inner)
1581 }
1582
1583 fn into_channel(self) -> fidl::Channel {
1584 self.client.into_channel()
1585 }
1586
1587 fn as_channel(&self) -> &fidl::Channel {
1588 self.client.as_channel()
1589 }
1590}
1591
1592#[cfg(target_os = "fuchsia")]
1593impl HciSynchronousProxy {
1594 pub fn new(channel: fidl::Channel) -> Self {
1595 let protocol_name = <HciMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
1596 Self { client: fidl::client::sync::Client::new(channel, protocol_name) }
1597 }
1598
1599 pub fn into_channel(self) -> fidl::Channel {
1600 self.client.into_channel()
1601 }
1602
1603 pub fn wait_for_event(&self, deadline: zx::MonotonicInstant) -> Result<HciEvent, fidl::Error> {
1606 HciEvent::decode(self.client.wait_for_event(deadline)?)
1607 }
1608
1609 pub fn r#open_command_channel(
1613 &self,
1614 mut channel: fidl::Channel,
1615 ___deadline: zx::MonotonicInstant,
1616 ) -> Result<HciOpenCommandChannelResult, fidl::Error> {
1617 let _response = self.client.send_query::<
1618 HciOpenCommandChannelRequest,
1619 fidl::encoding::FlexibleResultType<fidl::encoding::EmptyStruct, i32>,
1620 >(
1621 (channel,),
1622 0x2510b52ea3a51ce0,
1623 fidl::encoding::DynamicFlags::FLEXIBLE,
1624 ___deadline,
1625 )?
1626 .into_result::<HciMarker>("open_command_channel")?;
1627 Ok(_response.map(|x| x))
1628 }
1629
1630 pub fn r#open_acl_data_channel(
1633 &self,
1634 mut channel: fidl::Channel,
1635 ___deadline: zx::MonotonicInstant,
1636 ) -> Result<HciOpenAclDataChannelResult, fidl::Error> {
1637 let _response = self.client.send_query::<
1638 HciOpenAclDataChannelRequest,
1639 fidl::encoding::FlexibleResultType<fidl::encoding::EmptyStruct, i32>,
1640 >(
1641 (channel,),
1642 0x210c3dd69156385a,
1643 fidl::encoding::DynamicFlags::FLEXIBLE,
1644 ___deadline,
1645 )?
1646 .into_result::<HciMarker>("open_acl_data_channel")?;
1647 Ok(_response.map(|x| x))
1648 }
1649
1650 pub fn r#open_sco_data_channel(
1657 &self,
1658 mut channel: fidl::Channel,
1659 ___deadline: zx::MonotonicInstant,
1660 ) -> Result<HciOpenScoDataChannelResult, fidl::Error> {
1661 let _response = self.client.send_query::<
1662 HciOpenScoDataChannelRequest,
1663 fidl::encoding::FlexibleResultType<fidl::encoding::EmptyStruct, i32>,
1664 >(
1665 (channel,),
1666 0x5bcb0bf2cbf35bdf,
1667 fidl::encoding::DynamicFlags::FLEXIBLE,
1668 ___deadline,
1669 )?
1670 .into_result::<HciMarker>("open_sco_data_channel")?;
1671 Ok(_response.map(|x| x))
1672 }
1673
1674 pub fn r#configure_sco(
1679 &self,
1680 mut coding_format: ScoCodingFormat,
1681 mut encoding: ScoEncoding,
1682 mut sample_rate: ScoSampleRate,
1683 ___deadline: zx::MonotonicInstant,
1684 ) -> Result<HciConfigureScoResult, fidl::Error> {
1685 let _response = self.client.send_query::<
1686 HciConfigureScoRequest,
1687 fidl::encoding::FlexibleResultType<fidl::encoding::EmptyStruct, i32>,
1688 >(
1689 (coding_format, encoding, sample_rate,),
1690 0x499ec7edfd65fad7,
1691 fidl::encoding::DynamicFlags::FLEXIBLE,
1692 ___deadline,
1693 )?
1694 .into_result::<HciMarker>("configure_sco")?;
1695 Ok(_response.map(|x| x))
1696 }
1697
1698 pub fn r#reset_sco(
1703 &self,
1704 ___deadline: zx::MonotonicInstant,
1705 ) -> Result<HciResetScoResult, fidl::Error> {
1706 let _response = self.client.send_query::<
1707 fidl::encoding::EmptyPayload,
1708 fidl::encoding::FlexibleResultType<fidl::encoding::EmptyStruct, i32>,
1709 >(
1710 (),
1711 0x6ee56dcb2ce23fcb,
1712 fidl::encoding::DynamicFlags::FLEXIBLE,
1713 ___deadline,
1714 )?
1715 .into_result::<HciMarker>("reset_sco")?;
1716 Ok(_response.map(|x| x))
1717 }
1718
1719 pub fn r#open_iso_data_channel(
1726 &self,
1727 mut channel: fidl::Channel,
1728 ___deadline: zx::MonotonicInstant,
1729 ) -> Result<HciOpenIsoDataChannelResult, fidl::Error> {
1730 let _response = self.client.send_query::<
1731 HciOpenIsoDataChannelRequest,
1732 fidl::encoding::FlexibleResultType<fidl::encoding::EmptyStruct, i32>,
1733 >(
1734 (channel,),
1735 0x9adfa1d466cefd4,
1736 fidl::encoding::DynamicFlags::FLEXIBLE,
1737 ___deadline,
1738 )?
1739 .into_result::<HciMarker>("open_iso_data_channel")?;
1740 Ok(_response.map(|x| x))
1741 }
1742
1743 pub fn r#open_snoop_channel(
1751 &self,
1752 mut channel: fidl::Channel,
1753 ___deadline: zx::MonotonicInstant,
1754 ) -> Result<HciOpenSnoopChannelResult, fidl::Error> {
1755 let _response = self.client.send_query::<
1756 HciOpenSnoopChannelRequest,
1757 fidl::encoding::FlexibleResultType<fidl::encoding::EmptyStruct, i32>,
1758 >(
1759 (channel,),
1760 0xd31c6d5cbc4e136,
1761 fidl::encoding::DynamicFlags::FLEXIBLE,
1762 ___deadline,
1763 )?
1764 .into_result::<HciMarker>("open_snoop_channel")?;
1765 Ok(_response.map(|x| x))
1766 }
1767}
1768
1769#[cfg(target_os = "fuchsia")]
1770impl From<HciSynchronousProxy> for zx::Handle {
1771 fn from(value: HciSynchronousProxy) -> Self {
1772 value.into_channel().into()
1773 }
1774}
1775
1776#[cfg(target_os = "fuchsia")]
1777impl From<fidl::Channel> for HciSynchronousProxy {
1778 fn from(value: fidl::Channel) -> Self {
1779 Self::new(value)
1780 }
1781}
1782
1783#[derive(Debug, Clone)]
1784pub struct HciProxy {
1785 client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
1786}
1787
1788impl fidl::endpoints::Proxy for HciProxy {
1789 type Protocol = HciMarker;
1790
1791 fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
1792 Self::new(inner)
1793 }
1794
1795 fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
1796 self.client.into_channel().map_err(|client| Self { client })
1797 }
1798
1799 fn as_channel(&self) -> &::fidl::AsyncChannel {
1800 self.client.as_channel()
1801 }
1802}
1803
1804impl HciProxy {
1805 pub fn new(channel: ::fidl::AsyncChannel) -> Self {
1807 let protocol_name = <HciMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
1808 Self { client: fidl::client::Client::new(channel, protocol_name) }
1809 }
1810
1811 pub fn take_event_stream(&self) -> HciEventStream {
1817 HciEventStream { event_receiver: self.client.take_event_receiver() }
1818 }
1819
1820 pub fn r#open_command_channel(
1824 &self,
1825 mut channel: fidl::Channel,
1826 ) -> fidl::client::QueryResponseFut<
1827 HciOpenCommandChannelResult,
1828 fidl::encoding::DefaultFuchsiaResourceDialect,
1829 > {
1830 HciProxyInterface::r#open_command_channel(self, channel)
1831 }
1832
1833 pub fn r#open_acl_data_channel(
1836 &self,
1837 mut channel: fidl::Channel,
1838 ) -> fidl::client::QueryResponseFut<
1839 HciOpenAclDataChannelResult,
1840 fidl::encoding::DefaultFuchsiaResourceDialect,
1841 > {
1842 HciProxyInterface::r#open_acl_data_channel(self, channel)
1843 }
1844
1845 pub fn r#open_sco_data_channel(
1852 &self,
1853 mut channel: fidl::Channel,
1854 ) -> fidl::client::QueryResponseFut<
1855 HciOpenScoDataChannelResult,
1856 fidl::encoding::DefaultFuchsiaResourceDialect,
1857 > {
1858 HciProxyInterface::r#open_sco_data_channel(self, channel)
1859 }
1860
1861 pub fn r#configure_sco(
1866 &self,
1867 mut coding_format: ScoCodingFormat,
1868 mut encoding: ScoEncoding,
1869 mut sample_rate: ScoSampleRate,
1870 ) -> fidl::client::QueryResponseFut<
1871 HciConfigureScoResult,
1872 fidl::encoding::DefaultFuchsiaResourceDialect,
1873 > {
1874 HciProxyInterface::r#configure_sco(self, coding_format, encoding, sample_rate)
1875 }
1876
1877 pub fn r#reset_sco(
1882 &self,
1883 ) -> fidl::client::QueryResponseFut<
1884 HciResetScoResult,
1885 fidl::encoding::DefaultFuchsiaResourceDialect,
1886 > {
1887 HciProxyInterface::r#reset_sco(self)
1888 }
1889
1890 pub fn r#open_iso_data_channel(
1897 &self,
1898 mut channel: fidl::Channel,
1899 ) -> fidl::client::QueryResponseFut<
1900 HciOpenIsoDataChannelResult,
1901 fidl::encoding::DefaultFuchsiaResourceDialect,
1902 > {
1903 HciProxyInterface::r#open_iso_data_channel(self, channel)
1904 }
1905
1906 pub fn r#open_snoop_channel(
1914 &self,
1915 mut channel: fidl::Channel,
1916 ) -> fidl::client::QueryResponseFut<
1917 HciOpenSnoopChannelResult,
1918 fidl::encoding::DefaultFuchsiaResourceDialect,
1919 > {
1920 HciProxyInterface::r#open_snoop_channel(self, channel)
1921 }
1922}
1923
1924impl HciProxyInterface for HciProxy {
1925 type OpenCommandChannelResponseFut = fidl::client::QueryResponseFut<
1926 HciOpenCommandChannelResult,
1927 fidl::encoding::DefaultFuchsiaResourceDialect,
1928 >;
1929 fn r#open_command_channel(
1930 &self,
1931 mut channel: fidl::Channel,
1932 ) -> Self::OpenCommandChannelResponseFut {
1933 fn _decode(
1934 mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
1935 ) -> Result<HciOpenCommandChannelResult, fidl::Error> {
1936 let _response = fidl::client::decode_transaction_body::<
1937 fidl::encoding::FlexibleResultType<fidl::encoding::EmptyStruct, i32>,
1938 fidl::encoding::DefaultFuchsiaResourceDialect,
1939 0x2510b52ea3a51ce0,
1940 >(_buf?)?
1941 .into_result::<HciMarker>("open_command_channel")?;
1942 Ok(_response.map(|x| x))
1943 }
1944 self.client
1945 .send_query_and_decode::<HciOpenCommandChannelRequest, HciOpenCommandChannelResult>(
1946 (channel,),
1947 0x2510b52ea3a51ce0,
1948 fidl::encoding::DynamicFlags::FLEXIBLE,
1949 _decode,
1950 )
1951 }
1952
1953 type OpenAclDataChannelResponseFut = fidl::client::QueryResponseFut<
1954 HciOpenAclDataChannelResult,
1955 fidl::encoding::DefaultFuchsiaResourceDialect,
1956 >;
1957 fn r#open_acl_data_channel(
1958 &self,
1959 mut channel: fidl::Channel,
1960 ) -> Self::OpenAclDataChannelResponseFut {
1961 fn _decode(
1962 mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
1963 ) -> Result<HciOpenAclDataChannelResult, fidl::Error> {
1964 let _response = fidl::client::decode_transaction_body::<
1965 fidl::encoding::FlexibleResultType<fidl::encoding::EmptyStruct, i32>,
1966 fidl::encoding::DefaultFuchsiaResourceDialect,
1967 0x210c3dd69156385a,
1968 >(_buf?)?
1969 .into_result::<HciMarker>("open_acl_data_channel")?;
1970 Ok(_response.map(|x| x))
1971 }
1972 self.client
1973 .send_query_and_decode::<HciOpenAclDataChannelRequest, HciOpenAclDataChannelResult>(
1974 (channel,),
1975 0x210c3dd69156385a,
1976 fidl::encoding::DynamicFlags::FLEXIBLE,
1977 _decode,
1978 )
1979 }
1980
1981 type OpenScoDataChannelResponseFut = fidl::client::QueryResponseFut<
1982 HciOpenScoDataChannelResult,
1983 fidl::encoding::DefaultFuchsiaResourceDialect,
1984 >;
1985 fn r#open_sco_data_channel(
1986 &self,
1987 mut channel: fidl::Channel,
1988 ) -> Self::OpenScoDataChannelResponseFut {
1989 fn _decode(
1990 mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
1991 ) -> Result<HciOpenScoDataChannelResult, fidl::Error> {
1992 let _response = fidl::client::decode_transaction_body::<
1993 fidl::encoding::FlexibleResultType<fidl::encoding::EmptyStruct, i32>,
1994 fidl::encoding::DefaultFuchsiaResourceDialect,
1995 0x5bcb0bf2cbf35bdf,
1996 >(_buf?)?
1997 .into_result::<HciMarker>("open_sco_data_channel")?;
1998 Ok(_response.map(|x| x))
1999 }
2000 self.client
2001 .send_query_and_decode::<HciOpenScoDataChannelRequest, HciOpenScoDataChannelResult>(
2002 (channel,),
2003 0x5bcb0bf2cbf35bdf,
2004 fidl::encoding::DynamicFlags::FLEXIBLE,
2005 _decode,
2006 )
2007 }
2008
2009 type ConfigureScoResponseFut = fidl::client::QueryResponseFut<
2010 HciConfigureScoResult,
2011 fidl::encoding::DefaultFuchsiaResourceDialect,
2012 >;
2013 fn r#configure_sco(
2014 &self,
2015 mut coding_format: ScoCodingFormat,
2016 mut encoding: ScoEncoding,
2017 mut sample_rate: ScoSampleRate,
2018 ) -> Self::ConfigureScoResponseFut {
2019 fn _decode(
2020 mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
2021 ) -> Result<HciConfigureScoResult, fidl::Error> {
2022 let _response = fidl::client::decode_transaction_body::<
2023 fidl::encoding::FlexibleResultType<fidl::encoding::EmptyStruct, i32>,
2024 fidl::encoding::DefaultFuchsiaResourceDialect,
2025 0x499ec7edfd65fad7,
2026 >(_buf?)?
2027 .into_result::<HciMarker>("configure_sco")?;
2028 Ok(_response.map(|x| x))
2029 }
2030 self.client.send_query_and_decode::<HciConfigureScoRequest, HciConfigureScoResult>(
2031 (coding_format, encoding, sample_rate),
2032 0x499ec7edfd65fad7,
2033 fidl::encoding::DynamicFlags::FLEXIBLE,
2034 _decode,
2035 )
2036 }
2037
2038 type ResetScoResponseFut = fidl::client::QueryResponseFut<
2039 HciResetScoResult,
2040 fidl::encoding::DefaultFuchsiaResourceDialect,
2041 >;
2042 fn r#reset_sco(&self) -> Self::ResetScoResponseFut {
2043 fn _decode(
2044 mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
2045 ) -> Result<HciResetScoResult, fidl::Error> {
2046 let _response = fidl::client::decode_transaction_body::<
2047 fidl::encoding::FlexibleResultType<fidl::encoding::EmptyStruct, i32>,
2048 fidl::encoding::DefaultFuchsiaResourceDialect,
2049 0x6ee56dcb2ce23fcb,
2050 >(_buf?)?
2051 .into_result::<HciMarker>("reset_sco")?;
2052 Ok(_response.map(|x| x))
2053 }
2054 self.client.send_query_and_decode::<fidl::encoding::EmptyPayload, HciResetScoResult>(
2055 (),
2056 0x6ee56dcb2ce23fcb,
2057 fidl::encoding::DynamicFlags::FLEXIBLE,
2058 _decode,
2059 )
2060 }
2061
2062 type OpenIsoDataChannelResponseFut = fidl::client::QueryResponseFut<
2063 HciOpenIsoDataChannelResult,
2064 fidl::encoding::DefaultFuchsiaResourceDialect,
2065 >;
2066 fn r#open_iso_data_channel(
2067 &self,
2068 mut channel: fidl::Channel,
2069 ) -> Self::OpenIsoDataChannelResponseFut {
2070 fn _decode(
2071 mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
2072 ) -> Result<HciOpenIsoDataChannelResult, fidl::Error> {
2073 let _response = fidl::client::decode_transaction_body::<
2074 fidl::encoding::FlexibleResultType<fidl::encoding::EmptyStruct, i32>,
2075 fidl::encoding::DefaultFuchsiaResourceDialect,
2076 0x9adfa1d466cefd4,
2077 >(_buf?)?
2078 .into_result::<HciMarker>("open_iso_data_channel")?;
2079 Ok(_response.map(|x| x))
2080 }
2081 self.client
2082 .send_query_and_decode::<HciOpenIsoDataChannelRequest, HciOpenIsoDataChannelResult>(
2083 (channel,),
2084 0x9adfa1d466cefd4,
2085 fidl::encoding::DynamicFlags::FLEXIBLE,
2086 _decode,
2087 )
2088 }
2089
2090 type OpenSnoopChannelResponseFut = fidl::client::QueryResponseFut<
2091 HciOpenSnoopChannelResult,
2092 fidl::encoding::DefaultFuchsiaResourceDialect,
2093 >;
2094 fn r#open_snoop_channel(
2095 &self,
2096 mut channel: fidl::Channel,
2097 ) -> Self::OpenSnoopChannelResponseFut {
2098 fn _decode(
2099 mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
2100 ) -> Result<HciOpenSnoopChannelResult, fidl::Error> {
2101 let _response = fidl::client::decode_transaction_body::<
2102 fidl::encoding::FlexibleResultType<fidl::encoding::EmptyStruct, i32>,
2103 fidl::encoding::DefaultFuchsiaResourceDialect,
2104 0xd31c6d5cbc4e136,
2105 >(_buf?)?
2106 .into_result::<HciMarker>("open_snoop_channel")?;
2107 Ok(_response.map(|x| x))
2108 }
2109 self.client.send_query_and_decode::<HciOpenSnoopChannelRequest, HciOpenSnoopChannelResult>(
2110 (channel,),
2111 0xd31c6d5cbc4e136,
2112 fidl::encoding::DynamicFlags::FLEXIBLE,
2113 _decode,
2114 )
2115 }
2116}
2117
2118pub struct HciEventStream {
2119 event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
2120}
2121
2122impl std::marker::Unpin for HciEventStream {}
2123
2124impl futures::stream::FusedStream for HciEventStream {
2125 fn is_terminated(&self) -> bool {
2126 self.event_receiver.is_terminated()
2127 }
2128}
2129
2130impl futures::Stream for HciEventStream {
2131 type Item = Result<HciEvent, fidl::Error>;
2132
2133 fn poll_next(
2134 mut self: std::pin::Pin<&mut Self>,
2135 cx: &mut std::task::Context<'_>,
2136 ) -> std::task::Poll<Option<Self::Item>> {
2137 match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
2138 &mut self.event_receiver,
2139 cx
2140 )?) {
2141 Some(buf) => std::task::Poll::Ready(Some(HciEvent::decode(buf))),
2142 None => std::task::Poll::Ready(None),
2143 }
2144 }
2145}
2146
2147#[derive(Debug)]
2148pub enum HciEvent {
2149 #[non_exhaustive]
2150 _UnknownEvent {
2151 ordinal: u64,
2153 },
2154}
2155
2156impl HciEvent {
2157 fn decode(
2159 mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
2160 ) -> Result<HciEvent, fidl::Error> {
2161 let (bytes, _handles) = buf.split_mut();
2162 let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
2163 debug_assert_eq!(tx_header.tx_id, 0);
2164 match tx_header.ordinal {
2165 _ if tx_header.dynamic_flags().contains(fidl::encoding::DynamicFlags::FLEXIBLE) => {
2166 Ok(HciEvent::_UnknownEvent { ordinal: tx_header.ordinal })
2167 }
2168 _ => Err(fidl::Error::UnknownOrdinal {
2169 ordinal: tx_header.ordinal,
2170 protocol_name: <HciMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
2171 }),
2172 }
2173 }
2174}
2175
2176pub struct HciRequestStream {
2178 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
2179 is_terminated: bool,
2180}
2181
2182impl std::marker::Unpin for HciRequestStream {}
2183
2184impl futures::stream::FusedStream for HciRequestStream {
2185 fn is_terminated(&self) -> bool {
2186 self.is_terminated
2187 }
2188}
2189
2190impl fidl::endpoints::RequestStream for HciRequestStream {
2191 type Protocol = HciMarker;
2192 type ControlHandle = HciControlHandle;
2193
2194 fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
2195 Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
2196 }
2197
2198 fn control_handle(&self) -> Self::ControlHandle {
2199 HciControlHandle { inner: self.inner.clone() }
2200 }
2201
2202 fn into_inner(
2203 self,
2204 ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
2205 {
2206 (self.inner, self.is_terminated)
2207 }
2208
2209 fn from_inner(
2210 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
2211 is_terminated: bool,
2212 ) -> Self {
2213 Self { inner, is_terminated }
2214 }
2215}
2216
2217impl futures::Stream for HciRequestStream {
2218 type Item = Result<HciRequest, fidl::Error>;
2219
2220 fn poll_next(
2221 mut self: std::pin::Pin<&mut Self>,
2222 cx: &mut std::task::Context<'_>,
2223 ) -> std::task::Poll<Option<Self::Item>> {
2224 let this = &mut *self;
2225 if this.inner.check_shutdown(cx) {
2226 this.is_terminated = true;
2227 return std::task::Poll::Ready(None);
2228 }
2229 if this.is_terminated {
2230 panic!("polled HciRequestStream after completion");
2231 }
2232 fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
2233 |bytes, handles| {
2234 match this.inner.channel().read_etc(cx, bytes, handles) {
2235 std::task::Poll::Ready(Ok(())) => {}
2236 std::task::Poll::Pending => return std::task::Poll::Pending,
2237 std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
2238 this.is_terminated = true;
2239 return std::task::Poll::Ready(None);
2240 }
2241 std::task::Poll::Ready(Err(e)) => {
2242 return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
2243 e.into(),
2244 ))))
2245 }
2246 }
2247
2248 let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
2250
2251 std::task::Poll::Ready(Some(match header.ordinal {
2252 0x2510b52ea3a51ce0 => {
2253 header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
2254 let mut req = fidl::new_empty!(
2255 HciOpenCommandChannelRequest,
2256 fidl::encoding::DefaultFuchsiaResourceDialect
2257 );
2258 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<HciOpenCommandChannelRequest>(&header, _body_bytes, handles, &mut req)?;
2259 let control_handle = HciControlHandle { inner: this.inner.clone() };
2260 Ok(HciRequest::OpenCommandChannel {
2261 channel: req.channel,
2262
2263 responder: HciOpenCommandChannelResponder {
2264 control_handle: std::mem::ManuallyDrop::new(control_handle),
2265 tx_id: header.tx_id,
2266 },
2267 })
2268 }
2269 0x210c3dd69156385a => {
2270 header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
2271 let mut req = fidl::new_empty!(
2272 HciOpenAclDataChannelRequest,
2273 fidl::encoding::DefaultFuchsiaResourceDialect
2274 );
2275 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<HciOpenAclDataChannelRequest>(&header, _body_bytes, handles, &mut req)?;
2276 let control_handle = HciControlHandle { inner: this.inner.clone() };
2277 Ok(HciRequest::OpenAclDataChannel {
2278 channel: req.channel,
2279
2280 responder: HciOpenAclDataChannelResponder {
2281 control_handle: std::mem::ManuallyDrop::new(control_handle),
2282 tx_id: header.tx_id,
2283 },
2284 })
2285 }
2286 0x5bcb0bf2cbf35bdf => {
2287 header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
2288 let mut req = fidl::new_empty!(
2289 HciOpenScoDataChannelRequest,
2290 fidl::encoding::DefaultFuchsiaResourceDialect
2291 );
2292 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<HciOpenScoDataChannelRequest>(&header, _body_bytes, handles, &mut req)?;
2293 let control_handle = HciControlHandle { inner: this.inner.clone() };
2294 Ok(HciRequest::OpenScoDataChannel {
2295 channel: req.channel,
2296
2297 responder: HciOpenScoDataChannelResponder {
2298 control_handle: std::mem::ManuallyDrop::new(control_handle),
2299 tx_id: header.tx_id,
2300 },
2301 })
2302 }
2303 0x499ec7edfd65fad7 => {
2304 header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
2305 let mut req = fidl::new_empty!(
2306 HciConfigureScoRequest,
2307 fidl::encoding::DefaultFuchsiaResourceDialect
2308 );
2309 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<HciConfigureScoRequest>(&header, _body_bytes, handles, &mut req)?;
2310 let control_handle = HciControlHandle { inner: this.inner.clone() };
2311 Ok(HciRequest::ConfigureSco {
2312 coding_format: req.coding_format,
2313 encoding: req.encoding,
2314 sample_rate: req.sample_rate,
2315
2316 responder: HciConfigureScoResponder {
2317 control_handle: std::mem::ManuallyDrop::new(control_handle),
2318 tx_id: header.tx_id,
2319 },
2320 })
2321 }
2322 0x6ee56dcb2ce23fcb => {
2323 header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
2324 let mut req = fidl::new_empty!(
2325 fidl::encoding::EmptyPayload,
2326 fidl::encoding::DefaultFuchsiaResourceDialect
2327 );
2328 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
2329 let control_handle = HciControlHandle { inner: this.inner.clone() };
2330 Ok(HciRequest::ResetSco {
2331 responder: HciResetScoResponder {
2332 control_handle: std::mem::ManuallyDrop::new(control_handle),
2333 tx_id: header.tx_id,
2334 },
2335 })
2336 }
2337 0x9adfa1d466cefd4 => {
2338 header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
2339 let mut req = fidl::new_empty!(
2340 HciOpenIsoDataChannelRequest,
2341 fidl::encoding::DefaultFuchsiaResourceDialect
2342 );
2343 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<HciOpenIsoDataChannelRequest>(&header, _body_bytes, handles, &mut req)?;
2344 let control_handle = HciControlHandle { inner: this.inner.clone() };
2345 Ok(HciRequest::OpenIsoDataChannel {
2346 channel: req.channel,
2347
2348 responder: HciOpenIsoDataChannelResponder {
2349 control_handle: std::mem::ManuallyDrop::new(control_handle),
2350 tx_id: header.tx_id,
2351 },
2352 })
2353 }
2354 0xd31c6d5cbc4e136 => {
2355 header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
2356 let mut req = fidl::new_empty!(
2357 HciOpenSnoopChannelRequest,
2358 fidl::encoding::DefaultFuchsiaResourceDialect
2359 );
2360 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<HciOpenSnoopChannelRequest>(&header, _body_bytes, handles, &mut req)?;
2361 let control_handle = HciControlHandle { inner: this.inner.clone() };
2362 Ok(HciRequest::OpenSnoopChannel {
2363 channel: req.channel,
2364
2365 responder: HciOpenSnoopChannelResponder {
2366 control_handle: std::mem::ManuallyDrop::new(control_handle),
2367 tx_id: header.tx_id,
2368 },
2369 })
2370 }
2371 _ if header.tx_id == 0
2372 && header
2373 .dynamic_flags()
2374 .contains(fidl::encoding::DynamicFlags::FLEXIBLE) =>
2375 {
2376 Ok(HciRequest::_UnknownMethod {
2377 ordinal: header.ordinal,
2378 control_handle: HciControlHandle { inner: this.inner.clone() },
2379 method_type: fidl::MethodType::OneWay,
2380 })
2381 }
2382 _ if header
2383 .dynamic_flags()
2384 .contains(fidl::encoding::DynamicFlags::FLEXIBLE) =>
2385 {
2386 this.inner.send_framework_err(
2387 fidl::encoding::FrameworkErr::UnknownMethod,
2388 header.tx_id,
2389 header.ordinal,
2390 header.dynamic_flags(),
2391 (bytes, handles),
2392 )?;
2393 Ok(HciRequest::_UnknownMethod {
2394 ordinal: header.ordinal,
2395 control_handle: HciControlHandle { inner: this.inner.clone() },
2396 method_type: fidl::MethodType::TwoWay,
2397 })
2398 }
2399 _ => Err(fidl::Error::UnknownOrdinal {
2400 ordinal: header.ordinal,
2401 protocol_name: <HciMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
2402 }),
2403 }))
2404 },
2405 )
2406 }
2407}
2408
2409#[derive(Debug)]
2410pub enum HciRequest {
2411 OpenCommandChannel { channel: fidl::Channel, responder: HciOpenCommandChannelResponder },
2415 OpenAclDataChannel { channel: fidl::Channel, responder: HciOpenAclDataChannelResponder },
2418 OpenScoDataChannel { channel: fidl::Channel, responder: HciOpenScoDataChannelResponder },
2425 ConfigureSco {
2430 coding_format: ScoCodingFormat,
2431 encoding: ScoEncoding,
2432 sample_rate: ScoSampleRate,
2433 responder: HciConfigureScoResponder,
2434 },
2435 ResetSco { responder: HciResetScoResponder },
2440 OpenIsoDataChannel { channel: fidl::Channel, responder: HciOpenIsoDataChannelResponder },
2447 OpenSnoopChannel { channel: fidl::Channel, responder: HciOpenSnoopChannelResponder },
2455 #[non_exhaustive]
2457 _UnknownMethod {
2458 ordinal: u64,
2460 control_handle: HciControlHandle,
2461 method_type: fidl::MethodType,
2462 },
2463}
2464
2465impl HciRequest {
2466 #[allow(irrefutable_let_patterns)]
2467 pub fn into_open_command_channel(
2468 self,
2469 ) -> Option<(fidl::Channel, HciOpenCommandChannelResponder)> {
2470 if let HciRequest::OpenCommandChannel { channel, responder } = self {
2471 Some((channel, responder))
2472 } else {
2473 None
2474 }
2475 }
2476
2477 #[allow(irrefutable_let_patterns)]
2478 pub fn into_open_acl_data_channel(
2479 self,
2480 ) -> Option<(fidl::Channel, HciOpenAclDataChannelResponder)> {
2481 if let HciRequest::OpenAclDataChannel { channel, responder } = self {
2482 Some((channel, responder))
2483 } else {
2484 None
2485 }
2486 }
2487
2488 #[allow(irrefutable_let_patterns)]
2489 pub fn into_open_sco_data_channel(
2490 self,
2491 ) -> Option<(fidl::Channel, HciOpenScoDataChannelResponder)> {
2492 if let HciRequest::OpenScoDataChannel { channel, responder } = self {
2493 Some((channel, responder))
2494 } else {
2495 None
2496 }
2497 }
2498
2499 #[allow(irrefutable_let_patterns)]
2500 pub fn into_configure_sco(
2501 self,
2502 ) -> Option<(ScoCodingFormat, ScoEncoding, ScoSampleRate, HciConfigureScoResponder)> {
2503 if let HciRequest::ConfigureSco { coding_format, encoding, sample_rate, responder } = self {
2504 Some((coding_format, encoding, sample_rate, responder))
2505 } else {
2506 None
2507 }
2508 }
2509
2510 #[allow(irrefutable_let_patterns)]
2511 pub fn into_reset_sco(self) -> Option<(HciResetScoResponder)> {
2512 if let HciRequest::ResetSco { responder } = self {
2513 Some((responder))
2514 } else {
2515 None
2516 }
2517 }
2518
2519 #[allow(irrefutable_let_patterns)]
2520 pub fn into_open_iso_data_channel(
2521 self,
2522 ) -> Option<(fidl::Channel, HciOpenIsoDataChannelResponder)> {
2523 if let HciRequest::OpenIsoDataChannel { channel, responder } = self {
2524 Some((channel, responder))
2525 } else {
2526 None
2527 }
2528 }
2529
2530 #[allow(irrefutable_let_patterns)]
2531 pub fn into_open_snoop_channel(self) -> Option<(fidl::Channel, HciOpenSnoopChannelResponder)> {
2532 if let HciRequest::OpenSnoopChannel { channel, responder } = self {
2533 Some((channel, responder))
2534 } else {
2535 None
2536 }
2537 }
2538
2539 pub fn method_name(&self) -> &'static str {
2541 match *self {
2542 HciRequest::OpenCommandChannel { .. } => "open_command_channel",
2543 HciRequest::OpenAclDataChannel { .. } => "open_acl_data_channel",
2544 HciRequest::OpenScoDataChannel { .. } => "open_sco_data_channel",
2545 HciRequest::ConfigureSco { .. } => "configure_sco",
2546 HciRequest::ResetSco { .. } => "reset_sco",
2547 HciRequest::OpenIsoDataChannel { .. } => "open_iso_data_channel",
2548 HciRequest::OpenSnoopChannel { .. } => "open_snoop_channel",
2549 HciRequest::_UnknownMethod { method_type: fidl::MethodType::OneWay, .. } => {
2550 "unknown one-way method"
2551 }
2552 HciRequest::_UnknownMethod { method_type: fidl::MethodType::TwoWay, .. } => {
2553 "unknown two-way method"
2554 }
2555 }
2556 }
2557}
2558
2559#[derive(Debug, Clone)]
2560pub struct HciControlHandle {
2561 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
2562}
2563
2564impl fidl::endpoints::ControlHandle for HciControlHandle {
2565 fn shutdown(&self) {
2566 self.inner.shutdown()
2567 }
2568 fn shutdown_with_epitaph(&self, status: zx_status::Status) {
2569 self.inner.shutdown_with_epitaph(status)
2570 }
2571
2572 fn is_closed(&self) -> bool {
2573 self.inner.channel().is_closed()
2574 }
2575 fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
2576 self.inner.channel().on_closed()
2577 }
2578
2579 #[cfg(target_os = "fuchsia")]
2580 fn signal_peer(
2581 &self,
2582 clear_mask: zx::Signals,
2583 set_mask: zx::Signals,
2584 ) -> Result<(), zx_status::Status> {
2585 use fidl::Peered;
2586 self.inner.channel().signal_peer(clear_mask, set_mask)
2587 }
2588}
2589
2590impl HciControlHandle {}
2591
2592#[must_use = "FIDL methods require a response to be sent"]
2593#[derive(Debug)]
2594pub struct HciOpenCommandChannelResponder {
2595 control_handle: std::mem::ManuallyDrop<HciControlHandle>,
2596 tx_id: u32,
2597}
2598
2599impl std::ops::Drop for HciOpenCommandChannelResponder {
2603 fn drop(&mut self) {
2604 self.control_handle.shutdown();
2605 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
2607 }
2608}
2609
2610impl fidl::endpoints::Responder for HciOpenCommandChannelResponder {
2611 type ControlHandle = HciControlHandle;
2612
2613 fn control_handle(&self) -> &HciControlHandle {
2614 &self.control_handle
2615 }
2616
2617 fn drop_without_shutdown(mut self) {
2618 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
2620 std::mem::forget(self);
2622 }
2623}
2624
2625impl HciOpenCommandChannelResponder {
2626 pub fn send(self, mut result: Result<(), i32>) -> Result<(), fidl::Error> {
2630 let _result = self.send_raw(result);
2631 if _result.is_err() {
2632 self.control_handle.shutdown();
2633 }
2634 self.drop_without_shutdown();
2635 _result
2636 }
2637
2638 pub fn send_no_shutdown_on_err(self, mut result: Result<(), i32>) -> Result<(), fidl::Error> {
2640 let _result = self.send_raw(result);
2641 self.drop_without_shutdown();
2642 _result
2643 }
2644
2645 fn send_raw(&self, mut result: Result<(), i32>) -> Result<(), fidl::Error> {
2646 self.control_handle.inner.send::<fidl::encoding::FlexibleResultType<
2647 fidl::encoding::EmptyStruct,
2648 i32,
2649 >>(
2650 fidl::encoding::FlexibleResult::new(result),
2651 self.tx_id,
2652 0x2510b52ea3a51ce0,
2653 fidl::encoding::DynamicFlags::FLEXIBLE,
2654 )
2655 }
2656}
2657
2658#[must_use = "FIDL methods require a response to be sent"]
2659#[derive(Debug)]
2660pub struct HciOpenAclDataChannelResponder {
2661 control_handle: std::mem::ManuallyDrop<HciControlHandle>,
2662 tx_id: u32,
2663}
2664
2665impl std::ops::Drop for HciOpenAclDataChannelResponder {
2669 fn drop(&mut self) {
2670 self.control_handle.shutdown();
2671 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
2673 }
2674}
2675
2676impl fidl::endpoints::Responder for HciOpenAclDataChannelResponder {
2677 type ControlHandle = HciControlHandle;
2678
2679 fn control_handle(&self) -> &HciControlHandle {
2680 &self.control_handle
2681 }
2682
2683 fn drop_without_shutdown(mut self) {
2684 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
2686 std::mem::forget(self);
2688 }
2689}
2690
2691impl HciOpenAclDataChannelResponder {
2692 pub fn send(self, mut result: Result<(), i32>) -> Result<(), fidl::Error> {
2696 let _result = self.send_raw(result);
2697 if _result.is_err() {
2698 self.control_handle.shutdown();
2699 }
2700 self.drop_without_shutdown();
2701 _result
2702 }
2703
2704 pub fn send_no_shutdown_on_err(self, mut result: Result<(), i32>) -> Result<(), fidl::Error> {
2706 let _result = self.send_raw(result);
2707 self.drop_without_shutdown();
2708 _result
2709 }
2710
2711 fn send_raw(&self, mut result: Result<(), i32>) -> Result<(), fidl::Error> {
2712 self.control_handle.inner.send::<fidl::encoding::FlexibleResultType<
2713 fidl::encoding::EmptyStruct,
2714 i32,
2715 >>(
2716 fidl::encoding::FlexibleResult::new(result),
2717 self.tx_id,
2718 0x210c3dd69156385a,
2719 fidl::encoding::DynamicFlags::FLEXIBLE,
2720 )
2721 }
2722}
2723
2724#[must_use = "FIDL methods require a response to be sent"]
2725#[derive(Debug)]
2726pub struct HciOpenScoDataChannelResponder {
2727 control_handle: std::mem::ManuallyDrop<HciControlHandle>,
2728 tx_id: u32,
2729}
2730
2731impl std::ops::Drop for HciOpenScoDataChannelResponder {
2735 fn drop(&mut self) {
2736 self.control_handle.shutdown();
2737 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
2739 }
2740}
2741
2742impl fidl::endpoints::Responder for HciOpenScoDataChannelResponder {
2743 type ControlHandle = HciControlHandle;
2744
2745 fn control_handle(&self) -> &HciControlHandle {
2746 &self.control_handle
2747 }
2748
2749 fn drop_without_shutdown(mut self) {
2750 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
2752 std::mem::forget(self);
2754 }
2755}
2756
2757impl HciOpenScoDataChannelResponder {
2758 pub fn send(self, mut result: Result<(), i32>) -> Result<(), fidl::Error> {
2762 let _result = self.send_raw(result);
2763 if _result.is_err() {
2764 self.control_handle.shutdown();
2765 }
2766 self.drop_without_shutdown();
2767 _result
2768 }
2769
2770 pub fn send_no_shutdown_on_err(self, mut result: Result<(), i32>) -> Result<(), fidl::Error> {
2772 let _result = self.send_raw(result);
2773 self.drop_without_shutdown();
2774 _result
2775 }
2776
2777 fn send_raw(&self, mut result: Result<(), i32>) -> Result<(), fidl::Error> {
2778 self.control_handle.inner.send::<fidl::encoding::FlexibleResultType<
2779 fidl::encoding::EmptyStruct,
2780 i32,
2781 >>(
2782 fidl::encoding::FlexibleResult::new(result),
2783 self.tx_id,
2784 0x5bcb0bf2cbf35bdf,
2785 fidl::encoding::DynamicFlags::FLEXIBLE,
2786 )
2787 }
2788}
2789
2790#[must_use = "FIDL methods require a response to be sent"]
2791#[derive(Debug)]
2792pub struct HciConfigureScoResponder {
2793 control_handle: std::mem::ManuallyDrop<HciControlHandle>,
2794 tx_id: u32,
2795}
2796
2797impl std::ops::Drop for HciConfigureScoResponder {
2801 fn drop(&mut self) {
2802 self.control_handle.shutdown();
2803 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
2805 }
2806}
2807
2808impl fidl::endpoints::Responder for HciConfigureScoResponder {
2809 type ControlHandle = HciControlHandle;
2810
2811 fn control_handle(&self) -> &HciControlHandle {
2812 &self.control_handle
2813 }
2814
2815 fn drop_without_shutdown(mut self) {
2816 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
2818 std::mem::forget(self);
2820 }
2821}
2822
2823impl HciConfigureScoResponder {
2824 pub fn send(self, mut result: Result<(), i32>) -> Result<(), fidl::Error> {
2828 let _result = self.send_raw(result);
2829 if _result.is_err() {
2830 self.control_handle.shutdown();
2831 }
2832 self.drop_without_shutdown();
2833 _result
2834 }
2835
2836 pub fn send_no_shutdown_on_err(self, mut result: Result<(), i32>) -> Result<(), fidl::Error> {
2838 let _result = self.send_raw(result);
2839 self.drop_without_shutdown();
2840 _result
2841 }
2842
2843 fn send_raw(&self, mut result: Result<(), i32>) -> Result<(), fidl::Error> {
2844 self.control_handle.inner.send::<fidl::encoding::FlexibleResultType<
2845 fidl::encoding::EmptyStruct,
2846 i32,
2847 >>(
2848 fidl::encoding::FlexibleResult::new(result),
2849 self.tx_id,
2850 0x499ec7edfd65fad7,
2851 fidl::encoding::DynamicFlags::FLEXIBLE,
2852 )
2853 }
2854}
2855
2856#[must_use = "FIDL methods require a response to be sent"]
2857#[derive(Debug)]
2858pub struct HciResetScoResponder {
2859 control_handle: std::mem::ManuallyDrop<HciControlHandle>,
2860 tx_id: u32,
2861}
2862
2863impl std::ops::Drop for HciResetScoResponder {
2867 fn drop(&mut self) {
2868 self.control_handle.shutdown();
2869 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
2871 }
2872}
2873
2874impl fidl::endpoints::Responder for HciResetScoResponder {
2875 type ControlHandle = HciControlHandle;
2876
2877 fn control_handle(&self) -> &HciControlHandle {
2878 &self.control_handle
2879 }
2880
2881 fn drop_without_shutdown(mut self) {
2882 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
2884 std::mem::forget(self);
2886 }
2887}
2888
2889impl HciResetScoResponder {
2890 pub fn send(self, mut result: Result<(), i32>) -> Result<(), fidl::Error> {
2894 let _result = self.send_raw(result);
2895 if _result.is_err() {
2896 self.control_handle.shutdown();
2897 }
2898 self.drop_without_shutdown();
2899 _result
2900 }
2901
2902 pub fn send_no_shutdown_on_err(self, mut result: Result<(), i32>) -> Result<(), fidl::Error> {
2904 let _result = self.send_raw(result);
2905 self.drop_without_shutdown();
2906 _result
2907 }
2908
2909 fn send_raw(&self, mut result: Result<(), i32>) -> Result<(), fidl::Error> {
2910 self.control_handle.inner.send::<fidl::encoding::FlexibleResultType<
2911 fidl::encoding::EmptyStruct,
2912 i32,
2913 >>(
2914 fidl::encoding::FlexibleResult::new(result),
2915 self.tx_id,
2916 0x6ee56dcb2ce23fcb,
2917 fidl::encoding::DynamicFlags::FLEXIBLE,
2918 )
2919 }
2920}
2921
2922#[must_use = "FIDL methods require a response to be sent"]
2923#[derive(Debug)]
2924pub struct HciOpenIsoDataChannelResponder {
2925 control_handle: std::mem::ManuallyDrop<HciControlHandle>,
2926 tx_id: u32,
2927}
2928
2929impl std::ops::Drop for HciOpenIsoDataChannelResponder {
2933 fn drop(&mut self) {
2934 self.control_handle.shutdown();
2935 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
2937 }
2938}
2939
2940impl fidl::endpoints::Responder for HciOpenIsoDataChannelResponder {
2941 type ControlHandle = HciControlHandle;
2942
2943 fn control_handle(&self) -> &HciControlHandle {
2944 &self.control_handle
2945 }
2946
2947 fn drop_without_shutdown(mut self) {
2948 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
2950 std::mem::forget(self);
2952 }
2953}
2954
2955impl HciOpenIsoDataChannelResponder {
2956 pub fn send(self, mut result: Result<(), i32>) -> Result<(), fidl::Error> {
2960 let _result = self.send_raw(result);
2961 if _result.is_err() {
2962 self.control_handle.shutdown();
2963 }
2964 self.drop_without_shutdown();
2965 _result
2966 }
2967
2968 pub fn send_no_shutdown_on_err(self, mut result: Result<(), i32>) -> Result<(), fidl::Error> {
2970 let _result = self.send_raw(result);
2971 self.drop_without_shutdown();
2972 _result
2973 }
2974
2975 fn send_raw(&self, mut result: Result<(), i32>) -> Result<(), fidl::Error> {
2976 self.control_handle.inner.send::<fidl::encoding::FlexibleResultType<
2977 fidl::encoding::EmptyStruct,
2978 i32,
2979 >>(
2980 fidl::encoding::FlexibleResult::new(result),
2981 self.tx_id,
2982 0x9adfa1d466cefd4,
2983 fidl::encoding::DynamicFlags::FLEXIBLE,
2984 )
2985 }
2986}
2987
2988#[must_use = "FIDL methods require a response to be sent"]
2989#[derive(Debug)]
2990pub struct HciOpenSnoopChannelResponder {
2991 control_handle: std::mem::ManuallyDrop<HciControlHandle>,
2992 tx_id: u32,
2993}
2994
2995impl std::ops::Drop for HciOpenSnoopChannelResponder {
2999 fn drop(&mut self) {
3000 self.control_handle.shutdown();
3001 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
3003 }
3004}
3005
3006impl fidl::endpoints::Responder for HciOpenSnoopChannelResponder {
3007 type ControlHandle = HciControlHandle;
3008
3009 fn control_handle(&self) -> &HciControlHandle {
3010 &self.control_handle
3011 }
3012
3013 fn drop_without_shutdown(mut self) {
3014 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
3016 std::mem::forget(self);
3018 }
3019}
3020
3021impl HciOpenSnoopChannelResponder {
3022 pub fn send(self, mut result: Result<(), i32>) -> Result<(), fidl::Error> {
3026 let _result = self.send_raw(result);
3027 if _result.is_err() {
3028 self.control_handle.shutdown();
3029 }
3030 self.drop_without_shutdown();
3031 _result
3032 }
3033
3034 pub fn send_no_shutdown_on_err(self, mut result: Result<(), i32>) -> Result<(), fidl::Error> {
3036 let _result = self.send_raw(result);
3037 self.drop_without_shutdown();
3038 _result
3039 }
3040
3041 fn send_raw(&self, mut result: Result<(), i32>) -> Result<(), fidl::Error> {
3042 self.control_handle.inner.send::<fidl::encoding::FlexibleResultType<
3043 fidl::encoding::EmptyStruct,
3044 i32,
3045 >>(
3046 fidl::encoding::FlexibleResult::new(result),
3047 self.tx_id,
3048 0xd31c6d5cbc4e136,
3049 fidl::encoding::DynamicFlags::FLEXIBLE,
3050 )
3051 }
3052}
3053
3054#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
3055pub struct HciTransportMarker;
3056
3057impl fidl::endpoints::ProtocolMarker for HciTransportMarker {
3058 type Proxy = HciTransportProxy;
3059 type RequestStream = HciTransportRequestStream;
3060 #[cfg(target_os = "fuchsia")]
3061 type SynchronousProxy = HciTransportSynchronousProxy;
3062
3063 const DEBUG_NAME: &'static str = "(anonymous) HciTransport";
3064}
3065
3066pub trait HciTransportProxyInterface: Send + Sync {
3067 type Send_ResponseFut: std::future::Future<Output = Result<(), fidl::Error>> + Send;
3068 fn r#send_(&self, payload: &SentPacket) -> Self::Send_ResponseFut;
3069 fn r#ack_receive(&self) -> Result<(), fidl::Error>;
3070 fn r#configure_sco(&self, payload: HciTransportConfigureScoRequest) -> Result<(), fidl::Error>;
3071}
3072#[derive(Debug)]
3073#[cfg(target_os = "fuchsia")]
3074pub struct HciTransportSynchronousProxy {
3075 client: fidl::client::sync::Client,
3076}
3077
3078#[cfg(target_os = "fuchsia")]
3079impl fidl::endpoints::SynchronousProxy for HciTransportSynchronousProxy {
3080 type Proxy = HciTransportProxy;
3081 type Protocol = HciTransportMarker;
3082
3083 fn from_channel(inner: fidl::Channel) -> Self {
3084 Self::new(inner)
3085 }
3086
3087 fn into_channel(self) -> fidl::Channel {
3088 self.client.into_channel()
3089 }
3090
3091 fn as_channel(&self) -> &fidl::Channel {
3092 self.client.as_channel()
3093 }
3094}
3095
3096#[cfg(target_os = "fuchsia")]
3097impl HciTransportSynchronousProxy {
3098 pub fn new(channel: fidl::Channel) -> Self {
3099 let protocol_name = <HciTransportMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
3100 Self { client: fidl::client::sync::Client::new(channel, protocol_name) }
3101 }
3102
3103 pub fn into_channel(self) -> fidl::Channel {
3104 self.client.into_channel()
3105 }
3106
3107 pub fn wait_for_event(
3110 &self,
3111 deadline: zx::MonotonicInstant,
3112 ) -> Result<HciTransportEvent, fidl::Error> {
3113 HciTransportEvent::decode(self.client.wait_for_event(deadline)?)
3114 }
3115
3116 pub fn r#send_(
3121 &self,
3122 mut payload: &SentPacket,
3123 ___deadline: zx::MonotonicInstant,
3124 ) -> Result<(), fidl::Error> {
3125 let _response = self
3126 .client
3127 .send_query::<SentPacket, fidl::encoding::FlexibleType<fidl::encoding::EmptyStruct>>(
3128 payload,
3129 0x4793b5e66fd79e0b,
3130 fidl::encoding::DynamicFlags::FLEXIBLE,
3131 ___deadline,
3132 )?
3133 .into_result::<HciTransportMarker>("send_")?;
3134 Ok(_response)
3135 }
3136
3137 pub fn r#ack_receive(&self) -> Result<(), fidl::Error> {
3138 self.client.send::<fidl::encoding::EmptyPayload>(
3139 (),
3140 0x25de8c1f760f0c89,
3141 fidl::encoding::DynamicFlags::FLEXIBLE,
3142 )
3143 }
3144
3145 pub fn r#configure_sco(
3147 &self,
3148 mut payload: HciTransportConfigureScoRequest,
3149 ) -> Result<(), fidl::Error> {
3150 self.client.send::<HciTransportConfigureScoRequest>(
3151 &mut payload,
3152 0x4298072d0498b612,
3153 fidl::encoding::DynamicFlags::FLEXIBLE,
3154 )
3155 }
3156}
3157
3158#[cfg(target_os = "fuchsia")]
3159impl From<HciTransportSynchronousProxy> for zx::Handle {
3160 fn from(value: HciTransportSynchronousProxy) -> Self {
3161 value.into_channel().into()
3162 }
3163}
3164
3165#[cfg(target_os = "fuchsia")]
3166impl From<fidl::Channel> for HciTransportSynchronousProxy {
3167 fn from(value: fidl::Channel) -> Self {
3168 Self::new(value)
3169 }
3170}
3171
3172#[derive(Debug, Clone)]
3173pub struct HciTransportProxy {
3174 client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
3175}
3176
3177impl fidl::endpoints::Proxy for HciTransportProxy {
3178 type Protocol = HciTransportMarker;
3179
3180 fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
3181 Self::new(inner)
3182 }
3183
3184 fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
3185 self.client.into_channel().map_err(|client| Self { client })
3186 }
3187
3188 fn as_channel(&self) -> &::fidl::AsyncChannel {
3189 self.client.as_channel()
3190 }
3191}
3192
3193impl HciTransportProxy {
3194 pub fn new(channel: ::fidl::AsyncChannel) -> Self {
3196 let protocol_name = <HciTransportMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
3197 Self { client: fidl::client::Client::new(channel, protocol_name) }
3198 }
3199
3200 pub fn take_event_stream(&self) -> HciTransportEventStream {
3206 HciTransportEventStream { event_receiver: self.client.take_event_receiver() }
3207 }
3208
3209 pub fn r#send_(
3214 &self,
3215 mut payload: &SentPacket,
3216 ) -> fidl::client::QueryResponseFut<(), fidl::encoding::DefaultFuchsiaResourceDialect> {
3217 HciTransportProxyInterface::r#send_(self, payload)
3218 }
3219
3220 pub fn r#ack_receive(&self) -> Result<(), fidl::Error> {
3221 HciTransportProxyInterface::r#ack_receive(self)
3222 }
3223
3224 pub fn r#configure_sco(
3226 &self,
3227 mut payload: HciTransportConfigureScoRequest,
3228 ) -> Result<(), fidl::Error> {
3229 HciTransportProxyInterface::r#configure_sco(self, payload)
3230 }
3231}
3232
3233impl HciTransportProxyInterface for HciTransportProxy {
3234 type Send_ResponseFut =
3235 fidl::client::QueryResponseFut<(), fidl::encoding::DefaultFuchsiaResourceDialect>;
3236 fn r#send_(&self, mut payload: &SentPacket) -> Self::Send_ResponseFut {
3237 fn _decode(
3238 mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
3239 ) -> Result<(), fidl::Error> {
3240 let _response = fidl::client::decode_transaction_body::<
3241 fidl::encoding::FlexibleType<fidl::encoding::EmptyStruct>,
3242 fidl::encoding::DefaultFuchsiaResourceDialect,
3243 0x4793b5e66fd79e0b,
3244 >(_buf?)?
3245 .into_result::<HciTransportMarker>("send_")?;
3246 Ok(_response)
3247 }
3248 self.client.send_query_and_decode::<SentPacket, ()>(
3249 payload,
3250 0x4793b5e66fd79e0b,
3251 fidl::encoding::DynamicFlags::FLEXIBLE,
3252 _decode,
3253 )
3254 }
3255
3256 fn r#ack_receive(&self) -> Result<(), fidl::Error> {
3257 self.client.send::<fidl::encoding::EmptyPayload>(
3258 (),
3259 0x25de8c1f760f0c89,
3260 fidl::encoding::DynamicFlags::FLEXIBLE,
3261 )
3262 }
3263
3264 fn r#configure_sco(
3265 &self,
3266 mut payload: HciTransportConfigureScoRequest,
3267 ) -> Result<(), fidl::Error> {
3268 self.client.send::<HciTransportConfigureScoRequest>(
3269 &mut payload,
3270 0x4298072d0498b612,
3271 fidl::encoding::DynamicFlags::FLEXIBLE,
3272 )
3273 }
3274}
3275
3276pub struct HciTransportEventStream {
3277 event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
3278}
3279
3280impl std::marker::Unpin for HciTransportEventStream {}
3281
3282impl futures::stream::FusedStream for HciTransportEventStream {
3283 fn is_terminated(&self) -> bool {
3284 self.event_receiver.is_terminated()
3285 }
3286}
3287
3288impl futures::Stream for HciTransportEventStream {
3289 type Item = Result<HciTransportEvent, fidl::Error>;
3290
3291 fn poll_next(
3292 mut self: std::pin::Pin<&mut Self>,
3293 cx: &mut std::task::Context<'_>,
3294 ) -> std::task::Poll<Option<Self::Item>> {
3295 match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
3296 &mut self.event_receiver,
3297 cx
3298 )?) {
3299 Some(buf) => std::task::Poll::Ready(Some(HciTransportEvent::decode(buf))),
3300 None => std::task::Poll::Ready(None),
3301 }
3302 }
3303}
3304
3305#[derive(Debug)]
3306pub enum HciTransportEvent {
3307 OnReceive {
3308 payload: ReceivedPacket,
3309 },
3310 #[non_exhaustive]
3311 _UnknownEvent {
3312 ordinal: u64,
3314 },
3315}
3316
3317impl HciTransportEvent {
3318 #[allow(irrefutable_let_patterns)]
3319 pub fn into_on_receive(self) -> Option<ReceivedPacket> {
3320 if let HciTransportEvent::OnReceive { payload } = self {
3321 Some((payload))
3322 } else {
3323 None
3324 }
3325 }
3326
3327 fn decode(
3329 mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
3330 ) -> Result<HciTransportEvent, fidl::Error> {
3331 let (bytes, _handles) = buf.split_mut();
3332 let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
3333 debug_assert_eq!(tx_header.tx_id, 0);
3334 match tx_header.ordinal {
3335 0xcb102e573e5049c => {
3336 let mut out =
3337 fidl::new_empty!(ReceivedPacket, fidl::encoding::DefaultFuchsiaResourceDialect);
3338 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<ReceivedPacket>(&tx_header, _body_bytes, _handles, &mut out)?;
3339 Ok((HciTransportEvent::OnReceive { payload: out }))
3340 }
3341 _ if tx_header.dynamic_flags().contains(fidl::encoding::DynamicFlags::FLEXIBLE) => {
3342 Ok(HciTransportEvent::_UnknownEvent { ordinal: tx_header.ordinal })
3343 }
3344 _ => Err(fidl::Error::UnknownOrdinal {
3345 ordinal: tx_header.ordinal,
3346 protocol_name: <HciTransportMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
3347 }),
3348 }
3349 }
3350}
3351
3352pub struct HciTransportRequestStream {
3354 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
3355 is_terminated: bool,
3356}
3357
3358impl std::marker::Unpin for HciTransportRequestStream {}
3359
3360impl futures::stream::FusedStream for HciTransportRequestStream {
3361 fn is_terminated(&self) -> bool {
3362 self.is_terminated
3363 }
3364}
3365
3366impl fidl::endpoints::RequestStream for HciTransportRequestStream {
3367 type Protocol = HciTransportMarker;
3368 type ControlHandle = HciTransportControlHandle;
3369
3370 fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
3371 Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
3372 }
3373
3374 fn control_handle(&self) -> Self::ControlHandle {
3375 HciTransportControlHandle { inner: self.inner.clone() }
3376 }
3377
3378 fn into_inner(
3379 self,
3380 ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
3381 {
3382 (self.inner, self.is_terminated)
3383 }
3384
3385 fn from_inner(
3386 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
3387 is_terminated: bool,
3388 ) -> Self {
3389 Self { inner, is_terminated }
3390 }
3391}
3392
3393impl futures::Stream for HciTransportRequestStream {
3394 type Item = Result<HciTransportRequest, fidl::Error>;
3395
3396 fn poll_next(
3397 mut self: std::pin::Pin<&mut Self>,
3398 cx: &mut std::task::Context<'_>,
3399 ) -> std::task::Poll<Option<Self::Item>> {
3400 let this = &mut *self;
3401 if this.inner.check_shutdown(cx) {
3402 this.is_terminated = true;
3403 return std::task::Poll::Ready(None);
3404 }
3405 if this.is_terminated {
3406 panic!("polled HciTransportRequestStream after completion");
3407 }
3408 fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
3409 |bytes, handles| {
3410 match this.inner.channel().read_etc(cx, bytes, handles) {
3411 std::task::Poll::Ready(Ok(())) => {}
3412 std::task::Poll::Pending => return std::task::Poll::Pending,
3413 std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
3414 this.is_terminated = true;
3415 return std::task::Poll::Ready(None);
3416 }
3417 std::task::Poll::Ready(Err(e)) => {
3418 return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
3419 e.into(),
3420 ))))
3421 }
3422 }
3423
3424 let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
3426
3427 std::task::Poll::Ready(Some(match header.ordinal {
3428 0x4793b5e66fd79e0b => {
3429 header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
3430 let mut req = fidl::new_empty!(
3431 SentPacket,
3432 fidl::encoding::DefaultFuchsiaResourceDialect
3433 );
3434 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<SentPacket>(&header, _body_bytes, handles, &mut req)?;
3435 let control_handle =
3436 HciTransportControlHandle { inner: this.inner.clone() };
3437 Ok(HciTransportRequest::Send_ {
3438 payload: req,
3439 responder: HciTransportSend_Responder {
3440 control_handle: std::mem::ManuallyDrop::new(control_handle),
3441 tx_id: header.tx_id,
3442 },
3443 })
3444 }
3445 0x25de8c1f760f0c89 => {
3446 header.validate_request_tx_id(fidl::MethodType::OneWay)?;
3447 let mut req = fidl::new_empty!(
3448 fidl::encoding::EmptyPayload,
3449 fidl::encoding::DefaultFuchsiaResourceDialect
3450 );
3451 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
3452 let control_handle =
3453 HciTransportControlHandle { inner: this.inner.clone() };
3454 Ok(HciTransportRequest::AckReceive { control_handle })
3455 }
3456 0x4298072d0498b612 => {
3457 header.validate_request_tx_id(fidl::MethodType::OneWay)?;
3458 let mut req = fidl::new_empty!(
3459 HciTransportConfigureScoRequest,
3460 fidl::encoding::DefaultFuchsiaResourceDialect
3461 );
3462 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<HciTransportConfigureScoRequest>(&header, _body_bytes, handles, &mut req)?;
3463 let control_handle =
3464 HciTransportControlHandle { inner: this.inner.clone() };
3465 Ok(HciTransportRequest::ConfigureSco { payload: req, control_handle })
3466 }
3467 _ if header.tx_id == 0
3468 && header
3469 .dynamic_flags()
3470 .contains(fidl::encoding::DynamicFlags::FLEXIBLE) =>
3471 {
3472 Ok(HciTransportRequest::_UnknownMethod {
3473 ordinal: header.ordinal,
3474 control_handle: HciTransportControlHandle { inner: this.inner.clone() },
3475 method_type: fidl::MethodType::OneWay,
3476 })
3477 }
3478 _ if header
3479 .dynamic_flags()
3480 .contains(fidl::encoding::DynamicFlags::FLEXIBLE) =>
3481 {
3482 this.inner.send_framework_err(
3483 fidl::encoding::FrameworkErr::UnknownMethod,
3484 header.tx_id,
3485 header.ordinal,
3486 header.dynamic_flags(),
3487 (bytes, handles),
3488 )?;
3489 Ok(HciTransportRequest::_UnknownMethod {
3490 ordinal: header.ordinal,
3491 control_handle: HciTransportControlHandle { inner: this.inner.clone() },
3492 method_type: fidl::MethodType::TwoWay,
3493 })
3494 }
3495 _ => Err(fidl::Error::UnknownOrdinal {
3496 ordinal: header.ordinal,
3497 protocol_name:
3498 <HciTransportMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
3499 }),
3500 }))
3501 },
3502 )
3503 }
3504}
3505
3506#[derive(Debug)]
3507pub enum HciTransportRequest {
3508 Send_ {
3513 payload: SentPacket,
3514 responder: HciTransportSend_Responder,
3515 },
3516 AckReceive {
3517 control_handle: HciTransportControlHandle,
3518 },
3519 ConfigureSco {
3521 payload: HciTransportConfigureScoRequest,
3522 control_handle: HciTransportControlHandle,
3523 },
3524 #[non_exhaustive]
3526 _UnknownMethod {
3527 ordinal: u64,
3529 control_handle: HciTransportControlHandle,
3530 method_type: fidl::MethodType,
3531 },
3532}
3533
3534impl HciTransportRequest {
3535 #[allow(irrefutable_let_patterns)]
3536 pub fn into_send_(self) -> Option<(SentPacket, HciTransportSend_Responder)> {
3537 if let HciTransportRequest::Send_ { payload, responder } = self {
3538 Some((payload, responder))
3539 } else {
3540 None
3541 }
3542 }
3543
3544 #[allow(irrefutable_let_patterns)]
3545 pub fn into_ack_receive(self) -> Option<(HciTransportControlHandle)> {
3546 if let HciTransportRequest::AckReceive { control_handle } = self {
3547 Some((control_handle))
3548 } else {
3549 None
3550 }
3551 }
3552
3553 #[allow(irrefutable_let_patterns)]
3554 pub fn into_configure_sco(
3555 self,
3556 ) -> Option<(HciTransportConfigureScoRequest, HciTransportControlHandle)> {
3557 if let HciTransportRequest::ConfigureSco { payload, control_handle } = self {
3558 Some((payload, control_handle))
3559 } else {
3560 None
3561 }
3562 }
3563
3564 pub fn method_name(&self) -> &'static str {
3566 match *self {
3567 HciTransportRequest::Send_ { .. } => "send_",
3568 HciTransportRequest::AckReceive { .. } => "ack_receive",
3569 HciTransportRequest::ConfigureSco { .. } => "configure_sco",
3570 HciTransportRequest::_UnknownMethod {
3571 method_type: fidl::MethodType::OneWay, ..
3572 } => "unknown one-way method",
3573 HciTransportRequest::_UnknownMethod {
3574 method_type: fidl::MethodType::TwoWay, ..
3575 } => "unknown two-way method",
3576 }
3577 }
3578}
3579
3580#[derive(Debug, Clone)]
3581pub struct HciTransportControlHandle {
3582 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
3583}
3584
3585impl fidl::endpoints::ControlHandle for HciTransportControlHandle {
3586 fn shutdown(&self) {
3587 self.inner.shutdown()
3588 }
3589 fn shutdown_with_epitaph(&self, status: zx_status::Status) {
3590 self.inner.shutdown_with_epitaph(status)
3591 }
3592
3593 fn is_closed(&self) -> bool {
3594 self.inner.channel().is_closed()
3595 }
3596 fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
3597 self.inner.channel().on_closed()
3598 }
3599
3600 #[cfg(target_os = "fuchsia")]
3601 fn signal_peer(
3602 &self,
3603 clear_mask: zx::Signals,
3604 set_mask: zx::Signals,
3605 ) -> Result<(), zx_status::Status> {
3606 use fidl::Peered;
3607 self.inner.channel().signal_peer(clear_mask, set_mask)
3608 }
3609}
3610
3611impl HciTransportControlHandle {
3612 pub fn send_on_receive(&self, mut payload: &ReceivedPacket) -> Result<(), fidl::Error> {
3613 self.inner.send::<ReceivedPacket>(
3614 payload,
3615 0,
3616 0xcb102e573e5049c,
3617 fidl::encoding::DynamicFlags::FLEXIBLE,
3618 )
3619 }
3620}
3621
3622#[must_use = "FIDL methods require a response to be sent"]
3623#[derive(Debug)]
3624pub struct HciTransportSend_Responder {
3625 control_handle: std::mem::ManuallyDrop<HciTransportControlHandle>,
3626 tx_id: u32,
3627}
3628
3629impl std::ops::Drop for HciTransportSend_Responder {
3633 fn drop(&mut self) {
3634 self.control_handle.shutdown();
3635 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
3637 }
3638}
3639
3640impl fidl::endpoints::Responder for HciTransportSend_Responder {
3641 type ControlHandle = HciTransportControlHandle;
3642
3643 fn control_handle(&self) -> &HciTransportControlHandle {
3644 &self.control_handle
3645 }
3646
3647 fn drop_without_shutdown(mut self) {
3648 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
3650 std::mem::forget(self);
3652 }
3653}
3654
3655impl HciTransportSend_Responder {
3656 pub fn send(self) -> Result<(), fidl::Error> {
3660 let _result = self.send_raw();
3661 if _result.is_err() {
3662 self.control_handle.shutdown();
3663 }
3664 self.drop_without_shutdown();
3665 _result
3666 }
3667
3668 pub fn send_no_shutdown_on_err(self) -> Result<(), fidl::Error> {
3670 let _result = self.send_raw();
3671 self.drop_without_shutdown();
3672 _result
3673 }
3674
3675 fn send_raw(&self) -> Result<(), fidl::Error> {
3676 self.control_handle.inner.send::<fidl::encoding::FlexibleType<fidl::encoding::EmptyStruct>>(
3677 fidl::encoding::Flexible::new(()),
3678 self.tx_id,
3679 0x4793b5e66fd79e0b,
3680 fidl::encoding::DynamicFlags::FLEXIBLE,
3681 )
3682 }
3683}
3684
3685#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
3686pub struct PeerMarker;
3687
3688impl fidl::endpoints::ProtocolMarker for PeerMarker {
3689 type Proxy = PeerProxy;
3690 type RequestStream = PeerRequestStream;
3691 #[cfg(target_os = "fuchsia")]
3692 type SynchronousProxy = PeerSynchronousProxy;
3693
3694 const DEBUG_NAME: &'static str = "(anonymous) Peer";
3695}
3696pub type PeerSetLeAdvertisementResult = Result<(), EmulatorPeerError>;
3697
3698pub trait PeerProxyInterface: Send + Sync {
3699 type AssignConnectionStatusResponseFut: std::future::Future<Output = Result<(), fidl::Error>>
3700 + Send;
3701 fn r#assign_connection_status(
3702 &self,
3703 status: HciError,
3704 ) -> Self::AssignConnectionStatusResponseFut;
3705 fn r#emulate_le_connection_complete(
3706 &self,
3707 role: fidl_fuchsia_bluetooth::ConnectionRole,
3708 ) -> Result<(), fidl::Error>;
3709 fn r#emulate_disconnection_complete(&self) -> Result<(), fidl::Error>;
3710 type WatchConnectionStatesResponseFut: std::future::Future<Output = Result<Vec<ConnectionState>, fidl::Error>>
3711 + Send;
3712 fn r#watch_connection_states(&self) -> Self::WatchConnectionStatesResponseFut;
3713 type SetDeviceClassResponseFut: std::future::Future<Output = Result<(), fidl::Error>> + Send;
3714 fn r#set_device_class(&self, value: u32) -> Self::SetDeviceClassResponseFut;
3715 type SetServiceDefinitionsResponseFut: std::future::Future<Output = Result<(), fidl::Error>>
3716 + Send;
3717 fn r#set_service_definitions(
3718 &self,
3719 service_definitions: &[fidl_fuchsia_bluetooth_bredr::ServiceDefinition],
3720 ) -> Self::SetServiceDefinitionsResponseFut;
3721 type SetLeAdvertisementResponseFut: std::future::Future<Output = Result<PeerSetLeAdvertisementResult, fidl::Error>>
3722 + Send;
3723 fn r#set_le_advertisement(
3724 &self,
3725 payload: &PeerSetLeAdvertisementRequest,
3726 ) -> Self::SetLeAdvertisementResponseFut;
3727}
3728#[derive(Debug)]
3729#[cfg(target_os = "fuchsia")]
3730pub struct PeerSynchronousProxy {
3731 client: fidl::client::sync::Client,
3732}
3733
3734#[cfg(target_os = "fuchsia")]
3735impl fidl::endpoints::SynchronousProxy for PeerSynchronousProxy {
3736 type Proxy = PeerProxy;
3737 type Protocol = PeerMarker;
3738
3739 fn from_channel(inner: fidl::Channel) -> Self {
3740 Self::new(inner)
3741 }
3742
3743 fn into_channel(self) -> fidl::Channel {
3744 self.client.into_channel()
3745 }
3746
3747 fn as_channel(&self) -> &fidl::Channel {
3748 self.client.as_channel()
3749 }
3750}
3751
3752#[cfg(target_os = "fuchsia")]
3753impl PeerSynchronousProxy {
3754 pub fn new(channel: fidl::Channel) -> Self {
3755 let protocol_name = <PeerMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
3756 Self { client: fidl::client::sync::Client::new(channel, protocol_name) }
3757 }
3758
3759 pub fn into_channel(self) -> fidl::Channel {
3760 self.client.into_channel()
3761 }
3762
3763 pub fn wait_for_event(&self, deadline: zx::MonotonicInstant) -> Result<PeerEvent, fidl::Error> {
3766 PeerEvent::decode(self.client.wait_for_event(deadline)?)
3767 }
3768
3769 pub fn r#assign_connection_status(
3773 &self,
3774 mut status: HciError,
3775 ___deadline: zx::MonotonicInstant,
3776 ) -> Result<(), fidl::Error> {
3777 let _response = self.client.send_query::<
3778 PeerAssignConnectionStatusRequest,
3779 fidl::encoding::FlexibleType<fidl::encoding::EmptyStruct>,
3780 >(
3781 (status,),
3782 0x52810c5ba7a2555c,
3783 fidl::encoding::DynamicFlags::FLEXIBLE,
3784 ___deadline,
3785 )?
3786 .into_result::<PeerMarker>("assign_connection_status")?;
3787 Ok(_response)
3788 }
3789
3790 pub fn r#emulate_le_connection_complete(
3793 &self,
3794 mut role: fidl_fuchsia_bluetooth::ConnectionRole,
3795 ) -> Result<(), fidl::Error> {
3796 self.client.send::<PeerEmulateLeConnectionCompleteRequest>(
3797 (role,),
3798 0x3dfba319b8d2fc2a,
3799 fidl::encoding::DynamicFlags::FLEXIBLE,
3800 )
3801 }
3802
3803 pub fn r#emulate_disconnection_complete(&self) -> Result<(), fidl::Error> {
3805 self.client.send::<fidl::encoding::EmptyPayload>(
3806 (),
3807 0x4d3955084d85a15c,
3808 fidl::encoding::DynamicFlags::FLEXIBLE,
3809 )
3810 }
3811
3812 pub fn r#watch_connection_states(
3819 &self,
3820 ___deadline: zx::MonotonicInstant,
3821 ) -> Result<Vec<ConnectionState>, fidl::Error> {
3822 let _response = self.client.send_query::<
3823 fidl::encoding::EmptyPayload,
3824 fidl::encoding::FlexibleType<PeerWatchConnectionStatesResponse>,
3825 >(
3826 (),
3827 0x5a5190211980c70f,
3828 fidl::encoding::DynamicFlags::FLEXIBLE,
3829 ___deadline,
3830 )?
3831 .into_result::<PeerMarker>("watch_connection_states")?;
3832 Ok(_response.states)
3833 }
3834
3835 pub fn r#set_device_class(
3839 &self,
3840 mut value: u32,
3841 ___deadline: zx::MonotonicInstant,
3842 ) -> Result<(), fidl::Error> {
3843 let _response = self.client.send_query::<
3844 fidl_fuchsia_bluetooth::DeviceClass,
3845 fidl::encoding::FlexibleType<fidl::encoding::EmptyStruct>,
3846 >(
3847 (value,),
3848 0x3e52fa234758e1ea,
3849 fidl::encoding::DynamicFlags::FLEXIBLE,
3850 ___deadline,
3851 )?
3852 .into_result::<PeerMarker>("set_device_class")?;
3853 Ok(_response)
3854 }
3855
3856 pub fn r#set_service_definitions(
3859 &self,
3860 mut service_definitions: &[fidl_fuchsia_bluetooth_bredr::ServiceDefinition],
3861 ___deadline: zx::MonotonicInstant,
3862 ) -> Result<(), fidl::Error> {
3863 let _response = self.client.send_query::<
3864 PeerSetServiceDefinitionsRequest,
3865 fidl::encoding::FlexibleType<fidl::encoding::EmptyStruct>,
3866 >(
3867 (service_definitions,),
3868 0x58ce9f22fce272df,
3869 fidl::encoding::DynamicFlags::FLEXIBLE,
3870 ___deadline,
3871 )?
3872 .into_result::<PeerMarker>("set_service_definitions")?;
3873 Ok(_response)
3874 }
3875
3876 pub fn r#set_le_advertisement(
3877 &self,
3878 mut payload: &PeerSetLeAdvertisementRequest,
3879 ___deadline: zx::MonotonicInstant,
3880 ) -> Result<PeerSetLeAdvertisementResult, fidl::Error> {
3881 let _response = self.client.send_query::<
3882 PeerSetLeAdvertisementRequest,
3883 fidl::encoding::FlexibleResultType<fidl::encoding::EmptyStruct, EmulatorPeerError>,
3884 >(
3885 payload,
3886 0x481b9aea1b39cfb4,
3887 fidl::encoding::DynamicFlags::FLEXIBLE,
3888 ___deadline,
3889 )?
3890 .into_result::<PeerMarker>("set_le_advertisement")?;
3891 Ok(_response.map(|x| x))
3892 }
3893}
3894
3895#[cfg(target_os = "fuchsia")]
3896impl From<PeerSynchronousProxy> for zx::Handle {
3897 fn from(value: PeerSynchronousProxy) -> Self {
3898 value.into_channel().into()
3899 }
3900}
3901
3902#[cfg(target_os = "fuchsia")]
3903impl From<fidl::Channel> for PeerSynchronousProxy {
3904 fn from(value: fidl::Channel) -> Self {
3905 Self::new(value)
3906 }
3907}
3908
3909#[derive(Debug, Clone)]
3910pub struct PeerProxy {
3911 client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
3912}
3913
3914impl fidl::endpoints::Proxy for PeerProxy {
3915 type Protocol = PeerMarker;
3916
3917 fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
3918 Self::new(inner)
3919 }
3920
3921 fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
3922 self.client.into_channel().map_err(|client| Self { client })
3923 }
3924
3925 fn as_channel(&self) -> &::fidl::AsyncChannel {
3926 self.client.as_channel()
3927 }
3928}
3929
3930impl PeerProxy {
3931 pub fn new(channel: ::fidl::AsyncChannel) -> Self {
3933 let protocol_name = <PeerMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
3934 Self { client: fidl::client::Client::new(channel, protocol_name) }
3935 }
3936
3937 pub fn take_event_stream(&self) -> PeerEventStream {
3943 PeerEventStream { event_receiver: self.client.take_event_receiver() }
3944 }
3945
3946 pub fn r#assign_connection_status(
3950 &self,
3951 mut status: HciError,
3952 ) -> fidl::client::QueryResponseFut<(), fidl::encoding::DefaultFuchsiaResourceDialect> {
3953 PeerProxyInterface::r#assign_connection_status(self, status)
3954 }
3955
3956 pub fn r#emulate_le_connection_complete(
3959 &self,
3960 mut role: fidl_fuchsia_bluetooth::ConnectionRole,
3961 ) -> Result<(), fidl::Error> {
3962 PeerProxyInterface::r#emulate_le_connection_complete(self, role)
3963 }
3964
3965 pub fn r#emulate_disconnection_complete(&self) -> Result<(), fidl::Error> {
3967 PeerProxyInterface::r#emulate_disconnection_complete(self)
3968 }
3969
3970 pub fn r#watch_connection_states(
3977 &self,
3978 ) -> fidl::client::QueryResponseFut<
3979 Vec<ConnectionState>,
3980 fidl::encoding::DefaultFuchsiaResourceDialect,
3981 > {
3982 PeerProxyInterface::r#watch_connection_states(self)
3983 }
3984
3985 pub fn r#set_device_class(
3989 &self,
3990 mut value: u32,
3991 ) -> fidl::client::QueryResponseFut<(), fidl::encoding::DefaultFuchsiaResourceDialect> {
3992 PeerProxyInterface::r#set_device_class(self, value)
3993 }
3994
3995 pub fn r#set_service_definitions(
3998 &self,
3999 mut service_definitions: &[fidl_fuchsia_bluetooth_bredr::ServiceDefinition],
4000 ) -> fidl::client::QueryResponseFut<(), fidl::encoding::DefaultFuchsiaResourceDialect> {
4001 PeerProxyInterface::r#set_service_definitions(self, service_definitions)
4002 }
4003
4004 pub fn r#set_le_advertisement(
4005 &self,
4006 mut payload: &PeerSetLeAdvertisementRequest,
4007 ) -> fidl::client::QueryResponseFut<
4008 PeerSetLeAdvertisementResult,
4009 fidl::encoding::DefaultFuchsiaResourceDialect,
4010 > {
4011 PeerProxyInterface::r#set_le_advertisement(self, payload)
4012 }
4013}
4014
4015impl PeerProxyInterface for PeerProxy {
4016 type AssignConnectionStatusResponseFut =
4017 fidl::client::QueryResponseFut<(), fidl::encoding::DefaultFuchsiaResourceDialect>;
4018 fn r#assign_connection_status(
4019 &self,
4020 mut status: HciError,
4021 ) -> Self::AssignConnectionStatusResponseFut {
4022 fn _decode(
4023 mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
4024 ) -> Result<(), fidl::Error> {
4025 let _response = fidl::client::decode_transaction_body::<
4026 fidl::encoding::FlexibleType<fidl::encoding::EmptyStruct>,
4027 fidl::encoding::DefaultFuchsiaResourceDialect,
4028 0x52810c5ba7a2555c,
4029 >(_buf?)?
4030 .into_result::<PeerMarker>("assign_connection_status")?;
4031 Ok(_response)
4032 }
4033 self.client.send_query_and_decode::<PeerAssignConnectionStatusRequest, ()>(
4034 (status,),
4035 0x52810c5ba7a2555c,
4036 fidl::encoding::DynamicFlags::FLEXIBLE,
4037 _decode,
4038 )
4039 }
4040
4041 fn r#emulate_le_connection_complete(
4042 &self,
4043 mut role: fidl_fuchsia_bluetooth::ConnectionRole,
4044 ) -> Result<(), fidl::Error> {
4045 self.client.send::<PeerEmulateLeConnectionCompleteRequest>(
4046 (role,),
4047 0x3dfba319b8d2fc2a,
4048 fidl::encoding::DynamicFlags::FLEXIBLE,
4049 )
4050 }
4051
4052 fn r#emulate_disconnection_complete(&self) -> Result<(), fidl::Error> {
4053 self.client.send::<fidl::encoding::EmptyPayload>(
4054 (),
4055 0x4d3955084d85a15c,
4056 fidl::encoding::DynamicFlags::FLEXIBLE,
4057 )
4058 }
4059
4060 type WatchConnectionStatesResponseFut = fidl::client::QueryResponseFut<
4061 Vec<ConnectionState>,
4062 fidl::encoding::DefaultFuchsiaResourceDialect,
4063 >;
4064 fn r#watch_connection_states(&self) -> Self::WatchConnectionStatesResponseFut {
4065 fn _decode(
4066 mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
4067 ) -> Result<Vec<ConnectionState>, fidl::Error> {
4068 let _response = fidl::client::decode_transaction_body::<
4069 fidl::encoding::FlexibleType<PeerWatchConnectionStatesResponse>,
4070 fidl::encoding::DefaultFuchsiaResourceDialect,
4071 0x5a5190211980c70f,
4072 >(_buf?)?
4073 .into_result::<PeerMarker>("watch_connection_states")?;
4074 Ok(_response.states)
4075 }
4076 self.client.send_query_and_decode::<fidl::encoding::EmptyPayload, Vec<ConnectionState>>(
4077 (),
4078 0x5a5190211980c70f,
4079 fidl::encoding::DynamicFlags::FLEXIBLE,
4080 _decode,
4081 )
4082 }
4083
4084 type SetDeviceClassResponseFut =
4085 fidl::client::QueryResponseFut<(), fidl::encoding::DefaultFuchsiaResourceDialect>;
4086 fn r#set_device_class(&self, mut value: u32) -> Self::SetDeviceClassResponseFut {
4087 fn _decode(
4088 mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
4089 ) -> Result<(), fidl::Error> {
4090 let _response = fidl::client::decode_transaction_body::<
4091 fidl::encoding::FlexibleType<fidl::encoding::EmptyStruct>,
4092 fidl::encoding::DefaultFuchsiaResourceDialect,
4093 0x3e52fa234758e1ea,
4094 >(_buf?)?
4095 .into_result::<PeerMarker>("set_device_class")?;
4096 Ok(_response)
4097 }
4098 self.client.send_query_and_decode::<fidl_fuchsia_bluetooth::DeviceClass, ()>(
4099 (value,),
4100 0x3e52fa234758e1ea,
4101 fidl::encoding::DynamicFlags::FLEXIBLE,
4102 _decode,
4103 )
4104 }
4105
4106 type SetServiceDefinitionsResponseFut =
4107 fidl::client::QueryResponseFut<(), fidl::encoding::DefaultFuchsiaResourceDialect>;
4108 fn r#set_service_definitions(
4109 &self,
4110 mut service_definitions: &[fidl_fuchsia_bluetooth_bredr::ServiceDefinition],
4111 ) -> Self::SetServiceDefinitionsResponseFut {
4112 fn _decode(
4113 mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
4114 ) -> Result<(), fidl::Error> {
4115 let _response = fidl::client::decode_transaction_body::<
4116 fidl::encoding::FlexibleType<fidl::encoding::EmptyStruct>,
4117 fidl::encoding::DefaultFuchsiaResourceDialect,
4118 0x58ce9f22fce272df,
4119 >(_buf?)?
4120 .into_result::<PeerMarker>("set_service_definitions")?;
4121 Ok(_response)
4122 }
4123 self.client.send_query_and_decode::<PeerSetServiceDefinitionsRequest, ()>(
4124 (service_definitions,),
4125 0x58ce9f22fce272df,
4126 fidl::encoding::DynamicFlags::FLEXIBLE,
4127 _decode,
4128 )
4129 }
4130
4131 type SetLeAdvertisementResponseFut = fidl::client::QueryResponseFut<
4132 PeerSetLeAdvertisementResult,
4133 fidl::encoding::DefaultFuchsiaResourceDialect,
4134 >;
4135 fn r#set_le_advertisement(
4136 &self,
4137 mut payload: &PeerSetLeAdvertisementRequest,
4138 ) -> Self::SetLeAdvertisementResponseFut {
4139 fn _decode(
4140 mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
4141 ) -> Result<PeerSetLeAdvertisementResult, fidl::Error> {
4142 let _response = fidl::client::decode_transaction_body::<
4143 fidl::encoding::FlexibleResultType<fidl::encoding::EmptyStruct, EmulatorPeerError>,
4144 fidl::encoding::DefaultFuchsiaResourceDialect,
4145 0x481b9aea1b39cfb4,
4146 >(_buf?)?
4147 .into_result::<PeerMarker>("set_le_advertisement")?;
4148 Ok(_response.map(|x| x))
4149 }
4150 self.client
4151 .send_query_and_decode::<PeerSetLeAdvertisementRequest, PeerSetLeAdvertisementResult>(
4152 payload,
4153 0x481b9aea1b39cfb4,
4154 fidl::encoding::DynamicFlags::FLEXIBLE,
4155 _decode,
4156 )
4157 }
4158}
4159
4160pub struct PeerEventStream {
4161 event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
4162}
4163
4164impl std::marker::Unpin for PeerEventStream {}
4165
4166impl futures::stream::FusedStream for PeerEventStream {
4167 fn is_terminated(&self) -> bool {
4168 self.event_receiver.is_terminated()
4169 }
4170}
4171
4172impl futures::Stream for PeerEventStream {
4173 type Item = Result<PeerEvent, fidl::Error>;
4174
4175 fn poll_next(
4176 mut self: std::pin::Pin<&mut Self>,
4177 cx: &mut std::task::Context<'_>,
4178 ) -> std::task::Poll<Option<Self::Item>> {
4179 match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
4180 &mut self.event_receiver,
4181 cx
4182 )?) {
4183 Some(buf) => std::task::Poll::Ready(Some(PeerEvent::decode(buf))),
4184 None => std::task::Poll::Ready(None),
4185 }
4186 }
4187}
4188
4189#[derive(Debug)]
4190pub enum PeerEvent {
4191 #[non_exhaustive]
4192 _UnknownEvent {
4193 ordinal: u64,
4195 },
4196}
4197
4198impl PeerEvent {
4199 fn decode(
4201 mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
4202 ) -> Result<PeerEvent, fidl::Error> {
4203 let (bytes, _handles) = buf.split_mut();
4204 let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
4205 debug_assert_eq!(tx_header.tx_id, 0);
4206 match tx_header.ordinal {
4207 _ if tx_header.dynamic_flags().contains(fidl::encoding::DynamicFlags::FLEXIBLE) => {
4208 Ok(PeerEvent::_UnknownEvent { ordinal: tx_header.ordinal })
4209 }
4210 _ => Err(fidl::Error::UnknownOrdinal {
4211 ordinal: tx_header.ordinal,
4212 protocol_name: <PeerMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
4213 }),
4214 }
4215 }
4216}
4217
4218pub struct PeerRequestStream {
4220 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
4221 is_terminated: bool,
4222}
4223
4224impl std::marker::Unpin for PeerRequestStream {}
4225
4226impl futures::stream::FusedStream for PeerRequestStream {
4227 fn is_terminated(&self) -> bool {
4228 self.is_terminated
4229 }
4230}
4231
4232impl fidl::endpoints::RequestStream for PeerRequestStream {
4233 type Protocol = PeerMarker;
4234 type ControlHandle = PeerControlHandle;
4235
4236 fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
4237 Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
4238 }
4239
4240 fn control_handle(&self) -> Self::ControlHandle {
4241 PeerControlHandle { inner: self.inner.clone() }
4242 }
4243
4244 fn into_inner(
4245 self,
4246 ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
4247 {
4248 (self.inner, self.is_terminated)
4249 }
4250
4251 fn from_inner(
4252 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
4253 is_terminated: bool,
4254 ) -> Self {
4255 Self { inner, is_terminated }
4256 }
4257}
4258
4259impl futures::Stream for PeerRequestStream {
4260 type Item = Result<PeerRequest, fidl::Error>;
4261
4262 fn poll_next(
4263 mut self: std::pin::Pin<&mut Self>,
4264 cx: &mut std::task::Context<'_>,
4265 ) -> std::task::Poll<Option<Self::Item>> {
4266 let this = &mut *self;
4267 if this.inner.check_shutdown(cx) {
4268 this.is_terminated = true;
4269 return std::task::Poll::Ready(None);
4270 }
4271 if this.is_terminated {
4272 panic!("polled PeerRequestStream after completion");
4273 }
4274 fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
4275 |bytes, handles| {
4276 match this.inner.channel().read_etc(cx, bytes, handles) {
4277 std::task::Poll::Ready(Ok(())) => {}
4278 std::task::Poll::Pending => return std::task::Poll::Pending,
4279 std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
4280 this.is_terminated = true;
4281 return std::task::Poll::Ready(None);
4282 }
4283 std::task::Poll::Ready(Err(e)) => {
4284 return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
4285 e.into(),
4286 ))))
4287 }
4288 }
4289
4290 let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
4292
4293 std::task::Poll::Ready(Some(match header.ordinal {
4294 0x52810c5ba7a2555c => {
4295 header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
4296 let mut req = fidl::new_empty!(
4297 PeerAssignConnectionStatusRequest,
4298 fidl::encoding::DefaultFuchsiaResourceDialect
4299 );
4300 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<PeerAssignConnectionStatusRequest>(&header, _body_bytes, handles, &mut req)?;
4301 let control_handle = PeerControlHandle { inner: this.inner.clone() };
4302 Ok(PeerRequest::AssignConnectionStatus {
4303 status: req.status,
4304
4305 responder: PeerAssignConnectionStatusResponder {
4306 control_handle: std::mem::ManuallyDrop::new(control_handle),
4307 tx_id: header.tx_id,
4308 },
4309 })
4310 }
4311 0x3dfba319b8d2fc2a => {
4312 header.validate_request_tx_id(fidl::MethodType::OneWay)?;
4313 let mut req = fidl::new_empty!(
4314 PeerEmulateLeConnectionCompleteRequest,
4315 fidl::encoding::DefaultFuchsiaResourceDialect
4316 );
4317 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<PeerEmulateLeConnectionCompleteRequest>(&header, _body_bytes, handles, &mut req)?;
4318 let control_handle = PeerControlHandle { inner: this.inner.clone() };
4319 Ok(PeerRequest::EmulateLeConnectionComplete {
4320 role: req.role,
4321
4322 control_handle,
4323 })
4324 }
4325 0x4d3955084d85a15c => {
4326 header.validate_request_tx_id(fidl::MethodType::OneWay)?;
4327 let mut req = fidl::new_empty!(
4328 fidl::encoding::EmptyPayload,
4329 fidl::encoding::DefaultFuchsiaResourceDialect
4330 );
4331 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
4332 let control_handle = PeerControlHandle { inner: this.inner.clone() };
4333 Ok(PeerRequest::EmulateDisconnectionComplete { control_handle })
4334 }
4335 0x5a5190211980c70f => {
4336 header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
4337 let mut req = fidl::new_empty!(
4338 fidl::encoding::EmptyPayload,
4339 fidl::encoding::DefaultFuchsiaResourceDialect
4340 );
4341 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
4342 let control_handle = PeerControlHandle { inner: this.inner.clone() };
4343 Ok(PeerRequest::WatchConnectionStates {
4344 responder: PeerWatchConnectionStatesResponder {
4345 control_handle: std::mem::ManuallyDrop::new(control_handle),
4346 tx_id: header.tx_id,
4347 },
4348 })
4349 }
4350 0x3e52fa234758e1ea => {
4351 header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
4352 let mut req = fidl::new_empty!(
4353 fidl_fuchsia_bluetooth::DeviceClass,
4354 fidl::encoding::DefaultFuchsiaResourceDialect
4355 );
4356 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl_fuchsia_bluetooth::DeviceClass>(&header, _body_bytes, handles, &mut req)?;
4357 let control_handle = PeerControlHandle { inner: this.inner.clone() };
4358 Ok(PeerRequest::SetDeviceClass {
4359 value: req.value,
4360
4361 responder: PeerSetDeviceClassResponder {
4362 control_handle: std::mem::ManuallyDrop::new(control_handle),
4363 tx_id: header.tx_id,
4364 },
4365 })
4366 }
4367 0x58ce9f22fce272df => {
4368 header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
4369 let mut req = fidl::new_empty!(
4370 PeerSetServiceDefinitionsRequest,
4371 fidl::encoding::DefaultFuchsiaResourceDialect
4372 );
4373 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<PeerSetServiceDefinitionsRequest>(&header, _body_bytes, handles, &mut req)?;
4374 let control_handle = PeerControlHandle { inner: this.inner.clone() };
4375 Ok(PeerRequest::SetServiceDefinitions {
4376 service_definitions: req.service_definitions,
4377
4378 responder: PeerSetServiceDefinitionsResponder {
4379 control_handle: std::mem::ManuallyDrop::new(control_handle),
4380 tx_id: header.tx_id,
4381 },
4382 })
4383 }
4384 0x481b9aea1b39cfb4 => {
4385 header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
4386 let mut req = fidl::new_empty!(
4387 PeerSetLeAdvertisementRequest,
4388 fidl::encoding::DefaultFuchsiaResourceDialect
4389 );
4390 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<PeerSetLeAdvertisementRequest>(&header, _body_bytes, handles, &mut req)?;
4391 let control_handle = PeerControlHandle { inner: this.inner.clone() };
4392 Ok(PeerRequest::SetLeAdvertisement {
4393 payload: req,
4394 responder: PeerSetLeAdvertisementResponder {
4395 control_handle: std::mem::ManuallyDrop::new(control_handle),
4396 tx_id: header.tx_id,
4397 },
4398 })
4399 }
4400 _ if header.tx_id == 0
4401 && header
4402 .dynamic_flags()
4403 .contains(fidl::encoding::DynamicFlags::FLEXIBLE) =>
4404 {
4405 Ok(PeerRequest::_UnknownMethod {
4406 ordinal: header.ordinal,
4407 control_handle: PeerControlHandle { inner: this.inner.clone() },
4408 method_type: fidl::MethodType::OneWay,
4409 })
4410 }
4411 _ if header
4412 .dynamic_flags()
4413 .contains(fidl::encoding::DynamicFlags::FLEXIBLE) =>
4414 {
4415 this.inner.send_framework_err(
4416 fidl::encoding::FrameworkErr::UnknownMethod,
4417 header.tx_id,
4418 header.ordinal,
4419 header.dynamic_flags(),
4420 (bytes, handles),
4421 )?;
4422 Ok(PeerRequest::_UnknownMethod {
4423 ordinal: header.ordinal,
4424 control_handle: PeerControlHandle { inner: this.inner.clone() },
4425 method_type: fidl::MethodType::TwoWay,
4426 })
4427 }
4428 _ => Err(fidl::Error::UnknownOrdinal {
4429 ordinal: header.ordinal,
4430 protocol_name: <PeerMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
4431 }),
4432 }))
4433 },
4434 )
4435 }
4436}
4437
4438#[derive(Debug)]
4440pub enum PeerRequest {
4441 AssignConnectionStatus { status: HciError, responder: PeerAssignConnectionStatusResponder },
4445 EmulateLeConnectionComplete {
4448 role: fidl_fuchsia_bluetooth::ConnectionRole,
4449 control_handle: PeerControlHandle,
4450 },
4451 EmulateDisconnectionComplete { control_handle: PeerControlHandle },
4453 WatchConnectionStates { responder: PeerWatchConnectionStatesResponder },
4460 SetDeviceClass { value: u32, responder: PeerSetDeviceClassResponder },
4464 SetServiceDefinitions {
4467 service_definitions: Vec<fidl_fuchsia_bluetooth_bredr::ServiceDefinition>,
4468 responder: PeerSetServiceDefinitionsResponder,
4469 },
4470 SetLeAdvertisement {
4471 payload: PeerSetLeAdvertisementRequest,
4472 responder: PeerSetLeAdvertisementResponder,
4473 },
4474 #[non_exhaustive]
4476 _UnknownMethod {
4477 ordinal: u64,
4479 control_handle: PeerControlHandle,
4480 method_type: fidl::MethodType,
4481 },
4482}
4483
4484impl PeerRequest {
4485 #[allow(irrefutable_let_patterns)]
4486 pub fn into_assign_connection_status(
4487 self,
4488 ) -> Option<(HciError, PeerAssignConnectionStatusResponder)> {
4489 if let PeerRequest::AssignConnectionStatus { status, responder } = self {
4490 Some((status, responder))
4491 } else {
4492 None
4493 }
4494 }
4495
4496 #[allow(irrefutable_let_patterns)]
4497 pub fn into_emulate_le_connection_complete(
4498 self,
4499 ) -> Option<(fidl_fuchsia_bluetooth::ConnectionRole, PeerControlHandle)> {
4500 if let PeerRequest::EmulateLeConnectionComplete { role, control_handle } = self {
4501 Some((role, control_handle))
4502 } else {
4503 None
4504 }
4505 }
4506
4507 #[allow(irrefutable_let_patterns)]
4508 pub fn into_emulate_disconnection_complete(self) -> Option<(PeerControlHandle)> {
4509 if let PeerRequest::EmulateDisconnectionComplete { control_handle } = self {
4510 Some((control_handle))
4511 } else {
4512 None
4513 }
4514 }
4515
4516 #[allow(irrefutable_let_patterns)]
4517 pub fn into_watch_connection_states(self) -> Option<(PeerWatchConnectionStatesResponder)> {
4518 if let PeerRequest::WatchConnectionStates { responder } = self {
4519 Some((responder))
4520 } else {
4521 None
4522 }
4523 }
4524
4525 #[allow(irrefutable_let_patterns)]
4526 pub fn into_set_device_class(self) -> Option<(u32, PeerSetDeviceClassResponder)> {
4527 if let PeerRequest::SetDeviceClass { value, responder } = self {
4528 Some((value, responder))
4529 } else {
4530 None
4531 }
4532 }
4533
4534 #[allow(irrefutable_let_patterns)]
4535 pub fn into_set_service_definitions(
4536 self,
4537 ) -> Option<(
4538 Vec<fidl_fuchsia_bluetooth_bredr::ServiceDefinition>,
4539 PeerSetServiceDefinitionsResponder,
4540 )> {
4541 if let PeerRequest::SetServiceDefinitions { service_definitions, responder } = self {
4542 Some((service_definitions, responder))
4543 } else {
4544 None
4545 }
4546 }
4547
4548 #[allow(irrefutable_let_patterns)]
4549 pub fn into_set_le_advertisement(
4550 self,
4551 ) -> Option<(PeerSetLeAdvertisementRequest, PeerSetLeAdvertisementResponder)> {
4552 if let PeerRequest::SetLeAdvertisement { payload, responder } = self {
4553 Some((payload, responder))
4554 } else {
4555 None
4556 }
4557 }
4558
4559 pub fn method_name(&self) -> &'static str {
4561 match *self {
4562 PeerRequest::AssignConnectionStatus { .. } => "assign_connection_status",
4563 PeerRequest::EmulateLeConnectionComplete { .. } => "emulate_le_connection_complete",
4564 PeerRequest::EmulateDisconnectionComplete { .. } => "emulate_disconnection_complete",
4565 PeerRequest::WatchConnectionStates { .. } => "watch_connection_states",
4566 PeerRequest::SetDeviceClass { .. } => "set_device_class",
4567 PeerRequest::SetServiceDefinitions { .. } => "set_service_definitions",
4568 PeerRequest::SetLeAdvertisement { .. } => "set_le_advertisement",
4569 PeerRequest::_UnknownMethod { method_type: fidl::MethodType::OneWay, .. } => {
4570 "unknown one-way method"
4571 }
4572 PeerRequest::_UnknownMethod { method_type: fidl::MethodType::TwoWay, .. } => {
4573 "unknown two-way method"
4574 }
4575 }
4576 }
4577}
4578
4579#[derive(Debug, Clone)]
4580pub struct PeerControlHandle {
4581 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
4582}
4583
4584impl fidl::endpoints::ControlHandle for PeerControlHandle {
4585 fn shutdown(&self) {
4586 self.inner.shutdown()
4587 }
4588 fn shutdown_with_epitaph(&self, status: zx_status::Status) {
4589 self.inner.shutdown_with_epitaph(status)
4590 }
4591
4592 fn is_closed(&self) -> bool {
4593 self.inner.channel().is_closed()
4594 }
4595 fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
4596 self.inner.channel().on_closed()
4597 }
4598
4599 #[cfg(target_os = "fuchsia")]
4600 fn signal_peer(
4601 &self,
4602 clear_mask: zx::Signals,
4603 set_mask: zx::Signals,
4604 ) -> Result<(), zx_status::Status> {
4605 use fidl::Peered;
4606 self.inner.channel().signal_peer(clear_mask, set_mask)
4607 }
4608}
4609
4610impl PeerControlHandle {}
4611
4612#[must_use = "FIDL methods require a response to be sent"]
4613#[derive(Debug)]
4614pub struct PeerAssignConnectionStatusResponder {
4615 control_handle: std::mem::ManuallyDrop<PeerControlHandle>,
4616 tx_id: u32,
4617}
4618
4619impl std::ops::Drop for PeerAssignConnectionStatusResponder {
4623 fn drop(&mut self) {
4624 self.control_handle.shutdown();
4625 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
4627 }
4628}
4629
4630impl fidl::endpoints::Responder for PeerAssignConnectionStatusResponder {
4631 type ControlHandle = PeerControlHandle;
4632
4633 fn control_handle(&self) -> &PeerControlHandle {
4634 &self.control_handle
4635 }
4636
4637 fn drop_without_shutdown(mut self) {
4638 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
4640 std::mem::forget(self);
4642 }
4643}
4644
4645impl PeerAssignConnectionStatusResponder {
4646 pub fn send(self) -> Result<(), fidl::Error> {
4650 let _result = self.send_raw();
4651 if _result.is_err() {
4652 self.control_handle.shutdown();
4653 }
4654 self.drop_without_shutdown();
4655 _result
4656 }
4657
4658 pub fn send_no_shutdown_on_err(self) -> Result<(), fidl::Error> {
4660 let _result = self.send_raw();
4661 self.drop_without_shutdown();
4662 _result
4663 }
4664
4665 fn send_raw(&self) -> Result<(), fidl::Error> {
4666 self.control_handle.inner.send::<fidl::encoding::FlexibleType<fidl::encoding::EmptyStruct>>(
4667 fidl::encoding::Flexible::new(()),
4668 self.tx_id,
4669 0x52810c5ba7a2555c,
4670 fidl::encoding::DynamicFlags::FLEXIBLE,
4671 )
4672 }
4673}
4674
4675#[must_use = "FIDL methods require a response to be sent"]
4676#[derive(Debug)]
4677pub struct PeerWatchConnectionStatesResponder {
4678 control_handle: std::mem::ManuallyDrop<PeerControlHandle>,
4679 tx_id: u32,
4680}
4681
4682impl std::ops::Drop for PeerWatchConnectionStatesResponder {
4686 fn drop(&mut self) {
4687 self.control_handle.shutdown();
4688 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
4690 }
4691}
4692
4693impl fidl::endpoints::Responder for PeerWatchConnectionStatesResponder {
4694 type ControlHandle = PeerControlHandle;
4695
4696 fn control_handle(&self) -> &PeerControlHandle {
4697 &self.control_handle
4698 }
4699
4700 fn drop_without_shutdown(mut self) {
4701 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
4703 std::mem::forget(self);
4705 }
4706}
4707
4708impl PeerWatchConnectionStatesResponder {
4709 pub fn send(self, mut states: &[ConnectionState]) -> Result<(), fidl::Error> {
4713 let _result = self.send_raw(states);
4714 if _result.is_err() {
4715 self.control_handle.shutdown();
4716 }
4717 self.drop_without_shutdown();
4718 _result
4719 }
4720
4721 pub fn send_no_shutdown_on_err(
4723 self,
4724 mut states: &[ConnectionState],
4725 ) -> Result<(), fidl::Error> {
4726 let _result = self.send_raw(states);
4727 self.drop_without_shutdown();
4728 _result
4729 }
4730
4731 fn send_raw(&self, mut states: &[ConnectionState]) -> Result<(), fidl::Error> {
4732 self.control_handle
4733 .inner
4734 .send::<fidl::encoding::FlexibleType<PeerWatchConnectionStatesResponse>>(
4735 fidl::encoding::Flexible::new((states,)),
4736 self.tx_id,
4737 0x5a5190211980c70f,
4738 fidl::encoding::DynamicFlags::FLEXIBLE,
4739 )
4740 }
4741}
4742
4743#[must_use = "FIDL methods require a response to be sent"]
4744#[derive(Debug)]
4745pub struct PeerSetDeviceClassResponder {
4746 control_handle: std::mem::ManuallyDrop<PeerControlHandle>,
4747 tx_id: u32,
4748}
4749
4750impl std::ops::Drop for PeerSetDeviceClassResponder {
4754 fn drop(&mut self) {
4755 self.control_handle.shutdown();
4756 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
4758 }
4759}
4760
4761impl fidl::endpoints::Responder for PeerSetDeviceClassResponder {
4762 type ControlHandle = PeerControlHandle;
4763
4764 fn control_handle(&self) -> &PeerControlHandle {
4765 &self.control_handle
4766 }
4767
4768 fn drop_without_shutdown(mut self) {
4769 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
4771 std::mem::forget(self);
4773 }
4774}
4775
4776impl PeerSetDeviceClassResponder {
4777 pub fn send(self) -> Result<(), fidl::Error> {
4781 let _result = self.send_raw();
4782 if _result.is_err() {
4783 self.control_handle.shutdown();
4784 }
4785 self.drop_without_shutdown();
4786 _result
4787 }
4788
4789 pub fn send_no_shutdown_on_err(self) -> Result<(), fidl::Error> {
4791 let _result = self.send_raw();
4792 self.drop_without_shutdown();
4793 _result
4794 }
4795
4796 fn send_raw(&self) -> Result<(), fidl::Error> {
4797 self.control_handle.inner.send::<fidl::encoding::FlexibleType<fidl::encoding::EmptyStruct>>(
4798 fidl::encoding::Flexible::new(()),
4799 self.tx_id,
4800 0x3e52fa234758e1ea,
4801 fidl::encoding::DynamicFlags::FLEXIBLE,
4802 )
4803 }
4804}
4805
4806#[must_use = "FIDL methods require a response to be sent"]
4807#[derive(Debug)]
4808pub struct PeerSetServiceDefinitionsResponder {
4809 control_handle: std::mem::ManuallyDrop<PeerControlHandle>,
4810 tx_id: u32,
4811}
4812
4813impl std::ops::Drop for PeerSetServiceDefinitionsResponder {
4817 fn drop(&mut self) {
4818 self.control_handle.shutdown();
4819 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
4821 }
4822}
4823
4824impl fidl::endpoints::Responder for PeerSetServiceDefinitionsResponder {
4825 type ControlHandle = PeerControlHandle;
4826
4827 fn control_handle(&self) -> &PeerControlHandle {
4828 &self.control_handle
4829 }
4830
4831 fn drop_without_shutdown(mut self) {
4832 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
4834 std::mem::forget(self);
4836 }
4837}
4838
4839impl PeerSetServiceDefinitionsResponder {
4840 pub fn send(self) -> Result<(), fidl::Error> {
4844 let _result = self.send_raw();
4845 if _result.is_err() {
4846 self.control_handle.shutdown();
4847 }
4848 self.drop_without_shutdown();
4849 _result
4850 }
4851
4852 pub fn send_no_shutdown_on_err(self) -> Result<(), fidl::Error> {
4854 let _result = self.send_raw();
4855 self.drop_without_shutdown();
4856 _result
4857 }
4858
4859 fn send_raw(&self) -> Result<(), fidl::Error> {
4860 self.control_handle.inner.send::<fidl::encoding::FlexibleType<fidl::encoding::EmptyStruct>>(
4861 fidl::encoding::Flexible::new(()),
4862 self.tx_id,
4863 0x58ce9f22fce272df,
4864 fidl::encoding::DynamicFlags::FLEXIBLE,
4865 )
4866 }
4867}
4868
4869#[must_use = "FIDL methods require a response to be sent"]
4870#[derive(Debug)]
4871pub struct PeerSetLeAdvertisementResponder {
4872 control_handle: std::mem::ManuallyDrop<PeerControlHandle>,
4873 tx_id: u32,
4874}
4875
4876impl std::ops::Drop for PeerSetLeAdvertisementResponder {
4880 fn drop(&mut self) {
4881 self.control_handle.shutdown();
4882 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
4884 }
4885}
4886
4887impl fidl::endpoints::Responder for PeerSetLeAdvertisementResponder {
4888 type ControlHandle = PeerControlHandle;
4889
4890 fn control_handle(&self) -> &PeerControlHandle {
4891 &self.control_handle
4892 }
4893
4894 fn drop_without_shutdown(mut self) {
4895 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
4897 std::mem::forget(self);
4899 }
4900}
4901
4902impl PeerSetLeAdvertisementResponder {
4903 pub fn send(self, mut result: Result<(), EmulatorPeerError>) -> Result<(), fidl::Error> {
4907 let _result = self.send_raw(result);
4908 if _result.is_err() {
4909 self.control_handle.shutdown();
4910 }
4911 self.drop_without_shutdown();
4912 _result
4913 }
4914
4915 pub fn send_no_shutdown_on_err(
4917 self,
4918 mut result: Result<(), EmulatorPeerError>,
4919 ) -> Result<(), fidl::Error> {
4920 let _result = self.send_raw(result);
4921 self.drop_without_shutdown();
4922 _result
4923 }
4924
4925 fn send_raw(&self, mut result: Result<(), EmulatorPeerError>) -> Result<(), fidl::Error> {
4926 self.control_handle.inner.send::<fidl::encoding::FlexibleResultType<
4927 fidl::encoding::EmptyStruct,
4928 EmulatorPeerError,
4929 >>(
4930 fidl::encoding::FlexibleResult::new(result),
4931 self.tx_id,
4932 0x481b9aea1b39cfb4,
4933 fidl::encoding::DynamicFlags::FLEXIBLE,
4934 )
4935 }
4936}
4937
4938#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
4939pub struct ScoConnectionMarker;
4940
4941impl fidl::endpoints::ProtocolMarker for ScoConnectionMarker {
4942 type Proxy = ScoConnectionProxy;
4943 type RequestStream = ScoConnectionRequestStream;
4944 #[cfg(target_os = "fuchsia")]
4945 type SynchronousProxy = ScoConnectionSynchronousProxy;
4946
4947 const DEBUG_NAME: &'static str = "(anonymous) ScoConnection";
4948}
4949
4950pub trait ScoConnectionProxyInterface: Send + Sync {
4951 type Send_ResponseFut: std::future::Future<Output = Result<(), fidl::Error>> + Send;
4952 fn r#send_(&self, packet: &[u8]) -> Self::Send_ResponseFut;
4953 fn r#ack_receive(&self) -> Result<(), fidl::Error>;
4954 fn r#stop(&self) -> Result<(), fidl::Error>;
4955}
4956#[derive(Debug)]
4957#[cfg(target_os = "fuchsia")]
4958pub struct ScoConnectionSynchronousProxy {
4959 client: fidl::client::sync::Client,
4960}
4961
4962#[cfg(target_os = "fuchsia")]
4963impl fidl::endpoints::SynchronousProxy for ScoConnectionSynchronousProxy {
4964 type Proxy = ScoConnectionProxy;
4965 type Protocol = ScoConnectionMarker;
4966
4967 fn from_channel(inner: fidl::Channel) -> Self {
4968 Self::new(inner)
4969 }
4970
4971 fn into_channel(self) -> fidl::Channel {
4972 self.client.into_channel()
4973 }
4974
4975 fn as_channel(&self) -> &fidl::Channel {
4976 self.client.as_channel()
4977 }
4978}
4979
4980#[cfg(target_os = "fuchsia")]
4981impl ScoConnectionSynchronousProxy {
4982 pub fn new(channel: fidl::Channel) -> Self {
4983 let protocol_name = <ScoConnectionMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
4984 Self { client: fidl::client::sync::Client::new(channel, protocol_name) }
4985 }
4986
4987 pub fn into_channel(self) -> fidl::Channel {
4988 self.client.into_channel()
4989 }
4990
4991 pub fn wait_for_event(
4994 &self,
4995 deadline: zx::MonotonicInstant,
4996 ) -> Result<ScoConnectionEvent, fidl::Error> {
4997 ScoConnectionEvent::decode(self.client.wait_for_event(deadline)?)
4998 }
4999
5000 pub fn r#send_(
5004 &self,
5005 mut packet: &[u8],
5006 ___deadline: zx::MonotonicInstant,
5007 ) -> Result<(), fidl::Error> {
5008 let _response = self
5009 .client
5010 .send_query::<ScoPacket, fidl::encoding::FlexibleType<fidl::encoding::EmptyStruct>>(
5011 (packet,),
5012 0x6e0c000ccd50adec,
5013 fidl::encoding::DynamicFlags::FLEXIBLE,
5014 ___deadline,
5015 )?
5016 .into_result::<ScoConnectionMarker>("send_")?;
5017 Ok(_response)
5018 }
5019
5020 pub fn r#ack_receive(&self) -> Result<(), fidl::Error> {
5021 self.client.send::<fidl::encoding::EmptyPayload>(
5022 (),
5023 0x7e6af45151224a6a,
5024 fidl::encoding::DynamicFlags::FLEXIBLE,
5025 )
5026 }
5027
5028 pub fn r#stop(&self) -> Result<(), fidl::Error> {
5031 self.client.send::<fidl::encoding::EmptyPayload>(
5032 (),
5033 0x5df8b0ab265b449d,
5034 fidl::encoding::DynamicFlags::FLEXIBLE,
5035 )
5036 }
5037}
5038
5039#[cfg(target_os = "fuchsia")]
5040impl From<ScoConnectionSynchronousProxy> for zx::Handle {
5041 fn from(value: ScoConnectionSynchronousProxy) -> Self {
5042 value.into_channel().into()
5043 }
5044}
5045
5046#[cfg(target_os = "fuchsia")]
5047impl From<fidl::Channel> for ScoConnectionSynchronousProxy {
5048 fn from(value: fidl::Channel) -> Self {
5049 Self::new(value)
5050 }
5051}
5052
5053#[derive(Debug, Clone)]
5054pub struct ScoConnectionProxy {
5055 client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
5056}
5057
5058impl fidl::endpoints::Proxy for ScoConnectionProxy {
5059 type Protocol = ScoConnectionMarker;
5060
5061 fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
5062 Self::new(inner)
5063 }
5064
5065 fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
5066 self.client.into_channel().map_err(|client| Self { client })
5067 }
5068
5069 fn as_channel(&self) -> &::fidl::AsyncChannel {
5070 self.client.as_channel()
5071 }
5072}
5073
5074impl ScoConnectionProxy {
5075 pub fn new(channel: ::fidl::AsyncChannel) -> Self {
5077 let protocol_name = <ScoConnectionMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
5078 Self { client: fidl::client::Client::new(channel, protocol_name) }
5079 }
5080
5081 pub fn take_event_stream(&self) -> ScoConnectionEventStream {
5087 ScoConnectionEventStream { event_receiver: self.client.take_event_receiver() }
5088 }
5089
5090 pub fn r#send_(
5094 &self,
5095 mut packet: &[u8],
5096 ) -> fidl::client::QueryResponseFut<(), fidl::encoding::DefaultFuchsiaResourceDialect> {
5097 ScoConnectionProxyInterface::r#send_(self, packet)
5098 }
5099
5100 pub fn r#ack_receive(&self) -> Result<(), fidl::Error> {
5101 ScoConnectionProxyInterface::r#ack_receive(self)
5102 }
5103
5104 pub fn r#stop(&self) -> Result<(), fidl::Error> {
5107 ScoConnectionProxyInterface::r#stop(self)
5108 }
5109}
5110
5111impl ScoConnectionProxyInterface for ScoConnectionProxy {
5112 type Send_ResponseFut =
5113 fidl::client::QueryResponseFut<(), fidl::encoding::DefaultFuchsiaResourceDialect>;
5114 fn r#send_(&self, mut packet: &[u8]) -> Self::Send_ResponseFut {
5115 fn _decode(
5116 mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
5117 ) -> Result<(), fidl::Error> {
5118 let _response = fidl::client::decode_transaction_body::<
5119 fidl::encoding::FlexibleType<fidl::encoding::EmptyStruct>,
5120 fidl::encoding::DefaultFuchsiaResourceDialect,
5121 0x6e0c000ccd50adec,
5122 >(_buf?)?
5123 .into_result::<ScoConnectionMarker>("send_")?;
5124 Ok(_response)
5125 }
5126 self.client.send_query_and_decode::<ScoPacket, ()>(
5127 (packet,),
5128 0x6e0c000ccd50adec,
5129 fidl::encoding::DynamicFlags::FLEXIBLE,
5130 _decode,
5131 )
5132 }
5133
5134 fn r#ack_receive(&self) -> Result<(), fidl::Error> {
5135 self.client.send::<fidl::encoding::EmptyPayload>(
5136 (),
5137 0x7e6af45151224a6a,
5138 fidl::encoding::DynamicFlags::FLEXIBLE,
5139 )
5140 }
5141
5142 fn r#stop(&self) -> Result<(), fidl::Error> {
5143 self.client.send::<fidl::encoding::EmptyPayload>(
5144 (),
5145 0x5df8b0ab265b449d,
5146 fidl::encoding::DynamicFlags::FLEXIBLE,
5147 )
5148 }
5149}
5150
5151pub struct ScoConnectionEventStream {
5152 event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
5153}
5154
5155impl std::marker::Unpin for ScoConnectionEventStream {}
5156
5157impl futures::stream::FusedStream for ScoConnectionEventStream {
5158 fn is_terminated(&self) -> bool {
5159 self.event_receiver.is_terminated()
5160 }
5161}
5162
5163impl futures::Stream for ScoConnectionEventStream {
5164 type Item = Result<ScoConnectionEvent, fidl::Error>;
5165
5166 fn poll_next(
5167 mut self: std::pin::Pin<&mut Self>,
5168 cx: &mut std::task::Context<'_>,
5169 ) -> std::task::Poll<Option<Self::Item>> {
5170 match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
5171 &mut self.event_receiver,
5172 cx
5173 )?) {
5174 Some(buf) => std::task::Poll::Ready(Some(ScoConnectionEvent::decode(buf))),
5175 None => std::task::Poll::Ready(None),
5176 }
5177 }
5178}
5179
5180#[derive(Debug)]
5181pub enum ScoConnectionEvent {
5182 OnReceive {
5183 packet: Vec<u8>,
5184 },
5185 #[non_exhaustive]
5186 _UnknownEvent {
5187 ordinal: u64,
5189 },
5190}
5191
5192impl ScoConnectionEvent {
5193 #[allow(irrefutable_let_patterns)]
5194 pub fn into_on_receive(self) -> Option<Vec<u8>> {
5195 if let ScoConnectionEvent::OnReceive { packet } = self {
5196 Some((packet))
5197 } else {
5198 None
5199 }
5200 }
5201
5202 fn decode(
5204 mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
5205 ) -> Result<ScoConnectionEvent, fidl::Error> {
5206 let (bytes, _handles) = buf.split_mut();
5207 let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
5208 debug_assert_eq!(tx_header.tx_id, 0);
5209 match tx_header.ordinal {
5210 0x4d4e96f6f7d1aa12 => {
5211 let mut out =
5212 fidl::new_empty!(ScoPacket, fidl::encoding::DefaultFuchsiaResourceDialect);
5213 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<ScoPacket>(&tx_header, _body_bytes, _handles, &mut out)?;
5214 Ok((ScoConnectionEvent::OnReceive { packet: out.packet }))
5215 }
5216 _ if tx_header.dynamic_flags().contains(fidl::encoding::DynamicFlags::FLEXIBLE) => {
5217 Ok(ScoConnectionEvent::_UnknownEvent { ordinal: tx_header.ordinal })
5218 }
5219 _ => Err(fidl::Error::UnknownOrdinal {
5220 ordinal: tx_header.ordinal,
5221 protocol_name: <ScoConnectionMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
5222 }),
5223 }
5224 }
5225}
5226
5227pub struct ScoConnectionRequestStream {
5229 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
5230 is_terminated: bool,
5231}
5232
5233impl std::marker::Unpin for ScoConnectionRequestStream {}
5234
5235impl futures::stream::FusedStream for ScoConnectionRequestStream {
5236 fn is_terminated(&self) -> bool {
5237 self.is_terminated
5238 }
5239}
5240
5241impl fidl::endpoints::RequestStream for ScoConnectionRequestStream {
5242 type Protocol = ScoConnectionMarker;
5243 type ControlHandle = ScoConnectionControlHandle;
5244
5245 fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
5246 Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
5247 }
5248
5249 fn control_handle(&self) -> Self::ControlHandle {
5250 ScoConnectionControlHandle { inner: self.inner.clone() }
5251 }
5252
5253 fn into_inner(
5254 self,
5255 ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
5256 {
5257 (self.inner, self.is_terminated)
5258 }
5259
5260 fn from_inner(
5261 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
5262 is_terminated: bool,
5263 ) -> Self {
5264 Self { inner, is_terminated }
5265 }
5266}
5267
5268impl futures::Stream for ScoConnectionRequestStream {
5269 type Item = Result<ScoConnectionRequest, fidl::Error>;
5270
5271 fn poll_next(
5272 mut self: std::pin::Pin<&mut Self>,
5273 cx: &mut std::task::Context<'_>,
5274 ) -> std::task::Poll<Option<Self::Item>> {
5275 let this = &mut *self;
5276 if this.inner.check_shutdown(cx) {
5277 this.is_terminated = true;
5278 return std::task::Poll::Ready(None);
5279 }
5280 if this.is_terminated {
5281 panic!("polled ScoConnectionRequestStream after completion");
5282 }
5283 fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
5284 |bytes, handles| {
5285 match this.inner.channel().read_etc(cx, bytes, handles) {
5286 std::task::Poll::Ready(Ok(())) => {}
5287 std::task::Poll::Pending => return std::task::Poll::Pending,
5288 std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
5289 this.is_terminated = true;
5290 return std::task::Poll::Ready(None);
5291 }
5292 std::task::Poll::Ready(Err(e)) => {
5293 return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
5294 e.into(),
5295 ))))
5296 }
5297 }
5298
5299 let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
5301
5302 std::task::Poll::Ready(Some(match header.ordinal {
5303 0x6e0c000ccd50adec => {
5304 header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
5305 let mut req = fidl::new_empty!(
5306 ScoPacket,
5307 fidl::encoding::DefaultFuchsiaResourceDialect
5308 );
5309 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<ScoPacket>(&header, _body_bytes, handles, &mut req)?;
5310 let control_handle =
5311 ScoConnectionControlHandle { inner: this.inner.clone() };
5312 Ok(ScoConnectionRequest::Send_ {
5313 packet: req.packet,
5314
5315 responder: ScoConnectionSend_Responder {
5316 control_handle: std::mem::ManuallyDrop::new(control_handle),
5317 tx_id: header.tx_id,
5318 },
5319 })
5320 }
5321 0x7e6af45151224a6a => {
5322 header.validate_request_tx_id(fidl::MethodType::OneWay)?;
5323 let mut req = fidl::new_empty!(
5324 fidl::encoding::EmptyPayload,
5325 fidl::encoding::DefaultFuchsiaResourceDialect
5326 );
5327 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
5328 let control_handle =
5329 ScoConnectionControlHandle { inner: this.inner.clone() };
5330 Ok(ScoConnectionRequest::AckReceive { control_handle })
5331 }
5332 0x5df8b0ab265b449d => {
5333 header.validate_request_tx_id(fidl::MethodType::OneWay)?;
5334 let mut req = fidl::new_empty!(
5335 fidl::encoding::EmptyPayload,
5336 fidl::encoding::DefaultFuchsiaResourceDialect
5337 );
5338 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
5339 let control_handle =
5340 ScoConnectionControlHandle { inner: this.inner.clone() };
5341 Ok(ScoConnectionRequest::Stop { control_handle })
5342 }
5343 _ if header.tx_id == 0
5344 && header
5345 .dynamic_flags()
5346 .contains(fidl::encoding::DynamicFlags::FLEXIBLE) =>
5347 {
5348 Ok(ScoConnectionRequest::_UnknownMethod {
5349 ordinal: header.ordinal,
5350 control_handle: ScoConnectionControlHandle {
5351 inner: this.inner.clone(),
5352 },
5353 method_type: fidl::MethodType::OneWay,
5354 })
5355 }
5356 _ if header
5357 .dynamic_flags()
5358 .contains(fidl::encoding::DynamicFlags::FLEXIBLE) =>
5359 {
5360 this.inner.send_framework_err(
5361 fidl::encoding::FrameworkErr::UnknownMethod,
5362 header.tx_id,
5363 header.ordinal,
5364 header.dynamic_flags(),
5365 (bytes, handles),
5366 )?;
5367 Ok(ScoConnectionRequest::_UnknownMethod {
5368 ordinal: header.ordinal,
5369 control_handle: ScoConnectionControlHandle {
5370 inner: this.inner.clone(),
5371 },
5372 method_type: fidl::MethodType::TwoWay,
5373 })
5374 }
5375 _ => Err(fidl::Error::UnknownOrdinal {
5376 ordinal: header.ordinal,
5377 protocol_name:
5378 <ScoConnectionMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
5379 }),
5380 }))
5381 },
5382 )
5383 }
5384}
5385
5386#[derive(Debug)]
5387pub enum ScoConnectionRequest {
5388 Send_ {
5392 packet: Vec<u8>,
5393 responder: ScoConnectionSend_Responder,
5394 },
5395 AckReceive {
5396 control_handle: ScoConnectionControlHandle,
5397 },
5398 Stop {
5401 control_handle: ScoConnectionControlHandle,
5402 },
5403 #[non_exhaustive]
5405 _UnknownMethod {
5406 ordinal: u64,
5408 control_handle: ScoConnectionControlHandle,
5409 method_type: fidl::MethodType,
5410 },
5411}
5412
5413impl ScoConnectionRequest {
5414 #[allow(irrefutable_let_patterns)]
5415 pub fn into_send_(self) -> Option<(Vec<u8>, ScoConnectionSend_Responder)> {
5416 if let ScoConnectionRequest::Send_ { packet, responder } = self {
5417 Some((packet, responder))
5418 } else {
5419 None
5420 }
5421 }
5422
5423 #[allow(irrefutable_let_patterns)]
5424 pub fn into_ack_receive(self) -> Option<(ScoConnectionControlHandle)> {
5425 if let ScoConnectionRequest::AckReceive { control_handle } = self {
5426 Some((control_handle))
5427 } else {
5428 None
5429 }
5430 }
5431
5432 #[allow(irrefutable_let_patterns)]
5433 pub fn into_stop(self) -> Option<(ScoConnectionControlHandle)> {
5434 if let ScoConnectionRequest::Stop { control_handle } = self {
5435 Some((control_handle))
5436 } else {
5437 None
5438 }
5439 }
5440
5441 pub fn method_name(&self) -> &'static str {
5443 match *self {
5444 ScoConnectionRequest::Send_ { .. } => "send_",
5445 ScoConnectionRequest::AckReceive { .. } => "ack_receive",
5446 ScoConnectionRequest::Stop { .. } => "stop",
5447 ScoConnectionRequest::_UnknownMethod {
5448 method_type: fidl::MethodType::OneWay, ..
5449 } => "unknown one-way method",
5450 ScoConnectionRequest::_UnknownMethod {
5451 method_type: fidl::MethodType::TwoWay, ..
5452 } => "unknown two-way method",
5453 }
5454 }
5455}
5456
5457#[derive(Debug, Clone)]
5458pub struct ScoConnectionControlHandle {
5459 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
5460}
5461
5462impl fidl::endpoints::ControlHandle for ScoConnectionControlHandle {
5463 fn shutdown(&self) {
5464 self.inner.shutdown()
5465 }
5466 fn shutdown_with_epitaph(&self, status: zx_status::Status) {
5467 self.inner.shutdown_with_epitaph(status)
5468 }
5469
5470 fn is_closed(&self) -> bool {
5471 self.inner.channel().is_closed()
5472 }
5473 fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
5474 self.inner.channel().on_closed()
5475 }
5476
5477 #[cfg(target_os = "fuchsia")]
5478 fn signal_peer(
5479 &self,
5480 clear_mask: zx::Signals,
5481 set_mask: zx::Signals,
5482 ) -> Result<(), zx_status::Status> {
5483 use fidl::Peered;
5484 self.inner.channel().signal_peer(clear_mask, set_mask)
5485 }
5486}
5487
5488impl ScoConnectionControlHandle {
5489 pub fn send_on_receive(&self, mut packet: &[u8]) -> Result<(), fidl::Error> {
5490 self.inner.send::<ScoPacket>(
5491 (packet,),
5492 0,
5493 0x4d4e96f6f7d1aa12,
5494 fidl::encoding::DynamicFlags::FLEXIBLE,
5495 )
5496 }
5497}
5498
5499#[must_use = "FIDL methods require a response to be sent"]
5500#[derive(Debug)]
5501pub struct ScoConnectionSend_Responder {
5502 control_handle: std::mem::ManuallyDrop<ScoConnectionControlHandle>,
5503 tx_id: u32,
5504}
5505
5506impl std::ops::Drop for ScoConnectionSend_Responder {
5510 fn drop(&mut self) {
5511 self.control_handle.shutdown();
5512 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
5514 }
5515}
5516
5517impl fidl::endpoints::Responder for ScoConnectionSend_Responder {
5518 type ControlHandle = ScoConnectionControlHandle;
5519
5520 fn control_handle(&self) -> &ScoConnectionControlHandle {
5521 &self.control_handle
5522 }
5523
5524 fn drop_without_shutdown(mut self) {
5525 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
5527 std::mem::forget(self);
5529 }
5530}
5531
5532impl ScoConnectionSend_Responder {
5533 pub fn send(self) -> Result<(), fidl::Error> {
5537 let _result = self.send_raw();
5538 if _result.is_err() {
5539 self.control_handle.shutdown();
5540 }
5541 self.drop_without_shutdown();
5542 _result
5543 }
5544
5545 pub fn send_no_shutdown_on_err(self) -> Result<(), fidl::Error> {
5547 let _result = self.send_raw();
5548 self.drop_without_shutdown();
5549 _result
5550 }
5551
5552 fn send_raw(&self) -> Result<(), fidl::Error> {
5553 self.control_handle.inner.send::<fidl::encoding::FlexibleType<fidl::encoding::EmptyStruct>>(
5554 fidl::encoding::Flexible::new(()),
5555 self.tx_id,
5556 0x6e0c000ccd50adec,
5557 fidl::encoding::DynamicFlags::FLEXIBLE,
5558 )
5559 }
5560}
5561
5562#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
5563pub struct SnoopMarker;
5564
5565impl fidl::endpoints::ProtocolMarker for SnoopMarker {
5566 type Proxy = SnoopProxy;
5567 type RequestStream = SnoopRequestStream;
5568 #[cfg(target_os = "fuchsia")]
5569 type SynchronousProxy = SnoopSynchronousProxy;
5570
5571 const DEBUG_NAME: &'static str = "(anonymous) Snoop";
5572}
5573
5574pub trait SnoopProxyInterface: Send + Sync {
5575 fn r#acknowledge_packets(&self, sequence: u64) -> Result<(), fidl::Error>;
5576}
5577#[derive(Debug)]
5578#[cfg(target_os = "fuchsia")]
5579pub struct SnoopSynchronousProxy {
5580 client: fidl::client::sync::Client,
5581}
5582
5583#[cfg(target_os = "fuchsia")]
5584impl fidl::endpoints::SynchronousProxy for SnoopSynchronousProxy {
5585 type Proxy = SnoopProxy;
5586 type Protocol = SnoopMarker;
5587
5588 fn from_channel(inner: fidl::Channel) -> Self {
5589 Self::new(inner)
5590 }
5591
5592 fn into_channel(self) -> fidl::Channel {
5593 self.client.into_channel()
5594 }
5595
5596 fn as_channel(&self) -> &fidl::Channel {
5597 self.client.as_channel()
5598 }
5599}
5600
5601#[cfg(target_os = "fuchsia")]
5602impl SnoopSynchronousProxy {
5603 pub fn new(channel: fidl::Channel) -> Self {
5604 let protocol_name = <SnoopMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
5605 Self { client: fidl::client::sync::Client::new(channel, protocol_name) }
5606 }
5607
5608 pub fn into_channel(self) -> fidl::Channel {
5609 self.client.into_channel()
5610 }
5611
5612 pub fn wait_for_event(
5615 &self,
5616 deadline: zx::MonotonicInstant,
5617 ) -> Result<SnoopEvent, fidl::Error> {
5618 SnoopEvent::decode(self.client.wait_for_event(deadline)?)
5619 }
5620
5621 pub fn r#acknowledge_packets(&self, mut sequence: u64) -> Result<(), fidl::Error> {
5623 self.client.send::<SnoopAcknowledgePacketsRequest>(
5624 (sequence,),
5625 0x3336b5082c111286,
5626 fidl::encoding::DynamicFlags::FLEXIBLE,
5627 )
5628 }
5629}
5630
5631#[cfg(target_os = "fuchsia")]
5632impl From<SnoopSynchronousProxy> for zx::Handle {
5633 fn from(value: SnoopSynchronousProxy) -> Self {
5634 value.into_channel().into()
5635 }
5636}
5637
5638#[cfg(target_os = "fuchsia")]
5639impl From<fidl::Channel> for SnoopSynchronousProxy {
5640 fn from(value: fidl::Channel) -> Self {
5641 Self::new(value)
5642 }
5643}
5644
5645#[derive(Debug, Clone)]
5646pub struct SnoopProxy {
5647 client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
5648}
5649
5650impl fidl::endpoints::Proxy for SnoopProxy {
5651 type Protocol = SnoopMarker;
5652
5653 fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
5654 Self::new(inner)
5655 }
5656
5657 fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
5658 self.client.into_channel().map_err(|client| Self { client })
5659 }
5660
5661 fn as_channel(&self) -> &::fidl::AsyncChannel {
5662 self.client.as_channel()
5663 }
5664}
5665
5666impl SnoopProxy {
5667 pub fn new(channel: ::fidl::AsyncChannel) -> Self {
5669 let protocol_name = <SnoopMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
5670 Self { client: fidl::client::Client::new(channel, protocol_name) }
5671 }
5672
5673 pub fn take_event_stream(&self) -> SnoopEventStream {
5679 SnoopEventStream { event_receiver: self.client.take_event_receiver() }
5680 }
5681
5682 pub fn r#acknowledge_packets(&self, mut sequence: u64) -> Result<(), fidl::Error> {
5684 SnoopProxyInterface::r#acknowledge_packets(self, sequence)
5685 }
5686}
5687
5688impl SnoopProxyInterface for SnoopProxy {
5689 fn r#acknowledge_packets(&self, mut sequence: u64) -> Result<(), fidl::Error> {
5690 self.client.send::<SnoopAcknowledgePacketsRequest>(
5691 (sequence,),
5692 0x3336b5082c111286,
5693 fidl::encoding::DynamicFlags::FLEXIBLE,
5694 )
5695 }
5696}
5697
5698pub struct SnoopEventStream {
5699 event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
5700}
5701
5702impl std::marker::Unpin for SnoopEventStream {}
5703
5704impl futures::stream::FusedStream for SnoopEventStream {
5705 fn is_terminated(&self) -> bool {
5706 self.event_receiver.is_terminated()
5707 }
5708}
5709
5710impl futures::Stream for SnoopEventStream {
5711 type Item = Result<SnoopEvent, fidl::Error>;
5712
5713 fn poll_next(
5714 mut self: std::pin::Pin<&mut Self>,
5715 cx: &mut std::task::Context<'_>,
5716 ) -> std::task::Poll<Option<Self::Item>> {
5717 match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
5718 &mut self.event_receiver,
5719 cx
5720 )?) {
5721 Some(buf) => std::task::Poll::Ready(Some(SnoopEvent::decode(buf))),
5722 None => std::task::Poll::Ready(None),
5723 }
5724 }
5725}
5726
5727#[derive(Debug)]
5728pub enum SnoopEvent {
5729 OnObservePacket {
5730 payload: SnoopOnObservePacketRequest,
5731 },
5732 OnDroppedPackets {
5733 payload: SnoopOnDroppedPacketsRequest,
5734 },
5735 #[non_exhaustive]
5736 _UnknownEvent {
5737 ordinal: u64,
5739 },
5740}
5741
5742impl SnoopEvent {
5743 #[allow(irrefutable_let_patterns)]
5744 pub fn into_on_observe_packet(self) -> Option<SnoopOnObservePacketRequest> {
5745 if let SnoopEvent::OnObservePacket { payload } = self {
5746 Some((payload))
5747 } else {
5748 None
5749 }
5750 }
5751 #[allow(irrefutable_let_patterns)]
5752 pub fn into_on_dropped_packets(self) -> Option<SnoopOnDroppedPacketsRequest> {
5753 if let SnoopEvent::OnDroppedPackets { payload } = self {
5754 Some((payload))
5755 } else {
5756 None
5757 }
5758 }
5759
5760 fn decode(
5762 mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
5763 ) -> Result<SnoopEvent, fidl::Error> {
5764 let (bytes, _handles) = buf.split_mut();
5765 let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
5766 debug_assert_eq!(tx_header.tx_id, 0);
5767 match tx_header.ordinal {
5768 0x34d9f4c9c6bc10ca => {
5769 let mut out = fidl::new_empty!(
5770 SnoopOnObservePacketRequest,
5771 fidl::encoding::DefaultFuchsiaResourceDialect
5772 );
5773 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<SnoopOnObservePacketRequest>(&tx_header, _body_bytes, _handles, &mut out)?;
5774 Ok((SnoopEvent::OnObservePacket { payload: out }))
5775 }
5776 0x102a8d21278578b9 => {
5777 let mut out = fidl::new_empty!(
5778 SnoopOnDroppedPacketsRequest,
5779 fidl::encoding::DefaultFuchsiaResourceDialect
5780 );
5781 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<SnoopOnDroppedPacketsRequest>(&tx_header, _body_bytes, _handles, &mut out)?;
5782 Ok((SnoopEvent::OnDroppedPackets { payload: out }))
5783 }
5784 _ if tx_header.dynamic_flags().contains(fidl::encoding::DynamicFlags::FLEXIBLE) => {
5785 Ok(SnoopEvent::_UnknownEvent { ordinal: tx_header.ordinal })
5786 }
5787 _ => Err(fidl::Error::UnknownOrdinal {
5788 ordinal: tx_header.ordinal,
5789 protocol_name: <SnoopMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
5790 }),
5791 }
5792 }
5793}
5794
5795pub struct SnoopRequestStream {
5797 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
5798 is_terminated: bool,
5799}
5800
5801impl std::marker::Unpin for SnoopRequestStream {}
5802
5803impl futures::stream::FusedStream for SnoopRequestStream {
5804 fn is_terminated(&self) -> bool {
5805 self.is_terminated
5806 }
5807}
5808
5809impl fidl::endpoints::RequestStream for SnoopRequestStream {
5810 type Protocol = SnoopMarker;
5811 type ControlHandle = SnoopControlHandle;
5812
5813 fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
5814 Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
5815 }
5816
5817 fn control_handle(&self) -> Self::ControlHandle {
5818 SnoopControlHandle { inner: self.inner.clone() }
5819 }
5820
5821 fn into_inner(
5822 self,
5823 ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
5824 {
5825 (self.inner, self.is_terminated)
5826 }
5827
5828 fn from_inner(
5829 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
5830 is_terminated: bool,
5831 ) -> Self {
5832 Self { inner, is_terminated }
5833 }
5834}
5835
5836impl futures::Stream for SnoopRequestStream {
5837 type Item = Result<SnoopRequest, fidl::Error>;
5838
5839 fn poll_next(
5840 mut self: std::pin::Pin<&mut Self>,
5841 cx: &mut std::task::Context<'_>,
5842 ) -> std::task::Poll<Option<Self::Item>> {
5843 let this = &mut *self;
5844 if this.inner.check_shutdown(cx) {
5845 this.is_terminated = true;
5846 return std::task::Poll::Ready(None);
5847 }
5848 if this.is_terminated {
5849 panic!("polled SnoopRequestStream after completion");
5850 }
5851 fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
5852 |bytes, handles| {
5853 match this.inner.channel().read_etc(cx, bytes, handles) {
5854 std::task::Poll::Ready(Ok(())) => {}
5855 std::task::Poll::Pending => return std::task::Poll::Pending,
5856 std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
5857 this.is_terminated = true;
5858 return std::task::Poll::Ready(None);
5859 }
5860 std::task::Poll::Ready(Err(e)) => {
5861 return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
5862 e.into(),
5863 ))))
5864 }
5865 }
5866
5867 let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
5869
5870 std::task::Poll::Ready(Some(match header.ordinal {
5871 0x3336b5082c111286 => {
5872 header.validate_request_tx_id(fidl::MethodType::OneWay)?;
5873 let mut req = fidl::new_empty!(
5874 SnoopAcknowledgePacketsRequest,
5875 fidl::encoding::DefaultFuchsiaResourceDialect
5876 );
5877 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<SnoopAcknowledgePacketsRequest>(&header, _body_bytes, handles, &mut req)?;
5878 let control_handle = SnoopControlHandle { inner: this.inner.clone() };
5879 Ok(SnoopRequest::AcknowledgePackets {
5880 sequence: req.sequence,
5881
5882 control_handle,
5883 })
5884 }
5885 _ if header.tx_id == 0
5886 && header
5887 .dynamic_flags()
5888 .contains(fidl::encoding::DynamicFlags::FLEXIBLE) =>
5889 {
5890 Ok(SnoopRequest::_UnknownMethod {
5891 ordinal: header.ordinal,
5892 control_handle: SnoopControlHandle { inner: this.inner.clone() },
5893 method_type: fidl::MethodType::OneWay,
5894 })
5895 }
5896 _ if header
5897 .dynamic_flags()
5898 .contains(fidl::encoding::DynamicFlags::FLEXIBLE) =>
5899 {
5900 this.inner.send_framework_err(
5901 fidl::encoding::FrameworkErr::UnknownMethod,
5902 header.tx_id,
5903 header.ordinal,
5904 header.dynamic_flags(),
5905 (bytes, handles),
5906 )?;
5907 Ok(SnoopRequest::_UnknownMethod {
5908 ordinal: header.ordinal,
5909 control_handle: SnoopControlHandle { inner: this.inner.clone() },
5910 method_type: fidl::MethodType::TwoWay,
5911 })
5912 }
5913 _ => Err(fidl::Error::UnknownOrdinal {
5914 ordinal: header.ordinal,
5915 protocol_name: <SnoopMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
5916 }),
5917 }))
5918 },
5919 )
5920 }
5921}
5922
5923#[derive(Debug)]
5924pub enum SnoopRequest {
5925 AcknowledgePackets { sequence: u64, control_handle: SnoopControlHandle },
5927 #[non_exhaustive]
5929 _UnknownMethod {
5930 ordinal: u64,
5932 control_handle: SnoopControlHandle,
5933 method_type: fidl::MethodType,
5934 },
5935}
5936
5937impl SnoopRequest {
5938 #[allow(irrefutable_let_patterns)]
5939 pub fn into_acknowledge_packets(self) -> Option<(u64, SnoopControlHandle)> {
5940 if let SnoopRequest::AcknowledgePackets { sequence, control_handle } = self {
5941 Some((sequence, control_handle))
5942 } else {
5943 None
5944 }
5945 }
5946
5947 pub fn method_name(&self) -> &'static str {
5949 match *self {
5950 SnoopRequest::AcknowledgePackets { .. } => "acknowledge_packets",
5951 SnoopRequest::_UnknownMethod { method_type: fidl::MethodType::OneWay, .. } => {
5952 "unknown one-way method"
5953 }
5954 SnoopRequest::_UnknownMethod { method_type: fidl::MethodType::TwoWay, .. } => {
5955 "unknown two-way method"
5956 }
5957 }
5958 }
5959}
5960
5961#[derive(Debug, Clone)]
5962pub struct SnoopControlHandle {
5963 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
5964}
5965
5966impl fidl::endpoints::ControlHandle for SnoopControlHandle {
5967 fn shutdown(&self) {
5968 self.inner.shutdown()
5969 }
5970 fn shutdown_with_epitaph(&self, status: zx_status::Status) {
5971 self.inner.shutdown_with_epitaph(status)
5972 }
5973
5974 fn is_closed(&self) -> bool {
5975 self.inner.channel().is_closed()
5976 }
5977 fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
5978 self.inner.channel().on_closed()
5979 }
5980
5981 #[cfg(target_os = "fuchsia")]
5982 fn signal_peer(
5983 &self,
5984 clear_mask: zx::Signals,
5985 set_mask: zx::Signals,
5986 ) -> Result<(), zx_status::Status> {
5987 use fidl::Peered;
5988 self.inner.channel().signal_peer(clear_mask, set_mask)
5989 }
5990}
5991
5992impl SnoopControlHandle {
5993 pub fn send_on_observe_packet(
5994 &self,
5995 mut payload: &SnoopOnObservePacketRequest,
5996 ) -> Result<(), fidl::Error> {
5997 self.inner.send::<SnoopOnObservePacketRequest>(
5998 payload,
5999 0,
6000 0x34d9f4c9c6bc10ca,
6001 fidl::encoding::DynamicFlags::FLEXIBLE,
6002 )
6003 }
6004
6005 pub fn send_on_dropped_packets(
6006 &self,
6007 mut payload: &SnoopOnDroppedPacketsRequest,
6008 ) -> Result<(), fidl::Error> {
6009 self.inner.send::<SnoopOnDroppedPacketsRequest>(
6010 payload,
6011 0,
6012 0x102a8d21278578b9,
6013 fidl::encoding::DynamicFlags::FLEXIBLE,
6014 )
6015 }
6016}
6017
6018#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
6019pub struct VendorMarker;
6020
6021impl fidl::endpoints::ProtocolMarker for VendorMarker {
6022 type Proxy = VendorProxy;
6023 type RequestStream = VendorRequestStream;
6024 #[cfg(target_os = "fuchsia")]
6025 type SynchronousProxy = VendorSynchronousProxy;
6026
6027 const DEBUG_NAME: &'static str = "(anonymous) Vendor";
6028}
6029pub type VendorEncodeCommandResult = Result<Vec<u8>, i32>;
6030pub type VendorOpenHciResult = Result<fidl::endpoints::ClientEnd<HciMarker>, i32>;
6031pub type VendorOpenHciTransportResult = Result<fidl::endpoints::ClientEnd<HciTransportMarker>, i32>;
6032pub type VendorOpenSnoopResult = Result<fidl::endpoints::ClientEnd<SnoopMarker>, i32>;
6033
6034pub trait VendorProxyInterface: Send + Sync {
6035 type GetFeaturesResponseFut: std::future::Future<Output = Result<VendorFeatures, fidl::Error>>
6036 + Send;
6037 fn r#get_features(&self) -> Self::GetFeaturesResponseFut;
6038 type EncodeCommandResponseFut: std::future::Future<Output = Result<VendorEncodeCommandResult, fidl::Error>>
6039 + Send;
6040 fn r#encode_command(&self, payload: &VendorCommand) -> Self::EncodeCommandResponseFut;
6041 type OpenHciResponseFut: std::future::Future<Output = Result<VendorOpenHciResult, fidl::Error>>
6042 + Send;
6043 fn r#open_hci(&self) -> Self::OpenHciResponseFut;
6044 type OpenHciTransportResponseFut: std::future::Future<Output = Result<VendorOpenHciTransportResult, fidl::Error>>
6045 + Send;
6046 fn r#open_hci_transport(&self) -> Self::OpenHciTransportResponseFut;
6047 type OpenSnoopResponseFut: std::future::Future<Output = Result<VendorOpenSnoopResult, fidl::Error>>
6048 + Send;
6049 fn r#open_snoop(&self) -> Self::OpenSnoopResponseFut;
6050}
6051#[derive(Debug)]
6052#[cfg(target_os = "fuchsia")]
6053pub struct VendorSynchronousProxy {
6054 client: fidl::client::sync::Client,
6055}
6056
6057#[cfg(target_os = "fuchsia")]
6058impl fidl::endpoints::SynchronousProxy for VendorSynchronousProxy {
6059 type Proxy = VendorProxy;
6060 type Protocol = VendorMarker;
6061
6062 fn from_channel(inner: fidl::Channel) -> Self {
6063 Self::new(inner)
6064 }
6065
6066 fn into_channel(self) -> fidl::Channel {
6067 self.client.into_channel()
6068 }
6069
6070 fn as_channel(&self) -> &fidl::Channel {
6071 self.client.as_channel()
6072 }
6073}
6074
6075#[cfg(target_os = "fuchsia")]
6076impl VendorSynchronousProxy {
6077 pub fn new(channel: fidl::Channel) -> Self {
6078 let protocol_name = <VendorMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
6079 Self { client: fidl::client::sync::Client::new(channel, protocol_name) }
6080 }
6081
6082 pub fn into_channel(self) -> fidl::Channel {
6083 self.client.into_channel()
6084 }
6085
6086 pub fn wait_for_event(
6089 &self,
6090 deadline: zx::MonotonicInstant,
6091 ) -> Result<VendorEvent, fidl::Error> {
6092 VendorEvent::decode(self.client.wait_for_event(deadline)?)
6093 }
6094
6095 pub fn r#get_features(
6097 &self,
6098 ___deadline: zx::MonotonicInstant,
6099 ) -> Result<VendorFeatures, fidl::Error> {
6100 let _response = self.client.send_query::<
6101 fidl::encoding::EmptyPayload,
6102 fidl::encoding::FlexibleType<VendorFeatures>,
6103 >(
6104 (),
6105 0x102e70164c1dc911,
6106 fidl::encoding::DynamicFlags::FLEXIBLE,
6107 ___deadline,
6108 )?
6109 .into_result::<VendorMarker>("get_features")?;
6110 Ok(_response)
6111 }
6112
6113 pub fn r#encode_command(
6118 &self,
6119 mut payload: &VendorCommand,
6120 ___deadline: zx::MonotonicInstant,
6121 ) -> Result<VendorEncodeCommandResult, fidl::Error> {
6122 let _response = self.client.send_query::<
6123 VendorCommand,
6124 fidl::encoding::FlexibleResultType<VendorEncodeCommandResponse, i32>,
6125 >(
6126 payload,
6127 0x75430542c197cbe8,
6128 fidl::encoding::DynamicFlags::FLEXIBLE,
6129 ___deadline,
6130 )?
6131 .into_result::<VendorMarker>("encode_command")?;
6132 Ok(_response.map(|x| x.encoded))
6133 }
6134
6135 pub fn r#open_hci(
6140 &self,
6141 ___deadline: zx::MonotonicInstant,
6142 ) -> Result<VendorOpenHciResult, fidl::Error> {
6143 let _response = self.client.send_query::<
6144 fidl::encoding::EmptyPayload,
6145 fidl::encoding::FlexibleResultType<VendorOpenHciResponse, i32>,
6146 >(
6147 (),
6148 0x7f05862f7ef92ec8,
6149 fidl::encoding::DynamicFlags::FLEXIBLE,
6150 ___deadline,
6151 )?
6152 .into_result::<VendorMarker>("open_hci")?;
6153 Ok(_response.map(|x| x.channel))
6154 }
6155
6156 pub fn r#open_hci_transport(
6160 &self,
6161 ___deadline: zx::MonotonicInstant,
6162 ) -> Result<VendorOpenHciTransportResult, fidl::Error> {
6163 let _response = self.client.send_query::<
6164 fidl::encoding::EmptyPayload,
6165 fidl::encoding::FlexibleResultType<VendorOpenHciTransportResponse, i32>,
6166 >(
6167 (),
6168 0x1f785b656fb00834,
6169 fidl::encoding::DynamicFlags::FLEXIBLE,
6170 ___deadline,
6171 )?
6172 .into_result::<VendorMarker>("open_hci_transport")?;
6173 Ok(_response.map(|x| x.channel))
6174 }
6175
6176 pub fn r#open_snoop(
6179 &self,
6180 ___deadline: zx::MonotonicInstant,
6181 ) -> Result<VendorOpenSnoopResult, fidl::Error> {
6182 let _response = self.client.send_query::<
6183 fidl::encoding::EmptyPayload,
6184 fidl::encoding::FlexibleResultType<VendorOpenSnoopResponse, i32>,
6185 >(
6186 (),
6187 0xafeca0e3c789043,
6188 fidl::encoding::DynamicFlags::FLEXIBLE,
6189 ___deadline,
6190 )?
6191 .into_result::<VendorMarker>("open_snoop")?;
6192 Ok(_response.map(|x| x.channel))
6193 }
6194}
6195
6196#[cfg(target_os = "fuchsia")]
6197impl From<VendorSynchronousProxy> for zx::Handle {
6198 fn from(value: VendorSynchronousProxy) -> Self {
6199 value.into_channel().into()
6200 }
6201}
6202
6203#[cfg(target_os = "fuchsia")]
6204impl From<fidl::Channel> for VendorSynchronousProxy {
6205 fn from(value: fidl::Channel) -> Self {
6206 Self::new(value)
6207 }
6208}
6209
6210#[derive(Debug, Clone)]
6211pub struct VendorProxy {
6212 client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
6213}
6214
6215impl fidl::endpoints::Proxy for VendorProxy {
6216 type Protocol = VendorMarker;
6217
6218 fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
6219 Self::new(inner)
6220 }
6221
6222 fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
6223 self.client.into_channel().map_err(|client| Self { client })
6224 }
6225
6226 fn as_channel(&self) -> &::fidl::AsyncChannel {
6227 self.client.as_channel()
6228 }
6229}
6230
6231impl VendorProxy {
6232 pub fn new(channel: ::fidl::AsyncChannel) -> Self {
6234 let protocol_name = <VendorMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
6235 Self { client: fidl::client::Client::new(channel, protocol_name) }
6236 }
6237
6238 pub fn take_event_stream(&self) -> VendorEventStream {
6244 VendorEventStream { event_receiver: self.client.take_event_receiver() }
6245 }
6246
6247 pub fn r#get_features(
6249 &self,
6250 ) -> fidl::client::QueryResponseFut<VendorFeatures, fidl::encoding::DefaultFuchsiaResourceDialect>
6251 {
6252 VendorProxyInterface::r#get_features(self)
6253 }
6254
6255 pub fn r#encode_command(
6260 &self,
6261 mut payload: &VendorCommand,
6262 ) -> fidl::client::QueryResponseFut<
6263 VendorEncodeCommandResult,
6264 fidl::encoding::DefaultFuchsiaResourceDialect,
6265 > {
6266 VendorProxyInterface::r#encode_command(self, payload)
6267 }
6268
6269 pub fn r#open_hci(
6274 &self,
6275 ) -> fidl::client::QueryResponseFut<
6276 VendorOpenHciResult,
6277 fidl::encoding::DefaultFuchsiaResourceDialect,
6278 > {
6279 VendorProxyInterface::r#open_hci(self)
6280 }
6281
6282 pub fn r#open_hci_transport(
6286 &self,
6287 ) -> fidl::client::QueryResponseFut<
6288 VendorOpenHciTransportResult,
6289 fidl::encoding::DefaultFuchsiaResourceDialect,
6290 > {
6291 VendorProxyInterface::r#open_hci_transport(self)
6292 }
6293
6294 pub fn r#open_snoop(
6297 &self,
6298 ) -> fidl::client::QueryResponseFut<
6299 VendorOpenSnoopResult,
6300 fidl::encoding::DefaultFuchsiaResourceDialect,
6301 > {
6302 VendorProxyInterface::r#open_snoop(self)
6303 }
6304}
6305
6306impl VendorProxyInterface for VendorProxy {
6307 type GetFeaturesResponseFut = fidl::client::QueryResponseFut<
6308 VendorFeatures,
6309 fidl::encoding::DefaultFuchsiaResourceDialect,
6310 >;
6311 fn r#get_features(&self) -> Self::GetFeaturesResponseFut {
6312 fn _decode(
6313 mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
6314 ) -> Result<VendorFeatures, fidl::Error> {
6315 let _response = fidl::client::decode_transaction_body::<
6316 fidl::encoding::FlexibleType<VendorFeatures>,
6317 fidl::encoding::DefaultFuchsiaResourceDialect,
6318 0x102e70164c1dc911,
6319 >(_buf?)?
6320 .into_result::<VendorMarker>("get_features")?;
6321 Ok(_response)
6322 }
6323 self.client.send_query_and_decode::<fidl::encoding::EmptyPayload, VendorFeatures>(
6324 (),
6325 0x102e70164c1dc911,
6326 fidl::encoding::DynamicFlags::FLEXIBLE,
6327 _decode,
6328 )
6329 }
6330
6331 type EncodeCommandResponseFut = fidl::client::QueryResponseFut<
6332 VendorEncodeCommandResult,
6333 fidl::encoding::DefaultFuchsiaResourceDialect,
6334 >;
6335 fn r#encode_command(&self, mut payload: &VendorCommand) -> Self::EncodeCommandResponseFut {
6336 fn _decode(
6337 mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
6338 ) -> Result<VendorEncodeCommandResult, fidl::Error> {
6339 let _response = fidl::client::decode_transaction_body::<
6340 fidl::encoding::FlexibleResultType<VendorEncodeCommandResponse, i32>,
6341 fidl::encoding::DefaultFuchsiaResourceDialect,
6342 0x75430542c197cbe8,
6343 >(_buf?)?
6344 .into_result::<VendorMarker>("encode_command")?;
6345 Ok(_response.map(|x| x.encoded))
6346 }
6347 self.client.send_query_and_decode::<VendorCommand, VendorEncodeCommandResult>(
6348 payload,
6349 0x75430542c197cbe8,
6350 fidl::encoding::DynamicFlags::FLEXIBLE,
6351 _decode,
6352 )
6353 }
6354
6355 type OpenHciResponseFut = fidl::client::QueryResponseFut<
6356 VendorOpenHciResult,
6357 fidl::encoding::DefaultFuchsiaResourceDialect,
6358 >;
6359 fn r#open_hci(&self) -> Self::OpenHciResponseFut {
6360 fn _decode(
6361 mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
6362 ) -> Result<VendorOpenHciResult, fidl::Error> {
6363 let _response = fidl::client::decode_transaction_body::<
6364 fidl::encoding::FlexibleResultType<VendorOpenHciResponse, i32>,
6365 fidl::encoding::DefaultFuchsiaResourceDialect,
6366 0x7f05862f7ef92ec8,
6367 >(_buf?)?
6368 .into_result::<VendorMarker>("open_hci")?;
6369 Ok(_response.map(|x| x.channel))
6370 }
6371 self.client.send_query_and_decode::<fidl::encoding::EmptyPayload, VendorOpenHciResult>(
6372 (),
6373 0x7f05862f7ef92ec8,
6374 fidl::encoding::DynamicFlags::FLEXIBLE,
6375 _decode,
6376 )
6377 }
6378
6379 type OpenHciTransportResponseFut = fidl::client::QueryResponseFut<
6380 VendorOpenHciTransportResult,
6381 fidl::encoding::DefaultFuchsiaResourceDialect,
6382 >;
6383 fn r#open_hci_transport(&self) -> Self::OpenHciTransportResponseFut {
6384 fn _decode(
6385 mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
6386 ) -> Result<VendorOpenHciTransportResult, fidl::Error> {
6387 let _response = fidl::client::decode_transaction_body::<
6388 fidl::encoding::FlexibleResultType<VendorOpenHciTransportResponse, i32>,
6389 fidl::encoding::DefaultFuchsiaResourceDialect,
6390 0x1f785b656fb00834,
6391 >(_buf?)?
6392 .into_result::<VendorMarker>("open_hci_transport")?;
6393 Ok(_response.map(|x| x.channel))
6394 }
6395 self.client
6396 .send_query_and_decode::<fidl::encoding::EmptyPayload, VendorOpenHciTransportResult>(
6397 (),
6398 0x1f785b656fb00834,
6399 fidl::encoding::DynamicFlags::FLEXIBLE,
6400 _decode,
6401 )
6402 }
6403
6404 type OpenSnoopResponseFut = fidl::client::QueryResponseFut<
6405 VendorOpenSnoopResult,
6406 fidl::encoding::DefaultFuchsiaResourceDialect,
6407 >;
6408 fn r#open_snoop(&self) -> Self::OpenSnoopResponseFut {
6409 fn _decode(
6410 mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
6411 ) -> Result<VendorOpenSnoopResult, fidl::Error> {
6412 let _response = fidl::client::decode_transaction_body::<
6413 fidl::encoding::FlexibleResultType<VendorOpenSnoopResponse, i32>,
6414 fidl::encoding::DefaultFuchsiaResourceDialect,
6415 0xafeca0e3c789043,
6416 >(_buf?)?
6417 .into_result::<VendorMarker>("open_snoop")?;
6418 Ok(_response.map(|x| x.channel))
6419 }
6420 self.client.send_query_and_decode::<fidl::encoding::EmptyPayload, VendorOpenSnoopResult>(
6421 (),
6422 0xafeca0e3c789043,
6423 fidl::encoding::DynamicFlags::FLEXIBLE,
6424 _decode,
6425 )
6426 }
6427}
6428
6429pub struct VendorEventStream {
6430 event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
6431}
6432
6433impl std::marker::Unpin for VendorEventStream {}
6434
6435impl futures::stream::FusedStream for VendorEventStream {
6436 fn is_terminated(&self) -> bool {
6437 self.event_receiver.is_terminated()
6438 }
6439}
6440
6441impl futures::Stream for VendorEventStream {
6442 type Item = Result<VendorEvent, fidl::Error>;
6443
6444 fn poll_next(
6445 mut self: std::pin::Pin<&mut Self>,
6446 cx: &mut std::task::Context<'_>,
6447 ) -> std::task::Poll<Option<Self::Item>> {
6448 match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
6449 &mut self.event_receiver,
6450 cx
6451 )?) {
6452 Some(buf) => std::task::Poll::Ready(Some(VendorEvent::decode(buf))),
6453 None => std::task::Poll::Ready(None),
6454 }
6455 }
6456}
6457
6458#[derive(Debug)]
6459pub enum VendorEvent {
6460 #[non_exhaustive]
6461 _UnknownEvent {
6462 ordinal: u64,
6464 },
6465}
6466
6467impl VendorEvent {
6468 fn decode(
6470 mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
6471 ) -> Result<VendorEvent, fidl::Error> {
6472 let (bytes, _handles) = buf.split_mut();
6473 let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
6474 debug_assert_eq!(tx_header.tx_id, 0);
6475 match tx_header.ordinal {
6476 _ if tx_header.dynamic_flags().contains(fidl::encoding::DynamicFlags::FLEXIBLE) => {
6477 Ok(VendorEvent::_UnknownEvent { ordinal: tx_header.ordinal })
6478 }
6479 _ => Err(fidl::Error::UnknownOrdinal {
6480 ordinal: tx_header.ordinal,
6481 protocol_name: <VendorMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
6482 }),
6483 }
6484 }
6485}
6486
6487pub struct VendorRequestStream {
6489 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
6490 is_terminated: bool,
6491}
6492
6493impl std::marker::Unpin for VendorRequestStream {}
6494
6495impl futures::stream::FusedStream for VendorRequestStream {
6496 fn is_terminated(&self) -> bool {
6497 self.is_terminated
6498 }
6499}
6500
6501impl fidl::endpoints::RequestStream for VendorRequestStream {
6502 type Protocol = VendorMarker;
6503 type ControlHandle = VendorControlHandle;
6504
6505 fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
6506 Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
6507 }
6508
6509 fn control_handle(&self) -> Self::ControlHandle {
6510 VendorControlHandle { inner: self.inner.clone() }
6511 }
6512
6513 fn into_inner(
6514 self,
6515 ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
6516 {
6517 (self.inner, self.is_terminated)
6518 }
6519
6520 fn from_inner(
6521 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
6522 is_terminated: bool,
6523 ) -> Self {
6524 Self { inner, is_terminated }
6525 }
6526}
6527
6528impl futures::Stream for VendorRequestStream {
6529 type Item = Result<VendorRequest, fidl::Error>;
6530
6531 fn poll_next(
6532 mut self: std::pin::Pin<&mut Self>,
6533 cx: &mut std::task::Context<'_>,
6534 ) -> std::task::Poll<Option<Self::Item>> {
6535 let this = &mut *self;
6536 if this.inner.check_shutdown(cx) {
6537 this.is_terminated = true;
6538 return std::task::Poll::Ready(None);
6539 }
6540 if this.is_terminated {
6541 panic!("polled VendorRequestStream after completion");
6542 }
6543 fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
6544 |bytes, handles| {
6545 match this.inner.channel().read_etc(cx, bytes, handles) {
6546 std::task::Poll::Ready(Ok(())) => {}
6547 std::task::Poll::Pending => return std::task::Poll::Pending,
6548 std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
6549 this.is_terminated = true;
6550 return std::task::Poll::Ready(None);
6551 }
6552 std::task::Poll::Ready(Err(e)) => {
6553 return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
6554 e.into(),
6555 ))))
6556 }
6557 }
6558
6559 let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
6561
6562 std::task::Poll::Ready(Some(match header.ordinal {
6563 0x102e70164c1dc911 => {
6564 header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
6565 let mut req = fidl::new_empty!(
6566 fidl::encoding::EmptyPayload,
6567 fidl::encoding::DefaultFuchsiaResourceDialect
6568 );
6569 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
6570 let control_handle = VendorControlHandle { inner: this.inner.clone() };
6571 Ok(VendorRequest::GetFeatures {
6572 responder: VendorGetFeaturesResponder {
6573 control_handle: std::mem::ManuallyDrop::new(control_handle),
6574 tx_id: header.tx_id,
6575 },
6576 })
6577 }
6578 0x75430542c197cbe8 => {
6579 header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
6580 let mut req = fidl::new_empty!(
6581 VendorCommand,
6582 fidl::encoding::DefaultFuchsiaResourceDialect
6583 );
6584 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<VendorCommand>(&header, _body_bytes, handles, &mut req)?;
6585 let control_handle = VendorControlHandle { inner: this.inner.clone() };
6586 Ok(VendorRequest::EncodeCommand {
6587 payload: req,
6588 responder: VendorEncodeCommandResponder {
6589 control_handle: std::mem::ManuallyDrop::new(control_handle),
6590 tx_id: header.tx_id,
6591 },
6592 })
6593 }
6594 0x7f05862f7ef92ec8 => {
6595 header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
6596 let mut req = fidl::new_empty!(
6597 fidl::encoding::EmptyPayload,
6598 fidl::encoding::DefaultFuchsiaResourceDialect
6599 );
6600 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
6601 let control_handle = VendorControlHandle { inner: this.inner.clone() };
6602 Ok(VendorRequest::OpenHci {
6603 responder: VendorOpenHciResponder {
6604 control_handle: std::mem::ManuallyDrop::new(control_handle),
6605 tx_id: header.tx_id,
6606 },
6607 })
6608 }
6609 0x1f785b656fb00834 => {
6610 header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
6611 let mut req = fidl::new_empty!(
6612 fidl::encoding::EmptyPayload,
6613 fidl::encoding::DefaultFuchsiaResourceDialect
6614 );
6615 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
6616 let control_handle = VendorControlHandle { inner: this.inner.clone() };
6617 Ok(VendorRequest::OpenHciTransport {
6618 responder: VendorOpenHciTransportResponder {
6619 control_handle: std::mem::ManuallyDrop::new(control_handle),
6620 tx_id: header.tx_id,
6621 },
6622 })
6623 }
6624 0xafeca0e3c789043 => {
6625 header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
6626 let mut req = fidl::new_empty!(
6627 fidl::encoding::EmptyPayload,
6628 fidl::encoding::DefaultFuchsiaResourceDialect
6629 );
6630 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
6631 let control_handle = VendorControlHandle { inner: this.inner.clone() };
6632 Ok(VendorRequest::OpenSnoop {
6633 responder: VendorOpenSnoopResponder {
6634 control_handle: std::mem::ManuallyDrop::new(control_handle),
6635 tx_id: header.tx_id,
6636 },
6637 })
6638 }
6639 _ if header.tx_id == 0
6640 && header
6641 .dynamic_flags()
6642 .contains(fidl::encoding::DynamicFlags::FLEXIBLE) =>
6643 {
6644 Ok(VendorRequest::_UnknownMethod {
6645 ordinal: header.ordinal,
6646 control_handle: VendorControlHandle { inner: this.inner.clone() },
6647 method_type: fidl::MethodType::OneWay,
6648 })
6649 }
6650 _ if header
6651 .dynamic_flags()
6652 .contains(fidl::encoding::DynamicFlags::FLEXIBLE) =>
6653 {
6654 this.inner.send_framework_err(
6655 fidl::encoding::FrameworkErr::UnknownMethod,
6656 header.tx_id,
6657 header.ordinal,
6658 header.dynamic_flags(),
6659 (bytes, handles),
6660 )?;
6661 Ok(VendorRequest::_UnknownMethod {
6662 ordinal: header.ordinal,
6663 control_handle: VendorControlHandle { inner: this.inner.clone() },
6664 method_type: fidl::MethodType::TwoWay,
6665 })
6666 }
6667 _ => Err(fidl::Error::UnknownOrdinal {
6668 ordinal: header.ordinal,
6669 protocol_name:
6670 <VendorMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
6671 }),
6672 }))
6673 },
6674 )
6675 }
6676}
6677
6678#[derive(Debug)]
6681pub enum VendorRequest {
6682 GetFeatures { responder: VendorGetFeaturesResponder },
6684 EncodeCommand { payload: VendorCommand, responder: VendorEncodeCommandResponder },
6689 OpenHci { responder: VendorOpenHciResponder },
6694 OpenHciTransport { responder: VendorOpenHciTransportResponder },
6698 OpenSnoop { responder: VendorOpenSnoopResponder },
6701 #[non_exhaustive]
6703 _UnknownMethod {
6704 ordinal: u64,
6706 control_handle: VendorControlHandle,
6707 method_type: fidl::MethodType,
6708 },
6709}
6710
6711impl VendorRequest {
6712 #[allow(irrefutable_let_patterns)]
6713 pub fn into_get_features(self) -> Option<(VendorGetFeaturesResponder)> {
6714 if let VendorRequest::GetFeatures { responder } = self {
6715 Some((responder))
6716 } else {
6717 None
6718 }
6719 }
6720
6721 #[allow(irrefutable_let_patterns)]
6722 pub fn into_encode_command(self) -> Option<(VendorCommand, VendorEncodeCommandResponder)> {
6723 if let VendorRequest::EncodeCommand { payload, responder } = self {
6724 Some((payload, responder))
6725 } else {
6726 None
6727 }
6728 }
6729
6730 #[allow(irrefutable_let_patterns)]
6731 pub fn into_open_hci(self) -> Option<(VendorOpenHciResponder)> {
6732 if let VendorRequest::OpenHci { responder } = self {
6733 Some((responder))
6734 } else {
6735 None
6736 }
6737 }
6738
6739 #[allow(irrefutable_let_patterns)]
6740 pub fn into_open_hci_transport(self) -> Option<(VendorOpenHciTransportResponder)> {
6741 if let VendorRequest::OpenHciTransport { responder } = self {
6742 Some((responder))
6743 } else {
6744 None
6745 }
6746 }
6747
6748 #[allow(irrefutable_let_patterns)]
6749 pub fn into_open_snoop(self) -> Option<(VendorOpenSnoopResponder)> {
6750 if let VendorRequest::OpenSnoop { responder } = self {
6751 Some((responder))
6752 } else {
6753 None
6754 }
6755 }
6756
6757 pub fn method_name(&self) -> &'static str {
6759 match *self {
6760 VendorRequest::GetFeatures { .. } => "get_features",
6761 VendorRequest::EncodeCommand { .. } => "encode_command",
6762 VendorRequest::OpenHci { .. } => "open_hci",
6763 VendorRequest::OpenHciTransport { .. } => "open_hci_transport",
6764 VendorRequest::OpenSnoop { .. } => "open_snoop",
6765 VendorRequest::_UnknownMethod { method_type: fidl::MethodType::OneWay, .. } => {
6766 "unknown one-way method"
6767 }
6768 VendorRequest::_UnknownMethod { method_type: fidl::MethodType::TwoWay, .. } => {
6769 "unknown two-way method"
6770 }
6771 }
6772 }
6773}
6774
6775#[derive(Debug, Clone)]
6776pub struct VendorControlHandle {
6777 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
6778}
6779
6780impl fidl::endpoints::ControlHandle for VendorControlHandle {
6781 fn shutdown(&self) {
6782 self.inner.shutdown()
6783 }
6784 fn shutdown_with_epitaph(&self, status: zx_status::Status) {
6785 self.inner.shutdown_with_epitaph(status)
6786 }
6787
6788 fn is_closed(&self) -> bool {
6789 self.inner.channel().is_closed()
6790 }
6791 fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
6792 self.inner.channel().on_closed()
6793 }
6794
6795 #[cfg(target_os = "fuchsia")]
6796 fn signal_peer(
6797 &self,
6798 clear_mask: zx::Signals,
6799 set_mask: zx::Signals,
6800 ) -> Result<(), zx_status::Status> {
6801 use fidl::Peered;
6802 self.inner.channel().signal_peer(clear_mask, set_mask)
6803 }
6804}
6805
6806impl VendorControlHandle {}
6807
6808#[must_use = "FIDL methods require a response to be sent"]
6809#[derive(Debug)]
6810pub struct VendorGetFeaturesResponder {
6811 control_handle: std::mem::ManuallyDrop<VendorControlHandle>,
6812 tx_id: u32,
6813}
6814
6815impl std::ops::Drop for VendorGetFeaturesResponder {
6819 fn drop(&mut self) {
6820 self.control_handle.shutdown();
6821 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
6823 }
6824}
6825
6826impl fidl::endpoints::Responder for VendorGetFeaturesResponder {
6827 type ControlHandle = VendorControlHandle;
6828
6829 fn control_handle(&self) -> &VendorControlHandle {
6830 &self.control_handle
6831 }
6832
6833 fn drop_without_shutdown(mut self) {
6834 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
6836 std::mem::forget(self);
6838 }
6839}
6840
6841impl VendorGetFeaturesResponder {
6842 pub fn send(self, mut payload: &VendorFeatures) -> Result<(), fidl::Error> {
6846 let _result = self.send_raw(payload);
6847 if _result.is_err() {
6848 self.control_handle.shutdown();
6849 }
6850 self.drop_without_shutdown();
6851 _result
6852 }
6853
6854 pub fn send_no_shutdown_on_err(self, mut payload: &VendorFeatures) -> Result<(), fidl::Error> {
6856 let _result = self.send_raw(payload);
6857 self.drop_without_shutdown();
6858 _result
6859 }
6860
6861 fn send_raw(&self, mut payload: &VendorFeatures) -> Result<(), fidl::Error> {
6862 self.control_handle.inner.send::<fidl::encoding::FlexibleType<VendorFeatures>>(
6863 fidl::encoding::Flexible::new(payload),
6864 self.tx_id,
6865 0x102e70164c1dc911,
6866 fidl::encoding::DynamicFlags::FLEXIBLE,
6867 )
6868 }
6869}
6870
6871#[must_use = "FIDL methods require a response to be sent"]
6872#[derive(Debug)]
6873pub struct VendorEncodeCommandResponder {
6874 control_handle: std::mem::ManuallyDrop<VendorControlHandle>,
6875 tx_id: u32,
6876}
6877
6878impl std::ops::Drop for VendorEncodeCommandResponder {
6882 fn drop(&mut self) {
6883 self.control_handle.shutdown();
6884 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
6886 }
6887}
6888
6889impl fidl::endpoints::Responder for VendorEncodeCommandResponder {
6890 type ControlHandle = VendorControlHandle;
6891
6892 fn control_handle(&self) -> &VendorControlHandle {
6893 &self.control_handle
6894 }
6895
6896 fn drop_without_shutdown(mut self) {
6897 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
6899 std::mem::forget(self);
6901 }
6902}
6903
6904impl VendorEncodeCommandResponder {
6905 pub fn send(self, mut result: Result<&[u8], i32>) -> Result<(), fidl::Error> {
6909 let _result = self.send_raw(result);
6910 if _result.is_err() {
6911 self.control_handle.shutdown();
6912 }
6913 self.drop_without_shutdown();
6914 _result
6915 }
6916
6917 pub fn send_no_shutdown_on_err(
6919 self,
6920 mut result: Result<&[u8], i32>,
6921 ) -> Result<(), fidl::Error> {
6922 let _result = self.send_raw(result);
6923 self.drop_without_shutdown();
6924 _result
6925 }
6926
6927 fn send_raw(&self, mut result: Result<&[u8], i32>) -> Result<(), fidl::Error> {
6928 self.control_handle.inner.send::<fidl::encoding::FlexibleResultType<
6929 VendorEncodeCommandResponse,
6930 i32,
6931 >>(
6932 fidl::encoding::FlexibleResult::new(result.map(|encoded| (encoded,))),
6933 self.tx_id,
6934 0x75430542c197cbe8,
6935 fidl::encoding::DynamicFlags::FLEXIBLE,
6936 )
6937 }
6938}
6939
6940#[must_use = "FIDL methods require a response to be sent"]
6941#[derive(Debug)]
6942pub struct VendorOpenHciResponder {
6943 control_handle: std::mem::ManuallyDrop<VendorControlHandle>,
6944 tx_id: u32,
6945}
6946
6947impl std::ops::Drop for VendorOpenHciResponder {
6951 fn drop(&mut self) {
6952 self.control_handle.shutdown();
6953 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
6955 }
6956}
6957
6958impl fidl::endpoints::Responder for VendorOpenHciResponder {
6959 type ControlHandle = VendorControlHandle;
6960
6961 fn control_handle(&self) -> &VendorControlHandle {
6962 &self.control_handle
6963 }
6964
6965 fn drop_without_shutdown(mut self) {
6966 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
6968 std::mem::forget(self);
6970 }
6971}
6972
6973impl VendorOpenHciResponder {
6974 pub fn send(
6978 self,
6979 mut result: Result<fidl::endpoints::ClientEnd<HciMarker>, i32>,
6980 ) -> Result<(), fidl::Error> {
6981 let _result = self.send_raw(result);
6982 if _result.is_err() {
6983 self.control_handle.shutdown();
6984 }
6985 self.drop_without_shutdown();
6986 _result
6987 }
6988
6989 pub fn send_no_shutdown_on_err(
6991 self,
6992 mut result: Result<fidl::endpoints::ClientEnd<HciMarker>, i32>,
6993 ) -> Result<(), fidl::Error> {
6994 let _result = self.send_raw(result);
6995 self.drop_without_shutdown();
6996 _result
6997 }
6998
6999 fn send_raw(
7000 &self,
7001 mut result: Result<fidl::endpoints::ClientEnd<HciMarker>, i32>,
7002 ) -> Result<(), fidl::Error> {
7003 self.control_handle
7004 .inner
7005 .send::<fidl::encoding::FlexibleResultType<VendorOpenHciResponse, i32>>(
7006 fidl::encoding::FlexibleResult::new(result.map(|channel| (channel,))),
7007 self.tx_id,
7008 0x7f05862f7ef92ec8,
7009 fidl::encoding::DynamicFlags::FLEXIBLE,
7010 )
7011 }
7012}
7013
7014#[must_use = "FIDL methods require a response to be sent"]
7015#[derive(Debug)]
7016pub struct VendorOpenHciTransportResponder {
7017 control_handle: std::mem::ManuallyDrop<VendorControlHandle>,
7018 tx_id: u32,
7019}
7020
7021impl std::ops::Drop for VendorOpenHciTransportResponder {
7025 fn drop(&mut self) {
7026 self.control_handle.shutdown();
7027 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
7029 }
7030}
7031
7032impl fidl::endpoints::Responder for VendorOpenHciTransportResponder {
7033 type ControlHandle = VendorControlHandle;
7034
7035 fn control_handle(&self) -> &VendorControlHandle {
7036 &self.control_handle
7037 }
7038
7039 fn drop_without_shutdown(mut self) {
7040 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
7042 std::mem::forget(self);
7044 }
7045}
7046
7047impl VendorOpenHciTransportResponder {
7048 pub fn send(
7052 self,
7053 mut result: Result<fidl::endpoints::ClientEnd<HciTransportMarker>, i32>,
7054 ) -> Result<(), fidl::Error> {
7055 let _result = self.send_raw(result);
7056 if _result.is_err() {
7057 self.control_handle.shutdown();
7058 }
7059 self.drop_without_shutdown();
7060 _result
7061 }
7062
7063 pub fn send_no_shutdown_on_err(
7065 self,
7066 mut result: Result<fidl::endpoints::ClientEnd<HciTransportMarker>, i32>,
7067 ) -> Result<(), fidl::Error> {
7068 let _result = self.send_raw(result);
7069 self.drop_without_shutdown();
7070 _result
7071 }
7072
7073 fn send_raw(
7074 &self,
7075 mut result: Result<fidl::endpoints::ClientEnd<HciTransportMarker>, i32>,
7076 ) -> Result<(), fidl::Error> {
7077 self.control_handle.inner.send::<fidl::encoding::FlexibleResultType<
7078 VendorOpenHciTransportResponse,
7079 i32,
7080 >>(
7081 fidl::encoding::FlexibleResult::new(result.map(|channel| (channel,))),
7082 self.tx_id,
7083 0x1f785b656fb00834,
7084 fidl::encoding::DynamicFlags::FLEXIBLE,
7085 )
7086 }
7087}
7088
7089#[must_use = "FIDL methods require a response to be sent"]
7090#[derive(Debug)]
7091pub struct VendorOpenSnoopResponder {
7092 control_handle: std::mem::ManuallyDrop<VendorControlHandle>,
7093 tx_id: u32,
7094}
7095
7096impl std::ops::Drop for VendorOpenSnoopResponder {
7100 fn drop(&mut self) {
7101 self.control_handle.shutdown();
7102 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
7104 }
7105}
7106
7107impl fidl::endpoints::Responder for VendorOpenSnoopResponder {
7108 type ControlHandle = VendorControlHandle;
7109
7110 fn control_handle(&self) -> &VendorControlHandle {
7111 &self.control_handle
7112 }
7113
7114 fn drop_without_shutdown(mut self) {
7115 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
7117 std::mem::forget(self);
7119 }
7120}
7121
7122impl VendorOpenSnoopResponder {
7123 pub fn send(
7127 self,
7128 mut result: Result<fidl::endpoints::ClientEnd<SnoopMarker>, i32>,
7129 ) -> Result<(), fidl::Error> {
7130 let _result = self.send_raw(result);
7131 if _result.is_err() {
7132 self.control_handle.shutdown();
7133 }
7134 self.drop_without_shutdown();
7135 _result
7136 }
7137
7138 pub fn send_no_shutdown_on_err(
7140 self,
7141 mut result: Result<fidl::endpoints::ClientEnd<SnoopMarker>, i32>,
7142 ) -> Result<(), fidl::Error> {
7143 let _result = self.send_raw(result);
7144 self.drop_without_shutdown();
7145 _result
7146 }
7147
7148 fn send_raw(
7149 &self,
7150 mut result: Result<fidl::endpoints::ClientEnd<SnoopMarker>, i32>,
7151 ) -> Result<(), fidl::Error> {
7152 self.control_handle
7153 .inner
7154 .send::<fidl::encoding::FlexibleResultType<VendorOpenSnoopResponse, i32>>(
7155 fidl::encoding::FlexibleResult::new(result.map(|channel| (channel,))),
7156 self.tx_id,
7157 0xafeca0e3c789043,
7158 fidl::encoding::DynamicFlags::FLEXIBLE,
7159 )
7160 }
7161}
7162
7163#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
7164pub struct VirtualControllerMarker;
7165
7166impl fidl::endpoints::ProtocolMarker for VirtualControllerMarker {
7167 type Proxy = VirtualControllerProxy;
7168 type RequestStream = VirtualControllerRequestStream;
7169 #[cfg(target_os = "fuchsia")]
7170 type SynchronousProxy = VirtualControllerSynchronousProxy;
7171
7172 const DEBUG_NAME: &'static str = "(anonymous) VirtualController";
7173}
7174pub type VirtualControllerCreateEmulatorResult = Result<Option<String>, i32>;
7175
7176pub trait VirtualControllerProxyInterface: Send + Sync {
7177 type CreateEmulatorResponseFut: std::future::Future<Output = Result<VirtualControllerCreateEmulatorResult, fidl::Error>>
7178 + Send;
7179 fn r#create_emulator(&self) -> Self::CreateEmulatorResponseFut;
7180 fn r#create_loopback_device(
7181 &self,
7182 payload: VirtualControllerCreateLoopbackDeviceRequest,
7183 ) -> Result<(), fidl::Error>;
7184}
7185#[derive(Debug)]
7186#[cfg(target_os = "fuchsia")]
7187pub struct VirtualControllerSynchronousProxy {
7188 client: fidl::client::sync::Client,
7189}
7190
7191#[cfg(target_os = "fuchsia")]
7192impl fidl::endpoints::SynchronousProxy for VirtualControllerSynchronousProxy {
7193 type Proxy = VirtualControllerProxy;
7194 type Protocol = VirtualControllerMarker;
7195
7196 fn from_channel(inner: fidl::Channel) -> Self {
7197 Self::new(inner)
7198 }
7199
7200 fn into_channel(self) -> fidl::Channel {
7201 self.client.into_channel()
7202 }
7203
7204 fn as_channel(&self) -> &fidl::Channel {
7205 self.client.as_channel()
7206 }
7207}
7208
7209#[cfg(target_os = "fuchsia")]
7210impl VirtualControllerSynchronousProxy {
7211 pub fn new(channel: fidl::Channel) -> Self {
7212 let protocol_name =
7213 <VirtualControllerMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
7214 Self { client: fidl::client::sync::Client::new(channel, protocol_name) }
7215 }
7216
7217 pub fn into_channel(self) -> fidl::Channel {
7218 self.client.into_channel()
7219 }
7220
7221 pub fn wait_for_event(
7224 &self,
7225 deadline: zx::MonotonicInstant,
7226 ) -> Result<VirtualControllerEvent, fidl::Error> {
7227 VirtualControllerEvent::decode(self.client.wait_for_event(deadline)?)
7228 }
7229
7230 pub fn r#create_emulator(
7232 &self,
7233 ___deadline: zx::MonotonicInstant,
7234 ) -> Result<VirtualControllerCreateEmulatorResult, fidl::Error> {
7235 let _response = self.client.send_query::<
7236 fidl::encoding::EmptyPayload,
7237 fidl::encoding::FlexibleResultType<VirtualControllerCreateEmulatorResponse, i32>,
7238 >(
7239 (),
7240 0x130273fc0a35cedb,
7241 fidl::encoding::DynamicFlags::FLEXIBLE,
7242 ___deadline,
7243 )?
7244 .into_result::<VirtualControllerMarker>("create_emulator")?;
7245 Ok(_response.map(|x| x.name))
7246 }
7247
7248 pub fn r#create_loopback_device(
7252 &self,
7253 mut payload: VirtualControllerCreateLoopbackDeviceRequest,
7254 ) -> Result<(), fidl::Error> {
7255 self.client.send::<VirtualControllerCreateLoopbackDeviceRequest>(
7256 &mut payload,
7257 0x7525af8edecb6c0c,
7258 fidl::encoding::DynamicFlags::FLEXIBLE,
7259 )
7260 }
7261}
7262
7263#[cfg(target_os = "fuchsia")]
7264impl From<VirtualControllerSynchronousProxy> for zx::Handle {
7265 fn from(value: VirtualControllerSynchronousProxy) -> Self {
7266 value.into_channel().into()
7267 }
7268}
7269
7270#[cfg(target_os = "fuchsia")]
7271impl From<fidl::Channel> for VirtualControllerSynchronousProxy {
7272 fn from(value: fidl::Channel) -> Self {
7273 Self::new(value)
7274 }
7275}
7276
7277#[derive(Debug, Clone)]
7278pub struct VirtualControllerProxy {
7279 client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
7280}
7281
7282impl fidl::endpoints::Proxy for VirtualControllerProxy {
7283 type Protocol = VirtualControllerMarker;
7284
7285 fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
7286 Self::new(inner)
7287 }
7288
7289 fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
7290 self.client.into_channel().map_err(|client| Self { client })
7291 }
7292
7293 fn as_channel(&self) -> &::fidl::AsyncChannel {
7294 self.client.as_channel()
7295 }
7296}
7297
7298impl VirtualControllerProxy {
7299 pub fn new(channel: ::fidl::AsyncChannel) -> Self {
7301 let protocol_name =
7302 <VirtualControllerMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
7303 Self { client: fidl::client::Client::new(channel, protocol_name) }
7304 }
7305
7306 pub fn take_event_stream(&self) -> VirtualControllerEventStream {
7312 VirtualControllerEventStream { event_receiver: self.client.take_event_receiver() }
7313 }
7314
7315 pub fn r#create_emulator(
7317 &self,
7318 ) -> fidl::client::QueryResponseFut<
7319 VirtualControllerCreateEmulatorResult,
7320 fidl::encoding::DefaultFuchsiaResourceDialect,
7321 > {
7322 VirtualControllerProxyInterface::r#create_emulator(self)
7323 }
7324
7325 pub fn r#create_loopback_device(
7329 &self,
7330 mut payload: VirtualControllerCreateLoopbackDeviceRequest,
7331 ) -> Result<(), fidl::Error> {
7332 VirtualControllerProxyInterface::r#create_loopback_device(self, payload)
7333 }
7334}
7335
7336impl VirtualControllerProxyInterface for VirtualControllerProxy {
7337 type CreateEmulatorResponseFut = fidl::client::QueryResponseFut<
7338 VirtualControllerCreateEmulatorResult,
7339 fidl::encoding::DefaultFuchsiaResourceDialect,
7340 >;
7341 fn r#create_emulator(&self) -> Self::CreateEmulatorResponseFut {
7342 fn _decode(
7343 mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
7344 ) -> Result<VirtualControllerCreateEmulatorResult, fidl::Error> {
7345 let _response = fidl::client::decode_transaction_body::<
7346 fidl::encoding::FlexibleResultType<VirtualControllerCreateEmulatorResponse, i32>,
7347 fidl::encoding::DefaultFuchsiaResourceDialect,
7348 0x130273fc0a35cedb,
7349 >(_buf?)?
7350 .into_result::<VirtualControllerMarker>("create_emulator")?;
7351 Ok(_response.map(|x| x.name))
7352 }
7353 self.client.send_query_and_decode::<
7354 fidl::encoding::EmptyPayload,
7355 VirtualControllerCreateEmulatorResult,
7356 >(
7357 (),
7358 0x130273fc0a35cedb,
7359 fidl::encoding::DynamicFlags::FLEXIBLE,
7360 _decode,
7361 )
7362 }
7363
7364 fn r#create_loopback_device(
7365 &self,
7366 mut payload: VirtualControllerCreateLoopbackDeviceRequest,
7367 ) -> Result<(), fidl::Error> {
7368 self.client.send::<VirtualControllerCreateLoopbackDeviceRequest>(
7369 &mut payload,
7370 0x7525af8edecb6c0c,
7371 fidl::encoding::DynamicFlags::FLEXIBLE,
7372 )
7373 }
7374}
7375
7376pub struct VirtualControllerEventStream {
7377 event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
7378}
7379
7380impl std::marker::Unpin for VirtualControllerEventStream {}
7381
7382impl futures::stream::FusedStream for VirtualControllerEventStream {
7383 fn is_terminated(&self) -> bool {
7384 self.event_receiver.is_terminated()
7385 }
7386}
7387
7388impl futures::Stream for VirtualControllerEventStream {
7389 type Item = Result<VirtualControllerEvent, fidl::Error>;
7390
7391 fn poll_next(
7392 mut self: std::pin::Pin<&mut Self>,
7393 cx: &mut std::task::Context<'_>,
7394 ) -> std::task::Poll<Option<Self::Item>> {
7395 match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
7396 &mut self.event_receiver,
7397 cx
7398 )?) {
7399 Some(buf) => std::task::Poll::Ready(Some(VirtualControllerEvent::decode(buf))),
7400 None => std::task::Poll::Ready(None),
7401 }
7402 }
7403}
7404
7405#[derive(Debug)]
7406pub enum VirtualControllerEvent {
7407 #[non_exhaustive]
7408 _UnknownEvent {
7409 ordinal: u64,
7411 },
7412}
7413
7414impl VirtualControllerEvent {
7415 fn decode(
7417 mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
7418 ) -> Result<VirtualControllerEvent, fidl::Error> {
7419 let (bytes, _handles) = buf.split_mut();
7420 let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
7421 debug_assert_eq!(tx_header.tx_id, 0);
7422 match tx_header.ordinal {
7423 _ if tx_header.dynamic_flags().contains(fidl::encoding::DynamicFlags::FLEXIBLE) => {
7424 Ok(VirtualControllerEvent::_UnknownEvent { ordinal: tx_header.ordinal })
7425 }
7426 _ => Err(fidl::Error::UnknownOrdinal {
7427 ordinal: tx_header.ordinal,
7428 protocol_name:
7429 <VirtualControllerMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
7430 }),
7431 }
7432 }
7433}
7434
7435pub struct VirtualControllerRequestStream {
7437 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
7438 is_terminated: bool,
7439}
7440
7441impl std::marker::Unpin for VirtualControllerRequestStream {}
7442
7443impl futures::stream::FusedStream for VirtualControllerRequestStream {
7444 fn is_terminated(&self) -> bool {
7445 self.is_terminated
7446 }
7447}
7448
7449impl fidl::endpoints::RequestStream for VirtualControllerRequestStream {
7450 type Protocol = VirtualControllerMarker;
7451 type ControlHandle = VirtualControllerControlHandle;
7452
7453 fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
7454 Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
7455 }
7456
7457 fn control_handle(&self) -> Self::ControlHandle {
7458 VirtualControllerControlHandle { inner: self.inner.clone() }
7459 }
7460
7461 fn into_inner(
7462 self,
7463 ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
7464 {
7465 (self.inner, self.is_terminated)
7466 }
7467
7468 fn from_inner(
7469 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
7470 is_terminated: bool,
7471 ) -> Self {
7472 Self { inner, is_terminated }
7473 }
7474}
7475
7476impl futures::Stream for VirtualControllerRequestStream {
7477 type Item = Result<VirtualControllerRequest, fidl::Error>;
7478
7479 fn poll_next(
7480 mut self: std::pin::Pin<&mut Self>,
7481 cx: &mut std::task::Context<'_>,
7482 ) -> std::task::Poll<Option<Self::Item>> {
7483 let this = &mut *self;
7484 if this.inner.check_shutdown(cx) {
7485 this.is_terminated = true;
7486 return std::task::Poll::Ready(None);
7487 }
7488 if this.is_terminated {
7489 panic!("polled VirtualControllerRequestStream after completion");
7490 }
7491 fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
7492 |bytes, handles| {
7493 match this.inner.channel().read_etc(cx, bytes, handles) {
7494 std::task::Poll::Ready(Ok(())) => {}
7495 std::task::Poll::Pending => return std::task::Poll::Pending,
7496 std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
7497 this.is_terminated = true;
7498 return std::task::Poll::Ready(None);
7499 }
7500 std::task::Poll::Ready(Err(e)) => {
7501 return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
7502 e.into(),
7503 ))))
7504 }
7505 }
7506
7507 let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
7509
7510 std::task::Poll::Ready(Some(match header.ordinal {
7511 0x130273fc0a35cedb => {
7512 header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
7513 let mut req = fidl::new_empty!(
7514 fidl::encoding::EmptyPayload,
7515 fidl::encoding::DefaultFuchsiaResourceDialect
7516 );
7517 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
7518 let control_handle =
7519 VirtualControllerControlHandle { inner: this.inner.clone() };
7520 Ok(VirtualControllerRequest::CreateEmulator {
7521 responder: VirtualControllerCreateEmulatorResponder {
7522 control_handle: std::mem::ManuallyDrop::new(control_handle),
7523 tx_id: header.tx_id,
7524 },
7525 })
7526 }
7527 0x7525af8edecb6c0c => {
7528 header.validate_request_tx_id(fidl::MethodType::OneWay)?;
7529 let mut req = fidl::new_empty!(
7530 VirtualControllerCreateLoopbackDeviceRequest,
7531 fidl::encoding::DefaultFuchsiaResourceDialect
7532 );
7533 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<VirtualControllerCreateLoopbackDeviceRequest>(&header, _body_bytes, handles, &mut req)?;
7534 let control_handle =
7535 VirtualControllerControlHandle { inner: this.inner.clone() };
7536 Ok(VirtualControllerRequest::CreateLoopbackDevice {
7537 payload: req,
7538 control_handle,
7539 })
7540 }
7541 _ if header.tx_id == 0
7542 && header
7543 .dynamic_flags()
7544 .contains(fidl::encoding::DynamicFlags::FLEXIBLE) =>
7545 {
7546 Ok(VirtualControllerRequest::_UnknownMethod {
7547 ordinal: header.ordinal,
7548 control_handle: VirtualControllerControlHandle {
7549 inner: this.inner.clone(),
7550 },
7551 method_type: fidl::MethodType::OneWay,
7552 })
7553 }
7554 _ if header
7555 .dynamic_flags()
7556 .contains(fidl::encoding::DynamicFlags::FLEXIBLE) =>
7557 {
7558 this.inner.send_framework_err(
7559 fidl::encoding::FrameworkErr::UnknownMethod,
7560 header.tx_id,
7561 header.ordinal,
7562 header.dynamic_flags(),
7563 (bytes, handles),
7564 )?;
7565 Ok(VirtualControllerRequest::_UnknownMethod {
7566 ordinal: header.ordinal,
7567 control_handle: VirtualControllerControlHandle {
7568 inner: this.inner.clone(),
7569 },
7570 method_type: fidl::MethodType::TwoWay,
7571 })
7572 }
7573 _ => Err(fidl::Error::UnknownOrdinal {
7574 ordinal: header.ordinal,
7575 protocol_name:
7576 <VirtualControllerMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
7577 }),
7578 }))
7579 },
7580 )
7581 }
7582}
7583
7584#[derive(Debug)]
7586pub enum VirtualControllerRequest {
7587 CreateEmulator { responder: VirtualControllerCreateEmulatorResponder },
7589 CreateLoopbackDevice {
7593 payload: VirtualControllerCreateLoopbackDeviceRequest,
7594 control_handle: VirtualControllerControlHandle,
7595 },
7596 #[non_exhaustive]
7598 _UnknownMethod {
7599 ordinal: u64,
7601 control_handle: VirtualControllerControlHandle,
7602 method_type: fidl::MethodType,
7603 },
7604}
7605
7606impl VirtualControllerRequest {
7607 #[allow(irrefutable_let_patterns)]
7608 pub fn into_create_emulator(self) -> Option<(VirtualControllerCreateEmulatorResponder)> {
7609 if let VirtualControllerRequest::CreateEmulator { responder } = self {
7610 Some((responder))
7611 } else {
7612 None
7613 }
7614 }
7615
7616 #[allow(irrefutable_let_patterns)]
7617 pub fn into_create_loopback_device(
7618 self,
7619 ) -> Option<(VirtualControllerCreateLoopbackDeviceRequest, VirtualControllerControlHandle)>
7620 {
7621 if let VirtualControllerRequest::CreateLoopbackDevice { payload, control_handle } = self {
7622 Some((payload, control_handle))
7623 } else {
7624 None
7625 }
7626 }
7627
7628 pub fn method_name(&self) -> &'static str {
7630 match *self {
7631 VirtualControllerRequest::CreateEmulator { .. } => "create_emulator",
7632 VirtualControllerRequest::CreateLoopbackDevice { .. } => "create_loopback_device",
7633 VirtualControllerRequest::_UnknownMethod {
7634 method_type: fidl::MethodType::OneWay,
7635 ..
7636 } => "unknown one-way method",
7637 VirtualControllerRequest::_UnknownMethod {
7638 method_type: fidl::MethodType::TwoWay,
7639 ..
7640 } => "unknown two-way method",
7641 }
7642 }
7643}
7644
7645#[derive(Debug, Clone)]
7646pub struct VirtualControllerControlHandle {
7647 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
7648}
7649
7650impl fidl::endpoints::ControlHandle for VirtualControllerControlHandle {
7651 fn shutdown(&self) {
7652 self.inner.shutdown()
7653 }
7654 fn shutdown_with_epitaph(&self, status: zx_status::Status) {
7655 self.inner.shutdown_with_epitaph(status)
7656 }
7657
7658 fn is_closed(&self) -> bool {
7659 self.inner.channel().is_closed()
7660 }
7661 fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
7662 self.inner.channel().on_closed()
7663 }
7664
7665 #[cfg(target_os = "fuchsia")]
7666 fn signal_peer(
7667 &self,
7668 clear_mask: zx::Signals,
7669 set_mask: zx::Signals,
7670 ) -> Result<(), zx_status::Status> {
7671 use fidl::Peered;
7672 self.inner.channel().signal_peer(clear_mask, set_mask)
7673 }
7674}
7675
7676impl VirtualControllerControlHandle {}
7677
7678#[must_use = "FIDL methods require a response to be sent"]
7679#[derive(Debug)]
7680pub struct VirtualControllerCreateEmulatorResponder {
7681 control_handle: std::mem::ManuallyDrop<VirtualControllerControlHandle>,
7682 tx_id: u32,
7683}
7684
7685impl std::ops::Drop for VirtualControllerCreateEmulatorResponder {
7689 fn drop(&mut self) {
7690 self.control_handle.shutdown();
7691 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
7693 }
7694}
7695
7696impl fidl::endpoints::Responder for VirtualControllerCreateEmulatorResponder {
7697 type ControlHandle = VirtualControllerControlHandle;
7698
7699 fn control_handle(&self) -> &VirtualControllerControlHandle {
7700 &self.control_handle
7701 }
7702
7703 fn drop_without_shutdown(mut self) {
7704 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
7706 std::mem::forget(self);
7708 }
7709}
7710
7711impl VirtualControllerCreateEmulatorResponder {
7712 pub fn send(self, mut result: Result<Option<&str>, i32>) -> Result<(), fidl::Error> {
7716 let _result = self.send_raw(result);
7717 if _result.is_err() {
7718 self.control_handle.shutdown();
7719 }
7720 self.drop_without_shutdown();
7721 _result
7722 }
7723
7724 pub fn send_no_shutdown_on_err(
7726 self,
7727 mut result: Result<Option<&str>, i32>,
7728 ) -> Result<(), fidl::Error> {
7729 let _result = self.send_raw(result);
7730 self.drop_without_shutdown();
7731 _result
7732 }
7733
7734 fn send_raw(&self, mut result: Result<Option<&str>, i32>) -> Result<(), fidl::Error> {
7735 self.control_handle.inner.send::<fidl::encoding::FlexibleResultType<
7736 VirtualControllerCreateEmulatorResponse,
7737 i32,
7738 >>(
7739 fidl::encoding::FlexibleResult::new(result.map(|name| (name,))),
7740 self.tx_id,
7741 0x130273fc0a35cedb,
7742 fidl::encoding::DynamicFlags::FLEXIBLE,
7743 )
7744 }
7745}
7746
7747#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
7748pub struct EmulatorServiceMarker;
7749
7750#[cfg(target_os = "fuchsia")]
7751impl fidl::endpoints::ServiceMarker for EmulatorServiceMarker {
7752 type Proxy = EmulatorServiceProxy;
7753 type Request = EmulatorServiceRequest;
7754 const SERVICE_NAME: &'static str = "fuchsia.hardware.bluetooth.EmulatorService";
7755}
7756
7757#[cfg(target_os = "fuchsia")]
7760pub enum EmulatorServiceRequest {
7761 Device(EmulatorRequestStream),
7762}
7763
7764#[cfg(target_os = "fuchsia")]
7765impl fidl::endpoints::ServiceRequest for EmulatorServiceRequest {
7766 type Service = EmulatorServiceMarker;
7767
7768 fn dispatch(name: &str, _channel: fidl::AsyncChannel) -> Self {
7769 match name {
7770 "device" => Self::Device(
7771 <EmulatorRequestStream as fidl::endpoints::RequestStream>::from_channel(_channel),
7772 ),
7773 _ => panic!("no such member protocol name for service EmulatorService"),
7774 }
7775 }
7776
7777 fn member_names() -> &'static [&'static str] {
7778 &["device"]
7779 }
7780}
7781#[cfg(target_os = "fuchsia")]
7782pub struct EmulatorServiceProxy(#[allow(dead_code)] Box<dyn fidl::endpoints::MemberOpener>);
7783
7784#[cfg(target_os = "fuchsia")]
7785impl fidl::endpoints::ServiceProxy for EmulatorServiceProxy {
7786 type Service = EmulatorServiceMarker;
7787
7788 fn from_member_opener(opener: Box<dyn fidl::endpoints::MemberOpener>) -> Self {
7789 Self(opener)
7790 }
7791}
7792
7793#[cfg(target_os = "fuchsia")]
7794impl EmulatorServiceProxy {
7795 pub fn connect_to_device(&self) -> Result<EmulatorProxy, fidl::Error> {
7796 let (proxy, server_end) = fidl::endpoints::create_proxy::<EmulatorMarker>();
7797 self.connect_channel_to_device(server_end)?;
7798 Ok(proxy)
7799 }
7800
7801 pub fn connect_to_device_sync(&self) -> Result<EmulatorSynchronousProxy, fidl::Error> {
7804 let (proxy, server_end) = fidl::endpoints::create_sync_proxy::<EmulatorMarker>();
7805 self.connect_channel_to_device(server_end)?;
7806 Ok(proxy)
7807 }
7808
7809 pub fn connect_channel_to_device(
7812 &self,
7813 server_end: fidl::endpoints::ServerEnd<EmulatorMarker>,
7814 ) -> Result<(), fidl::Error> {
7815 self.0.open_member("device", server_end.into_channel())
7816 }
7817
7818 pub fn instance_name(&self) -> &str {
7819 self.0.instance_name()
7820 }
7821}
7822
7823#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
7824pub struct HciServiceMarker;
7825
7826#[cfg(target_os = "fuchsia")]
7827impl fidl::endpoints::ServiceMarker for HciServiceMarker {
7828 type Proxy = HciServiceProxy;
7829 type Request = HciServiceRequest;
7830 const SERVICE_NAME: &'static str = "fuchsia.hardware.bluetooth.HciService";
7831}
7832
7833#[cfg(target_os = "fuchsia")]
7837pub enum HciServiceRequest {
7838 Hci(HciRequestStream),
7839 HciTransport(HciTransportRequestStream),
7840 Snoop(SnoopRequestStream),
7841}
7842
7843#[cfg(target_os = "fuchsia")]
7844impl fidl::endpoints::ServiceRequest for HciServiceRequest {
7845 type Service = HciServiceMarker;
7846
7847 fn dispatch(name: &str, _channel: fidl::AsyncChannel) -> Self {
7848 match name {
7849 "hci" => Self::Hci(<HciRequestStream as fidl::endpoints::RequestStream>::from_channel(
7850 _channel,
7851 )),
7852 "hci_transport" => Self::HciTransport(
7853 <HciTransportRequestStream as fidl::endpoints::RequestStream>::from_channel(
7854 _channel,
7855 ),
7856 ),
7857 "snoop" => Self::Snoop(
7858 <SnoopRequestStream as fidl::endpoints::RequestStream>::from_channel(_channel),
7859 ),
7860 _ => panic!("no such member protocol name for service HciService"),
7861 }
7862 }
7863
7864 fn member_names() -> &'static [&'static str] {
7865 &["hci", "hci_transport", "snoop"]
7866 }
7867}
7868#[cfg(target_os = "fuchsia")]
7870pub struct HciServiceProxy(#[allow(dead_code)] Box<dyn fidl::endpoints::MemberOpener>);
7871
7872#[cfg(target_os = "fuchsia")]
7873impl fidl::endpoints::ServiceProxy for HciServiceProxy {
7874 type Service = HciServiceMarker;
7875
7876 fn from_member_opener(opener: Box<dyn fidl::endpoints::MemberOpener>) -> Self {
7877 Self(opener)
7878 }
7879}
7880
7881#[cfg(target_os = "fuchsia")]
7882impl HciServiceProxy {
7883 pub fn connect_to_hci(&self) -> Result<HciProxy, fidl::Error> {
7884 let (proxy, server_end) = fidl::endpoints::create_proxy::<HciMarker>();
7885 self.connect_channel_to_hci(server_end)?;
7886 Ok(proxy)
7887 }
7888
7889 pub fn connect_to_hci_sync(&self) -> Result<HciSynchronousProxy, fidl::Error> {
7892 let (proxy, server_end) = fidl::endpoints::create_sync_proxy::<HciMarker>();
7893 self.connect_channel_to_hci(server_end)?;
7894 Ok(proxy)
7895 }
7896
7897 pub fn connect_channel_to_hci(
7900 &self,
7901 server_end: fidl::endpoints::ServerEnd<HciMarker>,
7902 ) -> Result<(), fidl::Error> {
7903 self.0.open_member("hci", server_end.into_channel())
7904 }
7905 pub fn connect_to_hci_transport(&self) -> Result<HciTransportProxy, fidl::Error> {
7906 let (proxy, server_end) = fidl::endpoints::create_proxy::<HciTransportMarker>();
7907 self.connect_channel_to_hci_transport(server_end)?;
7908 Ok(proxy)
7909 }
7910
7911 pub fn connect_to_hci_transport_sync(
7914 &self,
7915 ) -> Result<HciTransportSynchronousProxy, fidl::Error> {
7916 let (proxy, server_end) = fidl::endpoints::create_sync_proxy::<HciTransportMarker>();
7917 self.connect_channel_to_hci_transport(server_end)?;
7918 Ok(proxy)
7919 }
7920
7921 pub fn connect_channel_to_hci_transport(
7924 &self,
7925 server_end: fidl::endpoints::ServerEnd<HciTransportMarker>,
7926 ) -> Result<(), fidl::Error> {
7927 self.0.open_member("hci_transport", server_end.into_channel())
7928 }
7929 pub fn connect_to_snoop(&self) -> Result<SnoopProxy, fidl::Error> {
7930 let (proxy, server_end) = fidl::endpoints::create_proxy::<SnoopMarker>();
7931 self.connect_channel_to_snoop(server_end)?;
7932 Ok(proxy)
7933 }
7934
7935 pub fn connect_to_snoop_sync(&self) -> Result<SnoopSynchronousProxy, fidl::Error> {
7938 let (proxy, server_end) = fidl::endpoints::create_sync_proxy::<SnoopMarker>();
7939 self.connect_channel_to_snoop(server_end)?;
7940 Ok(proxy)
7941 }
7942
7943 pub fn connect_channel_to_snoop(
7946 &self,
7947 server_end: fidl::endpoints::ServerEnd<SnoopMarker>,
7948 ) -> Result<(), fidl::Error> {
7949 self.0.open_member("snoop", server_end.into_channel())
7950 }
7951
7952 pub fn instance_name(&self) -> &str {
7953 self.0.instance_name()
7954 }
7955}
7956
7957#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
7958pub struct ServiceMarker;
7959
7960#[cfg(target_os = "fuchsia")]
7961impl fidl::endpoints::ServiceMarker for ServiceMarker {
7962 type Proxy = ServiceProxy;
7963 type Request = ServiceRequest;
7964 const SERVICE_NAME: &'static str = "fuchsia.hardware.bluetooth.Service";
7965}
7966
7967#[cfg(target_os = "fuchsia")]
7970pub enum ServiceRequest {
7971 Vendor(VendorRequestStream),
7972}
7973
7974#[cfg(target_os = "fuchsia")]
7975impl fidl::endpoints::ServiceRequest for ServiceRequest {
7976 type Service = ServiceMarker;
7977
7978 fn dispatch(name: &str, _channel: fidl::AsyncChannel) -> Self {
7979 match name {
7980 "vendor" => Self::Vendor(
7981 <VendorRequestStream as fidl::endpoints::RequestStream>::from_channel(_channel),
7982 ),
7983 _ => panic!("no such member protocol name for service Service"),
7984 }
7985 }
7986
7987 fn member_names() -> &'static [&'static str] {
7988 &["vendor"]
7989 }
7990}
7991#[cfg(target_os = "fuchsia")]
7992pub struct ServiceProxy(#[allow(dead_code)] Box<dyn fidl::endpoints::MemberOpener>);
7993
7994#[cfg(target_os = "fuchsia")]
7995impl fidl::endpoints::ServiceProxy for ServiceProxy {
7996 type Service = ServiceMarker;
7997
7998 fn from_member_opener(opener: Box<dyn fidl::endpoints::MemberOpener>) -> Self {
7999 Self(opener)
8000 }
8001}
8002
8003#[cfg(target_os = "fuchsia")]
8004impl ServiceProxy {
8005 pub fn connect_to_vendor(&self) -> Result<VendorProxy, fidl::Error> {
8006 let (proxy, server_end) = fidl::endpoints::create_proxy::<VendorMarker>();
8007 self.connect_channel_to_vendor(server_end)?;
8008 Ok(proxy)
8009 }
8010
8011 pub fn connect_to_vendor_sync(&self) -> Result<VendorSynchronousProxy, fidl::Error> {
8014 let (proxy, server_end) = fidl::endpoints::create_sync_proxy::<VendorMarker>();
8015 self.connect_channel_to_vendor(server_end)?;
8016 Ok(proxy)
8017 }
8018
8019 pub fn connect_channel_to_vendor(
8022 &self,
8023 server_end: fidl::endpoints::ServerEnd<VendorMarker>,
8024 ) -> Result<(), fidl::Error> {
8025 self.0.open_member("vendor", server_end.into_channel())
8026 }
8027
8028 pub fn instance_name(&self) -> &str {
8029 self.0.instance_name()
8030 }
8031}
8032
8033mod internal {
8034 use super::*;
8035
8036 impl fidl::encoding::ResourceTypeMarker for HciOpenAclDataChannelRequest {
8037 type Borrowed<'a> = &'a mut Self;
8038 fn take_or_borrow<'a>(
8039 value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
8040 ) -> Self::Borrowed<'a> {
8041 value
8042 }
8043 }
8044
8045 unsafe impl fidl::encoding::TypeMarker for HciOpenAclDataChannelRequest {
8046 type Owned = Self;
8047
8048 #[inline(always)]
8049 fn inline_align(_context: fidl::encoding::Context) -> usize {
8050 4
8051 }
8052
8053 #[inline(always)]
8054 fn inline_size(_context: fidl::encoding::Context) -> usize {
8055 4
8056 }
8057 }
8058
8059 unsafe impl
8060 fidl::encoding::Encode<
8061 HciOpenAclDataChannelRequest,
8062 fidl::encoding::DefaultFuchsiaResourceDialect,
8063 > for &mut HciOpenAclDataChannelRequest
8064 {
8065 #[inline]
8066 unsafe fn encode(
8067 self,
8068 encoder: &mut fidl::encoding::Encoder<
8069 '_,
8070 fidl::encoding::DefaultFuchsiaResourceDialect,
8071 >,
8072 offset: usize,
8073 _depth: fidl::encoding::Depth,
8074 ) -> fidl::Result<()> {
8075 encoder.debug_check_bounds::<HciOpenAclDataChannelRequest>(offset);
8076 fidl::encoding::Encode::<
8078 HciOpenAclDataChannelRequest,
8079 fidl::encoding::DefaultFuchsiaResourceDialect,
8080 >::encode(
8081 (<fidl::encoding::HandleType<
8082 fidl::Channel,
8083 { fidl::ObjectType::CHANNEL.into_raw() },
8084 2147483648,
8085 > as fidl::encoding::ResourceTypeMarker>::take_or_borrow(
8086 &mut self.channel
8087 ),),
8088 encoder,
8089 offset,
8090 _depth,
8091 )
8092 }
8093 }
8094 unsafe impl<
8095 T0: fidl::encoding::Encode<
8096 fidl::encoding::HandleType<
8097 fidl::Channel,
8098 { fidl::ObjectType::CHANNEL.into_raw() },
8099 2147483648,
8100 >,
8101 fidl::encoding::DefaultFuchsiaResourceDialect,
8102 >,
8103 >
8104 fidl::encoding::Encode<
8105 HciOpenAclDataChannelRequest,
8106 fidl::encoding::DefaultFuchsiaResourceDialect,
8107 > for (T0,)
8108 {
8109 #[inline]
8110 unsafe fn encode(
8111 self,
8112 encoder: &mut fidl::encoding::Encoder<
8113 '_,
8114 fidl::encoding::DefaultFuchsiaResourceDialect,
8115 >,
8116 offset: usize,
8117 depth: fidl::encoding::Depth,
8118 ) -> fidl::Result<()> {
8119 encoder.debug_check_bounds::<HciOpenAclDataChannelRequest>(offset);
8120 self.0.encode(encoder, offset + 0, depth)?;
8124 Ok(())
8125 }
8126 }
8127
8128 impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
8129 for HciOpenAclDataChannelRequest
8130 {
8131 #[inline(always)]
8132 fn new_empty() -> Self {
8133 Self {
8134 channel: fidl::new_empty!(fidl::encoding::HandleType<fidl::Channel, { fidl::ObjectType::CHANNEL.into_raw() }, 2147483648>, fidl::encoding::DefaultFuchsiaResourceDialect),
8135 }
8136 }
8137
8138 #[inline]
8139 unsafe fn decode(
8140 &mut self,
8141 decoder: &mut fidl::encoding::Decoder<
8142 '_,
8143 fidl::encoding::DefaultFuchsiaResourceDialect,
8144 >,
8145 offset: usize,
8146 _depth: fidl::encoding::Depth,
8147 ) -> fidl::Result<()> {
8148 decoder.debug_check_bounds::<Self>(offset);
8149 fidl::decode!(fidl::encoding::HandleType<fidl::Channel, { fidl::ObjectType::CHANNEL.into_raw() }, 2147483648>, fidl::encoding::DefaultFuchsiaResourceDialect, &mut self.channel, decoder, offset + 0, _depth)?;
8151 Ok(())
8152 }
8153 }
8154
8155 impl fidl::encoding::ResourceTypeMarker for HciOpenCommandChannelRequest {
8156 type Borrowed<'a> = &'a mut Self;
8157 fn take_or_borrow<'a>(
8158 value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
8159 ) -> Self::Borrowed<'a> {
8160 value
8161 }
8162 }
8163
8164 unsafe impl fidl::encoding::TypeMarker for HciOpenCommandChannelRequest {
8165 type Owned = Self;
8166
8167 #[inline(always)]
8168 fn inline_align(_context: fidl::encoding::Context) -> usize {
8169 4
8170 }
8171
8172 #[inline(always)]
8173 fn inline_size(_context: fidl::encoding::Context) -> usize {
8174 4
8175 }
8176 }
8177
8178 unsafe impl
8179 fidl::encoding::Encode<
8180 HciOpenCommandChannelRequest,
8181 fidl::encoding::DefaultFuchsiaResourceDialect,
8182 > for &mut HciOpenCommandChannelRequest
8183 {
8184 #[inline]
8185 unsafe fn encode(
8186 self,
8187 encoder: &mut fidl::encoding::Encoder<
8188 '_,
8189 fidl::encoding::DefaultFuchsiaResourceDialect,
8190 >,
8191 offset: usize,
8192 _depth: fidl::encoding::Depth,
8193 ) -> fidl::Result<()> {
8194 encoder.debug_check_bounds::<HciOpenCommandChannelRequest>(offset);
8195 fidl::encoding::Encode::<
8197 HciOpenCommandChannelRequest,
8198 fidl::encoding::DefaultFuchsiaResourceDialect,
8199 >::encode(
8200 (<fidl::encoding::HandleType<
8201 fidl::Channel,
8202 { fidl::ObjectType::CHANNEL.into_raw() },
8203 2147483648,
8204 > as fidl::encoding::ResourceTypeMarker>::take_or_borrow(
8205 &mut self.channel
8206 ),),
8207 encoder,
8208 offset,
8209 _depth,
8210 )
8211 }
8212 }
8213 unsafe impl<
8214 T0: fidl::encoding::Encode<
8215 fidl::encoding::HandleType<
8216 fidl::Channel,
8217 { fidl::ObjectType::CHANNEL.into_raw() },
8218 2147483648,
8219 >,
8220 fidl::encoding::DefaultFuchsiaResourceDialect,
8221 >,
8222 >
8223 fidl::encoding::Encode<
8224 HciOpenCommandChannelRequest,
8225 fidl::encoding::DefaultFuchsiaResourceDialect,
8226 > for (T0,)
8227 {
8228 #[inline]
8229 unsafe fn encode(
8230 self,
8231 encoder: &mut fidl::encoding::Encoder<
8232 '_,
8233 fidl::encoding::DefaultFuchsiaResourceDialect,
8234 >,
8235 offset: usize,
8236 depth: fidl::encoding::Depth,
8237 ) -> fidl::Result<()> {
8238 encoder.debug_check_bounds::<HciOpenCommandChannelRequest>(offset);
8239 self.0.encode(encoder, offset + 0, depth)?;
8243 Ok(())
8244 }
8245 }
8246
8247 impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
8248 for HciOpenCommandChannelRequest
8249 {
8250 #[inline(always)]
8251 fn new_empty() -> Self {
8252 Self {
8253 channel: fidl::new_empty!(fidl::encoding::HandleType<fidl::Channel, { fidl::ObjectType::CHANNEL.into_raw() }, 2147483648>, fidl::encoding::DefaultFuchsiaResourceDialect),
8254 }
8255 }
8256
8257 #[inline]
8258 unsafe fn decode(
8259 &mut self,
8260 decoder: &mut fidl::encoding::Decoder<
8261 '_,
8262 fidl::encoding::DefaultFuchsiaResourceDialect,
8263 >,
8264 offset: usize,
8265 _depth: fidl::encoding::Depth,
8266 ) -> fidl::Result<()> {
8267 decoder.debug_check_bounds::<Self>(offset);
8268 fidl::decode!(fidl::encoding::HandleType<fidl::Channel, { fidl::ObjectType::CHANNEL.into_raw() }, 2147483648>, fidl::encoding::DefaultFuchsiaResourceDialect, &mut self.channel, decoder, offset + 0, _depth)?;
8270 Ok(())
8271 }
8272 }
8273
8274 impl fidl::encoding::ResourceTypeMarker for HciOpenIsoDataChannelRequest {
8275 type Borrowed<'a> = &'a mut Self;
8276 fn take_or_borrow<'a>(
8277 value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
8278 ) -> Self::Borrowed<'a> {
8279 value
8280 }
8281 }
8282
8283 unsafe impl fidl::encoding::TypeMarker for HciOpenIsoDataChannelRequest {
8284 type Owned = Self;
8285
8286 #[inline(always)]
8287 fn inline_align(_context: fidl::encoding::Context) -> usize {
8288 4
8289 }
8290
8291 #[inline(always)]
8292 fn inline_size(_context: fidl::encoding::Context) -> usize {
8293 4
8294 }
8295 }
8296
8297 unsafe impl
8298 fidl::encoding::Encode<
8299 HciOpenIsoDataChannelRequest,
8300 fidl::encoding::DefaultFuchsiaResourceDialect,
8301 > for &mut HciOpenIsoDataChannelRequest
8302 {
8303 #[inline]
8304 unsafe fn encode(
8305 self,
8306 encoder: &mut fidl::encoding::Encoder<
8307 '_,
8308 fidl::encoding::DefaultFuchsiaResourceDialect,
8309 >,
8310 offset: usize,
8311 _depth: fidl::encoding::Depth,
8312 ) -> fidl::Result<()> {
8313 encoder.debug_check_bounds::<HciOpenIsoDataChannelRequest>(offset);
8314 fidl::encoding::Encode::<
8316 HciOpenIsoDataChannelRequest,
8317 fidl::encoding::DefaultFuchsiaResourceDialect,
8318 >::encode(
8319 (<fidl::encoding::HandleType<
8320 fidl::Channel,
8321 { fidl::ObjectType::CHANNEL.into_raw() },
8322 2147483648,
8323 > as fidl::encoding::ResourceTypeMarker>::take_or_borrow(
8324 &mut self.channel
8325 ),),
8326 encoder,
8327 offset,
8328 _depth,
8329 )
8330 }
8331 }
8332 unsafe impl<
8333 T0: fidl::encoding::Encode<
8334 fidl::encoding::HandleType<
8335 fidl::Channel,
8336 { fidl::ObjectType::CHANNEL.into_raw() },
8337 2147483648,
8338 >,
8339 fidl::encoding::DefaultFuchsiaResourceDialect,
8340 >,
8341 >
8342 fidl::encoding::Encode<
8343 HciOpenIsoDataChannelRequest,
8344 fidl::encoding::DefaultFuchsiaResourceDialect,
8345 > for (T0,)
8346 {
8347 #[inline]
8348 unsafe fn encode(
8349 self,
8350 encoder: &mut fidl::encoding::Encoder<
8351 '_,
8352 fidl::encoding::DefaultFuchsiaResourceDialect,
8353 >,
8354 offset: usize,
8355 depth: fidl::encoding::Depth,
8356 ) -> fidl::Result<()> {
8357 encoder.debug_check_bounds::<HciOpenIsoDataChannelRequest>(offset);
8358 self.0.encode(encoder, offset + 0, depth)?;
8362 Ok(())
8363 }
8364 }
8365
8366 impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
8367 for HciOpenIsoDataChannelRequest
8368 {
8369 #[inline(always)]
8370 fn new_empty() -> Self {
8371 Self {
8372 channel: fidl::new_empty!(fidl::encoding::HandleType<fidl::Channel, { fidl::ObjectType::CHANNEL.into_raw() }, 2147483648>, fidl::encoding::DefaultFuchsiaResourceDialect),
8373 }
8374 }
8375
8376 #[inline]
8377 unsafe fn decode(
8378 &mut self,
8379 decoder: &mut fidl::encoding::Decoder<
8380 '_,
8381 fidl::encoding::DefaultFuchsiaResourceDialect,
8382 >,
8383 offset: usize,
8384 _depth: fidl::encoding::Depth,
8385 ) -> fidl::Result<()> {
8386 decoder.debug_check_bounds::<Self>(offset);
8387 fidl::decode!(fidl::encoding::HandleType<fidl::Channel, { fidl::ObjectType::CHANNEL.into_raw() }, 2147483648>, fidl::encoding::DefaultFuchsiaResourceDialect, &mut self.channel, decoder, offset + 0, _depth)?;
8389 Ok(())
8390 }
8391 }
8392
8393 impl fidl::encoding::ResourceTypeMarker for HciOpenScoDataChannelRequest {
8394 type Borrowed<'a> = &'a mut Self;
8395 fn take_or_borrow<'a>(
8396 value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
8397 ) -> Self::Borrowed<'a> {
8398 value
8399 }
8400 }
8401
8402 unsafe impl fidl::encoding::TypeMarker for HciOpenScoDataChannelRequest {
8403 type Owned = Self;
8404
8405 #[inline(always)]
8406 fn inline_align(_context: fidl::encoding::Context) -> usize {
8407 4
8408 }
8409
8410 #[inline(always)]
8411 fn inline_size(_context: fidl::encoding::Context) -> usize {
8412 4
8413 }
8414 }
8415
8416 unsafe impl
8417 fidl::encoding::Encode<
8418 HciOpenScoDataChannelRequest,
8419 fidl::encoding::DefaultFuchsiaResourceDialect,
8420 > for &mut HciOpenScoDataChannelRequest
8421 {
8422 #[inline]
8423 unsafe fn encode(
8424 self,
8425 encoder: &mut fidl::encoding::Encoder<
8426 '_,
8427 fidl::encoding::DefaultFuchsiaResourceDialect,
8428 >,
8429 offset: usize,
8430 _depth: fidl::encoding::Depth,
8431 ) -> fidl::Result<()> {
8432 encoder.debug_check_bounds::<HciOpenScoDataChannelRequest>(offset);
8433 fidl::encoding::Encode::<
8435 HciOpenScoDataChannelRequest,
8436 fidl::encoding::DefaultFuchsiaResourceDialect,
8437 >::encode(
8438 (<fidl::encoding::HandleType<
8439 fidl::Channel,
8440 { fidl::ObjectType::CHANNEL.into_raw() },
8441 2147483648,
8442 > as fidl::encoding::ResourceTypeMarker>::take_or_borrow(
8443 &mut self.channel
8444 ),),
8445 encoder,
8446 offset,
8447 _depth,
8448 )
8449 }
8450 }
8451 unsafe impl<
8452 T0: fidl::encoding::Encode<
8453 fidl::encoding::HandleType<
8454 fidl::Channel,
8455 { fidl::ObjectType::CHANNEL.into_raw() },
8456 2147483648,
8457 >,
8458 fidl::encoding::DefaultFuchsiaResourceDialect,
8459 >,
8460 >
8461 fidl::encoding::Encode<
8462 HciOpenScoDataChannelRequest,
8463 fidl::encoding::DefaultFuchsiaResourceDialect,
8464 > for (T0,)
8465 {
8466 #[inline]
8467 unsafe fn encode(
8468 self,
8469 encoder: &mut fidl::encoding::Encoder<
8470 '_,
8471 fidl::encoding::DefaultFuchsiaResourceDialect,
8472 >,
8473 offset: usize,
8474 depth: fidl::encoding::Depth,
8475 ) -> fidl::Result<()> {
8476 encoder.debug_check_bounds::<HciOpenScoDataChannelRequest>(offset);
8477 self.0.encode(encoder, offset + 0, depth)?;
8481 Ok(())
8482 }
8483 }
8484
8485 impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
8486 for HciOpenScoDataChannelRequest
8487 {
8488 #[inline(always)]
8489 fn new_empty() -> Self {
8490 Self {
8491 channel: fidl::new_empty!(fidl::encoding::HandleType<fidl::Channel, { fidl::ObjectType::CHANNEL.into_raw() }, 2147483648>, fidl::encoding::DefaultFuchsiaResourceDialect),
8492 }
8493 }
8494
8495 #[inline]
8496 unsafe fn decode(
8497 &mut self,
8498 decoder: &mut fidl::encoding::Decoder<
8499 '_,
8500 fidl::encoding::DefaultFuchsiaResourceDialect,
8501 >,
8502 offset: usize,
8503 _depth: fidl::encoding::Depth,
8504 ) -> fidl::Result<()> {
8505 decoder.debug_check_bounds::<Self>(offset);
8506 fidl::decode!(fidl::encoding::HandleType<fidl::Channel, { fidl::ObjectType::CHANNEL.into_raw() }, 2147483648>, fidl::encoding::DefaultFuchsiaResourceDialect, &mut self.channel, decoder, offset + 0, _depth)?;
8508 Ok(())
8509 }
8510 }
8511
8512 impl fidl::encoding::ResourceTypeMarker for HciOpenSnoopChannelRequest {
8513 type Borrowed<'a> = &'a mut Self;
8514 fn take_or_borrow<'a>(
8515 value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
8516 ) -> Self::Borrowed<'a> {
8517 value
8518 }
8519 }
8520
8521 unsafe impl fidl::encoding::TypeMarker for HciOpenSnoopChannelRequest {
8522 type Owned = Self;
8523
8524 #[inline(always)]
8525 fn inline_align(_context: fidl::encoding::Context) -> usize {
8526 4
8527 }
8528
8529 #[inline(always)]
8530 fn inline_size(_context: fidl::encoding::Context) -> usize {
8531 4
8532 }
8533 }
8534
8535 unsafe impl
8536 fidl::encoding::Encode<
8537 HciOpenSnoopChannelRequest,
8538 fidl::encoding::DefaultFuchsiaResourceDialect,
8539 > for &mut HciOpenSnoopChannelRequest
8540 {
8541 #[inline]
8542 unsafe fn encode(
8543 self,
8544 encoder: &mut fidl::encoding::Encoder<
8545 '_,
8546 fidl::encoding::DefaultFuchsiaResourceDialect,
8547 >,
8548 offset: usize,
8549 _depth: fidl::encoding::Depth,
8550 ) -> fidl::Result<()> {
8551 encoder.debug_check_bounds::<HciOpenSnoopChannelRequest>(offset);
8552 fidl::encoding::Encode::<
8554 HciOpenSnoopChannelRequest,
8555 fidl::encoding::DefaultFuchsiaResourceDialect,
8556 >::encode(
8557 (<fidl::encoding::HandleType<
8558 fidl::Channel,
8559 { fidl::ObjectType::CHANNEL.into_raw() },
8560 2147483648,
8561 > as fidl::encoding::ResourceTypeMarker>::take_or_borrow(
8562 &mut self.channel
8563 ),),
8564 encoder,
8565 offset,
8566 _depth,
8567 )
8568 }
8569 }
8570 unsafe impl<
8571 T0: fidl::encoding::Encode<
8572 fidl::encoding::HandleType<
8573 fidl::Channel,
8574 { fidl::ObjectType::CHANNEL.into_raw() },
8575 2147483648,
8576 >,
8577 fidl::encoding::DefaultFuchsiaResourceDialect,
8578 >,
8579 >
8580 fidl::encoding::Encode<
8581 HciOpenSnoopChannelRequest,
8582 fidl::encoding::DefaultFuchsiaResourceDialect,
8583 > for (T0,)
8584 {
8585 #[inline]
8586 unsafe fn encode(
8587 self,
8588 encoder: &mut fidl::encoding::Encoder<
8589 '_,
8590 fidl::encoding::DefaultFuchsiaResourceDialect,
8591 >,
8592 offset: usize,
8593 depth: fidl::encoding::Depth,
8594 ) -> fidl::Result<()> {
8595 encoder.debug_check_bounds::<HciOpenSnoopChannelRequest>(offset);
8596 self.0.encode(encoder, offset + 0, depth)?;
8600 Ok(())
8601 }
8602 }
8603
8604 impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
8605 for HciOpenSnoopChannelRequest
8606 {
8607 #[inline(always)]
8608 fn new_empty() -> Self {
8609 Self {
8610 channel: fidl::new_empty!(fidl::encoding::HandleType<fidl::Channel, { fidl::ObjectType::CHANNEL.into_raw() }, 2147483648>, fidl::encoding::DefaultFuchsiaResourceDialect),
8611 }
8612 }
8613
8614 #[inline]
8615 unsafe fn decode(
8616 &mut self,
8617 decoder: &mut fidl::encoding::Decoder<
8618 '_,
8619 fidl::encoding::DefaultFuchsiaResourceDialect,
8620 >,
8621 offset: usize,
8622 _depth: fidl::encoding::Depth,
8623 ) -> fidl::Result<()> {
8624 decoder.debug_check_bounds::<Self>(offset);
8625 fidl::decode!(fidl::encoding::HandleType<fidl::Channel, { fidl::ObjectType::CHANNEL.into_raw() }, 2147483648>, fidl::encoding::DefaultFuchsiaResourceDialect, &mut self.channel, decoder, offset + 0, _depth)?;
8627 Ok(())
8628 }
8629 }
8630
8631 impl fidl::encoding::ResourceTypeMarker for VendorOpenHciTransportResponse {
8632 type Borrowed<'a> = &'a mut Self;
8633 fn take_or_borrow<'a>(
8634 value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
8635 ) -> Self::Borrowed<'a> {
8636 value
8637 }
8638 }
8639
8640 unsafe impl fidl::encoding::TypeMarker for VendorOpenHciTransportResponse {
8641 type Owned = Self;
8642
8643 #[inline(always)]
8644 fn inline_align(_context: fidl::encoding::Context) -> usize {
8645 4
8646 }
8647
8648 #[inline(always)]
8649 fn inline_size(_context: fidl::encoding::Context) -> usize {
8650 4
8651 }
8652 }
8653
8654 unsafe impl
8655 fidl::encoding::Encode<
8656 VendorOpenHciTransportResponse,
8657 fidl::encoding::DefaultFuchsiaResourceDialect,
8658 > for &mut VendorOpenHciTransportResponse
8659 {
8660 #[inline]
8661 unsafe fn encode(
8662 self,
8663 encoder: &mut fidl::encoding::Encoder<
8664 '_,
8665 fidl::encoding::DefaultFuchsiaResourceDialect,
8666 >,
8667 offset: usize,
8668 _depth: fidl::encoding::Depth,
8669 ) -> fidl::Result<()> {
8670 encoder.debug_check_bounds::<VendorOpenHciTransportResponse>(offset);
8671 fidl::encoding::Encode::<VendorOpenHciTransportResponse, fidl::encoding::DefaultFuchsiaResourceDialect>::encode(
8673 (
8674 <fidl::encoding::Endpoint<fidl::endpoints::ClientEnd<HciTransportMarker>> as fidl::encoding::ResourceTypeMarker>::take_or_borrow(&mut self.channel),
8675 ),
8676 encoder, offset, _depth
8677 )
8678 }
8679 }
8680 unsafe impl<
8681 T0: fidl::encoding::Encode<
8682 fidl::encoding::Endpoint<fidl::endpoints::ClientEnd<HciTransportMarker>>,
8683 fidl::encoding::DefaultFuchsiaResourceDialect,
8684 >,
8685 >
8686 fidl::encoding::Encode<
8687 VendorOpenHciTransportResponse,
8688 fidl::encoding::DefaultFuchsiaResourceDialect,
8689 > for (T0,)
8690 {
8691 #[inline]
8692 unsafe fn encode(
8693 self,
8694 encoder: &mut fidl::encoding::Encoder<
8695 '_,
8696 fidl::encoding::DefaultFuchsiaResourceDialect,
8697 >,
8698 offset: usize,
8699 depth: fidl::encoding::Depth,
8700 ) -> fidl::Result<()> {
8701 encoder.debug_check_bounds::<VendorOpenHciTransportResponse>(offset);
8702 self.0.encode(encoder, offset + 0, depth)?;
8706 Ok(())
8707 }
8708 }
8709
8710 impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
8711 for VendorOpenHciTransportResponse
8712 {
8713 #[inline(always)]
8714 fn new_empty() -> Self {
8715 Self {
8716 channel: fidl::new_empty!(
8717 fidl::encoding::Endpoint<fidl::endpoints::ClientEnd<HciTransportMarker>>,
8718 fidl::encoding::DefaultFuchsiaResourceDialect
8719 ),
8720 }
8721 }
8722
8723 #[inline]
8724 unsafe fn decode(
8725 &mut self,
8726 decoder: &mut fidl::encoding::Decoder<
8727 '_,
8728 fidl::encoding::DefaultFuchsiaResourceDialect,
8729 >,
8730 offset: usize,
8731 _depth: fidl::encoding::Depth,
8732 ) -> fidl::Result<()> {
8733 decoder.debug_check_bounds::<Self>(offset);
8734 fidl::decode!(
8736 fidl::encoding::Endpoint<fidl::endpoints::ClientEnd<HciTransportMarker>>,
8737 fidl::encoding::DefaultFuchsiaResourceDialect,
8738 &mut self.channel,
8739 decoder,
8740 offset + 0,
8741 _depth
8742 )?;
8743 Ok(())
8744 }
8745 }
8746
8747 impl fidl::encoding::ResourceTypeMarker for VendorOpenHciResponse {
8748 type Borrowed<'a> = &'a mut Self;
8749 fn take_or_borrow<'a>(
8750 value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
8751 ) -> Self::Borrowed<'a> {
8752 value
8753 }
8754 }
8755
8756 unsafe impl fidl::encoding::TypeMarker for VendorOpenHciResponse {
8757 type Owned = Self;
8758
8759 #[inline(always)]
8760 fn inline_align(_context: fidl::encoding::Context) -> usize {
8761 4
8762 }
8763
8764 #[inline(always)]
8765 fn inline_size(_context: fidl::encoding::Context) -> usize {
8766 4
8767 }
8768 }
8769
8770 unsafe impl
8771 fidl::encoding::Encode<VendorOpenHciResponse, fidl::encoding::DefaultFuchsiaResourceDialect>
8772 for &mut VendorOpenHciResponse
8773 {
8774 #[inline]
8775 unsafe fn encode(
8776 self,
8777 encoder: &mut fidl::encoding::Encoder<
8778 '_,
8779 fidl::encoding::DefaultFuchsiaResourceDialect,
8780 >,
8781 offset: usize,
8782 _depth: fidl::encoding::Depth,
8783 ) -> fidl::Result<()> {
8784 encoder.debug_check_bounds::<VendorOpenHciResponse>(offset);
8785 fidl::encoding::Encode::<VendorOpenHciResponse, fidl::encoding::DefaultFuchsiaResourceDialect>::encode(
8787 (
8788 <fidl::encoding::Endpoint<fidl::endpoints::ClientEnd<HciMarker>> as fidl::encoding::ResourceTypeMarker>::take_or_borrow(&mut self.channel),
8789 ),
8790 encoder, offset, _depth
8791 )
8792 }
8793 }
8794 unsafe impl<
8795 T0: fidl::encoding::Encode<
8796 fidl::encoding::Endpoint<fidl::endpoints::ClientEnd<HciMarker>>,
8797 fidl::encoding::DefaultFuchsiaResourceDialect,
8798 >,
8799 >
8800 fidl::encoding::Encode<VendorOpenHciResponse, fidl::encoding::DefaultFuchsiaResourceDialect>
8801 for (T0,)
8802 {
8803 #[inline]
8804 unsafe fn encode(
8805 self,
8806 encoder: &mut fidl::encoding::Encoder<
8807 '_,
8808 fidl::encoding::DefaultFuchsiaResourceDialect,
8809 >,
8810 offset: usize,
8811 depth: fidl::encoding::Depth,
8812 ) -> fidl::Result<()> {
8813 encoder.debug_check_bounds::<VendorOpenHciResponse>(offset);
8814 self.0.encode(encoder, offset + 0, depth)?;
8818 Ok(())
8819 }
8820 }
8821
8822 impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
8823 for VendorOpenHciResponse
8824 {
8825 #[inline(always)]
8826 fn new_empty() -> Self {
8827 Self {
8828 channel: fidl::new_empty!(
8829 fidl::encoding::Endpoint<fidl::endpoints::ClientEnd<HciMarker>>,
8830 fidl::encoding::DefaultFuchsiaResourceDialect
8831 ),
8832 }
8833 }
8834
8835 #[inline]
8836 unsafe fn decode(
8837 &mut self,
8838 decoder: &mut fidl::encoding::Decoder<
8839 '_,
8840 fidl::encoding::DefaultFuchsiaResourceDialect,
8841 >,
8842 offset: usize,
8843 _depth: fidl::encoding::Depth,
8844 ) -> fidl::Result<()> {
8845 decoder.debug_check_bounds::<Self>(offset);
8846 fidl::decode!(
8848 fidl::encoding::Endpoint<fidl::endpoints::ClientEnd<HciMarker>>,
8849 fidl::encoding::DefaultFuchsiaResourceDialect,
8850 &mut self.channel,
8851 decoder,
8852 offset + 0,
8853 _depth
8854 )?;
8855 Ok(())
8856 }
8857 }
8858
8859 impl fidl::encoding::ResourceTypeMarker for VendorOpenSnoopResponse {
8860 type Borrowed<'a> = &'a mut Self;
8861 fn take_or_borrow<'a>(
8862 value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
8863 ) -> Self::Borrowed<'a> {
8864 value
8865 }
8866 }
8867
8868 unsafe impl fidl::encoding::TypeMarker for VendorOpenSnoopResponse {
8869 type Owned = Self;
8870
8871 #[inline(always)]
8872 fn inline_align(_context: fidl::encoding::Context) -> usize {
8873 4
8874 }
8875
8876 #[inline(always)]
8877 fn inline_size(_context: fidl::encoding::Context) -> usize {
8878 4
8879 }
8880 }
8881
8882 unsafe impl
8883 fidl::encoding::Encode<
8884 VendorOpenSnoopResponse,
8885 fidl::encoding::DefaultFuchsiaResourceDialect,
8886 > for &mut VendorOpenSnoopResponse
8887 {
8888 #[inline]
8889 unsafe fn encode(
8890 self,
8891 encoder: &mut fidl::encoding::Encoder<
8892 '_,
8893 fidl::encoding::DefaultFuchsiaResourceDialect,
8894 >,
8895 offset: usize,
8896 _depth: fidl::encoding::Depth,
8897 ) -> fidl::Result<()> {
8898 encoder.debug_check_bounds::<VendorOpenSnoopResponse>(offset);
8899 fidl::encoding::Encode::<VendorOpenSnoopResponse, fidl::encoding::DefaultFuchsiaResourceDialect>::encode(
8901 (
8902 <fidl::encoding::Endpoint<fidl::endpoints::ClientEnd<SnoopMarker>> as fidl::encoding::ResourceTypeMarker>::take_or_borrow(&mut self.channel),
8903 ),
8904 encoder, offset, _depth
8905 )
8906 }
8907 }
8908 unsafe impl<
8909 T0: fidl::encoding::Encode<
8910 fidl::encoding::Endpoint<fidl::endpoints::ClientEnd<SnoopMarker>>,
8911 fidl::encoding::DefaultFuchsiaResourceDialect,
8912 >,
8913 >
8914 fidl::encoding::Encode<
8915 VendorOpenSnoopResponse,
8916 fidl::encoding::DefaultFuchsiaResourceDialect,
8917 > for (T0,)
8918 {
8919 #[inline]
8920 unsafe fn encode(
8921 self,
8922 encoder: &mut fidl::encoding::Encoder<
8923 '_,
8924 fidl::encoding::DefaultFuchsiaResourceDialect,
8925 >,
8926 offset: usize,
8927 depth: fidl::encoding::Depth,
8928 ) -> fidl::Result<()> {
8929 encoder.debug_check_bounds::<VendorOpenSnoopResponse>(offset);
8930 self.0.encode(encoder, offset + 0, depth)?;
8934 Ok(())
8935 }
8936 }
8937
8938 impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
8939 for VendorOpenSnoopResponse
8940 {
8941 #[inline(always)]
8942 fn new_empty() -> Self {
8943 Self {
8944 channel: fidl::new_empty!(
8945 fidl::encoding::Endpoint<fidl::endpoints::ClientEnd<SnoopMarker>>,
8946 fidl::encoding::DefaultFuchsiaResourceDialect
8947 ),
8948 }
8949 }
8950
8951 #[inline]
8952 unsafe fn decode(
8953 &mut self,
8954 decoder: &mut fidl::encoding::Decoder<
8955 '_,
8956 fidl::encoding::DefaultFuchsiaResourceDialect,
8957 >,
8958 offset: usize,
8959 _depth: fidl::encoding::Depth,
8960 ) -> fidl::Result<()> {
8961 decoder.debug_check_bounds::<Self>(offset);
8962 fidl::decode!(
8964 fidl::encoding::Endpoint<fidl::endpoints::ClientEnd<SnoopMarker>>,
8965 fidl::encoding::DefaultFuchsiaResourceDialect,
8966 &mut self.channel,
8967 decoder,
8968 offset + 0,
8969 _depth
8970 )?;
8971 Ok(())
8972 }
8973 }
8974
8975 impl HciTransportConfigureScoRequest {
8976 #[inline(always)]
8977 fn max_ordinal_present(&self) -> u64 {
8978 if let Some(_) = self.connection {
8979 return 4;
8980 }
8981 if let Some(_) = self.sample_rate {
8982 return 3;
8983 }
8984 if let Some(_) = self.encoding {
8985 return 2;
8986 }
8987 if let Some(_) = self.coding_format {
8988 return 1;
8989 }
8990 0
8991 }
8992 }
8993
8994 impl fidl::encoding::ResourceTypeMarker for HciTransportConfigureScoRequest {
8995 type Borrowed<'a> = &'a mut Self;
8996 fn take_or_borrow<'a>(
8997 value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
8998 ) -> Self::Borrowed<'a> {
8999 value
9000 }
9001 }
9002
9003 unsafe impl fidl::encoding::TypeMarker for HciTransportConfigureScoRequest {
9004 type Owned = Self;
9005
9006 #[inline(always)]
9007 fn inline_align(_context: fidl::encoding::Context) -> usize {
9008 8
9009 }
9010
9011 #[inline(always)]
9012 fn inline_size(_context: fidl::encoding::Context) -> usize {
9013 16
9014 }
9015 }
9016
9017 unsafe impl
9018 fidl::encoding::Encode<
9019 HciTransportConfigureScoRequest,
9020 fidl::encoding::DefaultFuchsiaResourceDialect,
9021 > for &mut HciTransportConfigureScoRequest
9022 {
9023 unsafe fn encode(
9024 self,
9025 encoder: &mut fidl::encoding::Encoder<
9026 '_,
9027 fidl::encoding::DefaultFuchsiaResourceDialect,
9028 >,
9029 offset: usize,
9030 mut depth: fidl::encoding::Depth,
9031 ) -> fidl::Result<()> {
9032 encoder.debug_check_bounds::<HciTransportConfigureScoRequest>(offset);
9033 let max_ordinal: u64 = self.max_ordinal_present();
9035 encoder.write_num(max_ordinal, offset);
9036 encoder.write_num(fidl::encoding::ALLOC_PRESENT_U64, offset + 8);
9037 if max_ordinal == 0 {
9039 return Ok(());
9040 }
9041 depth.increment()?;
9042 let envelope_size = 8;
9043 let bytes_len = max_ordinal as usize * envelope_size;
9044 #[allow(unused_variables)]
9045 let offset = encoder.out_of_line_offset(bytes_len);
9046 let mut _prev_end_offset: usize = 0;
9047 if 1 > max_ordinal {
9048 return Ok(());
9049 }
9050
9051 let cur_offset: usize = (1 - 1) * envelope_size;
9054
9055 encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
9057
9058 fidl::encoding::encode_in_envelope_optional::<
9063 ScoCodingFormat,
9064 fidl::encoding::DefaultFuchsiaResourceDialect,
9065 >(
9066 self.coding_format
9067 .as_ref()
9068 .map(<ScoCodingFormat as fidl::encoding::ValueTypeMarker>::borrow),
9069 encoder,
9070 offset + cur_offset,
9071 depth,
9072 )?;
9073
9074 _prev_end_offset = cur_offset + envelope_size;
9075 if 2 > max_ordinal {
9076 return Ok(());
9077 }
9078
9079 let cur_offset: usize = (2 - 1) * envelope_size;
9082
9083 encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
9085
9086 fidl::encoding::encode_in_envelope_optional::<
9091 ScoEncoding,
9092 fidl::encoding::DefaultFuchsiaResourceDialect,
9093 >(
9094 self.encoding
9095 .as_ref()
9096 .map(<ScoEncoding as fidl::encoding::ValueTypeMarker>::borrow),
9097 encoder,
9098 offset + cur_offset,
9099 depth,
9100 )?;
9101
9102 _prev_end_offset = cur_offset + envelope_size;
9103 if 3 > max_ordinal {
9104 return Ok(());
9105 }
9106
9107 let cur_offset: usize = (3 - 1) * envelope_size;
9110
9111 encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
9113
9114 fidl::encoding::encode_in_envelope_optional::<
9119 ScoSampleRate,
9120 fidl::encoding::DefaultFuchsiaResourceDialect,
9121 >(
9122 self.sample_rate
9123 .as_ref()
9124 .map(<ScoSampleRate as fidl::encoding::ValueTypeMarker>::borrow),
9125 encoder,
9126 offset + cur_offset,
9127 depth,
9128 )?;
9129
9130 _prev_end_offset = cur_offset + envelope_size;
9131 if 4 > max_ordinal {
9132 return Ok(());
9133 }
9134
9135 let cur_offset: usize = (4 - 1) * envelope_size;
9138
9139 encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
9141
9142 fidl::encoding::encode_in_envelope_optional::<fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<ScoConnectionMarker>>, fidl::encoding::DefaultFuchsiaResourceDialect>(
9147 self.connection.as_mut().map(<fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<ScoConnectionMarker>> as fidl::encoding::ResourceTypeMarker>::take_or_borrow),
9148 encoder, offset + cur_offset, depth
9149 )?;
9150
9151 _prev_end_offset = cur_offset + envelope_size;
9152
9153 Ok(())
9154 }
9155 }
9156
9157 impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
9158 for HciTransportConfigureScoRequest
9159 {
9160 #[inline(always)]
9161 fn new_empty() -> Self {
9162 Self::default()
9163 }
9164
9165 unsafe fn decode(
9166 &mut self,
9167 decoder: &mut fidl::encoding::Decoder<
9168 '_,
9169 fidl::encoding::DefaultFuchsiaResourceDialect,
9170 >,
9171 offset: usize,
9172 mut depth: fidl::encoding::Depth,
9173 ) -> fidl::Result<()> {
9174 decoder.debug_check_bounds::<Self>(offset);
9175 let len = match fidl::encoding::decode_vector_header(decoder, offset)? {
9176 None => return Err(fidl::Error::NotNullable),
9177 Some(len) => len,
9178 };
9179 if len == 0 {
9181 return Ok(());
9182 };
9183 depth.increment()?;
9184 let envelope_size = 8;
9185 let bytes_len = len * envelope_size;
9186 let offset = decoder.out_of_line_offset(bytes_len)?;
9187 let mut _next_ordinal_to_read = 0;
9189 let mut next_offset = offset;
9190 let end_offset = offset + bytes_len;
9191 _next_ordinal_to_read += 1;
9192 if next_offset >= end_offset {
9193 return Ok(());
9194 }
9195
9196 while _next_ordinal_to_read < 1 {
9198 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
9199 _next_ordinal_to_read += 1;
9200 next_offset += envelope_size;
9201 }
9202
9203 let next_out_of_line = decoder.next_out_of_line();
9204 let handles_before = decoder.remaining_handles();
9205 if let Some((inlined, num_bytes, num_handles)) =
9206 fidl::encoding::decode_envelope_header(decoder, next_offset)?
9207 {
9208 let member_inline_size =
9209 <ScoCodingFormat as fidl::encoding::TypeMarker>::inline_size(decoder.context);
9210 if inlined != (member_inline_size <= 4) {
9211 return Err(fidl::Error::InvalidInlineBitInEnvelope);
9212 }
9213 let inner_offset;
9214 let mut inner_depth = depth.clone();
9215 if inlined {
9216 decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
9217 inner_offset = next_offset;
9218 } else {
9219 inner_offset = decoder.out_of_line_offset(member_inline_size)?;
9220 inner_depth.increment()?;
9221 }
9222 let val_ref = self.coding_format.get_or_insert_with(|| {
9223 fidl::new_empty!(ScoCodingFormat, fidl::encoding::DefaultFuchsiaResourceDialect)
9224 });
9225 fidl::decode!(
9226 ScoCodingFormat,
9227 fidl::encoding::DefaultFuchsiaResourceDialect,
9228 val_ref,
9229 decoder,
9230 inner_offset,
9231 inner_depth
9232 )?;
9233 if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
9234 {
9235 return Err(fidl::Error::InvalidNumBytesInEnvelope);
9236 }
9237 if handles_before != decoder.remaining_handles() + (num_handles as usize) {
9238 return Err(fidl::Error::InvalidNumHandlesInEnvelope);
9239 }
9240 }
9241
9242 next_offset += envelope_size;
9243 _next_ordinal_to_read += 1;
9244 if next_offset >= end_offset {
9245 return Ok(());
9246 }
9247
9248 while _next_ordinal_to_read < 2 {
9250 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
9251 _next_ordinal_to_read += 1;
9252 next_offset += envelope_size;
9253 }
9254
9255 let next_out_of_line = decoder.next_out_of_line();
9256 let handles_before = decoder.remaining_handles();
9257 if let Some((inlined, num_bytes, num_handles)) =
9258 fidl::encoding::decode_envelope_header(decoder, next_offset)?
9259 {
9260 let member_inline_size =
9261 <ScoEncoding as fidl::encoding::TypeMarker>::inline_size(decoder.context);
9262 if inlined != (member_inline_size <= 4) {
9263 return Err(fidl::Error::InvalidInlineBitInEnvelope);
9264 }
9265 let inner_offset;
9266 let mut inner_depth = depth.clone();
9267 if inlined {
9268 decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
9269 inner_offset = next_offset;
9270 } else {
9271 inner_offset = decoder.out_of_line_offset(member_inline_size)?;
9272 inner_depth.increment()?;
9273 }
9274 let val_ref = self.encoding.get_or_insert_with(|| {
9275 fidl::new_empty!(ScoEncoding, fidl::encoding::DefaultFuchsiaResourceDialect)
9276 });
9277 fidl::decode!(
9278 ScoEncoding,
9279 fidl::encoding::DefaultFuchsiaResourceDialect,
9280 val_ref,
9281 decoder,
9282 inner_offset,
9283 inner_depth
9284 )?;
9285 if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
9286 {
9287 return Err(fidl::Error::InvalidNumBytesInEnvelope);
9288 }
9289 if handles_before != decoder.remaining_handles() + (num_handles as usize) {
9290 return Err(fidl::Error::InvalidNumHandlesInEnvelope);
9291 }
9292 }
9293
9294 next_offset += envelope_size;
9295 _next_ordinal_to_read += 1;
9296 if next_offset >= end_offset {
9297 return Ok(());
9298 }
9299
9300 while _next_ordinal_to_read < 3 {
9302 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
9303 _next_ordinal_to_read += 1;
9304 next_offset += envelope_size;
9305 }
9306
9307 let next_out_of_line = decoder.next_out_of_line();
9308 let handles_before = decoder.remaining_handles();
9309 if let Some((inlined, num_bytes, num_handles)) =
9310 fidl::encoding::decode_envelope_header(decoder, next_offset)?
9311 {
9312 let member_inline_size =
9313 <ScoSampleRate as fidl::encoding::TypeMarker>::inline_size(decoder.context);
9314 if inlined != (member_inline_size <= 4) {
9315 return Err(fidl::Error::InvalidInlineBitInEnvelope);
9316 }
9317 let inner_offset;
9318 let mut inner_depth = depth.clone();
9319 if inlined {
9320 decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
9321 inner_offset = next_offset;
9322 } else {
9323 inner_offset = decoder.out_of_line_offset(member_inline_size)?;
9324 inner_depth.increment()?;
9325 }
9326 let val_ref = self.sample_rate.get_or_insert_with(|| {
9327 fidl::new_empty!(ScoSampleRate, fidl::encoding::DefaultFuchsiaResourceDialect)
9328 });
9329 fidl::decode!(
9330 ScoSampleRate,
9331 fidl::encoding::DefaultFuchsiaResourceDialect,
9332 val_ref,
9333 decoder,
9334 inner_offset,
9335 inner_depth
9336 )?;
9337 if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
9338 {
9339 return Err(fidl::Error::InvalidNumBytesInEnvelope);
9340 }
9341 if handles_before != decoder.remaining_handles() + (num_handles as usize) {
9342 return Err(fidl::Error::InvalidNumHandlesInEnvelope);
9343 }
9344 }
9345
9346 next_offset += envelope_size;
9347 _next_ordinal_to_read += 1;
9348 if next_offset >= end_offset {
9349 return Ok(());
9350 }
9351
9352 while _next_ordinal_to_read < 4 {
9354 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
9355 _next_ordinal_to_read += 1;
9356 next_offset += envelope_size;
9357 }
9358
9359 let next_out_of_line = decoder.next_out_of_line();
9360 let handles_before = decoder.remaining_handles();
9361 if let Some((inlined, num_bytes, num_handles)) =
9362 fidl::encoding::decode_envelope_header(decoder, next_offset)?
9363 {
9364 let member_inline_size = <fidl::encoding::Endpoint<
9365 fidl::endpoints::ServerEnd<ScoConnectionMarker>,
9366 > as fidl::encoding::TypeMarker>::inline_size(
9367 decoder.context
9368 );
9369 if inlined != (member_inline_size <= 4) {
9370 return Err(fidl::Error::InvalidInlineBitInEnvelope);
9371 }
9372 let inner_offset;
9373 let mut inner_depth = depth.clone();
9374 if inlined {
9375 decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
9376 inner_offset = next_offset;
9377 } else {
9378 inner_offset = decoder.out_of_line_offset(member_inline_size)?;
9379 inner_depth.increment()?;
9380 }
9381 let val_ref = self.connection.get_or_insert_with(|| {
9382 fidl::new_empty!(
9383 fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<ScoConnectionMarker>>,
9384 fidl::encoding::DefaultFuchsiaResourceDialect
9385 )
9386 });
9387 fidl::decode!(
9388 fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<ScoConnectionMarker>>,
9389 fidl::encoding::DefaultFuchsiaResourceDialect,
9390 val_ref,
9391 decoder,
9392 inner_offset,
9393 inner_depth
9394 )?;
9395 if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
9396 {
9397 return Err(fidl::Error::InvalidNumBytesInEnvelope);
9398 }
9399 if handles_before != decoder.remaining_handles() + (num_handles as usize) {
9400 return Err(fidl::Error::InvalidNumHandlesInEnvelope);
9401 }
9402 }
9403
9404 next_offset += envelope_size;
9405
9406 while next_offset < end_offset {
9408 _next_ordinal_to_read += 1;
9409 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
9410 next_offset += envelope_size;
9411 }
9412
9413 Ok(())
9414 }
9415 }
9416
9417 impl PeerParameters {
9418 #[inline(always)]
9419 fn max_ordinal_present(&self) -> u64 {
9420 if let Some(_) = self.channel {
9421 return 3;
9422 }
9423 if let Some(_) = self.connectable {
9424 return 2;
9425 }
9426 if let Some(_) = self.address {
9427 return 1;
9428 }
9429 0
9430 }
9431 }
9432
9433 impl fidl::encoding::ResourceTypeMarker for PeerParameters {
9434 type Borrowed<'a> = &'a mut Self;
9435 fn take_or_borrow<'a>(
9436 value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
9437 ) -> Self::Borrowed<'a> {
9438 value
9439 }
9440 }
9441
9442 unsafe impl fidl::encoding::TypeMarker for PeerParameters {
9443 type Owned = Self;
9444
9445 #[inline(always)]
9446 fn inline_align(_context: fidl::encoding::Context) -> usize {
9447 8
9448 }
9449
9450 #[inline(always)]
9451 fn inline_size(_context: fidl::encoding::Context) -> usize {
9452 16
9453 }
9454 }
9455
9456 unsafe impl
9457 fidl::encoding::Encode<PeerParameters, fidl::encoding::DefaultFuchsiaResourceDialect>
9458 for &mut PeerParameters
9459 {
9460 unsafe fn encode(
9461 self,
9462 encoder: &mut fidl::encoding::Encoder<
9463 '_,
9464 fidl::encoding::DefaultFuchsiaResourceDialect,
9465 >,
9466 offset: usize,
9467 mut depth: fidl::encoding::Depth,
9468 ) -> fidl::Result<()> {
9469 encoder.debug_check_bounds::<PeerParameters>(offset);
9470 let max_ordinal: u64 = self.max_ordinal_present();
9472 encoder.write_num(max_ordinal, offset);
9473 encoder.write_num(fidl::encoding::ALLOC_PRESENT_U64, offset + 8);
9474 if max_ordinal == 0 {
9476 return Ok(());
9477 }
9478 depth.increment()?;
9479 let envelope_size = 8;
9480 let bytes_len = max_ordinal as usize * envelope_size;
9481 #[allow(unused_variables)]
9482 let offset = encoder.out_of_line_offset(bytes_len);
9483 let mut _prev_end_offset: usize = 0;
9484 if 1 > max_ordinal {
9485 return Ok(());
9486 }
9487
9488 let cur_offset: usize = (1 - 1) * envelope_size;
9491
9492 encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
9494
9495 fidl::encoding::encode_in_envelope_optional::<
9500 fidl_fuchsia_bluetooth::Address,
9501 fidl::encoding::DefaultFuchsiaResourceDialect,
9502 >(
9503 self.address.as_ref().map(
9504 <fidl_fuchsia_bluetooth::Address as fidl::encoding::ValueTypeMarker>::borrow,
9505 ),
9506 encoder,
9507 offset + cur_offset,
9508 depth,
9509 )?;
9510
9511 _prev_end_offset = cur_offset + envelope_size;
9512 if 2 > max_ordinal {
9513 return Ok(());
9514 }
9515
9516 let cur_offset: usize = (2 - 1) * envelope_size;
9519
9520 encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
9522
9523 fidl::encoding::encode_in_envelope_optional::<
9528 bool,
9529 fidl::encoding::DefaultFuchsiaResourceDialect,
9530 >(
9531 self.connectable.as_ref().map(<bool as fidl::encoding::ValueTypeMarker>::borrow),
9532 encoder,
9533 offset + cur_offset,
9534 depth,
9535 )?;
9536
9537 _prev_end_offset = cur_offset + envelope_size;
9538 if 3 > max_ordinal {
9539 return Ok(());
9540 }
9541
9542 let cur_offset: usize = (3 - 1) * envelope_size;
9545
9546 encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
9548
9549 fidl::encoding::encode_in_envelope_optional::<fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<PeerMarker>>, fidl::encoding::DefaultFuchsiaResourceDialect>(
9554 self.channel.as_mut().map(<fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<PeerMarker>> as fidl::encoding::ResourceTypeMarker>::take_or_borrow),
9555 encoder, offset + cur_offset, depth
9556 )?;
9557
9558 _prev_end_offset = cur_offset + envelope_size;
9559
9560 Ok(())
9561 }
9562 }
9563
9564 impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
9565 for PeerParameters
9566 {
9567 #[inline(always)]
9568 fn new_empty() -> Self {
9569 Self::default()
9570 }
9571
9572 unsafe fn decode(
9573 &mut self,
9574 decoder: &mut fidl::encoding::Decoder<
9575 '_,
9576 fidl::encoding::DefaultFuchsiaResourceDialect,
9577 >,
9578 offset: usize,
9579 mut depth: fidl::encoding::Depth,
9580 ) -> fidl::Result<()> {
9581 decoder.debug_check_bounds::<Self>(offset);
9582 let len = match fidl::encoding::decode_vector_header(decoder, offset)? {
9583 None => return Err(fidl::Error::NotNullable),
9584 Some(len) => len,
9585 };
9586 if len == 0 {
9588 return Ok(());
9589 };
9590 depth.increment()?;
9591 let envelope_size = 8;
9592 let bytes_len = len * envelope_size;
9593 let offset = decoder.out_of_line_offset(bytes_len)?;
9594 let mut _next_ordinal_to_read = 0;
9596 let mut next_offset = offset;
9597 let end_offset = offset + bytes_len;
9598 _next_ordinal_to_read += 1;
9599 if next_offset >= end_offset {
9600 return Ok(());
9601 }
9602
9603 while _next_ordinal_to_read < 1 {
9605 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
9606 _next_ordinal_to_read += 1;
9607 next_offset += envelope_size;
9608 }
9609
9610 let next_out_of_line = decoder.next_out_of_line();
9611 let handles_before = decoder.remaining_handles();
9612 if let Some((inlined, num_bytes, num_handles)) =
9613 fidl::encoding::decode_envelope_header(decoder, next_offset)?
9614 {
9615 let member_inline_size =
9616 <fidl_fuchsia_bluetooth::Address as fidl::encoding::TypeMarker>::inline_size(
9617 decoder.context,
9618 );
9619 if inlined != (member_inline_size <= 4) {
9620 return Err(fidl::Error::InvalidInlineBitInEnvelope);
9621 }
9622 let inner_offset;
9623 let mut inner_depth = depth.clone();
9624 if inlined {
9625 decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
9626 inner_offset = next_offset;
9627 } else {
9628 inner_offset = decoder.out_of_line_offset(member_inline_size)?;
9629 inner_depth.increment()?;
9630 }
9631 let val_ref = self.address.get_or_insert_with(|| {
9632 fidl::new_empty!(
9633 fidl_fuchsia_bluetooth::Address,
9634 fidl::encoding::DefaultFuchsiaResourceDialect
9635 )
9636 });
9637 fidl::decode!(
9638 fidl_fuchsia_bluetooth::Address,
9639 fidl::encoding::DefaultFuchsiaResourceDialect,
9640 val_ref,
9641 decoder,
9642 inner_offset,
9643 inner_depth
9644 )?;
9645 if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
9646 {
9647 return Err(fidl::Error::InvalidNumBytesInEnvelope);
9648 }
9649 if handles_before != decoder.remaining_handles() + (num_handles as usize) {
9650 return Err(fidl::Error::InvalidNumHandlesInEnvelope);
9651 }
9652 }
9653
9654 next_offset += envelope_size;
9655 _next_ordinal_to_read += 1;
9656 if next_offset >= end_offset {
9657 return Ok(());
9658 }
9659
9660 while _next_ordinal_to_read < 2 {
9662 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
9663 _next_ordinal_to_read += 1;
9664 next_offset += envelope_size;
9665 }
9666
9667 let next_out_of_line = decoder.next_out_of_line();
9668 let handles_before = decoder.remaining_handles();
9669 if let Some((inlined, num_bytes, num_handles)) =
9670 fidl::encoding::decode_envelope_header(decoder, next_offset)?
9671 {
9672 let member_inline_size =
9673 <bool as fidl::encoding::TypeMarker>::inline_size(decoder.context);
9674 if inlined != (member_inline_size <= 4) {
9675 return Err(fidl::Error::InvalidInlineBitInEnvelope);
9676 }
9677 let inner_offset;
9678 let mut inner_depth = depth.clone();
9679 if inlined {
9680 decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
9681 inner_offset = next_offset;
9682 } else {
9683 inner_offset = decoder.out_of_line_offset(member_inline_size)?;
9684 inner_depth.increment()?;
9685 }
9686 let val_ref = self.connectable.get_or_insert_with(|| {
9687 fidl::new_empty!(bool, fidl::encoding::DefaultFuchsiaResourceDialect)
9688 });
9689 fidl::decode!(
9690 bool,
9691 fidl::encoding::DefaultFuchsiaResourceDialect,
9692 val_ref,
9693 decoder,
9694 inner_offset,
9695 inner_depth
9696 )?;
9697 if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
9698 {
9699 return Err(fidl::Error::InvalidNumBytesInEnvelope);
9700 }
9701 if handles_before != decoder.remaining_handles() + (num_handles as usize) {
9702 return Err(fidl::Error::InvalidNumHandlesInEnvelope);
9703 }
9704 }
9705
9706 next_offset += envelope_size;
9707 _next_ordinal_to_read += 1;
9708 if next_offset >= end_offset {
9709 return Ok(());
9710 }
9711
9712 while _next_ordinal_to_read < 3 {
9714 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
9715 _next_ordinal_to_read += 1;
9716 next_offset += envelope_size;
9717 }
9718
9719 let next_out_of_line = decoder.next_out_of_line();
9720 let handles_before = decoder.remaining_handles();
9721 if let Some((inlined, num_bytes, num_handles)) =
9722 fidl::encoding::decode_envelope_header(decoder, next_offset)?
9723 {
9724 let member_inline_size = <fidl::encoding::Endpoint<
9725 fidl::endpoints::ServerEnd<PeerMarker>,
9726 > as fidl::encoding::TypeMarker>::inline_size(
9727 decoder.context
9728 );
9729 if inlined != (member_inline_size <= 4) {
9730 return Err(fidl::Error::InvalidInlineBitInEnvelope);
9731 }
9732 let inner_offset;
9733 let mut inner_depth = depth.clone();
9734 if inlined {
9735 decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
9736 inner_offset = next_offset;
9737 } else {
9738 inner_offset = decoder.out_of_line_offset(member_inline_size)?;
9739 inner_depth.increment()?;
9740 }
9741 let val_ref = self.channel.get_or_insert_with(|| {
9742 fidl::new_empty!(
9743 fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<PeerMarker>>,
9744 fidl::encoding::DefaultFuchsiaResourceDialect
9745 )
9746 });
9747 fidl::decode!(
9748 fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<PeerMarker>>,
9749 fidl::encoding::DefaultFuchsiaResourceDialect,
9750 val_ref,
9751 decoder,
9752 inner_offset,
9753 inner_depth
9754 )?;
9755 if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
9756 {
9757 return Err(fidl::Error::InvalidNumBytesInEnvelope);
9758 }
9759 if handles_before != decoder.remaining_handles() + (num_handles as usize) {
9760 return Err(fidl::Error::InvalidNumHandlesInEnvelope);
9761 }
9762 }
9763
9764 next_offset += envelope_size;
9765
9766 while next_offset < end_offset {
9768 _next_ordinal_to_read += 1;
9769 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
9770 next_offset += envelope_size;
9771 }
9772
9773 Ok(())
9774 }
9775 }
9776
9777 impl VirtualControllerCreateLoopbackDeviceRequest {
9778 #[inline(always)]
9779 fn max_ordinal_present(&self) -> u64 {
9780 if let Some(_) = self.uart_channel {
9781 return 1;
9782 }
9783 0
9784 }
9785 }
9786
9787 impl fidl::encoding::ResourceTypeMarker for VirtualControllerCreateLoopbackDeviceRequest {
9788 type Borrowed<'a> = &'a mut Self;
9789 fn take_or_borrow<'a>(
9790 value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
9791 ) -> Self::Borrowed<'a> {
9792 value
9793 }
9794 }
9795
9796 unsafe impl fidl::encoding::TypeMarker for VirtualControllerCreateLoopbackDeviceRequest {
9797 type Owned = Self;
9798
9799 #[inline(always)]
9800 fn inline_align(_context: fidl::encoding::Context) -> usize {
9801 8
9802 }
9803
9804 #[inline(always)]
9805 fn inline_size(_context: fidl::encoding::Context) -> usize {
9806 16
9807 }
9808 }
9809
9810 unsafe impl
9811 fidl::encoding::Encode<
9812 VirtualControllerCreateLoopbackDeviceRequest,
9813 fidl::encoding::DefaultFuchsiaResourceDialect,
9814 > for &mut VirtualControllerCreateLoopbackDeviceRequest
9815 {
9816 unsafe fn encode(
9817 self,
9818 encoder: &mut fidl::encoding::Encoder<
9819 '_,
9820 fidl::encoding::DefaultFuchsiaResourceDialect,
9821 >,
9822 offset: usize,
9823 mut depth: fidl::encoding::Depth,
9824 ) -> fidl::Result<()> {
9825 encoder.debug_check_bounds::<VirtualControllerCreateLoopbackDeviceRequest>(offset);
9826 let max_ordinal: u64 = self.max_ordinal_present();
9828 encoder.write_num(max_ordinal, offset);
9829 encoder.write_num(fidl::encoding::ALLOC_PRESENT_U64, offset + 8);
9830 if max_ordinal == 0 {
9832 return Ok(());
9833 }
9834 depth.increment()?;
9835 let envelope_size = 8;
9836 let bytes_len = max_ordinal as usize * envelope_size;
9837 #[allow(unused_variables)]
9838 let offset = encoder.out_of_line_offset(bytes_len);
9839 let mut _prev_end_offset: usize = 0;
9840 if 1 > max_ordinal {
9841 return Ok(());
9842 }
9843
9844 let cur_offset: usize = (1 - 1) * envelope_size;
9847
9848 encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
9850
9851 fidl::encoding::encode_in_envelope_optional::<
9856 fidl::encoding::HandleType<
9857 fidl::Channel,
9858 { fidl::ObjectType::CHANNEL.into_raw() },
9859 2147483648,
9860 >,
9861 fidl::encoding::DefaultFuchsiaResourceDialect,
9862 >(
9863 self.uart_channel.as_mut().map(
9864 <fidl::encoding::HandleType<
9865 fidl::Channel,
9866 { fidl::ObjectType::CHANNEL.into_raw() },
9867 2147483648,
9868 > as fidl::encoding::ResourceTypeMarker>::take_or_borrow,
9869 ),
9870 encoder,
9871 offset + cur_offset,
9872 depth,
9873 )?;
9874
9875 _prev_end_offset = cur_offset + envelope_size;
9876
9877 Ok(())
9878 }
9879 }
9880
9881 impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
9882 for VirtualControllerCreateLoopbackDeviceRequest
9883 {
9884 #[inline(always)]
9885 fn new_empty() -> Self {
9886 Self::default()
9887 }
9888
9889 unsafe fn decode(
9890 &mut self,
9891 decoder: &mut fidl::encoding::Decoder<
9892 '_,
9893 fidl::encoding::DefaultFuchsiaResourceDialect,
9894 >,
9895 offset: usize,
9896 mut depth: fidl::encoding::Depth,
9897 ) -> fidl::Result<()> {
9898 decoder.debug_check_bounds::<Self>(offset);
9899 let len = match fidl::encoding::decode_vector_header(decoder, offset)? {
9900 None => return Err(fidl::Error::NotNullable),
9901 Some(len) => len,
9902 };
9903 if len == 0 {
9905 return Ok(());
9906 };
9907 depth.increment()?;
9908 let envelope_size = 8;
9909 let bytes_len = len * envelope_size;
9910 let offset = decoder.out_of_line_offset(bytes_len)?;
9911 let mut _next_ordinal_to_read = 0;
9913 let mut next_offset = offset;
9914 let end_offset = offset + bytes_len;
9915 _next_ordinal_to_read += 1;
9916 if next_offset >= end_offset {
9917 return Ok(());
9918 }
9919
9920 while _next_ordinal_to_read < 1 {
9922 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
9923 _next_ordinal_to_read += 1;
9924 next_offset += envelope_size;
9925 }
9926
9927 let next_out_of_line = decoder.next_out_of_line();
9928 let handles_before = decoder.remaining_handles();
9929 if let Some((inlined, num_bytes, num_handles)) =
9930 fidl::encoding::decode_envelope_header(decoder, next_offset)?
9931 {
9932 let member_inline_size = <fidl::encoding::HandleType<
9933 fidl::Channel,
9934 { fidl::ObjectType::CHANNEL.into_raw() },
9935 2147483648,
9936 > as fidl::encoding::TypeMarker>::inline_size(
9937 decoder.context
9938 );
9939 if inlined != (member_inline_size <= 4) {
9940 return Err(fidl::Error::InvalidInlineBitInEnvelope);
9941 }
9942 let inner_offset;
9943 let mut inner_depth = depth.clone();
9944 if inlined {
9945 decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
9946 inner_offset = next_offset;
9947 } else {
9948 inner_offset = decoder.out_of_line_offset(member_inline_size)?;
9949 inner_depth.increment()?;
9950 }
9951 let val_ref =
9952 self.uart_channel.get_or_insert_with(|| fidl::new_empty!(fidl::encoding::HandleType<fidl::Channel, { fidl::ObjectType::CHANNEL.into_raw() }, 2147483648>, fidl::encoding::DefaultFuchsiaResourceDialect));
9953 fidl::decode!(fidl::encoding::HandleType<fidl::Channel, { fidl::ObjectType::CHANNEL.into_raw() }, 2147483648>, fidl::encoding::DefaultFuchsiaResourceDialect, val_ref, decoder, inner_offset, inner_depth)?;
9954 if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
9955 {
9956 return Err(fidl::Error::InvalidNumBytesInEnvelope);
9957 }
9958 if handles_before != decoder.remaining_handles() + (num_handles as usize) {
9959 return Err(fidl::Error::InvalidNumHandlesInEnvelope);
9960 }
9961 }
9962
9963 next_offset += envelope_size;
9964
9965 while next_offset < end_offset {
9967 _next_ordinal_to_read += 1;
9968 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
9969 next_offset += envelope_size;
9970 }
9971
9972 Ok(())
9973 }
9974 }
9975}