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 EffectsControllerControlHandle {
334 pub fn shutdown_with_epitaph(&self, status: impl Into<fidl::Epitaph>) {
335 self.inner.shutdown_with_epitaph(status.into())
336 }
337}
338
339impl fdomain_client::fidl::ControlHandle for EffectsControllerControlHandle {
340 fn shutdown(&self) {
341 self.inner.shutdown()
342 }
343
344 fn shutdown_with_epitaph(&self, status: fidl::Epitaph) {
345 self.inner.shutdown_with_epitaph(status)
346 }
347
348 fn is_closed(&self) -> bool {
349 self.inner.channel().is_closed()
350 }
351 fn on_closed(&self) -> fdomain_client::OnFDomainSignals {
352 self.inner.channel().on_closed()
353 }
354}
355
356impl EffectsControllerControlHandle {}
357
358#[must_use = "FIDL methods require a response to be sent"]
359#[derive(Debug)]
360pub struct EffectsControllerUpdateEffectResponder {
361 control_handle: std::mem::ManuallyDrop<EffectsControllerControlHandle>,
362 tx_id: u32,
363}
364
365impl std::ops::Drop for EffectsControllerUpdateEffectResponder {
369 fn drop(&mut self) {
370 self.control_handle.shutdown();
371 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
373 }
374}
375
376impl fdomain_client::fidl::Responder for EffectsControllerUpdateEffectResponder {
377 type ControlHandle = EffectsControllerControlHandle;
378
379 fn control_handle(&self) -> &EffectsControllerControlHandle {
380 &self.control_handle
381 }
382
383 fn drop_without_shutdown(mut self) {
384 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
386 std::mem::forget(self);
388 }
389}
390
391impl EffectsControllerUpdateEffectResponder {
392 pub fn send(self, mut result: Result<(), UpdateEffectError>) -> Result<(), fidl::Error> {
396 let _result = self.send_raw(result);
397 if _result.is_err() {
398 self.control_handle.shutdown();
399 }
400 self.drop_without_shutdown();
401 _result
402 }
403
404 pub fn send_no_shutdown_on_err(
406 self,
407 mut result: Result<(), UpdateEffectError>,
408 ) -> Result<(), fidl::Error> {
409 let _result = self.send_raw(result);
410 self.drop_without_shutdown();
411 _result
412 }
413
414 fn send_raw(&self, mut result: Result<(), UpdateEffectError>) -> Result<(), fidl::Error> {
415 self.control_handle.inner.send::<fidl::encoding::ResultType<
416 fidl::encoding::EmptyStruct,
417 UpdateEffectError,
418 >>(
419 result,
420 self.tx_id,
421 0x4e39e4b5e6279125,
422 fidl::encoding::DynamicFlags::empty(),
423 )
424 }
425}
426
427#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
428pub struct GainControlMarker;
429
430impl fdomain_client::fidl::ProtocolMarker for GainControlMarker {
431 type Proxy = GainControlProxy;
432 type RequestStream = GainControlRequestStream;
433
434 const DEBUG_NAME: &'static str = "(anonymous) GainControl";
435}
436
437pub trait GainControlProxyInterface: Send + Sync {
438 fn r#set_gain(&self, gain_db: f32) -> Result<(), fidl::Error>;
439 fn r#set_gain_with_ramp(
440 &self,
441 gain_db: f32,
442 duration: i64,
443 ramp_type: RampType,
444 ) -> Result<(), fidl::Error>;
445 fn r#set_mute(&self, muted: bool) -> Result<(), fidl::Error>;
446}
447
448#[derive(Debug, Clone)]
449pub struct GainControlProxy {
450 client: fidl::client::Client<fdomain_client::fidl::FDomainResourceDialect>,
451}
452
453impl fdomain_client::fidl::Proxy for GainControlProxy {
454 type Protocol = GainControlMarker;
455
456 fn from_channel(inner: fdomain_client::Channel) -> Self {
457 Self::new(inner)
458 }
459
460 fn into_channel(self) -> Result<fdomain_client::Channel, Self> {
461 self.client.into_channel().map_err(|client| Self { client })
462 }
463
464 fn as_channel(&self) -> &fdomain_client::Channel {
465 self.client.as_channel()
466 }
467}
468
469impl GainControlProxy {
470 pub fn new(channel: fdomain_client::Channel) -> Self {
472 let protocol_name = <GainControlMarker as fdomain_client::fidl::ProtocolMarker>::DEBUG_NAME;
473 Self { client: fidl::client::Client::new(channel, protocol_name) }
474 }
475
476 pub fn take_event_stream(&self) -> GainControlEventStream {
482 GainControlEventStream { event_receiver: self.client.take_event_receiver() }
483 }
484
485 pub fn r#set_gain(&self, mut gain_db: f32) -> Result<(), fidl::Error> {
487 GainControlProxyInterface::r#set_gain(self, gain_db)
488 }
489
490 pub fn r#set_gain_with_ramp(
527 &self,
528 mut gain_db: f32,
529 mut duration: i64,
530 mut ramp_type: RampType,
531 ) -> Result<(), fidl::Error> {
532 GainControlProxyInterface::r#set_gain_with_ramp(self, gain_db, duration, ramp_type)
533 }
534
535 pub fn r#set_mute(&self, mut muted: bool) -> Result<(), fidl::Error> {
538 GainControlProxyInterface::r#set_mute(self, muted)
539 }
540}
541
542impl GainControlProxyInterface for GainControlProxy {
543 fn r#set_gain(&self, mut gain_db: f32) -> Result<(), fidl::Error> {
544 self.client.send::<GainControlSetGainRequest>(
545 (gain_db,),
546 0x2fc070871d033f64,
547 fidl::encoding::DynamicFlags::empty(),
548 )
549 }
550
551 fn r#set_gain_with_ramp(
552 &self,
553 mut gain_db: f32,
554 mut duration: i64,
555 mut ramp_type: RampType,
556 ) -> Result<(), fidl::Error> {
557 self.client.send::<GainControlSetGainWithRampRequest>(
558 (gain_db, duration, ramp_type),
559 0x3a175b2d6979e8ea,
560 fidl::encoding::DynamicFlags::empty(),
561 )
562 }
563
564 fn r#set_mute(&self, mut muted: bool) -> Result<(), fidl::Error> {
565 self.client.send::<GainControlSetMuteRequest>(
566 (muted,),
567 0x5415723c1e31448,
568 fidl::encoding::DynamicFlags::empty(),
569 )
570 }
571}
572
573pub struct GainControlEventStream {
574 event_receiver: fidl::client::EventReceiver<fdomain_client::fidl::FDomainResourceDialect>,
575}
576
577impl std::marker::Unpin for GainControlEventStream {}
578
579impl futures::stream::FusedStream for GainControlEventStream {
580 fn is_terminated(&self) -> bool {
581 self.event_receiver.is_terminated()
582 }
583}
584
585impl futures::Stream for GainControlEventStream {
586 type Item = Result<GainControlEvent, fidl::Error>;
587
588 fn poll_next(
589 mut self: std::pin::Pin<&mut Self>,
590 cx: &mut std::task::Context<'_>,
591 ) -> std::task::Poll<Option<Self::Item>> {
592 match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
593 &mut self.event_receiver,
594 cx
595 )?) {
596 Some(buf) => std::task::Poll::Ready(Some(GainControlEvent::decode(buf))),
597 None => std::task::Poll::Ready(None),
598 }
599 }
600}
601
602#[derive(Debug)]
603pub enum GainControlEvent {
604 OnGainMuteChanged { gain_db: f32, muted: bool },
605}
606
607impl GainControlEvent {
608 #[allow(irrefutable_let_patterns)]
609 pub fn into_on_gain_mute_changed(self) -> Option<(f32, bool)> {
610 if let GainControlEvent::OnGainMuteChanged { gain_db, muted } = self {
611 Some((gain_db, muted))
612 } else {
613 None
614 }
615 }
616
617 fn decode(
619 mut buf: <fdomain_client::fidl::FDomainResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
620 ) -> Result<GainControlEvent, fidl::Error> {
621 let (bytes, _handles) = buf.split_mut();
622 let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
623 debug_assert_eq!(tx_header.tx_id, 0);
624 match tx_header.ordinal {
625 0x66d528cad4e0d753 => {
626 let mut out = fidl::new_empty!(
627 GainControlOnGainMuteChangedRequest,
628 fdomain_client::fidl::FDomainResourceDialect
629 );
630 fidl::encoding::Decoder::<fdomain_client::fidl::FDomainResourceDialect>::decode_into::<GainControlOnGainMuteChangedRequest>(&tx_header, _body_bytes, _handles, &mut out)?;
631 Ok((GainControlEvent::OnGainMuteChanged { gain_db: out.gain_db, muted: out.muted }))
632 }
633 _ => Err(fidl::Error::UnknownOrdinal {
634 ordinal: tx_header.ordinal,
635 protocol_name:
636 <GainControlMarker as fdomain_client::fidl::ProtocolMarker>::DEBUG_NAME,
637 }),
638 }
639 }
640}
641
642pub struct GainControlRequestStream {
644 inner: std::sync::Arc<fidl::ServeInner<fdomain_client::fidl::FDomainResourceDialect>>,
645 is_terminated: bool,
646}
647
648impl std::marker::Unpin for GainControlRequestStream {}
649
650impl futures::stream::FusedStream for GainControlRequestStream {
651 fn is_terminated(&self) -> bool {
652 self.is_terminated
653 }
654}
655
656impl fdomain_client::fidl::RequestStream for GainControlRequestStream {
657 type Protocol = GainControlMarker;
658 type ControlHandle = GainControlControlHandle;
659
660 fn from_channel(channel: fdomain_client::Channel) -> Self {
661 Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
662 }
663
664 fn control_handle(&self) -> Self::ControlHandle {
665 GainControlControlHandle { inner: self.inner.clone() }
666 }
667
668 fn into_inner(
669 self,
670 ) -> (::std::sync::Arc<fidl::ServeInner<fdomain_client::fidl::FDomainResourceDialect>>, bool)
671 {
672 (self.inner, self.is_terminated)
673 }
674
675 fn from_inner(
676 inner: std::sync::Arc<fidl::ServeInner<fdomain_client::fidl::FDomainResourceDialect>>,
677 is_terminated: bool,
678 ) -> Self {
679 Self { inner, is_terminated }
680 }
681}
682
683impl futures::Stream for GainControlRequestStream {
684 type Item = Result<GainControlRequest, fidl::Error>;
685
686 fn poll_next(
687 mut self: std::pin::Pin<&mut Self>,
688 cx: &mut std::task::Context<'_>,
689 ) -> std::task::Poll<Option<Self::Item>> {
690 let this = &mut *self;
691 if this.inner.check_shutdown(cx) {
692 this.is_terminated = true;
693 return std::task::Poll::Ready(None);
694 }
695 if this.is_terminated {
696 panic!("polled GainControlRequestStream after completion");
697 }
698 fidl::encoding::with_tls_decode_buf::<_, fdomain_client::fidl::FDomainResourceDialect>(
699 |bytes, handles| {
700 match this.inner.channel().read_etc(cx, bytes, handles) {
701 std::task::Poll::Ready(Ok(())) => {}
702 std::task::Poll::Pending => return std::task::Poll::Pending,
703 std::task::Poll::Ready(Err(None)) => {
704 this.is_terminated = true;
705 return std::task::Poll::Ready(None);
706 }
707 std::task::Poll::Ready(Err(Some(e))) => {
708 return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
709 e.into(),
710 ))));
711 }
712 }
713
714 let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
716
717 std::task::Poll::Ready(Some(match header.ordinal {
718 0x2fc070871d033f64 => {
719 header.validate_request_tx_id(fidl::MethodType::OneWay)?;
720 let mut req = fidl::new_empty!(
721 GainControlSetGainRequest,
722 fdomain_client::fidl::FDomainResourceDialect
723 );
724 fidl::encoding::Decoder::<fdomain_client::fidl::FDomainResourceDialect>::decode_into::<GainControlSetGainRequest>(&header, _body_bytes, handles, &mut req)?;
725 let control_handle = GainControlControlHandle { inner: this.inner.clone() };
726 Ok(GainControlRequest::SetGain { gain_db: req.gain_db, control_handle })
727 }
728 0x3a175b2d6979e8ea => {
729 header.validate_request_tx_id(fidl::MethodType::OneWay)?;
730 let mut req = fidl::new_empty!(
731 GainControlSetGainWithRampRequest,
732 fdomain_client::fidl::FDomainResourceDialect
733 );
734 fidl::encoding::Decoder::<fdomain_client::fidl::FDomainResourceDialect>::decode_into::<GainControlSetGainWithRampRequest>(&header, _body_bytes, handles, &mut req)?;
735 let control_handle = GainControlControlHandle { inner: this.inner.clone() };
736 Ok(GainControlRequest::SetGainWithRamp {
737 gain_db: req.gain_db,
738 duration: req.duration,
739 ramp_type: req.ramp_type,
740
741 control_handle,
742 })
743 }
744 0x5415723c1e31448 => {
745 header.validate_request_tx_id(fidl::MethodType::OneWay)?;
746 let mut req = fidl::new_empty!(
747 GainControlSetMuteRequest,
748 fdomain_client::fidl::FDomainResourceDialect
749 );
750 fidl::encoding::Decoder::<fdomain_client::fidl::FDomainResourceDialect>::decode_into::<GainControlSetMuteRequest>(&header, _body_bytes, handles, &mut req)?;
751 let control_handle = GainControlControlHandle { inner: this.inner.clone() };
752 Ok(GainControlRequest::SetMute { muted: req.muted, control_handle })
753 }
754 _ => Err(fidl::Error::UnknownOrdinal {
755 ordinal: header.ordinal,
756 protocol_name:
757 <GainControlMarker as fdomain_client::fidl::ProtocolMarker>::DEBUG_NAME,
758 }),
759 }))
760 },
761 )
762 }
763}
764
765#[derive(Debug)]
770pub enum GainControlRequest {
771 SetGain { gain_db: f32, control_handle: GainControlControlHandle },
773 SetGainWithRamp {
810 gain_db: f32,
811 duration: i64,
812 ramp_type: RampType,
813 control_handle: GainControlControlHandle,
814 },
815 SetMute { muted: bool, control_handle: GainControlControlHandle },
818}
819
820impl GainControlRequest {
821 #[allow(irrefutable_let_patterns)]
822 pub fn into_set_gain(self) -> Option<(f32, GainControlControlHandle)> {
823 if let GainControlRequest::SetGain { gain_db, control_handle } = self {
824 Some((gain_db, control_handle))
825 } else {
826 None
827 }
828 }
829
830 #[allow(irrefutable_let_patterns)]
831 pub fn into_set_gain_with_ramp(self) -> Option<(f32, i64, RampType, GainControlControlHandle)> {
832 if let GainControlRequest::SetGainWithRamp {
833 gain_db,
834 duration,
835 ramp_type,
836 control_handle,
837 } = self
838 {
839 Some((gain_db, duration, ramp_type, control_handle))
840 } else {
841 None
842 }
843 }
844
845 #[allow(irrefutable_let_patterns)]
846 pub fn into_set_mute(self) -> Option<(bool, GainControlControlHandle)> {
847 if let GainControlRequest::SetMute { muted, control_handle } = self {
848 Some((muted, control_handle))
849 } else {
850 None
851 }
852 }
853
854 pub fn method_name(&self) -> &'static str {
856 match *self {
857 GainControlRequest::SetGain { .. } => "set_gain",
858 GainControlRequest::SetGainWithRamp { .. } => "set_gain_with_ramp",
859 GainControlRequest::SetMute { .. } => "set_mute",
860 }
861 }
862}
863
864#[derive(Debug, Clone)]
865pub struct GainControlControlHandle {
866 inner: std::sync::Arc<fidl::ServeInner<fdomain_client::fidl::FDomainResourceDialect>>,
867}
868
869impl GainControlControlHandle {
870 pub fn shutdown_with_epitaph(&self, status: impl Into<fidl::Epitaph>) {
871 self.inner.shutdown_with_epitaph(status.into())
872 }
873}
874
875impl fdomain_client::fidl::ControlHandle for GainControlControlHandle {
876 fn shutdown(&self) {
877 self.inner.shutdown()
878 }
879
880 fn shutdown_with_epitaph(&self, status: fidl::Epitaph) {
881 self.inner.shutdown_with_epitaph(status)
882 }
883
884 fn is_closed(&self) -> bool {
885 self.inner.channel().is_closed()
886 }
887 fn on_closed(&self) -> fdomain_client::OnFDomainSignals {
888 self.inner.channel().on_closed()
889 }
890}
891
892impl GainControlControlHandle {
893 pub fn send_on_gain_mute_changed(
894 &self,
895 mut gain_db: f32,
896 mut muted: bool,
897 ) -> Result<(), fidl::Error> {
898 self.inner.send::<GainControlOnGainMuteChangedRequest>(
899 (gain_db, muted),
900 0,
901 0x66d528cad4e0d753,
902 fidl::encoding::DynamicFlags::empty(),
903 )
904 }
905}
906
907#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
908pub struct VolumeControlMarker;
909
910impl fdomain_client::fidl::ProtocolMarker for VolumeControlMarker {
911 type Proxy = VolumeControlProxy;
912 type RequestStream = VolumeControlRequestStream;
913
914 const DEBUG_NAME: &'static str = "(anonymous) VolumeControl";
915}
916
917pub trait VolumeControlProxyInterface: Send + Sync {
918 fn r#set_volume(&self, volume: f32) -> Result<(), fidl::Error>;
919 fn r#set_mute(&self, mute: bool) -> Result<(), fidl::Error>;
920}
921
922#[derive(Debug, Clone)]
923pub struct VolumeControlProxy {
924 client: fidl::client::Client<fdomain_client::fidl::FDomainResourceDialect>,
925}
926
927impl fdomain_client::fidl::Proxy for VolumeControlProxy {
928 type Protocol = VolumeControlMarker;
929
930 fn from_channel(inner: fdomain_client::Channel) -> Self {
931 Self::new(inner)
932 }
933
934 fn into_channel(self) -> Result<fdomain_client::Channel, Self> {
935 self.client.into_channel().map_err(|client| Self { client })
936 }
937
938 fn as_channel(&self) -> &fdomain_client::Channel {
939 self.client.as_channel()
940 }
941}
942
943impl VolumeControlProxy {
944 pub fn new(channel: fdomain_client::Channel) -> Self {
946 let protocol_name =
947 <VolumeControlMarker as fdomain_client::fidl::ProtocolMarker>::DEBUG_NAME;
948 Self { client: fidl::client::Client::new(channel, protocol_name) }
949 }
950
951 pub fn take_event_stream(&self) -> VolumeControlEventStream {
957 VolumeControlEventStream { event_receiver: self.client.take_event_receiver() }
958 }
959
960 pub fn r#set_volume(&self, mut volume: f32) -> Result<(), fidl::Error> {
964 VolumeControlProxyInterface::r#set_volume(self, volume)
965 }
966
967 pub fn r#set_mute(&self, mut mute: bool) -> Result<(), fidl::Error> {
972 VolumeControlProxyInterface::r#set_mute(self, mute)
973 }
974}
975
976impl VolumeControlProxyInterface for VolumeControlProxy {
977 fn r#set_volume(&self, mut volume: f32) -> Result<(), fidl::Error> {
978 self.client.send::<VolumeControlSetVolumeRequest>(
979 (volume,),
980 0x6ff4231809a697da,
981 fidl::encoding::DynamicFlags::empty(),
982 )
983 }
984
985 fn r#set_mute(&self, mut mute: bool) -> Result<(), fidl::Error> {
986 self.client.send::<VolumeControlSetMuteRequest>(
987 (mute,),
988 0x50c10c28bba46425,
989 fidl::encoding::DynamicFlags::empty(),
990 )
991 }
992}
993
994pub struct VolumeControlEventStream {
995 event_receiver: fidl::client::EventReceiver<fdomain_client::fidl::FDomainResourceDialect>,
996}
997
998impl std::marker::Unpin for VolumeControlEventStream {}
999
1000impl futures::stream::FusedStream for VolumeControlEventStream {
1001 fn is_terminated(&self) -> bool {
1002 self.event_receiver.is_terminated()
1003 }
1004}
1005
1006impl futures::Stream for VolumeControlEventStream {
1007 type Item = Result<VolumeControlEvent, fidl::Error>;
1008
1009 fn poll_next(
1010 mut self: std::pin::Pin<&mut Self>,
1011 cx: &mut std::task::Context<'_>,
1012 ) -> std::task::Poll<Option<Self::Item>> {
1013 match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
1014 &mut self.event_receiver,
1015 cx
1016 )?) {
1017 Some(buf) => std::task::Poll::Ready(Some(VolumeControlEvent::decode(buf))),
1018 None => std::task::Poll::Ready(None),
1019 }
1020 }
1021}
1022
1023#[derive(Debug)]
1024pub enum VolumeControlEvent {
1025 OnVolumeMuteChanged { new_volume: f32, new_muted: bool },
1026}
1027
1028impl VolumeControlEvent {
1029 #[allow(irrefutable_let_patterns)]
1030 pub fn into_on_volume_mute_changed(self) -> Option<(f32, bool)> {
1031 if let VolumeControlEvent::OnVolumeMuteChanged { new_volume, new_muted } = self {
1032 Some((new_volume, new_muted))
1033 } else {
1034 None
1035 }
1036 }
1037
1038 fn decode(
1040 mut buf: <fdomain_client::fidl::FDomainResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
1041 ) -> Result<VolumeControlEvent, fidl::Error> {
1042 let (bytes, _handles) = buf.split_mut();
1043 let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
1044 debug_assert_eq!(tx_header.tx_id, 0);
1045 match tx_header.ordinal {
1046 0x9cea352bd86c171 => {
1047 let mut out = fidl::new_empty!(
1048 VolumeControlOnVolumeMuteChangedRequest,
1049 fdomain_client::fidl::FDomainResourceDialect
1050 );
1051 fidl::encoding::Decoder::<fdomain_client::fidl::FDomainResourceDialect>::decode_into::<VolumeControlOnVolumeMuteChangedRequest>(&tx_header, _body_bytes, _handles, &mut out)?;
1052 Ok((VolumeControlEvent::OnVolumeMuteChanged {
1053 new_volume: out.new_volume,
1054 new_muted: out.new_muted,
1055 }))
1056 }
1057 _ => Err(fidl::Error::UnknownOrdinal {
1058 ordinal: tx_header.ordinal,
1059 protocol_name:
1060 <VolumeControlMarker as fdomain_client::fidl::ProtocolMarker>::DEBUG_NAME,
1061 }),
1062 }
1063 }
1064}
1065
1066pub struct VolumeControlRequestStream {
1068 inner: std::sync::Arc<fidl::ServeInner<fdomain_client::fidl::FDomainResourceDialect>>,
1069 is_terminated: bool,
1070}
1071
1072impl std::marker::Unpin for VolumeControlRequestStream {}
1073
1074impl futures::stream::FusedStream for VolumeControlRequestStream {
1075 fn is_terminated(&self) -> bool {
1076 self.is_terminated
1077 }
1078}
1079
1080impl fdomain_client::fidl::RequestStream for VolumeControlRequestStream {
1081 type Protocol = VolumeControlMarker;
1082 type ControlHandle = VolumeControlControlHandle;
1083
1084 fn from_channel(channel: fdomain_client::Channel) -> Self {
1085 Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
1086 }
1087
1088 fn control_handle(&self) -> Self::ControlHandle {
1089 VolumeControlControlHandle { inner: self.inner.clone() }
1090 }
1091
1092 fn into_inner(
1093 self,
1094 ) -> (::std::sync::Arc<fidl::ServeInner<fdomain_client::fidl::FDomainResourceDialect>>, bool)
1095 {
1096 (self.inner, self.is_terminated)
1097 }
1098
1099 fn from_inner(
1100 inner: std::sync::Arc<fidl::ServeInner<fdomain_client::fidl::FDomainResourceDialect>>,
1101 is_terminated: bool,
1102 ) -> Self {
1103 Self { inner, is_terminated }
1104 }
1105}
1106
1107impl futures::Stream for VolumeControlRequestStream {
1108 type Item = Result<VolumeControlRequest, fidl::Error>;
1109
1110 fn poll_next(
1111 mut self: std::pin::Pin<&mut Self>,
1112 cx: &mut std::task::Context<'_>,
1113 ) -> std::task::Poll<Option<Self::Item>> {
1114 let this = &mut *self;
1115 if this.inner.check_shutdown(cx) {
1116 this.is_terminated = true;
1117 return std::task::Poll::Ready(None);
1118 }
1119 if this.is_terminated {
1120 panic!("polled VolumeControlRequestStream after completion");
1121 }
1122 fidl::encoding::with_tls_decode_buf::<_, fdomain_client::fidl::FDomainResourceDialect>(
1123 |bytes, handles| {
1124 match this.inner.channel().read_etc(cx, bytes, handles) {
1125 std::task::Poll::Ready(Ok(())) => {}
1126 std::task::Poll::Pending => return std::task::Poll::Pending,
1127 std::task::Poll::Ready(Err(None)) => {
1128 this.is_terminated = true;
1129 return std::task::Poll::Ready(None);
1130 }
1131 std::task::Poll::Ready(Err(Some(e))) => {
1132 return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
1133 e.into(),
1134 ))));
1135 }
1136 }
1137
1138 let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
1140
1141 std::task::Poll::Ready(Some(match header.ordinal {
1142 0x6ff4231809a697da => {
1143 header.validate_request_tx_id(fidl::MethodType::OneWay)?;
1144 let mut req = fidl::new_empty!(VolumeControlSetVolumeRequest, fdomain_client::fidl::FDomainResourceDialect);
1145 fidl::encoding::Decoder::<fdomain_client::fidl::FDomainResourceDialect>::decode_into::<VolumeControlSetVolumeRequest>(&header, _body_bytes, handles, &mut req)?;
1146 let control_handle = VolumeControlControlHandle {
1147 inner: this.inner.clone(),
1148 };
1149 Ok(VolumeControlRequest::SetVolume {volume: req.volume,
1150
1151 control_handle,
1152 })
1153 }
1154 0x50c10c28bba46425 => {
1155 header.validate_request_tx_id(fidl::MethodType::OneWay)?;
1156 let mut req = fidl::new_empty!(VolumeControlSetMuteRequest, fdomain_client::fidl::FDomainResourceDialect);
1157 fidl::encoding::Decoder::<fdomain_client::fidl::FDomainResourceDialect>::decode_into::<VolumeControlSetMuteRequest>(&header, _body_bytes, handles, &mut req)?;
1158 let control_handle = VolumeControlControlHandle {
1159 inner: this.inner.clone(),
1160 };
1161 Ok(VolumeControlRequest::SetMute {mute: req.mute,
1162
1163 control_handle,
1164 })
1165 }
1166 _ => Err(fidl::Error::UnknownOrdinal {
1167 ordinal: header.ordinal,
1168 protocol_name: <VolumeControlMarker as fdomain_client::fidl::ProtocolMarker>::DEBUG_NAME,
1169 }),
1170 }))
1171 },
1172 )
1173 }
1174}
1175
1176#[derive(Debug)]
1178pub enum VolumeControlRequest {
1179 SetVolume { volume: f32, control_handle: VolumeControlControlHandle },
1183 SetMute { mute: bool, control_handle: VolumeControlControlHandle },
1188}
1189
1190impl VolumeControlRequest {
1191 #[allow(irrefutable_let_patterns)]
1192 pub fn into_set_volume(self) -> Option<(f32, VolumeControlControlHandle)> {
1193 if let VolumeControlRequest::SetVolume { volume, control_handle } = self {
1194 Some((volume, control_handle))
1195 } else {
1196 None
1197 }
1198 }
1199
1200 #[allow(irrefutable_let_patterns)]
1201 pub fn into_set_mute(self) -> Option<(bool, VolumeControlControlHandle)> {
1202 if let VolumeControlRequest::SetMute { mute, control_handle } = self {
1203 Some((mute, control_handle))
1204 } else {
1205 None
1206 }
1207 }
1208
1209 pub fn method_name(&self) -> &'static str {
1211 match *self {
1212 VolumeControlRequest::SetVolume { .. } => "set_volume",
1213 VolumeControlRequest::SetMute { .. } => "set_mute",
1214 }
1215 }
1216}
1217
1218#[derive(Debug, Clone)]
1219pub struct VolumeControlControlHandle {
1220 inner: std::sync::Arc<fidl::ServeInner<fdomain_client::fidl::FDomainResourceDialect>>,
1221}
1222
1223impl VolumeControlControlHandle {
1224 pub fn shutdown_with_epitaph(&self, status: impl Into<fidl::Epitaph>) {
1225 self.inner.shutdown_with_epitaph(status.into())
1226 }
1227}
1228
1229impl fdomain_client::fidl::ControlHandle for VolumeControlControlHandle {
1230 fn shutdown(&self) {
1231 self.inner.shutdown()
1232 }
1233
1234 fn shutdown_with_epitaph(&self, status: fidl::Epitaph) {
1235 self.inner.shutdown_with_epitaph(status)
1236 }
1237
1238 fn is_closed(&self) -> bool {
1239 self.inner.channel().is_closed()
1240 }
1241 fn on_closed(&self) -> fdomain_client::OnFDomainSignals {
1242 self.inner.channel().on_closed()
1243 }
1244}
1245
1246impl VolumeControlControlHandle {
1247 pub fn send_on_volume_mute_changed(
1248 &self,
1249 mut new_volume: f32,
1250 mut new_muted: bool,
1251 ) -> Result<(), fidl::Error> {
1252 self.inner.send::<VolumeControlOnVolumeMuteChangedRequest>(
1253 (new_volume, new_muted),
1254 0,
1255 0x9cea352bd86c171,
1256 fidl::encoding::DynamicFlags::empty(),
1257 )
1258 }
1259}
1260
1261mod internal {
1262 use super::*;
1263}