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