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_bredr__common::*;
11use futures::future::{self, MaybeDone, TryFutureExt};
12use zx_status;
13
14#[derive(Debug, PartialEq)]
15pub struct AudioOffloadExtStartAudioOffloadRequest {
16 pub configuration: AudioOffloadConfiguration,
17 pub controller: fidl::endpoints::ServerEnd<AudioOffloadControllerMarker>,
18}
19
20impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect>
21 for AudioOffloadExtStartAudioOffloadRequest
22{
23}
24
25#[derive(Debug, PartialEq)]
26pub struct ConnectionReceiverConnectedRequest {
27 pub peer_id: fidl_fuchsia_bluetooth::PeerId,
28 pub channel: Channel,
29 pub protocol: Vec<ProtocolDescriptor>,
30}
31
32impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect>
33 for ConnectionReceiverConnectedRequest
34{
35}
36
37#[derive(Debug, PartialEq)]
38pub struct ProfileConnectResponse {
39 pub channel: Channel,
40}
41
42impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect> for ProfileConnectResponse {}
43
44#[derive(Debug, Default, PartialEq)]
46pub struct Channel {
47 pub socket: Option<fidl::Socket>,
52 pub channel_mode: Option<fidl_fuchsia_bluetooth::ChannelMode>,
55 pub max_tx_sdu_size: Option<u16>,
58 pub ext_direction: Option<fidl::endpoints::ClientEnd<AudioDirectionExtMarker>>,
61 pub flush_timeout: Option<i64>,
62 pub ext_l2cap: Option<fidl::endpoints::ClientEnd<L2capParametersExtMarker>>,
65 pub ext_audio_offload: Option<fidl::endpoints::ClientEnd<AudioOffloadExtMarker>>,
68 pub connection: Option<fidl::endpoints::ClientEnd<fidl_fuchsia_bluetooth::ChannelMarker>>,
71 #[doc(hidden)]
72 pub __source_breaking: fidl::marker::SourceBreaking,
73}
74
75impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect> for Channel {}
76
77#[derive(Debug, Default, PartialEq)]
78pub struct ConnectionReceiver2ConnectedRequest {
79 pub peer_id: Option<fidl_fuchsia_bluetooth::PeerId>,
80 pub channel: Option<Channel>,
81 pub protocol: Option<Vec<ProtocolDescriptor>>,
82 #[doc(hidden)]
83 pub __source_breaking: fidl::marker::SourceBreaking,
84}
85
86impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect>
87 for ConnectionReceiver2ConnectedRequest
88{
89}
90
91#[derive(Debug, Default, PartialEq)]
92pub struct ProfileAdvertiseRequest {
93 pub services: Option<Vec<ServiceDefinition>>,
96 pub receiver: Option<fidl::endpoints::ClientEnd<ConnectionReceiverMarker>>,
99 pub parameters: Option<fidl_fuchsia_bluetooth::ChannelParameters>,
102 pub connection_receiver: Option<fidl::endpoints::ClientEnd<ConnectionReceiver2Marker>>,
105 #[doc(hidden)]
106 pub __source_breaking: fidl::marker::SourceBreaking,
107}
108
109impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect> for ProfileAdvertiseRequest {}
110
111#[derive(Debug, Default, PartialEq)]
112pub struct ProfileConnectScoRequest {
113 pub peer_id: Option<fidl_fuchsia_bluetooth::PeerId>,
115 pub initiator: Option<bool>,
117 pub params: Option<Vec<ScoConnectionParameters>>,
119 pub connection: Option<fidl::endpoints::ServerEnd<ScoConnectionMarker>>,
121 #[doc(hidden)]
122 pub __source_breaking: fidl::marker::SourceBreaking,
123}
124
125impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect> for ProfileConnectScoRequest {}
126
127#[derive(Debug, Default, PartialEq)]
128pub struct ProfileSearchRequest {
129 pub service_uuid: Option<ServiceClassProfileIdentifier>,
131 pub attr_ids: Option<Vec<u16>>,
133 pub results: Option<fidl::endpoints::ClientEnd<SearchResultsMarker>>,
135 pub full_uuid: Option<fidl_fuchsia_bluetooth::Uuid>,
137 #[doc(hidden)]
138 pub __source_breaking: fidl::marker::SourceBreaking,
139}
140
141impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect> for ProfileSearchRequest {}
142
143#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
144pub struct AudioDirectionExtMarker;
145
146impl fidl::endpoints::ProtocolMarker for AudioDirectionExtMarker {
147 type Proxy = AudioDirectionExtProxy;
148 type RequestStream = AudioDirectionExtRequestStream;
149 #[cfg(target_os = "fuchsia")]
150 type SynchronousProxy = AudioDirectionExtSynchronousProxy;
151
152 const DEBUG_NAME: &'static str = "(anonymous) AudioDirectionExt";
153}
154pub type AudioDirectionExtSetPriorityResult = Result<(), fidl_fuchsia_bluetooth::ErrorCode>;
155
156pub trait AudioDirectionExtProxyInterface: Send + Sync {
157 type SetPriorityResponseFut: std::future::Future<Output = Result<AudioDirectionExtSetPriorityResult, fidl::Error>>
158 + Send;
159 fn r#set_priority(&self, priority: A2dpDirectionPriority) -> Self::SetPriorityResponseFut;
160}
161#[derive(Debug)]
162#[cfg(target_os = "fuchsia")]
163pub struct AudioDirectionExtSynchronousProxy {
164 client: fidl::client::sync::Client,
165}
166
167#[cfg(target_os = "fuchsia")]
168impl fidl::endpoints::SynchronousProxy for AudioDirectionExtSynchronousProxy {
169 type Proxy = AudioDirectionExtProxy;
170 type Protocol = AudioDirectionExtMarker;
171
172 fn from_channel(inner: fidl::Channel) -> Self {
173 Self::new(inner)
174 }
175
176 fn into_channel(self) -> fidl::Channel {
177 self.client.into_channel()
178 }
179
180 fn as_channel(&self) -> &fidl::Channel {
181 self.client.as_channel()
182 }
183}
184
185#[cfg(target_os = "fuchsia")]
186impl AudioDirectionExtSynchronousProxy {
187 pub fn new(channel: fidl::Channel) -> Self {
188 let protocol_name =
189 <AudioDirectionExtMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
190 Self { client: fidl::client::sync::Client::new(channel, protocol_name) }
191 }
192
193 pub fn into_channel(self) -> fidl::Channel {
194 self.client.into_channel()
195 }
196
197 pub fn wait_for_event(
200 &self,
201 deadline: zx::MonotonicInstant,
202 ) -> Result<AudioDirectionExtEvent, fidl::Error> {
203 AudioDirectionExtEvent::decode(self.client.wait_for_event(deadline)?)
204 }
205
206 pub fn r#set_priority(
207 &self,
208 mut priority: A2dpDirectionPriority,
209 ___deadline: zx::MonotonicInstant,
210 ) -> Result<AudioDirectionExtSetPriorityResult, fidl::Error> {
211 let _response = self
212 .client
213 .send_query::<AudioDirectionExtSetPriorityRequest, fidl::encoding::FlexibleResultType<
214 fidl::encoding::EmptyStruct,
215 fidl_fuchsia_bluetooth::ErrorCode,
216 >>(
217 (priority,),
218 0x792713ef3b2bc38a,
219 fidl::encoding::DynamicFlags::FLEXIBLE,
220 ___deadline,
221 )?
222 .into_result::<AudioDirectionExtMarker>("set_priority")?;
223 Ok(_response.map(|x| x))
224 }
225}
226
227#[cfg(target_os = "fuchsia")]
228impl From<AudioDirectionExtSynchronousProxy> for zx::Handle {
229 fn from(value: AudioDirectionExtSynchronousProxy) -> Self {
230 value.into_channel().into()
231 }
232}
233
234#[cfg(target_os = "fuchsia")]
235impl From<fidl::Channel> for AudioDirectionExtSynchronousProxy {
236 fn from(value: fidl::Channel) -> Self {
237 Self::new(value)
238 }
239}
240
241#[cfg(target_os = "fuchsia")]
242impl fidl::endpoints::FromClient for AudioDirectionExtSynchronousProxy {
243 type Protocol = AudioDirectionExtMarker;
244
245 fn from_client(value: fidl::endpoints::ClientEnd<AudioDirectionExtMarker>) -> Self {
246 Self::new(value.into_channel())
247 }
248}
249
250#[derive(Debug, Clone)]
251pub struct AudioDirectionExtProxy {
252 client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
253}
254
255impl fidl::endpoints::Proxy for AudioDirectionExtProxy {
256 type Protocol = AudioDirectionExtMarker;
257
258 fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
259 Self::new(inner)
260 }
261
262 fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
263 self.client.into_channel().map_err(|client| Self { client })
264 }
265
266 fn as_channel(&self) -> &::fidl::AsyncChannel {
267 self.client.as_channel()
268 }
269}
270
271impl AudioDirectionExtProxy {
272 pub fn new(channel: ::fidl::AsyncChannel) -> Self {
274 let protocol_name =
275 <AudioDirectionExtMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
276 Self { client: fidl::client::Client::new(channel, protocol_name) }
277 }
278
279 pub fn take_event_stream(&self) -> AudioDirectionExtEventStream {
285 AudioDirectionExtEventStream { event_receiver: self.client.take_event_receiver() }
286 }
287
288 pub fn r#set_priority(
289 &self,
290 mut priority: A2dpDirectionPriority,
291 ) -> fidl::client::QueryResponseFut<
292 AudioDirectionExtSetPriorityResult,
293 fidl::encoding::DefaultFuchsiaResourceDialect,
294 > {
295 AudioDirectionExtProxyInterface::r#set_priority(self, priority)
296 }
297}
298
299impl AudioDirectionExtProxyInterface for AudioDirectionExtProxy {
300 type SetPriorityResponseFut = fidl::client::QueryResponseFut<
301 AudioDirectionExtSetPriorityResult,
302 fidl::encoding::DefaultFuchsiaResourceDialect,
303 >;
304 fn r#set_priority(&self, mut priority: A2dpDirectionPriority) -> Self::SetPriorityResponseFut {
305 fn _decode(
306 mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
307 ) -> Result<AudioDirectionExtSetPriorityResult, fidl::Error> {
308 let _response = fidl::client::decode_transaction_body::<
309 fidl::encoding::FlexibleResultType<
310 fidl::encoding::EmptyStruct,
311 fidl_fuchsia_bluetooth::ErrorCode,
312 >,
313 fidl::encoding::DefaultFuchsiaResourceDialect,
314 0x792713ef3b2bc38a,
315 >(_buf?)?
316 .into_result::<AudioDirectionExtMarker>("set_priority")?;
317 Ok(_response.map(|x| x))
318 }
319 self.client.send_query_and_decode::<
320 AudioDirectionExtSetPriorityRequest,
321 AudioDirectionExtSetPriorityResult,
322 >(
323 (priority,),
324 0x792713ef3b2bc38a,
325 fidl::encoding::DynamicFlags::FLEXIBLE,
326 _decode,
327 )
328 }
329}
330
331pub struct AudioDirectionExtEventStream {
332 event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
333}
334
335impl std::marker::Unpin for AudioDirectionExtEventStream {}
336
337impl futures::stream::FusedStream for AudioDirectionExtEventStream {
338 fn is_terminated(&self) -> bool {
339 self.event_receiver.is_terminated()
340 }
341}
342
343impl futures::Stream for AudioDirectionExtEventStream {
344 type Item = Result<AudioDirectionExtEvent, fidl::Error>;
345
346 fn poll_next(
347 mut self: std::pin::Pin<&mut Self>,
348 cx: &mut std::task::Context<'_>,
349 ) -> std::task::Poll<Option<Self::Item>> {
350 match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
351 &mut self.event_receiver,
352 cx
353 )?) {
354 Some(buf) => std::task::Poll::Ready(Some(AudioDirectionExtEvent::decode(buf))),
355 None => std::task::Poll::Ready(None),
356 }
357 }
358}
359
360#[derive(Debug)]
361pub enum AudioDirectionExtEvent {
362 #[non_exhaustive]
363 _UnknownEvent {
364 ordinal: u64,
366 },
367}
368
369impl AudioDirectionExtEvent {
370 fn decode(
372 mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
373 ) -> Result<AudioDirectionExtEvent, fidl::Error> {
374 let (bytes, _handles) = buf.split_mut();
375 let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
376 debug_assert_eq!(tx_header.tx_id, 0);
377 match tx_header.ordinal {
378 _ if tx_header.dynamic_flags().contains(fidl::encoding::DynamicFlags::FLEXIBLE) => {
379 Ok(AudioDirectionExtEvent::_UnknownEvent { ordinal: tx_header.ordinal })
380 }
381 _ => Err(fidl::Error::UnknownOrdinal {
382 ordinal: tx_header.ordinal,
383 protocol_name:
384 <AudioDirectionExtMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
385 }),
386 }
387 }
388}
389
390pub struct AudioDirectionExtRequestStream {
392 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
393 is_terminated: bool,
394}
395
396impl std::marker::Unpin for AudioDirectionExtRequestStream {}
397
398impl futures::stream::FusedStream for AudioDirectionExtRequestStream {
399 fn is_terminated(&self) -> bool {
400 self.is_terminated
401 }
402}
403
404impl fidl::endpoints::RequestStream for AudioDirectionExtRequestStream {
405 type Protocol = AudioDirectionExtMarker;
406 type ControlHandle = AudioDirectionExtControlHandle;
407
408 fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
409 Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
410 }
411
412 fn control_handle(&self) -> Self::ControlHandle {
413 AudioDirectionExtControlHandle { inner: self.inner.clone() }
414 }
415
416 fn into_inner(
417 self,
418 ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
419 {
420 (self.inner, self.is_terminated)
421 }
422
423 fn from_inner(
424 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
425 is_terminated: bool,
426 ) -> Self {
427 Self { inner, is_terminated }
428 }
429}
430
431impl futures::Stream for AudioDirectionExtRequestStream {
432 type Item = Result<AudioDirectionExtRequest, fidl::Error>;
433
434 fn poll_next(
435 mut self: std::pin::Pin<&mut Self>,
436 cx: &mut std::task::Context<'_>,
437 ) -> std::task::Poll<Option<Self::Item>> {
438 let this = &mut *self;
439 if this.inner.check_shutdown(cx) {
440 this.is_terminated = true;
441 return std::task::Poll::Ready(None);
442 }
443 if this.is_terminated {
444 panic!("polled AudioDirectionExtRequestStream after completion");
445 }
446 fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
447 |bytes, handles| {
448 match this.inner.channel().read_etc(cx, bytes, handles) {
449 std::task::Poll::Ready(Ok(())) => {}
450 std::task::Poll::Pending => return std::task::Poll::Pending,
451 std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
452 this.is_terminated = true;
453 return std::task::Poll::Ready(None);
454 }
455 std::task::Poll::Ready(Err(e)) => {
456 return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
457 e.into(),
458 ))));
459 }
460 }
461
462 let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
464
465 std::task::Poll::Ready(Some(match header.ordinal {
466 0x792713ef3b2bc38a => {
467 header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
468 let mut req = fidl::new_empty!(
469 AudioDirectionExtSetPriorityRequest,
470 fidl::encoding::DefaultFuchsiaResourceDialect
471 );
472 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<AudioDirectionExtSetPriorityRequest>(&header, _body_bytes, handles, &mut req)?;
473 let control_handle =
474 AudioDirectionExtControlHandle { inner: this.inner.clone() };
475 Ok(AudioDirectionExtRequest::SetPriority {
476 priority: req.priority,
477
478 responder: AudioDirectionExtSetPriorityResponder {
479 control_handle: std::mem::ManuallyDrop::new(control_handle),
480 tx_id: header.tx_id,
481 },
482 })
483 }
484 _ if header.tx_id == 0
485 && header
486 .dynamic_flags()
487 .contains(fidl::encoding::DynamicFlags::FLEXIBLE) =>
488 {
489 Ok(AudioDirectionExtRequest::_UnknownMethod {
490 ordinal: header.ordinal,
491 control_handle: AudioDirectionExtControlHandle {
492 inner: this.inner.clone(),
493 },
494 method_type: fidl::MethodType::OneWay,
495 })
496 }
497 _ if header
498 .dynamic_flags()
499 .contains(fidl::encoding::DynamicFlags::FLEXIBLE) =>
500 {
501 this.inner.send_framework_err(
502 fidl::encoding::FrameworkErr::UnknownMethod,
503 header.tx_id,
504 header.ordinal,
505 header.dynamic_flags(),
506 (bytes, handles),
507 )?;
508 Ok(AudioDirectionExtRequest::_UnknownMethod {
509 ordinal: header.ordinal,
510 control_handle: AudioDirectionExtControlHandle {
511 inner: this.inner.clone(),
512 },
513 method_type: fidl::MethodType::TwoWay,
514 })
515 }
516 _ => Err(fidl::Error::UnknownOrdinal {
517 ordinal: header.ordinal,
518 protocol_name:
519 <AudioDirectionExtMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
520 }),
521 }))
522 },
523 )
524 }
525}
526
527#[derive(Debug)]
530pub enum AudioDirectionExtRequest {
531 SetPriority {
532 priority: A2dpDirectionPriority,
533 responder: AudioDirectionExtSetPriorityResponder,
534 },
535 #[non_exhaustive]
537 _UnknownMethod {
538 ordinal: u64,
540 control_handle: AudioDirectionExtControlHandle,
541 method_type: fidl::MethodType,
542 },
543}
544
545impl AudioDirectionExtRequest {
546 #[allow(irrefutable_let_patterns)]
547 pub fn into_set_priority(
548 self,
549 ) -> Option<(A2dpDirectionPriority, AudioDirectionExtSetPriorityResponder)> {
550 if let AudioDirectionExtRequest::SetPriority { priority, responder } = self {
551 Some((priority, responder))
552 } else {
553 None
554 }
555 }
556
557 pub fn method_name(&self) -> &'static str {
559 match *self {
560 AudioDirectionExtRequest::SetPriority { .. } => "set_priority",
561 AudioDirectionExtRequest::_UnknownMethod {
562 method_type: fidl::MethodType::OneWay,
563 ..
564 } => "unknown one-way method",
565 AudioDirectionExtRequest::_UnknownMethod {
566 method_type: fidl::MethodType::TwoWay,
567 ..
568 } => "unknown two-way method",
569 }
570 }
571}
572
573#[derive(Debug, Clone)]
574pub struct AudioDirectionExtControlHandle {
575 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
576}
577
578impl fidl::endpoints::ControlHandle for AudioDirectionExtControlHandle {
579 fn shutdown(&self) {
580 self.inner.shutdown()
581 }
582 fn shutdown_with_epitaph(&self, status: zx_status::Status) {
583 self.inner.shutdown_with_epitaph(status)
584 }
585
586 fn is_closed(&self) -> bool {
587 self.inner.channel().is_closed()
588 }
589 fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
590 self.inner.channel().on_closed()
591 }
592
593 #[cfg(target_os = "fuchsia")]
594 fn signal_peer(
595 &self,
596 clear_mask: zx::Signals,
597 set_mask: zx::Signals,
598 ) -> Result<(), zx_status::Status> {
599 use fidl::Peered;
600 self.inner.channel().signal_peer(clear_mask, set_mask)
601 }
602}
603
604impl AudioDirectionExtControlHandle {}
605
606#[must_use = "FIDL methods require a response to be sent"]
607#[derive(Debug)]
608pub struct AudioDirectionExtSetPriorityResponder {
609 control_handle: std::mem::ManuallyDrop<AudioDirectionExtControlHandle>,
610 tx_id: u32,
611}
612
613impl std::ops::Drop for AudioDirectionExtSetPriorityResponder {
617 fn drop(&mut self) {
618 self.control_handle.shutdown();
619 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
621 }
622}
623
624impl fidl::endpoints::Responder for AudioDirectionExtSetPriorityResponder {
625 type ControlHandle = AudioDirectionExtControlHandle;
626
627 fn control_handle(&self) -> &AudioDirectionExtControlHandle {
628 &self.control_handle
629 }
630
631 fn drop_without_shutdown(mut self) {
632 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
634 std::mem::forget(self);
636 }
637}
638
639impl AudioDirectionExtSetPriorityResponder {
640 pub fn send(
644 self,
645 mut result: Result<(), fidl_fuchsia_bluetooth::ErrorCode>,
646 ) -> Result<(), fidl::Error> {
647 let _result = self.send_raw(result);
648 if _result.is_err() {
649 self.control_handle.shutdown();
650 }
651 self.drop_without_shutdown();
652 _result
653 }
654
655 pub fn send_no_shutdown_on_err(
657 self,
658 mut result: Result<(), fidl_fuchsia_bluetooth::ErrorCode>,
659 ) -> Result<(), fidl::Error> {
660 let _result = self.send_raw(result);
661 self.drop_without_shutdown();
662 _result
663 }
664
665 fn send_raw(
666 &self,
667 mut result: Result<(), fidl_fuchsia_bluetooth::ErrorCode>,
668 ) -> Result<(), fidl::Error> {
669 self.control_handle.inner.send::<fidl::encoding::FlexibleResultType<
670 fidl::encoding::EmptyStruct,
671 fidl_fuchsia_bluetooth::ErrorCode,
672 >>(
673 fidl::encoding::FlexibleResult::new(result),
674 self.tx_id,
675 0x792713ef3b2bc38a,
676 fidl::encoding::DynamicFlags::FLEXIBLE,
677 )
678 }
679}
680
681#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
682pub struct AudioOffloadControllerMarker;
683
684impl fidl::endpoints::ProtocolMarker for AudioOffloadControllerMarker {
685 type Proxy = AudioOffloadControllerProxy;
686 type RequestStream = AudioOffloadControllerRequestStream;
687 #[cfg(target_os = "fuchsia")]
688 type SynchronousProxy = AudioOffloadControllerSynchronousProxy;
689
690 const DEBUG_NAME: &'static str = "(anonymous) AudioOffloadController";
691}
692
693pub trait AudioOffloadControllerProxyInterface: Send + Sync {
694 type StopResponseFut: std::future::Future<Output = Result<(), fidl::Error>> + Send;
695 fn r#stop(&self) -> Self::StopResponseFut;
696}
697#[derive(Debug)]
698#[cfg(target_os = "fuchsia")]
699pub struct AudioOffloadControllerSynchronousProxy {
700 client: fidl::client::sync::Client,
701}
702
703#[cfg(target_os = "fuchsia")]
704impl fidl::endpoints::SynchronousProxy for AudioOffloadControllerSynchronousProxy {
705 type Proxy = AudioOffloadControllerProxy;
706 type Protocol = AudioOffloadControllerMarker;
707
708 fn from_channel(inner: fidl::Channel) -> Self {
709 Self::new(inner)
710 }
711
712 fn into_channel(self) -> fidl::Channel {
713 self.client.into_channel()
714 }
715
716 fn as_channel(&self) -> &fidl::Channel {
717 self.client.as_channel()
718 }
719}
720
721#[cfg(target_os = "fuchsia")]
722impl AudioOffloadControllerSynchronousProxy {
723 pub fn new(channel: fidl::Channel) -> Self {
724 let protocol_name =
725 <AudioOffloadControllerMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
726 Self { client: fidl::client::sync::Client::new(channel, protocol_name) }
727 }
728
729 pub fn into_channel(self) -> fidl::Channel {
730 self.client.into_channel()
731 }
732
733 pub fn wait_for_event(
736 &self,
737 deadline: zx::MonotonicInstant,
738 ) -> Result<AudioOffloadControllerEvent, fidl::Error> {
739 AudioOffloadControllerEvent::decode(self.client.wait_for_event(deadline)?)
740 }
741
742 pub fn r#stop(&self, ___deadline: zx::MonotonicInstant) -> Result<(), fidl::Error> {
745 let _response = self.client.send_query::<
746 fidl::encoding::EmptyPayload,
747 fidl::encoding::FlexibleType<fidl::encoding::EmptyStruct>,
748 >(
749 (),
750 0x37845d5a47ce5e39,
751 fidl::encoding::DynamicFlags::FLEXIBLE,
752 ___deadline,
753 )?
754 .into_result::<AudioOffloadControllerMarker>("stop")?;
755 Ok(_response)
756 }
757}
758
759#[cfg(target_os = "fuchsia")]
760impl From<AudioOffloadControllerSynchronousProxy> for zx::Handle {
761 fn from(value: AudioOffloadControllerSynchronousProxy) -> Self {
762 value.into_channel().into()
763 }
764}
765
766#[cfg(target_os = "fuchsia")]
767impl From<fidl::Channel> for AudioOffloadControllerSynchronousProxy {
768 fn from(value: fidl::Channel) -> Self {
769 Self::new(value)
770 }
771}
772
773#[cfg(target_os = "fuchsia")]
774impl fidl::endpoints::FromClient for AudioOffloadControllerSynchronousProxy {
775 type Protocol = AudioOffloadControllerMarker;
776
777 fn from_client(value: fidl::endpoints::ClientEnd<AudioOffloadControllerMarker>) -> Self {
778 Self::new(value.into_channel())
779 }
780}
781
782#[derive(Debug, Clone)]
783pub struct AudioOffloadControllerProxy {
784 client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
785}
786
787impl fidl::endpoints::Proxy for AudioOffloadControllerProxy {
788 type Protocol = AudioOffloadControllerMarker;
789
790 fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
791 Self::new(inner)
792 }
793
794 fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
795 self.client.into_channel().map_err(|client| Self { client })
796 }
797
798 fn as_channel(&self) -> &::fidl::AsyncChannel {
799 self.client.as_channel()
800 }
801}
802
803impl AudioOffloadControllerProxy {
804 pub fn new(channel: ::fidl::AsyncChannel) -> Self {
806 let protocol_name =
807 <AudioOffloadControllerMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
808 Self { client: fidl::client::Client::new(channel, protocol_name) }
809 }
810
811 pub fn take_event_stream(&self) -> AudioOffloadControllerEventStream {
817 AudioOffloadControllerEventStream { event_receiver: self.client.take_event_receiver() }
818 }
819
820 pub fn r#stop(
823 &self,
824 ) -> fidl::client::QueryResponseFut<(), fidl::encoding::DefaultFuchsiaResourceDialect> {
825 AudioOffloadControllerProxyInterface::r#stop(self)
826 }
827}
828
829impl AudioOffloadControllerProxyInterface for AudioOffloadControllerProxy {
830 type StopResponseFut =
831 fidl::client::QueryResponseFut<(), fidl::encoding::DefaultFuchsiaResourceDialect>;
832 fn r#stop(&self) -> Self::StopResponseFut {
833 fn _decode(
834 mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
835 ) -> Result<(), fidl::Error> {
836 let _response = fidl::client::decode_transaction_body::<
837 fidl::encoding::FlexibleType<fidl::encoding::EmptyStruct>,
838 fidl::encoding::DefaultFuchsiaResourceDialect,
839 0x37845d5a47ce5e39,
840 >(_buf?)?
841 .into_result::<AudioOffloadControllerMarker>("stop")?;
842 Ok(_response)
843 }
844 self.client.send_query_and_decode::<fidl::encoding::EmptyPayload, ()>(
845 (),
846 0x37845d5a47ce5e39,
847 fidl::encoding::DynamicFlags::FLEXIBLE,
848 _decode,
849 )
850 }
851}
852
853pub struct AudioOffloadControllerEventStream {
854 event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
855}
856
857impl std::marker::Unpin for AudioOffloadControllerEventStream {}
858
859impl futures::stream::FusedStream for AudioOffloadControllerEventStream {
860 fn is_terminated(&self) -> bool {
861 self.event_receiver.is_terminated()
862 }
863}
864
865impl futures::Stream for AudioOffloadControllerEventStream {
866 type Item = Result<AudioOffloadControllerEvent, fidl::Error>;
867
868 fn poll_next(
869 mut self: std::pin::Pin<&mut Self>,
870 cx: &mut std::task::Context<'_>,
871 ) -> std::task::Poll<Option<Self::Item>> {
872 match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
873 &mut self.event_receiver,
874 cx
875 )?) {
876 Some(buf) => std::task::Poll::Ready(Some(AudioOffloadControllerEvent::decode(buf))),
877 None => std::task::Poll::Ready(None),
878 }
879 }
880}
881
882#[derive(Debug)]
883pub enum AudioOffloadControllerEvent {
884 OnStarted {},
885 #[non_exhaustive]
886 _UnknownEvent {
887 ordinal: u64,
889 },
890}
891
892impl AudioOffloadControllerEvent {
893 #[allow(irrefutable_let_patterns)]
894 pub fn into_on_started(self) -> Option<()> {
895 if let AudioOffloadControllerEvent::OnStarted {} = self { Some(()) } else { None }
896 }
897
898 fn decode(
900 mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
901 ) -> Result<AudioOffloadControllerEvent, fidl::Error> {
902 let (bytes, _handles) = buf.split_mut();
903 let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
904 debug_assert_eq!(tx_header.tx_id, 0);
905 match tx_header.ordinal {
906 0x7b624f210570fc30 => {
907 let mut out = fidl::new_empty!(
908 fidl::encoding::EmptyPayload,
909 fidl::encoding::DefaultFuchsiaResourceDialect
910 );
911 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&tx_header, _body_bytes, _handles, &mut out)?;
912 Ok((AudioOffloadControllerEvent::OnStarted {}))
913 }
914 _ if tx_header.dynamic_flags().contains(fidl::encoding::DynamicFlags::FLEXIBLE) => {
915 Ok(AudioOffloadControllerEvent::_UnknownEvent { ordinal: tx_header.ordinal })
916 }
917 _ => Err(fidl::Error::UnknownOrdinal {
918 ordinal: tx_header.ordinal,
919 protocol_name:
920 <AudioOffloadControllerMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
921 }),
922 }
923 }
924}
925
926pub struct AudioOffloadControllerRequestStream {
928 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
929 is_terminated: bool,
930}
931
932impl std::marker::Unpin for AudioOffloadControllerRequestStream {}
933
934impl futures::stream::FusedStream for AudioOffloadControllerRequestStream {
935 fn is_terminated(&self) -> bool {
936 self.is_terminated
937 }
938}
939
940impl fidl::endpoints::RequestStream for AudioOffloadControllerRequestStream {
941 type Protocol = AudioOffloadControllerMarker;
942 type ControlHandle = AudioOffloadControllerControlHandle;
943
944 fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
945 Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
946 }
947
948 fn control_handle(&self) -> Self::ControlHandle {
949 AudioOffloadControllerControlHandle { inner: self.inner.clone() }
950 }
951
952 fn into_inner(
953 self,
954 ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
955 {
956 (self.inner, self.is_terminated)
957 }
958
959 fn from_inner(
960 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
961 is_terminated: bool,
962 ) -> Self {
963 Self { inner, is_terminated }
964 }
965}
966
967impl futures::Stream for AudioOffloadControllerRequestStream {
968 type Item = Result<AudioOffloadControllerRequest, fidl::Error>;
969
970 fn poll_next(
971 mut self: std::pin::Pin<&mut Self>,
972 cx: &mut std::task::Context<'_>,
973 ) -> std::task::Poll<Option<Self::Item>> {
974 let this = &mut *self;
975 if this.inner.check_shutdown(cx) {
976 this.is_terminated = true;
977 return std::task::Poll::Ready(None);
978 }
979 if this.is_terminated {
980 panic!("polled AudioOffloadControllerRequestStream after completion");
981 }
982 fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
983 |bytes, handles| {
984 match this.inner.channel().read_etc(cx, bytes, handles) {
985 std::task::Poll::Ready(Ok(())) => {}
986 std::task::Poll::Pending => return std::task::Poll::Pending,
987 std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
988 this.is_terminated = true;
989 return std::task::Poll::Ready(None);
990 }
991 std::task::Poll::Ready(Err(e)) => {
992 return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
993 e.into(),
994 ))));
995 }
996 }
997
998 let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
1000
1001 std::task::Poll::Ready(Some(match header.ordinal {
1002 0x37845d5a47ce5e39 => {
1003 header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
1004 let mut req = fidl::new_empty!(fidl::encoding::EmptyPayload, fidl::encoding::DefaultFuchsiaResourceDialect);
1005 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
1006 let control_handle = AudioOffloadControllerControlHandle {
1007 inner: this.inner.clone(),
1008 };
1009 Ok(AudioOffloadControllerRequest::Stop {
1010 responder: AudioOffloadControllerStopResponder {
1011 control_handle: std::mem::ManuallyDrop::new(control_handle),
1012 tx_id: header.tx_id,
1013 },
1014 })
1015 }
1016 _ if header.tx_id == 0 && header.dynamic_flags().contains(fidl::encoding::DynamicFlags::FLEXIBLE) => {
1017 Ok(AudioOffloadControllerRequest::_UnknownMethod {
1018 ordinal: header.ordinal,
1019 control_handle: AudioOffloadControllerControlHandle { inner: this.inner.clone() },
1020 method_type: fidl::MethodType::OneWay,
1021 })
1022 }
1023 _ if header.dynamic_flags().contains(fidl::encoding::DynamicFlags::FLEXIBLE) => {
1024 this.inner.send_framework_err(
1025 fidl::encoding::FrameworkErr::UnknownMethod,
1026 header.tx_id,
1027 header.ordinal,
1028 header.dynamic_flags(),
1029 (bytes, handles),
1030 )?;
1031 Ok(AudioOffloadControllerRequest::_UnknownMethod {
1032 ordinal: header.ordinal,
1033 control_handle: AudioOffloadControllerControlHandle { inner: this.inner.clone() },
1034 method_type: fidl::MethodType::TwoWay,
1035 })
1036 }
1037 _ => Err(fidl::Error::UnknownOrdinal {
1038 ordinal: header.ordinal,
1039 protocol_name: <AudioOffloadControllerMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
1040 }),
1041 }))
1042 },
1043 )
1044 }
1045}
1046
1047#[derive(Debug)]
1064pub enum AudioOffloadControllerRequest {
1065 Stop { responder: AudioOffloadControllerStopResponder },
1068 #[non_exhaustive]
1070 _UnknownMethod {
1071 ordinal: u64,
1073 control_handle: AudioOffloadControllerControlHandle,
1074 method_type: fidl::MethodType,
1075 },
1076}
1077
1078impl AudioOffloadControllerRequest {
1079 #[allow(irrefutable_let_patterns)]
1080 pub fn into_stop(self) -> Option<(AudioOffloadControllerStopResponder)> {
1081 if let AudioOffloadControllerRequest::Stop { responder } = self {
1082 Some((responder))
1083 } else {
1084 None
1085 }
1086 }
1087
1088 pub fn method_name(&self) -> &'static str {
1090 match *self {
1091 AudioOffloadControllerRequest::Stop { .. } => "stop",
1092 AudioOffloadControllerRequest::_UnknownMethod {
1093 method_type: fidl::MethodType::OneWay,
1094 ..
1095 } => "unknown one-way method",
1096 AudioOffloadControllerRequest::_UnknownMethod {
1097 method_type: fidl::MethodType::TwoWay,
1098 ..
1099 } => "unknown two-way method",
1100 }
1101 }
1102}
1103
1104#[derive(Debug, Clone)]
1105pub struct AudioOffloadControllerControlHandle {
1106 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
1107}
1108
1109impl fidl::endpoints::ControlHandle for AudioOffloadControllerControlHandle {
1110 fn shutdown(&self) {
1111 self.inner.shutdown()
1112 }
1113 fn shutdown_with_epitaph(&self, status: zx_status::Status) {
1114 self.inner.shutdown_with_epitaph(status)
1115 }
1116
1117 fn is_closed(&self) -> bool {
1118 self.inner.channel().is_closed()
1119 }
1120 fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
1121 self.inner.channel().on_closed()
1122 }
1123
1124 #[cfg(target_os = "fuchsia")]
1125 fn signal_peer(
1126 &self,
1127 clear_mask: zx::Signals,
1128 set_mask: zx::Signals,
1129 ) -> Result<(), zx_status::Status> {
1130 use fidl::Peered;
1131 self.inner.channel().signal_peer(clear_mask, set_mask)
1132 }
1133}
1134
1135impl AudioOffloadControllerControlHandle {
1136 pub fn send_on_started(&self) -> Result<(), fidl::Error> {
1137 self.inner.send::<fidl::encoding::EmptyPayload>(
1138 (),
1139 0,
1140 0x7b624f210570fc30,
1141 fidl::encoding::DynamicFlags::FLEXIBLE,
1142 )
1143 }
1144}
1145
1146#[must_use = "FIDL methods require a response to be sent"]
1147#[derive(Debug)]
1148pub struct AudioOffloadControllerStopResponder {
1149 control_handle: std::mem::ManuallyDrop<AudioOffloadControllerControlHandle>,
1150 tx_id: u32,
1151}
1152
1153impl std::ops::Drop for AudioOffloadControllerStopResponder {
1157 fn drop(&mut self) {
1158 self.control_handle.shutdown();
1159 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1161 }
1162}
1163
1164impl fidl::endpoints::Responder for AudioOffloadControllerStopResponder {
1165 type ControlHandle = AudioOffloadControllerControlHandle;
1166
1167 fn control_handle(&self) -> &AudioOffloadControllerControlHandle {
1168 &self.control_handle
1169 }
1170
1171 fn drop_without_shutdown(mut self) {
1172 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1174 std::mem::forget(self);
1176 }
1177}
1178
1179impl AudioOffloadControllerStopResponder {
1180 pub fn send(self) -> Result<(), fidl::Error> {
1184 let _result = self.send_raw();
1185 if _result.is_err() {
1186 self.control_handle.shutdown();
1187 }
1188 self.drop_without_shutdown();
1189 _result
1190 }
1191
1192 pub fn send_no_shutdown_on_err(self) -> Result<(), fidl::Error> {
1194 let _result = self.send_raw();
1195 self.drop_without_shutdown();
1196 _result
1197 }
1198
1199 fn send_raw(&self) -> Result<(), fidl::Error> {
1200 self.control_handle.inner.send::<fidl::encoding::FlexibleType<fidl::encoding::EmptyStruct>>(
1201 fidl::encoding::Flexible::new(()),
1202 self.tx_id,
1203 0x37845d5a47ce5e39,
1204 fidl::encoding::DynamicFlags::FLEXIBLE,
1205 )
1206 }
1207}
1208
1209#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
1210pub struct AudioOffloadExtMarker;
1211
1212impl fidl::endpoints::ProtocolMarker for AudioOffloadExtMarker {
1213 type Proxy = AudioOffloadExtProxy;
1214 type RequestStream = AudioOffloadExtRequestStream;
1215 #[cfg(target_os = "fuchsia")]
1216 type SynchronousProxy = AudioOffloadExtSynchronousProxy;
1217
1218 const DEBUG_NAME: &'static str = "(anonymous) AudioOffloadExt";
1219}
1220
1221pub trait AudioOffloadExtProxyInterface: Send + Sync {
1222 type GetSupportedFeaturesResponseFut: std::future::Future<
1223 Output = Result<AudioOffloadExtGetSupportedFeaturesResponse, fidl::Error>,
1224 > + Send;
1225 fn r#get_supported_features(&self) -> Self::GetSupportedFeaturesResponseFut;
1226 fn r#start_audio_offload(
1227 &self,
1228 configuration: &AudioOffloadConfiguration,
1229 controller: fidl::endpoints::ServerEnd<AudioOffloadControllerMarker>,
1230 ) -> Result<(), fidl::Error>;
1231}
1232#[derive(Debug)]
1233#[cfg(target_os = "fuchsia")]
1234pub struct AudioOffloadExtSynchronousProxy {
1235 client: fidl::client::sync::Client,
1236}
1237
1238#[cfg(target_os = "fuchsia")]
1239impl fidl::endpoints::SynchronousProxy for AudioOffloadExtSynchronousProxy {
1240 type Proxy = AudioOffloadExtProxy;
1241 type Protocol = AudioOffloadExtMarker;
1242
1243 fn from_channel(inner: fidl::Channel) -> Self {
1244 Self::new(inner)
1245 }
1246
1247 fn into_channel(self) -> fidl::Channel {
1248 self.client.into_channel()
1249 }
1250
1251 fn as_channel(&self) -> &fidl::Channel {
1252 self.client.as_channel()
1253 }
1254}
1255
1256#[cfg(target_os = "fuchsia")]
1257impl AudioOffloadExtSynchronousProxy {
1258 pub fn new(channel: fidl::Channel) -> Self {
1259 let protocol_name = <AudioOffloadExtMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
1260 Self { client: fidl::client::sync::Client::new(channel, protocol_name) }
1261 }
1262
1263 pub fn into_channel(self) -> fidl::Channel {
1264 self.client.into_channel()
1265 }
1266
1267 pub fn wait_for_event(
1270 &self,
1271 deadline: zx::MonotonicInstant,
1272 ) -> Result<AudioOffloadExtEvent, fidl::Error> {
1273 AudioOffloadExtEvent::decode(self.client.wait_for_event(deadline)?)
1274 }
1275
1276 pub fn r#get_supported_features(
1278 &self,
1279 ___deadline: zx::MonotonicInstant,
1280 ) -> Result<AudioOffloadExtGetSupportedFeaturesResponse, fidl::Error> {
1281 let _response = self.client.send_query::<
1282 fidl::encoding::EmptyPayload,
1283 fidl::encoding::FlexibleType<AudioOffloadExtGetSupportedFeaturesResponse>,
1284 >(
1285 (),
1286 0x44ab0b88dde41f94,
1287 fidl::encoding::DynamicFlags::FLEXIBLE,
1288 ___deadline,
1289 )?
1290 .into_result::<AudioOffloadExtMarker>("get_supported_features")?;
1291 Ok(_response)
1292 }
1293
1294 pub fn r#start_audio_offload(
1296 &self,
1297 mut configuration: &AudioOffloadConfiguration,
1298 mut controller: fidl::endpoints::ServerEnd<AudioOffloadControllerMarker>,
1299 ) -> Result<(), fidl::Error> {
1300 self.client.send::<AudioOffloadExtStartAudioOffloadRequest>(
1301 (configuration, controller),
1302 0x2172ac626202c1c9,
1303 fidl::encoding::DynamicFlags::FLEXIBLE,
1304 )
1305 }
1306}
1307
1308#[cfg(target_os = "fuchsia")]
1309impl From<AudioOffloadExtSynchronousProxy> for zx::Handle {
1310 fn from(value: AudioOffloadExtSynchronousProxy) -> Self {
1311 value.into_channel().into()
1312 }
1313}
1314
1315#[cfg(target_os = "fuchsia")]
1316impl From<fidl::Channel> for AudioOffloadExtSynchronousProxy {
1317 fn from(value: fidl::Channel) -> Self {
1318 Self::new(value)
1319 }
1320}
1321
1322#[cfg(target_os = "fuchsia")]
1323impl fidl::endpoints::FromClient for AudioOffloadExtSynchronousProxy {
1324 type Protocol = AudioOffloadExtMarker;
1325
1326 fn from_client(value: fidl::endpoints::ClientEnd<AudioOffloadExtMarker>) -> Self {
1327 Self::new(value.into_channel())
1328 }
1329}
1330
1331#[derive(Debug, Clone)]
1332pub struct AudioOffloadExtProxy {
1333 client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
1334}
1335
1336impl fidl::endpoints::Proxy for AudioOffloadExtProxy {
1337 type Protocol = AudioOffloadExtMarker;
1338
1339 fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
1340 Self::new(inner)
1341 }
1342
1343 fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
1344 self.client.into_channel().map_err(|client| Self { client })
1345 }
1346
1347 fn as_channel(&self) -> &::fidl::AsyncChannel {
1348 self.client.as_channel()
1349 }
1350}
1351
1352impl AudioOffloadExtProxy {
1353 pub fn new(channel: ::fidl::AsyncChannel) -> Self {
1355 let protocol_name = <AudioOffloadExtMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
1356 Self { client: fidl::client::Client::new(channel, protocol_name) }
1357 }
1358
1359 pub fn take_event_stream(&self) -> AudioOffloadExtEventStream {
1365 AudioOffloadExtEventStream { event_receiver: self.client.take_event_receiver() }
1366 }
1367
1368 pub fn r#get_supported_features(
1370 &self,
1371 ) -> fidl::client::QueryResponseFut<
1372 AudioOffloadExtGetSupportedFeaturesResponse,
1373 fidl::encoding::DefaultFuchsiaResourceDialect,
1374 > {
1375 AudioOffloadExtProxyInterface::r#get_supported_features(self)
1376 }
1377
1378 pub fn r#start_audio_offload(
1380 &self,
1381 mut configuration: &AudioOffloadConfiguration,
1382 mut controller: fidl::endpoints::ServerEnd<AudioOffloadControllerMarker>,
1383 ) -> Result<(), fidl::Error> {
1384 AudioOffloadExtProxyInterface::r#start_audio_offload(self, configuration, controller)
1385 }
1386}
1387
1388impl AudioOffloadExtProxyInterface for AudioOffloadExtProxy {
1389 type GetSupportedFeaturesResponseFut = fidl::client::QueryResponseFut<
1390 AudioOffloadExtGetSupportedFeaturesResponse,
1391 fidl::encoding::DefaultFuchsiaResourceDialect,
1392 >;
1393 fn r#get_supported_features(&self) -> Self::GetSupportedFeaturesResponseFut {
1394 fn _decode(
1395 mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
1396 ) -> Result<AudioOffloadExtGetSupportedFeaturesResponse, fidl::Error> {
1397 let _response = fidl::client::decode_transaction_body::<
1398 fidl::encoding::FlexibleType<AudioOffloadExtGetSupportedFeaturesResponse>,
1399 fidl::encoding::DefaultFuchsiaResourceDialect,
1400 0x44ab0b88dde41f94,
1401 >(_buf?)?
1402 .into_result::<AudioOffloadExtMarker>("get_supported_features")?;
1403 Ok(_response)
1404 }
1405 self.client.send_query_and_decode::<
1406 fidl::encoding::EmptyPayload,
1407 AudioOffloadExtGetSupportedFeaturesResponse,
1408 >(
1409 (),
1410 0x44ab0b88dde41f94,
1411 fidl::encoding::DynamicFlags::FLEXIBLE,
1412 _decode,
1413 )
1414 }
1415
1416 fn r#start_audio_offload(
1417 &self,
1418 mut configuration: &AudioOffloadConfiguration,
1419 mut controller: fidl::endpoints::ServerEnd<AudioOffloadControllerMarker>,
1420 ) -> Result<(), fidl::Error> {
1421 self.client.send::<AudioOffloadExtStartAudioOffloadRequest>(
1422 (configuration, controller),
1423 0x2172ac626202c1c9,
1424 fidl::encoding::DynamicFlags::FLEXIBLE,
1425 )
1426 }
1427}
1428
1429pub struct AudioOffloadExtEventStream {
1430 event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
1431}
1432
1433impl std::marker::Unpin for AudioOffloadExtEventStream {}
1434
1435impl futures::stream::FusedStream for AudioOffloadExtEventStream {
1436 fn is_terminated(&self) -> bool {
1437 self.event_receiver.is_terminated()
1438 }
1439}
1440
1441impl futures::Stream for AudioOffloadExtEventStream {
1442 type Item = Result<AudioOffloadExtEvent, fidl::Error>;
1443
1444 fn poll_next(
1445 mut self: std::pin::Pin<&mut Self>,
1446 cx: &mut std::task::Context<'_>,
1447 ) -> std::task::Poll<Option<Self::Item>> {
1448 match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
1449 &mut self.event_receiver,
1450 cx
1451 )?) {
1452 Some(buf) => std::task::Poll::Ready(Some(AudioOffloadExtEvent::decode(buf))),
1453 None => std::task::Poll::Ready(None),
1454 }
1455 }
1456}
1457
1458#[derive(Debug)]
1459pub enum AudioOffloadExtEvent {
1460 #[non_exhaustive]
1461 _UnknownEvent {
1462 ordinal: u64,
1464 },
1465}
1466
1467impl AudioOffloadExtEvent {
1468 fn decode(
1470 mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
1471 ) -> Result<AudioOffloadExtEvent, fidl::Error> {
1472 let (bytes, _handles) = buf.split_mut();
1473 let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
1474 debug_assert_eq!(tx_header.tx_id, 0);
1475 match tx_header.ordinal {
1476 _ if tx_header.dynamic_flags().contains(fidl::encoding::DynamicFlags::FLEXIBLE) => {
1477 Ok(AudioOffloadExtEvent::_UnknownEvent { ordinal: tx_header.ordinal })
1478 }
1479 _ => Err(fidl::Error::UnknownOrdinal {
1480 ordinal: tx_header.ordinal,
1481 protocol_name:
1482 <AudioOffloadExtMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
1483 }),
1484 }
1485 }
1486}
1487
1488pub struct AudioOffloadExtRequestStream {
1490 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
1491 is_terminated: bool,
1492}
1493
1494impl std::marker::Unpin for AudioOffloadExtRequestStream {}
1495
1496impl futures::stream::FusedStream for AudioOffloadExtRequestStream {
1497 fn is_terminated(&self) -> bool {
1498 self.is_terminated
1499 }
1500}
1501
1502impl fidl::endpoints::RequestStream for AudioOffloadExtRequestStream {
1503 type Protocol = AudioOffloadExtMarker;
1504 type ControlHandle = AudioOffloadExtControlHandle;
1505
1506 fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
1507 Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
1508 }
1509
1510 fn control_handle(&self) -> Self::ControlHandle {
1511 AudioOffloadExtControlHandle { inner: self.inner.clone() }
1512 }
1513
1514 fn into_inner(
1515 self,
1516 ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
1517 {
1518 (self.inner, self.is_terminated)
1519 }
1520
1521 fn from_inner(
1522 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
1523 is_terminated: bool,
1524 ) -> Self {
1525 Self { inner, is_terminated }
1526 }
1527}
1528
1529impl futures::Stream for AudioOffloadExtRequestStream {
1530 type Item = Result<AudioOffloadExtRequest, fidl::Error>;
1531
1532 fn poll_next(
1533 mut self: std::pin::Pin<&mut Self>,
1534 cx: &mut std::task::Context<'_>,
1535 ) -> std::task::Poll<Option<Self::Item>> {
1536 let this = &mut *self;
1537 if this.inner.check_shutdown(cx) {
1538 this.is_terminated = true;
1539 return std::task::Poll::Ready(None);
1540 }
1541 if this.is_terminated {
1542 panic!("polled AudioOffloadExtRequestStream after completion");
1543 }
1544 fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
1545 |bytes, handles| {
1546 match this.inner.channel().read_etc(cx, bytes, handles) {
1547 std::task::Poll::Ready(Ok(())) => {}
1548 std::task::Poll::Pending => return std::task::Poll::Pending,
1549 std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
1550 this.is_terminated = true;
1551 return std::task::Poll::Ready(None);
1552 }
1553 std::task::Poll::Ready(Err(e)) => {
1554 return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
1555 e.into(),
1556 ))));
1557 }
1558 }
1559
1560 let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
1562
1563 std::task::Poll::Ready(Some(match header.ordinal {
1564 0x44ab0b88dde41f94 => {
1565 header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
1566 let mut req = fidl::new_empty!(
1567 fidl::encoding::EmptyPayload,
1568 fidl::encoding::DefaultFuchsiaResourceDialect
1569 );
1570 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
1571 let control_handle =
1572 AudioOffloadExtControlHandle { inner: this.inner.clone() };
1573 Ok(AudioOffloadExtRequest::GetSupportedFeatures {
1574 responder: AudioOffloadExtGetSupportedFeaturesResponder {
1575 control_handle: std::mem::ManuallyDrop::new(control_handle),
1576 tx_id: header.tx_id,
1577 },
1578 })
1579 }
1580 0x2172ac626202c1c9 => {
1581 header.validate_request_tx_id(fidl::MethodType::OneWay)?;
1582 let mut req = fidl::new_empty!(
1583 AudioOffloadExtStartAudioOffloadRequest,
1584 fidl::encoding::DefaultFuchsiaResourceDialect
1585 );
1586 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<AudioOffloadExtStartAudioOffloadRequest>(&header, _body_bytes, handles, &mut req)?;
1587 let control_handle =
1588 AudioOffloadExtControlHandle { inner: this.inner.clone() };
1589 Ok(AudioOffloadExtRequest::StartAudioOffload {
1590 configuration: req.configuration,
1591 controller: req.controller,
1592
1593 control_handle,
1594 })
1595 }
1596 _ if header.tx_id == 0
1597 && header
1598 .dynamic_flags()
1599 .contains(fidl::encoding::DynamicFlags::FLEXIBLE) =>
1600 {
1601 Ok(AudioOffloadExtRequest::_UnknownMethod {
1602 ordinal: header.ordinal,
1603 control_handle: AudioOffloadExtControlHandle {
1604 inner: this.inner.clone(),
1605 },
1606 method_type: fidl::MethodType::OneWay,
1607 })
1608 }
1609 _ if header
1610 .dynamic_flags()
1611 .contains(fidl::encoding::DynamicFlags::FLEXIBLE) =>
1612 {
1613 this.inner.send_framework_err(
1614 fidl::encoding::FrameworkErr::UnknownMethod,
1615 header.tx_id,
1616 header.ordinal,
1617 header.dynamic_flags(),
1618 (bytes, handles),
1619 )?;
1620 Ok(AudioOffloadExtRequest::_UnknownMethod {
1621 ordinal: header.ordinal,
1622 control_handle: AudioOffloadExtControlHandle {
1623 inner: this.inner.clone(),
1624 },
1625 method_type: fidl::MethodType::TwoWay,
1626 })
1627 }
1628 _ => Err(fidl::Error::UnknownOrdinal {
1629 ordinal: header.ordinal,
1630 protocol_name:
1631 <AudioOffloadExtMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
1632 }),
1633 }))
1634 },
1635 )
1636 }
1637}
1638
1639#[derive(Debug)]
1641pub enum AudioOffloadExtRequest {
1642 GetSupportedFeatures { responder: AudioOffloadExtGetSupportedFeaturesResponder },
1644 StartAudioOffload {
1646 configuration: AudioOffloadConfiguration,
1647 controller: fidl::endpoints::ServerEnd<AudioOffloadControllerMarker>,
1648 control_handle: AudioOffloadExtControlHandle,
1649 },
1650 #[non_exhaustive]
1652 _UnknownMethod {
1653 ordinal: u64,
1655 control_handle: AudioOffloadExtControlHandle,
1656 method_type: fidl::MethodType,
1657 },
1658}
1659
1660impl AudioOffloadExtRequest {
1661 #[allow(irrefutable_let_patterns)]
1662 pub fn into_get_supported_features(
1663 self,
1664 ) -> Option<(AudioOffloadExtGetSupportedFeaturesResponder)> {
1665 if let AudioOffloadExtRequest::GetSupportedFeatures { responder } = self {
1666 Some((responder))
1667 } else {
1668 None
1669 }
1670 }
1671
1672 #[allow(irrefutable_let_patterns)]
1673 pub fn into_start_audio_offload(
1674 self,
1675 ) -> Option<(
1676 AudioOffloadConfiguration,
1677 fidl::endpoints::ServerEnd<AudioOffloadControllerMarker>,
1678 AudioOffloadExtControlHandle,
1679 )> {
1680 if let AudioOffloadExtRequest::StartAudioOffload {
1681 configuration,
1682 controller,
1683 control_handle,
1684 } = self
1685 {
1686 Some((configuration, controller, control_handle))
1687 } else {
1688 None
1689 }
1690 }
1691
1692 pub fn method_name(&self) -> &'static str {
1694 match *self {
1695 AudioOffloadExtRequest::GetSupportedFeatures { .. } => "get_supported_features",
1696 AudioOffloadExtRequest::StartAudioOffload { .. } => "start_audio_offload",
1697 AudioOffloadExtRequest::_UnknownMethod {
1698 method_type: fidl::MethodType::OneWay,
1699 ..
1700 } => "unknown one-way method",
1701 AudioOffloadExtRequest::_UnknownMethod {
1702 method_type: fidl::MethodType::TwoWay,
1703 ..
1704 } => "unknown two-way method",
1705 }
1706 }
1707}
1708
1709#[derive(Debug, Clone)]
1710pub struct AudioOffloadExtControlHandle {
1711 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
1712}
1713
1714impl fidl::endpoints::ControlHandle for AudioOffloadExtControlHandle {
1715 fn shutdown(&self) {
1716 self.inner.shutdown()
1717 }
1718 fn shutdown_with_epitaph(&self, status: zx_status::Status) {
1719 self.inner.shutdown_with_epitaph(status)
1720 }
1721
1722 fn is_closed(&self) -> bool {
1723 self.inner.channel().is_closed()
1724 }
1725 fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
1726 self.inner.channel().on_closed()
1727 }
1728
1729 #[cfg(target_os = "fuchsia")]
1730 fn signal_peer(
1731 &self,
1732 clear_mask: zx::Signals,
1733 set_mask: zx::Signals,
1734 ) -> Result<(), zx_status::Status> {
1735 use fidl::Peered;
1736 self.inner.channel().signal_peer(clear_mask, set_mask)
1737 }
1738}
1739
1740impl AudioOffloadExtControlHandle {}
1741
1742#[must_use = "FIDL methods require a response to be sent"]
1743#[derive(Debug)]
1744pub struct AudioOffloadExtGetSupportedFeaturesResponder {
1745 control_handle: std::mem::ManuallyDrop<AudioOffloadExtControlHandle>,
1746 tx_id: u32,
1747}
1748
1749impl std::ops::Drop for AudioOffloadExtGetSupportedFeaturesResponder {
1753 fn drop(&mut self) {
1754 self.control_handle.shutdown();
1755 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1757 }
1758}
1759
1760impl fidl::endpoints::Responder for AudioOffloadExtGetSupportedFeaturesResponder {
1761 type ControlHandle = AudioOffloadExtControlHandle;
1762
1763 fn control_handle(&self) -> &AudioOffloadExtControlHandle {
1764 &self.control_handle
1765 }
1766
1767 fn drop_without_shutdown(mut self) {
1768 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1770 std::mem::forget(self);
1772 }
1773}
1774
1775impl AudioOffloadExtGetSupportedFeaturesResponder {
1776 pub fn send(
1780 self,
1781 mut payload: &AudioOffloadExtGetSupportedFeaturesResponse,
1782 ) -> Result<(), fidl::Error> {
1783 let _result = self.send_raw(payload);
1784 if _result.is_err() {
1785 self.control_handle.shutdown();
1786 }
1787 self.drop_without_shutdown();
1788 _result
1789 }
1790
1791 pub fn send_no_shutdown_on_err(
1793 self,
1794 mut payload: &AudioOffloadExtGetSupportedFeaturesResponse,
1795 ) -> Result<(), fidl::Error> {
1796 let _result = self.send_raw(payload);
1797 self.drop_without_shutdown();
1798 _result
1799 }
1800
1801 fn send_raw(
1802 &self,
1803 mut payload: &AudioOffloadExtGetSupportedFeaturesResponse,
1804 ) -> Result<(), fidl::Error> {
1805 self.control_handle.inner.send::<fidl::encoding::FlexibleType<
1806 AudioOffloadExtGetSupportedFeaturesResponse,
1807 >>(
1808 fidl::encoding::Flexible::new(payload),
1809 self.tx_id,
1810 0x44ab0b88dde41f94,
1811 fidl::encoding::DynamicFlags::FLEXIBLE,
1812 )
1813 }
1814}
1815
1816#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
1817pub struct ConnectionReceiverMarker;
1818
1819impl fidl::endpoints::ProtocolMarker for ConnectionReceiverMarker {
1820 type Proxy = ConnectionReceiverProxy;
1821 type RequestStream = ConnectionReceiverRequestStream;
1822 #[cfg(target_os = "fuchsia")]
1823 type SynchronousProxy = ConnectionReceiverSynchronousProxy;
1824
1825 const DEBUG_NAME: &'static str = "(anonymous) ConnectionReceiver";
1826}
1827
1828pub trait ConnectionReceiverProxyInterface: Send + Sync {
1829 fn r#connected(
1830 &self,
1831 peer_id: &fidl_fuchsia_bluetooth::PeerId,
1832 channel: Channel,
1833 protocol: &[ProtocolDescriptor],
1834 ) -> Result<(), fidl::Error>;
1835}
1836#[derive(Debug)]
1837#[cfg(target_os = "fuchsia")]
1838pub struct ConnectionReceiverSynchronousProxy {
1839 client: fidl::client::sync::Client,
1840}
1841
1842#[cfg(target_os = "fuchsia")]
1843impl fidl::endpoints::SynchronousProxy for ConnectionReceiverSynchronousProxy {
1844 type Proxy = ConnectionReceiverProxy;
1845 type Protocol = ConnectionReceiverMarker;
1846
1847 fn from_channel(inner: fidl::Channel) -> Self {
1848 Self::new(inner)
1849 }
1850
1851 fn into_channel(self) -> fidl::Channel {
1852 self.client.into_channel()
1853 }
1854
1855 fn as_channel(&self) -> &fidl::Channel {
1856 self.client.as_channel()
1857 }
1858}
1859
1860#[cfg(target_os = "fuchsia")]
1861impl ConnectionReceiverSynchronousProxy {
1862 pub fn new(channel: fidl::Channel) -> Self {
1863 let protocol_name =
1864 <ConnectionReceiverMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
1865 Self { client: fidl::client::sync::Client::new(channel, protocol_name) }
1866 }
1867
1868 pub fn into_channel(self) -> fidl::Channel {
1869 self.client.into_channel()
1870 }
1871
1872 pub fn wait_for_event(
1875 &self,
1876 deadline: zx::MonotonicInstant,
1877 ) -> Result<ConnectionReceiverEvent, fidl::Error> {
1878 ConnectionReceiverEvent::decode(self.client.wait_for_event(deadline)?)
1879 }
1880
1881 pub fn r#connected(
1886 &self,
1887 mut peer_id: &fidl_fuchsia_bluetooth::PeerId,
1888 mut channel: Channel,
1889 mut protocol: &[ProtocolDescriptor],
1890 ) -> Result<(), fidl::Error> {
1891 self.client.send::<ConnectionReceiverConnectedRequest>(
1892 (peer_id, &mut channel, protocol),
1893 0xa5251eebbccf928,
1894 fidl::encoding::DynamicFlags::FLEXIBLE,
1895 )
1896 }
1897}
1898
1899#[cfg(target_os = "fuchsia")]
1900impl From<ConnectionReceiverSynchronousProxy> for zx::Handle {
1901 fn from(value: ConnectionReceiverSynchronousProxy) -> Self {
1902 value.into_channel().into()
1903 }
1904}
1905
1906#[cfg(target_os = "fuchsia")]
1907impl From<fidl::Channel> for ConnectionReceiverSynchronousProxy {
1908 fn from(value: fidl::Channel) -> Self {
1909 Self::new(value)
1910 }
1911}
1912
1913#[cfg(target_os = "fuchsia")]
1914impl fidl::endpoints::FromClient for ConnectionReceiverSynchronousProxy {
1915 type Protocol = ConnectionReceiverMarker;
1916
1917 fn from_client(value: fidl::endpoints::ClientEnd<ConnectionReceiverMarker>) -> Self {
1918 Self::new(value.into_channel())
1919 }
1920}
1921
1922#[derive(Debug, Clone)]
1923pub struct ConnectionReceiverProxy {
1924 client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
1925}
1926
1927impl fidl::endpoints::Proxy for ConnectionReceiverProxy {
1928 type Protocol = ConnectionReceiverMarker;
1929
1930 fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
1931 Self::new(inner)
1932 }
1933
1934 fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
1935 self.client.into_channel().map_err(|client| Self { client })
1936 }
1937
1938 fn as_channel(&self) -> &::fidl::AsyncChannel {
1939 self.client.as_channel()
1940 }
1941}
1942
1943impl ConnectionReceiverProxy {
1944 pub fn new(channel: ::fidl::AsyncChannel) -> Self {
1946 let protocol_name =
1947 <ConnectionReceiverMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
1948 Self { client: fidl::client::Client::new(channel, protocol_name) }
1949 }
1950
1951 pub fn take_event_stream(&self) -> ConnectionReceiverEventStream {
1957 ConnectionReceiverEventStream { event_receiver: self.client.take_event_receiver() }
1958 }
1959
1960 pub fn r#connected(
1965 &self,
1966 mut peer_id: &fidl_fuchsia_bluetooth::PeerId,
1967 mut channel: Channel,
1968 mut protocol: &[ProtocolDescriptor],
1969 ) -> Result<(), fidl::Error> {
1970 ConnectionReceiverProxyInterface::r#connected(self, peer_id, channel, protocol)
1971 }
1972}
1973
1974impl ConnectionReceiverProxyInterface for ConnectionReceiverProxy {
1975 fn r#connected(
1976 &self,
1977 mut peer_id: &fidl_fuchsia_bluetooth::PeerId,
1978 mut channel: Channel,
1979 mut protocol: &[ProtocolDescriptor],
1980 ) -> Result<(), fidl::Error> {
1981 self.client.send::<ConnectionReceiverConnectedRequest>(
1982 (peer_id, &mut channel, protocol),
1983 0xa5251eebbccf928,
1984 fidl::encoding::DynamicFlags::FLEXIBLE,
1985 )
1986 }
1987}
1988
1989pub struct ConnectionReceiverEventStream {
1990 event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
1991}
1992
1993impl std::marker::Unpin for ConnectionReceiverEventStream {}
1994
1995impl futures::stream::FusedStream for ConnectionReceiverEventStream {
1996 fn is_terminated(&self) -> bool {
1997 self.event_receiver.is_terminated()
1998 }
1999}
2000
2001impl futures::Stream for ConnectionReceiverEventStream {
2002 type Item = Result<ConnectionReceiverEvent, fidl::Error>;
2003
2004 fn poll_next(
2005 mut self: std::pin::Pin<&mut Self>,
2006 cx: &mut std::task::Context<'_>,
2007 ) -> std::task::Poll<Option<Self::Item>> {
2008 match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
2009 &mut self.event_receiver,
2010 cx
2011 )?) {
2012 Some(buf) => std::task::Poll::Ready(Some(ConnectionReceiverEvent::decode(buf))),
2013 None => std::task::Poll::Ready(None),
2014 }
2015 }
2016}
2017
2018#[derive(Debug)]
2019pub enum ConnectionReceiverEvent {
2020 OnRevoke {},
2021 #[non_exhaustive]
2022 _UnknownEvent {
2023 ordinal: u64,
2025 },
2026}
2027
2028impl ConnectionReceiverEvent {
2029 #[allow(irrefutable_let_patterns)]
2030 pub fn into_on_revoke(self) -> Option<()> {
2031 if let ConnectionReceiverEvent::OnRevoke {} = self { Some(()) } else { None }
2032 }
2033
2034 fn decode(
2036 mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
2037 ) -> Result<ConnectionReceiverEvent, fidl::Error> {
2038 let (bytes, _handles) = buf.split_mut();
2039 let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
2040 debug_assert_eq!(tx_header.tx_id, 0);
2041 match tx_header.ordinal {
2042 0x9b35c093a0468d1 => {
2043 let mut out = fidl::new_empty!(
2044 fidl::encoding::EmptyPayload,
2045 fidl::encoding::DefaultFuchsiaResourceDialect
2046 );
2047 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&tx_header, _body_bytes, _handles, &mut out)?;
2048 Ok((ConnectionReceiverEvent::OnRevoke {}))
2049 }
2050 _ if tx_header.dynamic_flags().contains(fidl::encoding::DynamicFlags::FLEXIBLE) => {
2051 Ok(ConnectionReceiverEvent::_UnknownEvent { ordinal: tx_header.ordinal })
2052 }
2053 _ => Err(fidl::Error::UnknownOrdinal {
2054 ordinal: tx_header.ordinal,
2055 protocol_name:
2056 <ConnectionReceiverMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
2057 }),
2058 }
2059 }
2060}
2061
2062pub struct ConnectionReceiverRequestStream {
2064 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
2065 is_terminated: bool,
2066}
2067
2068impl std::marker::Unpin for ConnectionReceiverRequestStream {}
2069
2070impl futures::stream::FusedStream for ConnectionReceiverRequestStream {
2071 fn is_terminated(&self) -> bool {
2072 self.is_terminated
2073 }
2074}
2075
2076impl fidl::endpoints::RequestStream for ConnectionReceiverRequestStream {
2077 type Protocol = ConnectionReceiverMarker;
2078 type ControlHandle = ConnectionReceiverControlHandle;
2079
2080 fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
2081 Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
2082 }
2083
2084 fn control_handle(&self) -> Self::ControlHandle {
2085 ConnectionReceiverControlHandle { inner: self.inner.clone() }
2086 }
2087
2088 fn into_inner(
2089 self,
2090 ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
2091 {
2092 (self.inner, self.is_terminated)
2093 }
2094
2095 fn from_inner(
2096 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
2097 is_terminated: bool,
2098 ) -> Self {
2099 Self { inner, is_terminated }
2100 }
2101}
2102
2103impl futures::Stream for ConnectionReceiverRequestStream {
2104 type Item = Result<ConnectionReceiverRequest, fidl::Error>;
2105
2106 fn poll_next(
2107 mut self: std::pin::Pin<&mut Self>,
2108 cx: &mut std::task::Context<'_>,
2109 ) -> std::task::Poll<Option<Self::Item>> {
2110 let this = &mut *self;
2111 if this.inner.check_shutdown(cx) {
2112 this.is_terminated = true;
2113 return std::task::Poll::Ready(None);
2114 }
2115 if this.is_terminated {
2116 panic!("polled ConnectionReceiverRequestStream after completion");
2117 }
2118 fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
2119 |bytes, handles| {
2120 match this.inner.channel().read_etc(cx, bytes, handles) {
2121 std::task::Poll::Ready(Ok(())) => {}
2122 std::task::Poll::Pending => return std::task::Poll::Pending,
2123 std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
2124 this.is_terminated = true;
2125 return std::task::Poll::Ready(None);
2126 }
2127 std::task::Poll::Ready(Err(e)) => {
2128 return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
2129 e.into(),
2130 ))));
2131 }
2132 }
2133
2134 let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
2136
2137 std::task::Poll::Ready(Some(match header.ordinal {
2138 0xa5251eebbccf928 => {
2139 header.validate_request_tx_id(fidl::MethodType::OneWay)?;
2140 let mut req = fidl::new_empty!(ConnectionReceiverConnectedRequest, fidl::encoding::DefaultFuchsiaResourceDialect);
2141 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<ConnectionReceiverConnectedRequest>(&header, _body_bytes, handles, &mut req)?;
2142 let control_handle = ConnectionReceiverControlHandle {
2143 inner: this.inner.clone(),
2144 };
2145 Ok(ConnectionReceiverRequest::Connected {peer_id: req.peer_id,
2146channel: req.channel,
2147protocol: req.protocol,
2148
2149 control_handle,
2150 })
2151 }
2152 _ if header.tx_id == 0 && header.dynamic_flags().contains(fidl::encoding::DynamicFlags::FLEXIBLE) => {
2153 Ok(ConnectionReceiverRequest::_UnknownMethod {
2154 ordinal: header.ordinal,
2155 control_handle: ConnectionReceiverControlHandle { inner: this.inner.clone() },
2156 method_type: fidl::MethodType::OneWay,
2157 })
2158 }
2159 _ if header.dynamic_flags().contains(fidl::encoding::DynamicFlags::FLEXIBLE) => {
2160 this.inner.send_framework_err(
2161 fidl::encoding::FrameworkErr::UnknownMethod,
2162 header.tx_id,
2163 header.ordinal,
2164 header.dynamic_flags(),
2165 (bytes, handles),
2166 )?;
2167 Ok(ConnectionReceiverRequest::_UnknownMethod {
2168 ordinal: header.ordinal,
2169 control_handle: ConnectionReceiverControlHandle { inner: this.inner.clone() },
2170 method_type: fidl::MethodType::TwoWay,
2171 })
2172 }
2173 _ => Err(fidl::Error::UnknownOrdinal {
2174 ordinal: header.ordinal,
2175 protocol_name: <ConnectionReceiverMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
2176 }),
2177 }))
2178 },
2179 )
2180 }
2181}
2182
2183#[derive(Debug)]
2186pub enum ConnectionReceiverRequest {
2187 Connected {
2192 peer_id: fidl_fuchsia_bluetooth::PeerId,
2193 channel: Channel,
2194 protocol: Vec<ProtocolDescriptor>,
2195 control_handle: ConnectionReceiverControlHandle,
2196 },
2197 #[non_exhaustive]
2199 _UnknownMethod {
2200 ordinal: u64,
2202 control_handle: ConnectionReceiverControlHandle,
2203 method_type: fidl::MethodType,
2204 },
2205}
2206
2207impl ConnectionReceiverRequest {
2208 #[allow(irrefutable_let_patterns)]
2209 pub fn into_connected(
2210 self,
2211 ) -> Option<(
2212 fidl_fuchsia_bluetooth::PeerId,
2213 Channel,
2214 Vec<ProtocolDescriptor>,
2215 ConnectionReceiverControlHandle,
2216 )> {
2217 if let ConnectionReceiverRequest::Connected { peer_id, channel, protocol, control_handle } =
2218 self
2219 {
2220 Some((peer_id, channel, protocol, control_handle))
2221 } else {
2222 None
2223 }
2224 }
2225
2226 pub fn method_name(&self) -> &'static str {
2228 match *self {
2229 ConnectionReceiverRequest::Connected { .. } => "connected",
2230 ConnectionReceiverRequest::_UnknownMethod {
2231 method_type: fidl::MethodType::OneWay,
2232 ..
2233 } => "unknown one-way method",
2234 ConnectionReceiverRequest::_UnknownMethod {
2235 method_type: fidl::MethodType::TwoWay,
2236 ..
2237 } => "unknown two-way method",
2238 }
2239 }
2240}
2241
2242#[derive(Debug, Clone)]
2243pub struct ConnectionReceiverControlHandle {
2244 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
2245}
2246
2247impl fidl::endpoints::ControlHandle for ConnectionReceiverControlHandle {
2248 fn shutdown(&self) {
2249 self.inner.shutdown()
2250 }
2251 fn shutdown_with_epitaph(&self, status: zx_status::Status) {
2252 self.inner.shutdown_with_epitaph(status)
2253 }
2254
2255 fn is_closed(&self) -> bool {
2256 self.inner.channel().is_closed()
2257 }
2258 fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
2259 self.inner.channel().on_closed()
2260 }
2261
2262 #[cfg(target_os = "fuchsia")]
2263 fn signal_peer(
2264 &self,
2265 clear_mask: zx::Signals,
2266 set_mask: zx::Signals,
2267 ) -> Result<(), zx_status::Status> {
2268 use fidl::Peered;
2269 self.inner.channel().signal_peer(clear_mask, set_mask)
2270 }
2271}
2272
2273impl ConnectionReceiverControlHandle {
2274 pub fn send_on_revoke(&self) -> Result<(), fidl::Error> {
2275 self.inner.send::<fidl::encoding::EmptyPayload>(
2276 (),
2277 0,
2278 0x9b35c093a0468d1,
2279 fidl::encoding::DynamicFlags::FLEXIBLE,
2280 )
2281 }
2282}
2283
2284#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
2285pub struct ConnectionReceiver2Marker;
2286
2287impl fidl::endpoints::ProtocolMarker for ConnectionReceiver2Marker {
2288 type Proxy = ConnectionReceiver2Proxy;
2289 type RequestStream = ConnectionReceiver2RequestStream;
2290 #[cfg(target_os = "fuchsia")]
2291 type SynchronousProxy = ConnectionReceiver2SynchronousProxy;
2292
2293 const DEBUG_NAME: &'static str = "(anonymous) ConnectionReceiver2";
2294}
2295
2296pub trait ConnectionReceiver2ProxyInterface: Send + Sync {
2297 type ConnectedResponseFut: std::future::Future<Output = Result<(), fidl::Error>> + Send;
2298 fn r#connected(
2299 &self,
2300 payload: ConnectionReceiver2ConnectedRequest,
2301 ) -> Self::ConnectedResponseFut;
2302}
2303#[derive(Debug)]
2304#[cfg(target_os = "fuchsia")]
2305pub struct ConnectionReceiver2SynchronousProxy {
2306 client: fidl::client::sync::Client,
2307}
2308
2309#[cfg(target_os = "fuchsia")]
2310impl fidl::endpoints::SynchronousProxy for ConnectionReceiver2SynchronousProxy {
2311 type Proxy = ConnectionReceiver2Proxy;
2312 type Protocol = ConnectionReceiver2Marker;
2313
2314 fn from_channel(inner: fidl::Channel) -> Self {
2315 Self::new(inner)
2316 }
2317
2318 fn into_channel(self) -> fidl::Channel {
2319 self.client.into_channel()
2320 }
2321
2322 fn as_channel(&self) -> &fidl::Channel {
2323 self.client.as_channel()
2324 }
2325}
2326
2327#[cfg(target_os = "fuchsia")]
2328impl ConnectionReceiver2SynchronousProxy {
2329 pub fn new(channel: fidl::Channel) -> Self {
2330 let protocol_name =
2331 <ConnectionReceiver2Marker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
2332 Self { client: fidl::client::sync::Client::new(channel, protocol_name) }
2333 }
2334
2335 pub fn into_channel(self) -> fidl::Channel {
2336 self.client.into_channel()
2337 }
2338
2339 pub fn wait_for_event(
2342 &self,
2343 deadline: zx::MonotonicInstant,
2344 ) -> Result<ConnectionReceiver2Event, fidl::Error> {
2345 ConnectionReceiver2Event::decode(self.client.wait_for_event(deadline)?)
2346 }
2347
2348 pub fn r#connected(
2353 &self,
2354 mut payload: ConnectionReceiver2ConnectedRequest,
2355 ___deadline: zx::MonotonicInstant,
2356 ) -> Result<(), fidl::Error> {
2357 let _response = self.client.send_query::<
2358 ConnectionReceiver2ConnectedRequest,
2359 fidl::encoding::FlexibleType<fidl::encoding::EmptyStruct>,
2360 >(
2361 &mut payload,
2362 0x602c15a8004564de,
2363 fidl::encoding::DynamicFlags::FLEXIBLE,
2364 ___deadline,
2365 )?
2366 .into_result::<ConnectionReceiver2Marker>("connected")?;
2367 Ok(_response)
2368 }
2369}
2370
2371#[cfg(target_os = "fuchsia")]
2372impl From<ConnectionReceiver2SynchronousProxy> for zx::Handle {
2373 fn from(value: ConnectionReceiver2SynchronousProxy) -> Self {
2374 value.into_channel().into()
2375 }
2376}
2377
2378#[cfg(target_os = "fuchsia")]
2379impl From<fidl::Channel> for ConnectionReceiver2SynchronousProxy {
2380 fn from(value: fidl::Channel) -> Self {
2381 Self::new(value)
2382 }
2383}
2384
2385#[cfg(target_os = "fuchsia")]
2386impl fidl::endpoints::FromClient for ConnectionReceiver2SynchronousProxy {
2387 type Protocol = ConnectionReceiver2Marker;
2388
2389 fn from_client(value: fidl::endpoints::ClientEnd<ConnectionReceiver2Marker>) -> Self {
2390 Self::new(value.into_channel())
2391 }
2392}
2393
2394#[derive(Debug, Clone)]
2395pub struct ConnectionReceiver2Proxy {
2396 client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
2397}
2398
2399impl fidl::endpoints::Proxy for ConnectionReceiver2Proxy {
2400 type Protocol = ConnectionReceiver2Marker;
2401
2402 fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
2403 Self::new(inner)
2404 }
2405
2406 fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
2407 self.client.into_channel().map_err(|client| Self { client })
2408 }
2409
2410 fn as_channel(&self) -> &::fidl::AsyncChannel {
2411 self.client.as_channel()
2412 }
2413}
2414
2415impl ConnectionReceiver2Proxy {
2416 pub fn new(channel: ::fidl::AsyncChannel) -> Self {
2418 let protocol_name =
2419 <ConnectionReceiver2Marker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
2420 Self { client: fidl::client::Client::new(channel, protocol_name) }
2421 }
2422
2423 pub fn take_event_stream(&self) -> ConnectionReceiver2EventStream {
2429 ConnectionReceiver2EventStream { event_receiver: self.client.take_event_receiver() }
2430 }
2431
2432 pub fn r#connected(
2437 &self,
2438 mut payload: ConnectionReceiver2ConnectedRequest,
2439 ) -> fidl::client::QueryResponseFut<(), fidl::encoding::DefaultFuchsiaResourceDialect> {
2440 ConnectionReceiver2ProxyInterface::r#connected(self, payload)
2441 }
2442}
2443
2444impl ConnectionReceiver2ProxyInterface for ConnectionReceiver2Proxy {
2445 type ConnectedResponseFut =
2446 fidl::client::QueryResponseFut<(), fidl::encoding::DefaultFuchsiaResourceDialect>;
2447 fn r#connected(
2448 &self,
2449 mut payload: ConnectionReceiver2ConnectedRequest,
2450 ) -> Self::ConnectedResponseFut {
2451 fn _decode(
2452 mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
2453 ) -> Result<(), fidl::Error> {
2454 let _response = fidl::client::decode_transaction_body::<
2455 fidl::encoding::FlexibleType<fidl::encoding::EmptyStruct>,
2456 fidl::encoding::DefaultFuchsiaResourceDialect,
2457 0x602c15a8004564de,
2458 >(_buf?)?
2459 .into_result::<ConnectionReceiver2Marker>("connected")?;
2460 Ok(_response)
2461 }
2462 self.client.send_query_and_decode::<ConnectionReceiver2ConnectedRequest, ()>(
2463 &mut payload,
2464 0x602c15a8004564de,
2465 fidl::encoding::DynamicFlags::FLEXIBLE,
2466 _decode,
2467 )
2468 }
2469}
2470
2471pub struct ConnectionReceiver2EventStream {
2472 event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
2473}
2474
2475impl std::marker::Unpin for ConnectionReceiver2EventStream {}
2476
2477impl futures::stream::FusedStream for ConnectionReceiver2EventStream {
2478 fn is_terminated(&self) -> bool {
2479 self.event_receiver.is_terminated()
2480 }
2481}
2482
2483impl futures::Stream for ConnectionReceiver2EventStream {
2484 type Item = Result<ConnectionReceiver2Event, fidl::Error>;
2485
2486 fn poll_next(
2487 mut self: std::pin::Pin<&mut Self>,
2488 cx: &mut std::task::Context<'_>,
2489 ) -> std::task::Poll<Option<Self::Item>> {
2490 match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
2491 &mut self.event_receiver,
2492 cx
2493 )?) {
2494 Some(buf) => std::task::Poll::Ready(Some(ConnectionReceiver2Event::decode(buf))),
2495 None => std::task::Poll::Ready(None),
2496 }
2497 }
2498}
2499
2500#[derive(Debug)]
2501pub enum ConnectionReceiver2Event {
2502 OnRevoke {},
2503 #[non_exhaustive]
2504 _UnknownEvent {
2505 ordinal: u64,
2507 },
2508}
2509
2510impl ConnectionReceiver2Event {
2511 #[allow(irrefutable_let_patterns)]
2512 pub fn into_on_revoke(self) -> Option<()> {
2513 if let ConnectionReceiver2Event::OnRevoke {} = self { Some(()) } else { None }
2514 }
2515
2516 fn decode(
2518 mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
2519 ) -> Result<ConnectionReceiver2Event, fidl::Error> {
2520 let (bytes, _handles) = buf.split_mut();
2521 let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
2522 debug_assert_eq!(tx_header.tx_id, 0);
2523 match tx_header.ordinal {
2524 0x11281753d1e1851c => {
2525 let mut out = fidl::new_empty!(
2526 fidl::encoding::EmptyPayload,
2527 fidl::encoding::DefaultFuchsiaResourceDialect
2528 );
2529 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&tx_header, _body_bytes, _handles, &mut out)?;
2530 Ok((ConnectionReceiver2Event::OnRevoke {}))
2531 }
2532 _ if tx_header.dynamic_flags().contains(fidl::encoding::DynamicFlags::FLEXIBLE) => {
2533 Ok(ConnectionReceiver2Event::_UnknownEvent { ordinal: tx_header.ordinal })
2534 }
2535 _ => Err(fidl::Error::UnknownOrdinal {
2536 ordinal: tx_header.ordinal,
2537 protocol_name:
2538 <ConnectionReceiver2Marker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
2539 }),
2540 }
2541 }
2542}
2543
2544pub struct ConnectionReceiver2RequestStream {
2546 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
2547 is_terminated: bool,
2548}
2549
2550impl std::marker::Unpin for ConnectionReceiver2RequestStream {}
2551
2552impl futures::stream::FusedStream for ConnectionReceiver2RequestStream {
2553 fn is_terminated(&self) -> bool {
2554 self.is_terminated
2555 }
2556}
2557
2558impl fidl::endpoints::RequestStream for ConnectionReceiver2RequestStream {
2559 type Protocol = ConnectionReceiver2Marker;
2560 type ControlHandle = ConnectionReceiver2ControlHandle;
2561
2562 fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
2563 Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
2564 }
2565
2566 fn control_handle(&self) -> Self::ControlHandle {
2567 ConnectionReceiver2ControlHandle { inner: self.inner.clone() }
2568 }
2569
2570 fn into_inner(
2571 self,
2572 ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
2573 {
2574 (self.inner, self.is_terminated)
2575 }
2576
2577 fn from_inner(
2578 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
2579 is_terminated: bool,
2580 ) -> Self {
2581 Self { inner, is_terminated }
2582 }
2583}
2584
2585impl futures::Stream for ConnectionReceiver2RequestStream {
2586 type Item = Result<ConnectionReceiver2Request, fidl::Error>;
2587
2588 fn poll_next(
2589 mut self: std::pin::Pin<&mut Self>,
2590 cx: &mut std::task::Context<'_>,
2591 ) -> std::task::Poll<Option<Self::Item>> {
2592 let this = &mut *self;
2593 if this.inner.check_shutdown(cx) {
2594 this.is_terminated = true;
2595 return std::task::Poll::Ready(None);
2596 }
2597 if this.is_terminated {
2598 panic!("polled ConnectionReceiver2RequestStream after completion");
2599 }
2600 fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
2601 |bytes, handles| {
2602 match this.inner.channel().read_etc(cx, bytes, handles) {
2603 std::task::Poll::Ready(Ok(())) => {}
2604 std::task::Poll::Pending => return std::task::Poll::Pending,
2605 std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
2606 this.is_terminated = true;
2607 return std::task::Poll::Ready(None);
2608 }
2609 std::task::Poll::Ready(Err(e)) => {
2610 return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
2611 e.into(),
2612 ))));
2613 }
2614 }
2615
2616 let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
2618
2619 std::task::Poll::Ready(Some(match header.ordinal {
2620 0x602c15a8004564de => {
2621 header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
2622 let mut req = fidl::new_empty!(ConnectionReceiver2ConnectedRequest, fidl::encoding::DefaultFuchsiaResourceDialect);
2623 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<ConnectionReceiver2ConnectedRequest>(&header, _body_bytes, handles, &mut req)?;
2624 let control_handle = ConnectionReceiver2ControlHandle {
2625 inner: this.inner.clone(),
2626 };
2627 Ok(ConnectionReceiver2Request::Connected {payload: req,
2628 responder: ConnectionReceiver2ConnectedResponder {
2629 control_handle: std::mem::ManuallyDrop::new(control_handle),
2630 tx_id: header.tx_id,
2631 },
2632 })
2633 }
2634 _ if header.tx_id == 0 && header.dynamic_flags().contains(fidl::encoding::DynamicFlags::FLEXIBLE) => {
2635 Ok(ConnectionReceiver2Request::_UnknownMethod {
2636 ordinal: header.ordinal,
2637 control_handle: ConnectionReceiver2ControlHandle { inner: this.inner.clone() },
2638 method_type: fidl::MethodType::OneWay,
2639 })
2640 }
2641 _ if header.dynamic_flags().contains(fidl::encoding::DynamicFlags::FLEXIBLE) => {
2642 this.inner.send_framework_err(
2643 fidl::encoding::FrameworkErr::UnknownMethod,
2644 header.tx_id,
2645 header.ordinal,
2646 header.dynamic_flags(),
2647 (bytes, handles),
2648 )?;
2649 Ok(ConnectionReceiver2Request::_UnknownMethod {
2650 ordinal: header.ordinal,
2651 control_handle: ConnectionReceiver2ControlHandle { inner: this.inner.clone() },
2652 method_type: fidl::MethodType::TwoWay,
2653 })
2654 }
2655 _ => Err(fidl::Error::UnknownOrdinal {
2656 ordinal: header.ordinal,
2657 protocol_name: <ConnectionReceiver2Marker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
2658 }),
2659 }))
2660 },
2661 )
2662 }
2663}
2664
2665#[derive(Debug)]
2668pub enum ConnectionReceiver2Request {
2669 Connected {
2674 payload: ConnectionReceiver2ConnectedRequest,
2675 responder: ConnectionReceiver2ConnectedResponder,
2676 },
2677 #[non_exhaustive]
2679 _UnknownMethod {
2680 ordinal: u64,
2682 control_handle: ConnectionReceiver2ControlHandle,
2683 method_type: fidl::MethodType,
2684 },
2685}
2686
2687impl ConnectionReceiver2Request {
2688 #[allow(irrefutable_let_patterns)]
2689 pub fn into_connected(
2690 self,
2691 ) -> Option<(ConnectionReceiver2ConnectedRequest, ConnectionReceiver2ConnectedResponder)> {
2692 if let ConnectionReceiver2Request::Connected { payload, responder } = self {
2693 Some((payload, responder))
2694 } else {
2695 None
2696 }
2697 }
2698
2699 pub fn method_name(&self) -> &'static str {
2701 match *self {
2702 ConnectionReceiver2Request::Connected { .. } => "connected",
2703 ConnectionReceiver2Request::_UnknownMethod {
2704 method_type: fidl::MethodType::OneWay,
2705 ..
2706 } => "unknown one-way method",
2707 ConnectionReceiver2Request::_UnknownMethod {
2708 method_type: fidl::MethodType::TwoWay,
2709 ..
2710 } => "unknown two-way method",
2711 }
2712 }
2713}
2714
2715#[derive(Debug, Clone)]
2716pub struct ConnectionReceiver2ControlHandle {
2717 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
2718}
2719
2720impl fidl::endpoints::ControlHandle for ConnectionReceiver2ControlHandle {
2721 fn shutdown(&self) {
2722 self.inner.shutdown()
2723 }
2724 fn shutdown_with_epitaph(&self, status: zx_status::Status) {
2725 self.inner.shutdown_with_epitaph(status)
2726 }
2727
2728 fn is_closed(&self) -> bool {
2729 self.inner.channel().is_closed()
2730 }
2731 fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
2732 self.inner.channel().on_closed()
2733 }
2734
2735 #[cfg(target_os = "fuchsia")]
2736 fn signal_peer(
2737 &self,
2738 clear_mask: zx::Signals,
2739 set_mask: zx::Signals,
2740 ) -> Result<(), zx_status::Status> {
2741 use fidl::Peered;
2742 self.inner.channel().signal_peer(clear_mask, set_mask)
2743 }
2744}
2745
2746impl ConnectionReceiver2ControlHandle {
2747 pub fn send_on_revoke(&self) -> Result<(), fidl::Error> {
2748 self.inner.send::<fidl::encoding::EmptyPayload>(
2749 (),
2750 0,
2751 0x11281753d1e1851c,
2752 fidl::encoding::DynamicFlags::FLEXIBLE,
2753 )
2754 }
2755}
2756
2757#[must_use = "FIDL methods require a response to be sent"]
2758#[derive(Debug)]
2759pub struct ConnectionReceiver2ConnectedResponder {
2760 control_handle: std::mem::ManuallyDrop<ConnectionReceiver2ControlHandle>,
2761 tx_id: u32,
2762}
2763
2764impl std::ops::Drop for ConnectionReceiver2ConnectedResponder {
2768 fn drop(&mut self) {
2769 self.control_handle.shutdown();
2770 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
2772 }
2773}
2774
2775impl fidl::endpoints::Responder for ConnectionReceiver2ConnectedResponder {
2776 type ControlHandle = ConnectionReceiver2ControlHandle;
2777
2778 fn control_handle(&self) -> &ConnectionReceiver2ControlHandle {
2779 &self.control_handle
2780 }
2781
2782 fn drop_without_shutdown(mut self) {
2783 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
2785 std::mem::forget(self);
2787 }
2788}
2789
2790impl ConnectionReceiver2ConnectedResponder {
2791 pub fn send(self) -> Result<(), fidl::Error> {
2795 let _result = self.send_raw();
2796 if _result.is_err() {
2797 self.control_handle.shutdown();
2798 }
2799 self.drop_without_shutdown();
2800 _result
2801 }
2802
2803 pub fn send_no_shutdown_on_err(self) -> Result<(), fidl::Error> {
2805 let _result = self.send_raw();
2806 self.drop_without_shutdown();
2807 _result
2808 }
2809
2810 fn send_raw(&self) -> Result<(), fidl::Error> {
2811 self.control_handle.inner.send::<fidl::encoding::FlexibleType<fidl::encoding::EmptyStruct>>(
2812 fidl::encoding::Flexible::new(()),
2813 self.tx_id,
2814 0x602c15a8004564de,
2815 fidl::encoding::DynamicFlags::FLEXIBLE,
2816 )
2817 }
2818}
2819
2820#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
2821pub struct L2capParametersExtMarker;
2822
2823impl fidl::endpoints::ProtocolMarker for L2capParametersExtMarker {
2824 type Proxy = L2capParametersExtProxy;
2825 type RequestStream = L2capParametersExtRequestStream;
2826 #[cfg(target_os = "fuchsia")]
2827 type SynchronousProxy = L2capParametersExtSynchronousProxy;
2828
2829 const DEBUG_NAME: &'static str = "(anonymous) L2capParametersExt";
2830}
2831
2832pub trait L2capParametersExtProxyInterface: Send + Sync {
2833 type RequestParametersResponseFut: std::future::Future<Output = Result<fidl_fuchsia_bluetooth::ChannelParameters, fidl::Error>>
2834 + Send;
2835 fn r#request_parameters(
2836 &self,
2837 request: &fidl_fuchsia_bluetooth::ChannelParameters,
2838 ) -> Self::RequestParametersResponseFut;
2839}
2840#[derive(Debug)]
2841#[cfg(target_os = "fuchsia")]
2842pub struct L2capParametersExtSynchronousProxy {
2843 client: fidl::client::sync::Client,
2844}
2845
2846#[cfg(target_os = "fuchsia")]
2847impl fidl::endpoints::SynchronousProxy for L2capParametersExtSynchronousProxy {
2848 type Proxy = L2capParametersExtProxy;
2849 type Protocol = L2capParametersExtMarker;
2850
2851 fn from_channel(inner: fidl::Channel) -> Self {
2852 Self::new(inner)
2853 }
2854
2855 fn into_channel(self) -> fidl::Channel {
2856 self.client.into_channel()
2857 }
2858
2859 fn as_channel(&self) -> &fidl::Channel {
2860 self.client.as_channel()
2861 }
2862}
2863
2864#[cfg(target_os = "fuchsia")]
2865impl L2capParametersExtSynchronousProxy {
2866 pub fn new(channel: fidl::Channel) -> Self {
2867 let protocol_name =
2868 <L2capParametersExtMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
2869 Self { client: fidl::client::sync::Client::new(channel, protocol_name) }
2870 }
2871
2872 pub fn into_channel(self) -> fidl::Channel {
2873 self.client.into_channel()
2874 }
2875
2876 pub fn wait_for_event(
2879 &self,
2880 deadline: zx::MonotonicInstant,
2881 ) -> Result<L2capParametersExtEvent, fidl::Error> {
2882 L2capParametersExtEvent::decode(self.client.wait_for_event(deadline)?)
2883 }
2884
2885 pub fn r#request_parameters(
2892 &self,
2893 mut request: &fidl_fuchsia_bluetooth::ChannelParameters,
2894 ___deadline: zx::MonotonicInstant,
2895 ) -> Result<fidl_fuchsia_bluetooth::ChannelParameters, fidl::Error> {
2896 let _response = self.client.send_query::<
2897 L2capParametersExtRequestParametersRequest,
2898 fidl::encoding::FlexibleType<L2capParametersExtRequestParametersResponse>,
2899 >(
2900 (request,),
2901 0x1da4d8f268e2e918,
2902 fidl::encoding::DynamicFlags::FLEXIBLE,
2903 ___deadline,
2904 )?
2905 .into_result::<L2capParametersExtMarker>("request_parameters")?;
2906 Ok(_response.new)
2907 }
2908}
2909
2910#[cfg(target_os = "fuchsia")]
2911impl From<L2capParametersExtSynchronousProxy> for zx::Handle {
2912 fn from(value: L2capParametersExtSynchronousProxy) -> Self {
2913 value.into_channel().into()
2914 }
2915}
2916
2917#[cfg(target_os = "fuchsia")]
2918impl From<fidl::Channel> for L2capParametersExtSynchronousProxy {
2919 fn from(value: fidl::Channel) -> Self {
2920 Self::new(value)
2921 }
2922}
2923
2924#[cfg(target_os = "fuchsia")]
2925impl fidl::endpoints::FromClient for L2capParametersExtSynchronousProxy {
2926 type Protocol = L2capParametersExtMarker;
2927
2928 fn from_client(value: fidl::endpoints::ClientEnd<L2capParametersExtMarker>) -> Self {
2929 Self::new(value.into_channel())
2930 }
2931}
2932
2933#[derive(Debug, Clone)]
2934pub struct L2capParametersExtProxy {
2935 client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
2936}
2937
2938impl fidl::endpoints::Proxy for L2capParametersExtProxy {
2939 type Protocol = L2capParametersExtMarker;
2940
2941 fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
2942 Self::new(inner)
2943 }
2944
2945 fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
2946 self.client.into_channel().map_err(|client| Self { client })
2947 }
2948
2949 fn as_channel(&self) -> &::fidl::AsyncChannel {
2950 self.client.as_channel()
2951 }
2952}
2953
2954impl L2capParametersExtProxy {
2955 pub fn new(channel: ::fidl::AsyncChannel) -> Self {
2957 let protocol_name =
2958 <L2capParametersExtMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
2959 Self { client: fidl::client::Client::new(channel, protocol_name) }
2960 }
2961
2962 pub fn take_event_stream(&self) -> L2capParametersExtEventStream {
2968 L2capParametersExtEventStream { event_receiver: self.client.take_event_receiver() }
2969 }
2970
2971 pub fn r#request_parameters(
2978 &self,
2979 mut request: &fidl_fuchsia_bluetooth::ChannelParameters,
2980 ) -> fidl::client::QueryResponseFut<
2981 fidl_fuchsia_bluetooth::ChannelParameters,
2982 fidl::encoding::DefaultFuchsiaResourceDialect,
2983 > {
2984 L2capParametersExtProxyInterface::r#request_parameters(self, request)
2985 }
2986}
2987
2988impl L2capParametersExtProxyInterface for L2capParametersExtProxy {
2989 type RequestParametersResponseFut = fidl::client::QueryResponseFut<
2990 fidl_fuchsia_bluetooth::ChannelParameters,
2991 fidl::encoding::DefaultFuchsiaResourceDialect,
2992 >;
2993 fn r#request_parameters(
2994 &self,
2995 mut request: &fidl_fuchsia_bluetooth::ChannelParameters,
2996 ) -> Self::RequestParametersResponseFut {
2997 fn _decode(
2998 mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
2999 ) -> Result<fidl_fuchsia_bluetooth::ChannelParameters, fidl::Error> {
3000 let _response = fidl::client::decode_transaction_body::<
3001 fidl::encoding::FlexibleType<L2capParametersExtRequestParametersResponse>,
3002 fidl::encoding::DefaultFuchsiaResourceDialect,
3003 0x1da4d8f268e2e918,
3004 >(_buf?)?
3005 .into_result::<L2capParametersExtMarker>("request_parameters")?;
3006 Ok(_response.new)
3007 }
3008 self.client.send_query_and_decode::<
3009 L2capParametersExtRequestParametersRequest,
3010 fidl_fuchsia_bluetooth::ChannelParameters,
3011 >(
3012 (request,),
3013 0x1da4d8f268e2e918,
3014 fidl::encoding::DynamicFlags::FLEXIBLE,
3015 _decode,
3016 )
3017 }
3018}
3019
3020pub struct L2capParametersExtEventStream {
3021 event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
3022}
3023
3024impl std::marker::Unpin for L2capParametersExtEventStream {}
3025
3026impl futures::stream::FusedStream for L2capParametersExtEventStream {
3027 fn is_terminated(&self) -> bool {
3028 self.event_receiver.is_terminated()
3029 }
3030}
3031
3032impl futures::Stream for L2capParametersExtEventStream {
3033 type Item = Result<L2capParametersExtEvent, fidl::Error>;
3034
3035 fn poll_next(
3036 mut self: std::pin::Pin<&mut Self>,
3037 cx: &mut std::task::Context<'_>,
3038 ) -> std::task::Poll<Option<Self::Item>> {
3039 match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
3040 &mut self.event_receiver,
3041 cx
3042 )?) {
3043 Some(buf) => std::task::Poll::Ready(Some(L2capParametersExtEvent::decode(buf))),
3044 None => std::task::Poll::Ready(None),
3045 }
3046 }
3047}
3048
3049#[derive(Debug)]
3050pub enum L2capParametersExtEvent {
3051 #[non_exhaustive]
3052 _UnknownEvent {
3053 ordinal: u64,
3055 },
3056}
3057
3058impl L2capParametersExtEvent {
3059 fn decode(
3061 mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
3062 ) -> Result<L2capParametersExtEvent, fidl::Error> {
3063 let (bytes, _handles) = buf.split_mut();
3064 let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
3065 debug_assert_eq!(tx_header.tx_id, 0);
3066 match tx_header.ordinal {
3067 _ if tx_header.dynamic_flags().contains(fidl::encoding::DynamicFlags::FLEXIBLE) => {
3068 Ok(L2capParametersExtEvent::_UnknownEvent { ordinal: tx_header.ordinal })
3069 }
3070 _ => Err(fidl::Error::UnknownOrdinal {
3071 ordinal: tx_header.ordinal,
3072 protocol_name:
3073 <L2capParametersExtMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
3074 }),
3075 }
3076 }
3077}
3078
3079pub struct L2capParametersExtRequestStream {
3081 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
3082 is_terminated: bool,
3083}
3084
3085impl std::marker::Unpin for L2capParametersExtRequestStream {}
3086
3087impl futures::stream::FusedStream for L2capParametersExtRequestStream {
3088 fn is_terminated(&self) -> bool {
3089 self.is_terminated
3090 }
3091}
3092
3093impl fidl::endpoints::RequestStream for L2capParametersExtRequestStream {
3094 type Protocol = L2capParametersExtMarker;
3095 type ControlHandle = L2capParametersExtControlHandle;
3096
3097 fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
3098 Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
3099 }
3100
3101 fn control_handle(&self) -> Self::ControlHandle {
3102 L2capParametersExtControlHandle { inner: self.inner.clone() }
3103 }
3104
3105 fn into_inner(
3106 self,
3107 ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
3108 {
3109 (self.inner, self.is_terminated)
3110 }
3111
3112 fn from_inner(
3113 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
3114 is_terminated: bool,
3115 ) -> Self {
3116 Self { inner, is_terminated }
3117 }
3118}
3119
3120impl futures::Stream for L2capParametersExtRequestStream {
3121 type Item = Result<L2capParametersExtRequest, 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 let this = &mut *self;
3128 if this.inner.check_shutdown(cx) {
3129 this.is_terminated = true;
3130 return std::task::Poll::Ready(None);
3131 }
3132 if this.is_terminated {
3133 panic!("polled L2capParametersExtRequestStream after completion");
3134 }
3135 fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
3136 |bytes, handles| {
3137 match this.inner.channel().read_etc(cx, bytes, handles) {
3138 std::task::Poll::Ready(Ok(())) => {}
3139 std::task::Poll::Pending => return std::task::Poll::Pending,
3140 std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
3141 this.is_terminated = true;
3142 return std::task::Poll::Ready(None);
3143 }
3144 std::task::Poll::Ready(Err(e)) => {
3145 return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
3146 e.into(),
3147 ))));
3148 }
3149 }
3150
3151 let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
3153
3154 std::task::Poll::Ready(Some(match header.ordinal {
3155 0x1da4d8f268e2e918 => {
3156 header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
3157 let mut req = fidl::new_empty!(L2capParametersExtRequestParametersRequest, fidl::encoding::DefaultFuchsiaResourceDialect);
3158 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<L2capParametersExtRequestParametersRequest>(&header, _body_bytes, handles, &mut req)?;
3159 let control_handle = L2capParametersExtControlHandle {
3160 inner: this.inner.clone(),
3161 };
3162 Ok(L2capParametersExtRequest::RequestParameters {request: req.request,
3163
3164 responder: L2capParametersExtRequestParametersResponder {
3165 control_handle: std::mem::ManuallyDrop::new(control_handle),
3166 tx_id: header.tx_id,
3167 },
3168 })
3169 }
3170 _ if header.tx_id == 0 && header.dynamic_flags().contains(fidl::encoding::DynamicFlags::FLEXIBLE) => {
3171 Ok(L2capParametersExtRequest::_UnknownMethod {
3172 ordinal: header.ordinal,
3173 control_handle: L2capParametersExtControlHandle { inner: this.inner.clone() },
3174 method_type: fidl::MethodType::OneWay,
3175 })
3176 }
3177 _ if header.dynamic_flags().contains(fidl::encoding::DynamicFlags::FLEXIBLE) => {
3178 this.inner.send_framework_err(
3179 fidl::encoding::FrameworkErr::UnknownMethod,
3180 header.tx_id,
3181 header.ordinal,
3182 header.dynamic_flags(),
3183 (bytes, handles),
3184 )?;
3185 Ok(L2capParametersExtRequest::_UnknownMethod {
3186 ordinal: header.ordinal,
3187 control_handle: L2capParametersExtControlHandle { inner: this.inner.clone() },
3188 method_type: fidl::MethodType::TwoWay,
3189 })
3190 }
3191 _ => Err(fidl::Error::UnknownOrdinal {
3192 ordinal: header.ordinal,
3193 protocol_name: <L2capParametersExtMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
3194 }),
3195 }))
3196 },
3197 )
3198 }
3199}
3200
3201#[derive(Debug)]
3203pub enum L2capParametersExtRequest {
3204 RequestParameters {
3211 request: fidl_fuchsia_bluetooth::ChannelParameters,
3212 responder: L2capParametersExtRequestParametersResponder,
3213 },
3214 #[non_exhaustive]
3216 _UnknownMethod {
3217 ordinal: u64,
3219 control_handle: L2capParametersExtControlHandle,
3220 method_type: fidl::MethodType,
3221 },
3222}
3223
3224impl L2capParametersExtRequest {
3225 #[allow(irrefutable_let_patterns)]
3226 pub fn into_request_parameters(
3227 self,
3228 ) -> Option<(
3229 fidl_fuchsia_bluetooth::ChannelParameters,
3230 L2capParametersExtRequestParametersResponder,
3231 )> {
3232 if let L2capParametersExtRequest::RequestParameters { request, responder } = self {
3233 Some((request, responder))
3234 } else {
3235 None
3236 }
3237 }
3238
3239 pub fn method_name(&self) -> &'static str {
3241 match *self {
3242 L2capParametersExtRequest::RequestParameters { .. } => "request_parameters",
3243 L2capParametersExtRequest::_UnknownMethod {
3244 method_type: fidl::MethodType::OneWay,
3245 ..
3246 } => "unknown one-way method",
3247 L2capParametersExtRequest::_UnknownMethod {
3248 method_type: fidl::MethodType::TwoWay,
3249 ..
3250 } => "unknown two-way method",
3251 }
3252 }
3253}
3254
3255#[derive(Debug, Clone)]
3256pub struct L2capParametersExtControlHandle {
3257 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
3258}
3259
3260impl fidl::endpoints::ControlHandle for L2capParametersExtControlHandle {
3261 fn shutdown(&self) {
3262 self.inner.shutdown()
3263 }
3264 fn shutdown_with_epitaph(&self, status: zx_status::Status) {
3265 self.inner.shutdown_with_epitaph(status)
3266 }
3267
3268 fn is_closed(&self) -> bool {
3269 self.inner.channel().is_closed()
3270 }
3271 fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
3272 self.inner.channel().on_closed()
3273 }
3274
3275 #[cfg(target_os = "fuchsia")]
3276 fn signal_peer(
3277 &self,
3278 clear_mask: zx::Signals,
3279 set_mask: zx::Signals,
3280 ) -> Result<(), zx_status::Status> {
3281 use fidl::Peered;
3282 self.inner.channel().signal_peer(clear_mask, set_mask)
3283 }
3284}
3285
3286impl L2capParametersExtControlHandle {}
3287
3288#[must_use = "FIDL methods require a response to be sent"]
3289#[derive(Debug)]
3290pub struct L2capParametersExtRequestParametersResponder {
3291 control_handle: std::mem::ManuallyDrop<L2capParametersExtControlHandle>,
3292 tx_id: u32,
3293}
3294
3295impl std::ops::Drop for L2capParametersExtRequestParametersResponder {
3299 fn drop(&mut self) {
3300 self.control_handle.shutdown();
3301 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
3303 }
3304}
3305
3306impl fidl::endpoints::Responder for L2capParametersExtRequestParametersResponder {
3307 type ControlHandle = L2capParametersExtControlHandle;
3308
3309 fn control_handle(&self) -> &L2capParametersExtControlHandle {
3310 &self.control_handle
3311 }
3312
3313 fn drop_without_shutdown(mut self) {
3314 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
3316 std::mem::forget(self);
3318 }
3319}
3320
3321impl L2capParametersExtRequestParametersResponder {
3322 pub fn send(
3326 self,
3327 mut new: &fidl_fuchsia_bluetooth::ChannelParameters,
3328 ) -> Result<(), fidl::Error> {
3329 let _result = self.send_raw(new);
3330 if _result.is_err() {
3331 self.control_handle.shutdown();
3332 }
3333 self.drop_without_shutdown();
3334 _result
3335 }
3336
3337 pub fn send_no_shutdown_on_err(
3339 self,
3340 mut new: &fidl_fuchsia_bluetooth::ChannelParameters,
3341 ) -> Result<(), fidl::Error> {
3342 let _result = self.send_raw(new);
3343 self.drop_without_shutdown();
3344 _result
3345 }
3346
3347 fn send_raw(
3348 &self,
3349 mut new: &fidl_fuchsia_bluetooth::ChannelParameters,
3350 ) -> Result<(), fidl::Error> {
3351 self.control_handle.inner.send::<fidl::encoding::FlexibleType<
3352 L2capParametersExtRequestParametersResponse,
3353 >>(
3354 fidl::encoding::Flexible::new((new,)),
3355 self.tx_id,
3356 0x1da4d8f268e2e918,
3357 fidl::encoding::DynamicFlags::FLEXIBLE,
3358 )
3359 }
3360}
3361
3362#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
3363pub struct ProfileMarker;
3364
3365impl fidl::endpoints::ProtocolMarker for ProfileMarker {
3366 type Proxy = ProfileProxy;
3367 type RequestStream = ProfileRequestStream;
3368 #[cfg(target_os = "fuchsia")]
3369 type SynchronousProxy = ProfileSynchronousProxy;
3370
3371 const DEBUG_NAME: &'static str = "fuchsia.bluetooth.bredr.Profile";
3372}
3373impl fidl::endpoints::DiscoverableProtocolMarker for ProfileMarker {}
3374pub type ProfileAdvertiseResult =
3375 Result<ProfileAdvertiseResponse, fidl_fuchsia_bluetooth::ErrorCode>;
3376pub type ProfileConnectResult = Result<Channel, fidl_fuchsia_bluetooth::ErrorCode>;
3377
3378pub trait ProfileProxyInterface: Send + Sync {
3379 type AdvertiseResponseFut: std::future::Future<Output = Result<ProfileAdvertiseResult, fidl::Error>>
3380 + Send;
3381 fn r#advertise(&self, payload: ProfileAdvertiseRequest) -> Self::AdvertiseResponseFut;
3382 fn r#search(&self, payload: ProfileSearchRequest) -> Result<(), fidl::Error>;
3383 type ConnectResponseFut: std::future::Future<Output = Result<ProfileConnectResult, fidl::Error>>
3384 + Send;
3385 fn r#connect(
3386 &self,
3387 peer_id: &fidl_fuchsia_bluetooth::PeerId,
3388 connection: &ConnectParameters,
3389 ) -> Self::ConnectResponseFut;
3390 fn r#connect_sco(&self, payload: ProfileConnectScoRequest) -> Result<(), fidl::Error>;
3391}
3392#[derive(Debug)]
3393#[cfg(target_os = "fuchsia")]
3394pub struct ProfileSynchronousProxy {
3395 client: fidl::client::sync::Client,
3396}
3397
3398#[cfg(target_os = "fuchsia")]
3399impl fidl::endpoints::SynchronousProxy for ProfileSynchronousProxy {
3400 type Proxy = ProfileProxy;
3401 type Protocol = ProfileMarker;
3402
3403 fn from_channel(inner: fidl::Channel) -> Self {
3404 Self::new(inner)
3405 }
3406
3407 fn into_channel(self) -> fidl::Channel {
3408 self.client.into_channel()
3409 }
3410
3411 fn as_channel(&self) -> &fidl::Channel {
3412 self.client.as_channel()
3413 }
3414}
3415
3416#[cfg(target_os = "fuchsia")]
3417impl ProfileSynchronousProxy {
3418 pub fn new(channel: fidl::Channel) -> Self {
3419 let protocol_name = <ProfileMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
3420 Self { client: fidl::client::sync::Client::new(channel, protocol_name) }
3421 }
3422
3423 pub fn into_channel(self) -> fidl::Channel {
3424 self.client.into_channel()
3425 }
3426
3427 pub fn wait_for_event(
3430 &self,
3431 deadline: zx::MonotonicInstant,
3432 ) -> Result<ProfileEvent, fidl::Error> {
3433 ProfileEvent::decode(self.client.wait_for_event(deadline)?)
3434 }
3435
3436 pub fn r#advertise(
3457 &self,
3458 mut payload: ProfileAdvertiseRequest,
3459 ___deadline: zx::MonotonicInstant,
3460 ) -> Result<ProfileAdvertiseResult, fidl::Error> {
3461 let _response = self
3462 .client
3463 .send_query::<ProfileAdvertiseRequest, fidl::encoding::FlexibleResultType<
3464 ProfileAdvertiseResponse,
3465 fidl_fuchsia_bluetooth::ErrorCode,
3466 >>(
3467 &mut payload,
3468 0x65e429c1f0205a0e,
3469 fidl::encoding::DynamicFlags::FLEXIBLE,
3470 ___deadline,
3471 )?
3472 .into_result::<ProfileMarker>("advertise")?;
3473 Ok(_response.map(|x| x))
3474 }
3475
3476 pub fn r#search(&self, mut payload: ProfileSearchRequest) -> Result<(), fidl::Error> {
3486 self.client.send::<ProfileSearchRequest>(
3487 &mut payload,
3488 0x2c59d8580bc8ef0a,
3489 fidl::encoding::DynamicFlags::FLEXIBLE,
3490 )
3491 }
3492
3493 pub fn r#connect(
3499 &self,
3500 mut peer_id: &fidl_fuchsia_bluetooth::PeerId,
3501 mut connection: &ConnectParameters,
3502 ___deadline: zx::MonotonicInstant,
3503 ) -> Result<ProfileConnectResult, fidl::Error> {
3504 let _response = self
3505 .client
3506 .send_query::<ProfileConnectRequest, fidl::encoding::FlexibleResultType<
3507 ProfileConnectResponse,
3508 fidl_fuchsia_bluetooth::ErrorCode,
3509 >>(
3510 (peer_id, connection),
3511 0xaaeefc898901fb3,
3512 fidl::encoding::DynamicFlags::FLEXIBLE,
3513 ___deadline,
3514 )?
3515 .into_result::<ProfileMarker>("connect")?;
3516 Ok(_response.map(|x| x.channel))
3517 }
3518
3519 pub fn r#connect_sco(&self, mut payload: ProfileConnectScoRequest) -> Result<(), fidl::Error> {
3535 self.client.send::<ProfileConnectScoRequest>(
3536 &mut payload,
3537 0x961976ddd116ee6,
3538 fidl::encoding::DynamicFlags::FLEXIBLE,
3539 )
3540 }
3541}
3542
3543#[cfg(target_os = "fuchsia")]
3544impl From<ProfileSynchronousProxy> for zx::Handle {
3545 fn from(value: ProfileSynchronousProxy) -> Self {
3546 value.into_channel().into()
3547 }
3548}
3549
3550#[cfg(target_os = "fuchsia")]
3551impl From<fidl::Channel> for ProfileSynchronousProxy {
3552 fn from(value: fidl::Channel) -> Self {
3553 Self::new(value)
3554 }
3555}
3556
3557#[cfg(target_os = "fuchsia")]
3558impl fidl::endpoints::FromClient for ProfileSynchronousProxy {
3559 type Protocol = ProfileMarker;
3560
3561 fn from_client(value: fidl::endpoints::ClientEnd<ProfileMarker>) -> Self {
3562 Self::new(value.into_channel())
3563 }
3564}
3565
3566#[derive(Debug, Clone)]
3567pub struct ProfileProxy {
3568 client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
3569}
3570
3571impl fidl::endpoints::Proxy for ProfileProxy {
3572 type Protocol = ProfileMarker;
3573
3574 fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
3575 Self::new(inner)
3576 }
3577
3578 fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
3579 self.client.into_channel().map_err(|client| Self { client })
3580 }
3581
3582 fn as_channel(&self) -> &::fidl::AsyncChannel {
3583 self.client.as_channel()
3584 }
3585}
3586
3587impl ProfileProxy {
3588 pub fn new(channel: ::fidl::AsyncChannel) -> Self {
3590 let protocol_name = <ProfileMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
3591 Self { client: fidl::client::Client::new(channel, protocol_name) }
3592 }
3593
3594 pub fn take_event_stream(&self) -> ProfileEventStream {
3600 ProfileEventStream { event_receiver: self.client.take_event_receiver() }
3601 }
3602
3603 pub fn r#advertise(
3624 &self,
3625 mut payload: ProfileAdvertiseRequest,
3626 ) -> fidl::client::QueryResponseFut<
3627 ProfileAdvertiseResult,
3628 fidl::encoding::DefaultFuchsiaResourceDialect,
3629 > {
3630 ProfileProxyInterface::r#advertise(self, payload)
3631 }
3632
3633 pub fn r#search(&self, mut payload: ProfileSearchRequest) -> Result<(), fidl::Error> {
3643 ProfileProxyInterface::r#search(self, payload)
3644 }
3645
3646 pub fn r#connect(
3652 &self,
3653 mut peer_id: &fidl_fuchsia_bluetooth::PeerId,
3654 mut connection: &ConnectParameters,
3655 ) -> fidl::client::QueryResponseFut<
3656 ProfileConnectResult,
3657 fidl::encoding::DefaultFuchsiaResourceDialect,
3658 > {
3659 ProfileProxyInterface::r#connect(self, peer_id, connection)
3660 }
3661
3662 pub fn r#connect_sco(&self, mut payload: ProfileConnectScoRequest) -> Result<(), fidl::Error> {
3678 ProfileProxyInterface::r#connect_sco(self, payload)
3679 }
3680}
3681
3682impl ProfileProxyInterface for ProfileProxy {
3683 type AdvertiseResponseFut = fidl::client::QueryResponseFut<
3684 ProfileAdvertiseResult,
3685 fidl::encoding::DefaultFuchsiaResourceDialect,
3686 >;
3687 fn r#advertise(&self, mut payload: ProfileAdvertiseRequest) -> Self::AdvertiseResponseFut {
3688 fn _decode(
3689 mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
3690 ) -> Result<ProfileAdvertiseResult, fidl::Error> {
3691 let _response = fidl::client::decode_transaction_body::<
3692 fidl::encoding::FlexibleResultType<
3693 ProfileAdvertiseResponse,
3694 fidl_fuchsia_bluetooth::ErrorCode,
3695 >,
3696 fidl::encoding::DefaultFuchsiaResourceDialect,
3697 0x65e429c1f0205a0e,
3698 >(_buf?)?
3699 .into_result::<ProfileMarker>("advertise")?;
3700 Ok(_response.map(|x| x))
3701 }
3702 self.client.send_query_and_decode::<ProfileAdvertiseRequest, ProfileAdvertiseResult>(
3703 &mut payload,
3704 0x65e429c1f0205a0e,
3705 fidl::encoding::DynamicFlags::FLEXIBLE,
3706 _decode,
3707 )
3708 }
3709
3710 fn r#search(&self, mut payload: ProfileSearchRequest) -> Result<(), fidl::Error> {
3711 self.client.send::<ProfileSearchRequest>(
3712 &mut payload,
3713 0x2c59d8580bc8ef0a,
3714 fidl::encoding::DynamicFlags::FLEXIBLE,
3715 )
3716 }
3717
3718 type ConnectResponseFut = fidl::client::QueryResponseFut<
3719 ProfileConnectResult,
3720 fidl::encoding::DefaultFuchsiaResourceDialect,
3721 >;
3722 fn r#connect(
3723 &self,
3724 mut peer_id: &fidl_fuchsia_bluetooth::PeerId,
3725 mut connection: &ConnectParameters,
3726 ) -> Self::ConnectResponseFut {
3727 fn _decode(
3728 mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
3729 ) -> Result<ProfileConnectResult, fidl::Error> {
3730 let _response = fidl::client::decode_transaction_body::<
3731 fidl::encoding::FlexibleResultType<
3732 ProfileConnectResponse,
3733 fidl_fuchsia_bluetooth::ErrorCode,
3734 >,
3735 fidl::encoding::DefaultFuchsiaResourceDialect,
3736 0xaaeefc898901fb3,
3737 >(_buf?)?
3738 .into_result::<ProfileMarker>("connect")?;
3739 Ok(_response.map(|x| x.channel))
3740 }
3741 self.client.send_query_and_decode::<ProfileConnectRequest, ProfileConnectResult>(
3742 (peer_id, connection),
3743 0xaaeefc898901fb3,
3744 fidl::encoding::DynamicFlags::FLEXIBLE,
3745 _decode,
3746 )
3747 }
3748
3749 fn r#connect_sco(&self, mut payload: ProfileConnectScoRequest) -> Result<(), fidl::Error> {
3750 self.client.send::<ProfileConnectScoRequest>(
3751 &mut payload,
3752 0x961976ddd116ee6,
3753 fidl::encoding::DynamicFlags::FLEXIBLE,
3754 )
3755 }
3756}
3757
3758pub struct ProfileEventStream {
3759 event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
3760}
3761
3762impl std::marker::Unpin for ProfileEventStream {}
3763
3764impl futures::stream::FusedStream for ProfileEventStream {
3765 fn is_terminated(&self) -> bool {
3766 self.event_receiver.is_terminated()
3767 }
3768}
3769
3770impl futures::Stream for ProfileEventStream {
3771 type Item = Result<ProfileEvent, fidl::Error>;
3772
3773 fn poll_next(
3774 mut self: std::pin::Pin<&mut Self>,
3775 cx: &mut std::task::Context<'_>,
3776 ) -> std::task::Poll<Option<Self::Item>> {
3777 match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
3778 &mut self.event_receiver,
3779 cx
3780 )?) {
3781 Some(buf) => std::task::Poll::Ready(Some(ProfileEvent::decode(buf))),
3782 None => std::task::Poll::Ready(None),
3783 }
3784 }
3785}
3786
3787#[derive(Debug)]
3788pub enum ProfileEvent {
3789 #[non_exhaustive]
3790 _UnknownEvent {
3791 ordinal: u64,
3793 },
3794}
3795
3796impl ProfileEvent {
3797 fn decode(
3799 mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
3800 ) -> Result<ProfileEvent, fidl::Error> {
3801 let (bytes, _handles) = buf.split_mut();
3802 let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
3803 debug_assert_eq!(tx_header.tx_id, 0);
3804 match tx_header.ordinal {
3805 _ if tx_header.dynamic_flags().contains(fidl::encoding::DynamicFlags::FLEXIBLE) => {
3806 Ok(ProfileEvent::_UnknownEvent { ordinal: tx_header.ordinal })
3807 }
3808 _ => Err(fidl::Error::UnknownOrdinal {
3809 ordinal: tx_header.ordinal,
3810 protocol_name: <ProfileMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
3811 }),
3812 }
3813 }
3814}
3815
3816pub struct ProfileRequestStream {
3818 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
3819 is_terminated: bool,
3820}
3821
3822impl std::marker::Unpin for ProfileRequestStream {}
3823
3824impl futures::stream::FusedStream for ProfileRequestStream {
3825 fn is_terminated(&self) -> bool {
3826 self.is_terminated
3827 }
3828}
3829
3830impl fidl::endpoints::RequestStream for ProfileRequestStream {
3831 type Protocol = ProfileMarker;
3832 type ControlHandle = ProfileControlHandle;
3833
3834 fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
3835 Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
3836 }
3837
3838 fn control_handle(&self) -> Self::ControlHandle {
3839 ProfileControlHandle { inner: self.inner.clone() }
3840 }
3841
3842 fn into_inner(
3843 self,
3844 ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
3845 {
3846 (self.inner, self.is_terminated)
3847 }
3848
3849 fn from_inner(
3850 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
3851 is_terminated: bool,
3852 ) -> Self {
3853 Self { inner, is_terminated }
3854 }
3855}
3856
3857impl futures::Stream for ProfileRequestStream {
3858 type Item = Result<ProfileRequest, fidl::Error>;
3859
3860 fn poll_next(
3861 mut self: std::pin::Pin<&mut Self>,
3862 cx: &mut std::task::Context<'_>,
3863 ) -> std::task::Poll<Option<Self::Item>> {
3864 let this = &mut *self;
3865 if this.inner.check_shutdown(cx) {
3866 this.is_terminated = true;
3867 return std::task::Poll::Ready(None);
3868 }
3869 if this.is_terminated {
3870 panic!("polled ProfileRequestStream after completion");
3871 }
3872 fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
3873 |bytes, handles| {
3874 match this.inner.channel().read_etc(cx, bytes, handles) {
3875 std::task::Poll::Ready(Ok(())) => {}
3876 std::task::Poll::Pending => return std::task::Poll::Pending,
3877 std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
3878 this.is_terminated = true;
3879 return std::task::Poll::Ready(None);
3880 }
3881 std::task::Poll::Ready(Err(e)) => {
3882 return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
3883 e.into(),
3884 ))));
3885 }
3886 }
3887
3888 let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
3890
3891 std::task::Poll::Ready(Some(match header.ordinal {
3892 0x65e429c1f0205a0e => {
3893 header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
3894 let mut req = fidl::new_empty!(
3895 ProfileAdvertiseRequest,
3896 fidl::encoding::DefaultFuchsiaResourceDialect
3897 );
3898 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<ProfileAdvertiseRequest>(&header, _body_bytes, handles, &mut req)?;
3899 let control_handle = ProfileControlHandle { inner: this.inner.clone() };
3900 Ok(ProfileRequest::Advertise {
3901 payload: req,
3902 responder: ProfileAdvertiseResponder {
3903 control_handle: std::mem::ManuallyDrop::new(control_handle),
3904 tx_id: header.tx_id,
3905 },
3906 })
3907 }
3908 0x2c59d8580bc8ef0a => {
3909 header.validate_request_tx_id(fidl::MethodType::OneWay)?;
3910 let mut req = fidl::new_empty!(
3911 ProfileSearchRequest,
3912 fidl::encoding::DefaultFuchsiaResourceDialect
3913 );
3914 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<ProfileSearchRequest>(&header, _body_bytes, handles, &mut req)?;
3915 let control_handle = ProfileControlHandle { inner: this.inner.clone() };
3916 Ok(ProfileRequest::Search { payload: req, control_handle })
3917 }
3918 0xaaeefc898901fb3 => {
3919 header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
3920 let mut req = fidl::new_empty!(
3921 ProfileConnectRequest,
3922 fidl::encoding::DefaultFuchsiaResourceDialect
3923 );
3924 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<ProfileConnectRequest>(&header, _body_bytes, handles, &mut req)?;
3925 let control_handle = ProfileControlHandle { inner: this.inner.clone() };
3926 Ok(ProfileRequest::Connect {
3927 peer_id: req.peer_id,
3928 connection: req.connection,
3929
3930 responder: ProfileConnectResponder {
3931 control_handle: std::mem::ManuallyDrop::new(control_handle),
3932 tx_id: header.tx_id,
3933 },
3934 })
3935 }
3936 0x961976ddd116ee6 => {
3937 header.validate_request_tx_id(fidl::MethodType::OneWay)?;
3938 let mut req = fidl::new_empty!(
3939 ProfileConnectScoRequest,
3940 fidl::encoding::DefaultFuchsiaResourceDialect
3941 );
3942 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<ProfileConnectScoRequest>(&header, _body_bytes, handles, &mut req)?;
3943 let control_handle = ProfileControlHandle { inner: this.inner.clone() };
3944 Ok(ProfileRequest::ConnectSco { payload: req, control_handle })
3945 }
3946 _ if header.tx_id == 0
3947 && header
3948 .dynamic_flags()
3949 .contains(fidl::encoding::DynamicFlags::FLEXIBLE) =>
3950 {
3951 Ok(ProfileRequest::_UnknownMethod {
3952 ordinal: header.ordinal,
3953 control_handle: ProfileControlHandle { inner: this.inner.clone() },
3954 method_type: fidl::MethodType::OneWay,
3955 })
3956 }
3957 _ if header
3958 .dynamic_flags()
3959 .contains(fidl::encoding::DynamicFlags::FLEXIBLE) =>
3960 {
3961 this.inner.send_framework_err(
3962 fidl::encoding::FrameworkErr::UnknownMethod,
3963 header.tx_id,
3964 header.ordinal,
3965 header.dynamic_flags(),
3966 (bytes, handles),
3967 )?;
3968 Ok(ProfileRequest::_UnknownMethod {
3969 ordinal: header.ordinal,
3970 control_handle: ProfileControlHandle { inner: this.inner.clone() },
3971 method_type: fidl::MethodType::TwoWay,
3972 })
3973 }
3974 _ => Err(fidl::Error::UnknownOrdinal {
3975 ordinal: header.ordinal,
3976 protocol_name:
3977 <ProfileMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
3978 }),
3979 }))
3980 },
3981 )
3982 }
3983}
3984
3985#[derive(Debug)]
3989pub enum ProfileRequest {
3990 Advertise { payload: ProfileAdvertiseRequest, responder: ProfileAdvertiseResponder },
4011 Search { payload: ProfileSearchRequest, control_handle: ProfileControlHandle },
4021 Connect {
4027 peer_id: fidl_fuchsia_bluetooth::PeerId,
4028 connection: ConnectParameters,
4029 responder: ProfileConnectResponder,
4030 },
4031 ConnectSco { payload: ProfileConnectScoRequest, control_handle: ProfileControlHandle },
4047 #[non_exhaustive]
4049 _UnknownMethod {
4050 ordinal: u64,
4052 control_handle: ProfileControlHandle,
4053 method_type: fidl::MethodType,
4054 },
4055}
4056
4057impl ProfileRequest {
4058 #[allow(irrefutable_let_patterns)]
4059 pub fn into_advertise(self) -> Option<(ProfileAdvertiseRequest, ProfileAdvertiseResponder)> {
4060 if let ProfileRequest::Advertise { payload, responder } = self {
4061 Some((payload, responder))
4062 } else {
4063 None
4064 }
4065 }
4066
4067 #[allow(irrefutable_let_patterns)]
4068 pub fn into_search(self) -> Option<(ProfileSearchRequest, ProfileControlHandle)> {
4069 if let ProfileRequest::Search { payload, control_handle } = self {
4070 Some((payload, control_handle))
4071 } else {
4072 None
4073 }
4074 }
4075
4076 #[allow(irrefutable_let_patterns)]
4077 pub fn into_connect(
4078 self,
4079 ) -> Option<(fidl_fuchsia_bluetooth::PeerId, ConnectParameters, ProfileConnectResponder)> {
4080 if let ProfileRequest::Connect { peer_id, connection, responder } = self {
4081 Some((peer_id, connection, responder))
4082 } else {
4083 None
4084 }
4085 }
4086
4087 #[allow(irrefutable_let_patterns)]
4088 pub fn into_connect_sco(self) -> Option<(ProfileConnectScoRequest, ProfileControlHandle)> {
4089 if let ProfileRequest::ConnectSco { payload, control_handle } = self {
4090 Some((payload, control_handle))
4091 } else {
4092 None
4093 }
4094 }
4095
4096 pub fn method_name(&self) -> &'static str {
4098 match *self {
4099 ProfileRequest::Advertise { .. } => "advertise",
4100 ProfileRequest::Search { .. } => "search",
4101 ProfileRequest::Connect { .. } => "connect",
4102 ProfileRequest::ConnectSco { .. } => "connect_sco",
4103 ProfileRequest::_UnknownMethod { method_type: fidl::MethodType::OneWay, .. } => {
4104 "unknown one-way method"
4105 }
4106 ProfileRequest::_UnknownMethod { method_type: fidl::MethodType::TwoWay, .. } => {
4107 "unknown two-way method"
4108 }
4109 }
4110 }
4111}
4112
4113#[derive(Debug, Clone)]
4114pub struct ProfileControlHandle {
4115 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
4116}
4117
4118impl fidl::endpoints::ControlHandle for ProfileControlHandle {
4119 fn shutdown(&self) {
4120 self.inner.shutdown()
4121 }
4122 fn shutdown_with_epitaph(&self, status: zx_status::Status) {
4123 self.inner.shutdown_with_epitaph(status)
4124 }
4125
4126 fn is_closed(&self) -> bool {
4127 self.inner.channel().is_closed()
4128 }
4129 fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
4130 self.inner.channel().on_closed()
4131 }
4132
4133 #[cfg(target_os = "fuchsia")]
4134 fn signal_peer(
4135 &self,
4136 clear_mask: zx::Signals,
4137 set_mask: zx::Signals,
4138 ) -> Result<(), zx_status::Status> {
4139 use fidl::Peered;
4140 self.inner.channel().signal_peer(clear_mask, set_mask)
4141 }
4142}
4143
4144impl ProfileControlHandle {}
4145
4146#[must_use = "FIDL methods require a response to be sent"]
4147#[derive(Debug)]
4148pub struct ProfileAdvertiseResponder {
4149 control_handle: std::mem::ManuallyDrop<ProfileControlHandle>,
4150 tx_id: u32,
4151}
4152
4153impl std::ops::Drop for ProfileAdvertiseResponder {
4157 fn drop(&mut self) {
4158 self.control_handle.shutdown();
4159 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
4161 }
4162}
4163
4164impl fidl::endpoints::Responder for ProfileAdvertiseResponder {
4165 type ControlHandle = ProfileControlHandle;
4166
4167 fn control_handle(&self) -> &ProfileControlHandle {
4168 &self.control_handle
4169 }
4170
4171 fn drop_without_shutdown(mut self) {
4172 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
4174 std::mem::forget(self);
4176 }
4177}
4178
4179impl ProfileAdvertiseResponder {
4180 pub fn send(
4184 self,
4185 mut result: Result<&ProfileAdvertiseResponse, fidl_fuchsia_bluetooth::ErrorCode>,
4186 ) -> Result<(), fidl::Error> {
4187 let _result = self.send_raw(result);
4188 if _result.is_err() {
4189 self.control_handle.shutdown();
4190 }
4191 self.drop_without_shutdown();
4192 _result
4193 }
4194
4195 pub fn send_no_shutdown_on_err(
4197 self,
4198 mut result: Result<&ProfileAdvertiseResponse, fidl_fuchsia_bluetooth::ErrorCode>,
4199 ) -> Result<(), fidl::Error> {
4200 let _result = self.send_raw(result);
4201 self.drop_without_shutdown();
4202 _result
4203 }
4204
4205 fn send_raw(
4206 &self,
4207 mut result: Result<&ProfileAdvertiseResponse, fidl_fuchsia_bluetooth::ErrorCode>,
4208 ) -> Result<(), fidl::Error> {
4209 self.control_handle.inner.send::<fidl::encoding::FlexibleResultType<
4210 ProfileAdvertiseResponse,
4211 fidl_fuchsia_bluetooth::ErrorCode,
4212 >>(
4213 fidl::encoding::FlexibleResult::new(result),
4214 self.tx_id,
4215 0x65e429c1f0205a0e,
4216 fidl::encoding::DynamicFlags::FLEXIBLE,
4217 )
4218 }
4219}
4220
4221#[must_use = "FIDL methods require a response to be sent"]
4222#[derive(Debug)]
4223pub struct ProfileConnectResponder {
4224 control_handle: std::mem::ManuallyDrop<ProfileControlHandle>,
4225 tx_id: u32,
4226}
4227
4228impl std::ops::Drop for ProfileConnectResponder {
4232 fn drop(&mut self) {
4233 self.control_handle.shutdown();
4234 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
4236 }
4237}
4238
4239impl fidl::endpoints::Responder for ProfileConnectResponder {
4240 type ControlHandle = ProfileControlHandle;
4241
4242 fn control_handle(&self) -> &ProfileControlHandle {
4243 &self.control_handle
4244 }
4245
4246 fn drop_without_shutdown(mut self) {
4247 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
4249 std::mem::forget(self);
4251 }
4252}
4253
4254impl ProfileConnectResponder {
4255 pub fn send(
4259 self,
4260 mut result: Result<Channel, fidl_fuchsia_bluetooth::ErrorCode>,
4261 ) -> Result<(), fidl::Error> {
4262 let _result = self.send_raw(result);
4263 if _result.is_err() {
4264 self.control_handle.shutdown();
4265 }
4266 self.drop_without_shutdown();
4267 _result
4268 }
4269
4270 pub fn send_no_shutdown_on_err(
4272 self,
4273 mut result: Result<Channel, fidl_fuchsia_bluetooth::ErrorCode>,
4274 ) -> Result<(), fidl::Error> {
4275 let _result = self.send_raw(result);
4276 self.drop_without_shutdown();
4277 _result
4278 }
4279
4280 fn send_raw(
4281 &self,
4282 mut result: Result<Channel, fidl_fuchsia_bluetooth::ErrorCode>,
4283 ) -> Result<(), fidl::Error> {
4284 self.control_handle.inner.send::<fidl::encoding::FlexibleResultType<
4285 ProfileConnectResponse,
4286 fidl_fuchsia_bluetooth::ErrorCode,
4287 >>(
4288 fidl::encoding::FlexibleResult::new(
4289 result.as_mut().map_err(|e| *e).map(|channel| (channel,)),
4290 ),
4291 self.tx_id,
4292 0xaaeefc898901fb3,
4293 fidl::encoding::DynamicFlags::FLEXIBLE,
4294 )
4295 }
4296}
4297
4298#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
4299pub struct ScoConnectionMarker;
4300
4301impl fidl::endpoints::ProtocolMarker for ScoConnectionMarker {
4302 type Proxy = ScoConnectionProxy;
4303 type RequestStream = ScoConnectionRequestStream;
4304 #[cfg(target_os = "fuchsia")]
4305 type SynchronousProxy = ScoConnectionSynchronousProxy;
4306
4307 const DEBUG_NAME: &'static str = "(anonymous) ScoConnection";
4308}
4309
4310pub trait ScoConnectionProxyInterface: Send + Sync {
4311 type ReadResponseFut: std::future::Future<Output = Result<ScoConnectionReadResponse, fidl::Error>>
4312 + Send;
4313 fn r#read(&self) -> Self::ReadResponseFut;
4314 type WriteResponseFut: std::future::Future<Output = Result<(), fidl::Error>> + Send;
4315 fn r#write(&self, payload: &ScoConnectionWriteRequest) -> Self::WriteResponseFut;
4316 fn r#request_disconnect(&self) -> Result<(), fidl::Error>;
4317}
4318#[derive(Debug)]
4319#[cfg(target_os = "fuchsia")]
4320pub struct ScoConnectionSynchronousProxy {
4321 client: fidl::client::sync::Client,
4322}
4323
4324#[cfg(target_os = "fuchsia")]
4325impl fidl::endpoints::SynchronousProxy for ScoConnectionSynchronousProxy {
4326 type Proxy = ScoConnectionProxy;
4327 type Protocol = ScoConnectionMarker;
4328
4329 fn from_channel(inner: fidl::Channel) -> Self {
4330 Self::new(inner)
4331 }
4332
4333 fn into_channel(self) -> fidl::Channel {
4334 self.client.into_channel()
4335 }
4336
4337 fn as_channel(&self) -> &fidl::Channel {
4338 self.client.as_channel()
4339 }
4340}
4341
4342#[cfg(target_os = "fuchsia")]
4343impl ScoConnectionSynchronousProxy {
4344 pub fn new(channel: fidl::Channel) -> Self {
4345 let protocol_name = <ScoConnectionMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
4346 Self { client: fidl::client::sync::Client::new(channel, protocol_name) }
4347 }
4348
4349 pub fn into_channel(self) -> fidl::Channel {
4350 self.client.into_channel()
4351 }
4352
4353 pub fn wait_for_event(
4356 &self,
4357 deadline: zx::MonotonicInstant,
4358 ) -> Result<ScoConnectionEvent, fidl::Error> {
4359 ScoConnectionEvent::decode(self.client.wait_for_event(deadline)?)
4360 }
4361
4362 pub fn r#read(
4367 &self,
4368 ___deadline: zx::MonotonicInstant,
4369 ) -> Result<ScoConnectionReadResponse, fidl::Error> {
4370 let _response = self.client.send_query::<
4371 fidl::encoding::EmptyPayload,
4372 fidl::encoding::FlexibleType<ScoConnectionReadResponse>,
4373 >(
4374 (),
4375 0x6fb29eb1e16ac616,
4376 fidl::encoding::DynamicFlags::FLEXIBLE,
4377 ___deadline,
4378 )?
4379 .into_result::<ScoConnectionMarker>("read")?;
4380 Ok(_response)
4381 }
4382
4383 pub fn r#write(
4388 &self,
4389 mut payload: &ScoConnectionWriteRequest,
4390 ___deadline: zx::MonotonicInstant,
4391 ) -> Result<(), fidl::Error> {
4392 let _response = self.client.send_query::<
4393 ScoConnectionWriteRequest,
4394 fidl::encoding::FlexibleType<fidl::encoding::EmptyStruct>,
4395 >(
4396 payload,
4397 0x394e1b2ff7f4a5a9,
4398 fidl::encoding::DynamicFlags::FLEXIBLE,
4399 ___deadline,
4400 )?
4401 .into_result::<ScoConnectionMarker>("write")?;
4402 Ok(_response)
4403 }
4404
4405 pub fn r#request_disconnect(&self) -> Result<(), fidl::Error> {
4410 self.client.send::<fidl::encoding::EmptyPayload>(
4411 (),
4412 0x1b1613b352ae6a57,
4413 fidl::encoding::DynamicFlags::FLEXIBLE,
4414 )
4415 }
4416}
4417
4418#[cfg(target_os = "fuchsia")]
4419impl From<ScoConnectionSynchronousProxy> for zx::Handle {
4420 fn from(value: ScoConnectionSynchronousProxy) -> Self {
4421 value.into_channel().into()
4422 }
4423}
4424
4425#[cfg(target_os = "fuchsia")]
4426impl From<fidl::Channel> for ScoConnectionSynchronousProxy {
4427 fn from(value: fidl::Channel) -> Self {
4428 Self::new(value)
4429 }
4430}
4431
4432#[cfg(target_os = "fuchsia")]
4433impl fidl::endpoints::FromClient for ScoConnectionSynchronousProxy {
4434 type Protocol = ScoConnectionMarker;
4435
4436 fn from_client(value: fidl::endpoints::ClientEnd<ScoConnectionMarker>) -> Self {
4437 Self::new(value.into_channel())
4438 }
4439}
4440
4441#[derive(Debug, Clone)]
4442pub struct ScoConnectionProxy {
4443 client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
4444}
4445
4446impl fidl::endpoints::Proxy for ScoConnectionProxy {
4447 type Protocol = ScoConnectionMarker;
4448
4449 fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
4450 Self::new(inner)
4451 }
4452
4453 fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
4454 self.client.into_channel().map_err(|client| Self { client })
4455 }
4456
4457 fn as_channel(&self) -> &::fidl::AsyncChannel {
4458 self.client.as_channel()
4459 }
4460}
4461
4462impl ScoConnectionProxy {
4463 pub fn new(channel: ::fidl::AsyncChannel) -> Self {
4465 let protocol_name = <ScoConnectionMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
4466 Self { client: fidl::client::Client::new(channel, protocol_name) }
4467 }
4468
4469 pub fn take_event_stream(&self) -> ScoConnectionEventStream {
4475 ScoConnectionEventStream { event_receiver: self.client.take_event_receiver() }
4476 }
4477
4478 pub fn r#read(
4483 &self,
4484 ) -> fidl::client::QueryResponseFut<
4485 ScoConnectionReadResponse,
4486 fidl::encoding::DefaultFuchsiaResourceDialect,
4487 > {
4488 ScoConnectionProxyInterface::r#read(self)
4489 }
4490
4491 pub fn r#write(
4496 &self,
4497 mut payload: &ScoConnectionWriteRequest,
4498 ) -> fidl::client::QueryResponseFut<(), fidl::encoding::DefaultFuchsiaResourceDialect> {
4499 ScoConnectionProxyInterface::r#write(self, payload)
4500 }
4501
4502 pub fn r#request_disconnect(&self) -> Result<(), fidl::Error> {
4507 ScoConnectionProxyInterface::r#request_disconnect(self)
4508 }
4509}
4510
4511impl ScoConnectionProxyInterface for ScoConnectionProxy {
4512 type ReadResponseFut = fidl::client::QueryResponseFut<
4513 ScoConnectionReadResponse,
4514 fidl::encoding::DefaultFuchsiaResourceDialect,
4515 >;
4516 fn r#read(&self) -> Self::ReadResponseFut {
4517 fn _decode(
4518 mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
4519 ) -> Result<ScoConnectionReadResponse, fidl::Error> {
4520 let _response = fidl::client::decode_transaction_body::<
4521 fidl::encoding::FlexibleType<ScoConnectionReadResponse>,
4522 fidl::encoding::DefaultFuchsiaResourceDialect,
4523 0x6fb29eb1e16ac616,
4524 >(_buf?)?
4525 .into_result::<ScoConnectionMarker>("read")?;
4526 Ok(_response)
4527 }
4528 self.client
4529 .send_query_and_decode::<fidl::encoding::EmptyPayload, ScoConnectionReadResponse>(
4530 (),
4531 0x6fb29eb1e16ac616,
4532 fidl::encoding::DynamicFlags::FLEXIBLE,
4533 _decode,
4534 )
4535 }
4536
4537 type WriteResponseFut =
4538 fidl::client::QueryResponseFut<(), fidl::encoding::DefaultFuchsiaResourceDialect>;
4539 fn r#write(&self, mut payload: &ScoConnectionWriteRequest) -> Self::WriteResponseFut {
4540 fn _decode(
4541 mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
4542 ) -> Result<(), fidl::Error> {
4543 let _response = fidl::client::decode_transaction_body::<
4544 fidl::encoding::FlexibleType<fidl::encoding::EmptyStruct>,
4545 fidl::encoding::DefaultFuchsiaResourceDialect,
4546 0x394e1b2ff7f4a5a9,
4547 >(_buf?)?
4548 .into_result::<ScoConnectionMarker>("write")?;
4549 Ok(_response)
4550 }
4551 self.client.send_query_and_decode::<ScoConnectionWriteRequest, ()>(
4552 payload,
4553 0x394e1b2ff7f4a5a9,
4554 fidl::encoding::DynamicFlags::FLEXIBLE,
4555 _decode,
4556 )
4557 }
4558
4559 fn r#request_disconnect(&self) -> Result<(), fidl::Error> {
4560 self.client.send::<fidl::encoding::EmptyPayload>(
4561 (),
4562 0x1b1613b352ae6a57,
4563 fidl::encoding::DynamicFlags::FLEXIBLE,
4564 )
4565 }
4566}
4567
4568pub struct ScoConnectionEventStream {
4569 event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
4570}
4571
4572impl std::marker::Unpin for ScoConnectionEventStream {}
4573
4574impl futures::stream::FusedStream for ScoConnectionEventStream {
4575 fn is_terminated(&self) -> bool {
4576 self.event_receiver.is_terminated()
4577 }
4578}
4579
4580impl futures::Stream for ScoConnectionEventStream {
4581 type Item = Result<ScoConnectionEvent, fidl::Error>;
4582
4583 fn poll_next(
4584 mut self: std::pin::Pin<&mut Self>,
4585 cx: &mut std::task::Context<'_>,
4586 ) -> std::task::Poll<Option<Self::Item>> {
4587 match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
4588 &mut self.event_receiver,
4589 cx
4590 )?) {
4591 Some(buf) => std::task::Poll::Ready(Some(ScoConnectionEvent::decode(buf))),
4592 None => std::task::Poll::Ready(None),
4593 }
4594 }
4595}
4596
4597#[derive(Debug)]
4598pub enum ScoConnectionEvent {
4599 OnConnectionComplete {
4600 payload: ScoConnectionOnConnectionCompleteRequest,
4601 },
4602 #[non_exhaustive]
4603 _UnknownEvent {
4604 ordinal: u64,
4606 },
4607}
4608
4609impl ScoConnectionEvent {
4610 #[allow(irrefutable_let_patterns)]
4611 pub fn into_on_connection_complete(self) -> Option<ScoConnectionOnConnectionCompleteRequest> {
4612 if let ScoConnectionEvent::OnConnectionComplete { payload } = self {
4613 Some((payload))
4614 } else {
4615 None
4616 }
4617 }
4618
4619 fn decode(
4621 mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
4622 ) -> Result<ScoConnectionEvent, fidl::Error> {
4623 let (bytes, _handles) = buf.split_mut();
4624 let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
4625 debug_assert_eq!(tx_header.tx_id, 0);
4626 match tx_header.ordinal {
4627 0x193aa06408ba384d => {
4628 let mut out = fidl::new_empty!(
4629 ScoConnectionOnConnectionCompleteRequest,
4630 fidl::encoding::DefaultFuchsiaResourceDialect
4631 );
4632 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<ScoConnectionOnConnectionCompleteRequest>(&tx_header, _body_bytes, _handles, &mut out)?;
4633 Ok((ScoConnectionEvent::OnConnectionComplete { payload: out }))
4634 }
4635 _ if tx_header.dynamic_flags().contains(fidl::encoding::DynamicFlags::FLEXIBLE) => {
4636 Ok(ScoConnectionEvent::_UnknownEvent { ordinal: tx_header.ordinal })
4637 }
4638 _ => Err(fidl::Error::UnknownOrdinal {
4639 ordinal: tx_header.ordinal,
4640 protocol_name: <ScoConnectionMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
4641 }),
4642 }
4643 }
4644}
4645
4646pub struct ScoConnectionRequestStream {
4648 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
4649 is_terminated: bool,
4650}
4651
4652impl std::marker::Unpin for ScoConnectionRequestStream {}
4653
4654impl futures::stream::FusedStream for ScoConnectionRequestStream {
4655 fn is_terminated(&self) -> bool {
4656 self.is_terminated
4657 }
4658}
4659
4660impl fidl::endpoints::RequestStream for ScoConnectionRequestStream {
4661 type Protocol = ScoConnectionMarker;
4662 type ControlHandle = ScoConnectionControlHandle;
4663
4664 fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
4665 Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
4666 }
4667
4668 fn control_handle(&self) -> Self::ControlHandle {
4669 ScoConnectionControlHandle { inner: self.inner.clone() }
4670 }
4671
4672 fn into_inner(
4673 self,
4674 ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
4675 {
4676 (self.inner, self.is_terminated)
4677 }
4678
4679 fn from_inner(
4680 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
4681 is_terminated: bool,
4682 ) -> Self {
4683 Self { inner, is_terminated }
4684 }
4685}
4686
4687impl futures::Stream for ScoConnectionRequestStream {
4688 type Item = Result<ScoConnectionRequest, fidl::Error>;
4689
4690 fn poll_next(
4691 mut self: std::pin::Pin<&mut Self>,
4692 cx: &mut std::task::Context<'_>,
4693 ) -> std::task::Poll<Option<Self::Item>> {
4694 let this = &mut *self;
4695 if this.inner.check_shutdown(cx) {
4696 this.is_terminated = true;
4697 return std::task::Poll::Ready(None);
4698 }
4699 if this.is_terminated {
4700 panic!("polled ScoConnectionRequestStream after completion");
4701 }
4702 fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
4703 |bytes, handles| {
4704 match this.inner.channel().read_etc(cx, bytes, handles) {
4705 std::task::Poll::Ready(Ok(())) => {}
4706 std::task::Poll::Pending => return std::task::Poll::Pending,
4707 std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
4708 this.is_terminated = true;
4709 return std::task::Poll::Ready(None);
4710 }
4711 std::task::Poll::Ready(Err(e)) => {
4712 return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
4713 e.into(),
4714 ))));
4715 }
4716 }
4717
4718 let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
4720
4721 std::task::Poll::Ready(Some(match header.ordinal {
4722 0x6fb29eb1e16ac616 => {
4723 header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
4724 let mut req = fidl::new_empty!(
4725 fidl::encoding::EmptyPayload,
4726 fidl::encoding::DefaultFuchsiaResourceDialect
4727 );
4728 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
4729 let control_handle =
4730 ScoConnectionControlHandle { inner: this.inner.clone() };
4731 Ok(ScoConnectionRequest::Read {
4732 responder: ScoConnectionReadResponder {
4733 control_handle: std::mem::ManuallyDrop::new(control_handle),
4734 tx_id: header.tx_id,
4735 },
4736 })
4737 }
4738 0x394e1b2ff7f4a5a9 => {
4739 header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
4740 let mut req = fidl::new_empty!(
4741 ScoConnectionWriteRequest,
4742 fidl::encoding::DefaultFuchsiaResourceDialect
4743 );
4744 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<ScoConnectionWriteRequest>(&header, _body_bytes, handles, &mut req)?;
4745 let control_handle =
4746 ScoConnectionControlHandle { inner: this.inner.clone() };
4747 Ok(ScoConnectionRequest::Write {
4748 payload: req,
4749 responder: ScoConnectionWriteResponder {
4750 control_handle: std::mem::ManuallyDrop::new(control_handle),
4751 tx_id: header.tx_id,
4752 },
4753 })
4754 }
4755 0x1b1613b352ae6a57 => {
4756 header.validate_request_tx_id(fidl::MethodType::OneWay)?;
4757 let mut req = fidl::new_empty!(
4758 fidl::encoding::EmptyPayload,
4759 fidl::encoding::DefaultFuchsiaResourceDialect
4760 );
4761 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
4762 let control_handle =
4763 ScoConnectionControlHandle { inner: this.inner.clone() };
4764 Ok(ScoConnectionRequest::RequestDisconnect { control_handle })
4765 }
4766 _ if header.tx_id == 0
4767 && header
4768 .dynamic_flags()
4769 .contains(fidl::encoding::DynamicFlags::FLEXIBLE) =>
4770 {
4771 Ok(ScoConnectionRequest::_UnknownMethod {
4772 ordinal: header.ordinal,
4773 control_handle: ScoConnectionControlHandle {
4774 inner: this.inner.clone(),
4775 },
4776 method_type: fidl::MethodType::OneWay,
4777 })
4778 }
4779 _ if header
4780 .dynamic_flags()
4781 .contains(fidl::encoding::DynamicFlags::FLEXIBLE) =>
4782 {
4783 this.inner.send_framework_err(
4784 fidl::encoding::FrameworkErr::UnknownMethod,
4785 header.tx_id,
4786 header.ordinal,
4787 header.dynamic_flags(),
4788 (bytes, handles),
4789 )?;
4790 Ok(ScoConnectionRequest::_UnknownMethod {
4791 ordinal: header.ordinal,
4792 control_handle: ScoConnectionControlHandle {
4793 inner: this.inner.clone(),
4794 },
4795 method_type: fidl::MethodType::TwoWay,
4796 })
4797 }
4798 _ => Err(fidl::Error::UnknownOrdinal {
4799 ordinal: header.ordinal,
4800 protocol_name:
4801 <ScoConnectionMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
4802 }),
4803 }))
4804 },
4805 )
4806 }
4807}
4808
4809#[derive(Debug)]
4814pub enum ScoConnectionRequest {
4815 Read { responder: ScoConnectionReadResponder },
4820 Write { payload: ScoConnectionWriteRequest, responder: ScoConnectionWriteResponder },
4825 RequestDisconnect { control_handle: ScoConnectionControlHandle },
4830 #[non_exhaustive]
4832 _UnknownMethod {
4833 ordinal: u64,
4835 control_handle: ScoConnectionControlHandle,
4836 method_type: fidl::MethodType,
4837 },
4838}
4839
4840impl ScoConnectionRequest {
4841 #[allow(irrefutable_let_patterns)]
4842 pub fn into_read(self) -> Option<(ScoConnectionReadResponder)> {
4843 if let ScoConnectionRequest::Read { responder } = self { Some((responder)) } else { None }
4844 }
4845
4846 #[allow(irrefutable_let_patterns)]
4847 pub fn into_write(self) -> Option<(ScoConnectionWriteRequest, ScoConnectionWriteResponder)> {
4848 if let ScoConnectionRequest::Write { payload, responder } = self {
4849 Some((payload, responder))
4850 } else {
4851 None
4852 }
4853 }
4854
4855 #[allow(irrefutable_let_patterns)]
4856 pub fn into_request_disconnect(self) -> Option<(ScoConnectionControlHandle)> {
4857 if let ScoConnectionRequest::RequestDisconnect { control_handle } = self {
4858 Some((control_handle))
4859 } else {
4860 None
4861 }
4862 }
4863
4864 pub fn method_name(&self) -> &'static str {
4866 match *self {
4867 ScoConnectionRequest::Read { .. } => "read",
4868 ScoConnectionRequest::Write { .. } => "write",
4869 ScoConnectionRequest::RequestDisconnect { .. } => "request_disconnect",
4870 ScoConnectionRequest::_UnknownMethod {
4871 method_type: fidl::MethodType::OneWay, ..
4872 } => "unknown one-way method",
4873 ScoConnectionRequest::_UnknownMethod {
4874 method_type: fidl::MethodType::TwoWay, ..
4875 } => "unknown two-way method",
4876 }
4877 }
4878}
4879
4880#[derive(Debug, Clone)]
4881pub struct ScoConnectionControlHandle {
4882 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
4883}
4884
4885impl fidl::endpoints::ControlHandle for ScoConnectionControlHandle {
4886 fn shutdown(&self) {
4887 self.inner.shutdown()
4888 }
4889 fn shutdown_with_epitaph(&self, status: zx_status::Status) {
4890 self.inner.shutdown_with_epitaph(status)
4891 }
4892
4893 fn is_closed(&self) -> bool {
4894 self.inner.channel().is_closed()
4895 }
4896 fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
4897 self.inner.channel().on_closed()
4898 }
4899
4900 #[cfg(target_os = "fuchsia")]
4901 fn signal_peer(
4902 &self,
4903 clear_mask: zx::Signals,
4904 set_mask: zx::Signals,
4905 ) -> Result<(), zx_status::Status> {
4906 use fidl::Peered;
4907 self.inner.channel().signal_peer(clear_mask, set_mask)
4908 }
4909}
4910
4911impl ScoConnectionControlHandle {
4912 pub fn send_on_connection_complete(
4913 &self,
4914 mut payload: &ScoConnectionOnConnectionCompleteRequest,
4915 ) -> Result<(), fidl::Error> {
4916 self.inner.send::<ScoConnectionOnConnectionCompleteRequest>(
4917 payload,
4918 0,
4919 0x193aa06408ba384d,
4920 fidl::encoding::DynamicFlags::FLEXIBLE,
4921 )
4922 }
4923}
4924
4925#[must_use = "FIDL methods require a response to be sent"]
4926#[derive(Debug)]
4927pub struct ScoConnectionReadResponder {
4928 control_handle: std::mem::ManuallyDrop<ScoConnectionControlHandle>,
4929 tx_id: u32,
4930}
4931
4932impl std::ops::Drop for ScoConnectionReadResponder {
4936 fn drop(&mut self) {
4937 self.control_handle.shutdown();
4938 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
4940 }
4941}
4942
4943impl fidl::endpoints::Responder for ScoConnectionReadResponder {
4944 type ControlHandle = ScoConnectionControlHandle;
4945
4946 fn control_handle(&self) -> &ScoConnectionControlHandle {
4947 &self.control_handle
4948 }
4949
4950 fn drop_without_shutdown(mut self) {
4951 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
4953 std::mem::forget(self);
4955 }
4956}
4957
4958impl ScoConnectionReadResponder {
4959 pub fn send(self, mut payload: &ScoConnectionReadResponse) -> Result<(), fidl::Error> {
4963 let _result = self.send_raw(payload);
4964 if _result.is_err() {
4965 self.control_handle.shutdown();
4966 }
4967 self.drop_without_shutdown();
4968 _result
4969 }
4970
4971 pub fn send_no_shutdown_on_err(
4973 self,
4974 mut payload: &ScoConnectionReadResponse,
4975 ) -> Result<(), fidl::Error> {
4976 let _result = self.send_raw(payload);
4977 self.drop_without_shutdown();
4978 _result
4979 }
4980
4981 fn send_raw(&self, mut payload: &ScoConnectionReadResponse) -> Result<(), fidl::Error> {
4982 self.control_handle.inner.send::<fidl::encoding::FlexibleType<ScoConnectionReadResponse>>(
4983 fidl::encoding::Flexible::new(payload),
4984 self.tx_id,
4985 0x6fb29eb1e16ac616,
4986 fidl::encoding::DynamicFlags::FLEXIBLE,
4987 )
4988 }
4989}
4990
4991#[must_use = "FIDL methods require a response to be sent"]
4992#[derive(Debug)]
4993pub struct ScoConnectionWriteResponder {
4994 control_handle: std::mem::ManuallyDrop<ScoConnectionControlHandle>,
4995 tx_id: u32,
4996}
4997
4998impl std::ops::Drop for ScoConnectionWriteResponder {
5002 fn drop(&mut self) {
5003 self.control_handle.shutdown();
5004 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
5006 }
5007}
5008
5009impl fidl::endpoints::Responder for ScoConnectionWriteResponder {
5010 type ControlHandle = ScoConnectionControlHandle;
5011
5012 fn control_handle(&self) -> &ScoConnectionControlHandle {
5013 &self.control_handle
5014 }
5015
5016 fn drop_without_shutdown(mut self) {
5017 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
5019 std::mem::forget(self);
5021 }
5022}
5023
5024impl ScoConnectionWriteResponder {
5025 pub fn send(self) -> Result<(), fidl::Error> {
5029 let _result = self.send_raw();
5030 if _result.is_err() {
5031 self.control_handle.shutdown();
5032 }
5033 self.drop_without_shutdown();
5034 _result
5035 }
5036
5037 pub fn send_no_shutdown_on_err(self) -> Result<(), fidl::Error> {
5039 let _result = self.send_raw();
5040 self.drop_without_shutdown();
5041 _result
5042 }
5043
5044 fn send_raw(&self) -> Result<(), fidl::Error> {
5045 self.control_handle.inner.send::<fidl::encoding::FlexibleType<fidl::encoding::EmptyStruct>>(
5046 fidl::encoding::Flexible::new(()),
5047 self.tx_id,
5048 0x394e1b2ff7f4a5a9,
5049 fidl::encoding::DynamicFlags::FLEXIBLE,
5050 )
5051 }
5052}
5053
5054#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
5055pub struct SearchResultsMarker;
5056
5057impl fidl::endpoints::ProtocolMarker for SearchResultsMarker {
5058 type Proxy = SearchResultsProxy;
5059 type RequestStream = SearchResultsRequestStream;
5060 #[cfg(target_os = "fuchsia")]
5061 type SynchronousProxy = SearchResultsSynchronousProxy;
5062
5063 const DEBUG_NAME: &'static str = "(anonymous) SearchResults";
5064}
5065
5066pub trait SearchResultsProxyInterface: Send + Sync {
5067 type ServiceFoundResponseFut: std::future::Future<Output = Result<(), fidl::Error>> + Send;
5068 fn r#service_found(
5069 &self,
5070 peer_id: &fidl_fuchsia_bluetooth::PeerId,
5071 protocol: Option<&[ProtocolDescriptor]>,
5072 attributes: &[Attribute],
5073 ) -> Self::ServiceFoundResponseFut;
5074}
5075#[derive(Debug)]
5076#[cfg(target_os = "fuchsia")]
5077pub struct SearchResultsSynchronousProxy {
5078 client: fidl::client::sync::Client,
5079}
5080
5081#[cfg(target_os = "fuchsia")]
5082impl fidl::endpoints::SynchronousProxy for SearchResultsSynchronousProxy {
5083 type Proxy = SearchResultsProxy;
5084 type Protocol = SearchResultsMarker;
5085
5086 fn from_channel(inner: fidl::Channel) -> Self {
5087 Self::new(inner)
5088 }
5089
5090 fn into_channel(self) -> fidl::Channel {
5091 self.client.into_channel()
5092 }
5093
5094 fn as_channel(&self) -> &fidl::Channel {
5095 self.client.as_channel()
5096 }
5097}
5098
5099#[cfg(target_os = "fuchsia")]
5100impl SearchResultsSynchronousProxy {
5101 pub fn new(channel: fidl::Channel) -> Self {
5102 let protocol_name = <SearchResultsMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
5103 Self { client: fidl::client::sync::Client::new(channel, protocol_name) }
5104 }
5105
5106 pub fn into_channel(self) -> fidl::Channel {
5107 self.client.into_channel()
5108 }
5109
5110 pub fn wait_for_event(
5113 &self,
5114 deadline: zx::MonotonicInstant,
5115 ) -> Result<SearchResultsEvent, fidl::Error> {
5116 SearchResultsEvent::decode(self.client.wait_for_event(deadline)?)
5117 }
5118
5119 pub fn r#service_found(
5129 &self,
5130 mut peer_id: &fidl_fuchsia_bluetooth::PeerId,
5131 mut protocol: Option<&[ProtocolDescriptor]>,
5132 mut attributes: &[Attribute],
5133 ___deadline: zx::MonotonicInstant,
5134 ) -> Result<(), fidl::Error> {
5135 let _response = self.client.send_query::<
5136 SearchResultsServiceFoundRequest,
5137 fidl::encoding::FlexibleType<fidl::encoding::EmptyStruct>,
5138 >(
5139 (peer_id, protocol, attributes,),
5140 0x526509a842ebd43c,
5141 fidl::encoding::DynamicFlags::FLEXIBLE,
5142 ___deadline,
5143 )?
5144 .into_result::<SearchResultsMarker>("service_found")?;
5145 Ok(_response)
5146 }
5147}
5148
5149#[cfg(target_os = "fuchsia")]
5150impl From<SearchResultsSynchronousProxy> for zx::Handle {
5151 fn from(value: SearchResultsSynchronousProxy) -> Self {
5152 value.into_channel().into()
5153 }
5154}
5155
5156#[cfg(target_os = "fuchsia")]
5157impl From<fidl::Channel> for SearchResultsSynchronousProxy {
5158 fn from(value: fidl::Channel) -> Self {
5159 Self::new(value)
5160 }
5161}
5162
5163#[cfg(target_os = "fuchsia")]
5164impl fidl::endpoints::FromClient for SearchResultsSynchronousProxy {
5165 type Protocol = SearchResultsMarker;
5166
5167 fn from_client(value: fidl::endpoints::ClientEnd<SearchResultsMarker>) -> Self {
5168 Self::new(value.into_channel())
5169 }
5170}
5171
5172#[derive(Debug, Clone)]
5173pub struct SearchResultsProxy {
5174 client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
5175}
5176
5177impl fidl::endpoints::Proxy for SearchResultsProxy {
5178 type Protocol = SearchResultsMarker;
5179
5180 fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
5181 Self::new(inner)
5182 }
5183
5184 fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
5185 self.client.into_channel().map_err(|client| Self { client })
5186 }
5187
5188 fn as_channel(&self) -> &::fidl::AsyncChannel {
5189 self.client.as_channel()
5190 }
5191}
5192
5193impl SearchResultsProxy {
5194 pub fn new(channel: ::fidl::AsyncChannel) -> Self {
5196 let protocol_name = <SearchResultsMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
5197 Self { client: fidl::client::Client::new(channel, protocol_name) }
5198 }
5199
5200 pub fn take_event_stream(&self) -> SearchResultsEventStream {
5206 SearchResultsEventStream { event_receiver: self.client.take_event_receiver() }
5207 }
5208
5209 pub fn r#service_found(
5219 &self,
5220 mut peer_id: &fidl_fuchsia_bluetooth::PeerId,
5221 mut protocol: Option<&[ProtocolDescriptor]>,
5222 mut attributes: &[Attribute],
5223 ) -> fidl::client::QueryResponseFut<(), fidl::encoding::DefaultFuchsiaResourceDialect> {
5224 SearchResultsProxyInterface::r#service_found(self, peer_id, protocol, attributes)
5225 }
5226}
5227
5228impl SearchResultsProxyInterface for SearchResultsProxy {
5229 type ServiceFoundResponseFut =
5230 fidl::client::QueryResponseFut<(), fidl::encoding::DefaultFuchsiaResourceDialect>;
5231 fn r#service_found(
5232 &self,
5233 mut peer_id: &fidl_fuchsia_bluetooth::PeerId,
5234 mut protocol: Option<&[ProtocolDescriptor]>,
5235 mut attributes: &[Attribute],
5236 ) -> Self::ServiceFoundResponseFut {
5237 fn _decode(
5238 mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
5239 ) -> Result<(), fidl::Error> {
5240 let _response = fidl::client::decode_transaction_body::<
5241 fidl::encoding::FlexibleType<fidl::encoding::EmptyStruct>,
5242 fidl::encoding::DefaultFuchsiaResourceDialect,
5243 0x526509a842ebd43c,
5244 >(_buf?)?
5245 .into_result::<SearchResultsMarker>("service_found")?;
5246 Ok(_response)
5247 }
5248 self.client.send_query_and_decode::<SearchResultsServiceFoundRequest, ()>(
5249 (peer_id, protocol, attributes),
5250 0x526509a842ebd43c,
5251 fidl::encoding::DynamicFlags::FLEXIBLE,
5252 _decode,
5253 )
5254 }
5255}
5256
5257pub struct SearchResultsEventStream {
5258 event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
5259}
5260
5261impl std::marker::Unpin for SearchResultsEventStream {}
5262
5263impl futures::stream::FusedStream for SearchResultsEventStream {
5264 fn is_terminated(&self) -> bool {
5265 self.event_receiver.is_terminated()
5266 }
5267}
5268
5269impl futures::Stream for SearchResultsEventStream {
5270 type Item = Result<SearchResultsEvent, fidl::Error>;
5271
5272 fn poll_next(
5273 mut self: std::pin::Pin<&mut Self>,
5274 cx: &mut std::task::Context<'_>,
5275 ) -> std::task::Poll<Option<Self::Item>> {
5276 match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
5277 &mut self.event_receiver,
5278 cx
5279 )?) {
5280 Some(buf) => std::task::Poll::Ready(Some(SearchResultsEvent::decode(buf))),
5281 None => std::task::Poll::Ready(None),
5282 }
5283 }
5284}
5285
5286#[derive(Debug)]
5287pub enum SearchResultsEvent {
5288 #[non_exhaustive]
5289 _UnknownEvent {
5290 ordinal: u64,
5292 },
5293}
5294
5295impl SearchResultsEvent {
5296 fn decode(
5298 mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
5299 ) -> Result<SearchResultsEvent, fidl::Error> {
5300 let (bytes, _handles) = buf.split_mut();
5301 let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
5302 debug_assert_eq!(tx_header.tx_id, 0);
5303 match tx_header.ordinal {
5304 _ if tx_header.dynamic_flags().contains(fidl::encoding::DynamicFlags::FLEXIBLE) => {
5305 Ok(SearchResultsEvent::_UnknownEvent { ordinal: tx_header.ordinal })
5306 }
5307 _ => Err(fidl::Error::UnknownOrdinal {
5308 ordinal: tx_header.ordinal,
5309 protocol_name: <SearchResultsMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
5310 }),
5311 }
5312 }
5313}
5314
5315pub struct SearchResultsRequestStream {
5317 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
5318 is_terminated: bool,
5319}
5320
5321impl std::marker::Unpin for SearchResultsRequestStream {}
5322
5323impl futures::stream::FusedStream for SearchResultsRequestStream {
5324 fn is_terminated(&self) -> bool {
5325 self.is_terminated
5326 }
5327}
5328
5329impl fidl::endpoints::RequestStream for SearchResultsRequestStream {
5330 type Protocol = SearchResultsMarker;
5331 type ControlHandle = SearchResultsControlHandle;
5332
5333 fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
5334 Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
5335 }
5336
5337 fn control_handle(&self) -> Self::ControlHandle {
5338 SearchResultsControlHandle { inner: self.inner.clone() }
5339 }
5340
5341 fn into_inner(
5342 self,
5343 ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
5344 {
5345 (self.inner, self.is_terminated)
5346 }
5347
5348 fn from_inner(
5349 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
5350 is_terminated: bool,
5351 ) -> Self {
5352 Self { inner, is_terminated }
5353 }
5354}
5355
5356impl futures::Stream for SearchResultsRequestStream {
5357 type Item = Result<SearchResultsRequest, fidl::Error>;
5358
5359 fn poll_next(
5360 mut self: std::pin::Pin<&mut Self>,
5361 cx: &mut std::task::Context<'_>,
5362 ) -> std::task::Poll<Option<Self::Item>> {
5363 let this = &mut *self;
5364 if this.inner.check_shutdown(cx) {
5365 this.is_terminated = true;
5366 return std::task::Poll::Ready(None);
5367 }
5368 if this.is_terminated {
5369 panic!("polled SearchResultsRequestStream after completion");
5370 }
5371 fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
5372 |bytes, handles| {
5373 match this.inner.channel().read_etc(cx, bytes, handles) {
5374 std::task::Poll::Ready(Ok(())) => {}
5375 std::task::Poll::Pending => return std::task::Poll::Pending,
5376 std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
5377 this.is_terminated = true;
5378 return std::task::Poll::Ready(None);
5379 }
5380 std::task::Poll::Ready(Err(e)) => {
5381 return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
5382 e.into(),
5383 ))));
5384 }
5385 }
5386
5387 let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
5389
5390 std::task::Poll::Ready(Some(match header.ordinal {
5391 0x526509a842ebd43c => {
5392 header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
5393 let mut req = fidl::new_empty!(
5394 SearchResultsServiceFoundRequest,
5395 fidl::encoding::DefaultFuchsiaResourceDialect
5396 );
5397 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<SearchResultsServiceFoundRequest>(&header, _body_bytes, handles, &mut req)?;
5398 let control_handle =
5399 SearchResultsControlHandle { inner: this.inner.clone() };
5400 Ok(SearchResultsRequest::ServiceFound {
5401 peer_id: req.peer_id,
5402 protocol: req.protocol,
5403 attributes: req.attributes,
5404
5405 responder: SearchResultsServiceFoundResponder {
5406 control_handle: std::mem::ManuallyDrop::new(control_handle),
5407 tx_id: header.tx_id,
5408 },
5409 })
5410 }
5411 _ if header.tx_id == 0
5412 && header
5413 .dynamic_flags()
5414 .contains(fidl::encoding::DynamicFlags::FLEXIBLE) =>
5415 {
5416 Ok(SearchResultsRequest::_UnknownMethod {
5417 ordinal: header.ordinal,
5418 control_handle: SearchResultsControlHandle {
5419 inner: this.inner.clone(),
5420 },
5421 method_type: fidl::MethodType::OneWay,
5422 })
5423 }
5424 _ if header
5425 .dynamic_flags()
5426 .contains(fidl::encoding::DynamicFlags::FLEXIBLE) =>
5427 {
5428 this.inner.send_framework_err(
5429 fidl::encoding::FrameworkErr::UnknownMethod,
5430 header.tx_id,
5431 header.ordinal,
5432 header.dynamic_flags(),
5433 (bytes, handles),
5434 )?;
5435 Ok(SearchResultsRequest::_UnknownMethod {
5436 ordinal: header.ordinal,
5437 control_handle: SearchResultsControlHandle {
5438 inner: this.inner.clone(),
5439 },
5440 method_type: fidl::MethodType::TwoWay,
5441 })
5442 }
5443 _ => Err(fidl::Error::UnknownOrdinal {
5444 ordinal: header.ordinal,
5445 protocol_name:
5446 <SearchResultsMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
5447 }),
5448 }))
5449 },
5450 )
5451 }
5452}
5453
5454#[derive(Debug)]
5457pub enum SearchResultsRequest {
5458 ServiceFound {
5468 peer_id: fidl_fuchsia_bluetooth::PeerId,
5469 protocol: Option<Vec<ProtocolDescriptor>>,
5470 attributes: Vec<Attribute>,
5471 responder: SearchResultsServiceFoundResponder,
5472 },
5473 #[non_exhaustive]
5475 _UnknownMethod {
5476 ordinal: u64,
5478 control_handle: SearchResultsControlHandle,
5479 method_type: fidl::MethodType,
5480 },
5481}
5482
5483impl SearchResultsRequest {
5484 #[allow(irrefutable_let_patterns)]
5485 pub fn into_service_found(
5486 self,
5487 ) -> Option<(
5488 fidl_fuchsia_bluetooth::PeerId,
5489 Option<Vec<ProtocolDescriptor>>,
5490 Vec<Attribute>,
5491 SearchResultsServiceFoundResponder,
5492 )> {
5493 if let SearchResultsRequest::ServiceFound { peer_id, protocol, attributes, responder } =
5494 self
5495 {
5496 Some((peer_id, protocol, attributes, responder))
5497 } else {
5498 None
5499 }
5500 }
5501
5502 pub fn method_name(&self) -> &'static str {
5504 match *self {
5505 SearchResultsRequest::ServiceFound { .. } => "service_found",
5506 SearchResultsRequest::_UnknownMethod {
5507 method_type: fidl::MethodType::OneWay, ..
5508 } => "unknown one-way method",
5509 SearchResultsRequest::_UnknownMethod {
5510 method_type: fidl::MethodType::TwoWay, ..
5511 } => "unknown two-way method",
5512 }
5513 }
5514}
5515
5516#[derive(Debug, Clone)]
5517pub struct SearchResultsControlHandle {
5518 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
5519}
5520
5521impl fidl::endpoints::ControlHandle for SearchResultsControlHandle {
5522 fn shutdown(&self) {
5523 self.inner.shutdown()
5524 }
5525 fn shutdown_with_epitaph(&self, status: zx_status::Status) {
5526 self.inner.shutdown_with_epitaph(status)
5527 }
5528
5529 fn is_closed(&self) -> bool {
5530 self.inner.channel().is_closed()
5531 }
5532 fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
5533 self.inner.channel().on_closed()
5534 }
5535
5536 #[cfg(target_os = "fuchsia")]
5537 fn signal_peer(
5538 &self,
5539 clear_mask: zx::Signals,
5540 set_mask: zx::Signals,
5541 ) -> Result<(), zx_status::Status> {
5542 use fidl::Peered;
5543 self.inner.channel().signal_peer(clear_mask, set_mask)
5544 }
5545}
5546
5547impl SearchResultsControlHandle {}
5548
5549#[must_use = "FIDL methods require a response to be sent"]
5550#[derive(Debug)]
5551pub struct SearchResultsServiceFoundResponder {
5552 control_handle: std::mem::ManuallyDrop<SearchResultsControlHandle>,
5553 tx_id: u32,
5554}
5555
5556impl std::ops::Drop for SearchResultsServiceFoundResponder {
5560 fn drop(&mut self) {
5561 self.control_handle.shutdown();
5562 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
5564 }
5565}
5566
5567impl fidl::endpoints::Responder for SearchResultsServiceFoundResponder {
5568 type ControlHandle = SearchResultsControlHandle;
5569
5570 fn control_handle(&self) -> &SearchResultsControlHandle {
5571 &self.control_handle
5572 }
5573
5574 fn drop_without_shutdown(mut self) {
5575 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
5577 std::mem::forget(self);
5579 }
5580}
5581
5582impl SearchResultsServiceFoundResponder {
5583 pub fn send(self) -> Result<(), fidl::Error> {
5587 let _result = self.send_raw();
5588 if _result.is_err() {
5589 self.control_handle.shutdown();
5590 }
5591 self.drop_without_shutdown();
5592 _result
5593 }
5594
5595 pub fn send_no_shutdown_on_err(self) -> Result<(), fidl::Error> {
5597 let _result = self.send_raw();
5598 self.drop_without_shutdown();
5599 _result
5600 }
5601
5602 fn send_raw(&self) -> Result<(), fidl::Error> {
5603 self.control_handle.inner.send::<fidl::encoding::FlexibleType<fidl::encoding::EmptyStruct>>(
5604 fidl::encoding::Flexible::new(()),
5605 self.tx_id,
5606 0x526509a842ebd43c,
5607 fidl::encoding::DynamicFlags::FLEXIBLE,
5608 )
5609 }
5610}
5611
5612mod internal {
5613 use super::*;
5614
5615 impl fidl::encoding::ResourceTypeMarker for AudioOffloadExtStartAudioOffloadRequest {
5616 type Borrowed<'a> = &'a mut Self;
5617 fn take_or_borrow<'a>(
5618 value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
5619 ) -> Self::Borrowed<'a> {
5620 value
5621 }
5622 }
5623
5624 unsafe impl fidl::encoding::TypeMarker for AudioOffloadExtStartAudioOffloadRequest {
5625 type Owned = Self;
5626
5627 #[inline(always)]
5628 fn inline_align(_context: fidl::encoding::Context) -> usize {
5629 8
5630 }
5631
5632 #[inline(always)]
5633 fn inline_size(_context: fidl::encoding::Context) -> usize {
5634 24
5635 }
5636 }
5637
5638 unsafe impl
5639 fidl::encoding::Encode<
5640 AudioOffloadExtStartAudioOffloadRequest,
5641 fidl::encoding::DefaultFuchsiaResourceDialect,
5642 > for &mut AudioOffloadExtStartAudioOffloadRequest
5643 {
5644 #[inline]
5645 unsafe fn encode(
5646 self,
5647 encoder: &mut fidl::encoding::Encoder<
5648 '_,
5649 fidl::encoding::DefaultFuchsiaResourceDialect,
5650 >,
5651 offset: usize,
5652 _depth: fidl::encoding::Depth,
5653 ) -> fidl::Result<()> {
5654 encoder.debug_check_bounds::<AudioOffloadExtStartAudioOffloadRequest>(offset);
5655 fidl::encoding::Encode::<
5657 AudioOffloadExtStartAudioOffloadRequest,
5658 fidl::encoding::DefaultFuchsiaResourceDialect,
5659 >::encode(
5660 (
5661 <AudioOffloadConfiguration as fidl::encoding::ValueTypeMarker>::borrow(
5662 &self.configuration,
5663 ),
5664 <fidl::encoding::Endpoint<
5665 fidl::endpoints::ServerEnd<AudioOffloadControllerMarker>,
5666 > as fidl::encoding::ResourceTypeMarker>::take_or_borrow(
5667 &mut self.controller
5668 ),
5669 ),
5670 encoder,
5671 offset,
5672 _depth,
5673 )
5674 }
5675 }
5676 unsafe impl<
5677 T0: fidl::encoding::Encode<
5678 AudioOffloadConfiguration,
5679 fidl::encoding::DefaultFuchsiaResourceDialect,
5680 >,
5681 T1: fidl::encoding::Encode<
5682 fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<AudioOffloadControllerMarker>>,
5683 fidl::encoding::DefaultFuchsiaResourceDialect,
5684 >,
5685 >
5686 fidl::encoding::Encode<
5687 AudioOffloadExtStartAudioOffloadRequest,
5688 fidl::encoding::DefaultFuchsiaResourceDialect,
5689 > for (T0, T1)
5690 {
5691 #[inline]
5692 unsafe fn encode(
5693 self,
5694 encoder: &mut fidl::encoding::Encoder<
5695 '_,
5696 fidl::encoding::DefaultFuchsiaResourceDialect,
5697 >,
5698 offset: usize,
5699 depth: fidl::encoding::Depth,
5700 ) -> fidl::Result<()> {
5701 encoder.debug_check_bounds::<AudioOffloadExtStartAudioOffloadRequest>(offset);
5702 unsafe {
5705 let ptr = encoder.buf.as_mut_ptr().add(offset).offset(16);
5706 (ptr as *mut u64).write_unaligned(0);
5707 }
5708 self.0.encode(encoder, offset + 0, depth)?;
5710 self.1.encode(encoder, offset + 16, depth)?;
5711 Ok(())
5712 }
5713 }
5714
5715 impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
5716 for AudioOffloadExtStartAudioOffloadRequest
5717 {
5718 #[inline(always)]
5719 fn new_empty() -> Self {
5720 Self {
5721 configuration: fidl::new_empty!(
5722 AudioOffloadConfiguration,
5723 fidl::encoding::DefaultFuchsiaResourceDialect
5724 ),
5725 controller: fidl::new_empty!(
5726 fidl::encoding::Endpoint<
5727 fidl::endpoints::ServerEnd<AudioOffloadControllerMarker>,
5728 >,
5729 fidl::encoding::DefaultFuchsiaResourceDialect
5730 ),
5731 }
5732 }
5733
5734 #[inline]
5735 unsafe fn decode(
5736 &mut self,
5737 decoder: &mut fidl::encoding::Decoder<
5738 '_,
5739 fidl::encoding::DefaultFuchsiaResourceDialect,
5740 >,
5741 offset: usize,
5742 _depth: fidl::encoding::Depth,
5743 ) -> fidl::Result<()> {
5744 decoder.debug_check_bounds::<Self>(offset);
5745 let ptr = unsafe { decoder.buf.as_ptr().add(offset).offset(16) };
5747 let padval = unsafe { (ptr as *const u64).read_unaligned() };
5748 let mask = 0xffffffff00000000u64;
5749 let maskedval = padval & mask;
5750 if maskedval != 0 {
5751 return Err(fidl::Error::NonZeroPadding {
5752 padding_start: offset + 16 + ((mask as u64).trailing_zeros() / 8) as usize,
5753 });
5754 }
5755 fidl::decode!(
5756 AudioOffloadConfiguration,
5757 fidl::encoding::DefaultFuchsiaResourceDialect,
5758 &mut self.configuration,
5759 decoder,
5760 offset + 0,
5761 _depth
5762 )?;
5763 fidl::decode!(
5764 fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<AudioOffloadControllerMarker>>,
5765 fidl::encoding::DefaultFuchsiaResourceDialect,
5766 &mut self.controller,
5767 decoder,
5768 offset + 16,
5769 _depth
5770 )?;
5771 Ok(())
5772 }
5773 }
5774
5775 impl fidl::encoding::ResourceTypeMarker for ConnectionReceiverConnectedRequest {
5776 type Borrowed<'a> = &'a mut Self;
5777 fn take_or_borrow<'a>(
5778 value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
5779 ) -> Self::Borrowed<'a> {
5780 value
5781 }
5782 }
5783
5784 unsafe impl fidl::encoding::TypeMarker for ConnectionReceiverConnectedRequest {
5785 type Owned = Self;
5786
5787 #[inline(always)]
5788 fn inline_align(_context: fidl::encoding::Context) -> usize {
5789 8
5790 }
5791
5792 #[inline(always)]
5793 fn inline_size(_context: fidl::encoding::Context) -> usize {
5794 40
5795 }
5796 }
5797
5798 unsafe impl
5799 fidl::encoding::Encode<
5800 ConnectionReceiverConnectedRequest,
5801 fidl::encoding::DefaultFuchsiaResourceDialect,
5802 > for &mut ConnectionReceiverConnectedRequest
5803 {
5804 #[inline]
5805 unsafe fn encode(
5806 self,
5807 encoder: &mut fidl::encoding::Encoder<
5808 '_,
5809 fidl::encoding::DefaultFuchsiaResourceDialect,
5810 >,
5811 offset: usize,
5812 _depth: fidl::encoding::Depth,
5813 ) -> fidl::Result<()> {
5814 encoder.debug_check_bounds::<ConnectionReceiverConnectedRequest>(offset);
5815 fidl::encoding::Encode::<ConnectionReceiverConnectedRequest, fidl::encoding::DefaultFuchsiaResourceDialect>::encode(
5817 (
5818 <fidl_fuchsia_bluetooth::PeerId as fidl::encoding::ValueTypeMarker>::borrow(&self.peer_id),
5819 <Channel as fidl::encoding::ResourceTypeMarker>::take_or_borrow(&mut self.channel),
5820 <fidl::encoding::Vector<ProtocolDescriptor, 255> as fidl::encoding::ValueTypeMarker>::borrow(&self.protocol),
5821 ),
5822 encoder, offset, _depth
5823 )
5824 }
5825 }
5826 unsafe impl<
5827 T0: fidl::encoding::Encode<
5828 fidl_fuchsia_bluetooth::PeerId,
5829 fidl::encoding::DefaultFuchsiaResourceDialect,
5830 >,
5831 T1: fidl::encoding::Encode<Channel, fidl::encoding::DefaultFuchsiaResourceDialect>,
5832 T2: fidl::encoding::Encode<
5833 fidl::encoding::Vector<ProtocolDescriptor, 255>,
5834 fidl::encoding::DefaultFuchsiaResourceDialect,
5835 >,
5836 >
5837 fidl::encoding::Encode<
5838 ConnectionReceiverConnectedRequest,
5839 fidl::encoding::DefaultFuchsiaResourceDialect,
5840 > for (T0, T1, T2)
5841 {
5842 #[inline]
5843 unsafe fn encode(
5844 self,
5845 encoder: &mut fidl::encoding::Encoder<
5846 '_,
5847 fidl::encoding::DefaultFuchsiaResourceDialect,
5848 >,
5849 offset: usize,
5850 depth: fidl::encoding::Depth,
5851 ) -> fidl::Result<()> {
5852 encoder.debug_check_bounds::<ConnectionReceiverConnectedRequest>(offset);
5853 self.0.encode(encoder, offset + 0, depth)?;
5857 self.1.encode(encoder, offset + 8, depth)?;
5858 self.2.encode(encoder, offset + 24, depth)?;
5859 Ok(())
5860 }
5861 }
5862
5863 impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
5864 for ConnectionReceiverConnectedRequest
5865 {
5866 #[inline(always)]
5867 fn new_empty() -> Self {
5868 Self {
5869 peer_id: fidl::new_empty!(
5870 fidl_fuchsia_bluetooth::PeerId,
5871 fidl::encoding::DefaultFuchsiaResourceDialect
5872 ),
5873 channel: fidl::new_empty!(Channel, fidl::encoding::DefaultFuchsiaResourceDialect),
5874 protocol: fidl::new_empty!(fidl::encoding::Vector<ProtocolDescriptor, 255>, fidl::encoding::DefaultFuchsiaResourceDialect),
5875 }
5876 }
5877
5878 #[inline]
5879 unsafe fn decode(
5880 &mut self,
5881 decoder: &mut fidl::encoding::Decoder<
5882 '_,
5883 fidl::encoding::DefaultFuchsiaResourceDialect,
5884 >,
5885 offset: usize,
5886 _depth: fidl::encoding::Depth,
5887 ) -> fidl::Result<()> {
5888 decoder.debug_check_bounds::<Self>(offset);
5889 fidl::decode!(
5891 fidl_fuchsia_bluetooth::PeerId,
5892 fidl::encoding::DefaultFuchsiaResourceDialect,
5893 &mut self.peer_id,
5894 decoder,
5895 offset + 0,
5896 _depth
5897 )?;
5898 fidl::decode!(
5899 Channel,
5900 fidl::encoding::DefaultFuchsiaResourceDialect,
5901 &mut self.channel,
5902 decoder,
5903 offset + 8,
5904 _depth
5905 )?;
5906 fidl::decode!(fidl::encoding::Vector<ProtocolDescriptor, 255>, fidl::encoding::DefaultFuchsiaResourceDialect, &mut self.protocol, decoder, offset + 24, _depth)?;
5907 Ok(())
5908 }
5909 }
5910
5911 impl fidl::encoding::ResourceTypeMarker for ProfileConnectResponse {
5912 type Borrowed<'a> = &'a mut Self;
5913 fn take_or_borrow<'a>(
5914 value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
5915 ) -> Self::Borrowed<'a> {
5916 value
5917 }
5918 }
5919
5920 unsafe impl fidl::encoding::TypeMarker for ProfileConnectResponse {
5921 type Owned = Self;
5922
5923 #[inline(always)]
5924 fn inline_align(_context: fidl::encoding::Context) -> usize {
5925 8
5926 }
5927
5928 #[inline(always)]
5929 fn inline_size(_context: fidl::encoding::Context) -> usize {
5930 16
5931 }
5932 }
5933
5934 unsafe impl
5935 fidl::encoding::Encode<
5936 ProfileConnectResponse,
5937 fidl::encoding::DefaultFuchsiaResourceDialect,
5938 > for &mut ProfileConnectResponse
5939 {
5940 #[inline]
5941 unsafe fn encode(
5942 self,
5943 encoder: &mut fidl::encoding::Encoder<
5944 '_,
5945 fidl::encoding::DefaultFuchsiaResourceDialect,
5946 >,
5947 offset: usize,
5948 _depth: fidl::encoding::Depth,
5949 ) -> fidl::Result<()> {
5950 encoder.debug_check_bounds::<ProfileConnectResponse>(offset);
5951 fidl::encoding::Encode::<
5953 ProfileConnectResponse,
5954 fidl::encoding::DefaultFuchsiaResourceDialect,
5955 >::encode(
5956 (<Channel as fidl::encoding::ResourceTypeMarker>::take_or_borrow(
5957 &mut self.channel,
5958 ),),
5959 encoder,
5960 offset,
5961 _depth,
5962 )
5963 }
5964 }
5965 unsafe impl<T0: fidl::encoding::Encode<Channel, fidl::encoding::DefaultFuchsiaResourceDialect>>
5966 fidl::encoding::Encode<
5967 ProfileConnectResponse,
5968 fidl::encoding::DefaultFuchsiaResourceDialect,
5969 > for (T0,)
5970 {
5971 #[inline]
5972 unsafe fn encode(
5973 self,
5974 encoder: &mut fidl::encoding::Encoder<
5975 '_,
5976 fidl::encoding::DefaultFuchsiaResourceDialect,
5977 >,
5978 offset: usize,
5979 depth: fidl::encoding::Depth,
5980 ) -> fidl::Result<()> {
5981 encoder.debug_check_bounds::<ProfileConnectResponse>(offset);
5982 self.0.encode(encoder, offset + 0, depth)?;
5986 Ok(())
5987 }
5988 }
5989
5990 impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
5991 for ProfileConnectResponse
5992 {
5993 #[inline(always)]
5994 fn new_empty() -> Self {
5995 Self {
5996 channel: fidl::new_empty!(Channel, fidl::encoding::DefaultFuchsiaResourceDialect),
5997 }
5998 }
5999
6000 #[inline]
6001 unsafe fn decode(
6002 &mut self,
6003 decoder: &mut fidl::encoding::Decoder<
6004 '_,
6005 fidl::encoding::DefaultFuchsiaResourceDialect,
6006 >,
6007 offset: usize,
6008 _depth: fidl::encoding::Depth,
6009 ) -> fidl::Result<()> {
6010 decoder.debug_check_bounds::<Self>(offset);
6011 fidl::decode!(
6013 Channel,
6014 fidl::encoding::DefaultFuchsiaResourceDialect,
6015 &mut self.channel,
6016 decoder,
6017 offset + 0,
6018 _depth
6019 )?;
6020 Ok(())
6021 }
6022 }
6023
6024 impl Channel {
6025 #[inline(always)]
6026 fn max_ordinal_present(&self) -> u64 {
6027 if let Some(_) = self.connection {
6028 return 8;
6029 }
6030 if let Some(_) = self.ext_audio_offload {
6031 return 7;
6032 }
6033 if let Some(_) = self.ext_l2cap {
6034 return 6;
6035 }
6036 if let Some(_) = self.flush_timeout {
6037 return 5;
6038 }
6039 if let Some(_) = self.ext_direction {
6040 return 4;
6041 }
6042 if let Some(_) = self.max_tx_sdu_size {
6043 return 3;
6044 }
6045 if let Some(_) = self.channel_mode {
6046 return 2;
6047 }
6048 if let Some(_) = self.socket {
6049 return 1;
6050 }
6051 0
6052 }
6053 }
6054
6055 impl fidl::encoding::ResourceTypeMarker for Channel {
6056 type Borrowed<'a> = &'a mut Self;
6057 fn take_or_borrow<'a>(
6058 value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
6059 ) -> Self::Borrowed<'a> {
6060 value
6061 }
6062 }
6063
6064 unsafe impl fidl::encoding::TypeMarker for Channel {
6065 type Owned = Self;
6066
6067 #[inline(always)]
6068 fn inline_align(_context: fidl::encoding::Context) -> usize {
6069 8
6070 }
6071
6072 #[inline(always)]
6073 fn inline_size(_context: fidl::encoding::Context) -> usize {
6074 16
6075 }
6076 }
6077
6078 unsafe impl fidl::encoding::Encode<Channel, fidl::encoding::DefaultFuchsiaResourceDialect>
6079 for &mut Channel
6080 {
6081 unsafe fn encode(
6082 self,
6083 encoder: &mut fidl::encoding::Encoder<
6084 '_,
6085 fidl::encoding::DefaultFuchsiaResourceDialect,
6086 >,
6087 offset: usize,
6088 mut depth: fidl::encoding::Depth,
6089 ) -> fidl::Result<()> {
6090 encoder.debug_check_bounds::<Channel>(offset);
6091 let max_ordinal: u64 = self.max_ordinal_present();
6093 encoder.write_num(max_ordinal, offset);
6094 encoder.write_num(fidl::encoding::ALLOC_PRESENT_U64, offset + 8);
6095 if max_ordinal == 0 {
6097 return Ok(());
6098 }
6099 depth.increment()?;
6100 let envelope_size = 8;
6101 let bytes_len = max_ordinal as usize * envelope_size;
6102 #[allow(unused_variables)]
6103 let offset = encoder.out_of_line_offset(bytes_len);
6104 let mut _prev_end_offset: usize = 0;
6105 if 1 > max_ordinal {
6106 return Ok(());
6107 }
6108
6109 let cur_offset: usize = (1 - 1) * envelope_size;
6112
6113 encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
6115
6116 fidl::encoding::encode_in_envelope_optional::<
6121 fidl::encoding::HandleType<
6122 fidl::Socket,
6123 { fidl::ObjectType::SOCKET.into_raw() },
6124 2147483648,
6125 >,
6126 fidl::encoding::DefaultFuchsiaResourceDialect,
6127 >(
6128 self.socket.as_mut().map(
6129 <fidl::encoding::HandleType<
6130 fidl::Socket,
6131 { fidl::ObjectType::SOCKET.into_raw() },
6132 2147483648,
6133 > as fidl::encoding::ResourceTypeMarker>::take_or_borrow,
6134 ),
6135 encoder,
6136 offset + cur_offset,
6137 depth,
6138 )?;
6139
6140 _prev_end_offset = cur_offset + envelope_size;
6141 if 2 > max_ordinal {
6142 return Ok(());
6143 }
6144
6145 let cur_offset: usize = (2 - 1) * envelope_size;
6148
6149 encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
6151
6152 fidl::encoding::encode_in_envelope_optional::<fidl_fuchsia_bluetooth::ChannelMode, fidl::encoding::DefaultFuchsiaResourceDialect>(
6157 self.channel_mode.as_ref().map(<fidl_fuchsia_bluetooth::ChannelMode as fidl::encoding::ValueTypeMarker>::borrow),
6158 encoder, offset + cur_offset, depth
6159 )?;
6160
6161 _prev_end_offset = cur_offset + envelope_size;
6162 if 3 > max_ordinal {
6163 return Ok(());
6164 }
6165
6166 let cur_offset: usize = (3 - 1) * envelope_size;
6169
6170 encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
6172
6173 fidl::encoding::encode_in_envelope_optional::<
6178 u16,
6179 fidl::encoding::DefaultFuchsiaResourceDialect,
6180 >(
6181 self.max_tx_sdu_size.as_ref().map(<u16 as fidl::encoding::ValueTypeMarker>::borrow),
6182 encoder,
6183 offset + cur_offset,
6184 depth,
6185 )?;
6186
6187 _prev_end_offset = cur_offset + envelope_size;
6188 if 4 > max_ordinal {
6189 return Ok(());
6190 }
6191
6192 let cur_offset: usize = (4 - 1) * envelope_size;
6195
6196 encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
6198
6199 fidl::encoding::encode_in_envelope_optional::<fidl::encoding::Endpoint<fidl::endpoints::ClientEnd<AudioDirectionExtMarker>>, fidl::encoding::DefaultFuchsiaResourceDialect>(
6204 self.ext_direction.as_mut().map(<fidl::encoding::Endpoint<fidl::endpoints::ClientEnd<AudioDirectionExtMarker>> as fidl::encoding::ResourceTypeMarker>::take_or_borrow),
6205 encoder, offset + cur_offset, depth
6206 )?;
6207
6208 _prev_end_offset = cur_offset + envelope_size;
6209 if 5 > max_ordinal {
6210 return Ok(());
6211 }
6212
6213 let cur_offset: usize = (5 - 1) * envelope_size;
6216
6217 encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
6219
6220 fidl::encoding::encode_in_envelope_optional::<
6225 i64,
6226 fidl::encoding::DefaultFuchsiaResourceDialect,
6227 >(
6228 self.flush_timeout.as_ref().map(<i64 as fidl::encoding::ValueTypeMarker>::borrow),
6229 encoder,
6230 offset + cur_offset,
6231 depth,
6232 )?;
6233
6234 _prev_end_offset = cur_offset + envelope_size;
6235 if 6 > max_ordinal {
6236 return Ok(());
6237 }
6238
6239 let cur_offset: usize = (6 - 1) * envelope_size;
6242
6243 encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
6245
6246 fidl::encoding::encode_in_envelope_optional::<fidl::encoding::Endpoint<fidl::endpoints::ClientEnd<L2capParametersExtMarker>>, fidl::encoding::DefaultFuchsiaResourceDialect>(
6251 self.ext_l2cap.as_mut().map(<fidl::encoding::Endpoint<fidl::endpoints::ClientEnd<L2capParametersExtMarker>> as fidl::encoding::ResourceTypeMarker>::take_or_borrow),
6252 encoder, offset + cur_offset, depth
6253 )?;
6254
6255 _prev_end_offset = cur_offset + envelope_size;
6256 if 7 > max_ordinal {
6257 return Ok(());
6258 }
6259
6260 let cur_offset: usize = (7 - 1) * envelope_size;
6263
6264 encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
6266
6267 fidl::encoding::encode_in_envelope_optional::<fidl::encoding::Endpoint<fidl::endpoints::ClientEnd<AudioOffloadExtMarker>>, fidl::encoding::DefaultFuchsiaResourceDialect>(
6272 self.ext_audio_offload.as_mut().map(<fidl::encoding::Endpoint<fidl::endpoints::ClientEnd<AudioOffloadExtMarker>> as fidl::encoding::ResourceTypeMarker>::take_or_borrow),
6273 encoder, offset + cur_offset, depth
6274 )?;
6275
6276 _prev_end_offset = cur_offset + envelope_size;
6277 if 8 > max_ordinal {
6278 return Ok(());
6279 }
6280
6281 let cur_offset: usize = (8 - 1) * envelope_size;
6284
6285 encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
6287
6288 fidl::encoding::encode_in_envelope_optional::<
6293 fidl::encoding::Endpoint<
6294 fidl::endpoints::ClientEnd<fidl_fuchsia_bluetooth::ChannelMarker>,
6295 >,
6296 fidl::encoding::DefaultFuchsiaResourceDialect,
6297 >(
6298 self.connection.as_mut().map(
6299 <fidl::encoding::Endpoint<
6300 fidl::endpoints::ClientEnd<fidl_fuchsia_bluetooth::ChannelMarker>,
6301 > as fidl::encoding::ResourceTypeMarker>::take_or_borrow,
6302 ),
6303 encoder,
6304 offset + cur_offset,
6305 depth,
6306 )?;
6307
6308 _prev_end_offset = cur_offset + envelope_size;
6309
6310 Ok(())
6311 }
6312 }
6313
6314 impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect> for Channel {
6315 #[inline(always)]
6316 fn new_empty() -> Self {
6317 Self::default()
6318 }
6319
6320 unsafe fn decode(
6321 &mut self,
6322 decoder: &mut fidl::encoding::Decoder<
6323 '_,
6324 fidl::encoding::DefaultFuchsiaResourceDialect,
6325 >,
6326 offset: usize,
6327 mut depth: fidl::encoding::Depth,
6328 ) -> fidl::Result<()> {
6329 decoder.debug_check_bounds::<Self>(offset);
6330 let len = match fidl::encoding::decode_vector_header(decoder, offset)? {
6331 None => return Err(fidl::Error::NotNullable),
6332 Some(len) => len,
6333 };
6334 if len == 0 {
6336 return Ok(());
6337 };
6338 depth.increment()?;
6339 let envelope_size = 8;
6340 let bytes_len = len * envelope_size;
6341 let offset = decoder.out_of_line_offset(bytes_len)?;
6342 let mut _next_ordinal_to_read = 0;
6344 let mut next_offset = offset;
6345 let end_offset = offset + bytes_len;
6346 _next_ordinal_to_read += 1;
6347 if next_offset >= end_offset {
6348 return Ok(());
6349 }
6350
6351 while _next_ordinal_to_read < 1 {
6353 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
6354 _next_ordinal_to_read += 1;
6355 next_offset += envelope_size;
6356 }
6357
6358 let next_out_of_line = decoder.next_out_of_line();
6359 let handles_before = decoder.remaining_handles();
6360 if let Some((inlined, num_bytes, num_handles)) =
6361 fidl::encoding::decode_envelope_header(decoder, next_offset)?
6362 {
6363 let member_inline_size = <fidl::encoding::HandleType<
6364 fidl::Socket,
6365 { fidl::ObjectType::SOCKET.into_raw() },
6366 2147483648,
6367 > as fidl::encoding::TypeMarker>::inline_size(
6368 decoder.context
6369 );
6370 if inlined != (member_inline_size <= 4) {
6371 return Err(fidl::Error::InvalidInlineBitInEnvelope);
6372 }
6373 let inner_offset;
6374 let mut inner_depth = depth.clone();
6375 if inlined {
6376 decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
6377 inner_offset = next_offset;
6378 } else {
6379 inner_offset = decoder.out_of_line_offset(member_inline_size)?;
6380 inner_depth.increment()?;
6381 }
6382 let val_ref =
6383 self.socket.get_or_insert_with(|| fidl::new_empty!(fidl::encoding::HandleType<fidl::Socket, { fidl::ObjectType::SOCKET.into_raw() }, 2147483648>, fidl::encoding::DefaultFuchsiaResourceDialect));
6384 fidl::decode!(fidl::encoding::HandleType<fidl::Socket, { fidl::ObjectType::SOCKET.into_raw() }, 2147483648>, fidl::encoding::DefaultFuchsiaResourceDialect, val_ref, decoder, inner_offset, inner_depth)?;
6385 if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
6386 {
6387 return Err(fidl::Error::InvalidNumBytesInEnvelope);
6388 }
6389 if handles_before != decoder.remaining_handles() + (num_handles as usize) {
6390 return Err(fidl::Error::InvalidNumHandlesInEnvelope);
6391 }
6392 }
6393
6394 next_offset += envelope_size;
6395 _next_ordinal_to_read += 1;
6396 if next_offset >= end_offset {
6397 return Ok(());
6398 }
6399
6400 while _next_ordinal_to_read < 2 {
6402 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
6403 _next_ordinal_to_read += 1;
6404 next_offset += envelope_size;
6405 }
6406
6407 let next_out_of_line = decoder.next_out_of_line();
6408 let handles_before = decoder.remaining_handles();
6409 if let Some((inlined, num_bytes, num_handles)) =
6410 fidl::encoding::decode_envelope_header(decoder, next_offset)?
6411 {
6412 let member_inline_size = <fidl_fuchsia_bluetooth::ChannelMode as fidl::encoding::TypeMarker>::inline_size(decoder.context);
6413 if inlined != (member_inline_size <= 4) {
6414 return Err(fidl::Error::InvalidInlineBitInEnvelope);
6415 }
6416 let inner_offset;
6417 let mut inner_depth = depth.clone();
6418 if inlined {
6419 decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
6420 inner_offset = next_offset;
6421 } else {
6422 inner_offset = decoder.out_of_line_offset(member_inline_size)?;
6423 inner_depth.increment()?;
6424 }
6425 let val_ref = self.channel_mode.get_or_insert_with(|| {
6426 fidl::new_empty!(
6427 fidl_fuchsia_bluetooth::ChannelMode,
6428 fidl::encoding::DefaultFuchsiaResourceDialect
6429 )
6430 });
6431 fidl::decode!(
6432 fidl_fuchsia_bluetooth::ChannelMode,
6433 fidl::encoding::DefaultFuchsiaResourceDialect,
6434 val_ref,
6435 decoder,
6436 inner_offset,
6437 inner_depth
6438 )?;
6439 if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
6440 {
6441 return Err(fidl::Error::InvalidNumBytesInEnvelope);
6442 }
6443 if handles_before != decoder.remaining_handles() + (num_handles as usize) {
6444 return Err(fidl::Error::InvalidNumHandlesInEnvelope);
6445 }
6446 }
6447
6448 next_offset += envelope_size;
6449 _next_ordinal_to_read += 1;
6450 if next_offset >= end_offset {
6451 return Ok(());
6452 }
6453
6454 while _next_ordinal_to_read < 3 {
6456 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
6457 _next_ordinal_to_read += 1;
6458 next_offset += envelope_size;
6459 }
6460
6461 let next_out_of_line = decoder.next_out_of_line();
6462 let handles_before = decoder.remaining_handles();
6463 if let Some((inlined, num_bytes, num_handles)) =
6464 fidl::encoding::decode_envelope_header(decoder, next_offset)?
6465 {
6466 let member_inline_size =
6467 <u16 as fidl::encoding::TypeMarker>::inline_size(decoder.context);
6468 if inlined != (member_inline_size <= 4) {
6469 return Err(fidl::Error::InvalidInlineBitInEnvelope);
6470 }
6471 let inner_offset;
6472 let mut inner_depth = depth.clone();
6473 if inlined {
6474 decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
6475 inner_offset = next_offset;
6476 } else {
6477 inner_offset = decoder.out_of_line_offset(member_inline_size)?;
6478 inner_depth.increment()?;
6479 }
6480 let val_ref = self.max_tx_sdu_size.get_or_insert_with(|| {
6481 fidl::new_empty!(u16, fidl::encoding::DefaultFuchsiaResourceDialect)
6482 });
6483 fidl::decode!(
6484 u16,
6485 fidl::encoding::DefaultFuchsiaResourceDialect,
6486 val_ref,
6487 decoder,
6488 inner_offset,
6489 inner_depth
6490 )?;
6491 if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
6492 {
6493 return Err(fidl::Error::InvalidNumBytesInEnvelope);
6494 }
6495 if handles_before != decoder.remaining_handles() + (num_handles as usize) {
6496 return Err(fidl::Error::InvalidNumHandlesInEnvelope);
6497 }
6498 }
6499
6500 next_offset += envelope_size;
6501 _next_ordinal_to_read += 1;
6502 if next_offset >= end_offset {
6503 return Ok(());
6504 }
6505
6506 while _next_ordinal_to_read < 4 {
6508 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
6509 _next_ordinal_to_read += 1;
6510 next_offset += envelope_size;
6511 }
6512
6513 let next_out_of_line = decoder.next_out_of_line();
6514 let handles_before = decoder.remaining_handles();
6515 if let Some((inlined, num_bytes, num_handles)) =
6516 fidl::encoding::decode_envelope_header(decoder, next_offset)?
6517 {
6518 let member_inline_size = <fidl::encoding::Endpoint<
6519 fidl::endpoints::ClientEnd<AudioDirectionExtMarker>,
6520 > as fidl::encoding::TypeMarker>::inline_size(
6521 decoder.context
6522 );
6523 if inlined != (member_inline_size <= 4) {
6524 return Err(fidl::Error::InvalidInlineBitInEnvelope);
6525 }
6526 let inner_offset;
6527 let mut inner_depth = depth.clone();
6528 if inlined {
6529 decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
6530 inner_offset = next_offset;
6531 } else {
6532 inner_offset = decoder.out_of_line_offset(member_inline_size)?;
6533 inner_depth.increment()?;
6534 }
6535 let val_ref = self.ext_direction.get_or_insert_with(|| {
6536 fidl::new_empty!(
6537 fidl::encoding::Endpoint<
6538 fidl::endpoints::ClientEnd<AudioDirectionExtMarker>,
6539 >,
6540 fidl::encoding::DefaultFuchsiaResourceDialect
6541 )
6542 });
6543 fidl::decode!(
6544 fidl::encoding::Endpoint<fidl::endpoints::ClientEnd<AudioDirectionExtMarker>>,
6545 fidl::encoding::DefaultFuchsiaResourceDialect,
6546 val_ref,
6547 decoder,
6548 inner_offset,
6549 inner_depth
6550 )?;
6551 if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
6552 {
6553 return Err(fidl::Error::InvalidNumBytesInEnvelope);
6554 }
6555 if handles_before != decoder.remaining_handles() + (num_handles as usize) {
6556 return Err(fidl::Error::InvalidNumHandlesInEnvelope);
6557 }
6558 }
6559
6560 next_offset += envelope_size;
6561 _next_ordinal_to_read += 1;
6562 if next_offset >= end_offset {
6563 return Ok(());
6564 }
6565
6566 while _next_ordinal_to_read < 5 {
6568 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
6569 _next_ordinal_to_read += 1;
6570 next_offset += envelope_size;
6571 }
6572
6573 let next_out_of_line = decoder.next_out_of_line();
6574 let handles_before = decoder.remaining_handles();
6575 if let Some((inlined, num_bytes, num_handles)) =
6576 fidl::encoding::decode_envelope_header(decoder, next_offset)?
6577 {
6578 let member_inline_size =
6579 <i64 as fidl::encoding::TypeMarker>::inline_size(decoder.context);
6580 if inlined != (member_inline_size <= 4) {
6581 return Err(fidl::Error::InvalidInlineBitInEnvelope);
6582 }
6583 let inner_offset;
6584 let mut inner_depth = depth.clone();
6585 if inlined {
6586 decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
6587 inner_offset = next_offset;
6588 } else {
6589 inner_offset = decoder.out_of_line_offset(member_inline_size)?;
6590 inner_depth.increment()?;
6591 }
6592 let val_ref = self.flush_timeout.get_or_insert_with(|| {
6593 fidl::new_empty!(i64, fidl::encoding::DefaultFuchsiaResourceDialect)
6594 });
6595 fidl::decode!(
6596 i64,
6597 fidl::encoding::DefaultFuchsiaResourceDialect,
6598 val_ref,
6599 decoder,
6600 inner_offset,
6601 inner_depth
6602 )?;
6603 if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
6604 {
6605 return Err(fidl::Error::InvalidNumBytesInEnvelope);
6606 }
6607 if handles_before != decoder.remaining_handles() + (num_handles as usize) {
6608 return Err(fidl::Error::InvalidNumHandlesInEnvelope);
6609 }
6610 }
6611
6612 next_offset += envelope_size;
6613 _next_ordinal_to_read += 1;
6614 if next_offset >= end_offset {
6615 return Ok(());
6616 }
6617
6618 while _next_ordinal_to_read < 6 {
6620 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
6621 _next_ordinal_to_read += 1;
6622 next_offset += envelope_size;
6623 }
6624
6625 let next_out_of_line = decoder.next_out_of_line();
6626 let handles_before = decoder.remaining_handles();
6627 if let Some((inlined, num_bytes, num_handles)) =
6628 fidl::encoding::decode_envelope_header(decoder, next_offset)?
6629 {
6630 let member_inline_size = <fidl::encoding::Endpoint<
6631 fidl::endpoints::ClientEnd<L2capParametersExtMarker>,
6632 > as fidl::encoding::TypeMarker>::inline_size(
6633 decoder.context
6634 );
6635 if inlined != (member_inline_size <= 4) {
6636 return Err(fidl::Error::InvalidInlineBitInEnvelope);
6637 }
6638 let inner_offset;
6639 let mut inner_depth = depth.clone();
6640 if inlined {
6641 decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
6642 inner_offset = next_offset;
6643 } else {
6644 inner_offset = decoder.out_of_line_offset(member_inline_size)?;
6645 inner_depth.increment()?;
6646 }
6647 let val_ref = self.ext_l2cap.get_or_insert_with(|| {
6648 fidl::new_empty!(
6649 fidl::encoding::Endpoint<
6650 fidl::endpoints::ClientEnd<L2capParametersExtMarker>,
6651 >,
6652 fidl::encoding::DefaultFuchsiaResourceDialect
6653 )
6654 });
6655 fidl::decode!(
6656 fidl::encoding::Endpoint<fidl::endpoints::ClientEnd<L2capParametersExtMarker>>,
6657 fidl::encoding::DefaultFuchsiaResourceDialect,
6658 val_ref,
6659 decoder,
6660 inner_offset,
6661 inner_depth
6662 )?;
6663 if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
6664 {
6665 return Err(fidl::Error::InvalidNumBytesInEnvelope);
6666 }
6667 if handles_before != decoder.remaining_handles() + (num_handles as usize) {
6668 return Err(fidl::Error::InvalidNumHandlesInEnvelope);
6669 }
6670 }
6671
6672 next_offset += envelope_size;
6673 _next_ordinal_to_read += 1;
6674 if next_offset >= end_offset {
6675 return Ok(());
6676 }
6677
6678 while _next_ordinal_to_read < 7 {
6680 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
6681 _next_ordinal_to_read += 1;
6682 next_offset += envelope_size;
6683 }
6684
6685 let next_out_of_line = decoder.next_out_of_line();
6686 let handles_before = decoder.remaining_handles();
6687 if let Some((inlined, num_bytes, num_handles)) =
6688 fidl::encoding::decode_envelope_header(decoder, next_offset)?
6689 {
6690 let member_inline_size = <fidl::encoding::Endpoint<
6691 fidl::endpoints::ClientEnd<AudioOffloadExtMarker>,
6692 > as fidl::encoding::TypeMarker>::inline_size(
6693 decoder.context
6694 );
6695 if inlined != (member_inline_size <= 4) {
6696 return Err(fidl::Error::InvalidInlineBitInEnvelope);
6697 }
6698 let inner_offset;
6699 let mut inner_depth = depth.clone();
6700 if inlined {
6701 decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
6702 inner_offset = next_offset;
6703 } else {
6704 inner_offset = decoder.out_of_line_offset(member_inline_size)?;
6705 inner_depth.increment()?;
6706 }
6707 let val_ref = self.ext_audio_offload.get_or_insert_with(|| {
6708 fidl::new_empty!(
6709 fidl::encoding::Endpoint<fidl::endpoints::ClientEnd<AudioOffloadExtMarker>>,
6710 fidl::encoding::DefaultFuchsiaResourceDialect
6711 )
6712 });
6713 fidl::decode!(
6714 fidl::encoding::Endpoint<fidl::endpoints::ClientEnd<AudioOffloadExtMarker>>,
6715 fidl::encoding::DefaultFuchsiaResourceDialect,
6716 val_ref,
6717 decoder,
6718 inner_offset,
6719 inner_depth
6720 )?;
6721 if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
6722 {
6723 return Err(fidl::Error::InvalidNumBytesInEnvelope);
6724 }
6725 if handles_before != decoder.remaining_handles() + (num_handles as usize) {
6726 return Err(fidl::Error::InvalidNumHandlesInEnvelope);
6727 }
6728 }
6729
6730 next_offset += envelope_size;
6731 _next_ordinal_to_read += 1;
6732 if next_offset >= end_offset {
6733 return Ok(());
6734 }
6735
6736 while _next_ordinal_to_read < 8 {
6738 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
6739 _next_ordinal_to_read += 1;
6740 next_offset += envelope_size;
6741 }
6742
6743 let next_out_of_line = decoder.next_out_of_line();
6744 let handles_before = decoder.remaining_handles();
6745 if let Some((inlined, num_bytes, num_handles)) =
6746 fidl::encoding::decode_envelope_header(decoder, next_offset)?
6747 {
6748 let member_inline_size = <fidl::encoding::Endpoint<
6749 fidl::endpoints::ClientEnd<fidl_fuchsia_bluetooth::ChannelMarker>,
6750 > as fidl::encoding::TypeMarker>::inline_size(
6751 decoder.context
6752 );
6753 if inlined != (member_inline_size <= 4) {
6754 return Err(fidl::Error::InvalidInlineBitInEnvelope);
6755 }
6756 let inner_offset;
6757 let mut inner_depth = depth.clone();
6758 if inlined {
6759 decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
6760 inner_offset = next_offset;
6761 } else {
6762 inner_offset = decoder.out_of_line_offset(member_inline_size)?;
6763 inner_depth.increment()?;
6764 }
6765 let val_ref = self.connection.get_or_insert_with(|| {
6766 fidl::new_empty!(
6767 fidl::encoding::Endpoint<
6768 fidl::endpoints::ClientEnd<fidl_fuchsia_bluetooth::ChannelMarker>,
6769 >,
6770 fidl::encoding::DefaultFuchsiaResourceDialect
6771 )
6772 });
6773 fidl::decode!(
6774 fidl::encoding::Endpoint<
6775 fidl::endpoints::ClientEnd<fidl_fuchsia_bluetooth::ChannelMarker>,
6776 >,
6777 fidl::encoding::DefaultFuchsiaResourceDialect,
6778 val_ref,
6779 decoder,
6780 inner_offset,
6781 inner_depth
6782 )?;
6783 if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
6784 {
6785 return Err(fidl::Error::InvalidNumBytesInEnvelope);
6786 }
6787 if handles_before != decoder.remaining_handles() + (num_handles as usize) {
6788 return Err(fidl::Error::InvalidNumHandlesInEnvelope);
6789 }
6790 }
6791
6792 next_offset += envelope_size;
6793
6794 while next_offset < end_offset {
6796 _next_ordinal_to_read += 1;
6797 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
6798 next_offset += envelope_size;
6799 }
6800
6801 Ok(())
6802 }
6803 }
6804
6805 impl ConnectionReceiver2ConnectedRequest {
6806 #[inline(always)]
6807 fn max_ordinal_present(&self) -> u64 {
6808 if let Some(_) = self.protocol {
6809 return 3;
6810 }
6811 if let Some(_) = self.channel {
6812 return 2;
6813 }
6814 if let Some(_) = self.peer_id {
6815 return 1;
6816 }
6817 0
6818 }
6819 }
6820
6821 impl fidl::encoding::ResourceTypeMarker for ConnectionReceiver2ConnectedRequest {
6822 type Borrowed<'a> = &'a mut Self;
6823 fn take_or_borrow<'a>(
6824 value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
6825 ) -> Self::Borrowed<'a> {
6826 value
6827 }
6828 }
6829
6830 unsafe impl fidl::encoding::TypeMarker for ConnectionReceiver2ConnectedRequest {
6831 type Owned = Self;
6832
6833 #[inline(always)]
6834 fn inline_align(_context: fidl::encoding::Context) -> usize {
6835 8
6836 }
6837
6838 #[inline(always)]
6839 fn inline_size(_context: fidl::encoding::Context) -> usize {
6840 16
6841 }
6842 }
6843
6844 unsafe impl
6845 fidl::encoding::Encode<
6846 ConnectionReceiver2ConnectedRequest,
6847 fidl::encoding::DefaultFuchsiaResourceDialect,
6848 > for &mut ConnectionReceiver2ConnectedRequest
6849 {
6850 unsafe fn encode(
6851 self,
6852 encoder: &mut fidl::encoding::Encoder<
6853 '_,
6854 fidl::encoding::DefaultFuchsiaResourceDialect,
6855 >,
6856 offset: usize,
6857 mut depth: fidl::encoding::Depth,
6858 ) -> fidl::Result<()> {
6859 encoder.debug_check_bounds::<ConnectionReceiver2ConnectedRequest>(offset);
6860 let max_ordinal: u64 = self.max_ordinal_present();
6862 encoder.write_num(max_ordinal, offset);
6863 encoder.write_num(fidl::encoding::ALLOC_PRESENT_U64, offset + 8);
6864 if max_ordinal == 0 {
6866 return Ok(());
6867 }
6868 depth.increment()?;
6869 let envelope_size = 8;
6870 let bytes_len = max_ordinal as usize * envelope_size;
6871 #[allow(unused_variables)]
6872 let offset = encoder.out_of_line_offset(bytes_len);
6873 let mut _prev_end_offset: usize = 0;
6874 if 1 > max_ordinal {
6875 return Ok(());
6876 }
6877
6878 let cur_offset: usize = (1 - 1) * envelope_size;
6881
6882 encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
6884
6885 fidl::encoding::encode_in_envelope_optional::<
6890 fidl_fuchsia_bluetooth::PeerId,
6891 fidl::encoding::DefaultFuchsiaResourceDialect,
6892 >(
6893 self.peer_id.as_ref().map(
6894 <fidl_fuchsia_bluetooth::PeerId as fidl::encoding::ValueTypeMarker>::borrow,
6895 ),
6896 encoder,
6897 offset + cur_offset,
6898 depth,
6899 )?;
6900
6901 _prev_end_offset = cur_offset + envelope_size;
6902 if 2 > max_ordinal {
6903 return Ok(());
6904 }
6905
6906 let cur_offset: usize = (2 - 1) * envelope_size;
6909
6910 encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
6912
6913 fidl::encoding::encode_in_envelope_optional::<
6918 Channel,
6919 fidl::encoding::DefaultFuchsiaResourceDialect,
6920 >(
6921 self.channel
6922 .as_mut()
6923 .map(<Channel as fidl::encoding::ResourceTypeMarker>::take_or_borrow),
6924 encoder,
6925 offset + cur_offset,
6926 depth,
6927 )?;
6928
6929 _prev_end_offset = cur_offset + envelope_size;
6930 if 3 > max_ordinal {
6931 return Ok(());
6932 }
6933
6934 let cur_offset: usize = (3 - 1) * envelope_size;
6937
6938 encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
6940
6941 fidl::encoding::encode_in_envelope_optional::<fidl::encoding::Vector<ProtocolDescriptor, 255>, fidl::encoding::DefaultFuchsiaResourceDialect>(
6946 self.protocol.as_ref().map(<fidl::encoding::Vector<ProtocolDescriptor, 255> as fidl::encoding::ValueTypeMarker>::borrow),
6947 encoder, offset + cur_offset, depth
6948 )?;
6949
6950 _prev_end_offset = cur_offset + envelope_size;
6951
6952 Ok(())
6953 }
6954 }
6955
6956 impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
6957 for ConnectionReceiver2ConnectedRequest
6958 {
6959 #[inline(always)]
6960 fn new_empty() -> Self {
6961 Self::default()
6962 }
6963
6964 unsafe fn decode(
6965 &mut self,
6966 decoder: &mut fidl::encoding::Decoder<
6967 '_,
6968 fidl::encoding::DefaultFuchsiaResourceDialect,
6969 >,
6970 offset: usize,
6971 mut depth: fidl::encoding::Depth,
6972 ) -> fidl::Result<()> {
6973 decoder.debug_check_bounds::<Self>(offset);
6974 let len = match fidl::encoding::decode_vector_header(decoder, offset)? {
6975 None => return Err(fidl::Error::NotNullable),
6976 Some(len) => len,
6977 };
6978 if len == 0 {
6980 return Ok(());
6981 };
6982 depth.increment()?;
6983 let envelope_size = 8;
6984 let bytes_len = len * envelope_size;
6985 let offset = decoder.out_of_line_offset(bytes_len)?;
6986 let mut _next_ordinal_to_read = 0;
6988 let mut next_offset = offset;
6989 let end_offset = offset + bytes_len;
6990 _next_ordinal_to_read += 1;
6991 if next_offset >= end_offset {
6992 return Ok(());
6993 }
6994
6995 while _next_ordinal_to_read < 1 {
6997 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
6998 _next_ordinal_to_read += 1;
6999 next_offset += envelope_size;
7000 }
7001
7002 let next_out_of_line = decoder.next_out_of_line();
7003 let handles_before = decoder.remaining_handles();
7004 if let Some((inlined, num_bytes, num_handles)) =
7005 fidl::encoding::decode_envelope_header(decoder, next_offset)?
7006 {
7007 let member_inline_size =
7008 <fidl_fuchsia_bluetooth::PeerId as fidl::encoding::TypeMarker>::inline_size(
7009 decoder.context,
7010 );
7011 if inlined != (member_inline_size <= 4) {
7012 return Err(fidl::Error::InvalidInlineBitInEnvelope);
7013 }
7014 let inner_offset;
7015 let mut inner_depth = depth.clone();
7016 if inlined {
7017 decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
7018 inner_offset = next_offset;
7019 } else {
7020 inner_offset = decoder.out_of_line_offset(member_inline_size)?;
7021 inner_depth.increment()?;
7022 }
7023 let val_ref = self.peer_id.get_or_insert_with(|| {
7024 fidl::new_empty!(
7025 fidl_fuchsia_bluetooth::PeerId,
7026 fidl::encoding::DefaultFuchsiaResourceDialect
7027 )
7028 });
7029 fidl::decode!(
7030 fidl_fuchsia_bluetooth::PeerId,
7031 fidl::encoding::DefaultFuchsiaResourceDialect,
7032 val_ref,
7033 decoder,
7034 inner_offset,
7035 inner_depth
7036 )?;
7037 if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
7038 {
7039 return Err(fidl::Error::InvalidNumBytesInEnvelope);
7040 }
7041 if handles_before != decoder.remaining_handles() + (num_handles as usize) {
7042 return Err(fidl::Error::InvalidNumHandlesInEnvelope);
7043 }
7044 }
7045
7046 next_offset += envelope_size;
7047 _next_ordinal_to_read += 1;
7048 if next_offset >= end_offset {
7049 return Ok(());
7050 }
7051
7052 while _next_ordinal_to_read < 2 {
7054 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
7055 _next_ordinal_to_read += 1;
7056 next_offset += envelope_size;
7057 }
7058
7059 let next_out_of_line = decoder.next_out_of_line();
7060 let handles_before = decoder.remaining_handles();
7061 if let Some((inlined, num_bytes, num_handles)) =
7062 fidl::encoding::decode_envelope_header(decoder, next_offset)?
7063 {
7064 let member_inline_size =
7065 <Channel as fidl::encoding::TypeMarker>::inline_size(decoder.context);
7066 if inlined != (member_inline_size <= 4) {
7067 return Err(fidl::Error::InvalidInlineBitInEnvelope);
7068 }
7069 let inner_offset;
7070 let mut inner_depth = depth.clone();
7071 if inlined {
7072 decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
7073 inner_offset = next_offset;
7074 } else {
7075 inner_offset = decoder.out_of_line_offset(member_inline_size)?;
7076 inner_depth.increment()?;
7077 }
7078 let val_ref = self.channel.get_or_insert_with(|| {
7079 fidl::new_empty!(Channel, fidl::encoding::DefaultFuchsiaResourceDialect)
7080 });
7081 fidl::decode!(
7082 Channel,
7083 fidl::encoding::DefaultFuchsiaResourceDialect,
7084 val_ref,
7085 decoder,
7086 inner_offset,
7087 inner_depth
7088 )?;
7089 if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
7090 {
7091 return Err(fidl::Error::InvalidNumBytesInEnvelope);
7092 }
7093 if handles_before != decoder.remaining_handles() + (num_handles as usize) {
7094 return Err(fidl::Error::InvalidNumHandlesInEnvelope);
7095 }
7096 }
7097
7098 next_offset += envelope_size;
7099 _next_ordinal_to_read += 1;
7100 if next_offset >= end_offset {
7101 return Ok(());
7102 }
7103
7104 while _next_ordinal_to_read < 3 {
7106 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
7107 _next_ordinal_to_read += 1;
7108 next_offset += envelope_size;
7109 }
7110
7111 let next_out_of_line = decoder.next_out_of_line();
7112 let handles_before = decoder.remaining_handles();
7113 if let Some((inlined, num_bytes, num_handles)) =
7114 fidl::encoding::decode_envelope_header(decoder, next_offset)?
7115 {
7116 let member_inline_size = <fidl::encoding::Vector<ProtocolDescriptor, 255> as fidl::encoding::TypeMarker>::inline_size(decoder.context);
7117 if inlined != (member_inline_size <= 4) {
7118 return Err(fidl::Error::InvalidInlineBitInEnvelope);
7119 }
7120 let inner_offset;
7121 let mut inner_depth = depth.clone();
7122 if inlined {
7123 decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
7124 inner_offset = next_offset;
7125 } else {
7126 inner_offset = decoder.out_of_line_offset(member_inline_size)?;
7127 inner_depth.increment()?;
7128 }
7129 let val_ref =
7130 self.protocol.get_or_insert_with(|| fidl::new_empty!(fidl::encoding::Vector<ProtocolDescriptor, 255>, fidl::encoding::DefaultFuchsiaResourceDialect));
7131 fidl::decode!(fidl::encoding::Vector<ProtocolDescriptor, 255>, fidl::encoding::DefaultFuchsiaResourceDialect, val_ref, decoder, inner_offset, inner_depth)?;
7132 if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
7133 {
7134 return Err(fidl::Error::InvalidNumBytesInEnvelope);
7135 }
7136 if handles_before != decoder.remaining_handles() + (num_handles as usize) {
7137 return Err(fidl::Error::InvalidNumHandlesInEnvelope);
7138 }
7139 }
7140
7141 next_offset += envelope_size;
7142
7143 while next_offset < end_offset {
7145 _next_ordinal_to_read += 1;
7146 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
7147 next_offset += envelope_size;
7148 }
7149
7150 Ok(())
7151 }
7152 }
7153
7154 impl ProfileAdvertiseRequest {
7155 #[inline(always)]
7156 fn max_ordinal_present(&self) -> u64 {
7157 if let Some(_) = self.connection_receiver {
7158 return 4;
7159 }
7160 if let Some(_) = self.parameters {
7161 return 3;
7162 }
7163 if let Some(_) = self.receiver {
7164 return 2;
7165 }
7166 if let Some(_) = self.services {
7167 return 1;
7168 }
7169 0
7170 }
7171 }
7172
7173 impl fidl::encoding::ResourceTypeMarker for ProfileAdvertiseRequest {
7174 type Borrowed<'a> = &'a mut Self;
7175 fn take_or_borrow<'a>(
7176 value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
7177 ) -> Self::Borrowed<'a> {
7178 value
7179 }
7180 }
7181
7182 unsafe impl fidl::encoding::TypeMarker for ProfileAdvertiseRequest {
7183 type Owned = Self;
7184
7185 #[inline(always)]
7186 fn inline_align(_context: fidl::encoding::Context) -> usize {
7187 8
7188 }
7189
7190 #[inline(always)]
7191 fn inline_size(_context: fidl::encoding::Context) -> usize {
7192 16
7193 }
7194 }
7195
7196 unsafe impl
7197 fidl::encoding::Encode<
7198 ProfileAdvertiseRequest,
7199 fidl::encoding::DefaultFuchsiaResourceDialect,
7200 > for &mut ProfileAdvertiseRequest
7201 {
7202 unsafe fn encode(
7203 self,
7204 encoder: &mut fidl::encoding::Encoder<
7205 '_,
7206 fidl::encoding::DefaultFuchsiaResourceDialect,
7207 >,
7208 offset: usize,
7209 mut depth: fidl::encoding::Depth,
7210 ) -> fidl::Result<()> {
7211 encoder.debug_check_bounds::<ProfileAdvertiseRequest>(offset);
7212 let max_ordinal: u64 = self.max_ordinal_present();
7214 encoder.write_num(max_ordinal, offset);
7215 encoder.write_num(fidl::encoding::ALLOC_PRESENT_U64, offset + 8);
7216 if max_ordinal == 0 {
7218 return Ok(());
7219 }
7220 depth.increment()?;
7221 let envelope_size = 8;
7222 let bytes_len = max_ordinal as usize * envelope_size;
7223 #[allow(unused_variables)]
7224 let offset = encoder.out_of_line_offset(bytes_len);
7225 let mut _prev_end_offset: usize = 0;
7226 if 1 > max_ordinal {
7227 return Ok(());
7228 }
7229
7230 let cur_offset: usize = (1 - 1) * envelope_size;
7233
7234 encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
7236
7237 fidl::encoding::encode_in_envelope_optional::<fidl::encoding::Vector<ServiceDefinition, 32>, fidl::encoding::DefaultFuchsiaResourceDialect>(
7242 self.services.as_ref().map(<fidl::encoding::Vector<ServiceDefinition, 32> as fidl::encoding::ValueTypeMarker>::borrow),
7243 encoder, offset + cur_offset, depth
7244 )?;
7245
7246 _prev_end_offset = cur_offset + envelope_size;
7247 if 2 > max_ordinal {
7248 return Ok(());
7249 }
7250
7251 let cur_offset: usize = (2 - 1) * envelope_size;
7254
7255 encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
7257
7258 fidl::encoding::encode_in_envelope_optional::<fidl::encoding::Endpoint<fidl::endpoints::ClientEnd<ConnectionReceiverMarker>>, fidl::encoding::DefaultFuchsiaResourceDialect>(
7263 self.receiver.as_mut().map(<fidl::encoding::Endpoint<fidl::endpoints::ClientEnd<ConnectionReceiverMarker>> as fidl::encoding::ResourceTypeMarker>::take_or_borrow),
7264 encoder, offset + cur_offset, depth
7265 )?;
7266
7267 _prev_end_offset = cur_offset + envelope_size;
7268 if 3 > max_ordinal {
7269 return Ok(());
7270 }
7271
7272 let cur_offset: usize = (3 - 1) * envelope_size;
7275
7276 encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
7278
7279 fidl::encoding::encode_in_envelope_optional::<fidl_fuchsia_bluetooth::ChannelParameters, fidl::encoding::DefaultFuchsiaResourceDialect>(
7284 self.parameters.as_ref().map(<fidl_fuchsia_bluetooth::ChannelParameters as fidl::encoding::ValueTypeMarker>::borrow),
7285 encoder, offset + cur_offset, depth
7286 )?;
7287
7288 _prev_end_offset = cur_offset + envelope_size;
7289 if 4 > max_ordinal {
7290 return Ok(());
7291 }
7292
7293 let cur_offset: usize = (4 - 1) * envelope_size;
7296
7297 encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
7299
7300 fidl::encoding::encode_in_envelope_optional::<fidl::encoding::Endpoint<fidl::endpoints::ClientEnd<ConnectionReceiver2Marker>>, fidl::encoding::DefaultFuchsiaResourceDialect>(
7305 self.connection_receiver.as_mut().map(<fidl::encoding::Endpoint<fidl::endpoints::ClientEnd<ConnectionReceiver2Marker>> as fidl::encoding::ResourceTypeMarker>::take_or_borrow),
7306 encoder, offset + cur_offset, depth
7307 )?;
7308
7309 _prev_end_offset = cur_offset + envelope_size;
7310
7311 Ok(())
7312 }
7313 }
7314
7315 impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
7316 for ProfileAdvertiseRequest
7317 {
7318 #[inline(always)]
7319 fn new_empty() -> Self {
7320 Self::default()
7321 }
7322
7323 unsafe fn decode(
7324 &mut self,
7325 decoder: &mut fidl::encoding::Decoder<
7326 '_,
7327 fidl::encoding::DefaultFuchsiaResourceDialect,
7328 >,
7329 offset: usize,
7330 mut depth: fidl::encoding::Depth,
7331 ) -> fidl::Result<()> {
7332 decoder.debug_check_bounds::<Self>(offset);
7333 let len = match fidl::encoding::decode_vector_header(decoder, offset)? {
7334 None => return Err(fidl::Error::NotNullable),
7335 Some(len) => len,
7336 };
7337 if len == 0 {
7339 return Ok(());
7340 };
7341 depth.increment()?;
7342 let envelope_size = 8;
7343 let bytes_len = len * envelope_size;
7344 let offset = decoder.out_of_line_offset(bytes_len)?;
7345 let mut _next_ordinal_to_read = 0;
7347 let mut next_offset = offset;
7348 let end_offset = offset + bytes_len;
7349 _next_ordinal_to_read += 1;
7350 if next_offset >= end_offset {
7351 return Ok(());
7352 }
7353
7354 while _next_ordinal_to_read < 1 {
7356 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
7357 _next_ordinal_to_read += 1;
7358 next_offset += envelope_size;
7359 }
7360
7361 let next_out_of_line = decoder.next_out_of_line();
7362 let handles_before = decoder.remaining_handles();
7363 if let Some((inlined, num_bytes, num_handles)) =
7364 fidl::encoding::decode_envelope_header(decoder, next_offset)?
7365 {
7366 let member_inline_size = <fidl::encoding::Vector<ServiceDefinition, 32> as fidl::encoding::TypeMarker>::inline_size(decoder.context);
7367 if inlined != (member_inline_size <= 4) {
7368 return Err(fidl::Error::InvalidInlineBitInEnvelope);
7369 }
7370 let inner_offset;
7371 let mut inner_depth = depth.clone();
7372 if inlined {
7373 decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
7374 inner_offset = next_offset;
7375 } else {
7376 inner_offset = decoder.out_of_line_offset(member_inline_size)?;
7377 inner_depth.increment()?;
7378 }
7379 let val_ref =
7380 self.services.get_or_insert_with(|| fidl::new_empty!(fidl::encoding::Vector<ServiceDefinition, 32>, fidl::encoding::DefaultFuchsiaResourceDialect));
7381 fidl::decode!(fidl::encoding::Vector<ServiceDefinition, 32>, fidl::encoding::DefaultFuchsiaResourceDialect, val_ref, decoder, inner_offset, inner_depth)?;
7382 if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
7383 {
7384 return Err(fidl::Error::InvalidNumBytesInEnvelope);
7385 }
7386 if handles_before != decoder.remaining_handles() + (num_handles as usize) {
7387 return Err(fidl::Error::InvalidNumHandlesInEnvelope);
7388 }
7389 }
7390
7391 next_offset += envelope_size;
7392 _next_ordinal_to_read += 1;
7393 if next_offset >= end_offset {
7394 return Ok(());
7395 }
7396
7397 while _next_ordinal_to_read < 2 {
7399 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
7400 _next_ordinal_to_read += 1;
7401 next_offset += envelope_size;
7402 }
7403
7404 let next_out_of_line = decoder.next_out_of_line();
7405 let handles_before = decoder.remaining_handles();
7406 if let Some((inlined, num_bytes, num_handles)) =
7407 fidl::encoding::decode_envelope_header(decoder, next_offset)?
7408 {
7409 let member_inline_size = <fidl::encoding::Endpoint<
7410 fidl::endpoints::ClientEnd<ConnectionReceiverMarker>,
7411 > as fidl::encoding::TypeMarker>::inline_size(
7412 decoder.context
7413 );
7414 if inlined != (member_inline_size <= 4) {
7415 return Err(fidl::Error::InvalidInlineBitInEnvelope);
7416 }
7417 let inner_offset;
7418 let mut inner_depth = depth.clone();
7419 if inlined {
7420 decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
7421 inner_offset = next_offset;
7422 } else {
7423 inner_offset = decoder.out_of_line_offset(member_inline_size)?;
7424 inner_depth.increment()?;
7425 }
7426 let val_ref = self.receiver.get_or_insert_with(|| {
7427 fidl::new_empty!(
7428 fidl::encoding::Endpoint<
7429 fidl::endpoints::ClientEnd<ConnectionReceiverMarker>,
7430 >,
7431 fidl::encoding::DefaultFuchsiaResourceDialect
7432 )
7433 });
7434 fidl::decode!(
7435 fidl::encoding::Endpoint<fidl::endpoints::ClientEnd<ConnectionReceiverMarker>>,
7436 fidl::encoding::DefaultFuchsiaResourceDialect,
7437 val_ref,
7438 decoder,
7439 inner_offset,
7440 inner_depth
7441 )?;
7442 if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
7443 {
7444 return Err(fidl::Error::InvalidNumBytesInEnvelope);
7445 }
7446 if handles_before != decoder.remaining_handles() + (num_handles as usize) {
7447 return Err(fidl::Error::InvalidNumHandlesInEnvelope);
7448 }
7449 }
7450
7451 next_offset += envelope_size;
7452 _next_ordinal_to_read += 1;
7453 if next_offset >= end_offset {
7454 return Ok(());
7455 }
7456
7457 while _next_ordinal_to_read < 3 {
7459 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
7460 _next_ordinal_to_read += 1;
7461 next_offset += envelope_size;
7462 }
7463
7464 let next_out_of_line = decoder.next_out_of_line();
7465 let handles_before = decoder.remaining_handles();
7466 if let Some((inlined, num_bytes, num_handles)) =
7467 fidl::encoding::decode_envelope_header(decoder, next_offset)?
7468 {
7469 let member_inline_size = <fidl_fuchsia_bluetooth::ChannelParameters as fidl::encoding::TypeMarker>::inline_size(decoder.context);
7470 if inlined != (member_inline_size <= 4) {
7471 return Err(fidl::Error::InvalidInlineBitInEnvelope);
7472 }
7473 let inner_offset;
7474 let mut inner_depth = depth.clone();
7475 if inlined {
7476 decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
7477 inner_offset = next_offset;
7478 } else {
7479 inner_offset = decoder.out_of_line_offset(member_inline_size)?;
7480 inner_depth.increment()?;
7481 }
7482 let val_ref = self.parameters.get_or_insert_with(|| {
7483 fidl::new_empty!(
7484 fidl_fuchsia_bluetooth::ChannelParameters,
7485 fidl::encoding::DefaultFuchsiaResourceDialect
7486 )
7487 });
7488 fidl::decode!(
7489 fidl_fuchsia_bluetooth::ChannelParameters,
7490 fidl::encoding::DefaultFuchsiaResourceDialect,
7491 val_ref,
7492 decoder,
7493 inner_offset,
7494 inner_depth
7495 )?;
7496 if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
7497 {
7498 return Err(fidl::Error::InvalidNumBytesInEnvelope);
7499 }
7500 if handles_before != decoder.remaining_handles() + (num_handles as usize) {
7501 return Err(fidl::Error::InvalidNumHandlesInEnvelope);
7502 }
7503 }
7504
7505 next_offset += envelope_size;
7506 _next_ordinal_to_read += 1;
7507 if next_offset >= end_offset {
7508 return Ok(());
7509 }
7510
7511 while _next_ordinal_to_read < 4 {
7513 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
7514 _next_ordinal_to_read += 1;
7515 next_offset += envelope_size;
7516 }
7517
7518 let next_out_of_line = decoder.next_out_of_line();
7519 let handles_before = decoder.remaining_handles();
7520 if let Some((inlined, num_bytes, num_handles)) =
7521 fidl::encoding::decode_envelope_header(decoder, next_offset)?
7522 {
7523 let member_inline_size = <fidl::encoding::Endpoint<
7524 fidl::endpoints::ClientEnd<ConnectionReceiver2Marker>,
7525 > as fidl::encoding::TypeMarker>::inline_size(
7526 decoder.context
7527 );
7528 if inlined != (member_inline_size <= 4) {
7529 return Err(fidl::Error::InvalidInlineBitInEnvelope);
7530 }
7531 let inner_offset;
7532 let mut inner_depth = depth.clone();
7533 if inlined {
7534 decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
7535 inner_offset = next_offset;
7536 } else {
7537 inner_offset = decoder.out_of_line_offset(member_inline_size)?;
7538 inner_depth.increment()?;
7539 }
7540 let val_ref = self.connection_receiver.get_or_insert_with(|| {
7541 fidl::new_empty!(
7542 fidl::encoding::Endpoint<
7543 fidl::endpoints::ClientEnd<ConnectionReceiver2Marker>,
7544 >,
7545 fidl::encoding::DefaultFuchsiaResourceDialect
7546 )
7547 });
7548 fidl::decode!(
7549 fidl::encoding::Endpoint<fidl::endpoints::ClientEnd<ConnectionReceiver2Marker>>,
7550 fidl::encoding::DefaultFuchsiaResourceDialect,
7551 val_ref,
7552 decoder,
7553 inner_offset,
7554 inner_depth
7555 )?;
7556 if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
7557 {
7558 return Err(fidl::Error::InvalidNumBytesInEnvelope);
7559 }
7560 if handles_before != decoder.remaining_handles() + (num_handles as usize) {
7561 return Err(fidl::Error::InvalidNumHandlesInEnvelope);
7562 }
7563 }
7564
7565 next_offset += envelope_size;
7566
7567 while next_offset < end_offset {
7569 _next_ordinal_to_read += 1;
7570 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
7571 next_offset += envelope_size;
7572 }
7573
7574 Ok(())
7575 }
7576 }
7577
7578 impl ProfileConnectScoRequest {
7579 #[inline(always)]
7580 fn max_ordinal_present(&self) -> u64 {
7581 if let Some(_) = self.connection {
7582 return 4;
7583 }
7584 if let Some(_) = self.params {
7585 return 3;
7586 }
7587 if let Some(_) = self.initiator {
7588 return 2;
7589 }
7590 if let Some(_) = self.peer_id {
7591 return 1;
7592 }
7593 0
7594 }
7595 }
7596
7597 impl fidl::encoding::ResourceTypeMarker for ProfileConnectScoRequest {
7598 type Borrowed<'a> = &'a mut Self;
7599 fn take_or_borrow<'a>(
7600 value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
7601 ) -> Self::Borrowed<'a> {
7602 value
7603 }
7604 }
7605
7606 unsafe impl fidl::encoding::TypeMarker for ProfileConnectScoRequest {
7607 type Owned = Self;
7608
7609 #[inline(always)]
7610 fn inline_align(_context: fidl::encoding::Context) -> usize {
7611 8
7612 }
7613
7614 #[inline(always)]
7615 fn inline_size(_context: fidl::encoding::Context) -> usize {
7616 16
7617 }
7618 }
7619
7620 unsafe impl
7621 fidl::encoding::Encode<
7622 ProfileConnectScoRequest,
7623 fidl::encoding::DefaultFuchsiaResourceDialect,
7624 > for &mut ProfileConnectScoRequest
7625 {
7626 unsafe fn encode(
7627 self,
7628 encoder: &mut fidl::encoding::Encoder<
7629 '_,
7630 fidl::encoding::DefaultFuchsiaResourceDialect,
7631 >,
7632 offset: usize,
7633 mut depth: fidl::encoding::Depth,
7634 ) -> fidl::Result<()> {
7635 encoder.debug_check_bounds::<ProfileConnectScoRequest>(offset);
7636 let max_ordinal: u64 = self.max_ordinal_present();
7638 encoder.write_num(max_ordinal, offset);
7639 encoder.write_num(fidl::encoding::ALLOC_PRESENT_U64, offset + 8);
7640 if max_ordinal == 0 {
7642 return Ok(());
7643 }
7644 depth.increment()?;
7645 let envelope_size = 8;
7646 let bytes_len = max_ordinal as usize * envelope_size;
7647 #[allow(unused_variables)]
7648 let offset = encoder.out_of_line_offset(bytes_len);
7649 let mut _prev_end_offset: usize = 0;
7650 if 1 > max_ordinal {
7651 return Ok(());
7652 }
7653
7654 let cur_offset: usize = (1 - 1) * envelope_size;
7657
7658 encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
7660
7661 fidl::encoding::encode_in_envelope_optional::<
7666 fidl_fuchsia_bluetooth::PeerId,
7667 fidl::encoding::DefaultFuchsiaResourceDialect,
7668 >(
7669 self.peer_id.as_ref().map(
7670 <fidl_fuchsia_bluetooth::PeerId as fidl::encoding::ValueTypeMarker>::borrow,
7671 ),
7672 encoder,
7673 offset + cur_offset,
7674 depth,
7675 )?;
7676
7677 _prev_end_offset = cur_offset + envelope_size;
7678 if 2 > max_ordinal {
7679 return Ok(());
7680 }
7681
7682 let cur_offset: usize = (2 - 1) * envelope_size;
7685
7686 encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
7688
7689 fidl::encoding::encode_in_envelope_optional::<
7694 bool,
7695 fidl::encoding::DefaultFuchsiaResourceDialect,
7696 >(
7697 self.initiator.as_ref().map(<bool as fidl::encoding::ValueTypeMarker>::borrow),
7698 encoder,
7699 offset + cur_offset,
7700 depth,
7701 )?;
7702
7703 _prev_end_offset = cur_offset + envelope_size;
7704 if 3 > max_ordinal {
7705 return Ok(());
7706 }
7707
7708 let cur_offset: usize = (3 - 1) * envelope_size;
7711
7712 encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
7714
7715 fidl::encoding::encode_in_envelope_optional::<fidl::encoding::UnboundedVector<ScoConnectionParameters>, fidl::encoding::DefaultFuchsiaResourceDialect>(
7720 self.params.as_ref().map(<fidl::encoding::UnboundedVector<ScoConnectionParameters> as fidl::encoding::ValueTypeMarker>::borrow),
7721 encoder, offset + cur_offset, depth
7722 )?;
7723
7724 _prev_end_offset = cur_offset + envelope_size;
7725 if 4 > max_ordinal {
7726 return Ok(());
7727 }
7728
7729 let cur_offset: usize = (4 - 1) * envelope_size;
7732
7733 encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
7735
7736 fidl::encoding::encode_in_envelope_optional::<fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<ScoConnectionMarker>>, fidl::encoding::DefaultFuchsiaResourceDialect>(
7741 self.connection.as_mut().map(<fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<ScoConnectionMarker>> as fidl::encoding::ResourceTypeMarker>::take_or_borrow),
7742 encoder, offset + cur_offset, depth
7743 )?;
7744
7745 _prev_end_offset = cur_offset + envelope_size;
7746
7747 Ok(())
7748 }
7749 }
7750
7751 impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
7752 for ProfileConnectScoRequest
7753 {
7754 #[inline(always)]
7755 fn new_empty() -> Self {
7756 Self::default()
7757 }
7758
7759 unsafe fn decode(
7760 &mut self,
7761 decoder: &mut fidl::encoding::Decoder<
7762 '_,
7763 fidl::encoding::DefaultFuchsiaResourceDialect,
7764 >,
7765 offset: usize,
7766 mut depth: fidl::encoding::Depth,
7767 ) -> fidl::Result<()> {
7768 decoder.debug_check_bounds::<Self>(offset);
7769 let len = match fidl::encoding::decode_vector_header(decoder, offset)? {
7770 None => return Err(fidl::Error::NotNullable),
7771 Some(len) => len,
7772 };
7773 if len == 0 {
7775 return Ok(());
7776 };
7777 depth.increment()?;
7778 let envelope_size = 8;
7779 let bytes_len = len * envelope_size;
7780 let offset = decoder.out_of_line_offset(bytes_len)?;
7781 let mut _next_ordinal_to_read = 0;
7783 let mut next_offset = offset;
7784 let end_offset = offset + bytes_len;
7785 _next_ordinal_to_read += 1;
7786 if next_offset >= end_offset {
7787 return Ok(());
7788 }
7789
7790 while _next_ordinal_to_read < 1 {
7792 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
7793 _next_ordinal_to_read += 1;
7794 next_offset += envelope_size;
7795 }
7796
7797 let next_out_of_line = decoder.next_out_of_line();
7798 let handles_before = decoder.remaining_handles();
7799 if let Some((inlined, num_bytes, num_handles)) =
7800 fidl::encoding::decode_envelope_header(decoder, next_offset)?
7801 {
7802 let member_inline_size =
7803 <fidl_fuchsia_bluetooth::PeerId as fidl::encoding::TypeMarker>::inline_size(
7804 decoder.context,
7805 );
7806 if inlined != (member_inline_size <= 4) {
7807 return Err(fidl::Error::InvalidInlineBitInEnvelope);
7808 }
7809 let inner_offset;
7810 let mut inner_depth = depth.clone();
7811 if inlined {
7812 decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
7813 inner_offset = next_offset;
7814 } else {
7815 inner_offset = decoder.out_of_line_offset(member_inline_size)?;
7816 inner_depth.increment()?;
7817 }
7818 let val_ref = self.peer_id.get_or_insert_with(|| {
7819 fidl::new_empty!(
7820 fidl_fuchsia_bluetooth::PeerId,
7821 fidl::encoding::DefaultFuchsiaResourceDialect
7822 )
7823 });
7824 fidl::decode!(
7825 fidl_fuchsia_bluetooth::PeerId,
7826 fidl::encoding::DefaultFuchsiaResourceDialect,
7827 val_ref,
7828 decoder,
7829 inner_offset,
7830 inner_depth
7831 )?;
7832 if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
7833 {
7834 return Err(fidl::Error::InvalidNumBytesInEnvelope);
7835 }
7836 if handles_before != decoder.remaining_handles() + (num_handles as usize) {
7837 return Err(fidl::Error::InvalidNumHandlesInEnvelope);
7838 }
7839 }
7840
7841 next_offset += envelope_size;
7842 _next_ordinal_to_read += 1;
7843 if next_offset >= end_offset {
7844 return Ok(());
7845 }
7846
7847 while _next_ordinal_to_read < 2 {
7849 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
7850 _next_ordinal_to_read += 1;
7851 next_offset += envelope_size;
7852 }
7853
7854 let next_out_of_line = decoder.next_out_of_line();
7855 let handles_before = decoder.remaining_handles();
7856 if let Some((inlined, num_bytes, num_handles)) =
7857 fidl::encoding::decode_envelope_header(decoder, next_offset)?
7858 {
7859 let member_inline_size =
7860 <bool as fidl::encoding::TypeMarker>::inline_size(decoder.context);
7861 if inlined != (member_inline_size <= 4) {
7862 return Err(fidl::Error::InvalidInlineBitInEnvelope);
7863 }
7864 let inner_offset;
7865 let mut inner_depth = depth.clone();
7866 if inlined {
7867 decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
7868 inner_offset = next_offset;
7869 } else {
7870 inner_offset = decoder.out_of_line_offset(member_inline_size)?;
7871 inner_depth.increment()?;
7872 }
7873 let val_ref = self.initiator.get_or_insert_with(|| {
7874 fidl::new_empty!(bool, fidl::encoding::DefaultFuchsiaResourceDialect)
7875 });
7876 fidl::decode!(
7877 bool,
7878 fidl::encoding::DefaultFuchsiaResourceDialect,
7879 val_ref,
7880 decoder,
7881 inner_offset,
7882 inner_depth
7883 )?;
7884 if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
7885 {
7886 return Err(fidl::Error::InvalidNumBytesInEnvelope);
7887 }
7888 if handles_before != decoder.remaining_handles() + (num_handles as usize) {
7889 return Err(fidl::Error::InvalidNumHandlesInEnvelope);
7890 }
7891 }
7892
7893 next_offset += envelope_size;
7894 _next_ordinal_to_read += 1;
7895 if next_offset >= end_offset {
7896 return Ok(());
7897 }
7898
7899 while _next_ordinal_to_read < 3 {
7901 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
7902 _next_ordinal_to_read += 1;
7903 next_offset += envelope_size;
7904 }
7905
7906 let next_out_of_line = decoder.next_out_of_line();
7907 let handles_before = decoder.remaining_handles();
7908 if let Some((inlined, num_bytes, num_handles)) =
7909 fidl::encoding::decode_envelope_header(decoder, next_offset)?
7910 {
7911 let member_inline_size = <fidl::encoding::UnboundedVector<ScoConnectionParameters> as fidl::encoding::TypeMarker>::inline_size(decoder.context);
7912 if inlined != (member_inline_size <= 4) {
7913 return Err(fidl::Error::InvalidInlineBitInEnvelope);
7914 }
7915 let inner_offset;
7916 let mut inner_depth = depth.clone();
7917 if inlined {
7918 decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
7919 inner_offset = next_offset;
7920 } else {
7921 inner_offset = decoder.out_of_line_offset(member_inline_size)?;
7922 inner_depth.increment()?;
7923 }
7924 let val_ref = self.params.get_or_insert_with(|| {
7925 fidl::new_empty!(
7926 fidl::encoding::UnboundedVector<ScoConnectionParameters>,
7927 fidl::encoding::DefaultFuchsiaResourceDialect
7928 )
7929 });
7930 fidl::decode!(
7931 fidl::encoding::UnboundedVector<ScoConnectionParameters>,
7932 fidl::encoding::DefaultFuchsiaResourceDialect,
7933 val_ref,
7934 decoder,
7935 inner_offset,
7936 inner_depth
7937 )?;
7938 if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
7939 {
7940 return Err(fidl::Error::InvalidNumBytesInEnvelope);
7941 }
7942 if handles_before != decoder.remaining_handles() + (num_handles as usize) {
7943 return Err(fidl::Error::InvalidNumHandlesInEnvelope);
7944 }
7945 }
7946
7947 next_offset += envelope_size;
7948 _next_ordinal_to_read += 1;
7949 if next_offset >= end_offset {
7950 return Ok(());
7951 }
7952
7953 while _next_ordinal_to_read < 4 {
7955 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
7956 _next_ordinal_to_read += 1;
7957 next_offset += envelope_size;
7958 }
7959
7960 let next_out_of_line = decoder.next_out_of_line();
7961 let handles_before = decoder.remaining_handles();
7962 if let Some((inlined, num_bytes, num_handles)) =
7963 fidl::encoding::decode_envelope_header(decoder, next_offset)?
7964 {
7965 let member_inline_size = <fidl::encoding::Endpoint<
7966 fidl::endpoints::ServerEnd<ScoConnectionMarker>,
7967 > as fidl::encoding::TypeMarker>::inline_size(
7968 decoder.context
7969 );
7970 if inlined != (member_inline_size <= 4) {
7971 return Err(fidl::Error::InvalidInlineBitInEnvelope);
7972 }
7973 let inner_offset;
7974 let mut inner_depth = depth.clone();
7975 if inlined {
7976 decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
7977 inner_offset = next_offset;
7978 } else {
7979 inner_offset = decoder.out_of_line_offset(member_inline_size)?;
7980 inner_depth.increment()?;
7981 }
7982 let val_ref = self.connection.get_or_insert_with(|| {
7983 fidl::new_empty!(
7984 fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<ScoConnectionMarker>>,
7985 fidl::encoding::DefaultFuchsiaResourceDialect
7986 )
7987 });
7988 fidl::decode!(
7989 fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<ScoConnectionMarker>>,
7990 fidl::encoding::DefaultFuchsiaResourceDialect,
7991 val_ref,
7992 decoder,
7993 inner_offset,
7994 inner_depth
7995 )?;
7996 if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
7997 {
7998 return Err(fidl::Error::InvalidNumBytesInEnvelope);
7999 }
8000 if handles_before != decoder.remaining_handles() + (num_handles as usize) {
8001 return Err(fidl::Error::InvalidNumHandlesInEnvelope);
8002 }
8003 }
8004
8005 next_offset += envelope_size;
8006
8007 while next_offset < end_offset {
8009 _next_ordinal_to_read += 1;
8010 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
8011 next_offset += envelope_size;
8012 }
8013
8014 Ok(())
8015 }
8016 }
8017
8018 impl ProfileSearchRequest {
8019 #[inline(always)]
8020 fn max_ordinal_present(&self) -> u64 {
8021 if let Some(_) = self.full_uuid {
8022 return 4;
8023 }
8024 if let Some(_) = self.results {
8025 return 3;
8026 }
8027 if let Some(_) = self.attr_ids {
8028 return 2;
8029 }
8030 if let Some(_) = self.service_uuid {
8031 return 1;
8032 }
8033 0
8034 }
8035 }
8036
8037 impl fidl::encoding::ResourceTypeMarker for ProfileSearchRequest {
8038 type Borrowed<'a> = &'a mut Self;
8039 fn take_or_borrow<'a>(
8040 value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
8041 ) -> Self::Borrowed<'a> {
8042 value
8043 }
8044 }
8045
8046 unsafe impl fidl::encoding::TypeMarker for ProfileSearchRequest {
8047 type Owned = Self;
8048
8049 #[inline(always)]
8050 fn inline_align(_context: fidl::encoding::Context) -> usize {
8051 8
8052 }
8053
8054 #[inline(always)]
8055 fn inline_size(_context: fidl::encoding::Context) -> usize {
8056 16
8057 }
8058 }
8059
8060 unsafe impl
8061 fidl::encoding::Encode<ProfileSearchRequest, fidl::encoding::DefaultFuchsiaResourceDialect>
8062 for &mut ProfileSearchRequest
8063 {
8064 unsafe fn encode(
8065 self,
8066 encoder: &mut fidl::encoding::Encoder<
8067 '_,
8068 fidl::encoding::DefaultFuchsiaResourceDialect,
8069 >,
8070 offset: usize,
8071 mut depth: fidl::encoding::Depth,
8072 ) -> fidl::Result<()> {
8073 encoder.debug_check_bounds::<ProfileSearchRequest>(offset);
8074 let max_ordinal: u64 = self.max_ordinal_present();
8076 encoder.write_num(max_ordinal, offset);
8077 encoder.write_num(fidl::encoding::ALLOC_PRESENT_U64, offset + 8);
8078 if max_ordinal == 0 {
8080 return Ok(());
8081 }
8082 depth.increment()?;
8083 let envelope_size = 8;
8084 let bytes_len = max_ordinal as usize * envelope_size;
8085 #[allow(unused_variables)]
8086 let offset = encoder.out_of_line_offset(bytes_len);
8087 let mut _prev_end_offset: usize = 0;
8088 if 1 > max_ordinal {
8089 return Ok(());
8090 }
8091
8092 let cur_offset: usize = (1 - 1) * envelope_size;
8095
8096 encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
8098
8099 fidl::encoding::encode_in_envelope_optional::<
8104 ServiceClassProfileIdentifier,
8105 fidl::encoding::DefaultFuchsiaResourceDialect,
8106 >(
8107 self.service_uuid.as_ref().map(
8108 <ServiceClassProfileIdentifier as fidl::encoding::ValueTypeMarker>::borrow,
8109 ),
8110 encoder,
8111 offset + cur_offset,
8112 depth,
8113 )?;
8114
8115 _prev_end_offset = cur_offset + envelope_size;
8116 if 2 > max_ordinal {
8117 return Ok(());
8118 }
8119
8120 let cur_offset: usize = (2 - 1) * envelope_size;
8123
8124 encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
8126
8127 fidl::encoding::encode_in_envelope_optional::<
8132 fidl::encoding::Vector<u16, 512>,
8133 fidl::encoding::DefaultFuchsiaResourceDialect,
8134 >(
8135 self.attr_ids.as_ref().map(
8136 <fidl::encoding::Vector<u16, 512> as fidl::encoding::ValueTypeMarker>::borrow,
8137 ),
8138 encoder,
8139 offset + cur_offset,
8140 depth,
8141 )?;
8142
8143 _prev_end_offset = cur_offset + envelope_size;
8144 if 3 > max_ordinal {
8145 return Ok(());
8146 }
8147
8148 let cur_offset: usize = (3 - 1) * envelope_size;
8151
8152 encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
8154
8155 fidl::encoding::encode_in_envelope_optional::<fidl::encoding::Endpoint<fidl::endpoints::ClientEnd<SearchResultsMarker>>, fidl::encoding::DefaultFuchsiaResourceDialect>(
8160 self.results.as_mut().map(<fidl::encoding::Endpoint<fidl::endpoints::ClientEnd<SearchResultsMarker>> as fidl::encoding::ResourceTypeMarker>::take_or_borrow),
8161 encoder, offset + cur_offset, depth
8162 )?;
8163
8164 _prev_end_offset = cur_offset + envelope_size;
8165 if 4 > max_ordinal {
8166 return Ok(());
8167 }
8168
8169 let cur_offset: usize = (4 - 1) * envelope_size;
8172
8173 encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
8175
8176 fidl::encoding::encode_in_envelope_optional::<
8181 fidl_fuchsia_bluetooth::Uuid,
8182 fidl::encoding::DefaultFuchsiaResourceDialect,
8183 >(
8184 self.full_uuid
8185 .as_ref()
8186 .map(<fidl_fuchsia_bluetooth::Uuid as fidl::encoding::ValueTypeMarker>::borrow),
8187 encoder,
8188 offset + cur_offset,
8189 depth,
8190 )?;
8191
8192 _prev_end_offset = cur_offset + envelope_size;
8193
8194 Ok(())
8195 }
8196 }
8197
8198 impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
8199 for ProfileSearchRequest
8200 {
8201 #[inline(always)]
8202 fn new_empty() -> Self {
8203 Self::default()
8204 }
8205
8206 unsafe fn decode(
8207 &mut self,
8208 decoder: &mut fidl::encoding::Decoder<
8209 '_,
8210 fidl::encoding::DefaultFuchsiaResourceDialect,
8211 >,
8212 offset: usize,
8213 mut depth: fidl::encoding::Depth,
8214 ) -> fidl::Result<()> {
8215 decoder.debug_check_bounds::<Self>(offset);
8216 let len = match fidl::encoding::decode_vector_header(decoder, offset)? {
8217 None => return Err(fidl::Error::NotNullable),
8218 Some(len) => len,
8219 };
8220 if len == 0 {
8222 return Ok(());
8223 };
8224 depth.increment()?;
8225 let envelope_size = 8;
8226 let bytes_len = len * envelope_size;
8227 let offset = decoder.out_of_line_offset(bytes_len)?;
8228 let mut _next_ordinal_to_read = 0;
8230 let mut next_offset = offset;
8231 let end_offset = offset + bytes_len;
8232 _next_ordinal_to_read += 1;
8233 if next_offset >= end_offset {
8234 return Ok(());
8235 }
8236
8237 while _next_ordinal_to_read < 1 {
8239 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
8240 _next_ordinal_to_read += 1;
8241 next_offset += envelope_size;
8242 }
8243
8244 let next_out_of_line = decoder.next_out_of_line();
8245 let handles_before = decoder.remaining_handles();
8246 if let Some((inlined, num_bytes, num_handles)) =
8247 fidl::encoding::decode_envelope_header(decoder, next_offset)?
8248 {
8249 let member_inline_size =
8250 <ServiceClassProfileIdentifier as fidl::encoding::TypeMarker>::inline_size(
8251 decoder.context,
8252 );
8253 if inlined != (member_inline_size <= 4) {
8254 return Err(fidl::Error::InvalidInlineBitInEnvelope);
8255 }
8256 let inner_offset;
8257 let mut inner_depth = depth.clone();
8258 if inlined {
8259 decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
8260 inner_offset = next_offset;
8261 } else {
8262 inner_offset = decoder.out_of_line_offset(member_inline_size)?;
8263 inner_depth.increment()?;
8264 }
8265 let val_ref = self.service_uuid.get_or_insert_with(|| {
8266 fidl::new_empty!(
8267 ServiceClassProfileIdentifier,
8268 fidl::encoding::DefaultFuchsiaResourceDialect
8269 )
8270 });
8271 fidl::decode!(
8272 ServiceClassProfileIdentifier,
8273 fidl::encoding::DefaultFuchsiaResourceDialect,
8274 val_ref,
8275 decoder,
8276 inner_offset,
8277 inner_depth
8278 )?;
8279 if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
8280 {
8281 return Err(fidl::Error::InvalidNumBytesInEnvelope);
8282 }
8283 if handles_before != decoder.remaining_handles() + (num_handles as usize) {
8284 return Err(fidl::Error::InvalidNumHandlesInEnvelope);
8285 }
8286 }
8287
8288 next_offset += envelope_size;
8289 _next_ordinal_to_read += 1;
8290 if next_offset >= end_offset {
8291 return Ok(());
8292 }
8293
8294 while _next_ordinal_to_read < 2 {
8296 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
8297 _next_ordinal_to_read += 1;
8298 next_offset += envelope_size;
8299 }
8300
8301 let next_out_of_line = decoder.next_out_of_line();
8302 let handles_before = decoder.remaining_handles();
8303 if let Some((inlined, num_bytes, num_handles)) =
8304 fidl::encoding::decode_envelope_header(decoder, next_offset)?
8305 {
8306 let member_inline_size =
8307 <fidl::encoding::Vector<u16, 512> as fidl::encoding::TypeMarker>::inline_size(
8308 decoder.context,
8309 );
8310 if inlined != (member_inline_size <= 4) {
8311 return Err(fidl::Error::InvalidInlineBitInEnvelope);
8312 }
8313 let inner_offset;
8314 let mut inner_depth = depth.clone();
8315 if inlined {
8316 decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
8317 inner_offset = next_offset;
8318 } else {
8319 inner_offset = decoder.out_of_line_offset(member_inline_size)?;
8320 inner_depth.increment()?;
8321 }
8322 let val_ref =
8323 self.attr_ids.get_or_insert_with(|| fidl::new_empty!(fidl::encoding::Vector<u16, 512>, fidl::encoding::DefaultFuchsiaResourceDialect));
8324 fidl::decode!(fidl::encoding::Vector<u16, 512>, fidl::encoding::DefaultFuchsiaResourceDialect, val_ref, decoder, inner_offset, inner_depth)?;
8325 if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
8326 {
8327 return Err(fidl::Error::InvalidNumBytesInEnvelope);
8328 }
8329 if handles_before != decoder.remaining_handles() + (num_handles as usize) {
8330 return Err(fidl::Error::InvalidNumHandlesInEnvelope);
8331 }
8332 }
8333
8334 next_offset += envelope_size;
8335 _next_ordinal_to_read += 1;
8336 if next_offset >= end_offset {
8337 return Ok(());
8338 }
8339
8340 while _next_ordinal_to_read < 3 {
8342 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
8343 _next_ordinal_to_read += 1;
8344 next_offset += envelope_size;
8345 }
8346
8347 let next_out_of_line = decoder.next_out_of_line();
8348 let handles_before = decoder.remaining_handles();
8349 if let Some((inlined, num_bytes, num_handles)) =
8350 fidl::encoding::decode_envelope_header(decoder, next_offset)?
8351 {
8352 let member_inline_size = <fidl::encoding::Endpoint<
8353 fidl::endpoints::ClientEnd<SearchResultsMarker>,
8354 > as fidl::encoding::TypeMarker>::inline_size(
8355 decoder.context
8356 );
8357 if inlined != (member_inline_size <= 4) {
8358 return Err(fidl::Error::InvalidInlineBitInEnvelope);
8359 }
8360 let inner_offset;
8361 let mut inner_depth = depth.clone();
8362 if inlined {
8363 decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
8364 inner_offset = next_offset;
8365 } else {
8366 inner_offset = decoder.out_of_line_offset(member_inline_size)?;
8367 inner_depth.increment()?;
8368 }
8369 let val_ref = self.results.get_or_insert_with(|| {
8370 fidl::new_empty!(
8371 fidl::encoding::Endpoint<fidl::endpoints::ClientEnd<SearchResultsMarker>>,
8372 fidl::encoding::DefaultFuchsiaResourceDialect
8373 )
8374 });
8375 fidl::decode!(
8376 fidl::encoding::Endpoint<fidl::endpoints::ClientEnd<SearchResultsMarker>>,
8377 fidl::encoding::DefaultFuchsiaResourceDialect,
8378 val_ref,
8379 decoder,
8380 inner_offset,
8381 inner_depth
8382 )?;
8383 if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
8384 {
8385 return Err(fidl::Error::InvalidNumBytesInEnvelope);
8386 }
8387 if handles_before != decoder.remaining_handles() + (num_handles as usize) {
8388 return Err(fidl::Error::InvalidNumHandlesInEnvelope);
8389 }
8390 }
8391
8392 next_offset += envelope_size;
8393 _next_ordinal_to_read += 1;
8394 if next_offset >= end_offset {
8395 return Ok(());
8396 }
8397
8398 while _next_ordinal_to_read < 4 {
8400 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
8401 _next_ordinal_to_read += 1;
8402 next_offset += envelope_size;
8403 }
8404
8405 let next_out_of_line = decoder.next_out_of_line();
8406 let handles_before = decoder.remaining_handles();
8407 if let Some((inlined, num_bytes, num_handles)) =
8408 fidl::encoding::decode_envelope_header(decoder, next_offset)?
8409 {
8410 let member_inline_size =
8411 <fidl_fuchsia_bluetooth::Uuid as fidl::encoding::TypeMarker>::inline_size(
8412 decoder.context,
8413 );
8414 if inlined != (member_inline_size <= 4) {
8415 return Err(fidl::Error::InvalidInlineBitInEnvelope);
8416 }
8417 let inner_offset;
8418 let mut inner_depth = depth.clone();
8419 if inlined {
8420 decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
8421 inner_offset = next_offset;
8422 } else {
8423 inner_offset = decoder.out_of_line_offset(member_inline_size)?;
8424 inner_depth.increment()?;
8425 }
8426 let val_ref = self.full_uuid.get_or_insert_with(|| {
8427 fidl::new_empty!(
8428 fidl_fuchsia_bluetooth::Uuid,
8429 fidl::encoding::DefaultFuchsiaResourceDialect
8430 )
8431 });
8432 fidl::decode!(
8433 fidl_fuchsia_bluetooth::Uuid,
8434 fidl::encoding::DefaultFuchsiaResourceDialect,
8435 val_ref,
8436 decoder,
8437 inner_offset,
8438 inner_depth
8439 )?;
8440 if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
8441 {
8442 return Err(fidl::Error::InvalidNumBytesInEnvelope);
8443 }
8444 if handles_before != decoder.remaining_handles() + (num_handles as usize) {
8445 return Err(fidl::Error::InvalidNumHandlesInEnvelope);
8446 }
8447 }
8448
8449 next_offset += envelope_size;
8450
8451 while next_offset < end_offset {
8453 _next_ordinal_to_read += 1;
8454 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
8455 next_offset += envelope_size;
8456 }
8457
8458 Ok(())
8459 }
8460 }
8461}