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_pandora_common::*;
11use futures::future::{self, MaybeDone, TryFutureExt};
12use zx_status;
13
14#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
15pub struct GrpcServerControllerMarker;
16
17impl fidl::endpoints::ProtocolMarker for GrpcServerControllerMarker {
18 type Proxy = GrpcServerControllerProxy;
19 type RequestStream = GrpcServerControllerRequestStream;
20 #[cfg(target_os = "fuchsia")]
21 type SynchronousProxy = GrpcServerControllerSynchronousProxy;
22
23 const DEBUG_NAME: &'static str = "fuchsia.bluetooth.pandora.GrpcServerController";
24}
25impl fidl::endpoints::DiscoverableProtocolMarker for GrpcServerControllerMarker {}
26pub type GrpcServerControllerStartResult = Result<(), ServiceError>;
27
28pub trait GrpcServerControllerProxyInterface: Send + Sync {
29 type StartResponseFut: std::future::Future<Output = Result<GrpcServerControllerStartResult, fidl::Error>>
30 + Send;
31 fn r#start(&self, payload: &GrpcServerControllerStartRequest) -> Self::StartResponseFut;
32 type StopResponseFut: std::future::Future<Output = Result<(), fidl::Error>> + Send;
33 fn r#stop(&self) -> Self::StopResponseFut;
34}
35#[derive(Debug)]
36#[cfg(target_os = "fuchsia")]
37pub struct GrpcServerControllerSynchronousProxy {
38 client: fidl::client::sync::Client,
39}
40
41#[cfg(target_os = "fuchsia")]
42impl fidl::endpoints::SynchronousProxy for GrpcServerControllerSynchronousProxy {
43 type Proxy = GrpcServerControllerProxy;
44 type Protocol = GrpcServerControllerMarker;
45
46 fn from_channel(inner: fidl::Channel) -> Self {
47 Self::new(inner)
48 }
49
50 fn into_channel(self) -> fidl::Channel {
51 self.client.into_channel()
52 }
53
54 fn as_channel(&self) -> &fidl::Channel {
55 self.client.as_channel()
56 }
57}
58
59#[cfg(target_os = "fuchsia")]
60impl GrpcServerControllerSynchronousProxy {
61 pub fn new(channel: fidl::Channel) -> Self {
62 let protocol_name =
63 <GrpcServerControllerMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
64 Self { client: fidl::client::sync::Client::new(channel, protocol_name) }
65 }
66
67 pub fn into_channel(self) -> fidl::Channel {
68 self.client.into_channel()
69 }
70
71 pub fn wait_for_event(
74 &self,
75 deadline: zx::MonotonicInstant,
76 ) -> Result<GrpcServerControllerEvent, fidl::Error> {
77 GrpcServerControllerEvent::decode(self.client.wait_for_event(deadline)?)
78 }
79
80 pub fn r#start(
87 &self,
88 mut payload: &GrpcServerControllerStartRequest,
89 ___deadline: zx::MonotonicInstant,
90 ) -> Result<GrpcServerControllerStartResult, fidl::Error> {
91 let _response = self.client.send_query::<
92 GrpcServerControllerStartRequest,
93 fidl::encoding::FlexibleResultType<fidl::encoding::EmptyStruct, ServiceError>,
94 >(
95 payload,
96 0x39b64f9031375c29,
97 fidl::encoding::DynamicFlags::FLEXIBLE,
98 ___deadline,
99 )?
100 .into_result::<GrpcServerControllerMarker>("start")?;
101 Ok(_response.map(|x| x))
102 }
103
104 pub fn r#stop(&self, ___deadline: zx::MonotonicInstant) -> Result<(), fidl::Error> {
106 let _response = self.client.send_query::<
107 fidl::encoding::EmptyPayload,
108 fidl::encoding::FlexibleType<fidl::encoding::EmptyStruct>,
109 >(
110 (),
111 0x4e8601feb5d930b9,
112 fidl::encoding::DynamicFlags::FLEXIBLE,
113 ___deadline,
114 )?
115 .into_result::<GrpcServerControllerMarker>("stop")?;
116 Ok(_response)
117 }
118}
119
120#[cfg(target_os = "fuchsia")]
121impl From<GrpcServerControllerSynchronousProxy> for zx::Handle {
122 fn from(value: GrpcServerControllerSynchronousProxy) -> Self {
123 value.into_channel().into()
124 }
125}
126
127#[cfg(target_os = "fuchsia")]
128impl From<fidl::Channel> for GrpcServerControllerSynchronousProxy {
129 fn from(value: fidl::Channel) -> Self {
130 Self::new(value)
131 }
132}
133
134#[derive(Debug, Clone)]
135pub struct GrpcServerControllerProxy {
136 client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
137}
138
139impl fidl::endpoints::Proxy for GrpcServerControllerProxy {
140 type Protocol = GrpcServerControllerMarker;
141
142 fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
143 Self::new(inner)
144 }
145
146 fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
147 self.client.into_channel().map_err(|client| Self { client })
148 }
149
150 fn as_channel(&self) -> &::fidl::AsyncChannel {
151 self.client.as_channel()
152 }
153}
154
155impl GrpcServerControllerProxy {
156 pub fn new(channel: ::fidl::AsyncChannel) -> Self {
158 let protocol_name =
159 <GrpcServerControllerMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
160 Self { client: fidl::client::Client::new(channel, protocol_name) }
161 }
162
163 pub fn take_event_stream(&self) -> GrpcServerControllerEventStream {
169 GrpcServerControllerEventStream { event_receiver: self.client.take_event_receiver() }
170 }
171
172 pub fn r#start(
179 &self,
180 mut payload: &GrpcServerControllerStartRequest,
181 ) -> fidl::client::QueryResponseFut<
182 GrpcServerControllerStartResult,
183 fidl::encoding::DefaultFuchsiaResourceDialect,
184 > {
185 GrpcServerControllerProxyInterface::r#start(self, payload)
186 }
187
188 pub fn r#stop(
190 &self,
191 ) -> fidl::client::QueryResponseFut<(), fidl::encoding::DefaultFuchsiaResourceDialect> {
192 GrpcServerControllerProxyInterface::r#stop(self)
193 }
194}
195
196impl GrpcServerControllerProxyInterface for GrpcServerControllerProxy {
197 type StartResponseFut = fidl::client::QueryResponseFut<
198 GrpcServerControllerStartResult,
199 fidl::encoding::DefaultFuchsiaResourceDialect,
200 >;
201 fn r#start(&self, mut payload: &GrpcServerControllerStartRequest) -> Self::StartResponseFut {
202 fn _decode(
203 mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
204 ) -> Result<GrpcServerControllerStartResult, fidl::Error> {
205 let _response = fidl::client::decode_transaction_body::<
206 fidl::encoding::FlexibleResultType<fidl::encoding::EmptyStruct, ServiceError>,
207 fidl::encoding::DefaultFuchsiaResourceDialect,
208 0x39b64f9031375c29,
209 >(_buf?)?
210 .into_result::<GrpcServerControllerMarker>("start")?;
211 Ok(_response.map(|x| x))
212 }
213 self.client.send_query_and_decode::<
214 GrpcServerControllerStartRequest,
215 GrpcServerControllerStartResult,
216 >(
217 payload,
218 0x39b64f9031375c29,
219 fidl::encoding::DynamicFlags::FLEXIBLE,
220 _decode,
221 )
222 }
223
224 type StopResponseFut =
225 fidl::client::QueryResponseFut<(), fidl::encoding::DefaultFuchsiaResourceDialect>;
226 fn r#stop(&self) -> Self::StopResponseFut {
227 fn _decode(
228 mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
229 ) -> Result<(), fidl::Error> {
230 let _response = fidl::client::decode_transaction_body::<
231 fidl::encoding::FlexibleType<fidl::encoding::EmptyStruct>,
232 fidl::encoding::DefaultFuchsiaResourceDialect,
233 0x4e8601feb5d930b9,
234 >(_buf?)?
235 .into_result::<GrpcServerControllerMarker>("stop")?;
236 Ok(_response)
237 }
238 self.client.send_query_and_decode::<fidl::encoding::EmptyPayload, ()>(
239 (),
240 0x4e8601feb5d930b9,
241 fidl::encoding::DynamicFlags::FLEXIBLE,
242 _decode,
243 )
244 }
245}
246
247pub struct GrpcServerControllerEventStream {
248 event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
249}
250
251impl std::marker::Unpin for GrpcServerControllerEventStream {}
252
253impl futures::stream::FusedStream for GrpcServerControllerEventStream {
254 fn is_terminated(&self) -> bool {
255 self.event_receiver.is_terminated()
256 }
257}
258
259impl futures::Stream for GrpcServerControllerEventStream {
260 type Item = Result<GrpcServerControllerEvent, fidl::Error>;
261
262 fn poll_next(
263 mut self: std::pin::Pin<&mut Self>,
264 cx: &mut std::task::Context<'_>,
265 ) -> std::task::Poll<Option<Self::Item>> {
266 match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
267 &mut self.event_receiver,
268 cx
269 )?) {
270 Some(buf) => std::task::Poll::Ready(Some(GrpcServerControllerEvent::decode(buf))),
271 None => std::task::Poll::Ready(None),
272 }
273 }
274}
275
276#[derive(Debug)]
277pub enum GrpcServerControllerEvent {
278 #[non_exhaustive]
279 _UnknownEvent {
280 ordinal: u64,
282 },
283}
284
285impl GrpcServerControllerEvent {
286 fn decode(
288 mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
289 ) -> Result<GrpcServerControllerEvent, fidl::Error> {
290 let (bytes, _handles) = buf.split_mut();
291 let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
292 debug_assert_eq!(tx_header.tx_id, 0);
293 match tx_header.ordinal {
294 _ if tx_header.dynamic_flags().contains(fidl::encoding::DynamicFlags::FLEXIBLE) => {
295 Ok(GrpcServerControllerEvent::_UnknownEvent { ordinal: tx_header.ordinal })
296 }
297 _ => Err(fidl::Error::UnknownOrdinal {
298 ordinal: tx_header.ordinal,
299 protocol_name:
300 <GrpcServerControllerMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
301 }),
302 }
303 }
304}
305
306pub struct GrpcServerControllerRequestStream {
308 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
309 is_terminated: bool,
310}
311
312impl std::marker::Unpin for GrpcServerControllerRequestStream {}
313
314impl futures::stream::FusedStream for GrpcServerControllerRequestStream {
315 fn is_terminated(&self) -> bool {
316 self.is_terminated
317 }
318}
319
320impl fidl::endpoints::RequestStream for GrpcServerControllerRequestStream {
321 type Protocol = GrpcServerControllerMarker;
322 type ControlHandle = GrpcServerControllerControlHandle;
323
324 fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
325 Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
326 }
327
328 fn control_handle(&self) -> Self::ControlHandle {
329 GrpcServerControllerControlHandle { inner: self.inner.clone() }
330 }
331
332 fn into_inner(
333 self,
334 ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
335 {
336 (self.inner, self.is_terminated)
337 }
338
339 fn from_inner(
340 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
341 is_terminated: bool,
342 ) -> Self {
343 Self { inner, is_terminated }
344 }
345}
346
347impl futures::Stream for GrpcServerControllerRequestStream {
348 type Item = Result<GrpcServerControllerRequest, fidl::Error>;
349
350 fn poll_next(
351 mut self: std::pin::Pin<&mut Self>,
352 cx: &mut std::task::Context<'_>,
353 ) -> std::task::Poll<Option<Self::Item>> {
354 let this = &mut *self;
355 if this.inner.check_shutdown(cx) {
356 this.is_terminated = true;
357 return std::task::Poll::Ready(None);
358 }
359 if this.is_terminated {
360 panic!("polled GrpcServerControllerRequestStream after completion");
361 }
362 fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
363 |bytes, handles| {
364 match this.inner.channel().read_etc(cx, bytes, handles) {
365 std::task::Poll::Ready(Ok(())) => {}
366 std::task::Poll::Pending => return std::task::Poll::Pending,
367 std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
368 this.is_terminated = true;
369 return std::task::Poll::Ready(None);
370 }
371 std::task::Poll::Ready(Err(e)) => {
372 return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
373 e.into(),
374 ))))
375 }
376 }
377
378 let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
380
381 std::task::Poll::Ready(Some(match header.ordinal {
382 0x39b64f9031375c29 => {
383 header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
384 let mut req = fidl::new_empty!(GrpcServerControllerStartRequest, fidl::encoding::DefaultFuchsiaResourceDialect);
385 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<GrpcServerControllerStartRequest>(&header, _body_bytes, handles, &mut req)?;
386 let control_handle = GrpcServerControllerControlHandle {
387 inner: this.inner.clone(),
388 };
389 Ok(GrpcServerControllerRequest::Start {payload: req,
390 responder: GrpcServerControllerStartResponder {
391 control_handle: std::mem::ManuallyDrop::new(control_handle),
392 tx_id: header.tx_id,
393 },
394 })
395 }
396 0x4e8601feb5d930b9 => {
397 header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
398 let mut req = fidl::new_empty!(fidl::encoding::EmptyPayload, fidl::encoding::DefaultFuchsiaResourceDialect);
399 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
400 let control_handle = GrpcServerControllerControlHandle {
401 inner: this.inner.clone(),
402 };
403 Ok(GrpcServerControllerRequest::Stop {
404 responder: GrpcServerControllerStopResponder {
405 control_handle: std::mem::ManuallyDrop::new(control_handle),
406 tx_id: header.tx_id,
407 },
408 })
409 }
410 _ if header.tx_id == 0 && header.dynamic_flags().contains(fidl::encoding::DynamicFlags::FLEXIBLE) => {
411 Ok(GrpcServerControllerRequest::_UnknownMethod {
412 ordinal: header.ordinal,
413 control_handle: GrpcServerControllerControlHandle { inner: this.inner.clone() },
414 method_type: fidl::MethodType::OneWay,
415 })
416 }
417 _ if header.dynamic_flags().contains(fidl::encoding::DynamicFlags::FLEXIBLE) => {
418 this.inner.send_framework_err(
419 fidl::encoding::FrameworkErr::UnknownMethod,
420 header.tx_id,
421 header.ordinal,
422 header.dynamic_flags(),
423 (bytes, handles),
424 )?;
425 Ok(GrpcServerControllerRequest::_UnknownMethod {
426 ordinal: header.ordinal,
427 control_handle: GrpcServerControllerControlHandle { inner: this.inner.clone() },
428 method_type: fidl::MethodType::TwoWay,
429 })
430 }
431 _ => Err(fidl::Error::UnknownOrdinal {
432 ordinal: header.ordinal,
433 protocol_name: <GrpcServerControllerMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
434 }),
435 }))
436 },
437 )
438 }
439}
440
441#[derive(Debug)]
444pub enum GrpcServerControllerRequest {
445 Start {
452 payload: GrpcServerControllerStartRequest,
453 responder: GrpcServerControllerStartResponder,
454 },
455 Stop { responder: GrpcServerControllerStopResponder },
457 #[non_exhaustive]
459 _UnknownMethod {
460 ordinal: u64,
462 control_handle: GrpcServerControllerControlHandle,
463 method_type: fidl::MethodType,
464 },
465}
466
467impl GrpcServerControllerRequest {
468 #[allow(irrefutable_let_patterns)]
469 pub fn into_start(
470 self,
471 ) -> Option<(GrpcServerControllerStartRequest, GrpcServerControllerStartResponder)> {
472 if let GrpcServerControllerRequest::Start { payload, responder } = self {
473 Some((payload, responder))
474 } else {
475 None
476 }
477 }
478
479 #[allow(irrefutable_let_patterns)]
480 pub fn into_stop(self) -> Option<(GrpcServerControllerStopResponder)> {
481 if let GrpcServerControllerRequest::Stop { responder } = self {
482 Some((responder))
483 } else {
484 None
485 }
486 }
487
488 pub fn method_name(&self) -> &'static str {
490 match *self {
491 GrpcServerControllerRequest::Start { .. } => "start",
492 GrpcServerControllerRequest::Stop { .. } => "stop",
493 GrpcServerControllerRequest::_UnknownMethod {
494 method_type: fidl::MethodType::OneWay,
495 ..
496 } => "unknown one-way method",
497 GrpcServerControllerRequest::_UnknownMethod {
498 method_type: fidl::MethodType::TwoWay,
499 ..
500 } => "unknown two-way method",
501 }
502 }
503}
504
505#[derive(Debug, Clone)]
506pub struct GrpcServerControllerControlHandle {
507 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
508}
509
510impl fidl::endpoints::ControlHandle for GrpcServerControllerControlHandle {
511 fn shutdown(&self) {
512 self.inner.shutdown()
513 }
514 fn shutdown_with_epitaph(&self, status: zx_status::Status) {
515 self.inner.shutdown_with_epitaph(status)
516 }
517
518 fn is_closed(&self) -> bool {
519 self.inner.channel().is_closed()
520 }
521 fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
522 self.inner.channel().on_closed()
523 }
524
525 #[cfg(target_os = "fuchsia")]
526 fn signal_peer(
527 &self,
528 clear_mask: zx::Signals,
529 set_mask: zx::Signals,
530 ) -> Result<(), zx_status::Status> {
531 use fidl::Peered;
532 self.inner.channel().signal_peer(clear_mask, set_mask)
533 }
534}
535
536impl GrpcServerControllerControlHandle {}
537
538#[must_use = "FIDL methods require a response to be sent"]
539#[derive(Debug)]
540pub struct GrpcServerControllerStartResponder {
541 control_handle: std::mem::ManuallyDrop<GrpcServerControllerControlHandle>,
542 tx_id: u32,
543}
544
545impl std::ops::Drop for GrpcServerControllerStartResponder {
549 fn drop(&mut self) {
550 self.control_handle.shutdown();
551 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
553 }
554}
555
556impl fidl::endpoints::Responder for GrpcServerControllerStartResponder {
557 type ControlHandle = GrpcServerControllerControlHandle;
558
559 fn control_handle(&self) -> &GrpcServerControllerControlHandle {
560 &self.control_handle
561 }
562
563 fn drop_without_shutdown(mut self) {
564 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
566 std::mem::forget(self);
568 }
569}
570
571impl GrpcServerControllerStartResponder {
572 pub fn send(self, mut result: Result<(), ServiceError>) -> Result<(), fidl::Error> {
576 let _result = self.send_raw(result);
577 if _result.is_err() {
578 self.control_handle.shutdown();
579 }
580 self.drop_without_shutdown();
581 _result
582 }
583
584 pub fn send_no_shutdown_on_err(
586 self,
587 mut result: Result<(), ServiceError>,
588 ) -> Result<(), fidl::Error> {
589 let _result = self.send_raw(result);
590 self.drop_without_shutdown();
591 _result
592 }
593
594 fn send_raw(&self, mut result: Result<(), ServiceError>) -> Result<(), fidl::Error> {
595 self.control_handle.inner.send::<fidl::encoding::FlexibleResultType<
596 fidl::encoding::EmptyStruct,
597 ServiceError,
598 >>(
599 fidl::encoding::FlexibleResult::new(result),
600 self.tx_id,
601 0x39b64f9031375c29,
602 fidl::encoding::DynamicFlags::FLEXIBLE,
603 )
604 }
605}
606
607#[must_use = "FIDL methods require a response to be sent"]
608#[derive(Debug)]
609pub struct GrpcServerControllerStopResponder {
610 control_handle: std::mem::ManuallyDrop<GrpcServerControllerControlHandle>,
611 tx_id: u32,
612}
613
614impl std::ops::Drop for GrpcServerControllerStopResponder {
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 GrpcServerControllerStopResponder {
626 type ControlHandle = GrpcServerControllerControlHandle;
627
628 fn control_handle(&self) -> &GrpcServerControllerControlHandle {
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 GrpcServerControllerStopResponder {
641 pub fn send(self) -> Result<(), fidl::Error> {
645 let _result = self.send_raw();
646 if _result.is_err() {
647 self.control_handle.shutdown();
648 }
649 self.drop_without_shutdown();
650 _result
651 }
652
653 pub fn send_no_shutdown_on_err(self) -> Result<(), fidl::Error> {
655 let _result = self.send_raw();
656 self.drop_without_shutdown();
657 _result
658 }
659
660 fn send_raw(&self) -> Result<(), fidl::Error> {
661 self.control_handle.inner.send::<fidl::encoding::FlexibleType<fidl::encoding::EmptyStruct>>(
662 fidl::encoding::Flexible::new(()),
663 self.tx_id,
664 0x4e8601feb5d930b9,
665 fidl::encoding::DynamicFlags::FLEXIBLE,
666 )
667 }
668}
669
670#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
671pub struct RootcanalClientControllerMarker;
672
673impl fidl::endpoints::ProtocolMarker for RootcanalClientControllerMarker {
674 type Proxy = RootcanalClientControllerProxy;
675 type RequestStream = RootcanalClientControllerRequestStream;
676 #[cfg(target_os = "fuchsia")]
677 type SynchronousProxy = RootcanalClientControllerSynchronousProxy;
678
679 const DEBUG_NAME: &'static str = "fuchsia.bluetooth.pandora.RootcanalClientController";
680}
681impl fidl::endpoints::DiscoverableProtocolMarker for RootcanalClientControllerMarker {}
682pub type RootcanalClientControllerStartResult = Result<(), ServiceError>;
683
684pub trait RootcanalClientControllerProxyInterface: Send + Sync {
685 type StartResponseFut: std::future::Future<Output = Result<RootcanalClientControllerStartResult, fidl::Error>>
686 + Send;
687 fn r#start(&self, payload: &RootcanalClientControllerStartRequest) -> Self::StartResponseFut;
688 type StopResponseFut: std::future::Future<Output = Result<(), fidl::Error>> + Send;
689 fn r#stop(&self) -> Self::StopResponseFut;
690}
691#[derive(Debug)]
692#[cfg(target_os = "fuchsia")]
693pub struct RootcanalClientControllerSynchronousProxy {
694 client: fidl::client::sync::Client,
695}
696
697#[cfg(target_os = "fuchsia")]
698impl fidl::endpoints::SynchronousProxy for RootcanalClientControllerSynchronousProxy {
699 type Proxy = RootcanalClientControllerProxy;
700 type Protocol = RootcanalClientControllerMarker;
701
702 fn from_channel(inner: fidl::Channel) -> Self {
703 Self::new(inner)
704 }
705
706 fn into_channel(self) -> fidl::Channel {
707 self.client.into_channel()
708 }
709
710 fn as_channel(&self) -> &fidl::Channel {
711 self.client.as_channel()
712 }
713}
714
715#[cfg(target_os = "fuchsia")]
716impl RootcanalClientControllerSynchronousProxy {
717 pub fn new(channel: fidl::Channel) -> Self {
718 let protocol_name =
719 <RootcanalClientControllerMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
720 Self { client: fidl::client::sync::Client::new(channel, protocol_name) }
721 }
722
723 pub fn into_channel(self) -> fidl::Channel {
724 self.client.into_channel()
725 }
726
727 pub fn wait_for_event(
730 &self,
731 deadline: zx::MonotonicInstant,
732 ) -> Result<RootcanalClientControllerEvent, fidl::Error> {
733 RootcanalClientControllerEvent::decode(self.client.wait_for_event(deadline)?)
734 }
735
736 pub fn r#start(
747 &self,
748 mut payload: &RootcanalClientControllerStartRequest,
749 ___deadline: zx::MonotonicInstant,
750 ) -> Result<RootcanalClientControllerStartResult, fidl::Error> {
751 let _response = self.client.send_query::<
752 RootcanalClientControllerStartRequest,
753 fidl::encoding::FlexibleResultType<fidl::encoding::EmptyStruct, ServiceError>,
754 >(
755 payload,
756 0xde429b8e402832c,
757 fidl::encoding::DynamicFlags::FLEXIBLE,
758 ___deadline,
759 )?
760 .into_result::<RootcanalClientControllerMarker>("start")?;
761 Ok(_response.map(|x| x))
762 }
763
764 pub fn r#stop(&self, ___deadline: zx::MonotonicInstant) -> Result<(), fidl::Error> {
766 let _response = self.client.send_query::<
767 fidl::encoding::EmptyPayload,
768 fidl::encoding::FlexibleType<fidl::encoding::EmptyStruct>,
769 >(
770 (),
771 0x30419bba3f039d1d,
772 fidl::encoding::DynamicFlags::FLEXIBLE,
773 ___deadline,
774 )?
775 .into_result::<RootcanalClientControllerMarker>("stop")?;
776 Ok(_response)
777 }
778}
779
780#[cfg(target_os = "fuchsia")]
781impl From<RootcanalClientControllerSynchronousProxy> for zx::Handle {
782 fn from(value: RootcanalClientControllerSynchronousProxy) -> Self {
783 value.into_channel().into()
784 }
785}
786
787#[cfg(target_os = "fuchsia")]
788impl From<fidl::Channel> for RootcanalClientControllerSynchronousProxy {
789 fn from(value: fidl::Channel) -> Self {
790 Self::new(value)
791 }
792}
793
794#[derive(Debug, Clone)]
795pub struct RootcanalClientControllerProxy {
796 client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
797}
798
799impl fidl::endpoints::Proxy for RootcanalClientControllerProxy {
800 type Protocol = RootcanalClientControllerMarker;
801
802 fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
803 Self::new(inner)
804 }
805
806 fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
807 self.client.into_channel().map_err(|client| Self { client })
808 }
809
810 fn as_channel(&self) -> &::fidl::AsyncChannel {
811 self.client.as_channel()
812 }
813}
814
815impl RootcanalClientControllerProxy {
816 pub fn new(channel: ::fidl::AsyncChannel) -> Self {
818 let protocol_name =
819 <RootcanalClientControllerMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
820 Self { client: fidl::client::Client::new(channel, protocol_name) }
821 }
822
823 pub fn take_event_stream(&self) -> RootcanalClientControllerEventStream {
829 RootcanalClientControllerEventStream { event_receiver: self.client.take_event_receiver() }
830 }
831
832 pub fn r#start(
843 &self,
844 mut payload: &RootcanalClientControllerStartRequest,
845 ) -> fidl::client::QueryResponseFut<
846 RootcanalClientControllerStartResult,
847 fidl::encoding::DefaultFuchsiaResourceDialect,
848 > {
849 RootcanalClientControllerProxyInterface::r#start(self, payload)
850 }
851
852 pub fn r#stop(
854 &self,
855 ) -> fidl::client::QueryResponseFut<(), fidl::encoding::DefaultFuchsiaResourceDialect> {
856 RootcanalClientControllerProxyInterface::r#stop(self)
857 }
858}
859
860impl RootcanalClientControllerProxyInterface for RootcanalClientControllerProxy {
861 type StartResponseFut = fidl::client::QueryResponseFut<
862 RootcanalClientControllerStartResult,
863 fidl::encoding::DefaultFuchsiaResourceDialect,
864 >;
865 fn r#start(
866 &self,
867 mut payload: &RootcanalClientControllerStartRequest,
868 ) -> Self::StartResponseFut {
869 fn _decode(
870 mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
871 ) -> Result<RootcanalClientControllerStartResult, fidl::Error> {
872 let _response = fidl::client::decode_transaction_body::<
873 fidl::encoding::FlexibleResultType<fidl::encoding::EmptyStruct, ServiceError>,
874 fidl::encoding::DefaultFuchsiaResourceDialect,
875 0xde429b8e402832c,
876 >(_buf?)?
877 .into_result::<RootcanalClientControllerMarker>("start")?;
878 Ok(_response.map(|x| x))
879 }
880 self.client.send_query_and_decode::<
881 RootcanalClientControllerStartRequest,
882 RootcanalClientControllerStartResult,
883 >(
884 payload,
885 0xde429b8e402832c,
886 fidl::encoding::DynamicFlags::FLEXIBLE,
887 _decode,
888 )
889 }
890
891 type StopResponseFut =
892 fidl::client::QueryResponseFut<(), fidl::encoding::DefaultFuchsiaResourceDialect>;
893 fn r#stop(&self) -> Self::StopResponseFut {
894 fn _decode(
895 mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
896 ) -> Result<(), fidl::Error> {
897 let _response = fidl::client::decode_transaction_body::<
898 fidl::encoding::FlexibleType<fidl::encoding::EmptyStruct>,
899 fidl::encoding::DefaultFuchsiaResourceDialect,
900 0x30419bba3f039d1d,
901 >(_buf?)?
902 .into_result::<RootcanalClientControllerMarker>("stop")?;
903 Ok(_response)
904 }
905 self.client.send_query_and_decode::<fidl::encoding::EmptyPayload, ()>(
906 (),
907 0x30419bba3f039d1d,
908 fidl::encoding::DynamicFlags::FLEXIBLE,
909 _decode,
910 )
911 }
912}
913
914pub struct RootcanalClientControllerEventStream {
915 event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
916}
917
918impl std::marker::Unpin for RootcanalClientControllerEventStream {}
919
920impl futures::stream::FusedStream for RootcanalClientControllerEventStream {
921 fn is_terminated(&self) -> bool {
922 self.event_receiver.is_terminated()
923 }
924}
925
926impl futures::Stream for RootcanalClientControllerEventStream {
927 type Item = Result<RootcanalClientControllerEvent, fidl::Error>;
928
929 fn poll_next(
930 mut self: std::pin::Pin<&mut Self>,
931 cx: &mut std::task::Context<'_>,
932 ) -> std::task::Poll<Option<Self::Item>> {
933 match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
934 &mut self.event_receiver,
935 cx
936 )?) {
937 Some(buf) => std::task::Poll::Ready(Some(RootcanalClientControllerEvent::decode(buf))),
938 None => std::task::Poll::Ready(None),
939 }
940 }
941}
942
943#[derive(Debug)]
944pub enum RootcanalClientControllerEvent {
945 #[non_exhaustive]
946 _UnknownEvent {
947 ordinal: u64,
949 },
950}
951
952impl RootcanalClientControllerEvent {
953 fn decode(
955 mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
956 ) -> Result<RootcanalClientControllerEvent, fidl::Error> {
957 let (bytes, _handles) = buf.split_mut();
958 let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
959 debug_assert_eq!(tx_header.tx_id, 0);
960 match tx_header.ordinal {
961 _ if tx_header.dynamic_flags().contains(fidl::encoding::DynamicFlags::FLEXIBLE) => {
962 Ok(RootcanalClientControllerEvent::_UnknownEvent { ordinal: tx_header.ordinal })
963 }
964 _ => Err(fidl::Error::UnknownOrdinal {
965 ordinal: tx_header.ordinal,
966 protocol_name:
967 <RootcanalClientControllerMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
968 }),
969 }
970 }
971}
972
973pub struct RootcanalClientControllerRequestStream {
975 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
976 is_terminated: bool,
977}
978
979impl std::marker::Unpin for RootcanalClientControllerRequestStream {}
980
981impl futures::stream::FusedStream for RootcanalClientControllerRequestStream {
982 fn is_terminated(&self) -> bool {
983 self.is_terminated
984 }
985}
986
987impl fidl::endpoints::RequestStream for RootcanalClientControllerRequestStream {
988 type Protocol = RootcanalClientControllerMarker;
989 type ControlHandle = RootcanalClientControllerControlHandle;
990
991 fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
992 Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
993 }
994
995 fn control_handle(&self) -> Self::ControlHandle {
996 RootcanalClientControllerControlHandle { inner: self.inner.clone() }
997 }
998
999 fn into_inner(
1000 self,
1001 ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
1002 {
1003 (self.inner, self.is_terminated)
1004 }
1005
1006 fn from_inner(
1007 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
1008 is_terminated: bool,
1009 ) -> Self {
1010 Self { inner, is_terminated }
1011 }
1012}
1013
1014impl futures::Stream for RootcanalClientControllerRequestStream {
1015 type Item = Result<RootcanalClientControllerRequest, fidl::Error>;
1016
1017 fn poll_next(
1018 mut self: std::pin::Pin<&mut Self>,
1019 cx: &mut std::task::Context<'_>,
1020 ) -> std::task::Poll<Option<Self::Item>> {
1021 let this = &mut *self;
1022 if this.inner.check_shutdown(cx) {
1023 this.is_terminated = true;
1024 return std::task::Poll::Ready(None);
1025 }
1026 if this.is_terminated {
1027 panic!("polled RootcanalClientControllerRequestStream after completion");
1028 }
1029 fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
1030 |bytes, handles| {
1031 match this.inner.channel().read_etc(cx, bytes, handles) {
1032 std::task::Poll::Ready(Ok(())) => {}
1033 std::task::Poll::Pending => return std::task::Poll::Pending,
1034 std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
1035 this.is_terminated = true;
1036 return std::task::Poll::Ready(None);
1037 }
1038 std::task::Poll::Ready(Err(e)) => {
1039 return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
1040 e.into(),
1041 ))))
1042 }
1043 }
1044
1045 let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
1047
1048 std::task::Poll::Ready(Some(match header.ordinal {
1049 0xde429b8e402832c => {
1050 header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
1051 let mut req = fidl::new_empty!(RootcanalClientControllerStartRequest, fidl::encoding::DefaultFuchsiaResourceDialect);
1052 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<RootcanalClientControllerStartRequest>(&header, _body_bytes, handles, &mut req)?;
1053 let control_handle = RootcanalClientControllerControlHandle {
1054 inner: this.inner.clone(),
1055 };
1056 Ok(RootcanalClientControllerRequest::Start {payload: req,
1057 responder: RootcanalClientControllerStartResponder {
1058 control_handle: std::mem::ManuallyDrop::new(control_handle),
1059 tx_id: header.tx_id,
1060 },
1061 })
1062 }
1063 0x30419bba3f039d1d => {
1064 header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
1065 let mut req = fidl::new_empty!(fidl::encoding::EmptyPayload, fidl::encoding::DefaultFuchsiaResourceDialect);
1066 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
1067 let control_handle = RootcanalClientControllerControlHandle {
1068 inner: this.inner.clone(),
1069 };
1070 Ok(RootcanalClientControllerRequest::Stop {
1071 responder: RootcanalClientControllerStopResponder {
1072 control_handle: std::mem::ManuallyDrop::new(control_handle),
1073 tx_id: header.tx_id,
1074 },
1075 })
1076 }
1077 _ if header.tx_id == 0 && header.dynamic_flags().contains(fidl::encoding::DynamicFlags::FLEXIBLE) => {
1078 Ok(RootcanalClientControllerRequest::_UnknownMethod {
1079 ordinal: header.ordinal,
1080 control_handle: RootcanalClientControllerControlHandle { inner: this.inner.clone() },
1081 method_type: fidl::MethodType::OneWay,
1082 })
1083 }
1084 _ if header.dynamic_flags().contains(fidl::encoding::DynamicFlags::FLEXIBLE) => {
1085 this.inner.send_framework_err(
1086 fidl::encoding::FrameworkErr::UnknownMethod,
1087 header.tx_id,
1088 header.ordinal,
1089 header.dynamic_flags(),
1090 (bytes, handles),
1091 )?;
1092 Ok(RootcanalClientControllerRequest::_UnknownMethod {
1093 ordinal: header.ordinal,
1094 control_handle: RootcanalClientControllerControlHandle { inner: this.inner.clone() },
1095 method_type: fidl::MethodType::TwoWay,
1096 })
1097 }
1098 _ => Err(fidl::Error::UnknownOrdinal {
1099 ordinal: header.ordinal,
1100 protocol_name: <RootcanalClientControllerMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
1101 }),
1102 }))
1103 },
1104 )
1105 }
1106}
1107
1108#[derive(Debug)]
1111pub enum RootcanalClientControllerRequest {
1112 Start {
1123 payload: RootcanalClientControllerStartRequest,
1124 responder: RootcanalClientControllerStartResponder,
1125 },
1126 Stop { responder: RootcanalClientControllerStopResponder },
1128 #[non_exhaustive]
1130 _UnknownMethod {
1131 ordinal: u64,
1133 control_handle: RootcanalClientControllerControlHandle,
1134 method_type: fidl::MethodType,
1135 },
1136}
1137
1138impl RootcanalClientControllerRequest {
1139 #[allow(irrefutable_let_patterns)]
1140 pub fn into_start(
1141 self,
1142 ) -> Option<(RootcanalClientControllerStartRequest, RootcanalClientControllerStartResponder)>
1143 {
1144 if let RootcanalClientControllerRequest::Start { payload, responder } = self {
1145 Some((payload, responder))
1146 } else {
1147 None
1148 }
1149 }
1150
1151 #[allow(irrefutable_let_patterns)]
1152 pub fn into_stop(self) -> Option<(RootcanalClientControllerStopResponder)> {
1153 if let RootcanalClientControllerRequest::Stop { responder } = self {
1154 Some((responder))
1155 } else {
1156 None
1157 }
1158 }
1159
1160 pub fn method_name(&self) -> &'static str {
1162 match *self {
1163 RootcanalClientControllerRequest::Start { .. } => "start",
1164 RootcanalClientControllerRequest::Stop { .. } => "stop",
1165 RootcanalClientControllerRequest::_UnknownMethod {
1166 method_type: fidl::MethodType::OneWay,
1167 ..
1168 } => "unknown one-way method",
1169 RootcanalClientControllerRequest::_UnknownMethod {
1170 method_type: fidl::MethodType::TwoWay,
1171 ..
1172 } => "unknown two-way method",
1173 }
1174 }
1175}
1176
1177#[derive(Debug, Clone)]
1178pub struct RootcanalClientControllerControlHandle {
1179 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
1180}
1181
1182impl fidl::endpoints::ControlHandle for RootcanalClientControllerControlHandle {
1183 fn shutdown(&self) {
1184 self.inner.shutdown()
1185 }
1186 fn shutdown_with_epitaph(&self, status: zx_status::Status) {
1187 self.inner.shutdown_with_epitaph(status)
1188 }
1189
1190 fn is_closed(&self) -> bool {
1191 self.inner.channel().is_closed()
1192 }
1193 fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
1194 self.inner.channel().on_closed()
1195 }
1196
1197 #[cfg(target_os = "fuchsia")]
1198 fn signal_peer(
1199 &self,
1200 clear_mask: zx::Signals,
1201 set_mask: zx::Signals,
1202 ) -> Result<(), zx_status::Status> {
1203 use fidl::Peered;
1204 self.inner.channel().signal_peer(clear_mask, set_mask)
1205 }
1206}
1207
1208impl RootcanalClientControllerControlHandle {}
1209
1210#[must_use = "FIDL methods require a response to be sent"]
1211#[derive(Debug)]
1212pub struct RootcanalClientControllerStartResponder {
1213 control_handle: std::mem::ManuallyDrop<RootcanalClientControllerControlHandle>,
1214 tx_id: u32,
1215}
1216
1217impl std::ops::Drop for RootcanalClientControllerStartResponder {
1221 fn drop(&mut self) {
1222 self.control_handle.shutdown();
1223 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1225 }
1226}
1227
1228impl fidl::endpoints::Responder for RootcanalClientControllerStartResponder {
1229 type ControlHandle = RootcanalClientControllerControlHandle;
1230
1231 fn control_handle(&self) -> &RootcanalClientControllerControlHandle {
1232 &self.control_handle
1233 }
1234
1235 fn drop_without_shutdown(mut self) {
1236 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1238 std::mem::forget(self);
1240 }
1241}
1242
1243impl RootcanalClientControllerStartResponder {
1244 pub fn send(self, mut result: Result<(), ServiceError>) -> Result<(), fidl::Error> {
1248 let _result = self.send_raw(result);
1249 if _result.is_err() {
1250 self.control_handle.shutdown();
1251 }
1252 self.drop_without_shutdown();
1253 _result
1254 }
1255
1256 pub fn send_no_shutdown_on_err(
1258 self,
1259 mut result: Result<(), ServiceError>,
1260 ) -> Result<(), fidl::Error> {
1261 let _result = self.send_raw(result);
1262 self.drop_without_shutdown();
1263 _result
1264 }
1265
1266 fn send_raw(&self, mut result: Result<(), ServiceError>) -> Result<(), fidl::Error> {
1267 self.control_handle.inner.send::<fidl::encoding::FlexibleResultType<
1268 fidl::encoding::EmptyStruct,
1269 ServiceError,
1270 >>(
1271 fidl::encoding::FlexibleResult::new(result),
1272 self.tx_id,
1273 0xde429b8e402832c,
1274 fidl::encoding::DynamicFlags::FLEXIBLE,
1275 )
1276 }
1277}
1278
1279#[must_use = "FIDL methods require a response to be sent"]
1280#[derive(Debug)]
1281pub struct RootcanalClientControllerStopResponder {
1282 control_handle: std::mem::ManuallyDrop<RootcanalClientControllerControlHandle>,
1283 tx_id: u32,
1284}
1285
1286impl std::ops::Drop for RootcanalClientControllerStopResponder {
1290 fn drop(&mut self) {
1291 self.control_handle.shutdown();
1292 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1294 }
1295}
1296
1297impl fidl::endpoints::Responder for RootcanalClientControllerStopResponder {
1298 type ControlHandle = RootcanalClientControllerControlHandle;
1299
1300 fn control_handle(&self) -> &RootcanalClientControllerControlHandle {
1301 &self.control_handle
1302 }
1303
1304 fn drop_without_shutdown(mut self) {
1305 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1307 std::mem::forget(self);
1309 }
1310}
1311
1312impl RootcanalClientControllerStopResponder {
1313 pub fn send(self) -> Result<(), fidl::Error> {
1317 let _result = self.send_raw();
1318 if _result.is_err() {
1319 self.control_handle.shutdown();
1320 }
1321 self.drop_without_shutdown();
1322 _result
1323 }
1324
1325 pub fn send_no_shutdown_on_err(self) -> Result<(), fidl::Error> {
1327 let _result = self.send_raw();
1328 self.drop_without_shutdown();
1329 _result
1330 }
1331
1332 fn send_raw(&self) -> Result<(), fidl::Error> {
1333 self.control_handle.inner.send::<fidl::encoding::FlexibleType<fidl::encoding::EmptyStruct>>(
1334 fidl::encoding::Flexible::new(()),
1335 self.tx_id,
1336 0x30419bba3f039d1d,
1337 fidl::encoding::DynamicFlags::FLEXIBLE,
1338 )
1339 }
1340}
1341
1342mod internal {
1343 use super::*;
1344}