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