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_hardware_hidbus_common::*;
11use futures::future::{self, MaybeDone, TryFutureExt};
12use zx_status;
13
14#[derive(Debug, Default, PartialEq)]
15pub struct Report {
16 pub buf: Option<Vec<u8>>,
17 pub timestamp: Option<i64>,
18 pub wake_lease: Option<fidl::EventPair>,
19 #[doc(hidden)]
20 pub __source_breaking: fidl::marker::SourceBreaking,
21}
22
23impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect> for Report {}
24
25#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
26pub struct HidbusMarker;
27
28impl fidl::endpoints::ProtocolMarker for HidbusMarker {
29 type Proxy = HidbusProxy;
30 type RequestStream = HidbusRequestStream;
31 #[cfg(target_os = "fuchsia")]
32 type SynchronousProxy = HidbusSynchronousProxy;
33
34 const DEBUG_NAME: &'static str = "(anonymous) Hidbus";
35}
36pub type HidbusQueryResult = Result<HidInfo, i32>;
37pub type HidbusStartResult = Result<(), i32>;
38pub type HidbusGetDescriptorResult = Result<Vec<u8>, i32>;
39pub type HidbusSetDescriptorResult = Result<(), i32>;
40pub type HidbusGetReportResult = Result<Vec<u8>, i32>;
41pub type HidbusSetReportResult = Result<(), i32>;
42pub type HidbusGetIdleResult = Result<i64, i32>;
43pub type HidbusSetIdleResult = Result<(), i32>;
44pub type HidbusGetProtocolResult = Result<HidProtocol, i32>;
45pub type HidbusSetProtocolResult = Result<(), i32>;
46
47pub trait HidbusProxyInterface: Send + Sync {
48 type QueryResponseFut: std::future::Future<Output = Result<HidbusQueryResult, fidl::Error>>
49 + Send;
50 fn r#query(&self) -> Self::QueryResponseFut;
51 type StartResponseFut: std::future::Future<Output = Result<HidbusStartResult, fidl::Error>>
52 + Send;
53 fn r#start(&self) -> Self::StartResponseFut;
54 type StopResponseFut: std::future::Future<Output = Result<(), fidl::Error>> + Send;
55 fn r#stop(&self) -> Self::StopResponseFut;
56 type GetDescriptorResponseFut: std::future::Future<Output = Result<HidbusGetDescriptorResult, fidl::Error>>
57 + Send;
58 fn r#get_descriptor(&self, desc_type: HidDescriptorType) -> Self::GetDescriptorResponseFut;
59 type SetDescriptorResponseFut: std::future::Future<Output = Result<HidbusSetDescriptorResult, fidl::Error>>
60 + Send;
61 fn r#set_descriptor(
62 &self,
63 desc_type: HidDescriptorType,
64 data: &[u8],
65 ) -> Self::SetDescriptorResponseFut;
66 type GetReportResponseFut: std::future::Future<Output = Result<HidbusGetReportResult, fidl::Error>>
67 + Send;
68 fn r#get_report(
69 &self,
70 rpt_type: ReportType,
71 rpt_id: u8,
72 len: u64,
73 ) -> Self::GetReportResponseFut;
74 type SetReportResponseFut: std::future::Future<Output = Result<HidbusSetReportResult, fidl::Error>>
75 + Send;
76 fn r#set_report(
77 &self,
78 rpt_type: ReportType,
79 rpt_id: u8,
80 data: &[u8],
81 ) -> Self::SetReportResponseFut;
82 type GetIdleResponseFut: std::future::Future<Output = Result<HidbusGetIdleResult, fidl::Error>>
83 + Send;
84 fn r#get_idle(&self, rpt_id: u8) -> Self::GetIdleResponseFut;
85 type SetIdleResponseFut: std::future::Future<Output = Result<HidbusSetIdleResult, fidl::Error>>
86 + Send;
87 fn r#set_idle(&self, rpt_id: u8, duration: i64) -> Self::SetIdleResponseFut;
88 type GetProtocolResponseFut: std::future::Future<Output = Result<HidbusGetProtocolResult, fidl::Error>>
89 + Send;
90 fn r#get_protocol(&self) -> Self::GetProtocolResponseFut;
91 type SetProtocolResponseFut: std::future::Future<Output = Result<HidbusSetProtocolResult, fidl::Error>>
92 + Send;
93 fn r#set_protocol(&self, protocol: HidProtocol) -> Self::SetProtocolResponseFut;
94}
95#[derive(Debug)]
96#[cfg(target_os = "fuchsia")]
97pub struct HidbusSynchronousProxy {
98 client: fidl::client::sync::Client,
99}
100
101#[cfg(target_os = "fuchsia")]
102impl fidl::endpoints::SynchronousProxy for HidbusSynchronousProxy {
103 type Proxy = HidbusProxy;
104 type Protocol = HidbusMarker;
105
106 fn from_channel(inner: fidl::Channel) -> Self {
107 Self::new(inner)
108 }
109
110 fn into_channel(self) -> fidl::Channel {
111 self.client.into_channel()
112 }
113
114 fn as_channel(&self) -> &fidl::Channel {
115 self.client.as_channel()
116 }
117}
118
119#[cfg(target_os = "fuchsia")]
120impl HidbusSynchronousProxy {
121 pub fn new(channel: fidl::Channel) -> Self {
122 let protocol_name = <HidbusMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
123 Self { client: fidl::client::sync::Client::new(channel, protocol_name) }
124 }
125
126 pub fn into_channel(self) -> fidl::Channel {
127 self.client.into_channel()
128 }
129
130 pub fn wait_for_event(
133 &self,
134 deadline: zx::MonotonicInstant,
135 ) -> Result<HidbusEvent, fidl::Error> {
136 HidbusEvent::decode(self.client.wait_for_event(deadline)?)
137 }
138
139 pub fn r#query(
142 &self,
143 ___deadline: zx::MonotonicInstant,
144 ) -> Result<HidbusQueryResult, fidl::Error> {
145 let _response = self.client.send_query::<
146 fidl::encoding::EmptyPayload,
147 fidl::encoding::ResultType<HidbusQueryResponse, i32>,
148 >(
149 (),
150 0x23eb61f83d06efa9,
151 fidl::encoding::DynamicFlags::empty(),
152 ___deadline,
153 )?;
154 Ok(_response.map(|x| x.info))
155 }
156
157 pub fn r#start(
164 &self,
165 ___deadline: zx::MonotonicInstant,
166 ) -> Result<HidbusStartResult, fidl::Error> {
167 let _response = self.client.send_query::<
168 fidl::encoding::EmptyPayload,
169 fidl::encoding::ResultType<fidl::encoding::EmptyStruct, i32>,
170 >(
171 (),
172 0x1ba15adf96bade4a,
173 fidl::encoding::DynamicFlags::empty(),
174 ___deadline,
175 )?;
176 Ok(_response.map(|x| x))
177 }
178
179 pub fn r#stop(&self, ___deadline: zx::MonotonicInstant) -> Result<(), fidl::Error> {
181 let _response =
182 self.client.send_query::<fidl::encoding::EmptyPayload, fidl::encoding::EmptyPayload>(
183 (),
184 0x61b973ecd69cfff8,
185 fidl::encoding::DynamicFlags::empty(),
186 ___deadline,
187 )?;
188 Ok(_response)
189 }
190
191 pub fn r#get_descriptor(
194 &self,
195 mut desc_type: HidDescriptorType,
196 ___deadline: zx::MonotonicInstant,
197 ) -> Result<HidbusGetDescriptorResult, fidl::Error> {
198 let _response = self.client.send_query::<
199 HidbusGetDescriptorRequest,
200 fidl::encoding::ResultType<HidbusGetDescriptorResponse, i32>,
201 >(
202 (desc_type,),
203 0x29343a1289ceb2e5,
204 fidl::encoding::DynamicFlags::empty(),
205 ___deadline,
206 )?;
207 Ok(_response.map(|x| x.data))
208 }
209
210 pub fn r#set_descriptor(
212 &self,
213 mut desc_type: HidDescriptorType,
214 mut data: &[u8],
215 ___deadline: zx::MonotonicInstant,
216 ) -> Result<HidbusSetDescriptorResult, fidl::Error> {
217 let _response = self.client.send_query::<
218 HidbusSetDescriptorRequest,
219 fidl::encoding::ResultType<fidl::encoding::EmptyStruct, i32>,
220 >(
221 (desc_type, data,),
222 0x7567278eba076777,
223 fidl::encoding::DynamicFlags::empty(),
224 ___deadline,
225 )?;
226 Ok(_response.map(|x| x))
227 }
228
229 pub fn r#get_report(
231 &self,
232 mut rpt_type: ReportType,
233 mut rpt_id: u8,
234 mut len: u64,
235 ___deadline: zx::MonotonicInstant,
236 ) -> Result<HidbusGetReportResult, fidl::Error> {
237 let _response = self.client.send_query::<
238 HidbusGetReportRequest,
239 fidl::encoding::ResultType<HidbusGetReportResponse, i32>,
240 >(
241 (rpt_type, rpt_id, len,),
242 0x69b5538a28dc472c,
243 fidl::encoding::DynamicFlags::empty(),
244 ___deadline,
245 )?;
246 Ok(_response.map(|x| x.data))
247 }
248
249 pub fn r#set_report(
251 &self,
252 mut rpt_type: ReportType,
253 mut rpt_id: u8,
254 mut data: &[u8],
255 ___deadline: zx::MonotonicInstant,
256 ) -> Result<HidbusSetReportResult, fidl::Error> {
257 let _response = self.client.send_query::<
258 HidbusSetReportRequest,
259 fidl::encoding::ResultType<fidl::encoding::EmptyStruct, i32>,
260 >(
261 (rpt_type, rpt_id, data,),
262 0x1172863081673c55,
263 fidl::encoding::DynamicFlags::empty(),
264 ___deadline,
265 )?;
266 Ok(_response.map(|x| x))
267 }
268
269 pub fn r#get_idle(
271 &self,
272 mut rpt_id: u8,
273 ___deadline: zx::MonotonicInstant,
274 ) -> Result<HidbusGetIdleResult, fidl::Error> {
275 let _response = self.client.send_query::<
276 HidbusGetIdleRequest,
277 fidl::encoding::ResultType<HidbusGetIdleResponse, i32>,
278 >(
279 (rpt_id,),
280 0xa95c2c504d9aa0b,
281 fidl::encoding::DynamicFlags::empty(),
282 ___deadline,
283 )?;
284 Ok(_response.map(|x| x.duration))
285 }
286
287 pub fn r#set_idle(
289 &self,
290 mut rpt_id: u8,
291 mut duration: i64,
292 ___deadline: zx::MonotonicInstant,
293 ) -> Result<HidbusSetIdleResult, fidl::Error> {
294 let _response = self.client.send_query::<
295 HidbusSetIdleRequest,
296 fidl::encoding::ResultType<fidl::encoding::EmptyStruct, i32>,
297 >(
298 (rpt_id, duration,),
299 0x7c387cbaa4c09b3c,
300 fidl::encoding::DynamicFlags::empty(),
301 ___deadline,
302 )?;
303 Ok(_response.map(|x| x))
304 }
305
306 pub fn r#get_protocol(
308 &self,
309 ___deadline: zx::MonotonicInstant,
310 ) -> Result<HidbusGetProtocolResult, fidl::Error> {
311 let _response = self.client.send_query::<
312 fidl::encoding::EmptyPayload,
313 fidl::encoding::ResultType<HidbusGetProtocolResponse, i32>,
314 >(
315 (),
316 0x3ec61a9b2d5c50eb,
317 fidl::encoding::DynamicFlags::empty(),
318 ___deadline,
319 )?;
320 Ok(_response.map(|x| x.protocol))
321 }
322
323 pub fn r#set_protocol(
325 &self,
326 mut protocol: HidProtocol,
327 ___deadline: zx::MonotonicInstant,
328 ) -> Result<HidbusSetProtocolResult, fidl::Error> {
329 let _response = self.client.send_query::<
330 HidbusSetProtocolRequest,
331 fidl::encoding::ResultType<fidl::encoding::EmptyStruct, i32>,
332 >(
333 (protocol,),
334 0x1655cdfd0f316b0b,
335 fidl::encoding::DynamicFlags::empty(),
336 ___deadline,
337 )?;
338 Ok(_response.map(|x| x))
339 }
340}
341
342#[cfg(target_os = "fuchsia")]
343impl From<HidbusSynchronousProxy> for zx::Handle {
344 fn from(value: HidbusSynchronousProxy) -> Self {
345 value.into_channel().into()
346 }
347}
348
349#[cfg(target_os = "fuchsia")]
350impl From<fidl::Channel> for HidbusSynchronousProxy {
351 fn from(value: fidl::Channel) -> Self {
352 Self::new(value)
353 }
354}
355
356#[derive(Debug, Clone)]
357pub struct HidbusProxy {
358 client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
359}
360
361impl fidl::endpoints::Proxy for HidbusProxy {
362 type Protocol = HidbusMarker;
363
364 fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
365 Self::new(inner)
366 }
367
368 fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
369 self.client.into_channel().map_err(|client| Self { client })
370 }
371
372 fn as_channel(&self) -> &::fidl::AsyncChannel {
373 self.client.as_channel()
374 }
375}
376
377impl HidbusProxy {
378 pub fn new(channel: ::fidl::AsyncChannel) -> Self {
380 let protocol_name = <HidbusMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
381 Self { client: fidl::client::Client::new(channel, protocol_name) }
382 }
383
384 pub fn take_event_stream(&self) -> HidbusEventStream {
390 HidbusEventStream { event_receiver: self.client.take_event_receiver() }
391 }
392
393 pub fn r#query(
396 &self,
397 ) -> fidl::client::QueryResponseFut<
398 HidbusQueryResult,
399 fidl::encoding::DefaultFuchsiaResourceDialect,
400 > {
401 HidbusProxyInterface::r#query(self)
402 }
403
404 pub fn r#start(
411 &self,
412 ) -> fidl::client::QueryResponseFut<
413 HidbusStartResult,
414 fidl::encoding::DefaultFuchsiaResourceDialect,
415 > {
416 HidbusProxyInterface::r#start(self)
417 }
418
419 pub fn r#stop(
421 &self,
422 ) -> fidl::client::QueryResponseFut<(), fidl::encoding::DefaultFuchsiaResourceDialect> {
423 HidbusProxyInterface::r#stop(self)
424 }
425
426 pub fn r#get_descriptor(
429 &self,
430 mut desc_type: HidDescriptorType,
431 ) -> fidl::client::QueryResponseFut<
432 HidbusGetDescriptorResult,
433 fidl::encoding::DefaultFuchsiaResourceDialect,
434 > {
435 HidbusProxyInterface::r#get_descriptor(self, desc_type)
436 }
437
438 pub fn r#set_descriptor(
440 &self,
441 mut desc_type: HidDescriptorType,
442 mut data: &[u8],
443 ) -> fidl::client::QueryResponseFut<
444 HidbusSetDescriptorResult,
445 fidl::encoding::DefaultFuchsiaResourceDialect,
446 > {
447 HidbusProxyInterface::r#set_descriptor(self, desc_type, data)
448 }
449
450 pub fn r#get_report(
452 &self,
453 mut rpt_type: ReportType,
454 mut rpt_id: u8,
455 mut len: u64,
456 ) -> fidl::client::QueryResponseFut<
457 HidbusGetReportResult,
458 fidl::encoding::DefaultFuchsiaResourceDialect,
459 > {
460 HidbusProxyInterface::r#get_report(self, rpt_type, rpt_id, len)
461 }
462
463 pub fn r#set_report(
465 &self,
466 mut rpt_type: ReportType,
467 mut rpt_id: u8,
468 mut data: &[u8],
469 ) -> fidl::client::QueryResponseFut<
470 HidbusSetReportResult,
471 fidl::encoding::DefaultFuchsiaResourceDialect,
472 > {
473 HidbusProxyInterface::r#set_report(self, rpt_type, rpt_id, data)
474 }
475
476 pub fn r#get_idle(
478 &self,
479 mut rpt_id: u8,
480 ) -> fidl::client::QueryResponseFut<
481 HidbusGetIdleResult,
482 fidl::encoding::DefaultFuchsiaResourceDialect,
483 > {
484 HidbusProxyInterface::r#get_idle(self, rpt_id)
485 }
486
487 pub fn r#set_idle(
489 &self,
490 mut rpt_id: u8,
491 mut duration: i64,
492 ) -> fidl::client::QueryResponseFut<
493 HidbusSetIdleResult,
494 fidl::encoding::DefaultFuchsiaResourceDialect,
495 > {
496 HidbusProxyInterface::r#set_idle(self, rpt_id, duration)
497 }
498
499 pub fn r#get_protocol(
501 &self,
502 ) -> fidl::client::QueryResponseFut<
503 HidbusGetProtocolResult,
504 fidl::encoding::DefaultFuchsiaResourceDialect,
505 > {
506 HidbusProxyInterface::r#get_protocol(self)
507 }
508
509 pub fn r#set_protocol(
511 &self,
512 mut protocol: HidProtocol,
513 ) -> fidl::client::QueryResponseFut<
514 HidbusSetProtocolResult,
515 fidl::encoding::DefaultFuchsiaResourceDialect,
516 > {
517 HidbusProxyInterface::r#set_protocol(self, protocol)
518 }
519}
520
521impl HidbusProxyInterface for HidbusProxy {
522 type QueryResponseFut = fidl::client::QueryResponseFut<
523 HidbusQueryResult,
524 fidl::encoding::DefaultFuchsiaResourceDialect,
525 >;
526 fn r#query(&self) -> Self::QueryResponseFut {
527 fn _decode(
528 mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
529 ) -> Result<HidbusQueryResult, fidl::Error> {
530 let _response = fidl::client::decode_transaction_body::<
531 fidl::encoding::ResultType<HidbusQueryResponse, i32>,
532 fidl::encoding::DefaultFuchsiaResourceDialect,
533 0x23eb61f83d06efa9,
534 >(_buf?)?;
535 Ok(_response.map(|x| x.info))
536 }
537 self.client.send_query_and_decode::<fidl::encoding::EmptyPayload, HidbusQueryResult>(
538 (),
539 0x23eb61f83d06efa9,
540 fidl::encoding::DynamicFlags::empty(),
541 _decode,
542 )
543 }
544
545 type StartResponseFut = fidl::client::QueryResponseFut<
546 HidbusStartResult,
547 fidl::encoding::DefaultFuchsiaResourceDialect,
548 >;
549 fn r#start(&self) -> Self::StartResponseFut {
550 fn _decode(
551 mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
552 ) -> Result<HidbusStartResult, fidl::Error> {
553 let _response = fidl::client::decode_transaction_body::<
554 fidl::encoding::ResultType<fidl::encoding::EmptyStruct, i32>,
555 fidl::encoding::DefaultFuchsiaResourceDialect,
556 0x1ba15adf96bade4a,
557 >(_buf?)?;
558 Ok(_response.map(|x| x))
559 }
560 self.client.send_query_and_decode::<fidl::encoding::EmptyPayload, HidbusStartResult>(
561 (),
562 0x1ba15adf96bade4a,
563 fidl::encoding::DynamicFlags::empty(),
564 _decode,
565 )
566 }
567
568 type StopResponseFut =
569 fidl::client::QueryResponseFut<(), fidl::encoding::DefaultFuchsiaResourceDialect>;
570 fn r#stop(&self) -> Self::StopResponseFut {
571 fn _decode(
572 mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
573 ) -> Result<(), fidl::Error> {
574 let _response = fidl::client::decode_transaction_body::<
575 fidl::encoding::EmptyPayload,
576 fidl::encoding::DefaultFuchsiaResourceDialect,
577 0x61b973ecd69cfff8,
578 >(_buf?)?;
579 Ok(_response)
580 }
581 self.client.send_query_and_decode::<fidl::encoding::EmptyPayload, ()>(
582 (),
583 0x61b973ecd69cfff8,
584 fidl::encoding::DynamicFlags::empty(),
585 _decode,
586 )
587 }
588
589 type GetDescriptorResponseFut = fidl::client::QueryResponseFut<
590 HidbusGetDescriptorResult,
591 fidl::encoding::DefaultFuchsiaResourceDialect,
592 >;
593 fn r#get_descriptor(&self, mut desc_type: HidDescriptorType) -> Self::GetDescriptorResponseFut {
594 fn _decode(
595 mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
596 ) -> Result<HidbusGetDescriptorResult, fidl::Error> {
597 let _response = fidl::client::decode_transaction_body::<
598 fidl::encoding::ResultType<HidbusGetDescriptorResponse, i32>,
599 fidl::encoding::DefaultFuchsiaResourceDialect,
600 0x29343a1289ceb2e5,
601 >(_buf?)?;
602 Ok(_response.map(|x| x.data))
603 }
604 self.client.send_query_and_decode::<HidbusGetDescriptorRequest, HidbusGetDescriptorResult>(
605 (desc_type,),
606 0x29343a1289ceb2e5,
607 fidl::encoding::DynamicFlags::empty(),
608 _decode,
609 )
610 }
611
612 type SetDescriptorResponseFut = fidl::client::QueryResponseFut<
613 HidbusSetDescriptorResult,
614 fidl::encoding::DefaultFuchsiaResourceDialect,
615 >;
616 fn r#set_descriptor(
617 &self,
618 mut desc_type: HidDescriptorType,
619 mut data: &[u8],
620 ) -> Self::SetDescriptorResponseFut {
621 fn _decode(
622 mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
623 ) -> Result<HidbusSetDescriptorResult, fidl::Error> {
624 let _response = fidl::client::decode_transaction_body::<
625 fidl::encoding::ResultType<fidl::encoding::EmptyStruct, i32>,
626 fidl::encoding::DefaultFuchsiaResourceDialect,
627 0x7567278eba076777,
628 >(_buf?)?;
629 Ok(_response.map(|x| x))
630 }
631 self.client.send_query_and_decode::<HidbusSetDescriptorRequest, HidbusSetDescriptorResult>(
632 (desc_type, data),
633 0x7567278eba076777,
634 fidl::encoding::DynamicFlags::empty(),
635 _decode,
636 )
637 }
638
639 type GetReportResponseFut = fidl::client::QueryResponseFut<
640 HidbusGetReportResult,
641 fidl::encoding::DefaultFuchsiaResourceDialect,
642 >;
643 fn r#get_report(
644 &self,
645 mut rpt_type: ReportType,
646 mut rpt_id: u8,
647 mut len: u64,
648 ) -> Self::GetReportResponseFut {
649 fn _decode(
650 mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
651 ) -> Result<HidbusGetReportResult, fidl::Error> {
652 let _response = fidl::client::decode_transaction_body::<
653 fidl::encoding::ResultType<HidbusGetReportResponse, i32>,
654 fidl::encoding::DefaultFuchsiaResourceDialect,
655 0x69b5538a28dc472c,
656 >(_buf?)?;
657 Ok(_response.map(|x| x.data))
658 }
659 self.client.send_query_and_decode::<HidbusGetReportRequest, HidbusGetReportResult>(
660 (rpt_type, rpt_id, len),
661 0x69b5538a28dc472c,
662 fidl::encoding::DynamicFlags::empty(),
663 _decode,
664 )
665 }
666
667 type SetReportResponseFut = fidl::client::QueryResponseFut<
668 HidbusSetReportResult,
669 fidl::encoding::DefaultFuchsiaResourceDialect,
670 >;
671 fn r#set_report(
672 &self,
673 mut rpt_type: ReportType,
674 mut rpt_id: u8,
675 mut data: &[u8],
676 ) -> Self::SetReportResponseFut {
677 fn _decode(
678 mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
679 ) -> Result<HidbusSetReportResult, fidl::Error> {
680 let _response = fidl::client::decode_transaction_body::<
681 fidl::encoding::ResultType<fidl::encoding::EmptyStruct, i32>,
682 fidl::encoding::DefaultFuchsiaResourceDialect,
683 0x1172863081673c55,
684 >(_buf?)?;
685 Ok(_response.map(|x| x))
686 }
687 self.client.send_query_and_decode::<HidbusSetReportRequest, HidbusSetReportResult>(
688 (rpt_type, rpt_id, data),
689 0x1172863081673c55,
690 fidl::encoding::DynamicFlags::empty(),
691 _decode,
692 )
693 }
694
695 type GetIdleResponseFut = fidl::client::QueryResponseFut<
696 HidbusGetIdleResult,
697 fidl::encoding::DefaultFuchsiaResourceDialect,
698 >;
699 fn r#get_idle(&self, mut rpt_id: u8) -> Self::GetIdleResponseFut {
700 fn _decode(
701 mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
702 ) -> Result<HidbusGetIdleResult, fidl::Error> {
703 let _response = fidl::client::decode_transaction_body::<
704 fidl::encoding::ResultType<HidbusGetIdleResponse, i32>,
705 fidl::encoding::DefaultFuchsiaResourceDialect,
706 0xa95c2c504d9aa0b,
707 >(_buf?)?;
708 Ok(_response.map(|x| x.duration))
709 }
710 self.client.send_query_and_decode::<HidbusGetIdleRequest, HidbusGetIdleResult>(
711 (rpt_id,),
712 0xa95c2c504d9aa0b,
713 fidl::encoding::DynamicFlags::empty(),
714 _decode,
715 )
716 }
717
718 type SetIdleResponseFut = fidl::client::QueryResponseFut<
719 HidbusSetIdleResult,
720 fidl::encoding::DefaultFuchsiaResourceDialect,
721 >;
722 fn r#set_idle(&self, mut rpt_id: u8, mut duration: i64) -> Self::SetIdleResponseFut {
723 fn _decode(
724 mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
725 ) -> Result<HidbusSetIdleResult, fidl::Error> {
726 let _response = fidl::client::decode_transaction_body::<
727 fidl::encoding::ResultType<fidl::encoding::EmptyStruct, i32>,
728 fidl::encoding::DefaultFuchsiaResourceDialect,
729 0x7c387cbaa4c09b3c,
730 >(_buf?)?;
731 Ok(_response.map(|x| x))
732 }
733 self.client.send_query_and_decode::<HidbusSetIdleRequest, HidbusSetIdleResult>(
734 (rpt_id, duration),
735 0x7c387cbaa4c09b3c,
736 fidl::encoding::DynamicFlags::empty(),
737 _decode,
738 )
739 }
740
741 type GetProtocolResponseFut = fidl::client::QueryResponseFut<
742 HidbusGetProtocolResult,
743 fidl::encoding::DefaultFuchsiaResourceDialect,
744 >;
745 fn r#get_protocol(&self) -> Self::GetProtocolResponseFut {
746 fn _decode(
747 mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
748 ) -> Result<HidbusGetProtocolResult, fidl::Error> {
749 let _response = fidl::client::decode_transaction_body::<
750 fidl::encoding::ResultType<HidbusGetProtocolResponse, i32>,
751 fidl::encoding::DefaultFuchsiaResourceDialect,
752 0x3ec61a9b2d5c50eb,
753 >(_buf?)?;
754 Ok(_response.map(|x| x.protocol))
755 }
756 self.client.send_query_and_decode::<fidl::encoding::EmptyPayload, HidbusGetProtocolResult>(
757 (),
758 0x3ec61a9b2d5c50eb,
759 fidl::encoding::DynamicFlags::empty(),
760 _decode,
761 )
762 }
763
764 type SetProtocolResponseFut = fidl::client::QueryResponseFut<
765 HidbusSetProtocolResult,
766 fidl::encoding::DefaultFuchsiaResourceDialect,
767 >;
768 fn r#set_protocol(&self, mut protocol: HidProtocol) -> Self::SetProtocolResponseFut {
769 fn _decode(
770 mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
771 ) -> Result<HidbusSetProtocolResult, fidl::Error> {
772 let _response = fidl::client::decode_transaction_body::<
773 fidl::encoding::ResultType<fidl::encoding::EmptyStruct, i32>,
774 fidl::encoding::DefaultFuchsiaResourceDialect,
775 0x1655cdfd0f316b0b,
776 >(_buf?)?;
777 Ok(_response.map(|x| x))
778 }
779 self.client.send_query_and_decode::<HidbusSetProtocolRequest, HidbusSetProtocolResult>(
780 (protocol,),
781 0x1655cdfd0f316b0b,
782 fidl::encoding::DynamicFlags::empty(),
783 _decode,
784 )
785 }
786}
787
788pub struct HidbusEventStream {
789 event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
790}
791
792impl std::marker::Unpin for HidbusEventStream {}
793
794impl futures::stream::FusedStream for HidbusEventStream {
795 fn is_terminated(&self) -> bool {
796 self.event_receiver.is_terminated()
797 }
798}
799
800impl futures::Stream for HidbusEventStream {
801 type Item = Result<HidbusEvent, fidl::Error>;
802
803 fn poll_next(
804 mut self: std::pin::Pin<&mut Self>,
805 cx: &mut std::task::Context<'_>,
806 ) -> std::task::Poll<Option<Self::Item>> {
807 match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
808 &mut self.event_receiver,
809 cx
810 )?) {
811 Some(buf) => std::task::Poll::Ready(Some(HidbusEvent::decode(buf))),
812 None => std::task::Poll::Ready(None),
813 }
814 }
815}
816
817#[derive(Debug)]
818pub enum HidbusEvent {
819 OnReportReceived { payload: Report },
820}
821
822impl HidbusEvent {
823 #[allow(irrefutable_let_patterns)]
824 pub fn into_on_report_received(self) -> Option<Report> {
825 if let HidbusEvent::OnReportReceived { payload } = self {
826 Some((payload))
827 } else {
828 None
829 }
830 }
831
832 fn decode(
834 mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
835 ) -> Result<HidbusEvent, fidl::Error> {
836 let (bytes, _handles) = buf.split_mut();
837 let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
838 debug_assert_eq!(tx_header.tx_id, 0);
839 match tx_header.ordinal {
840 0x6093963f2efe1e56 => {
841 let mut out =
842 fidl::new_empty!(Report, fidl::encoding::DefaultFuchsiaResourceDialect);
843 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<Report>(&tx_header, _body_bytes, _handles, &mut out)?;
844 Ok((HidbusEvent::OnReportReceived { payload: out }))
845 }
846 _ => Err(fidl::Error::UnknownOrdinal {
847 ordinal: tx_header.ordinal,
848 protocol_name: <HidbusMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
849 }),
850 }
851 }
852}
853
854pub struct HidbusRequestStream {
856 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
857 is_terminated: bool,
858}
859
860impl std::marker::Unpin for HidbusRequestStream {}
861
862impl futures::stream::FusedStream for HidbusRequestStream {
863 fn is_terminated(&self) -> bool {
864 self.is_terminated
865 }
866}
867
868impl fidl::endpoints::RequestStream for HidbusRequestStream {
869 type Protocol = HidbusMarker;
870 type ControlHandle = HidbusControlHandle;
871
872 fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
873 Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
874 }
875
876 fn control_handle(&self) -> Self::ControlHandle {
877 HidbusControlHandle { inner: self.inner.clone() }
878 }
879
880 fn into_inner(
881 self,
882 ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
883 {
884 (self.inner, self.is_terminated)
885 }
886
887 fn from_inner(
888 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
889 is_terminated: bool,
890 ) -> Self {
891 Self { inner, is_terminated }
892 }
893}
894
895impl futures::Stream for HidbusRequestStream {
896 type Item = Result<HidbusRequest, fidl::Error>;
897
898 fn poll_next(
899 mut self: std::pin::Pin<&mut Self>,
900 cx: &mut std::task::Context<'_>,
901 ) -> std::task::Poll<Option<Self::Item>> {
902 let this = &mut *self;
903 if this.inner.check_shutdown(cx) {
904 this.is_terminated = true;
905 return std::task::Poll::Ready(None);
906 }
907 if this.is_terminated {
908 panic!("polled HidbusRequestStream after completion");
909 }
910 fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
911 |bytes, handles| {
912 match this.inner.channel().read_etc(cx, bytes, handles) {
913 std::task::Poll::Ready(Ok(())) => {}
914 std::task::Poll::Pending => return std::task::Poll::Pending,
915 std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
916 this.is_terminated = true;
917 return std::task::Poll::Ready(None);
918 }
919 std::task::Poll::Ready(Err(e)) => {
920 return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
921 e.into(),
922 ))))
923 }
924 }
925
926 let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
928
929 std::task::Poll::Ready(Some(match header.ordinal {
930 0x23eb61f83d06efa9 => {
931 header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
932 let mut req = fidl::new_empty!(
933 fidl::encoding::EmptyPayload,
934 fidl::encoding::DefaultFuchsiaResourceDialect
935 );
936 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
937 let control_handle = HidbusControlHandle { inner: this.inner.clone() };
938 Ok(HidbusRequest::Query {
939 responder: HidbusQueryResponder {
940 control_handle: std::mem::ManuallyDrop::new(control_handle),
941 tx_id: header.tx_id,
942 },
943 })
944 }
945 0x1ba15adf96bade4a => {
946 header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
947 let mut req = fidl::new_empty!(
948 fidl::encoding::EmptyPayload,
949 fidl::encoding::DefaultFuchsiaResourceDialect
950 );
951 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
952 let control_handle = HidbusControlHandle { inner: this.inner.clone() };
953 Ok(HidbusRequest::Start {
954 responder: HidbusStartResponder {
955 control_handle: std::mem::ManuallyDrop::new(control_handle),
956 tx_id: header.tx_id,
957 },
958 })
959 }
960 0x61b973ecd69cfff8 => {
961 header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
962 let mut req = fidl::new_empty!(
963 fidl::encoding::EmptyPayload,
964 fidl::encoding::DefaultFuchsiaResourceDialect
965 );
966 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
967 let control_handle = HidbusControlHandle { inner: this.inner.clone() };
968 Ok(HidbusRequest::Stop {
969 responder: HidbusStopResponder {
970 control_handle: std::mem::ManuallyDrop::new(control_handle),
971 tx_id: header.tx_id,
972 },
973 })
974 }
975 0x29343a1289ceb2e5 => {
976 header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
977 let mut req = fidl::new_empty!(
978 HidbusGetDescriptorRequest,
979 fidl::encoding::DefaultFuchsiaResourceDialect
980 );
981 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<HidbusGetDescriptorRequest>(&header, _body_bytes, handles, &mut req)?;
982 let control_handle = HidbusControlHandle { inner: this.inner.clone() };
983 Ok(HidbusRequest::GetDescriptor {
984 desc_type: req.desc_type,
985
986 responder: HidbusGetDescriptorResponder {
987 control_handle: std::mem::ManuallyDrop::new(control_handle),
988 tx_id: header.tx_id,
989 },
990 })
991 }
992 0x7567278eba076777 => {
993 header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
994 let mut req = fidl::new_empty!(
995 HidbusSetDescriptorRequest,
996 fidl::encoding::DefaultFuchsiaResourceDialect
997 );
998 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<HidbusSetDescriptorRequest>(&header, _body_bytes, handles, &mut req)?;
999 let control_handle = HidbusControlHandle { inner: this.inner.clone() };
1000 Ok(HidbusRequest::SetDescriptor {
1001 desc_type: req.desc_type,
1002 data: req.data,
1003
1004 responder: HidbusSetDescriptorResponder {
1005 control_handle: std::mem::ManuallyDrop::new(control_handle),
1006 tx_id: header.tx_id,
1007 },
1008 })
1009 }
1010 0x69b5538a28dc472c => {
1011 header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
1012 let mut req = fidl::new_empty!(
1013 HidbusGetReportRequest,
1014 fidl::encoding::DefaultFuchsiaResourceDialect
1015 );
1016 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<HidbusGetReportRequest>(&header, _body_bytes, handles, &mut req)?;
1017 let control_handle = HidbusControlHandle { inner: this.inner.clone() };
1018 Ok(HidbusRequest::GetReport {
1019 rpt_type: req.rpt_type,
1020 rpt_id: req.rpt_id,
1021 len: req.len,
1022
1023 responder: HidbusGetReportResponder {
1024 control_handle: std::mem::ManuallyDrop::new(control_handle),
1025 tx_id: header.tx_id,
1026 },
1027 })
1028 }
1029 0x1172863081673c55 => {
1030 header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
1031 let mut req = fidl::new_empty!(
1032 HidbusSetReportRequest,
1033 fidl::encoding::DefaultFuchsiaResourceDialect
1034 );
1035 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<HidbusSetReportRequest>(&header, _body_bytes, handles, &mut req)?;
1036 let control_handle = HidbusControlHandle { inner: this.inner.clone() };
1037 Ok(HidbusRequest::SetReport {
1038 rpt_type: req.rpt_type,
1039 rpt_id: req.rpt_id,
1040 data: req.data,
1041
1042 responder: HidbusSetReportResponder {
1043 control_handle: std::mem::ManuallyDrop::new(control_handle),
1044 tx_id: header.tx_id,
1045 },
1046 })
1047 }
1048 0xa95c2c504d9aa0b => {
1049 header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
1050 let mut req = fidl::new_empty!(
1051 HidbusGetIdleRequest,
1052 fidl::encoding::DefaultFuchsiaResourceDialect
1053 );
1054 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<HidbusGetIdleRequest>(&header, _body_bytes, handles, &mut req)?;
1055 let control_handle = HidbusControlHandle { inner: this.inner.clone() };
1056 Ok(HidbusRequest::GetIdle {
1057 rpt_id: req.rpt_id,
1058
1059 responder: HidbusGetIdleResponder {
1060 control_handle: std::mem::ManuallyDrop::new(control_handle),
1061 tx_id: header.tx_id,
1062 },
1063 })
1064 }
1065 0x7c387cbaa4c09b3c => {
1066 header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
1067 let mut req = fidl::new_empty!(
1068 HidbusSetIdleRequest,
1069 fidl::encoding::DefaultFuchsiaResourceDialect
1070 );
1071 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<HidbusSetIdleRequest>(&header, _body_bytes, handles, &mut req)?;
1072 let control_handle = HidbusControlHandle { inner: this.inner.clone() };
1073 Ok(HidbusRequest::SetIdle {
1074 rpt_id: req.rpt_id,
1075 duration: req.duration,
1076
1077 responder: HidbusSetIdleResponder {
1078 control_handle: std::mem::ManuallyDrop::new(control_handle),
1079 tx_id: header.tx_id,
1080 },
1081 })
1082 }
1083 0x3ec61a9b2d5c50eb => {
1084 header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
1085 let mut req = fidl::new_empty!(
1086 fidl::encoding::EmptyPayload,
1087 fidl::encoding::DefaultFuchsiaResourceDialect
1088 );
1089 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
1090 let control_handle = HidbusControlHandle { inner: this.inner.clone() };
1091 Ok(HidbusRequest::GetProtocol {
1092 responder: HidbusGetProtocolResponder {
1093 control_handle: std::mem::ManuallyDrop::new(control_handle),
1094 tx_id: header.tx_id,
1095 },
1096 })
1097 }
1098 0x1655cdfd0f316b0b => {
1099 header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
1100 let mut req = fidl::new_empty!(
1101 HidbusSetProtocolRequest,
1102 fidl::encoding::DefaultFuchsiaResourceDialect
1103 );
1104 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<HidbusSetProtocolRequest>(&header, _body_bytes, handles, &mut req)?;
1105 let control_handle = HidbusControlHandle { inner: this.inner.clone() };
1106 Ok(HidbusRequest::SetProtocol {
1107 protocol: req.protocol,
1108
1109 responder: HidbusSetProtocolResponder {
1110 control_handle: std::mem::ManuallyDrop::new(control_handle),
1111 tx_id: header.tx_id,
1112 },
1113 })
1114 }
1115 _ => Err(fidl::Error::UnknownOrdinal {
1116 ordinal: header.ordinal,
1117 protocol_name:
1118 <HidbusMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
1119 }),
1120 }))
1121 },
1122 )
1123 }
1124}
1125
1126#[derive(Debug)]
1127pub enum HidbusRequest {
1128 Query { responder: HidbusQueryResponder },
1131 Start { responder: HidbusStartResponder },
1138 Stop { responder: HidbusStopResponder },
1140 GetDescriptor { desc_type: HidDescriptorType, responder: HidbusGetDescriptorResponder },
1143 SetDescriptor {
1145 desc_type: HidDescriptorType,
1146 data: Vec<u8>,
1147 responder: HidbusSetDescriptorResponder,
1148 },
1149 GetReport { rpt_type: ReportType, rpt_id: u8, len: u64, responder: HidbusGetReportResponder },
1151 SetReport {
1153 rpt_type: ReportType,
1154 rpt_id: u8,
1155 data: Vec<u8>,
1156 responder: HidbusSetReportResponder,
1157 },
1158 GetIdle { rpt_id: u8, responder: HidbusGetIdleResponder },
1160 SetIdle { rpt_id: u8, duration: i64, responder: HidbusSetIdleResponder },
1162 GetProtocol { responder: HidbusGetProtocolResponder },
1164 SetProtocol { protocol: HidProtocol, responder: HidbusSetProtocolResponder },
1166}
1167
1168impl HidbusRequest {
1169 #[allow(irrefutable_let_patterns)]
1170 pub fn into_query(self) -> Option<(HidbusQueryResponder)> {
1171 if let HidbusRequest::Query { responder } = self {
1172 Some((responder))
1173 } else {
1174 None
1175 }
1176 }
1177
1178 #[allow(irrefutable_let_patterns)]
1179 pub fn into_start(self) -> Option<(HidbusStartResponder)> {
1180 if let HidbusRequest::Start { responder } = self {
1181 Some((responder))
1182 } else {
1183 None
1184 }
1185 }
1186
1187 #[allow(irrefutable_let_patterns)]
1188 pub fn into_stop(self) -> Option<(HidbusStopResponder)> {
1189 if let HidbusRequest::Stop { responder } = self {
1190 Some((responder))
1191 } else {
1192 None
1193 }
1194 }
1195
1196 #[allow(irrefutable_let_patterns)]
1197 pub fn into_get_descriptor(self) -> Option<(HidDescriptorType, HidbusGetDescriptorResponder)> {
1198 if let HidbusRequest::GetDescriptor { desc_type, responder } = self {
1199 Some((desc_type, responder))
1200 } else {
1201 None
1202 }
1203 }
1204
1205 #[allow(irrefutable_let_patterns)]
1206 pub fn into_set_descriptor(
1207 self,
1208 ) -> Option<(HidDescriptorType, Vec<u8>, HidbusSetDescriptorResponder)> {
1209 if let HidbusRequest::SetDescriptor { desc_type, data, responder } = self {
1210 Some((desc_type, data, responder))
1211 } else {
1212 None
1213 }
1214 }
1215
1216 #[allow(irrefutable_let_patterns)]
1217 pub fn into_get_report(self) -> Option<(ReportType, u8, u64, HidbusGetReportResponder)> {
1218 if let HidbusRequest::GetReport { rpt_type, rpt_id, len, responder } = self {
1219 Some((rpt_type, rpt_id, len, responder))
1220 } else {
1221 None
1222 }
1223 }
1224
1225 #[allow(irrefutable_let_patterns)]
1226 pub fn into_set_report(self) -> Option<(ReportType, u8, Vec<u8>, HidbusSetReportResponder)> {
1227 if let HidbusRequest::SetReport { rpt_type, rpt_id, data, responder } = self {
1228 Some((rpt_type, rpt_id, data, responder))
1229 } else {
1230 None
1231 }
1232 }
1233
1234 #[allow(irrefutable_let_patterns)]
1235 pub fn into_get_idle(self) -> Option<(u8, HidbusGetIdleResponder)> {
1236 if let HidbusRequest::GetIdle { rpt_id, responder } = self {
1237 Some((rpt_id, responder))
1238 } else {
1239 None
1240 }
1241 }
1242
1243 #[allow(irrefutable_let_patterns)]
1244 pub fn into_set_idle(self) -> Option<(u8, i64, HidbusSetIdleResponder)> {
1245 if let HidbusRequest::SetIdle { rpt_id, duration, responder } = self {
1246 Some((rpt_id, duration, responder))
1247 } else {
1248 None
1249 }
1250 }
1251
1252 #[allow(irrefutable_let_patterns)]
1253 pub fn into_get_protocol(self) -> Option<(HidbusGetProtocolResponder)> {
1254 if let HidbusRequest::GetProtocol { responder } = self {
1255 Some((responder))
1256 } else {
1257 None
1258 }
1259 }
1260
1261 #[allow(irrefutable_let_patterns)]
1262 pub fn into_set_protocol(self) -> Option<(HidProtocol, HidbusSetProtocolResponder)> {
1263 if let HidbusRequest::SetProtocol { protocol, responder } = self {
1264 Some((protocol, responder))
1265 } else {
1266 None
1267 }
1268 }
1269
1270 pub fn method_name(&self) -> &'static str {
1272 match *self {
1273 HidbusRequest::Query { .. } => "query",
1274 HidbusRequest::Start { .. } => "start",
1275 HidbusRequest::Stop { .. } => "stop",
1276 HidbusRequest::GetDescriptor { .. } => "get_descriptor",
1277 HidbusRequest::SetDescriptor { .. } => "set_descriptor",
1278 HidbusRequest::GetReport { .. } => "get_report",
1279 HidbusRequest::SetReport { .. } => "set_report",
1280 HidbusRequest::GetIdle { .. } => "get_idle",
1281 HidbusRequest::SetIdle { .. } => "set_idle",
1282 HidbusRequest::GetProtocol { .. } => "get_protocol",
1283 HidbusRequest::SetProtocol { .. } => "set_protocol",
1284 }
1285 }
1286}
1287
1288#[derive(Debug, Clone)]
1289pub struct HidbusControlHandle {
1290 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
1291}
1292
1293impl fidl::endpoints::ControlHandle for HidbusControlHandle {
1294 fn shutdown(&self) {
1295 self.inner.shutdown()
1296 }
1297 fn shutdown_with_epitaph(&self, status: zx_status::Status) {
1298 self.inner.shutdown_with_epitaph(status)
1299 }
1300
1301 fn is_closed(&self) -> bool {
1302 self.inner.channel().is_closed()
1303 }
1304 fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
1305 self.inner.channel().on_closed()
1306 }
1307
1308 #[cfg(target_os = "fuchsia")]
1309 fn signal_peer(
1310 &self,
1311 clear_mask: zx::Signals,
1312 set_mask: zx::Signals,
1313 ) -> Result<(), zx_status::Status> {
1314 use fidl::Peered;
1315 self.inner.channel().signal_peer(clear_mask, set_mask)
1316 }
1317}
1318
1319impl HidbusControlHandle {
1320 pub fn send_on_report_received(&self, mut payload: Report) -> Result<(), fidl::Error> {
1321 self.inner.send::<Report>(
1322 &mut payload,
1323 0,
1324 0x6093963f2efe1e56,
1325 fidl::encoding::DynamicFlags::empty(),
1326 )
1327 }
1328}
1329
1330#[must_use = "FIDL methods require a response to be sent"]
1331#[derive(Debug)]
1332pub struct HidbusQueryResponder {
1333 control_handle: std::mem::ManuallyDrop<HidbusControlHandle>,
1334 tx_id: u32,
1335}
1336
1337impl std::ops::Drop for HidbusQueryResponder {
1341 fn drop(&mut self) {
1342 self.control_handle.shutdown();
1343 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1345 }
1346}
1347
1348impl fidl::endpoints::Responder for HidbusQueryResponder {
1349 type ControlHandle = HidbusControlHandle;
1350
1351 fn control_handle(&self) -> &HidbusControlHandle {
1352 &self.control_handle
1353 }
1354
1355 fn drop_without_shutdown(mut self) {
1356 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1358 std::mem::forget(self);
1360 }
1361}
1362
1363impl HidbusQueryResponder {
1364 pub fn send(self, mut result: Result<&HidInfo, i32>) -> Result<(), fidl::Error> {
1368 let _result = self.send_raw(result);
1369 if _result.is_err() {
1370 self.control_handle.shutdown();
1371 }
1372 self.drop_without_shutdown();
1373 _result
1374 }
1375
1376 pub fn send_no_shutdown_on_err(
1378 self,
1379 mut result: Result<&HidInfo, i32>,
1380 ) -> Result<(), fidl::Error> {
1381 let _result = self.send_raw(result);
1382 self.drop_without_shutdown();
1383 _result
1384 }
1385
1386 fn send_raw(&self, mut result: Result<&HidInfo, i32>) -> Result<(), fidl::Error> {
1387 self.control_handle.inner.send::<fidl::encoding::ResultType<HidbusQueryResponse, i32>>(
1388 result.map(|info| (info,)),
1389 self.tx_id,
1390 0x23eb61f83d06efa9,
1391 fidl::encoding::DynamicFlags::empty(),
1392 )
1393 }
1394}
1395
1396#[must_use = "FIDL methods require a response to be sent"]
1397#[derive(Debug)]
1398pub struct HidbusStartResponder {
1399 control_handle: std::mem::ManuallyDrop<HidbusControlHandle>,
1400 tx_id: u32,
1401}
1402
1403impl std::ops::Drop for HidbusStartResponder {
1407 fn drop(&mut self) {
1408 self.control_handle.shutdown();
1409 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1411 }
1412}
1413
1414impl fidl::endpoints::Responder for HidbusStartResponder {
1415 type ControlHandle = HidbusControlHandle;
1416
1417 fn control_handle(&self) -> &HidbusControlHandle {
1418 &self.control_handle
1419 }
1420
1421 fn drop_without_shutdown(mut self) {
1422 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1424 std::mem::forget(self);
1426 }
1427}
1428
1429impl HidbusStartResponder {
1430 pub fn send(self, mut result: Result<(), i32>) -> Result<(), fidl::Error> {
1434 let _result = self.send_raw(result);
1435 if _result.is_err() {
1436 self.control_handle.shutdown();
1437 }
1438 self.drop_without_shutdown();
1439 _result
1440 }
1441
1442 pub fn send_no_shutdown_on_err(self, mut result: Result<(), i32>) -> Result<(), fidl::Error> {
1444 let _result = self.send_raw(result);
1445 self.drop_without_shutdown();
1446 _result
1447 }
1448
1449 fn send_raw(&self, mut result: Result<(), i32>) -> Result<(), fidl::Error> {
1450 self.control_handle
1451 .inner
1452 .send::<fidl::encoding::ResultType<fidl::encoding::EmptyStruct, i32>>(
1453 result,
1454 self.tx_id,
1455 0x1ba15adf96bade4a,
1456 fidl::encoding::DynamicFlags::empty(),
1457 )
1458 }
1459}
1460
1461#[must_use = "FIDL methods require a response to be sent"]
1462#[derive(Debug)]
1463pub struct HidbusStopResponder {
1464 control_handle: std::mem::ManuallyDrop<HidbusControlHandle>,
1465 tx_id: u32,
1466}
1467
1468impl std::ops::Drop for HidbusStopResponder {
1472 fn drop(&mut self) {
1473 self.control_handle.shutdown();
1474 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1476 }
1477}
1478
1479impl fidl::endpoints::Responder for HidbusStopResponder {
1480 type ControlHandle = HidbusControlHandle;
1481
1482 fn control_handle(&self) -> &HidbusControlHandle {
1483 &self.control_handle
1484 }
1485
1486 fn drop_without_shutdown(mut self) {
1487 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1489 std::mem::forget(self);
1491 }
1492}
1493
1494impl HidbusStopResponder {
1495 pub fn send(self) -> Result<(), fidl::Error> {
1499 let _result = self.send_raw();
1500 if _result.is_err() {
1501 self.control_handle.shutdown();
1502 }
1503 self.drop_without_shutdown();
1504 _result
1505 }
1506
1507 pub fn send_no_shutdown_on_err(self) -> Result<(), fidl::Error> {
1509 let _result = self.send_raw();
1510 self.drop_without_shutdown();
1511 _result
1512 }
1513
1514 fn send_raw(&self) -> Result<(), fidl::Error> {
1515 self.control_handle.inner.send::<fidl::encoding::EmptyPayload>(
1516 (),
1517 self.tx_id,
1518 0x61b973ecd69cfff8,
1519 fidl::encoding::DynamicFlags::empty(),
1520 )
1521 }
1522}
1523
1524#[must_use = "FIDL methods require a response to be sent"]
1525#[derive(Debug)]
1526pub struct HidbusGetDescriptorResponder {
1527 control_handle: std::mem::ManuallyDrop<HidbusControlHandle>,
1528 tx_id: u32,
1529}
1530
1531impl std::ops::Drop for HidbusGetDescriptorResponder {
1535 fn drop(&mut self) {
1536 self.control_handle.shutdown();
1537 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1539 }
1540}
1541
1542impl fidl::endpoints::Responder for HidbusGetDescriptorResponder {
1543 type ControlHandle = HidbusControlHandle;
1544
1545 fn control_handle(&self) -> &HidbusControlHandle {
1546 &self.control_handle
1547 }
1548
1549 fn drop_without_shutdown(mut self) {
1550 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1552 std::mem::forget(self);
1554 }
1555}
1556
1557impl HidbusGetDescriptorResponder {
1558 pub fn send(self, mut result: Result<&[u8], i32>) -> Result<(), fidl::Error> {
1562 let _result = self.send_raw(result);
1563 if _result.is_err() {
1564 self.control_handle.shutdown();
1565 }
1566 self.drop_without_shutdown();
1567 _result
1568 }
1569
1570 pub fn send_no_shutdown_on_err(
1572 self,
1573 mut result: Result<&[u8], i32>,
1574 ) -> Result<(), fidl::Error> {
1575 let _result = self.send_raw(result);
1576 self.drop_without_shutdown();
1577 _result
1578 }
1579
1580 fn send_raw(&self, mut result: Result<&[u8], i32>) -> Result<(), fidl::Error> {
1581 self.control_handle
1582 .inner
1583 .send::<fidl::encoding::ResultType<HidbusGetDescriptorResponse, i32>>(
1584 result.map(|data| (data,)),
1585 self.tx_id,
1586 0x29343a1289ceb2e5,
1587 fidl::encoding::DynamicFlags::empty(),
1588 )
1589 }
1590}
1591
1592#[must_use = "FIDL methods require a response to be sent"]
1593#[derive(Debug)]
1594pub struct HidbusSetDescriptorResponder {
1595 control_handle: std::mem::ManuallyDrop<HidbusControlHandle>,
1596 tx_id: u32,
1597}
1598
1599impl std::ops::Drop for HidbusSetDescriptorResponder {
1603 fn drop(&mut self) {
1604 self.control_handle.shutdown();
1605 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1607 }
1608}
1609
1610impl fidl::endpoints::Responder for HidbusSetDescriptorResponder {
1611 type ControlHandle = HidbusControlHandle;
1612
1613 fn control_handle(&self) -> &HidbusControlHandle {
1614 &self.control_handle
1615 }
1616
1617 fn drop_without_shutdown(mut self) {
1618 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1620 std::mem::forget(self);
1622 }
1623}
1624
1625impl HidbusSetDescriptorResponder {
1626 pub fn send(self, mut result: Result<(), i32>) -> Result<(), fidl::Error> {
1630 let _result = self.send_raw(result);
1631 if _result.is_err() {
1632 self.control_handle.shutdown();
1633 }
1634 self.drop_without_shutdown();
1635 _result
1636 }
1637
1638 pub fn send_no_shutdown_on_err(self, mut result: Result<(), i32>) -> Result<(), fidl::Error> {
1640 let _result = self.send_raw(result);
1641 self.drop_without_shutdown();
1642 _result
1643 }
1644
1645 fn send_raw(&self, mut result: Result<(), i32>) -> Result<(), fidl::Error> {
1646 self.control_handle
1647 .inner
1648 .send::<fidl::encoding::ResultType<fidl::encoding::EmptyStruct, i32>>(
1649 result,
1650 self.tx_id,
1651 0x7567278eba076777,
1652 fidl::encoding::DynamicFlags::empty(),
1653 )
1654 }
1655}
1656
1657#[must_use = "FIDL methods require a response to be sent"]
1658#[derive(Debug)]
1659pub struct HidbusGetReportResponder {
1660 control_handle: std::mem::ManuallyDrop<HidbusControlHandle>,
1661 tx_id: u32,
1662}
1663
1664impl std::ops::Drop for HidbusGetReportResponder {
1668 fn drop(&mut self) {
1669 self.control_handle.shutdown();
1670 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1672 }
1673}
1674
1675impl fidl::endpoints::Responder for HidbusGetReportResponder {
1676 type ControlHandle = HidbusControlHandle;
1677
1678 fn control_handle(&self) -> &HidbusControlHandle {
1679 &self.control_handle
1680 }
1681
1682 fn drop_without_shutdown(mut self) {
1683 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1685 std::mem::forget(self);
1687 }
1688}
1689
1690impl HidbusGetReportResponder {
1691 pub fn send(self, mut result: Result<&[u8], i32>) -> Result<(), fidl::Error> {
1695 let _result = self.send_raw(result);
1696 if _result.is_err() {
1697 self.control_handle.shutdown();
1698 }
1699 self.drop_without_shutdown();
1700 _result
1701 }
1702
1703 pub fn send_no_shutdown_on_err(
1705 self,
1706 mut result: Result<&[u8], i32>,
1707 ) -> Result<(), fidl::Error> {
1708 let _result = self.send_raw(result);
1709 self.drop_without_shutdown();
1710 _result
1711 }
1712
1713 fn send_raw(&self, mut result: Result<&[u8], i32>) -> Result<(), fidl::Error> {
1714 self.control_handle.inner.send::<fidl::encoding::ResultType<HidbusGetReportResponse, i32>>(
1715 result.map(|data| (data,)),
1716 self.tx_id,
1717 0x69b5538a28dc472c,
1718 fidl::encoding::DynamicFlags::empty(),
1719 )
1720 }
1721}
1722
1723#[must_use = "FIDL methods require a response to be sent"]
1724#[derive(Debug)]
1725pub struct HidbusSetReportResponder {
1726 control_handle: std::mem::ManuallyDrop<HidbusControlHandle>,
1727 tx_id: u32,
1728}
1729
1730impl std::ops::Drop for HidbusSetReportResponder {
1734 fn drop(&mut self) {
1735 self.control_handle.shutdown();
1736 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1738 }
1739}
1740
1741impl fidl::endpoints::Responder for HidbusSetReportResponder {
1742 type ControlHandle = HidbusControlHandle;
1743
1744 fn control_handle(&self) -> &HidbusControlHandle {
1745 &self.control_handle
1746 }
1747
1748 fn drop_without_shutdown(mut self) {
1749 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1751 std::mem::forget(self);
1753 }
1754}
1755
1756impl HidbusSetReportResponder {
1757 pub fn send(self, mut result: Result<(), i32>) -> Result<(), fidl::Error> {
1761 let _result = self.send_raw(result);
1762 if _result.is_err() {
1763 self.control_handle.shutdown();
1764 }
1765 self.drop_without_shutdown();
1766 _result
1767 }
1768
1769 pub fn send_no_shutdown_on_err(self, mut result: Result<(), i32>) -> Result<(), fidl::Error> {
1771 let _result = self.send_raw(result);
1772 self.drop_without_shutdown();
1773 _result
1774 }
1775
1776 fn send_raw(&self, mut result: Result<(), i32>) -> Result<(), fidl::Error> {
1777 self.control_handle
1778 .inner
1779 .send::<fidl::encoding::ResultType<fidl::encoding::EmptyStruct, i32>>(
1780 result,
1781 self.tx_id,
1782 0x1172863081673c55,
1783 fidl::encoding::DynamicFlags::empty(),
1784 )
1785 }
1786}
1787
1788#[must_use = "FIDL methods require a response to be sent"]
1789#[derive(Debug)]
1790pub struct HidbusGetIdleResponder {
1791 control_handle: std::mem::ManuallyDrop<HidbusControlHandle>,
1792 tx_id: u32,
1793}
1794
1795impl std::ops::Drop for HidbusGetIdleResponder {
1799 fn drop(&mut self) {
1800 self.control_handle.shutdown();
1801 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1803 }
1804}
1805
1806impl fidl::endpoints::Responder for HidbusGetIdleResponder {
1807 type ControlHandle = HidbusControlHandle;
1808
1809 fn control_handle(&self) -> &HidbusControlHandle {
1810 &self.control_handle
1811 }
1812
1813 fn drop_without_shutdown(mut self) {
1814 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1816 std::mem::forget(self);
1818 }
1819}
1820
1821impl HidbusGetIdleResponder {
1822 pub fn send(self, mut result: Result<i64, i32>) -> Result<(), fidl::Error> {
1826 let _result = self.send_raw(result);
1827 if _result.is_err() {
1828 self.control_handle.shutdown();
1829 }
1830 self.drop_without_shutdown();
1831 _result
1832 }
1833
1834 pub fn send_no_shutdown_on_err(self, mut result: Result<i64, i32>) -> Result<(), fidl::Error> {
1836 let _result = self.send_raw(result);
1837 self.drop_without_shutdown();
1838 _result
1839 }
1840
1841 fn send_raw(&self, mut result: Result<i64, i32>) -> Result<(), fidl::Error> {
1842 self.control_handle.inner.send::<fidl::encoding::ResultType<HidbusGetIdleResponse, i32>>(
1843 result.map(|duration| (duration,)),
1844 self.tx_id,
1845 0xa95c2c504d9aa0b,
1846 fidl::encoding::DynamicFlags::empty(),
1847 )
1848 }
1849}
1850
1851#[must_use = "FIDL methods require a response to be sent"]
1852#[derive(Debug)]
1853pub struct HidbusSetIdleResponder {
1854 control_handle: std::mem::ManuallyDrop<HidbusControlHandle>,
1855 tx_id: u32,
1856}
1857
1858impl std::ops::Drop for HidbusSetIdleResponder {
1862 fn drop(&mut self) {
1863 self.control_handle.shutdown();
1864 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1866 }
1867}
1868
1869impl fidl::endpoints::Responder for HidbusSetIdleResponder {
1870 type ControlHandle = HidbusControlHandle;
1871
1872 fn control_handle(&self) -> &HidbusControlHandle {
1873 &self.control_handle
1874 }
1875
1876 fn drop_without_shutdown(mut self) {
1877 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1879 std::mem::forget(self);
1881 }
1882}
1883
1884impl HidbusSetIdleResponder {
1885 pub fn send(self, mut result: Result<(), i32>) -> Result<(), fidl::Error> {
1889 let _result = self.send_raw(result);
1890 if _result.is_err() {
1891 self.control_handle.shutdown();
1892 }
1893 self.drop_without_shutdown();
1894 _result
1895 }
1896
1897 pub fn send_no_shutdown_on_err(self, mut result: Result<(), i32>) -> Result<(), fidl::Error> {
1899 let _result = self.send_raw(result);
1900 self.drop_without_shutdown();
1901 _result
1902 }
1903
1904 fn send_raw(&self, mut result: Result<(), i32>) -> Result<(), fidl::Error> {
1905 self.control_handle
1906 .inner
1907 .send::<fidl::encoding::ResultType<fidl::encoding::EmptyStruct, i32>>(
1908 result,
1909 self.tx_id,
1910 0x7c387cbaa4c09b3c,
1911 fidl::encoding::DynamicFlags::empty(),
1912 )
1913 }
1914}
1915
1916#[must_use = "FIDL methods require a response to be sent"]
1917#[derive(Debug)]
1918pub struct HidbusGetProtocolResponder {
1919 control_handle: std::mem::ManuallyDrop<HidbusControlHandle>,
1920 tx_id: u32,
1921}
1922
1923impl std::ops::Drop for HidbusGetProtocolResponder {
1927 fn drop(&mut self) {
1928 self.control_handle.shutdown();
1929 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1931 }
1932}
1933
1934impl fidl::endpoints::Responder for HidbusGetProtocolResponder {
1935 type ControlHandle = HidbusControlHandle;
1936
1937 fn control_handle(&self) -> &HidbusControlHandle {
1938 &self.control_handle
1939 }
1940
1941 fn drop_without_shutdown(mut self) {
1942 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1944 std::mem::forget(self);
1946 }
1947}
1948
1949impl HidbusGetProtocolResponder {
1950 pub fn send(self, mut result: Result<HidProtocol, i32>) -> Result<(), fidl::Error> {
1954 let _result = self.send_raw(result);
1955 if _result.is_err() {
1956 self.control_handle.shutdown();
1957 }
1958 self.drop_without_shutdown();
1959 _result
1960 }
1961
1962 pub fn send_no_shutdown_on_err(
1964 self,
1965 mut result: Result<HidProtocol, i32>,
1966 ) -> Result<(), fidl::Error> {
1967 let _result = self.send_raw(result);
1968 self.drop_without_shutdown();
1969 _result
1970 }
1971
1972 fn send_raw(&self, mut result: Result<HidProtocol, i32>) -> Result<(), fidl::Error> {
1973 self.control_handle
1974 .inner
1975 .send::<fidl::encoding::ResultType<HidbusGetProtocolResponse, i32>>(
1976 result.map(|protocol| (protocol,)),
1977 self.tx_id,
1978 0x3ec61a9b2d5c50eb,
1979 fidl::encoding::DynamicFlags::empty(),
1980 )
1981 }
1982}
1983
1984#[must_use = "FIDL methods require a response to be sent"]
1985#[derive(Debug)]
1986pub struct HidbusSetProtocolResponder {
1987 control_handle: std::mem::ManuallyDrop<HidbusControlHandle>,
1988 tx_id: u32,
1989}
1990
1991impl std::ops::Drop for HidbusSetProtocolResponder {
1995 fn drop(&mut self) {
1996 self.control_handle.shutdown();
1997 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1999 }
2000}
2001
2002impl fidl::endpoints::Responder for HidbusSetProtocolResponder {
2003 type ControlHandle = HidbusControlHandle;
2004
2005 fn control_handle(&self) -> &HidbusControlHandle {
2006 &self.control_handle
2007 }
2008
2009 fn drop_without_shutdown(mut self) {
2010 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
2012 std::mem::forget(self);
2014 }
2015}
2016
2017impl HidbusSetProtocolResponder {
2018 pub fn send(self, mut result: Result<(), i32>) -> Result<(), fidl::Error> {
2022 let _result = self.send_raw(result);
2023 if _result.is_err() {
2024 self.control_handle.shutdown();
2025 }
2026 self.drop_without_shutdown();
2027 _result
2028 }
2029
2030 pub fn send_no_shutdown_on_err(self, mut result: Result<(), i32>) -> Result<(), fidl::Error> {
2032 let _result = self.send_raw(result);
2033 self.drop_without_shutdown();
2034 _result
2035 }
2036
2037 fn send_raw(&self, mut result: Result<(), i32>) -> Result<(), fidl::Error> {
2038 self.control_handle
2039 .inner
2040 .send::<fidl::encoding::ResultType<fidl::encoding::EmptyStruct, i32>>(
2041 result,
2042 self.tx_id,
2043 0x1655cdfd0f316b0b,
2044 fidl::encoding::DynamicFlags::empty(),
2045 )
2046 }
2047}
2048
2049#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
2050pub struct ServiceMarker;
2051
2052#[cfg(target_os = "fuchsia")]
2053impl fidl::endpoints::ServiceMarker for ServiceMarker {
2054 type Proxy = ServiceProxy;
2055 type Request = ServiceRequest;
2056 const SERVICE_NAME: &'static str = "fuchsia.hardware.hidbus.Service";
2057}
2058
2059#[cfg(target_os = "fuchsia")]
2062pub enum ServiceRequest {
2063 Device(HidbusRequestStream),
2064}
2065
2066#[cfg(target_os = "fuchsia")]
2067impl fidl::endpoints::ServiceRequest for ServiceRequest {
2068 type Service = ServiceMarker;
2069
2070 fn dispatch(name: &str, _channel: fidl::AsyncChannel) -> Self {
2071 match name {
2072 "device" => Self::Device(
2073 <HidbusRequestStream as fidl::endpoints::RequestStream>::from_channel(_channel),
2074 ),
2075 _ => panic!("no such member protocol name for service Service"),
2076 }
2077 }
2078
2079 fn member_names() -> &'static [&'static str] {
2080 &["device"]
2081 }
2082}
2083#[cfg(target_os = "fuchsia")]
2084pub struct ServiceProxy(#[allow(dead_code)] Box<dyn fidl::endpoints::MemberOpener>);
2085
2086#[cfg(target_os = "fuchsia")]
2087impl fidl::endpoints::ServiceProxy for ServiceProxy {
2088 type Service = ServiceMarker;
2089
2090 fn from_member_opener(opener: Box<dyn fidl::endpoints::MemberOpener>) -> Self {
2091 Self(opener)
2092 }
2093}
2094
2095#[cfg(target_os = "fuchsia")]
2096impl ServiceProxy {
2097 pub fn connect_to_device(&self) -> Result<HidbusProxy, fidl::Error> {
2098 let (proxy, server_end) = fidl::endpoints::create_proxy::<HidbusMarker>();
2099 self.connect_channel_to_device(server_end)?;
2100 Ok(proxy)
2101 }
2102
2103 pub fn connect_to_device_sync(&self) -> Result<HidbusSynchronousProxy, fidl::Error> {
2106 let (proxy, server_end) = fidl::endpoints::create_sync_proxy::<HidbusMarker>();
2107 self.connect_channel_to_device(server_end)?;
2108 Ok(proxy)
2109 }
2110
2111 pub fn connect_channel_to_device(
2114 &self,
2115 server_end: fidl::endpoints::ServerEnd<HidbusMarker>,
2116 ) -> Result<(), fidl::Error> {
2117 self.0.open_member("device", server_end.into_channel())
2118 }
2119
2120 pub fn instance_name(&self) -> &str {
2121 self.0.instance_name()
2122 }
2123}
2124
2125mod internal {
2126 use super::*;
2127
2128 impl Report {
2129 #[inline(always)]
2130 fn max_ordinal_present(&self) -> u64 {
2131 if let Some(_) = self.wake_lease {
2132 return 3;
2133 }
2134 if let Some(_) = self.timestamp {
2135 return 2;
2136 }
2137 if let Some(_) = self.buf {
2138 return 1;
2139 }
2140 0
2141 }
2142 }
2143
2144 impl fidl::encoding::ResourceTypeMarker for Report {
2145 type Borrowed<'a> = &'a mut Self;
2146 fn take_or_borrow<'a>(
2147 value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
2148 ) -> Self::Borrowed<'a> {
2149 value
2150 }
2151 }
2152
2153 unsafe impl fidl::encoding::TypeMarker for Report {
2154 type Owned = Self;
2155
2156 #[inline(always)]
2157 fn inline_align(_context: fidl::encoding::Context) -> usize {
2158 8
2159 }
2160
2161 #[inline(always)]
2162 fn inline_size(_context: fidl::encoding::Context) -> usize {
2163 16
2164 }
2165 }
2166
2167 unsafe impl fidl::encoding::Encode<Report, fidl::encoding::DefaultFuchsiaResourceDialect>
2168 for &mut Report
2169 {
2170 unsafe fn encode(
2171 self,
2172 encoder: &mut fidl::encoding::Encoder<
2173 '_,
2174 fidl::encoding::DefaultFuchsiaResourceDialect,
2175 >,
2176 offset: usize,
2177 mut depth: fidl::encoding::Depth,
2178 ) -> fidl::Result<()> {
2179 encoder.debug_check_bounds::<Report>(offset);
2180 let max_ordinal: u64 = self.max_ordinal_present();
2182 encoder.write_num(max_ordinal, offset);
2183 encoder.write_num(fidl::encoding::ALLOC_PRESENT_U64, offset + 8);
2184 if max_ordinal == 0 {
2186 return Ok(());
2187 }
2188 depth.increment()?;
2189 let envelope_size = 8;
2190 let bytes_len = max_ordinal as usize * envelope_size;
2191 #[allow(unused_variables)]
2192 let offset = encoder.out_of_line_offset(bytes_len);
2193 let mut _prev_end_offset: usize = 0;
2194 if 1 > max_ordinal {
2195 return Ok(());
2196 }
2197
2198 let cur_offset: usize = (1 - 1) * envelope_size;
2201
2202 encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
2204
2205 fidl::encoding::encode_in_envelope_optional::<
2210 fidl::encoding::Vector<u8, 8192>,
2211 fidl::encoding::DefaultFuchsiaResourceDialect,
2212 >(
2213 self.buf.as_ref().map(
2214 <fidl::encoding::Vector<u8, 8192> as fidl::encoding::ValueTypeMarker>::borrow,
2215 ),
2216 encoder,
2217 offset + cur_offset,
2218 depth,
2219 )?;
2220
2221 _prev_end_offset = cur_offset + envelope_size;
2222 if 2 > max_ordinal {
2223 return Ok(());
2224 }
2225
2226 let cur_offset: usize = (2 - 1) * envelope_size;
2229
2230 encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
2232
2233 fidl::encoding::encode_in_envelope_optional::<
2238 i64,
2239 fidl::encoding::DefaultFuchsiaResourceDialect,
2240 >(
2241 self.timestamp.as_ref().map(<i64 as fidl::encoding::ValueTypeMarker>::borrow),
2242 encoder,
2243 offset + cur_offset,
2244 depth,
2245 )?;
2246
2247 _prev_end_offset = cur_offset + envelope_size;
2248 if 3 > max_ordinal {
2249 return Ok(());
2250 }
2251
2252 let cur_offset: usize = (3 - 1) * envelope_size;
2255
2256 encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
2258
2259 fidl::encoding::encode_in_envelope_optional::<
2264 fidl::encoding::HandleType<
2265 fidl::EventPair,
2266 { fidl::ObjectType::EVENTPAIR.into_raw() },
2267 2147483648,
2268 >,
2269 fidl::encoding::DefaultFuchsiaResourceDialect,
2270 >(
2271 self.wake_lease.as_mut().map(
2272 <fidl::encoding::HandleType<
2273 fidl::EventPair,
2274 { fidl::ObjectType::EVENTPAIR.into_raw() },
2275 2147483648,
2276 > as fidl::encoding::ResourceTypeMarker>::take_or_borrow,
2277 ),
2278 encoder,
2279 offset + cur_offset,
2280 depth,
2281 )?;
2282
2283 _prev_end_offset = cur_offset + envelope_size;
2284
2285 Ok(())
2286 }
2287 }
2288
2289 impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect> for Report {
2290 #[inline(always)]
2291 fn new_empty() -> Self {
2292 Self::default()
2293 }
2294
2295 unsafe fn decode(
2296 &mut self,
2297 decoder: &mut fidl::encoding::Decoder<
2298 '_,
2299 fidl::encoding::DefaultFuchsiaResourceDialect,
2300 >,
2301 offset: usize,
2302 mut depth: fidl::encoding::Depth,
2303 ) -> fidl::Result<()> {
2304 decoder.debug_check_bounds::<Self>(offset);
2305 let len = match fidl::encoding::decode_vector_header(decoder, offset)? {
2306 None => return Err(fidl::Error::NotNullable),
2307 Some(len) => len,
2308 };
2309 if len == 0 {
2311 return Ok(());
2312 };
2313 depth.increment()?;
2314 let envelope_size = 8;
2315 let bytes_len = len * envelope_size;
2316 let offset = decoder.out_of_line_offset(bytes_len)?;
2317 let mut _next_ordinal_to_read = 0;
2319 let mut next_offset = offset;
2320 let end_offset = offset + bytes_len;
2321 _next_ordinal_to_read += 1;
2322 if next_offset >= end_offset {
2323 return Ok(());
2324 }
2325
2326 while _next_ordinal_to_read < 1 {
2328 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
2329 _next_ordinal_to_read += 1;
2330 next_offset += envelope_size;
2331 }
2332
2333 let next_out_of_line = decoder.next_out_of_line();
2334 let handles_before = decoder.remaining_handles();
2335 if let Some((inlined, num_bytes, num_handles)) =
2336 fidl::encoding::decode_envelope_header(decoder, next_offset)?
2337 {
2338 let member_inline_size =
2339 <fidl::encoding::Vector<u8, 8192> as fidl::encoding::TypeMarker>::inline_size(
2340 decoder.context,
2341 );
2342 if inlined != (member_inline_size <= 4) {
2343 return Err(fidl::Error::InvalidInlineBitInEnvelope);
2344 }
2345 let inner_offset;
2346 let mut inner_depth = depth.clone();
2347 if inlined {
2348 decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
2349 inner_offset = next_offset;
2350 } else {
2351 inner_offset = decoder.out_of_line_offset(member_inline_size)?;
2352 inner_depth.increment()?;
2353 }
2354 let val_ref =
2355 self.buf.get_or_insert_with(|| fidl::new_empty!(fidl::encoding::Vector<u8, 8192>, fidl::encoding::DefaultFuchsiaResourceDialect));
2356 fidl::decode!(fidl::encoding::Vector<u8, 8192>, fidl::encoding::DefaultFuchsiaResourceDialect, val_ref, decoder, inner_offset, inner_depth)?;
2357 if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
2358 {
2359 return Err(fidl::Error::InvalidNumBytesInEnvelope);
2360 }
2361 if handles_before != decoder.remaining_handles() + (num_handles as usize) {
2362 return Err(fidl::Error::InvalidNumHandlesInEnvelope);
2363 }
2364 }
2365
2366 next_offset += envelope_size;
2367 _next_ordinal_to_read += 1;
2368 if next_offset >= end_offset {
2369 return Ok(());
2370 }
2371
2372 while _next_ordinal_to_read < 2 {
2374 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
2375 _next_ordinal_to_read += 1;
2376 next_offset += envelope_size;
2377 }
2378
2379 let next_out_of_line = decoder.next_out_of_line();
2380 let handles_before = decoder.remaining_handles();
2381 if let Some((inlined, num_bytes, num_handles)) =
2382 fidl::encoding::decode_envelope_header(decoder, next_offset)?
2383 {
2384 let member_inline_size =
2385 <i64 as fidl::encoding::TypeMarker>::inline_size(decoder.context);
2386 if inlined != (member_inline_size <= 4) {
2387 return Err(fidl::Error::InvalidInlineBitInEnvelope);
2388 }
2389 let inner_offset;
2390 let mut inner_depth = depth.clone();
2391 if inlined {
2392 decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
2393 inner_offset = next_offset;
2394 } else {
2395 inner_offset = decoder.out_of_line_offset(member_inline_size)?;
2396 inner_depth.increment()?;
2397 }
2398 let val_ref = self.timestamp.get_or_insert_with(|| {
2399 fidl::new_empty!(i64, fidl::encoding::DefaultFuchsiaResourceDialect)
2400 });
2401 fidl::decode!(
2402 i64,
2403 fidl::encoding::DefaultFuchsiaResourceDialect,
2404 val_ref,
2405 decoder,
2406 inner_offset,
2407 inner_depth
2408 )?;
2409 if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
2410 {
2411 return Err(fidl::Error::InvalidNumBytesInEnvelope);
2412 }
2413 if handles_before != decoder.remaining_handles() + (num_handles as usize) {
2414 return Err(fidl::Error::InvalidNumHandlesInEnvelope);
2415 }
2416 }
2417
2418 next_offset += envelope_size;
2419 _next_ordinal_to_read += 1;
2420 if next_offset >= end_offset {
2421 return Ok(());
2422 }
2423
2424 while _next_ordinal_to_read < 3 {
2426 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
2427 _next_ordinal_to_read += 1;
2428 next_offset += envelope_size;
2429 }
2430
2431 let next_out_of_line = decoder.next_out_of_line();
2432 let handles_before = decoder.remaining_handles();
2433 if let Some((inlined, num_bytes, num_handles)) =
2434 fidl::encoding::decode_envelope_header(decoder, next_offset)?
2435 {
2436 let member_inline_size = <fidl::encoding::HandleType<
2437 fidl::EventPair,
2438 { fidl::ObjectType::EVENTPAIR.into_raw() },
2439 2147483648,
2440 > as fidl::encoding::TypeMarker>::inline_size(
2441 decoder.context
2442 );
2443 if inlined != (member_inline_size <= 4) {
2444 return Err(fidl::Error::InvalidInlineBitInEnvelope);
2445 }
2446 let inner_offset;
2447 let mut inner_depth = depth.clone();
2448 if inlined {
2449 decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
2450 inner_offset = next_offset;
2451 } else {
2452 inner_offset = decoder.out_of_line_offset(member_inline_size)?;
2453 inner_depth.increment()?;
2454 }
2455 let val_ref =
2456 self.wake_lease.get_or_insert_with(|| fidl::new_empty!(fidl::encoding::HandleType<fidl::EventPair, { fidl::ObjectType::EVENTPAIR.into_raw() }, 2147483648>, fidl::encoding::DefaultFuchsiaResourceDialect));
2457 fidl::decode!(fidl::encoding::HandleType<fidl::EventPair, { fidl::ObjectType::EVENTPAIR.into_raw() }, 2147483648>, fidl::encoding::DefaultFuchsiaResourceDialect, val_ref, decoder, inner_offset, inner_depth)?;
2458 if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
2459 {
2460 return Err(fidl::Error::InvalidNumBytesInEnvelope);
2461 }
2462 if handles_before != decoder.remaining_handles() + (num_handles as usize) {
2463 return Err(fidl::Error::InvalidNumHandlesInEnvelope);
2464 }
2465 }
2466
2467 next_offset += envelope_size;
2468
2469 while next_offset < end_offset {
2471 _next_ordinal_to_read += 1;
2472 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
2473 next_offset += envelope_size;
2474 }
2475
2476 Ok(())
2477 }
2478 }
2479}