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