fidl_fuchsia_bluetooth_avrcp/
fidl_fuchsia_bluetooth_avrcp.rs

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