1#![warn(clippy::all)]
4#![allow(unused_parens, unused_mut, unused_imports, nonstandard_style)]
5
6use bitflags::bitflags;
7use fdomain_client::fidl::{ControlHandle as _, FDomainFlexibleIntoResult as _, Responder as _};
8use fidl::encoding::{MessageBufFor, ProxyChannelBox, ResourceDialect};
9pub use fidl_fuchsia_media_audio__common::*;
10use futures::future::{self, MaybeDone, TryFutureExt};
11use zx_status;
12
13#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
14pub struct EffectsControllerMarker;
15
16impl fdomain_client::fidl::ProtocolMarker for EffectsControllerMarker {
17 type Proxy = EffectsControllerProxy;
18 type RequestStream = EffectsControllerRequestStream;
19
20 const DEBUG_NAME: &'static str = "fuchsia.media.audio.EffectsController";
21}
22impl fdomain_client::fidl::DiscoverableProtocolMarker for EffectsControllerMarker {}
23pub type EffectsControllerUpdateEffectResult = Result<(), UpdateEffectError>;
24
25pub trait EffectsControllerProxyInterface: Send + Sync {
26 type UpdateEffectResponseFut: std::future::Future<Output = Result<EffectsControllerUpdateEffectResult, fidl::Error>>
27 + Send;
28 fn r#update_effect(&self, effect_name: &str, config: &str) -> Self::UpdateEffectResponseFut;
29}
30
31#[derive(Debug, Clone)]
32pub struct EffectsControllerProxy {
33 client: fidl::client::Client<fdomain_client::fidl::FDomainResourceDialect>,
34}
35
36impl fdomain_client::fidl::Proxy for EffectsControllerProxy {
37 type Protocol = EffectsControllerMarker;
38
39 fn from_channel(inner: fdomain_client::Channel) -> Self {
40 Self::new(inner)
41 }
42
43 fn into_channel(self) -> Result<fdomain_client::Channel, Self> {
44 self.client.into_channel().map_err(|client| Self { client })
45 }
46
47 fn as_channel(&self) -> &fdomain_client::Channel {
48 self.client.as_channel()
49 }
50}
51
52impl EffectsControllerProxy {
53 pub fn new(channel: fdomain_client::Channel) -> Self {
55 let protocol_name =
56 <EffectsControllerMarker as fdomain_client::fidl::ProtocolMarker>::DEBUG_NAME;
57 Self { client: fidl::client::Client::new(channel, protocol_name) }
58 }
59
60 pub fn take_event_stream(&self) -> EffectsControllerEventStream {
66 EffectsControllerEventStream { event_receiver: self.client.take_event_receiver() }
67 }
68
69 pub fn r#update_effect(
87 &self,
88 mut effect_name: &str,
89 mut config: &str,
90 ) -> fidl::client::QueryResponseFut<
91 EffectsControllerUpdateEffectResult,
92 fdomain_client::fidl::FDomainResourceDialect,
93 > {
94 EffectsControllerProxyInterface::r#update_effect(self, effect_name, config)
95 }
96}
97
98impl EffectsControllerProxyInterface for EffectsControllerProxy {
99 type UpdateEffectResponseFut = fidl::client::QueryResponseFut<
100 EffectsControllerUpdateEffectResult,
101 fdomain_client::fidl::FDomainResourceDialect,
102 >;
103 fn r#update_effect(
104 &self,
105 mut effect_name: &str,
106 mut config: &str,
107 ) -> Self::UpdateEffectResponseFut {
108 fn _decode(
109 mut _buf: Result<<fdomain_client::fidl::FDomainResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
110 ) -> Result<EffectsControllerUpdateEffectResult, fidl::Error> {
111 let _response = fidl::client::decode_transaction_body::<
112 fidl::encoding::ResultType<fidl::encoding::EmptyStruct, UpdateEffectError>,
113 fdomain_client::fidl::FDomainResourceDialect,
114 0x4e39e4b5e6279125,
115 >(_buf?)?;
116 Ok(_response.map(|x| x))
117 }
118 self.client.send_query_and_decode::<
119 EffectsControllerUpdateEffectRequest,
120 EffectsControllerUpdateEffectResult,
121 >(
122 (effect_name, config,),
123 0x4e39e4b5e6279125,
124 fidl::encoding::DynamicFlags::empty(),
125 _decode,
126 )
127 }
128}
129
130pub struct EffectsControllerEventStream {
131 event_receiver: fidl::client::EventReceiver<fdomain_client::fidl::FDomainResourceDialect>,
132}
133
134impl std::marker::Unpin for EffectsControllerEventStream {}
135
136impl futures::stream::FusedStream for EffectsControllerEventStream {
137 fn is_terminated(&self) -> bool {
138 self.event_receiver.is_terminated()
139 }
140}
141
142impl futures::Stream for EffectsControllerEventStream {
143 type Item = Result<EffectsControllerEvent, fidl::Error>;
144
145 fn poll_next(
146 mut self: std::pin::Pin<&mut Self>,
147 cx: &mut std::task::Context<'_>,
148 ) -> std::task::Poll<Option<Self::Item>> {
149 match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
150 &mut self.event_receiver,
151 cx
152 )?) {
153 Some(buf) => std::task::Poll::Ready(Some(EffectsControllerEvent::decode(buf))),
154 None => std::task::Poll::Ready(None),
155 }
156 }
157}
158
159#[derive(Debug)]
160pub enum EffectsControllerEvent {}
161
162impl EffectsControllerEvent {
163 fn decode(
165 mut buf: <fdomain_client::fidl::FDomainResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
166 ) -> Result<EffectsControllerEvent, fidl::Error> {
167 let (bytes, _handles) = buf.split_mut();
168 let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
169 debug_assert_eq!(tx_header.tx_id, 0);
170 match tx_header.ordinal {
171 _ => Err(fidl::Error::UnknownOrdinal {
172 ordinal: tx_header.ordinal,
173 protocol_name:
174 <EffectsControllerMarker as fdomain_client::fidl::ProtocolMarker>::DEBUG_NAME,
175 }),
176 }
177 }
178}
179
180pub struct EffectsControllerRequestStream {
182 inner: std::sync::Arc<fidl::ServeInner<fdomain_client::fidl::FDomainResourceDialect>>,
183 is_terminated: bool,
184}
185
186impl std::marker::Unpin for EffectsControllerRequestStream {}
187
188impl futures::stream::FusedStream for EffectsControllerRequestStream {
189 fn is_terminated(&self) -> bool {
190 self.is_terminated
191 }
192}
193
194impl fdomain_client::fidl::RequestStream for EffectsControllerRequestStream {
195 type Protocol = EffectsControllerMarker;
196 type ControlHandle = EffectsControllerControlHandle;
197
198 fn from_channel(channel: fdomain_client::Channel) -> Self {
199 Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
200 }
201
202 fn control_handle(&self) -> Self::ControlHandle {
203 EffectsControllerControlHandle { inner: self.inner.clone() }
204 }
205
206 fn into_inner(
207 self,
208 ) -> (::std::sync::Arc<fidl::ServeInner<fdomain_client::fidl::FDomainResourceDialect>>, bool)
209 {
210 (self.inner, self.is_terminated)
211 }
212
213 fn from_inner(
214 inner: std::sync::Arc<fidl::ServeInner<fdomain_client::fidl::FDomainResourceDialect>>,
215 is_terminated: bool,
216 ) -> Self {
217 Self { inner, is_terminated }
218 }
219}
220
221impl futures::Stream for EffectsControllerRequestStream {
222 type Item = Result<EffectsControllerRequest, fidl::Error>;
223
224 fn poll_next(
225 mut self: std::pin::Pin<&mut Self>,
226 cx: &mut std::task::Context<'_>,
227 ) -> std::task::Poll<Option<Self::Item>> {
228 let this = &mut *self;
229 if this.inner.check_shutdown(cx) {
230 this.is_terminated = true;
231 return std::task::Poll::Ready(None);
232 }
233 if this.is_terminated {
234 panic!("polled EffectsControllerRequestStream after completion");
235 }
236 fidl::encoding::with_tls_decode_buf::<_, fdomain_client::fidl::FDomainResourceDialect>(
237 |bytes, handles| {
238 match this.inner.channel().read_etc(cx, bytes, handles) {
239 std::task::Poll::Ready(Ok(())) => {}
240 std::task::Poll::Pending => return std::task::Poll::Pending,
241 std::task::Poll::Ready(Err(None)) => {
242 this.is_terminated = true;
243 return std::task::Poll::Ready(None);
244 }
245 std::task::Poll::Ready(Err(Some(e))) => {
246 return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
247 e.into(),
248 ))));
249 }
250 }
251
252 let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
254
255 std::task::Poll::Ready(Some(match header.ordinal {
256 0x4e39e4b5e6279125 => {
257 header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
258 let mut req = fidl::new_empty!(EffectsControllerUpdateEffectRequest, fdomain_client::fidl::FDomainResourceDialect);
259 fidl::encoding::Decoder::<fdomain_client::fidl::FDomainResourceDialect>::decode_into::<EffectsControllerUpdateEffectRequest>(&header, _body_bytes, handles, &mut req)?;
260 let control_handle = EffectsControllerControlHandle {
261 inner: this.inner.clone(),
262 };
263 Ok(EffectsControllerRequest::UpdateEffect {effect_name: req.effect_name,
264config: req.config,
265
266 responder: EffectsControllerUpdateEffectResponder {
267 control_handle: std::mem::ManuallyDrop::new(control_handle),
268 tx_id: header.tx_id,
269 },
270 })
271 }
272 _ => Err(fidl::Error::UnknownOrdinal {
273 ordinal: header.ordinal,
274 protocol_name: <EffectsControllerMarker as fdomain_client::fidl::ProtocolMarker>::DEBUG_NAME,
275 }),
276 }))
277 },
278 )
279 }
280}
281
282#[derive(Debug)]
283pub enum EffectsControllerRequest {
284 UpdateEffect {
302 effect_name: String,
303 config: String,
304 responder: EffectsControllerUpdateEffectResponder,
305 },
306}
307
308impl EffectsControllerRequest {
309 #[allow(irrefutable_let_patterns)]
310 pub fn into_update_effect(
311 self,
312 ) -> Option<(String, String, EffectsControllerUpdateEffectResponder)> {
313 if let EffectsControllerRequest::UpdateEffect { effect_name, config, responder } = self {
314 Some((effect_name, config, responder))
315 } else {
316 None
317 }
318 }
319
320 pub fn method_name(&self) -> &'static str {
322 match *self {
323 EffectsControllerRequest::UpdateEffect { .. } => "update_effect",
324 }
325 }
326}
327
328#[derive(Debug, Clone)]
329pub struct EffectsControllerControlHandle {
330 inner: std::sync::Arc<fidl::ServeInner<fdomain_client::fidl::FDomainResourceDialect>>,
331}
332
333impl fdomain_client::fidl::ControlHandle for EffectsControllerControlHandle {
334 fn shutdown(&self) {
335 self.inner.shutdown()
336 }
337
338 fn shutdown_with_epitaph(&self, status: zx_status::Status) {
339 self.inner.shutdown_with_epitaph(status)
340 }
341
342 fn is_closed(&self) -> bool {
343 self.inner.channel().is_closed()
344 }
345 fn on_closed(&self) -> fdomain_client::OnFDomainSignals {
346 self.inner.channel().on_closed()
347 }
348}
349
350impl EffectsControllerControlHandle {}
351
352#[must_use = "FIDL methods require a response to be sent"]
353#[derive(Debug)]
354pub struct EffectsControllerUpdateEffectResponder {
355 control_handle: std::mem::ManuallyDrop<EffectsControllerControlHandle>,
356 tx_id: u32,
357}
358
359impl std::ops::Drop for EffectsControllerUpdateEffectResponder {
363 fn drop(&mut self) {
364 self.control_handle.shutdown();
365 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
367 }
368}
369
370impl fdomain_client::fidl::Responder for EffectsControllerUpdateEffectResponder {
371 type ControlHandle = EffectsControllerControlHandle;
372
373 fn control_handle(&self) -> &EffectsControllerControlHandle {
374 &self.control_handle
375 }
376
377 fn drop_without_shutdown(mut self) {
378 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
380 std::mem::forget(self);
382 }
383}
384
385impl EffectsControllerUpdateEffectResponder {
386 pub fn send(self, mut result: Result<(), UpdateEffectError>) -> Result<(), fidl::Error> {
390 let _result = self.send_raw(result);
391 if _result.is_err() {
392 self.control_handle.shutdown();
393 }
394 self.drop_without_shutdown();
395 _result
396 }
397
398 pub fn send_no_shutdown_on_err(
400 self,
401 mut result: Result<(), UpdateEffectError>,
402 ) -> Result<(), fidl::Error> {
403 let _result = self.send_raw(result);
404 self.drop_without_shutdown();
405 _result
406 }
407
408 fn send_raw(&self, mut result: Result<(), UpdateEffectError>) -> Result<(), fidl::Error> {
409 self.control_handle.inner.send::<fidl::encoding::ResultType<
410 fidl::encoding::EmptyStruct,
411 UpdateEffectError,
412 >>(
413 result,
414 self.tx_id,
415 0x4e39e4b5e6279125,
416 fidl::encoding::DynamicFlags::empty(),
417 )
418 }
419}
420
421#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
422pub struct GainControlMarker;
423
424impl fdomain_client::fidl::ProtocolMarker for GainControlMarker {
425 type Proxy = GainControlProxy;
426 type RequestStream = GainControlRequestStream;
427
428 const DEBUG_NAME: &'static str = "(anonymous) GainControl";
429}
430
431pub trait GainControlProxyInterface: Send + Sync {
432 fn r#set_gain(&self, gain_db: f32) -> Result<(), fidl::Error>;
433 fn r#set_gain_with_ramp(
434 &self,
435 gain_db: f32,
436 duration: i64,
437 ramp_type: RampType,
438 ) -> Result<(), fidl::Error>;
439 fn r#set_mute(&self, muted: bool) -> Result<(), fidl::Error>;
440}
441
442#[derive(Debug, Clone)]
443pub struct GainControlProxy {
444 client: fidl::client::Client<fdomain_client::fidl::FDomainResourceDialect>,
445}
446
447impl fdomain_client::fidl::Proxy for GainControlProxy {
448 type Protocol = GainControlMarker;
449
450 fn from_channel(inner: fdomain_client::Channel) -> Self {
451 Self::new(inner)
452 }
453
454 fn into_channel(self) -> Result<fdomain_client::Channel, Self> {
455 self.client.into_channel().map_err(|client| Self { client })
456 }
457
458 fn as_channel(&self) -> &fdomain_client::Channel {
459 self.client.as_channel()
460 }
461}
462
463impl GainControlProxy {
464 pub fn new(channel: fdomain_client::Channel) -> Self {
466 let protocol_name = <GainControlMarker as fdomain_client::fidl::ProtocolMarker>::DEBUG_NAME;
467 Self { client: fidl::client::Client::new(channel, protocol_name) }
468 }
469
470 pub fn take_event_stream(&self) -> GainControlEventStream {
476 GainControlEventStream { event_receiver: self.client.take_event_receiver() }
477 }
478
479 pub fn r#set_gain(&self, mut gain_db: f32) -> Result<(), fidl::Error> {
481 GainControlProxyInterface::r#set_gain(self, gain_db)
482 }
483
484 pub fn r#set_gain_with_ramp(
521 &self,
522 mut gain_db: f32,
523 mut duration: i64,
524 mut ramp_type: RampType,
525 ) -> Result<(), fidl::Error> {
526 GainControlProxyInterface::r#set_gain_with_ramp(self, gain_db, duration, ramp_type)
527 }
528
529 pub fn r#set_mute(&self, mut muted: bool) -> Result<(), fidl::Error> {
532 GainControlProxyInterface::r#set_mute(self, muted)
533 }
534}
535
536impl GainControlProxyInterface for GainControlProxy {
537 fn r#set_gain(&self, mut gain_db: f32) -> Result<(), fidl::Error> {
538 self.client.send::<GainControlSetGainRequest>(
539 (gain_db,),
540 0x2fc070871d033f64,
541 fidl::encoding::DynamicFlags::empty(),
542 )
543 }
544
545 fn r#set_gain_with_ramp(
546 &self,
547 mut gain_db: f32,
548 mut duration: i64,
549 mut ramp_type: RampType,
550 ) -> Result<(), fidl::Error> {
551 self.client.send::<GainControlSetGainWithRampRequest>(
552 (gain_db, duration, ramp_type),
553 0x3a175b2d6979e8ea,
554 fidl::encoding::DynamicFlags::empty(),
555 )
556 }
557
558 fn r#set_mute(&self, mut muted: bool) -> Result<(), fidl::Error> {
559 self.client.send::<GainControlSetMuteRequest>(
560 (muted,),
561 0x5415723c1e31448,
562 fidl::encoding::DynamicFlags::empty(),
563 )
564 }
565}
566
567pub struct GainControlEventStream {
568 event_receiver: fidl::client::EventReceiver<fdomain_client::fidl::FDomainResourceDialect>,
569}
570
571impl std::marker::Unpin for GainControlEventStream {}
572
573impl futures::stream::FusedStream for GainControlEventStream {
574 fn is_terminated(&self) -> bool {
575 self.event_receiver.is_terminated()
576 }
577}
578
579impl futures::Stream for GainControlEventStream {
580 type Item = Result<GainControlEvent, fidl::Error>;
581
582 fn poll_next(
583 mut self: std::pin::Pin<&mut Self>,
584 cx: &mut std::task::Context<'_>,
585 ) -> std::task::Poll<Option<Self::Item>> {
586 match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
587 &mut self.event_receiver,
588 cx
589 )?) {
590 Some(buf) => std::task::Poll::Ready(Some(GainControlEvent::decode(buf))),
591 None => std::task::Poll::Ready(None),
592 }
593 }
594}
595
596#[derive(Debug)]
597pub enum GainControlEvent {
598 OnGainMuteChanged { gain_db: f32, muted: bool },
599}
600
601impl GainControlEvent {
602 #[allow(irrefutable_let_patterns)]
603 pub fn into_on_gain_mute_changed(self) -> Option<(f32, bool)> {
604 if let GainControlEvent::OnGainMuteChanged { gain_db, muted } = self {
605 Some((gain_db, muted))
606 } else {
607 None
608 }
609 }
610
611 fn decode(
613 mut buf: <fdomain_client::fidl::FDomainResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
614 ) -> Result<GainControlEvent, fidl::Error> {
615 let (bytes, _handles) = buf.split_mut();
616 let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
617 debug_assert_eq!(tx_header.tx_id, 0);
618 match tx_header.ordinal {
619 0x66d528cad4e0d753 => {
620 let mut out = fidl::new_empty!(
621 GainControlOnGainMuteChangedRequest,
622 fdomain_client::fidl::FDomainResourceDialect
623 );
624 fidl::encoding::Decoder::<fdomain_client::fidl::FDomainResourceDialect>::decode_into::<GainControlOnGainMuteChangedRequest>(&tx_header, _body_bytes, _handles, &mut out)?;
625 Ok((GainControlEvent::OnGainMuteChanged { gain_db: out.gain_db, muted: out.muted }))
626 }
627 _ => Err(fidl::Error::UnknownOrdinal {
628 ordinal: tx_header.ordinal,
629 protocol_name:
630 <GainControlMarker as fdomain_client::fidl::ProtocolMarker>::DEBUG_NAME,
631 }),
632 }
633 }
634}
635
636pub struct GainControlRequestStream {
638 inner: std::sync::Arc<fidl::ServeInner<fdomain_client::fidl::FDomainResourceDialect>>,
639 is_terminated: bool,
640}
641
642impl std::marker::Unpin for GainControlRequestStream {}
643
644impl futures::stream::FusedStream for GainControlRequestStream {
645 fn is_terminated(&self) -> bool {
646 self.is_terminated
647 }
648}
649
650impl fdomain_client::fidl::RequestStream for GainControlRequestStream {
651 type Protocol = GainControlMarker;
652 type ControlHandle = GainControlControlHandle;
653
654 fn from_channel(channel: fdomain_client::Channel) -> Self {
655 Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
656 }
657
658 fn control_handle(&self) -> Self::ControlHandle {
659 GainControlControlHandle { inner: self.inner.clone() }
660 }
661
662 fn into_inner(
663 self,
664 ) -> (::std::sync::Arc<fidl::ServeInner<fdomain_client::fidl::FDomainResourceDialect>>, bool)
665 {
666 (self.inner, self.is_terminated)
667 }
668
669 fn from_inner(
670 inner: std::sync::Arc<fidl::ServeInner<fdomain_client::fidl::FDomainResourceDialect>>,
671 is_terminated: bool,
672 ) -> Self {
673 Self { inner, is_terminated }
674 }
675}
676
677impl futures::Stream for GainControlRequestStream {
678 type Item = Result<GainControlRequest, fidl::Error>;
679
680 fn poll_next(
681 mut self: std::pin::Pin<&mut Self>,
682 cx: &mut std::task::Context<'_>,
683 ) -> std::task::Poll<Option<Self::Item>> {
684 let this = &mut *self;
685 if this.inner.check_shutdown(cx) {
686 this.is_terminated = true;
687 return std::task::Poll::Ready(None);
688 }
689 if this.is_terminated {
690 panic!("polled GainControlRequestStream after completion");
691 }
692 fidl::encoding::with_tls_decode_buf::<_, fdomain_client::fidl::FDomainResourceDialect>(
693 |bytes, handles| {
694 match this.inner.channel().read_etc(cx, bytes, handles) {
695 std::task::Poll::Ready(Ok(())) => {}
696 std::task::Poll::Pending => return std::task::Poll::Pending,
697 std::task::Poll::Ready(Err(None)) => {
698 this.is_terminated = true;
699 return std::task::Poll::Ready(None);
700 }
701 std::task::Poll::Ready(Err(Some(e))) => {
702 return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
703 e.into(),
704 ))));
705 }
706 }
707
708 let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
710
711 std::task::Poll::Ready(Some(match header.ordinal {
712 0x2fc070871d033f64 => {
713 header.validate_request_tx_id(fidl::MethodType::OneWay)?;
714 let mut req = fidl::new_empty!(
715 GainControlSetGainRequest,
716 fdomain_client::fidl::FDomainResourceDialect
717 );
718 fidl::encoding::Decoder::<fdomain_client::fidl::FDomainResourceDialect>::decode_into::<GainControlSetGainRequest>(&header, _body_bytes, handles, &mut req)?;
719 let control_handle = GainControlControlHandle { inner: this.inner.clone() };
720 Ok(GainControlRequest::SetGain { gain_db: req.gain_db, control_handle })
721 }
722 0x3a175b2d6979e8ea => {
723 header.validate_request_tx_id(fidl::MethodType::OneWay)?;
724 let mut req = fidl::new_empty!(
725 GainControlSetGainWithRampRequest,
726 fdomain_client::fidl::FDomainResourceDialect
727 );
728 fidl::encoding::Decoder::<fdomain_client::fidl::FDomainResourceDialect>::decode_into::<GainControlSetGainWithRampRequest>(&header, _body_bytes, handles, &mut req)?;
729 let control_handle = GainControlControlHandle { inner: this.inner.clone() };
730 Ok(GainControlRequest::SetGainWithRamp {
731 gain_db: req.gain_db,
732 duration: req.duration,
733 ramp_type: req.ramp_type,
734
735 control_handle,
736 })
737 }
738 0x5415723c1e31448 => {
739 header.validate_request_tx_id(fidl::MethodType::OneWay)?;
740 let mut req = fidl::new_empty!(
741 GainControlSetMuteRequest,
742 fdomain_client::fidl::FDomainResourceDialect
743 );
744 fidl::encoding::Decoder::<fdomain_client::fidl::FDomainResourceDialect>::decode_into::<GainControlSetMuteRequest>(&header, _body_bytes, handles, &mut req)?;
745 let control_handle = GainControlControlHandle { inner: this.inner.clone() };
746 Ok(GainControlRequest::SetMute { muted: req.muted, control_handle })
747 }
748 _ => Err(fidl::Error::UnknownOrdinal {
749 ordinal: header.ordinal,
750 protocol_name:
751 <GainControlMarker as fdomain_client::fidl::ProtocolMarker>::DEBUG_NAME,
752 }),
753 }))
754 },
755 )
756 }
757}
758
759#[derive(Debug)]
764pub enum GainControlRequest {
765 SetGain { gain_db: f32, control_handle: GainControlControlHandle },
767 SetGainWithRamp {
804 gain_db: f32,
805 duration: i64,
806 ramp_type: RampType,
807 control_handle: GainControlControlHandle,
808 },
809 SetMute { muted: bool, control_handle: GainControlControlHandle },
812}
813
814impl GainControlRequest {
815 #[allow(irrefutable_let_patterns)]
816 pub fn into_set_gain(self) -> Option<(f32, GainControlControlHandle)> {
817 if let GainControlRequest::SetGain { gain_db, control_handle } = self {
818 Some((gain_db, control_handle))
819 } else {
820 None
821 }
822 }
823
824 #[allow(irrefutable_let_patterns)]
825 pub fn into_set_gain_with_ramp(self) -> Option<(f32, i64, RampType, GainControlControlHandle)> {
826 if let GainControlRequest::SetGainWithRamp {
827 gain_db,
828 duration,
829 ramp_type,
830 control_handle,
831 } = self
832 {
833 Some((gain_db, duration, ramp_type, control_handle))
834 } else {
835 None
836 }
837 }
838
839 #[allow(irrefutable_let_patterns)]
840 pub fn into_set_mute(self) -> Option<(bool, GainControlControlHandle)> {
841 if let GainControlRequest::SetMute { muted, control_handle } = self {
842 Some((muted, control_handle))
843 } else {
844 None
845 }
846 }
847
848 pub fn method_name(&self) -> &'static str {
850 match *self {
851 GainControlRequest::SetGain { .. } => "set_gain",
852 GainControlRequest::SetGainWithRamp { .. } => "set_gain_with_ramp",
853 GainControlRequest::SetMute { .. } => "set_mute",
854 }
855 }
856}
857
858#[derive(Debug, Clone)]
859pub struct GainControlControlHandle {
860 inner: std::sync::Arc<fidl::ServeInner<fdomain_client::fidl::FDomainResourceDialect>>,
861}
862
863impl fdomain_client::fidl::ControlHandle for GainControlControlHandle {
864 fn shutdown(&self) {
865 self.inner.shutdown()
866 }
867
868 fn shutdown_with_epitaph(&self, status: zx_status::Status) {
869 self.inner.shutdown_with_epitaph(status)
870 }
871
872 fn is_closed(&self) -> bool {
873 self.inner.channel().is_closed()
874 }
875 fn on_closed(&self) -> fdomain_client::OnFDomainSignals {
876 self.inner.channel().on_closed()
877 }
878}
879
880impl GainControlControlHandle {
881 pub fn send_on_gain_mute_changed(
882 &self,
883 mut gain_db: f32,
884 mut muted: bool,
885 ) -> Result<(), fidl::Error> {
886 self.inner.send::<GainControlOnGainMuteChangedRequest>(
887 (gain_db, muted),
888 0,
889 0x66d528cad4e0d753,
890 fidl::encoding::DynamicFlags::empty(),
891 )
892 }
893}
894
895#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
896pub struct VolumeControlMarker;
897
898impl fdomain_client::fidl::ProtocolMarker for VolumeControlMarker {
899 type Proxy = VolumeControlProxy;
900 type RequestStream = VolumeControlRequestStream;
901
902 const DEBUG_NAME: &'static str = "(anonymous) VolumeControl";
903}
904
905pub trait VolumeControlProxyInterface: Send + Sync {
906 fn r#set_volume(&self, volume: f32) -> Result<(), fidl::Error>;
907 fn r#set_mute(&self, mute: bool) -> Result<(), fidl::Error>;
908}
909
910#[derive(Debug, Clone)]
911pub struct VolumeControlProxy {
912 client: fidl::client::Client<fdomain_client::fidl::FDomainResourceDialect>,
913}
914
915impl fdomain_client::fidl::Proxy for VolumeControlProxy {
916 type Protocol = VolumeControlMarker;
917
918 fn from_channel(inner: fdomain_client::Channel) -> Self {
919 Self::new(inner)
920 }
921
922 fn into_channel(self) -> Result<fdomain_client::Channel, Self> {
923 self.client.into_channel().map_err(|client| Self { client })
924 }
925
926 fn as_channel(&self) -> &fdomain_client::Channel {
927 self.client.as_channel()
928 }
929}
930
931impl VolumeControlProxy {
932 pub fn new(channel: fdomain_client::Channel) -> Self {
934 let protocol_name =
935 <VolumeControlMarker as fdomain_client::fidl::ProtocolMarker>::DEBUG_NAME;
936 Self { client: fidl::client::Client::new(channel, protocol_name) }
937 }
938
939 pub fn take_event_stream(&self) -> VolumeControlEventStream {
945 VolumeControlEventStream { event_receiver: self.client.take_event_receiver() }
946 }
947
948 pub fn r#set_volume(&self, mut volume: f32) -> Result<(), fidl::Error> {
952 VolumeControlProxyInterface::r#set_volume(self, volume)
953 }
954
955 pub fn r#set_mute(&self, mut mute: bool) -> Result<(), fidl::Error> {
960 VolumeControlProxyInterface::r#set_mute(self, mute)
961 }
962}
963
964impl VolumeControlProxyInterface for VolumeControlProxy {
965 fn r#set_volume(&self, mut volume: f32) -> Result<(), fidl::Error> {
966 self.client.send::<VolumeControlSetVolumeRequest>(
967 (volume,),
968 0x6ff4231809a697da,
969 fidl::encoding::DynamicFlags::empty(),
970 )
971 }
972
973 fn r#set_mute(&self, mut mute: bool) -> Result<(), fidl::Error> {
974 self.client.send::<VolumeControlSetMuteRequest>(
975 (mute,),
976 0x50c10c28bba46425,
977 fidl::encoding::DynamicFlags::empty(),
978 )
979 }
980}
981
982pub struct VolumeControlEventStream {
983 event_receiver: fidl::client::EventReceiver<fdomain_client::fidl::FDomainResourceDialect>,
984}
985
986impl std::marker::Unpin for VolumeControlEventStream {}
987
988impl futures::stream::FusedStream for VolumeControlEventStream {
989 fn is_terminated(&self) -> bool {
990 self.event_receiver.is_terminated()
991 }
992}
993
994impl futures::Stream for VolumeControlEventStream {
995 type Item = Result<VolumeControlEvent, fidl::Error>;
996
997 fn poll_next(
998 mut self: std::pin::Pin<&mut Self>,
999 cx: &mut std::task::Context<'_>,
1000 ) -> std::task::Poll<Option<Self::Item>> {
1001 match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
1002 &mut self.event_receiver,
1003 cx
1004 )?) {
1005 Some(buf) => std::task::Poll::Ready(Some(VolumeControlEvent::decode(buf))),
1006 None => std::task::Poll::Ready(None),
1007 }
1008 }
1009}
1010
1011#[derive(Debug)]
1012pub enum VolumeControlEvent {
1013 OnVolumeMuteChanged { new_volume: f32, new_muted: bool },
1014}
1015
1016impl VolumeControlEvent {
1017 #[allow(irrefutable_let_patterns)]
1018 pub fn into_on_volume_mute_changed(self) -> Option<(f32, bool)> {
1019 if let VolumeControlEvent::OnVolumeMuteChanged { new_volume, new_muted } = self {
1020 Some((new_volume, new_muted))
1021 } else {
1022 None
1023 }
1024 }
1025
1026 fn decode(
1028 mut buf: <fdomain_client::fidl::FDomainResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
1029 ) -> Result<VolumeControlEvent, fidl::Error> {
1030 let (bytes, _handles) = buf.split_mut();
1031 let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
1032 debug_assert_eq!(tx_header.tx_id, 0);
1033 match tx_header.ordinal {
1034 0x9cea352bd86c171 => {
1035 let mut out = fidl::new_empty!(
1036 VolumeControlOnVolumeMuteChangedRequest,
1037 fdomain_client::fidl::FDomainResourceDialect
1038 );
1039 fidl::encoding::Decoder::<fdomain_client::fidl::FDomainResourceDialect>::decode_into::<VolumeControlOnVolumeMuteChangedRequest>(&tx_header, _body_bytes, _handles, &mut out)?;
1040 Ok((VolumeControlEvent::OnVolumeMuteChanged {
1041 new_volume: out.new_volume,
1042 new_muted: out.new_muted,
1043 }))
1044 }
1045 _ => Err(fidl::Error::UnknownOrdinal {
1046 ordinal: tx_header.ordinal,
1047 protocol_name:
1048 <VolumeControlMarker as fdomain_client::fidl::ProtocolMarker>::DEBUG_NAME,
1049 }),
1050 }
1051 }
1052}
1053
1054pub struct VolumeControlRequestStream {
1056 inner: std::sync::Arc<fidl::ServeInner<fdomain_client::fidl::FDomainResourceDialect>>,
1057 is_terminated: bool,
1058}
1059
1060impl std::marker::Unpin for VolumeControlRequestStream {}
1061
1062impl futures::stream::FusedStream for VolumeControlRequestStream {
1063 fn is_terminated(&self) -> bool {
1064 self.is_terminated
1065 }
1066}
1067
1068impl fdomain_client::fidl::RequestStream for VolumeControlRequestStream {
1069 type Protocol = VolumeControlMarker;
1070 type ControlHandle = VolumeControlControlHandle;
1071
1072 fn from_channel(channel: fdomain_client::Channel) -> Self {
1073 Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
1074 }
1075
1076 fn control_handle(&self) -> Self::ControlHandle {
1077 VolumeControlControlHandle { inner: self.inner.clone() }
1078 }
1079
1080 fn into_inner(
1081 self,
1082 ) -> (::std::sync::Arc<fidl::ServeInner<fdomain_client::fidl::FDomainResourceDialect>>, bool)
1083 {
1084 (self.inner, self.is_terminated)
1085 }
1086
1087 fn from_inner(
1088 inner: std::sync::Arc<fidl::ServeInner<fdomain_client::fidl::FDomainResourceDialect>>,
1089 is_terminated: bool,
1090 ) -> Self {
1091 Self { inner, is_terminated }
1092 }
1093}
1094
1095impl futures::Stream for VolumeControlRequestStream {
1096 type Item = Result<VolumeControlRequest, fidl::Error>;
1097
1098 fn poll_next(
1099 mut self: std::pin::Pin<&mut Self>,
1100 cx: &mut std::task::Context<'_>,
1101 ) -> std::task::Poll<Option<Self::Item>> {
1102 let this = &mut *self;
1103 if this.inner.check_shutdown(cx) {
1104 this.is_terminated = true;
1105 return std::task::Poll::Ready(None);
1106 }
1107 if this.is_terminated {
1108 panic!("polled VolumeControlRequestStream after completion");
1109 }
1110 fidl::encoding::with_tls_decode_buf::<_, fdomain_client::fidl::FDomainResourceDialect>(
1111 |bytes, handles| {
1112 match this.inner.channel().read_etc(cx, bytes, handles) {
1113 std::task::Poll::Ready(Ok(())) => {}
1114 std::task::Poll::Pending => return std::task::Poll::Pending,
1115 std::task::Poll::Ready(Err(None)) => {
1116 this.is_terminated = true;
1117 return std::task::Poll::Ready(None);
1118 }
1119 std::task::Poll::Ready(Err(Some(e))) => {
1120 return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
1121 e.into(),
1122 ))));
1123 }
1124 }
1125
1126 let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
1128
1129 std::task::Poll::Ready(Some(match header.ordinal {
1130 0x6ff4231809a697da => {
1131 header.validate_request_tx_id(fidl::MethodType::OneWay)?;
1132 let mut req = fidl::new_empty!(VolumeControlSetVolumeRequest, fdomain_client::fidl::FDomainResourceDialect);
1133 fidl::encoding::Decoder::<fdomain_client::fidl::FDomainResourceDialect>::decode_into::<VolumeControlSetVolumeRequest>(&header, _body_bytes, handles, &mut req)?;
1134 let control_handle = VolumeControlControlHandle {
1135 inner: this.inner.clone(),
1136 };
1137 Ok(VolumeControlRequest::SetVolume {volume: req.volume,
1138
1139 control_handle,
1140 })
1141 }
1142 0x50c10c28bba46425 => {
1143 header.validate_request_tx_id(fidl::MethodType::OneWay)?;
1144 let mut req = fidl::new_empty!(VolumeControlSetMuteRequest, fdomain_client::fidl::FDomainResourceDialect);
1145 fidl::encoding::Decoder::<fdomain_client::fidl::FDomainResourceDialect>::decode_into::<VolumeControlSetMuteRequest>(&header, _body_bytes, handles, &mut req)?;
1146 let control_handle = VolumeControlControlHandle {
1147 inner: this.inner.clone(),
1148 };
1149 Ok(VolumeControlRequest::SetMute {mute: req.mute,
1150
1151 control_handle,
1152 })
1153 }
1154 _ => Err(fidl::Error::UnknownOrdinal {
1155 ordinal: header.ordinal,
1156 protocol_name: <VolumeControlMarker as fdomain_client::fidl::ProtocolMarker>::DEBUG_NAME,
1157 }),
1158 }))
1159 },
1160 )
1161 }
1162}
1163
1164#[derive(Debug)]
1166pub enum VolumeControlRequest {
1167 SetVolume { volume: f32, control_handle: VolumeControlControlHandle },
1171 SetMute { mute: bool, control_handle: VolumeControlControlHandle },
1176}
1177
1178impl VolumeControlRequest {
1179 #[allow(irrefutable_let_patterns)]
1180 pub fn into_set_volume(self) -> Option<(f32, VolumeControlControlHandle)> {
1181 if let VolumeControlRequest::SetVolume { volume, control_handle } = self {
1182 Some((volume, control_handle))
1183 } else {
1184 None
1185 }
1186 }
1187
1188 #[allow(irrefutable_let_patterns)]
1189 pub fn into_set_mute(self) -> Option<(bool, VolumeControlControlHandle)> {
1190 if let VolumeControlRequest::SetMute { mute, control_handle } = self {
1191 Some((mute, control_handle))
1192 } else {
1193 None
1194 }
1195 }
1196
1197 pub fn method_name(&self) -> &'static str {
1199 match *self {
1200 VolumeControlRequest::SetVolume { .. } => "set_volume",
1201 VolumeControlRequest::SetMute { .. } => "set_mute",
1202 }
1203 }
1204}
1205
1206#[derive(Debug, Clone)]
1207pub struct VolumeControlControlHandle {
1208 inner: std::sync::Arc<fidl::ServeInner<fdomain_client::fidl::FDomainResourceDialect>>,
1209}
1210
1211impl fdomain_client::fidl::ControlHandle for VolumeControlControlHandle {
1212 fn shutdown(&self) {
1213 self.inner.shutdown()
1214 }
1215
1216 fn shutdown_with_epitaph(&self, status: zx_status::Status) {
1217 self.inner.shutdown_with_epitaph(status)
1218 }
1219
1220 fn is_closed(&self) -> bool {
1221 self.inner.channel().is_closed()
1222 }
1223 fn on_closed(&self) -> fdomain_client::OnFDomainSignals {
1224 self.inner.channel().on_closed()
1225 }
1226}
1227
1228impl VolumeControlControlHandle {
1229 pub fn send_on_volume_mute_changed(
1230 &self,
1231 mut new_volume: f32,
1232 mut new_muted: bool,
1233 ) -> Result<(), fidl::Error> {
1234 self.inner.send::<VolumeControlOnVolumeMuteChangedRequest>(
1235 (new_volume, new_muted),
1236 0,
1237 0x9cea352bd86c171,
1238 fidl::encoding::DynamicFlags::empty(),
1239 )
1240 }
1241}
1242
1243mod internal {
1244 use super::*;
1245}