fidl_fuchsia_bluetooth_avrcp/
fidl_fuchsia_bluetooth_avrcp.rs

1// WARNING: This file is machine generated by fidlgen.
2
3#![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_bluetooth_avrcp__common::*;
11use futures::future::{self, MaybeDone, TryFutureExt};
12use zx_status;
13
14#[derive(Debug, PartialEq)]
15pub struct PeerManagerGetBrowseControllerForTargetRequest {
16    pub peer_id: fidl_fuchsia_bluetooth::PeerId,
17    pub client: fidl::endpoints::ServerEnd<BrowseControllerMarker>,
18}
19
20impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect>
21    for PeerManagerGetBrowseControllerForTargetRequest
22{
23}
24
25#[derive(Debug, PartialEq)]
26pub struct PeerManagerGetControllerForTargetRequest {
27    pub peer_id: fidl_fuchsia_bluetooth::PeerId,
28    pub client: fidl::endpoints::ServerEnd<ControllerMarker>,
29}
30
31impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect>
32    for PeerManagerGetControllerForTargetRequest
33{
34}
35
36#[derive(Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
37pub struct PeerManagerRegisterTargetHandlerRequest {
38    pub handler: fidl::endpoints::ClientEnd<TargetHandlerMarker>,
39}
40
41impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect>
42    for PeerManagerRegisterTargetHandlerRequest
43{
44}
45
46#[derive(Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
47pub struct PeerManagerSetAbsoluteVolumeHandlerRequest {
48    pub handler: fidl::endpoints::ClientEnd<AbsoluteVolumeHandlerMarker>,
49}
50
51impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect>
52    for PeerManagerSetAbsoluteVolumeHandlerRequest
53{
54}
55
56#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
57pub struct AbsoluteVolumeHandlerMarker;
58
59impl fidl::endpoints::ProtocolMarker for AbsoluteVolumeHandlerMarker {
60    type Proxy = AbsoluteVolumeHandlerProxy;
61    type RequestStream = AbsoluteVolumeHandlerRequestStream;
62    #[cfg(target_os = "fuchsia")]
63    type SynchronousProxy = AbsoluteVolumeHandlerSynchronousProxy;
64
65    const DEBUG_NAME: &'static str = "(anonymous) AbsoluteVolumeHandler";
66}
67
68pub trait AbsoluteVolumeHandlerProxyInterface: Send + Sync {
69    type SetVolumeResponseFut: std::future::Future<Output = Result<u8, fidl::Error>> + Send;
70    fn r#set_volume(&self, requested_volume: u8) -> Self::SetVolumeResponseFut;
71    type OnVolumeChangedResponseFut: std::future::Future<Output = Result<u8, fidl::Error>> + Send;
72    fn r#on_volume_changed(&self) -> Self::OnVolumeChangedResponseFut;
73    type GetCurrentVolumeResponseFut: std::future::Future<Output = Result<u8, fidl::Error>> + Send;
74    fn r#get_current_volume(&self) -> Self::GetCurrentVolumeResponseFut;
75}
76#[derive(Debug)]
77#[cfg(target_os = "fuchsia")]
78pub struct AbsoluteVolumeHandlerSynchronousProxy {
79    client: fidl::client::sync::Client,
80}
81
82#[cfg(target_os = "fuchsia")]
83impl fidl::endpoints::SynchronousProxy for AbsoluteVolumeHandlerSynchronousProxy {
84    type Proxy = AbsoluteVolumeHandlerProxy;
85    type Protocol = AbsoluteVolumeHandlerMarker;
86
87    fn from_channel(inner: fidl::Channel) -> Self {
88        Self::new(inner)
89    }
90
91    fn into_channel(self) -> fidl::Channel {
92        self.client.into_channel()
93    }
94
95    fn as_channel(&self) -> &fidl::Channel {
96        self.client.as_channel()
97    }
98}
99
100#[cfg(target_os = "fuchsia")]
101impl AbsoluteVolumeHandlerSynchronousProxy {
102    pub fn new(channel: fidl::Channel) -> Self {
103        let protocol_name =
104            <AbsoluteVolumeHandlerMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
105        Self { client: fidl::client::sync::Client::new(channel, protocol_name) }
106    }
107
108    pub fn into_channel(self) -> fidl::Channel {
109        self.client.into_channel()
110    }
111
112    /// Waits until an event arrives and returns it. It is safe for other
113    /// threads to make concurrent requests while waiting for an event.
114    pub fn wait_for_event(
115        &self,
116        deadline: zx::MonotonicInstant,
117    ) -> Result<AbsoluteVolumeHandlerEvent, fidl::Error> {
118        AbsoluteVolumeHandlerEvent::decode(self.client.wait_for_event(deadline)?)
119    }
120
121    /// Requests that the absolute volume of the player be changed.
122    /// `requested_volume` is the requested volume by the peer.
123    /// Returns the actual volume set locally by the handler.
124    pub fn r#set_volume(
125        &self,
126        mut requested_volume: u8,
127        ___deadline: zx::MonotonicInstant,
128    ) -> Result<u8, fidl::Error> {
129        let _response = self.client.send_query::<
130            AbsoluteVolumeHandlerSetVolumeRequest,
131            AbsoluteVolumeHandlerSetVolumeResponse,
132        >(
133            (requested_volume,),
134            0x2796843ecbdecc65,
135            fidl::encoding::DynamicFlags::empty(),
136            ___deadline,
137        )?;
138        Ok(_response.set_volume)
139    }
140
141    /// Returns latest volume of the handler to the AVRCP service. This function should return
142    /// immediately on the first call and if the volume has changed since the last call to this
143    /// function, otherwise it should only return when the volume has been changed.
144    /// Multiple outstanding `OnVolumeChanged` requests can be made - all outstanding calls will
145    /// return when the volume has been changed.
146    pub fn r#on_volume_changed(
147        &self,
148        ___deadline: zx::MonotonicInstant,
149    ) -> Result<u8, fidl::Error> {
150        let _response = self.client.send_query::<
151            fidl::encoding::EmptyPayload,
152            AbsoluteVolumeHandlerOnVolumeChangedResponse,
153        >(
154            (),
155            0x1a1f9cffd4f2a74,
156            fidl::encoding::DynamicFlags::empty(),
157            ___deadline,
158        )?;
159        Ok(_response.new_volume)
160    }
161
162    /// Returns the current volume immediately.
163    pub fn r#get_current_volume(
164        &self,
165        ___deadline: zx::MonotonicInstant,
166    ) -> Result<u8, fidl::Error> {
167        let _response = self.client.send_query::<
168            fidl::encoding::EmptyPayload,
169            AbsoluteVolumeHandlerGetCurrentVolumeResponse,
170        >(
171            (),
172            0x6ae76e0c77ac35ff,
173            fidl::encoding::DynamicFlags::empty(),
174            ___deadline,
175        )?;
176        Ok(_response.volume)
177    }
178}
179
180#[cfg(target_os = "fuchsia")]
181impl From<AbsoluteVolumeHandlerSynchronousProxy> for zx::Handle {
182    fn from(value: AbsoluteVolumeHandlerSynchronousProxy) -> Self {
183        value.into_channel().into()
184    }
185}
186
187#[cfg(target_os = "fuchsia")]
188impl From<fidl::Channel> for AbsoluteVolumeHandlerSynchronousProxy {
189    fn from(value: fidl::Channel) -> Self {
190        Self::new(value)
191    }
192}
193
194#[cfg(target_os = "fuchsia")]
195impl fidl::endpoints::FromClient for AbsoluteVolumeHandlerSynchronousProxy {
196    type Protocol = AbsoluteVolumeHandlerMarker;
197
198    fn from_client(value: fidl::endpoints::ClientEnd<AbsoluteVolumeHandlerMarker>) -> Self {
199        Self::new(value.into_channel())
200    }
201}
202
203#[derive(Debug, Clone)]
204pub struct AbsoluteVolumeHandlerProxy {
205    client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
206}
207
208impl fidl::endpoints::Proxy for AbsoluteVolumeHandlerProxy {
209    type Protocol = AbsoluteVolumeHandlerMarker;
210
211    fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
212        Self::new(inner)
213    }
214
215    fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
216        self.client.into_channel().map_err(|client| Self { client })
217    }
218
219    fn as_channel(&self) -> &::fidl::AsyncChannel {
220        self.client.as_channel()
221    }
222}
223
224impl AbsoluteVolumeHandlerProxy {
225    /// Create a new Proxy for fuchsia.bluetooth.avrcp/AbsoluteVolumeHandler.
226    pub fn new(channel: ::fidl::AsyncChannel) -> Self {
227        let protocol_name =
228            <AbsoluteVolumeHandlerMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
229        Self { client: fidl::client::Client::new(channel, protocol_name) }
230    }
231
232    /// Get a Stream of events from the remote end of the protocol.
233    ///
234    /// # Panics
235    ///
236    /// Panics if the event stream was already taken.
237    pub fn take_event_stream(&self) -> AbsoluteVolumeHandlerEventStream {
238        AbsoluteVolumeHandlerEventStream { event_receiver: self.client.take_event_receiver() }
239    }
240
241    /// Requests that the absolute volume of the player be changed.
242    /// `requested_volume` is the requested volume by the peer.
243    /// Returns the actual volume set locally by the handler.
244    pub fn r#set_volume(
245        &self,
246        mut requested_volume: u8,
247    ) -> fidl::client::QueryResponseFut<u8, fidl::encoding::DefaultFuchsiaResourceDialect> {
248        AbsoluteVolumeHandlerProxyInterface::r#set_volume(self, requested_volume)
249    }
250
251    /// Returns latest volume of the handler to the AVRCP service. This function should return
252    /// immediately on the first call and if the volume has changed since the last call to this
253    /// function, otherwise it should only return when the volume has been changed.
254    /// Multiple outstanding `OnVolumeChanged` requests can be made - all outstanding calls will
255    /// return when the volume has been changed.
256    pub fn r#on_volume_changed(
257        &self,
258    ) -> fidl::client::QueryResponseFut<u8, fidl::encoding::DefaultFuchsiaResourceDialect> {
259        AbsoluteVolumeHandlerProxyInterface::r#on_volume_changed(self)
260    }
261
262    /// Returns the current volume immediately.
263    pub fn r#get_current_volume(
264        &self,
265    ) -> fidl::client::QueryResponseFut<u8, fidl::encoding::DefaultFuchsiaResourceDialect> {
266        AbsoluteVolumeHandlerProxyInterface::r#get_current_volume(self)
267    }
268}
269
270impl AbsoluteVolumeHandlerProxyInterface for AbsoluteVolumeHandlerProxy {
271    type SetVolumeResponseFut =
272        fidl::client::QueryResponseFut<u8, fidl::encoding::DefaultFuchsiaResourceDialect>;
273    fn r#set_volume(&self, mut requested_volume: u8) -> Self::SetVolumeResponseFut {
274        fn _decode(
275            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
276        ) -> Result<u8, fidl::Error> {
277            let _response = fidl::client::decode_transaction_body::<
278                AbsoluteVolumeHandlerSetVolumeResponse,
279                fidl::encoding::DefaultFuchsiaResourceDialect,
280                0x2796843ecbdecc65,
281            >(_buf?)?;
282            Ok(_response.set_volume)
283        }
284        self.client.send_query_and_decode::<AbsoluteVolumeHandlerSetVolumeRequest, u8>(
285            (requested_volume,),
286            0x2796843ecbdecc65,
287            fidl::encoding::DynamicFlags::empty(),
288            _decode,
289        )
290    }
291
292    type OnVolumeChangedResponseFut =
293        fidl::client::QueryResponseFut<u8, fidl::encoding::DefaultFuchsiaResourceDialect>;
294    fn r#on_volume_changed(&self) -> Self::OnVolumeChangedResponseFut {
295        fn _decode(
296            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
297        ) -> Result<u8, fidl::Error> {
298            let _response = fidl::client::decode_transaction_body::<
299                AbsoluteVolumeHandlerOnVolumeChangedResponse,
300                fidl::encoding::DefaultFuchsiaResourceDialect,
301                0x1a1f9cffd4f2a74,
302            >(_buf?)?;
303            Ok(_response.new_volume)
304        }
305        self.client.send_query_and_decode::<fidl::encoding::EmptyPayload, u8>(
306            (),
307            0x1a1f9cffd4f2a74,
308            fidl::encoding::DynamicFlags::empty(),
309            _decode,
310        )
311    }
312
313    type GetCurrentVolumeResponseFut =
314        fidl::client::QueryResponseFut<u8, fidl::encoding::DefaultFuchsiaResourceDialect>;
315    fn r#get_current_volume(&self) -> Self::GetCurrentVolumeResponseFut {
316        fn _decode(
317            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
318        ) -> Result<u8, fidl::Error> {
319            let _response = fidl::client::decode_transaction_body::<
320                AbsoluteVolumeHandlerGetCurrentVolumeResponse,
321                fidl::encoding::DefaultFuchsiaResourceDialect,
322                0x6ae76e0c77ac35ff,
323            >(_buf?)?;
324            Ok(_response.volume)
325        }
326        self.client.send_query_and_decode::<fidl::encoding::EmptyPayload, u8>(
327            (),
328            0x6ae76e0c77ac35ff,
329            fidl::encoding::DynamicFlags::empty(),
330            _decode,
331        )
332    }
333}
334
335pub struct AbsoluteVolumeHandlerEventStream {
336    event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
337}
338
339impl std::marker::Unpin for AbsoluteVolumeHandlerEventStream {}
340
341impl futures::stream::FusedStream for AbsoluteVolumeHandlerEventStream {
342    fn is_terminated(&self) -> bool {
343        self.event_receiver.is_terminated()
344    }
345}
346
347impl futures::Stream for AbsoluteVolumeHandlerEventStream {
348    type Item = Result<AbsoluteVolumeHandlerEvent, fidl::Error>;
349
350    fn poll_next(
351        mut self: std::pin::Pin<&mut Self>,
352        cx: &mut std::task::Context<'_>,
353    ) -> std::task::Poll<Option<Self::Item>> {
354        match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
355            &mut self.event_receiver,
356            cx
357        )?) {
358            Some(buf) => std::task::Poll::Ready(Some(AbsoluteVolumeHandlerEvent::decode(buf))),
359            None => std::task::Poll::Ready(None),
360        }
361    }
362}
363
364#[derive(Debug)]
365pub enum AbsoluteVolumeHandlerEvent {}
366
367impl AbsoluteVolumeHandlerEvent {
368    /// Decodes a message buffer as a [`AbsoluteVolumeHandlerEvent`].
369    fn decode(
370        mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
371    ) -> Result<AbsoluteVolumeHandlerEvent, fidl::Error> {
372        let (bytes, _handles) = buf.split_mut();
373        let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
374        debug_assert_eq!(tx_header.tx_id, 0);
375        match tx_header.ordinal {
376            _ => Err(fidl::Error::UnknownOrdinal {
377                ordinal: tx_header.ordinal,
378                protocol_name:
379                    <AbsoluteVolumeHandlerMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
380            }),
381        }
382    }
383}
384
385/// A Stream of incoming requests for fuchsia.bluetooth.avrcp/AbsoluteVolumeHandler.
386pub struct AbsoluteVolumeHandlerRequestStream {
387    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
388    is_terminated: bool,
389}
390
391impl std::marker::Unpin for AbsoluteVolumeHandlerRequestStream {}
392
393impl futures::stream::FusedStream for AbsoluteVolumeHandlerRequestStream {
394    fn is_terminated(&self) -> bool {
395        self.is_terminated
396    }
397}
398
399impl fidl::endpoints::RequestStream for AbsoluteVolumeHandlerRequestStream {
400    type Protocol = AbsoluteVolumeHandlerMarker;
401    type ControlHandle = AbsoluteVolumeHandlerControlHandle;
402
403    fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
404        Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
405    }
406
407    fn control_handle(&self) -> Self::ControlHandle {
408        AbsoluteVolumeHandlerControlHandle { inner: self.inner.clone() }
409    }
410
411    fn into_inner(
412        self,
413    ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
414    {
415        (self.inner, self.is_terminated)
416    }
417
418    fn from_inner(
419        inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
420        is_terminated: bool,
421    ) -> Self {
422        Self { inner, is_terminated }
423    }
424}
425
426impl futures::Stream for AbsoluteVolumeHandlerRequestStream {
427    type Item = Result<AbsoluteVolumeHandlerRequest, fidl::Error>;
428
429    fn poll_next(
430        mut self: std::pin::Pin<&mut Self>,
431        cx: &mut std::task::Context<'_>,
432    ) -> std::task::Poll<Option<Self::Item>> {
433        let this = &mut *self;
434        if this.inner.check_shutdown(cx) {
435            this.is_terminated = true;
436            return std::task::Poll::Ready(None);
437        }
438        if this.is_terminated {
439            panic!("polled AbsoluteVolumeHandlerRequestStream after completion");
440        }
441        fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
442            |bytes, handles| {
443                match this.inner.channel().read_etc(cx, bytes, handles) {
444                    std::task::Poll::Ready(Ok(())) => {}
445                    std::task::Poll::Pending => return std::task::Poll::Pending,
446                    std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
447                        this.is_terminated = true;
448                        return std::task::Poll::Ready(None);
449                    }
450                    std::task::Poll::Ready(Err(e)) => {
451                        return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
452                            e.into(),
453                        ))))
454                    }
455                }
456
457                // A message has been received from the channel
458                let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
459
460                std::task::Poll::Ready(Some(match header.ordinal {
461                0x2796843ecbdecc65 => {
462                    header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
463                    let mut req = fidl::new_empty!(AbsoluteVolumeHandlerSetVolumeRequest, fidl::encoding::DefaultFuchsiaResourceDialect);
464                    fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<AbsoluteVolumeHandlerSetVolumeRequest>(&header, _body_bytes, handles, &mut req)?;
465                    let control_handle = AbsoluteVolumeHandlerControlHandle {
466                        inner: this.inner.clone(),
467                    };
468                    Ok(AbsoluteVolumeHandlerRequest::SetVolume {requested_volume: req.requested_volume,
469
470                        responder: AbsoluteVolumeHandlerSetVolumeResponder {
471                            control_handle: std::mem::ManuallyDrop::new(control_handle),
472                            tx_id: header.tx_id,
473                        },
474                    })
475                }
476                0x1a1f9cffd4f2a74 => {
477                    header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
478                    let mut req = fidl::new_empty!(fidl::encoding::EmptyPayload, fidl::encoding::DefaultFuchsiaResourceDialect);
479                    fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
480                    let control_handle = AbsoluteVolumeHandlerControlHandle {
481                        inner: this.inner.clone(),
482                    };
483                    Ok(AbsoluteVolumeHandlerRequest::OnVolumeChanged {
484                        responder: AbsoluteVolumeHandlerOnVolumeChangedResponder {
485                            control_handle: std::mem::ManuallyDrop::new(control_handle),
486                            tx_id: header.tx_id,
487                        },
488                    })
489                }
490                0x6ae76e0c77ac35ff => {
491                    header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
492                    let mut req = fidl::new_empty!(fidl::encoding::EmptyPayload, fidl::encoding::DefaultFuchsiaResourceDialect);
493                    fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
494                    let control_handle = AbsoluteVolumeHandlerControlHandle {
495                        inner: this.inner.clone(),
496                    };
497                    Ok(AbsoluteVolumeHandlerRequest::GetCurrentVolume {
498                        responder: AbsoluteVolumeHandlerGetCurrentVolumeResponder {
499                            control_handle: std::mem::ManuallyDrop::new(control_handle),
500                            tx_id: header.tx_id,
501                        },
502                    })
503                }
504                _ => Err(fidl::Error::UnknownOrdinal {
505                    ordinal: header.ordinal,
506                    protocol_name: <AbsoluteVolumeHandlerMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
507                }),
508            }))
509            },
510        )
511    }
512}
513
514/// Handler for absolute volume requests from a remote peer. See AVRCP v 1.6.2 section 6.13.2.
515/// Absolute volume is represented as a percentage using one byte with the most significant bit
516/// reserved. 0% is represented as 0x0 and 100% as 0x7f. Volume should scaled between the
517/// two values.
518#[derive(Debug)]
519pub enum AbsoluteVolumeHandlerRequest {
520    /// Requests that the absolute volume of the player be changed.
521    /// `requested_volume` is the requested volume by the peer.
522    /// Returns the actual volume set locally by the handler.
523    SetVolume { requested_volume: u8, responder: AbsoluteVolumeHandlerSetVolumeResponder },
524    /// Returns latest volume of the handler to the AVRCP service. This function should return
525    /// immediately on the first call and if the volume has changed since the last call to this
526    /// function, otherwise it should only return when the volume has been changed.
527    /// Multiple outstanding `OnVolumeChanged` requests can be made - all outstanding calls will
528    /// return when the volume has been changed.
529    OnVolumeChanged { responder: AbsoluteVolumeHandlerOnVolumeChangedResponder },
530    /// Returns the current volume immediately.
531    GetCurrentVolume { responder: AbsoluteVolumeHandlerGetCurrentVolumeResponder },
532}
533
534impl AbsoluteVolumeHandlerRequest {
535    #[allow(irrefutable_let_patterns)]
536    pub fn into_set_volume(self) -> Option<(u8, AbsoluteVolumeHandlerSetVolumeResponder)> {
537        if let AbsoluteVolumeHandlerRequest::SetVolume { requested_volume, responder } = self {
538            Some((requested_volume, responder))
539        } else {
540            None
541        }
542    }
543
544    #[allow(irrefutable_let_patterns)]
545    pub fn into_on_volume_changed(self) -> Option<(AbsoluteVolumeHandlerOnVolumeChangedResponder)> {
546        if let AbsoluteVolumeHandlerRequest::OnVolumeChanged { responder } = self {
547            Some((responder))
548        } else {
549            None
550        }
551    }
552
553    #[allow(irrefutable_let_patterns)]
554    pub fn into_get_current_volume(
555        self,
556    ) -> Option<(AbsoluteVolumeHandlerGetCurrentVolumeResponder)> {
557        if let AbsoluteVolumeHandlerRequest::GetCurrentVolume { responder } = self {
558            Some((responder))
559        } else {
560            None
561        }
562    }
563
564    /// Name of the method defined in FIDL
565    pub fn method_name(&self) -> &'static str {
566        match *self {
567            AbsoluteVolumeHandlerRequest::SetVolume { .. } => "set_volume",
568            AbsoluteVolumeHandlerRequest::OnVolumeChanged { .. } => "on_volume_changed",
569            AbsoluteVolumeHandlerRequest::GetCurrentVolume { .. } => "get_current_volume",
570        }
571    }
572}
573
574#[derive(Debug, Clone)]
575pub struct AbsoluteVolumeHandlerControlHandle {
576    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
577}
578
579impl fidl::endpoints::ControlHandle for AbsoluteVolumeHandlerControlHandle {
580    fn shutdown(&self) {
581        self.inner.shutdown()
582    }
583    fn shutdown_with_epitaph(&self, status: zx_status::Status) {
584        self.inner.shutdown_with_epitaph(status)
585    }
586
587    fn is_closed(&self) -> bool {
588        self.inner.channel().is_closed()
589    }
590    fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
591        self.inner.channel().on_closed()
592    }
593
594    #[cfg(target_os = "fuchsia")]
595    fn signal_peer(
596        &self,
597        clear_mask: zx::Signals,
598        set_mask: zx::Signals,
599    ) -> Result<(), zx_status::Status> {
600        use fidl::Peered;
601        self.inner.channel().signal_peer(clear_mask, set_mask)
602    }
603}
604
605impl AbsoluteVolumeHandlerControlHandle {}
606
607#[must_use = "FIDL methods require a response to be sent"]
608#[derive(Debug)]
609pub struct AbsoluteVolumeHandlerSetVolumeResponder {
610    control_handle: std::mem::ManuallyDrop<AbsoluteVolumeHandlerControlHandle>,
611    tx_id: u32,
612}
613
614/// Set the the channel to be shutdown (see [`AbsoluteVolumeHandlerControlHandle::shutdown`])
615/// if the responder is dropped without sending a response, so that the client
616/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
617impl std::ops::Drop for AbsoluteVolumeHandlerSetVolumeResponder {
618    fn drop(&mut self) {
619        self.control_handle.shutdown();
620        // Safety: drops once, never accessed again
621        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
622    }
623}
624
625impl fidl::endpoints::Responder for AbsoluteVolumeHandlerSetVolumeResponder {
626    type ControlHandle = AbsoluteVolumeHandlerControlHandle;
627
628    fn control_handle(&self) -> &AbsoluteVolumeHandlerControlHandle {
629        &self.control_handle
630    }
631
632    fn drop_without_shutdown(mut self) {
633        // Safety: drops once, never accessed again due to mem::forget
634        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
635        // Prevent Drop from running (which would shut down the channel)
636        std::mem::forget(self);
637    }
638}
639
640impl AbsoluteVolumeHandlerSetVolumeResponder {
641    /// Sends a response to the FIDL transaction.
642    ///
643    /// Sets the channel to shutdown if an error occurs.
644    pub fn send(self, mut set_volume: u8) -> Result<(), fidl::Error> {
645        let _result = self.send_raw(set_volume);
646        if _result.is_err() {
647            self.control_handle.shutdown();
648        }
649        self.drop_without_shutdown();
650        _result
651    }
652
653    /// Similar to "send" but does not shutdown the channel if an error occurs.
654    pub fn send_no_shutdown_on_err(self, mut set_volume: u8) -> Result<(), fidl::Error> {
655        let _result = self.send_raw(set_volume);
656        self.drop_without_shutdown();
657        _result
658    }
659
660    fn send_raw(&self, mut set_volume: u8) -> Result<(), fidl::Error> {
661        self.control_handle.inner.send::<AbsoluteVolumeHandlerSetVolumeResponse>(
662            (set_volume,),
663            self.tx_id,
664            0x2796843ecbdecc65,
665            fidl::encoding::DynamicFlags::empty(),
666        )
667    }
668}
669
670#[must_use = "FIDL methods require a response to be sent"]
671#[derive(Debug)]
672pub struct AbsoluteVolumeHandlerOnVolumeChangedResponder {
673    control_handle: std::mem::ManuallyDrop<AbsoluteVolumeHandlerControlHandle>,
674    tx_id: u32,
675}
676
677/// Set the the channel to be shutdown (see [`AbsoluteVolumeHandlerControlHandle::shutdown`])
678/// if the responder is dropped without sending a response, so that the client
679/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
680impl std::ops::Drop for AbsoluteVolumeHandlerOnVolumeChangedResponder {
681    fn drop(&mut self) {
682        self.control_handle.shutdown();
683        // Safety: drops once, never accessed again
684        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
685    }
686}
687
688impl fidl::endpoints::Responder for AbsoluteVolumeHandlerOnVolumeChangedResponder {
689    type ControlHandle = AbsoluteVolumeHandlerControlHandle;
690
691    fn control_handle(&self) -> &AbsoluteVolumeHandlerControlHandle {
692        &self.control_handle
693    }
694
695    fn drop_without_shutdown(mut self) {
696        // Safety: drops once, never accessed again due to mem::forget
697        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
698        // Prevent Drop from running (which would shut down the channel)
699        std::mem::forget(self);
700    }
701}
702
703impl AbsoluteVolumeHandlerOnVolumeChangedResponder {
704    /// Sends a response to the FIDL transaction.
705    ///
706    /// Sets the channel to shutdown if an error occurs.
707    pub fn send(self, mut new_volume: u8) -> Result<(), fidl::Error> {
708        let _result = self.send_raw(new_volume);
709        if _result.is_err() {
710            self.control_handle.shutdown();
711        }
712        self.drop_without_shutdown();
713        _result
714    }
715
716    /// Similar to "send" but does not shutdown the channel if an error occurs.
717    pub fn send_no_shutdown_on_err(self, mut new_volume: u8) -> Result<(), fidl::Error> {
718        let _result = self.send_raw(new_volume);
719        self.drop_without_shutdown();
720        _result
721    }
722
723    fn send_raw(&self, mut new_volume: u8) -> Result<(), fidl::Error> {
724        self.control_handle.inner.send::<AbsoluteVolumeHandlerOnVolumeChangedResponse>(
725            (new_volume,),
726            self.tx_id,
727            0x1a1f9cffd4f2a74,
728            fidl::encoding::DynamicFlags::empty(),
729        )
730    }
731}
732
733#[must_use = "FIDL methods require a response to be sent"]
734#[derive(Debug)]
735pub struct AbsoluteVolumeHandlerGetCurrentVolumeResponder {
736    control_handle: std::mem::ManuallyDrop<AbsoluteVolumeHandlerControlHandle>,
737    tx_id: u32,
738}
739
740/// Set the the channel to be shutdown (see [`AbsoluteVolumeHandlerControlHandle::shutdown`])
741/// if the responder is dropped without sending a response, so that the client
742/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
743impl std::ops::Drop for AbsoluteVolumeHandlerGetCurrentVolumeResponder {
744    fn drop(&mut self) {
745        self.control_handle.shutdown();
746        // Safety: drops once, never accessed again
747        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
748    }
749}
750
751impl fidl::endpoints::Responder for AbsoluteVolumeHandlerGetCurrentVolumeResponder {
752    type ControlHandle = AbsoluteVolumeHandlerControlHandle;
753
754    fn control_handle(&self) -> &AbsoluteVolumeHandlerControlHandle {
755        &self.control_handle
756    }
757
758    fn drop_without_shutdown(mut self) {
759        // Safety: drops once, never accessed again due to mem::forget
760        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
761        // Prevent Drop from running (which would shut down the channel)
762        std::mem::forget(self);
763    }
764}
765
766impl AbsoluteVolumeHandlerGetCurrentVolumeResponder {
767    /// Sends a response to the FIDL transaction.
768    ///
769    /// Sets the channel to shutdown if an error occurs.
770    pub fn send(self, mut volume: u8) -> Result<(), fidl::Error> {
771        let _result = self.send_raw(volume);
772        if _result.is_err() {
773            self.control_handle.shutdown();
774        }
775        self.drop_without_shutdown();
776        _result
777    }
778
779    /// Similar to "send" but does not shutdown the channel if an error occurs.
780    pub fn send_no_shutdown_on_err(self, mut volume: u8) -> Result<(), fidl::Error> {
781        let _result = self.send_raw(volume);
782        self.drop_without_shutdown();
783        _result
784    }
785
786    fn send_raw(&self, mut volume: u8) -> Result<(), fidl::Error> {
787        self.control_handle.inner.send::<AbsoluteVolumeHandlerGetCurrentVolumeResponse>(
788            (volume,),
789            self.tx_id,
790            0x6ae76e0c77ac35ff,
791            fidl::encoding::DynamicFlags::empty(),
792        )
793    }
794}
795
796#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
797pub struct BrowseControllerMarker;
798
799impl fidl::endpoints::ProtocolMarker for BrowseControllerMarker {
800    type Proxy = BrowseControllerProxy;
801    type RequestStream = BrowseControllerRequestStream;
802    #[cfg(target_os = "fuchsia")]
803    type SynchronousProxy = BrowseControllerSynchronousProxy;
804
805    const DEBUG_NAME: &'static str = "(anonymous) BrowseController";
806}
807pub type BrowseControllerGetMediaPlayerItemsResult =
808    Result<Vec<MediaPlayerItem>, BrowseControllerError>;
809pub type BrowseControllerGetNowPlayingItemsResult =
810    Result<Vec<MediaElementItem>, BrowseControllerError>;
811pub type BrowseControllerGetFileSystemItemsResult =
812    Result<Vec<FileSystemItem>, BrowseControllerError>;
813pub type BrowseControllerChangePathResult = Result<u32, BrowseControllerError>;
814pub type BrowseControllerPlayFileSystemItemResult = Result<(), BrowseControllerError>;
815pub type BrowseControllerPlayNowPlayingItemResult = Result<(), BrowseControllerError>;
816pub type BrowseControllerSetBrowsedPlayerResult = Result<(), BrowseControllerError>;
817
818pub trait BrowseControllerProxyInterface: Send + Sync {
819    type GetMediaPlayerItemsResponseFut: std::future::Future<Output = Result<BrowseControllerGetMediaPlayerItemsResult, fidl::Error>>
820        + Send;
821    fn r#get_media_player_items(
822        &self,
823        start_index: u32,
824        end_index: u32,
825    ) -> Self::GetMediaPlayerItemsResponseFut;
826    type GetNowPlayingItemsResponseFut: std::future::Future<Output = Result<BrowseControllerGetNowPlayingItemsResult, fidl::Error>>
827        + Send;
828    fn r#get_now_playing_items(
829        &self,
830        start_index: u32,
831        end_index: u32,
832        attribute_option: &AttributeRequestOption,
833    ) -> Self::GetNowPlayingItemsResponseFut;
834    type GetFileSystemItemsResponseFut: std::future::Future<Output = Result<BrowseControllerGetFileSystemItemsResult, fidl::Error>>
835        + Send;
836    fn r#get_file_system_items(
837        &self,
838        start_index: u32,
839        end_index: u32,
840        attribute_option: &AttributeRequestOption,
841    ) -> Self::GetFileSystemItemsResponseFut;
842    type ChangePathResponseFut: std::future::Future<Output = Result<BrowseControllerChangePathResult, fidl::Error>>
843        + Send;
844    fn r#change_path(&self, path: &Path) -> Self::ChangePathResponseFut;
845    type PlayFileSystemItemResponseFut: std::future::Future<Output = Result<BrowseControllerPlayFileSystemItemResult, fidl::Error>>
846        + Send;
847    fn r#play_file_system_item(&self, uid: u64) -> Self::PlayFileSystemItemResponseFut;
848    type PlayNowPlayingItemResponseFut: std::future::Future<Output = Result<BrowseControllerPlayNowPlayingItemResult, fidl::Error>>
849        + Send;
850    fn r#play_now_playing_item(&self, uid: u64) -> Self::PlayNowPlayingItemResponseFut;
851    type SetBrowsedPlayerResponseFut: std::future::Future<Output = Result<BrowseControllerSetBrowsedPlayerResult, fidl::Error>>
852        + Send;
853    fn r#set_browsed_player(&self, player_id: u16) -> Self::SetBrowsedPlayerResponseFut;
854}
855#[derive(Debug)]
856#[cfg(target_os = "fuchsia")]
857pub struct BrowseControllerSynchronousProxy {
858    client: fidl::client::sync::Client,
859}
860
861#[cfg(target_os = "fuchsia")]
862impl fidl::endpoints::SynchronousProxy for BrowseControllerSynchronousProxy {
863    type Proxy = BrowseControllerProxy;
864    type Protocol = BrowseControllerMarker;
865
866    fn from_channel(inner: fidl::Channel) -> Self {
867        Self::new(inner)
868    }
869
870    fn into_channel(self) -> fidl::Channel {
871        self.client.into_channel()
872    }
873
874    fn as_channel(&self) -> &fidl::Channel {
875        self.client.as_channel()
876    }
877}
878
879#[cfg(target_os = "fuchsia")]
880impl BrowseControllerSynchronousProxy {
881    pub fn new(channel: fidl::Channel) -> Self {
882        let protocol_name = <BrowseControllerMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
883        Self { client: fidl::client::sync::Client::new(channel, protocol_name) }
884    }
885
886    pub fn into_channel(self) -> fidl::Channel {
887        self.client.into_channel()
888    }
889
890    /// Waits until an event arrives and returns it. It is safe for other
891    /// threads to make concurrent requests while waiting for an event.
892    pub fn wait_for_event(
893        &self,
894        deadline: zx::MonotonicInstant,
895    ) -> Result<BrowseControllerEvent, fidl::Error> {
896        BrowseControllerEvent::decode(self.client.wait_for_event(deadline)?)
897    }
898
899    /// Used for GetFolderItems(MediaPlayerList).
900    /// Gets the list of media players. End index is inclusive.
901    pub fn r#get_media_player_items(
902        &self,
903        mut start_index: u32,
904        mut end_index: u32,
905        ___deadline: zx::MonotonicInstant,
906    ) -> Result<BrowseControllerGetMediaPlayerItemsResult, fidl::Error> {
907        let _response = self
908            .client
909            .send_query::<BrowseControllerGetMediaPlayerItemsRequest, fidl::encoding::ResultType<
910                BrowseControllerGetMediaPlayerItemsResponse,
911                BrowseControllerError,
912            >>(
913                (start_index, end_index),
914                0x49c06d30a9aa02ba,
915                fidl::encoding::DynamicFlags::empty(),
916                ___deadline,
917            )?;
918        Ok(_response.map(|x| x.items))
919    }
920
921    /// Used for GetFolderItems(NowPlayingList).
922    /// Gets the list of items from the now playing list aka the queue of the
923    /// addressed media player.
924    /// + request `end_index` is inclusive.
925    pub fn r#get_now_playing_items(
926        &self,
927        mut start_index: u32,
928        mut end_index: u32,
929        mut attribute_option: &AttributeRequestOption,
930        ___deadline: zx::MonotonicInstant,
931    ) -> Result<BrowseControllerGetNowPlayingItemsResult, fidl::Error> {
932        let _response = self
933            .client
934            .send_query::<BrowseControllerGetNowPlayingItemsRequest, fidl::encoding::ResultType<
935                BrowseControllerGetNowPlayingItemsResponse,
936                BrowseControllerError,
937            >>(
938                (start_index, end_index, attribute_option),
939                0x35f5a88695b46cf7,
940                fidl::encoding::DynamicFlags::empty(),
941                ___deadline,
942            )?;
943        Ok(_response.map(|x| x.items))
944    }
945
946    /// Used for GetFolderItems(MediaPlayerVirtualFilesystem).
947    /// Gets the list of folder item/media element item.
948    /// + request `end_index` is inclusive.
949    pub fn r#get_file_system_items(
950        &self,
951        mut start_index: u32,
952        mut end_index: u32,
953        mut attribute_option: &AttributeRequestOption,
954        ___deadline: zx::MonotonicInstant,
955    ) -> Result<BrowseControllerGetFileSystemItemsResult, fidl::Error> {
956        let _response = self
957            .client
958            .send_query::<BrowseControllerGetFileSystemItemsRequest, fidl::encoding::ResultType<
959                BrowseControllerGetFileSystemItemsResponse,
960                BrowseControllerError,
961            >>(
962                (start_index, end_index, attribute_option),
963                0x5d1415aecee72133,
964                fidl::encoding::DynamicFlags::empty(),
965                ___deadline,
966            )?;
967        Ok(_response.map(|x| x.items))
968    }
969
970    /// Used for ChangePath browse command.
971    /// + request `path` dictates whether or not the direction will be Move Up
972    ///   or Move down. If `path.parent` is set, direction will be Move Up. If
973    ///   `path.child_folder_uid` is set, direction will be Move Down.
974    pub fn r#change_path(
975        &self,
976        mut path: &Path,
977        ___deadline: zx::MonotonicInstant,
978    ) -> Result<BrowseControllerChangePathResult, fidl::Error> {
979        let _response =
980            self.client
981                .send_query::<BrowseControllerChangePathRequest, fidl::encoding::ResultType<
982                    BrowseControllerChangePathResponse,
983                    BrowseControllerError,
984                >>(
985                    (path,),
986                    0x2e0600579d43b51e,
987                    fidl::encoding::DynamicFlags::empty(),
988                    ___deadline,
989                )?;
990        Ok(_response.map(|x| x.num_items))
991    }
992
993    ///  Used for PlayItem(FileSystem).
994    pub fn r#play_file_system_item(
995        &self,
996        mut uid: u64,
997        ___deadline: zx::MonotonicInstant,
998    ) -> Result<BrowseControllerPlayFileSystemItemResult, fidl::Error> {
999        let _response = self.client.send_query::<
1000            BrowseControllerPlayFileSystemItemRequest,
1001            fidl::encoding::ResultType<fidl::encoding::EmptyStruct, BrowseControllerError>,
1002        >(
1003            (uid,),
1004            0x57075115ce25cf16,
1005            fidl::encoding::DynamicFlags::empty(),
1006            ___deadline,
1007        )?;
1008        Ok(_response.map(|x| x))
1009    }
1010
1011    ///  Used for PlayItem(NowPlayingList). Plays the specified item from the now playing
1012    /// list aka the queue of the addressed media player.
1013    pub fn r#play_now_playing_item(
1014        &self,
1015        mut uid: u64,
1016        ___deadline: zx::MonotonicInstant,
1017    ) -> Result<BrowseControllerPlayNowPlayingItemResult, fidl::Error> {
1018        let _response = self.client.send_query::<
1019            BrowseControllerPlayNowPlayingItemRequest,
1020            fidl::encoding::ResultType<fidl::encoding::EmptyStruct, BrowseControllerError>,
1021        >(
1022            (uid,),
1023            0x116e151d547fd2d7,
1024            fidl::encoding::DynamicFlags::empty(),
1025            ___deadline,
1026        )?;
1027        Ok(_response.map(|x| x))
1028    }
1029
1030    /// Changes the addressed `player_id` on the target when multiple are supported.
1031    pub fn r#set_browsed_player(
1032        &self,
1033        mut player_id: u16,
1034        ___deadline: zx::MonotonicInstant,
1035    ) -> Result<BrowseControllerSetBrowsedPlayerResult, fidl::Error> {
1036        let _response = self.client.send_query::<
1037            BrowseControllerSetBrowsedPlayerRequest,
1038            fidl::encoding::ResultType<fidl::encoding::EmptyStruct, BrowseControllerError>,
1039        >(
1040            (player_id,),
1041            0x3e3256f57f8848da,
1042            fidl::encoding::DynamicFlags::empty(),
1043            ___deadline,
1044        )?;
1045        Ok(_response.map(|x| x))
1046    }
1047}
1048
1049#[cfg(target_os = "fuchsia")]
1050impl From<BrowseControllerSynchronousProxy> for zx::Handle {
1051    fn from(value: BrowseControllerSynchronousProxy) -> Self {
1052        value.into_channel().into()
1053    }
1054}
1055
1056#[cfg(target_os = "fuchsia")]
1057impl From<fidl::Channel> for BrowseControllerSynchronousProxy {
1058    fn from(value: fidl::Channel) -> Self {
1059        Self::new(value)
1060    }
1061}
1062
1063#[cfg(target_os = "fuchsia")]
1064impl fidl::endpoints::FromClient for BrowseControllerSynchronousProxy {
1065    type Protocol = BrowseControllerMarker;
1066
1067    fn from_client(value: fidl::endpoints::ClientEnd<BrowseControllerMarker>) -> Self {
1068        Self::new(value.into_channel())
1069    }
1070}
1071
1072#[derive(Debug, Clone)]
1073pub struct BrowseControllerProxy {
1074    client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
1075}
1076
1077impl fidl::endpoints::Proxy for BrowseControllerProxy {
1078    type Protocol = BrowseControllerMarker;
1079
1080    fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
1081        Self::new(inner)
1082    }
1083
1084    fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
1085        self.client.into_channel().map_err(|client| Self { client })
1086    }
1087
1088    fn as_channel(&self) -> &::fidl::AsyncChannel {
1089        self.client.as_channel()
1090    }
1091}
1092
1093impl BrowseControllerProxy {
1094    /// Create a new Proxy for fuchsia.bluetooth.avrcp/BrowseController.
1095    pub fn new(channel: ::fidl::AsyncChannel) -> Self {
1096        let protocol_name = <BrowseControllerMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
1097        Self { client: fidl::client::Client::new(channel, protocol_name) }
1098    }
1099
1100    /// Get a Stream of events from the remote end of the protocol.
1101    ///
1102    /// # Panics
1103    ///
1104    /// Panics if the event stream was already taken.
1105    pub fn take_event_stream(&self) -> BrowseControllerEventStream {
1106        BrowseControllerEventStream { event_receiver: self.client.take_event_receiver() }
1107    }
1108
1109    /// Used for GetFolderItems(MediaPlayerList).
1110    /// Gets the list of media players. End index is inclusive.
1111    pub fn r#get_media_player_items(
1112        &self,
1113        mut start_index: u32,
1114        mut end_index: u32,
1115    ) -> fidl::client::QueryResponseFut<
1116        BrowseControllerGetMediaPlayerItemsResult,
1117        fidl::encoding::DefaultFuchsiaResourceDialect,
1118    > {
1119        BrowseControllerProxyInterface::r#get_media_player_items(self, start_index, end_index)
1120    }
1121
1122    /// Used for GetFolderItems(NowPlayingList).
1123    /// Gets the list of items from the now playing list aka the queue of the
1124    /// addressed media player.
1125    /// + request `end_index` is inclusive.
1126    pub fn r#get_now_playing_items(
1127        &self,
1128        mut start_index: u32,
1129        mut end_index: u32,
1130        mut attribute_option: &AttributeRequestOption,
1131    ) -> fidl::client::QueryResponseFut<
1132        BrowseControllerGetNowPlayingItemsResult,
1133        fidl::encoding::DefaultFuchsiaResourceDialect,
1134    > {
1135        BrowseControllerProxyInterface::r#get_now_playing_items(
1136            self,
1137            start_index,
1138            end_index,
1139            attribute_option,
1140        )
1141    }
1142
1143    /// Used for GetFolderItems(MediaPlayerVirtualFilesystem).
1144    /// Gets the list of folder item/media element item.
1145    /// + request `end_index` is inclusive.
1146    pub fn r#get_file_system_items(
1147        &self,
1148        mut start_index: u32,
1149        mut end_index: u32,
1150        mut attribute_option: &AttributeRequestOption,
1151    ) -> fidl::client::QueryResponseFut<
1152        BrowseControllerGetFileSystemItemsResult,
1153        fidl::encoding::DefaultFuchsiaResourceDialect,
1154    > {
1155        BrowseControllerProxyInterface::r#get_file_system_items(
1156            self,
1157            start_index,
1158            end_index,
1159            attribute_option,
1160        )
1161    }
1162
1163    /// Used for ChangePath browse command.
1164    /// + request `path` dictates whether or not the direction will be Move Up
1165    ///   or Move down. If `path.parent` is set, direction will be Move Up. If
1166    ///   `path.child_folder_uid` is set, direction will be Move Down.
1167    pub fn r#change_path(
1168        &self,
1169        mut path: &Path,
1170    ) -> fidl::client::QueryResponseFut<
1171        BrowseControllerChangePathResult,
1172        fidl::encoding::DefaultFuchsiaResourceDialect,
1173    > {
1174        BrowseControllerProxyInterface::r#change_path(self, path)
1175    }
1176
1177    ///  Used for PlayItem(FileSystem).
1178    pub fn r#play_file_system_item(
1179        &self,
1180        mut uid: u64,
1181    ) -> fidl::client::QueryResponseFut<
1182        BrowseControllerPlayFileSystemItemResult,
1183        fidl::encoding::DefaultFuchsiaResourceDialect,
1184    > {
1185        BrowseControllerProxyInterface::r#play_file_system_item(self, uid)
1186    }
1187
1188    ///  Used for PlayItem(NowPlayingList). Plays the specified item from the now playing
1189    /// list aka the queue of the addressed media player.
1190    pub fn r#play_now_playing_item(
1191        &self,
1192        mut uid: u64,
1193    ) -> fidl::client::QueryResponseFut<
1194        BrowseControllerPlayNowPlayingItemResult,
1195        fidl::encoding::DefaultFuchsiaResourceDialect,
1196    > {
1197        BrowseControllerProxyInterface::r#play_now_playing_item(self, uid)
1198    }
1199
1200    /// Changes the addressed `player_id` on the target when multiple are supported.
1201    pub fn r#set_browsed_player(
1202        &self,
1203        mut player_id: u16,
1204    ) -> fidl::client::QueryResponseFut<
1205        BrowseControllerSetBrowsedPlayerResult,
1206        fidl::encoding::DefaultFuchsiaResourceDialect,
1207    > {
1208        BrowseControllerProxyInterface::r#set_browsed_player(self, player_id)
1209    }
1210}
1211
1212impl BrowseControllerProxyInterface for BrowseControllerProxy {
1213    type GetMediaPlayerItemsResponseFut = fidl::client::QueryResponseFut<
1214        BrowseControllerGetMediaPlayerItemsResult,
1215        fidl::encoding::DefaultFuchsiaResourceDialect,
1216    >;
1217    fn r#get_media_player_items(
1218        &self,
1219        mut start_index: u32,
1220        mut end_index: u32,
1221    ) -> Self::GetMediaPlayerItemsResponseFut {
1222        fn _decode(
1223            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
1224        ) -> Result<BrowseControllerGetMediaPlayerItemsResult, fidl::Error> {
1225            let _response = fidl::client::decode_transaction_body::<
1226                fidl::encoding::ResultType<
1227                    BrowseControllerGetMediaPlayerItemsResponse,
1228                    BrowseControllerError,
1229                >,
1230                fidl::encoding::DefaultFuchsiaResourceDialect,
1231                0x49c06d30a9aa02ba,
1232            >(_buf?)?;
1233            Ok(_response.map(|x| x.items))
1234        }
1235        self.client.send_query_and_decode::<
1236            BrowseControllerGetMediaPlayerItemsRequest,
1237            BrowseControllerGetMediaPlayerItemsResult,
1238        >(
1239            (start_index, end_index,),
1240            0x49c06d30a9aa02ba,
1241            fidl::encoding::DynamicFlags::empty(),
1242            _decode,
1243        )
1244    }
1245
1246    type GetNowPlayingItemsResponseFut = fidl::client::QueryResponseFut<
1247        BrowseControllerGetNowPlayingItemsResult,
1248        fidl::encoding::DefaultFuchsiaResourceDialect,
1249    >;
1250    fn r#get_now_playing_items(
1251        &self,
1252        mut start_index: u32,
1253        mut end_index: u32,
1254        mut attribute_option: &AttributeRequestOption,
1255    ) -> Self::GetNowPlayingItemsResponseFut {
1256        fn _decode(
1257            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
1258        ) -> Result<BrowseControllerGetNowPlayingItemsResult, fidl::Error> {
1259            let _response = fidl::client::decode_transaction_body::<
1260                fidl::encoding::ResultType<
1261                    BrowseControllerGetNowPlayingItemsResponse,
1262                    BrowseControllerError,
1263                >,
1264                fidl::encoding::DefaultFuchsiaResourceDialect,
1265                0x35f5a88695b46cf7,
1266            >(_buf?)?;
1267            Ok(_response.map(|x| x.items))
1268        }
1269        self.client.send_query_and_decode::<
1270            BrowseControllerGetNowPlayingItemsRequest,
1271            BrowseControllerGetNowPlayingItemsResult,
1272        >(
1273            (start_index, end_index, attribute_option,),
1274            0x35f5a88695b46cf7,
1275            fidl::encoding::DynamicFlags::empty(),
1276            _decode,
1277        )
1278    }
1279
1280    type GetFileSystemItemsResponseFut = fidl::client::QueryResponseFut<
1281        BrowseControllerGetFileSystemItemsResult,
1282        fidl::encoding::DefaultFuchsiaResourceDialect,
1283    >;
1284    fn r#get_file_system_items(
1285        &self,
1286        mut start_index: u32,
1287        mut end_index: u32,
1288        mut attribute_option: &AttributeRequestOption,
1289    ) -> Self::GetFileSystemItemsResponseFut {
1290        fn _decode(
1291            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
1292        ) -> Result<BrowseControllerGetFileSystemItemsResult, fidl::Error> {
1293            let _response = fidl::client::decode_transaction_body::<
1294                fidl::encoding::ResultType<
1295                    BrowseControllerGetFileSystemItemsResponse,
1296                    BrowseControllerError,
1297                >,
1298                fidl::encoding::DefaultFuchsiaResourceDialect,
1299                0x5d1415aecee72133,
1300            >(_buf?)?;
1301            Ok(_response.map(|x| x.items))
1302        }
1303        self.client.send_query_and_decode::<
1304            BrowseControllerGetFileSystemItemsRequest,
1305            BrowseControllerGetFileSystemItemsResult,
1306        >(
1307            (start_index, end_index, attribute_option,),
1308            0x5d1415aecee72133,
1309            fidl::encoding::DynamicFlags::empty(),
1310            _decode,
1311        )
1312    }
1313
1314    type ChangePathResponseFut = fidl::client::QueryResponseFut<
1315        BrowseControllerChangePathResult,
1316        fidl::encoding::DefaultFuchsiaResourceDialect,
1317    >;
1318    fn r#change_path(&self, mut path: &Path) -> Self::ChangePathResponseFut {
1319        fn _decode(
1320            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
1321        ) -> Result<BrowseControllerChangePathResult, fidl::Error> {
1322            let _response = fidl::client::decode_transaction_body::<
1323                fidl::encoding::ResultType<
1324                    BrowseControllerChangePathResponse,
1325                    BrowseControllerError,
1326                >,
1327                fidl::encoding::DefaultFuchsiaResourceDialect,
1328                0x2e0600579d43b51e,
1329            >(_buf?)?;
1330            Ok(_response.map(|x| x.num_items))
1331        }
1332        self.client.send_query_and_decode::<
1333            BrowseControllerChangePathRequest,
1334            BrowseControllerChangePathResult,
1335        >(
1336            (path,),
1337            0x2e0600579d43b51e,
1338            fidl::encoding::DynamicFlags::empty(),
1339            _decode,
1340        )
1341    }
1342
1343    type PlayFileSystemItemResponseFut = fidl::client::QueryResponseFut<
1344        BrowseControllerPlayFileSystemItemResult,
1345        fidl::encoding::DefaultFuchsiaResourceDialect,
1346    >;
1347    fn r#play_file_system_item(&self, mut uid: u64) -> Self::PlayFileSystemItemResponseFut {
1348        fn _decode(
1349            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
1350        ) -> Result<BrowseControllerPlayFileSystemItemResult, fidl::Error> {
1351            let _response = fidl::client::decode_transaction_body::<
1352                fidl::encoding::ResultType<fidl::encoding::EmptyStruct, BrowseControllerError>,
1353                fidl::encoding::DefaultFuchsiaResourceDialect,
1354                0x57075115ce25cf16,
1355            >(_buf?)?;
1356            Ok(_response.map(|x| x))
1357        }
1358        self.client.send_query_and_decode::<
1359            BrowseControllerPlayFileSystemItemRequest,
1360            BrowseControllerPlayFileSystemItemResult,
1361        >(
1362            (uid,),
1363            0x57075115ce25cf16,
1364            fidl::encoding::DynamicFlags::empty(),
1365            _decode,
1366        )
1367    }
1368
1369    type PlayNowPlayingItemResponseFut = fidl::client::QueryResponseFut<
1370        BrowseControllerPlayNowPlayingItemResult,
1371        fidl::encoding::DefaultFuchsiaResourceDialect,
1372    >;
1373    fn r#play_now_playing_item(&self, mut uid: u64) -> Self::PlayNowPlayingItemResponseFut {
1374        fn _decode(
1375            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
1376        ) -> Result<BrowseControllerPlayNowPlayingItemResult, fidl::Error> {
1377            let _response = fidl::client::decode_transaction_body::<
1378                fidl::encoding::ResultType<fidl::encoding::EmptyStruct, BrowseControllerError>,
1379                fidl::encoding::DefaultFuchsiaResourceDialect,
1380                0x116e151d547fd2d7,
1381            >(_buf?)?;
1382            Ok(_response.map(|x| x))
1383        }
1384        self.client.send_query_and_decode::<
1385            BrowseControllerPlayNowPlayingItemRequest,
1386            BrowseControllerPlayNowPlayingItemResult,
1387        >(
1388            (uid,),
1389            0x116e151d547fd2d7,
1390            fidl::encoding::DynamicFlags::empty(),
1391            _decode,
1392        )
1393    }
1394
1395    type SetBrowsedPlayerResponseFut = fidl::client::QueryResponseFut<
1396        BrowseControllerSetBrowsedPlayerResult,
1397        fidl::encoding::DefaultFuchsiaResourceDialect,
1398    >;
1399    fn r#set_browsed_player(&self, mut player_id: u16) -> Self::SetBrowsedPlayerResponseFut {
1400        fn _decode(
1401            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
1402        ) -> Result<BrowseControllerSetBrowsedPlayerResult, fidl::Error> {
1403            let _response = fidl::client::decode_transaction_body::<
1404                fidl::encoding::ResultType<fidl::encoding::EmptyStruct, BrowseControllerError>,
1405                fidl::encoding::DefaultFuchsiaResourceDialect,
1406                0x3e3256f57f8848da,
1407            >(_buf?)?;
1408            Ok(_response.map(|x| x))
1409        }
1410        self.client.send_query_and_decode::<
1411            BrowseControllerSetBrowsedPlayerRequest,
1412            BrowseControllerSetBrowsedPlayerResult,
1413        >(
1414            (player_id,),
1415            0x3e3256f57f8848da,
1416            fidl::encoding::DynamicFlags::empty(),
1417            _decode,
1418        )
1419    }
1420}
1421
1422pub struct BrowseControllerEventStream {
1423    event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
1424}
1425
1426impl std::marker::Unpin for BrowseControllerEventStream {}
1427
1428impl futures::stream::FusedStream for BrowseControllerEventStream {
1429    fn is_terminated(&self) -> bool {
1430        self.event_receiver.is_terminated()
1431    }
1432}
1433
1434impl futures::Stream for BrowseControllerEventStream {
1435    type Item = Result<BrowseControllerEvent, fidl::Error>;
1436
1437    fn poll_next(
1438        mut self: std::pin::Pin<&mut Self>,
1439        cx: &mut std::task::Context<'_>,
1440    ) -> std::task::Poll<Option<Self::Item>> {
1441        match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
1442            &mut self.event_receiver,
1443            cx
1444        )?) {
1445            Some(buf) => std::task::Poll::Ready(Some(BrowseControllerEvent::decode(buf))),
1446            None => std::task::Poll::Ready(None),
1447        }
1448    }
1449}
1450
1451#[derive(Debug)]
1452pub enum BrowseControllerEvent {}
1453
1454impl BrowseControllerEvent {
1455    /// Decodes a message buffer as a [`BrowseControllerEvent`].
1456    fn decode(
1457        mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
1458    ) -> Result<BrowseControllerEvent, fidl::Error> {
1459        let (bytes, _handles) = buf.split_mut();
1460        let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
1461        debug_assert_eq!(tx_header.tx_id, 0);
1462        match tx_header.ordinal {
1463            _ => Err(fidl::Error::UnknownOrdinal {
1464                ordinal: tx_header.ordinal,
1465                protocol_name:
1466                    <BrowseControllerMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
1467            }),
1468        }
1469    }
1470}
1471
1472/// A Stream of incoming requests for fuchsia.bluetooth.avrcp/BrowseController.
1473pub struct BrowseControllerRequestStream {
1474    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
1475    is_terminated: bool,
1476}
1477
1478impl std::marker::Unpin for BrowseControllerRequestStream {}
1479
1480impl futures::stream::FusedStream for BrowseControllerRequestStream {
1481    fn is_terminated(&self) -> bool {
1482        self.is_terminated
1483    }
1484}
1485
1486impl fidl::endpoints::RequestStream for BrowseControllerRequestStream {
1487    type Protocol = BrowseControllerMarker;
1488    type ControlHandle = BrowseControllerControlHandle;
1489
1490    fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
1491        Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
1492    }
1493
1494    fn control_handle(&self) -> Self::ControlHandle {
1495        BrowseControllerControlHandle { inner: self.inner.clone() }
1496    }
1497
1498    fn into_inner(
1499        self,
1500    ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
1501    {
1502        (self.inner, self.is_terminated)
1503    }
1504
1505    fn from_inner(
1506        inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
1507        is_terminated: bool,
1508    ) -> Self {
1509        Self { inner, is_terminated }
1510    }
1511}
1512
1513impl futures::Stream for BrowseControllerRequestStream {
1514    type Item = Result<BrowseControllerRequest, fidl::Error>;
1515
1516    fn poll_next(
1517        mut self: std::pin::Pin<&mut Self>,
1518        cx: &mut std::task::Context<'_>,
1519    ) -> std::task::Poll<Option<Self::Item>> {
1520        let this = &mut *self;
1521        if this.inner.check_shutdown(cx) {
1522            this.is_terminated = true;
1523            return std::task::Poll::Ready(None);
1524        }
1525        if this.is_terminated {
1526            panic!("polled BrowseControllerRequestStream after completion");
1527        }
1528        fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
1529            |bytes, handles| {
1530                match this.inner.channel().read_etc(cx, bytes, handles) {
1531                    std::task::Poll::Ready(Ok(())) => {}
1532                    std::task::Poll::Pending => return std::task::Poll::Pending,
1533                    std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
1534                        this.is_terminated = true;
1535                        return std::task::Poll::Ready(None);
1536                    }
1537                    std::task::Poll::Ready(Err(e)) => {
1538                        return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
1539                            e.into(),
1540                        ))))
1541                    }
1542                }
1543
1544                // A message has been received from the channel
1545                let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
1546
1547                std::task::Poll::Ready(Some(match header.ordinal {
1548                    0x49c06d30a9aa02ba => {
1549                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
1550                        let mut req = fidl::new_empty!(
1551                            BrowseControllerGetMediaPlayerItemsRequest,
1552                            fidl::encoding::DefaultFuchsiaResourceDialect
1553                        );
1554                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<BrowseControllerGetMediaPlayerItemsRequest>(&header, _body_bytes, handles, &mut req)?;
1555                        let control_handle =
1556                            BrowseControllerControlHandle { inner: this.inner.clone() };
1557                        Ok(BrowseControllerRequest::GetMediaPlayerItems {
1558                            start_index: req.start_index,
1559                            end_index: req.end_index,
1560
1561                            responder: BrowseControllerGetMediaPlayerItemsResponder {
1562                                control_handle: std::mem::ManuallyDrop::new(control_handle),
1563                                tx_id: header.tx_id,
1564                            },
1565                        })
1566                    }
1567                    0x35f5a88695b46cf7 => {
1568                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
1569                        let mut req = fidl::new_empty!(
1570                            BrowseControllerGetNowPlayingItemsRequest,
1571                            fidl::encoding::DefaultFuchsiaResourceDialect
1572                        );
1573                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<BrowseControllerGetNowPlayingItemsRequest>(&header, _body_bytes, handles, &mut req)?;
1574                        let control_handle =
1575                            BrowseControllerControlHandle { inner: this.inner.clone() };
1576                        Ok(BrowseControllerRequest::GetNowPlayingItems {
1577                            start_index: req.start_index,
1578                            end_index: req.end_index,
1579                            attribute_option: req.attribute_option,
1580
1581                            responder: BrowseControllerGetNowPlayingItemsResponder {
1582                                control_handle: std::mem::ManuallyDrop::new(control_handle),
1583                                tx_id: header.tx_id,
1584                            },
1585                        })
1586                    }
1587                    0x5d1415aecee72133 => {
1588                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
1589                        let mut req = fidl::new_empty!(
1590                            BrowseControllerGetFileSystemItemsRequest,
1591                            fidl::encoding::DefaultFuchsiaResourceDialect
1592                        );
1593                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<BrowseControllerGetFileSystemItemsRequest>(&header, _body_bytes, handles, &mut req)?;
1594                        let control_handle =
1595                            BrowseControllerControlHandle { inner: this.inner.clone() };
1596                        Ok(BrowseControllerRequest::GetFileSystemItems {
1597                            start_index: req.start_index,
1598                            end_index: req.end_index,
1599                            attribute_option: req.attribute_option,
1600
1601                            responder: BrowseControllerGetFileSystemItemsResponder {
1602                                control_handle: std::mem::ManuallyDrop::new(control_handle),
1603                                tx_id: header.tx_id,
1604                            },
1605                        })
1606                    }
1607                    0x2e0600579d43b51e => {
1608                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
1609                        let mut req = fidl::new_empty!(
1610                            BrowseControllerChangePathRequest,
1611                            fidl::encoding::DefaultFuchsiaResourceDialect
1612                        );
1613                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<BrowseControllerChangePathRequest>(&header, _body_bytes, handles, &mut req)?;
1614                        let control_handle =
1615                            BrowseControllerControlHandle { inner: this.inner.clone() };
1616                        Ok(BrowseControllerRequest::ChangePath {
1617                            path: req.path,
1618
1619                            responder: BrowseControllerChangePathResponder {
1620                                control_handle: std::mem::ManuallyDrop::new(control_handle),
1621                                tx_id: header.tx_id,
1622                            },
1623                        })
1624                    }
1625                    0x57075115ce25cf16 => {
1626                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
1627                        let mut req = fidl::new_empty!(
1628                            BrowseControllerPlayFileSystemItemRequest,
1629                            fidl::encoding::DefaultFuchsiaResourceDialect
1630                        );
1631                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<BrowseControllerPlayFileSystemItemRequest>(&header, _body_bytes, handles, &mut req)?;
1632                        let control_handle =
1633                            BrowseControllerControlHandle { inner: this.inner.clone() };
1634                        Ok(BrowseControllerRequest::PlayFileSystemItem {
1635                            uid: req.uid,
1636
1637                            responder: BrowseControllerPlayFileSystemItemResponder {
1638                                control_handle: std::mem::ManuallyDrop::new(control_handle),
1639                                tx_id: header.tx_id,
1640                            },
1641                        })
1642                    }
1643                    0x116e151d547fd2d7 => {
1644                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
1645                        let mut req = fidl::new_empty!(
1646                            BrowseControllerPlayNowPlayingItemRequest,
1647                            fidl::encoding::DefaultFuchsiaResourceDialect
1648                        );
1649                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<BrowseControllerPlayNowPlayingItemRequest>(&header, _body_bytes, handles, &mut req)?;
1650                        let control_handle =
1651                            BrowseControllerControlHandle { inner: this.inner.clone() };
1652                        Ok(BrowseControllerRequest::PlayNowPlayingItem {
1653                            uid: req.uid,
1654
1655                            responder: BrowseControllerPlayNowPlayingItemResponder {
1656                                control_handle: std::mem::ManuallyDrop::new(control_handle),
1657                                tx_id: header.tx_id,
1658                            },
1659                        })
1660                    }
1661                    0x3e3256f57f8848da => {
1662                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
1663                        let mut req = fidl::new_empty!(
1664                            BrowseControllerSetBrowsedPlayerRequest,
1665                            fidl::encoding::DefaultFuchsiaResourceDialect
1666                        );
1667                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<BrowseControllerSetBrowsedPlayerRequest>(&header, _body_bytes, handles, &mut req)?;
1668                        let control_handle =
1669                            BrowseControllerControlHandle { inner: this.inner.clone() };
1670                        Ok(BrowseControllerRequest::SetBrowsedPlayer {
1671                            player_id: req.player_id,
1672
1673                            responder: BrowseControllerSetBrowsedPlayerResponder {
1674                                control_handle: std::mem::ManuallyDrop::new(control_handle),
1675                                tx_id: header.tx_id,
1676                            },
1677                        })
1678                    }
1679                    _ => Err(fidl::Error::UnknownOrdinal {
1680                        ordinal: header.ordinal,
1681                        protocol_name:
1682                            <BrowseControllerMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
1683                    }),
1684                }))
1685            },
1686        )
1687    }
1688}
1689
1690/// Client wrapper for local controller (CT) -> remote target (TG) AVCTP
1691/// connections between devices for browse related commands.
1692///
1693/// NOTE: a client is high level construct and does not represent a connection
1694/// with a device. Connections are internally managed and may be shared by
1695/// multiple clients. The actual connection may be opened on-demand after any
1696/// command here is called.
1697#[derive(Debug)]
1698pub enum BrowseControllerRequest {
1699    /// Used for GetFolderItems(MediaPlayerList).
1700    /// Gets the list of media players. End index is inclusive.
1701    GetMediaPlayerItems {
1702        start_index: u32,
1703        end_index: u32,
1704        responder: BrowseControllerGetMediaPlayerItemsResponder,
1705    },
1706    /// Used for GetFolderItems(NowPlayingList).
1707    /// Gets the list of items from the now playing list aka the queue of the
1708    /// addressed media player.
1709    /// + request `end_index` is inclusive.
1710    GetNowPlayingItems {
1711        start_index: u32,
1712        end_index: u32,
1713        attribute_option: AttributeRequestOption,
1714        responder: BrowseControllerGetNowPlayingItemsResponder,
1715    },
1716    /// Used for GetFolderItems(MediaPlayerVirtualFilesystem).
1717    /// Gets the list of folder item/media element item.
1718    /// + request `end_index` is inclusive.
1719    GetFileSystemItems {
1720        start_index: u32,
1721        end_index: u32,
1722        attribute_option: AttributeRequestOption,
1723        responder: BrowseControllerGetFileSystemItemsResponder,
1724    },
1725    /// Used for ChangePath browse command.
1726    /// + request `path` dictates whether or not the direction will be Move Up
1727    ///   or Move down. If `path.parent` is set, direction will be Move Up. If
1728    ///   `path.child_folder_uid` is set, direction will be Move Down.
1729    ChangePath { path: Path, responder: BrowseControllerChangePathResponder },
1730    ///  Used for PlayItem(FileSystem).
1731    PlayFileSystemItem { uid: u64, responder: BrowseControllerPlayFileSystemItemResponder },
1732    ///  Used for PlayItem(NowPlayingList). Plays the specified item from the now playing
1733    /// list aka the queue of the addressed media player.
1734    PlayNowPlayingItem { uid: u64, responder: BrowseControllerPlayNowPlayingItemResponder },
1735    /// Changes the addressed `player_id` on the target when multiple are supported.
1736    SetBrowsedPlayer { player_id: u16, responder: BrowseControllerSetBrowsedPlayerResponder },
1737}
1738
1739impl BrowseControllerRequest {
1740    #[allow(irrefutable_let_patterns)]
1741    pub fn into_get_media_player_items(
1742        self,
1743    ) -> Option<(u32, u32, BrowseControllerGetMediaPlayerItemsResponder)> {
1744        if let BrowseControllerRequest::GetMediaPlayerItems { start_index, end_index, responder } =
1745            self
1746        {
1747            Some((start_index, end_index, responder))
1748        } else {
1749            None
1750        }
1751    }
1752
1753    #[allow(irrefutable_let_patterns)]
1754    pub fn into_get_now_playing_items(
1755        self,
1756    ) -> Option<(u32, u32, AttributeRequestOption, BrowseControllerGetNowPlayingItemsResponder)>
1757    {
1758        if let BrowseControllerRequest::GetNowPlayingItems {
1759            start_index,
1760            end_index,
1761            attribute_option,
1762            responder,
1763        } = self
1764        {
1765            Some((start_index, end_index, attribute_option, responder))
1766        } else {
1767            None
1768        }
1769    }
1770
1771    #[allow(irrefutable_let_patterns)]
1772    pub fn into_get_file_system_items(
1773        self,
1774    ) -> Option<(u32, u32, AttributeRequestOption, BrowseControllerGetFileSystemItemsResponder)>
1775    {
1776        if let BrowseControllerRequest::GetFileSystemItems {
1777            start_index,
1778            end_index,
1779            attribute_option,
1780            responder,
1781        } = self
1782        {
1783            Some((start_index, end_index, attribute_option, responder))
1784        } else {
1785            None
1786        }
1787    }
1788
1789    #[allow(irrefutable_let_patterns)]
1790    pub fn into_change_path(self) -> Option<(Path, BrowseControllerChangePathResponder)> {
1791        if let BrowseControllerRequest::ChangePath { path, responder } = self {
1792            Some((path, responder))
1793        } else {
1794            None
1795        }
1796    }
1797
1798    #[allow(irrefutable_let_patterns)]
1799    pub fn into_play_file_system_item(
1800        self,
1801    ) -> Option<(u64, BrowseControllerPlayFileSystemItemResponder)> {
1802        if let BrowseControllerRequest::PlayFileSystemItem { uid, responder } = self {
1803            Some((uid, responder))
1804        } else {
1805            None
1806        }
1807    }
1808
1809    #[allow(irrefutable_let_patterns)]
1810    pub fn into_play_now_playing_item(
1811        self,
1812    ) -> Option<(u64, BrowseControllerPlayNowPlayingItemResponder)> {
1813        if let BrowseControllerRequest::PlayNowPlayingItem { uid, responder } = self {
1814            Some((uid, responder))
1815        } else {
1816            None
1817        }
1818    }
1819
1820    #[allow(irrefutable_let_patterns)]
1821    pub fn into_set_browsed_player(
1822        self,
1823    ) -> Option<(u16, BrowseControllerSetBrowsedPlayerResponder)> {
1824        if let BrowseControllerRequest::SetBrowsedPlayer { player_id, responder } = self {
1825            Some((player_id, responder))
1826        } else {
1827            None
1828        }
1829    }
1830
1831    /// Name of the method defined in FIDL
1832    pub fn method_name(&self) -> &'static str {
1833        match *self {
1834            BrowseControllerRequest::GetMediaPlayerItems { .. } => "get_media_player_items",
1835            BrowseControllerRequest::GetNowPlayingItems { .. } => "get_now_playing_items",
1836            BrowseControllerRequest::GetFileSystemItems { .. } => "get_file_system_items",
1837            BrowseControllerRequest::ChangePath { .. } => "change_path",
1838            BrowseControllerRequest::PlayFileSystemItem { .. } => "play_file_system_item",
1839            BrowseControllerRequest::PlayNowPlayingItem { .. } => "play_now_playing_item",
1840            BrowseControllerRequest::SetBrowsedPlayer { .. } => "set_browsed_player",
1841        }
1842    }
1843}
1844
1845#[derive(Debug, Clone)]
1846pub struct BrowseControllerControlHandle {
1847    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
1848}
1849
1850impl fidl::endpoints::ControlHandle for BrowseControllerControlHandle {
1851    fn shutdown(&self) {
1852        self.inner.shutdown()
1853    }
1854    fn shutdown_with_epitaph(&self, status: zx_status::Status) {
1855        self.inner.shutdown_with_epitaph(status)
1856    }
1857
1858    fn is_closed(&self) -> bool {
1859        self.inner.channel().is_closed()
1860    }
1861    fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
1862        self.inner.channel().on_closed()
1863    }
1864
1865    #[cfg(target_os = "fuchsia")]
1866    fn signal_peer(
1867        &self,
1868        clear_mask: zx::Signals,
1869        set_mask: zx::Signals,
1870    ) -> Result<(), zx_status::Status> {
1871        use fidl::Peered;
1872        self.inner.channel().signal_peer(clear_mask, set_mask)
1873    }
1874}
1875
1876impl BrowseControllerControlHandle {}
1877
1878#[must_use = "FIDL methods require a response to be sent"]
1879#[derive(Debug)]
1880pub struct BrowseControllerGetMediaPlayerItemsResponder {
1881    control_handle: std::mem::ManuallyDrop<BrowseControllerControlHandle>,
1882    tx_id: u32,
1883}
1884
1885/// Set the the channel to be shutdown (see [`BrowseControllerControlHandle::shutdown`])
1886/// if the responder is dropped without sending a response, so that the client
1887/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
1888impl std::ops::Drop for BrowseControllerGetMediaPlayerItemsResponder {
1889    fn drop(&mut self) {
1890        self.control_handle.shutdown();
1891        // Safety: drops once, never accessed again
1892        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1893    }
1894}
1895
1896impl fidl::endpoints::Responder for BrowseControllerGetMediaPlayerItemsResponder {
1897    type ControlHandle = BrowseControllerControlHandle;
1898
1899    fn control_handle(&self) -> &BrowseControllerControlHandle {
1900        &self.control_handle
1901    }
1902
1903    fn drop_without_shutdown(mut self) {
1904        // Safety: drops once, never accessed again due to mem::forget
1905        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1906        // Prevent Drop from running (which would shut down the channel)
1907        std::mem::forget(self);
1908    }
1909}
1910
1911impl BrowseControllerGetMediaPlayerItemsResponder {
1912    /// Sends a response to the FIDL transaction.
1913    ///
1914    /// Sets the channel to shutdown if an error occurs.
1915    pub fn send(
1916        self,
1917        mut result: Result<&[MediaPlayerItem], BrowseControllerError>,
1918    ) -> Result<(), fidl::Error> {
1919        let _result = self.send_raw(result);
1920        if _result.is_err() {
1921            self.control_handle.shutdown();
1922        }
1923        self.drop_without_shutdown();
1924        _result
1925    }
1926
1927    /// Similar to "send" but does not shutdown the channel if an error occurs.
1928    pub fn send_no_shutdown_on_err(
1929        self,
1930        mut result: Result<&[MediaPlayerItem], BrowseControllerError>,
1931    ) -> Result<(), fidl::Error> {
1932        let _result = self.send_raw(result);
1933        self.drop_without_shutdown();
1934        _result
1935    }
1936
1937    fn send_raw(
1938        &self,
1939        mut result: Result<&[MediaPlayerItem], BrowseControllerError>,
1940    ) -> Result<(), fidl::Error> {
1941        self.control_handle.inner.send::<fidl::encoding::ResultType<
1942            BrowseControllerGetMediaPlayerItemsResponse,
1943            BrowseControllerError,
1944        >>(
1945            result.map(|items| (items,)),
1946            self.tx_id,
1947            0x49c06d30a9aa02ba,
1948            fidl::encoding::DynamicFlags::empty(),
1949        )
1950    }
1951}
1952
1953#[must_use = "FIDL methods require a response to be sent"]
1954#[derive(Debug)]
1955pub struct BrowseControllerGetNowPlayingItemsResponder {
1956    control_handle: std::mem::ManuallyDrop<BrowseControllerControlHandle>,
1957    tx_id: u32,
1958}
1959
1960/// Set the the channel to be shutdown (see [`BrowseControllerControlHandle::shutdown`])
1961/// if the responder is dropped without sending a response, so that the client
1962/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
1963impl std::ops::Drop for BrowseControllerGetNowPlayingItemsResponder {
1964    fn drop(&mut self) {
1965        self.control_handle.shutdown();
1966        // Safety: drops once, never accessed again
1967        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1968    }
1969}
1970
1971impl fidl::endpoints::Responder for BrowseControllerGetNowPlayingItemsResponder {
1972    type ControlHandle = BrowseControllerControlHandle;
1973
1974    fn control_handle(&self) -> &BrowseControllerControlHandle {
1975        &self.control_handle
1976    }
1977
1978    fn drop_without_shutdown(mut self) {
1979        // Safety: drops once, never accessed again due to mem::forget
1980        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1981        // Prevent Drop from running (which would shut down the channel)
1982        std::mem::forget(self);
1983    }
1984}
1985
1986impl BrowseControllerGetNowPlayingItemsResponder {
1987    /// Sends a response to the FIDL transaction.
1988    ///
1989    /// Sets the channel to shutdown if an error occurs.
1990    pub fn send(
1991        self,
1992        mut result: Result<&[MediaElementItem], BrowseControllerError>,
1993    ) -> Result<(), fidl::Error> {
1994        let _result = self.send_raw(result);
1995        if _result.is_err() {
1996            self.control_handle.shutdown();
1997        }
1998        self.drop_without_shutdown();
1999        _result
2000    }
2001
2002    /// Similar to "send" but does not shutdown the channel if an error occurs.
2003    pub fn send_no_shutdown_on_err(
2004        self,
2005        mut result: Result<&[MediaElementItem], BrowseControllerError>,
2006    ) -> Result<(), fidl::Error> {
2007        let _result = self.send_raw(result);
2008        self.drop_without_shutdown();
2009        _result
2010    }
2011
2012    fn send_raw(
2013        &self,
2014        mut result: Result<&[MediaElementItem], BrowseControllerError>,
2015    ) -> Result<(), fidl::Error> {
2016        self.control_handle.inner.send::<fidl::encoding::ResultType<
2017            BrowseControllerGetNowPlayingItemsResponse,
2018            BrowseControllerError,
2019        >>(
2020            result.map(|items| (items,)),
2021            self.tx_id,
2022            0x35f5a88695b46cf7,
2023            fidl::encoding::DynamicFlags::empty(),
2024        )
2025    }
2026}
2027
2028#[must_use = "FIDL methods require a response to be sent"]
2029#[derive(Debug)]
2030pub struct BrowseControllerGetFileSystemItemsResponder {
2031    control_handle: std::mem::ManuallyDrop<BrowseControllerControlHandle>,
2032    tx_id: u32,
2033}
2034
2035/// Set the the channel to be shutdown (see [`BrowseControllerControlHandle::shutdown`])
2036/// if the responder is dropped without sending a response, so that the client
2037/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
2038impl std::ops::Drop for BrowseControllerGetFileSystemItemsResponder {
2039    fn drop(&mut self) {
2040        self.control_handle.shutdown();
2041        // Safety: drops once, never accessed again
2042        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
2043    }
2044}
2045
2046impl fidl::endpoints::Responder for BrowseControllerGetFileSystemItemsResponder {
2047    type ControlHandle = BrowseControllerControlHandle;
2048
2049    fn control_handle(&self) -> &BrowseControllerControlHandle {
2050        &self.control_handle
2051    }
2052
2053    fn drop_without_shutdown(mut self) {
2054        // Safety: drops once, never accessed again due to mem::forget
2055        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
2056        // Prevent Drop from running (which would shut down the channel)
2057        std::mem::forget(self);
2058    }
2059}
2060
2061impl BrowseControllerGetFileSystemItemsResponder {
2062    /// Sends a response to the FIDL transaction.
2063    ///
2064    /// Sets the channel to shutdown if an error occurs.
2065    pub fn send(
2066        self,
2067        mut result: Result<&[FileSystemItem], BrowseControllerError>,
2068    ) -> Result<(), fidl::Error> {
2069        let _result = self.send_raw(result);
2070        if _result.is_err() {
2071            self.control_handle.shutdown();
2072        }
2073        self.drop_without_shutdown();
2074        _result
2075    }
2076
2077    /// Similar to "send" but does not shutdown the channel if an error occurs.
2078    pub fn send_no_shutdown_on_err(
2079        self,
2080        mut result: Result<&[FileSystemItem], BrowseControllerError>,
2081    ) -> Result<(), fidl::Error> {
2082        let _result = self.send_raw(result);
2083        self.drop_without_shutdown();
2084        _result
2085    }
2086
2087    fn send_raw(
2088        &self,
2089        mut result: Result<&[FileSystemItem], BrowseControllerError>,
2090    ) -> Result<(), fidl::Error> {
2091        self.control_handle.inner.send::<fidl::encoding::ResultType<
2092            BrowseControllerGetFileSystemItemsResponse,
2093            BrowseControllerError,
2094        >>(
2095            result.map(|items| (items,)),
2096            self.tx_id,
2097            0x5d1415aecee72133,
2098            fidl::encoding::DynamicFlags::empty(),
2099        )
2100    }
2101}
2102
2103#[must_use = "FIDL methods require a response to be sent"]
2104#[derive(Debug)]
2105pub struct BrowseControllerChangePathResponder {
2106    control_handle: std::mem::ManuallyDrop<BrowseControllerControlHandle>,
2107    tx_id: u32,
2108}
2109
2110/// Set the the channel to be shutdown (see [`BrowseControllerControlHandle::shutdown`])
2111/// if the responder is dropped without sending a response, so that the client
2112/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
2113impl std::ops::Drop for BrowseControllerChangePathResponder {
2114    fn drop(&mut self) {
2115        self.control_handle.shutdown();
2116        // Safety: drops once, never accessed again
2117        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
2118    }
2119}
2120
2121impl fidl::endpoints::Responder for BrowseControllerChangePathResponder {
2122    type ControlHandle = BrowseControllerControlHandle;
2123
2124    fn control_handle(&self) -> &BrowseControllerControlHandle {
2125        &self.control_handle
2126    }
2127
2128    fn drop_without_shutdown(mut self) {
2129        // Safety: drops once, never accessed again due to mem::forget
2130        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
2131        // Prevent Drop from running (which would shut down the channel)
2132        std::mem::forget(self);
2133    }
2134}
2135
2136impl BrowseControllerChangePathResponder {
2137    /// Sends a response to the FIDL transaction.
2138    ///
2139    /// Sets the channel to shutdown if an error occurs.
2140    pub fn send(self, mut result: Result<u32, BrowseControllerError>) -> Result<(), fidl::Error> {
2141        let _result = self.send_raw(result);
2142        if _result.is_err() {
2143            self.control_handle.shutdown();
2144        }
2145        self.drop_without_shutdown();
2146        _result
2147    }
2148
2149    /// Similar to "send" but does not shutdown the channel if an error occurs.
2150    pub fn send_no_shutdown_on_err(
2151        self,
2152        mut result: Result<u32, BrowseControllerError>,
2153    ) -> Result<(), fidl::Error> {
2154        let _result = self.send_raw(result);
2155        self.drop_without_shutdown();
2156        _result
2157    }
2158
2159    fn send_raw(&self, mut result: Result<u32, BrowseControllerError>) -> Result<(), fidl::Error> {
2160        self.control_handle.inner.send::<fidl::encoding::ResultType<
2161            BrowseControllerChangePathResponse,
2162            BrowseControllerError,
2163        >>(
2164            result.map(|num_items| (num_items,)),
2165            self.tx_id,
2166            0x2e0600579d43b51e,
2167            fidl::encoding::DynamicFlags::empty(),
2168        )
2169    }
2170}
2171
2172#[must_use = "FIDL methods require a response to be sent"]
2173#[derive(Debug)]
2174pub struct BrowseControllerPlayFileSystemItemResponder {
2175    control_handle: std::mem::ManuallyDrop<BrowseControllerControlHandle>,
2176    tx_id: u32,
2177}
2178
2179/// Set the the channel to be shutdown (see [`BrowseControllerControlHandle::shutdown`])
2180/// if the responder is dropped without sending a response, so that the client
2181/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
2182impl std::ops::Drop for BrowseControllerPlayFileSystemItemResponder {
2183    fn drop(&mut self) {
2184        self.control_handle.shutdown();
2185        // Safety: drops once, never accessed again
2186        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
2187    }
2188}
2189
2190impl fidl::endpoints::Responder for BrowseControllerPlayFileSystemItemResponder {
2191    type ControlHandle = BrowseControllerControlHandle;
2192
2193    fn control_handle(&self) -> &BrowseControllerControlHandle {
2194        &self.control_handle
2195    }
2196
2197    fn drop_without_shutdown(mut self) {
2198        // Safety: drops once, never accessed again due to mem::forget
2199        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
2200        // Prevent Drop from running (which would shut down the channel)
2201        std::mem::forget(self);
2202    }
2203}
2204
2205impl BrowseControllerPlayFileSystemItemResponder {
2206    /// Sends a response to the FIDL transaction.
2207    ///
2208    /// Sets the channel to shutdown if an error occurs.
2209    pub fn send(self, mut result: Result<(), BrowseControllerError>) -> Result<(), fidl::Error> {
2210        let _result = self.send_raw(result);
2211        if _result.is_err() {
2212            self.control_handle.shutdown();
2213        }
2214        self.drop_without_shutdown();
2215        _result
2216    }
2217
2218    /// Similar to "send" but does not shutdown the channel if an error occurs.
2219    pub fn send_no_shutdown_on_err(
2220        self,
2221        mut result: Result<(), BrowseControllerError>,
2222    ) -> Result<(), fidl::Error> {
2223        let _result = self.send_raw(result);
2224        self.drop_without_shutdown();
2225        _result
2226    }
2227
2228    fn send_raw(&self, mut result: Result<(), BrowseControllerError>) -> Result<(), fidl::Error> {
2229        self.control_handle.inner.send::<fidl::encoding::ResultType<
2230            fidl::encoding::EmptyStruct,
2231            BrowseControllerError,
2232        >>(
2233            result,
2234            self.tx_id,
2235            0x57075115ce25cf16,
2236            fidl::encoding::DynamicFlags::empty(),
2237        )
2238    }
2239}
2240
2241#[must_use = "FIDL methods require a response to be sent"]
2242#[derive(Debug)]
2243pub struct BrowseControllerPlayNowPlayingItemResponder {
2244    control_handle: std::mem::ManuallyDrop<BrowseControllerControlHandle>,
2245    tx_id: u32,
2246}
2247
2248/// Set the the channel to be shutdown (see [`BrowseControllerControlHandle::shutdown`])
2249/// if the responder is dropped without sending a response, so that the client
2250/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
2251impl std::ops::Drop for BrowseControllerPlayNowPlayingItemResponder {
2252    fn drop(&mut self) {
2253        self.control_handle.shutdown();
2254        // Safety: drops once, never accessed again
2255        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
2256    }
2257}
2258
2259impl fidl::endpoints::Responder for BrowseControllerPlayNowPlayingItemResponder {
2260    type ControlHandle = BrowseControllerControlHandle;
2261
2262    fn control_handle(&self) -> &BrowseControllerControlHandle {
2263        &self.control_handle
2264    }
2265
2266    fn drop_without_shutdown(mut self) {
2267        // Safety: drops once, never accessed again due to mem::forget
2268        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
2269        // Prevent Drop from running (which would shut down the channel)
2270        std::mem::forget(self);
2271    }
2272}
2273
2274impl BrowseControllerPlayNowPlayingItemResponder {
2275    /// Sends a response to the FIDL transaction.
2276    ///
2277    /// Sets the channel to shutdown if an error occurs.
2278    pub fn send(self, mut result: Result<(), BrowseControllerError>) -> Result<(), fidl::Error> {
2279        let _result = self.send_raw(result);
2280        if _result.is_err() {
2281            self.control_handle.shutdown();
2282        }
2283        self.drop_without_shutdown();
2284        _result
2285    }
2286
2287    /// Similar to "send" but does not shutdown the channel if an error occurs.
2288    pub fn send_no_shutdown_on_err(
2289        self,
2290        mut result: Result<(), BrowseControllerError>,
2291    ) -> Result<(), fidl::Error> {
2292        let _result = self.send_raw(result);
2293        self.drop_without_shutdown();
2294        _result
2295    }
2296
2297    fn send_raw(&self, mut result: Result<(), BrowseControllerError>) -> Result<(), fidl::Error> {
2298        self.control_handle.inner.send::<fidl::encoding::ResultType<
2299            fidl::encoding::EmptyStruct,
2300            BrowseControllerError,
2301        >>(
2302            result,
2303            self.tx_id,
2304            0x116e151d547fd2d7,
2305            fidl::encoding::DynamicFlags::empty(),
2306        )
2307    }
2308}
2309
2310#[must_use = "FIDL methods require a response to be sent"]
2311#[derive(Debug)]
2312pub struct BrowseControllerSetBrowsedPlayerResponder {
2313    control_handle: std::mem::ManuallyDrop<BrowseControllerControlHandle>,
2314    tx_id: u32,
2315}
2316
2317/// Set the the channel to be shutdown (see [`BrowseControllerControlHandle::shutdown`])
2318/// if the responder is dropped without sending a response, so that the client
2319/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
2320impl std::ops::Drop for BrowseControllerSetBrowsedPlayerResponder {
2321    fn drop(&mut self) {
2322        self.control_handle.shutdown();
2323        // Safety: drops once, never accessed again
2324        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
2325    }
2326}
2327
2328impl fidl::endpoints::Responder for BrowseControllerSetBrowsedPlayerResponder {
2329    type ControlHandle = BrowseControllerControlHandle;
2330
2331    fn control_handle(&self) -> &BrowseControllerControlHandle {
2332        &self.control_handle
2333    }
2334
2335    fn drop_without_shutdown(mut self) {
2336        // Safety: drops once, never accessed again due to mem::forget
2337        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
2338        // Prevent Drop from running (which would shut down the channel)
2339        std::mem::forget(self);
2340    }
2341}
2342
2343impl BrowseControllerSetBrowsedPlayerResponder {
2344    /// Sends a response to the FIDL transaction.
2345    ///
2346    /// Sets the channel to shutdown if an error occurs.
2347    pub fn send(self, mut result: Result<(), BrowseControllerError>) -> Result<(), fidl::Error> {
2348        let _result = self.send_raw(result);
2349        if _result.is_err() {
2350            self.control_handle.shutdown();
2351        }
2352        self.drop_without_shutdown();
2353        _result
2354    }
2355
2356    /// Similar to "send" but does not shutdown the channel if an error occurs.
2357    pub fn send_no_shutdown_on_err(
2358        self,
2359        mut result: Result<(), BrowseControllerError>,
2360    ) -> Result<(), fidl::Error> {
2361        let _result = self.send_raw(result);
2362        self.drop_without_shutdown();
2363        _result
2364    }
2365
2366    fn send_raw(&self, mut result: Result<(), BrowseControllerError>) -> Result<(), fidl::Error> {
2367        self.control_handle.inner.send::<fidl::encoding::ResultType<
2368            fidl::encoding::EmptyStruct,
2369            BrowseControllerError,
2370        >>(
2371            result,
2372            self.tx_id,
2373            0x3e3256f57f8848da,
2374            fidl::encoding::DynamicFlags::empty(),
2375        )
2376    }
2377}
2378
2379#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
2380pub struct ControllerMarker;
2381
2382impl fidl::endpoints::ProtocolMarker for ControllerMarker {
2383    type Proxy = ControllerProxy;
2384    type RequestStream = ControllerRequestStream;
2385    #[cfg(target_os = "fuchsia")]
2386    type SynchronousProxy = ControllerSynchronousProxy;
2387
2388    const DEBUG_NAME: &'static str = "(anonymous) Controller";
2389}
2390pub type ControllerGetPlayerApplicationSettingsResult =
2391    Result<PlayerApplicationSettings, ControllerError>;
2392pub type ControllerSetPlayerApplicationSettingsResult =
2393    Result<PlayerApplicationSettings, ControllerError>;
2394pub type ControllerGetMediaAttributesResult = Result<MediaAttributes, ControllerError>;
2395pub type ControllerGetPlayStatusResult = Result<PlayStatus, ControllerError>;
2396pub type ControllerSetAbsoluteVolumeResult = Result<u8, ControllerError>;
2397pub type ControllerInformBatteryStatusResult = Result<(), ControllerError>;
2398pub type ControllerSetAddressedPlayerResult = Result<(), ControllerError>;
2399pub type ControllerSendCommandResult = Result<(), ControllerError>;
2400
2401pub trait ControllerProxyInterface: Send + Sync {
2402    type GetPlayerApplicationSettingsResponseFut: std::future::Future<
2403            Output = Result<ControllerGetPlayerApplicationSettingsResult, fidl::Error>,
2404        > + Send;
2405    fn r#get_player_application_settings(
2406        &self,
2407        attribute_ids: &[PlayerApplicationSettingAttributeId],
2408    ) -> Self::GetPlayerApplicationSettingsResponseFut;
2409    type SetPlayerApplicationSettingsResponseFut: std::future::Future<
2410            Output = Result<ControllerSetPlayerApplicationSettingsResult, fidl::Error>,
2411        > + Send;
2412    fn r#set_player_application_settings(
2413        &self,
2414        requested_settings: &PlayerApplicationSettings,
2415    ) -> Self::SetPlayerApplicationSettingsResponseFut;
2416    type GetMediaAttributesResponseFut: std::future::Future<Output = Result<ControllerGetMediaAttributesResult, fidl::Error>>
2417        + Send;
2418    fn r#get_media_attributes(&self) -> Self::GetMediaAttributesResponseFut;
2419    type GetPlayStatusResponseFut: std::future::Future<Output = Result<ControllerGetPlayStatusResult, fidl::Error>>
2420        + Send;
2421    fn r#get_play_status(&self) -> Self::GetPlayStatusResponseFut;
2422    type SetAbsoluteVolumeResponseFut: std::future::Future<Output = Result<ControllerSetAbsoluteVolumeResult, fidl::Error>>
2423        + Send;
2424    fn r#set_absolute_volume(&self, requested_volume: u8) -> Self::SetAbsoluteVolumeResponseFut;
2425    type InformBatteryStatusResponseFut: std::future::Future<Output = Result<ControllerInformBatteryStatusResult, fidl::Error>>
2426        + Send;
2427    fn r#inform_battery_status(
2428        &self,
2429        battery_status: BatteryStatus,
2430    ) -> Self::InformBatteryStatusResponseFut;
2431    fn r#set_notification_filter(
2432        &self,
2433        notifications: Notifications,
2434        position_change_interval: u32,
2435    ) -> Result<(), fidl::Error>;
2436    fn r#notify_notification_handled(&self) -> Result<(), fidl::Error>;
2437    type SetAddressedPlayerResponseFut: std::future::Future<Output = Result<ControllerSetAddressedPlayerResult, fidl::Error>>
2438        + Send;
2439    fn r#set_addressed_player(&self, player_id: u16) -> Self::SetAddressedPlayerResponseFut;
2440    type SendCommandResponseFut: std::future::Future<Output = Result<ControllerSendCommandResult, fidl::Error>>
2441        + Send;
2442    fn r#send_command(&self, command: AvcPanelCommand) -> Self::SendCommandResponseFut;
2443}
2444#[derive(Debug)]
2445#[cfg(target_os = "fuchsia")]
2446pub struct ControllerSynchronousProxy {
2447    client: fidl::client::sync::Client,
2448}
2449
2450#[cfg(target_os = "fuchsia")]
2451impl fidl::endpoints::SynchronousProxy for ControllerSynchronousProxy {
2452    type Proxy = ControllerProxy;
2453    type Protocol = ControllerMarker;
2454
2455    fn from_channel(inner: fidl::Channel) -> Self {
2456        Self::new(inner)
2457    }
2458
2459    fn into_channel(self) -> fidl::Channel {
2460        self.client.into_channel()
2461    }
2462
2463    fn as_channel(&self) -> &fidl::Channel {
2464        self.client.as_channel()
2465    }
2466}
2467
2468#[cfg(target_os = "fuchsia")]
2469impl ControllerSynchronousProxy {
2470    pub fn new(channel: fidl::Channel) -> Self {
2471        let protocol_name = <ControllerMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
2472        Self { client: fidl::client::sync::Client::new(channel, protocol_name) }
2473    }
2474
2475    pub fn into_channel(self) -> fidl::Channel {
2476        self.client.into_channel()
2477    }
2478
2479    /// Waits until an event arrives and returns it. It is safe for other
2480    /// threads to make concurrent requests while waiting for an event.
2481    pub fn wait_for_event(
2482        &self,
2483        deadline: zx::MonotonicInstant,
2484    ) -> Result<ControllerEvent, fidl::Error> {
2485        ControllerEvent::decode(self.client.wait_for_event(deadline)?)
2486    }
2487
2488    /// Returns currently set player application setting values for the `attribute_ids`.
2489    /// If no `attribute_ids` are provided, this method will query the TG for all valid
2490    /// attribute ID's, and return the currently set player application setting values.
2491    pub fn r#get_player_application_settings(
2492        &self,
2493        mut attribute_ids: &[PlayerApplicationSettingAttributeId],
2494        ___deadline: zx::MonotonicInstant,
2495    ) -> Result<ControllerGetPlayerApplicationSettingsResult, fidl::Error> {
2496        let _response = self
2497            .client
2498            .send_query::<ControllerGetPlayerApplicationSettingsRequest, fidl::encoding::ResultType<
2499                ControllerGetPlayerApplicationSettingsResponse,
2500                ControllerError,
2501            >>(
2502                (attribute_ids,),
2503                0x681de2da50670120,
2504                fidl::encoding::DynamicFlags::empty(),
2505                ___deadline,
2506            )?;
2507        Ok(_response.map(|x| x.current_settings))
2508    }
2509
2510    /// Sets the player application settings specified by `requested_settings`. Only
2511    /// settings specified in the input `requested_settings` will be overwritten.
2512    /// Returns the actual settings that were set.
2513    /// Settings provided in the `requested_settings` that are unsupported or unknown
2514    /// will not be set; the returned `set_settings` will include only the settings
2515    /// that were successfully set on the remote target.
2516    pub fn r#set_player_application_settings(
2517        &self,
2518        mut requested_settings: &PlayerApplicationSettings,
2519        ___deadline: zx::MonotonicInstant,
2520    ) -> Result<ControllerSetPlayerApplicationSettingsResult, fidl::Error> {
2521        let _response = self
2522            .client
2523            .send_query::<ControllerSetPlayerApplicationSettingsRequest, fidl::encoding::ResultType<
2524                ControllerSetPlayerApplicationSettingsResponse,
2525                ControllerError,
2526            >>(
2527                (requested_settings,),
2528                0x6a7c9689ea3a589a,
2529                fidl::encoding::DynamicFlags::empty(),
2530                ___deadline,
2531            )?;
2532        Ok(_response.map(|x| x.set_settings))
2533    }
2534
2535    /// Returns the currently playing media attributes.
2536    /// May send either the GetElementAttributes or GetItemAttributes command depending on what
2537    /// is supported.
2538    pub fn r#get_media_attributes(
2539        &self,
2540        ___deadline: zx::MonotonicInstant,
2541    ) -> Result<ControllerGetMediaAttributesResult, fidl::Error> {
2542        let _response =
2543            self.client.send_query::<fidl::encoding::EmptyPayload, fidl::encoding::ResultType<
2544                ControllerGetMediaAttributesResponse,
2545                ControllerError,
2546            >>(
2547                (),
2548                0x18bd14308ee3173d,
2549                fidl::encoding::DynamicFlags::empty(),
2550                ___deadline,
2551            )?;
2552        Ok(_response.map(|x| x.attributes))
2553    }
2554
2555    /// Returns the status of the currently playing media.
2556    pub fn r#get_play_status(
2557        &self,
2558        ___deadline: zx::MonotonicInstant,
2559    ) -> Result<ControllerGetPlayStatusResult, fidl::Error> {
2560        let _response =
2561            self.client.send_query::<fidl::encoding::EmptyPayload, fidl::encoding::ResultType<
2562                ControllerGetPlayStatusResponse,
2563                ControllerError,
2564            >>(
2565                (),
2566                0x120735bec709fc6d,
2567                fidl::encoding::DynamicFlags::empty(),
2568                ___deadline,
2569            )?;
2570        Ok(_response.map(|x| x.play_status))
2571    }
2572
2573    /// Request the absolute volume on the peer be changed. Returns the actual volume set by the
2574    /// peer. Values can range from 0x00 to 0x7F (with 100% volume being 0x7F). You may not get a
2575    /// volume changed notification event from the remote peer as result of changing this.
2576    pub fn r#set_absolute_volume(
2577        &self,
2578        mut requested_volume: u8,
2579        ___deadline: zx::MonotonicInstant,
2580    ) -> Result<ControllerSetAbsoluteVolumeResult, fidl::Error> {
2581        let _response = self.client.send_query::<
2582            ControllerSetAbsoluteVolumeRequest,
2583            fidl::encoding::ResultType<ControllerSetAbsoluteVolumeResponse, ControllerError>,
2584        >(
2585            (requested_volume,),
2586            0x1b8d010e11d05957,
2587            fidl::encoding::DynamicFlags::empty(),
2588            ___deadline,
2589        )?;
2590        Ok(_response.map(|x| x.set_volume))
2591    }
2592
2593    /// Inform target of the controller's battery level.
2594    pub fn r#inform_battery_status(
2595        &self,
2596        mut battery_status: BatteryStatus,
2597        ___deadline: zx::MonotonicInstant,
2598    ) -> Result<ControllerInformBatteryStatusResult, fidl::Error> {
2599        let _response = self.client.send_query::<
2600            ControllerInformBatteryStatusRequest,
2601            fidl::encoding::ResultType<fidl::encoding::EmptyStruct, ControllerError>,
2602        >(
2603            (battery_status,),
2604            0x11d54fbe9d12c44d,
2605            fidl::encoding::DynamicFlags::empty(),
2606            ___deadline,
2607        )?;
2608        Ok(_response.map(|x| x))
2609    }
2610
2611    /// Filters notifications that will be received with [`OnNotification`]. Not all notifications
2612    /// are supported by all peers. Resetting the notification filter may trigger all requested
2613    /// notification types to post their current value to [`OnNotification`] immediately.
2614    ///
2615    /// The `position_change_interval` argument is used to set the interval in seconds that the
2616    /// controller client would like to be notified of `TRACK_POS_CHANGED` events.
2617    /// `position_change_interval` is ignored if `TRACK_POS` is not set. The position change interval
2618    /// is best effort and not a guarantee and events may arrive more frequently or less frequently
2619    /// than requested.
2620    pub fn r#set_notification_filter(
2621        &self,
2622        mut notifications: Notifications,
2623        mut position_change_interval: u32,
2624    ) -> Result<(), fidl::Error> {
2625        self.client.send::<ControllerSetNotificationFilterRequest>(
2626            (notifications, position_change_interval),
2627            0x4d8a327745ccd73b,
2628            fidl::encoding::DynamicFlags::empty(),
2629        )
2630    }
2631
2632    /// Call to acknowledge handling of a notification from [`OnNotification`].
2633    pub fn r#notify_notification_handled(&self) -> Result<(), fidl::Error> {
2634        self.client.send::<fidl::encoding::EmptyPayload>(
2635            (),
2636            0x43d3e556557f3bc2,
2637            fidl::encoding::DynamicFlags::empty(),
2638        )
2639    }
2640
2641    /// Changes the addressed `player_id` on the target when multiple are supported.
2642    pub fn r#set_addressed_player(
2643        &self,
2644        mut player_id: u16,
2645        ___deadline: zx::MonotonicInstant,
2646    ) -> Result<ControllerSetAddressedPlayerResult, fidl::Error> {
2647        let _response = self.client.send_query::<
2648            ControllerSetAddressedPlayerRequest,
2649            fidl::encoding::ResultType<fidl::encoding::EmptyStruct, ControllerError>,
2650        >(
2651            (player_id,),
2652            0x7ffc261f10ee1da5,
2653            fidl::encoding::DynamicFlags::empty(),
2654            ___deadline,
2655        )?;
2656        Ok(_response.map(|x| x))
2657    }
2658
2659    /// Send an AV\C passthrough key command. Sends both a key down and key up event.
2660    pub fn r#send_command(
2661        &self,
2662        mut command: AvcPanelCommand,
2663        ___deadline: zx::MonotonicInstant,
2664    ) -> Result<ControllerSendCommandResult, fidl::Error> {
2665        let _response = self.client.send_query::<
2666            ControllerSendCommandRequest,
2667            fidl::encoding::ResultType<fidl::encoding::EmptyStruct, ControllerError>,
2668        >(
2669            (command,),
2670            0x241324c56b5bc257,
2671            fidl::encoding::DynamicFlags::empty(),
2672            ___deadline,
2673        )?;
2674        Ok(_response.map(|x| x))
2675    }
2676}
2677
2678#[cfg(target_os = "fuchsia")]
2679impl From<ControllerSynchronousProxy> for zx::Handle {
2680    fn from(value: ControllerSynchronousProxy) -> Self {
2681        value.into_channel().into()
2682    }
2683}
2684
2685#[cfg(target_os = "fuchsia")]
2686impl From<fidl::Channel> for ControllerSynchronousProxy {
2687    fn from(value: fidl::Channel) -> Self {
2688        Self::new(value)
2689    }
2690}
2691
2692#[cfg(target_os = "fuchsia")]
2693impl fidl::endpoints::FromClient for ControllerSynchronousProxy {
2694    type Protocol = ControllerMarker;
2695
2696    fn from_client(value: fidl::endpoints::ClientEnd<ControllerMarker>) -> Self {
2697        Self::new(value.into_channel())
2698    }
2699}
2700
2701#[derive(Debug, Clone)]
2702pub struct ControllerProxy {
2703    client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
2704}
2705
2706impl fidl::endpoints::Proxy for ControllerProxy {
2707    type Protocol = ControllerMarker;
2708
2709    fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
2710        Self::new(inner)
2711    }
2712
2713    fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
2714        self.client.into_channel().map_err(|client| Self { client })
2715    }
2716
2717    fn as_channel(&self) -> &::fidl::AsyncChannel {
2718        self.client.as_channel()
2719    }
2720}
2721
2722impl ControllerProxy {
2723    /// Create a new Proxy for fuchsia.bluetooth.avrcp/Controller.
2724    pub fn new(channel: ::fidl::AsyncChannel) -> Self {
2725        let protocol_name = <ControllerMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
2726        Self { client: fidl::client::Client::new(channel, protocol_name) }
2727    }
2728
2729    /// Get a Stream of events from the remote end of the protocol.
2730    ///
2731    /// # Panics
2732    ///
2733    /// Panics if the event stream was already taken.
2734    pub fn take_event_stream(&self) -> ControllerEventStream {
2735        ControllerEventStream { event_receiver: self.client.take_event_receiver() }
2736    }
2737
2738    /// Returns currently set player application setting values for the `attribute_ids`.
2739    /// If no `attribute_ids` are provided, this method will query the TG for all valid
2740    /// attribute ID's, and return the currently set player application setting values.
2741    pub fn r#get_player_application_settings(
2742        &self,
2743        mut attribute_ids: &[PlayerApplicationSettingAttributeId],
2744    ) -> fidl::client::QueryResponseFut<
2745        ControllerGetPlayerApplicationSettingsResult,
2746        fidl::encoding::DefaultFuchsiaResourceDialect,
2747    > {
2748        ControllerProxyInterface::r#get_player_application_settings(self, attribute_ids)
2749    }
2750
2751    /// Sets the player application settings specified by `requested_settings`. Only
2752    /// settings specified in the input `requested_settings` will be overwritten.
2753    /// Returns the actual settings that were set.
2754    /// Settings provided in the `requested_settings` that are unsupported or unknown
2755    /// will not be set; the returned `set_settings` will include only the settings
2756    /// that were successfully set on the remote target.
2757    pub fn r#set_player_application_settings(
2758        &self,
2759        mut requested_settings: &PlayerApplicationSettings,
2760    ) -> fidl::client::QueryResponseFut<
2761        ControllerSetPlayerApplicationSettingsResult,
2762        fidl::encoding::DefaultFuchsiaResourceDialect,
2763    > {
2764        ControllerProxyInterface::r#set_player_application_settings(self, requested_settings)
2765    }
2766
2767    /// Returns the currently playing media attributes.
2768    /// May send either the GetElementAttributes or GetItemAttributes command depending on what
2769    /// is supported.
2770    pub fn r#get_media_attributes(
2771        &self,
2772    ) -> fidl::client::QueryResponseFut<
2773        ControllerGetMediaAttributesResult,
2774        fidl::encoding::DefaultFuchsiaResourceDialect,
2775    > {
2776        ControllerProxyInterface::r#get_media_attributes(self)
2777    }
2778
2779    /// Returns the status of the currently playing media.
2780    pub fn r#get_play_status(
2781        &self,
2782    ) -> fidl::client::QueryResponseFut<
2783        ControllerGetPlayStatusResult,
2784        fidl::encoding::DefaultFuchsiaResourceDialect,
2785    > {
2786        ControllerProxyInterface::r#get_play_status(self)
2787    }
2788
2789    /// Request the absolute volume on the peer be changed. Returns the actual volume set by the
2790    /// peer. Values can range from 0x00 to 0x7F (with 100% volume being 0x7F). You may not get a
2791    /// volume changed notification event from the remote peer as result of changing this.
2792    pub fn r#set_absolute_volume(
2793        &self,
2794        mut requested_volume: u8,
2795    ) -> fidl::client::QueryResponseFut<
2796        ControllerSetAbsoluteVolumeResult,
2797        fidl::encoding::DefaultFuchsiaResourceDialect,
2798    > {
2799        ControllerProxyInterface::r#set_absolute_volume(self, requested_volume)
2800    }
2801
2802    /// Inform target of the controller's battery level.
2803    pub fn r#inform_battery_status(
2804        &self,
2805        mut battery_status: BatteryStatus,
2806    ) -> fidl::client::QueryResponseFut<
2807        ControllerInformBatteryStatusResult,
2808        fidl::encoding::DefaultFuchsiaResourceDialect,
2809    > {
2810        ControllerProxyInterface::r#inform_battery_status(self, battery_status)
2811    }
2812
2813    /// Filters notifications that will be received with [`OnNotification`]. Not all notifications
2814    /// are supported by all peers. Resetting the notification filter may trigger all requested
2815    /// notification types to post their current value to [`OnNotification`] immediately.
2816    ///
2817    /// The `position_change_interval` argument is used to set the interval in seconds that the
2818    /// controller client would like to be notified of `TRACK_POS_CHANGED` events.
2819    /// `position_change_interval` is ignored if `TRACK_POS` is not set. The position change interval
2820    /// is best effort and not a guarantee and events may arrive more frequently or less frequently
2821    /// than requested.
2822    pub fn r#set_notification_filter(
2823        &self,
2824        mut notifications: Notifications,
2825        mut position_change_interval: u32,
2826    ) -> Result<(), fidl::Error> {
2827        ControllerProxyInterface::r#set_notification_filter(
2828            self,
2829            notifications,
2830            position_change_interval,
2831        )
2832    }
2833
2834    /// Call to acknowledge handling of a notification from [`OnNotification`].
2835    pub fn r#notify_notification_handled(&self) -> Result<(), fidl::Error> {
2836        ControllerProxyInterface::r#notify_notification_handled(self)
2837    }
2838
2839    /// Changes the addressed `player_id` on the target when multiple are supported.
2840    pub fn r#set_addressed_player(
2841        &self,
2842        mut player_id: u16,
2843    ) -> fidl::client::QueryResponseFut<
2844        ControllerSetAddressedPlayerResult,
2845        fidl::encoding::DefaultFuchsiaResourceDialect,
2846    > {
2847        ControllerProxyInterface::r#set_addressed_player(self, player_id)
2848    }
2849
2850    /// Send an AV\C passthrough key command. Sends both a key down and key up event.
2851    pub fn r#send_command(
2852        &self,
2853        mut command: AvcPanelCommand,
2854    ) -> fidl::client::QueryResponseFut<
2855        ControllerSendCommandResult,
2856        fidl::encoding::DefaultFuchsiaResourceDialect,
2857    > {
2858        ControllerProxyInterface::r#send_command(self, command)
2859    }
2860}
2861
2862impl ControllerProxyInterface for ControllerProxy {
2863    type GetPlayerApplicationSettingsResponseFut = fidl::client::QueryResponseFut<
2864        ControllerGetPlayerApplicationSettingsResult,
2865        fidl::encoding::DefaultFuchsiaResourceDialect,
2866    >;
2867    fn r#get_player_application_settings(
2868        &self,
2869        mut attribute_ids: &[PlayerApplicationSettingAttributeId],
2870    ) -> Self::GetPlayerApplicationSettingsResponseFut {
2871        fn _decode(
2872            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
2873        ) -> Result<ControllerGetPlayerApplicationSettingsResult, fidl::Error> {
2874            let _response = fidl::client::decode_transaction_body::<
2875                fidl::encoding::ResultType<
2876                    ControllerGetPlayerApplicationSettingsResponse,
2877                    ControllerError,
2878                >,
2879                fidl::encoding::DefaultFuchsiaResourceDialect,
2880                0x681de2da50670120,
2881            >(_buf?)?;
2882            Ok(_response.map(|x| x.current_settings))
2883        }
2884        self.client.send_query_and_decode::<
2885            ControllerGetPlayerApplicationSettingsRequest,
2886            ControllerGetPlayerApplicationSettingsResult,
2887        >(
2888            (attribute_ids,),
2889            0x681de2da50670120,
2890            fidl::encoding::DynamicFlags::empty(),
2891            _decode,
2892        )
2893    }
2894
2895    type SetPlayerApplicationSettingsResponseFut = fidl::client::QueryResponseFut<
2896        ControllerSetPlayerApplicationSettingsResult,
2897        fidl::encoding::DefaultFuchsiaResourceDialect,
2898    >;
2899    fn r#set_player_application_settings(
2900        &self,
2901        mut requested_settings: &PlayerApplicationSettings,
2902    ) -> Self::SetPlayerApplicationSettingsResponseFut {
2903        fn _decode(
2904            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
2905        ) -> Result<ControllerSetPlayerApplicationSettingsResult, fidl::Error> {
2906            let _response = fidl::client::decode_transaction_body::<
2907                fidl::encoding::ResultType<
2908                    ControllerSetPlayerApplicationSettingsResponse,
2909                    ControllerError,
2910                >,
2911                fidl::encoding::DefaultFuchsiaResourceDialect,
2912                0x6a7c9689ea3a589a,
2913            >(_buf?)?;
2914            Ok(_response.map(|x| x.set_settings))
2915        }
2916        self.client.send_query_and_decode::<
2917            ControllerSetPlayerApplicationSettingsRequest,
2918            ControllerSetPlayerApplicationSettingsResult,
2919        >(
2920            (requested_settings,),
2921            0x6a7c9689ea3a589a,
2922            fidl::encoding::DynamicFlags::empty(),
2923            _decode,
2924        )
2925    }
2926
2927    type GetMediaAttributesResponseFut = fidl::client::QueryResponseFut<
2928        ControllerGetMediaAttributesResult,
2929        fidl::encoding::DefaultFuchsiaResourceDialect,
2930    >;
2931    fn r#get_media_attributes(&self) -> Self::GetMediaAttributesResponseFut {
2932        fn _decode(
2933            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
2934        ) -> Result<ControllerGetMediaAttributesResult, fidl::Error> {
2935            let _response = fidl::client::decode_transaction_body::<
2936                fidl::encoding::ResultType<ControllerGetMediaAttributesResponse, ControllerError>,
2937                fidl::encoding::DefaultFuchsiaResourceDialect,
2938                0x18bd14308ee3173d,
2939            >(_buf?)?;
2940            Ok(_response.map(|x| x.attributes))
2941        }
2942        self.client.send_query_and_decode::<
2943            fidl::encoding::EmptyPayload,
2944            ControllerGetMediaAttributesResult,
2945        >(
2946            (),
2947            0x18bd14308ee3173d,
2948            fidl::encoding::DynamicFlags::empty(),
2949            _decode,
2950        )
2951    }
2952
2953    type GetPlayStatusResponseFut = fidl::client::QueryResponseFut<
2954        ControllerGetPlayStatusResult,
2955        fidl::encoding::DefaultFuchsiaResourceDialect,
2956    >;
2957    fn r#get_play_status(&self) -> Self::GetPlayStatusResponseFut {
2958        fn _decode(
2959            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
2960        ) -> Result<ControllerGetPlayStatusResult, fidl::Error> {
2961            let _response = fidl::client::decode_transaction_body::<
2962                fidl::encoding::ResultType<ControllerGetPlayStatusResponse, ControllerError>,
2963                fidl::encoding::DefaultFuchsiaResourceDialect,
2964                0x120735bec709fc6d,
2965            >(_buf?)?;
2966            Ok(_response.map(|x| x.play_status))
2967        }
2968        self.client
2969            .send_query_and_decode::<fidl::encoding::EmptyPayload, ControllerGetPlayStatusResult>(
2970                (),
2971                0x120735bec709fc6d,
2972                fidl::encoding::DynamicFlags::empty(),
2973                _decode,
2974            )
2975    }
2976
2977    type SetAbsoluteVolumeResponseFut = fidl::client::QueryResponseFut<
2978        ControllerSetAbsoluteVolumeResult,
2979        fidl::encoding::DefaultFuchsiaResourceDialect,
2980    >;
2981    fn r#set_absolute_volume(
2982        &self,
2983        mut requested_volume: u8,
2984    ) -> Self::SetAbsoluteVolumeResponseFut {
2985        fn _decode(
2986            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
2987        ) -> Result<ControllerSetAbsoluteVolumeResult, fidl::Error> {
2988            let _response = fidl::client::decode_transaction_body::<
2989                fidl::encoding::ResultType<ControllerSetAbsoluteVolumeResponse, ControllerError>,
2990                fidl::encoding::DefaultFuchsiaResourceDialect,
2991                0x1b8d010e11d05957,
2992            >(_buf?)?;
2993            Ok(_response.map(|x| x.set_volume))
2994        }
2995        self.client.send_query_and_decode::<
2996            ControllerSetAbsoluteVolumeRequest,
2997            ControllerSetAbsoluteVolumeResult,
2998        >(
2999            (requested_volume,),
3000            0x1b8d010e11d05957,
3001            fidl::encoding::DynamicFlags::empty(),
3002            _decode,
3003        )
3004    }
3005
3006    type InformBatteryStatusResponseFut = fidl::client::QueryResponseFut<
3007        ControllerInformBatteryStatusResult,
3008        fidl::encoding::DefaultFuchsiaResourceDialect,
3009    >;
3010    fn r#inform_battery_status(
3011        &self,
3012        mut battery_status: BatteryStatus,
3013    ) -> Self::InformBatteryStatusResponseFut {
3014        fn _decode(
3015            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
3016        ) -> Result<ControllerInformBatteryStatusResult, fidl::Error> {
3017            let _response = fidl::client::decode_transaction_body::<
3018                fidl::encoding::ResultType<fidl::encoding::EmptyStruct, ControllerError>,
3019                fidl::encoding::DefaultFuchsiaResourceDialect,
3020                0x11d54fbe9d12c44d,
3021            >(_buf?)?;
3022            Ok(_response.map(|x| x))
3023        }
3024        self.client.send_query_and_decode::<
3025            ControllerInformBatteryStatusRequest,
3026            ControllerInformBatteryStatusResult,
3027        >(
3028            (battery_status,),
3029            0x11d54fbe9d12c44d,
3030            fidl::encoding::DynamicFlags::empty(),
3031            _decode,
3032        )
3033    }
3034
3035    fn r#set_notification_filter(
3036        &self,
3037        mut notifications: Notifications,
3038        mut position_change_interval: u32,
3039    ) -> Result<(), fidl::Error> {
3040        self.client.send::<ControllerSetNotificationFilterRequest>(
3041            (notifications, position_change_interval),
3042            0x4d8a327745ccd73b,
3043            fidl::encoding::DynamicFlags::empty(),
3044        )
3045    }
3046
3047    fn r#notify_notification_handled(&self) -> Result<(), fidl::Error> {
3048        self.client.send::<fidl::encoding::EmptyPayload>(
3049            (),
3050            0x43d3e556557f3bc2,
3051            fidl::encoding::DynamicFlags::empty(),
3052        )
3053    }
3054
3055    type SetAddressedPlayerResponseFut = fidl::client::QueryResponseFut<
3056        ControllerSetAddressedPlayerResult,
3057        fidl::encoding::DefaultFuchsiaResourceDialect,
3058    >;
3059    fn r#set_addressed_player(&self, mut player_id: u16) -> Self::SetAddressedPlayerResponseFut {
3060        fn _decode(
3061            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
3062        ) -> Result<ControllerSetAddressedPlayerResult, fidl::Error> {
3063            let _response = fidl::client::decode_transaction_body::<
3064                fidl::encoding::ResultType<fidl::encoding::EmptyStruct, ControllerError>,
3065                fidl::encoding::DefaultFuchsiaResourceDialect,
3066                0x7ffc261f10ee1da5,
3067            >(_buf?)?;
3068            Ok(_response.map(|x| x))
3069        }
3070        self.client.send_query_and_decode::<
3071            ControllerSetAddressedPlayerRequest,
3072            ControllerSetAddressedPlayerResult,
3073        >(
3074            (player_id,),
3075            0x7ffc261f10ee1da5,
3076            fidl::encoding::DynamicFlags::empty(),
3077            _decode,
3078        )
3079    }
3080
3081    type SendCommandResponseFut = fidl::client::QueryResponseFut<
3082        ControllerSendCommandResult,
3083        fidl::encoding::DefaultFuchsiaResourceDialect,
3084    >;
3085    fn r#send_command(&self, mut command: AvcPanelCommand) -> Self::SendCommandResponseFut {
3086        fn _decode(
3087            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
3088        ) -> Result<ControllerSendCommandResult, fidl::Error> {
3089            let _response = fidl::client::decode_transaction_body::<
3090                fidl::encoding::ResultType<fidl::encoding::EmptyStruct, ControllerError>,
3091                fidl::encoding::DefaultFuchsiaResourceDialect,
3092                0x241324c56b5bc257,
3093            >(_buf?)?;
3094            Ok(_response.map(|x| x))
3095        }
3096        self.client
3097            .send_query_and_decode::<ControllerSendCommandRequest, ControllerSendCommandResult>(
3098                (command,),
3099                0x241324c56b5bc257,
3100                fidl::encoding::DynamicFlags::empty(),
3101                _decode,
3102            )
3103    }
3104}
3105
3106pub struct ControllerEventStream {
3107    event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
3108}
3109
3110impl std::marker::Unpin for ControllerEventStream {}
3111
3112impl futures::stream::FusedStream for ControllerEventStream {
3113    fn is_terminated(&self) -> bool {
3114        self.event_receiver.is_terminated()
3115    }
3116}
3117
3118impl futures::Stream for ControllerEventStream {
3119    type Item = Result<ControllerEvent, fidl::Error>;
3120
3121    fn poll_next(
3122        mut self: std::pin::Pin<&mut Self>,
3123        cx: &mut std::task::Context<'_>,
3124    ) -> std::task::Poll<Option<Self::Item>> {
3125        match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
3126            &mut self.event_receiver,
3127            cx
3128        )?) {
3129            Some(buf) => std::task::Poll::Ready(Some(ControllerEvent::decode(buf))),
3130            None => std::task::Poll::Ready(None),
3131        }
3132    }
3133}
3134
3135#[derive(Debug)]
3136pub enum ControllerEvent {
3137    OnNotification { timestamp: i64, notification: Notification },
3138}
3139
3140impl ControllerEvent {
3141    #[allow(irrefutable_let_patterns)]
3142    pub fn into_on_notification(self) -> Option<(i64, Notification)> {
3143        if let ControllerEvent::OnNotification { timestamp, notification } = self {
3144            Some((timestamp, notification))
3145        } else {
3146            None
3147        }
3148    }
3149
3150    /// Decodes a message buffer as a [`ControllerEvent`].
3151    fn decode(
3152        mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
3153    ) -> Result<ControllerEvent, fidl::Error> {
3154        let (bytes, _handles) = buf.split_mut();
3155        let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
3156        debug_assert_eq!(tx_header.tx_id, 0);
3157        match tx_header.ordinal {
3158            0x796259451db67281 => {
3159                let mut out = fidl::new_empty!(
3160                    ControllerOnNotificationRequest,
3161                    fidl::encoding::DefaultFuchsiaResourceDialect
3162                );
3163                fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<ControllerOnNotificationRequest>(&tx_header, _body_bytes, _handles, &mut out)?;
3164                Ok((ControllerEvent::OnNotification {
3165                    timestamp: out.timestamp,
3166                    notification: out.notification,
3167                }))
3168            }
3169            _ => Err(fidl::Error::UnknownOrdinal {
3170                ordinal: tx_header.ordinal,
3171                protocol_name: <ControllerMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
3172            }),
3173        }
3174    }
3175}
3176
3177/// A Stream of incoming requests for fuchsia.bluetooth.avrcp/Controller.
3178pub struct ControllerRequestStream {
3179    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
3180    is_terminated: bool,
3181}
3182
3183impl std::marker::Unpin for ControllerRequestStream {}
3184
3185impl futures::stream::FusedStream for ControllerRequestStream {
3186    fn is_terminated(&self) -> bool {
3187        self.is_terminated
3188    }
3189}
3190
3191impl fidl::endpoints::RequestStream for ControllerRequestStream {
3192    type Protocol = ControllerMarker;
3193    type ControlHandle = ControllerControlHandle;
3194
3195    fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
3196        Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
3197    }
3198
3199    fn control_handle(&self) -> Self::ControlHandle {
3200        ControllerControlHandle { inner: self.inner.clone() }
3201    }
3202
3203    fn into_inner(
3204        self,
3205    ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
3206    {
3207        (self.inner, self.is_terminated)
3208    }
3209
3210    fn from_inner(
3211        inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
3212        is_terminated: bool,
3213    ) -> Self {
3214        Self { inner, is_terminated }
3215    }
3216}
3217
3218impl futures::Stream for ControllerRequestStream {
3219    type Item = Result<ControllerRequest, fidl::Error>;
3220
3221    fn poll_next(
3222        mut self: std::pin::Pin<&mut Self>,
3223        cx: &mut std::task::Context<'_>,
3224    ) -> std::task::Poll<Option<Self::Item>> {
3225        let this = &mut *self;
3226        if this.inner.check_shutdown(cx) {
3227            this.is_terminated = true;
3228            return std::task::Poll::Ready(None);
3229        }
3230        if this.is_terminated {
3231            panic!("polled ControllerRequestStream after completion");
3232        }
3233        fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
3234            |bytes, handles| {
3235                match this.inner.channel().read_etc(cx, bytes, handles) {
3236                    std::task::Poll::Ready(Ok(())) => {}
3237                    std::task::Poll::Pending => return std::task::Poll::Pending,
3238                    std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
3239                        this.is_terminated = true;
3240                        return std::task::Poll::Ready(None);
3241                    }
3242                    std::task::Poll::Ready(Err(e)) => {
3243                        return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
3244                            e.into(),
3245                        ))))
3246                    }
3247                }
3248
3249                // A message has been received from the channel
3250                let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
3251
3252                std::task::Poll::Ready(Some(match header.ordinal {
3253                    0x681de2da50670120 => {
3254                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
3255                        let mut req = fidl::new_empty!(
3256                            ControllerGetPlayerApplicationSettingsRequest,
3257                            fidl::encoding::DefaultFuchsiaResourceDialect
3258                        );
3259                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<ControllerGetPlayerApplicationSettingsRequest>(&header, _body_bytes, handles, &mut req)?;
3260                        let control_handle = ControllerControlHandle { inner: this.inner.clone() };
3261                        Ok(ControllerRequest::GetPlayerApplicationSettings {
3262                            attribute_ids: req.attribute_ids,
3263
3264                            responder: ControllerGetPlayerApplicationSettingsResponder {
3265                                control_handle: std::mem::ManuallyDrop::new(control_handle),
3266                                tx_id: header.tx_id,
3267                            },
3268                        })
3269                    }
3270                    0x6a7c9689ea3a589a => {
3271                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
3272                        let mut req = fidl::new_empty!(
3273                            ControllerSetPlayerApplicationSettingsRequest,
3274                            fidl::encoding::DefaultFuchsiaResourceDialect
3275                        );
3276                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<ControllerSetPlayerApplicationSettingsRequest>(&header, _body_bytes, handles, &mut req)?;
3277                        let control_handle = ControllerControlHandle { inner: this.inner.clone() };
3278                        Ok(ControllerRequest::SetPlayerApplicationSettings {
3279                            requested_settings: req.requested_settings,
3280
3281                            responder: ControllerSetPlayerApplicationSettingsResponder {
3282                                control_handle: std::mem::ManuallyDrop::new(control_handle),
3283                                tx_id: header.tx_id,
3284                            },
3285                        })
3286                    }
3287                    0x18bd14308ee3173d => {
3288                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
3289                        let mut req = fidl::new_empty!(
3290                            fidl::encoding::EmptyPayload,
3291                            fidl::encoding::DefaultFuchsiaResourceDialect
3292                        );
3293                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
3294                        let control_handle = ControllerControlHandle { inner: this.inner.clone() };
3295                        Ok(ControllerRequest::GetMediaAttributes {
3296                            responder: ControllerGetMediaAttributesResponder {
3297                                control_handle: std::mem::ManuallyDrop::new(control_handle),
3298                                tx_id: header.tx_id,
3299                            },
3300                        })
3301                    }
3302                    0x120735bec709fc6d => {
3303                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
3304                        let mut req = fidl::new_empty!(
3305                            fidl::encoding::EmptyPayload,
3306                            fidl::encoding::DefaultFuchsiaResourceDialect
3307                        );
3308                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
3309                        let control_handle = ControllerControlHandle { inner: this.inner.clone() };
3310                        Ok(ControllerRequest::GetPlayStatus {
3311                            responder: ControllerGetPlayStatusResponder {
3312                                control_handle: std::mem::ManuallyDrop::new(control_handle),
3313                                tx_id: header.tx_id,
3314                            },
3315                        })
3316                    }
3317                    0x1b8d010e11d05957 => {
3318                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
3319                        let mut req = fidl::new_empty!(
3320                            ControllerSetAbsoluteVolumeRequest,
3321                            fidl::encoding::DefaultFuchsiaResourceDialect
3322                        );
3323                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<ControllerSetAbsoluteVolumeRequest>(&header, _body_bytes, handles, &mut req)?;
3324                        let control_handle = ControllerControlHandle { inner: this.inner.clone() };
3325                        Ok(ControllerRequest::SetAbsoluteVolume {
3326                            requested_volume: req.requested_volume,
3327
3328                            responder: ControllerSetAbsoluteVolumeResponder {
3329                                control_handle: std::mem::ManuallyDrop::new(control_handle),
3330                                tx_id: header.tx_id,
3331                            },
3332                        })
3333                    }
3334                    0x11d54fbe9d12c44d => {
3335                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
3336                        let mut req = fidl::new_empty!(
3337                            ControllerInformBatteryStatusRequest,
3338                            fidl::encoding::DefaultFuchsiaResourceDialect
3339                        );
3340                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<ControllerInformBatteryStatusRequest>(&header, _body_bytes, handles, &mut req)?;
3341                        let control_handle = ControllerControlHandle { inner: this.inner.clone() };
3342                        Ok(ControllerRequest::InformBatteryStatus {
3343                            battery_status: req.battery_status,
3344
3345                            responder: ControllerInformBatteryStatusResponder {
3346                                control_handle: std::mem::ManuallyDrop::new(control_handle),
3347                                tx_id: header.tx_id,
3348                            },
3349                        })
3350                    }
3351                    0x4d8a327745ccd73b => {
3352                        header.validate_request_tx_id(fidl::MethodType::OneWay)?;
3353                        let mut req = fidl::new_empty!(
3354                            ControllerSetNotificationFilterRequest,
3355                            fidl::encoding::DefaultFuchsiaResourceDialect
3356                        );
3357                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<ControllerSetNotificationFilterRequest>(&header, _body_bytes, handles, &mut req)?;
3358                        let control_handle = ControllerControlHandle { inner: this.inner.clone() };
3359                        Ok(ControllerRequest::SetNotificationFilter {
3360                            notifications: req.notifications,
3361                            position_change_interval: req.position_change_interval,
3362
3363                            control_handle,
3364                        })
3365                    }
3366                    0x43d3e556557f3bc2 => {
3367                        header.validate_request_tx_id(fidl::MethodType::OneWay)?;
3368                        let mut req = fidl::new_empty!(
3369                            fidl::encoding::EmptyPayload,
3370                            fidl::encoding::DefaultFuchsiaResourceDialect
3371                        );
3372                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
3373                        let control_handle = ControllerControlHandle { inner: this.inner.clone() };
3374                        Ok(ControllerRequest::NotifyNotificationHandled { control_handle })
3375                    }
3376                    0x7ffc261f10ee1da5 => {
3377                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
3378                        let mut req = fidl::new_empty!(
3379                            ControllerSetAddressedPlayerRequest,
3380                            fidl::encoding::DefaultFuchsiaResourceDialect
3381                        );
3382                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<ControllerSetAddressedPlayerRequest>(&header, _body_bytes, handles, &mut req)?;
3383                        let control_handle = ControllerControlHandle { inner: this.inner.clone() };
3384                        Ok(ControllerRequest::SetAddressedPlayer {
3385                            player_id: req.player_id,
3386
3387                            responder: ControllerSetAddressedPlayerResponder {
3388                                control_handle: std::mem::ManuallyDrop::new(control_handle),
3389                                tx_id: header.tx_id,
3390                            },
3391                        })
3392                    }
3393                    0x241324c56b5bc257 => {
3394                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
3395                        let mut req = fidl::new_empty!(
3396                            ControllerSendCommandRequest,
3397                            fidl::encoding::DefaultFuchsiaResourceDialect
3398                        );
3399                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<ControllerSendCommandRequest>(&header, _body_bytes, handles, &mut req)?;
3400                        let control_handle = ControllerControlHandle { inner: this.inner.clone() };
3401                        Ok(ControllerRequest::SendCommand {
3402                            command: req.command,
3403
3404                            responder: ControllerSendCommandResponder {
3405                                control_handle: std::mem::ManuallyDrop::new(control_handle),
3406                                tx_id: header.tx_id,
3407                            },
3408                        })
3409                    }
3410                    _ => Err(fidl::Error::UnknownOrdinal {
3411                        ordinal: header.ordinal,
3412                        protocol_name:
3413                            <ControllerMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
3414                    }),
3415                }))
3416            },
3417        )
3418    }
3419}
3420
3421/// Client wrapper for local controller (CT) -> remote target (TG) AVCTP
3422/// connections between devices for AV/C commands.
3423///
3424/// See `BrowseController` protocol note for more detailed explanation on
3425/// the purpose of this protocol.
3426#[derive(Debug)]
3427pub enum ControllerRequest {
3428    /// Returns currently set player application setting values for the `attribute_ids`.
3429    /// If no `attribute_ids` are provided, this method will query the TG for all valid
3430    /// attribute ID's, and return the currently set player application setting values.
3431    GetPlayerApplicationSettings {
3432        attribute_ids: Vec<PlayerApplicationSettingAttributeId>,
3433        responder: ControllerGetPlayerApplicationSettingsResponder,
3434    },
3435    /// Sets the player application settings specified by `requested_settings`. Only
3436    /// settings specified in the input `requested_settings` will be overwritten.
3437    /// Returns the actual settings that were set.
3438    /// Settings provided in the `requested_settings` that are unsupported or unknown
3439    /// will not be set; the returned `set_settings` will include only the settings
3440    /// that were successfully set on the remote target.
3441    SetPlayerApplicationSettings {
3442        requested_settings: PlayerApplicationSettings,
3443        responder: ControllerSetPlayerApplicationSettingsResponder,
3444    },
3445    /// Returns the currently playing media attributes.
3446    /// May send either the GetElementAttributes or GetItemAttributes command depending on what
3447    /// is supported.
3448    GetMediaAttributes { responder: ControllerGetMediaAttributesResponder },
3449    /// Returns the status of the currently playing media.
3450    GetPlayStatus { responder: ControllerGetPlayStatusResponder },
3451    /// Request the absolute volume on the peer be changed. Returns the actual volume set by the
3452    /// peer. Values can range from 0x00 to 0x7F (with 100% volume being 0x7F). You may not get a
3453    /// volume changed notification event from the remote peer as result of changing this.
3454    SetAbsoluteVolume { requested_volume: u8, responder: ControllerSetAbsoluteVolumeResponder },
3455    /// Inform target of the controller's battery level.
3456    InformBatteryStatus {
3457        battery_status: BatteryStatus,
3458        responder: ControllerInformBatteryStatusResponder,
3459    },
3460    /// Filters notifications that will be received with [`OnNotification`]. Not all notifications
3461    /// are supported by all peers. Resetting the notification filter may trigger all requested
3462    /// notification types to post their current value to [`OnNotification`] immediately.
3463    ///
3464    /// The `position_change_interval` argument is used to set the interval in seconds that the
3465    /// controller client would like to be notified of `TRACK_POS_CHANGED` events.
3466    /// `position_change_interval` is ignored if `TRACK_POS` is not set. The position change interval
3467    /// is best effort and not a guarantee and events may arrive more frequently or less frequently
3468    /// than requested.
3469    SetNotificationFilter {
3470        notifications: Notifications,
3471        position_change_interval: u32,
3472        control_handle: ControllerControlHandle,
3473    },
3474    /// Call to acknowledge handling of a notification from [`OnNotification`].
3475    NotifyNotificationHandled { control_handle: ControllerControlHandle },
3476    /// Changes the addressed `player_id` on the target when multiple are supported.
3477    SetAddressedPlayer { player_id: u16, responder: ControllerSetAddressedPlayerResponder },
3478    /// Send an AV\C passthrough key command. Sends both a key down and key up event.
3479    SendCommand { command: AvcPanelCommand, responder: ControllerSendCommandResponder },
3480}
3481
3482impl ControllerRequest {
3483    #[allow(irrefutable_let_patterns)]
3484    pub fn into_get_player_application_settings(
3485        self,
3486    ) -> Option<(
3487        Vec<PlayerApplicationSettingAttributeId>,
3488        ControllerGetPlayerApplicationSettingsResponder,
3489    )> {
3490        if let ControllerRequest::GetPlayerApplicationSettings { attribute_ids, responder } = self {
3491            Some((attribute_ids, responder))
3492        } else {
3493            None
3494        }
3495    }
3496
3497    #[allow(irrefutable_let_patterns)]
3498    pub fn into_set_player_application_settings(
3499        self,
3500    ) -> Option<(PlayerApplicationSettings, ControllerSetPlayerApplicationSettingsResponder)> {
3501        if let ControllerRequest::SetPlayerApplicationSettings { requested_settings, responder } =
3502            self
3503        {
3504            Some((requested_settings, responder))
3505        } else {
3506            None
3507        }
3508    }
3509
3510    #[allow(irrefutable_let_patterns)]
3511    pub fn into_get_media_attributes(self) -> Option<(ControllerGetMediaAttributesResponder)> {
3512        if let ControllerRequest::GetMediaAttributes { responder } = self {
3513            Some((responder))
3514        } else {
3515            None
3516        }
3517    }
3518
3519    #[allow(irrefutable_let_patterns)]
3520    pub fn into_get_play_status(self) -> Option<(ControllerGetPlayStatusResponder)> {
3521        if let ControllerRequest::GetPlayStatus { responder } = self {
3522            Some((responder))
3523        } else {
3524            None
3525        }
3526    }
3527
3528    #[allow(irrefutable_let_patterns)]
3529    pub fn into_set_absolute_volume(self) -> Option<(u8, ControllerSetAbsoluteVolumeResponder)> {
3530        if let ControllerRequest::SetAbsoluteVolume { requested_volume, responder } = self {
3531            Some((requested_volume, responder))
3532        } else {
3533            None
3534        }
3535    }
3536
3537    #[allow(irrefutable_let_patterns)]
3538    pub fn into_inform_battery_status(
3539        self,
3540    ) -> Option<(BatteryStatus, ControllerInformBatteryStatusResponder)> {
3541        if let ControllerRequest::InformBatteryStatus { battery_status, responder } = self {
3542            Some((battery_status, responder))
3543        } else {
3544            None
3545        }
3546    }
3547
3548    #[allow(irrefutable_let_patterns)]
3549    pub fn into_set_notification_filter(
3550        self,
3551    ) -> Option<(Notifications, u32, ControllerControlHandle)> {
3552        if let ControllerRequest::SetNotificationFilter {
3553            notifications,
3554            position_change_interval,
3555            control_handle,
3556        } = self
3557        {
3558            Some((notifications, position_change_interval, control_handle))
3559        } else {
3560            None
3561        }
3562    }
3563
3564    #[allow(irrefutable_let_patterns)]
3565    pub fn into_notify_notification_handled(self) -> Option<(ControllerControlHandle)> {
3566        if let ControllerRequest::NotifyNotificationHandled { control_handle } = self {
3567            Some((control_handle))
3568        } else {
3569            None
3570        }
3571    }
3572
3573    #[allow(irrefutable_let_patterns)]
3574    pub fn into_set_addressed_player(self) -> Option<(u16, ControllerSetAddressedPlayerResponder)> {
3575        if let ControllerRequest::SetAddressedPlayer { player_id, responder } = self {
3576            Some((player_id, responder))
3577        } else {
3578            None
3579        }
3580    }
3581
3582    #[allow(irrefutable_let_patterns)]
3583    pub fn into_send_command(self) -> Option<(AvcPanelCommand, ControllerSendCommandResponder)> {
3584        if let ControllerRequest::SendCommand { command, responder } = self {
3585            Some((command, responder))
3586        } else {
3587            None
3588        }
3589    }
3590
3591    /// Name of the method defined in FIDL
3592    pub fn method_name(&self) -> &'static str {
3593        match *self {
3594            ControllerRequest::GetPlayerApplicationSettings { .. } => {
3595                "get_player_application_settings"
3596            }
3597            ControllerRequest::SetPlayerApplicationSettings { .. } => {
3598                "set_player_application_settings"
3599            }
3600            ControllerRequest::GetMediaAttributes { .. } => "get_media_attributes",
3601            ControllerRequest::GetPlayStatus { .. } => "get_play_status",
3602            ControllerRequest::SetAbsoluteVolume { .. } => "set_absolute_volume",
3603            ControllerRequest::InformBatteryStatus { .. } => "inform_battery_status",
3604            ControllerRequest::SetNotificationFilter { .. } => "set_notification_filter",
3605            ControllerRequest::NotifyNotificationHandled { .. } => "notify_notification_handled",
3606            ControllerRequest::SetAddressedPlayer { .. } => "set_addressed_player",
3607            ControllerRequest::SendCommand { .. } => "send_command",
3608        }
3609    }
3610}
3611
3612#[derive(Debug, Clone)]
3613pub struct ControllerControlHandle {
3614    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
3615}
3616
3617impl fidl::endpoints::ControlHandle for ControllerControlHandle {
3618    fn shutdown(&self) {
3619        self.inner.shutdown()
3620    }
3621    fn shutdown_with_epitaph(&self, status: zx_status::Status) {
3622        self.inner.shutdown_with_epitaph(status)
3623    }
3624
3625    fn is_closed(&self) -> bool {
3626        self.inner.channel().is_closed()
3627    }
3628    fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
3629        self.inner.channel().on_closed()
3630    }
3631
3632    #[cfg(target_os = "fuchsia")]
3633    fn signal_peer(
3634        &self,
3635        clear_mask: zx::Signals,
3636        set_mask: zx::Signals,
3637    ) -> Result<(), zx_status::Status> {
3638        use fidl::Peered;
3639        self.inner.channel().signal_peer(clear_mask, set_mask)
3640    }
3641}
3642
3643impl ControllerControlHandle {
3644    pub fn send_on_notification(
3645        &self,
3646        mut timestamp: i64,
3647        mut notification: &Notification,
3648    ) -> Result<(), fidl::Error> {
3649        self.inner.send::<ControllerOnNotificationRequest>(
3650            (timestamp, notification),
3651            0,
3652            0x796259451db67281,
3653            fidl::encoding::DynamicFlags::empty(),
3654        )
3655    }
3656}
3657
3658#[must_use = "FIDL methods require a response to be sent"]
3659#[derive(Debug)]
3660pub struct ControllerGetPlayerApplicationSettingsResponder {
3661    control_handle: std::mem::ManuallyDrop<ControllerControlHandle>,
3662    tx_id: u32,
3663}
3664
3665/// Set the the channel to be shutdown (see [`ControllerControlHandle::shutdown`])
3666/// if the responder is dropped without sending a response, so that the client
3667/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
3668impl std::ops::Drop for ControllerGetPlayerApplicationSettingsResponder {
3669    fn drop(&mut self) {
3670        self.control_handle.shutdown();
3671        // Safety: drops once, never accessed again
3672        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
3673    }
3674}
3675
3676impl fidl::endpoints::Responder for ControllerGetPlayerApplicationSettingsResponder {
3677    type ControlHandle = ControllerControlHandle;
3678
3679    fn control_handle(&self) -> &ControllerControlHandle {
3680        &self.control_handle
3681    }
3682
3683    fn drop_without_shutdown(mut self) {
3684        // Safety: drops once, never accessed again due to mem::forget
3685        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
3686        // Prevent Drop from running (which would shut down the channel)
3687        std::mem::forget(self);
3688    }
3689}
3690
3691impl ControllerGetPlayerApplicationSettingsResponder {
3692    /// Sends a response to the FIDL transaction.
3693    ///
3694    /// Sets the channel to shutdown if an error occurs.
3695    pub fn send(
3696        self,
3697        mut result: Result<&PlayerApplicationSettings, ControllerError>,
3698    ) -> Result<(), fidl::Error> {
3699        let _result = self.send_raw(result);
3700        if _result.is_err() {
3701            self.control_handle.shutdown();
3702        }
3703        self.drop_without_shutdown();
3704        _result
3705    }
3706
3707    /// Similar to "send" but does not shutdown the channel if an error occurs.
3708    pub fn send_no_shutdown_on_err(
3709        self,
3710        mut result: Result<&PlayerApplicationSettings, ControllerError>,
3711    ) -> Result<(), fidl::Error> {
3712        let _result = self.send_raw(result);
3713        self.drop_without_shutdown();
3714        _result
3715    }
3716
3717    fn send_raw(
3718        &self,
3719        mut result: Result<&PlayerApplicationSettings, ControllerError>,
3720    ) -> Result<(), fidl::Error> {
3721        self.control_handle.inner.send::<fidl::encoding::ResultType<
3722            ControllerGetPlayerApplicationSettingsResponse,
3723            ControllerError,
3724        >>(
3725            result.map(|current_settings| (current_settings,)),
3726            self.tx_id,
3727            0x681de2da50670120,
3728            fidl::encoding::DynamicFlags::empty(),
3729        )
3730    }
3731}
3732
3733#[must_use = "FIDL methods require a response to be sent"]
3734#[derive(Debug)]
3735pub struct ControllerSetPlayerApplicationSettingsResponder {
3736    control_handle: std::mem::ManuallyDrop<ControllerControlHandle>,
3737    tx_id: u32,
3738}
3739
3740/// Set the the channel to be shutdown (see [`ControllerControlHandle::shutdown`])
3741/// if the responder is dropped without sending a response, so that the client
3742/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
3743impl std::ops::Drop for ControllerSetPlayerApplicationSettingsResponder {
3744    fn drop(&mut self) {
3745        self.control_handle.shutdown();
3746        // Safety: drops once, never accessed again
3747        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
3748    }
3749}
3750
3751impl fidl::endpoints::Responder for ControllerSetPlayerApplicationSettingsResponder {
3752    type ControlHandle = ControllerControlHandle;
3753
3754    fn control_handle(&self) -> &ControllerControlHandle {
3755        &self.control_handle
3756    }
3757
3758    fn drop_without_shutdown(mut self) {
3759        // Safety: drops once, never accessed again due to mem::forget
3760        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
3761        // Prevent Drop from running (which would shut down the channel)
3762        std::mem::forget(self);
3763    }
3764}
3765
3766impl ControllerSetPlayerApplicationSettingsResponder {
3767    /// Sends a response to the FIDL transaction.
3768    ///
3769    /// Sets the channel to shutdown if an error occurs.
3770    pub fn send(
3771        self,
3772        mut result: Result<&PlayerApplicationSettings, ControllerError>,
3773    ) -> Result<(), fidl::Error> {
3774        let _result = self.send_raw(result);
3775        if _result.is_err() {
3776            self.control_handle.shutdown();
3777        }
3778        self.drop_without_shutdown();
3779        _result
3780    }
3781
3782    /// Similar to "send" but does not shutdown the channel if an error occurs.
3783    pub fn send_no_shutdown_on_err(
3784        self,
3785        mut result: Result<&PlayerApplicationSettings, ControllerError>,
3786    ) -> Result<(), fidl::Error> {
3787        let _result = self.send_raw(result);
3788        self.drop_without_shutdown();
3789        _result
3790    }
3791
3792    fn send_raw(
3793        &self,
3794        mut result: Result<&PlayerApplicationSettings, ControllerError>,
3795    ) -> Result<(), fidl::Error> {
3796        self.control_handle.inner.send::<fidl::encoding::ResultType<
3797            ControllerSetPlayerApplicationSettingsResponse,
3798            ControllerError,
3799        >>(
3800            result.map(|set_settings| (set_settings,)),
3801            self.tx_id,
3802            0x6a7c9689ea3a589a,
3803            fidl::encoding::DynamicFlags::empty(),
3804        )
3805    }
3806}
3807
3808#[must_use = "FIDL methods require a response to be sent"]
3809#[derive(Debug)]
3810pub struct ControllerGetMediaAttributesResponder {
3811    control_handle: std::mem::ManuallyDrop<ControllerControlHandle>,
3812    tx_id: u32,
3813}
3814
3815/// Set the the channel to be shutdown (see [`ControllerControlHandle::shutdown`])
3816/// if the responder is dropped without sending a response, so that the client
3817/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
3818impl std::ops::Drop for ControllerGetMediaAttributesResponder {
3819    fn drop(&mut self) {
3820        self.control_handle.shutdown();
3821        // Safety: drops once, never accessed again
3822        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
3823    }
3824}
3825
3826impl fidl::endpoints::Responder for ControllerGetMediaAttributesResponder {
3827    type ControlHandle = ControllerControlHandle;
3828
3829    fn control_handle(&self) -> &ControllerControlHandle {
3830        &self.control_handle
3831    }
3832
3833    fn drop_without_shutdown(mut self) {
3834        // Safety: drops once, never accessed again due to mem::forget
3835        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
3836        // Prevent Drop from running (which would shut down the channel)
3837        std::mem::forget(self);
3838    }
3839}
3840
3841impl ControllerGetMediaAttributesResponder {
3842    /// Sends a response to the FIDL transaction.
3843    ///
3844    /// Sets the channel to shutdown if an error occurs.
3845    pub fn send(
3846        self,
3847        mut result: Result<&MediaAttributes, ControllerError>,
3848    ) -> Result<(), fidl::Error> {
3849        let _result = self.send_raw(result);
3850        if _result.is_err() {
3851            self.control_handle.shutdown();
3852        }
3853        self.drop_without_shutdown();
3854        _result
3855    }
3856
3857    /// Similar to "send" but does not shutdown the channel if an error occurs.
3858    pub fn send_no_shutdown_on_err(
3859        self,
3860        mut result: Result<&MediaAttributes, ControllerError>,
3861    ) -> Result<(), fidl::Error> {
3862        let _result = self.send_raw(result);
3863        self.drop_without_shutdown();
3864        _result
3865    }
3866
3867    fn send_raw(
3868        &self,
3869        mut result: Result<&MediaAttributes, ControllerError>,
3870    ) -> Result<(), fidl::Error> {
3871        self.control_handle.inner.send::<fidl::encoding::ResultType<
3872            ControllerGetMediaAttributesResponse,
3873            ControllerError,
3874        >>(
3875            result.map(|attributes| (attributes,)),
3876            self.tx_id,
3877            0x18bd14308ee3173d,
3878            fidl::encoding::DynamicFlags::empty(),
3879        )
3880    }
3881}
3882
3883#[must_use = "FIDL methods require a response to be sent"]
3884#[derive(Debug)]
3885pub struct ControllerGetPlayStatusResponder {
3886    control_handle: std::mem::ManuallyDrop<ControllerControlHandle>,
3887    tx_id: u32,
3888}
3889
3890/// Set the the channel to be shutdown (see [`ControllerControlHandle::shutdown`])
3891/// if the responder is dropped without sending a response, so that the client
3892/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
3893impl std::ops::Drop for ControllerGetPlayStatusResponder {
3894    fn drop(&mut self) {
3895        self.control_handle.shutdown();
3896        // Safety: drops once, never accessed again
3897        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
3898    }
3899}
3900
3901impl fidl::endpoints::Responder for ControllerGetPlayStatusResponder {
3902    type ControlHandle = ControllerControlHandle;
3903
3904    fn control_handle(&self) -> &ControllerControlHandle {
3905        &self.control_handle
3906    }
3907
3908    fn drop_without_shutdown(mut self) {
3909        // Safety: drops once, never accessed again due to mem::forget
3910        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
3911        // Prevent Drop from running (which would shut down the channel)
3912        std::mem::forget(self);
3913    }
3914}
3915
3916impl ControllerGetPlayStatusResponder {
3917    /// Sends a response to the FIDL transaction.
3918    ///
3919    /// Sets the channel to shutdown if an error occurs.
3920    pub fn send(self, mut result: Result<&PlayStatus, ControllerError>) -> Result<(), fidl::Error> {
3921        let _result = self.send_raw(result);
3922        if _result.is_err() {
3923            self.control_handle.shutdown();
3924        }
3925        self.drop_without_shutdown();
3926        _result
3927    }
3928
3929    /// Similar to "send" but does not shutdown the channel if an error occurs.
3930    pub fn send_no_shutdown_on_err(
3931        self,
3932        mut result: Result<&PlayStatus, ControllerError>,
3933    ) -> Result<(), fidl::Error> {
3934        let _result = self.send_raw(result);
3935        self.drop_without_shutdown();
3936        _result
3937    }
3938
3939    fn send_raw(
3940        &self,
3941        mut result: Result<&PlayStatus, ControllerError>,
3942    ) -> Result<(), fidl::Error> {
3943        self.control_handle.inner.send::<fidl::encoding::ResultType<
3944            ControllerGetPlayStatusResponse,
3945            ControllerError,
3946        >>(
3947            result.map(|play_status| (play_status,)),
3948            self.tx_id,
3949            0x120735bec709fc6d,
3950            fidl::encoding::DynamicFlags::empty(),
3951        )
3952    }
3953}
3954
3955#[must_use = "FIDL methods require a response to be sent"]
3956#[derive(Debug)]
3957pub struct ControllerSetAbsoluteVolumeResponder {
3958    control_handle: std::mem::ManuallyDrop<ControllerControlHandle>,
3959    tx_id: u32,
3960}
3961
3962/// Set the the channel to be shutdown (see [`ControllerControlHandle::shutdown`])
3963/// if the responder is dropped without sending a response, so that the client
3964/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
3965impl std::ops::Drop for ControllerSetAbsoluteVolumeResponder {
3966    fn drop(&mut self) {
3967        self.control_handle.shutdown();
3968        // Safety: drops once, never accessed again
3969        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
3970    }
3971}
3972
3973impl fidl::endpoints::Responder for ControllerSetAbsoluteVolumeResponder {
3974    type ControlHandle = ControllerControlHandle;
3975
3976    fn control_handle(&self) -> &ControllerControlHandle {
3977        &self.control_handle
3978    }
3979
3980    fn drop_without_shutdown(mut self) {
3981        // Safety: drops once, never accessed again due to mem::forget
3982        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
3983        // Prevent Drop from running (which would shut down the channel)
3984        std::mem::forget(self);
3985    }
3986}
3987
3988impl ControllerSetAbsoluteVolumeResponder {
3989    /// Sends a response to the FIDL transaction.
3990    ///
3991    /// Sets the channel to shutdown if an error occurs.
3992    pub fn send(self, mut result: Result<u8, ControllerError>) -> Result<(), fidl::Error> {
3993        let _result = self.send_raw(result);
3994        if _result.is_err() {
3995            self.control_handle.shutdown();
3996        }
3997        self.drop_without_shutdown();
3998        _result
3999    }
4000
4001    /// Similar to "send" but does not shutdown the channel if an error occurs.
4002    pub fn send_no_shutdown_on_err(
4003        self,
4004        mut result: Result<u8, ControllerError>,
4005    ) -> Result<(), fidl::Error> {
4006        let _result = self.send_raw(result);
4007        self.drop_without_shutdown();
4008        _result
4009    }
4010
4011    fn send_raw(&self, mut result: Result<u8, ControllerError>) -> Result<(), fidl::Error> {
4012        self.control_handle.inner.send::<fidl::encoding::ResultType<
4013            ControllerSetAbsoluteVolumeResponse,
4014            ControllerError,
4015        >>(
4016            result.map(|set_volume| (set_volume,)),
4017            self.tx_id,
4018            0x1b8d010e11d05957,
4019            fidl::encoding::DynamicFlags::empty(),
4020        )
4021    }
4022}
4023
4024#[must_use = "FIDL methods require a response to be sent"]
4025#[derive(Debug)]
4026pub struct ControllerInformBatteryStatusResponder {
4027    control_handle: std::mem::ManuallyDrop<ControllerControlHandle>,
4028    tx_id: u32,
4029}
4030
4031/// Set the the channel to be shutdown (see [`ControllerControlHandle::shutdown`])
4032/// if the responder is dropped without sending a response, so that the client
4033/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
4034impl std::ops::Drop for ControllerInformBatteryStatusResponder {
4035    fn drop(&mut self) {
4036        self.control_handle.shutdown();
4037        // Safety: drops once, never accessed again
4038        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
4039    }
4040}
4041
4042impl fidl::endpoints::Responder for ControllerInformBatteryStatusResponder {
4043    type ControlHandle = ControllerControlHandle;
4044
4045    fn control_handle(&self) -> &ControllerControlHandle {
4046        &self.control_handle
4047    }
4048
4049    fn drop_without_shutdown(mut self) {
4050        // Safety: drops once, never accessed again due to mem::forget
4051        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
4052        // Prevent Drop from running (which would shut down the channel)
4053        std::mem::forget(self);
4054    }
4055}
4056
4057impl ControllerInformBatteryStatusResponder {
4058    /// Sends a response to the FIDL transaction.
4059    ///
4060    /// Sets the channel to shutdown if an error occurs.
4061    pub fn send(self, mut result: Result<(), ControllerError>) -> Result<(), fidl::Error> {
4062        let _result = self.send_raw(result);
4063        if _result.is_err() {
4064            self.control_handle.shutdown();
4065        }
4066        self.drop_without_shutdown();
4067        _result
4068    }
4069
4070    /// Similar to "send" but does not shutdown the channel if an error occurs.
4071    pub fn send_no_shutdown_on_err(
4072        self,
4073        mut result: Result<(), ControllerError>,
4074    ) -> Result<(), fidl::Error> {
4075        let _result = self.send_raw(result);
4076        self.drop_without_shutdown();
4077        _result
4078    }
4079
4080    fn send_raw(&self, mut result: Result<(), ControllerError>) -> Result<(), fidl::Error> {
4081        self.control_handle.inner.send::<fidl::encoding::ResultType<
4082            fidl::encoding::EmptyStruct,
4083            ControllerError,
4084        >>(
4085            result,
4086            self.tx_id,
4087            0x11d54fbe9d12c44d,
4088            fidl::encoding::DynamicFlags::empty(),
4089        )
4090    }
4091}
4092
4093#[must_use = "FIDL methods require a response to be sent"]
4094#[derive(Debug)]
4095pub struct ControllerSetAddressedPlayerResponder {
4096    control_handle: std::mem::ManuallyDrop<ControllerControlHandle>,
4097    tx_id: u32,
4098}
4099
4100/// Set the the channel to be shutdown (see [`ControllerControlHandle::shutdown`])
4101/// if the responder is dropped without sending a response, so that the client
4102/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
4103impl std::ops::Drop for ControllerSetAddressedPlayerResponder {
4104    fn drop(&mut self) {
4105        self.control_handle.shutdown();
4106        // Safety: drops once, never accessed again
4107        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
4108    }
4109}
4110
4111impl fidl::endpoints::Responder for ControllerSetAddressedPlayerResponder {
4112    type ControlHandle = ControllerControlHandle;
4113
4114    fn control_handle(&self) -> &ControllerControlHandle {
4115        &self.control_handle
4116    }
4117
4118    fn drop_without_shutdown(mut self) {
4119        // Safety: drops once, never accessed again due to mem::forget
4120        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
4121        // Prevent Drop from running (which would shut down the channel)
4122        std::mem::forget(self);
4123    }
4124}
4125
4126impl ControllerSetAddressedPlayerResponder {
4127    /// Sends a response to the FIDL transaction.
4128    ///
4129    /// Sets the channel to shutdown if an error occurs.
4130    pub fn send(self, mut result: Result<(), ControllerError>) -> Result<(), fidl::Error> {
4131        let _result = self.send_raw(result);
4132        if _result.is_err() {
4133            self.control_handle.shutdown();
4134        }
4135        self.drop_without_shutdown();
4136        _result
4137    }
4138
4139    /// Similar to "send" but does not shutdown the channel if an error occurs.
4140    pub fn send_no_shutdown_on_err(
4141        self,
4142        mut result: Result<(), ControllerError>,
4143    ) -> Result<(), fidl::Error> {
4144        let _result = self.send_raw(result);
4145        self.drop_without_shutdown();
4146        _result
4147    }
4148
4149    fn send_raw(&self, mut result: Result<(), ControllerError>) -> Result<(), fidl::Error> {
4150        self.control_handle.inner.send::<fidl::encoding::ResultType<
4151            fidl::encoding::EmptyStruct,
4152            ControllerError,
4153        >>(
4154            result,
4155            self.tx_id,
4156            0x7ffc261f10ee1da5,
4157            fidl::encoding::DynamicFlags::empty(),
4158        )
4159    }
4160}
4161
4162#[must_use = "FIDL methods require a response to be sent"]
4163#[derive(Debug)]
4164pub struct ControllerSendCommandResponder {
4165    control_handle: std::mem::ManuallyDrop<ControllerControlHandle>,
4166    tx_id: u32,
4167}
4168
4169/// Set the the channel to be shutdown (see [`ControllerControlHandle::shutdown`])
4170/// if the responder is dropped without sending a response, so that the client
4171/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
4172impl std::ops::Drop for ControllerSendCommandResponder {
4173    fn drop(&mut self) {
4174        self.control_handle.shutdown();
4175        // Safety: drops once, never accessed again
4176        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
4177    }
4178}
4179
4180impl fidl::endpoints::Responder for ControllerSendCommandResponder {
4181    type ControlHandle = ControllerControlHandle;
4182
4183    fn control_handle(&self) -> &ControllerControlHandle {
4184        &self.control_handle
4185    }
4186
4187    fn drop_without_shutdown(mut self) {
4188        // Safety: drops once, never accessed again due to mem::forget
4189        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
4190        // Prevent Drop from running (which would shut down the channel)
4191        std::mem::forget(self);
4192    }
4193}
4194
4195impl ControllerSendCommandResponder {
4196    /// Sends a response to the FIDL transaction.
4197    ///
4198    /// Sets the channel to shutdown if an error occurs.
4199    pub fn send(self, mut result: Result<(), ControllerError>) -> Result<(), fidl::Error> {
4200        let _result = self.send_raw(result);
4201        if _result.is_err() {
4202            self.control_handle.shutdown();
4203        }
4204        self.drop_without_shutdown();
4205        _result
4206    }
4207
4208    /// Similar to "send" but does not shutdown the channel if an error occurs.
4209    pub fn send_no_shutdown_on_err(
4210        self,
4211        mut result: Result<(), ControllerError>,
4212    ) -> Result<(), fidl::Error> {
4213        let _result = self.send_raw(result);
4214        self.drop_without_shutdown();
4215        _result
4216    }
4217
4218    fn send_raw(&self, mut result: Result<(), ControllerError>) -> Result<(), fidl::Error> {
4219        self.control_handle.inner.send::<fidl::encoding::ResultType<
4220            fidl::encoding::EmptyStruct,
4221            ControllerError,
4222        >>(
4223            result,
4224            self.tx_id,
4225            0x241324c56b5bc257,
4226            fidl::encoding::DynamicFlags::empty(),
4227        )
4228    }
4229}
4230
4231#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
4232pub struct PeerManagerMarker;
4233
4234impl fidl::endpoints::ProtocolMarker for PeerManagerMarker {
4235    type Proxy = PeerManagerProxy;
4236    type RequestStream = PeerManagerRequestStream;
4237    #[cfg(target_os = "fuchsia")]
4238    type SynchronousProxy = PeerManagerSynchronousProxy;
4239
4240    const DEBUG_NAME: &'static str = "fuchsia.bluetooth.avrcp.PeerManager";
4241}
4242impl fidl::endpoints::DiscoverableProtocolMarker for PeerManagerMarker {}
4243pub type PeerManagerGetBrowseControllerForTargetResult = Result<(), i32>;
4244pub type PeerManagerGetControllerForTargetResult = Result<(), i32>;
4245pub type PeerManagerSetAbsoluteVolumeHandlerResult = Result<(), i32>;
4246pub type PeerManagerRegisterTargetHandlerResult = Result<(), i32>;
4247
4248pub trait PeerManagerProxyInterface: Send + Sync {
4249    type GetBrowseControllerForTargetResponseFut: std::future::Future<
4250            Output = Result<PeerManagerGetBrowseControllerForTargetResult, fidl::Error>,
4251        > + Send;
4252    fn r#get_browse_controller_for_target(
4253        &self,
4254        peer_id: &fidl_fuchsia_bluetooth::PeerId,
4255        client: fidl::endpoints::ServerEnd<BrowseControllerMarker>,
4256    ) -> Self::GetBrowseControllerForTargetResponseFut;
4257    type GetControllerForTargetResponseFut: std::future::Future<Output = Result<PeerManagerGetControllerForTargetResult, fidl::Error>>
4258        + Send;
4259    fn r#get_controller_for_target(
4260        &self,
4261        peer_id: &fidl_fuchsia_bluetooth::PeerId,
4262        client: fidl::endpoints::ServerEnd<ControllerMarker>,
4263    ) -> Self::GetControllerForTargetResponseFut;
4264    type SetAbsoluteVolumeHandlerResponseFut: std::future::Future<Output = Result<PeerManagerSetAbsoluteVolumeHandlerResult, fidl::Error>>
4265        + Send;
4266    fn r#set_absolute_volume_handler(
4267        &self,
4268        handler: fidl::endpoints::ClientEnd<AbsoluteVolumeHandlerMarker>,
4269    ) -> Self::SetAbsoluteVolumeHandlerResponseFut;
4270    type RegisterTargetHandlerResponseFut: std::future::Future<Output = Result<PeerManagerRegisterTargetHandlerResult, fidl::Error>>
4271        + Send;
4272    fn r#register_target_handler(
4273        &self,
4274        handler: fidl::endpoints::ClientEnd<TargetHandlerMarker>,
4275    ) -> Self::RegisterTargetHandlerResponseFut;
4276}
4277#[derive(Debug)]
4278#[cfg(target_os = "fuchsia")]
4279pub struct PeerManagerSynchronousProxy {
4280    client: fidl::client::sync::Client,
4281}
4282
4283#[cfg(target_os = "fuchsia")]
4284impl fidl::endpoints::SynchronousProxy for PeerManagerSynchronousProxy {
4285    type Proxy = PeerManagerProxy;
4286    type Protocol = PeerManagerMarker;
4287
4288    fn from_channel(inner: fidl::Channel) -> Self {
4289        Self::new(inner)
4290    }
4291
4292    fn into_channel(self) -> fidl::Channel {
4293        self.client.into_channel()
4294    }
4295
4296    fn as_channel(&self) -> &fidl::Channel {
4297        self.client.as_channel()
4298    }
4299}
4300
4301#[cfg(target_os = "fuchsia")]
4302impl PeerManagerSynchronousProxy {
4303    pub fn new(channel: fidl::Channel) -> Self {
4304        let protocol_name = <PeerManagerMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
4305        Self { client: fidl::client::sync::Client::new(channel, protocol_name) }
4306    }
4307
4308    pub fn into_channel(self) -> fidl::Channel {
4309        self.client.into_channel()
4310    }
4311
4312    /// Waits until an event arrives and returns it. It is safe for other
4313    /// threads to make concurrent requests while waiting for an event.
4314    pub fn wait_for_event(
4315        &self,
4316        deadline: zx::MonotonicInstant,
4317    ) -> Result<PeerManagerEvent, fidl::Error> {
4318        PeerManagerEvent::decode(self.client.wait_for_event(deadline)?)
4319    }
4320
4321    /// Returns a browse controller client to a remote target (TG) service at
4322    /// the peer specified by `peer_id`.
4323    pub fn r#get_browse_controller_for_target(
4324        &self,
4325        mut peer_id: &fidl_fuchsia_bluetooth::PeerId,
4326        mut client: fidl::endpoints::ServerEnd<BrowseControllerMarker>,
4327        ___deadline: zx::MonotonicInstant,
4328    ) -> Result<PeerManagerGetBrowseControllerForTargetResult, fidl::Error> {
4329        let _response = self.client.send_query::<
4330            PeerManagerGetBrowseControllerForTargetRequest,
4331            fidl::encoding::ResultType<fidl::encoding::EmptyStruct, i32>,
4332        >(
4333            (peer_id, client,),
4334            0x5b75bbb8d58a6d49,
4335            fidl::encoding::DynamicFlags::empty(),
4336            ___deadline,
4337        )?;
4338        Ok(_response.map(|x| x))
4339    }
4340
4341    /// Returns a controller client to a remote target (TG) service at the peer specified by
4342    /// `peer_id`.
4343    pub fn r#get_controller_for_target(
4344        &self,
4345        mut peer_id: &fidl_fuchsia_bluetooth::PeerId,
4346        mut client: fidl::endpoints::ServerEnd<ControllerMarker>,
4347        ___deadline: zx::MonotonicInstant,
4348    ) -> Result<PeerManagerGetControllerForTargetResult, fidl::Error> {
4349        let _response = self.client.send_query::<
4350            PeerManagerGetControllerForTargetRequest,
4351            fidl::encoding::ResultType<fidl::encoding::EmptyStruct, i32>,
4352        >(
4353            (peer_id, client,),
4354            0x25d36e51516bc3b4,
4355            fidl::encoding::DynamicFlags::empty(),
4356            ___deadline,
4357        )?;
4358        Ok(_response.map(|x| x))
4359    }
4360
4361    /// Set the absolute volume handler.  Only one handler may be set  at at time.
4362    /// If a second handler is registered it will be dropped and an error will
4363    /// be returned.
4364    pub fn r#set_absolute_volume_handler(
4365        &self,
4366        mut handler: fidl::endpoints::ClientEnd<AbsoluteVolumeHandlerMarker>,
4367        ___deadline: zx::MonotonicInstant,
4368    ) -> Result<PeerManagerSetAbsoluteVolumeHandlerResult, fidl::Error> {
4369        let _response = self.client.send_query::<
4370            PeerManagerSetAbsoluteVolumeHandlerRequest,
4371            fidl::encoding::ResultType<fidl::encoding::EmptyStruct, i32>,
4372        >(
4373            (handler,),
4374            0x39a465c63e9f918c,
4375            fidl::encoding::DynamicFlags::empty(),
4376            ___deadline,
4377        )?;
4378        Ok(_response.map(|x| x))
4379    }
4380
4381    /// Sets an implementation of target handler that will vend delegates for each incoming
4382    /// remote TG -> local CT connections to handle the commands being sent by the remote TG.
4383    pub fn r#register_target_handler(
4384        &self,
4385        mut handler: fidl::endpoints::ClientEnd<TargetHandlerMarker>,
4386        ___deadline: zx::MonotonicInstant,
4387    ) -> Result<PeerManagerRegisterTargetHandlerResult, fidl::Error> {
4388        let _response = self.client.send_query::<
4389            PeerManagerRegisterTargetHandlerRequest,
4390            fidl::encoding::ResultType<fidl::encoding::EmptyStruct, i32>,
4391        >(
4392            (handler,),
4393            0x4bc919acb791bdb3,
4394            fidl::encoding::DynamicFlags::empty(),
4395            ___deadline,
4396        )?;
4397        Ok(_response.map(|x| x))
4398    }
4399}
4400
4401#[cfg(target_os = "fuchsia")]
4402impl From<PeerManagerSynchronousProxy> for zx::Handle {
4403    fn from(value: PeerManagerSynchronousProxy) -> Self {
4404        value.into_channel().into()
4405    }
4406}
4407
4408#[cfg(target_os = "fuchsia")]
4409impl From<fidl::Channel> for PeerManagerSynchronousProxy {
4410    fn from(value: fidl::Channel) -> Self {
4411        Self::new(value)
4412    }
4413}
4414
4415#[cfg(target_os = "fuchsia")]
4416impl fidl::endpoints::FromClient for PeerManagerSynchronousProxy {
4417    type Protocol = PeerManagerMarker;
4418
4419    fn from_client(value: fidl::endpoints::ClientEnd<PeerManagerMarker>) -> Self {
4420        Self::new(value.into_channel())
4421    }
4422}
4423
4424#[derive(Debug, Clone)]
4425pub struct PeerManagerProxy {
4426    client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
4427}
4428
4429impl fidl::endpoints::Proxy for PeerManagerProxy {
4430    type Protocol = PeerManagerMarker;
4431
4432    fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
4433        Self::new(inner)
4434    }
4435
4436    fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
4437        self.client.into_channel().map_err(|client| Self { client })
4438    }
4439
4440    fn as_channel(&self) -> &::fidl::AsyncChannel {
4441        self.client.as_channel()
4442    }
4443}
4444
4445impl PeerManagerProxy {
4446    /// Create a new Proxy for fuchsia.bluetooth.avrcp/PeerManager.
4447    pub fn new(channel: ::fidl::AsyncChannel) -> Self {
4448        let protocol_name = <PeerManagerMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
4449        Self { client: fidl::client::Client::new(channel, protocol_name) }
4450    }
4451
4452    /// Get a Stream of events from the remote end of the protocol.
4453    ///
4454    /// # Panics
4455    ///
4456    /// Panics if the event stream was already taken.
4457    pub fn take_event_stream(&self) -> PeerManagerEventStream {
4458        PeerManagerEventStream { event_receiver: self.client.take_event_receiver() }
4459    }
4460
4461    /// Returns a browse controller client to a remote target (TG) service at
4462    /// the peer specified by `peer_id`.
4463    pub fn r#get_browse_controller_for_target(
4464        &self,
4465        mut peer_id: &fidl_fuchsia_bluetooth::PeerId,
4466        mut client: fidl::endpoints::ServerEnd<BrowseControllerMarker>,
4467    ) -> fidl::client::QueryResponseFut<
4468        PeerManagerGetBrowseControllerForTargetResult,
4469        fidl::encoding::DefaultFuchsiaResourceDialect,
4470    > {
4471        PeerManagerProxyInterface::r#get_browse_controller_for_target(self, peer_id, client)
4472    }
4473
4474    /// Returns a controller client to a remote target (TG) service at the peer specified by
4475    /// `peer_id`.
4476    pub fn r#get_controller_for_target(
4477        &self,
4478        mut peer_id: &fidl_fuchsia_bluetooth::PeerId,
4479        mut client: fidl::endpoints::ServerEnd<ControllerMarker>,
4480    ) -> fidl::client::QueryResponseFut<
4481        PeerManagerGetControllerForTargetResult,
4482        fidl::encoding::DefaultFuchsiaResourceDialect,
4483    > {
4484        PeerManagerProxyInterface::r#get_controller_for_target(self, peer_id, client)
4485    }
4486
4487    /// Set the absolute volume handler.  Only one handler may be set  at at time.
4488    /// If a second handler is registered it will be dropped and an error will
4489    /// be returned.
4490    pub fn r#set_absolute_volume_handler(
4491        &self,
4492        mut handler: fidl::endpoints::ClientEnd<AbsoluteVolumeHandlerMarker>,
4493    ) -> fidl::client::QueryResponseFut<
4494        PeerManagerSetAbsoluteVolumeHandlerResult,
4495        fidl::encoding::DefaultFuchsiaResourceDialect,
4496    > {
4497        PeerManagerProxyInterface::r#set_absolute_volume_handler(self, handler)
4498    }
4499
4500    /// Sets an implementation of target handler that will vend delegates for each incoming
4501    /// remote TG -> local CT connections to handle the commands being sent by the remote TG.
4502    pub fn r#register_target_handler(
4503        &self,
4504        mut handler: fidl::endpoints::ClientEnd<TargetHandlerMarker>,
4505    ) -> fidl::client::QueryResponseFut<
4506        PeerManagerRegisterTargetHandlerResult,
4507        fidl::encoding::DefaultFuchsiaResourceDialect,
4508    > {
4509        PeerManagerProxyInterface::r#register_target_handler(self, handler)
4510    }
4511}
4512
4513impl PeerManagerProxyInterface for PeerManagerProxy {
4514    type GetBrowseControllerForTargetResponseFut = fidl::client::QueryResponseFut<
4515        PeerManagerGetBrowseControllerForTargetResult,
4516        fidl::encoding::DefaultFuchsiaResourceDialect,
4517    >;
4518    fn r#get_browse_controller_for_target(
4519        &self,
4520        mut peer_id: &fidl_fuchsia_bluetooth::PeerId,
4521        mut client: fidl::endpoints::ServerEnd<BrowseControllerMarker>,
4522    ) -> Self::GetBrowseControllerForTargetResponseFut {
4523        fn _decode(
4524            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
4525        ) -> Result<PeerManagerGetBrowseControllerForTargetResult, fidl::Error> {
4526            let _response = fidl::client::decode_transaction_body::<
4527                fidl::encoding::ResultType<fidl::encoding::EmptyStruct, i32>,
4528                fidl::encoding::DefaultFuchsiaResourceDialect,
4529                0x5b75bbb8d58a6d49,
4530            >(_buf?)?;
4531            Ok(_response.map(|x| x))
4532        }
4533        self.client.send_query_and_decode::<
4534            PeerManagerGetBrowseControllerForTargetRequest,
4535            PeerManagerGetBrowseControllerForTargetResult,
4536        >(
4537            (peer_id, client,),
4538            0x5b75bbb8d58a6d49,
4539            fidl::encoding::DynamicFlags::empty(),
4540            _decode,
4541        )
4542    }
4543
4544    type GetControllerForTargetResponseFut = fidl::client::QueryResponseFut<
4545        PeerManagerGetControllerForTargetResult,
4546        fidl::encoding::DefaultFuchsiaResourceDialect,
4547    >;
4548    fn r#get_controller_for_target(
4549        &self,
4550        mut peer_id: &fidl_fuchsia_bluetooth::PeerId,
4551        mut client: fidl::endpoints::ServerEnd<ControllerMarker>,
4552    ) -> Self::GetControllerForTargetResponseFut {
4553        fn _decode(
4554            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
4555        ) -> Result<PeerManagerGetControllerForTargetResult, fidl::Error> {
4556            let _response = fidl::client::decode_transaction_body::<
4557                fidl::encoding::ResultType<fidl::encoding::EmptyStruct, i32>,
4558                fidl::encoding::DefaultFuchsiaResourceDialect,
4559                0x25d36e51516bc3b4,
4560            >(_buf?)?;
4561            Ok(_response.map(|x| x))
4562        }
4563        self.client.send_query_and_decode::<
4564            PeerManagerGetControllerForTargetRequest,
4565            PeerManagerGetControllerForTargetResult,
4566        >(
4567            (peer_id, client,),
4568            0x25d36e51516bc3b4,
4569            fidl::encoding::DynamicFlags::empty(),
4570            _decode,
4571        )
4572    }
4573
4574    type SetAbsoluteVolumeHandlerResponseFut = fidl::client::QueryResponseFut<
4575        PeerManagerSetAbsoluteVolumeHandlerResult,
4576        fidl::encoding::DefaultFuchsiaResourceDialect,
4577    >;
4578    fn r#set_absolute_volume_handler(
4579        &self,
4580        mut handler: fidl::endpoints::ClientEnd<AbsoluteVolumeHandlerMarker>,
4581    ) -> Self::SetAbsoluteVolumeHandlerResponseFut {
4582        fn _decode(
4583            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
4584        ) -> Result<PeerManagerSetAbsoluteVolumeHandlerResult, fidl::Error> {
4585            let _response = fidl::client::decode_transaction_body::<
4586                fidl::encoding::ResultType<fidl::encoding::EmptyStruct, i32>,
4587                fidl::encoding::DefaultFuchsiaResourceDialect,
4588                0x39a465c63e9f918c,
4589            >(_buf?)?;
4590            Ok(_response.map(|x| x))
4591        }
4592        self.client.send_query_and_decode::<
4593            PeerManagerSetAbsoluteVolumeHandlerRequest,
4594            PeerManagerSetAbsoluteVolumeHandlerResult,
4595        >(
4596            (handler,),
4597            0x39a465c63e9f918c,
4598            fidl::encoding::DynamicFlags::empty(),
4599            _decode,
4600        )
4601    }
4602
4603    type RegisterTargetHandlerResponseFut = fidl::client::QueryResponseFut<
4604        PeerManagerRegisterTargetHandlerResult,
4605        fidl::encoding::DefaultFuchsiaResourceDialect,
4606    >;
4607    fn r#register_target_handler(
4608        &self,
4609        mut handler: fidl::endpoints::ClientEnd<TargetHandlerMarker>,
4610    ) -> Self::RegisterTargetHandlerResponseFut {
4611        fn _decode(
4612            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
4613        ) -> Result<PeerManagerRegisterTargetHandlerResult, fidl::Error> {
4614            let _response = fidl::client::decode_transaction_body::<
4615                fidl::encoding::ResultType<fidl::encoding::EmptyStruct, i32>,
4616                fidl::encoding::DefaultFuchsiaResourceDialect,
4617                0x4bc919acb791bdb3,
4618            >(_buf?)?;
4619            Ok(_response.map(|x| x))
4620        }
4621        self.client.send_query_and_decode::<
4622            PeerManagerRegisterTargetHandlerRequest,
4623            PeerManagerRegisterTargetHandlerResult,
4624        >(
4625            (handler,),
4626            0x4bc919acb791bdb3,
4627            fidl::encoding::DynamicFlags::empty(),
4628            _decode,
4629        )
4630    }
4631}
4632
4633pub struct PeerManagerEventStream {
4634    event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
4635}
4636
4637impl std::marker::Unpin for PeerManagerEventStream {}
4638
4639impl futures::stream::FusedStream for PeerManagerEventStream {
4640    fn is_terminated(&self) -> bool {
4641        self.event_receiver.is_terminated()
4642    }
4643}
4644
4645impl futures::Stream for PeerManagerEventStream {
4646    type Item = Result<PeerManagerEvent, fidl::Error>;
4647
4648    fn poll_next(
4649        mut self: std::pin::Pin<&mut Self>,
4650        cx: &mut std::task::Context<'_>,
4651    ) -> std::task::Poll<Option<Self::Item>> {
4652        match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
4653            &mut self.event_receiver,
4654            cx
4655        )?) {
4656            Some(buf) => std::task::Poll::Ready(Some(PeerManagerEvent::decode(buf))),
4657            None => std::task::Poll::Ready(None),
4658        }
4659    }
4660}
4661
4662#[derive(Debug)]
4663pub enum PeerManagerEvent {}
4664
4665impl PeerManagerEvent {
4666    /// Decodes a message buffer as a [`PeerManagerEvent`].
4667    fn decode(
4668        mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
4669    ) -> Result<PeerManagerEvent, fidl::Error> {
4670        let (bytes, _handles) = buf.split_mut();
4671        let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
4672        debug_assert_eq!(tx_header.tx_id, 0);
4673        match tx_header.ordinal {
4674            _ => Err(fidl::Error::UnknownOrdinal {
4675                ordinal: tx_header.ordinal,
4676                protocol_name: <PeerManagerMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
4677            }),
4678        }
4679    }
4680}
4681
4682/// A Stream of incoming requests for fuchsia.bluetooth.avrcp/PeerManager.
4683pub struct PeerManagerRequestStream {
4684    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
4685    is_terminated: bool,
4686}
4687
4688impl std::marker::Unpin for PeerManagerRequestStream {}
4689
4690impl futures::stream::FusedStream for PeerManagerRequestStream {
4691    fn is_terminated(&self) -> bool {
4692        self.is_terminated
4693    }
4694}
4695
4696impl fidl::endpoints::RequestStream for PeerManagerRequestStream {
4697    type Protocol = PeerManagerMarker;
4698    type ControlHandle = PeerManagerControlHandle;
4699
4700    fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
4701        Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
4702    }
4703
4704    fn control_handle(&self) -> Self::ControlHandle {
4705        PeerManagerControlHandle { inner: self.inner.clone() }
4706    }
4707
4708    fn into_inner(
4709        self,
4710    ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
4711    {
4712        (self.inner, self.is_terminated)
4713    }
4714
4715    fn from_inner(
4716        inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
4717        is_terminated: bool,
4718    ) -> Self {
4719        Self { inner, is_terminated }
4720    }
4721}
4722
4723impl futures::Stream for PeerManagerRequestStream {
4724    type Item = Result<PeerManagerRequest, fidl::Error>;
4725
4726    fn poll_next(
4727        mut self: std::pin::Pin<&mut Self>,
4728        cx: &mut std::task::Context<'_>,
4729    ) -> std::task::Poll<Option<Self::Item>> {
4730        let this = &mut *self;
4731        if this.inner.check_shutdown(cx) {
4732            this.is_terminated = true;
4733            return std::task::Poll::Ready(None);
4734        }
4735        if this.is_terminated {
4736            panic!("polled PeerManagerRequestStream after completion");
4737        }
4738        fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
4739            |bytes, handles| {
4740                match this.inner.channel().read_etc(cx, bytes, handles) {
4741                    std::task::Poll::Ready(Ok(())) => {}
4742                    std::task::Poll::Pending => return std::task::Poll::Pending,
4743                    std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
4744                        this.is_terminated = true;
4745                        return std::task::Poll::Ready(None);
4746                    }
4747                    std::task::Poll::Ready(Err(e)) => {
4748                        return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
4749                            e.into(),
4750                        ))))
4751                    }
4752                }
4753
4754                // A message has been received from the channel
4755                let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
4756
4757                std::task::Poll::Ready(Some(match header.ordinal {
4758                    0x5b75bbb8d58a6d49 => {
4759                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
4760                        let mut req = fidl::new_empty!(
4761                            PeerManagerGetBrowseControllerForTargetRequest,
4762                            fidl::encoding::DefaultFuchsiaResourceDialect
4763                        );
4764                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<PeerManagerGetBrowseControllerForTargetRequest>(&header, _body_bytes, handles, &mut req)?;
4765                        let control_handle = PeerManagerControlHandle { inner: this.inner.clone() };
4766                        Ok(PeerManagerRequest::GetBrowseControllerForTarget {
4767                            peer_id: req.peer_id,
4768                            client: req.client,
4769
4770                            responder: PeerManagerGetBrowseControllerForTargetResponder {
4771                                control_handle: std::mem::ManuallyDrop::new(control_handle),
4772                                tx_id: header.tx_id,
4773                            },
4774                        })
4775                    }
4776                    0x25d36e51516bc3b4 => {
4777                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
4778                        let mut req = fidl::new_empty!(
4779                            PeerManagerGetControllerForTargetRequest,
4780                            fidl::encoding::DefaultFuchsiaResourceDialect
4781                        );
4782                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<PeerManagerGetControllerForTargetRequest>(&header, _body_bytes, handles, &mut req)?;
4783                        let control_handle = PeerManagerControlHandle { inner: this.inner.clone() };
4784                        Ok(PeerManagerRequest::GetControllerForTarget {
4785                            peer_id: req.peer_id,
4786                            client: req.client,
4787
4788                            responder: PeerManagerGetControllerForTargetResponder {
4789                                control_handle: std::mem::ManuallyDrop::new(control_handle),
4790                                tx_id: header.tx_id,
4791                            },
4792                        })
4793                    }
4794                    0x39a465c63e9f918c => {
4795                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
4796                        let mut req = fidl::new_empty!(
4797                            PeerManagerSetAbsoluteVolumeHandlerRequest,
4798                            fidl::encoding::DefaultFuchsiaResourceDialect
4799                        );
4800                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<PeerManagerSetAbsoluteVolumeHandlerRequest>(&header, _body_bytes, handles, &mut req)?;
4801                        let control_handle = PeerManagerControlHandle { inner: this.inner.clone() };
4802                        Ok(PeerManagerRequest::SetAbsoluteVolumeHandler {
4803                            handler: req.handler,
4804
4805                            responder: PeerManagerSetAbsoluteVolumeHandlerResponder {
4806                                control_handle: std::mem::ManuallyDrop::new(control_handle),
4807                                tx_id: header.tx_id,
4808                            },
4809                        })
4810                    }
4811                    0x4bc919acb791bdb3 => {
4812                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
4813                        let mut req = fidl::new_empty!(
4814                            PeerManagerRegisterTargetHandlerRequest,
4815                            fidl::encoding::DefaultFuchsiaResourceDialect
4816                        );
4817                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<PeerManagerRegisterTargetHandlerRequest>(&header, _body_bytes, handles, &mut req)?;
4818                        let control_handle = PeerManagerControlHandle { inner: this.inner.clone() };
4819                        Ok(PeerManagerRequest::RegisterTargetHandler {
4820                            handler: req.handler,
4821
4822                            responder: PeerManagerRegisterTargetHandlerResponder {
4823                                control_handle: std::mem::ManuallyDrop::new(control_handle),
4824                                tx_id: header.tx_id,
4825                            },
4826                        })
4827                    }
4828                    _ => Err(fidl::Error::UnknownOrdinal {
4829                        ordinal: header.ordinal,
4830                        protocol_name:
4831                            <PeerManagerMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
4832                    }),
4833                }))
4834            },
4835        )
4836    }
4837}
4838
4839#[derive(Debug)]
4840pub enum PeerManagerRequest {
4841    /// Returns a browse controller client to a remote target (TG) service at
4842    /// the peer specified by `peer_id`.
4843    GetBrowseControllerForTarget {
4844        peer_id: fidl_fuchsia_bluetooth::PeerId,
4845        client: fidl::endpoints::ServerEnd<BrowseControllerMarker>,
4846        responder: PeerManagerGetBrowseControllerForTargetResponder,
4847    },
4848    /// Returns a controller client to a remote target (TG) service at the peer specified by
4849    /// `peer_id`.
4850    GetControllerForTarget {
4851        peer_id: fidl_fuchsia_bluetooth::PeerId,
4852        client: fidl::endpoints::ServerEnd<ControllerMarker>,
4853        responder: PeerManagerGetControllerForTargetResponder,
4854    },
4855    /// Set the absolute volume handler.  Only one handler may be set  at at time.
4856    /// If a second handler is registered it will be dropped and an error will
4857    /// be returned.
4858    SetAbsoluteVolumeHandler {
4859        handler: fidl::endpoints::ClientEnd<AbsoluteVolumeHandlerMarker>,
4860        responder: PeerManagerSetAbsoluteVolumeHandlerResponder,
4861    },
4862    /// Sets an implementation of target handler that will vend delegates for each incoming
4863    /// remote TG -> local CT connections to handle the commands being sent by the remote TG.
4864    RegisterTargetHandler {
4865        handler: fidl::endpoints::ClientEnd<TargetHandlerMarker>,
4866        responder: PeerManagerRegisterTargetHandlerResponder,
4867    },
4868}
4869
4870impl PeerManagerRequest {
4871    #[allow(irrefutable_let_patterns)]
4872    pub fn into_get_browse_controller_for_target(
4873        self,
4874    ) -> Option<(
4875        fidl_fuchsia_bluetooth::PeerId,
4876        fidl::endpoints::ServerEnd<BrowseControllerMarker>,
4877        PeerManagerGetBrowseControllerForTargetResponder,
4878    )> {
4879        if let PeerManagerRequest::GetBrowseControllerForTarget { peer_id, client, responder } =
4880            self
4881        {
4882            Some((peer_id, client, responder))
4883        } else {
4884            None
4885        }
4886    }
4887
4888    #[allow(irrefutable_let_patterns)]
4889    pub fn into_get_controller_for_target(
4890        self,
4891    ) -> Option<(
4892        fidl_fuchsia_bluetooth::PeerId,
4893        fidl::endpoints::ServerEnd<ControllerMarker>,
4894        PeerManagerGetControllerForTargetResponder,
4895    )> {
4896        if let PeerManagerRequest::GetControllerForTarget { peer_id, client, responder } = self {
4897            Some((peer_id, client, responder))
4898        } else {
4899            None
4900        }
4901    }
4902
4903    #[allow(irrefutable_let_patterns)]
4904    pub fn into_set_absolute_volume_handler(
4905        self,
4906    ) -> Option<(
4907        fidl::endpoints::ClientEnd<AbsoluteVolumeHandlerMarker>,
4908        PeerManagerSetAbsoluteVolumeHandlerResponder,
4909    )> {
4910        if let PeerManagerRequest::SetAbsoluteVolumeHandler { handler, responder } = self {
4911            Some((handler, responder))
4912        } else {
4913            None
4914        }
4915    }
4916
4917    #[allow(irrefutable_let_patterns)]
4918    pub fn into_register_target_handler(
4919        self,
4920    ) -> Option<(
4921        fidl::endpoints::ClientEnd<TargetHandlerMarker>,
4922        PeerManagerRegisterTargetHandlerResponder,
4923    )> {
4924        if let PeerManagerRequest::RegisterTargetHandler { handler, responder } = self {
4925            Some((handler, responder))
4926        } else {
4927            None
4928        }
4929    }
4930
4931    /// Name of the method defined in FIDL
4932    pub fn method_name(&self) -> &'static str {
4933        match *self {
4934            PeerManagerRequest::GetBrowseControllerForTarget { .. } => {
4935                "get_browse_controller_for_target"
4936            }
4937            PeerManagerRequest::GetControllerForTarget { .. } => "get_controller_for_target",
4938            PeerManagerRequest::SetAbsoluteVolumeHandler { .. } => "set_absolute_volume_handler",
4939            PeerManagerRequest::RegisterTargetHandler { .. } => "register_target_handler",
4940        }
4941    }
4942}
4943
4944#[derive(Debug, Clone)]
4945pub struct PeerManagerControlHandle {
4946    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
4947}
4948
4949impl fidl::endpoints::ControlHandle for PeerManagerControlHandle {
4950    fn shutdown(&self) {
4951        self.inner.shutdown()
4952    }
4953    fn shutdown_with_epitaph(&self, status: zx_status::Status) {
4954        self.inner.shutdown_with_epitaph(status)
4955    }
4956
4957    fn is_closed(&self) -> bool {
4958        self.inner.channel().is_closed()
4959    }
4960    fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
4961        self.inner.channel().on_closed()
4962    }
4963
4964    #[cfg(target_os = "fuchsia")]
4965    fn signal_peer(
4966        &self,
4967        clear_mask: zx::Signals,
4968        set_mask: zx::Signals,
4969    ) -> Result<(), zx_status::Status> {
4970        use fidl::Peered;
4971        self.inner.channel().signal_peer(clear_mask, set_mask)
4972    }
4973}
4974
4975impl PeerManagerControlHandle {}
4976
4977#[must_use = "FIDL methods require a response to be sent"]
4978#[derive(Debug)]
4979pub struct PeerManagerGetBrowseControllerForTargetResponder {
4980    control_handle: std::mem::ManuallyDrop<PeerManagerControlHandle>,
4981    tx_id: u32,
4982}
4983
4984/// Set the the channel to be shutdown (see [`PeerManagerControlHandle::shutdown`])
4985/// if the responder is dropped without sending a response, so that the client
4986/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
4987impl std::ops::Drop for PeerManagerGetBrowseControllerForTargetResponder {
4988    fn drop(&mut self) {
4989        self.control_handle.shutdown();
4990        // Safety: drops once, never accessed again
4991        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
4992    }
4993}
4994
4995impl fidl::endpoints::Responder for PeerManagerGetBrowseControllerForTargetResponder {
4996    type ControlHandle = PeerManagerControlHandle;
4997
4998    fn control_handle(&self) -> &PeerManagerControlHandle {
4999        &self.control_handle
5000    }
5001
5002    fn drop_without_shutdown(mut self) {
5003        // Safety: drops once, never accessed again due to mem::forget
5004        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
5005        // Prevent Drop from running (which would shut down the channel)
5006        std::mem::forget(self);
5007    }
5008}
5009
5010impl PeerManagerGetBrowseControllerForTargetResponder {
5011    /// Sends a response to the FIDL transaction.
5012    ///
5013    /// Sets the channel to shutdown if an error occurs.
5014    pub fn send(self, mut result: Result<(), i32>) -> Result<(), fidl::Error> {
5015        let _result = self.send_raw(result);
5016        if _result.is_err() {
5017            self.control_handle.shutdown();
5018        }
5019        self.drop_without_shutdown();
5020        _result
5021    }
5022
5023    /// Similar to "send" but does not shutdown the channel if an error occurs.
5024    pub fn send_no_shutdown_on_err(self, mut result: Result<(), i32>) -> Result<(), fidl::Error> {
5025        let _result = self.send_raw(result);
5026        self.drop_without_shutdown();
5027        _result
5028    }
5029
5030    fn send_raw(&self, mut result: Result<(), i32>) -> Result<(), fidl::Error> {
5031        self.control_handle
5032            .inner
5033            .send::<fidl::encoding::ResultType<fidl::encoding::EmptyStruct, i32>>(
5034                result,
5035                self.tx_id,
5036                0x5b75bbb8d58a6d49,
5037                fidl::encoding::DynamicFlags::empty(),
5038            )
5039    }
5040}
5041
5042#[must_use = "FIDL methods require a response to be sent"]
5043#[derive(Debug)]
5044pub struct PeerManagerGetControllerForTargetResponder {
5045    control_handle: std::mem::ManuallyDrop<PeerManagerControlHandle>,
5046    tx_id: u32,
5047}
5048
5049/// Set the the channel to be shutdown (see [`PeerManagerControlHandle::shutdown`])
5050/// if the responder is dropped without sending a response, so that the client
5051/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
5052impl std::ops::Drop for PeerManagerGetControllerForTargetResponder {
5053    fn drop(&mut self) {
5054        self.control_handle.shutdown();
5055        // Safety: drops once, never accessed again
5056        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
5057    }
5058}
5059
5060impl fidl::endpoints::Responder for PeerManagerGetControllerForTargetResponder {
5061    type ControlHandle = PeerManagerControlHandle;
5062
5063    fn control_handle(&self) -> &PeerManagerControlHandle {
5064        &self.control_handle
5065    }
5066
5067    fn drop_without_shutdown(mut self) {
5068        // Safety: drops once, never accessed again due to mem::forget
5069        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
5070        // Prevent Drop from running (which would shut down the channel)
5071        std::mem::forget(self);
5072    }
5073}
5074
5075impl PeerManagerGetControllerForTargetResponder {
5076    /// Sends a response to the FIDL transaction.
5077    ///
5078    /// Sets the channel to shutdown if an error occurs.
5079    pub fn send(self, mut result: Result<(), i32>) -> Result<(), fidl::Error> {
5080        let _result = self.send_raw(result);
5081        if _result.is_err() {
5082            self.control_handle.shutdown();
5083        }
5084        self.drop_without_shutdown();
5085        _result
5086    }
5087
5088    /// Similar to "send" but does not shutdown the channel if an error occurs.
5089    pub fn send_no_shutdown_on_err(self, mut result: Result<(), i32>) -> Result<(), fidl::Error> {
5090        let _result = self.send_raw(result);
5091        self.drop_without_shutdown();
5092        _result
5093    }
5094
5095    fn send_raw(&self, mut result: Result<(), i32>) -> Result<(), fidl::Error> {
5096        self.control_handle
5097            .inner
5098            .send::<fidl::encoding::ResultType<fidl::encoding::EmptyStruct, i32>>(
5099                result,
5100                self.tx_id,
5101                0x25d36e51516bc3b4,
5102                fidl::encoding::DynamicFlags::empty(),
5103            )
5104    }
5105}
5106
5107#[must_use = "FIDL methods require a response to be sent"]
5108#[derive(Debug)]
5109pub struct PeerManagerSetAbsoluteVolumeHandlerResponder {
5110    control_handle: std::mem::ManuallyDrop<PeerManagerControlHandle>,
5111    tx_id: u32,
5112}
5113
5114/// Set the the channel to be shutdown (see [`PeerManagerControlHandle::shutdown`])
5115/// if the responder is dropped without sending a response, so that the client
5116/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
5117impl std::ops::Drop for PeerManagerSetAbsoluteVolumeHandlerResponder {
5118    fn drop(&mut self) {
5119        self.control_handle.shutdown();
5120        // Safety: drops once, never accessed again
5121        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
5122    }
5123}
5124
5125impl fidl::endpoints::Responder for PeerManagerSetAbsoluteVolumeHandlerResponder {
5126    type ControlHandle = PeerManagerControlHandle;
5127
5128    fn control_handle(&self) -> &PeerManagerControlHandle {
5129        &self.control_handle
5130    }
5131
5132    fn drop_without_shutdown(mut self) {
5133        // Safety: drops once, never accessed again due to mem::forget
5134        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
5135        // Prevent Drop from running (which would shut down the channel)
5136        std::mem::forget(self);
5137    }
5138}
5139
5140impl PeerManagerSetAbsoluteVolumeHandlerResponder {
5141    /// Sends a response to the FIDL transaction.
5142    ///
5143    /// Sets the channel to shutdown if an error occurs.
5144    pub fn send(self, mut result: Result<(), i32>) -> Result<(), fidl::Error> {
5145        let _result = self.send_raw(result);
5146        if _result.is_err() {
5147            self.control_handle.shutdown();
5148        }
5149        self.drop_without_shutdown();
5150        _result
5151    }
5152
5153    /// Similar to "send" but does not shutdown the channel if an error occurs.
5154    pub fn send_no_shutdown_on_err(self, mut result: Result<(), i32>) -> Result<(), fidl::Error> {
5155        let _result = self.send_raw(result);
5156        self.drop_without_shutdown();
5157        _result
5158    }
5159
5160    fn send_raw(&self, mut result: Result<(), i32>) -> Result<(), fidl::Error> {
5161        self.control_handle
5162            .inner
5163            .send::<fidl::encoding::ResultType<fidl::encoding::EmptyStruct, i32>>(
5164                result,
5165                self.tx_id,
5166                0x39a465c63e9f918c,
5167                fidl::encoding::DynamicFlags::empty(),
5168            )
5169    }
5170}
5171
5172#[must_use = "FIDL methods require a response to be sent"]
5173#[derive(Debug)]
5174pub struct PeerManagerRegisterTargetHandlerResponder {
5175    control_handle: std::mem::ManuallyDrop<PeerManagerControlHandle>,
5176    tx_id: u32,
5177}
5178
5179/// Set the the channel to be shutdown (see [`PeerManagerControlHandle::shutdown`])
5180/// if the responder is dropped without sending a response, so that the client
5181/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
5182impl std::ops::Drop for PeerManagerRegisterTargetHandlerResponder {
5183    fn drop(&mut self) {
5184        self.control_handle.shutdown();
5185        // Safety: drops once, never accessed again
5186        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
5187    }
5188}
5189
5190impl fidl::endpoints::Responder for PeerManagerRegisterTargetHandlerResponder {
5191    type ControlHandle = PeerManagerControlHandle;
5192
5193    fn control_handle(&self) -> &PeerManagerControlHandle {
5194        &self.control_handle
5195    }
5196
5197    fn drop_without_shutdown(mut self) {
5198        // Safety: drops once, never accessed again due to mem::forget
5199        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
5200        // Prevent Drop from running (which would shut down the channel)
5201        std::mem::forget(self);
5202    }
5203}
5204
5205impl PeerManagerRegisterTargetHandlerResponder {
5206    /// Sends a response to the FIDL transaction.
5207    ///
5208    /// Sets the channel to shutdown if an error occurs.
5209    pub fn send(self, mut result: Result<(), i32>) -> Result<(), fidl::Error> {
5210        let _result = self.send_raw(result);
5211        if _result.is_err() {
5212            self.control_handle.shutdown();
5213        }
5214        self.drop_without_shutdown();
5215        _result
5216    }
5217
5218    /// Similar to "send" but does not shutdown the channel if an error occurs.
5219    pub fn send_no_shutdown_on_err(self, mut result: Result<(), i32>) -> Result<(), fidl::Error> {
5220        let _result = self.send_raw(result);
5221        self.drop_without_shutdown();
5222        _result
5223    }
5224
5225    fn send_raw(&self, mut result: Result<(), i32>) -> Result<(), fidl::Error> {
5226        self.control_handle
5227            .inner
5228            .send::<fidl::encoding::ResultType<fidl::encoding::EmptyStruct, i32>>(
5229                result,
5230                self.tx_id,
5231                0x4bc919acb791bdb3,
5232                fidl::encoding::DynamicFlags::empty(),
5233            )
5234    }
5235}
5236
5237#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
5238pub struct TargetHandlerMarker;
5239
5240impl fidl::endpoints::ProtocolMarker for TargetHandlerMarker {
5241    type Proxy = TargetHandlerProxy;
5242    type RequestStream = TargetHandlerRequestStream;
5243    #[cfg(target_os = "fuchsia")]
5244    type SynchronousProxy = TargetHandlerSynchronousProxy;
5245
5246    const DEBUG_NAME: &'static str = "(anonymous) TargetHandler";
5247}
5248pub type TargetHandlerGetEventsSupportedResult = Result<Vec<NotificationEvent>, TargetAvcError>;
5249pub type TargetHandlerGetMediaAttributesResult = Result<MediaAttributes, TargetAvcError>;
5250pub type TargetHandlerGetPlayStatusResult = Result<PlayStatus, TargetAvcError>;
5251pub type TargetHandlerSendCommandResult = Result<(), TargetPassthroughError>;
5252pub type TargetHandlerListPlayerApplicationSettingAttributesResult =
5253    Result<Vec<PlayerApplicationSettingAttributeId>, TargetAvcError>;
5254pub type TargetHandlerGetPlayerApplicationSettingsResult =
5255    Result<PlayerApplicationSettings, TargetAvcError>;
5256pub type TargetHandlerSetPlayerApplicationSettingsResult =
5257    Result<PlayerApplicationSettings, TargetAvcError>;
5258pub type TargetHandlerGetNotificationResult = Result<Notification, TargetAvcError>;
5259pub type TargetHandlerWatchNotificationResult = Result<Notification, TargetAvcError>;
5260pub type TargetHandlerSetAddressedPlayerResult = Result<(), TargetAvcError>;
5261pub type TargetHandlerGetMediaPlayerItemsResult = Result<Vec<MediaPlayerItem>, TargetAvcError>;
5262
5263pub trait TargetHandlerProxyInterface: Send + Sync {
5264    type GetEventsSupportedResponseFut: std::future::Future<Output = Result<TargetHandlerGetEventsSupportedResult, fidl::Error>>
5265        + Send;
5266    fn r#get_events_supported(&self) -> Self::GetEventsSupportedResponseFut;
5267    type GetMediaAttributesResponseFut: std::future::Future<Output = Result<TargetHandlerGetMediaAttributesResult, fidl::Error>>
5268        + Send;
5269    fn r#get_media_attributes(&self) -> Self::GetMediaAttributesResponseFut;
5270    type GetPlayStatusResponseFut: std::future::Future<Output = Result<TargetHandlerGetPlayStatusResult, fidl::Error>>
5271        + Send;
5272    fn r#get_play_status(&self) -> Self::GetPlayStatusResponseFut;
5273    type SendCommandResponseFut: std::future::Future<Output = Result<TargetHandlerSendCommandResult, fidl::Error>>
5274        + Send;
5275    fn r#send_command(
5276        &self,
5277        command: AvcPanelCommand,
5278        pressed: bool,
5279    ) -> Self::SendCommandResponseFut;
5280    type ListPlayerApplicationSettingAttributesResponseFut: std::future::Future<
5281            Output = Result<TargetHandlerListPlayerApplicationSettingAttributesResult, fidl::Error>,
5282        > + Send;
5283    fn r#list_player_application_setting_attributes(
5284        &self,
5285    ) -> Self::ListPlayerApplicationSettingAttributesResponseFut;
5286    type GetPlayerApplicationSettingsResponseFut: std::future::Future<
5287            Output = Result<TargetHandlerGetPlayerApplicationSettingsResult, fidl::Error>,
5288        > + Send;
5289    fn r#get_player_application_settings(
5290        &self,
5291        attribute_ids: &[PlayerApplicationSettingAttributeId],
5292    ) -> Self::GetPlayerApplicationSettingsResponseFut;
5293    type SetPlayerApplicationSettingsResponseFut: std::future::Future<
5294            Output = Result<TargetHandlerSetPlayerApplicationSettingsResult, fidl::Error>,
5295        > + Send;
5296    fn r#set_player_application_settings(
5297        &self,
5298        requested_settings: &PlayerApplicationSettings,
5299    ) -> Self::SetPlayerApplicationSettingsResponseFut;
5300    type GetNotificationResponseFut: std::future::Future<Output = Result<TargetHandlerGetNotificationResult, fidl::Error>>
5301        + Send;
5302    fn r#get_notification(&self, event_id: NotificationEvent) -> Self::GetNotificationResponseFut;
5303    type WatchNotificationResponseFut: std::future::Future<Output = Result<TargetHandlerWatchNotificationResult, fidl::Error>>
5304        + Send;
5305    fn r#watch_notification(
5306        &self,
5307        event_id: NotificationEvent,
5308        current: &Notification,
5309        pos_change_interval: u32,
5310    ) -> Self::WatchNotificationResponseFut;
5311    type SetAddressedPlayerResponseFut: std::future::Future<Output = Result<TargetHandlerSetAddressedPlayerResult, fidl::Error>>
5312        + Send;
5313    fn r#set_addressed_player(
5314        &self,
5315        player_id: &AddressedPlayerId,
5316    ) -> Self::SetAddressedPlayerResponseFut;
5317    type GetMediaPlayerItemsResponseFut: std::future::Future<Output = Result<TargetHandlerGetMediaPlayerItemsResult, fidl::Error>>
5318        + Send;
5319    fn r#get_media_player_items(&self) -> Self::GetMediaPlayerItemsResponseFut;
5320}
5321#[derive(Debug)]
5322#[cfg(target_os = "fuchsia")]
5323pub struct TargetHandlerSynchronousProxy {
5324    client: fidl::client::sync::Client,
5325}
5326
5327#[cfg(target_os = "fuchsia")]
5328impl fidl::endpoints::SynchronousProxy for TargetHandlerSynchronousProxy {
5329    type Proxy = TargetHandlerProxy;
5330    type Protocol = TargetHandlerMarker;
5331
5332    fn from_channel(inner: fidl::Channel) -> Self {
5333        Self::new(inner)
5334    }
5335
5336    fn into_channel(self) -> fidl::Channel {
5337        self.client.into_channel()
5338    }
5339
5340    fn as_channel(&self) -> &fidl::Channel {
5341        self.client.as_channel()
5342    }
5343}
5344
5345#[cfg(target_os = "fuchsia")]
5346impl TargetHandlerSynchronousProxy {
5347    pub fn new(channel: fidl::Channel) -> Self {
5348        let protocol_name = <TargetHandlerMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
5349        Self { client: fidl::client::sync::Client::new(channel, protocol_name) }
5350    }
5351
5352    pub fn into_channel(self) -> fidl::Channel {
5353        self.client.into_channel()
5354    }
5355
5356    /// Waits until an event arrives and returns it. It is safe for other
5357    /// threads to make concurrent requests while waiting for an event.
5358    pub fn wait_for_event(
5359        &self,
5360        deadline: zx::MonotonicInstant,
5361    ) -> Result<TargetHandlerEvent, fidl::Error> {
5362        TargetHandlerEvent::decode(self.client.wait_for_event(deadline)?)
5363    }
5364
5365    /// Returns the event notification ids that are supported by the TG.
5366    pub fn r#get_events_supported(
5367        &self,
5368        ___deadline: zx::MonotonicInstant,
5369    ) -> Result<TargetHandlerGetEventsSupportedResult, fidl::Error> {
5370        let _response =
5371            self.client.send_query::<fidl::encoding::EmptyPayload, fidl::encoding::ResultType<
5372                TargetHandlerGetEventsSupportedResponse,
5373                TargetAvcError,
5374            >>(
5375                (),
5376                0x54bb8d817d5e1257,
5377                fidl::encoding::DynamicFlags::empty(),
5378                ___deadline,
5379            )?;
5380        Ok(_response.map(|x| x.notification_ids))
5381    }
5382
5383    /// Returns the currently playing media attributes.
5384    /// May send either the GetElementAttributes or GetItemAttributes command depending on what
5385    /// is supported.
5386    pub fn r#get_media_attributes(
5387        &self,
5388        ___deadline: zx::MonotonicInstant,
5389    ) -> Result<TargetHandlerGetMediaAttributesResult, fidl::Error> {
5390        let _response =
5391            self.client.send_query::<fidl::encoding::EmptyPayload, fidl::encoding::ResultType<
5392                TargetHandlerGetMediaAttributesResponse,
5393                TargetAvcError,
5394            >>(
5395                (),
5396                0x629f354d2805daf5,
5397                fidl::encoding::DynamicFlags::empty(),
5398                ___deadline,
5399            )?;
5400        Ok(_response.map(|x| x.attributes))
5401    }
5402
5403    /// Returns the status of the currently playing media.
5404    pub fn r#get_play_status(
5405        &self,
5406        ___deadline: zx::MonotonicInstant,
5407    ) -> Result<TargetHandlerGetPlayStatusResult, fidl::Error> {
5408        let _response =
5409            self.client.send_query::<fidl::encoding::EmptyPayload, fidl::encoding::ResultType<
5410                TargetHandlerGetPlayStatusResponse,
5411                TargetAvcError,
5412            >>(
5413                (),
5414                0x24a4816300e14d89,
5415                fidl::encoding::DynamicFlags::empty(),
5416                ___deadline,
5417            )?;
5418        Ok(_response.map(|x| x.play_status))
5419    }
5420
5421    /// Send an AV\C passthrough key command.
5422    /// If `key_pressed`, then the AV\C passthrough command shall be interpreted as a key
5423    /// press down event. Otherwise, the command shall be interpreted as a key release event.
5424    pub fn r#send_command(
5425        &self,
5426        mut command: AvcPanelCommand,
5427        mut pressed: bool,
5428        ___deadline: zx::MonotonicInstant,
5429    ) -> Result<TargetHandlerSendCommandResult, fidl::Error> {
5430        let _response =
5431            self.client.send_query::<TargetHandlerSendCommandRequest, fidl::encoding::ResultType<
5432                fidl::encoding::EmptyStruct,
5433                TargetPassthroughError,
5434            >>(
5435                (command, pressed),
5436                0x69e063a8f6ab7b87,
5437                fidl::encoding::DynamicFlags::empty(),
5438                ___deadline,
5439            )?;
5440        Ok(_response.map(|x| x))
5441    }
5442
5443    /// Request the target device to provide all the target supported player application
5444    /// setting attributes.
5445    pub fn r#list_player_application_setting_attributes(
5446        &self,
5447        ___deadline: zx::MonotonicInstant,
5448    ) -> Result<TargetHandlerListPlayerApplicationSettingAttributesResult, fidl::Error> {
5449        let _response =
5450            self.client.send_query::<fidl::encoding::EmptyPayload, fidl::encoding::ResultType<
5451                TargetHandlerListPlayerApplicationSettingAttributesResponse,
5452                TargetAvcError,
5453            >>(
5454                (), 0xdfa38da6a60b2, fidl::encoding::DynamicFlags::empty(), ___deadline
5455            )?;
5456        Ok(_response.map(|x| x.attributes))
5457    }
5458
5459    /// Returns currently set player application setting values for the `attribute_ids`.
5460    /// If no `attribute_ids` are provided, this method will query the TG for all valid
5461    /// attribute ID's, and return the currently set player application setting values.
5462    pub fn r#get_player_application_settings(
5463        &self,
5464        mut attribute_ids: &[PlayerApplicationSettingAttributeId],
5465        ___deadline: zx::MonotonicInstant,
5466    ) -> Result<TargetHandlerGetPlayerApplicationSettingsResult, fidl::Error> {
5467        let _response = self.client.send_query::<
5468            TargetHandlerGetPlayerApplicationSettingsRequest,
5469            fidl::encoding::ResultType<TargetHandlerGetPlayerApplicationSettingsResponse, TargetAvcError>,
5470        >(
5471            (attribute_ids,),
5472            0x4273f96bdb752751,
5473            fidl::encoding::DynamicFlags::empty(),
5474            ___deadline,
5475        )?;
5476        Ok(_response.map(|x| x.current_settings))
5477    }
5478
5479    /// Sets the player application settings specified by `requested_settings`. Only
5480    /// settings specified in the input `requested_settings` will be overwritten.
5481    /// Returns the actual settings that were set.
5482    /// Settings provided in the `requested_settings` that are unsupported or unknown
5483    /// will not be set; and `SetPlayerApplicationSettings` will not return an error.
5484    /// Instead, the returned `set_settings` will include only the settings that were
5485    /// successfully set on the remote target.
5486    pub fn r#set_player_application_settings(
5487        &self,
5488        mut requested_settings: &PlayerApplicationSettings,
5489        ___deadline: zx::MonotonicInstant,
5490    ) -> Result<TargetHandlerSetPlayerApplicationSettingsResult, fidl::Error> {
5491        let _response = self.client.send_query::<
5492            TargetHandlerSetPlayerApplicationSettingsRequest,
5493            fidl::encoding::ResultType<TargetHandlerSetPlayerApplicationSettingsResponse, TargetAvcError>,
5494        >(
5495            (requested_settings,),
5496            0x636dd18255e01998,
5497            fidl::encoding::DynamicFlags::empty(),
5498            ___deadline,
5499        )?;
5500        Ok(_response.map(|x| x.set_settings))
5501    }
5502
5503    /// Returns the current value for the notification specified by `event_id`.
5504    pub fn r#get_notification(
5505        &self,
5506        mut event_id: NotificationEvent,
5507        ___deadline: zx::MonotonicInstant,
5508    ) -> Result<TargetHandlerGetNotificationResult, fidl::Error> {
5509        let _response = self.client.send_query::<
5510            TargetHandlerGetNotificationRequest,
5511            fidl::encoding::ResultType<TargetHandlerGetNotificationResponse, TargetAvcError>,
5512        >(
5513            (event_id,),
5514            0x60c7792539a032f1,
5515            fidl::encoding::DynamicFlags::empty(),
5516            ___deadline,
5517        )?;
5518        Ok(_response.map(|x| x.current_value))
5519    }
5520
5521    /// Returns the changed value of the notification specified by 'event_id'.
5522    /// A changed value refers to any value that is different than the input parameter
5523    /// `current` Notification value.
5524    /// `WatchNotification` will not respond until the Notification value associated
5525    /// with `event_id` has changed from the `current` Notification.
5526    pub fn r#watch_notification(
5527        &self,
5528        mut event_id: NotificationEvent,
5529        mut current: &Notification,
5530        mut pos_change_interval: u32,
5531        ___deadline: zx::MonotonicInstant,
5532    ) -> Result<TargetHandlerWatchNotificationResult, fidl::Error> {
5533        let _response =
5534            self.client
5535                .send_query::<TargetHandlerWatchNotificationRequest, fidl::encoding::ResultType<
5536                    TargetHandlerWatchNotificationResponse,
5537                    TargetAvcError,
5538                >>(
5539                    (event_id, current, pos_change_interval),
5540                    0x2a513434cf256e5f,
5541                    fidl::encoding::DynamicFlags::empty(),
5542                    ___deadline,
5543                )?;
5544        Ok(_response.map(|x| x.new_value))
5545    }
5546
5547    /// Changes the addressed `player_id` on the target when multiple are supported.
5548    pub fn r#set_addressed_player(
5549        &self,
5550        mut player_id: &AddressedPlayerId,
5551        ___deadline: zx::MonotonicInstant,
5552    ) -> Result<TargetHandlerSetAddressedPlayerResult, fidl::Error> {
5553        let _response = self.client.send_query::<
5554            TargetHandlerSetAddressedPlayerRequest,
5555            fidl::encoding::ResultType<fidl::encoding::EmptyStruct, TargetAvcError>,
5556        >(
5557            (player_id,),
5558            0x6724ae8288c34d2f,
5559            fidl::encoding::DynamicFlags::empty(),
5560            ___deadline,
5561        )?;
5562        Ok(_response.map(|x| x))
5563    }
5564
5565    /// Returns a list of media player information about the players on the target.
5566    pub fn r#get_media_player_items(
5567        &self,
5568        ___deadline: zx::MonotonicInstant,
5569    ) -> Result<TargetHandlerGetMediaPlayerItemsResult, fidl::Error> {
5570        let _response =
5571            self.client.send_query::<fidl::encoding::EmptyPayload, fidl::encoding::ResultType<
5572                TargetHandlerGetMediaPlayerItemsResponse,
5573                TargetAvcError,
5574            >>(
5575                (),
5576                0x736668f5aa3a8246,
5577                fidl::encoding::DynamicFlags::empty(),
5578                ___deadline,
5579            )?;
5580        Ok(_response.map(|x| x.items))
5581    }
5582}
5583
5584#[cfg(target_os = "fuchsia")]
5585impl From<TargetHandlerSynchronousProxy> for zx::Handle {
5586    fn from(value: TargetHandlerSynchronousProxy) -> Self {
5587        value.into_channel().into()
5588    }
5589}
5590
5591#[cfg(target_os = "fuchsia")]
5592impl From<fidl::Channel> for TargetHandlerSynchronousProxy {
5593    fn from(value: fidl::Channel) -> Self {
5594        Self::new(value)
5595    }
5596}
5597
5598#[cfg(target_os = "fuchsia")]
5599impl fidl::endpoints::FromClient for TargetHandlerSynchronousProxy {
5600    type Protocol = TargetHandlerMarker;
5601
5602    fn from_client(value: fidl::endpoints::ClientEnd<TargetHandlerMarker>) -> Self {
5603        Self::new(value.into_channel())
5604    }
5605}
5606
5607#[derive(Debug, Clone)]
5608pub struct TargetHandlerProxy {
5609    client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
5610}
5611
5612impl fidl::endpoints::Proxy for TargetHandlerProxy {
5613    type Protocol = TargetHandlerMarker;
5614
5615    fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
5616        Self::new(inner)
5617    }
5618
5619    fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
5620        self.client.into_channel().map_err(|client| Self { client })
5621    }
5622
5623    fn as_channel(&self) -> &::fidl::AsyncChannel {
5624        self.client.as_channel()
5625    }
5626}
5627
5628impl TargetHandlerProxy {
5629    /// Create a new Proxy for fuchsia.bluetooth.avrcp/TargetHandler.
5630    pub fn new(channel: ::fidl::AsyncChannel) -> Self {
5631        let protocol_name = <TargetHandlerMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
5632        Self { client: fidl::client::Client::new(channel, protocol_name) }
5633    }
5634
5635    /// Get a Stream of events from the remote end of the protocol.
5636    ///
5637    /// # Panics
5638    ///
5639    /// Panics if the event stream was already taken.
5640    pub fn take_event_stream(&self) -> TargetHandlerEventStream {
5641        TargetHandlerEventStream { event_receiver: self.client.take_event_receiver() }
5642    }
5643
5644    /// Returns the event notification ids that are supported by the TG.
5645    pub fn r#get_events_supported(
5646        &self,
5647    ) -> fidl::client::QueryResponseFut<
5648        TargetHandlerGetEventsSupportedResult,
5649        fidl::encoding::DefaultFuchsiaResourceDialect,
5650    > {
5651        TargetHandlerProxyInterface::r#get_events_supported(self)
5652    }
5653
5654    /// Returns the currently playing media attributes.
5655    /// May send either the GetElementAttributes or GetItemAttributes command depending on what
5656    /// is supported.
5657    pub fn r#get_media_attributes(
5658        &self,
5659    ) -> fidl::client::QueryResponseFut<
5660        TargetHandlerGetMediaAttributesResult,
5661        fidl::encoding::DefaultFuchsiaResourceDialect,
5662    > {
5663        TargetHandlerProxyInterface::r#get_media_attributes(self)
5664    }
5665
5666    /// Returns the status of the currently playing media.
5667    pub fn r#get_play_status(
5668        &self,
5669    ) -> fidl::client::QueryResponseFut<
5670        TargetHandlerGetPlayStatusResult,
5671        fidl::encoding::DefaultFuchsiaResourceDialect,
5672    > {
5673        TargetHandlerProxyInterface::r#get_play_status(self)
5674    }
5675
5676    /// Send an AV\C passthrough key command.
5677    /// If `key_pressed`, then the AV\C passthrough command shall be interpreted as a key
5678    /// press down event. Otherwise, the command shall be interpreted as a key release event.
5679    pub fn r#send_command(
5680        &self,
5681        mut command: AvcPanelCommand,
5682        mut pressed: bool,
5683    ) -> fidl::client::QueryResponseFut<
5684        TargetHandlerSendCommandResult,
5685        fidl::encoding::DefaultFuchsiaResourceDialect,
5686    > {
5687        TargetHandlerProxyInterface::r#send_command(self, command, pressed)
5688    }
5689
5690    /// Request the target device to provide all the target supported player application
5691    /// setting attributes.
5692    pub fn r#list_player_application_setting_attributes(
5693        &self,
5694    ) -> fidl::client::QueryResponseFut<
5695        TargetHandlerListPlayerApplicationSettingAttributesResult,
5696        fidl::encoding::DefaultFuchsiaResourceDialect,
5697    > {
5698        TargetHandlerProxyInterface::r#list_player_application_setting_attributes(self)
5699    }
5700
5701    /// Returns currently set player application setting values for the `attribute_ids`.
5702    /// If no `attribute_ids` are provided, this method will query the TG for all valid
5703    /// attribute ID's, and return the currently set player application setting values.
5704    pub fn r#get_player_application_settings(
5705        &self,
5706        mut attribute_ids: &[PlayerApplicationSettingAttributeId],
5707    ) -> fidl::client::QueryResponseFut<
5708        TargetHandlerGetPlayerApplicationSettingsResult,
5709        fidl::encoding::DefaultFuchsiaResourceDialect,
5710    > {
5711        TargetHandlerProxyInterface::r#get_player_application_settings(self, attribute_ids)
5712    }
5713
5714    /// Sets the player application settings specified by `requested_settings`. Only
5715    /// settings specified in the input `requested_settings` will be overwritten.
5716    /// Returns the actual settings that were set.
5717    /// Settings provided in the `requested_settings` that are unsupported or unknown
5718    /// will not be set; and `SetPlayerApplicationSettings` will not return an error.
5719    /// Instead, the returned `set_settings` will include only the settings that were
5720    /// successfully set on the remote target.
5721    pub fn r#set_player_application_settings(
5722        &self,
5723        mut requested_settings: &PlayerApplicationSettings,
5724    ) -> fidl::client::QueryResponseFut<
5725        TargetHandlerSetPlayerApplicationSettingsResult,
5726        fidl::encoding::DefaultFuchsiaResourceDialect,
5727    > {
5728        TargetHandlerProxyInterface::r#set_player_application_settings(self, requested_settings)
5729    }
5730
5731    /// Returns the current value for the notification specified by `event_id`.
5732    pub fn r#get_notification(
5733        &self,
5734        mut event_id: NotificationEvent,
5735    ) -> fidl::client::QueryResponseFut<
5736        TargetHandlerGetNotificationResult,
5737        fidl::encoding::DefaultFuchsiaResourceDialect,
5738    > {
5739        TargetHandlerProxyInterface::r#get_notification(self, event_id)
5740    }
5741
5742    /// Returns the changed value of the notification specified by 'event_id'.
5743    /// A changed value refers to any value that is different than the input parameter
5744    /// `current` Notification value.
5745    /// `WatchNotification` will not respond until the Notification value associated
5746    /// with `event_id` has changed from the `current` Notification.
5747    pub fn r#watch_notification(
5748        &self,
5749        mut event_id: NotificationEvent,
5750        mut current: &Notification,
5751        mut pos_change_interval: u32,
5752    ) -> fidl::client::QueryResponseFut<
5753        TargetHandlerWatchNotificationResult,
5754        fidl::encoding::DefaultFuchsiaResourceDialect,
5755    > {
5756        TargetHandlerProxyInterface::r#watch_notification(
5757            self,
5758            event_id,
5759            current,
5760            pos_change_interval,
5761        )
5762    }
5763
5764    /// Changes the addressed `player_id` on the target when multiple are supported.
5765    pub fn r#set_addressed_player(
5766        &self,
5767        mut player_id: &AddressedPlayerId,
5768    ) -> fidl::client::QueryResponseFut<
5769        TargetHandlerSetAddressedPlayerResult,
5770        fidl::encoding::DefaultFuchsiaResourceDialect,
5771    > {
5772        TargetHandlerProxyInterface::r#set_addressed_player(self, player_id)
5773    }
5774
5775    /// Returns a list of media player information about the players on the target.
5776    pub fn r#get_media_player_items(
5777        &self,
5778    ) -> fidl::client::QueryResponseFut<
5779        TargetHandlerGetMediaPlayerItemsResult,
5780        fidl::encoding::DefaultFuchsiaResourceDialect,
5781    > {
5782        TargetHandlerProxyInterface::r#get_media_player_items(self)
5783    }
5784}
5785
5786impl TargetHandlerProxyInterface for TargetHandlerProxy {
5787    type GetEventsSupportedResponseFut = fidl::client::QueryResponseFut<
5788        TargetHandlerGetEventsSupportedResult,
5789        fidl::encoding::DefaultFuchsiaResourceDialect,
5790    >;
5791    fn r#get_events_supported(&self) -> Self::GetEventsSupportedResponseFut {
5792        fn _decode(
5793            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
5794        ) -> Result<TargetHandlerGetEventsSupportedResult, fidl::Error> {
5795            let _response = fidl::client::decode_transaction_body::<
5796                fidl::encoding::ResultType<TargetHandlerGetEventsSupportedResponse, TargetAvcError>,
5797                fidl::encoding::DefaultFuchsiaResourceDialect,
5798                0x54bb8d817d5e1257,
5799            >(_buf?)?;
5800            Ok(_response.map(|x| x.notification_ids))
5801        }
5802        self.client.send_query_and_decode::<
5803            fidl::encoding::EmptyPayload,
5804            TargetHandlerGetEventsSupportedResult,
5805        >(
5806            (),
5807            0x54bb8d817d5e1257,
5808            fidl::encoding::DynamicFlags::empty(),
5809            _decode,
5810        )
5811    }
5812
5813    type GetMediaAttributesResponseFut = fidl::client::QueryResponseFut<
5814        TargetHandlerGetMediaAttributesResult,
5815        fidl::encoding::DefaultFuchsiaResourceDialect,
5816    >;
5817    fn r#get_media_attributes(&self) -> Self::GetMediaAttributesResponseFut {
5818        fn _decode(
5819            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
5820        ) -> Result<TargetHandlerGetMediaAttributesResult, fidl::Error> {
5821            let _response = fidl::client::decode_transaction_body::<
5822                fidl::encoding::ResultType<TargetHandlerGetMediaAttributesResponse, TargetAvcError>,
5823                fidl::encoding::DefaultFuchsiaResourceDialect,
5824                0x629f354d2805daf5,
5825            >(_buf?)?;
5826            Ok(_response.map(|x| x.attributes))
5827        }
5828        self.client.send_query_and_decode::<
5829            fidl::encoding::EmptyPayload,
5830            TargetHandlerGetMediaAttributesResult,
5831        >(
5832            (),
5833            0x629f354d2805daf5,
5834            fidl::encoding::DynamicFlags::empty(),
5835            _decode,
5836        )
5837    }
5838
5839    type GetPlayStatusResponseFut = fidl::client::QueryResponseFut<
5840        TargetHandlerGetPlayStatusResult,
5841        fidl::encoding::DefaultFuchsiaResourceDialect,
5842    >;
5843    fn r#get_play_status(&self) -> Self::GetPlayStatusResponseFut {
5844        fn _decode(
5845            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
5846        ) -> Result<TargetHandlerGetPlayStatusResult, fidl::Error> {
5847            let _response = fidl::client::decode_transaction_body::<
5848                fidl::encoding::ResultType<TargetHandlerGetPlayStatusResponse, TargetAvcError>,
5849                fidl::encoding::DefaultFuchsiaResourceDialect,
5850                0x24a4816300e14d89,
5851            >(_buf?)?;
5852            Ok(_response.map(|x| x.play_status))
5853        }
5854        self.client.send_query_and_decode::<
5855            fidl::encoding::EmptyPayload,
5856            TargetHandlerGetPlayStatusResult,
5857        >(
5858            (),
5859            0x24a4816300e14d89,
5860            fidl::encoding::DynamicFlags::empty(),
5861            _decode,
5862        )
5863    }
5864
5865    type SendCommandResponseFut = fidl::client::QueryResponseFut<
5866        TargetHandlerSendCommandResult,
5867        fidl::encoding::DefaultFuchsiaResourceDialect,
5868    >;
5869    fn r#send_command(
5870        &self,
5871        mut command: AvcPanelCommand,
5872        mut pressed: bool,
5873    ) -> Self::SendCommandResponseFut {
5874        fn _decode(
5875            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
5876        ) -> Result<TargetHandlerSendCommandResult, fidl::Error> {
5877            let _response = fidl::client::decode_transaction_body::<
5878                fidl::encoding::ResultType<fidl::encoding::EmptyStruct, TargetPassthroughError>,
5879                fidl::encoding::DefaultFuchsiaResourceDialect,
5880                0x69e063a8f6ab7b87,
5881            >(_buf?)?;
5882            Ok(_response.map(|x| x))
5883        }
5884        self.client.send_query_and_decode::<
5885            TargetHandlerSendCommandRequest,
5886            TargetHandlerSendCommandResult,
5887        >(
5888            (command, pressed,),
5889            0x69e063a8f6ab7b87,
5890            fidl::encoding::DynamicFlags::empty(),
5891            _decode,
5892        )
5893    }
5894
5895    type ListPlayerApplicationSettingAttributesResponseFut = fidl::client::QueryResponseFut<
5896        TargetHandlerListPlayerApplicationSettingAttributesResult,
5897        fidl::encoding::DefaultFuchsiaResourceDialect,
5898    >;
5899    fn r#list_player_application_setting_attributes(
5900        &self,
5901    ) -> Self::ListPlayerApplicationSettingAttributesResponseFut {
5902        fn _decode(
5903            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
5904        ) -> Result<TargetHandlerListPlayerApplicationSettingAttributesResult, fidl::Error>
5905        {
5906            let _response = fidl::client::decode_transaction_body::<
5907                fidl::encoding::ResultType<
5908                    TargetHandlerListPlayerApplicationSettingAttributesResponse,
5909                    TargetAvcError,
5910                >,
5911                fidl::encoding::DefaultFuchsiaResourceDialect,
5912                0xdfa38da6a60b2,
5913            >(_buf?)?;
5914            Ok(_response.map(|x| x.attributes))
5915        }
5916        self.client.send_query_and_decode::<
5917            fidl::encoding::EmptyPayload,
5918            TargetHandlerListPlayerApplicationSettingAttributesResult,
5919        >(
5920            (),
5921            0xdfa38da6a60b2,
5922            fidl::encoding::DynamicFlags::empty(),
5923            _decode,
5924        )
5925    }
5926
5927    type GetPlayerApplicationSettingsResponseFut = fidl::client::QueryResponseFut<
5928        TargetHandlerGetPlayerApplicationSettingsResult,
5929        fidl::encoding::DefaultFuchsiaResourceDialect,
5930    >;
5931    fn r#get_player_application_settings(
5932        &self,
5933        mut attribute_ids: &[PlayerApplicationSettingAttributeId],
5934    ) -> Self::GetPlayerApplicationSettingsResponseFut {
5935        fn _decode(
5936            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
5937        ) -> Result<TargetHandlerGetPlayerApplicationSettingsResult, fidl::Error> {
5938            let _response = fidl::client::decode_transaction_body::<
5939                fidl::encoding::ResultType<
5940                    TargetHandlerGetPlayerApplicationSettingsResponse,
5941                    TargetAvcError,
5942                >,
5943                fidl::encoding::DefaultFuchsiaResourceDialect,
5944                0x4273f96bdb752751,
5945            >(_buf?)?;
5946            Ok(_response.map(|x| x.current_settings))
5947        }
5948        self.client.send_query_and_decode::<
5949            TargetHandlerGetPlayerApplicationSettingsRequest,
5950            TargetHandlerGetPlayerApplicationSettingsResult,
5951        >(
5952            (attribute_ids,),
5953            0x4273f96bdb752751,
5954            fidl::encoding::DynamicFlags::empty(),
5955            _decode,
5956        )
5957    }
5958
5959    type SetPlayerApplicationSettingsResponseFut = fidl::client::QueryResponseFut<
5960        TargetHandlerSetPlayerApplicationSettingsResult,
5961        fidl::encoding::DefaultFuchsiaResourceDialect,
5962    >;
5963    fn r#set_player_application_settings(
5964        &self,
5965        mut requested_settings: &PlayerApplicationSettings,
5966    ) -> Self::SetPlayerApplicationSettingsResponseFut {
5967        fn _decode(
5968            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
5969        ) -> Result<TargetHandlerSetPlayerApplicationSettingsResult, fidl::Error> {
5970            let _response = fidl::client::decode_transaction_body::<
5971                fidl::encoding::ResultType<
5972                    TargetHandlerSetPlayerApplicationSettingsResponse,
5973                    TargetAvcError,
5974                >,
5975                fidl::encoding::DefaultFuchsiaResourceDialect,
5976                0x636dd18255e01998,
5977            >(_buf?)?;
5978            Ok(_response.map(|x| x.set_settings))
5979        }
5980        self.client.send_query_and_decode::<
5981            TargetHandlerSetPlayerApplicationSettingsRequest,
5982            TargetHandlerSetPlayerApplicationSettingsResult,
5983        >(
5984            (requested_settings,),
5985            0x636dd18255e01998,
5986            fidl::encoding::DynamicFlags::empty(),
5987            _decode,
5988        )
5989    }
5990
5991    type GetNotificationResponseFut = fidl::client::QueryResponseFut<
5992        TargetHandlerGetNotificationResult,
5993        fidl::encoding::DefaultFuchsiaResourceDialect,
5994    >;
5995    fn r#get_notification(
5996        &self,
5997        mut event_id: NotificationEvent,
5998    ) -> Self::GetNotificationResponseFut {
5999        fn _decode(
6000            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
6001        ) -> Result<TargetHandlerGetNotificationResult, fidl::Error> {
6002            let _response = fidl::client::decode_transaction_body::<
6003                fidl::encoding::ResultType<TargetHandlerGetNotificationResponse, TargetAvcError>,
6004                fidl::encoding::DefaultFuchsiaResourceDialect,
6005                0x60c7792539a032f1,
6006            >(_buf?)?;
6007            Ok(_response.map(|x| x.current_value))
6008        }
6009        self.client.send_query_and_decode::<
6010            TargetHandlerGetNotificationRequest,
6011            TargetHandlerGetNotificationResult,
6012        >(
6013            (event_id,),
6014            0x60c7792539a032f1,
6015            fidl::encoding::DynamicFlags::empty(),
6016            _decode,
6017        )
6018    }
6019
6020    type WatchNotificationResponseFut = fidl::client::QueryResponseFut<
6021        TargetHandlerWatchNotificationResult,
6022        fidl::encoding::DefaultFuchsiaResourceDialect,
6023    >;
6024    fn r#watch_notification(
6025        &self,
6026        mut event_id: NotificationEvent,
6027        mut current: &Notification,
6028        mut pos_change_interval: u32,
6029    ) -> Self::WatchNotificationResponseFut {
6030        fn _decode(
6031            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
6032        ) -> Result<TargetHandlerWatchNotificationResult, fidl::Error> {
6033            let _response = fidl::client::decode_transaction_body::<
6034                fidl::encoding::ResultType<TargetHandlerWatchNotificationResponse, TargetAvcError>,
6035                fidl::encoding::DefaultFuchsiaResourceDialect,
6036                0x2a513434cf256e5f,
6037            >(_buf?)?;
6038            Ok(_response.map(|x| x.new_value))
6039        }
6040        self.client.send_query_and_decode::<
6041            TargetHandlerWatchNotificationRequest,
6042            TargetHandlerWatchNotificationResult,
6043        >(
6044            (event_id, current, pos_change_interval,),
6045            0x2a513434cf256e5f,
6046            fidl::encoding::DynamicFlags::empty(),
6047            _decode,
6048        )
6049    }
6050
6051    type SetAddressedPlayerResponseFut = fidl::client::QueryResponseFut<
6052        TargetHandlerSetAddressedPlayerResult,
6053        fidl::encoding::DefaultFuchsiaResourceDialect,
6054    >;
6055    fn r#set_addressed_player(
6056        &self,
6057        mut player_id: &AddressedPlayerId,
6058    ) -> Self::SetAddressedPlayerResponseFut {
6059        fn _decode(
6060            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
6061        ) -> Result<TargetHandlerSetAddressedPlayerResult, fidl::Error> {
6062            let _response = fidl::client::decode_transaction_body::<
6063                fidl::encoding::ResultType<fidl::encoding::EmptyStruct, TargetAvcError>,
6064                fidl::encoding::DefaultFuchsiaResourceDialect,
6065                0x6724ae8288c34d2f,
6066            >(_buf?)?;
6067            Ok(_response.map(|x| x))
6068        }
6069        self.client.send_query_and_decode::<
6070            TargetHandlerSetAddressedPlayerRequest,
6071            TargetHandlerSetAddressedPlayerResult,
6072        >(
6073            (player_id,),
6074            0x6724ae8288c34d2f,
6075            fidl::encoding::DynamicFlags::empty(),
6076            _decode,
6077        )
6078    }
6079
6080    type GetMediaPlayerItemsResponseFut = fidl::client::QueryResponseFut<
6081        TargetHandlerGetMediaPlayerItemsResult,
6082        fidl::encoding::DefaultFuchsiaResourceDialect,
6083    >;
6084    fn r#get_media_player_items(&self) -> Self::GetMediaPlayerItemsResponseFut {
6085        fn _decode(
6086            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
6087        ) -> Result<TargetHandlerGetMediaPlayerItemsResult, fidl::Error> {
6088            let _response = fidl::client::decode_transaction_body::<
6089                fidl::encoding::ResultType<
6090                    TargetHandlerGetMediaPlayerItemsResponse,
6091                    TargetAvcError,
6092                >,
6093                fidl::encoding::DefaultFuchsiaResourceDialect,
6094                0x736668f5aa3a8246,
6095            >(_buf?)?;
6096            Ok(_response.map(|x| x.items))
6097        }
6098        self.client.send_query_and_decode::<
6099            fidl::encoding::EmptyPayload,
6100            TargetHandlerGetMediaPlayerItemsResult,
6101        >(
6102            (),
6103            0x736668f5aa3a8246,
6104            fidl::encoding::DynamicFlags::empty(),
6105            _decode,
6106        )
6107    }
6108}
6109
6110pub struct TargetHandlerEventStream {
6111    event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
6112}
6113
6114impl std::marker::Unpin for TargetHandlerEventStream {}
6115
6116impl futures::stream::FusedStream for TargetHandlerEventStream {
6117    fn is_terminated(&self) -> bool {
6118        self.event_receiver.is_terminated()
6119    }
6120}
6121
6122impl futures::Stream for TargetHandlerEventStream {
6123    type Item = Result<TargetHandlerEvent, fidl::Error>;
6124
6125    fn poll_next(
6126        mut self: std::pin::Pin<&mut Self>,
6127        cx: &mut std::task::Context<'_>,
6128    ) -> std::task::Poll<Option<Self::Item>> {
6129        match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
6130            &mut self.event_receiver,
6131            cx
6132        )?) {
6133            Some(buf) => std::task::Poll::Ready(Some(TargetHandlerEvent::decode(buf))),
6134            None => std::task::Poll::Ready(None),
6135        }
6136    }
6137}
6138
6139#[derive(Debug)]
6140pub enum TargetHandlerEvent {}
6141
6142impl TargetHandlerEvent {
6143    /// Decodes a message buffer as a [`TargetHandlerEvent`].
6144    fn decode(
6145        mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
6146    ) -> Result<TargetHandlerEvent, fidl::Error> {
6147        let (bytes, _handles) = buf.split_mut();
6148        let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
6149        debug_assert_eq!(tx_header.tx_id, 0);
6150        match tx_header.ordinal {
6151            _ => Err(fidl::Error::UnknownOrdinal {
6152                ordinal: tx_header.ordinal,
6153                protocol_name: <TargetHandlerMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
6154            }),
6155        }
6156    }
6157}
6158
6159/// A Stream of incoming requests for fuchsia.bluetooth.avrcp/TargetHandler.
6160pub struct TargetHandlerRequestStream {
6161    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
6162    is_terminated: bool,
6163}
6164
6165impl std::marker::Unpin for TargetHandlerRequestStream {}
6166
6167impl futures::stream::FusedStream for TargetHandlerRequestStream {
6168    fn is_terminated(&self) -> bool {
6169        self.is_terminated
6170    }
6171}
6172
6173impl fidl::endpoints::RequestStream for TargetHandlerRequestStream {
6174    type Protocol = TargetHandlerMarker;
6175    type ControlHandle = TargetHandlerControlHandle;
6176
6177    fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
6178        Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
6179    }
6180
6181    fn control_handle(&self) -> Self::ControlHandle {
6182        TargetHandlerControlHandle { inner: self.inner.clone() }
6183    }
6184
6185    fn into_inner(
6186        self,
6187    ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
6188    {
6189        (self.inner, self.is_terminated)
6190    }
6191
6192    fn from_inner(
6193        inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
6194        is_terminated: bool,
6195    ) -> Self {
6196        Self { inner, is_terminated }
6197    }
6198}
6199
6200impl futures::Stream for TargetHandlerRequestStream {
6201    type Item = Result<TargetHandlerRequest, fidl::Error>;
6202
6203    fn poll_next(
6204        mut self: std::pin::Pin<&mut Self>,
6205        cx: &mut std::task::Context<'_>,
6206    ) -> std::task::Poll<Option<Self::Item>> {
6207        let this = &mut *self;
6208        if this.inner.check_shutdown(cx) {
6209            this.is_terminated = true;
6210            return std::task::Poll::Ready(None);
6211        }
6212        if this.is_terminated {
6213            panic!("polled TargetHandlerRequestStream after completion");
6214        }
6215        fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
6216            |bytes, handles| {
6217                match this.inner.channel().read_etc(cx, bytes, handles) {
6218                    std::task::Poll::Ready(Ok(())) => {}
6219                    std::task::Poll::Pending => return std::task::Poll::Pending,
6220                    std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
6221                        this.is_terminated = true;
6222                        return std::task::Poll::Ready(None);
6223                    }
6224                    std::task::Poll::Ready(Err(e)) => {
6225                        return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
6226                            e.into(),
6227                        ))))
6228                    }
6229                }
6230
6231                // A message has been received from the channel
6232                let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
6233
6234                std::task::Poll::Ready(Some(match header.ordinal {
6235                    0x54bb8d817d5e1257 => {
6236                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
6237                        let mut req = fidl::new_empty!(
6238                            fidl::encoding::EmptyPayload,
6239                            fidl::encoding::DefaultFuchsiaResourceDialect
6240                        );
6241                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
6242                        let control_handle =
6243                            TargetHandlerControlHandle { inner: this.inner.clone() };
6244                        Ok(TargetHandlerRequest::GetEventsSupported {
6245                            responder: TargetHandlerGetEventsSupportedResponder {
6246                                control_handle: std::mem::ManuallyDrop::new(control_handle),
6247                                tx_id: header.tx_id,
6248                            },
6249                        })
6250                    }
6251                    0x629f354d2805daf5 => {
6252                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
6253                        let mut req = fidl::new_empty!(
6254                            fidl::encoding::EmptyPayload,
6255                            fidl::encoding::DefaultFuchsiaResourceDialect
6256                        );
6257                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
6258                        let control_handle =
6259                            TargetHandlerControlHandle { inner: this.inner.clone() };
6260                        Ok(TargetHandlerRequest::GetMediaAttributes {
6261                            responder: TargetHandlerGetMediaAttributesResponder {
6262                                control_handle: std::mem::ManuallyDrop::new(control_handle),
6263                                tx_id: header.tx_id,
6264                            },
6265                        })
6266                    }
6267                    0x24a4816300e14d89 => {
6268                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
6269                        let mut req = fidl::new_empty!(
6270                            fidl::encoding::EmptyPayload,
6271                            fidl::encoding::DefaultFuchsiaResourceDialect
6272                        );
6273                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
6274                        let control_handle =
6275                            TargetHandlerControlHandle { inner: this.inner.clone() };
6276                        Ok(TargetHandlerRequest::GetPlayStatus {
6277                            responder: TargetHandlerGetPlayStatusResponder {
6278                                control_handle: std::mem::ManuallyDrop::new(control_handle),
6279                                tx_id: header.tx_id,
6280                            },
6281                        })
6282                    }
6283                    0x69e063a8f6ab7b87 => {
6284                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
6285                        let mut req = fidl::new_empty!(
6286                            TargetHandlerSendCommandRequest,
6287                            fidl::encoding::DefaultFuchsiaResourceDialect
6288                        );
6289                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<TargetHandlerSendCommandRequest>(&header, _body_bytes, handles, &mut req)?;
6290                        let control_handle =
6291                            TargetHandlerControlHandle { inner: this.inner.clone() };
6292                        Ok(TargetHandlerRequest::SendCommand {
6293                            command: req.command,
6294                            pressed: req.pressed,
6295
6296                            responder: TargetHandlerSendCommandResponder {
6297                                control_handle: std::mem::ManuallyDrop::new(control_handle),
6298                                tx_id: header.tx_id,
6299                            },
6300                        })
6301                    }
6302                    0xdfa38da6a60b2 => {
6303                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
6304                        let mut req = fidl::new_empty!(
6305                            fidl::encoding::EmptyPayload,
6306                            fidl::encoding::DefaultFuchsiaResourceDialect
6307                        );
6308                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
6309                        let control_handle =
6310                            TargetHandlerControlHandle { inner: this.inner.clone() };
6311                        Ok(TargetHandlerRequest::ListPlayerApplicationSettingAttributes {
6312                            responder:
6313                                TargetHandlerListPlayerApplicationSettingAttributesResponder {
6314                                    control_handle: std::mem::ManuallyDrop::new(control_handle),
6315                                    tx_id: header.tx_id,
6316                                },
6317                        })
6318                    }
6319                    0x4273f96bdb752751 => {
6320                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
6321                        let mut req = fidl::new_empty!(
6322                            TargetHandlerGetPlayerApplicationSettingsRequest,
6323                            fidl::encoding::DefaultFuchsiaResourceDialect
6324                        );
6325                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<TargetHandlerGetPlayerApplicationSettingsRequest>(&header, _body_bytes, handles, &mut req)?;
6326                        let control_handle =
6327                            TargetHandlerControlHandle { inner: this.inner.clone() };
6328                        Ok(TargetHandlerRequest::GetPlayerApplicationSettings {
6329                            attribute_ids: req.attribute_ids,
6330
6331                            responder: TargetHandlerGetPlayerApplicationSettingsResponder {
6332                                control_handle: std::mem::ManuallyDrop::new(control_handle),
6333                                tx_id: header.tx_id,
6334                            },
6335                        })
6336                    }
6337                    0x636dd18255e01998 => {
6338                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
6339                        let mut req = fidl::new_empty!(
6340                            TargetHandlerSetPlayerApplicationSettingsRequest,
6341                            fidl::encoding::DefaultFuchsiaResourceDialect
6342                        );
6343                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<TargetHandlerSetPlayerApplicationSettingsRequest>(&header, _body_bytes, handles, &mut req)?;
6344                        let control_handle =
6345                            TargetHandlerControlHandle { inner: this.inner.clone() };
6346                        Ok(TargetHandlerRequest::SetPlayerApplicationSettings {
6347                            requested_settings: req.requested_settings,
6348
6349                            responder: TargetHandlerSetPlayerApplicationSettingsResponder {
6350                                control_handle: std::mem::ManuallyDrop::new(control_handle),
6351                                tx_id: header.tx_id,
6352                            },
6353                        })
6354                    }
6355                    0x60c7792539a032f1 => {
6356                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
6357                        let mut req = fidl::new_empty!(
6358                            TargetHandlerGetNotificationRequest,
6359                            fidl::encoding::DefaultFuchsiaResourceDialect
6360                        );
6361                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<TargetHandlerGetNotificationRequest>(&header, _body_bytes, handles, &mut req)?;
6362                        let control_handle =
6363                            TargetHandlerControlHandle { inner: this.inner.clone() };
6364                        Ok(TargetHandlerRequest::GetNotification {
6365                            event_id: req.event_id,
6366
6367                            responder: TargetHandlerGetNotificationResponder {
6368                                control_handle: std::mem::ManuallyDrop::new(control_handle),
6369                                tx_id: header.tx_id,
6370                            },
6371                        })
6372                    }
6373                    0x2a513434cf256e5f => {
6374                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
6375                        let mut req = fidl::new_empty!(
6376                            TargetHandlerWatchNotificationRequest,
6377                            fidl::encoding::DefaultFuchsiaResourceDialect
6378                        );
6379                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<TargetHandlerWatchNotificationRequest>(&header, _body_bytes, handles, &mut req)?;
6380                        let control_handle =
6381                            TargetHandlerControlHandle { inner: this.inner.clone() };
6382                        Ok(TargetHandlerRequest::WatchNotification {
6383                            event_id: req.event_id,
6384                            current: req.current,
6385                            pos_change_interval: req.pos_change_interval,
6386
6387                            responder: TargetHandlerWatchNotificationResponder {
6388                                control_handle: std::mem::ManuallyDrop::new(control_handle),
6389                                tx_id: header.tx_id,
6390                            },
6391                        })
6392                    }
6393                    0x6724ae8288c34d2f => {
6394                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
6395                        let mut req = fidl::new_empty!(
6396                            TargetHandlerSetAddressedPlayerRequest,
6397                            fidl::encoding::DefaultFuchsiaResourceDialect
6398                        );
6399                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<TargetHandlerSetAddressedPlayerRequest>(&header, _body_bytes, handles, &mut req)?;
6400                        let control_handle =
6401                            TargetHandlerControlHandle { inner: this.inner.clone() };
6402                        Ok(TargetHandlerRequest::SetAddressedPlayer {
6403                            player_id: req.player_id,
6404
6405                            responder: TargetHandlerSetAddressedPlayerResponder {
6406                                control_handle: std::mem::ManuallyDrop::new(control_handle),
6407                                tx_id: header.tx_id,
6408                            },
6409                        })
6410                    }
6411                    0x736668f5aa3a8246 => {
6412                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
6413                        let mut req = fidl::new_empty!(
6414                            fidl::encoding::EmptyPayload,
6415                            fidl::encoding::DefaultFuchsiaResourceDialect
6416                        );
6417                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
6418                        let control_handle =
6419                            TargetHandlerControlHandle { inner: this.inner.clone() };
6420                        Ok(TargetHandlerRequest::GetMediaPlayerItems {
6421                            responder: TargetHandlerGetMediaPlayerItemsResponder {
6422                                control_handle: std::mem::ManuallyDrop::new(control_handle),
6423                                tx_id: header.tx_id,
6424                            },
6425                        })
6426                    }
6427                    _ => Err(fidl::Error::UnknownOrdinal {
6428                        ordinal: header.ordinal,
6429                        protocol_name:
6430                            <TargetHandlerMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
6431                    }),
6432                }))
6433            },
6434        )
6435    }
6436}
6437
6438/// Client wrapper for the local target.
6439/// A client is a high level construct and does not represent a connection with a device.
6440#[derive(Debug)]
6441pub enum TargetHandlerRequest {
6442    /// Returns the event notification ids that are supported by the TG.
6443    GetEventsSupported { responder: TargetHandlerGetEventsSupportedResponder },
6444    /// Returns the currently playing media attributes.
6445    /// May send either the GetElementAttributes or GetItemAttributes command depending on what
6446    /// is supported.
6447    GetMediaAttributes { responder: TargetHandlerGetMediaAttributesResponder },
6448    /// Returns the status of the currently playing media.
6449    GetPlayStatus { responder: TargetHandlerGetPlayStatusResponder },
6450    /// Send an AV\C passthrough key command.
6451    /// If `key_pressed`, then the AV\C passthrough command shall be interpreted as a key
6452    /// press down event. Otherwise, the command shall be interpreted as a key release event.
6453    SendCommand {
6454        command: AvcPanelCommand,
6455        pressed: bool,
6456        responder: TargetHandlerSendCommandResponder,
6457    },
6458    /// Request the target device to provide all the target supported player application
6459    /// setting attributes.
6460    ListPlayerApplicationSettingAttributes {
6461        responder: TargetHandlerListPlayerApplicationSettingAttributesResponder,
6462    },
6463    /// Returns currently set player application setting values for the `attribute_ids`.
6464    /// If no `attribute_ids` are provided, this method will query the TG for all valid
6465    /// attribute ID's, and return the currently set player application setting values.
6466    GetPlayerApplicationSettings {
6467        attribute_ids: Vec<PlayerApplicationSettingAttributeId>,
6468        responder: TargetHandlerGetPlayerApplicationSettingsResponder,
6469    },
6470    /// Sets the player application settings specified by `requested_settings`. Only
6471    /// settings specified in the input `requested_settings` will be overwritten.
6472    /// Returns the actual settings that were set.
6473    /// Settings provided in the `requested_settings` that are unsupported or unknown
6474    /// will not be set; and `SetPlayerApplicationSettings` will not return an error.
6475    /// Instead, the returned `set_settings` will include only the settings that were
6476    /// successfully set on the remote target.
6477    SetPlayerApplicationSettings {
6478        requested_settings: PlayerApplicationSettings,
6479        responder: TargetHandlerSetPlayerApplicationSettingsResponder,
6480    },
6481    /// Returns the current value for the notification specified by `event_id`.
6482    GetNotification {
6483        event_id: NotificationEvent,
6484        responder: TargetHandlerGetNotificationResponder,
6485    },
6486    /// Returns the changed value of the notification specified by 'event_id'.
6487    /// A changed value refers to any value that is different than the input parameter
6488    /// `current` Notification value.
6489    /// `WatchNotification` will not respond until the Notification value associated
6490    /// with `event_id` has changed from the `current` Notification.
6491    WatchNotification {
6492        event_id: NotificationEvent,
6493        current: Notification,
6494        pos_change_interval: u32,
6495        responder: TargetHandlerWatchNotificationResponder,
6496    },
6497    /// Changes the addressed `player_id` on the target when multiple are supported.
6498    SetAddressedPlayer {
6499        player_id: AddressedPlayerId,
6500        responder: TargetHandlerSetAddressedPlayerResponder,
6501    },
6502    /// Returns a list of media player information about the players on the target.
6503    GetMediaPlayerItems { responder: TargetHandlerGetMediaPlayerItemsResponder },
6504}
6505
6506impl TargetHandlerRequest {
6507    #[allow(irrefutable_let_patterns)]
6508    pub fn into_get_events_supported(self) -> Option<(TargetHandlerGetEventsSupportedResponder)> {
6509        if let TargetHandlerRequest::GetEventsSupported { responder } = self {
6510            Some((responder))
6511        } else {
6512            None
6513        }
6514    }
6515
6516    #[allow(irrefutable_let_patterns)]
6517    pub fn into_get_media_attributes(self) -> Option<(TargetHandlerGetMediaAttributesResponder)> {
6518        if let TargetHandlerRequest::GetMediaAttributes { responder } = self {
6519            Some((responder))
6520        } else {
6521            None
6522        }
6523    }
6524
6525    #[allow(irrefutable_let_patterns)]
6526    pub fn into_get_play_status(self) -> Option<(TargetHandlerGetPlayStatusResponder)> {
6527        if let TargetHandlerRequest::GetPlayStatus { responder } = self {
6528            Some((responder))
6529        } else {
6530            None
6531        }
6532    }
6533
6534    #[allow(irrefutable_let_patterns)]
6535    pub fn into_send_command(
6536        self,
6537    ) -> Option<(AvcPanelCommand, bool, TargetHandlerSendCommandResponder)> {
6538        if let TargetHandlerRequest::SendCommand { command, pressed, responder } = self {
6539            Some((command, pressed, responder))
6540        } else {
6541            None
6542        }
6543    }
6544
6545    #[allow(irrefutable_let_patterns)]
6546    pub fn into_list_player_application_setting_attributes(
6547        self,
6548    ) -> Option<(TargetHandlerListPlayerApplicationSettingAttributesResponder)> {
6549        if let TargetHandlerRequest::ListPlayerApplicationSettingAttributes { responder } = self {
6550            Some((responder))
6551        } else {
6552            None
6553        }
6554    }
6555
6556    #[allow(irrefutable_let_patterns)]
6557    pub fn into_get_player_application_settings(
6558        self,
6559    ) -> Option<(
6560        Vec<PlayerApplicationSettingAttributeId>,
6561        TargetHandlerGetPlayerApplicationSettingsResponder,
6562    )> {
6563        if let TargetHandlerRequest::GetPlayerApplicationSettings { attribute_ids, responder } =
6564            self
6565        {
6566            Some((attribute_ids, responder))
6567        } else {
6568            None
6569        }
6570    }
6571
6572    #[allow(irrefutable_let_patterns)]
6573    pub fn into_set_player_application_settings(
6574        self,
6575    ) -> Option<(PlayerApplicationSettings, TargetHandlerSetPlayerApplicationSettingsResponder)>
6576    {
6577        if let TargetHandlerRequest::SetPlayerApplicationSettings {
6578            requested_settings,
6579            responder,
6580        } = self
6581        {
6582            Some((requested_settings, responder))
6583        } else {
6584            None
6585        }
6586    }
6587
6588    #[allow(irrefutable_let_patterns)]
6589    pub fn into_get_notification(
6590        self,
6591    ) -> Option<(NotificationEvent, TargetHandlerGetNotificationResponder)> {
6592        if let TargetHandlerRequest::GetNotification { event_id, responder } = self {
6593            Some((event_id, responder))
6594        } else {
6595            None
6596        }
6597    }
6598
6599    #[allow(irrefutable_let_patterns)]
6600    pub fn into_watch_notification(
6601        self,
6602    ) -> Option<(NotificationEvent, Notification, u32, TargetHandlerWatchNotificationResponder)>
6603    {
6604        if let TargetHandlerRequest::WatchNotification {
6605            event_id,
6606            current,
6607            pos_change_interval,
6608            responder,
6609        } = self
6610        {
6611            Some((event_id, current, pos_change_interval, responder))
6612        } else {
6613            None
6614        }
6615    }
6616
6617    #[allow(irrefutable_let_patterns)]
6618    pub fn into_set_addressed_player(
6619        self,
6620    ) -> Option<(AddressedPlayerId, TargetHandlerSetAddressedPlayerResponder)> {
6621        if let TargetHandlerRequest::SetAddressedPlayer { player_id, responder } = self {
6622            Some((player_id, responder))
6623        } else {
6624            None
6625        }
6626    }
6627
6628    #[allow(irrefutable_let_patterns)]
6629    pub fn into_get_media_player_items(
6630        self,
6631    ) -> Option<(TargetHandlerGetMediaPlayerItemsResponder)> {
6632        if let TargetHandlerRequest::GetMediaPlayerItems { responder } = self {
6633            Some((responder))
6634        } else {
6635            None
6636        }
6637    }
6638
6639    /// Name of the method defined in FIDL
6640    pub fn method_name(&self) -> &'static str {
6641        match *self {
6642            TargetHandlerRequest::GetEventsSupported { .. } => "get_events_supported",
6643            TargetHandlerRequest::GetMediaAttributes { .. } => "get_media_attributes",
6644            TargetHandlerRequest::GetPlayStatus { .. } => "get_play_status",
6645            TargetHandlerRequest::SendCommand { .. } => "send_command",
6646            TargetHandlerRequest::ListPlayerApplicationSettingAttributes { .. } => {
6647                "list_player_application_setting_attributes"
6648            }
6649            TargetHandlerRequest::GetPlayerApplicationSettings { .. } => {
6650                "get_player_application_settings"
6651            }
6652            TargetHandlerRequest::SetPlayerApplicationSettings { .. } => {
6653                "set_player_application_settings"
6654            }
6655            TargetHandlerRequest::GetNotification { .. } => "get_notification",
6656            TargetHandlerRequest::WatchNotification { .. } => "watch_notification",
6657            TargetHandlerRequest::SetAddressedPlayer { .. } => "set_addressed_player",
6658            TargetHandlerRequest::GetMediaPlayerItems { .. } => "get_media_player_items",
6659        }
6660    }
6661}
6662
6663#[derive(Debug, Clone)]
6664pub struct TargetHandlerControlHandle {
6665    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
6666}
6667
6668impl fidl::endpoints::ControlHandle for TargetHandlerControlHandle {
6669    fn shutdown(&self) {
6670        self.inner.shutdown()
6671    }
6672    fn shutdown_with_epitaph(&self, status: zx_status::Status) {
6673        self.inner.shutdown_with_epitaph(status)
6674    }
6675
6676    fn is_closed(&self) -> bool {
6677        self.inner.channel().is_closed()
6678    }
6679    fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
6680        self.inner.channel().on_closed()
6681    }
6682
6683    #[cfg(target_os = "fuchsia")]
6684    fn signal_peer(
6685        &self,
6686        clear_mask: zx::Signals,
6687        set_mask: zx::Signals,
6688    ) -> Result<(), zx_status::Status> {
6689        use fidl::Peered;
6690        self.inner.channel().signal_peer(clear_mask, set_mask)
6691    }
6692}
6693
6694impl TargetHandlerControlHandle {}
6695
6696#[must_use = "FIDL methods require a response to be sent"]
6697#[derive(Debug)]
6698pub struct TargetHandlerGetEventsSupportedResponder {
6699    control_handle: std::mem::ManuallyDrop<TargetHandlerControlHandle>,
6700    tx_id: u32,
6701}
6702
6703/// Set the the channel to be shutdown (see [`TargetHandlerControlHandle::shutdown`])
6704/// if the responder is dropped without sending a response, so that the client
6705/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
6706impl std::ops::Drop for TargetHandlerGetEventsSupportedResponder {
6707    fn drop(&mut self) {
6708        self.control_handle.shutdown();
6709        // Safety: drops once, never accessed again
6710        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
6711    }
6712}
6713
6714impl fidl::endpoints::Responder for TargetHandlerGetEventsSupportedResponder {
6715    type ControlHandle = TargetHandlerControlHandle;
6716
6717    fn control_handle(&self) -> &TargetHandlerControlHandle {
6718        &self.control_handle
6719    }
6720
6721    fn drop_without_shutdown(mut self) {
6722        // Safety: drops once, never accessed again due to mem::forget
6723        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
6724        // Prevent Drop from running (which would shut down the channel)
6725        std::mem::forget(self);
6726    }
6727}
6728
6729impl TargetHandlerGetEventsSupportedResponder {
6730    /// Sends a response to the FIDL transaction.
6731    ///
6732    /// Sets the channel to shutdown if an error occurs.
6733    pub fn send(
6734        self,
6735        mut result: Result<&[NotificationEvent], TargetAvcError>,
6736    ) -> Result<(), fidl::Error> {
6737        let _result = self.send_raw(result);
6738        if _result.is_err() {
6739            self.control_handle.shutdown();
6740        }
6741        self.drop_without_shutdown();
6742        _result
6743    }
6744
6745    /// Similar to "send" but does not shutdown the channel if an error occurs.
6746    pub fn send_no_shutdown_on_err(
6747        self,
6748        mut result: Result<&[NotificationEvent], TargetAvcError>,
6749    ) -> Result<(), fidl::Error> {
6750        let _result = self.send_raw(result);
6751        self.drop_without_shutdown();
6752        _result
6753    }
6754
6755    fn send_raw(
6756        &self,
6757        mut result: Result<&[NotificationEvent], TargetAvcError>,
6758    ) -> Result<(), fidl::Error> {
6759        self.control_handle.inner.send::<fidl::encoding::ResultType<
6760            TargetHandlerGetEventsSupportedResponse,
6761            TargetAvcError,
6762        >>(
6763            result.map(|notification_ids| (notification_ids,)),
6764            self.tx_id,
6765            0x54bb8d817d5e1257,
6766            fidl::encoding::DynamicFlags::empty(),
6767        )
6768    }
6769}
6770
6771#[must_use = "FIDL methods require a response to be sent"]
6772#[derive(Debug)]
6773pub struct TargetHandlerGetMediaAttributesResponder {
6774    control_handle: std::mem::ManuallyDrop<TargetHandlerControlHandle>,
6775    tx_id: u32,
6776}
6777
6778/// Set the the channel to be shutdown (see [`TargetHandlerControlHandle::shutdown`])
6779/// if the responder is dropped without sending a response, so that the client
6780/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
6781impl std::ops::Drop for TargetHandlerGetMediaAttributesResponder {
6782    fn drop(&mut self) {
6783        self.control_handle.shutdown();
6784        // Safety: drops once, never accessed again
6785        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
6786    }
6787}
6788
6789impl fidl::endpoints::Responder for TargetHandlerGetMediaAttributesResponder {
6790    type ControlHandle = TargetHandlerControlHandle;
6791
6792    fn control_handle(&self) -> &TargetHandlerControlHandle {
6793        &self.control_handle
6794    }
6795
6796    fn drop_without_shutdown(mut self) {
6797        // Safety: drops once, never accessed again due to mem::forget
6798        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
6799        // Prevent Drop from running (which would shut down the channel)
6800        std::mem::forget(self);
6801    }
6802}
6803
6804impl TargetHandlerGetMediaAttributesResponder {
6805    /// Sends a response to the FIDL transaction.
6806    ///
6807    /// Sets the channel to shutdown if an error occurs.
6808    pub fn send(
6809        self,
6810        mut result: Result<&MediaAttributes, TargetAvcError>,
6811    ) -> Result<(), fidl::Error> {
6812        let _result = self.send_raw(result);
6813        if _result.is_err() {
6814            self.control_handle.shutdown();
6815        }
6816        self.drop_without_shutdown();
6817        _result
6818    }
6819
6820    /// Similar to "send" but does not shutdown the channel if an error occurs.
6821    pub fn send_no_shutdown_on_err(
6822        self,
6823        mut result: Result<&MediaAttributes, TargetAvcError>,
6824    ) -> Result<(), fidl::Error> {
6825        let _result = self.send_raw(result);
6826        self.drop_without_shutdown();
6827        _result
6828    }
6829
6830    fn send_raw(
6831        &self,
6832        mut result: Result<&MediaAttributes, TargetAvcError>,
6833    ) -> Result<(), fidl::Error> {
6834        self.control_handle.inner.send::<fidl::encoding::ResultType<
6835            TargetHandlerGetMediaAttributesResponse,
6836            TargetAvcError,
6837        >>(
6838            result.map(|attributes| (attributes,)),
6839            self.tx_id,
6840            0x629f354d2805daf5,
6841            fidl::encoding::DynamicFlags::empty(),
6842        )
6843    }
6844}
6845
6846#[must_use = "FIDL methods require a response to be sent"]
6847#[derive(Debug)]
6848pub struct TargetHandlerGetPlayStatusResponder {
6849    control_handle: std::mem::ManuallyDrop<TargetHandlerControlHandle>,
6850    tx_id: u32,
6851}
6852
6853/// Set the the channel to be shutdown (see [`TargetHandlerControlHandle::shutdown`])
6854/// if the responder is dropped without sending a response, so that the client
6855/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
6856impl std::ops::Drop for TargetHandlerGetPlayStatusResponder {
6857    fn drop(&mut self) {
6858        self.control_handle.shutdown();
6859        // Safety: drops once, never accessed again
6860        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
6861    }
6862}
6863
6864impl fidl::endpoints::Responder for TargetHandlerGetPlayStatusResponder {
6865    type ControlHandle = TargetHandlerControlHandle;
6866
6867    fn control_handle(&self) -> &TargetHandlerControlHandle {
6868        &self.control_handle
6869    }
6870
6871    fn drop_without_shutdown(mut self) {
6872        // Safety: drops once, never accessed again due to mem::forget
6873        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
6874        // Prevent Drop from running (which would shut down the channel)
6875        std::mem::forget(self);
6876    }
6877}
6878
6879impl TargetHandlerGetPlayStatusResponder {
6880    /// Sends a response to the FIDL transaction.
6881    ///
6882    /// Sets the channel to shutdown if an error occurs.
6883    pub fn send(self, mut result: Result<&PlayStatus, TargetAvcError>) -> Result<(), fidl::Error> {
6884        let _result = self.send_raw(result);
6885        if _result.is_err() {
6886            self.control_handle.shutdown();
6887        }
6888        self.drop_without_shutdown();
6889        _result
6890    }
6891
6892    /// Similar to "send" but does not shutdown the channel if an error occurs.
6893    pub fn send_no_shutdown_on_err(
6894        self,
6895        mut result: Result<&PlayStatus, TargetAvcError>,
6896    ) -> Result<(), fidl::Error> {
6897        let _result = self.send_raw(result);
6898        self.drop_without_shutdown();
6899        _result
6900    }
6901
6902    fn send_raw(&self, mut result: Result<&PlayStatus, TargetAvcError>) -> Result<(), fidl::Error> {
6903        self.control_handle.inner.send::<fidl::encoding::ResultType<
6904            TargetHandlerGetPlayStatusResponse,
6905            TargetAvcError,
6906        >>(
6907            result.map(|play_status| (play_status,)),
6908            self.tx_id,
6909            0x24a4816300e14d89,
6910            fidl::encoding::DynamicFlags::empty(),
6911        )
6912    }
6913}
6914
6915#[must_use = "FIDL methods require a response to be sent"]
6916#[derive(Debug)]
6917pub struct TargetHandlerSendCommandResponder {
6918    control_handle: std::mem::ManuallyDrop<TargetHandlerControlHandle>,
6919    tx_id: u32,
6920}
6921
6922/// Set the the channel to be shutdown (see [`TargetHandlerControlHandle::shutdown`])
6923/// if the responder is dropped without sending a response, so that the client
6924/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
6925impl std::ops::Drop for TargetHandlerSendCommandResponder {
6926    fn drop(&mut self) {
6927        self.control_handle.shutdown();
6928        // Safety: drops once, never accessed again
6929        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
6930    }
6931}
6932
6933impl fidl::endpoints::Responder for TargetHandlerSendCommandResponder {
6934    type ControlHandle = TargetHandlerControlHandle;
6935
6936    fn control_handle(&self) -> &TargetHandlerControlHandle {
6937        &self.control_handle
6938    }
6939
6940    fn drop_without_shutdown(mut self) {
6941        // Safety: drops once, never accessed again due to mem::forget
6942        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
6943        // Prevent Drop from running (which would shut down the channel)
6944        std::mem::forget(self);
6945    }
6946}
6947
6948impl TargetHandlerSendCommandResponder {
6949    /// Sends a response to the FIDL transaction.
6950    ///
6951    /// Sets the channel to shutdown if an error occurs.
6952    pub fn send(self, mut result: Result<(), TargetPassthroughError>) -> Result<(), fidl::Error> {
6953        let _result = self.send_raw(result);
6954        if _result.is_err() {
6955            self.control_handle.shutdown();
6956        }
6957        self.drop_without_shutdown();
6958        _result
6959    }
6960
6961    /// Similar to "send" but does not shutdown the channel if an error occurs.
6962    pub fn send_no_shutdown_on_err(
6963        self,
6964        mut result: Result<(), TargetPassthroughError>,
6965    ) -> Result<(), fidl::Error> {
6966        let _result = self.send_raw(result);
6967        self.drop_without_shutdown();
6968        _result
6969    }
6970
6971    fn send_raw(&self, mut result: Result<(), TargetPassthroughError>) -> Result<(), fidl::Error> {
6972        self.control_handle.inner.send::<fidl::encoding::ResultType<
6973            fidl::encoding::EmptyStruct,
6974            TargetPassthroughError,
6975        >>(
6976            result,
6977            self.tx_id,
6978            0x69e063a8f6ab7b87,
6979            fidl::encoding::DynamicFlags::empty(),
6980        )
6981    }
6982}
6983
6984#[must_use = "FIDL methods require a response to be sent"]
6985#[derive(Debug)]
6986pub struct TargetHandlerListPlayerApplicationSettingAttributesResponder {
6987    control_handle: std::mem::ManuallyDrop<TargetHandlerControlHandle>,
6988    tx_id: u32,
6989}
6990
6991/// Set the the channel to be shutdown (see [`TargetHandlerControlHandle::shutdown`])
6992/// if the responder is dropped without sending a response, so that the client
6993/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
6994impl std::ops::Drop for TargetHandlerListPlayerApplicationSettingAttributesResponder {
6995    fn drop(&mut self) {
6996        self.control_handle.shutdown();
6997        // Safety: drops once, never accessed again
6998        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
6999    }
7000}
7001
7002impl fidl::endpoints::Responder for TargetHandlerListPlayerApplicationSettingAttributesResponder {
7003    type ControlHandle = TargetHandlerControlHandle;
7004
7005    fn control_handle(&self) -> &TargetHandlerControlHandle {
7006        &self.control_handle
7007    }
7008
7009    fn drop_without_shutdown(mut self) {
7010        // Safety: drops once, never accessed again due to mem::forget
7011        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
7012        // Prevent Drop from running (which would shut down the channel)
7013        std::mem::forget(self);
7014    }
7015}
7016
7017impl TargetHandlerListPlayerApplicationSettingAttributesResponder {
7018    /// Sends a response to the FIDL transaction.
7019    ///
7020    /// Sets the channel to shutdown if an error occurs.
7021    pub fn send(
7022        self,
7023        mut result: Result<&[PlayerApplicationSettingAttributeId], TargetAvcError>,
7024    ) -> Result<(), fidl::Error> {
7025        let _result = self.send_raw(result);
7026        if _result.is_err() {
7027            self.control_handle.shutdown();
7028        }
7029        self.drop_without_shutdown();
7030        _result
7031    }
7032
7033    /// Similar to "send" but does not shutdown the channel if an error occurs.
7034    pub fn send_no_shutdown_on_err(
7035        self,
7036        mut result: Result<&[PlayerApplicationSettingAttributeId], TargetAvcError>,
7037    ) -> Result<(), fidl::Error> {
7038        let _result = self.send_raw(result);
7039        self.drop_without_shutdown();
7040        _result
7041    }
7042
7043    fn send_raw(
7044        &self,
7045        mut result: Result<&[PlayerApplicationSettingAttributeId], TargetAvcError>,
7046    ) -> Result<(), fidl::Error> {
7047        self.control_handle.inner.send::<fidl::encoding::ResultType<
7048            TargetHandlerListPlayerApplicationSettingAttributesResponse,
7049            TargetAvcError,
7050        >>(
7051            result.map(|attributes| (attributes,)),
7052            self.tx_id,
7053            0xdfa38da6a60b2,
7054            fidl::encoding::DynamicFlags::empty(),
7055        )
7056    }
7057}
7058
7059#[must_use = "FIDL methods require a response to be sent"]
7060#[derive(Debug)]
7061pub struct TargetHandlerGetPlayerApplicationSettingsResponder {
7062    control_handle: std::mem::ManuallyDrop<TargetHandlerControlHandle>,
7063    tx_id: u32,
7064}
7065
7066/// Set the the channel to be shutdown (see [`TargetHandlerControlHandle::shutdown`])
7067/// if the responder is dropped without sending a response, so that the client
7068/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
7069impl std::ops::Drop for TargetHandlerGetPlayerApplicationSettingsResponder {
7070    fn drop(&mut self) {
7071        self.control_handle.shutdown();
7072        // Safety: drops once, never accessed again
7073        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
7074    }
7075}
7076
7077impl fidl::endpoints::Responder for TargetHandlerGetPlayerApplicationSettingsResponder {
7078    type ControlHandle = TargetHandlerControlHandle;
7079
7080    fn control_handle(&self) -> &TargetHandlerControlHandle {
7081        &self.control_handle
7082    }
7083
7084    fn drop_without_shutdown(mut self) {
7085        // Safety: drops once, never accessed again due to mem::forget
7086        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
7087        // Prevent Drop from running (which would shut down the channel)
7088        std::mem::forget(self);
7089    }
7090}
7091
7092impl TargetHandlerGetPlayerApplicationSettingsResponder {
7093    /// Sends a response to the FIDL transaction.
7094    ///
7095    /// Sets the channel to shutdown if an error occurs.
7096    pub fn send(
7097        self,
7098        mut result: Result<&PlayerApplicationSettings, TargetAvcError>,
7099    ) -> Result<(), fidl::Error> {
7100        let _result = self.send_raw(result);
7101        if _result.is_err() {
7102            self.control_handle.shutdown();
7103        }
7104        self.drop_without_shutdown();
7105        _result
7106    }
7107
7108    /// Similar to "send" but does not shutdown the channel if an error occurs.
7109    pub fn send_no_shutdown_on_err(
7110        self,
7111        mut result: Result<&PlayerApplicationSettings, TargetAvcError>,
7112    ) -> Result<(), fidl::Error> {
7113        let _result = self.send_raw(result);
7114        self.drop_without_shutdown();
7115        _result
7116    }
7117
7118    fn send_raw(
7119        &self,
7120        mut result: Result<&PlayerApplicationSettings, TargetAvcError>,
7121    ) -> Result<(), fidl::Error> {
7122        self.control_handle.inner.send::<fidl::encoding::ResultType<
7123            TargetHandlerGetPlayerApplicationSettingsResponse,
7124            TargetAvcError,
7125        >>(
7126            result.map(|current_settings| (current_settings,)),
7127            self.tx_id,
7128            0x4273f96bdb752751,
7129            fidl::encoding::DynamicFlags::empty(),
7130        )
7131    }
7132}
7133
7134#[must_use = "FIDL methods require a response to be sent"]
7135#[derive(Debug)]
7136pub struct TargetHandlerSetPlayerApplicationSettingsResponder {
7137    control_handle: std::mem::ManuallyDrop<TargetHandlerControlHandle>,
7138    tx_id: u32,
7139}
7140
7141/// Set the the channel to be shutdown (see [`TargetHandlerControlHandle::shutdown`])
7142/// if the responder is dropped without sending a response, so that the client
7143/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
7144impl std::ops::Drop for TargetHandlerSetPlayerApplicationSettingsResponder {
7145    fn drop(&mut self) {
7146        self.control_handle.shutdown();
7147        // Safety: drops once, never accessed again
7148        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
7149    }
7150}
7151
7152impl fidl::endpoints::Responder for TargetHandlerSetPlayerApplicationSettingsResponder {
7153    type ControlHandle = TargetHandlerControlHandle;
7154
7155    fn control_handle(&self) -> &TargetHandlerControlHandle {
7156        &self.control_handle
7157    }
7158
7159    fn drop_without_shutdown(mut self) {
7160        // Safety: drops once, never accessed again due to mem::forget
7161        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
7162        // Prevent Drop from running (which would shut down the channel)
7163        std::mem::forget(self);
7164    }
7165}
7166
7167impl TargetHandlerSetPlayerApplicationSettingsResponder {
7168    /// Sends a response to the FIDL transaction.
7169    ///
7170    /// Sets the channel to shutdown if an error occurs.
7171    pub fn send(
7172        self,
7173        mut result: Result<&PlayerApplicationSettings, TargetAvcError>,
7174    ) -> Result<(), fidl::Error> {
7175        let _result = self.send_raw(result);
7176        if _result.is_err() {
7177            self.control_handle.shutdown();
7178        }
7179        self.drop_without_shutdown();
7180        _result
7181    }
7182
7183    /// Similar to "send" but does not shutdown the channel if an error occurs.
7184    pub fn send_no_shutdown_on_err(
7185        self,
7186        mut result: Result<&PlayerApplicationSettings, TargetAvcError>,
7187    ) -> Result<(), fidl::Error> {
7188        let _result = self.send_raw(result);
7189        self.drop_without_shutdown();
7190        _result
7191    }
7192
7193    fn send_raw(
7194        &self,
7195        mut result: Result<&PlayerApplicationSettings, TargetAvcError>,
7196    ) -> Result<(), fidl::Error> {
7197        self.control_handle.inner.send::<fidl::encoding::ResultType<
7198            TargetHandlerSetPlayerApplicationSettingsResponse,
7199            TargetAvcError,
7200        >>(
7201            result.map(|set_settings| (set_settings,)),
7202            self.tx_id,
7203            0x636dd18255e01998,
7204            fidl::encoding::DynamicFlags::empty(),
7205        )
7206    }
7207}
7208
7209#[must_use = "FIDL methods require a response to be sent"]
7210#[derive(Debug)]
7211pub struct TargetHandlerGetNotificationResponder {
7212    control_handle: std::mem::ManuallyDrop<TargetHandlerControlHandle>,
7213    tx_id: u32,
7214}
7215
7216/// Set the the channel to be shutdown (see [`TargetHandlerControlHandle::shutdown`])
7217/// if the responder is dropped without sending a response, so that the client
7218/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
7219impl std::ops::Drop for TargetHandlerGetNotificationResponder {
7220    fn drop(&mut self) {
7221        self.control_handle.shutdown();
7222        // Safety: drops once, never accessed again
7223        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
7224    }
7225}
7226
7227impl fidl::endpoints::Responder for TargetHandlerGetNotificationResponder {
7228    type ControlHandle = TargetHandlerControlHandle;
7229
7230    fn control_handle(&self) -> &TargetHandlerControlHandle {
7231        &self.control_handle
7232    }
7233
7234    fn drop_without_shutdown(mut self) {
7235        // Safety: drops once, never accessed again due to mem::forget
7236        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
7237        // Prevent Drop from running (which would shut down the channel)
7238        std::mem::forget(self);
7239    }
7240}
7241
7242impl TargetHandlerGetNotificationResponder {
7243    /// Sends a response to the FIDL transaction.
7244    ///
7245    /// Sets the channel to shutdown if an error occurs.
7246    pub fn send(
7247        self,
7248        mut result: Result<&Notification, TargetAvcError>,
7249    ) -> Result<(), fidl::Error> {
7250        let _result = self.send_raw(result);
7251        if _result.is_err() {
7252            self.control_handle.shutdown();
7253        }
7254        self.drop_without_shutdown();
7255        _result
7256    }
7257
7258    /// Similar to "send" but does not shutdown the channel if an error occurs.
7259    pub fn send_no_shutdown_on_err(
7260        self,
7261        mut result: Result<&Notification, TargetAvcError>,
7262    ) -> Result<(), fidl::Error> {
7263        let _result = self.send_raw(result);
7264        self.drop_without_shutdown();
7265        _result
7266    }
7267
7268    fn send_raw(
7269        &self,
7270        mut result: Result<&Notification, TargetAvcError>,
7271    ) -> Result<(), fidl::Error> {
7272        self.control_handle.inner.send::<fidl::encoding::ResultType<
7273            TargetHandlerGetNotificationResponse,
7274            TargetAvcError,
7275        >>(
7276            result.map(|current_value| (current_value,)),
7277            self.tx_id,
7278            0x60c7792539a032f1,
7279            fidl::encoding::DynamicFlags::empty(),
7280        )
7281    }
7282}
7283
7284#[must_use = "FIDL methods require a response to be sent"]
7285#[derive(Debug)]
7286pub struct TargetHandlerWatchNotificationResponder {
7287    control_handle: std::mem::ManuallyDrop<TargetHandlerControlHandle>,
7288    tx_id: u32,
7289}
7290
7291/// Set the the channel to be shutdown (see [`TargetHandlerControlHandle::shutdown`])
7292/// if the responder is dropped without sending a response, so that the client
7293/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
7294impl std::ops::Drop for TargetHandlerWatchNotificationResponder {
7295    fn drop(&mut self) {
7296        self.control_handle.shutdown();
7297        // Safety: drops once, never accessed again
7298        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
7299    }
7300}
7301
7302impl fidl::endpoints::Responder for TargetHandlerWatchNotificationResponder {
7303    type ControlHandle = TargetHandlerControlHandle;
7304
7305    fn control_handle(&self) -> &TargetHandlerControlHandle {
7306        &self.control_handle
7307    }
7308
7309    fn drop_without_shutdown(mut self) {
7310        // Safety: drops once, never accessed again due to mem::forget
7311        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
7312        // Prevent Drop from running (which would shut down the channel)
7313        std::mem::forget(self);
7314    }
7315}
7316
7317impl TargetHandlerWatchNotificationResponder {
7318    /// Sends a response to the FIDL transaction.
7319    ///
7320    /// Sets the channel to shutdown if an error occurs.
7321    pub fn send(
7322        self,
7323        mut result: Result<&Notification, TargetAvcError>,
7324    ) -> Result<(), fidl::Error> {
7325        let _result = self.send_raw(result);
7326        if _result.is_err() {
7327            self.control_handle.shutdown();
7328        }
7329        self.drop_without_shutdown();
7330        _result
7331    }
7332
7333    /// Similar to "send" but does not shutdown the channel if an error occurs.
7334    pub fn send_no_shutdown_on_err(
7335        self,
7336        mut result: Result<&Notification, TargetAvcError>,
7337    ) -> Result<(), fidl::Error> {
7338        let _result = self.send_raw(result);
7339        self.drop_without_shutdown();
7340        _result
7341    }
7342
7343    fn send_raw(
7344        &self,
7345        mut result: Result<&Notification, TargetAvcError>,
7346    ) -> Result<(), fidl::Error> {
7347        self.control_handle.inner.send::<fidl::encoding::ResultType<
7348            TargetHandlerWatchNotificationResponse,
7349            TargetAvcError,
7350        >>(
7351            result.map(|new_value| (new_value,)),
7352            self.tx_id,
7353            0x2a513434cf256e5f,
7354            fidl::encoding::DynamicFlags::empty(),
7355        )
7356    }
7357}
7358
7359#[must_use = "FIDL methods require a response to be sent"]
7360#[derive(Debug)]
7361pub struct TargetHandlerSetAddressedPlayerResponder {
7362    control_handle: std::mem::ManuallyDrop<TargetHandlerControlHandle>,
7363    tx_id: u32,
7364}
7365
7366/// Set the the channel to be shutdown (see [`TargetHandlerControlHandle::shutdown`])
7367/// if the responder is dropped without sending a response, so that the client
7368/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
7369impl std::ops::Drop for TargetHandlerSetAddressedPlayerResponder {
7370    fn drop(&mut self) {
7371        self.control_handle.shutdown();
7372        // Safety: drops once, never accessed again
7373        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
7374    }
7375}
7376
7377impl fidl::endpoints::Responder for TargetHandlerSetAddressedPlayerResponder {
7378    type ControlHandle = TargetHandlerControlHandle;
7379
7380    fn control_handle(&self) -> &TargetHandlerControlHandle {
7381        &self.control_handle
7382    }
7383
7384    fn drop_without_shutdown(mut self) {
7385        // Safety: drops once, never accessed again due to mem::forget
7386        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
7387        // Prevent Drop from running (which would shut down the channel)
7388        std::mem::forget(self);
7389    }
7390}
7391
7392impl TargetHandlerSetAddressedPlayerResponder {
7393    /// Sends a response to the FIDL transaction.
7394    ///
7395    /// Sets the channel to shutdown if an error occurs.
7396    pub fn send(self, mut result: Result<(), TargetAvcError>) -> Result<(), fidl::Error> {
7397        let _result = self.send_raw(result);
7398        if _result.is_err() {
7399            self.control_handle.shutdown();
7400        }
7401        self.drop_without_shutdown();
7402        _result
7403    }
7404
7405    /// Similar to "send" but does not shutdown the channel if an error occurs.
7406    pub fn send_no_shutdown_on_err(
7407        self,
7408        mut result: Result<(), TargetAvcError>,
7409    ) -> Result<(), fidl::Error> {
7410        let _result = self.send_raw(result);
7411        self.drop_without_shutdown();
7412        _result
7413    }
7414
7415    fn send_raw(&self, mut result: Result<(), TargetAvcError>) -> Result<(), fidl::Error> {
7416        self.control_handle.inner.send::<fidl::encoding::ResultType<
7417            fidl::encoding::EmptyStruct,
7418            TargetAvcError,
7419        >>(
7420            result,
7421            self.tx_id,
7422            0x6724ae8288c34d2f,
7423            fidl::encoding::DynamicFlags::empty(),
7424        )
7425    }
7426}
7427
7428#[must_use = "FIDL methods require a response to be sent"]
7429#[derive(Debug)]
7430pub struct TargetHandlerGetMediaPlayerItemsResponder {
7431    control_handle: std::mem::ManuallyDrop<TargetHandlerControlHandle>,
7432    tx_id: u32,
7433}
7434
7435/// Set the the channel to be shutdown (see [`TargetHandlerControlHandle::shutdown`])
7436/// if the responder is dropped without sending a response, so that the client
7437/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
7438impl std::ops::Drop for TargetHandlerGetMediaPlayerItemsResponder {
7439    fn drop(&mut self) {
7440        self.control_handle.shutdown();
7441        // Safety: drops once, never accessed again
7442        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
7443    }
7444}
7445
7446impl fidl::endpoints::Responder for TargetHandlerGetMediaPlayerItemsResponder {
7447    type ControlHandle = TargetHandlerControlHandle;
7448
7449    fn control_handle(&self) -> &TargetHandlerControlHandle {
7450        &self.control_handle
7451    }
7452
7453    fn drop_without_shutdown(mut self) {
7454        // Safety: drops once, never accessed again due to mem::forget
7455        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
7456        // Prevent Drop from running (which would shut down the channel)
7457        std::mem::forget(self);
7458    }
7459}
7460
7461impl TargetHandlerGetMediaPlayerItemsResponder {
7462    /// Sends a response to the FIDL transaction.
7463    ///
7464    /// Sets the channel to shutdown if an error occurs.
7465    pub fn send(
7466        self,
7467        mut result: Result<&[MediaPlayerItem], TargetAvcError>,
7468    ) -> Result<(), fidl::Error> {
7469        let _result = self.send_raw(result);
7470        if _result.is_err() {
7471            self.control_handle.shutdown();
7472        }
7473        self.drop_without_shutdown();
7474        _result
7475    }
7476
7477    /// Similar to "send" but does not shutdown the channel if an error occurs.
7478    pub fn send_no_shutdown_on_err(
7479        self,
7480        mut result: Result<&[MediaPlayerItem], TargetAvcError>,
7481    ) -> Result<(), fidl::Error> {
7482        let _result = self.send_raw(result);
7483        self.drop_without_shutdown();
7484        _result
7485    }
7486
7487    fn send_raw(
7488        &self,
7489        mut result: Result<&[MediaPlayerItem], TargetAvcError>,
7490    ) -> Result<(), fidl::Error> {
7491        self.control_handle.inner.send::<fidl::encoding::ResultType<
7492            TargetHandlerGetMediaPlayerItemsResponse,
7493            TargetAvcError,
7494        >>(
7495            result.map(|items| (items,)),
7496            self.tx_id,
7497            0x736668f5aa3a8246,
7498            fidl::encoding::DynamicFlags::empty(),
7499        )
7500    }
7501}
7502
7503mod internal {
7504    use super::*;
7505
7506    impl fidl::encoding::ResourceTypeMarker for PeerManagerGetBrowseControllerForTargetRequest {
7507        type Borrowed<'a> = &'a mut Self;
7508        fn take_or_borrow<'a>(
7509            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
7510        ) -> Self::Borrowed<'a> {
7511            value
7512        }
7513    }
7514
7515    unsafe impl fidl::encoding::TypeMarker for PeerManagerGetBrowseControllerForTargetRequest {
7516        type Owned = Self;
7517
7518        #[inline(always)]
7519        fn inline_align(_context: fidl::encoding::Context) -> usize {
7520            8
7521        }
7522
7523        #[inline(always)]
7524        fn inline_size(_context: fidl::encoding::Context) -> usize {
7525            16
7526        }
7527    }
7528
7529    unsafe impl
7530        fidl::encoding::Encode<
7531            PeerManagerGetBrowseControllerForTargetRequest,
7532            fidl::encoding::DefaultFuchsiaResourceDialect,
7533        > for &mut PeerManagerGetBrowseControllerForTargetRequest
7534    {
7535        #[inline]
7536        unsafe fn encode(
7537            self,
7538            encoder: &mut fidl::encoding::Encoder<
7539                '_,
7540                fidl::encoding::DefaultFuchsiaResourceDialect,
7541            >,
7542            offset: usize,
7543            _depth: fidl::encoding::Depth,
7544        ) -> fidl::Result<()> {
7545            encoder.debug_check_bounds::<PeerManagerGetBrowseControllerForTargetRequest>(offset);
7546            // Delegate to tuple encoding.
7547            fidl::encoding::Encode::<PeerManagerGetBrowseControllerForTargetRequest, fidl::encoding::DefaultFuchsiaResourceDialect>::encode(
7548                (
7549                    <fidl_fuchsia_bluetooth::PeerId as fidl::encoding::ValueTypeMarker>::borrow(&self.peer_id),
7550                    <fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<BrowseControllerMarker>> as fidl::encoding::ResourceTypeMarker>::take_or_borrow(&mut self.client),
7551                ),
7552                encoder, offset, _depth
7553            )
7554        }
7555    }
7556    unsafe impl<
7557            T0: fidl::encoding::Encode<
7558                fidl_fuchsia_bluetooth::PeerId,
7559                fidl::encoding::DefaultFuchsiaResourceDialect,
7560            >,
7561            T1: fidl::encoding::Encode<
7562                fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<BrowseControllerMarker>>,
7563                fidl::encoding::DefaultFuchsiaResourceDialect,
7564            >,
7565        >
7566        fidl::encoding::Encode<
7567            PeerManagerGetBrowseControllerForTargetRequest,
7568            fidl::encoding::DefaultFuchsiaResourceDialect,
7569        > for (T0, T1)
7570    {
7571        #[inline]
7572        unsafe fn encode(
7573            self,
7574            encoder: &mut fidl::encoding::Encoder<
7575                '_,
7576                fidl::encoding::DefaultFuchsiaResourceDialect,
7577            >,
7578            offset: usize,
7579            depth: fidl::encoding::Depth,
7580        ) -> fidl::Result<()> {
7581            encoder.debug_check_bounds::<PeerManagerGetBrowseControllerForTargetRequest>(offset);
7582            // Zero out padding regions. There's no need to apply masks
7583            // because the unmasked parts will be overwritten by fields.
7584            unsafe {
7585                let ptr = encoder.buf.as_mut_ptr().add(offset).offset(8);
7586                (ptr as *mut u64).write_unaligned(0);
7587            }
7588            // Write the fields.
7589            self.0.encode(encoder, offset + 0, depth)?;
7590            self.1.encode(encoder, offset + 8, depth)?;
7591            Ok(())
7592        }
7593    }
7594
7595    impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
7596        for PeerManagerGetBrowseControllerForTargetRequest
7597    {
7598        #[inline(always)]
7599        fn new_empty() -> Self {
7600            Self {
7601                peer_id: fidl::new_empty!(
7602                    fidl_fuchsia_bluetooth::PeerId,
7603                    fidl::encoding::DefaultFuchsiaResourceDialect
7604                ),
7605                client: fidl::new_empty!(
7606                    fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<BrowseControllerMarker>>,
7607                    fidl::encoding::DefaultFuchsiaResourceDialect
7608                ),
7609            }
7610        }
7611
7612        #[inline]
7613        unsafe fn decode(
7614            &mut self,
7615            decoder: &mut fidl::encoding::Decoder<
7616                '_,
7617                fidl::encoding::DefaultFuchsiaResourceDialect,
7618            >,
7619            offset: usize,
7620            _depth: fidl::encoding::Depth,
7621        ) -> fidl::Result<()> {
7622            decoder.debug_check_bounds::<Self>(offset);
7623            // Verify that padding bytes are zero.
7624            let ptr = unsafe { decoder.buf.as_ptr().add(offset).offset(8) };
7625            let padval = unsafe { (ptr as *const u64).read_unaligned() };
7626            let mask = 0xffffffff00000000u64;
7627            let maskedval = padval & mask;
7628            if maskedval != 0 {
7629                return Err(fidl::Error::NonZeroPadding {
7630                    padding_start: offset + 8 + ((mask as u64).trailing_zeros() / 8) as usize,
7631                });
7632            }
7633            fidl::decode!(
7634                fidl_fuchsia_bluetooth::PeerId,
7635                fidl::encoding::DefaultFuchsiaResourceDialect,
7636                &mut self.peer_id,
7637                decoder,
7638                offset + 0,
7639                _depth
7640            )?;
7641            fidl::decode!(
7642                fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<BrowseControllerMarker>>,
7643                fidl::encoding::DefaultFuchsiaResourceDialect,
7644                &mut self.client,
7645                decoder,
7646                offset + 8,
7647                _depth
7648            )?;
7649            Ok(())
7650        }
7651    }
7652
7653    impl fidl::encoding::ResourceTypeMarker for PeerManagerGetControllerForTargetRequest {
7654        type Borrowed<'a> = &'a mut Self;
7655        fn take_or_borrow<'a>(
7656            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
7657        ) -> Self::Borrowed<'a> {
7658            value
7659        }
7660    }
7661
7662    unsafe impl fidl::encoding::TypeMarker for PeerManagerGetControllerForTargetRequest {
7663        type Owned = Self;
7664
7665        #[inline(always)]
7666        fn inline_align(_context: fidl::encoding::Context) -> usize {
7667            8
7668        }
7669
7670        #[inline(always)]
7671        fn inline_size(_context: fidl::encoding::Context) -> usize {
7672            16
7673        }
7674    }
7675
7676    unsafe impl
7677        fidl::encoding::Encode<
7678            PeerManagerGetControllerForTargetRequest,
7679            fidl::encoding::DefaultFuchsiaResourceDialect,
7680        > for &mut PeerManagerGetControllerForTargetRequest
7681    {
7682        #[inline]
7683        unsafe fn encode(
7684            self,
7685            encoder: &mut fidl::encoding::Encoder<
7686                '_,
7687                fidl::encoding::DefaultFuchsiaResourceDialect,
7688            >,
7689            offset: usize,
7690            _depth: fidl::encoding::Depth,
7691        ) -> fidl::Result<()> {
7692            encoder.debug_check_bounds::<PeerManagerGetControllerForTargetRequest>(offset);
7693            // Delegate to tuple encoding.
7694            fidl::encoding::Encode::<PeerManagerGetControllerForTargetRequest, fidl::encoding::DefaultFuchsiaResourceDialect>::encode(
7695                (
7696                    <fidl_fuchsia_bluetooth::PeerId as fidl::encoding::ValueTypeMarker>::borrow(&self.peer_id),
7697                    <fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<ControllerMarker>> as fidl::encoding::ResourceTypeMarker>::take_or_borrow(&mut self.client),
7698                ),
7699                encoder, offset, _depth
7700            )
7701        }
7702    }
7703    unsafe impl<
7704            T0: fidl::encoding::Encode<
7705                fidl_fuchsia_bluetooth::PeerId,
7706                fidl::encoding::DefaultFuchsiaResourceDialect,
7707            >,
7708            T1: fidl::encoding::Encode<
7709                fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<ControllerMarker>>,
7710                fidl::encoding::DefaultFuchsiaResourceDialect,
7711            >,
7712        >
7713        fidl::encoding::Encode<
7714            PeerManagerGetControllerForTargetRequest,
7715            fidl::encoding::DefaultFuchsiaResourceDialect,
7716        > for (T0, T1)
7717    {
7718        #[inline]
7719        unsafe fn encode(
7720            self,
7721            encoder: &mut fidl::encoding::Encoder<
7722                '_,
7723                fidl::encoding::DefaultFuchsiaResourceDialect,
7724            >,
7725            offset: usize,
7726            depth: fidl::encoding::Depth,
7727        ) -> fidl::Result<()> {
7728            encoder.debug_check_bounds::<PeerManagerGetControllerForTargetRequest>(offset);
7729            // Zero out padding regions. There's no need to apply masks
7730            // because the unmasked parts will be overwritten by fields.
7731            unsafe {
7732                let ptr = encoder.buf.as_mut_ptr().add(offset).offset(8);
7733                (ptr as *mut u64).write_unaligned(0);
7734            }
7735            // Write the fields.
7736            self.0.encode(encoder, offset + 0, depth)?;
7737            self.1.encode(encoder, offset + 8, depth)?;
7738            Ok(())
7739        }
7740    }
7741
7742    impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
7743        for PeerManagerGetControllerForTargetRequest
7744    {
7745        #[inline(always)]
7746        fn new_empty() -> Self {
7747            Self {
7748                peer_id: fidl::new_empty!(
7749                    fidl_fuchsia_bluetooth::PeerId,
7750                    fidl::encoding::DefaultFuchsiaResourceDialect
7751                ),
7752                client: fidl::new_empty!(
7753                    fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<ControllerMarker>>,
7754                    fidl::encoding::DefaultFuchsiaResourceDialect
7755                ),
7756            }
7757        }
7758
7759        #[inline]
7760        unsafe fn decode(
7761            &mut self,
7762            decoder: &mut fidl::encoding::Decoder<
7763                '_,
7764                fidl::encoding::DefaultFuchsiaResourceDialect,
7765            >,
7766            offset: usize,
7767            _depth: fidl::encoding::Depth,
7768        ) -> fidl::Result<()> {
7769            decoder.debug_check_bounds::<Self>(offset);
7770            // Verify that padding bytes are zero.
7771            let ptr = unsafe { decoder.buf.as_ptr().add(offset).offset(8) };
7772            let padval = unsafe { (ptr as *const u64).read_unaligned() };
7773            let mask = 0xffffffff00000000u64;
7774            let maskedval = padval & mask;
7775            if maskedval != 0 {
7776                return Err(fidl::Error::NonZeroPadding {
7777                    padding_start: offset + 8 + ((mask as u64).trailing_zeros() / 8) as usize,
7778                });
7779            }
7780            fidl::decode!(
7781                fidl_fuchsia_bluetooth::PeerId,
7782                fidl::encoding::DefaultFuchsiaResourceDialect,
7783                &mut self.peer_id,
7784                decoder,
7785                offset + 0,
7786                _depth
7787            )?;
7788            fidl::decode!(
7789                fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<ControllerMarker>>,
7790                fidl::encoding::DefaultFuchsiaResourceDialect,
7791                &mut self.client,
7792                decoder,
7793                offset + 8,
7794                _depth
7795            )?;
7796            Ok(())
7797        }
7798    }
7799
7800    impl fidl::encoding::ResourceTypeMarker for PeerManagerRegisterTargetHandlerRequest {
7801        type Borrowed<'a> = &'a mut Self;
7802        fn take_or_borrow<'a>(
7803            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
7804        ) -> Self::Borrowed<'a> {
7805            value
7806        }
7807    }
7808
7809    unsafe impl fidl::encoding::TypeMarker for PeerManagerRegisterTargetHandlerRequest {
7810        type Owned = Self;
7811
7812        #[inline(always)]
7813        fn inline_align(_context: fidl::encoding::Context) -> usize {
7814            4
7815        }
7816
7817        #[inline(always)]
7818        fn inline_size(_context: fidl::encoding::Context) -> usize {
7819            4
7820        }
7821    }
7822
7823    unsafe impl
7824        fidl::encoding::Encode<
7825            PeerManagerRegisterTargetHandlerRequest,
7826            fidl::encoding::DefaultFuchsiaResourceDialect,
7827        > for &mut PeerManagerRegisterTargetHandlerRequest
7828    {
7829        #[inline]
7830        unsafe fn encode(
7831            self,
7832            encoder: &mut fidl::encoding::Encoder<
7833                '_,
7834                fidl::encoding::DefaultFuchsiaResourceDialect,
7835            >,
7836            offset: usize,
7837            _depth: fidl::encoding::Depth,
7838        ) -> fidl::Result<()> {
7839            encoder.debug_check_bounds::<PeerManagerRegisterTargetHandlerRequest>(offset);
7840            // Delegate to tuple encoding.
7841            fidl::encoding::Encode::<PeerManagerRegisterTargetHandlerRequest, fidl::encoding::DefaultFuchsiaResourceDialect>::encode(
7842                (
7843                    <fidl::encoding::Endpoint<fidl::endpoints::ClientEnd<TargetHandlerMarker>> as fidl::encoding::ResourceTypeMarker>::take_or_borrow(&mut self.handler),
7844                ),
7845                encoder, offset, _depth
7846            )
7847        }
7848    }
7849    unsafe impl<
7850            T0: fidl::encoding::Encode<
7851                fidl::encoding::Endpoint<fidl::endpoints::ClientEnd<TargetHandlerMarker>>,
7852                fidl::encoding::DefaultFuchsiaResourceDialect,
7853            >,
7854        >
7855        fidl::encoding::Encode<
7856            PeerManagerRegisterTargetHandlerRequest,
7857            fidl::encoding::DefaultFuchsiaResourceDialect,
7858        > for (T0,)
7859    {
7860        #[inline]
7861        unsafe fn encode(
7862            self,
7863            encoder: &mut fidl::encoding::Encoder<
7864                '_,
7865                fidl::encoding::DefaultFuchsiaResourceDialect,
7866            >,
7867            offset: usize,
7868            depth: fidl::encoding::Depth,
7869        ) -> fidl::Result<()> {
7870            encoder.debug_check_bounds::<PeerManagerRegisterTargetHandlerRequest>(offset);
7871            // Zero out padding regions. There's no need to apply masks
7872            // because the unmasked parts will be overwritten by fields.
7873            // Write the fields.
7874            self.0.encode(encoder, offset + 0, depth)?;
7875            Ok(())
7876        }
7877    }
7878
7879    impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
7880        for PeerManagerRegisterTargetHandlerRequest
7881    {
7882        #[inline(always)]
7883        fn new_empty() -> Self {
7884            Self {
7885                handler: fidl::new_empty!(
7886                    fidl::encoding::Endpoint<fidl::endpoints::ClientEnd<TargetHandlerMarker>>,
7887                    fidl::encoding::DefaultFuchsiaResourceDialect
7888                ),
7889            }
7890        }
7891
7892        #[inline]
7893        unsafe fn decode(
7894            &mut self,
7895            decoder: &mut fidl::encoding::Decoder<
7896                '_,
7897                fidl::encoding::DefaultFuchsiaResourceDialect,
7898            >,
7899            offset: usize,
7900            _depth: fidl::encoding::Depth,
7901        ) -> fidl::Result<()> {
7902            decoder.debug_check_bounds::<Self>(offset);
7903            // Verify that padding bytes are zero.
7904            fidl::decode!(
7905                fidl::encoding::Endpoint<fidl::endpoints::ClientEnd<TargetHandlerMarker>>,
7906                fidl::encoding::DefaultFuchsiaResourceDialect,
7907                &mut self.handler,
7908                decoder,
7909                offset + 0,
7910                _depth
7911            )?;
7912            Ok(())
7913        }
7914    }
7915
7916    impl fidl::encoding::ResourceTypeMarker for PeerManagerSetAbsoluteVolumeHandlerRequest {
7917        type Borrowed<'a> = &'a mut Self;
7918        fn take_or_borrow<'a>(
7919            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
7920        ) -> Self::Borrowed<'a> {
7921            value
7922        }
7923    }
7924
7925    unsafe impl fidl::encoding::TypeMarker for PeerManagerSetAbsoluteVolumeHandlerRequest {
7926        type Owned = Self;
7927
7928        #[inline(always)]
7929        fn inline_align(_context: fidl::encoding::Context) -> usize {
7930            4
7931        }
7932
7933        #[inline(always)]
7934        fn inline_size(_context: fidl::encoding::Context) -> usize {
7935            4
7936        }
7937    }
7938
7939    unsafe impl
7940        fidl::encoding::Encode<
7941            PeerManagerSetAbsoluteVolumeHandlerRequest,
7942            fidl::encoding::DefaultFuchsiaResourceDialect,
7943        > for &mut PeerManagerSetAbsoluteVolumeHandlerRequest
7944    {
7945        #[inline]
7946        unsafe fn encode(
7947            self,
7948            encoder: &mut fidl::encoding::Encoder<
7949                '_,
7950                fidl::encoding::DefaultFuchsiaResourceDialect,
7951            >,
7952            offset: usize,
7953            _depth: fidl::encoding::Depth,
7954        ) -> fidl::Result<()> {
7955            encoder.debug_check_bounds::<PeerManagerSetAbsoluteVolumeHandlerRequest>(offset);
7956            // Delegate to tuple encoding.
7957            fidl::encoding::Encode::<
7958                PeerManagerSetAbsoluteVolumeHandlerRequest,
7959                fidl::encoding::DefaultFuchsiaResourceDialect,
7960            >::encode(
7961                (
7962                    <fidl::encoding::Endpoint<
7963                        fidl::endpoints::ClientEnd<AbsoluteVolumeHandlerMarker>,
7964                    > as fidl::encoding::ResourceTypeMarker>::take_or_borrow(
7965                        &mut self.handler
7966                    ),
7967                ),
7968                encoder,
7969                offset,
7970                _depth,
7971            )
7972        }
7973    }
7974    unsafe impl<
7975            T0: fidl::encoding::Encode<
7976                fidl::encoding::Endpoint<fidl::endpoints::ClientEnd<AbsoluteVolumeHandlerMarker>>,
7977                fidl::encoding::DefaultFuchsiaResourceDialect,
7978            >,
7979        >
7980        fidl::encoding::Encode<
7981            PeerManagerSetAbsoluteVolumeHandlerRequest,
7982            fidl::encoding::DefaultFuchsiaResourceDialect,
7983        > for (T0,)
7984    {
7985        #[inline]
7986        unsafe fn encode(
7987            self,
7988            encoder: &mut fidl::encoding::Encoder<
7989                '_,
7990                fidl::encoding::DefaultFuchsiaResourceDialect,
7991            >,
7992            offset: usize,
7993            depth: fidl::encoding::Depth,
7994        ) -> fidl::Result<()> {
7995            encoder.debug_check_bounds::<PeerManagerSetAbsoluteVolumeHandlerRequest>(offset);
7996            // Zero out padding regions. There's no need to apply masks
7997            // because the unmasked parts will be overwritten by fields.
7998            // Write the fields.
7999            self.0.encode(encoder, offset + 0, depth)?;
8000            Ok(())
8001        }
8002    }
8003
8004    impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
8005        for PeerManagerSetAbsoluteVolumeHandlerRequest
8006    {
8007        #[inline(always)]
8008        fn new_empty() -> Self {
8009            Self {
8010                handler: fidl::new_empty!(
8011                    fidl::encoding::Endpoint<
8012                        fidl::endpoints::ClientEnd<AbsoluteVolumeHandlerMarker>,
8013                    >,
8014                    fidl::encoding::DefaultFuchsiaResourceDialect
8015                ),
8016            }
8017        }
8018
8019        #[inline]
8020        unsafe fn decode(
8021            &mut self,
8022            decoder: &mut fidl::encoding::Decoder<
8023                '_,
8024                fidl::encoding::DefaultFuchsiaResourceDialect,
8025            >,
8026            offset: usize,
8027            _depth: fidl::encoding::Depth,
8028        ) -> fidl::Result<()> {
8029            decoder.debug_check_bounds::<Self>(offset);
8030            // Verify that padding bytes are zero.
8031            fidl::decode!(
8032                fidl::encoding::Endpoint<fidl::endpoints::ClientEnd<AbsoluteVolumeHandlerMarker>>,
8033                fidl::encoding::DefaultFuchsiaResourceDialect,
8034                &mut self.handler,
8035                decoder,
8036                offset + 0,
8037                _depth
8038            )?;
8039            Ok(())
8040        }
8041    }
8042}