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