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 fidl::endpoints::ControlHandle for EffectsControllerControlHandle {
445 fn shutdown(&self) {
446 self.inner.shutdown()
447 }
448
449 fn shutdown_with_epitaph(&self, status: zx_status::Status) {
450 self.inner.shutdown_with_epitaph(status)
451 }
452
453 fn is_closed(&self) -> bool {
454 self.inner.channel().is_closed()
455 }
456 fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
457 self.inner.channel().on_closed()
458 }
459
460 #[cfg(target_os = "fuchsia")]
461 fn signal_peer(
462 &self,
463 clear_mask: zx::Signals,
464 set_mask: zx::Signals,
465 ) -> Result<(), zx_status::Status> {
466 use fidl::Peered;
467 self.inner.channel().signal_peer(clear_mask, set_mask)
468 }
469}
470
471impl EffectsControllerControlHandle {}
472
473#[must_use = "FIDL methods require a response to be sent"]
474#[derive(Debug)]
475pub struct EffectsControllerUpdateEffectResponder {
476 control_handle: std::mem::ManuallyDrop<EffectsControllerControlHandle>,
477 tx_id: u32,
478}
479
480impl std::ops::Drop for EffectsControllerUpdateEffectResponder {
484 fn drop(&mut self) {
485 self.control_handle.shutdown();
486 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
488 }
489}
490
491impl fidl::endpoints::Responder for EffectsControllerUpdateEffectResponder {
492 type ControlHandle = EffectsControllerControlHandle;
493
494 fn control_handle(&self) -> &EffectsControllerControlHandle {
495 &self.control_handle
496 }
497
498 fn drop_without_shutdown(mut self) {
499 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
501 std::mem::forget(self);
503 }
504}
505
506impl EffectsControllerUpdateEffectResponder {
507 pub fn send(self, mut result: Result<(), UpdateEffectError>) -> Result<(), fidl::Error> {
511 let _result = self.send_raw(result);
512 if _result.is_err() {
513 self.control_handle.shutdown();
514 }
515 self.drop_without_shutdown();
516 _result
517 }
518
519 pub fn send_no_shutdown_on_err(
521 self,
522 mut result: Result<(), UpdateEffectError>,
523 ) -> Result<(), fidl::Error> {
524 let _result = self.send_raw(result);
525 self.drop_without_shutdown();
526 _result
527 }
528
529 fn send_raw(&self, mut result: Result<(), UpdateEffectError>) -> Result<(), fidl::Error> {
530 self.control_handle.inner.send::<fidl::encoding::ResultType<
531 fidl::encoding::EmptyStruct,
532 UpdateEffectError,
533 >>(
534 result,
535 self.tx_id,
536 0x4e39e4b5e6279125,
537 fidl::encoding::DynamicFlags::empty(),
538 )
539 }
540}
541
542#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
543pub struct GainControlMarker;
544
545impl fidl::endpoints::ProtocolMarker for GainControlMarker {
546 type Proxy = GainControlProxy;
547 type RequestStream = GainControlRequestStream;
548 #[cfg(target_os = "fuchsia")]
549 type SynchronousProxy = GainControlSynchronousProxy;
550
551 const DEBUG_NAME: &'static str = "(anonymous) GainControl";
552}
553
554pub trait GainControlProxyInterface: Send + Sync {
555 fn r#set_gain(&self, gain_db: f32) -> Result<(), fidl::Error>;
556 fn r#set_gain_with_ramp(
557 &self,
558 gain_db: f32,
559 duration: i64,
560 ramp_type: RampType,
561 ) -> Result<(), fidl::Error>;
562 fn r#set_mute(&self, muted: bool) -> Result<(), fidl::Error>;
563}
564#[derive(Debug)]
565#[cfg(target_os = "fuchsia")]
566pub struct GainControlSynchronousProxy {
567 client: fidl::client::sync::Client,
568}
569
570#[cfg(target_os = "fuchsia")]
571impl fidl::endpoints::SynchronousProxy for GainControlSynchronousProxy {
572 type Proxy = GainControlProxy;
573 type Protocol = GainControlMarker;
574
575 fn from_channel(inner: fidl::Channel) -> Self {
576 Self::new(inner)
577 }
578
579 fn into_channel(self) -> fidl::Channel {
580 self.client.into_channel()
581 }
582
583 fn as_channel(&self) -> &fidl::Channel {
584 self.client.as_channel()
585 }
586}
587
588#[cfg(target_os = "fuchsia")]
589impl GainControlSynchronousProxy {
590 pub fn new(channel: fidl::Channel) -> Self {
591 Self { client: fidl::client::sync::Client::new(channel) }
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::<GainControlMarker>(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 Self { client: fidl::client::sync::Client::new(channel) }
1205 }
1206
1207 pub fn into_channel(self) -> fidl::Channel {
1208 self.client.into_channel()
1209 }
1210
1211 pub fn wait_for_event(
1214 &self,
1215 deadline: zx::MonotonicInstant,
1216 ) -> Result<VolumeControlEvent, fidl::Error> {
1217 VolumeControlEvent::decode(self.client.wait_for_event::<VolumeControlMarker>(deadline)?)
1218 }
1219
1220 pub fn r#set_volume(&self, mut volume: f32) -> Result<(), fidl::Error> {
1224 self.client.send::<VolumeControlSetVolumeRequest>(
1225 (volume,),
1226 0x6ff4231809a697da,
1227 fidl::encoding::DynamicFlags::empty(),
1228 )
1229 }
1230
1231 pub fn r#set_mute(&self, mut mute: bool) -> Result<(), fidl::Error> {
1236 self.client.send::<VolumeControlSetMuteRequest>(
1237 (mute,),
1238 0x50c10c28bba46425,
1239 fidl::encoding::DynamicFlags::empty(),
1240 )
1241 }
1242}
1243
1244#[cfg(target_os = "fuchsia")]
1245impl From<VolumeControlSynchronousProxy> for zx::NullableHandle {
1246 fn from(value: VolumeControlSynchronousProxy) -> Self {
1247 value.into_channel().into()
1248 }
1249}
1250
1251#[cfg(target_os = "fuchsia")]
1252impl From<fidl::Channel> for VolumeControlSynchronousProxy {
1253 fn from(value: fidl::Channel) -> Self {
1254 Self::new(value)
1255 }
1256}
1257
1258#[cfg(target_os = "fuchsia")]
1259impl fidl::endpoints::FromClient for VolumeControlSynchronousProxy {
1260 type Protocol = VolumeControlMarker;
1261
1262 fn from_client(value: fidl::endpoints::ClientEnd<VolumeControlMarker>) -> Self {
1263 Self::new(value.into_channel())
1264 }
1265}
1266
1267#[derive(Debug, Clone)]
1268pub struct VolumeControlProxy {
1269 client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
1270}
1271
1272impl fidl::endpoints::Proxy for VolumeControlProxy {
1273 type Protocol = VolumeControlMarker;
1274
1275 fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
1276 Self::new(inner)
1277 }
1278
1279 fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
1280 self.client.into_channel().map_err(|client| Self { client })
1281 }
1282
1283 fn as_channel(&self) -> &::fidl::AsyncChannel {
1284 self.client.as_channel()
1285 }
1286}
1287
1288impl VolumeControlProxy {
1289 pub fn new(channel: ::fidl::AsyncChannel) -> Self {
1291 let protocol_name = <VolumeControlMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
1292 Self { client: fidl::client::Client::new(channel, protocol_name) }
1293 }
1294
1295 pub fn take_event_stream(&self) -> VolumeControlEventStream {
1301 VolumeControlEventStream { event_receiver: self.client.take_event_receiver() }
1302 }
1303
1304 pub fn r#set_volume(&self, mut volume: f32) -> Result<(), fidl::Error> {
1308 VolumeControlProxyInterface::r#set_volume(self, volume)
1309 }
1310
1311 pub fn r#set_mute(&self, mut mute: bool) -> Result<(), fidl::Error> {
1316 VolumeControlProxyInterface::r#set_mute(self, mute)
1317 }
1318}
1319
1320impl VolumeControlProxyInterface for VolumeControlProxy {
1321 fn r#set_volume(&self, mut volume: f32) -> Result<(), fidl::Error> {
1322 self.client.send::<VolumeControlSetVolumeRequest>(
1323 (volume,),
1324 0x6ff4231809a697da,
1325 fidl::encoding::DynamicFlags::empty(),
1326 )
1327 }
1328
1329 fn r#set_mute(&self, mut mute: bool) -> Result<(), fidl::Error> {
1330 self.client.send::<VolumeControlSetMuteRequest>(
1331 (mute,),
1332 0x50c10c28bba46425,
1333 fidl::encoding::DynamicFlags::empty(),
1334 )
1335 }
1336}
1337
1338pub struct VolumeControlEventStream {
1339 event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
1340}
1341
1342impl std::marker::Unpin for VolumeControlEventStream {}
1343
1344impl futures::stream::FusedStream for VolumeControlEventStream {
1345 fn is_terminated(&self) -> bool {
1346 self.event_receiver.is_terminated()
1347 }
1348}
1349
1350impl futures::Stream for VolumeControlEventStream {
1351 type Item = Result<VolumeControlEvent, fidl::Error>;
1352
1353 fn poll_next(
1354 mut self: std::pin::Pin<&mut Self>,
1355 cx: &mut std::task::Context<'_>,
1356 ) -> std::task::Poll<Option<Self::Item>> {
1357 match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
1358 &mut self.event_receiver,
1359 cx
1360 )?) {
1361 Some(buf) => std::task::Poll::Ready(Some(VolumeControlEvent::decode(buf))),
1362 None => std::task::Poll::Ready(None),
1363 }
1364 }
1365}
1366
1367#[derive(Debug)]
1368pub enum VolumeControlEvent {
1369 OnVolumeMuteChanged { new_volume: f32, new_muted: bool },
1370}
1371
1372impl VolumeControlEvent {
1373 #[allow(irrefutable_let_patterns)]
1374 pub fn into_on_volume_mute_changed(self) -> Option<(f32, bool)> {
1375 if let VolumeControlEvent::OnVolumeMuteChanged { new_volume, new_muted } = self {
1376 Some((new_volume, new_muted))
1377 } else {
1378 None
1379 }
1380 }
1381
1382 fn decode(
1384 mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
1385 ) -> Result<VolumeControlEvent, fidl::Error> {
1386 let (bytes, _handles) = buf.split_mut();
1387 let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
1388 debug_assert_eq!(tx_header.tx_id, 0);
1389 match tx_header.ordinal {
1390 0x9cea352bd86c171 => {
1391 let mut out = fidl::new_empty!(
1392 VolumeControlOnVolumeMuteChangedRequest,
1393 fidl::encoding::DefaultFuchsiaResourceDialect
1394 );
1395 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<VolumeControlOnVolumeMuteChangedRequest>(&tx_header, _body_bytes, _handles, &mut out)?;
1396 Ok((VolumeControlEvent::OnVolumeMuteChanged {
1397 new_volume: out.new_volume,
1398 new_muted: out.new_muted,
1399 }))
1400 }
1401 _ => Err(fidl::Error::UnknownOrdinal {
1402 ordinal: tx_header.ordinal,
1403 protocol_name: <VolumeControlMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
1404 }),
1405 }
1406 }
1407}
1408
1409pub struct VolumeControlRequestStream {
1411 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
1412 is_terminated: bool,
1413}
1414
1415impl std::marker::Unpin for VolumeControlRequestStream {}
1416
1417impl futures::stream::FusedStream for VolumeControlRequestStream {
1418 fn is_terminated(&self) -> bool {
1419 self.is_terminated
1420 }
1421}
1422
1423impl fidl::endpoints::RequestStream for VolumeControlRequestStream {
1424 type Protocol = VolumeControlMarker;
1425 type ControlHandle = VolumeControlControlHandle;
1426
1427 fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
1428 Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
1429 }
1430
1431 fn control_handle(&self) -> Self::ControlHandle {
1432 VolumeControlControlHandle { inner: self.inner.clone() }
1433 }
1434
1435 fn into_inner(
1436 self,
1437 ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
1438 {
1439 (self.inner, self.is_terminated)
1440 }
1441
1442 fn from_inner(
1443 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
1444 is_terminated: bool,
1445 ) -> Self {
1446 Self { inner, is_terminated }
1447 }
1448}
1449
1450impl futures::Stream for VolumeControlRequestStream {
1451 type Item = Result<VolumeControlRequest, fidl::Error>;
1452
1453 fn poll_next(
1454 mut self: std::pin::Pin<&mut Self>,
1455 cx: &mut std::task::Context<'_>,
1456 ) -> std::task::Poll<Option<Self::Item>> {
1457 let this = &mut *self;
1458 if this.inner.check_shutdown(cx) {
1459 this.is_terminated = true;
1460 return std::task::Poll::Ready(None);
1461 }
1462 if this.is_terminated {
1463 panic!("polled VolumeControlRequestStream after completion");
1464 }
1465 fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
1466 |bytes, handles| {
1467 match this.inner.channel().read_etc(cx, bytes, handles) {
1468 std::task::Poll::Ready(Ok(())) => {}
1469 std::task::Poll::Pending => return std::task::Poll::Pending,
1470 std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
1471 this.is_terminated = true;
1472 return std::task::Poll::Ready(None);
1473 }
1474 std::task::Poll::Ready(Err(e)) => {
1475 return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
1476 e.into(),
1477 ))));
1478 }
1479 }
1480
1481 let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
1483
1484 std::task::Poll::Ready(Some(match header.ordinal {
1485 0x6ff4231809a697da => {
1486 header.validate_request_tx_id(fidl::MethodType::OneWay)?;
1487 let mut req = fidl::new_empty!(
1488 VolumeControlSetVolumeRequest,
1489 fidl::encoding::DefaultFuchsiaResourceDialect
1490 );
1491 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<VolumeControlSetVolumeRequest>(&header, _body_bytes, handles, &mut req)?;
1492 let control_handle =
1493 VolumeControlControlHandle { inner: this.inner.clone() };
1494 Ok(VolumeControlRequest::SetVolume { volume: req.volume, control_handle })
1495 }
1496 0x50c10c28bba46425 => {
1497 header.validate_request_tx_id(fidl::MethodType::OneWay)?;
1498 let mut req = fidl::new_empty!(
1499 VolumeControlSetMuteRequest,
1500 fidl::encoding::DefaultFuchsiaResourceDialect
1501 );
1502 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<VolumeControlSetMuteRequest>(&header, _body_bytes, handles, &mut req)?;
1503 let control_handle =
1504 VolumeControlControlHandle { inner: this.inner.clone() };
1505 Ok(VolumeControlRequest::SetMute { mute: req.mute, control_handle })
1506 }
1507 _ => Err(fidl::Error::UnknownOrdinal {
1508 ordinal: header.ordinal,
1509 protocol_name:
1510 <VolumeControlMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
1511 }),
1512 }))
1513 },
1514 )
1515 }
1516}
1517
1518#[derive(Debug)]
1520pub enum VolumeControlRequest {
1521 SetVolume { volume: f32, control_handle: VolumeControlControlHandle },
1525 SetMute { mute: bool, control_handle: VolumeControlControlHandle },
1530}
1531
1532impl VolumeControlRequest {
1533 #[allow(irrefutable_let_patterns)]
1534 pub fn into_set_volume(self) -> Option<(f32, VolumeControlControlHandle)> {
1535 if let VolumeControlRequest::SetVolume { volume, control_handle } = self {
1536 Some((volume, control_handle))
1537 } else {
1538 None
1539 }
1540 }
1541
1542 #[allow(irrefutable_let_patterns)]
1543 pub fn into_set_mute(self) -> Option<(bool, VolumeControlControlHandle)> {
1544 if let VolumeControlRequest::SetMute { mute, control_handle } = self {
1545 Some((mute, control_handle))
1546 } else {
1547 None
1548 }
1549 }
1550
1551 pub fn method_name(&self) -> &'static str {
1553 match *self {
1554 VolumeControlRequest::SetVolume { .. } => "set_volume",
1555 VolumeControlRequest::SetMute { .. } => "set_mute",
1556 }
1557 }
1558}
1559
1560#[derive(Debug, Clone)]
1561pub struct VolumeControlControlHandle {
1562 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
1563}
1564
1565impl fidl::endpoints::ControlHandle for VolumeControlControlHandle {
1566 fn shutdown(&self) {
1567 self.inner.shutdown()
1568 }
1569
1570 fn shutdown_with_epitaph(&self, status: zx_status::Status) {
1571 self.inner.shutdown_with_epitaph(status)
1572 }
1573
1574 fn is_closed(&self) -> bool {
1575 self.inner.channel().is_closed()
1576 }
1577 fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
1578 self.inner.channel().on_closed()
1579 }
1580
1581 #[cfg(target_os = "fuchsia")]
1582 fn signal_peer(
1583 &self,
1584 clear_mask: zx::Signals,
1585 set_mask: zx::Signals,
1586 ) -> Result<(), zx_status::Status> {
1587 use fidl::Peered;
1588 self.inner.channel().signal_peer(clear_mask, set_mask)
1589 }
1590}
1591
1592impl VolumeControlControlHandle {
1593 pub fn send_on_volume_mute_changed(
1594 &self,
1595 mut new_volume: f32,
1596 mut new_muted: bool,
1597 ) -> Result<(), fidl::Error> {
1598 self.inner.send::<VolumeControlOnVolumeMuteChangedRequest>(
1599 (new_volume, new_muted),
1600 0,
1601 0x9cea352bd86c171,
1602 fidl::encoding::DynamicFlags::empty(),
1603 )
1604 }
1605}
1606
1607mod internal {
1608 use super::*;
1609}