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}
4317#[derive(Debug)]
4318#[cfg(target_os = "fuchsia")]
4319pub struct ScoConnectionSynchronousProxy {
4320 client: fidl::client::sync::Client,
4321}
4322
4323#[cfg(target_os = "fuchsia")]
4324impl fidl::endpoints::SynchronousProxy for ScoConnectionSynchronousProxy {
4325 type Proxy = ScoConnectionProxy;
4326 type Protocol = ScoConnectionMarker;
4327
4328 fn from_channel(inner: fidl::Channel) -> Self {
4329 Self::new(inner)
4330 }
4331
4332 fn into_channel(self) -> fidl::Channel {
4333 self.client.into_channel()
4334 }
4335
4336 fn as_channel(&self) -> &fidl::Channel {
4337 self.client.as_channel()
4338 }
4339}
4340
4341#[cfg(target_os = "fuchsia")]
4342impl ScoConnectionSynchronousProxy {
4343 pub fn new(channel: fidl::Channel) -> Self {
4344 let protocol_name = <ScoConnectionMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
4345 Self { client: fidl::client::sync::Client::new(channel, protocol_name) }
4346 }
4347
4348 pub fn into_channel(self) -> fidl::Channel {
4349 self.client.into_channel()
4350 }
4351
4352 pub fn wait_for_event(
4355 &self,
4356 deadline: zx::MonotonicInstant,
4357 ) -> Result<ScoConnectionEvent, fidl::Error> {
4358 ScoConnectionEvent::decode(self.client.wait_for_event(deadline)?)
4359 }
4360
4361 pub fn r#read(
4366 &self,
4367 ___deadline: zx::MonotonicInstant,
4368 ) -> Result<ScoConnectionReadResponse, fidl::Error> {
4369 let _response = self.client.send_query::<
4370 fidl::encoding::EmptyPayload,
4371 fidl::encoding::FlexibleType<ScoConnectionReadResponse>,
4372 >(
4373 (),
4374 0x6fb29eb1e16ac616,
4375 fidl::encoding::DynamicFlags::FLEXIBLE,
4376 ___deadline,
4377 )?
4378 .into_result::<ScoConnectionMarker>("read")?;
4379 Ok(_response)
4380 }
4381
4382 pub fn r#write(
4387 &self,
4388 mut payload: &ScoConnectionWriteRequest,
4389 ___deadline: zx::MonotonicInstant,
4390 ) -> Result<(), fidl::Error> {
4391 let _response = self.client.send_query::<
4392 ScoConnectionWriteRequest,
4393 fidl::encoding::FlexibleType<fidl::encoding::EmptyStruct>,
4394 >(
4395 payload,
4396 0x394e1b2ff7f4a5a9,
4397 fidl::encoding::DynamicFlags::FLEXIBLE,
4398 ___deadline,
4399 )?
4400 .into_result::<ScoConnectionMarker>("write")?;
4401 Ok(_response)
4402 }
4403}
4404
4405#[cfg(target_os = "fuchsia")]
4406impl From<ScoConnectionSynchronousProxy> for zx::Handle {
4407 fn from(value: ScoConnectionSynchronousProxy) -> Self {
4408 value.into_channel().into()
4409 }
4410}
4411
4412#[cfg(target_os = "fuchsia")]
4413impl From<fidl::Channel> for ScoConnectionSynchronousProxy {
4414 fn from(value: fidl::Channel) -> Self {
4415 Self::new(value)
4416 }
4417}
4418
4419#[cfg(target_os = "fuchsia")]
4420impl fidl::endpoints::FromClient for ScoConnectionSynchronousProxy {
4421 type Protocol = ScoConnectionMarker;
4422
4423 fn from_client(value: fidl::endpoints::ClientEnd<ScoConnectionMarker>) -> Self {
4424 Self::new(value.into_channel())
4425 }
4426}
4427
4428#[derive(Debug, Clone)]
4429pub struct ScoConnectionProxy {
4430 client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
4431}
4432
4433impl fidl::endpoints::Proxy for ScoConnectionProxy {
4434 type Protocol = ScoConnectionMarker;
4435
4436 fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
4437 Self::new(inner)
4438 }
4439
4440 fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
4441 self.client.into_channel().map_err(|client| Self { client })
4442 }
4443
4444 fn as_channel(&self) -> &::fidl::AsyncChannel {
4445 self.client.as_channel()
4446 }
4447}
4448
4449impl ScoConnectionProxy {
4450 pub fn new(channel: ::fidl::AsyncChannel) -> Self {
4452 let protocol_name = <ScoConnectionMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
4453 Self { client: fidl::client::Client::new(channel, protocol_name) }
4454 }
4455
4456 pub fn take_event_stream(&self) -> ScoConnectionEventStream {
4462 ScoConnectionEventStream { event_receiver: self.client.take_event_receiver() }
4463 }
4464
4465 pub fn r#read(
4470 &self,
4471 ) -> fidl::client::QueryResponseFut<
4472 ScoConnectionReadResponse,
4473 fidl::encoding::DefaultFuchsiaResourceDialect,
4474 > {
4475 ScoConnectionProxyInterface::r#read(self)
4476 }
4477
4478 pub fn r#write(
4483 &self,
4484 mut payload: &ScoConnectionWriteRequest,
4485 ) -> fidl::client::QueryResponseFut<(), fidl::encoding::DefaultFuchsiaResourceDialect> {
4486 ScoConnectionProxyInterface::r#write(self, payload)
4487 }
4488}
4489
4490impl ScoConnectionProxyInterface for ScoConnectionProxy {
4491 type ReadResponseFut = fidl::client::QueryResponseFut<
4492 ScoConnectionReadResponse,
4493 fidl::encoding::DefaultFuchsiaResourceDialect,
4494 >;
4495 fn r#read(&self) -> Self::ReadResponseFut {
4496 fn _decode(
4497 mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
4498 ) -> Result<ScoConnectionReadResponse, fidl::Error> {
4499 let _response = fidl::client::decode_transaction_body::<
4500 fidl::encoding::FlexibleType<ScoConnectionReadResponse>,
4501 fidl::encoding::DefaultFuchsiaResourceDialect,
4502 0x6fb29eb1e16ac616,
4503 >(_buf?)?
4504 .into_result::<ScoConnectionMarker>("read")?;
4505 Ok(_response)
4506 }
4507 self.client
4508 .send_query_and_decode::<fidl::encoding::EmptyPayload, ScoConnectionReadResponse>(
4509 (),
4510 0x6fb29eb1e16ac616,
4511 fidl::encoding::DynamicFlags::FLEXIBLE,
4512 _decode,
4513 )
4514 }
4515
4516 type WriteResponseFut =
4517 fidl::client::QueryResponseFut<(), fidl::encoding::DefaultFuchsiaResourceDialect>;
4518 fn r#write(&self, mut payload: &ScoConnectionWriteRequest) -> Self::WriteResponseFut {
4519 fn _decode(
4520 mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
4521 ) -> Result<(), fidl::Error> {
4522 let _response = fidl::client::decode_transaction_body::<
4523 fidl::encoding::FlexibleType<fidl::encoding::EmptyStruct>,
4524 fidl::encoding::DefaultFuchsiaResourceDialect,
4525 0x394e1b2ff7f4a5a9,
4526 >(_buf?)?
4527 .into_result::<ScoConnectionMarker>("write")?;
4528 Ok(_response)
4529 }
4530 self.client.send_query_and_decode::<ScoConnectionWriteRequest, ()>(
4531 payload,
4532 0x394e1b2ff7f4a5a9,
4533 fidl::encoding::DynamicFlags::FLEXIBLE,
4534 _decode,
4535 )
4536 }
4537}
4538
4539pub struct ScoConnectionEventStream {
4540 event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
4541}
4542
4543impl std::marker::Unpin for ScoConnectionEventStream {}
4544
4545impl futures::stream::FusedStream for ScoConnectionEventStream {
4546 fn is_terminated(&self) -> bool {
4547 self.event_receiver.is_terminated()
4548 }
4549}
4550
4551impl futures::Stream for ScoConnectionEventStream {
4552 type Item = Result<ScoConnectionEvent, fidl::Error>;
4553
4554 fn poll_next(
4555 mut self: std::pin::Pin<&mut Self>,
4556 cx: &mut std::task::Context<'_>,
4557 ) -> std::task::Poll<Option<Self::Item>> {
4558 match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
4559 &mut self.event_receiver,
4560 cx
4561 )?) {
4562 Some(buf) => std::task::Poll::Ready(Some(ScoConnectionEvent::decode(buf))),
4563 None => std::task::Poll::Ready(None),
4564 }
4565 }
4566}
4567
4568#[derive(Debug)]
4569pub enum ScoConnectionEvent {
4570 OnConnectionComplete {
4571 payload: ScoConnectionOnConnectionCompleteRequest,
4572 },
4573 #[non_exhaustive]
4574 _UnknownEvent {
4575 ordinal: u64,
4577 },
4578}
4579
4580impl ScoConnectionEvent {
4581 #[allow(irrefutable_let_patterns)]
4582 pub fn into_on_connection_complete(self) -> Option<ScoConnectionOnConnectionCompleteRequest> {
4583 if let ScoConnectionEvent::OnConnectionComplete { payload } = self {
4584 Some((payload))
4585 } else {
4586 None
4587 }
4588 }
4589
4590 fn decode(
4592 mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
4593 ) -> Result<ScoConnectionEvent, fidl::Error> {
4594 let (bytes, _handles) = buf.split_mut();
4595 let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
4596 debug_assert_eq!(tx_header.tx_id, 0);
4597 match tx_header.ordinal {
4598 0x193aa06408ba384d => {
4599 let mut out = fidl::new_empty!(
4600 ScoConnectionOnConnectionCompleteRequest,
4601 fidl::encoding::DefaultFuchsiaResourceDialect
4602 );
4603 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<ScoConnectionOnConnectionCompleteRequest>(&tx_header, _body_bytes, _handles, &mut out)?;
4604 Ok((ScoConnectionEvent::OnConnectionComplete { payload: out }))
4605 }
4606 _ if tx_header.dynamic_flags().contains(fidl::encoding::DynamicFlags::FLEXIBLE) => {
4607 Ok(ScoConnectionEvent::_UnknownEvent { ordinal: tx_header.ordinal })
4608 }
4609 _ => Err(fidl::Error::UnknownOrdinal {
4610 ordinal: tx_header.ordinal,
4611 protocol_name: <ScoConnectionMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
4612 }),
4613 }
4614 }
4615}
4616
4617pub struct ScoConnectionRequestStream {
4619 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
4620 is_terminated: bool,
4621}
4622
4623impl std::marker::Unpin for ScoConnectionRequestStream {}
4624
4625impl futures::stream::FusedStream for ScoConnectionRequestStream {
4626 fn is_terminated(&self) -> bool {
4627 self.is_terminated
4628 }
4629}
4630
4631impl fidl::endpoints::RequestStream for ScoConnectionRequestStream {
4632 type Protocol = ScoConnectionMarker;
4633 type ControlHandle = ScoConnectionControlHandle;
4634
4635 fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
4636 Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
4637 }
4638
4639 fn control_handle(&self) -> Self::ControlHandle {
4640 ScoConnectionControlHandle { inner: self.inner.clone() }
4641 }
4642
4643 fn into_inner(
4644 self,
4645 ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
4646 {
4647 (self.inner, self.is_terminated)
4648 }
4649
4650 fn from_inner(
4651 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
4652 is_terminated: bool,
4653 ) -> Self {
4654 Self { inner, is_terminated }
4655 }
4656}
4657
4658impl futures::Stream for ScoConnectionRequestStream {
4659 type Item = Result<ScoConnectionRequest, fidl::Error>;
4660
4661 fn poll_next(
4662 mut self: std::pin::Pin<&mut Self>,
4663 cx: &mut std::task::Context<'_>,
4664 ) -> std::task::Poll<Option<Self::Item>> {
4665 let this = &mut *self;
4666 if this.inner.check_shutdown(cx) {
4667 this.is_terminated = true;
4668 return std::task::Poll::Ready(None);
4669 }
4670 if this.is_terminated {
4671 panic!("polled ScoConnectionRequestStream after completion");
4672 }
4673 fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
4674 |bytes, handles| {
4675 match this.inner.channel().read_etc(cx, bytes, handles) {
4676 std::task::Poll::Ready(Ok(())) => {}
4677 std::task::Poll::Pending => return std::task::Poll::Pending,
4678 std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
4679 this.is_terminated = true;
4680 return std::task::Poll::Ready(None);
4681 }
4682 std::task::Poll::Ready(Err(e)) => {
4683 return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
4684 e.into(),
4685 ))));
4686 }
4687 }
4688
4689 let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
4691
4692 std::task::Poll::Ready(Some(match header.ordinal {
4693 0x6fb29eb1e16ac616 => {
4694 header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
4695 let mut req = fidl::new_empty!(
4696 fidl::encoding::EmptyPayload,
4697 fidl::encoding::DefaultFuchsiaResourceDialect
4698 );
4699 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
4700 let control_handle =
4701 ScoConnectionControlHandle { inner: this.inner.clone() };
4702 Ok(ScoConnectionRequest::Read {
4703 responder: ScoConnectionReadResponder {
4704 control_handle: std::mem::ManuallyDrop::new(control_handle),
4705 tx_id: header.tx_id,
4706 },
4707 })
4708 }
4709 0x394e1b2ff7f4a5a9 => {
4710 header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
4711 let mut req = fidl::new_empty!(
4712 ScoConnectionWriteRequest,
4713 fidl::encoding::DefaultFuchsiaResourceDialect
4714 );
4715 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<ScoConnectionWriteRequest>(&header, _body_bytes, handles, &mut req)?;
4716 let control_handle =
4717 ScoConnectionControlHandle { inner: this.inner.clone() };
4718 Ok(ScoConnectionRequest::Write {
4719 payload: req,
4720 responder: ScoConnectionWriteResponder {
4721 control_handle: std::mem::ManuallyDrop::new(control_handle),
4722 tx_id: header.tx_id,
4723 },
4724 })
4725 }
4726 _ if header.tx_id == 0
4727 && header
4728 .dynamic_flags()
4729 .contains(fidl::encoding::DynamicFlags::FLEXIBLE) =>
4730 {
4731 Ok(ScoConnectionRequest::_UnknownMethod {
4732 ordinal: header.ordinal,
4733 control_handle: ScoConnectionControlHandle {
4734 inner: this.inner.clone(),
4735 },
4736 method_type: fidl::MethodType::OneWay,
4737 })
4738 }
4739 _ if header
4740 .dynamic_flags()
4741 .contains(fidl::encoding::DynamicFlags::FLEXIBLE) =>
4742 {
4743 this.inner.send_framework_err(
4744 fidl::encoding::FrameworkErr::UnknownMethod,
4745 header.tx_id,
4746 header.ordinal,
4747 header.dynamic_flags(),
4748 (bytes, handles),
4749 )?;
4750 Ok(ScoConnectionRequest::_UnknownMethod {
4751 ordinal: header.ordinal,
4752 control_handle: ScoConnectionControlHandle {
4753 inner: this.inner.clone(),
4754 },
4755 method_type: fidl::MethodType::TwoWay,
4756 })
4757 }
4758 _ => Err(fidl::Error::UnknownOrdinal {
4759 ordinal: header.ordinal,
4760 protocol_name:
4761 <ScoConnectionMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
4762 }),
4763 }))
4764 },
4765 )
4766 }
4767}
4768
4769#[derive(Debug)]
4774pub enum ScoConnectionRequest {
4775 Read { responder: ScoConnectionReadResponder },
4780 Write { payload: ScoConnectionWriteRequest, responder: ScoConnectionWriteResponder },
4785 #[non_exhaustive]
4787 _UnknownMethod {
4788 ordinal: u64,
4790 control_handle: ScoConnectionControlHandle,
4791 method_type: fidl::MethodType,
4792 },
4793}
4794
4795impl ScoConnectionRequest {
4796 #[allow(irrefutable_let_patterns)]
4797 pub fn into_read(self) -> Option<(ScoConnectionReadResponder)> {
4798 if let ScoConnectionRequest::Read { responder } = self { Some((responder)) } else { None }
4799 }
4800
4801 #[allow(irrefutable_let_patterns)]
4802 pub fn into_write(self) -> Option<(ScoConnectionWriteRequest, ScoConnectionWriteResponder)> {
4803 if let ScoConnectionRequest::Write { payload, responder } = self {
4804 Some((payload, responder))
4805 } else {
4806 None
4807 }
4808 }
4809
4810 pub fn method_name(&self) -> &'static str {
4812 match *self {
4813 ScoConnectionRequest::Read { .. } => "read",
4814 ScoConnectionRequest::Write { .. } => "write",
4815 ScoConnectionRequest::_UnknownMethod {
4816 method_type: fidl::MethodType::OneWay, ..
4817 } => "unknown one-way method",
4818 ScoConnectionRequest::_UnknownMethod {
4819 method_type: fidl::MethodType::TwoWay, ..
4820 } => "unknown two-way method",
4821 }
4822 }
4823}
4824
4825#[derive(Debug, Clone)]
4826pub struct ScoConnectionControlHandle {
4827 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
4828}
4829
4830impl fidl::endpoints::ControlHandle for ScoConnectionControlHandle {
4831 fn shutdown(&self) {
4832 self.inner.shutdown()
4833 }
4834 fn shutdown_with_epitaph(&self, status: zx_status::Status) {
4835 self.inner.shutdown_with_epitaph(status)
4836 }
4837
4838 fn is_closed(&self) -> bool {
4839 self.inner.channel().is_closed()
4840 }
4841 fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
4842 self.inner.channel().on_closed()
4843 }
4844
4845 #[cfg(target_os = "fuchsia")]
4846 fn signal_peer(
4847 &self,
4848 clear_mask: zx::Signals,
4849 set_mask: zx::Signals,
4850 ) -> Result<(), zx_status::Status> {
4851 use fidl::Peered;
4852 self.inner.channel().signal_peer(clear_mask, set_mask)
4853 }
4854}
4855
4856impl ScoConnectionControlHandle {
4857 pub fn send_on_connection_complete(
4858 &self,
4859 mut payload: &ScoConnectionOnConnectionCompleteRequest,
4860 ) -> Result<(), fidl::Error> {
4861 self.inner.send::<ScoConnectionOnConnectionCompleteRequest>(
4862 payload,
4863 0,
4864 0x193aa06408ba384d,
4865 fidl::encoding::DynamicFlags::FLEXIBLE,
4866 )
4867 }
4868}
4869
4870#[must_use = "FIDL methods require a response to be sent"]
4871#[derive(Debug)]
4872pub struct ScoConnectionReadResponder {
4873 control_handle: std::mem::ManuallyDrop<ScoConnectionControlHandle>,
4874 tx_id: u32,
4875}
4876
4877impl std::ops::Drop for ScoConnectionReadResponder {
4881 fn drop(&mut self) {
4882 self.control_handle.shutdown();
4883 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
4885 }
4886}
4887
4888impl fidl::endpoints::Responder for ScoConnectionReadResponder {
4889 type ControlHandle = ScoConnectionControlHandle;
4890
4891 fn control_handle(&self) -> &ScoConnectionControlHandle {
4892 &self.control_handle
4893 }
4894
4895 fn drop_without_shutdown(mut self) {
4896 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
4898 std::mem::forget(self);
4900 }
4901}
4902
4903impl ScoConnectionReadResponder {
4904 pub fn send(self, mut payload: &ScoConnectionReadResponse) -> Result<(), fidl::Error> {
4908 let _result = self.send_raw(payload);
4909 if _result.is_err() {
4910 self.control_handle.shutdown();
4911 }
4912 self.drop_without_shutdown();
4913 _result
4914 }
4915
4916 pub fn send_no_shutdown_on_err(
4918 self,
4919 mut payload: &ScoConnectionReadResponse,
4920 ) -> Result<(), fidl::Error> {
4921 let _result = self.send_raw(payload);
4922 self.drop_without_shutdown();
4923 _result
4924 }
4925
4926 fn send_raw(&self, mut payload: &ScoConnectionReadResponse) -> Result<(), fidl::Error> {
4927 self.control_handle.inner.send::<fidl::encoding::FlexibleType<ScoConnectionReadResponse>>(
4928 fidl::encoding::Flexible::new(payload),
4929 self.tx_id,
4930 0x6fb29eb1e16ac616,
4931 fidl::encoding::DynamicFlags::FLEXIBLE,
4932 )
4933 }
4934}
4935
4936#[must_use = "FIDL methods require a response to be sent"]
4937#[derive(Debug)]
4938pub struct ScoConnectionWriteResponder {
4939 control_handle: std::mem::ManuallyDrop<ScoConnectionControlHandle>,
4940 tx_id: u32,
4941}
4942
4943impl std::ops::Drop for ScoConnectionWriteResponder {
4947 fn drop(&mut self) {
4948 self.control_handle.shutdown();
4949 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
4951 }
4952}
4953
4954impl fidl::endpoints::Responder for ScoConnectionWriteResponder {
4955 type ControlHandle = ScoConnectionControlHandle;
4956
4957 fn control_handle(&self) -> &ScoConnectionControlHandle {
4958 &self.control_handle
4959 }
4960
4961 fn drop_without_shutdown(mut self) {
4962 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
4964 std::mem::forget(self);
4966 }
4967}
4968
4969impl ScoConnectionWriteResponder {
4970 pub fn send(self) -> Result<(), fidl::Error> {
4974 let _result = self.send_raw();
4975 if _result.is_err() {
4976 self.control_handle.shutdown();
4977 }
4978 self.drop_without_shutdown();
4979 _result
4980 }
4981
4982 pub fn send_no_shutdown_on_err(self) -> Result<(), fidl::Error> {
4984 let _result = self.send_raw();
4985 self.drop_without_shutdown();
4986 _result
4987 }
4988
4989 fn send_raw(&self) -> Result<(), fidl::Error> {
4990 self.control_handle.inner.send::<fidl::encoding::FlexibleType<fidl::encoding::EmptyStruct>>(
4991 fidl::encoding::Flexible::new(()),
4992 self.tx_id,
4993 0x394e1b2ff7f4a5a9,
4994 fidl::encoding::DynamicFlags::FLEXIBLE,
4995 )
4996 }
4997}
4998
4999#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
5000pub struct SearchResultsMarker;
5001
5002impl fidl::endpoints::ProtocolMarker for SearchResultsMarker {
5003 type Proxy = SearchResultsProxy;
5004 type RequestStream = SearchResultsRequestStream;
5005 #[cfg(target_os = "fuchsia")]
5006 type SynchronousProxy = SearchResultsSynchronousProxy;
5007
5008 const DEBUG_NAME: &'static str = "(anonymous) SearchResults";
5009}
5010
5011pub trait SearchResultsProxyInterface: Send + Sync {
5012 type ServiceFoundResponseFut: std::future::Future<Output = Result<(), fidl::Error>> + Send;
5013 fn r#service_found(
5014 &self,
5015 peer_id: &fidl_fuchsia_bluetooth::PeerId,
5016 protocol: Option<&[ProtocolDescriptor]>,
5017 attributes: &[Attribute],
5018 ) -> Self::ServiceFoundResponseFut;
5019}
5020#[derive(Debug)]
5021#[cfg(target_os = "fuchsia")]
5022pub struct SearchResultsSynchronousProxy {
5023 client: fidl::client::sync::Client,
5024}
5025
5026#[cfg(target_os = "fuchsia")]
5027impl fidl::endpoints::SynchronousProxy for SearchResultsSynchronousProxy {
5028 type Proxy = SearchResultsProxy;
5029 type Protocol = SearchResultsMarker;
5030
5031 fn from_channel(inner: fidl::Channel) -> Self {
5032 Self::new(inner)
5033 }
5034
5035 fn into_channel(self) -> fidl::Channel {
5036 self.client.into_channel()
5037 }
5038
5039 fn as_channel(&self) -> &fidl::Channel {
5040 self.client.as_channel()
5041 }
5042}
5043
5044#[cfg(target_os = "fuchsia")]
5045impl SearchResultsSynchronousProxy {
5046 pub fn new(channel: fidl::Channel) -> Self {
5047 let protocol_name = <SearchResultsMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
5048 Self { client: fidl::client::sync::Client::new(channel, protocol_name) }
5049 }
5050
5051 pub fn into_channel(self) -> fidl::Channel {
5052 self.client.into_channel()
5053 }
5054
5055 pub fn wait_for_event(
5058 &self,
5059 deadline: zx::MonotonicInstant,
5060 ) -> Result<SearchResultsEvent, fidl::Error> {
5061 SearchResultsEvent::decode(self.client.wait_for_event(deadline)?)
5062 }
5063
5064 pub fn r#service_found(
5074 &self,
5075 mut peer_id: &fidl_fuchsia_bluetooth::PeerId,
5076 mut protocol: Option<&[ProtocolDescriptor]>,
5077 mut attributes: &[Attribute],
5078 ___deadline: zx::MonotonicInstant,
5079 ) -> Result<(), fidl::Error> {
5080 let _response = self.client.send_query::<
5081 SearchResultsServiceFoundRequest,
5082 fidl::encoding::FlexibleType<fidl::encoding::EmptyStruct>,
5083 >(
5084 (peer_id, protocol, attributes,),
5085 0x526509a842ebd43c,
5086 fidl::encoding::DynamicFlags::FLEXIBLE,
5087 ___deadline,
5088 )?
5089 .into_result::<SearchResultsMarker>("service_found")?;
5090 Ok(_response)
5091 }
5092}
5093
5094#[cfg(target_os = "fuchsia")]
5095impl From<SearchResultsSynchronousProxy> for zx::Handle {
5096 fn from(value: SearchResultsSynchronousProxy) -> Self {
5097 value.into_channel().into()
5098 }
5099}
5100
5101#[cfg(target_os = "fuchsia")]
5102impl From<fidl::Channel> for SearchResultsSynchronousProxy {
5103 fn from(value: fidl::Channel) -> Self {
5104 Self::new(value)
5105 }
5106}
5107
5108#[cfg(target_os = "fuchsia")]
5109impl fidl::endpoints::FromClient for SearchResultsSynchronousProxy {
5110 type Protocol = SearchResultsMarker;
5111
5112 fn from_client(value: fidl::endpoints::ClientEnd<SearchResultsMarker>) -> Self {
5113 Self::new(value.into_channel())
5114 }
5115}
5116
5117#[derive(Debug, Clone)]
5118pub struct SearchResultsProxy {
5119 client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
5120}
5121
5122impl fidl::endpoints::Proxy for SearchResultsProxy {
5123 type Protocol = SearchResultsMarker;
5124
5125 fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
5126 Self::new(inner)
5127 }
5128
5129 fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
5130 self.client.into_channel().map_err(|client| Self { client })
5131 }
5132
5133 fn as_channel(&self) -> &::fidl::AsyncChannel {
5134 self.client.as_channel()
5135 }
5136}
5137
5138impl SearchResultsProxy {
5139 pub fn new(channel: ::fidl::AsyncChannel) -> Self {
5141 let protocol_name = <SearchResultsMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
5142 Self { client: fidl::client::Client::new(channel, protocol_name) }
5143 }
5144
5145 pub fn take_event_stream(&self) -> SearchResultsEventStream {
5151 SearchResultsEventStream { event_receiver: self.client.take_event_receiver() }
5152 }
5153
5154 pub fn r#service_found(
5164 &self,
5165 mut peer_id: &fidl_fuchsia_bluetooth::PeerId,
5166 mut protocol: Option<&[ProtocolDescriptor]>,
5167 mut attributes: &[Attribute],
5168 ) -> fidl::client::QueryResponseFut<(), fidl::encoding::DefaultFuchsiaResourceDialect> {
5169 SearchResultsProxyInterface::r#service_found(self, peer_id, protocol, attributes)
5170 }
5171}
5172
5173impl SearchResultsProxyInterface for SearchResultsProxy {
5174 type ServiceFoundResponseFut =
5175 fidl::client::QueryResponseFut<(), fidl::encoding::DefaultFuchsiaResourceDialect>;
5176 fn r#service_found(
5177 &self,
5178 mut peer_id: &fidl_fuchsia_bluetooth::PeerId,
5179 mut protocol: Option<&[ProtocolDescriptor]>,
5180 mut attributes: &[Attribute],
5181 ) -> Self::ServiceFoundResponseFut {
5182 fn _decode(
5183 mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
5184 ) -> Result<(), fidl::Error> {
5185 let _response = fidl::client::decode_transaction_body::<
5186 fidl::encoding::FlexibleType<fidl::encoding::EmptyStruct>,
5187 fidl::encoding::DefaultFuchsiaResourceDialect,
5188 0x526509a842ebd43c,
5189 >(_buf?)?
5190 .into_result::<SearchResultsMarker>("service_found")?;
5191 Ok(_response)
5192 }
5193 self.client.send_query_and_decode::<SearchResultsServiceFoundRequest, ()>(
5194 (peer_id, protocol, attributes),
5195 0x526509a842ebd43c,
5196 fidl::encoding::DynamicFlags::FLEXIBLE,
5197 _decode,
5198 )
5199 }
5200}
5201
5202pub struct SearchResultsEventStream {
5203 event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
5204}
5205
5206impl std::marker::Unpin for SearchResultsEventStream {}
5207
5208impl futures::stream::FusedStream for SearchResultsEventStream {
5209 fn is_terminated(&self) -> bool {
5210 self.event_receiver.is_terminated()
5211 }
5212}
5213
5214impl futures::Stream for SearchResultsEventStream {
5215 type Item = Result<SearchResultsEvent, fidl::Error>;
5216
5217 fn poll_next(
5218 mut self: std::pin::Pin<&mut Self>,
5219 cx: &mut std::task::Context<'_>,
5220 ) -> std::task::Poll<Option<Self::Item>> {
5221 match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
5222 &mut self.event_receiver,
5223 cx
5224 )?) {
5225 Some(buf) => std::task::Poll::Ready(Some(SearchResultsEvent::decode(buf))),
5226 None => std::task::Poll::Ready(None),
5227 }
5228 }
5229}
5230
5231#[derive(Debug)]
5232pub enum SearchResultsEvent {
5233 #[non_exhaustive]
5234 _UnknownEvent {
5235 ordinal: u64,
5237 },
5238}
5239
5240impl SearchResultsEvent {
5241 fn decode(
5243 mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
5244 ) -> Result<SearchResultsEvent, fidl::Error> {
5245 let (bytes, _handles) = buf.split_mut();
5246 let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
5247 debug_assert_eq!(tx_header.tx_id, 0);
5248 match tx_header.ordinal {
5249 _ if tx_header.dynamic_flags().contains(fidl::encoding::DynamicFlags::FLEXIBLE) => {
5250 Ok(SearchResultsEvent::_UnknownEvent { ordinal: tx_header.ordinal })
5251 }
5252 _ => Err(fidl::Error::UnknownOrdinal {
5253 ordinal: tx_header.ordinal,
5254 protocol_name: <SearchResultsMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
5255 }),
5256 }
5257 }
5258}
5259
5260pub struct SearchResultsRequestStream {
5262 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
5263 is_terminated: bool,
5264}
5265
5266impl std::marker::Unpin for SearchResultsRequestStream {}
5267
5268impl futures::stream::FusedStream for SearchResultsRequestStream {
5269 fn is_terminated(&self) -> bool {
5270 self.is_terminated
5271 }
5272}
5273
5274impl fidl::endpoints::RequestStream for SearchResultsRequestStream {
5275 type Protocol = SearchResultsMarker;
5276 type ControlHandle = SearchResultsControlHandle;
5277
5278 fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
5279 Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
5280 }
5281
5282 fn control_handle(&self) -> Self::ControlHandle {
5283 SearchResultsControlHandle { inner: self.inner.clone() }
5284 }
5285
5286 fn into_inner(
5287 self,
5288 ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
5289 {
5290 (self.inner, self.is_terminated)
5291 }
5292
5293 fn from_inner(
5294 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
5295 is_terminated: bool,
5296 ) -> Self {
5297 Self { inner, is_terminated }
5298 }
5299}
5300
5301impl futures::Stream for SearchResultsRequestStream {
5302 type Item = Result<SearchResultsRequest, fidl::Error>;
5303
5304 fn poll_next(
5305 mut self: std::pin::Pin<&mut Self>,
5306 cx: &mut std::task::Context<'_>,
5307 ) -> std::task::Poll<Option<Self::Item>> {
5308 let this = &mut *self;
5309 if this.inner.check_shutdown(cx) {
5310 this.is_terminated = true;
5311 return std::task::Poll::Ready(None);
5312 }
5313 if this.is_terminated {
5314 panic!("polled SearchResultsRequestStream after completion");
5315 }
5316 fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
5317 |bytes, handles| {
5318 match this.inner.channel().read_etc(cx, bytes, handles) {
5319 std::task::Poll::Ready(Ok(())) => {}
5320 std::task::Poll::Pending => return std::task::Poll::Pending,
5321 std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
5322 this.is_terminated = true;
5323 return std::task::Poll::Ready(None);
5324 }
5325 std::task::Poll::Ready(Err(e)) => {
5326 return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
5327 e.into(),
5328 ))));
5329 }
5330 }
5331
5332 let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
5334
5335 std::task::Poll::Ready(Some(match header.ordinal {
5336 0x526509a842ebd43c => {
5337 header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
5338 let mut req = fidl::new_empty!(
5339 SearchResultsServiceFoundRequest,
5340 fidl::encoding::DefaultFuchsiaResourceDialect
5341 );
5342 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<SearchResultsServiceFoundRequest>(&header, _body_bytes, handles, &mut req)?;
5343 let control_handle =
5344 SearchResultsControlHandle { inner: this.inner.clone() };
5345 Ok(SearchResultsRequest::ServiceFound {
5346 peer_id: req.peer_id,
5347 protocol: req.protocol,
5348 attributes: req.attributes,
5349
5350 responder: SearchResultsServiceFoundResponder {
5351 control_handle: std::mem::ManuallyDrop::new(control_handle),
5352 tx_id: header.tx_id,
5353 },
5354 })
5355 }
5356 _ if header.tx_id == 0
5357 && header
5358 .dynamic_flags()
5359 .contains(fidl::encoding::DynamicFlags::FLEXIBLE) =>
5360 {
5361 Ok(SearchResultsRequest::_UnknownMethod {
5362 ordinal: header.ordinal,
5363 control_handle: SearchResultsControlHandle {
5364 inner: this.inner.clone(),
5365 },
5366 method_type: fidl::MethodType::OneWay,
5367 })
5368 }
5369 _ if header
5370 .dynamic_flags()
5371 .contains(fidl::encoding::DynamicFlags::FLEXIBLE) =>
5372 {
5373 this.inner.send_framework_err(
5374 fidl::encoding::FrameworkErr::UnknownMethod,
5375 header.tx_id,
5376 header.ordinal,
5377 header.dynamic_flags(),
5378 (bytes, handles),
5379 )?;
5380 Ok(SearchResultsRequest::_UnknownMethod {
5381 ordinal: header.ordinal,
5382 control_handle: SearchResultsControlHandle {
5383 inner: this.inner.clone(),
5384 },
5385 method_type: fidl::MethodType::TwoWay,
5386 })
5387 }
5388 _ => Err(fidl::Error::UnknownOrdinal {
5389 ordinal: header.ordinal,
5390 protocol_name:
5391 <SearchResultsMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
5392 }),
5393 }))
5394 },
5395 )
5396 }
5397}
5398
5399#[derive(Debug)]
5402pub enum SearchResultsRequest {
5403 ServiceFound {
5413 peer_id: fidl_fuchsia_bluetooth::PeerId,
5414 protocol: Option<Vec<ProtocolDescriptor>>,
5415 attributes: Vec<Attribute>,
5416 responder: SearchResultsServiceFoundResponder,
5417 },
5418 #[non_exhaustive]
5420 _UnknownMethod {
5421 ordinal: u64,
5423 control_handle: SearchResultsControlHandle,
5424 method_type: fidl::MethodType,
5425 },
5426}
5427
5428impl SearchResultsRequest {
5429 #[allow(irrefutable_let_patterns)]
5430 pub fn into_service_found(
5431 self,
5432 ) -> Option<(
5433 fidl_fuchsia_bluetooth::PeerId,
5434 Option<Vec<ProtocolDescriptor>>,
5435 Vec<Attribute>,
5436 SearchResultsServiceFoundResponder,
5437 )> {
5438 if let SearchResultsRequest::ServiceFound { peer_id, protocol, attributes, responder } =
5439 self
5440 {
5441 Some((peer_id, protocol, attributes, responder))
5442 } else {
5443 None
5444 }
5445 }
5446
5447 pub fn method_name(&self) -> &'static str {
5449 match *self {
5450 SearchResultsRequest::ServiceFound { .. } => "service_found",
5451 SearchResultsRequest::_UnknownMethod {
5452 method_type: fidl::MethodType::OneWay, ..
5453 } => "unknown one-way method",
5454 SearchResultsRequest::_UnknownMethod {
5455 method_type: fidl::MethodType::TwoWay, ..
5456 } => "unknown two-way method",
5457 }
5458 }
5459}
5460
5461#[derive(Debug, Clone)]
5462pub struct SearchResultsControlHandle {
5463 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
5464}
5465
5466impl fidl::endpoints::ControlHandle for SearchResultsControlHandle {
5467 fn shutdown(&self) {
5468 self.inner.shutdown()
5469 }
5470 fn shutdown_with_epitaph(&self, status: zx_status::Status) {
5471 self.inner.shutdown_with_epitaph(status)
5472 }
5473
5474 fn is_closed(&self) -> bool {
5475 self.inner.channel().is_closed()
5476 }
5477 fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
5478 self.inner.channel().on_closed()
5479 }
5480
5481 #[cfg(target_os = "fuchsia")]
5482 fn signal_peer(
5483 &self,
5484 clear_mask: zx::Signals,
5485 set_mask: zx::Signals,
5486 ) -> Result<(), zx_status::Status> {
5487 use fidl::Peered;
5488 self.inner.channel().signal_peer(clear_mask, set_mask)
5489 }
5490}
5491
5492impl SearchResultsControlHandle {}
5493
5494#[must_use = "FIDL methods require a response to be sent"]
5495#[derive(Debug)]
5496pub struct SearchResultsServiceFoundResponder {
5497 control_handle: std::mem::ManuallyDrop<SearchResultsControlHandle>,
5498 tx_id: u32,
5499}
5500
5501impl std::ops::Drop for SearchResultsServiceFoundResponder {
5505 fn drop(&mut self) {
5506 self.control_handle.shutdown();
5507 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
5509 }
5510}
5511
5512impl fidl::endpoints::Responder for SearchResultsServiceFoundResponder {
5513 type ControlHandle = SearchResultsControlHandle;
5514
5515 fn control_handle(&self) -> &SearchResultsControlHandle {
5516 &self.control_handle
5517 }
5518
5519 fn drop_without_shutdown(mut self) {
5520 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
5522 std::mem::forget(self);
5524 }
5525}
5526
5527impl SearchResultsServiceFoundResponder {
5528 pub fn send(self) -> Result<(), fidl::Error> {
5532 let _result = self.send_raw();
5533 if _result.is_err() {
5534 self.control_handle.shutdown();
5535 }
5536 self.drop_without_shutdown();
5537 _result
5538 }
5539
5540 pub fn send_no_shutdown_on_err(self) -> Result<(), fidl::Error> {
5542 let _result = self.send_raw();
5543 self.drop_without_shutdown();
5544 _result
5545 }
5546
5547 fn send_raw(&self) -> Result<(), fidl::Error> {
5548 self.control_handle.inner.send::<fidl::encoding::FlexibleType<fidl::encoding::EmptyStruct>>(
5549 fidl::encoding::Flexible::new(()),
5550 self.tx_id,
5551 0x526509a842ebd43c,
5552 fidl::encoding::DynamicFlags::FLEXIBLE,
5553 )
5554 }
5555}
5556
5557mod internal {
5558 use super::*;
5559
5560 impl fidl::encoding::ResourceTypeMarker for AudioOffloadExtStartAudioOffloadRequest {
5561 type Borrowed<'a> = &'a mut Self;
5562 fn take_or_borrow<'a>(
5563 value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
5564 ) -> Self::Borrowed<'a> {
5565 value
5566 }
5567 }
5568
5569 unsafe impl fidl::encoding::TypeMarker for AudioOffloadExtStartAudioOffloadRequest {
5570 type Owned = Self;
5571
5572 #[inline(always)]
5573 fn inline_align(_context: fidl::encoding::Context) -> usize {
5574 8
5575 }
5576
5577 #[inline(always)]
5578 fn inline_size(_context: fidl::encoding::Context) -> usize {
5579 24
5580 }
5581 }
5582
5583 unsafe impl
5584 fidl::encoding::Encode<
5585 AudioOffloadExtStartAudioOffloadRequest,
5586 fidl::encoding::DefaultFuchsiaResourceDialect,
5587 > for &mut AudioOffloadExtStartAudioOffloadRequest
5588 {
5589 #[inline]
5590 unsafe fn encode(
5591 self,
5592 encoder: &mut fidl::encoding::Encoder<
5593 '_,
5594 fidl::encoding::DefaultFuchsiaResourceDialect,
5595 >,
5596 offset: usize,
5597 _depth: fidl::encoding::Depth,
5598 ) -> fidl::Result<()> {
5599 encoder.debug_check_bounds::<AudioOffloadExtStartAudioOffloadRequest>(offset);
5600 fidl::encoding::Encode::<
5602 AudioOffloadExtStartAudioOffloadRequest,
5603 fidl::encoding::DefaultFuchsiaResourceDialect,
5604 >::encode(
5605 (
5606 <AudioOffloadConfiguration as fidl::encoding::ValueTypeMarker>::borrow(
5607 &self.configuration,
5608 ),
5609 <fidl::encoding::Endpoint<
5610 fidl::endpoints::ServerEnd<AudioOffloadControllerMarker>,
5611 > as fidl::encoding::ResourceTypeMarker>::take_or_borrow(
5612 &mut self.controller
5613 ),
5614 ),
5615 encoder,
5616 offset,
5617 _depth,
5618 )
5619 }
5620 }
5621 unsafe impl<
5622 T0: fidl::encoding::Encode<
5623 AudioOffloadConfiguration,
5624 fidl::encoding::DefaultFuchsiaResourceDialect,
5625 >,
5626 T1: fidl::encoding::Encode<
5627 fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<AudioOffloadControllerMarker>>,
5628 fidl::encoding::DefaultFuchsiaResourceDialect,
5629 >,
5630 >
5631 fidl::encoding::Encode<
5632 AudioOffloadExtStartAudioOffloadRequest,
5633 fidl::encoding::DefaultFuchsiaResourceDialect,
5634 > for (T0, T1)
5635 {
5636 #[inline]
5637 unsafe fn encode(
5638 self,
5639 encoder: &mut fidl::encoding::Encoder<
5640 '_,
5641 fidl::encoding::DefaultFuchsiaResourceDialect,
5642 >,
5643 offset: usize,
5644 depth: fidl::encoding::Depth,
5645 ) -> fidl::Result<()> {
5646 encoder.debug_check_bounds::<AudioOffloadExtStartAudioOffloadRequest>(offset);
5647 unsafe {
5650 let ptr = encoder.buf.as_mut_ptr().add(offset).offset(16);
5651 (ptr as *mut u64).write_unaligned(0);
5652 }
5653 self.0.encode(encoder, offset + 0, depth)?;
5655 self.1.encode(encoder, offset + 16, depth)?;
5656 Ok(())
5657 }
5658 }
5659
5660 impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
5661 for AudioOffloadExtStartAudioOffloadRequest
5662 {
5663 #[inline(always)]
5664 fn new_empty() -> Self {
5665 Self {
5666 configuration: fidl::new_empty!(
5667 AudioOffloadConfiguration,
5668 fidl::encoding::DefaultFuchsiaResourceDialect
5669 ),
5670 controller: fidl::new_empty!(
5671 fidl::encoding::Endpoint<
5672 fidl::endpoints::ServerEnd<AudioOffloadControllerMarker>,
5673 >,
5674 fidl::encoding::DefaultFuchsiaResourceDialect
5675 ),
5676 }
5677 }
5678
5679 #[inline]
5680 unsafe fn decode(
5681 &mut self,
5682 decoder: &mut fidl::encoding::Decoder<
5683 '_,
5684 fidl::encoding::DefaultFuchsiaResourceDialect,
5685 >,
5686 offset: usize,
5687 _depth: fidl::encoding::Depth,
5688 ) -> fidl::Result<()> {
5689 decoder.debug_check_bounds::<Self>(offset);
5690 let ptr = unsafe { decoder.buf.as_ptr().add(offset).offset(16) };
5692 let padval = unsafe { (ptr as *const u64).read_unaligned() };
5693 let mask = 0xffffffff00000000u64;
5694 let maskedval = padval & mask;
5695 if maskedval != 0 {
5696 return Err(fidl::Error::NonZeroPadding {
5697 padding_start: offset + 16 + ((mask as u64).trailing_zeros() / 8) as usize,
5698 });
5699 }
5700 fidl::decode!(
5701 AudioOffloadConfiguration,
5702 fidl::encoding::DefaultFuchsiaResourceDialect,
5703 &mut self.configuration,
5704 decoder,
5705 offset + 0,
5706 _depth
5707 )?;
5708 fidl::decode!(
5709 fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<AudioOffloadControllerMarker>>,
5710 fidl::encoding::DefaultFuchsiaResourceDialect,
5711 &mut self.controller,
5712 decoder,
5713 offset + 16,
5714 _depth
5715 )?;
5716 Ok(())
5717 }
5718 }
5719
5720 impl fidl::encoding::ResourceTypeMarker for ConnectionReceiverConnectedRequest {
5721 type Borrowed<'a> = &'a mut Self;
5722 fn take_or_borrow<'a>(
5723 value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
5724 ) -> Self::Borrowed<'a> {
5725 value
5726 }
5727 }
5728
5729 unsafe impl fidl::encoding::TypeMarker for ConnectionReceiverConnectedRequest {
5730 type Owned = Self;
5731
5732 #[inline(always)]
5733 fn inline_align(_context: fidl::encoding::Context) -> usize {
5734 8
5735 }
5736
5737 #[inline(always)]
5738 fn inline_size(_context: fidl::encoding::Context) -> usize {
5739 40
5740 }
5741 }
5742
5743 unsafe impl
5744 fidl::encoding::Encode<
5745 ConnectionReceiverConnectedRequest,
5746 fidl::encoding::DefaultFuchsiaResourceDialect,
5747 > for &mut ConnectionReceiverConnectedRequest
5748 {
5749 #[inline]
5750 unsafe fn encode(
5751 self,
5752 encoder: &mut fidl::encoding::Encoder<
5753 '_,
5754 fidl::encoding::DefaultFuchsiaResourceDialect,
5755 >,
5756 offset: usize,
5757 _depth: fidl::encoding::Depth,
5758 ) -> fidl::Result<()> {
5759 encoder.debug_check_bounds::<ConnectionReceiverConnectedRequest>(offset);
5760 fidl::encoding::Encode::<ConnectionReceiverConnectedRequest, fidl::encoding::DefaultFuchsiaResourceDialect>::encode(
5762 (
5763 <fidl_fuchsia_bluetooth::PeerId as fidl::encoding::ValueTypeMarker>::borrow(&self.peer_id),
5764 <Channel as fidl::encoding::ResourceTypeMarker>::take_or_borrow(&mut self.channel),
5765 <fidl::encoding::Vector<ProtocolDescriptor, 255> as fidl::encoding::ValueTypeMarker>::borrow(&self.protocol),
5766 ),
5767 encoder, offset, _depth
5768 )
5769 }
5770 }
5771 unsafe impl<
5772 T0: fidl::encoding::Encode<
5773 fidl_fuchsia_bluetooth::PeerId,
5774 fidl::encoding::DefaultFuchsiaResourceDialect,
5775 >,
5776 T1: fidl::encoding::Encode<Channel, fidl::encoding::DefaultFuchsiaResourceDialect>,
5777 T2: fidl::encoding::Encode<
5778 fidl::encoding::Vector<ProtocolDescriptor, 255>,
5779 fidl::encoding::DefaultFuchsiaResourceDialect,
5780 >,
5781 >
5782 fidl::encoding::Encode<
5783 ConnectionReceiverConnectedRequest,
5784 fidl::encoding::DefaultFuchsiaResourceDialect,
5785 > for (T0, T1, T2)
5786 {
5787 #[inline]
5788 unsafe fn encode(
5789 self,
5790 encoder: &mut fidl::encoding::Encoder<
5791 '_,
5792 fidl::encoding::DefaultFuchsiaResourceDialect,
5793 >,
5794 offset: usize,
5795 depth: fidl::encoding::Depth,
5796 ) -> fidl::Result<()> {
5797 encoder.debug_check_bounds::<ConnectionReceiverConnectedRequest>(offset);
5798 self.0.encode(encoder, offset + 0, depth)?;
5802 self.1.encode(encoder, offset + 8, depth)?;
5803 self.2.encode(encoder, offset + 24, depth)?;
5804 Ok(())
5805 }
5806 }
5807
5808 impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
5809 for ConnectionReceiverConnectedRequest
5810 {
5811 #[inline(always)]
5812 fn new_empty() -> Self {
5813 Self {
5814 peer_id: fidl::new_empty!(
5815 fidl_fuchsia_bluetooth::PeerId,
5816 fidl::encoding::DefaultFuchsiaResourceDialect
5817 ),
5818 channel: fidl::new_empty!(Channel, fidl::encoding::DefaultFuchsiaResourceDialect),
5819 protocol: fidl::new_empty!(fidl::encoding::Vector<ProtocolDescriptor, 255>, fidl::encoding::DefaultFuchsiaResourceDialect),
5820 }
5821 }
5822
5823 #[inline]
5824 unsafe fn decode(
5825 &mut self,
5826 decoder: &mut fidl::encoding::Decoder<
5827 '_,
5828 fidl::encoding::DefaultFuchsiaResourceDialect,
5829 >,
5830 offset: usize,
5831 _depth: fidl::encoding::Depth,
5832 ) -> fidl::Result<()> {
5833 decoder.debug_check_bounds::<Self>(offset);
5834 fidl::decode!(
5836 fidl_fuchsia_bluetooth::PeerId,
5837 fidl::encoding::DefaultFuchsiaResourceDialect,
5838 &mut self.peer_id,
5839 decoder,
5840 offset + 0,
5841 _depth
5842 )?;
5843 fidl::decode!(
5844 Channel,
5845 fidl::encoding::DefaultFuchsiaResourceDialect,
5846 &mut self.channel,
5847 decoder,
5848 offset + 8,
5849 _depth
5850 )?;
5851 fidl::decode!(fidl::encoding::Vector<ProtocolDescriptor, 255>, fidl::encoding::DefaultFuchsiaResourceDialect, &mut self.protocol, decoder, offset + 24, _depth)?;
5852 Ok(())
5853 }
5854 }
5855
5856 impl fidl::encoding::ResourceTypeMarker for ProfileConnectResponse {
5857 type Borrowed<'a> = &'a mut Self;
5858 fn take_or_borrow<'a>(
5859 value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
5860 ) -> Self::Borrowed<'a> {
5861 value
5862 }
5863 }
5864
5865 unsafe impl fidl::encoding::TypeMarker for ProfileConnectResponse {
5866 type Owned = Self;
5867
5868 #[inline(always)]
5869 fn inline_align(_context: fidl::encoding::Context) -> usize {
5870 8
5871 }
5872
5873 #[inline(always)]
5874 fn inline_size(_context: fidl::encoding::Context) -> usize {
5875 16
5876 }
5877 }
5878
5879 unsafe impl
5880 fidl::encoding::Encode<
5881 ProfileConnectResponse,
5882 fidl::encoding::DefaultFuchsiaResourceDialect,
5883 > for &mut ProfileConnectResponse
5884 {
5885 #[inline]
5886 unsafe fn encode(
5887 self,
5888 encoder: &mut fidl::encoding::Encoder<
5889 '_,
5890 fidl::encoding::DefaultFuchsiaResourceDialect,
5891 >,
5892 offset: usize,
5893 _depth: fidl::encoding::Depth,
5894 ) -> fidl::Result<()> {
5895 encoder.debug_check_bounds::<ProfileConnectResponse>(offset);
5896 fidl::encoding::Encode::<
5898 ProfileConnectResponse,
5899 fidl::encoding::DefaultFuchsiaResourceDialect,
5900 >::encode(
5901 (<Channel as fidl::encoding::ResourceTypeMarker>::take_or_borrow(
5902 &mut self.channel,
5903 ),),
5904 encoder,
5905 offset,
5906 _depth,
5907 )
5908 }
5909 }
5910 unsafe impl<T0: fidl::encoding::Encode<Channel, fidl::encoding::DefaultFuchsiaResourceDialect>>
5911 fidl::encoding::Encode<
5912 ProfileConnectResponse,
5913 fidl::encoding::DefaultFuchsiaResourceDialect,
5914 > for (T0,)
5915 {
5916 #[inline]
5917 unsafe fn encode(
5918 self,
5919 encoder: &mut fidl::encoding::Encoder<
5920 '_,
5921 fidl::encoding::DefaultFuchsiaResourceDialect,
5922 >,
5923 offset: usize,
5924 depth: fidl::encoding::Depth,
5925 ) -> fidl::Result<()> {
5926 encoder.debug_check_bounds::<ProfileConnectResponse>(offset);
5927 self.0.encode(encoder, offset + 0, depth)?;
5931 Ok(())
5932 }
5933 }
5934
5935 impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
5936 for ProfileConnectResponse
5937 {
5938 #[inline(always)]
5939 fn new_empty() -> Self {
5940 Self {
5941 channel: fidl::new_empty!(Channel, fidl::encoding::DefaultFuchsiaResourceDialect),
5942 }
5943 }
5944
5945 #[inline]
5946 unsafe fn decode(
5947 &mut self,
5948 decoder: &mut fidl::encoding::Decoder<
5949 '_,
5950 fidl::encoding::DefaultFuchsiaResourceDialect,
5951 >,
5952 offset: usize,
5953 _depth: fidl::encoding::Depth,
5954 ) -> fidl::Result<()> {
5955 decoder.debug_check_bounds::<Self>(offset);
5956 fidl::decode!(
5958 Channel,
5959 fidl::encoding::DefaultFuchsiaResourceDialect,
5960 &mut self.channel,
5961 decoder,
5962 offset + 0,
5963 _depth
5964 )?;
5965 Ok(())
5966 }
5967 }
5968
5969 impl Channel {
5970 #[inline(always)]
5971 fn max_ordinal_present(&self) -> u64 {
5972 if let Some(_) = self.connection {
5973 return 8;
5974 }
5975 if let Some(_) = self.ext_audio_offload {
5976 return 7;
5977 }
5978 if let Some(_) = self.ext_l2cap {
5979 return 6;
5980 }
5981 if let Some(_) = self.flush_timeout {
5982 return 5;
5983 }
5984 if let Some(_) = self.ext_direction {
5985 return 4;
5986 }
5987 if let Some(_) = self.max_tx_sdu_size {
5988 return 3;
5989 }
5990 if let Some(_) = self.channel_mode {
5991 return 2;
5992 }
5993 if let Some(_) = self.socket {
5994 return 1;
5995 }
5996 0
5997 }
5998 }
5999
6000 impl fidl::encoding::ResourceTypeMarker for Channel {
6001 type Borrowed<'a> = &'a mut Self;
6002 fn take_or_borrow<'a>(
6003 value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
6004 ) -> Self::Borrowed<'a> {
6005 value
6006 }
6007 }
6008
6009 unsafe impl fidl::encoding::TypeMarker for Channel {
6010 type Owned = Self;
6011
6012 #[inline(always)]
6013 fn inline_align(_context: fidl::encoding::Context) -> usize {
6014 8
6015 }
6016
6017 #[inline(always)]
6018 fn inline_size(_context: fidl::encoding::Context) -> usize {
6019 16
6020 }
6021 }
6022
6023 unsafe impl fidl::encoding::Encode<Channel, fidl::encoding::DefaultFuchsiaResourceDialect>
6024 for &mut Channel
6025 {
6026 unsafe fn encode(
6027 self,
6028 encoder: &mut fidl::encoding::Encoder<
6029 '_,
6030 fidl::encoding::DefaultFuchsiaResourceDialect,
6031 >,
6032 offset: usize,
6033 mut depth: fidl::encoding::Depth,
6034 ) -> fidl::Result<()> {
6035 encoder.debug_check_bounds::<Channel>(offset);
6036 let max_ordinal: u64 = self.max_ordinal_present();
6038 encoder.write_num(max_ordinal, offset);
6039 encoder.write_num(fidl::encoding::ALLOC_PRESENT_U64, offset + 8);
6040 if max_ordinal == 0 {
6042 return Ok(());
6043 }
6044 depth.increment()?;
6045 let envelope_size = 8;
6046 let bytes_len = max_ordinal as usize * envelope_size;
6047 #[allow(unused_variables)]
6048 let offset = encoder.out_of_line_offset(bytes_len);
6049 let mut _prev_end_offset: usize = 0;
6050 if 1 > max_ordinal {
6051 return Ok(());
6052 }
6053
6054 let cur_offset: usize = (1 - 1) * envelope_size;
6057
6058 encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
6060
6061 fidl::encoding::encode_in_envelope_optional::<
6066 fidl::encoding::HandleType<
6067 fidl::Socket,
6068 { fidl::ObjectType::SOCKET.into_raw() },
6069 2147483648,
6070 >,
6071 fidl::encoding::DefaultFuchsiaResourceDialect,
6072 >(
6073 self.socket.as_mut().map(
6074 <fidl::encoding::HandleType<
6075 fidl::Socket,
6076 { fidl::ObjectType::SOCKET.into_raw() },
6077 2147483648,
6078 > as fidl::encoding::ResourceTypeMarker>::take_or_borrow,
6079 ),
6080 encoder,
6081 offset + cur_offset,
6082 depth,
6083 )?;
6084
6085 _prev_end_offset = cur_offset + envelope_size;
6086 if 2 > max_ordinal {
6087 return Ok(());
6088 }
6089
6090 let cur_offset: usize = (2 - 1) * envelope_size;
6093
6094 encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
6096
6097 fidl::encoding::encode_in_envelope_optional::<fidl_fuchsia_bluetooth::ChannelMode, fidl::encoding::DefaultFuchsiaResourceDialect>(
6102 self.channel_mode.as_ref().map(<fidl_fuchsia_bluetooth::ChannelMode as fidl::encoding::ValueTypeMarker>::borrow),
6103 encoder, offset + cur_offset, depth
6104 )?;
6105
6106 _prev_end_offset = cur_offset + envelope_size;
6107 if 3 > max_ordinal {
6108 return Ok(());
6109 }
6110
6111 let cur_offset: usize = (3 - 1) * envelope_size;
6114
6115 encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
6117
6118 fidl::encoding::encode_in_envelope_optional::<
6123 u16,
6124 fidl::encoding::DefaultFuchsiaResourceDialect,
6125 >(
6126 self.max_tx_sdu_size.as_ref().map(<u16 as fidl::encoding::ValueTypeMarker>::borrow),
6127 encoder,
6128 offset + cur_offset,
6129 depth,
6130 )?;
6131
6132 _prev_end_offset = cur_offset + envelope_size;
6133 if 4 > max_ordinal {
6134 return Ok(());
6135 }
6136
6137 let cur_offset: usize = (4 - 1) * envelope_size;
6140
6141 encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
6143
6144 fidl::encoding::encode_in_envelope_optional::<fidl::encoding::Endpoint<fidl::endpoints::ClientEnd<AudioDirectionExtMarker>>, fidl::encoding::DefaultFuchsiaResourceDialect>(
6149 self.ext_direction.as_mut().map(<fidl::encoding::Endpoint<fidl::endpoints::ClientEnd<AudioDirectionExtMarker>> as fidl::encoding::ResourceTypeMarker>::take_or_borrow),
6150 encoder, offset + cur_offset, depth
6151 )?;
6152
6153 _prev_end_offset = cur_offset + envelope_size;
6154 if 5 > max_ordinal {
6155 return Ok(());
6156 }
6157
6158 let cur_offset: usize = (5 - 1) * envelope_size;
6161
6162 encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
6164
6165 fidl::encoding::encode_in_envelope_optional::<
6170 i64,
6171 fidl::encoding::DefaultFuchsiaResourceDialect,
6172 >(
6173 self.flush_timeout.as_ref().map(<i64 as fidl::encoding::ValueTypeMarker>::borrow),
6174 encoder,
6175 offset + cur_offset,
6176 depth,
6177 )?;
6178
6179 _prev_end_offset = cur_offset + envelope_size;
6180 if 6 > max_ordinal {
6181 return Ok(());
6182 }
6183
6184 let cur_offset: usize = (6 - 1) * envelope_size;
6187
6188 encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
6190
6191 fidl::encoding::encode_in_envelope_optional::<fidl::encoding::Endpoint<fidl::endpoints::ClientEnd<L2capParametersExtMarker>>, fidl::encoding::DefaultFuchsiaResourceDialect>(
6196 self.ext_l2cap.as_mut().map(<fidl::encoding::Endpoint<fidl::endpoints::ClientEnd<L2capParametersExtMarker>> as fidl::encoding::ResourceTypeMarker>::take_or_borrow),
6197 encoder, offset + cur_offset, depth
6198 )?;
6199
6200 _prev_end_offset = cur_offset + envelope_size;
6201 if 7 > max_ordinal {
6202 return Ok(());
6203 }
6204
6205 let cur_offset: usize = (7 - 1) * envelope_size;
6208
6209 encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
6211
6212 fidl::encoding::encode_in_envelope_optional::<fidl::encoding::Endpoint<fidl::endpoints::ClientEnd<AudioOffloadExtMarker>>, fidl::encoding::DefaultFuchsiaResourceDialect>(
6217 self.ext_audio_offload.as_mut().map(<fidl::encoding::Endpoint<fidl::endpoints::ClientEnd<AudioOffloadExtMarker>> as fidl::encoding::ResourceTypeMarker>::take_or_borrow),
6218 encoder, offset + cur_offset, depth
6219 )?;
6220
6221 _prev_end_offset = cur_offset + envelope_size;
6222 if 8 > max_ordinal {
6223 return Ok(());
6224 }
6225
6226 let cur_offset: usize = (8 - 1) * envelope_size;
6229
6230 encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
6232
6233 fidl::encoding::encode_in_envelope_optional::<
6238 fidl::encoding::Endpoint<
6239 fidl::endpoints::ClientEnd<fidl_fuchsia_bluetooth::ChannelMarker>,
6240 >,
6241 fidl::encoding::DefaultFuchsiaResourceDialect,
6242 >(
6243 self.connection.as_mut().map(
6244 <fidl::encoding::Endpoint<
6245 fidl::endpoints::ClientEnd<fidl_fuchsia_bluetooth::ChannelMarker>,
6246 > as fidl::encoding::ResourceTypeMarker>::take_or_borrow,
6247 ),
6248 encoder,
6249 offset + cur_offset,
6250 depth,
6251 )?;
6252
6253 _prev_end_offset = cur_offset + envelope_size;
6254
6255 Ok(())
6256 }
6257 }
6258
6259 impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect> for Channel {
6260 #[inline(always)]
6261 fn new_empty() -> Self {
6262 Self::default()
6263 }
6264
6265 unsafe fn decode(
6266 &mut self,
6267 decoder: &mut fidl::encoding::Decoder<
6268 '_,
6269 fidl::encoding::DefaultFuchsiaResourceDialect,
6270 >,
6271 offset: usize,
6272 mut depth: fidl::encoding::Depth,
6273 ) -> fidl::Result<()> {
6274 decoder.debug_check_bounds::<Self>(offset);
6275 let len = match fidl::encoding::decode_vector_header(decoder, offset)? {
6276 None => return Err(fidl::Error::NotNullable),
6277 Some(len) => len,
6278 };
6279 if len == 0 {
6281 return Ok(());
6282 };
6283 depth.increment()?;
6284 let envelope_size = 8;
6285 let bytes_len = len * envelope_size;
6286 let offset = decoder.out_of_line_offset(bytes_len)?;
6287 let mut _next_ordinal_to_read = 0;
6289 let mut next_offset = offset;
6290 let end_offset = offset + bytes_len;
6291 _next_ordinal_to_read += 1;
6292 if next_offset >= end_offset {
6293 return Ok(());
6294 }
6295
6296 while _next_ordinal_to_read < 1 {
6298 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
6299 _next_ordinal_to_read += 1;
6300 next_offset += envelope_size;
6301 }
6302
6303 let next_out_of_line = decoder.next_out_of_line();
6304 let handles_before = decoder.remaining_handles();
6305 if let Some((inlined, num_bytes, num_handles)) =
6306 fidl::encoding::decode_envelope_header(decoder, next_offset)?
6307 {
6308 let member_inline_size = <fidl::encoding::HandleType<
6309 fidl::Socket,
6310 { fidl::ObjectType::SOCKET.into_raw() },
6311 2147483648,
6312 > as fidl::encoding::TypeMarker>::inline_size(
6313 decoder.context
6314 );
6315 if inlined != (member_inline_size <= 4) {
6316 return Err(fidl::Error::InvalidInlineBitInEnvelope);
6317 }
6318 let inner_offset;
6319 let mut inner_depth = depth.clone();
6320 if inlined {
6321 decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
6322 inner_offset = next_offset;
6323 } else {
6324 inner_offset = decoder.out_of_line_offset(member_inline_size)?;
6325 inner_depth.increment()?;
6326 }
6327 let val_ref =
6328 self.socket.get_or_insert_with(|| fidl::new_empty!(fidl::encoding::HandleType<fidl::Socket, { fidl::ObjectType::SOCKET.into_raw() }, 2147483648>, fidl::encoding::DefaultFuchsiaResourceDialect));
6329 fidl::decode!(fidl::encoding::HandleType<fidl::Socket, { fidl::ObjectType::SOCKET.into_raw() }, 2147483648>, fidl::encoding::DefaultFuchsiaResourceDialect, val_ref, decoder, inner_offset, inner_depth)?;
6330 if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
6331 {
6332 return Err(fidl::Error::InvalidNumBytesInEnvelope);
6333 }
6334 if handles_before != decoder.remaining_handles() + (num_handles as usize) {
6335 return Err(fidl::Error::InvalidNumHandlesInEnvelope);
6336 }
6337 }
6338
6339 next_offset += envelope_size;
6340 _next_ordinal_to_read += 1;
6341 if next_offset >= end_offset {
6342 return Ok(());
6343 }
6344
6345 while _next_ordinal_to_read < 2 {
6347 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
6348 _next_ordinal_to_read += 1;
6349 next_offset += envelope_size;
6350 }
6351
6352 let next_out_of_line = decoder.next_out_of_line();
6353 let handles_before = decoder.remaining_handles();
6354 if let Some((inlined, num_bytes, num_handles)) =
6355 fidl::encoding::decode_envelope_header(decoder, next_offset)?
6356 {
6357 let member_inline_size = <fidl_fuchsia_bluetooth::ChannelMode as fidl::encoding::TypeMarker>::inline_size(decoder.context);
6358 if inlined != (member_inline_size <= 4) {
6359 return Err(fidl::Error::InvalidInlineBitInEnvelope);
6360 }
6361 let inner_offset;
6362 let mut inner_depth = depth.clone();
6363 if inlined {
6364 decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
6365 inner_offset = next_offset;
6366 } else {
6367 inner_offset = decoder.out_of_line_offset(member_inline_size)?;
6368 inner_depth.increment()?;
6369 }
6370 let val_ref = self.channel_mode.get_or_insert_with(|| {
6371 fidl::new_empty!(
6372 fidl_fuchsia_bluetooth::ChannelMode,
6373 fidl::encoding::DefaultFuchsiaResourceDialect
6374 )
6375 });
6376 fidl::decode!(
6377 fidl_fuchsia_bluetooth::ChannelMode,
6378 fidl::encoding::DefaultFuchsiaResourceDialect,
6379 val_ref,
6380 decoder,
6381 inner_offset,
6382 inner_depth
6383 )?;
6384 if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
6385 {
6386 return Err(fidl::Error::InvalidNumBytesInEnvelope);
6387 }
6388 if handles_before != decoder.remaining_handles() + (num_handles as usize) {
6389 return Err(fidl::Error::InvalidNumHandlesInEnvelope);
6390 }
6391 }
6392
6393 next_offset += envelope_size;
6394 _next_ordinal_to_read += 1;
6395 if next_offset >= end_offset {
6396 return Ok(());
6397 }
6398
6399 while _next_ordinal_to_read < 3 {
6401 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
6402 _next_ordinal_to_read += 1;
6403 next_offset += envelope_size;
6404 }
6405
6406 let next_out_of_line = decoder.next_out_of_line();
6407 let handles_before = decoder.remaining_handles();
6408 if let Some((inlined, num_bytes, num_handles)) =
6409 fidl::encoding::decode_envelope_header(decoder, next_offset)?
6410 {
6411 let member_inline_size =
6412 <u16 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.max_tx_sdu_size.get_or_insert_with(|| {
6426 fidl::new_empty!(u16, fidl::encoding::DefaultFuchsiaResourceDialect)
6427 });
6428 fidl::decode!(
6429 u16,
6430 fidl::encoding::DefaultFuchsiaResourceDialect,
6431 val_ref,
6432 decoder,
6433 inner_offset,
6434 inner_depth
6435 )?;
6436 if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
6437 {
6438 return Err(fidl::Error::InvalidNumBytesInEnvelope);
6439 }
6440 if handles_before != decoder.remaining_handles() + (num_handles as usize) {
6441 return Err(fidl::Error::InvalidNumHandlesInEnvelope);
6442 }
6443 }
6444
6445 next_offset += envelope_size;
6446 _next_ordinal_to_read += 1;
6447 if next_offset >= end_offset {
6448 return Ok(());
6449 }
6450
6451 while _next_ordinal_to_read < 4 {
6453 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
6454 _next_ordinal_to_read += 1;
6455 next_offset += envelope_size;
6456 }
6457
6458 let next_out_of_line = decoder.next_out_of_line();
6459 let handles_before = decoder.remaining_handles();
6460 if let Some((inlined, num_bytes, num_handles)) =
6461 fidl::encoding::decode_envelope_header(decoder, next_offset)?
6462 {
6463 let member_inline_size = <fidl::encoding::Endpoint<
6464 fidl::endpoints::ClientEnd<AudioDirectionExtMarker>,
6465 > as fidl::encoding::TypeMarker>::inline_size(
6466 decoder.context
6467 );
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.ext_direction.get_or_insert_with(|| {
6481 fidl::new_empty!(
6482 fidl::encoding::Endpoint<
6483 fidl::endpoints::ClientEnd<AudioDirectionExtMarker>,
6484 >,
6485 fidl::encoding::DefaultFuchsiaResourceDialect
6486 )
6487 });
6488 fidl::decode!(
6489 fidl::encoding::Endpoint<fidl::endpoints::ClientEnd<AudioDirectionExtMarker>>,
6490 fidl::encoding::DefaultFuchsiaResourceDialect,
6491 val_ref,
6492 decoder,
6493 inner_offset,
6494 inner_depth
6495 )?;
6496 if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
6497 {
6498 return Err(fidl::Error::InvalidNumBytesInEnvelope);
6499 }
6500 if handles_before != decoder.remaining_handles() + (num_handles as usize) {
6501 return Err(fidl::Error::InvalidNumHandlesInEnvelope);
6502 }
6503 }
6504
6505 next_offset += envelope_size;
6506 _next_ordinal_to_read += 1;
6507 if next_offset >= end_offset {
6508 return Ok(());
6509 }
6510
6511 while _next_ordinal_to_read < 5 {
6513 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
6514 _next_ordinal_to_read += 1;
6515 next_offset += envelope_size;
6516 }
6517
6518 let next_out_of_line = decoder.next_out_of_line();
6519 let handles_before = decoder.remaining_handles();
6520 if let Some((inlined, num_bytes, num_handles)) =
6521 fidl::encoding::decode_envelope_header(decoder, next_offset)?
6522 {
6523 let member_inline_size =
6524 <i64 as fidl::encoding::TypeMarker>::inline_size(decoder.context);
6525 if inlined != (member_inline_size <= 4) {
6526 return Err(fidl::Error::InvalidInlineBitInEnvelope);
6527 }
6528 let inner_offset;
6529 let mut inner_depth = depth.clone();
6530 if inlined {
6531 decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
6532 inner_offset = next_offset;
6533 } else {
6534 inner_offset = decoder.out_of_line_offset(member_inline_size)?;
6535 inner_depth.increment()?;
6536 }
6537 let val_ref = self.flush_timeout.get_or_insert_with(|| {
6538 fidl::new_empty!(i64, fidl::encoding::DefaultFuchsiaResourceDialect)
6539 });
6540 fidl::decode!(
6541 i64,
6542 fidl::encoding::DefaultFuchsiaResourceDialect,
6543 val_ref,
6544 decoder,
6545 inner_offset,
6546 inner_depth
6547 )?;
6548 if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
6549 {
6550 return Err(fidl::Error::InvalidNumBytesInEnvelope);
6551 }
6552 if handles_before != decoder.remaining_handles() + (num_handles as usize) {
6553 return Err(fidl::Error::InvalidNumHandlesInEnvelope);
6554 }
6555 }
6556
6557 next_offset += envelope_size;
6558 _next_ordinal_to_read += 1;
6559 if next_offset >= end_offset {
6560 return Ok(());
6561 }
6562
6563 while _next_ordinal_to_read < 6 {
6565 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
6566 _next_ordinal_to_read += 1;
6567 next_offset += envelope_size;
6568 }
6569
6570 let next_out_of_line = decoder.next_out_of_line();
6571 let handles_before = decoder.remaining_handles();
6572 if let Some((inlined, num_bytes, num_handles)) =
6573 fidl::encoding::decode_envelope_header(decoder, next_offset)?
6574 {
6575 let member_inline_size = <fidl::encoding::Endpoint<
6576 fidl::endpoints::ClientEnd<L2capParametersExtMarker>,
6577 > as fidl::encoding::TypeMarker>::inline_size(
6578 decoder.context
6579 );
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.ext_l2cap.get_or_insert_with(|| {
6593 fidl::new_empty!(
6594 fidl::encoding::Endpoint<
6595 fidl::endpoints::ClientEnd<L2capParametersExtMarker>,
6596 >,
6597 fidl::encoding::DefaultFuchsiaResourceDialect
6598 )
6599 });
6600 fidl::decode!(
6601 fidl::encoding::Endpoint<fidl::endpoints::ClientEnd<L2capParametersExtMarker>>,
6602 fidl::encoding::DefaultFuchsiaResourceDialect,
6603 val_ref,
6604 decoder,
6605 inner_offset,
6606 inner_depth
6607 )?;
6608 if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
6609 {
6610 return Err(fidl::Error::InvalidNumBytesInEnvelope);
6611 }
6612 if handles_before != decoder.remaining_handles() + (num_handles as usize) {
6613 return Err(fidl::Error::InvalidNumHandlesInEnvelope);
6614 }
6615 }
6616
6617 next_offset += envelope_size;
6618 _next_ordinal_to_read += 1;
6619 if next_offset >= end_offset {
6620 return Ok(());
6621 }
6622
6623 while _next_ordinal_to_read < 7 {
6625 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
6626 _next_ordinal_to_read += 1;
6627 next_offset += envelope_size;
6628 }
6629
6630 let next_out_of_line = decoder.next_out_of_line();
6631 let handles_before = decoder.remaining_handles();
6632 if let Some((inlined, num_bytes, num_handles)) =
6633 fidl::encoding::decode_envelope_header(decoder, next_offset)?
6634 {
6635 let member_inline_size = <fidl::encoding::Endpoint<
6636 fidl::endpoints::ClientEnd<AudioOffloadExtMarker>,
6637 > as fidl::encoding::TypeMarker>::inline_size(
6638 decoder.context
6639 );
6640 if inlined != (member_inline_size <= 4) {
6641 return Err(fidl::Error::InvalidInlineBitInEnvelope);
6642 }
6643 let inner_offset;
6644 let mut inner_depth = depth.clone();
6645 if inlined {
6646 decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
6647 inner_offset = next_offset;
6648 } else {
6649 inner_offset = decoder.out_of_line_offset(member_inline_size)?;
6650 inner_depth.increment()?;
6651 }
6652 let val_ref = self.ext_audio_offload.get_or_insert_with(|| {
6653 fidl::new_empty!(
6654 fidl::encoding::Endpoint<fidl::endpoints::ClientEnd<AudioOffloadExtMarker>>,
6655 fidl::encoding::DefaultFuchsiaResourceDialect
6656 )
6657 });
6658 fidl::decode!(
6659 fidl::encoding::Endpoint<fidl::endpoints::ClientEnd<AudioOffloadExtMarker>>,
6660 fidl::encoding::DefaultFuchsiaResourceDialect,
6661 val_ref,
6662 decoder,
6663 inner_offset,
6664 inner_depth
6665 )?;
6666 if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
6667 {
6668 return Err(fidl::Error::InvalidNumBytesInEnvelope);
6669 }
6670 if handles_before != decoder.remaining_handles() + (num_handles as usize) {
6671 return Err(fidl::Error::InvalidNumHandlesInEnvelope);
6672 }
6673 }
6674
6675 next_offset += envelope_size;
6676 _next_ordinal_to_read += 1;
6677 if next_offset >= end_offset {
6678 return Ok(());
6679 }
6680
6681 while _next_ordinal_to_read < 8 {
6683 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
6684 _next_ordinal_to_read += 1;
6685 next_offset += envelope_size;
6686 }
6687
6688 let next_out_of_line = decoder.next_out_of_line();
6689 let handles_before = decoder.remaining_handles();
6690 if let Some((inlined, num_bytes, num_handles)) =
6691 fidl::encoding::decode_envelope_header(decoder, next_offset)?
6692 {
6693 let member_inline_size = <fidl::encoding::Endpoint<
6694 fidl::endpoints::ClientEnd<fidl_fuchsia_bluetooth::ChannelMarker>,
6695 > as fidl::encoding::TypeMarker>::inline_size(
6696 decoder.context
6697 );
6698 if inlined != (member_inline_size <= 4) {
6699 return Err(fidl::Error::InvalidInlineBitInEnvelope);
6700 }
6701 let inner_offset;
6702 let mut inner_depth = depth.clone();
6703 if inlined {
6704 decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
6705 inner_offset = next_offset;
6706 } else {
6707 inner_offset = decoder.out_of_line_offset(member_inline_size)?;
6708 inner_depth.increment()?;
6709 }
6710 let val_ref = self.connection.get_or_insert_with(|| {
6711 fidl::new_empty!(
6712 fidl::encoding::Endpoint<
6713 fidl::endpoints::ClientEnd<fidl_fuchsia_bluetooth::ChannelMarker>,
6714 >,
6715 fidl::encoding::DefaultFuchsiaResourceDialect
6716 )
6717 });
6718 fidl::decode!(
6719 fidl::encoding::Endpoint<
6720 fidl::endpoints::ClientEnd<fidl_fuchsia_bluetooth::ChannelMarker>,
6721 >,
6722 fidl::encoding::DefaultFuchsiaResourceDialect,
6723 val_ref,
6724 decoder,
6725 inner_offset,
6726 inner_depth
6727 )?;
6728 if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
6729 {
6730 return Err(fidl::Error::InvalidNumBytesInEnvelope);
6731 }
6732 if handles_before != decoder.remaining_handles() + (num_handles as usize) {
6733 return Err(fidl::Error::InvalidNumHandlesInEnvelope);
6734 }
6735 }
6736
6737 next_offset += envelope_size;
6738
6739 while next_offset < end_offset {
6741 _next_ordinal_to_read += 1;
6742 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
6743 next_offset += envelope_size;
6744 }
6745
6746 Ok(())
6747 }
6748 }
6749
6750 impl ConnectionReceiver2ConnectedRequest {
6751 #[inline(always)]
6752 fn max_ordinal_present(&self) -> u64 {
6753 if let Some(_) = self.protocol {
6754 return 3;
6755 }
6756 if let Some(_) = self.channel {
6757 return 2;
6758 }
6759 if let Some(_) = self.peer_id {
6760 return 1;
6761 }
6762 0
6763 }
6764 }
6765
6766 impl fidl::encoding::ResourceTypeMarker for ConnectionReceiver2ConnectedRequest {
6767 type Borrowed<'a> = &'a mut Self;
6768 fn take_or_borrow<'a>(
6769 value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
6770 ) -> Self::Borrowed<'a> {
6771 value
6772 }
6773 }
6774
6775 unsafe impl fidl::encoding::TypeMarker for ConnectionReceiver2ConnectedRequest {
6776 type Owned = Self;
6777
6778 #[inline(always)]
6779 fn inline_align(_context: fidl::encoding::Context) -> usize {
6780 8
6781 }
6782
6783 #[inline(always)]
6784 fn inline_size(_context: fidl::encoding::Context) -> usize {
6785 16
6786 }
6787 }
6788
6789 unsafe impl
6790 fidl::encoding::Encode<
6791 ConnectionReceiver2ConnectedRequest,
6792 fidl::encoding::DefaultFuchsiaResourceDialect,
6793 > for &mut ConnectionReceiver2ConnectedRequest
6794 {
6795 unsafe fn encode(
6796 self,
6797 encoder: &mut fidl::encoding::Encoder<
6798 '_,
6799 fidl::encoding::DefaultFuchsiaResourceDialect,
6800 >,
6801 offset: usize,
6802 mut depth: fidl::encoding::Depth,
6803 ) -> fidl::Result<()> {
6804 encoder.debug_check_bounds::<ConnectionReceiver2ConnectedRequest>(offset);
6805 let max_ordinal: u64 = self.max_ordinal_present();
6807 encoder.write_num(max_ordinal, offset);
6808 encoder.write_num(fidl::encoding::ALLOC_PRESENT_U64, offset + 8);
6809 if max_ordinal == 0 {
6811 return Ok(());
6812 }
6813 depth.increment()?;
6814 let envelope_size = 8;
6815 let bytes_len = max_ordinal as usize * envelope_size;
6816 #[allow(unused_variables)]
6817 let offset = encoder.out_of_line_offset(bytes_len);
6818 let mut _prev_end_offset: usize = 0;
6819 if 1 > max_ordinal {
6820 return Ok(());
6821 }
6822
6823 let cur_offset: usize = (1 - 1) * envelope_size;
6826
6827 encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
6829
6830 fidl::encoding::encode_in_envelope_optional::<
6835 fidl_fuchsia_bluetooth::PeerId,
6836 fidl::encoding::DefaultFuchsiaResourceDialect,
6837 >(
6838 self.peer_id.as_ref().map(
6839 <fidl_fuchsia_bluetooth::PeerId as fidl::encoding::ValueTypeMarker>::borrow,
6840 ),
6841 encoder,
6842 offset + cur_offset,
6843 depth,
6844 )?;
6845
6846 _prev_end_offset = cur_offset + envelope_size;
6847 if 2 > max_ordinal {
6848 return Ok(());
6849 }
6850
6851 let cur_offset: usize = (2 - 1) * envelope_size;
6854
6855 encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
6857
6858 fidl::encoding::encode_in_envelope_optional::<
6863 Channel,
6864 fidl::encoding::DefaultFuchsiaResourceDialect,
6865 >(
6866 self.channel
6867 .as_mut()
6868 .map(<Channel as fidl::encoding::ResourceTypeMarker>::take_or_borrow),
6869 encoder,
6870 offset + cur_offset,
6871 depth,
6872 )?;
6873
6874 _prev_end_offset = cur_offset + envelope_size;
6875 if 3 > max_ordinal {
6876 return Ok(());
6877 }
6878
6879 let cur_offset: usize = (3 - 1) * envelope_size;
6882
6883 encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
6885
6886 fidl::encoding::encode_in_envelope_optional::<fidl::encoding::Vector<ProtocolDescriptor, 255>, fidl::encoding::DefaultFuchsiaResourceDialect>(
6891 self.protocol.as_ref().map(<fidl::encoding::Vector<ProtocolDescriptor, 255> as fidl::encoding::ValueTypeMarker>::borrow),
6892 encoder, offset + cur_offset, depth
6893 )?;
6894
6895 _prev_end_offset = cur_offset + envelope_size;
6896
6897 Ok(())
6898 }
6899 }
6900
6901 impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
6902 for ConnectionReceiver2ConnectedRequest
6903 {
6904 #[inline(always)]
6905 fn new_empty() -> Self {
6906 Self::default()
6907 }
6908
6909 unsafe fn decode(
6910 &mut self,
6911 decoder: &mut fidl::encoding::Decoder<
6912 '_,
6913 fidl::encoding::DefaultFuchsiaResourceDialect,
6914 >,
6915 offset: usize,
6916 mut depth: fidl::encoding::Depth,
6917 ) -> fidl::Result<()> {
6918 decoder.debug_check_bounds::<Self>(offset);
6919 let len = match fidl::encoding::decode_vector_header(decoder, offset)? {
6920 None => return Err(fidl::Error::NotNullable),
6921 Some(len) => len,
6922 };
6923 if len == 0 {
6925 return Ok(());
6926 };
6927 depth.increment()?;
6928 let envelope_size = 8;
6929 let bytes_len = len * envelope_size;
6930 let offset = decoder.out_of_line_offset(bytes_len)?;
6931 let mut _next_ordinal_to_read = 0;
6933 let mut next_offset = offset;
6934 let end_offset = offset + bytes_len;
6935 _next_ordinal_to_read += 1;
6936 if next_offset >= end_offset {
6937 return Ok(());
6938 }
6939
6940 while _next_ordinal_to_read < 1 {
6942 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
6943 _next_ordinal_to_read += 1;
6944 next_offset += envelope_size;
6945 }
6946
6947 let next_out_of_line = decoder.next_out_of_line();
6948 let handles_before = decoder.remaining_handles();
6949 if let Some((inlined, num_bytes, num_handles)) =
6950 fidl::encoding::decode_envelope_header(decoder, next_offset)?
6951 {
6952 let member_inline_size =
6953 <fidl_fuchsia_bluetooth::PeerId as fidl::encoding::TypeMarker>::inline_size(
6954 decoder.context,
6955 );
6956 if inlined != (member_inline_size <= 4) {
6957 return Err(fidl::Error::InvalidInlineBitInEnvelope);
6958 }
6959 let inner_offset;
6960 let mut inner_depth = depth.clone();
6961 if inlined {
6962 decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
6963 inner_offset = next_offset;
6964 } else {
6965 inner_offset = decoder.out_of_line_offset(member_inline_size)?;
6966 inner_depth.increment()?;
6967 }
6968 let val_ref = self.peer_id.get_or_insert_with(|| {
6969 fidl::new_empty!(
6970 fidl_fuchsia_bluetooth::PeerId,
6971 fidl::encoding::DefaultFuchsiaResourceDialect
6972 )
6973 });
6974 fidl::decode!(
6975 fidl_fuchsia_bluetooth::PeerId,
6976 fidl::encoding::DefaultFuchsiaResourceDialect,
6977 val_ref,
6978 decoder,
6979 inner_offset,
6980 inner_depth
6981 )?;
6982 if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
6983 {
6984 return Err(fidl::Error::InvalidNumBytesInEnvelope);
6985 }
6986 if handles_before != decoder.remaining_handles() + (num_handles as usize) {
6987 return Err(fidl::Error::InvalidNumHandlesInEnvelope);
6988 }
6989 }
6990
6991 next_offset += envelope_size;
6992 _next_ordinal_to_read += 1;
6993 if next_offset >= end_offset {
6994 return Ok(());
6995 }
6996
6997 while _next_ordinal_to_read < 2 {
6999 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
7000 _next_ordinal_to_read += 1;
7001 next_offset += envelope_size;
7002 }
7003
7004 let next_out_of_line = decoder.next_out_of_line();
7005 let handles_before = decoder.remaining_handles();
7006 if let Some((inlined, num_bytes, num_handles)) =
7007 fidl::encoding::decode_envelope_header(decoder, next_offset)?
7008 {
7009 let member_inline_size =
7010 <Channel as fidl::encoding::TypeMarker>::inline_size(decoder.context);
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.channel.get_or_insert_with(|| {
7024 fidl::new_empty!(Channel, fidl::encoding::DefaultFuchsiaResourceDialect)
7025 });
7026 fidl::decode!(
7027 Channel,
7028 fidl::encoding::DefaultFuchsiaResourceDialect,
7029 val_ref,
7030 decoder,
7031 inner_offset,
7032 inner_depth
7033 )?;
7034 if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
7035 {
7036 return Err(fidl::Error::InvalidNumBytesInEnvelope);
7037 }
7038 if handles_before != decoder.remaining_handles() + (num_handles as usize) {
7039 return Err(fidl::Error::InvalidNumHandlesInEnvelope);
7040 }
7041 }
7042
7043 next_offset += envelope_size;
7044 _next_ordinal_to_read += 1;
7045 if next_offset >= end_offset {
7046 return Ok(());
7047 }
7048
7049 while _next_ordinal_to_read < 3 {
7051 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
7052 _next_ordinal_to_read += 1;
7053 next_offset += envelope_size;
7054 }
7055
7056 let next_out_of_line = decoder.next_out_of_line();
7057 let handles_before = decoder.remaining_handles();
7058 if let Some((inlined, num_bytes, num_handles)) =
7059 fidl::encoding::decode_envelope_header(decoder, next_offset)?
7060 {
7061 let member_inline_size = <fidl::encoding::Vector<ProtocolDescriptor, 255> as fidl::encoding::TypeMarker>::inline_size(decoder.context);
7062 if inlined != (member_inline_size <= 4) {
7063 return Err(fidl::Error::InvalidInlineBitInEnvelope);
7064 }
7065 let inner_offset;
7066 let mut inner_depth = depth.clone();
7067 if inlined {
7068 decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
7069 inner_offset = next_offset;
7070 } else {
7071 inner_offset = decoder.out_of_line_offset(member_inline_size)?;
7072 inner_depth.increment()?;
7073 }
7074 let val_ref =
7075 self.protocol.get_or_insert_with(|| fidl::new_empty!(fidl::encoding::Vector<ProtocolDescriptor, 255>, fidl::encoding::DefaultFuchsiaResourceDialect));
7076 fidl::decode!(fidl::encoding::Vector<ProtocolDescriptor, 255>, fidl::encoding::DefaultFuchsiaResourceDialect, val_ref, decoder, inner_offset, inner_depth)?;
7077 if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
7078 {
7079 return Err(fidl::Error::InvalidNumBytesInEnvelope);
7080 }
7081 if handles_before != decoder.remaining_handles() + (num_handles as usize) {
7082 return Err(fidl::Error::InvalidNumHandlesInEnvelope);
7083 }
7084 }
7085
7086 next_offset += envelope_size;
7087
7088 while next_offset < end_offset {
7090 _next_ordinal_to_read += 1;
7091 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
7092 next_offset += envelope_size;
7093 }
7094
7095 Ok(())
7096 }
7097 }
7098
7099 impl ProfileAdvertiseRequest {
7100 #[inline(always)]
7101 fn max_ordinal_present(&self) -> u64 {
7102 if let Some(_) = self.connection_receiver {
7103 return 4;
7104 }
7105 if let Some(_) = self.parameters {
7106 return 3;
7107 }
7108 if let Some(_) = self.receiver {
7109 return 2;
7110 }
7111 if let Some(_) = self.services {
7112 return 1;
7113 }
7114 0
7115 }
7116 }
7117
7118 impl fidl::encoding::ResourceTypeMarker for ProfileAdvertiseRequest {
7119 type Borrowed<'a> = &'a mut Self;
7120 fn take_or_borrow<'a>(
7121 value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
7122 ) -> Self::Borrowed<'a> {
7123 value
7124 }
7125 }
7126
7127 unsafe impl fidl::encoding::TypeMarker for ProfileAdvertiseRequest {
7128 type Owned = Self;
7129
7130 #[inline(always)]
7131 fn inline_align(_context: fidl::encoding::Context) -> usize {
7132 8
7133 }
7134
7135 #[inline(always)]
7136 fn inline_size(_context: fidl::encoding::Context) -> usize {
7137 16
7138 }
7139 }
7140
7141 unsafe impl
7142 fidl::encoding::Encode<
7143 ProfileAdvertiseRequest,
7144 fidl::encoding::DefaultFuchsiaResourceDialect,
7145 > for &mut ProfileAdvertiseRequest
7146 {
7147 unsafe fn encode(
7148 self,
7149 encoder: &mut fidl::encoding::Encoder<
7150 '_,
7151 fidl::encoding::DefaultFuchsiaResourceDialect,
7152 >,
7153 offset: usize,
7154 mut depth: fidl::encoding::Depth,
7155 ) -> fidl::Result<()> {
7156 encoder.debug_check_bounds::<ProfileAdvertiseRequest>(offset);
7157 let max_ordinal: u64 = self.max_ordinal_present();
7159 encoder.write_num(max_ordinal, offset);
7160 encoder.write_num(fidl::encoding::ALLOC_PRESENT_U64, offset + 8);
7161 if max_ordinal == 0 {
7163 return Ok(());
7164 }
7165 depth.increment()?;
7166 let envelope_size = 8;
7167 let bytes_len = max_ordinal as usize * envelope_size;
7168 #[allow(unused_variables)]
7169 let offset = encoder.out_of_line_offset(bytes_len);
7170 let mut _prev_end_offset: usize = 0;
7171 if 1 > max_ordinal {
7172 return Ok(());
7173 }
7174
7175 let cur_offset: usize = (1 - 1) * envelope_size;
7178
7179 encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
7181
7182 fidl::encoding::encode_in_envelope_optional::<fidl::encoding::Vector<ServiceDefinition, 32>, fidl::encoding::DefaultFuchsiaResourceDialect>(
7187 self.services.as_ref().map(<fidl::encoding::Vector<ServiceDefinition, 32> as fidl::encoding::ValueTypeMarker>::borrow),
7188 encoder, offset + cur_offset, depth
7189 )?;
7190
7191 _prev_end_offset = cur_offset + envelope_size;
7192 if 2 > max_ordinal {
7193 return Ok(());
7194 }
7195
7196 let cur_offset: usize = (2 - 1) * envelope_size;
7199
7200 encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
7202
7203 fidl::encoding::encode_in_envelope_optional::<fidl::encoding::Endpoint<fidl::endpoints::ClientEnd<ConnectionReceiverMarker>>, fidl::encoding::DefaultFuchsiaResourceDialect>(
7208 self.receiver.as_mut().map(<fidl::encoding::Endpoint<fidl::endpoints::ClientEnd<ConnectionReceiverMarker>> as fidl::encoding::ResourceTypeMarker>::take_or_borrow),
7209 encoder, offset + cur_offset, depth
7210 )?;
7211
7212 _prev_end_offset = cur_offset + envelope_size;
7213 if 3 > max_ordinal {
7214 return Ok(());
7215 }
7216
7217 let cur_offset: usize = (3 - 1) * envelope_size;
7220
7221 encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
7223
7224 fidl::encoding::encode_in_envelope_optional::<fidl_fuchsia_bluetooth::ChannelParameters, fidl::encoding::DefaultFuchsiaResourceDialect>(
7229 self.parameters.as_ref().map(<fidl_fuchsia_bluetooth::ChannelParameters as fidl::encoding::ValueTypeMarker>::borrow),
7230 encoder, offset + cur_offset, depth
7231 )?;
7232
7233 _prev_end_offset = cur_offset + envelope_size;
7234 if 4 > max_ordinal {
7235 return Ok(());
7236 }
7237
7238 let cur_offset: usize = (4 - 1) * envelope_size;
7241
7242 encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
7244
7245 fidl::encoding::encode_in_envelope_optional::<fidl::encoding::Endpoint<fidl::endpoints::ClientEnd<ConnectionReceiver2Marker>>, fidl::encoding::DefaultFuchsiaResourceDialect>(
7250 self.connection_receiver.as_mut().map(<fidl::encoding::Endpoint<fidl::endpoints::ClientEnd<ConnectionReceiver2Marker>> as fidl::encoding::ResourceTypeMarker>::take_or_borrow),
7251 encoder, offset + cur_offset, depth
7252 )?;
7253
7254 _prev_end_offset = cur_offset + envelope_size;
7255
7256 Ok(())
7257 }
7258 }
7259
7260 impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
7261 for ProfileAdvertiseRequest
7262 {
7263 #[inline(always)]
7264 fn new_empty() -> Self {
7265 Self::default()
7266 }
7267
7268 unsafe fn decode(
7269 &mut self,
7270 decoder: &mut fidl::encoding::Decoder<
7271 '_,
7272 fidl::encoding::DefaultFuchsiaResourceDialect,
7273 >,
7274 offset: usize,
7275 mut depth: fidl::encoding::Depth,
7276 ) -> fidl::Result<()> {
7277 decoder.debug_check_bounds::<Self>(offset);
7278 let len = match fidl::encoding::decode_vector_header(decoder, offset)? {
7279 None => return Err(fidl::Error::NotNullable),
7280 Some(len) => len,
7281 };
7282 if len == 0 {
7284 return Ok(());
7285 };
7286 depth.increment()?;
7287 let envelope_size = 8;
7288 let bytes_len = len * envelope_size;
7289 let offset = decoder.out_of_line_offset(bytes_len)?;
7290 let mut _next_ordinal_to_read = 0;
7292 let mut next_offset = offset;
7293 let end_offset = offset + bytes_len;
7294 _next_ordinal_to_read += 1;
7295 if next_offset >= end_offset {
7296 return Ok(());
7297 }
7298
7299 while _next_ordinal_to_read < 1 {
7301 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
7302 _next_ordinal_to_read += 1;
7303 next_offset += envelope_size;
7304 }
7305
7306 let next_out_of_line = decoder.next_out_of_line();
7307 let handles_before = decoder.remaining_handles();
7308 if let Some((inlined, num_bytes, num_handles)) =
7309 fidl::encoding::decode_envelope_header(decoder, next_offset)?
7310 {
7311 let member_inline_size = <fidl::encoding::Vector<ServiceDefinition, 32> as fidl::encoding::TypeMarker>::inline_size(decoder.context);
7312 if inlined != (member_inline_size <= 4) {
7313 return Err(fidl::Error::InvalidInlineBitInEnvelope);
7314 }
7315 let inner_offset;
7316 let mut inner_depth = depth.clone();
7317 if inlined {
7318 decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
7319 inner_offset = next_offset;
7320 } else {
7321 inner_offset = decoder.out_of_line_offset(member_inline_size)?;
7322 inner_depth.increment()?;
7323 }
7324 let val_ref =
7325 self.services.get_or_insert_with(|| fidl::new_empty!(fidl::encoding::Vector<ServiceDefinition, 32>, fidl::encoding::DefaultFuchsiaResourceDialect));
7326 fidl::decode!(fidl::encoding::Vector<ServiceDefinition, 32>, fidl::encoding::DefaultFuchsiaResourceDialect, val_ref, decoder, inner_offset, inner_depth)?;
7327 if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
7328 {
7329 return Err(fidl::Error::InvalidNumBytesInEnvelope);
7330 }
7331 if handles_before != decoder.remaining_handles() + (num_handles as usize) {
7332 return Err(fidl::Error::InvalidNumHandlesInEnvelope);
7333 }
7334 }
7335
7336 next_offset += envelope_size;
7337 _next_ordinal_to_read += 1;
7338 if next_offset >= end_offset {
7339 return Ok(());
7340 }
7341
7342 while _next_ordinal_to_read < 2 {
7344 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
7345 _next_ordinal_to_read += 1;
7346 next_offset += envelope_size;
7347 }
7348
7349 let next_out_of_line = decoder.next_out_of_line();
7350 let handles_before = decoder.remaining_handles();
7351 if let Some((inlined, num_bytes, num_handles)) =
7352 fidl::encoding::decode_envelope_header(decoder, next_offset)?
7353 {
7354 let member_inline_size = <fidl::encoding::Endpoint<
7355 fidl::endpoints::ClientEnd<ConnectionReceiverMarker>,
7356 > as fidl::encoding::TypeMarker>::inline_size(
7357 decoder.context
7358 );
7359 if inlined != (member_inline_size <= 4) {
7360 return Err(fidl::Error::InvalidInlineBitInEnvelope);
7361 }
7362 let inner_offset;
7363 let mut inner_depth = depth.clone();
7364 if inlined {
7365 decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
7366 inner_offset = next_offset;
7367 } else {
7368 inner_offset = decoder.out_of_line_offset(member_inline_size)?;
7369 inner_depth.increment()?;
7370 }
7371 let val_ref = self.receiver.get_or_insert_with(|| {
7372 fidl::new_empty!(
7373 fidl::encoding::Endpoint<
7374 fidl::endpoints::ClientEnd<ConnectionReceiverMarker>,
7375 >,
7376 fidl::encoding::DefaultFuchsiaResourceDialect
7377 )
7378 });
7379 fidl::decode!(
7380 fidl::encoding::Endpoint<fidl::endpoints::ClientEnd<ConnectionReceiverMarker>>,
7381 fidl::encoding::DefaultFuchsiaResourceDialect,
7382 val_ref,
7383 decoder,
7384 inner_offset,
7385 inner_depth
7386 )?;
7387 if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
7388 {
7389 return Err(fidl::Error::InvalidNumBytesInEnvelope);
7390 }
7391 if handles_before != decoder.remaining_handles() + (num_handles as usize) {
7392 return Err(fidl::Error::InvalidNumHandlesInEnvelope);
7393 }
7394 }
7395
7396 next_offset += envelope_size;
7397 _next_ordinal_to_read += 1;
7398 if next_offset >= end_offset {
7399 return Ok(());
7400 }
7401
7402 while _next_ordinal_to_read < 3 {
7404 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
7405 _next_ordinal_to_read += 1;
7406 next_offset += envelope_size;
7407 }
7408
7409 let next_out_of_line = decoder.next_out_of_line();
7410 let handles_before = decoder.remaining_handles();
7411 if let Some((inlined, num_bytes, num_handles)) =
7412 fidl::encoding::decode_envelope_header(decoder, next_offset)?
7413 {
7414 let member_inline_size = <fidl_fuchsia_bluetooth::ChannelParameters as fidl::encoding::TypeMarker>::inline_size(decoder.context);
7415 if inlined != (member_inline_size <= 4) {
7416 return Err(fidl::Error::InvalidInlineBitInEnvelope);
7417 }
7418 let inner_offset;
7419 let mut inner_depth = depth.clone();
7420 if inlined {
7421 decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
7422 inner_offset = next_offset;
7423 } else {
7424 inner_offset = decoder.out_of_line_offset(member_inline_size)?;
7425 inner_depth.increment()?;
7426 }
7427 let val_ref = self.parameters.get_or_insert_with(|| {
7428 fidl::new_empty!(
7429 fidl_fuchsia_bluetooth::ChannelParameters,
7430 fidl::encoding::DefaultFuchsiaResourceDialect
7431 )
7432 });
7433 fidl::decode!(
7434 fidl_fuchsia_bluetooth::ChannelParameters,
7435 fidl::encoding::DefaultFuchsiaResourceDialect,
7436 val_ref,
7437 decoder,
7438 inner_offset,
7439 inner_depth
7440 )?;
7441 if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
7442 {
7443 return Err(fidl::Error::InvalidNumBytesInEnvelope);
7444 }
7445 if handles_before != decoder.remaining_handles() + (num_handles as usize) {
7446 return Err(fidl::Error::InvalidNumHandlesInEnvelope);
7447 }
7448 }
7449
7450 next_offset += envelope_size;
7451 _next_ordinal_to_read += 1;
7452 if next_offset >= end_offset {
7453 return Ok(());
7454 }
7455
7456 while _next_ordinal_to_read < 4 {
7458 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
7459 _next_ordinal_to_read += 1;
7460 next_offset += envelope_size;
7461 }
7462
7463 let next_out_of_line = decoder.next_out_of_line();
7464 let handles_before = decoder.remaining_handles();
7465 if let Some((inlined, num_bytes, num_handles)) =
7466 fidl::encoding::decode_envelope_header(decoder, next_offset)?
7467 {
7468 let member_inline_size = <fidl::encoding::Endpoint<
7469 fidl::endpoints::ClientEnd<ConnectionReceiver2Marker>,
7470 > as fidl::encoding::TypeMarker>::inline_size(
7471 decoder.context
7472 );
7473 if inlined != (member_inline_size <= 4) {
7474 return Err(fidl::Error::InvalidInlineBitInEnvelope);
7475 }
7476 let inner_offset;
7477 let mut inner_depth = depth.clone();
7478 if inlined {
7479 decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
7480 inner_offset = next_offset;
7481 } else {
7482 inner_offset = decoder.out_of_line_offset(member_inline_size)?;
7483 inner_depth.increment()?;
7484 }
7485 let val_ref = self.connection_receiver.get_or_insert_with(|| {
7486 fidl::new_empty!(
7487 fidl::encoding::Endpoint<
7488 fidl::endpoints::ClientEnd<ConnectionReceiver2Marker>,
7489 >,
7490 fidl::encoding::DefaultFuchsiaResourceDialect
7491 )
7492 });
7493 fidl::decode!(
7494 fidl::encoding::Endpoint<fidl::endpoints::ClientEnd<ConnectionReceiver2Marker>>,
7495 fidl::encoding::DefaultFuchsiaResourceDialect,
7496 val_ref,
7497 decoder,
7498 inner_offset,
7499 inner_depth
7500 )?;
7501 if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
7502 {
7503 return Err(fidl::Error::InvalidNumBytesInEnvelope);
7504 }
7505 if handles_before != decoder.remaining_handles() + (num_handles as usize) {
7506 return Err(fidl::Error::InvalidNumHandlesInEnvelope);
7507 }
7508 }
7509
7510 next_offset += envelope_size;
7511
7512 while next_offset < end_offset {
7514 _next_ordinal_to_read += 1;
7515 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
7516 next_offset += envelope_size;
7517 }
7518
7519 Ok(())
7520 }
7521 }
7522
7523 impl ProfileConnectScoRequest {
7524 #[inline(always)]
7525 fn max_ordinal_present(&self) -> u64 {
7526 if let Some(_) = self.connection {
7527 return 4;
7528 }
7529 if let Some(_) = self.params {
7530 return 3;
7531 }
7532 if let Some(_) = self.initiator {
7533 return 2;
7534 }
7535 if let Some(_) = self.peer_id {
7536 return 1;
7537 }
7538 0
7539 }
7540 }
7541
7542 impl fidl::encoding::ResourceTypeMarker for ProfileConnectScoRequest {
7543 type Borrowed<'a> = &'a mut Self;
7544 fn take_or_borrow<'a>(
7545 value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
7546 ) -> Self::Borrowed<'a> {
7547 value
7548 }
7549 }
7550
7551 unsafe impl fidl::encoding::TypeMarker for ProfileConnectScoRequest {
7552 type Owned = Self;
7553
7554 #[inline(always)]
7555 fn inline_align(_context: fidl::encoding::Context) -> usize {
7556 8
7557 }
7558
7559 #[inline(always)]
7560 fn inline_size(_context: fidl::encoding::Context) -> usize {
7561 16
7562 }
7563 }
7564
7565 unsafe impl
7566 fidl::encoding::Encode<
7567 ProfileConnectScoRequest,
7568 fidl::encoding::DefaultFuchsiaResourceDialect,
7569 > for &mut ProfileConnectScoRequest
7570 {
7571 unsafe fn encode(
7572 self,
7573 encoder: &mut fidl::encoding::Encoder<
7574 '_,
7575 fidl::encoding::DefaultFuchsiaResourceDialect,
7576 >,
7577 offset: usize,
7578 mut depth: fidl::encoding::Depth,
7579 ) -> fidl::Result<()> {
7580 encoder.debug_check_bounds::<ProfileConnectScoRequest>(offset);
7581 let max_ordinal: u64 = self.max_ordinal_present();
7583 encoder.write_num(max_ordinal, offset);
7584 encoder.write_num(fidl::encoding::ALLOC_PRESENT_U64, offset + 8);
7585 if max_ordinal == 0 {
7587 return Ok(());
7588 }
7589 depth.increment()?;
7590 let envelope_size = 8;
7591 let bytes_len = max_ordinal as usize * envelope_size;
7592 #[allow(unused_variables)]
7593 let offset = encoder.out_of_line_offset(bytes_len);
7594 let mut _prev_end_offset: usize = 0;
7595 if 1 > max_ordinal {
7596 return Ok(());
7597 }
7598
7599 let cur_offset: usize = (1 - 1) * envelope_size;
7602
7603 encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
7605
7606 fidl::encoding::encode_in_envelope_optional::<
7611 fidl_fuchsia_bluetooth::PeerId,
7612 fidl::encoding::DefaultFuchsiaResourceDialect,
7613 >(
7614 self.peer_id.as_ref().map(
7615 <fidl_fuchsia_bluetooth::PeerId as fidl::encoding::ValueTypeMarker>::borrow,
7616 ),
7617 encoder,
7618 offset + cur_offset,
7619 depth,
7620 )?;
7621
7622 _prev_end_offset = cur_offset + envelope_size;
7623 if 2 > max_ordinal {
7624 return Ok(());
7625 }
7626
7627 let cur_offset: usize = (2 - 1) * envelope_size;
7630
7631 encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
7633
7634 fidl::encoding::encode_in_envelope_optional::<
7639 bool,
7640 fidl::encoding::DefaultFuchsiaResourceDialect,
7641 >(
7642 self.initiator.as_ref().map(<bool as fidl::encoding::ValueTypeMarker>::borrow),
7643 encoder,
7644 offset + cur_offset,
7645 depth,
7646 )?;
7647
7648 _prev_end_offset = cur_offset + envelope_size;
7649 if 3 > max_ordinal {
7650 return Ok(());
7651 }
7652
7653 let cur_offset: usize = (3 - 1) * envelope_size;
7656
7657 encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
7659
7660 fidl::encoding::encode_in_envelope_optional::<fidl::encoding::UnboundedVector<ScoConnectionParameters>, fidl::encoding::DefaultFuchsiaResourceDialect>(
7665 self.params.as_ref().map(<fidl::encoding::UnboundedVector<ScoConnectionParameters> as fidl::encoding::ValueTypeMarker>::borrow),
7666 encoder, offset + cur_offset, depth
7667 )?;
7668
7669 _prev_end_offset = cur_offset + envelope_size;
7670 if 4 > max_ordinal {
7671 return Ok(());
7672 }
7673
7674 let cur_offset: usize = (4 - 1) * envelope_size;
7677
7678 encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
7680
7681 fidl::encoding::encode_in_envelope_optional::<fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<ScoConnectionMarker>>, fidl::encoding::DefaultFuchsiaResourceDialect>(
7686 self.connection.as_mut().map(<fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<ScoConnectionMarker>> as fidl::encoding::ResourceTypeMarker>::take_or_borrow),
7687 encoder, offset + cur_offset, depth
7688 )?;
7689
7690 _prev_end_offset = cur_offset + envelope_size;
7691
7692 Ok(())
7693 }
7694 }
7695
7696 impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
7697 for ProfileConnectScoRequest
7698 {
7699 #[inline(always)]
7700 fn new_empty() -> Self {
7701 Self::default()
7702 }
7703
7704 unsafe fn decode(
7705 &mut self,
7706 decoder: &mut fidl::encoding::Decoder<
7707 '_,
7708 fidl::encoding::DefaultFuchsiaResourceDialect,
7709 >,
7710 offset: usize,
7711 mut depth: fidl::encoding::Depth,
7712 ) -> fidl::Result<()> {
7713 decoder.debug_check_bounds::<Self>(offset);
7714 let len = match fidl::encoding::decode_vector_header(decoder, offset)? {
7715 None => return Err(fidl::Error::NotNullable),
7716 Some(len) => len,
7717 };
7718 if len == 0 {
7720 return Ok(());
7721 };
7722 depth.increment()?;
7723 let envelope_size = 8;
7724 let bytes_len = len * envelope_size;
7725 let offset = decoder.out_of_line_offset(bytes_len)?;
7726 let mut _next_ordinal_to_read = 0;
7728 let mut next_offset = offset;
7729 let end_offset = offset + bytes_len;
7730 _next_ordinal_to_read += 1;
7731 if next_offset >= end_offset {
7732 return Ok(());
7733 }
7734
7735 while _next_ordinal_to_read < 1 {
7737 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
7738 _next_ordinal_to_read += 1;
7739 next_offset += envelope_size;
7740 }
7741
7742 let next_out_of_line = decoder.next_out_of_line();
7743 let handles_before = decoder.remaining_handles();
7744 if let Some((inlined, num_bytes, num_handles)) =
7745 fidl::encoding::decode_envelope_header(decoder, next_offset)?
7746 {
7747 let member_inline_size =
7748 <fidl_fuchsia_bluetooth::PeerId as fidl::encoding::TypeMarker>::inline_size(
7749 decoder.context,
7750 );
7751 if inlined != (member_inline_size <= 4) {
7752 return Err(fidl::Error::InvalidInlineBitInEnvelope);
7753 }
7754 let inner_offset;
7755 let mut inner_depth = depth.clone();
7756 if inlined {
7757 decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
7758 inner_offset = next_offset;
7759 } else {
7760 inner_offset = decoder.out_of_line_offset(member_inline_size)?;
7761 inner_depth.increment()?;
7762 }
7763 let val_ref = self.peer_id.get_or_insert_with(|| {
7764 fidl::new_empty!(
7765 fidl_fuchsia_bluetooth::PeerId,
7766 fidl::encoding::DefaultFuchsiaResourceDialect
7767 )
7768 });
7769 fidl::decode!(
7770 fidl_fuchsia_bluetooth::PeerId,
7771 fidl::encoding::DefaultFuchsiaResourceDialect,
7772 val_ref,
7773 decoder,
7774 inner_offset,
7775 inner_depth
7776 )?;
7777 if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
7778 {
7779 return Err(fidl::Error::InvalidNumBytesInEnvelope);
7780 }
7781 if handles_before != decoder.remaining_handles() + (num_handles as usize) {
7782 return Err(fidl::Error::InvalidNumHandlesInEnvelope);
7783 }
7784 }
7785
7786 next_offset += envelope_size;
7787 _next_ordinal_to_read += 1;
7788 if next_offset >= end_offset {
7789 return Ok(());
7790 }
7791
7792 while _next_ordinal_to_read < 2 {
7794 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
7795 _next_ordinal_to_read += 1;
7796 next_offset += envelope_size;
7797 }
7798
7799 let next_out_of_line = decoder.next_out_of_line();
7800 let handles_before = decoder.remaining_handles();
7801 if let Some((inlined, num_bytes, num_handles)) =
7802 fidl::encoding::decode_envelope_header(decoder, next_offset)?
7803 {
7804 let member_inline_size =
7805 <bool as fidl::encoding::TypeMarker>::inline_size(decoder.context);
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.initiator.get_or_insert_with(|| {
7819 fidl::new_empty!(bool, fidl::encoding::DefaultFuchsiaResourceDialect)
7820 });
7821 fidl::decode!(
7822 bool,
7823 fidl::encoding::DefaultFuchsiaResourceDialect,
7824 val_ref,
7825 decoder,
7826 inner_offset,
7827 inner_depth
7828 )?;
7829 if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
7830 {
7831 return Err(fidl::Error::InvalidNumBytesInEnvelope);
7832 }
7833 if handles_before != decoder.remaining_handles() + (num_handles as usize) {
7834 return Err(fidl::Error::InvalidNumHandlesInEnvelope);
7835 }
7836 }
7837
7838 next_offset += envelope_size;
7839 _next_ordinal_to_read += 1;
7840 if next_offset >= end_offset {
7841 return Ok(());
7842 }
7843
7844 while _next_ordinal_to_read < 3 {
7846 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
7847 _next_ordinal_to_read += 1;
7848 next_offset += envelope_size;
7849 }
7850
7851 let next_out_of_line = decoder.next_out_of_line();
7852 let handles_before = decoder.remaining_handles();
7853 if let Some((inlined, num_bytes, num_handles)) =
7854 fidl::encoding::decode_envelope_header(decoder, next_offset)?
7855 {
7856 let member_inline_size = <fidl::encoding::UnboundedVector<ScoConnectionParameters> as fidl::encoding::TypeMarker>::inline_size(decoder.context);
7857 if inlined != (member_inline_size <= 4) {
7858 return Err(fidl::Error::InvalidInlineBitInEnvelope);
7859 }
7860 let inner_offset;
7861 let mut inner_depth = depth.clone();
7862 if inlined {
7863 decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
7864 inner_offset = next_offset;
7865 } else {
7866 inner_offset = decoder.out_of_line_offset(member_inline_size)?;
7867 inner_depth.increment()?;
7868 }
7869 let val_ref = self.params.get_or_insert_with(|| {
7870 fidl::new_empty!(
7871 fidl::encoding::UnboundedVector<ScoConnectionParameters>,
7872 fidl::encoding::DefaultFuchsiaResourceDialect
7873 )
7874 });
7875 fidl::decode!(
7876 fidl::encoding::UnboundedVector<ScoConnectionParameters>,
7877 fidl::encoding::DefaultFuchsiaResourceDialect,
7878 val_ref,
7879 decoder,
7880 inner_offset,
7881 inner_depth
7882 )?;
7883 if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
7884 {
7885 return Err(fidl::Error::InvalidNumBytesInEnvelope);
7886 }
7887 if handles_before != decoder.remaining_handles() + (num_handles as usize) {
7888 return Err(fidl::Error::InvalidNumHandlesInEnvelope);
7889 }
7890 }
7891
7892 next_offset += envelope_size;
7893 _next_ordinal_to_read += 1;
7894 if next_offset >= end_offset {
7895 return Ok(());
7896 }
7897
7898 while _next_ordinal_to_read < 4 {
7900 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
7901 _next_ordinal_to_read += 1;
7902 next_offset += envelope_size;
7903 }
7904
7905 let next_out_of_line = decoder.next_out_of_line();
7906 let handles_before = decoder.remaining_handles();
7907 if let Some((inlined, num_bytes, num_handles)) =
7908 fidl::encoding::decode_envelope_header(decoder, next_offset)?
7909 {
7910 let member_inline_size = <fidl::encoding::Endpoint<
7911 fidl::endpoints::ServerEnd<ScoConnectionMarker>,
7912 > as fidl::encoding::TypeMarker>::inline_size(
7913 decoder.context
7914 );
7915 if inlined != (member_inline_size <= 4) {
7916 return Err(fidl::Error::InvalidInlineBitInEnvelope);
7917 }
7918 let inner_offset;
7919 let mut inner_depth = depth.clone();
7920 if inlined {
7921 decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
7922 inner_offset = next_offset;
7923 } else {
7924 inner_offset = decoder.out_of_line_offset(member_inline_size)?;
7925 inner_depth.increment()?;
7926 }
7927 let val_ref = self.connection.get_or_insert_with(|| {
7928 fidl::new_empty!(
7929 fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<ScoConnectionMarker>>,
7930 fidl::encoding::DefaultFuchsiaResourceDialect
7931 )
7932 });
7933 fidl::decode!(
7934 fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<ScoConnectionMarker>>,
7935 fidl::encoding::DefaultFuchsiaResourceDialect,
7936 val_ref,
7937 decoder,
7938 inner_offset,
7939 inner_depth
7940 )?;
7941 if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
7942 {
7943 return Err(fidl::Error::InvalidNumBytesInEnvelope);
7944 }
7945 if handles_before != decoder.remaining_handles() + (num_handles as usize) {
7946 return Err(fidl::Error::InvalidNumHandlesInEnvelope);
7947 }
7948 }
7949
7950 next_offset += envelope_size;
7951
7952 while next_offset < end_offset {
7954 _next_ordinal_to_read += 1;
7955 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
7956 next_offset += envelope_size;
7957 }
7958
7959 Ok(())
7960 }
7961 }
7962
7963 impl ProfileSearchRequest {
7964 #[inline(always)]
7965 fn max_ordinal_present(&self) -> u64 {
7966 if let Some(_) = self.full_uuid {
7967 return 4;
7968 }
7969 if let Some(_) = self.results {
7970 return 3;
7971 }
7972 if let Some(_) = self.attr_ids {
7973 return 2;
7974 }
7975 if let Some(_) = self.service_uuid {
7976 return 1;
7977 }
7978 0
7979 }
7980 }
7981
7982 impl fidl::encoding::ResourceTypeMarker for ProfileSearchRequest {
7983 type Borrowed<'a> = &'a mut Self;
7984 fn take_or_borrow<'a>(
7985 value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
7986 ) -> Self::Borrowed<'a> {
7987 value
7988 }
7989 }
7990
7991 unsafe impl fidl::encoding::TypeMarker for ProfileSearchRequest {
7992 type Owned = Self;
7993
7994 #[inline(always)]
7995 fn inline_align(_context: fidl::encoding::Context) -> usize {
7996 8
7997 }
7998
7999 #[inline(always)]
8000 fn inline_size(_context: fidl::encoding::Context) -> usize {
8001 16
8002 }
8003 }
8004
8005 unsafe impl
8006 fidl::encoding::Encode<ProfileSearchRequest, fidl::encoding::DefaultFuchsiaResourceDialect>
8007 for &mut ProfileSearchRequest
8008 {
8009 unsafe fn encode(
8010 self,
8011 encoder: &mut fidl::encoding::Encoder<
8012 '_,
8013 fidl::encoding::DefaultFuchsiaResourceDialect,
8014 >,
8015 offset: usize,
8016 mut depth: fidl::encoding::Depth,
8017 ) -> fidl::Result<()> {
8018 encoder.debug_check_bounds::<ProfileSearchRequest>(offset);
8019 let max_ordinal: u64 = self.max_ordinal_present();
8021 encoder.write_num(max_ordinal, offset);
8022 encoder.write_num(fidl::encoding::ALLOC_PRESENT_U64, offset + 8);
8023 if max_ordinal == 0 {
8025 return Ok(());
8026 }
8027 depth.increment()?;
8028 let envelope_size = 8;
8029 let bytes_len = max_ordinal as usize * envelope_size;
8030 #[allow(unused_variables)]
8031 let offset = encoder.out_of_line_offset(bytes_len);
8032 let mut _prev_end_offset: usize = 0;
8033 if 1 > max_ordinal {
8034 return Ok(());
8035 }
8036
8037 let cur_offset: usize = (1 - 1) * envelope_size;
8040
8041 encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
8043
8044 fidl::encoding::encode_in_envelope_optional::<
8049 ServiceClassProfileIdentifier,
8050 fidl::encoding::DefaultFuchsiaResourceDialect,
8051 >(
8052 self.service_uuid.as_ref().map(
8053 <ServiceClassProfileIdentifier as fidl::encoding::ValueTypeMarker>::borrow,
8054 ),
8055 encoder,
8056 offset + cur_offset,
8057 depth,
8058 )?;
8059
8060 _prev_end_offset = cur_offset + envelope_size;
8061 if 2 > max_ordinal {
8062 return Ok(());
8063 }
8064
8065 let cur_offset: usize = (2 - 1) * envelope_size;
8068
8069 encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
8071
8072 fidl::encoding::encode_in_envelope_optional::<
8077 fidl::encoding::Vector<u16, 512>,
8078 fidl::encoding::DefaultFuchsiaResourceDialect,
8079 >(
8080 self.attr_ids.as_ref().map(
8081 <fidl::encoding::Vector<u16, 512> as fidl::encoding::ValueTypeMarker>::borrow,
8082 ),
8083 encoder,
8084 offset + cur_offset,
8085 depth,
8086 )?;
8087
8088 _prev_end_offset = cur_offset + envelope_size;
8089 if 3 > max_ordinal {
8090 return Ok(());
8091 }
8092
8093 let cur_offset: usize = (3 - 1) * envelope_size;
8096
8097 encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
8099
8100 fidl::encoding::encode_in_envelope_optional::<fidl::encoding::Endpoint<fidl::endpoints::ClientEnd<SearchResultsMarker>>, fidl::encoding::DefaultFuchsiaResourceDialect>(
8105 self.results.as_mut().map(<fidl::encoding::Endpoint<fidl::endpoints::ClientEnd<SearchResultsMarker>> as fidl::encoding::ResourceTypeMarker>::take_or_borrow),
8106 encoder, offset + cur_offset, depth
8107 )?;
8108
8109 _prev_end_offset = cur_offset + envelope_size;
8110 if 4 > max_ordinal {
8111 return Ok(());
8112 }
8113
8114 let cur_offset: usize = (4 - 1) * envelope_size;
8117
8118 encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
8120
8121 fidl::encoding::encode_in_envelope_optional::<
8126 fidl_fuchsia_bluetooth::Uuid,
8127 fidl::encoding::DefaultFuchsiaResourceDialect,
8128 >(
8129 self.full_uuid
8130 .as_ref()
8131 .map(<fidl_fuchsia_bluetooth::Uuid as fidl::encoding::ValueTypeMarker>::borrow),
8132 encoder,
8133 offset + cur_offset,
8134 depth,
8135 )?;
8136
8137 _prev_end_offset = cur_offset + envelope_size;
8138
8139 Ok(())
8140 }
8141 }
8142
8143 impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
8144 for ProfileSearchRequest
8145 {
8146 #[inline(always)]
8147 fn new_empty() -> Self {
8148 Self::default()
8149 }
8150
8151 unsafe fn decode(
8152 &mut self,
8153 decoder: &mut fidl::encoding::Decoder<
8154 '_,
8155 fidl::encoding::DefaultFuchsiaResourceDialect,
8156 >,
8157 offset: usize,
8158 mut depth: fidl::encoding::Depth,
8159 ) -> fidl::Result<()> {
8160 decoder.debug_check_bounds::<Self>(offset);
8161 let len = match fidl::encoding::decode_vector_header(decoder, offset)? {
8162 None => return Err(fidl::Error::NotNullable),
8163 Some(len) => len,
8164 };
8165 if len == 0 {
8167 return Ok(());
8168 };
8169 depth.increment()?;
8170 let envelope_size = 8;
8171 let bytes_len = len * envelope_size;
8172 let offset = decoder.out_of_line_offset(bytes_len)?;
8173 let mut _next_ordinal_to_read = 0;
8175 let mut next_offset = offset;
8176 let end_offset = offset + bytes_len;
8177 _next_ordinal_to_read += 1;
8178 if next_offset >= end_offset {
8179 return Ok(());
8180 }
8181
8182 while _next_ordinal_to_read < 1 {
8184 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
8185 _next_ordinal_to_read += 1;
8186 next_offset += envelope_size;
8187 }
8188
8189 let next_out_of_line = decoder.next_out_of_line();
8190 let handles_before = decoder.remaining_handles();
8191 if let Some((inlined, num_bytes, num_handles)) =
8192 fidl::encoding::decode_envelope_header(decoder, next_offset)?
8193 {
8194 let member_inline_size =
8195 <ServiceClassProfileIdentifier as fidl::encoding::TypeMarker>::inline_size(
8196 decoder.context,
8197 );
8198 if inlined != (member_inline_size <= 4) {
8199 return Err(fidl::Error::InvalidInlineBitInEnvelope);
8200 }
8201 let inner_offset;
8202 let mut inner_depth = depth.clone();
8203 if inlined {
8204 decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
8205 inner_offset = next_offset;
8206 } else {
8207 inner_offset = decoder.out_of_line_offset(member_inline_size)?;
8208 inner_depth.increment()?;
8209 }
8210 let val_ref = self.service_uuid.get_or_insert_with(|| {
8211 fidl::new_empty!(
8212 ServiceClassProfileIdentifier,
8213 fidl::encoding::DefaultFuchsiaResourceDialect
8214 )
8215 });
8216 fidl::decode!(
8217 ServiceClassProfileIdentifier,
8218 fidl::encoding::DefaultFuchsiaResourceDialect,
8219 val_ref,
8220 decoder,
8221 inner_offset,
8222 inner_depth
8223 )?;
8224 if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
8225 {
8226 return Err(fidl::Error::InvalidNumBytesInEnvelope);
8227 }
8228 if handles_before != decoder.remaining_handles() + (num_handles as usize) {
8229 return Err(fidl::Error::InvalidNumHandlesInEnvelope);
8230 }
8231 }
8232
8233 next_offset += envelope_size;
8234 _next_ordinal_to_read += 1;
8235 if next_offset >= end_offset {
8236 return Ok(());
8237 }
8238
8239 while _next_ordinal_to_read < 2 {
8241 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
8242 _next_ordinal_to_read += 1;
8243 next_offset += envelope_size;
8244 }
8245
8246 let next_out_of_line = decoder.next_out_of_line();
8247 let handles_before = decoder.remaining_handles();
8248 if let Some((inlined, num_bytes, num_handles)) =
8249 fidl::encoding::decode_envelope_header(decoder, next_offset)?
8250 {
8251 let member_inline_size =
8252 <fidl::encoding::Vector<u16, 512> as fidl::encoding::TypeMarker>::inline_size(
8253 decoder.context,
8254 );
8255 if inlined != (member_inline_size <= 4) {
8256 return Err(fidl::Error::InvalidInlineBitInEnvelope);
8257 }
8258 let inner_offset;
8259 let mut inner_depth = depth.clone();
8260 if inlined {
8261 decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
8262 inner_offset = next_offset;
8263 } else {
8264 inner_offset = decoder.out_of_line_offset(member_inline_size)?;
8265 inner_depth.increment()?;
8266 }
8267 let val_ref =
8268 self.attr_ids.get_or_insert_with(|| fidl::new_empty!(fidl::encoding::Vector<u16, 512>, fidl::encoding::DefaultFuchsiaResourceDialect));
8269 fidl::decode!(fidl::encoding::Vector<u16, 512>, fidl::encoding::DefaultFuchsiaResourceDialect, val_ref, decoder, inner_offset, inner_depth)?;
8270 if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
8271 {
8272 return Err(fidl::Error::InvalidNumBytesInEnvelope);
8273 }
8274 if handles_before != decoder.remaining_handles() + (num_handles as usize) {
8275 return Err(fidl::Error::InvalidNumHandlesInEnvelope);
8276 }
8277 }
8278
8279 next_offset += envelope_size;
8280 _next_ordinal_to_read += 1;
8281 if next_offset >= end_offset {
8282 return Ok(());
8283 }
8284
8285 while _next_ordinal_to_read < 3 {
8287 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
8288 _next_ordinal_to_read += 1;
8289 next_offset += envelope_size;
8290 }
8291
8292 let next_out_of_line = decoder.next_out_of_line();
8293 let handles_before = decoder.remaining_handles();
8294 if let Some((inlined, num_bytes, num_handles)) =
8295 fidl::encoding::decode_envelope_header(decoder, next_offset)?
8296 {
8297 let member_inline_size = <fidl::encoding::Endpoint<
8298 fidl::endpoints::ClientEnd<SearchResultsMarker>,
8299 > as fidl::encoding::TypeMarker>::inline_size(
8300 decoder.context
8301 );
8302 if inlined != (member_inline_size <= 4) {
8303 return Err(fidl::Error::InvalidInlineBitInEnvelope);
8304 }
8305 let inner_offset;
8306 let mut inner_depth = depth.clone();
8307 if inlined {
8308 decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
8309 inner_offset = next_offset;
8310 } else {
8311 inner_offset = decoder.out_of_line_offset(member_inline_size)?;
8312 inner_depth.increment()?;
8313 }
8314 let val_ref = self.results.get_or_insert_with(|| {
8315 fidl::new_empty!(
8316 fidl::encoding::Endpoint<fidl::endpoints::ClientEnd<SearchResultsMarker>>,
8317 fidl::encoding::DefaultFuchsiaResourceDialect
8318 )
8319 });
8320 fidl::decode!(
8321 fidl::encoding::Endpoint<fidl::endpoints::ClientEnd<SearchResultsMarker>>,
8322 fidl::encoding::DefaultFuchsiaResourceDialect,
8323 val_ref,
8324 decoder,
8325 inner_offset,
8326 inner_depth
8327 )?;
8328 if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
8329 {
8330 return Err(fidl::Error::InvalidNumBytesInEnvelope);
8331 }
8332 if handles_before != decoder.remaining_handles() + (num_handles as usize) {
8333 return Err(fidl::Error::InvalidNumHandlesInEnvelope);
8334 }
8335 }
8336
8337 next_offset += envelope_size;
8338 _next_ordinal_to_read += 1;
8339 if next_offset >= end_offset {
8340 return Ok(());
8341 }
8342
8343 while _next_ordinal_to_read < 4 {
8345 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
8346 _next_ordinal_to_read += 1;
8347 next_offset += envelope_size;
8348 }
8349
8350 let next_out_of_line = decoder.next_out_of_line();
8351 let handles_before = decoder.remaining_handles();
8352 if let Some((inlined, num_bytes, num_handles)) =
8353 fidl::encoding::decode_envelope_header(decoder, next_offset)?
8354 {
8355 let member_inline_size =
8356 <fidl_fuchsia_bluetooth::Uuid as fidl::encoding::TypeMarker>::inline_size(
8357 decoder.context,
8358 );
8359 if inlined != (member_inline_size <= 4) {
8360 return Err(fidl::Error::InvalidInlineBitInEnvelope);
8361 }
8362 let inner_offset;
8363 let mut inner_depth = depth.clone();
8364 if inlined {
8365 decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
8366 inner_offset = next_offset;
8367 } else {
8368 inner_offset = decoder.out_of_line_offset(member_inline_size)?;
8369 inner_depth.increment()?;
8370 }
8371 let val_ref = self.full_uuid.get_or_insert_with(|| {
8372 fidl::new_empty!(
8373 fidl_fuchsia_bluetooth::Uuid,
8374 fidl::encoding::DefaultFuchsiaResourceDialect
8375 )
8376 });
8377 fidl::decode!(
8378 fidl_fuchsia_bluetooth::Uuid,
8379 fidl::encoding::DefaultFuchsiaResourceDialect,
8380 val_ref,
8381 decoder,
8382 inner_offset,
8383 inner_depth
8384 )?;
8385 if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
8386 {
8387 return Err(fidl::Error::InvalidNumBytesInEnvelope);
8388 }
8389 if handles_before != decoder.remaining_handles() + (num_handles as usize) {
8390 return Err(fidl::Error::InvalidNumHandlesInEnvelope);
8391 }
8392 }
8393
8394 next_offset += envelope_size;
8395
8396 while next_offset < end_offset {
8398 _next_ordinal_to_read += 1;
8399 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
8400 next_offset += envelope_size;
8401 }
8402
8403 Ok(())
8404 }
8405 }
8406}