1#![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_test_common::*;
11use futures::future::{self, MaybeDone, TryFutureExt};
12use zx_status;
13
14#[derive(Debug, PartialEq)]
15pub struct PeerManagerExtGetBrowseControllerForTargetRequest {
16 pub peer_id: fidl_fuchsia_bluetooth::PeerId,
17 pub client: fidl::endpoints::ServerEnd<BrowseControllerExtMarker>,
18}
19
20impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect>
21 for PeerManagerExtGetBrowseControllerForTargetRequest
22{
23}
24
25#[derive(Debug, PartialEq)]
26pub struct PeerManagerExtGetControllerForTargetRequest {
27 pub peer_id: fidl_fuchsia_bluetooth::PeerId,
28 pub client: fidl::endpoints::ServerEnd<ControllerExtMarker>,
29}
30
31impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect>
32 for PeerManagerExtGetControllerForTargetRequest
33{
34}
35
36#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
37pub struct BrowseControllerExtMarker;
38
39impl fidl::endpoints::ProtocolMarker for BrowseControllerExtMarker {
40 type Proxy = BrowseControllerExtProxy;
41 type RequestStream = BrowseControllerExtRequestStream;
42 #[cfg(target_os = "fuchsia")]
43 type SynchronousProxy = BrowseControllerExtSynchronousProxy;
44
45 const DEBUG_NAME: &'static str = "(anonymous) BrowseControllerExt";
46}
47pub type BrowseControllerExtSendRawBrowseCommandResult =
48 Result<Vec<u8>, fidl_fuchsia_bluetooth_avrcp::BrowseControllerError>;
49
50pub trait BrowseControllerExtProxyInterface: Send + Sync {
51 type IsConnectedResponseFut: std::future::Future<Output = Result<bool, fidl::Error>> + Send;
52 fn r#is_connected(&self) -> Self::IsConnectedResponseFut;
53 type SendRawBrowseCommandResponseFut: std::future::Future<
54 Output = Result<BrowseControllerExtSendRawBrowseCommandResult, fidl::Error>,
55 > + Send;
56 fn r#send_raw_browse_command(
57 &self,
58 pdu_id: u8,
59 command: &[u8],
60 ) -> Self::SendRawBrowseCommandResponseFut;
61}
62#[derive(Debug)]
63#[cfg(target_os = "fuchsia")]
64pub struct BrowseControllerExtSynchronousProxy {
65 client: fidl::client::sync::Client,
66}
67
68#[cfg(target_os = "fuchsia")]
69impl fidl::endpoints::SynchronousProxy for BrowseControllerExtSynchronousProxy {
70 type Proxy = BrowseControllerExtProxy;
71 type Protocol = BrowseControllerExtMarker;
72
73 fn from_channel(inner: fidl::Channel) -> Self {
74 Self::new(inner)
75 }
76
77 fn into_channel(self) -> fidl::Channel {
78 self.client.into_channel()
79 }
80
81 fn as_channel(&self) -> &fidl::Channel {
82 self.client.as_channel()
83 }
84}
85
86#[cfg(target_os = "fuchsia")]
87impl BrowseControllerExtSynchronousProxy {
88 pub fn new(channel: fidl::Channel) -> Self {
89 let protocol_name =
90 <BrowseControllerExtMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
91 Self { client: fidl::client::sync::Client::new(channel, protocol_name) }
92 }
93
94 pub fn into_channel(self) -> fidl::Channel {
95 self.client.into_channel()
96 }
97
98 pub fn wait_for_event(
101 &self,
102 deadline: zx::MonotonicInstant,
103 ) -> Result<BrowseControllerExtEvent, fidl::Error> {
104 BrowseControllerExtEvent::decode(self.client.wait_for_event(deadline)?)
105 }
106
107 pub fn r#is_connected(&self, ___deadline: zx::MonotonicInstant) -> Result<bool, fidl::Error> {
109 let _response = self
110 .client
111 .send_query::<fidl::encoding::EmptyPayload, BrowseControllerExtIsConnectedResponse>(
112 (),
113 0x276450990f1915b6,
114 fidl::encoding::DynamicFlags::empty(),
115 ___deadline,
116 )?;
117 Ok(_response.connected)
118 }
119
120 pub fn r#send_raw_browse_command(
126 &self,
127 mut pdu_id: u8,
128 mut command: &[u8],
129 ___deadline: zx::MonotonicInstant,
130 ) -> Result<BrowseControllerExtSendRawBrowseCommandResult, fidl::Error> {
131 let _response = self.client.send_query::<
132 BrowseControllerExtSendRawBrowseCommandRequest,
133 fidl::encoding::ResultType<BrowseControllerExtSendRawBrowseCommandResponse, fidl_fuchsia_bluetooth_avrcp::BrowseControllerError>,
134 >(
135 (pdu_id, command,),
136 0x7346e59b68ac4a71,
137 fidl::encoding::DynamicFlags::empty(),
138 ___deadline,
139 )?;
140 Ok(_response.map(|x| x.response))
141 }
142}
143
144#[cfg(target_os = "fuchsia")]
145impl From<BrowseControllerExtSynchronousProxy> for zx::Handle {
146 fn from(value: BrowseControllerExtSynchronousProxy) -> Self {
147 value.into_channel().into()
148 }
149}
150
151#[cfg(target_os = "fuchsia")]
152impl From<fidl::Channel> for BrowseControllerExtSynchronousProxy {
153 fn from(value: fidl::Channel) -> Self {
154 Self::new(value)
155 }
156}
157
158#[derive(Debug, Clone)]
159pub struct BrowseControllerExtProxy {
160 client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
161}
162
163impl fidl::endpoints::Proxy for BrowseControllerExtProxy {
164 type Protocol = BrowseControllerExtMarker;
165
166 fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
167 Self::new(inner)
168 }
169
170 fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
171 self.client.into_channel().map_err(|client| Self { client })
172 }
173
174 fn as_channel(&self) -> &::fidl::AsyncChannel {
175 self.client.as_channel()
176 }
177}
178
179impl BrowseControllerExtProxy {
180 pub fn new(channel: ::fidl::AsyncChannel) -> Self {
182 let protocol_name =
183 <BrowseControllerExtMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
184 Self { client: fidl::client::Client::new(channel, protocol_name) }
185 }
186
187 pub fn take_event_stream(&self) -> BrowseControllerExtEventStream {
193 BrowseControllerExtEventStream { event_receiver: self.client.take_event_receiver() }
194 }
195
196 pub fn r#is_connected(
198 &self,
199 ) -> fidl::client::QueryResponseFut<bool, fidl::encoding::DefaultFuchsiaResourceDialect> {
200 BrowseControllerExtProxyInterface::r#is_connected(self)
201 }
202
203 pub fn r#send_raw_browse_command(
209 &self,
210 mut pdu_id: u8,
211 mut command: &[u8],
212 ) -> fidl::client::QueryResponseFut<
213 BrowseControllerExtSendRawBrowseCommandResult,
214 fidl::encoding::DefaultFuchsiaResourceDialect,
215 > {
216 BrowseControllerExtProxyInterface::r#send_raw_browse_command(self, pdu_id, command)
217 }
218}
219
220impl BrowseControllerExtProxyInterface for BrowseControllerExtProxy {
221 type IsConnectedResponseFut =
222 fidl::client::QueryResponseFut<bool, fidl::encoding::DefaultFuchsiaResourceDialect>;
223 fn r#is_connected(&self) -> Self::IsConnectedResponseFut {
224 fn _decode(
225 mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
226 ) -> Result<bool, fidl::Error> {
227 let _response = fidl::client::decode_transaction_body::<
228 BrowseControllerExtIsConnectedResponse,
229 fidl::encoding::DefaultFuchsiaResourceDialect,
230 0x276450990f1915b6,
231 >(_buf?)?;
232 Ok(_response.connected)
233 }
234 self.client.send_query_and_decode::<fidl::encoding::EmptyPayload, bool>(
235 (),
236 0x276450990f1915b6,
237 fidl::encoding::DynamicFlags::empty(),
238 _decode,
239 )
240 }
241
242 type SendRawBrowseCommandResponseFut = fidl::client::QueryResponseFut<
243 BrowseControllerExtSendRawBrowseCommandResult,
244 fidl::encoding::DefaultFuchsiaResourceDialect,
245 >;
246 fn r#send_raw_browse_command(
247 &self,
248 mut pdu_id: u8,
249 mut command: &[u8],
250 ) -> Self::SendRawBrowseCommandResponseFut {
251 fn _decode(
252 mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
253 ) -> Result<BrowseControllerExtSendRawBrowseCommandResult, fidl::Error> {
254 let _response = fidl::client::decode_transaction_body::<
255 fidl::encoding::ResultType<
256 BrowseControllerExtSendRawBrowseCommandResponse,
257 fidl_fuchsia_bluetooth_avrcp::BrowseControllerError,
258 >,
259 fidl::encoding::DefaultFuchsiaResourceDialect,
260 0x7346e59b68ac4a71,
261 >(_buf?)?;
262 Ok(_response.map(|x| x.response))
263 }
264 self.client.send_query_and_decode::<
265 BrowseControllerExtSendRawBrowseCommandRequest,
266 BrowseControllerExtSendRawBrowseCommandResult,
267 >(
268 (pdu_id, command,),
269 0x7346e59b68ac4a71,
270 fidl::encoding::DynamicFlags::empty(),
271 _decode,
272 )
273 }
274}
275
276pub struct BrowseControllerExtEventStream {
277 event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
278}
279
280impl std::marker::Unpin for BrowseControllerExtEventStream {}
281
282impl futures::stream::FusedStream for BrowseControllerExtEventStream {
283 fn is_terminated(&self) -> bool {
284 self.event_receiver.is_terminated()
285 }
286}
287
288impl futures::Stream for BrowseControllerExtEventStream {
289 type Item = Result<BrowseControllerExtEvent, fidl::Error>;
290
291 fn poll_next(
292 mut self: std::pin::Pin<&mut Self>,
293 cx: &mut std::task::Context<'_>,
294 ) -> std::task::Poll<Option<Self::Item>> {
295 match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
296 &mut self.event_receiver,
297 cx
298 )?) {
299 Some(buf) => std::task::Poll::Ready(Some(BrowseControllerExtEvent::decode(buf))),
300 None => std::task::Poll::Ready(None),
301 }
302 }
303}
304
305#[derive(Debug)]
306pub enum BrowseControllerExtEvent {}
307
308impl BrowseControllerExtEvent {
309 fn decode(
311 mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
312 ) -> Result<BrowseControllerExtEvent, fidl::Error> {
313 let (bytes, _handles) = buf.split_mut();
314 let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
315 debug_assert_eq!(tx_header.tx_id, 0);
316 match tx_header.ordinal {
317 _ => Err(fidl::Error::UnknownOrdinal {
318 ordinal: tx_header.ordinal,
319 protocol_name:
320 <BrowseControllerExtMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
321 }),
322 }
323 }
324}
325
326pub struct BrowseControllerExtRequestStream {
328 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
329 is_terminated: bool,
330}
331
332impl std::marker::Unpin for BrowseControllerExtRequestStream {}
333
334impl futures::stream::FusedStream for BrowseControllerExtRequestStream {
335 fn is_terminated(&self) -> bool {
336 self.is_terminated
337 }
338}
339
340impl fidl::endpoints::RequestStream for BrowseControllerExtRequestStream {
341 type Protocol = BrowseControllerExtMarker;
342 type ControlHandle = BrowseControllerExtControlHandle;
343
344 fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
345 Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
346 }
347
348 fn control_handle(&self) -> Self::ControlHandle {
349 BrowseControllerExtControlHandle { inner: self.inner.clone() }
350 }
351
352 fn into_inner(
353 self,
354 ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
355 {
356 (self.inner, self.is_terminated)
357 }
358
359 fn from_inner(
360 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
361 is_terminated: bool,
362 ) -> Self {
363 Self { inner, is_terminated }
364 }
365}
366
367impl futures::Stream for BrowseControllerExtRequestStream {
368 type Item = Result<BrowseControllerExtRequest, fidl::Error>;
369
370 fn poll_next(
371 mut self: std::pin::Pin<&mut Self>,
372 cx: &mut std::task::Context<'_>,
373 ) -> std::task::Poll<Option<Self::Item>> {
374 let this = &mut *self;
375 if this.inner.check_shutdown(cx) {
376 this.is_terminated = true;
377 return std::task::Poll::Ready(None);
378 }
379 if this.is_terminated {
380 panic!("polled BrowseControllerExtRequestStream after completion");
381 }
382 fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
383 |bytes, handles| {
384 match this.inner.channel().read_etc(cx, bytes, handles) {
385 std::task::Poll::Ready(Ok(())) => {}
386 std::task::Poll::Pending => return std::task::Poll::Pending,
387 std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
388 this.is_terminated = true;
389 return std::task::Poll::Ready(None);
390 }
391 std::task::Poll::Ready(Err(e)) => {
392 return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
393 e.into(),
394 ))))
395 }
396 }
397
398 let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
400
401 std::task::Poll::Ready(Some(match header.ordinal {
402 0x276450990f1915b6 => {
403 header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
404 let mut req = fidl::new_empty!(fidl::encoding::EmptyPayload, fidl::encoding::DefaultFuchsiaResourceDialect);
405 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
406 let control_handle = BrowseControllerExtControlHandle {
407 inner: this.inner.clone(),
408 };
409 Ok(BrowseControllerExtRequest::IsConnected {
410 responder: BrowseControllerExtIsConnectedResponder {
411 control_handle: std::mem::ManuallyDrop::new(control_handle),
412 tx_id: header.tx_id,
413 },
414 })
415 }
416 0x7346e59b68ac4a71 => {
417 header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
418 let mut req = fidl::new_empty!(BrowseControllerExtSendRawBrowseCommandRequest, fidl::encoding::DefaultFuchsiaResourceDialect);
419 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<BrowseControllerExtSendRawBrowseCommandRequest>(&header, _body_bytes, handles, &mut req)?;
420 let control_handle = BrowseControllerExtControlHandle {
421 inner: this.inner.clone(),
422 };
423 Ok(BrowseControllerExtRequest::SendRawBrowseCommand {pdu_id: req.pdu_id,
424command: req.command,
425
426 responder: BrowseControllerExtSendRawBrowseCommandResponder {
427 control_handle: std::mem::ManuallyDrop::new(control_handle),
428 tx_id: header.tx_id,
429 },
430 })
431 }
432 _ => Err(fidl::Error::UnknownOrdinal {
433 ordinal: header.ordinal,
434 protocol_name: <BrowseControllerExtMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
435 }),
436 }))
437 },
438 )
439 }
440}
441
442#[derive(Debug)]
445pub enum BrowseControllerExtRequest {
446 IsConnected { responder: BrowseControllerExtIsConnectedResponder },
448 SendRawBrowseCommand {
454 pdu_id: u8,
455 command: Vec<u8>,
456 responder: BrowseControllerExtSendRawBrowseCommandResponder,
457 },
458}
459
460impl BrowseControllerExtRequest {
461 #[allow(irrefutable_let_patterns)]
462 pub fn into_is_connected(self) -> Option<(BrowseControllerExtIsConnectedResponder)> {
463 if let BrowseControllerExtRequest::IsConnected { responder } = self {
464 Some((responder))
465 } else {
466 None
467 }
468 }
469
470 #[allow(irrefutable_let_patterns)]
471 pub fn into_send_raw_browse_command(
472 self,
473 ) -> Option<(u8, Vec<u8>, BrowseControllerExtSendRawBrowseCommandResponder)> {
474 if let BrowseControllerExtRequest::SendRawBrowseCommand { pdu_id, command, responder } =
475 self
476 {
477 Some((pdu_id, command, responder))
478 } else {
479 None
480 }
481 }
482
483 pub fn method_name(&self) -> &'static str {
485 match *self {
486 BrowseControllerExtRequest::IsConnected { .. } => "is_connected",
487 BrowseControllerExtRequest::SendRawBrowseCommand { .. } => "send_raw_browse_command",
488 }
489 }
490}
491
492#[derive(Debug, Clone)]
493pub struct BrowseControllerExtControlHandle {
494 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
495}
496
497impl fidl::endpoints::ControlHandle for BrowseControllerExtControlHandle {
498 fn shutdown(&self) {
499 self.inner.shutdown()
500 }
501 fn shutdown_with_epitaph(&self, status: zx_status::Status) {
502 self.inner.shutdown_with_epitaph(status)
503 }
504
505 fn is_closed(&self) -> bool {
506 self.inner.channel().is_closed()
507 }
508 fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
509 self.inner.channel().on_closed()
510 }
511
512 #[cfg(target_os = "fuchsia")]
513 fn signal_peer(
514 &self,
515 clear_mask: zx::Signals,
516 set_mask: zx::Signals,
517 ) -> Result<(), zx_status::Status> {
518 use fidl::Peered;
519 self.inner.channel().signal_peer(clear_mask, set_mask)
520 }
521}
522
523impl BrowseControllerExtControlHandle {}
524
525#[must_use = "FIDL methods require a response to be sent"]
526#[derive(Debug)]
527pub struct BrowseControllerExtIsConnectedResponder {
528 control_handle: std::mem::ManuallyDrop<BrowseControllerExtControlHandle>,
529 tx_id: u32,
530}
531
532impl std::ops::Drop for BrowseControllerExtIsConnectedResponder {
536 fn drop(&mut self) {
537 self.control_handle.shutdown();
538 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
540 }
541}
542
543impl fidl::endpoints::Responder for BrowseControllerExtIsConnectedResponder {
544 type ControlHandle = BrowseControllerExtControlHandle;
545
546 fn control_handle(&self) -> &BrowseControllerExtControlHandle {
547 &self.control_handle
548 }
549
550 fn drop_without_shutdown(mut self) {
551 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
553 std::mem::forget(self);
555 }
556}
557
558impl BrowseControllerExtIsConnectedResponder {
559 pub fn send(self, mut connected: bool) -> Result<(), fidl::Error> {
563 let _result = self.send_raw(connected);
564 if _result.is_err() {
565 self.control_handle.shutdown();
566 }
567 self.drop_without_shutdown();
568 _result
569 }
570
571 pub fn send_no_shutdown_on_err(self, mut connected: bool) -> Result<(), fidl::Error> {
573 let _result = self.send_raw(connected);
574 self.drop_without_shutdown();
575 _result
576 }
577
578 fn send_raw(&self, mut connected: bool) -> Result<(), fidl::Error> {
579 self.control_handle.inner.send::<BrowseControllerExtIsConnectedResponse>(
580 (connected,),
581 self.tx_id,
582 0x276450990f1915b6,
583 fidl::encoding::DynamicFlags::empty(),
584 )
585 }
586}
587
588#[must_use = "FIDL methods require a response to be sent"]
589#[derive(Debug)]
590pub struct BrowseControllerExtSendRawBrowseCommandResponder {
591 control_handle: std::mem::ManuallyDrop<BrowseControllerExtControlHandle>,
592 tx_id: u32,
593}
594
595impl std::ops::Drop for BrowseControllerExtSendRawBrowseCommandResponder {
599 fn drop(&mut self) {
600 self.control_handle.shutdown();
601 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
603 }
604}
605
606impl fidl::endpoints::Responder for BrowseControllerExtSendRawBrowseCommandResponder {
607 type ControlHandle = BrowseControllerExtControlHandle;
608
609 fn control_handle(&self) -> &BrowseControllerExtControlHandle {
610 &self.control_handle
611 }
612
613 fn drop_without_shutdown(mut self) {
614 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
616 std::mem::forget(self);
618 }
619}
620
621impl BrowseControllerExtSendRawBrowseCommandResponder {
622 pub fn send(
626 self,
627 mut result: Result<&[u8], fidl_fuchsia_bluetooth_avrcp::BrowseControllerError>,
628 ) -> Result<(), fidl::Error> {
629 let _result = self.send_raw(result);
630 if _result.is_err() {
631 self.control_handle.shutdown();
632 }
633 self.drop_without_shutdown();
634 _result
635 }
636
637 pub fn send_no_shutdown_on_err(
639 self,
640 mut result: Result<&[u8], fidl_fuchsia_bluetooth_avrcp::BrowseControllerError>,
641 ) -> Result<(), fidl::Error> {
642 let _result = self.send_raw(result);
643 self.drop_without_shutdown();
644 _result
645 }
646
647 fn send_raw(
648 &self,
649 mut result: Result<&[u8], fidl_fuchsia_bluetooth_avrcp::BrowseControllerError>,
650 ) -> Result<(), fidl::Error> {
651 self.control_handle.inner.send::<fidl::encoding::ResultType<
652 BrowseControllerExtSendRawBrowseCommandResponse,
653 fidl_fuchsia_bluetooth_avrcp::BrowseControllerError,
654 >>(
655 result.map(|response| (response,)),
656 self.tx_id,
657 0x7346e59b68ac4a71,
658 fidl::encoding::DynamicFlags::empty(),
659 )
660 }
661}
662
663#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
664pub struct ControllerExtMarker;
665
666impl fidl::endpoints::ProtocolMarker for ControllerExtMarker {
667 type Proxy = ControllerExtProxy;
668 type RequestStream = ControllerExtRequestStream;
669 #[cfg(target_os = "fuchsia")]
670 type SynchronousProxy = ControllerExtSynchronousProxy;
671
672 const DEBUG_NAME: &'static str = "(anonymous) ControllerExt";
673}
674pub type ControllerExtGetEventsSupportedResult = Result<
675 Vec<fidl_fuchsia_bluetooth_avrcp::NotificationEvent>,
676 fidl_fuchsia_bluetooth_avrcp::ControllerError,
677>;
678pub type ControllerExtSendRawVendorDependentCommandResult =
679 Result<Vec<u8>, fidl_fuchsia_bluetooth_avrcp::ControllerError>;
680
681pub trait ControllerExtProxyInterface: Send + Sync {
682 type IsConnectedResponseFut: std::future::Future<Output = Result<bool, fidl::Error>> + Send;
683 fn r#is_connected(&self) -> Self::IsConnectedResponseFut;
684 type GetEventsSupportedResponseFut: std::future::Future<Output = Result<ControllerExtGetEventsSupportedResult, fidl::Error>>
685 + Send;
686 fn r#get_events_supported(&self) -> Self::GetEventsSupportedResponseFut;
687 type SendRawVendorDependentCommandResponseFut: std::future::Future<
688 Output = Result<ControllerExtSendRawVendorDependentCommandResult, fidl::Error>,
689 > + Send;
690 fn r#send_raw_vendor_dependent_command(
691 &self,
692 pdu_id: u8,
693 command: &[u8],
694 ) -> Self::SendRawVendorDependentCommandResponseFut;
695}
696#[derive(Debug)]
697#[cfg(target_os = "fuchsia")]
698pub struct ControllerExtSynchronousProxy {
699 client: fidl::client::sync::Client,
700}
701
702#[cfg(target_os = "fuchsia")]
703impl fidl::endpoints::SynchronousProxy for ControllerExtSynchronousProxy {
704 type Proxy = ControllerExtProxy;
705 type Protocol = ControllerExtMarker;
706
707 fn from_channel(inner: fidl::Channel) -> Self {
708 Self::new(inner)
709 }
710
711 fn into_channel(self) -> fidl::Channel {
712 self.client.into_channel()
713 }
714
715 fn as_channel(&self) -> &fidl::Channel {
716 self.client.as_channel()
717 }
718}
719
720#[cfg(target_os = "fuchsia")]
721impl ControllerExtSynchronousProxy {
722 pub fn new(channel: fidl::Channel) -> Self {
723 let protocol_name = <ControllerExtMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
724 Self { client: fidl::client::sync::Client::new(channel, protocol_name) }
725 }
726
727 pub fn into_channel(self) -> fidl::Channel {
728 self.client.into_channel()
729 }
730
731 pub fn wait_for_event(
734 &self,
735 deadline: zx::MonotonicInstant,
736 ) -> Result<ControllerExtEvent, fidl::Error> {
737 ControllerExtEvent::decode(self.client.wait_for_event(deadline)?)
738 }
739
740 pub fn r#is_connected(&self, ___deadline: zx::MonotonicInstant) -> Result<bool, fidl::Error> {
742 let _response = self
743 .client
744 .send_query::<fidl::encoding::EmptyPayload, ControllerExtIsConnectedResponse>(
745 (),
746 0x403f7bc6dbbcfc4f,
747 fidl::encoding::DynamicFlags::empty(),
748 ___deadline,
749 )?;
750 Ok(_response.connected)
751 }
752
753 pub fn r#get_events_supported(
757 &self,
758 ___deadline: zx::MonotonicInstant,
759 ) -> Result<ControllerExtGetEventsSupportedResult, fidl::Error> {
760 let _response = self
761 .client
762 .send_query::<fidl::encoding::EmptyPayload, fidl::encoding::ResultType<
763 ControllerExtGetEventsSupportedResponse,
764 fidl_fuchsia_bluetooth_avrcp::ControllerError,
765 >>(
766 (), 0x13465d8abf04dd26, fidl::encoding::DynamicFlags::empty(), ___deadline
767 )?;
768 Ok(_response.map(|x| x.events_supported))
769 }
770
771 pub fn r#send_raw_vendor_dependent_command(
775 &self,
776 mut pdu_id: u8,
777 mut command: &[u8],
778 ___deadline: zx::MonotonicInstant,
779 ) -> Result<ControllerExtSendRawVendorDependentCommandResult, fidl::Error> {
780 let _response = self.client.send_query::<
781 ControllerExtSendRawVendorDependentCommandRequest,
782 fidl::encoding::ResultType<ControllerExtSendRawVendorDependentCommandResponse, fidl_fuchsia_bluetooth_avrcp::ControllerError>,
783 >(
784 (pdu_id, command,),
785 0x48004b651df5f606,
786 fidl::encoding::DynamicFlags::empty(),
787 ___deadline,
788 )?;
789 Ok(_response.map(|x| x.response))
790 }
791}
792
793#[cfg(target_os = "fuchsia")]
794impl From<ControllerExtSynchronousProxy> for zx::Handle {
795 fn from(value: ControllerExtSynchronousProxy) -> Self {
796 value.into_channel().into()
797 }
798}
799
800#[cfg(target_os = "fuchsia")]
801impl From<fidl::Channel> for ControllerExtSynchronousProxy {
802 fn from(value: fidl::Channel) -> Self {
803 Self::new(value)
804 }
805}
806
807#[derive(Debug, Clone)]
808pub struct ControllerExtProxy {
809 client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
810}
811
812impl fidl::endpoints::Proxy for ControllerExtProxy {
813 type Protocol = ControllerExtMarker;
814
815 fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
816 Self::new(inner)
817 }
818
819 fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
820 self.client.into_channel().map_err(|client| Self { client })
821 }
822
823 fn as_channel(&self) -> &::fidl::AsyncChannel {
824 self.client.as_channel()
825 }
826}
827
828impl ControllerExtProxy {
829 pub fn new(channel: ::fidl::AsyncChannel) -> Self {
831 let protocol_name = <ControllerExtMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
832 Self { client: fidl::client::Client::new(channel, protocol_name) }
833 }
834
835 pub fn take_event_stream(&self) -> ControllerExtEventStream {
841 ControllerExtEventStream { event_receiver: self.client.take_event_receiver() }
842 }
843
844 pub fn r#is_connected(
846 &self,
847 ) -> fidl::client::QueryResponseFut<bool, fidl::encoding::DefaultFuchsiaResourceDialect> {
848 ControllerExtProxyInterface::r#is_connected(self)
849 }
850
851 pub fn r#get_events_supported(
855 &self,
856 ) -> fidl::client::QueryResponseFut<
857 ControllerExtGetEventsSupportedResult,
858 fidl::encoding::DefaultFuchsiaResourceDialect,
859 > {
860 ControllerExtProxyInterface::r#get_events_supported(self)
861 }
862
863 pub fn r#send_raw_vendor_dependent_command(
867 &self,
868 mut pdu_id: u8,
869 mut command: &[u8],
870 ) -> fidl::client::QueryResponseFut<
871 ControllerExtSendRawVendorDependentCommandResult,
872 fidl::encoding::DefaultFuchsiaResourceDialect,
873 > {
874 ControllerExtProxyInterface::r#send_raw_vendor_dependent_command(self, pdu_id, command)
875 }
876}
877
878impl ControllerExtProxyInterface for ControllerExtProxy {
879 type IsConnectedResponseFut =
880 fidl::client::QueryResponseFut<bool, fidl::encoding::DefaultFuchsiaResourceDialect>;
881 fn r#is_connected(&self) -> Self::IsConnectedResponseFut {
882 fn _decode(
883 mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
884 ) -> Result<bool, fidl::Error> {
885 let _response = fidl::client::decode_transaction_body::<
886 ControllerExtIsConnectedResponse,
887 fidl::encoding::DefaultFuchsiaResourceDialect,
888 0x403f7bc6dbbcfc4f,
889 >(_buf?)?;
890 Ok(_response.connected)
891 }
892 self.client.send_query_and_decode::<fidl::encoding::EmptyPayload, bool>(
893 (),
894 0x403f7bc6dbbcfc4f,
895 fidl::encoding::DynamicFlags::empty(),
896 _decode,
897 )
898 }
899
900 type GetEventsSupportedResponseFut = fidl::client::QueryResponseFut<
901 ControllerExtGetEventsSupportedResult,
902 fidl::encoding::DefaultFuchsiaResourceDialect,
903 >;
904 fn r#get_events_supported(&self) -> Self::GetEventsSupportedResponseFut {
905 fn _decode(
906 mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
907 ) -> Result<ControllerExtGetEventsSupportedResult, fidl::Error> {
908 let _response = fidl::client::decode_transaction_body::<
909 fidl::encoding::ResultType<
910 ControllerExtGetEventsSupportedResponse,
911 fidl_fuchsia_bluetooth_avrcp::ControllerError,
912 >,
913 fidl::encoding::DefaultFuchsiaResourceDialect,
914 0x13465d8abf04dd26,
915 >(_buf?)?;
916 Ok(_response.map(|x| x.events_supported))
917 }
918 self.client.send_query_and_decode::<
919 fidl::encoding::EmptyPayload,
920 ControllerExtGetEventsSupportedResult,
921 >(
922 (),
923 0x13465d8abf04dd26,
924 fidl::encoding::DynamicFlags::empty(),
925 _decode,
926 )
927 }
928
929 type SendRawVendorDependentCommandResponseFut = fidl::client::QueryResponseFut<
930 ControllerExtSendRawVendorDependentCommandResult,
931 fidl::encoding::DefaultFuchsiaResourceDialect,
932 >;
933 fn r#send_raw_vendor_dependent_command(
934 &self,
935 mut pdu_id: u8,
936 mut command: &[u8],
937 ) -> Self::SendRawVendorDependentCommandResponseFut {
938 fn _decode(
939 mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
940 ) -> Result<ControllerExtSendRawVendorDependentCommandResult, fidl::Error> {
941 let _response = fidl::client::decode_transaction_body::<
942 fidl::encoding::ResultType<
943 ControllerExtSendRawVendorDependentCommandResponse,
944 fidl_fuchsia_bluetooth_avrcp::ControllerError,
945 >,
946 fidl::encoding::DefaultFuchsiaResourceDialect,
947 0x48004b651df5f606,
948 >(_buf?)?;
949 Ok(_response.map(|x| x.response))
950 }
951 self.client.send_query_and_decode::<
952 ControllerExtSendRawVendorDependentCommandRequest,
953 ControllerExtSendRawVendorDependentCommandResult,
954 >(
955 (pdu_id, command,),
956 0x48004b651df5f606,
957 fidl::encoding::DynamicFlags::empty(),
958 _decode,
959 )
960 }
961}
962
963pub struct ControllerExtEventStream {
964 event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
965}
966
967impl std::marker::Unpin for ControllerExtEventStream {}
968
969impl futures::stream::FusedStream for ControllerExtEventStream {
970 fn is_terminated(&self) -> bool {
971 self.event_receiver.is_terminated()
972 }
973}
974
975impl futures::Stream for ControllerExtEventStream {
976 type Item = Result<ControllerExtEvent, fidl::Error>;
977
978 fn poll_next(
979 mut self: std::pin::Pin<&mut Self>,
980 cx: &mut std::task::Context<'_>,
981 ) -> std::task::Poll<Option<Self::Item>> {
982 match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
983 &mut self.event_receiver,
984 cx
985 )?) {
986 Some(buf) => std::task::Poll::Ready(Some(ControllerExtEvent::decode(buf))),
987 None => std::task::Poll::Ready(None),
988 }
989 }
990}
991
992#[derive(Debug)]
993pub enum ControllerExtEvent {}
994
995impl ControllerExtEvent {
996 fn decode(
998 mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
999 ) -> Result<ControllerExtEvent, fidl::Error> {
1000 let (bytes, _handles) = buf.split_mut();
1001 let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
1002 debug_assert_eq!(tx_header.tx_id, 0);
1003 match tx_header.ordinal {
1004 _ => Err(fidl::Error::UnknownOrdinal {
1005 ordinal: tx_header.ordinal,
1006 protocol_name: <ControllerExtMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
1007 }),
1008 }
1009 }
1010}
1011
1012pub struct ControllerExtRequestStream {
1014 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
1015 is_terminated: bool,
1016}
1017
1018impl std::marker::Unpin for ControllerExtRequestStream {}
1019
1020impl futures::stream::FusedStream for ControllerExtRequestStream {
1021 fn is_terminated(&self) -> bool {
1022 self.is_terminated
1023 }
1024}
1025
1026impl fidl::endpoints::RequestStream for ControllerExtRequestStream {
1027 type Protocol = ControllerExtMarker;
1028 type ControlHandle = ControllerExtControlHandle;
1029
1030 fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
1031 Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
1032 }
1033
1034 fn control_handle(&self) -> Self::ControlHandle {
1035 ControllerExtControlHandle { inner: self.inner.clone() }
1036 }
1037
1038 fn into_inner(
1039 self,
1040 ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
1041 {
1042 (self.inner, self.is_terminated)
1043 }
1044
1045 fn from_inner(
1046 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
1047 is_terminated: bool,
1048 ) -> Self {
1049 Self { inner, is_terminated }
1050 }
1051}
1052
1053impl futures::Stream for ControllerExtRequestStream {
1054 type Item = Result<ControllerExtRequest, fidl::Error>;
1055
1056 fn poll_next(
1057 mut self: std::pin::Pin<&mut Self>,
1058 cx: &mut std::task::Context<'_>,
1059 ) -> std::task::Poll<Option<Self::Item>> {
1060 let this = &mut *self;
1061 if this.inner.check_shutdown(cx) {
1062 this.is_terminated = true;
1063 return std::task::Poll::Ready(None);
1064 }
1065 if this.is_terminated {
1066 panic!("polled ControllerExtRequestStream after completion");
1067 }
1068 fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
1069 |bytes, handles| {
1070 match this.inner.channel().read_etc(cx, bytes, handles) {
1071 std::task::Poll::Ready(Ok(())) => {}
1072 std::task::Poll::Pending => return std::task::Poll::Pending,
1073 std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
1074 this.is_terminated = true;
1075 return std::task::Poll::Ready(None);
1076 }
1077 std::task::Poll::Ready(Err(e)) => {
1078 return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
1079 e.into(),
1080 ))))
1081 }
1082 }
1083
1084 let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
1086
1087 std::task::Poll::Ready(Some(match header.ordinal {
1088 0x403f7bc6dbbcfc4f => {
1089 header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
1090 let mut req = fidl::new_empty!(
1091 fidl::encoding::EmptyPayload,
1092 fidl::encoding::DefaultFuchsiaResourceDialect
1093 );
1094 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
1095 let control_handle =
1096 ControllerExtControlHandle { inner: this.inner.clone() };
1097 Ok(ControllerExtRequest::IsConnected {
1098 responder: ControllerExtIsConnectedResponder {
1099 control_handle: std::mem::ManuallyDrop::new(control_handle),
1100 tx_id: header.tx_id,
1101 },
1102 })
1103 }
1104 0x13465d8abf04dd26 => {
1105 header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
1106 let mut req = fidl::new_empty!(
1107 fidl::encoding::EmptyPayload,
1108 fidl::encoding::DefaultFuchsiaResourceDialect
1109 );
1110 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
1111 let control_handle =
1112 ControllerExtControlHandle { inner: this.inner.clone() };
1113 Ok(ControllerExtRequest::GetEventsSupported {
1114 responder: ControllerExtGetEventsSupportedResponder {
1115 control_handle: std::mem::ManuallyDrop::new(control_handle),
1116 tx_id: header.tx_id,
1117 },
1118 })
1119 }
1120 0x48004b651df5f606 => {
1121 header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
1122 let mut req = fidl::new_empty!(
1123 ControllerExtSendRawVendorDependentCommandRequest,
1124 fidl::encoding::DefaultFuchsiaResourceDialect
1125 );
1126 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<ControllerExtSendRawVendorDependentCommandRequest>(&header, _body_bytes, handles, &mut req)?;
1127 let control_handle =
1128 ControllerExtControlHandle { inner: this.inner.clone() };
1129 Ok(ControllerExtRequest::SendRawVendorDependentCommand {
1130 pdu_id: req.pdu_id,
1131 command: req.command,
1132
1133 responder: ControllerExtSendRawVendorDependentCommandResponder {
1134 control_handle: std::mem::ManuallyDrop::new(control_handle),
1135 tx_id: header.tx_id,
1136 },
1137 })
1138 }
1139 _ => Err(fidl::Error::UnknownOrdinal {
1140 ordinal: header.ordinal,
1141 protocol_name:
1142 <ControllerExtMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
1143 }),
1144 }))
1145 },
1146 )
1147 }
1148}
1149
1150#[derive(Debug)]
1152pub enum ControllerExtRequest {
1153 IsConnected { responder: ControllerExtIsConnectedResponder },
1155 GetEventsSupported { responder: ControllerExtGetEventsSupportedResponder },
1159 SendRawVendorDependentCommand {
1163 pdu_id: u8,
1164 command: Vec<u8>,
1165 responder: ControllerExtSendRawVendorDependentCommandResponder,
1166 },
1167}
1168
1169impl ControllerExtRequest {
1170 #[allow(irrefutable_let_patterns)]
1171 pub fn into_is_connected(self) -> Option<(ControllerExtIsConnectedResponder)> {
1172 if let ControllerExtRequest::IsConnected { responder } = self {
1173 Some((responder))
1174 } else {
1175 None
1176 }
1177 }
1178
1179 #[allow(irrefutable_let_patterns)]
1180 pub fn into_get_events_supported(self) -> Option<(ControllerExtGetEventsSupportedResponder)> {
1181 if let ControllerExtRequest::GetEventsSupported { responder } = self {
1182 Some((responder))
1183 } else {
1184 None
1185 }
1186 }
1187
1188 #[allow(irrefutable_let_patterns)]
1189 pub fn into_send_raw_vendor_dependent_command(
1190 self,
1191 ) -> Option<(u8, Vec<u8>, ControllerExtSendRawVendorDependentCommandResponder)> {
1192 if let ControllerExtRequest::SendRawVendorDependentCommand { pdu_id, command, responder } =
1193 self
1194 {
1195 Some((pdu_id, command, responder))
1196 } else {
1197 None
1198 }
1199 }
1200
1201 pub fn method_name(&self) -> &'static str {
1203 match *self {
1204 ControllerExtRequest::IsConnected { .. } => "is_connected",
1205 ControllerExtRequest::GetEventsSupported { .. } => "get_events_supported",
1206 ControllerExtRequest::SendRawVendorDependentCommand { .. } => {
1207 "send_raw_vendor_dependent_command"
1208 }
1209 }
1210 }
1211}
1212
1213#[derive(Debug, Clone)]
1214pub struct ControllerExtControlHandle {
1215 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
1216}
1217
1218impl fidl::endpoints::ControlHandle for ControllerExtControlHandle {
1219 fn shutdown(&self) {
1220 self.inner.shutdown()
1221 }
1222 fn shutdown_with_epitaph(&self, status: zx_status::Status) {
1223 self.inner.shutdown_with_epitaph(status)
1224 }
1225
1226 fn is_closed(&self) -> bool {
1227 self.inner.channel().is_closed()
1228 }
1229 fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
1230 self.inner.channel().on_closed()
1231 }
1232
1233 #[cfg(target_os = "fuchsia")]
1234 fn signal_peer(
1235 &self,
1236 clear_mask: zx::Signals,
1237 set_mask: zx::Signals,
1238 ) -> Result<(), zx_status::Status> {
1239 use fidl::Peered;
1240 self.inner.channel().signal_peer(clear_mask, set_mask)
1241 }
1242}
1243
1244impl ControllerExtControlHandle {}
1245
1246#[must_use = "FIDL methods require a response to be sent"]
1247#[derive(Debug)]
1248pub struct ControllerExtIsConnectedResponder {
1249 control_handle: std::mem::ManuallyDrop<ControllerExtControlHandle>,
1250 tx_id: u32,
1251}
1252
1253impl std::ops::Drop for ControllerExtIsConnectedResponder {
1257 fn drop(&mut self) {
1258 self.control_handle.shutdown();
1259 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1261 }
1262}
1263
1264impl fidl::endpoints::Responder for ControllerExtIsConnectedResponder {
1265 type ControlHandle = ControllerExtControlHandle;
1266
1267 fn control_handle(&self) -> &ControllerExtControlHandle {
1268 &self.control_handle
1269 }
1270
1271 fn drop_without_shutdown(mut self) {
1272 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1274 std::mem::forget(self);
1276 }
1277}
1278
1279impl ControllerExtIsConnectedResponder {
1280 pub fn send(self, mut connected: bool) -> Result<(), fidl::Error> {
1284 let _result = self.send_raw(connected);
1285 if _result.is_err() {
1286 self.control_handle.shutdown();
1287 }
1288 self.drop_without_shutdown();
1289 _result
1290 }
1291
1292 pub fn send_no_shutdown_on_err(self, mut connected: bool) -> Result<(), fidl::Error> {
1294 let _result = self.send_raw(connected);
1295 self.drop_without_shutdown();
1296 _result
1297 }
1298
1299 fn send_raw(&self, mut connected: bool) -> Result<(), fidl::Error> {
1300 self.control_handle.inner.send::<ControllerExtIsConnectedResponse>(
1301 (connected,),
1302 self.tx_id,
1303 0x403f7bc6dbbcfc4f,
1304 fidl::encoding::DynamicFlags::empty(),
1305 )
1306 }
1307}
1308
1309#[must_use = "FIDL methods require a response to be sent"]
1310#[derive(Debug)]
1311pub struct ControllerExtGetEventsSupportedResponder {
1312 control_handle: std::mem::ManuallyDrop<ControllerExtControlHandle>,
1313 tx_id: u32,
1314}
1315
1316impl std::ops::Drop for ControllerExtGetEventsSupportedResponder {
1320 fn drop(&mut self) {
1321 self.control_handle.shutdown();
1322 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1324 }
1325}
1326
1327impl fidl::endpoints::Responder for ControllerExtGetEventsSupportedResponder {
1328 type ControlHandle = ControllerExtControlHandle;
1329
1330 fn control_handle(&self) -> &ControllerExtControlHandle {
1331 &self.control_handle
1332 }
1333
1334 fn drop_without_shutdown(mut self) {
1335 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1337 std::mem::forget(self);
1339 }
1340}
1341
1342impl ControllerExtGetEventsSupportedResponder {
1343 pub fn send(
1347 self,
1348 mut result: Result<
1349 &[fidl_fuchsia_bluetooth_avrcp::NotificationEvent],
1350 fidl_fuchsia_bluetooth_avrcp::ControllerError,
1351 >,
1352 ) -> Result<(), fidl::Error> {
1353 let _result = self.send_raw(result);
1354 if _result.is_err() {
1355 self.control_handle.shutdown();
1356 }
1357 self.drop_without_shutdown();
1358 _result
1359 }
1360
1361 pub fn send_no_shutdown_on_err(
1363 self,
1364 mut result: Result<
1365 &[fidl_fuchsia_bluetooth_avrcp::NotificationEvent],
1366 fidl_fuchsia_bluetooth_avrcp::ControllerError,
1367 >,
1368 ) -> Result<(), fidl::Error> {
1369 let _result = self.send_raw(result);
1370 self.drop_without_shutdown();
1371 _result
1372 }
1373
1374 fn send_raw(
1375 &self,
1376 mut result: Result<
1377 &[fidl_fuchsia_bluetooth_avrcp::NotificationEvent],
1378 fidl_fuchsia_bluetooth_avrcp::ControllerError,
1379 >,
1380 ) -> Result<(), fidl::Error> {
1381 self.control_handle.inner.send::<fidl::encoding::ResultType<
1382 ControllerExtGetEventsSupportedResponse,
1383 fidl_fuchsia_bluetooth_avrcp::ControllerError,
1384 >>(
1385 result.map(|events_supported| (events_supported,)),
1386 self.tx_id,
1387 0x13465d8abf04dd26,
1388 fidl::encoding::DynamicFlags::empty(),
1389 )
1390 }
1391}
1392
1393#[must_use = "FIDL methods require a response to be sent"]
1394#[derive(Debug)]
1395pub struct ControllerExtSendRawVendorDependentCommandResponder {
1396 control_handle: std::mem::ManuallyDrop<ControllerExtControlHandle>,
1397 tx_id: u32,
1398}
1399
1400impl std::ops::Drop for ControllerExtSendRawVendorDependentCommandResponder {
1404 fn drop(&mut self) {
1405 self.control_handle.shutdown();
1406 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1408 }
1409}
1410
1411impl fidl::endpoints::Responder for ControllerExtSendRawVendorDependentCommandResponder {
1412 type ControlHandle = ControllerExtControlHandle;
1413
1414 fn control_handle(&self) -> &ControllerExtControlHandle {
1415 &self.control_handle
1416 }
1417
1418 fn drop_without_shutdown(mut self) {
1419 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1421 std::mem::forget(self);
1423 }
1424}
1425
1426impl ControllerExtSendRawVendorDependentCommandResponder {
1427 pub fn send(
1431 self,
1432 mut result: Result<&[u8], fidl_fuchsia_bluetooth_avrcp::ControllerError>,
1433 ) -> Result<(), fidl::Error> {
1434 let _result = self.send_raw(result);
1435 if _result.is_err() {
1436 self.control_handle.shutdown();
1437 }
1438 self.drop_without_shutdown();
1439 _result
1440 }
1441
1442 pub fn send_no_shutdown_on_err(
1444 self,
1445 mut result: Result<&[u8], fidl_fuchsia_bluetooth_avrcp::ControllerError>,
1446 ) -> Result<(), fidl::Error> {
1447 let _result = self.send_raw(result);
1448 self.drop_without_shutdown();
1449 _result
1450 }
1451
1452 fn send_raw(
1453 &self,
1454 mut result: Result<&[u8], fidl_fuchsia_bluetooth_avrcp::ControllerError>,
1455 ) -> Result<(), fidl::Error> {
1456 self.control_handle.inner.send::<fidl::encoding::ResultType<
1457 ControllerExtSendRawVendorDependentCommandResponse,
1458 fidl_fuchsia_bluetooth_avrcp::ControllerError,
1459 >>(
1460 result.map(|response| (response,)),
1461 self.tx_id,
1462 0x48004b651df5f606,
1463 fidl::encoding::DynamicFlags::empty(),
1464 )
1465 }
1466}
1467
1468#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
1469pub struct PeerManagerExtMarker;
1470
1471impl fidl::endpoints::ProtocolMarker for PeerManagerExtMarker {
1472 type Proxy = PeerManagerExtProxy;
1473 type RequestStream = PeerManagerExtRequestStream;
1474 #[cfg(target_os = "fuchsia")]
1475 type SynchronousProxy = PeerManagerExtSynchronousProxy;
1476
1477 const DEBUG_NAME: &'static str = "fuchsia.bluetooth.avrcp.test.PeerManagerExt";
1478}
1479impl fidl::endpoints::DiscoverableProtocolMarker for PeerManagerExtMarker {}
1480pub type PeerManagerExtGetBrowseControllerForTargetResult = Result<(), i32>;
1481pub type PeerManagerExtGetControllerForTargetResult = Result<(), i32>;
1482
1483pub trait PeerManagerExtProxyInterface: Send + Sync {
1484 type GetBrowseControllerForTargetResponseFut: std::future::Future<
1485 Output = Result<PeerManagerExtGetBrowseControllerForTargetResult, fidl::Error>,
1486 > + Send;
1487 fn r#get_browse_controller_for_target(
1488 &self,
1489 peer_id: &fidl_fuchsia_bluetooth::PeerId,
1490 client: fidl::endpoints::ServerEnd<BrowseControllerExtMarker>,
1491 ) -> Self::GetBrowseControllerForTargetResponseFut;
1492 type GetControllerForTargetResponseFut: std::future::Future<
1493 Output = Result<PeerManagerExtGetControllerForTargetResult, fidl::Error>,
1494 > + Send;
1495 fn r#get_controller_for_target(
1496 &self,
1497 peer_id: &fidl_fuchsia_bluetooth::PeerId,
1498 client: fidl::endpoints::ServerEnd<ControllerExtMarker>,
1499 ) -> Self::GetControllerForTargetResponseFut;
1500}
1501#[derive(Debug)]
1502#[cfg(target_os = "fuchsia")]
1503pub struct PeerManagerExtSynchronousProxy {
1504 client: fidl::client::sync::Client,
1505}
1506
1507#[cfg(target_os = "fuchsia")]
1508impl fidl::endpoints::SynchronousProxy for PeerManagerExtSynchronousProxy {
1509 type Proxy = PeerManagerExtProxy;
1510 type Protocol = PeerManagerExtMarker;
1511
1512 fn from_channel(inner: fidl::Channel) -> Self {
1513 Self::new(inner)
1514 }
1515
1516 fn into_channel(self) -> fidl::Channel {
1517 self.client.into_channel()
1518 }
1519
1520 fn as_channel(&self) -> &fidl::Channel {
1521 self.client.as_channel()
1522 }
1523}
1524
1525#[cfg(target_os = "fuchsia")]
1526impl PeerManagerExtSynchronousProxy {
1527 pub fn new(channel: fidl::Channel) -> Self {
1528 let protocol_name = <PeerManagerExtMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
1529 Self { client: fidl::client::sync::Client::new(channel, protocol_name) }
1530 }
1531
1532 pub fn into_channel(self) -> fidl::Channel {
1533 self.client.into_channel()
1534 }
1535
1536 pub fn wait_for_event(
1539 &self,
1540 deadline: zx::MonotonicInstant,
1541 ) -> Result<PeerManagerExtEvent, fidl::Error> {
1542 PeerManagerExtEvent::decode(self.client.wait_for_event(deadline)?)
1543 }
1544
1545 pub fn r#get_browse_controller_for_target(
1549 &self,
1550 mut peer_id: &fidl_fuchsia_bluetooth::PeerId,
1551 mut client: fidl::endpoints::ServerEnd<BrowseControllerExtMarker>,
1552 ___deadline: zx::MonotonicInstant,
1553 ) -> Result<PeerManagerExtGetBrowseControllerForTargetResult, fidl::Error> {
1554 let _response = self.client.send_query::<
1555 PeerManagerExtGetBrowseControllerForTargetRequest,
1556 fidl::encoding::ResultType<fidl::encoding::EmptyStruct, i32>,
1557 >(
1558 (peer_id, client,),
1559 0x3b838b67d5a5aeac,
1560 fidl::encoding::DynamicFlags::empty(),
1561 ___deadline,
1562 )?;
1563 Ok(_response.map(|x| x))
1564 }
1565
1566 pub fn r#get_controller_for_target(
1570 &self,
1571 mut peer_id: &fidl_fuchsia_bluetooth::PeerId,
1572 mut client: fidl::endpoints::ServerEnd<ControllerExtMarker>,
1573 ___deadline: zx::MonotonicInstant,
1574 ) -> Result<PeerManagerExtGetControllerForTargetResult, fidl::Error> {
1575 let _response = self.client.send_query::<
1576 PeerManagerExtGetControllerForTargetRequest,
1577 fidl::encoding::ResultType<fidl::encoding::EmptyStruct, i32>,
1578 >(
1579 (peer_id, client,),
1580 0x39448b0c65966553,
1581 fidl::encoding::DynamicFlags::empty(),
1582 ___deadline,
1583 )?;
1584 Ok(_response.map(|x| x))
1585 }
1586}
1587
1588#[cfg(target_os = "fuchsia")]
1589impl From<PeerManagerExtSynchronousProxy> for zx::Handle {
1590 fn from(value: PeerManagerExtSynchronousProxy) -> Self {
1591 value.into_channel().into()
1592 }
1593}
1594
1595#[cfg(target_os = "fuchsia")]
1596impl From<fidl::Channel> for PeerManagerExtSynchronousProxy {
1597 fn from(value: fidl::Channel) -> Self {
1598 Self::new(value)
1599 }
1600}
1601
1602#[derive(Debug, Clone)]
1603pub struct PeerManagerExtProxy {
1604 client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
1605}
1606
1607impl fidl::endpoints::Proxy for PeerManagerExtProxy {
1608 type Protocol = PeerManagerExtMarker;
1609
1610 fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
1611 Self::new(inner)
1612 }
1613
1614 fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
1615 self.client.into_channel().map_err(|client| Self { client })
1616 }
1617
1618 fn as_channel(&self) -> &::fidl::AsyncChannel {
1619 self.client.as_channel()
1620 }
1621}
1622
1623impl PeerManagerExtProxy {
1624 pub fn new(channel: ::fidl::AsyncChannel) -> Self {
1626 let protocol_name = <PeerManagerExtMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
1627 Self { client: fidl::client::Client::new(channel, protocol_name) }
1628 }
1629
1630 pub fn take_event_stream(&self) -> PeerManagerExtEventStream {
1636 PeerManagerExtEventStream { event_receiver: self.client.take_event_receiver() }
1637 }
1638
1639 pub fn r#get_browse_controller_for_target(
1643 &self,
1644 mut peer_id: &fidl_fuchsia_bluetooth::PeerId,
1645 mut client: fidl::endpoints::ServerEnd<BrowseControllerExtMarker>,
1646 ) -> fidl::client::QueryResponseFut<
1647 PeerManagerExtGetBrowseControllerForTargetResult,
1648 fidl::encoding::DefaultFuchsiaResourceDialect,
1649 > {
1650 PeerManagerExtProxyInterface::r#get_browse_controller_for_target(self, peer_id, client)
1651 }
1652
1653 pub fn r#get_controller_for_target(
1657 &self,
1658 mut peer_id: &fidl_fuchsia_bluetooth::PeerId,
1659 mut client: fidl::endpoints::ServerEnd<ControllerExtMarker>,
1660 ) -> fidl::client::QueryResponseFut<
1661 PeerManagerExtGetControllerForTargetResult,
1662 fidl::encoding::DefaultFuchsiaResourceDialect,
1663 > {
1664 PeerManagerExtProxyInterface::r#get_controller_for_target(self, peer_id, client)
1665 }
1666}
1667
1668impl PeerManagerExtProxyInterface for PeerManagerExtProxy {
1669 type GetBrowseControllerForTargetResponseFut = fidl::client::QueryResponseFut<
1670 PeerManagerExtGetBrowseControllerForTargetResult,
1671 fidl::encoding::DefaultFuchsiaResourceDialect,
1672 >;
1673 fn r#get_browse_controller_for_target(
1674 &self,
1675 mut peer_id: &fidl_fuchsia_bluetooth::PeerId,
1676 mut client: fidl::endpoints::ServerEnd<BrowseControllerExtMarker>,
1677 ) -> Self::GetBrowseControllerForTargetResponseFut {
1678 fn _decode(
1679 mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
1680 ) -> Result<PeerManagerExtGetBrowseControllerForTargetResult, fidl::Error> {
1681 let _response = fidl::client::decode_transaction_body::<
1682 fidl::encoding::ResultType<fidl::encoding::EmptyStruct, i32>,
1683 fidl::encoding::DefaultFuchsiaResourceDialect,
1684 0x3b838b67d5a5aeac,
1685 >(_buf?)?;
1686 Ok(_response.map(|x| x))
1687 }
1688 self.client.send_query_and_decode::<
1689 PeerManagerExtGetBrowseControllerForTargetRequest,
1690 PeerManagerExtGetBrowseControllerForTargetResult,
1691 >(
1692 (peer_id, client,),
1693 0x3b838b67d5a5aeac,
1694 fidl::encoding::DynamicFlags::empty(),
1695 _decode,
1696 )
1697 }
1698
1699 type GetControllerForTargetResponseFut = fidl::client::QueryResponseFut<
1700 PeerManagerExtGetControllerForTargetResult,
1701 fidl::encoding::DefaultFuchsiaResourceDialect,
1702 >;
1703 fn r#get_controller_for_target(
1704 &self,
1705 mut peer_id: &fidl_fuchsia_bluetooth::PeerId,
1706 mut client: fidl::endpoints::ServerEnd<ControllerExtMarker>,
1707 ) -> Self::GetControllerForTargetResponseFut {
1708 fn _decode(
1709 mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
1710 ) -> Result<PeerManagerExtGetControllerForTargetResult, fidl::Error> {
1711 let _response = fidl::client::decode_transaction_body::<
1712 fidl::encoding::ResultType<fidl::encoding::EmptyStruct, i32>,
1713 fidl::encoding::DefaultFuchsiaResourceDialect,
1714 0x39448b0c65966553,
1715 >(_buf?)?;
1716 Ok(_response.map(|x| x))
1717 }
1718 self.client.send_query_and_decode::<
1719 PeerManagerExtGetControllerForTargetRequest,
1720 PeerManagerExtGetControllerForTargetResult,
1721 >(
1722 (peer_id, client,),
1723 0x39448b0c65966553,
1724 fidl::encoding::DynamicFlags::empty(),
1725 _decode,
1726 )
1727 }
1728}
1729
1730pub struct PeerManagerExtEventStream {
1731 event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
1732}
1733
1734impl std::marker::Unpin for PeerManagerExtEventStream {}
1735
1736impl futures::stream::FusedStream for PeerManagerExtEventStream {
1737 fn is_terminated(&self) -> bool {
1738 self.event_receiver.is_terminated()
1739 }
1740}
1741
1742impl futures::Stream for PeerManagerExtEventStream {
1743 type Item = Result<PeerManagerExtEvent, fidl::Error>;
1744
1745 fn poll_next(
1746 mut self: std::pin::Pin<&mut Self>,
1747 cx: &mut std::task::Context<'_>,
1748 ) -> std::task::Poll<Option<Self::Item>> {
1749 match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
1750 &mut self.event_receiver,
1751 cx
1752 )?) {
1753 Some(buf) => std::task::Poll::Ready(Some(PeerManagerExtEvent::decode(buf))),
1754 None => std::task::Poll::Ready(None),
1755 }
1756 }
1757}
1758
1759#[derive(Debug)]
1760pub enum PeerManagerExtEvent {}
1761
1762impl PeerManagerExtEvent {
1763 fn decode(
1765 mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
1766 ) -> Result<PeerManagerExtEvent, fidl::Error> {
1767 let (bytes, _handles) = buf.split_mut();
1768 let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
1769 debug_assert_eq!(tx_header.tx_id, 0);
1770 match tx_header.ordinal {
1771 _ => Err(fidl::Error::UnknownOrdinal {
1772 ordinal: tx_header.ordinal,
1773 protocol_name:
1774 <PeerManagerExtMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
1775 }),
1776 }
1777 }
1778}
1779
1780pub struct PeerManagerExtRequestStream {
1782 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
1783 is_terminated: bool,
1784}
1785
1786impl std::marker::Unpin for PeerManagerExtRequestStream {}
1787
1788impl futures::stream::FusedStream for PeerManagerExtRequestStream {
1789 fn is_terminated(&self) -> bool {
1790 self.is_terminated
1791 }
1792}
1793
1794impl fidl::endpoints::RequestStream for PeerManagerExtRequestStream {
1795 type Protocol = PeerManagerExtMarker;
1796 type ControlHandle = PeerManagerExtControlHandle;
1797
1798 fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
1799 Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
1800 }
1801
1802 fn control_handle(&self) -> Self::ControlHandle {
1803 PeerManagerExtControlHandle { inner: self.inner.clone() }
1804 }
1805
1806 fn into_inner(
1807 self,
1808 ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
1809 {
1810 (self.inner, self.is_terminated)
1811 }
1812
1813 fn from_inner(
1814 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
1815 is_terminated: bool,
1816 ) -> Self {
1817 Self { inner, is_terminated }
1818 }
1819}
1820
1821impl futures::Stream for PeerManagerExtRequestStream {
1822 type Item = Result<PeerManagerExtRequest, fidl::Error>;
1823
1824 fn poll_next(
1825 mut self: std::pin::Pin<&mut Self>,
1826 cx: &mut std::task::Context<'_>,
1827 ) -> std::task::Poll<Option<Self::Item>> {
1828 let this = &mut *self;
1829 if this.inner.check_shutdown(cx) {
1830 this.is_terminated = true;
1831 return std::task::Poll::Ready(None);
1832 }
1833 if this.is_terminated {
1834 panic!("polled PeerManagerExtRequestStream after completion");
1835 }
1836 fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
1837 |bytes, handles| {
1838 match this.inner.channel().read_etc(cx, bytes, handles) {
1839 std::task::Poll::Ready(Ok(())) => {}
1840 std::task::Poll::Pending => return std::task::Poll::Pending,
1841 std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
1842 this.is_terminated = true;
1843 return std::task::Poll::Ready(None);
1844 }
1845 std::task::Poll::Ready(Err(e)) => {
1846 return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
1847 e.into(),
1848 ))))
1849 }
1850 }
1851
1852 let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
1854
1855 std::task::Poll::Ready(Some(match header.ordinal {
1856 0x3b838b67d5a5aeac => {
1857 header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
1858 let mut req = fidl::new_empty!(
1859 PeerManagerExtGetBrowseControllerForTargetRequest,
1860 fidl::encoding::DefaultFuchsiaResourceDialect
1861 );
1862 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<PeerManagerExtGetBrowseControllerForTargetRequest>(&header, _body_bytes, handles, &mut req)?;
1863 let control_handle =
1864 PeerManagerExtControlHandle { inner: this.inner.clone() };
1865 Ok(PeerManagerExtRequest::GetBrowseControllerForTarget {
1866 peer_id: req.peer_id,
1867 client: req.client,
1868
1869 responder: PeerManagerExtGetBrowseControllerForTargetResponder {
1870 control_handle: std::mem::ManuallyDrop::new(control_handle),
1871 tx_id: header.tx_id,
1872 },
1873 })
1874 }
1875 0x39448b0c65966553 => {
1876 header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
1877 let mut req = fidl::new_empty!(
1878 PeerManagerExtGetControllerForTargetRequest,
1879 fidl::encoding::DefaultFuchsiaResourceDialect
1880 );
1881 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<PeerManagerExtGetControllerForTargetRequest>(&header, _body_bytes, handles, &mut req)?;
1882 let control_handle =
1883 PeerManagerExtControlHandle { inner: this.inner.clone() };
1884 Ok(PeerManagerExtRequest::GetControllerForTarget {
1885 peer_id: req.peer_id,
1886 client: req.client,
1887
1888 responder: PeerManagerExtGetControllerForTargetResponder {
1889 control_handle: std::mem::ManuallyDrop::new(control_handle),
1890 tx_id: header.tx_id,
1891 },
1892 })
1893 }
1894 _ => Err(fidl::Error::UnknownOrdinal {
1895 ordinal: header.ordinal,
1896 protocol_name:
1897 <PeerManagerExtMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
1898 }),
1899 }))
1900 },
1901 )
1902 }
1903}
1904
1905#[derive(Debug)]
1915pub enum PeerManagerExtRequest {
1916 GetBrowseControllerForTarget {
1920 peer_id: fidl_fuchsia_bluetooth::PeerId,
1921 client: fidl::endpoints::ServerEnd<BrowseControllerExtMarker>,
1922 responder: PeerManagerExtGetBrowseControllerForTargetResponder,
1923 },
1924 GetControllerForTarget {
1928 peer_id: fidl_fuchsia_bluetooth::PeerId,
1929 client: fidl::endpoints::ServerEnd<ControllerExtMarker>,
1930 responder: PeerManagerExtGetControllerForTargetResponder,
1931 },
1932}
1933
1934impl PeerManagerExtRequest {
1935 #[allow(irrefutable_let_patterns)]
1936 pub fn into_get_browse_controller_for_target(
1937 self,
1938 ) -> Option<(
1939 fidl_fuchsia_bluetooth::PeerId,
1940 fidl::endpoints::ServerEnd<BrowseControllerExtMarker>,
1941 PeerManagerExtGetBrowseControllerForTargetResponder,
1942 )> {
1943 if let PeerManagerExtRequest::GetBrowseControllerForTarget { peer_id, client, responder } =
1944 self
1945 {
1946 Some((peer_id, client, responder))
1947 } else {
1948 None
1949 }
1950 }
1951
1952 #[allow(irrefutable_let_patterns)]
1953 pub fn into_get_controller_for_target(
1954 self,
1955 ) -> Option<(
1956 fidl_fuchsia_bluetooth::PeerId,
1957 fidl::endpoints::ServerEnd<ControllerExtMarker>,
1958 PeerManagerExtGetControllerForTargetResponder,
1959 )> {
1960 if let PeerManagerExtRequest::GetControllerForTarget { peer_id, client, responder } = self {
1961 Some((peer_id, client, responder))
1962 } else {
1963 None
1964 }
1965 }
1966
1967 pub fn method_name(&self) -> &'static str {
1969 match *self {
1970 PeerManagerExtRequest::GetBrowseControllerForTarget { .. } => {
1971 "get_browse_controller_for_target"
1972 }
1973 PeerManagerExtRequest::GetControllerForTarget { .. } => "get_controller_for_target",
1974 }
1975 }
1976}
1977
1978#[derive(Debug, Clone)]
1979pub struct PeerManagerExtControlHandle {
1980 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
1981}
1982
1983impl fidl::endpoints::ControlHandle for PeerManagerExtControlHandle {
1984 fn shutdown(&self) {
1985 self.inner.shutdown()
1986 }
1987 fn shutdown_with_epitaph(&self, status: zx_status::Status) {
1988 self.inner.shutdown_with_epitaph(status)
1989 }
1990
1991 fn is_closed(&self) -> bool {
1992 self.inner.channel().is_closed()
1993 }
1994 fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
1995 self.inner.channel().on_closed()
1996 }
1997
1998 #[cfg(target_os = "fuchsia")]
1999 fn signal_peer(
2000 &self,
2001 clear_mask: zx::Signals,
2002 set_mask: zx::Signals,
2003 ) -> Result<(), zx_status::Status> {
2004 use fidl::Peered;
2005 self.inner.channel().signal_peer(clear_mask, set_mask)
2006 }
2007}
2008
2009impl PeerManagerExtControlHandle {}
2010
2011#[must_use = "FIDL methods require a response to be sent"]
2012#[derive(Debug)]
2013pub struct PeerManagerExtGetBrowseControllerForTargetResponder {
2014 control_handle: std::mem::ManuallyDrop<PeerManagerExtControlHandle>,
2015 tx_id: u32,
2016}
2017
2018impl std::ops::Drop for PeerManagerExtGetBrowseControllerForTargetResponder {
2022 fn drop(&mut self) {
2023 self.control_handle.shutdown();
2024 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
2026 }
2027}
2028
2029impl fidl::endpoints::Responder for PeerManagerExtGetBrowseControllerForTargetResponder {
2030 type ControlHandle = PeerManagerExtControlHandle;
2031
2032 fn control_handle(&self) -> &PeerManagerExtControlHandle {
2033 &self.control_handle
2034 }
2035
2036 fn drop_without_shutdown(mut self) {
2037 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
2039 std::mem::forget(self);
2041 }
2042}
2043
2044impl PeerManagerExtGetBrowseControllerForTargetResponder {
2045 pub fn send(self, mut result: Result<(), i32>) -> Result<(), fidl::Error> {
2049 let _result = self.send_raw(result);
2050 if _result.is_err() {
2051 self.control_handle.shutdown();
2052 }
2053 self.drop_without_shutdown();
2054 _result
2055 }
2056
2057 pub fn send_no_shutdown_on_err(self, mut result: Result<(), i32>) -> Result<(), fidl::Error> {
2059 let _result = self.send_raw(result);
2060 self.drop_without_shutdown();
2061 _result
2062 }
2063
2064 fn send_raw(&self, mut result: Result<(), i32>) -> Result<(), fidl::Error> {
2065 self.control_handle
2066 .inner
2067 .send::<fidl::encoding::ResultType<fidl::encoding::EmptyStruct, i32>>(
2068 result,
2069 self.tx_id,
2070 0x3b838b67d5a5aeac,
2071 fidl::encoding::DynamicFlags::empty(),
2072 )
2073 }
2074}
2075
2076#[must_use = "FIDL methods require a response to be sent"]
2077#[derive(Debug)]
2078pub struct PeerManagerExtGetControllerForTargetResponder {
2079 control_handle: std::mem::ManuallyDrop<PeerManagerExtControlHandle>,
2080 tx_id: u32,
2081}
2082
2083impl std::ops::Drop for PeerManagerExtGetControllerForTargetResponder {
2087 fn drop(&mut self) {
2088 self.control_handle.shutdown();
2089 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
2091 }
2092}
2093
2094impl fidl::endpoints::Responder for PeerManagerExtGetControllerForTargetResponder {
2095 type ControlHandle = PeerManagerExtControlHandle;
2096
2097 fn control_handle(&self) -> &PeerManagerExtControlHandle {
2098 &self.control_handle
2099 }
2100
2101 fn drop_without_shutdown(mut self) {
2102 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
2104 std::mem::forget(self);
2106 }
2107}
2108
2109impl PeerManagerExtGetControllerForTargetResponder {
2110 pub fn send(self, mut result: Result<(), i32>) -> Result<(), fidl::Error> {
2114 let _result = self.send_raw(result);
2115 if _result.is_err() {
2116 self.control_handle.shutdown();
2117 }
2118 self.drop_without_shutdown();
2119 _result
2120 }
2121
2122 pub fn send_no_shutdown_on_err(self, mut result: Result<(), i32>) -> Result<(), fidl::Error> {
2124 let _result = self.send_raw(result);
2125 self.drop_without_shutdown();
2126 _result
2127 }
2128
2129 fn send_raw(&self, mut result: Result<(), i32>) -> Result<(), fidl::Error> {
2130 self.control_handle
2131 .inner
2132 .send::<fidl::encoding::ResultType<fidl::encoding::EmptyStruct, i32>>(
2133 result,
2134 self.tx_id,
2135 0x39448b0c65966553,
2136 fidl::encoding::DynamicFlags::empty(),
2137 )
2138 }
2139}
2140
2141mod internal {
2142 use super::*;
2143
2144 impl fidl::encoding::ResourceTypeMarker for PeerManagerExtGetBrowseControllerForTargetRequest {
2145 type Borrowed<'a> = &'a mut Self;
2146 fn take_or_borrow<'a>(
2147 value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
2148 ) -> Self::Borrowed<'a> {
2149 value
2150 }
2151 }
2152
2153 unsafe impl fidl::encoding::TypeMarker for PeerManagerExtGetBrowseControllerForTargetRequest {
2154 type Owned = Self;
2155
2156 #[inline(always)]
2157 fn inline_align(_context: fidl::encoding::Context) -> usize {
2158 8
2159 }
2160
2161 #[inline(always)]
2162 fn inline_size(_context: fidl::encoding::Context) -> usize {
2163 16
2164 }
2165 }
2166
2167 unsafe impl
2168 fidl::encoding::Encode<
2169 PeerManagerExtGetBrowseControllerForTargetRequest,
2170 fidl::encoding::DefaultFuchsiaResourceDialect,
2171 > for &mut PeerManagerExtGetBrowseControllerForTargetRequest
2172 {
2173 #[inline]
2174 unsafe fn encode(
2175 self,
2176 encoder: &mut fidl::encoding::Encoder<
2177 '_,
2178 fidl::encoding::DefaultFuchsiaResourceDialect,
2179 >,
2180 offset: usize,
2181 _depth: fidl::encoding::Depth,
2182 ) -> fidl::Result<()> {
2183 encoder.debug_check_bounds::<PeerManagerExtGetBrowseControllerForTargetRequest>(offset);
2184 fidl::encoding::Encode::<PeerManagerExtGetBrowseControllerForTargetRequest, fidl::encoding::DefaultFuchsiaResourceDialect>::encode(
2186 (
2187 <fidl_fuchsia_bluetooth::PeerId as fidl::encoding::ValueTypeMarker>::borrow(&self.peer_id),
2188 <fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<BrowseControllerExtMarker>> as fidl::encoding::ResourceTypeMarker>::take_or_borrow(&mut self.client),
2189 ),
2190 encoder, offset, _depth
2191 )
2192 }
2193 }
2194 unsafe impl<
2195 T0: fidl::encoding::Encode<
2196 fidl_fuchsia_bluetooth::PeerId,
2197 fidl::encoding::DefaultFuchsiaResourceDialect,
2198 >,
2199 T1: fidl::encoding::Encode<
2200 fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<BrowseControllerExtMarker>>,
2201 fidl::encoding::DefaultFuchsiaResourceDialect,
2202 >,
2203 >
2204 fidl::encoding::Encode<
2205 PeerManagerExtGetBrowseControllerForTargetRequest,
2206 fidl::encoding::DefaultFuchsiaResourceDialect,
2207 > for (T0, T1)
2208 {
2209 #[inline]
2210 unsafe fn encode(
2211 self,
2212 encoder: &mut fidl::encoding::Encoder<
2213 '_,
2214 fidl::encoding::DefaultFuchsiaResourceDialect,
2215 >,
2216 offset: usize,
2217 depth: fidl::encoding::Depth,
2218 ) -> fidl::Result<()> {
2219 encoder.debug_check_bounds::<PeerManagerExtGetBrowseControllerForTargetRequest>(offset);
2220 unsafe {
2223 let ptr = encoder.buf.as_mut_ptr().add(offset).offset(8);
2224 (ptr as *mut u64).write_unaligned(0);
2225 }
2226 self.0.encode(encoder, offset + 0, depth)?;
2228 self.1.encode(encoder, offset + 8, depth)?;
2229 Ok(())
2230 }
2231 }
2232
2233 impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
2234 for PeerManagerExtGetBrowseControllerForTargetRequest
2235 {
2236 #[inline(always)]
2237 fn new_empty() -> Self {
2238 Self {
2239 peer_id: fidl::new_empty!(
2240 fidl_fuchsia_bluetooth::PeerId,
2241 fidl::encoding::DefaultFuchsiaResourceDialect
2242 ),
2243 client: fidl::new_empty!(
2244 fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<BrowseControllerExtMarker>>,
2245 fidl::encoding::DefaultFuchsiaResourceDialect
2246 ),
2247 }
2248 }
2249
2250 #[inline]
2251 unsafe fn decode(
2252 &mut self,
2253 decoder: &mut fidl::encoding::Decoder<
2254 '_,
2255 fidl::encoding::DefaultFuchsiaResourceDialect,
2256 >,
2257 offset: usize,
2258 _depth: fidl::encoding::Depth,
2259 ) -> fidl::Result<()> {
2260 decoder.debug_check_bounds::<Self>(offset);
2261 let ptr = unsafe { decoder.buf.as_ptr().add(offset).offset(8) };
2263 let padval = unsafe { (ptr as *const u64).read_unaligned() };
2264 let mask = 0xffffffff00000000u64;
2265 let maskedval = padval & mask;
2266 if maskedval != 0 {
2267 return Err(fidl::Error::NonZeroPadding {
2268 padding_start: offset + 8 + ((mask as u64).trailing_zeros() / 8) as usize,
2269 });
2270 }
2271 fidl::decode!(
2272 fidl_fuchsia_bluetooth::PeerId,
2273 fidl::encoding::DefaultFuchsiaResourceDialect,
2274 &mut self.peer_id,
2275 decoder,
2276 offset + 0,
2277 _depth
2278 )?;
2279 fidl::decode!(
2280 fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<BrowseControllerExtMarker>>,
2281 fidl::encoding::DefaultFuchsiaResourceDialect,
2282 &mut self.client,
2283 decoder,
2284 offset + 8,
2285 _depth
2286 )?;
2287 Ok(())
2288 }
2289 }
2290
2291 impl fidl::encoding::ResourceTypeMarker for PeerManagerExtGetControllerForTargetRequest {
2292 type Borrowed<'a> = &'a mut Self;
2293 fn take_or_borrow<'a>(
2294 value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
2295 ) -> Self::Borrowed<'a> {
2296 value
2297 }
2298 }
2299
2300 unsafe impl fidl::encoding::TypeMarker for PeerManagerExtGetControllerForTargetRequest {
2301 type Owned = Self;
2302
2303 #[inline(always)]
2304 fn inline_align(_context: fidl::encoding::Context) -> usize {
2305 8
2306 }
2307
2308 #[inline(always)]
2309 fn inline_size(_context: fidl::encoding::Context) -> usize {
2310 16
2311 }
2312 }
2313
2314 unsafe impl
2315 fidl::encoding::Encode<
2316 PeerManagerExtGetControllerForTargetRequest,
2317 fidl::encoding::DefaultFuchsiaResourceDialect,
2318 > for &mut PeerManagerExtGetControllerForTargetRequest
2319 {
2320 #[inline]
2321 unsafe fn encode(
2322 self,
2323 encoder: &mut fidl::encoding::Encoder<
2324 '_,
2325 fidl::encoding::DefaultFuchsiaResourceDialect,
2326 >,
2327 offset: usize,
2328 _depth: fidl::encoding::Depth,
2329 ) -> fidl::Result<()> {
2330 encoder.debug_check_bounds::<PeerManagerExtGetControllerForTargetRequest>(offset);
2331 fidl::encoding::Encode::<PeerManagerExtGetControllerForTargetRequest, fidl::encoding::DefaultFuchsiaResourceDialect>::encode(
2333 (
2334 <fidl_fuchsia_bluetooth::PeerId as fidl::encoding::ValueTypeMarker>::borrow(&self.peer_id),
2335 <fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<ControllerExtMarker>> as fidl::encoding::ResourceTypeMarker>::take_or_borrow(&mut self.client),
2336 ),
2337 encoder, offset, _depth
2338 )
2339 }
2340 }
2341 unsafe impl<
2342 T0: fidl::encoding::Encode<
2343 fidl_fuchsia_bluetooth::PeerId,
2344 fidl::encoding::DefaultFuchsiaResourceDialect,
2345 >,
2346 T1: fidl::encoding::Encode<
2347 fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<ControllerExtMarker>>,
2348 fidl::encoding::DefaultFuchsiaResourceDialect,
2349 >,
2350 >
2351 fidl::encoding::Encode<
2352 PeerManagerExtGetControllerForTargetRequest,
2353 fidl::encoding::DefaultFuchsiaResourceDialect,
2354 > for (T0, T1)
2355 {
2356 #[inline]
2357 unsafe fn encode(
2358 self,
2359 encoder: &mut fidl::encoding::Encoder<
2360 '_,
2361 fidl::encoding::DefaultFuchsiaResourceDialect,
2362 >,
2363 offset: usize,
2364 depth: fidl::encoding::Depth,
2365 ) -> fidl::Result<()> {
2366 encoder.debug_check_bounds::<PeerManagerExtGetControllerForTargetRequest>(offset);
2367 unsafe {
2370 let ptr = encoder.buf.as_mut_ptr().add(offset).offset(8);
2371 (ptr as *mut u64).write_unaligned(0);
2372 }
2373 self.0.encode(encoder, offset + 0, depth)?;
2375 self.1.encode(encoder, offset + 8, depth)?;
2376 Ok(())
2377 }
2378 }
2379
2380 impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
2381 for PeerManagerExtGetControllerForTargetRequest
2382 {
2383 #[inline(always)]
2384 fn new_empty() -> Self {
2385 Self {
2386 peer_id: fidl::new_empty!(
2387 fidl_fuchsia_bluetooth::PeerId,
2388 fidl::encoding::DefaultFuchsiaResourceDialect
2389 ),
2390 client: fidl::new_empty!(
2391 fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<ControllerExtMarker>>,
2392 fidl::encoding::DefaultFuchsiaResourceDialect
2393 ),
2394 }
2395 }
2396
2397 #[inline]
2398 unsafe fn decode(
2399 &mut self,
2400 decoder: &mut fidl::encoding::Decoder<
2401 '_,
2402 fidl::encoding::DefaultFuchsiaResourceDialect,
2403 >,
2404 offset: usize,
2405 _depth: fidl::encoding::Depth,
2406 ) -> fidl::Result<()> {
2407 decoder.debug_check_bounds::<Self>(offset);
2408 let ptr = unsafe { decoder.buf.as_ptr().add(offset).offset(8) };
2410 let padval = unsafe { (ptr as *const u64).read_unaligned() };
2411 let mask = 0xffffffff00000000u64;
2412 let maskedval = padval & mask;
2413 if maskedval != 0 {
2414 return Err(fidl::Error::NonZeroPadding {
2415 padding_start: offset + 8 + ((mask as u64).trailing_zeros() / 8) as usize,
2416 });
2417 }
2418 fidl::decode!(
2419 fidl_fuchsia_bluetooth::PeerId,
2420 fidl::encoding::DefaultFuchsiaResourceDialect,
2421 &mut self.peer_id,
2422 decoder,
2423 offset + 0,
2424 _depth
2425 )?;
2426 fidl::decode!(
2427 fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<ControllerExtMarker>>,
2428 fidl::encoding::DefaultFuchsiaResourceDialect,
2429 &mut self.client,
2430 decoder,
2431 offset + 8,
2432 _depth
2433 )?;
2434 Ok(())
2435 }
2436 }
2437}