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_test_audio__common::*;
11use futures::future::{self, MaybeDone, TryFutureExt};
12use zx_status;
13
14#[derive(Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
15pub struct CaptureGetOutputAudioResponse {
16 pub audio_reader: fidl::Socket,
17}
18
19impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect>
20 for CaptureGetOutputAudioResponse
21{
22}
23
24#[derive(Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
25#[repr(C)]
26pub struct InjectionClearInputAudioRequest {
27 pub index: i32,
28}
29
30impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect>
31 for InjectionClearInputAudioRequest
32{
33}
34
35#[derive(Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
36#[repr(C)]
37pub struct InjectionStartInputInjectionRequest {
38 pub index: i32,
39}
40
41impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect>
42 for InjectionStartInputInjectionRequest
43{
44}
45
46#[derive(Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
47pub struct InjectionWriteInputAudioRequest {
48 pub index: i32,
49 pub audio_writer: fidl::Socket,
50}
51
52impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect>
53 for InjectionWriteInputAudioRequest
54{
55}
56
57#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
58pub struct CaptureMarker;
59
60impl fidl::endpoints::ProtocolMarker for CaptureMarker {
61 type Proxy = CaptureProxy;
62 type RequestStream = CaptureRequestStream;
63 #[cfg(target_os = "fuchsia")]
64 type SynchronousProxy = CaptureSynchronousProxy;
65
66 const DEBUG_NAME: &'static str = "fuchsia.test.audio.Capture";
67}
68impl fidl::endpoints::DiscoverableProtocolMarker for CaptureMarker {}
69pub type CaptureStartOutputCaptureResult = Result<(), AudioTestError>;
70pub type CaptureStopOutputCaptureResult = Result<(), AudioTestError>;
71pub type CaptureWaitForQuietResult = Result<WaitForQuietResult, AudioTestError>;
72pub type CaptureQueueTriggeredCaptureResult = Result<(), AudioTestError>;
73pub type CaptureWaitForTriggeredCaptureResult = Result<QueuedCaptureResult, AudioTestError>;
74pub type CaptureGetOutputAudioResult = Result<fidl::Socket, AudioTestError>;
75
76pub trait CaptureProxyInterface: Send + Sync {
77 type StartOutputCaptureResponseFut: std::future::Future<Output = Result<CaptureStartOutputCaptureResult, fidl::Error>>
78 + Send;
79 fn r#start_output_capture(&self) -> Self::StartOutputCaptureResponseFut;
80 type StopOutputCaptureResponseFut: std::future::Future<Output = Result<CaptureStopOutputCaptureResult, fidl::Error>>
81 + Send;
82 fn r#stop_output_capture(&self) -> Self::StopOutputCaptureResponseFut;
83 type WaitForQuietResponseFut: std::future::Future<Output = Result<CaptureWaitForQuietResult, fidl::Error>>
84 + Send;
85 fn r#wait_for_quiet(
86 &self,
87 payload: &CaptureWaitForQuietRequest,
88 ) -> Self::WaitForQuietResponseFut;
89 type QueueTriggeredCaptureResponseFut: std::future::Future<Output = Result<CaptureQueueTriggeredCaptureResult, fidl::Error>>
90 + Send;
91 fn r#queue_triggered_capture(
92 &self,
93 payload: &CaptureQueueTriggeredCaptureRequest,
94 ) -> Self::QueueTriggeredCaptureResponseFut;
95 type WaitForTriggeredCaptureResponseFut: std::future::Future<Output = Result<CaptureWaitForTriggeredCaptureResult, fidl::Error>>
96 + Send;
97 fn r#wait_for_triggered_capture(&self) -> Self::WaitForTriggeredCaptureResponseFut;
98 type GetOutputAudioResponseFut: std::future::Future<Output = Result<CaptureGetOutputAudioResult, fidl::Error>>
99 + Send;
100 fn r#get_output_audio(&self) -> Self::GetOutputAudioResponseFut;
101}
102#[derive(Debug)]
103#[cfg(target_os = "fuchsia")]
104pub struct CaptureSynchronousProxy {
105 client: fidl::client::sync::Client,
106}
107
108#[cfg(target_os = "fuchsia")]
109impl fidl::endpoints::SynchronousProxy for CaptureSynchronousProxy {
110 type Proxy = CaptureProxy;
111 type Protocol = CaptureMarker;
112
113 fn from_channel(inner: fidl::Channel) -> Self {
114 Self::new(inner)
115 }
116
117 fn into_channel(self) -> fidl::Channel {
118 self.client.into_channel()
119 }
120
121 fn as_channel(&self) -> &fidl::Channel {
122 self.client.as_channel()
123 }
124}
125
126#[cfg(target_os = "fuchsia")]
127impl CaptureSynchronousProxy {
128 pub fn new(channel: fidl::Channel) -> Self {
129 let protocol_name = <CaptureMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
130 Self { client: fidl::client::sync::Client::new(channel, protocol_name) }
131 }
132
133 pub fn into_channel(self) -> fidl::Channel {
134 self.client.into_channel()
135 }
136
137 pub fn wait_for_event(
140 &self,
141 deadline: zx::MonotonicInstant,
142 ) -> Result<CaptureEvent, fidl::Error> {
143 CaptureEvent::decode(self.client.wait_for_event(deadline)?)
144 }
145
146 pub fn r#start_output_capture(
156 &self,
157 ___deadline: zx::MonotonicInstant,
158 ) -> Result<CaptureStartOutputCaptureResult, fidl::Error> {
159 let _response = self.client.send_query::<
160 fidl::encoding::EmptyPayload,
161 fidl::encoding::ResultType<fidl::encoding::EmptyStruct, AudioTestError>,
162 >(
163 (),
164 0x3da5afb01b70be17,
165 fidl::encoding::DynamicFlags::empty(),
166 ___deadline,
167 )?;
168 Ok(_response.map(|x| x))
169 }
170
171 pub fn r#stop_output_capture(
180 &self,
181 ___deadline: zx::MonotonicInstant,
182 ) -> Result<CaptureStopOutputCaptureResult, fidl::Error> {
183 let _response = self.client.send_query::<
184 fidl::encoding::EmptyPayload,
185 fidl::encoding::ResultType<fidl::encoding::EmptyStruct, AudioTestError>,
186 >(
187 (),
188 0x4598c765e8859b6b,
189 fidl::encoding::DynamicFlags::empty(),
190 ___deadline,
191 )?;
192 Ok(_response.map(|x| x))
193 }
194
195 pub fn r#wait_for_quiet(
206 &self,
207 mut payload: &CaptureWaitForQuietRequest,
208 ___deadline: zx::MonotonicInstant,
209 ) -> Result<CaptureWaitForQuietResult, fidl::Error> {
210 let _response = self.client.send_query::<
211 CaptureWaitForQuietRequest,
212 fidl::encoding::ResultType<CaptureWaitForQuietResponse, AudioTestError>,
213 >(
214 payload,
215 0x7f8de156ce46d54b,
216 fidl::encoding::DynamicFlags::empty(),
217 ___deadline,
218 )?;
219 Ok(_response.map(|x| x.result))
220 }
221
222 pub fn r#queue_triggered_capture(
242 &self,
243 mut payload: &CaptureQueueTriggeredCaptureRequest,
244 ___deadline: zx::MonotonicInstant,
245 ) -> Result<CaptureQueueTriggeredCaptureResult, fidl::Error> {
246 let _response = self.client.send_query::<
247 CaptureQueueTriggeredCaptureRequest,
248 fidl::encoding::ResultType<fidl::encoding::EmptyStruct, AudioTestError>,
249 >(
250 payload,
251 0x5d372fd28da4efb2,
252 fidl::encoding::DynamicFlags::empty(),
253 ___deadline,
254 )?;
255 Ok(_response.map(|x| x))
256 }
257
258 pub fn r#wait_for_triggered_capture(
271 &self,
272 ___deadline: zx::MonotonicInstant,
273 ) -> Result<CaptureWaitForTriggeredCaptureResult, fidl::Error> {
274 let _response =
275 self.client.send_query::<fidl::encoding::EmptyPayload, fidl::encoding::ResultType<
276 CaptureWaitForTriggeredCaptureResponse,
277 AudioTestError,
278 >>(
279 (),
280 0x7b55fa2cfe9c6c3,
281 fidl::encoding::DynamicFlags::empty(),
282 ___deadline,
283 )?;
284 Ok(_response.map(|x| x.result))
285 }
286
287 pub fn r#get_output_audio(
300 &self,
301 ___deadline: zx::MonotonicInstant,
302 ) -> Result<CaptureGetOutputAudioResult, fidl::Error> {
303 let _response = self.client.send_query::<
304 fidl::encoding::EmptyPayload,
305 fidl::encoding::ResultType<CaptureGetOutputAudioResponse, AudioTestError>,
306 >(
307 (),
308 0x23960702c8a96e54,
309 fidl::encoding::DynamicFlags::empty(),
310 ___deadline,
311 )?;
312 Ok(_response.map(|x| x.audio_reader))
313 }
314}
315
316#[cfg(target_os = "fuchsia")]
317impl From<CaptureSynchronousProxy> for zx::Handle {
318 fn from(value: CaptureSynchronousProxy) -> Self {
319 value.into_channel().into()
320 }
321}
322
323#[cfg(target_os = "fuchsia")]
324impl From<fidl::Channel> for CaptureSynchronousProxy {
325 fn from(value: fidl::Channel) -> Self {
326 Self::new(value)
327 }
328}
329
330#[cfg(target_os = "fuchsia")]
331impl fidl::endpoints::FromClient for CaptureSynchronousProxy {
332 type Protocol = CaptureMarker;
333
334 fn from_client(value: fidl::endpoints::ClientEnd<CaptureMarker>) -> Self {
335 Self::new(value.into_channel())
336 }
337}
338
339#[derive(Debug, Clone)]
340pub struct CaptureProxy {
341 client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
342}
343
344impl fidl::endpoints::Proxy for CaptureProxy {
345 type Protocol = CaptureMarker;
346
347 fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
348 Self::new(inner)
349 }
350
351 fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
352 self.client.into_channel().map_err(|client| Self { client })
353 }
354
355 fn as_channel(&self) -> &::fidl::AsyncChannel {
356 self.client.as_channel()
357 }
358}
359
360impl CaptureProxy {
361 pub fn new(channel: ::fidl::AsyncChannel) -> Self {
363 let protocol_name = <CaptureMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
364 Self { client: fidl::client::Client::new(channel, protocol_name) }
365 }
366
367 pub fn take_event_stream(&self) -> CaptureEventStream {
373 CaptureEventStream { event_receiver: self.client.take_event_receiver() }
374 }
375
376 pub fn r#start_output_capture(
386 &self,
387 ) -> fidl::client::QueryResponseFut<
388 CaptureStartOutputCaptureResult,
389 fidl::encoding::DefaultFuchsiaResourceDialect,
390 > {
391 CaptureProxyInterface::r#start_output_capture(self)
392 }
393
394 pub fn r#stop_output_capture(
403 &self,
404 ) -> fidl::client::QueryResponseFut<
405 CaptureStopOutputCaptureResult,
406 fidl::encoding::DefaultFuchsiaResourceDialect,
407 > {
408 CaptureProxyInterface::r#stop_output_capture(self)
409 }
410
411 pub fn r#wait_for_quiet(
422 &self,
423 mut payload: &CaptureWaitForQuietRequest,
424 ) -> fidl::client::QueryResponseFut<
425 CaptureWaitForQuietResult,
426 fidl::encoding::DefaultFuchsiaResourceDialect,
427 > {
428 CaptureProxyInterface::r#wait_for_quiet(self, payload)
429 }
430
431 pub fn r#queue_triggered_capture(
451 &self,
452 mut payload: &CaptureQueueTriggeredCaptureRequest,
453 ) -> fidl::client::QueryResponseFut<
454 CaptureQueueTriggeredCaptureResult,
455 fidl::encoding::DefaultFuchsiaResourceDialect,
456 > {
457 CaptureProxyInterface::r#queue_triggered_capture(self, payload)
458 }
459
460 pub fn r#wait_for_triggered_capture(
473 &self,
474 ) -> fidl::client::QueryResponseFut<
475 CaptureWaitForTriggeredCaptureResult,
476 fidl::encoding::DefaultFuchsiaResourceDialect,
477 > {
478 CaptureProxyInterface::r#wait_for_triggered_capture(self)
479 }
480
481 pub fn r#get_output_audio(
494 &self,
495 ) -> fidl::client::QueryResponseFut<
496 CaptureGetOutputAudioResult,
497 fidl::encoding::DefaultFuchsiaResourceDialect,
498 > {
499 CaptureProxyInterface::r#get_output_audio(self)
500 }
501}
502
503impl CaptureProxyInterface for CaptureProxy {
504 type StartOutputCaptureResponseFut = fidl::client::QueryResponseFut<
505 CaptureStartOutputCaptureResult,
506 fidl::encoding::DefaultFuchsiaResourceDialect,
507 >;
508 fn r#start_output_capture(&self) -> Self::StartOutputCaptureResponseFut {
509 fn _decode(
510 mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
511 ) -> Result<CaptureStartOutputCaptureResult, fidl::Error> {
512 let _response = fidl::client::decode_transaction_body::<
513 fidl::encoding::ResultType<fidl::encoding::EmptyStruct, AudioTestError>,
514 fidl::encoding::DefaultFuchsiaResourceDialect,
515 0x3da5afb01b70be17,
516 >(_buf?)?;
517 Ok(_response.map(|x| x))
518 }
519 self.client
520 .send_query_and_decode::<fidl::encoding::EmptyPayload, CaptureStartOutputCaptureResult>(
521 (),
522 0x3da5afb01b70be17,
523 fidl::encoding::DynamicFlags::empty(),
524 _decode,
525 )
526 }
527
528 type StopOutputCaptureResponseFut = fidl::client::QueryResponseFut<
529 CaptureStopOutputCaptureResult,
530 fidl::encoding::DefaultFuchsiaResourceDialect,
531 >;
532 fn r#stop_output_capture(&self) -> Self::StopOutputCaptureResponseFut {
533 fn _decode(
534 mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
535 ) -> Result<CaptureStopOutputCaptureResult, fidl::Error> {
536 let _response = fidl::client::decode_transaction_body::<
537 fidl::encoding::ResultType<fidl::encoding::EmptyStruct, AudioTestError>,
538 fidl::encoding::DefaultFuchsiaResourceDialect,
539 0x4598c765e8859b6b,
540 >(_buf?)?;
541 Ok(_response.map(|x| x))
542 }
543 self.client
544 .send_query_and_decode::<fidl::encoding::EmptyPayload, CaptureStopOutputCaptureResult>(
545 (),
546 0x4598c765e8859b6b,
547 fidl::encoding::DynamicFlags::empty(),
548 _decode,
549 )
550 }
551
552 type WaitForQuietResponseFut = fidl::client::QueryResponseFut<
553 CaptureWaitForQuietResult,
554 fidl::encoding::DefaultFuchsiaResourceDialect,
555 >;
556 fn r#wait_for_quiet(
557 &self,
558 mut payload: &CaptureWaitForQuietRequest,
559 ) -> Self::WaitForQuietResponseFut {
560 fn _decode(
561 mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
562 ) -> Result<CaptureWaitForQuietResult, fidl::Error> {
563 let _response = fidl::client::decode_transaction_body::<
564 fidl::encoding::ResultType<CaptureWaitForQuietResponse, AudioTestError>,
565 fidl::encoding::DefaultFuchsiaResourceDialect,
566 0x7f8de156ce46d54b,
567 >(_buf?)?;
568 Ok(_response.map(|x| x.result))
569 }
570 self.client.send_query_and_decode::<CaptureWaitForQuietRequest, CaptureWaitForQuietResult>(
571 payload,
572 0x7f8de156ce46d54b,
573 fidl::encoding::DynamicFlags::empty(),
574 _decode,
575 )
576 }
577
578 type QueueTriggeredCaptureResponseFut = fidl::client::QueryResponseFut<
579 CaptureQueueTriggeredCaptureResult,
580 fidl::encoding::DefaultFuchsiaResourceDialect,
581 >;
582 fn r#queue_triggered_capture(
583 &self,
584 mut payload: &CaptureQueueTriggeredCaptureRequest,
585 ) -> Self::QueueTriggeredCaptureResponseFut {
586 fn _decode(
587 mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
588 ) -> Result<CaptureQueueTriggeredCaptureResult, fidl::Error> {
589 let _response = fidl::client::decode_transaction_body::<
590 fidl::encoding::ResultType<fidl::encoding::EmptyStruct, AudioTestError>,
591 fidl::encoding::DefaultFuchsiaResourceDialect,
592 0x5d372fd28da4efb2,
593 >(_buf?)?;
594 Ok(_response.map(|x| x))
595 }
596 self.client.send_query_and_decode::<
597 CaptureQueueTriggeredCaptureRequest,
598 CaptureQueueTriggeredCaptureResult,
599 >(
600 payload,
601 0x5d372fd28da4efb2,
602 fidl::encoding::DynamicFlags::empty(),
603 _decode,
604 )
605 }
606
607 type WaitForTriggeredCaptureResponseFut = fidl::client::QueryResponseFut<
608 CaptureWaitForTriggeredCaptureResult,
609 fidl::encoding::DefaultFuchsiaResourceDialect,
610 >;
611 fn r#wait_for_triggered_capture(&self) -> Self::WaitForTriggeredCaptureResponseFut {
612 fn _decode(
613 mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
614 ) -> Result<CaptureWaitForTriggeredCaptureResult, fidl::Error> {
615 let _response = fidl::client::decode_transaction_body::<
616 fidl::encoding::ResultType<CaptureWaitForTriggeredCaptureResponse, AudioTestError>,
617 fidl::encoding::DefaultFuchsiaResourceDialect,
618 0x7b55fa2cfe9c6c3,
619 >(_buf?)?;
620 Ok(_response.map(|x| x.result))
621 }
622 self.client.send_query_and_decode::<
623 fidl::encoding::EmptyPayload,
624 CaptureWaitForTriggeredCaptureResult,
625 >(
626 (),
627 0x7b55fa2cfe9c6c3,
628 fidl::encoding::DynamicFlags::empty(),
629 _decode,
630 )
631 }
632
633 type GetOutputAudioResponseFut = fidl::client::QueryResponseFut<
634 CaptureGetOutputAudioResult,
635 fidl::encoding::DefaultFuchsiaResourceDialect,
636 >;
637 fn r#get_output_audio(&self) -> Self::GetOutputAudioResponseFut {
638 fn _decode(
639 mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
640 ) -> Result<CaptureGetOutputAudioResult, fidl::Error> {
641 let _response = fidl::client::decode_transaction_body::<
642 fidl::encoding::ResultType<CaptureGetOutputAudioResponse, AudioTestError>,
643 fidl::encoding::DefaultFuchsiaResourceDialect,
644 0x23960702c8a96e54,
645 >(_buf?)?;
646 Ok(_response.map(|x| x.audio_reader))
647 }
648 self.client
649 .send_query_and_decode::<fidl::encoding::EmptyPayload, CaptureGetOutputAudioResult>(
650 (),
651 0x23960702c8a96e54,
652 fidl::encoding::DynamicFlags::empty(),
653 _decode,
654 )
655 }
656}
657
658pub struct CaptureEventStream {
659 event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
660}
661
662impl std::marker::Unpin for CaptureEventStream {}
663
664impl futures::stream::FusedStream for CaptureEventStream {
665 fn is_terminated(&self) -> bool {
666 self.event_receiver.is_terminated()
667 }
668}
669
670impl futures::Stream for CaptureEventStream {
671 type Item = Result<CaptureEvent, fidl::Error>;
672
673 fn poll_next(
674 mut self: std::pin::Pin<&mut Self>,
675 cx: &mut std::task::Context<'_>,
676 ) -> std::task::Poll<Option<Self::Item>> {
677 match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
678 &mut self.event_receiver,
679 cx
680 )?) {
681 Some(buf) => std::task::Poll::Ready(Some(CaptureEvent::decode(buf))),
682 None => std::task::Poll::Ready(None),
683 }
684 }
685}
686
687#[derive(Debug)]
688pub enum CaptureEvent {
689 #[non_exhaustive]
690 _UnknownEvent {
691 ordinal: u64,
693 },
694}
695
696impl CaptureEvent {
697 fn decode(
699 mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
700 ) -> Result<CaptureEvent, fidl::Error> {
701 let (bytes, _handles) = buf.split_mut();
702 let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
703 debug_assert_eq!(tx_header.tx_id, 0);
704 match tx_header.ordinal {
705 _ if tx_header.dynamic_flags().contains(fidl::encoding::DynamicFlags::FLEXIBLE) => {
706 Ok(CaptureEvent::_UnknownEvent { ordinal: tx_header.ordinal })
707 }
708 _ => Err(fidl::Error::UnknownOrdinal {
709 ordinal: tx_header.ordinal,
710 protocol_name: <CaptureMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
711 }),
712 }
713 }
714}
715
716pub struct CaptureRequestStream {
718 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
719 is_terminated: bool,
720}
721
722impl std::marker::Unpin for CaptureRequestStream {}
723
724impl futures::stream::FusedStream for CaptureRequestStream {
725 fn is_terminated(&self) -> bool {
726 self.is_terminated
727 }
728}
729
730impl fidl::endpoints::RequestStream for CaptureRequestStream {
731 type Protocol = CaptureMarker;
732 type ControlHandle = CaptureControlHandle;
733
734 fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
735 Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
736 }
737
738 fn control_handle(&self) -> Self::ControlHandle {
739 CaptureControlHandle { inner: self.inner.clone() }
740 }
741
742 fn into_inner(
743 self,
744 ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
745 {
746 (self.inner, self.is_terminated)
747 }
748
749 fn from_inner(
750 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
751 is_terminated: bool,
752 ) -> Self {
753 Self { inner, is_terminated }
754 }
755}
756
757impl futures::Stream for CaptureRequestStream {
758 type Item = Result<CaptureRequest, fidl::Error>;
759
760 fn poll_next(
761 mut self: std::pin::Pin<&mut Self>,
762 cx: &mut std::task::Context<'_>,
763 ) -> std::task::Poll<Option<Self::Item>> {
764 let this = &mut *self;
765 if this.inner.check_shutdown(cx) {
766 this.is_terminated = true;
767 return std::task::Poll::Ready(None);
768 }
769 if this.is_terminated {
770 panic!("polled CaptureRequestStream after completion");
771 }
772 fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
773 |bytes, handles| {
774 match this.inner.channel().read_etc(cx, bytes, handles) {
775 std::task::Poll::Ready(Ok(())) => {}
776 std::task::Poll::Pending => return std::task::Poll::Pending,
777 std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
778 this.is_terminated = true;
779 return std::task::Poll::Ready(None);
780 }
781 std::task::Poll::Ready(Err(e)) => {
782 return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
783 e.into(),
784 ))));
785 }
786 }
787
788 let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
790
791 std::task::Poll::Ready(Some(match header.ordinal {
792 0x3da5afb01b70be17 => {
793 header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
794 let mut req = fidl::new_empty!(
795 fidl::encoding::EmptyPayload,
796 fidl::encoding::DefaultFuchsiaResourceDialect
797 );
798 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
799 let control_handle = CaptureControlHandle { inner: this.inner.clone() };
800 Ok(CaptureRequest::StartOutputCapture {
801 responder: CaptureStartOutputCaptureResponder {
802 control_handle: std::mem::ManuallyDrop::new(control_handle),
803 tx_id: header.tx_id,
804 },
805 })
806 }
807 0x4598c765e8859b6b => {
808 header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
809 let mut req = fidl::new_empty!(
810 fidl::encoding::EmptyPayload,
811 fidl::encoding::DefaultFuchsiaResourceDialect
812 );
813 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
814 let control_handle = CaptureControlHandle { inner: this.inner.clone() };
815 Ok(CaptureRequest::StopOutputCapture {
816 responder: CaptureStopOutputCaptureResponder {
817 control_handle: std::mem::ManuallyDrop::new(control_handle),
818 tx_id: header.tx_id,
819 },
820 })
821 }
822 0x7f8de156ce46d54b => {
823 header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
824 let mut req = fidl::new_empty!(
825 CaptureWaitForQuietRequest,
826 fidl::encoding::DefaultFuchsiaResourceDialect
827 );
828 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<CaptureWaitForQuietRequest>(&header, _body_bytes, handles, &mut req)?;
829 let control_handle = CaptureControlHandle { inner: this.inner.clone() };
830 Ok(CaptureRequest::WaitForQuiet {
831 payload: req,
832 responder: CaptureWaitForQuietResponder {
833 control_handle: std::mem::ManuallyDrop::new(control_handle),
834 tx_id: header.tx_id,
835 },
836 })
837 }
838 0x5d372fd28da4efb2 => {
839 header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
840 let mut req = fidl::new_empty!(
841 CaptureQueueTriggeredCaptureRequest,
842 fidl::encoding::DefaultFuchsiaResourceDialect
843 );
844 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<CaptureQueueTriggeredCaptureRequest>(&header, _body_bytes, handles, &mut req)?;
845 let control_handle = CaptureControlHandle { inner: this.inner.clone() };
846 Ok(CaptureRequest::QueueTriggeredCapture {
847 payload: req,
848 responder: CaptureQueueTriggeredCaptureResponder {
849 control_handle: std::mem::ManuallyDrop::new(control_handle),
850 tx_id: header.tx_id,
851 },
852 })
853 }
854 0x7b55fa2cfe9c6c3 => {
855 header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
856 let mut req = fidl::new_empty!(
857 fidl::encoding::EmptyPayload,
858 fidl::encoding::DefaultFuchsiaResourceDialect
859 );
860 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
861 let control_handle = CaptureControlHandle { inner: this.inner.clone() };
862 Ok(CaptureRequest::WaitForTriggeredCapture {
863 responder: CaptureWaitForTriggeredCaptureResponder {
864 control_handle: std::mem::ManuallyDrop::new(control_handle),
865 tx_id: header.tx_id,
866 },
867 })
868 }
869 0x23960702c8a96e54 => {
870 header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
871 let mut req = fidl::new_empty!(
872 fidl::encoding::EmptyPayload,
873 fidl::encoding::DefaultFuchsiaResourceDialect
874 );
875 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
876 let control_handle = CaptureControlHandle { inner: this.inner.clone() };
877 Ok(CaptureRequest::GetOutputAudio {
878 responder: CaptureGetOutputAudioResponder {
879 control_handle: std::mem::ManuallyDrop::new(control_handle),
880 tx_id: header.tx_id,
881 },
882 })
883 }
884 _ if header.tx_id == 0
885 && header
886 .dynamic_flags()
887 .contains(fidl::encoding::DynamicFlags::FLEXIBLE) =>
888 {
889 Ok(CaptureRequest::_UnknownMethod {
890 ordinal: header.ordinal,
891 control_handle: CaptureControlHandle { inner: this.inner.clone() },
892 method_type: fidl::MethodType::OneWay,
893 })
894 }
895 _ if header
896 .dynamic_flags()
897 .contains(fidl::encoding::DynamicFlags::FLEXIBLE) =>
898 {
899 this.inner.send_framework_err(
900 fidl::encoding::FrameworkErr::UnknownMethod,
901 header.tx_id,
902 header.ordinal,
903 header.dynamic_flags(),
904 (bytes, handles),
905 )?;
906 Ok(CaptureRequest::_UnknownMethod {
907 ordinal: header.ordinal,
908 control_handle: CaptureControlHandle { inner: this.inner.clone() },
909 method_type: fidl::MethodType::TwoWay,
910 })
911 }
912 _ => Err(fidl::Error::UnknownOrdinal {
913 ordinal: header.ordinal,
914 protocol_name:
915 <CaptureMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
916 }),
917 }))
918 },
919 )
920 }
921}
922
923#[derive(Debug)]
924pub enum CaptureRequest {
925 StartOutputCapture { responder: CaptureStartOutputCaptureResponder },
935 StopOutputCapture { responder: CaptureStopOutputCaptureResponder },
944 WaitForQuiet { payload: CaptureWaitForQuietRequest, responder: CaptureWaitForQuietResponder },
955 QueueTriggeredCapture {
975 payload: CaptureQueueTriggeredCaptureRequest,
976 responder: CaptureQueueTriggeredCaptureResponder,
977 },
978 WaitForTriggeredCapture { responder: CaptureWaitForTriggeredCaptureResponder },
991 GetOutputAudio { responder: CaptureGetOutputAudioResponder },
1004 #[non_exhaustive]
1006 _UnknownMethod {
1007 ordinal: u64,
1009 control_handle: CaptureControlHandle,
1010 method_type: fidl::MethodType,
1011 },
1012}
1013
1014impl CaptureRequest {
1015 #[allow(irrefutable_let_patterns)]
1016 pub fn into_start_output_capture(self) -> Option<(CaptureStartOutputCaptureResponder)> {
1017 if let CaptureRequest::StartOutputCapture { responder } = self {
1018 Some((responder))
1019 } else {
1020 None
1021 }
1022 }
1023
1024 #[allow(irrefutable_let_patterns)]
1025 pub fn into_stop_output_capture(self) -> Option<(CaptureStopOutputCaptureResponder)> {
1026 if let CaptureRequest::StopOutputCapture { responder } = self {
1027 Some((responder))
1028 } else {
1029 None
1030 }
1031 }
1032
1033 #[allow(irrefutable_let_patterns)]
1034 pub fn into_wait_for_quiet(
1035 self,
1036 ) -> Option<(CaptureWaitForQuietRequest, CaptureWaitForQuietResponder)> {
1037 if let CaptureRequest::WaitForQuiet { payload, responder } = self {
1038 Some((payload, responder))
1039 } else {
1040 None
1041 }
1042 }
1043
1044 #[allow(irrefutable_let_patterns)]
1045 pub fn into_queue_triggered_capture(
1046 self,
1047 ) -> Option<(CaptureQueueTriggeredCaptureRequest, CaptureQueueTriggeredCaptureResponder)> {
1048 if let CaptureRequest::QueueTriggeredCapture { payload, responder } = self {
1049 Some((payload, responder))
1050 } else {
1051 None
1052 }
1053 }
1054
1055 #[allow(irrefutable_let_patterns)]
1056 pub fn into_wait_for_triggered_capture(
1057 self,
1058 ) -> Option<(CaptureWaitForTriggeredCaptureResponder)> {
1059 if let CaptureRequest::WaitForTriggeredCapture { responder } = self {
1060 Some((responder))
1061 } else {
1062 None
1063 }
1064 }
1065
1066 #[allow(irrefutable_let_patterns)]
1067 pub fn into_get_output_audio(self) -> Option<(CaptureGetOutputAudioResponder)> {
1068 if let CaptureRequest::GetOutputAudio { responder } = self {
1069 Some((responder))
1070 } else {
1071 None
1072 }
1073 }
1074
1075 pub fn method_name(&self) -> &'static str {
1077 match *self {
1078 CaptureRequest::StartOutputCapture { .. } => "start_output_capture",
1079 CaptureRequest::StopOutputCapture { .. } => "stop_output_capture",
1080 CaptureRequest::WaitForQuiet { .. } => "wait_for_quiet",
1081 CaptureRequest::QueueTriggeredCapture { .. } => "queue_triggered_capture",
1082 CaptureRequest::WaitForTriggeredCapture { .. } => "wait_for_triggered_capture",
1083 CaptureRequest::GetOutputAudio { .. } => "get_output_audio",
1084 CaptureRequest::_UnknownMethod { method_type: fidl::MethodType::OneWay, .. } => {
1085 "unknown one-way method"
1086 }
1087 CaptureRequest::_UnknownMethod { method_type: fidl::MethodType::TwoWay, .. } => {
1088 "unknown two-way method"
1089 }
1090 }
1091 }
1092}
1093
1094#[derive(Debug, Clone)]
1095pub struct CaptureControlHandle {
1096 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
1097}
1098
1099impl fidl::endpoints::ControlHandle for CaptureControlHandle {
1100 fn shutdown(&self) {
1101 self.inner.shutdown()
1102 }
1103 fn shutdown_with_epitaph(&self, status: zx_status::Status) {
1104 self.inner.shutdown_with_epitaph(status)
1105 }
1106
1107 fn is_closed(&self) -> bool {
1108 self.inner.channel().is_closed()
1109 }
1110 fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
1111 self.inner.channel().on_closed()
1112 }
1113
1114 #[cfg(target_os = "fuchsia")]
1115 fn signal_peer(
1116 &self,
1117 clear_mask: zx::Signals,
1118 set_mask: zx::Signals,
1119 ) -> Result<(), zx_status::Status> {
1120 use fidl::Peered;
1121 self.inner.channel().signal_peer(clear_mask, set_mask)
1122 }
1123}
1124
1125impl CaptureControlHandle {}
1126
1127#[must_use = "FIDL methods require a response to be sent"]
1128#[derive(Debug)]
1129pub struct CaptureStartOutputCaptureResponder {
1130 control_handle: std::mem::ManuallyDrop<CaptureControlHandle>,
1131 tx_id: u32,
1132}
1133
1134impl std::ops::Drop for CaptureStartOutputCaptureResponder {
1138 fn drop(&mut self) {
1139 self.control_handle.shutdown();
1140 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1142 }
1143}
1144
1145impl fidl::endpoints::Responder for CaptureStartOutputCaptureResponder {
1146 type ControlHandle = CaptureControlHandle;
1147
1148 fn control_handle(&self) -> &CaptureControlHandle {
1149 &self.control_handle
1150 }
1151
1152 fn drop_without_shutdown(mut self) {
1153 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1155 std::mem::forget(self);
1157 }
1158}
1159
1160impl CaptureStartOutputCaptureResponder {
1161 pub fn send(self, mut result: Result<(), AudioTestError>) -> Result<(), fidl::Error> {
1165 let _result = self.send_raw(result);
1166 if _result.is_err() {
1167 self.control_handle.shutdown();
1168 }
1169 self.drop_without_shutdown();
1170 _result
1171 }
1172
1173 pub fn send_no_shutdown_on_err(
1175 self,
1176 mut result: Result<(), AudioTestError>,
1177 ) -> Result<(), fidl::Error> {
1178 let _result = self.send_raw(result);
1179 self.drop_without_shutdown();
1180 _result
1181 }
1182
1183 fn send_raw(&self, mut result: Result<(), AudioTestError>) -> Result<(), fidl::Error> {
1184 self.control_handle.inner.send::<fidl::encoding::ResultType<
1185 fidl::encoding::EmptyStruct,
1186 AudioTestError,
1187 >>(
1188 result,
1189 self.tx_id,
1190 0x3da5afb01b70be17,
1191 fidl::encoding::DynamicFlags::empty(),
1192 )
1193 }
1194}
1195
1196#[must_use = "FIDL methods require a response to be sent"]
1197#[derive(Debug)]
1198pub struct CaptureStopOutputCaptureResponder {
1199 control_handle: std::mem::ManuallyDrop<CaptureControlHandle>,
1200 tx_id: u32,
1201}
1202
1203impl std::ops::Drop for CaptureStopOutputCaptureResponder {
1207 fn drop(&mut self) {
1208 self.control_handle.shutdown();
1209 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1211 }
1212}
1213
1214impl fidl::endpoints::Responder for CaptureStopOutputCaptureResponder {
1215 type ControlHandle = CaptureControlHandle;
1216
1217 fn control_handle(&self) -> &CaptureControlHandle {
1218 &self.control_handle
1219 }
1220
1221 fn drop_without_shutdown(mut self) {
1222 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1224 std::mem::forget(self);
1226 }
1227}
1228
1229impl CaptureStopOutputCaptureResponder {
1230 pub fn send(self, mut result: Result<(), AudioTestError>) -> Result<(), fidl::Error> {
1234 let _result = self.send_raw(result);
1235 if _result.is_err() {
1236 self.control_handle.shutdown();
1237 }
1238 self.drop_without_shutdown();
1239 _result
1240 }
1241
1242 pub fn send_no_shutdown_on_err(
1244 self,
1245 mut result: Result<(), AudioTestError>,
1246 ) -> Result<(), fidl::Error> {
1247 let _result = self.send_raw(result);
1248 self.drop_without_shutdown();
1249 _result
1250 }
1251
1252 fn send_raw(&self, mut result: Result<(), AudioTestError>) -> Result<(), fidl::Error> {
1253 self.control_handle.inner.send::<fidl::encoding::ResultType<
1254 fidl::encoding::EmptyStruct,
1255 AudioTestError,
1256 >>(
1257 result,
1258 self.tx_id,
1259 0x4598c765e8859b6b,
1260 fidl::encoding::DynamicFlags::empty(),
1261 )
1262 }
1263}
1264
1265#[must_use = "FIDL methods require a response to be sent"]
1266#[derive(Debug)]
1267pub struct CaptureWaitForQuietResponder {
1268 control_handle: std::mem::ManuallyDrop<CaptureControlHandle>,
1269 tx_id: u32,
1270}
1271
1272impl std::ops::Drop for CaptureWaitForQuietResponder {
1276 fn drop(&mut self) {
1277 self.control_handle.shutdown();
1278 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1280 }
1281}
1282
1283impl fidl::endpoints::Responder for CaptureWaitForQuietResponder {
1284 type ControlHandle = CaptureControlHandle;
1285
1286 fn control_handle(&self) -> &CaptureControlHandle {
1287 &self.control_handle
1288 }
1289
1290 fn drop_without_shutdown(mut self) {
1291 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1293 std::mem::forget(self);
1295 }
1296}
1297
1298impl CaptureWaitForQuietResponder {
1299 pub fn send(
1303 self,
1304 mut result: Result<WaitForQuietResult, AudioTestError>,
1305 ) -> Result<(), fidl::Error> {
1306 let _result = self.send_raw(result);
1307 if _result.is_err() {
1308 self.control_handle.shutdown();
1309 }
1310 self.drop_without_shutdown();
1311 _result
1312 }
1313
1314 pub fn send_no_shutdown_on_err(
1316 self,
1317 mut result: Result<WaitForQuietResult, AudioTestError>,
1318 ) -> Result<(), fidl::Error> {
1319 let _result = self.send_raw(result);
1320 self.drop_without_shutdown();
1321 _result
1322 }
1323
1324 fn send_raw(
1325 &self,
1326 mut result: Result<WaitForQuietResult, AudioTestError>,
1327 ) -> Result<(), fidl::Error> {
1328 self.control_handle.inner.send::<fidl::encoding::ResultType<
1329 CaptureWaitForQuietResponse,
1330 AudioTestError,
1331 >>(
1332 result.map(|result| (result,)),
1333 self.tx_id,
1334 0x7f8de156ce46d54b,
1335 fidl::encoding::DynamicFlags::empty(),
1336 )
1337 }
1338}
1339
1340#[must_use = "FIDL methods require a response to be sent"]
1341#[derive(Debug)]
1342pub struct CaptureQueueTriggeredCaptureResponder {
1343 control_handle: std::mem::ManuallyDrop<CaptureControlHandle>,
1344 tx_id: u32,
1345}
1346
1347impl std::ops::Drop for CaptureQueueTriggeredCaptureResponder {
1351 fn drop(&mut self) {
1352 self.control_handle.shutdown();
1353 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1355 }
1356}
1357
1358impl fidl::endpoints::Responder for CaptureQueueTriggeredCaptureResponder {
1359 type ControlHandle = CaptureControlHandle;
1360
1361 fn control_handle(&self) -> &CaptureControlHandle {
1362 &self.control_handle
1363 }
1364
1365 fn drop_without_shutdown(mut self) {
1366 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1368 std::mem::forget(self);
1370 }
1371}
1372
1373impl CaptureQueueTriggeredCaptureResponder {
1374 pub fn send(self, mut result: Result<(), AudioTestError>) -> Result<(), fidl::Error> {
1378 let _result = self.send_raw(result);
1379 if _result.is_err() {
1380 self.control_handle.shutdown();
1381 }
1382 self.drop_without_shutdown();
1383 _result
1384 }
1385
1386 pub fn send_no_shutdown_on_err(
1388 self,
1389 mut result: Result<(), AudioTestError>,
1390 ) -> Result<(), fidl::Error> {
1391 let _result = self.send_raw(result);
1392 self.drop_without_shutdown();
1393 _result
1394 }
1395
1396 fn send_raw(&self, mut result: Result<(), AudioTestError>) -> Result<(), fidl::Error> {
1397 self.control_handle.inner.send::<fidl::encoding::ResultType<
1398 fidl::encoding::EmptyStruct,
1399 AudioTestError,
1400 >>(
1401 result,
1402 self.tx_id,
1403 0x5d372fd28da4efb2,
1404 fidl::encoding::DynamicFlags::empty(),
1405 )
1406 }
1407}
1408
1409#[must_use = "FIDL methods require a response to be sent"]
1410#[derive(Debug)]
1411pub struct CaptureWaitForTriggeredCaptureResponder {
1412 control_handle: std::mem::ManuallyDrop<CaptureControlHandle>,
1413 tx_id: u32,
1414}
1415
1416impl std::ops::Drop for CaptureWaitForTriggeredCaptureResponder {
1420 fn drop(&mut self) {
1421 self.control_handle.shutdown();
1422 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1424 }
1425}
1426
1427impl fidl::endpoints::Responder for CaptureWaitForTriggeredCaptureResponder {
1428 type ControlHandle = CaptureControlHandle;
1429
1430 fn control_handle(&self) -> &CaptureControlHandle {
1431 &self.control_handle
1432 }
1433
1434 fn drop_without_shutdown(mut self) {
1435 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1437 std::mem::forget(self);
1439 }
1440}
1441
1442impl CaptureWaitForTriggeredCaptureResponder {
1443 pub fn send(
1447 self,
1448 mut result: Result<QueuedCaptureResult, AudioTestError>,
1449 ) -> Result<(), fidl::Error> {
1450 let _result = self.send_raw(result);
1451 if _result.is_err() {
1452 self.control_handle.shutdown();
1453 }
1454 self.drop_without_shutdown();
1455 _result
1456 }
1457
1458 pub fn send_no_shutdown_on_err(
1460 self,
1461 mut result: Result<QueuedCaptureResult, AudioTestError>,
1462 ) -> Result<(), fidl::Error> {
1463 let _result = self.send_raw(result);
1464 self.drop_without_shutdown();
1465 _result
1466 }
1467
1468 fn send_raw(
1469 &self,
1470 mut result: Result<QueuedCaptureResult, AudioTestError>,
1471 ) -> Result<(), fidl::Error> {
1472 self.control_handle.inner.send::<fidl::encoding::ResultType<
1473 CaptureWaitForTriggeredCaptureResponse,
1474 AudioTestError,
1475 >>(
1476 result.map(|result| (result,)),
1477 self.tx_id,
1478 0x7b55fa2cfe9c6c3,
1479 fidl::encoding::DynamicFlags::empty(),
1480 )
1481 }
1482}
1483
1484#[must_use = "FIDL methods require a response to be sent"]
1485#[derive(Debug)]
1486pub struct CaptureGetOutputAudioResponder {
1487 control_handle: std::mem::ManuallyDrop<CaptureControlHandle>,
1488 tx_id: u32,
1489}
1490
1491impl std::ops::Drop for CaptureGetOutputAudioResponder {
1495 fn drop(&mut self) {
1496 self.control_handle.shutdown();
1497 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1499 }
1500}
1501
1502impl fidl::endpoints::Responder for CaptureGetOutputAudioResponder {
1503 type ControlHandle = CaptureControlHandle;
1504
1505 fn control_handle(&self) -> &CaptureControlHandle {
1506 &self.control_handle
1507 }
1508
1509 fn drop_without_shutdown(mut self) {
1510 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1512 std::mem::forget(self);
1514 }
1515}
1516
1517impl CaptureGetOutputAudioResponder {
1518 pub fn send(self, mut result: Result<fidl::Socket, AudioTestError>) -> Result<(), fidl::Error> {
1522 let _result = self.send_raw(result);
1523 if _result.is_err() {
1524 self.control_handle.shutdown();
1525 }
1526 self.drop_without_shutdown();
1527 _result
1528 }
1529
1530 pub fn send_no_shutdown_on_err(
1532 self,
1533 mut result: Result<fidl::Socket, AudioTestError>,
1534 ) -> Result<(), fidl::Error> {
1535 let _result = self.send_raw(result);
1536 self.drop_without_shutdown();
1537 _result
1538 }
1539
1540 fn send_raw(
1541 &self,
1542 mut result: Result<fidl::Socket, AudioTestError>,
1543 ) -> Result<(), fidl::Error> {
1544 self.control_handle.inner.send::<fidl::encoding::ResultType<
1545 CaptureGetOutputAudioResponse,
1546 AudioTestError,
1547 >>(
1548 result.map(|audio_reader| (audio_reader,)),
1549 self.tx_id,
1550 0x23960702c8a96e54,
1551 fidl::encoding::DynamicFlags::empty(),
1552 )
1553 }
1554}
1555
1556#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
1557pub struct InjectionMarker;
1558
1559impl fidl::endpoints::ProtocolMarker for InjectionMarker {
1560 type Proxy = InjectionProxy;
1561 type RequestStream = InjectionRequestStream;
1562 #[cfg(target_os = "fuchsia")]
1563 type SynchronousProxy = InjectionSynchronousProxy;
1564
1565 const DEBUG_NAME: &'static str = "fuchsia.test.audio.Injection";
1566}
1567impl fidl::endpoints::DiscoverableProtocolMarker for InjectionMarker {}
1568pub type InjectionGetInputAudioSizeResult = Result<u64, AudioTestError>;
1569pub type InjectionClearInputAudioResult = Result<(), AudioTestError>;
1570pub type InjectionWaitUntilInputIsDoneResult = Result<(), AudioTestError>;
1571pub type InjectionStartInputInjectionResult = Result<(), AudioTestError>;
1572pub type InjectionStopInputInjectionResult = Result<(), AudioTestError>;
1573
1574pub trait InjectionProxyInterface: Send + Sync {
1575 fn r#write_input_audio(
1576 &self,
1577 index: i32,
1578 audio_writer: fidl::Socket,
1579 ) -> Result<(), fidl::Error>;
1580 type GetInputAudioSizeResponseFut: std::future::Future<Output = Result<InjectionGetInputAudioSizeResult, fidl::Error>>
1581 + Send;
1582 fn r#get_input_audio_size(&self, index: i32) -> Self::GetInputAudioSizeResponseFut;
1583 type ClearInputAudioResponseFut: std::future::Future<Output = Result<InjectionClearInputAudioResult, fidl::Error>>
1584 + Send;
1585 fn r#clear_input_audio(&self, index: i32) -> Self::ClearInputAudioResponseFut;
1586 type WaitUntilInputIsDoneResponseFut: std::future::Future<Output = Result<InjectionWaitUntilInputIsDoneResult, fidl::Error>>
1587 + Send;
1588 fn r#wait_until_input_is_done(&self) -> Self::WaitUntilInputIsDoneResponseFut;
1589 type StartInputInjectionResponseFut: std::future::Future<Output = Result<InjectionStartInputInjectionResult, fidl::Error>>
1590 + Send;
1591 fn r#start_input_injection(&self, index: i32) -> Self::StartInputInjectionResponseFut;
1592 type StopInputInjectionResponseFut: std::future::Future<Output = Result<InjectionStopInputInjectionResult, fidl::Error>>
1593 + Send;
1594 fn r#stop_input_injection(&self) -> Self::StopInputInjectionResponseFut;
1595}
1596#[derive(Debug)]
1597#[cfg(target_os = "fuchsia")]
1598pub struct InjectionSynchronousProxy {
1599 client: fidl::client::sync::Client,
1600}
1601
1602#[cfg(target_os = "fuchsia")]
1603impl fidl::endpoints::SynchronousProxy for InjectionSynchronousProxy {
1604 type Proxy = InjectionProxy;
1605 type Protocol = InjectionMarker;
1606
1607 fn from_channel(inner: fidl::Channel) -> Self {
1608 Self::new(inner)
1609 }
1610
1611 fn into_channel(self) -> fidl::Channel {
1612 self.client.into_channel()
1613 }
1614
1615 fn as_channel(&self) -> &fidl::Channel {
1616 self.client.as_channel()
1617 }
1618}
1619
1620#[cfg(target_os = "fuchsia")]
1621impl InjectionSynchronousProxy {
1622 pub fn new(channel: fidl::Channel) -> Self {
1623 let protocol_name = <InjectionMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
1624 Self { client: fidl::client::sync::Client::new(channel, protocol_name) }
1625 }
1626
1627 pub fn into_channel(self) -> fidl::Channel {
1628 self.client.into_channel()
1629 }
1630
1631 pub fn wait_for_event(
1634 &self,
1635 deadline: zx::MonotonicInstant,
1636 ) -> Result<InjectionEvent, fidl::Error> {
1637 InjectionEvent::decode(self.client.wait_for_event(deadline)?)
1638 }
1639
1640 pub fn r#write_input_audio(
1654 &self,
1655 mut index: i32,
1656 mut audio_writer: fidl::Socket,
1657 ) -> Result<(), fidl::Error> {
1658 self.client.send::<InjectionWriteInputAudioRequest>(
1659 (index, audio_writer),
1660 0x2eaec6d4251a030d,
1661 fidl::encoding::DynamicFlags::empty(),
1662 )
1663 }
1664
1665 pub fn r#get_input_audio_size(
1676 &self,
1677 mut index: i32,
1678 ___deadline: zx::MonotonicInstant,
1679 ) -> Result<InjectionGetInputAudioSizeResult, fidl::Error> {
1680 let _response = self.client.send_query::<
1681 InjectionGetInputAudioSizeRequest,
1682 fidl::encoding::ResultType<InjectionGetInputAudioSizeResponse, AudioTestError>,
1683 >(
1684 (index,),
1685 0x57684145b51cf28,
1686 fidl::encoding::DynamicFlags::empty(),
1687 ___deadline,
1688 )?;
1689 Ok(_response.map(|x| x.byte_count))
1690 }
1691
1692 pub fn r#clear_input_audio(
1699 &self,
1700 mut index: i32,
1701 ___deadline: zx::MonotonicInstant,
1702 ) -> Result<InjectionClearInputAudioResult, fidl::Error> {
1703 let _response = self.client.send_query::<
1704 InjectionClearInputAudioRequest,
1705 fidl::encoding::ResultType<fidl::encoding::EmptyStruct, AudioTestError>,
1706 >(
1707 (index,),
1708 0x33259f902aace7b7,
1709 fidl::encoding::DynamicFlags::empty(),
1710 ___deadline,
1711 )?;
1712 Ok(_response.map(|x| x))
1713 }
1714
1715 pub fn r#wait_until_input_is_done(
1725 &self,
1726 ___deadline: zx::MonotonicInstant,
1727 ) -> Result<InjectionWaitUntilInputIsDoneResult, fidl::Error> {
1728 let _response = self.client.send_query::<
1729 fidl::encoding::EmptyPayload,
1730 fidl::encoding::ResultType<fidl::encoding::EmptyStruct, AudioTestError>,
1731 >(
1732 (),
1733 0x6cb5b4b48ffe7fc8,
1734 fidl::encoding::DynamicFlags::empty(),
1735 ___deadline,
1736 )?;
1737 Ok(_response.map(|x| x))
1738 }
1739
1740 pub fn r#start_input_injection(
1747 &self,
1748 mut index: i32,
1749 ___deadline: zx::MonotonicInstant,
1750 ) -> Result<InjectionStartInputInjectionResult, fidl::Error> {
1751 let _response = self.client.send_query::<
1752 InjectionStartInputInjectionRequest,
1753 fidl::encoding::ResultType<fidl::encoding::EmptyStruct, AudioTestError>,
1754 >(
1755 (index,),
1756 0x753a5415ad966b06,
1757 fidl::encoding::DynamicFlags::empty(),
1758 ___deadline,
1759 )?;
1760 Ok(_response.map(|x| x))
1761 }
1762
1763 pub fn r#stop_input_injection(
1773 &self,
1774 ___deadline: zx::MonotonicInstant,
1775 ) -> Result<InjectionStopInputInjectionResult, fidl::Error> {
1776 let _response = self.client.send_query::<
1777 fidl::encoding::EmptyPayload,
1778 fidl::encoding::ResultType<fidl::encoding::EmptyStruct, AudioTestError>,
1779 >(
1780 (),
1781 0x371fce6bb8d77fe,
1782 fidl::encoding::DynamicFlags::empty(),
1783 ___deadline,
1784 )?;
1785 Ok(_response.map(|x| x))
1786 }
1787}
1788
1789#[cfg(target_os = "fuchsia")]
1790impl From<InjectionSynchronousProxy> for zx::Handle {
1791 fn from(value: InjectionSynchronousProxy) -> Self {
1792 value.into_channel().into()
1793 }
1794}
1795
1796#[cfg(target_os = "fuchsia")]
1797impl From<fidl::Channel> for InjectionSynchronousProxy {
1798 fn from(value: fidl::Channel) -> Self {
1799 Self::new(value)
1800 }
1801}
1802
1803#[cfg(target_os = "fuchsia")]
1804impl fidl::endpoints::FromClient for InjectionSynchronousProxy {
1805 type Protocol = InjectionMarker;
1806
1807 fn from_client(value: fidl::endpoints::ClientEnd<InjectionMarker>) -> Self {
1808 Self::new(value.into_channel())
1809 }
1810}
1811
1812#[derive(Debug, Clone)]
1813pub struct InjectionProxy {
1814 client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
1815}
1816
1817impl fidl::endpoints::Proxy for InjectionProxy {
1818 type Protocol = InjectionMarker;
1819
1820 fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
1821 Self::new(inner)
1822 }
1823
1824 fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
1825 self.client.into_channel().map_err(|client| Self { client })
1826 }
1827
1828 fn as_channel(&self) -> &::fidl::AsyncChannel {
1829 self.client.as_channel()
1830 }
1831}
1832
1833impl InjectionProxy {
1834 pub fn new(channel: ::fidl::AsyncChannel) -> Self {
1836 let protocol_name = <InjectionMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
1837 Self { client: fidl::client::Client::new(channel, protocol_name) }
1838 }
1839
1840 pub fn take_event_stream(&self) -> InjectionEventStream {
1846 InjectionEventStream { event_receiver: self.client.take_event_receiver() }
1847 }
1848
1849 pub fn r#write_input_audio(
1863 &self,
1864 mut index: i32,
1865 mut audio_writer: fidl::Socket,
1866 ) -> Result<(), fidl::Error> {
1867 InjectionProxyInterface::r#write_input_audio(self, index, audio_writer)
1868 }
1869
1870 pub fn r#get_input_audio_size(
1881 &self,
1882 mut index: i32,
1883 ) -> fidl::client::QueryResponseFut<
1884 InjectionGetInputAudioSizeResult,
1885 fidl::encoding::DefaultFuchsiaResourceDialect,
1886 > {
1887 InjectionProxyInterface::r#get_input_audio_size(self, index)
1888 }
1889
1890 pub fn r#clear_input_audio(
1897 &self,
1898 mut index: i32,
1899 ) -> fidl::client::QueryResponseFut<
1900 InjectionClearInputAudioResult,
1901 fidl::encoding::DefaultFuchsiaResourceDialect,
1902 > {
1903 InjectionProxyInterface::r#clear_input_audio(self, index)
1904 }
1905
1906 pub fn r#wait_until_input_is_done(
1916 &self,
1917 ) -> fidl::client::QueryResponseFut<
1918 InjectionWaitUntilInputIsDoneResult,
1919 fidl::encoding::DefaultFuchsiaResourceDialect,
1920 > {
1921 InjectionProxyInterface::r#wait_until_input_is_done(self)
1922 }
1923
1924 pub fn r#start_input_injection(
1931 &self,
1932 mut index: i32,
1933 ) -> fidl::client::QueryResponseFut<
1934 InjectionStartInputInjectionResult,
1935 fidl::encoding::DefaultFuchsiaResourceDialect,
1936 > {
1937 InjectionProxyInterface::r#start_input_injection(self, index)
1938 }
1939
1940 pub fn r#stop_input_injection(
1950 &self,
1951 ) -> fidl::client::QueryResponseFut<
1952 InjectionStopInputInjectionResult,
1953 fidl::encoding::DefaultFuchsiaResourceDialect,
1954 > {
1955 InjectionProxyInterface::r#stop_input_injection(self)
1956 }
1957}
1958
1959impl InjectionProxyInterface for InjectionProxy {
1960 fn r#write_input_audio(
1961 &self,
1962 mut index: i32,
1963 mut audio_writer: fidl::Socket,
1964 ) -> Result<(), fidl::Error> {
1965 self.client.send::<InjectionWriteInputAudioRequest>(
1966 (index, audio_writer),
1967 0x2eaec6d4251a030d,
1968 fidl::encoding::DynamicFlags::empty(),
1969 )
1970 }
1971
1972 type GetInputAudioSizeResponseFut = fidl::client::QueryResponseFut<
1973 InjectionGetInputAudioSizeResult,
1974 fidl::encoding::DefaultFuchsiaResourceDialect,
1975 >;
1976 fn r#get_input_audio_size(&self, mut index: i32) -> Self::GetInputAudioSizeResponseFut {
1977 fn _decode(
1978 mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
1979 ) -> Result<InjectionGetInputAudioSizeResult, fidl::Error> {
1980 let _response = fidl::client::decode_transaction_body::<
1981 fidl::encoding::ResultType<InjectionGetInputAudioSizeResponse, AudioTestError>,
1982 fidl::encoding::DefaultFuchsiaResourceDialect,
1983 0x57684145b51cf28,
1984 >(_buf?)?;
1985 Ok(_response.map(|x| x.byte_count))
1986 }
1987 self.client.send_query_and_decode::<
1988 InjectionGetInputAudioSizeRequest,
1989 InjectionGetInputAudioSizeResult,
1990 >(
1991 (index,),
1992 0x57684145b51cf28,
1993 fidl::encoding::DynamicFlags::empty(),
1994 _decode,
1995 )
1996 }
1997
1998 type ClearInputAudioResponseFut = fidl::client::QueryResponseFut<
1999 InjectionClearInputAudioResult,
2000 fidl::encoding::DefaultFuchsiaResourceDialect,
2001 >;
2002 fn r#clear_input_audio(&self, mut index: i32) -> Self::ClearInputAudioResponseFut {
2003 fn _decode(
2004 mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
2005 ) -> Result<InjectionClearInputAudioResult, fidl::Error> {
2006 let _response = fidl::client::decode_transaction_body::<
2007 fidl::encoding::ResultType<fidl::encoding::EmptyStruct, AudioTestError>,
2008 fidl::encoding::DefaultFuchsiaResourceDialect,
2009 0x33259f902aace7b7,
2010 >(_buf?)?;
2011 Ok(_response.map(|x| x))
2012 }
2013 self.client.send_query_and_decode::<
2014 InjectionClearInputAudioRequest,
2015 InjectionClearInputAudioResult,
2016 >(
2017 (index,),
2018 0x33259f902aace7b7,
2019 fidl::encoding::DynamicFlags::empty(),
2020 _decode,
2021 )
2022 }
2023
2024 type WaitUntilInputIsDoneResponseFut = fidl::client::QueryResponseFut<
2025 InjectionWaitUntilInputIsDoneResult,
2026 fidl::encoding::DefaultFuchsiaResourceDialect,
2027 >;
2028 fn r#wait_until_input_is_done(&self) -> Self::WaitUntilInputIsDoneResponseFut {
2029 fn _decode(
2030 mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
2031 ) -> Result<InjectionWaitUntilInputIsDoneResult, fidl::Error> {
2032 let _response = fidl::client::decode_transaction_body::<
2033 fidl::encoding::ResultType<fidl::encoding::EmptyStruct, AudioTestError>,
2034 fidl::encoding::DefaultFuchsiaResourceDialect,
2035 0x6cb5b4b48ffe7fc8,
2036 >(_buf?)?;
2037 Ok(_response.map(|x| x))
2038 }
2039 self.client.send_query_and_decode::<
2040 fidl::encoding::EmptyPayload,
2041 InjectionWaitUntilInputIsDoneResult,
2042 >(
2043 (),
2044 0x6cb5b4b48ffe7fc8,
2045 fidl::encoding::DynamicFlags::empty(),
2046 _decode,
2047 )
2048 }
2049
2050 type StartInputInjectionResponseFut = fidl::client::QueryResponseFut<
2051 InjectionStartInputInjectionResult,
2052 fidl::encoding::DefaultFuchsiaResourceDialect,
2053 >;
2054 fn r#start_input_injection(&self, mut index: i32) -> Self::StartInputInjectionResponseFut {
2055 fn _decode(
2056 mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
2057 ) -> Result<InjectionStartInputInjectionResult, fidl::Error> {
2058 let _response = fidl::client::decode_transaction_body::<
2059 fidl::encoding::ResultType<fidl::encoding::EmptyStruct, AudioTestError>,
2060 fidl::encoding::DefaultFuchsiaResourceDialect,
2061 0x753a5415ad966b06,
2062 >(_buf?)?;
2063 Ok(_response.map(|x| x))
2064 }
2065 self.client.send_query_and_decode::<
2066 InjectionStartInputInjectionRequest,
2067 InjectionStartInputInjectionResult,
2068 >(
2069 (index,),
2070 0x753a5415ad966b06,
2071 fidl::encoding::DynamicFlags::empty(),
2072 _decode,
2073 )
2074 }
2075
2076 type StopInputInjectionResponseFut = fidl::client::QueryResponseFut<
2077 InjectionStopInputInjectionResult,
2078 fidl::encoding::DefaultFuchsiaResourceDialect,
2079 >;
2080 fn r#stop_input_injection(&self) -> Self::StopInputInjectionResponseFut {
2081 fn _decode(
2082 mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
2083 ) -> Result<InjectionStopInputInjectionResult, fidl::Error> {
2084 let _response = fidl::client::decode_transaction_body::<
2085 fidl::encoding::ResultType<fidl::encoding::EmptyStruct, AudioTestError>,
2086 fidl::encoding::DefaultFuchsiaResourceDialect,
2087 0x371fce6bb8d77fe,
2088 >(_buf?)?;
2089 Ok(_response.map(|x| x))
2090 }
2091 self.client.send_query_and_decode::<
2092 fidl::encoding::EmptyPayload,
2093 InjectionStopInputInjectionResult,
2094 >(
2095 (),
2096 0x371fce6bb8d77fe,
2097 fidl::encoding::DynamicFlags::empty(),
2098 _decode,
2099 )
2100 }
2101}
2102
2103pub struct InjectionEventStream {
2104 event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
2105}
2106
2107impl std::marker::Unpin for InjectionEventStream {}
2108
2109impl futures::stream::FusedStream for InjectionEventStream {
2110 fn is_terminated(&self) -> bool {
2111 self.event_receiver.is_terminated()
2112 }
2113}
2114
2115impl futures::Stream for InjectionEventStream {
2116 type Item = Result<InjectionEvent, fidl::Error>;
2117
2118 fn poll_next(
2119 mut self: std::pin::Pin<&mut Self>,
2120 cx: &mut std::task::Context<'_>,
2121 ) -> std::task::Poll<Option<Self::Item>> {
2122 match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
2123 &mut self.event_receiver,
2124 cx
2125 )?) {
2126 Some(buf) => std::task::Poll::Ready(Some(InjectionEvent::decode(buf))),
2127 None => std::task::Poll::Ready(None),
2128 }
2129 }
2130}
2131
2132#[derive(Debug)]
2133pub enum InjectionEvent {
2134 #[non_exhaustive]
2135 _UnknownEvent {
2136 ordinal: u64,
2138 },
2139}
2140
2141impl InjectionEvent {
2142 fn decode(
2144 mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
2145 ) -> Result<InjectionEvent, fidl::Error> {
2146 let (bytes, _handles) = buf.split_mut();
2147 let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
2148 debug_assert_eq!(tx_header.tx_id, 0);
2149 match tx_header.ordinal {
2150 _ if tx_header.dynamic_flags().contains(fidl::encoding::DynamicFlags::FLEXIBLE) => {
2151 Ok(InjectionEvent::_UnknownEvent { ordinal: tx_header.ordinal })
2152 }
2153 _ => Err(fidl::Error::UnknownOrdinal {
2154 ordinal: tx_header.ordinal,
2155 protocol_name: <InjectionMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
2156 }),
2157 }
2158 }
2159}
2160
2161pub struct InjectionRequestStream {
2163 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
2164 is_terminated: bool,
2165}
2166
2167impl std::marker::Unpin for InjectionRequestStream {}
2168
2169impl futures::stream::FusedStream for InjectionRequestStream {
2170 fn is_terminated(&self) -> bool {
2171 self.is_terminated
2172 }
2173}
2174
2175impl fidl::endpoints::RequestStream for InjectionRequestStream {
2176 type Protocol = InjectionMarker;
2177 type ControlHandle = InjectionControlHandle;
2178
2179 fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
2180 Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
2181 }
2182
2183 fn control_handle(&self) -> Self::ControlHandle {
2184 InjectionControlHandle { inner: self.inner.clone() }
2185 }
2186
2187 fn into_inner(
2188 self,
2189 ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
2190 {
2191 (self.inner, self.is_terminated)
2192 }
2193
2194 fn from_inner(
2195 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
2196 is_terminated: bool,
2197 ) -> Self {
2198 Self { inner, is_terminated }
2199 }
2200}
2201
2202impl futures::Stream for InjectionRequestStream {
2203 type Item = Result<InjectionRequest, fidl::Error>;
2204
2205 fn poll_next(
2206 mut self: std::pin::Pin<&mut Self>,
2207 cx: &mut std::task::Context<'_>,
2208 ) -> std::task::Poll<Option<Self::Item>> {
2209 let this = &mut *self;
2210 if this.inner.check_shutdown(cx) {
2211 this.is_terminated = true;
2212 return std::task::Poll::Ready(None);
2213 }
2214 if this.is_terminated {
2215 panic!("polled InjectionRequestStream after completion");
2216 }
2217 fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
2218 |bytes, handles| {
2219 match this.inner.channel().read_etc(cx, bytes, handles) {
2220 std::task::Poll::Ready(Ok(())) => {}
2221 std::task::Poll::Pending => return std::task::Poll::Pending,
2222 std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
2223 this.is_terminated = true;
2224 return std::task::Poll::Ready(None);
2225 }
2226 std::task::Poll::Ready(Err(e)) => {
2227 return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
2228 e.into(),
2229 ))));
2230 }
2231 }
2232
2233 let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
2235
2236 std::task::Poll::Ready(Some(match header.ordinal {
2237 0x2eaec6d4251a030d => {
2238 header.validate_request_tx_id(fidl::MethodType::OneWay)?;
2239 let mut req = fidl::new_empty!(
2240 InjectionWriteInputAudioRequest,
2241 fidl::encoding::DefaultFuchsiaResourceDialect
2242 );
2243 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<InjectionWriteInputAudioRequest>(&header, _body_bytes, handles, &mut req)?;
2244 let control_handle = InjectionControlHandle { inner: this.inner.clone() };
2245 Ok(InjectionRequest::WriteInputAudio {
2246 index: req.index,
2247 audio_writer: req.audio_writer,
2248
2249 control_handle,
2250 })
2251 }
2252 0x57684145b51cf28 => {
2253 header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
2254 let mut req = fidl::new_empty!(
2255 InjectionGetInputAudioSizeRequest,
2256 fidl::encoding::DefaultFuchsiaResourceDialect
2257 );
2258 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<InjectionGetInputAudioSizeRequest>(&header, _body_bytes, handles, &mut req)?;
2259 let control_handle = InjectionControlHandle { inner: this.inner.clone() };
2260 Ok(InjectionRequest::GetInputAudioSize {
2261 index: req.index,
2262
2263 responder: InjectionGetInputAudioSizeResponder {
2264 control_handle: std::mem::ManuallyDrop::new(control_handle),
2265 tx_id: header.tx_id,
2266 },
2267 })
2268 }
2269 0x33259f902aace7b7 => {
2270 header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
2271 let mut req = fidl::new_empty!(
2272 InjectionClearInputAudioRequest,
2273 fidl::encoding::DefaultFuchsiaResourceDialect
2274 );
2275 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<InjectionClearInputAudioRequest>(&header, _body_bytes, handles, &mut req)?;
2276 let control_handle = InjectionControlHandle { inner: this.inner.clone() };
2277 Ok(InjectionRequest::ClearInputAudio {
2278 index: req.index,
2279
2280 responder: InjectionClearInputAudioResponder {
2281 control_handle: std::mem::ManuallyDrop::new(control_handle),
2282 tx_id: header.tx_id,
2283 },
2284 })
2285 }
2286 0x6cb5b4b48ffe7fc8 => {
2287 header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
2288 let mut req = fidl::new_empty!(
2289 fidl::encoding::EmptyPayload,
2290 fidl::encoding::DefaultFuchsiaResourceDialect
2291 );
2292 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
2293 let control_handle = InjectionControlHandle { inner: this.inner.clone() };
2294 Ok(InjectionRequest::WaitUntilInputIsDone {
2295 responder: InjectionWaitUntilInputIsDoneResponder {
2296 control_handle: std::mem::ManuallyDrop::new(control_handle),
2297 tx_id: header.tx_id,
2298 },
2299 })
2300 }
2301 0x753a5415ad966b06 => {
2302 header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
2303 let mut req = fidl::new_empty!(
2304 InjectionStartInputInjectionRequest,
2305 fidl::encoding::DefaultFuchsiaResourceDialect
2306 );
2307 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<InjectionStartInputInjectionRequest>(&header, _body_bytes, handles, &mut req)?;
2308 let control_handle = InjectionControlHandle { inner: this.inner.clone() };
2309 Ok(InjectionRequest::StartInputInjection {
2310 index: req.index,
2311
2312 responder: InjectionStartInputInjectionResponder {
2313 control_handle: std::mem::ManuallyDrop::new(control_handle),
2314 tx_id: header.tx_id,
2315 },
2316 })
2317 }
2318 0x371fce6bb8d77fe => {
2319 header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
2320 let mut req = fidl::new_empty!(
2321 fidl::encoding::EmptyPayload,
2322 fidl::encoding::DefaultFuchsiaResourceDialect
2323 );
2324 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
2325 let control_handle = InjectionControlHandle { inner: this.inner.clone() };
2326 Ok(InjectionRequest::StopInputInjection {
2327 responder: InjectionStopInputInjectionResponder {
2328 control_handle: std::mem::ManuallyDrop::new(control_handle),
2329 tx_id: header.tx_id,
2330 },
2331 })
2332 }
2333 _ if header.tx_id == 0
2334 && header
2335 .dynamic_flags()
2336 .contains(fidl::encoding::DynamicFlags::FLEXIBLE) =>
2337 {
2338 Ok(InjectionRequest::_UnknownMethod {
2339 ordinal: header.ordinal,
2340 control_handle: InjectionControlHandle { inner: this.inner.clone() },
2341 method_type: fidl::MethodType::OneWay,
2342 })
2343 }
2344 _ if header
2345 .dynamic_flags()
2346 .contains(fidl::encoding::DynamicFlags::FLEXIBLE) =>
2347 {
2348 this.inner.send_framework_err(
2349 fidl::encoding::FrameworkErr::UnknownMethod,
2350 header.tx_id,
2351 header.ordinal,
2352 header.dynamic_flags(),
2353 (bytes, handles),
2354 )?;
2355 Ok(InjectionRequest::_UnknownMethod {
2356 ordinal: header.ordinal,
2357 control_handle: InjectionControlHandle { inner: this.inner.clone() },
2358 method_type: fidl::MethodType::TwoWay,
2359 })
2360 }
2361 _ => Err(fidl::Error::UnknownOrdinal {
2362 ordinal: header.ordinal,
2363 protocol_name:
2364 <InjectionMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
2365 }),
2366 }))
2367 },
2368 )
2369 }
2370}
2371
2372#[derive(Debug)]
2381pub enum InjectionRequest {
2382 WriteInputAudio {
2396 index: i32,
2397 audio_writer: fidl::Socket,
2398 control_handle: InjectionControlHandle,
2399 },
2400 GetInputAudioSize { index: i32, responder: InjectionGetInputAudioSizeResponder },
2411 ClearInputAudio { index: i32, responder: InjectionClearInputAudioResponder },
2418 WaitUntilInputIsDone { responder: InjectionWaitUntilInputIsDoneResponder },
2428 StartInputInjection { index: i32, responder: InjectionStartInputInjectionResponder },
2435 StopInputInjection { responder: InjectionStopInputInjectionResponder },
2445 #[non_exhaustive]
2447 _UnknownMethod {
2448 ordinal: u64,
2450 control_handle: InjectionControlHandle,
2451 method_type: fidl::MethodType,
2452 },
2453}
2454
2455impl InjectionRequest {
2456 #[allow(irrefutable_let_patterns)]
2457 pub fn into_write_input_audio(self) -> Option<(i32, fidl::Socket, InjectionControlHandle)> {
2458 if let InjectionRequest::WriteInputAudio { index, audio_writer, control_handle } = self {
2459 Some((index, audio_writer, control_handle))
2460 } else {
2461 None
2462 }
2463 }
2464
2465 #[allow(irrefutable_let_patterns)]
2466 pub fn into_get_input_audio_size(self) -> Option<(i32, InjectionGetInputAudioSizeResponder)> {
2467 if let InjectionRequest::GetInputAudioSize { index, responder } = self {
2468 Some((index, responder))
2469 } else {
2470 None
2471 }
2472 }
2473
2474 #[allow(irrefutable_let_patterns)]
2475 pub fn into_clear_input_audio(self) -> Option<(i32, InjectionClearInputAudioResponder)> {
2476 if let InjectionRequest::ClearInputAudio { index, responder } = self {
2477 Some((index, responder))
2478 } else {
2479 None
2480 }
2481 }
2482
2483 #[allow(irrefutable_let_patterns)]
2484 pub fn into_wait_until_input_is_done(self) -> Option<(InjectionWaitUntilInputIsDoneResponder)> {
2485 if let InjectionRequest::WaitUntilInputIsDone { responder } = self {
2486 Some((responder))
2487 } else {
2488 None
2489 }
2490 }
2491
2492 #[allow(irrefutable_let_patterns)]
2493 pub fn into_start_input_injection(
2494 self,
2495 ) -> Option<(i32, InjectionStartInputInjectionResponder)> {
2496 if let InjectionRequest::StartInputInjection { index, responder } = self {
2497 Some((index, responder))
2498 } else {
2499 None
2500 }
2501 }
2502
2503 #[allow(irrefutable_let_patterns)]
2504 pub fn into_stop_input_injection(self) -> Option<(InjectionStopInputInjectionResponder)> {
2505 if let InjectionRequest::StopInputInjection { responder } = self {
2506 Some((responder))
2507 } else {
2508 None
2509 }
2510 }
2511
2512 pub fn method_name(&self) -> &'static str {
2514 match *self {
2515 InjectionRequest::WriteInputAudio { .. } => "write_input_audio",
2516 InjectionRequest::GetInputAudioSize { .. } => "get_input_audio_size",
2517 InjectionRequest::ClearInputAudio { .. } => "clear_input_audio",
2518 InjectionRequest::WaitUntilInputIsDone { .. } => "wait_until_input_is_done",
2519 InjectionRequest::StartInputInjection { .. } => "start_input_injection",
2520 InjectionRequest::StopInputInjection { .. } => "stop_input_injection",
2521 InjectionRequest::_UnknownMethod { method_type: fidl::MethodType::OneWay, .. } => {
2522 "unknown one-way method"
2523 }
2524 InjectionRequest::_UnknownMethod { method_type: fidl::MethodType::TwoWay, .. } => {
2525 "unknown two-way method"
2526 }
2527 }
2528 }
2529}
2530
2531#[derive(Debug, Clone)]
2532pub struct InjectionControlHandle {
2533 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
2534}
2535
2536impl fidl::endpoints::ControlHandle for InjectionControlHandle {
2537 fn shutdown(&self) {
2538 self.inner.shutdown()
2539 }
2540 fn shutdown_with_epitaph(&self, status: zx_status::Status) {
2541 self.inner.shutdown_with_epitaph(status)
2542 }
2543
2544 fn is_closed(&self) -> bool {
2545 self.inner.channel().is_closed()
2546 }
2547 fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
2548 self.inner.channel().on_closed()
2549 }
2550
2551 #[cfg(target_os = "fuchsia")]
2552 fn signal_peer(
2553 &self,
2554 clear_mask: zx::Signals,
2555 set_mask: zx::Signals,
2556 ) -> Result<(), zx_status::Status> {
2557 use fidl::Peered;
2558 self.inner.channel().signal_peer(clear_mask, set_mask)
2559 }
2560}
2561
2562impl InjectionControlHandle {}
2563
2564#[must_use = "FIDL methods require a response to be sent"]
2565#[derive(Debug)]
2566pub struct InjectionGetInputAudioSizeResponder {
2567 control_handle: std::mem::ManuallyDrop<InjectionControlHandle>,
2568 tx_id: u32,
2569}
2570
2571impl std::ops::Drop for InjectionGetInputAudioSizeResponder {
2575 fn drop(&mut self) {
2576 self.control_handle.shutdown();
2577 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
2579 }
2580}
2581
2582impl fidl::endpoints::Responder for InjectionGetInputAudioSizeResponder {
2583 type ControlHandle = InjectionControlHandle;
2584
2585 fn control_handle(&self) -> &InjectionControlHandle {
2586 &self.control_handle
2587 }
2588
2589 fn drop_without_shutdown(mut self) {
2590 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
2592 std::mem::forget(self);
2594 }
2595}
2596
2597impl InjectionGetInputAudioSizeResponder {
2598 pub fn send(self, mut result: Result<u64, AudioTestError>) -> Result<(), fidl::Error> {
2602 let _result = self.send_raw(result);
2603 if _result.is_err() {
2604 self.control_handle.shutdown();
2605 }
2606 self.drop_without_shutdown();
2607 _result
2608 }
2609
2610 pub fn send_no_shutdown_on_err(
2612 self,
2613 mut result: Result<u64, AudioTestError>,
2614 ) -> Result<(), fidl::Error> {
2615 let _result = self.send_raw(result);
2616 self.drop_without_shutdown();
2617 _result
2618 }
2619
2620 fn send_raw(&self, mut result: Result<u64, AudioTestError>) -> Result<(), fidl::Error> {
2621 self.control_handle.inner.send::<fidl::encoding::ResultType<
2622 InjectionGetInputAudioSizeResponse,
2623 AudioTestError,
2624 >>(
2625 result.map(|byte_count| (byte_count,)),
2626 self.tx_id,
2627 0x57684145b51cf28,
2628 fidl::encoding::DynamicFlags::empty(),
2629 )
2630 }
2631}
2632
2633#[must_use = "FIDL methods require a response to be sent"]
2634#[derive(Debug)]
2635pub struct InjectionClearInputAudioResponder {
2636 control_handle: std::mem::ManuallyDrop<InjectionControlHandle>,
2637 tx_id: u32,
2638}
2639
2640impl std::ops::Drop for InjectionClearInputAudioResponder {
2644 fn drop(&mut self) {
2645 self.control_handle.shutdown();
2646 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
2648 }
2649}
2650
2651impl fidl::endpoints::Responder for InjectionClearInputAudioResponder {
2652 type ControlHandle = InjectionControlHandle;
2653
2654 fn control_handle(&self) -> &InjectionControlHandle {
2655 &self.control_handle
2656 }
2657
2658 fn drop_without_shutdown(mut self) {
2659 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
2661 std::mem::forget(self);
2663 }
2664}
2665
2666impl InjectionClearInputAudioResponder {
2667 pub fn send(self, mut result: Result<(), AudioTestError>) -> Result<(), fidl::Error> {
2671 let _result = self.send_raw(result);
2672 if _result.is_err() {
2673 self.control_handle.shutdown();
2674 }
2675 self.drop_without_shutdown();
2676 _result
2677 }
2678
2679 pub fn send_no_shutdown_on_err(
2681 self,
2682 mut result: Result<(), AudioTestError>,
2683 ) -> Result<(), fidl::Error> {
2684 let _result = self.send_raw(result);
2685 self.drop_without_shutdown();
2686 _result
2687 }
2688
2689 fn send_raw(&self, mut result: Result<(), AudioTestError>) -> Result<(), fidl::Error> {
2690 self.control_handle.inner.send::<fidl::encoding::ResultType<
2691 fidl::encoding::EmptyStruct,
2692 AudioTestError,
2693 >>(
2694 result,
2695 self.tx_id,
2696 0x33259f902aace7b7,
2697 fidl::encoding::DynamicFlags::empty(),
2698 )
2699 }
2700}
2701
2702#[must_use = "FIDL methods require a response to be sent"]
2703#[derive(Debug)]
2704pub struct InjectionWaitUntilInputIsDoneResponder {
2705 control_handle: std::mem::ManuallyDrop<InjectionControlHandle>,
2706 tx_id: u32,
2707}
2708
2709impl std::ops::Drop for InjectionWaitUntilInputIsDoneResponder {
2713 fn drop(&mut self) {
2714 self.control_handle.shutdown();
2715 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
2717 }
2718}
2719
2720impl fidl::endpoints::Responder for InjectionWaitUntilInputIsDoneResponder {
2721 type ControlHandle = InjectionControlHandle;
2722
2723 fn control_handle(&self) -> &InjectionControlHandle {
2724 &self.control_handle
2725 }
2726
2727 fn drop_without_shutdown(mut self) {
2728 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
2730 std::mem::forget(self);
2732 }
2733}
2734
2735impl InjectionWaitUntilInputIsDoneResponder {
2736 pub fn send(self, mut result: Result<(), AudioTestError>) -> Result<(), fidl::Error> {
2740 let _result = self.send_raw(result);
2741 if _result.is_err() {
2742 self.control_handle.shutdown();
2743 }
2744 self.drop_without_shutdown();
2745 _result
2746 }
2747
2748 pub fn send_no_shutdown_on_err(
2750 self,
2751 mut result: Result<(), AudioTestError>,
2752 ) -> Result<(), fidl::Error> {
2753 let _result = self.send_raw(result);
2754 self.drop_without_shutdown();
2755 _result
2756 }
2757
2758 fn send_raw(&self, mut result: Result<(), AudioTestError>) -> Result<(), fidl::Error> {
2759 self.control_handle.inner.send::<fidl::encoding::ResultType<
2760 fidl::encoding::EmptyStruct,
2761 AudioTestError,
2762 >>(
2763 result,
2764 self.tx_id,
2765 0x6cb5b4b48ffe7fc8,
2766 fidl::encoding::DynamicFlags::empty(),
2767 )
2768 }
2769}
2770
2771#[must_use = "FIDL methods require a response to be sent"]
2772#[derive(Debug)]
2773pub struct InjectionStartInputInjectionResponder {
2774 control_handle: std::mem::ManuallyDrop<InjectionControlHandle>,
2775 tx_id: u32,
2776}
2777
2778impl std::ops::Drop for InjectionStartInputInjectionResponder {
2782 fn drop(&mut self) {
2783 self.control_handle.shutdown();
2784 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
2786 }
2787}
2788
2789impl fidl::endpoints::Responder for InjectionStartInputInjectionResponder {
2790 type ControlHandle = InjectionControlHandle;
2791
2792 fn control_handle(&self) -> &InjectionControlHandle {
2793 &self.control_handle
2794 }
2795
2796 fn drop_without_shutdown(mut self) {
2797 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
2799 std::mem::forget(self);
2801 }
2802}
2803
2804impl InjectionStartInputInjectionResponder {
2805 pub fn send(self, mut result: Result<(), AudioTestError>) -> Result<(), fidl::Error> {
2809 let _result = self.send_raw(result);
2810 if _result.is_err() {
2811 self.control_handle.shutdown();
2812 }
2813 self.drop_without_shutdown();
2814 _result
2815 }
2816
2817 pub fn send_no_shutdown_on_err(
2819 self,
2820 mut result: Result<(), AudioTestError>,
2821 ) -> Result<(), fidl::Error> {
2822 let _result = self.send_raw(result);
2823 self.drop_without_shutdown();
2824 _result
2825 }
2826
2827 fn send_raw(&self, mut result: Result<(), AudioTestError>) -> Result<(), fidl::Error> {
2828 self.control_handle.inner.send::<fidl::encoding::ResultType<
2829 fidl::encoding::EmptyStruct,
2830 AudioTestError,
2831 >>(
2832 result,
2833 self.tx_id,
2834 0x753a5415ad966b06,
2835 fidl::encoding::DynamicFlags::empty(),
2836 )
2837 }
2838}
2839
2840#[must_use = "FIDL methods require a response to be sent"]
2841#[derive(Debug)]
2842pub struct InjectionStopInputInjectionResponder {
2843 control_handle: std::mem::ManuallyDrop<InjectionControlHandle>,
2844 tx_id: u32,
2845}
2846
2847impl std::ops::Drop for InjectionStopInputInjectionResponder {
2851 fn drop(&mut self) {
2852 self.control_handle.shutdown();
2853 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
2855 }
2856}
2857
2858impl fidl::endpoints::Responder for InjectionStopInputInjectionResponder {
2859 type ControlHandle = InjectionControlHandle;
2860
2861 fn control_handle(&self) -> &InjectionControlHandle {
2862 &self.control_handle
2863 }
2864
2865 fn drop_without_shutdown(mut self) {
2866 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
2868 std::mem::forget(self);
2870 }
2871}
2872
2873impl InjectionStopInputInjectionResponder {
2874 pub fn send(self, mut result: Result<(), AudioTestError>) -> Result<(), fidl::Error> {
2878 let _result = self.send_raw(result);
2879 if _result.is_err() {
2880 self.control_handle.shutdown();
2881 }
2882 self.drop_without_shutdown();
2883 _result
2884 }
2885
2886 pub fn send_no_shutdown_on_err(
2888 self,
2889 mut result: Result<(), AudioTestError>,
2890 ) -> Result<(), fidl::Error> {
2891 let _result = self.send_raw(result);
2892 self.drop_without_shutdown();
2893 _result
2894 }
2895
2896 fn send_raw(&self, mut result: Result<(), AudioTestError>) -> Result<(), fidl::Error> {
2897 self.control_handle.inner.send::<fidl::encoding::ResultType<
2898 fidl::encoding::EmptyStruct,
2899 AudioTestError,
2900 >>(
2901 result,
2902 self.tx_id,
2903 0x371fce6bb8d77fe,
2904 fidl::encoding::DynamicFlags::empty(),
2905 )
2906 }
2907}
2908
2909mod internal {
2910 use super::*;
2911
2912 impl fidl::encoding::ResourceTypeMarker for CaptureGetOutputAudioResponse {
2913 type Borrowed<'a> = &'a mut Self;
2914 fn take_or_borrow<'a>(
2915 value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
2916 ) -> Self::Borrowed<'a> {
2917 value
2918 }
2919 }
2920
2921 unsafe impl fidl::encoding::TypeMarker for CaptureGetOutputAudioResponse {
2922 type Owned = Self;
2923
2924 #[inline(always)]
2925 fn inline_align(_context: fidl::encoding::Context) -> usize {
2926 4
2927 }
2928
2929 #[inline(always)]
2930 fn inline_size(_context: fidl::encoding::Context) -> usize {
2931 4
2932 }
2933 }
2934
2935 unsafe impl
2936 fidl::encoding::Encode<
2937 CaptureGetOutputAudioResponse,
2938 fidl::encoding::DefaultFuchsiaResourceDialect,
2939 > for &mut CaptureGetOutputAudioResponse
2940 {
2941 #[inline]
2942 unsafe fn encode(
2943 self,
2944 encoder: &mut fidl::encoding::Encoder<
2945 '_,
2946 fidl::encoding::DefaultFuchsiaResourceDialect,
2947 >,
2948 offset: usize,
2949 _depth: fidl::encoding::Depth,
2950 ) -> fidl::Result<()> {
2951 encoder.debug_check_bounds::<CaptureGetOutputAudioResponse>(offset);
2952 fidl::encoding::Encode::<
2954 CaptureGetOutputAudioResponse,
2955 fidl::encoding::DefaultFuchsiaResourceDialect,
2956 >::encode(
2957 (<fidl::encoding::HandleType<
2958 fidl::Socket,
2959 { fidl::ObjectType::SOCKET.into_raw() },
2960 2147483648,
2961 > as fidl::encoding::ResourceTypeMarker>::take_or_borrow(
2962 &mut self.audio_reader
2963 ),),
2964 encoder,
2965 offset,
2966 _depth,
2967 )
2968 }
2969 }
2970 unsafe impl<
2971 T0: fidl::encoding::Encode<
2972 fidl::encoding::HandleType<
2973 fidl::Socket,
2974 { fidl::ObjectType::SOCKET.into_raw() },
2975 2147483648,
2976 >,
2977 fidl::encoding::DefaultFuchsiaResourceDialect,
2978 >,
2979 >
2980 fidl::encoding::Encode<
2981 CaptureGetOutputAudioResponse,
2982 fidl::encoding::DefaultFuchsiaResourceDialect,
2983 > for (T0,)
2984 {
2985 #[inline]
2986 unsafe fn encode(
2987 self,
2988 encoder: &mut fidl::encoding::Encoder<
2989 '_,
2990 fidl::encoding::DefaultFuchsiaResourceDialect,
2991 >,
2992 offset: usize,
2993 depth: fidl::encoding::Depth,
2994 ) -> fidl::Result<()> {
2995 encoder.debug_check_bounds::<CaptureGetOutputAudioResponse>(offset);
2996 self.0.encode(encoder, offset + 0, depth)?;
3000 Ok(())
3001 }
3002 }
3003
3004 impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
3005 for CaptureGetOutputAudioResponse
3006 {
3007 #[inline(always)]
3008 fn new_empty() -> Self {
3009 Self {
3010 audio_reader: fidl::new_empty!(fidl::encoding::HandleType<fidl::Socket, { fidl::ObjectType::SOCKET.into_raw() }, 2147483648>, fidl::encoding::DefaultFuchsiaResourceDialect),
3011 }
3012 }
3013
3014 #[inline]
3015 unsafe fn decode(
3016 &mut self,
3017 decoder: &mut fidl::encoding::Decoder<
3018 '_,
3019 fidl::encoding::DefaultFuchsiaResourceDialect,
3020 >,
3021 offset: usize,
3022 _depth: fidl::encoding::Depth,
3023 ) -> fidl::Result<()> {
3024 decoder.debug_check_bounds::<Self>(offset);
3025 fidl::decode!(fidl::encoding::HandleType<fidl::Socket, { fidl::ObjectType::SOCKET.into_raw() }, 2147483648>, fidl::encoding::DefaultFuchsiaResourceDialect, &mut self.audio_reader, decoder, offset + 0, _depth)?;
3027 Ok(())
3028 }
3029 }
3030
3031 impl fidl::encoding::ResourceTypeMarker for InjectionClearInputAudioRequest {
3032 type Borrowed<'a> = &'a mut Self;
3033 fn take_or_borrow<'a>(
3034 value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
3035 ) -> Self::Borrowed<'a> {
3036 value
3037 }
3038 }
3039
3040 unsafe impl fidl::encoding::TypeMarker for InjectionClearInputAudioRequest {
3041 type Owned = Self;
3042
3043 #[inline(always)]
3044 fn inline_align(_context: fidl::encoding::Context) -> usize {
3045 4
3046 }
3047
3048 #[inline(always)]
3049 fn inline_size(_context: fidl::encoding::Context) -> usize {
3050 4
3051 }
3052 #[inline(always)]
3053 fn encode_is_copy() -> bool {
3054 true
3055 }
3056
3057 #[inline(always)]
3058 fn decode_is_copy() -> bool {
3059 true
3060 }
3061 }
3062
3063 unsafe impl
3064 fidl::encoding::Encode<
3065 InjectionClearInputAudioRequest,
3066 fidl::encoding::DefaultFuchsiaResourceDialect,
3067 > for &mut InjectionClearInputAudioRequest
3068 {
3069 #[inline]
3070 unsafe fn encode(
3071 self,
3072 encoder: &mut fidl::encoding::Encoder<
3073 '_,
3074 fidl::encoding::DefaultFuchsiaResourceDialect,
3075 >,
3076 offset: usize,
3077 _depth: fidl::encoding::Depth,
3078 ) -> fidl::Result<()> {
3079 encoder.debug_check_bounds::<InjectionClearInputAudioRequest>(offset);
3080 unsafe {
3081 let buf_ptr = encoder.buf.as_mut_ptr().add(offset);
3083 (buf_ptr as *mut InjectionClearInputAudioRequest)
3084 .write_unaligned((self as *const InjectionClearInputAudioRequest).read());
3085 }
3088 Ok(())
3089 }
3090 }
3091 unsafe impl<T0: fidl::encoding::Encode<i32, fidl::encoding::DefaultFuchsiaResourceDialect>>
3092 fidl::encoding::Encode<
3093 InjectionClearInputAudioRequest,
3094 fidl::encoding::DefaultFuchsiaResourceDialect,
3095 > for (T0,)
3096 {
3097 #[inline]
3098 unsafe fn encode(
3099 self,
3100 encoder: &mut fidl::encoding::Encoder<
3101 '_,
3102 fidl::encoding::DefaultFuchsiaResourceDialect,
3103 >,
3104 offset: usize,
3105 depth: fidl::encoding::Depth,
3106 ) -> fidl::Result<()> {
3107 encoder.debug_check_bounds::<InjectionClearInputAudioRequest>(offset);
3108 self.0.encode(encoder, offset + 0, depth)?;
3112 Ok(())
3113 }
3114 }
3115
3116 impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
3117 for InjectionClearInputAudioRequest
3118 {
3119 #[inline(always)]
3120 fn new_empty() -> Self {
3121 Self { index: fidl::new_empty!(i32, fidl::encoding::DefaultFuchsiaResourceDialect) }
3122 }
3123
3124 #[inline]
3125 unsafe fn decode(
3126 &mut self,
3127 decoder: &mut fidl::encoding::Decoder<
3128 '_,
3129 fidl::encoding::DefaultFuchsiaResourceDialect,
3130 >,
3131 offset: usize,
3132 _depth: fidl::encoding::Depth,
3133 ) -> fidl::Result<()> {
3134 decoder.debug_check_bounds::<Self>(offset);
3135 let buf_ptr = unsafe { decoder.buf.as_ptr().add(offset) };
3136 unsafe {
3139 std::ptr::copy_nonoverlapping(buf_ptr, self as *mut Self as *mut u8, 4);
3140 }
3141 Ok(())
3142 }
3143 }
3144
3145 impl fidl::encoding::ResourceTypeMarker for InjectionStartInputInjectionRequest {
3146 type Borrowed<'a> = &'a mut Self;
3147 fn take_or_borrow<'a>(
3148 value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
3149 ) -> Self::Borrowed<'a> {
3150 value
3151 }
3152 }
3153
3154 unsafe impl fidl::encoding::TypeMarker for InjectionStartInputInjectionRequest {
3155 type Owned = Self;
3156
3157 #[inline(always)]
3158 fn inline_align(_context: fidl::encoding::Context) -> usize {
3159 4
3160 }
3161
3162 #[inline(always)]
3163 fn inline_size(_context: fidl::encoding::Context) -> usize {
3164 4
3165 }
3166 #[inline(always)]
3167 fn encode_is_copy() -> bool {
3168 true
3169 }
3170
3171 #[inline(always)]
3172 fn decode_is_copy() -> bool {
3173 true
3174 }
3175 }
3176
3177 unsafe impl
3178 fidl::encoding::Encode<
3179 InjectionStartInputInjectionRequest,
3180 fidl::encoding::DefaultFuchsiaResourceDialect,
3181 > for &mut InjectionStartInputInjectionRequest
3182 {
3183 #[inline]
3184 unsafe fn encode(
3185 self,
3186 encoder: &mut fidl::encoding::Encoder<
3187 '_,
3188 fidl::encoding::DefaultFuchsiaResourceDialect,
3189 >,
3190 offset: usize,
3191 _depth: fidl::encoding::Depth,
3192 ) -> fidl::Result<()> {
3193 encoder.debug_check_bounds::<InjectionStartInputInjectionRequest>(offset);
3194 unsafe {
3195 let buf_ptr = encoder.buf.as_mut_ptr().add(offset);
3197 (buf_ptr as *mut InjectionStartInputInjectionRequest)
3198 .write_unaligned((self as *const InjectionStartInputInjectionRequest).read());
3199 }
3202 Ok(())
3203 }
3204 }
3205 unsafe impl<T0: fidl::encoding::Encode<i32, fidl::encoding::DefaultFuchsiaResourceDialect>>
3206 fidl::encoding::Encode<
3207 InjectionStartInputInjectionRequest,
3208 fidl::encoding::DefaultFuchsiaResourceDialect,
3209 > for (T0,)
3210 {
3211 #[inline]
3212 unsafe fn encode(
3213 self,
3214 encoder: &mut fidl::encoding::Encoder<
3215 '_,
3216 fidl::encoding::DefaultFuchsiaResourceDialect,
3217 >,
3218 offset: usize,
3219 depth: fidl::encoding::Depth,
3220 ) -> fidl::Result<()> {
3221 encoder.debug_check_bounds::<InjectionStartInputInjectionRequest>(offset);
3222 self.0.encode(encoder, offset + 0, depth)?;
3226 Ok(())
3227 }
3228 }
3229
3230 impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
3231 for InjectionStartInputInjectionRequest
3232 {
3233 #[inline(always)]
3234 fn new_empty() -> Self {
3235 Self { index: fidl::new_empty!(i32, fidl::encoding::DefaultFuchsiaResourceDialect) }
3236 }
3237
3238 #[inline]
3239 unsafe fn decode(
3240 &mut self,
3241 decoder: &mut fidl::encoding::Decoder<
3242 '_,
3243 fidl::encoding::DefaultFuchsiaResourceDialect,
3244 >,
3245 offset: usize,
3246 _depth: fidl::encoding::Depth,
3247 ) -> fidl::Result<()> {
3248 decoder.debug_check_bounds::<Self>(offset);
3249 let buf_ptr = unsafe { decoder.buf.as_ptr().add(offset) };
3250 unsafe {
3253 std::ptr::copy_nonoverlapping(buf_ptr, self as *mut Self as *mut u8, 4);
3254 }
3255 Ok(())
3256 }
3257 }
3258
3259 impl fidl::encoding::ResourceTypeMarker for InjectionWriteInputAudioRequest {
3260 type Borrowed<'a> = &'a mut Self;
3261 fn take_or_borrow<'a>(
3262 value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
3263 ) -> Self::Borrowed<'a> {
3264 value
3265 }
3266 }
3267
3268 unsafe impl fidl::encoding::TypeMarker for InjectionWriteInputAudioRequest {
3269 type Owned = Self;
3270
3271 #[inline(always)]
3272 fn inline_align(_context: fidl::encoding::Context) -> usize {
3273 4
3274 }
3275
3276 #[inline(always)]
3277 fn inline_size(_context: fidl::encoding::Context) -> usize {
3278 8
3279 }
3280 }
3281
3282 unsafe impl
3283 fidl::encoding::Encode<
3284 InjectionWriteInputAudioRequest,
3285 fidl::encoding::DefaultFuchsiaResourceDialect,
3286 > for &mut InjectionWriteInputAudioRequest
3287 {
3288 #[inline]
3289 unsafe fn encode(
3290 self,
3291 encoder: &mut fidl::encoding::Encoder<
3292 '_,
3293 fidl::encoding::DefaultFuchsiaResourceDialect,
3294 >,
3295 offset: usize,
3296 _depth: fidl::encoding::Depth,
3297 ) -> fidl::Result<()> {
3298 encoder.debug_check_bounds::<InjectionWriteInputAudioRequest>(offset);
3299 fidl::encoding::Encode::<
3301 InjectionWriteInputAudioRequest,
3302 fidl::encoding::DefaultFuchsiaResourceDialect,
3303 >::encode(
3304 (
3305 <i32 as fidl::encoding::ValueTypeMarker>::borrow(&self.index),
3306 <fidl::encoding::HandleType<
3307 fidl::Socket,
3308 { fidl::ObjectType::SOCKET.into_raw() },
3309 2147483648,
3310 > as fidl::encoding::ResourceTypeMarker>::take_or_borrow(
3311 &mut self.audio_writer,
3312 ),
3313 ),
3314 encoder,
3315 offset,
3316 _depth,
3317 )
3318 }
3319 }
3320 unsafe impl<
3321 T0: fidl::encoding::Encode<i32, fidl::encoding::DefaultFuchsiaResourceDialect>,
3322 T1: fidl::encoding::Encode<
3323 fidl::encoding::HandleType<
3324 fidl::Socket,
3325 { fidl::ObjectType::SOCKET.into_raw() },
3326 2147483648,
3327 >,
3328 fidl::encoding::DefaultFuchsiaResourceDialect,
3329 >,
3330 >
3331 fidl::encoding::Encode<
3332 InjectionWriteInputAudioRequest,
3333 fidl::encoding::DefaultFuchsiaResourceDialect,
3334 > for (T0, T1)
3335 {
3336 #[inline]
3337 unsafe fn encode(
3338 self,
3339 encoder: &mut fidl::encoding::Encoder<
3340 '_,
3341 fidl::encoding::DefaultFuchsiaResourceDialect,
3342 >,
3343 offset: usize,
3344 depth: fidl::encoding::Depth,
3345 ) -> fidl::Result<()> {
3346 encoder.debug_check_bounds::<InjectionWriteInputAudioRequest>(offset);
3347 self.0.encode(encoder, offset + 0, depth)?;
3351 self.1.encode(encoder, offset + 4, depth)?;
3352 Ok(())
3353 }
3354 }
3355
3356 impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
3357 for InjectionWriteInputAudioRequest
3358 {
3359 #[inline(always)]
3360 fn new_empty() -> Self {
3361 Self {
3362 index: fidl::new_empty!(i32, fidl::encoding::DefaultFuchsiaResourceDialect),
3363 audio_writer: fidl::new_empty!(fidl::encoding::HandleType<fidl::Socket, { fidl::ObjectType::SOCKET.into_raw() }, 2147483648>, fidl::encoding::DefaultFuchsiaResourceDialect),
3364 }
3365 }
3366
3367 #[inline]
3368 unsafe fn decode(
3369 &mut self,
3370 decoder: &mut fidl::encoding::Decoder<
3371 '_,
3372 fidl::encoding::DefaultFuchsiaResourceDialect,
3373 >,
3374 offset: usize,
3375 _depth: fidl::encoding::Depth,
3376 ) -> fidl::Result<()> {
3377 decoder.debug_check_bounds::<Self>(offset);
3378 fidl::decode!(
3380 i32,
3381 fidl::encoding::DefaultFuchsiaResourceDialect,
3382 &mut self.index,
3383 decoder,
3384 offset + 0,
3385 _depth
3386 )?;
3387 fidl::decode!(fidl::encoding::HandleType<fidl::Socket, { fidl::ObjectType::SOCKET.into_raw() }, 2147483648>, fidl::encoding::DefaultFuchsiaResourceDialect, &mut self.audio_writer, decoder, offset + 4, _depth)?;
3388 Ok(())
3389 }
3390 }
3391}