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_media_audio__common::*;
11use futures::future::{self, MaybeDone, TryFutureExt};
12use zx_status;
13
14#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
15pub struct EffectsControllerMarker;
16
17impl fidl::endpoints::ProtocolMarker for EffectsControllerMarker {
18 type Proxy = EffectsControllerProxy;
19 type RequestStream = EffectsControllerRequestStream;
20 #[cfg(target_os = "fuchsia")]
21 type SynchronousProxy = EffectsControllerSynchronousProxy;
22
23 const DEBUG_NAME: &'static str = "fuchsia.media.audio.EffectsController";
24}
25impl fidl::endpoints::DiscoverableProtocolMarker for EffectsControllerMarker {}
26pub type EffectsControllerUpdateEffectResult = Result<(), UpdateEffectError>;
27
28pub trait EffectsControllerProxyInterface: Send + Sync {
29 type UpdateEffectResponseFut: std::future::Future<Output = Result<EffectsControllerUpdateEffectResult, fidl::Error>>
30 + Send;
31 fn r#update_effect(&self, effect_name: &str, config: &str) -> Self::UpdateEffectResponseFut;
32}
33#[derive(Debug)]
34#[cfg(target_os = "fuchsia")]
35pub struct EffectsControllerSynchronousProxy {
36 client: fidl::client::sync::Client,
37}
38
39#[cfg(target_os = "fuchsia")]
40impl fidl::endpoints::SynchronousProxy for EffectsControllerSynchronousProxy {
41 type Proxy = EffectsControllerProxy;
42 type Protocol = EffectsControllerMarker;
43
44 fn from_channel(inner: fidl::Channel) -> Self {
45 Self::new(inner)
46 }
47
48 fn into_channel(self) -> fidl::Channel {
49 self.client.into_channel()
50 }
51
52 fn as_channel(&self) -> &fidl::Channel {
53 self.client.as_channel()
54 }
55}
56
57#[cfg(target_os = "fuchsia")]
58impl EffectsControllerSynchronousProxy {
59 pub fn new(channel: fidl::Channel) -> Self {
60 let protocol_name =
61 <EffectsControllerMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
62 Self { client: fidl::client::sync::Client::new(channel, protocol_name) }
63 }
64
65 pub fn into_channel(self) -> fidl::Channel {
66 self.client.into_channel()
67 }
68
69 pub fn wait_for_event(
72 &self,
73 deadline: zx::MonotonicInstant,
74 ) -> Result<EffectsControllerEvent, fidl::Error> {
75 EffectsControllerEvent::decode(self.client.wait_for_event(deadline)?)
76 }
77
78 pub fn r#update_effect(
96 &self,
97 mut effect_name: &str,
98 mut config: &str,
99 ___deadline: zx::MonotonicInstant,
100 ) -> Result<EffectsControllerUpdateEffectResult, fidl::Error> {
101 let _response = self.client.send_query::<
102 EffectsControllerUpdateEffectRequest,
103 fidl::encoding::ResultType<fidl::encoding::EmptyStruct, UpdateEffectError>,
104 >(
105 (effect_name, config,),
106 0x4e39e4b5e6279125,
107 fidl::encoding::DynamicFlags::empty(),
108 ___deadline,
109 )?;
110 Ok(_response.map(|x| x))
111 }
112}
113
114#[cfg(target_os = "fuchsia")]
115impl From<EffectsControllerSynchronousProxy> for zx::NullableHandle {
116 fn from(value: EffectsControllerSynchronousProxy) -> Self {
117 value.into_channel().into()
118 }
119}
120
121#[cfg(target_os = "fuchsia")]
122impl From<fidl::Channel> for EffectsControllerSynchronousProxy {
123 fn from(value: fidl::Channel) -> Self {
124 Self::new(value)
125 }
126}
127
128#[cfg(target_os = "fuchsia")]
129impl fidl::endpoints::FromClient for EffectsControllerSynchronousProxy {
130 type Protocol = EffectsControllerMarker;
131
132 fn from_client(value: fidl::endpoints::ClientEnd<EffectsControllerMarker>) -> Self {
133 Self::new(value.into_channel())
134 }
135}
136
137#[derive(Debug, Clone)]
138pub struct EffectsControllerProxy {
139 client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
140}
141
142impl fidl::endpoints::Proxy for EffectsControllerProxy {
143 type Protocol = EffectsControllerMarker;
144
145 fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
146 Self::new(inner)
147 }
148
149 fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
150 self.client.into_channel().map_err(|client| Self { client })
151 }
152
153 fn as_channel(&self) -> &::fidl::AsyncChannel {
154 self.client.as_channel()
155 }
156}
157
158impl EffectsControllerProxy {
159 pub fn new(channel: ::fidl::AsyncChannel) -> Self {
161 let protocol_name =
162 <EffectsControllerMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
163 Self { client: fidl::client::Client::new(channel, protocol_name) }
164 }
165
166 pub fn take_event_stream(&self) -> EffectsControllerEventStream {
172 EffectsControllerEventStream { event_receiver: self.client.take_event_receiver() }
173 }
174
175 pub fn r#update_effect(
193 &self,
194 mut effect_name: &str,
195 mut config: &str,
196 ) -> fidl::client::QueryResponseFut<
197 EffectsControllerUpdateEffectResult,
198 fidl::encoding::DefaultFuchsiaResourceDialect,
199 > {
200 EffectsControllerProxyInterface::r#update_effect(self, effect_name, config)
201 }
202}
203
204impl EffectsControllerProxyInterface for EffectsControllerProxy {
205 type UpdateEffectResponseFut = fidl::client::QueryResponseFut<
206 EffectsControllerUpdateEffectResult,
207 fidl::encoding::DefaultFuchsiaResourceDialect,
208 >;
209 fn r#update_effect(
210 &self,
211 mut effect_name: &str,
212 mut config: &str,
213 ) -> Self::UpdateEffectResponseFut {
214 fn _decode(
215 mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
216 ) -> Result<EffectsControllerUpdateEffectResult, fidl::Error> {
217 let _response = fidl::client::decode_transaction_body::<
218 fidl::encoding::ResultType<fidl::encoding::EmptyStruct, UpdateEffectError>,
219 fidl::encoding::DefaultFuchsiaResourceDialect,
220 0x4e39e4b5e6279125,
221 >(_buf?)?;
222 Ok(_response.map(|x| x))
223 }
224 self.client.send_query_and_decode::<
225 EffectsControllerUpdateEffectRequest,
226 EffectsControllerUpdateEffectResult,
227 >(
228 (effect_name, config,),
229 0x4e39e4b5e6279125,
230 fidl::encoding::DynamicFlags::empty(),
231 _decode,
232 )
233 }
234}
235
236pub struct EffectsControllerEventStream {
237 event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
238}
239
240impl std::marker::Unpin for EffectsControllerEventStream {}
241
242impl futures::stream::FusedStream for EffectsControllerEventStream {
243 fn is_terminated(&self) -> bool {
244 self.event_receiver.is_terminated()
245 }
246}
247
248impl futures::Stream for EffectsControllerEventStream {
249 type Item = Result<EffectsControllerEvent, fidl::Error>;
250
251 fn poll_next(
252 mut self: std::pin::Pin<&mut Self>,
253 cx: &mut std::task::Context<'_>,
254 ) -> std::task::Poll<Option<Self::Item>> {
255 match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
256 &mut self.event_receiver,
257 cx
258 )?) {
259 Some(buf) => std::task::Poll::Ready(Some(EffectsControllerEvent::decode(buf))),
260 None => std::task::Poll::Ready(None),
261 }
262 }
263}
264
265#[derive(Debug)]
266pub enum EffectsControllerEvent {}
267
268impl EffectsControllerEvent {
269 fn decode(
271 mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
272 ) -> Result<EffectsControllerEvent, fidl::Error> {
273 let (bytes, _handles) = buf.split_mut();
274 let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
275 debug_assert_eq!(tx_header.tx_id, 0);
276 match tx_header.ordinal {
277 _ => Err(fidl::Error::UnknownOrdinal {
278 ordinal: tx_header.ordinal,
279 protocol_name:
280 <EffectsControllerMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
281 }),
282 }
283 }
284}
285
286pub struct EffectsControllerRequestStream {
288 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
289 is_terminated: bool,
290}
291
292impl std::marker::Unpin for EffectsControllerRequestStream {}
293
294impl futures::stream::FusedStream for EffectsControllerRequestStream {
295 fn is_terminated(&self) -> bool {
296 self.is_terminated
297 }
298}
299
300impl fidl::endpoints::RequestStream for EffectsControllerRequestStream {
301 type Protocol = EffectsControllerMarker;
302 type ControlHandle = EffectsControllerControlHandle;
303
304 fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
305 Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
306 }
307
308 fn control_handle(&self) -> Self::ControlHandle {
309 EffectsControllerControlHandle { inner: self.inner.clone() }
310 }
311
312 fn into_inner(
313 self,
314 ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
315 {
316 (self.inner, self.is_terminated)
317 }
318
319 fn from_inner(
320 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
321 is_terminated: bool,
322 ) -> Self {
323 Self { inner, is_terminated }
324 }
325}
326
327impl futures::Stream for EffectsControllerRequestStream {
328 type Item = Result<EffectsControllerRequest, fidl::Error>;
329
330 fn poll_next(
331 mut self: std::pin::Pin<&mut Self>,
332 cx: &mut std::task::Context<'_>,
333 ) -> std::task::Poll<Option<Self::Item>> {
334 let this = &mut *self;
335 if this.inner.check_shutdown(cx) {
336 this.is_terminated = true;
337 return std::task::Poll::Ready(None);
338 }
339 if this.is_terminated {
340 panic!("polled EffectsControllerRequestStream after completion");
341 }
342 fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
343 |bytes, handles| {
344 match this.inner.channel().read_etc(cx, bytes, handles) {
345 std::task::Poll::Ready(Ok(())) => {}
346 std::task::Poll::Pending => return std::task::Poll::Pending,
347 std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
348 this.is_terminated = true;
349 return std::task::Poll::Ready(None);
350 }
351 std::task::Poll::Ready(Err(e)) => {
352 return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
353 e.into(),
354 ))));
355 }
356 }
357
358 let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
360
361 std::task::Poll::Ready(Some(match header.ordinal {
362 0x4e39e4b5e6279125 => {
363 header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
364 let mut req = fidl::new_empty!(
365 EffectsControllerUpdateEffectRequest,
366 fidl::encoding::DefaultFuchsiaResourceDialect
367 );
368 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<EffectsControllerUpdateEffectRequest>(&header, _body_bytes, handles, &mut req)?;
369 let control_handle =
370 EffectsControllerControlHandle { inner: this.inner.clone() };
371 Ok(EffectsControllerRequest::UpdateEffect {
372 effect_name: req.effect_name,
373 config: req.config,
374
375 responder: EffectsControllerUpdateEffectResponder {
376 control_handle: std::mem::ManuallyDrop::new(control_handle),
377 tx_id: header.tx_id,
378 },
379 })
380 }
381 _ => Err(fidl::Error::UnknownOrdinal {
382 ordinal: header.ordinal,
383 protocol_name:
384 <EffectsControllerMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
385 }),
386 }))
387 },
388 )
389 }
390}
391
392#[derive(Debug)]
393pub enum EffectsControllerRequest {
394 UpdateEffect {
412 effect_name: String,
413 config: String,
414 responder: EffectsControllerUpdateEffectResponder,
415 },
416}
417
418impl EffectsControllerRequest {
419 #[allow(irrefutable_let_patterns)]
420 pub fn into_update_effect(
421 self,
422 ) -> Option<(String, String, EffectsControllerUpdateEffectResponder)> {
423 if let EffectsControllerRequest::UpdateEffect { effect_name, config, responder } = self {
424 Some((effect_name, config, responder))
425 } else {
426 None
427 }
428 }
429
430 pub fn method_name(&self) -> &'static str {
432 match *self {
433 EffectsControllerRequest::UpdateEffect { .. } => "update_effect",
434 }
435 }
436}
437
438#[derive(Debug, Clone)]
439pub struct EffectsControllerControlHandle {
440 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
441}
442
443impl fidl::endpoints::ControlHandle for EffectsControllerControlHandle {
444 fn shutdown(&self) {
445 self.inner.shutdown()
446 }
447
448 fn shutdown_with_epitaph(&self, status: zx_status::Status) {
449 self.inner.shutdown_with_epitaph(status)
450 }
451
452 fn is_closed(&self) -> bool {
453 self.inner.channel().is_closed()
454 }
455 fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
456 self.inner.channel().on_closed()
457 }
458
459 #[cfg(target_os = "fuchsia")]
460 fn signal_peer(
461 &self,
462 clear_mask: zx::Signals,
463 set_mask: zx::Signals,
464 ) -> Result<(), zx_status::Status> {
465 use fidl::Peered;
466 self.inner.channel().signal_peer(clear_mask, set_mask)
467 }
468}
469
470impl EffectsControllerControlHandle {}
471
472#[must_use = "FIDL methods require a response to be sent"]
473#[derive(Debug)]
474pub struct EffectsControllerUpdateEffectResponder {
475 control_handle: std::mem::ManuallyDrop<EffectsControllerControlHandle>,
476 tx_id: u32,
477}
478
479impl std::ops::Drop for EffectsControllerUpdateEffectResponder {
483 fn drop(&mut self) {
484 self.control_handle.shutdown();
485 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
487 }
488}
489
490impl fidl::endpoints::Responder for EffectsControllerUpdateEffectResponder {
491 type ControlHandle = EffectsControllerControlHandle;
492
493 fn control_handle(&self) -> &EffectsControllerControlHandle {
494 &self.control_handle
495 }
496
497 fn drop_without_shutdown(mut self) {
498 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
500 std::mem::forget(self);
502 }
503}
504
505impl EffectsControllerUpdateEffectResponder {
506 pub fn send(self, mut result: Result<(), UpdateEffectError>) -> Result<(), fidl::Error> {
510 let _result = self.send_raw(result);
511 if _result.is_err() {
512 self.control_handle.shutdown();
513 }
514 self.drop_without_shutdown();
515 _result
516 }
517
518 pub fn send_no_shutdown_on_err(
520 self,
521 mut result: Result<(), UpdateEffectError>,
522 ) -> Result<(), fidl::Error> {
523 let _result = self.send_raw(result);
524 self.drop_without_shutdown();
525 _result
526 }
527
528 fn send_raw(&self, mut result: Result<(), UpdateEffectError>) -> Result<(), fidl::Error> {
529 self.control_handle.inner.send::<fidl::encoding::ResultType<
530 fidl::encoding::EmptyStruct,
531 UpdateEffectError,
532 >>(
533 result,
534 self.tx_id,
535 0x4e39e4b5e6279125,
536 fidl::encoding::DynamicFlags::empty(),
537 )
538 }
539}
540
541#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
542pub struct GainControlMarker;
543
544impl fidl::endpoints::ProtocolMarker for GainControlMarker {
545 type Proxy = GainControlProxy;
546 type RequestStream = GainControlRequestStream;
547 #[cfg(target_os = "fuchsia")]
548 type SynchronousProxy = GainControlSynchronousProxy;
549
550 const DEBUG_NAME: &'static str = "(anonymous) GainControl";
551}
552
553pub trait GainControlProxyInterface: Send + Sync {
554 fn r#set_gain(&self, gain_db: f32) -> Result<(), fidl::Error>;
555 fn r#set_gain_with_ramp(
556 &self,
557 gain_db: f32,
558 duration: i64,
559 ramp_type: RampType,
560 ) -> Result<(), fidl::Error>;
561 fn r#set_mute(&self, muted: bool) -> Result<(), fidl::Error>;
562}
563#[derive(Debug)]
564#[cfg(target_os = "fuchsia")]
565pub struct GainControlSynchronousProxy {
566 client: fidl::client::sync::Client,
567}
568
569#[cfg(target_os = "fuchsia")]
570impl fidl::endpoints::SynchronousProxy for GainControlSynchronousProxy {
571 type Proxy = GainControlProxy;
572 type Protocol = GainControlMarker;
573
574 fn from_channel(inner: fidl::Channel) -> Self {
575 Self::new(inner)
576 }
577
578 fn into_channel(self) -> fidl::Channel {
579 self.client.into_channel()
580 }
581
582 fn as_channel(&self) -> &fidl::Channel {
583 self.client.as_channel()
584 }
585}
586
587#[cfg(target_os = "fuchsia")]
588impl GainControlSynchronousProxy {
589 pub fn new(channel: fidl::Channel) -> Self {
590 let protocol_name = <GainControlMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
591 Self { client: fidl::client::sync::Client::new(channel, protocol_name) }
592 }
593
594 pub fn into_channel(self) -> fidl::Channel {
595 self.client.into_channel()
596 }
597
598 pub fn wait_for_event(
601 &self,
602 deadline: zx::MonotonicInstant,
603 ) -> Result<GainControlEvent, fidl::Error> {
604 GainControlEvent::decode(self.client.wait_for_event(deadline)?)
605 }
606
607 pub fn r#set_gain(&self, mut gain_db: f32) -> Result<(), fidl::Error> {
609 self.client.send::<GainControlSetGainRequest>(
610 (gain_db,),
611 0x2fc070871d033f64,
612 fidl::encoding::DynamicFlags::empty(),
613 )
614 }
615
616 pub fn r#set_gain_with_ramp(
653 &self,
654 mut gain_db: f32,
655 mut duration: i64,
656 mut ramp_type: RampType,
657 ) -> Result<(), fidl::Error> {
658 self.client.send::<GainControlSetGainWithRampRequest>(
659 (gain_db, duration, ramp_type),
660 0x3a175b2d6979e8ea,
661 fidl::encoding::DynamicFlags::empty(),
662 )
663 }
664
665 pub fn r#set_mute(&self, mut muted: bool) -> Result<(), fidl::Error> {
668 self.client.send::<GainControlSetMuteRequest>(
669 (muted,),
670 0x5415723c1e31448,
671 fidl::encoding::DynamicFlags::empty(),
672 )
673 }
674}
675
676#[cfg(target_os = "fuchsia")]
677impl From<GainControlSynchronousProxy> for zx::NullableHandle {
678 fn from(value: GainControlSynchronousProxy) -> Self {
679 value.into_channel().into()
680 }
681}
682
683#[cfg(target_os = "fuchsia")]
684impl From<fidl::Channel> for GainControlSynchronousProxy {
685 fn from(value: fidl::Channel) -> Self {
686 Self::new(value)
687 }
688}
689
690#[cfg(target_os = "fuchsia")]
691impl fidl::endpoints::FromClient for GainControlSynchronousProxy {
692 type Protocol = GainControlMarker;
693
694 fn from_client(value: fidl::endpoints::ClientEnd<GainControlMarker>) -> Self {
695 Self::new(value.into_channel())
696 }
697}
698
699#[derive(Debug, Clone)]
700pub struct GainControlProxy {
701 client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
702}
703
704impl fidl::endpoints::Proxy for GainControlProxy {
705 type Protocol = GainControlMarker;
706
707 fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
708 Self::new(inner)
709 }
710
711 fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
712 self.client.into_channel().map_err(|client| Self { client })
713 }
714
715 fn as_channel(&self) -> &::fidl::AsyncChannel {
716 self.client.as_channel()
717 }
718}
719
720impl GainControlProxy {
721 pub fn new(channel: ::fidl::AsyncChannel) -> Self {
723 let protocol_name = <GainControlMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
724 Self { client: fidl::client::Client::new(channel, protocol_name) }
725 }
726
727 pub fn take_event_stream(&self) -> GainControlEventStream {
733 GainControlEventStream { event_receiver: self.client.take_event_receiver() }
734 }
735
736 pub fn r#set_gain(&self, mut gain_db: f32) -> Result<(), fidl::Error> {
738 GainControlProxyInterface::r#set_gain(self, gain_db)
739 }
740
741 pub fn r#set_gain_with_ramp(
778 &self,
779 mut gain_db: f32,
780 mut duration: i64,
781 mut ramp_type: RampType,
782 ) -> Result<(), fidl::Error> {
783 GainControlProxyInterface::r#set_gain_with_ramp(self, gain_db, duration, ramp_type)
784 }
785
786 pub fn r#set_mute(&self, mut muted: bool) -> Result<(), fidl::Error> {
789 GainControlProxyInterface::r#set_mute(self, muted)
790 }
791}
792
793impl GainControlProxyInterface for GainControlProxy {
794 fn r#set_gain(&self, mut gain_db: f32) -> Result<(), fidl::Error> {
795 self.client.send::<GainControlSetGainRequest>(
796 (gain_db,),
797 0x2fc070871d033f64,
798 fidl::encoding::DynamicFlags::empty(),
799 )
800 }
801
802 fn r#set_gain_with_ramp(
803 &self,
804 mut gain_db: f32,
805 mut duration: i64,
806 mut ramp_type: RampType,
807 ) -> Result<(), fidl::Error> {
808 self.client.send::<GainControlSetGainWithRampRequest>(
809 (gain_db, duration, ramp_type),
810 0x3a175b2d6979e8ea,
811 fidl::encoding::DynamicFlags::empty(),
812 )
813 }
814
815 fn r#set_mute(&self, mut muted: bool) -> Result<(), fidl::Error> {
816 self.client.send::<GainControlSetMuteRequest>(
817 (muted,),
818 0x5415723c1e31448,
819 fidl::encoding::DynamicFlags::empty(),
820 )
821 }
822}
823
824pub struct GainControlEventStream {
825 event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
826}
827
828impl std::marker::Unpin for GainControlEventStream {}
829
830impl futures::stream::FusedStream for GainControlEventStream {
831 fn is_terminated(&self) -> bool {
832 self.event_receiver.is_terminated()
833 }
834}
835
836impl futures::Stream for GainControlEventStream {
837 type Item = Result<GainControlEvent, fidl::Error>;
838
839 fn poll_next(
840 mut self: std::pin::Pin<&mut Self>,
841 cx: &mut std::task::Context<'_>,
842 ) -> std::task::Poll<Option<Self::Item>> {
843 match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
844 &mut self.event_receiver,
845 cx
846 )?) {
847 Some(buf) => std::task::Poll::Ready(Some(GainControlEvent::decode(buf))),
848 None => std::task::Poll::Ready(None),
849 }
850 }
851}
852
853#[derive(Debug)]
854pub enum GainControlEvent {
855 OnGainMuteChanged { gain_db: f32, muted: bool },
856}
857
858impl GainControlEvent {
859 #[allow(irrefutable_let_patterns)]
860 pub fn into_on_gain_mute_changed(self) -> Option<(f32, bool)> {
861 if let GainControlEvent::OnGainMuteChanged { gain_db, muted } = self {
862 Some((gain_db, muted))
863 } else {
864 None
865 }
866 }
867
868 fn decode(
870 mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
871 ) -> Result<GainControlEvent, fidl::Error> {
872 let (bytes, _handles) = buf.split_mut();
873 let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
874 debug_assert_eq!(tx_header.tx_id, 0);
875 match tx_header.ordinal {
876 0x66d528cad4e0d753 => {
877 let mut out = fidl::new_empty!(
878 GainControlOnGainMuteChangedRequest,
879 fidl::encoding::DefaultFuchsiaResourceDialect
880 );
881 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<GainControlOnGainMuteChangedRequest>(&tx_header, _body_bytes, _handles, &mut out)?;
882 Ok((GainControlEvent::OnGainMuteChanged { gain_db: out.gain_db, muted: out.muted }))
883 }
884 _ => Err(fidl::Error::UnknownOrdinal {
885 ordinal: tx_header.ordinal,
886 protocol_name: <GainControlMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
887 }),
888 }
889 }
890}
891
892pub struct GainControlRequestStream {
894 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
895 is_terminated: bool,
896}
897
898impl std::marker::Unpin for GainControlRequestStream {}
899
900impl futures::stream::FusedStream for GainControlRequestStream {
901 fn is_terminated(&self) -> bool {
902 self.is_terminated
903 }
904}
905
906impl fidl::endpoints::RequestStream for GainControlRequestStream {
907 type Protocol = GainControlMarker;
908 type ControlHandle = GainControlControlHandle;
909
910 fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
911 Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
912 }
913
914 fn control_handle(&self) -> Self::ControlHandle {
915 GainControlControlHandle { inner: self.inner.clone() }
916 }
917
918 fn into_inner(
919 self,
920 ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
921 {
922 (self.inner, self.is_terminated)
923 }
924
925 fn from_inner(
926 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
927 is_terminated: bool,
928 ) -> Self {
929 Self { inner, is_terminated }
930 }
931}
932
933impl futures::Stream for GainControlRequestStream {
934 type Item = Result<GainControlRequest, fidl::Error>;
935
936 fn poll_next(
937 mut self: std::pin::Pin<&mut Self>,
938 cx: &mut std::task::Context<'_>,
939 ) -> std::task::Poll<Option<Self::Item>> {
940 let this = &mut *self;
941 if this.inner.check_shutdown(cx) {
942 this.is_terminated = true;
943 return std::task::Poll::Ready(None);
944 }
945 if this.is_terminated {
946 panic!("polled GainControlRequestStream after completion");
947 }
948 fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
949 |bytes, handles| {
950 match this.inner.channel().read_etc(cx, bytes, handles) {
951 std::task::Poll::Ready(Ok(())) => {}
952 std::task::Poll::Pending => return std::task::Poll::Pending,
953 std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
954 this.is_terminated = true;
955 return std::task::Poll::Ready(None);
956 }
957 std::task::Poll::Ready(Err(e)) => {
958 return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
959 e.into(),
960 ))));
961 }
962 }
963
964 let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
966
967 std::task::Poll::Ready(Some(match header.ordinal {
968 0x2fc070871d033f64 => {
969 header.validate_request_tx_id(fidl::MethodType::OneWay)?;
970 let mut req = fidl::new_empty!(
971 GainControlSetGainRequest,
972 fidl::encoding::DefaultFuchsiaResourceDialect
973 );
974 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<GainControlSetGainRequest>(&header, _body_bytes, handles, &mut req)?;
975 let control_handle = GainControlControlHandle { inner: this.inner.clone() };
976 Ok(GainControlRequest::SetGain { gain_db: req.gain_db, control_handle })
977 }
978 0x3a175b2d6979e8ea => {
979 header.validate_request_tx_id(fidl::MethodType::OneWay)?;
980 let mut req = fidl::new_empty!(
981 GainControlSetGainWithRampRequest,
982 fidl::encoding::DefaultFuchsiaResourceDialect
983 );
984 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<GainControlSetGainWithRampRequest>(&header, _body_bytes, handles, &mut req)?;
985 let control_handle = GainControlControlHandle { inner: this.inner.clone() };
986 Ok(GainControlRequest::SetGainWithRamp {
987 gain_db: req.gain_db,
988 duration: req.duration,
989 ramp_type: req.ramp_type,
990
991 control_handle,
992 })
993 }
994 0x5415723c1e31448 => {
995 header.validate_request_tx_id(fidl::MethodType::OneWay)?;
996 let mut req = fidl::new_empty!(
997 GainControlSetMuteRequest,
998 fidl::encoding::DefaultFuchsiaResourceDialect
999 );
1000 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<GainControlSetMuteRequest>(&header, _body_bytes, handles, &mut req)?;
1001 let control_handle = GainControlControlHandle { inner: this.inner.clone() };
1002 Ok(GainControlRequest::SetMute { muted: req.muted, control_handle })
1003 }
1004 _ => Err(fidl::Error::UnknownOrdinal {
1005 ordinal: header.ordinal,
1006 protocol_name:
1007 <GainControlMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
1008 }),
1009 }))
1010 },
1011 )
1012 }
1013}
1014
1015#[derive(Debug)]
1020pub enum GainControlRequest {
1021 SetGain { gain_db: f32, control_handle: GainControlControlHandle },
1023 SetGainWithRamp {
1060 gain_db: f32,
1061 duration: i64,
1062 ramp_type: RampType,
1063 control_handle: GainControlControlHandle,
1064 },
1065 SetMute { muted: bool, control_handle: GainControlControlHandle },
1068}
1069
1070impl GainControlRequest {
1071 #[allow(irrefutable_let_patterns)]
1072 pub fn into_set_gain(self) -> Option<(f32, GainControlControlHandle)> {
1073 if let GainControlRequest::SetGain { gain_db, control_handle } = self {
1074 Some((gain_db, control_handle))
1075 } else {
1076 None
1077 }
1078 }
1079
1080 #[allow(irrefutable_let_patterns)]
1081 pub fn into_set_gain_with_ramp(self) -> Option<(f32, i64, RampType, GainControlControlHandle)> {
1082 if let GainControlRequest::SetGainWithRamp {
1083 gain_db,
1084 duration,
1085 ramp_type,
1086 control_handle,
1087 } = self
1088 {
1089 Some((gain_db, duration, ramp_type, control_handle))
1090 } else {
1091 None
1092 }
1093 }
1094
1095 #[allow(irrefutable_let_patterns)]
1096 pub fn into_set_mute(self) -> Option<(bool, GainControlControlHandle)> {
1097 if let GainControlRequest::SetMute { muted, control_handle } = self {
1098 Some((muted, control_handle))
1099 } else {
1100 None
1101 }
1102 }
1103
1104 pub fn method_name(&self) -> &'static str {
1106 match *self {
1107 GainControlRequest::SetGain { .. } => "set_gain",
1108 GainControlRequest::SetGainWithRamp { .. } => "set_gain_with_ramp",
1109 GainControlRequest::SetMute { .. } => "set_mute",
1110 }
1111 }
1112}
1113
1114#[derive(Debug, Clone)]
1115pub struct GainControlControlHandle {
1116 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
1117}
1118
1119impl fidl::endpoints::ControlHandle for GainControlControlHandle {
1120 fn shutdown(&self) {
1121 self.inner.shutdown()
1122 }
1123
1124 fn shutdown_with_epitaph(&self, status: zx_status::Status) {
1125 self.inner.shutdown_with_epitaph(status)
1126 }
1127
1128 fn is_closed(&self) -> bool {
1129 self.inner.channel().is_closed()
1130 }
1131 fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
1132 self.inner.channel().on_closed()
1133 }
1134
1135 #[cfg(target_os = "fuchsia")]
1136 fn signal_peer(
1137 &self,
1138 clear_mask: zx::Signals,
1139 set_mask: zx::Signals,
1140 ) -> Result<(), zx_status::Status> {
1141 use fidl::Peered;
1142 self.inner.channel().signal_peer(clear_mask, set_mask)
1143 }
1144}
1145
1146impl GainControlControlHandle {
1147 pub fn send_on_gain_mute_changed(
1148 &self,
1149 mut gain_db: f32,
1150 mut muted: bool,
1151 ) -> Result<(), fidl::Error> {
1152 self.inner.send::<GainControlOnGainMuteChangedRequest>(
1153 (gain_db, muted),
1154 0,
1155 0x66d528cad4e0d753,
1156 fidl::encoding::DynamicFlags::empty(),
1157 )
1158 }
1159}
1160
1161#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
1162pub struct VolumeControlMarker;
1163
1164impl fidl::endpoints::ProtocolMarker for VolumeControlMarker {
1165 type Proxy = VolumeControlProxy;
1166 type RequestStream = VolumeControlRequestStream;
1167 #[cfg(target_os = "fuchsia")]
1168 type SynchronousProxy = VolumeControlSynchronousProxy;
1169
1170 const DEBUG_NAME: &'static str = "(anonymous) VolumeControl";
1171}
1172
1173pub trait VolumeControlProxyInterface: Send + Sync {
1174 fn r#set_volume(&self, volume: f32) -> Result<(), fidl::Error>;
1175 fn r#set_mute(&self, mute: bool) -> Result<(), fidl::Error>;
1176}
1177#[derive(Debug)]
1178#[cfg(target_os = "fuchsia")]
1179pub struct VolumeControlSynchronousProxy {
1180 client: fidl::client::sync::Client,
1181}
1182
1183#[cfg(target_os = "fuchsia")]
1184impl fidl::endpoints::SynchronousProxy for VolumeControlSynchronousProxy {
1185 type Proxy = VolumeControlProxy;
1186 type Protocol = VolumeControlMarker;
1187
1188 fn from_channel(inner: fidl::Channel) -> Self {
1189 Self::new(inner)
1190 }
1191
1192 fn into_channel(self) -> fidl::Channel {
1193 self.client.into_channel()
1194 }
1195
1196 fn as_channel(&self) -> &fidl::Channel {
1197 self.client.as_channel()
1198 }
1199}
1200
1201#[cfg(target_os = "fuchsia")]
1202impl VolumeControlSynchronousProxy {
1203 pub fn new(channel: fidl::Channel) -> Self {
1204 let protocol_name = <VolumeControlMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
1205 Self { client: fidl::client::sync::Client::new(channel, protocol_name) }
1206 }
1207
1208 pub fn into_channel(self) -> fidl::Channel {
1209 self.client.into_channel()
1210 }
1211
1212 pub fn wait_for_event(
1215 &self,
1216 deadline: zx::MonotonicInstant,
1217 ) -> Result<VolumeControlEvent, fidl::Error> {
1218 VolumeControlEvent::decode(self.client.wait_for_event(deadline)?)
1219 }
1220
1221 pub fn r#set_volume(&self, mut volume: f32) -> Result<(), fidl::Error> {
1225 self.client.send::<VolumeControlSetVolumeRequest>(
1226 (volume,),
1227 0x6ff4231809a697da,
1228 fidl::encoding::DynamicFlags::empty(),
1229 )
1230 }
1231
1232 pub fn r#set_mute(&self, mut mute: bool) -> Result<(), fidl::Error> {
1237 self.client.send::<VolumeControlSetMuteRequest>(
1238 (mute,),
1239 0x50c10c28bba46425,
1240 fidl::encoding::DynamicFlags::empty(),
1241 )
1242 }
1243}
1244
1245#[cfg(target_os = "fuchsia")]
1246impl From<VolumeControlSynchronousProxy> for zx::NullableHandle {
1247 fn from(value: VolumeControlSynchronousProxy) -> Self {
1248 value.into_channel().into()
1249 }
1250}
1251
1252#[cfg(target_os = "fuchsia")]
1253impl From<fidl::Channel> for VolumeControlSynchronousProxy {
1254 fn from(value: fidl::Channel) -> Self {
1255 Self::new(value)
1256 }
1257}
1258
1259#[cfg(target_os = "fuchsia")]
1260impl fidl::endpoints::FromClient for VolumeControlSynchronousProxy {
1261 type Protocol = VolumeControlMarker;
1262
1263 fn from_client(value: fidl::endpoints::ClientEnd<VolumeControlMarker>) -> Self {
1264 Self::new(value.into_channel())
1265 }
1266}
1267
1268#[derive(Debug, Clone)]
1269pub struct VolumeControlProxy {
1270 client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
1271}
1272
1273impl fidl::endpoints::Proxy for VolumeControlProxy {
1274 type Protocol = VolumeControlMarker;
1275
1276 fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
1277 Self::new(inner)
1278 }
1279
1280 fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
1281 self.client.into_channel().map_err(|client| Self { client })
1282 }
1283
1284 fn as_channel(&self) -> &::fidl::AsyncChannel {
1285 self.client.as_channel()
1286 }
1287}
1288
1289impl VolumeControlProxy {
1290 pub fn new(channel: ::fidl::AsyncChannel) -> Self {
1292 let protocol_name = <VolumeControlMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
1293 Self { client: fidl::client::Client::new(channel, protocol_name) }
1294 }
1295
1296 pub fn take_event_stream(&self) -> VolumeControlEventStream {
1302 VolumeControlEventStream { event_receiver: self.client.take_event_receiver() }
1303 }
1304
1305 pub fn r#set_volume(&self, mut volume: f32) -> Result<(), fidl::Error> {
1309 VolumeControlProxyInterface::r#set_volume(self, volume)
1310 }
1311
1312 pub fn r#set_mute(&self, mut mute: bool) -> Result<(), fidl::Error> {
1317 VolumeControlProxyInterface::r#set_mute(self, mute)
1318 }
1319}
1320
1321impl VolumeControlProxyInterface for VolumeControlProxy {
1322 fn r#set_volume(&self, mut volume: f32) -> Result<(), fidl::Error> {
1323 self.client.send::<VolumeControlSetVolumeRequest>(
1324 (volume,),
1325 0x6ff4231809a697da,
1326 fidl::encoding::DynamicFlags::empty(),
1327 )
1328 }
1329
1330 fn r#set_mute(&self, mut mute: bool) -> Result<(), fidl::Error> {
1331 self.client.send::<VolumeControlSetMuteRequest>(
1332 (mute,),
1333 0x50c10c28bba46425,
1334 fidl::encoding::DynamicFlags::empty(),
1335 )
1336 }
1337}
1338
1339pub struct VolumeControlEventStream {
1340 event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
1341}
1342
1343impl std::marker::Unpin for VolumeControlEventStream {}
1344
1345impl futures::stream::FusedStream for VolumeControlEventStream {
1346 fn is_terminated(&self) -> bool {
1347 self.event_receiver.is_terminated()
1348 }
1349}
1350
1351impl futures::Stream for VolumeControlEventStream {
1352 type Item = Result<VolumeControlEvent, fidl::Error>;
1353
1354 fn poll_next(
1355 mut self: std::pin::Pin<&mut Self>,
1356 cx: &mut std::task::Context<'_>,
1357 ) -> std::task::Poll<Option<Self::Item>> {
1358 match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
1359 &mut self.event_receiver,
1360 cx
1361 )?) {
1362 Some(buf) => std::task::Poll::Ready(Some(VolumeControlEvent::decode(buf))),
1363 None => std::task::Poll::Ready(None),
1364 }
1365 }
1366}
1367
1368#[derive(Debug)]
1369pub enum VolumeControlEvent {
1370 OnVolumeMuteChanged { new_volume: f32, new_muted: bool },
1371}
1372
1373impl VolumeControlEvent {
1374 #[allow(irrefutable_let_patterns)]
1375 pub fn into_on_volume_mute_changed(self) -> Option<(f32, bool)> {
1376 if let VolumeControlEvent::OnVolumeMuteChanged { new_volume, new_muted } = self {
1377 Some((new_volume, new_muted))
1378 } else {
1379 None
1380 }
1381 }
1382
1383 fn decode(
1385 mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
1386 ) -> Result<VolumeControlEvent, fidl::Error> {
1387 let (bytes, _handles) = buf.split_mut();
1388 let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
1389 debug_assert_eq!(tx_header.tx_id, 0);
1390 match tx_header.ordinal {
1391 0x9cea352bd86c171 => {
1392 let mut out = fidl::new_empty!(
1393 VolumeControlOnVolumeMuteChangedRequest,
1394 fidl::encoding::DefaultFuchsiaResourceDialect
1395 );
1396 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<VolumeControlOnVolumeMuteChangedRequest>(&tx_header, _body_bytes, _handles, &mut out)?;
1397 Ok((VolumeControlEvent::OnVolumeMuteChanged {
1398 new_volume: out.new_volume,
1399 new_muted: out.new_muted,
1400 }))
1401 }
1402 _ => Err(fidl::Error::UnknownOrdinal {
1403 ordinal: tx_header.ordinal,
1404 protocol_name: <VolumeControlMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
1405 }),
1406 }
1407 }
1408}
1409
1410pub struct VolumeControlRequestStream {
1412 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
1413 is_terminated: bool,
1414}
1415
1416impl std::marker::Unpin for VolumeControlRequestStream {}
1417
1418impl futures::stream::FusedStream for VolumeControlRequestStream {
1419 fn is_terminated(&self) -> bool {
1420 self.is_terminated
1421 }
1422}
1423
1424impl fidl::endpoints::RequestStream for VolumeControlRequestStream {
1425 type Protocol = VolumeControlMarker;
1426 type ControlHandle = VolumeControlControlHandle;
1427
1428 fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
1429 Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
1430 }
1431
1432 fn control_handle(&self) -> Self::ControlHandle {
1433 VolumeControlControlHandle { inner: self.inner.clone() }
1434 }
1435
1436 fn into_inner(
1437 self,
1438 ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
1439 {
1440 (self.inner, self.is_terminated)
1441 }
1442
1443 fn from_inner(
1444 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
1445 is_terminated: bool,
1446 ) -> Self {
1447 Self { inner, is_terminated }
1448 }
1449}
1450
1451impl futures::Stream for VolumeControlRequestStream {
1452 type Item = Result<VolumeControlRequest, fidl::Error>;
1453
1454 fn poll_next(
1455 mut self: std::pin::Pin<&mut Self>,
1456 cx: &mut std::task::Context<'_>,
1457 ) -> std::task::Poll<Option<Self::Item>> {
1458 let this = &mut *self;
1459 if this.inner.check_shutdown(cx) {
1460 this.is_terminated = true;
1461 return std::task::Poll::Ready(None);
1462 }
1463 if this.is_terminated {
1464 panic!("polled VolumeControlRequestStream after completion");
1465 }
1466 fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
1467 |bytes, handles| {
1468 match this.inner.channel().read_etc(cx, bytes, handles) {
1469 std::task::Poll::Ready(Ok(())) => {}
1470 std::task::Poll::Pending => return std::task::Poll::Pending,
1471 std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
1472 this.is_terminated = true;
1473 return std::task::Poll::Ready(None);
1474 }
1475 std::task::Poll::Ready(Err(e)) => {
1476 return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
1477 e.into(),
1478 ))));
1479 }
1480 }
1481
1482 let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
1484
1485 std::task::Poll::Ready(Some(match header.ordinal {
1486 0x6ff4231809a697da => {
1487 header.validate_request_tx_id(fidl::MethodType::OneWay)?;
1488 let mut req = fidl::new_empty!(
1489 VolumeControlSetVolumeRequest,
1490 fidl::encoding::DefaultFuchsiaResourceDialect
1491 );
1492 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<VolumeControlSetVolumeRequest>(&header, _body_bytes, handles, &mut req)?;
1493 let control_handle =
1494 VolumeControlControlHandle { inner: this.inner.clone() };
1495 Ok(VolumeControlRequest::SetVolume { volume: req.volume, control_handle })
1496 }
1497 0x50c10c28bba46425 => {
1498 header.validate_request_tx_id(fidl::MethodType::OneWay)?;
1499 let mut req = fidl::new_empty!(
1500 VolumeControlSetMuteRequest,
1501 fidl::encoding::DefaultFuchsiaResourceDialect
1502 );
1503 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<VolumeControlSetMuteRequest>(&header, _body_bytes, handles, &mut req)?;
1504 let control_handle =
1505 VolumeControlControlHandle { inner: this.inner.clone() };
1506 Ok(VolumeControlRequest::SetMute { mute: req.mute, control_handle })
1507 }
1508 _ => Err(fidl::Error::UnknownOrdinal {
1509 ordinal: header.ordinal,
1510 protocol_name:
1511 <VolumeControlMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
1512 }),
1513 }))
1514 },
1515 )
1516 }
1517}
1518
1519#[derive(Debug)]
1521pub enum VolumeControlRequest {
1522 SetVolume { volume: f32, control_handle: VolumeControlControlHandle },
1526 SetMute { mute: bool, control_handle: VolumeControlControlHandle },
1531}
1532
1533impl VolumeControlRequest {
1534 #[allow(irrefutable_let_patterns)]
1535 pub fn into_set_volume(self) -> Option<(f32, VolumeControlControlHandle)> {
1536 if let VolumeControlRequest::SetVolume { volume, control_handle } = self {
1537 Some((volume, control_handle))
1538 } else {
1539 None
1540 }
1541 }
1542
1543 #[allow(irrefutable_let_patterns)]
1544 pub fn into_set_mute(self) -> Option<(bool, VolumeControlControlHandle)> {
1545 if let VolumeControlRequest::SetMute { mute, control_handle } = self {
1546 Some((mute, control_handle))
1547 } else {
1548 None
1549 }
1550 }
1551
1552 pub fn method_name(&self) -> &'static str {
1554 match *self {
1555 VolumeControlRequest::SetVolume { .. } => "set_volume",
1556 VolumeControlRequest::SetMute { .. } => "set_mute",
1557 }
1558 }
1559}
1560
1561#[derive(Debug, Clone)]
1562pub struct VolumeControlControlHandle {
1563 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
1564}
1565
1566impl fidl::endpoints::ControlHandle for VolumeControlControlHandle {
1567 fn shutdown(&self) {
1568 self.inner.shutdown()
1569 }
1570
1571 fn shutdown_with_epitaph(&self, status: zx_status::Status) {
1572 self.inner.shutdown_with_epitaph(status)
1573 }
1574
1575 fn is_closed(&self) -> bool {
1576 self.inner.channel().is_closed()
1577 }
1578 fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
1579 self.inner.channel().on_closed()
1580 }
1581
1582 #[cfg(target_os = "fuchsia")]
1583 fn signal_peer(
1584 &self,
1585 clear_mask: zx::Signals,
1586 set_mask: zx::Signals,
1587 ) -> Result<(), zx_status::Status> {
1588 use fidl::Peered;
1589 self.inner.channel().signal_peer(clear_mask, set_mask)
1590 }
1591}
1592
1593impl VolumeControlControlHandle {
1594 pub fn send_on_volume_mute_changed(
1595 &self,
1596 mut new_volume: f32,
1597 mut new_muted: bool,
1598 ) -> Result<(), fidl::Error> {
1599 self.inner.send::<VolumeControlOnVolumeMuteChangedRequest>(
1600 (new_volume, new_muted),
1601 0,
1602 0x9cea352bd86c171,
1603 fidl::encoding::DynamicFlags::empty(),
1604 )
1605 }
1606}
1607
1608mod internal {
1609 use super::*;
1610}