Skip to main content

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