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::Handle {
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 fn shutdown_with_epitaph(&self, status: zx_status::Status) {
448 self.inner.shutdown_with_epitaph(status)
449 }
450
451 fn is_closed(&self) -> bool {
452 self.inner.channel().is_closed()
453 }
454 fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
455 self.inner.channel().on_closed()
456 }
457
458 #[cfg(target_os = "fuchsia")]
459 fn signal_peer(
460 &self,
461 clear_mask: zx::Signals,
462 set_mask: zx::Signals,
463 ) -> Result<(), zx_status::Status> {
464 use fidl::Peered;
465 self.inner.channel().signal_peer(clear_mask, set_mask)
466 }
467}
468
469impl EffectsControllerControlHandle {}
470
471#[must_use = "FIDL methods require a response to be sent"]
472#[derive(Debug)]
473pub struct EffectsControllerUpdateEffectResponder {
474 control_handle: std::mem::ManuallyDrop<EffectsControllerControlHandle>,
475 tx_id: u32,
476}
477
478impl std::ops::Drop for EffectsControllerUpdateEffectResponder {
482 fn drop(&mut self) {
483 self.control_handle.shutdown();
484 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
486 }
487}
488
489impl fidl::endpoints::Responder for EffectsControllerUpdateEffectResponder {
490 type ControlHandle = EffectsControllerControlHandle;
491
492 fn control_handle(&self) -> &EffectsControllerControlHandle {
493 &self.control_handle
494 }
495
496 fn drop_without_shutdown(mut self) {
497 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
499 std::mem::forget(self);
501 }
502}
503
504impl EffectsControllerUpdateEffectResponder {
505 pub fn send(self, mut result: Result<(), UpdateEffectError>) -> Result<(), fidl::Error> {
509 let _result = self.send_raw(result);
510 if _result.is_err() {
511 self.control_handle.shutdown();
512 }
513 self.drop_without_shutdown();
514 _result
515 }
516
517 pub fn send_no_shutdown_on_err(
519 self,
520 mut result: Result<(), UpdateEffectError>,
521 ) -> Result<(), fidl::Error> {
522 let _result = self.send_raw(result);
523 self.drop_without_shutdown();
524 _result
525 }
526
527 fn send_raw(&self, mut result: Result<(), UpdateEffectError>) -> Result<(), fidl::Error> {
528 self.control_handle.inner.send::<fidl::encoding::ResultType<
529 fidl::encoding::EmptyStruct,
530 UpdateEffectError,
531 >>(
532 result,
533 self.tx_id,
534 0x4e39e4b5e6279125,
535 fidl::encoding::DynamicFlags::empty(),
536 )
537 }
538}
539
540#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
541pub struct GainControlMarker;
542
543impl fidl::endpoints::ProtocolMarker for GainControlMarker {
544 type Proxy = GainControlProxy;
545 type RequestStream = GainControlRequestStream;
546 #[cfg(target_os = "fuchsia")]
547 type SynchronousProxy = GainControlSynchronousProxy;
548
549 const DEBUG_NAME: &'static str = "(anonymous) GainControl";
550}
551
552pub trait GainControlProxyInterface: Send + Sync {
553 fn r#set_gain(&self, gain_db: f32) -> Result<(), fidl::Error>;
554 fn r#set_gain_with_ramp(
555 &self,
556 gain_db: f32,
557 duration: i64,
558 ramp_type: RampType,
559 ) -> Result<(), fidl::Error>;
560 fn r#set_mute(&self, muted: bool) -> Result<(), fidl::Error>;
561}
562#[derive(Debug)]
563#[cfg(target_os = "fuchsia")]
564pub struct GainControlSynchronousProxy {
565 client: fidl::client::sync::Client,
566}
567
568#[cfg(target_os = "fuchsia")]
569impl fidl::endpoints::SynchronousProxy for GainControlSynchronousProxy {
570 type Proxy = GainControlProxy;
571 type Protocol = GainControlMarker;
572
573 fn from_channel(inner: fidl::Channel) -> Self {
574 Self::new(inner)
575 }
576
577 fn into_channel(self) -> fidl::Channel {
578 self.client.into_channel()
579 }
580
581 fn as_channel(&self) -> &fidl::Channel {
582 self.client.as_channel()
583 }
584}
585
586#[cfg(target_os = "fuchsia")]
587impl GainControlSynchronousProxy {
588 pub fn new(channel: fidl::Channel) -> Self {
589 let protocol_name = <GainControlMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
590 Self { client: fidl::client::sync::Client::new(channel, protocol_name) }
591 }
592
593 pub fn into_channel(self) -> fidl::Channel {
594 self.client.into_channel()
595 }
596
597 pub fn wait_for_event(
600 &self,
601 deadline: zx::MonotonicInstant,
602 ) -> Result<GainControlEvent, fidl::Error> {
603 GainControlEvent::decode(self.client.wait_for_event(deadline)?)
604 }
605
606 pub fn r#set_gain(&self, mut gain_db: f32) -> Result<(), fidl::Error> {
608 self.client.send::<GainControlSetGainRequest>(
609 (gain_db,),
610 0x2fc070871d033f64,
611 fidl::encoding::DynamicFlags::empty(),
612 )
613 }
614
615 pub fn r#set_gain_with_ramp(
652 &self,
653 mut gain_db: f32,
654 mut duration: i64,
655 mut ramp_type: RampType,
656 ) -> Result<(), fidl::Error> {
657 self.client.send::<GainControlSetGainWithRampRequest>(
658 (gain_db, duration, ramp_type),
659 0x3a175b2d6979e8ea,
660 fidl::encoding::DynamicFlags::empty(),
661 )
662 }
663
664 pub fn r#set_mute(&self, mut muted: bool) -> Result<(), fidl::Error> {
667 self.client.send::<GainControlSetMuteRequest>(
668 (muted,),
669 0x5415723c1e31448,
670 fidl::encoding::DynamicFlags::empty(),
671 )
672 }
673}
674
675#[cfg(target_os = "fuchsia")]
676impl From<GainControlSynchronousProxy> for zx::Handle {
677 fn from(value: GainControlSynchronousProxy) -> Self {
678 value.into_channel().into()
679 }
680}
681
682#[cfg(target_os = "fuchsia")]
683impl From<fidl::Channel> for GainControlSynchronousProxy {
684 fn from(value: fidl::Channel) -> Self {
685 Self::new(value)
686 }
687}
688
689#[cfg(target_os = "fuchsia")]
690impl fidl::endpoints::FromClient for GainControlSynchronousProxy {
691 type Protocol = GainControlMarker;
692
693 fn from_client(value: fidl::endpoints::ClientEnd<GainControlMarker>) -> Self {
694 Self::new(value.into_channel())
695 }
696}
697
698#[derive(Debug, Clone)]
699pub struct GainControlProxy {
700 client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
701}
702
703impl fidl::endpoints::Proxy for GainControlProxy {
704 type Protocol = GainControlMarker;
705
706 fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
707 Self::new(inner)
708 }
709
710 fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
711 self.client.into_channel().map_err(|client| Self { client })
712 }
713
714 fn as_channel(&self) -> &::fidl::AsyncChannel {
715 self.client.as_channel()
716 }
717}
718
719impl GainControlProxy {
720 pub fn new(channel: ::fidl::AsyncChannel) -> Self {
722 let protocol_name = <GainControlMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
723 Self { client: fidl::client::Client::new(channel, protocol_name) }
724 }
725
726 pub fn take_event_stream(&self) -> GainControlEventStream {
732 GainControlEventStream { event_receiver: self.client.take_event_receiver() }
733 }
734
735 pub fn r#set_gain(&self, mut gain_db: f32) -> Result<(), fidl::Error> {
737 GainControlProxyInterface::r#set_gain(self, gain_db)
738 }
739
740 pub fn r#set_gain_with_ramp(
777 &self,
778 mut gain_db: f32,
779 mut duration: i64,
780 mut ramp_type: RampType,
781 ) -> Result<(), fidl::Error> {
782 GainControlProxyInterface::r#set_gain_with_ramp(self, gain_db, duration, ramp_type)
783 }
784
785 pub fn r#set_mute(&self, mut muted: bool) -> Result<(), fidl::Error> {
788 GainControlProxyInterface::r#set_mute(self, muted)
789 }
790}
791
792impl GainControlProxyInterface for GainControlProxy {
793 fn r#set_gain(&self, mut gain_db: f32) -> Result<(), fidl::Error> {
794 self.client.send::<GainControlSetGainRequest>(
795 (gain_db,),
796 0x2fc070871d033f64,
797 fidl::encoding::DynamicFlags::empty(),
798 )
799 }
800
801 fn r#set_gain_with_ramp(
802 &self,
803 mut gain_db: f32,
804 mut duration: i64,
805 mut ramp_type: RampType,
806 ) -> Result<(), fidl::Error> {
807 self.client.send::<GainControlSetGainWithRampRequest>(
808 (gain_db, duration, ramp_type),
809 0x3a175b2d6979e8ea,
810 fidl::encoding::DynamicFlags::empty(),
811 )
812 }
813
814 fn r#set_mute(&self, mut muted: bool) -> Result<(), fidl::Error> {
815 self.client.send::<GainControlSetMuteRequest>(
816 (muted,),
817 0x5415723c1e31448,
818 fidl::encoding::DynamicFlags::empty(),
819 )
820 }
821}
822
823pub struct GainControlEventStream {
824 event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
825}
826
827impl std::marker::Unpin for GainControlEventStream {}
828
829impl futures::stream::FusedStream for GainControlEventStream {
830 fn is_terminated(&self) -> bool {
831 self.event_receiver.is_terminated()
832 }
833}
834
835impl futures::Stream for GainControlEventStream {
836 type Item = Result<GainControlEvent, fidl::Error>;
837
838 fn poll_next(
839 mut self: std::pin::Pin<&mut Self>,
840 cx: &mut std::task::Context<'_>,
841 ) -> std::task::Poll<Option<Self::Item>> {
842 match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
843 &mut self.event_receiver,
844 cx
845 )?) {
846 Some(buf) => std::task::Poll::Ready(Some(GainControlEvent::decode(buf))),
847 None => std::task::Poll::Ready(None),
848 }
849 }
850}
851
852#[derive(Debug)]
853pub enum GainControlEvent {
854 OnGainMuteChanged { gain_db: f32, muted: bool },
855}
856
857impl GainControlEvent {
858 #[allow(irrefutable_let_patterns)]
859 pub fn into_on_gain_mute_changed(self) -> Option<(f32, bool)> {
860 if let GainControlEvent::OnGainMuteChanged { gain_db, muted } = self {
861 Some((gain_db, muted))
862 } else {
863 None
864 }
865 }
866
867 fn decode(
869 mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
870 ) -> Result<GainControlEvent, fidl::Error> {
871 let (bytes, _handles) = buf.split_mut();
872 let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
873 debug_assert_eq!(tx_header.tx_id, 0);
874 match tx_header.ordinal {
875 0x66d528cad4e0d753 => {
876 let mut out = fidl::new_empty!(
877 GainControlOnGainMuteChangedRequest,
878 fidl::encoding::DefaultFuchsiaResourceDialect
879 );
880 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<GainControlOnGainMuteChangedRequest>(&tx_header, _body_bytes, _handles, &mut out)?;
881 Ok((GainControlEvent::OnGainMuteChanged { gain_db: out.gain_db, muted: out.muted }))
882 }
883 _ => Err(fidl::Error::UnknownOrdinal {
884 ordinal: tx_header.ordinal,
885 protocol_name: <GainControlMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
886 }),
887 }
888 }
889}
890
891pub struct GainControlRequestStream {
893 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
894 is_terminated: bool,
895}
896
897impl std::marker::Unpin for GainControlRequestStream {}
898
899impl futures::stream::FusedStream for GainControlRequestStream {
900 fn is_terminated(&self) -> bool {
901 self.is_terminated
902 }
903}
904
905impl fidl::endpoints::RequestStream for GainControlRequestStream {
906 type Protocol = GainControlMarker;
907 type ControlHandle = GainControlControlHandle;
908
909 fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
910 Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
911 }
912
913 fn control_handle(&self) -> Self::ControlHandle {
914 GainControlControlHandle { inner: self.inner.clone() }
915 }
916
917 fn into_inner(
918 self,
919 ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
920 {
921 (self.inner, self.is_terminated)
922 }
923
924 fn from_inner(
925 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
926 is_terminated: bool,
927 ) -> Self {
928 Self { inner, is_terminated }
929 }
930}
931
932impl futures::Stream for GainControlRequestStream {
933 type Item = Result<GainControlRequest, fidl::Error>;
934
935 fn poll_next(
936 mut self: std::pin::Pin<&mut Self>,
937 cx: &mut std::task::Context<'_>,
938 ) -> std::task::Poll<Option<Self::Item>> {
939 let this = &mut *self;
940 if this.inner.check_shutdown(cx) {
941 this.is_terminated = true;
942 return std::task::Poll::Ready(None);
943 }
944 if this.is_terminated {
945 panic!("polled GainControlRequestStream after completion");
946 }
947 fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
948 |bytes, handles| {
949 match this.inner.channel().read_etc(cx, bytes, handles) {
950 std::task::Poll::Ready(Ok(())) => {}
951 std::task::Poll::Pending => return std::task::Poll::Pending,
952 std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
953 this.is_terminated = true;
954 return std::task::Poll::Ready(None);
955 }
956 std::task::Poll::Ready(Err(e)) => {
957 return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
958 e.into(),
959 ))))
960 }
961 }
962
963 let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
965
966 std::task::Poll::Ready(Some(match header.ordinal {
967 0x2fc070871d033f64 => {
968 header.validate_request_tx_id(fidl::MethodType::OneWay)?;
969 let mut req = fidl::new_empty!(
970 GainControlSetGainRequest,
971 fidl::encoding::DefaultFuchsiaResourceDialect
972 );
973 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<GainControlSetGainRequest>(&header, _body_bytes, handles, &mut req)?;
974 let control_handle = GainControlControlHandle { inner: this.inner.clone() };
975 Ok(GainControlRequest::SetGain { gain_db: req.gain_db, control_handle })
976 }
977 0x3a175b2d6979e8ea => {
978 header.validate_request_tx_id(fidl::MethodType::OneWay)?;
979 let mut req = fidl::new_empty!(
980 GainControlSetGainWithRampRequest,
981 fidl::encoding::DefaultFuchsiaResourceDialect
982 );
983 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<GainControlSetGainWithRampRequest>(&header, _body_bytes, handles, &mut req)?;
984 let control_handle = GainControlControlHandle { inner: this.inner.clone() };
985 Ok(GainControlRequest::SetGainWithRamp {
986 gain_db: req.gain_db,
987 duration: req.duration,
988 ramp_type: req.ramp_type,
989
990 control_handle,
991 })
992 }
993 0x5415723c1e31448 => {
994 header.validate_request_tx_id(fidl::MethodType::OneWay)?;
995 let mut req = fidl::new_empty!(
996 GainControlSetMuteRequest,
997 fidl::encoding::DefaultFuchsiaResourceDialect
998 );
999 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<GainControlSetMuteRequest>(&header, _body_bytes, handles, &mut req)?;
1000 let control_handle = GainControlControlHandle { inner: this.inner.clone() };
1001 Ok(GainControlRequest::SetMute { muted: req.muted, control_handle })
1002 }
1003 _ => Err(fidl::Error::UnknownOrdinal {
1004 ordinal: header.ordinal,
1005 protocol_name:
1006 <GainControlMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
1007 }),
1008 }))
1009 },
1010 )
1011 }
1012}
1013
1014#[derive(Debug)]
1019pub enum GainControlRequest {
1020 SetGain { gain_db: f32, control_handle: GainControlControlHandle },
1022 SetGainWithRamp {
1059 gain_db: f32,
1060 duration: i64,
1061 ramp_type: RampType,
1062 control_handle: GainControlControlHandle,
1063 },
1064 SetMute { muted: bool, control_handle: GainControlControlHandle },
1067}
1068
1069impl GainControlRequest {
1070 #[allow(irrefutable_let_patterns)]
1071 pub fn into_set_gain(self) -> Option<(f32, GainControlControlHandle)> {
1072 if let GainControlRequest::SetGain { gain_db, control_handle } = self {
1073 Some((gain_db, control_handle))
1074 } else {
1075 None
1076 }
1077 }
1078
1079 #[allow(irrefutable_let_patterns)]
1080 pub fn into_set_gain_with_ramp(self) -> Option<(f32, i64, RampType, GainControlControlHandle)> {
1081 if let GainControlRequest::SetGainWithRamp {
1082 gain_db,
1083 duration,
1084 ramp_type,
1085 control_handle,
1086 } = self
1087 {
1088 Some((gain_db, duration, ramp_type, control_handle))
1089 } else {
1090 None
1091 }
1092 }
1093
1094 #[allow(irrefutable_let_patterns)]
1095 pub fn into_set_mute(self) -> Option<(bool, GainControlControlHandle)> {
1096 if let GainControlRequest::SetMute { muted, control_handle } = self {
1097 Some((muted, control_handle))
1098 } else {
1099 None
1100 }
1101 }
1102
1103 pub fn method_name(&self) -> &'static str {
1105 match *self {
1106 GainControlRequest::SetGain { .. } => "set_gain",
1107 GainControlRequest::SetGainWithRamp { .. } => "set_gain_with_ramp",
1108 GainControlRequest::SetMute { .. } => "set_mute",
1109 }
1110 }
1111}
1112
1113#[derive(Debug, Clone)]
1114pub struct GainControlControlHandle {
1115 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
1116}
1117
1118impl fidl::endpoints::ControlHandle for GainControlControlHandle {
1119 fn shutdown(&self) {
1120 self.inner.shutdown()
1121 }
1122 fn shutdown_with_epitaph(&self, status: zx_status::Status) {
1123 self.inner.shutdown_with_epitaph(status)
1124 }
1125
1126 fn is_closed(&self) -> bool {
1127 self.inner.channel().is_closed()
1128 }
1129 fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
1130 self.inner.channel().on_closed()
1131 }
1132
1133 #[cfg(target_os = "fuchsia")]
1134 fn signal_peer(
1135 &self,
1136 clear_mask: zx::Signals,
1137 set_mask: zx::Signals,
1138 ) -> Result<(), zx_status::Status> {
1139 use fidl::Peered;
1140 self.inner.channel().signal_peer(clear_mask, set_mask)
1141 }
1142}
1143
1144impl GainControlControlHandle {
1145 pub fn send_on_gain_mute_changed(
1146 &self,
1147 mut gain_db: f32,
1148 mut muted: bool,
1149 ) -> Result<(), fidl::Error> {
1150 self.inner.send::<GainControlOnGainMuteChangedRequest>(
1151 (gain_db, muted),
1152 0,
1153 0x66d528cad4e0d753,
1154 fidl::encoding::DynamicFlags::empty(),
1155 )
1156 }
1157}
1158
1159#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
1160pub struct VolumeControlMarker;
1161
1162impl fidl::endpoints::ProtocolMarker for VolumeControlMarker {
1163 type Proxy = VolumeControlProxy;
1164 type RequestStream = VolumeControlRequestStream;
1165 #[cfg(target_os = "fuchsia")]
1166 type SynchronousProxy = VolumeControlSynchronousProxy;
1167
1168 const DEBUG_NAME: &'static str = "(anonymous) VolumeControl";
1169}
1170
1171pub trait VolumeControlProxyInterface: Send + Sync {
1172 fn r#set_volume(&self, volume: f32) -> Result<(), fidl::Error>;
1173 fn r#set_mute(&self, mute: bool) -> Result<(), fidl::Error>;
1174}
1175#[derive(Debug)]
1176#[cfg(target_os = "fuchsia")]
1177pub struct VolumeControlSynchronousProxy {
1178 client: fidl::client::sync::Client,
1179}
1180
1181#[cfg(target_os = "fuchsia")]
1182impl fidl::endpoints::SynchronousProxy for VolumeControlSynchronousProxy {
1183 type Proxy = VolumeControlProxy;
1184 type Protocol = VolumeControlMarker;
1185
1186 fn from_channel(inner: fidl::Channel) -> Self {
1187 Self::new(inner)
1188 }
1189
1190 fn into_channel(self) -> fidl::Channel {
1191 self.client.into_channel()
1192 }
1193
1194 fn as_channel(&self) -> &fidl::Channel {
1195 self.client.as_channel()
1196 }
1197}
1198
1199#[cfg(target_os = "fuchsia")]
1200impl VolumeControlSynchronousProxy {
1201 pub fn new(channel: fidl::Channel) -> Self {
1202 let protocol_name = <VolumeControlMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
1203 Self { client: fidl::client::sync::Client::new(channel, protocol_name) }
1204 }
1205
1206 pub fn into_channel(self) -> fidl::Channel {
1207 self.client.into_channel()
1208 }
1209
1210 pub fn wait_for_event(
1213 &self,
1214 deadline: zx::MonotonicInstant,
1215 ) -> Result<VolumeControlEvent, fidl::Error> {
1216 VolumeControlEvent::decode(self.client.wait_for_event(deadline)?)
1217 }
1218
1219 pub fn r#set_volume(&self, mut volume: f32) -> Result<(), fidl::Error> {
1223 self.client.send::<VolumeControlSetVolumeRequest>(
1224 (volume,),
1225 0x6ff4231809a697da,
1226 fidl::encoding::DynamicFlags::empty(),
1227 )
1228 }
1229
1230 pub fn r#set_mute(&self, mut mute: bool) -> Result<(), fidl::Error> {
1235 self.client.send::<VolumeControlSetMuteRequest>(
1236 (mute,),
1237 0x50c10c28bba46425,
1238 fidl::encoding::DynamicFlags::empty(),
1239 )
1240 }
1241}
1242
1243#[cfg(target_os = "fuchsia")]
1244impl From<VolumeControlSynchronousProxy> for zx::Handle {
1245 fn from(value: VolumeControlSynchronousProxy) -> Self {
1246 value.into_channel().into()
1247 }
1248}
1249
1250#[cfg(target_os = "fuchsia")]
1251impl From<fidl::Channel> for VolumeControlSynchronousProxy {
1252 fn from(value: fidl::Channel) -> Self {
1253 Self::new(value)
1254 }
1255}
1256
1257#[cfg(target_os = "fuchsia")]
1258impl fidl::endpoints::FromClient for VolumeControlSynchronousProxy {
1259 type Protocol = VolumeControlMarker;
1260
1261 fn from_client(value: fidl::endpoints::ClientEnd<VolumeControlMarker>) -> Self {
1262 Self::new(value.into_channel())
1263 }
1264}
1265
1266#[derive(Debug, Clone)]
1267pub struct VolumeControlProxy {
1268 client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
1269}
1270
1271impl fidl::endpoints::Proxy for VolumeControlProxy {
1272 type Protocol = VolumeControlMarker;
1273
1274 fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
1275 Self::new(inner)
1276 }
1277
1278 fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
1279 self.client.into_channel().map_err(|client| Self { client })
1280 }
1281
1282 fn as_channel(&self) -> &::fidl::AsyncChannel {
1283 self.client.as_channel()
1284 }
1285}
1286
1287impl VolumeControlProxy {
1288 pub fn new(channel: ::fidl::AsyncChannel) -> Self {
1290 let protocol_name = <VolumeControlMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
1291 Self { client: fidl::client::Client::new(channel, protocol_name) }
1292 }
1293
1294 pub fn take_event_stream(&self) -> VolumeControlEventStream {
1300 VolumeControlEventStream { event_receiver: self.client.take_event_receiver() }
1301 }
1302
1303 pub fn r#set_volume(&self, mut volume: f32) -> Result<(), fidl::Error> {
1307 VolumeControlProxyInterface::r#set_volume(self, volume)
1308 }
1309
1310 pub fn r#set_mute(&self, mut mute: bool) -> Result<(), fidl::Error> {
1315 VolumeControlProxyInterface::r#set_mute(self, mute)
1316 }
1317}
1318
1319impl VolumeControlProxyInterface for VolumeControlProxy {
1320 fn r#set_volume(&self, mut volume: f32) -> Result<(), fidl::Error> {
1321 self.client.send::<VolumeControlSetVolumeRequest>(
1322 (volume,),
1323 0x6ff4231809a697da,
1324 fidl::encoding::DynamicFlags::empty(),
1325 )
1326 }
1327
1328 fn r#set_mute(&self, mut mute: bool) -> Result<(), fidl::Error> {
1329 self.client.send::<VolumeControlSetMuteRequest>(
1330 (mute,),
1331 0x50c10c28bba46425,
1332 fidl::encoding::DynamicFlags::empty(),
1333 )
1334 }
1335}
1336
1337pub struct VolumeControlEventStream {
1338 event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
1339}
1340
1341impl std::marker::Unpin for VolumeControlEventStream {}
1342
1343impl futures::stream::FusedStream for VolumeControlEventStream {
1344 fn is_terminated(&self) -> bool {
1345 self.event_receiver.is_terminated()
1346 }
1347}
1348
1349impl futures::Stream for VolumeControlEventStream {
1350 type Item = Result<VolumeControlEvent, fidl::Error>;
1351
1352 fn poll_next(
1353 mut self: std::pin::Pin<&mut Self>,
1354 cx: &mut std::task::Context<'_>,
1355 ) -> std::task::Poll<Option<Self::Item>> {
1356 match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
1357 &mut self.event_receiver,
1358 cx
1359 )?) {
1360 Some(buf) => std::task::Poll::Ready(Some(VolumeControlEvent::decode(buf))),
1361 None => std::task::Poll::Ready(None),
1362 }
1363 }
1364}
1365
1366#[derive(Debug)]
1367pub enum VolumeControlEvent {
1368 OnVolumeMuteChanged { new_volume: f32, new_muted: bool },
1369}
1370
1371impl VolumeControlEvent {
1372 #[allow(irrefutable_let_patterns)]
1373 pub fn into_on_volume_mute_changed(self) -> Option<(f32, bool)> {
1374 if let VolumeControlEvent::OnVolumeMuteChanged { new_volume, new_muted } = self {
1375 Some((new_volume, new_muted))
1376 } else {
1377 None
1378 }
1379 }
1380
1381 fn decode(
1383 mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
1384 ) -> Result<VolumeControlEvent, fidl::Error> {
1385 let (bytes, _handles) = buf.split_mut();
1386 let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
1387 debug_assert_eq!(tx_header.tx_id, 0);
1388 match tx_header.ordinal {
1389 0x9cea352bd86c171 => {
1390 let mut out = fidl::new_empty!(
1391 VolumeControlOnVolumeMuteChangedRequest,
1392 fidl::encoding::DefaultFuchsiaResourceDialect
1393 );
1394 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<VolumeControlOnVolumeMuteChangedRequest>(&tx_header, _body_bytes, _handles, &mut out)?;
1395 Ok((VolumeControlEvent::OnVolumeMuteChanged {
1396 new_volume: out.new_volume,
1397 new_muted: out.new_muted,
1398 }))
1399 }
1400 _ => Err(fidl::Error::UnknownOrdinal {
1401 ordinal: tx_header.ordinal,
1402 protocol_name: <VolumeControlMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
1403 }),
1404 }
1405 }
1406}
1407
1408pub struct VolumeControlRequestStream {
1410 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
1411 is_terminated: bool,
1412}
1413
1414impl std::marker::Unpin for VolumeControlRequestStream {}
1415
1416impl futures::stream::FusedStream for VolumeControlRequestStream {
1417 fn is_terminated(&self) -> bool {
1418 self.is_terminated
1419 }
1420}
1421
1422impl fidl::endpoints::RequestStream for VolumeControlRequestStream {
1423 type Protocol = VolumeControlMarker;
1424 type ControlHandle = VolumeControlControlHandle;
1425
1426 fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
1427 Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
1428 }
1429
1430 fn control_handle(&self) -> Self::ControlHandle {
1431 VolumeControlControlHandle { inner: self.inner.clone() }
1432 }
1433
1434 fn into_inner(
1435 self,
1436 ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
1437 {
1438 (self.inner, self.is_terminated)
1439 }
1440
1441 fn from_inner(
1442 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
1443 is_terminated: bool,
1444 ) -> Self {
1445 Self { inner, is_terminated }
1446 }
1447}
1448
1449impl futures::Stream for VolumeControlRequestStream {
1450 type Item = Result<VolumeControlRequest, fidl::Error>;
1451
1452 fn poll_next(
1453 mut self: std::pin::Pin<&mut Self>,
1454 cx: &mut std::task::Context<'_>,
1455 ) -> std::task::Poll<Option<Self::Item>> {
1456 let this = &mut *self;
1457 if this.inner.check_shutdown(cx) {
1458 this.is_terminated = true;
1459 return std::task::Poll::Ready(None);
1460 }
1461 if this.is_terminated {
1462 panic!("polled VolumeControlRequestStream after completion");
1463 }
1464 fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
1465 |bytes, handles| {
1466 match this.inner.channel().read_etc(cx, bytes, handles) {
1467 std::task::Poll::Ready(Ok(())) => {}
1468 std::task::Poll::Pending => return std::task::Poll::Pending,
1469 std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
1470 this.is_terminated = true;
1471 return std::task::Poll::Ready(None);
1472 }
1473 std::task::Poll::Ready(Err(e)) => {
1474 return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
1475 e.into(),
1476 ))))
1477 }
1478 }
1479
1480 let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
1482
1483 std::task::Poll::Ready(Some(match header.ordinal {
1484 0x6ff4231809a697da => {
1485 header.validate_request_tx_id(fidl::MethodType::OneWay)?;
1486 let mut req = fidl::new_empty!(
1487 VolumeControlSetVolumeRequest,
1488 fidl::encoding::DefaultFuchsiaResourceDialect
1489 );
1490 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<VolumeControlSetVolumeRequest>(&header, _body_bytes, handles, &mut req)?;
1491 let control_handle =
1492 VolumeControlControlHandle { inner: this.inner.clone() };
1493 Ok(VolumeControlRequest::SetVolume { volume: req.volume, control_handle })
1494 }
1495 0x50c10c28bba46425 => {
1496 header.validate_request_tx_id(fidl::MethodType::OneWay)?;
1497 let mut req = fidl::new_empty!(
1498 VolumeControlSetMuteRequest,
1499 fidl::encoding::DefaultFuchsiaResourceDialect
1500 );
1501 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<VolumeControlSetMuteRequest>(&header, _body_bytes, handles, &mut req)?;
1502 let control_handle =
1503 VolumeControlControlHandle { inner: this.inner.clone() };
1504 Ok(VolumeControlRequest::SetMute { mute: req.mute, control_handle })
1505 }
1506 _ => Err(fidl::Error::UnknownOrdinal {
1507 ordinal: header.ordinal,
1508 protocol_name:
1509 <VolumeControlMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
1510 }),
1511 }))
1512 },
1513 )
1514 }
1515}
1516
1517#[derive(Debug)]
1519pub enum VolumeControlRequest {
1520 SetVolume { volume: f32, control_handle: VolumeControlControlHandle },
1524 SetMute { mute: bool, control_handle: VolumeControlControlHandle },
1529}
1530
1531impl VolumeControlRequest {
1532 #[allow(irrefutable_let_patterns)]
1533 pub fn into_set_volume(self) -> Option<(f32, VolumeControlControlHandle)> {
1534 if let VolumeControlRequest::SetVolume { volume, control_handle } = self {
1535 Some((volume, control_handle))
1536 } else {
1537 None
1538 }
1539 }
1540
1541 #[allow(irrefutable_let_patterns)]
1542 pub fn into_set_mute(self) -> Option<(bool, VolumeControlControlHandle)> {
1543 if let VolumeControlRequest::SetMute { mute, control_handle } = self {
1544 Some((mute, control_handle))
1545 } else {
1546 None
1547 }
1548 }
1549
1550 pub fn method_name(&self) -> &'static str {
1552 match *self {
1553 VolumeControlRequest::SetVolume { .. } => "set_volume",
1554 VolumeControlRequest::SetMute { .. } => "set_mute",
1555 }
1556 }
1557}
1558
1559#[derive(Debug, Clone)]
1560pub struct VolumeControlControlHandle {
1561 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
1562}
1563
1564impl fidl::endpoints::ControlHandle for VolumeControlControlHandle {
1565 fn shutdown(&self) {
1566 self.inner.shutdown()
1567 }
1568 fn shutdown_with_epitaph(&self, status: zx_status::Status) {
1569 self.inner.shutdown_with_epitaph(status)
1570 }
1571
1572 fn is_closed(&self) -> bool {
1573 self.inner.channel().is_closed()
1574 }
1575 fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
1576 self.inner.channel().on_closed()
1577 }
1578
1579 #[cfg(target_os = "fuchsia")]
1580 fn signal_peer(
1581 &self,
1582 clear_mask: zx::Signals,
1583 set_mask: zx::Signals,
1584 ) -> Result<(), zx_status::Status> {
1585 use fidl::Peered;
1586 self.inner.channel().signal_peer(clear_mask, set_mask)
1587 }
1588}
1589
1590impl VolumeControlControlHandle {
1591 pub fn send_on_volume_mute_changed(
1592 &self,
1593 mut new_volume: f32,
1594 mut new_muted: bool,
1595 ) -> Result<(), fidl::Error> {
1596 self.inner.send::<VolumeControlOnVolumeMuteChangedRequest>(
1597 (new_volume, new_muted),
1598 0,
1599 0x9cea352bd86c171,
1600 fidl::encoding::DynamicFlags::empty(),
1601 )
1602 }
1603}
1604
1605mod internal {
1606 use super::*;
1607}