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