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_usb_device__common::*;
11use futures::future::{self, MaybeDone, TryFutureExt};
12use zx_status;
13
14#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
15pub struct DeviceMarker;
16
17impl fidl::endpoints::ProtocolMarker for DeviceMarker {
18 type Proxy = DeviceProxy;
19 type RequestStream = DeviceRequestStream;
20 #[cfg(target_os = "fuchsia")]
21 type SynchronousProxy = DeviceSynchronousProxy;
22
23 const DEBUG_NAME: &'static str = "(anonymous) Device";
24}
25
26pub trait DeviceProxyInterface: Send + Sync {
27 type GetDeviceSpeedResponseFut: std::future::Future<Output = Result<u32, fidl::Error>> + Send;
28 fn r#get_device_speed(&self) -> Self::GetDeviceSpeedResponseFut;
29 type GetDeviceDescriptorResponseFut: std::future::Future<Output = Result<[u8; 18], fidl::Error>>
30 + Send;
31 fn r#get_device_descriptor(&self) -> Self::GetDeviceDescriptorResponseFut;
32 type GetConfigurationDescriptorSizeResponseFut: std::future::Future<Output = Result<(i32, u16), fidl::Error>>
33 + Send;
34 fn r#get_configuration_descriptor_size(
35 &self,
36 config: u8,
37 ) -> Self::GetConfigurationDescriptorSizeResponseFut;
38 type GetConfigurationDescriptorResponseFut: std::future::Future<Output = Result<(i32, Vec<u8>), fidl::Error>>
39 + Send;
40 fn r#get_configuration_descriptor(
41 &self,
42 config: u8,
43 ) -> Self::GetConfigurationDescriptorResponseFut;
44 type GetStringDescriptorResponseFut: std::future::Future<Output = Result<(i32, String, u16), fidl::Error>>
45 + Send;
46 fn r#get_string_descriptor(
47 &self,
48 desc_id: u8,
49 lang_id: u16,
50 ) -> Self::GetStringDescriptorResponseFut;
51 type SetInterfaceResponseFut: std::future::Future<Output = Result<i32, fidl::Error>> + Send;
52 fn r#set_interface(
53 &self,
54 interface_number: u8,
55 alt_setting: u8,
56 ) -> Self::SetInterfaceResponseFut;
57 type GetDeviceIdResponseFut: std::future::Future<Output = Result<u32, fidl::Error>> + Send;
58 fn r#get_device_id(&self) -> Self::GetDeviceIdResponseFut;
59 type GetHubDeviceIdResponseFut: std::future::Future<Output = Result<u32, fidl::Error>> + Send;
60 fn r#get_hub_device_id(&self) -> Self::GetHubDeviceIdResponseFut;
61 type GetConfigurationResponseFut: std::future::Future<Output = Result<u8, fidl::Error>> + Send;
62 fn r#get_configuration(&self) -> Self::GetConfigurationResponseFut;
63 type SetConfigurationResponseFut: std::future::Future<Output = Result<i32, fidl::Error>> + Send;
64 fn r#set_configuration(&self, configuration: u8) -> Self::SetConfigurationResponseFut;
65}
66#[derive(Debug)]
67#[cfg(target_os = "fuchsia")]
68pub struct DeviceSynchronousProxy {
69 client: fidl::client::sync::Client,
70}
71
72#[cfg(target_os = "fuchsia")]
73impl fidl::endpoints::SynchronousProxy for DeviceSynchronousProxy {
74 type Proxy = DeviceProxy;
75 type Protocol = DeviceMarker;
76
77 fn from_channel(inner: fidl::Channel) -> Self {
78 Self::new(inner)
79 }
80
81 fn into_channel(self) -> fidl::Channel {
82 self.client.into_channel()
83 }
84
85 fn as_channel(&self) -> &fidl::Channel {
86 self.client.as_channel()
87 }
88}
89
90#[cfg(target_os = "fuchsia")]
91impl DeviceSynchronousProxy {
92 pub fn new(channel: fidl::Channel) -> Self {
93 Self { client: fidl::client::sync::Client::new(channel) }
94 }
95
96 pub fn into_channel(self) -> fidl::Channel {
97 self.client.into_channel()
98 }
99
100 pub fn wait_for_event(
103 &self,
104 deadline: zx::MonotonicInstant,
105 ) -> Result<DeviceEvent, fidl::Error> {
106 DeviceEvent::decode(self.client.wait_for_event::<DeviceMarker>(deadline)?)
107 }
108
109 pub fn r#get_device_speed(
111 &self,
112 ___deadline: zx::MonotonicInstant,
113 ) -> Result<u32, fidl::Error> {
114 let _response = self
115 .client
116 .send_query::<fidl::encoding::EmptyPayload, DeviceGetDeviceSpeedResponse, DeviceMarker>(
117 (),
118 0x623cd7927fb449de,
119 fidl::encoding::DynamicFlags::empty(),
120 ___deadline,
121 )?;
122 Ok(_response.speed)
123 }
124
125 pub fn r#get_device_descriptor(
127 &self,
128 ___deadline: zx::MonotonicInstant,
129 ) -> Result<[u8; 18], fidl::Error> {
130 let _response = self.client.send_query::<
131 fidl::encoding::EmptyPayload,
132 DeviceGetDeviceDescriptorResponse,
133 DeviceMarker,
134 >(
135 (),
136 0x5f761371f4b9f34a,
137 fidl::encoding::DynamicFlags::empty(),
138 ___deadline,
139 )?;
140 Ok(_response.desc)
141 }
142
143 pub fn r#get_configuration_descriptor_size(
145 &self,
146 mut config: u8,
147 ___deadline: zx::MonotonicInstant,
148 ) -> Result<(i32, u16), fidl::Error> {
149 let _response = self.client.send_query::<
150 DeviceGetConfigurationDescriptorSizeRequest,
151 DeviceGetConfigurationDescriptorSizeResponse,
152 DeviceMarker,
153 >(
154 (config,),
155 0x65912d7d5e3a07c8,
156 fidl::encoding::DynamicFlags::empty(),
157 ___deadline,
158 )?;
159 Ok((_response.s, _response.size))
160 }
161
162 pub fn r#get_configuration_descriptor(
164 &self,
165 mut config: u8,
166 ___deadline: zx::MonotonicInstant,
167 ) -> Result<(i32, Vec<u8>), fidl::Error> {
168 let _response = self.client.send_query::<
169 DeviceGetConfigurationDescriptorRequest,
170 DeviceGetConfigurationDescriptorResponse,
171 DeviceMarker,
172 >(
173 (config,),
174 0x1859a4e4421d2036,
175 fidl::encoding::DynamicFlags::empty(),
176 ___deadline,
177 )?;
178 Ok((_response.s, _response.desc))
179 }
180
181 pub fn r#get_string_descriptor(
200 &self,
201 mut desc_id: u8,
202 mut lang_id: u16,
203 ___deadline: zx::MonotonicInstant,
204 ) -> Result<(i32, String, u16), fidl::Error> {
205 let _response = self.client.send_query::<
206 DeviceGetStringDescriptorRequest,
207 DeviceGetStringDescriptorResponse,
208 DeviceMarker,
209 >(
210 (desc_id, lang_id,),
211 0x5ff601b3b6891337,
212 fidl::encoding::DynamicFlags::empty(),
213 ___deadline,
214 )?;
215 Ok((_response.s, _response.desc, _response.actual_lang_id))
216 }
217
218 pub fn r#set_interface(
220 &self,
221 mut interface_number: u8,
222 mut alt_setting: u8,
223 ___deadline: zx::MonotonicInstant,
224 ) -> Result<i32, fidl::Error> {
225 let _response = self
226 .client
227 .send_query::<DeviceSetInterfaceRequest, DeviceSetInterfaceResponse, DeviceMarker>(
228 (interface_number, alt_setting),
229 0x45348c50850b641d,
230 fidl::encoding::DynamicFlags::empty(),
231 ___deadline,
232 )?;
233 Ok(_response.s)
234 }
235
236 pub fn r#get_device_id(&self, ___deadline: zx::MonotonicInstant) -> Result<u32, fidl::Error> {
239 let _response = self
240 .client
241 .send_query::<fidl::encoding::EmptyPayload, DeviceGetDeviceIdResponse, DeviceMarker>(
242 (),
243 0x34a73eef491c2ce0,
244 fidl::encoding::DynamicFlags::empty(),
245 ___deadline,
246 )?;
247 Ok(_response.device_id)
248 }
249
250 pub fn r#get_hub_device_id(
253 &self,
254 ___deadline: zx::MonotonicInstant,
255 ) -> Result<u32, fidl::Error> {
256 let _response = self
257 .client
258 .send_query::<fidl::encoding::EmptyPayload, DeviceGetHubDeviceIdResponse, DeviceMarker>(
259 (),
260 0xce263c86f7bbbcd,
261 fidl::encoding::DynamicFlags::empty(),
262 ___deadline,
263 )?;
264 Ok(_response.hub_device_id)
265 }
266
267 pub fn r#get_configuration(
269 &self,
270 ___deadline: zx::MonotonicInstant,
271 ) -> Result<u8, fidl::Error> {
272 let _response = self.client.send_query::<
273 fidl::encoding::EmptyPayload,
274 DeviceGetConfigurationResponse,
275 DeviceMarker,
276 >(
277 (),
278 0x73f644382a2335fd,
279 fidl::encoding::DynamicFlags::empty(),
280 ___deadline,
281 )?;
282 Ok(_response.configuration)
283 }
284
285 pub fn r#set_configuration(
287 &self,
288 mut configuration: u8,
289 ___deadline: zx::MonotonicInstant,
290 ) -> Result<i32, fidl::Error> {
291 let _response = self.client.send_query::<
292 DeviceSetConfigurationRequest,
293 DeviceSetConfigurationResponse,
294 DeviceMarker,
295 >(
296 (configuration,),
297 0x12bf6e43b045ee9d,
298 fidl::encoding::DynamicFlags::empty(),
299 ___deadline,
300 )?;
301 Ok(_response.s)
302 }
303}
304
305#[cfg(target_os = "fuchsia")]
306impl From<DeviceSynchronousProxy> for zx::NullableHandle {
307 fn from(value: DeviceSynchronousProxy) -> Self {
308 value.into_channel().into()
309 }
310}
311
312#[cfg(target_os = "fuchsia")]
313impl From<fidl::Channel> for DeviceSynchronousProxy {
314 fn from(value: fidl::Channel) -> Self {
315 Self::new(value)
316 }
317}
318
319#[cfg(target_os = "fuchsia")]
320impl fidl::endpoints::FromClient for DeviceSynchronousProxy {
321 type Protocol = DeviceMarker;
322
323 fn from_client(value: fidl::endpoints::ClientEnd<DeviceMarker>) -> Self {
324 Self::new(value.into_channel())
325 }
326}
327
328#[derive(Debug, Clone)]
329pub struct DeviceProxy {
330 client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
331}
332
333impl fidl::endpoints::Proxy for DeviceProxy {
334 type Protocol = DeviceMarker;
335
336 fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
337 Self::new(inner)
338 }
339
340 fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
341 self.client.into_channel().map_err(|client| Self { client })
342 }
343
344 fn as_channel(&self) -> &::fidl::AsyncChannel {
345 self.client.as_channel()
346 }
347}
348
349impl DeviceProxy {
350 pub fn new(channel: ::fidl::AsyncChannel) -> Self {
352 let protocol_name = <DeviceMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
353 Self { client: fidl::client::Client::new(channel, protocol_name) }
354 }
355
356 pub fn take_event_stream(&self) -> DeviceEventStream {
362 DeviceEventStream { event_receiver: self.client.take_event_receiver() }
363 }
364
365 pub fn r#get_device_speed(
367 &self,
368 ) -> fidl::client::QueryResponseFut<u32, fidl::encoding::DefaultFuchsiaResourceDialect> {
369 DeviceProxyInterface::r#get_device_speed(self)
370 }
371
372 pub fn r#get_device_descriptor(
374 &self,
375 ) -> fidl::client::QueryResponseFut<[u8; 18], fidl::encoding::DefaultFuchsiaResourceDialect>
376 {
377 DeviceProxyInterface::r#get_device_descriptor(self)
378 }
379
380 pub fn r#get_configuration_descriptor_size(
382 &self,
383 mut config: u8,
384 ) -> fidl::client::QueryResponseFut<(i32, u16), fidl::encoding::DefaultFuchsiaResourceDialect>
385 {
386 DeviceProxyInterface::r#get_configuration_descriptor_size(self, config)
387 }
388
389 pub fn r#get_configuration_descriptor(
391 &self,
392 mut config: u8,
393 ) -> fidl::client::QueryResponseFut<(i32, Vec<u8>), fidl::encoding::DefaultFuchsiaResourceDialect>
394 {
395 DeviceProxyInterface::r#get_configuration_descriptor(self, config)
396 }
397
398 pub fn r#get_string_descriptor(
417 &self,
418 mut desc_id: u8,
419 mut lang_id: u16,
420 ) -> fidl::client::QueryResponseFut<
421 (i32, String, u16),
422 fidl::encoding::DefaultFuchsiaResourceDialect,
423 > {
424 DeviceProxyInterface::r#get_string_descriptor(self, desc_id, lang_id)
425 }
426
427 pub fn r#set_interface(
429 &self,
430 mut interface_number: u8,
431 mut alt_setting: u8,
432 ) -> fidl::client::QueryResponseFut<i32, fidl::encoding::DefaultFuchsiaResourceDialect> {
433 DeviceProxyInterface::r#set_interface(self, interface_number, alt_setting)
434 }
435
436 pub fn r#get_device_id(
439 &self,
440 ) -> fidl::client::QueryResponseFut<u32, fidl::encoding::DefaultFuchsiaResourceDialect> {
441 DeviceProxyInterface::r#get_device_id(self)
442 }
443
444 pub fn r#get_hub_device_id(
447 &self,
448 ) -> fidl::client::QueryResponseFut<u32, fidl::encoding::DefaultFuchsiaResourceDialect> {
449 DeviceProxyInterface::r#get_hub_device_id(self)
450 }
451
452 pub fn r#get_configuration(
454 &self,
455 ) -> fidl::client::QueryResponseFut<u8, fidl::encoding::DefaultFuchsiaResourceDialect> {
456 DeviceProxyInterface::r#get_configuration(self)
457 }
458
459 pub fn r#set_configuration(
461 &self,
462 mut configuration: u8,
463 ) -> fidl::client::QueryResponseFut<i32, fidl::encoding::DefaultFuchsiaResourceDialect> {
464 DeviceProxyInterface::r#set_configuration(self, configuration)
465 }
466}
467
468impl DeviceProxyInterface for DeviceProxy {
469 type GetDeviceSpeedResponseFut =
470 fidl::client::QueryResponseFut<u32, fidl::encoding::DefaultFuchsiaResourceDialect>;
471 fn r#get_device_speed(&self) -> Self::GetDeviceSpeedResponseFut {
472 fn _decode(
473 mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
474 ) -> Result<u32, fidl::Error> {
475 let _response = fidl::client::decode_transaction_body::<
476 DeviceGetDeviceSpeedResponse,
477 fidl::encoding::DefaultFuchsiaResourceDialect,
478 0x623cd7927fb449de,
479 >(_buf?)?;
480 Ok(_response.speed)
481 }
482 self.client.send_query_and_decode::<fidl::encoding::EmptyPayload, u32>(
483 (),
484 0x623cd7927fb449de,
485 fidl::encoding::DynamicFlags::empty(),
486 _decode,
487 )
488 }
489
490 type GetDeviceDescriptorResponseFut =
491 fidl::client::QueryResponseFut<[u8; 18], fidl::encoding::DefaultFuchsiaResourceDialect>;
492 fn r#get_device_descriptor(&self) -> Self::GetDeviceDescriptorResponseFut {
493 fn _decode(
494 mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
495 ) -> Result<[u8; 18], fidl::Error> {
496 let _response = fidl::client::decode_transaction_body::<
497 DeviceGetDeviceDescriptorResponse,
498 fidl::encoding::DefaultFuchsiaResourceDialect,
499 0x5f761371f4b9f34a,
500 >(_buf?)?;
501 Ok(_response.desc)
502 }
503 self.client.send_query_and_decode::<fidl::encoding::EmptyPayload, [u8; 18]>(
504 (),
505 0x5f761371f4b9f34a,
506 fidl::encoding::DynamicFlags::empty(),
507 _decode,
508 )
509 }
510
511 type GetConfigurationDescriptorSizeResponseFut =
512 fidl::client::QueryResponseFut<(i32, u16), fidl::encoding::DefaultFuchsiaResourceDialect>;
513 fn r#get_configuration_descriptor_size(
514 &self,
515 mut config: u8,
516 ) -> Self::GetConfigurationDescriptorSizeResponseFut {
517 fn _decode(
518 mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
519 ) -> Result<(i32, u16), fidl::Error> {
520 let _response = fidl::client::decode_transaction_body::<
521 DeviceGetConfigurationDescriptorSizeResponse,
522 fidl::encoding::DefaultFuchsiaResourceDialect,
523 0x65912d7d5e3a07c8,
524 >(_buf?)?;
525 Ok((_response.s, _response.size))
526 }
527 self.client
528 .send_query_and_decode::<DeviceGetConfigurationDescriptorSizeRequest, (i32, u16)>(
529 (config,),
530 0x65912d7d5e3a07c8,
531 fidl::encoding::DynamicFlags::empty(),
532 _decode,
533 )
534 }
535
536 type GetConfigurationDescriptorResponseFut = fidl::client::QueryResponseFut<
537 (i32, Vec<u8>),
538 fidl::encoding::DefaultFuchsiaResourceDialect,
539 >;
540 fn r#get_configuration_descriptor(
541 &self,
542 mut config: u8,
543 ) -> Self::GetConfigurationDescriptorResponseFut {
544 fn _decode(
545 mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
546 ) -> Result<(i32, Vec<u8>), fidl::Error> {
547 let _response = fidl::client::decode_transaction_body::<
548 DeviceGetConfigurationDescriptorResponse,
549 fidl::encoding::DefaultFuchsiaResourceDialect,
550 0x1859a4e4421d2036,
551 >(_buf?)?;
552 Ok((_response.s, _response.desc))
553 }
554 self.client
555 .send_query_and_decode::<DeviceGetConfigurationDescriptorRequest, (i32, Vec<u8>)>(
556 (config,),
557 0x1859a4e4421d2036,
558 fidl::encoding::DynamicFlags::empty(),
559 _decode,
560 )
561 }
562
563 type GetStringDescriptorResponseFut = fidl::client::QueryResponseFut<
564 (i32, String, u16),
565 fidl::encoding::DefaultFuchsiaResourceDialect,
566 >;
567 fn r#get_string_descriptor(
568 &self,
569 mut desc_id: u8,
570 mut lang_id: u16,
571 ) -> Self::GetStringDescriptorResponseFut {
572 fn _decode(
573 mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
574 ) -> Result<(i32, String, u16), fidl::Error> {
575 let _response = fidl::client::decode_transaction_body::<
576 DeviceGetStringDescriptorResponse,
577 fidl::encoding::DefaultFuchsiaResourceDialect,
578 0x5ff601b3b6891337,
579 >(_buf?)?;
580 Ok((_response.s, _response.desc, _response.actual_lang_id))
581 }
582 self.client.send_query_and_decode::<DeviceGetStringDescriptorRequest, (i32, String, u16)>(
583 (desc_id, lang_id),
584 0x5ff601b3b6891337,
585 fidl::encoding::DynamicFlags::empty(),
586 _decode,
587 )
588 }
589
590 type SetInterfaceResponseFut =
591 fidl::client::QueryResponseFut<i32, fidl::encoding::DefaultFuchsiaResourceDialect>;
592 fn r#set_interface(
593 &self,
594 mut interface_number: u8,
595 mut alt_setting: u8,
596 ) -> Self::SetInterfaceResponseFut {
597 fn _decode(
598 mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
599 ) -> Result<i32, fidl::Error> {
600 let _response = fidl::client::decode_transaction_body::<
601 DeviceSetInterfaceResponse,
602 fidl::encoding::DefaultFuchsiaResourceDialect,
603 0x45348c50850b641d,
604 >(_buf?)?;
605 Ok(_response.s)
606 }
607 self.client.send_query_and_decode::<DeviceSetInterfaceRequest, i32>(
608 (interface_number, alt_setting),
609 0x45348c50850b641d,
610 fidl::encoding::DynamicFlags::empty(),
611 _decode,
612 )
613 }
614
615 type GetDeviceIdResponseFut =
616 fidl::client::QueryResponseFut<u32, fidl::encoding::DefaultFuchsiaResourceDialect>;
617 fn r#get_device_id(&self) -> Self::GetDeviceIdResponseFut {
618 fn _decode(
619 mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
620 ) -> Result<u32, fidl::Error> {
621 let _response = fidl::client::decode_transaction_body::<
622 DeviceGetDeviceIdResponse,
623 fidl::encoding::DefaultFuchsiaResourceDialect,
624 0x34a73eef491c2ce0,
625 >(_buf?)?;
626 Ok(_response.device_id)
627 }
628 self.client.send_query_and_decode::<fidl::encoding::EmptyPayload, u32>(
629 (),
630 0x34a73eef491c2ce0,
631 fidl::encoding::DynamicFlags::empty(),
632 _decode,
633 )
634 }
635
636 type GetHubDeviceIdResponseFut =
637 fidl::client::QueryResponseFut<u32, fidl::encoding::DefaultFuchsiaResourceDialect>;
638 fn r#get_hub_device_id(&self) -> Self::GetHubDeviceIdResponseFut {
639 fn _decode(
640 mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
641 ) -> Result<u32, fidl::Error> {
642 let _response = fidl::client::decode_transaction_body::<
643 DeviceGetHubDeviceIdResponse,
644 fidl::encoding::DefaultFuchsiaResourceDialect,
645 0xce263c86f7bbbcd,
646 >(_buf?)?;
647 Ok(_response.hub_device_id)
648 }
649 self.client.send_query_and_decode::<fidl::encoding::EmptyPayload, u32>(
650 (),
651 0xce263c86f7bbbcd,
652 fidl::encoding::DynamicFlags::empty(),
653 _decode,
654 )
655 }
656
657 type GetConfigurationResponseFut =
658 fidl::client::QueryResponseFut<u8, fidl::encoding::DefaultFuchsiaResourceDialect>;
659 fn r#get_configuration(&self) -> Self::GetConfigurationResponseFut {
660 fn _decode(
661 mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
662 ) -> Result<u8, fidl::Error> {
663 let _response = fidl::client::decode_transaction_body::<
664 DeviceGetConfigurationResponse,
665 fidl::encoding::DefaultFuchsiaResourceDialect,
666 0x73f644382a2335fd,
667 >(_buf?)?;
668 Ok(_response.configuration)
669 }
670 self.client.send_query_and_decode::<fidl::encoding::EmptyPayload, u8>(
671 (),
672 0x73f644382a2335fd,
673 fidl::encoding::DynamicFlags::empty(),
674 _decode,
675 )
676 }
677
678 type SetConfigurationResponseFut =
679 fidl::client::QueryResponseFut<i32, fidl::encoding::DefaultFuchsiaResourceDialect>;
680 fn r#set_configuration(&self, mut configuration: u8) -> Self::SetConfigurationResponseFut {
681 fn _decode(
682 mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
683 ) -> Result<i32, fidl::Error> {
684 let _response = fidl::client::decode_transaction_body::<
685 DeviceSetConfigurationResponse,
686 fidl::encoding::DefaultFuchsiaResourceDialect,
687 0x12bf6e43b045ee9d,
688 >(_buf?)?;
689 Ok(_response.s)
690 }
691 self.client.send_query_and_decode::<DeviceSetConfigurationRequest, i32>(
692 (configuration,),
693 0x12bf6e43b045ee9d,
694 fidl::encoding::DynamicFlags::empty(),
695 _decode,
696 )
697 }
698}
699
700pub struct DeviceEventStream {
701 event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
702}
703
704impl std::marker::Unpin for DeviceEventStream {}
705
706impl futures::stream::FusedStream for DeviceEventStream {
707 fn is_terminated(&self) -> bool {
708 self.event_receiver.is_terminated()
709 }
710}
711
712impl futures::Stream for DeviceEventStream {
713 type Item = Result<DeviceEvent, fidl::Error>;
714
715 fn poll_next(
716 mut self: std::pin::Pin<&mut Self>,
717 cx: &mut std::task::Context<'_>,
718 ) -> std::task::Poll<Option<Self::Item>> {
719 match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
720 &mut self.event_receiver,
721 cx
722 )?) {
723 Some(buf) => std::task::Poll::Ready(Some(DeviceEvent::decode(buf))),
724 None => std::task::Poll::Ready(None),
725 }
726 }
727}
728
729#[derive(Debug)]
730pub enum DeviceEvent {}
731
732impl DeviceEvent {
733 fn decode(
735 mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
736 ) -> Result<DeviceEvent, fidl::Error> {
737 let (bytes, _handles) = buf.split_mut();
738 let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
739 debug_assert_eq!(tx_header.tx_id, 0);
740 match tx_header.ordinal {
741 _ => Err(fidl::Error::UnknownOrdinal {
742 ordinal: tx_header.ordinal,
743 protocol_name: <DeviceMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
744 }),
745 }
746 }
747}
748
749pub struct DeviceRequestStream {
751 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
752 is_terminated: bool,
753}
754
755impl std::marker::Unpin for DeviceRequestStream {}
756
757impl futures::stream::FusedStream for DeviceRequestStream {
758 fn is_terminated(&self) -> bool {
759 self.is_terminated
760 }
761}
762
763impl fidl::endpoints::RequestStream for DeviceRequestStream {
764 type Protocol = DeviceMarker;
765 type ControlHandle = DeviceControlHandle;
766
767 fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
768 Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
769 }
770
771 fn control_handle(&self) -> Self::ControlHandle {
772 DeviceControlHandle { inner: self.inner.clone() }
773 }
774
775 fn into_inner(
776 self,
777 ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
778 {
779 (self.inner, self.is_terminated)
780 }
781
782 fn from_inner(
783 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
784 is_terminated: bool,
785 ) -> Self {
786 Self { inner, is_terminated }
787 }
788}
789
790impl futures::Stream for DeviceRequestStream {
791 type Item = Result<DeviceRequest, fidl::Error>;
792
793 fn poll_next(
794 mut self: std::pin::Pin<&mut Self>,
795 cx: &mut std::task::Context<'_>,
796 ) -> std::task::Poll<Option<Self::Item>> {
797 let this = &mut *self;
798 if this.inner.check_shutdown(cx) {
799 this.is_terminated = true;
800 return std::task::Poll::Ready(None);
801 }
802 if this.is_terminated {
803 panic!("polled DeviceRequestStream after completion");
804 }
805 fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
806 |bytes, handles| {
807 match this.inner.channel().read_etc(cx, bytes, handles) {
808 std::task::Poll::Ready(Ok(())) => {}
809 std::task::Poll::Pending => return std::task::Poll::Pending,
810 std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
811 this.is_terminated = true;
812 return std::task::Poll::Ready(None);
813 }
814 std::task::Poll::Ready(Err(e)) => {
815 return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
816 e.into(),
817 ))));
818 }
819 }
820
821 let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
823
824 std::task::Poll::Ready(Some(match header.ordinal {
825 0x623cd7927fb449de => {
826 header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
827 let mut req = fidl::new_empty!(
828 fidl::encoding::EmptyPayload,
829 fidl::encoding::DefaultFuchsiaResourceDialect
830 );
831 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
832 let control_handle = DeviceControlHandle { inner: this.inner.clone() };
833 Ok(DeviceRequest::GetDeviceSpeed {
834 responder: DeviceGetDeviceSpeedResponder {
835 control_handle: std::mem::ManuallyDrop::new(control_handle),
836 tx_id: header.tx_id,
837 },
838 })
839 }
840 0x5f761371f4b9f34a => {
841 header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
842 let mut req = fidl::new_empty!(
843 fidl::encoding::EmptyPayload,
844 fidl::encoding::DefaultFuchsiaResourceDialect
845 );
846 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
847 let control_handle = DeviceControlHandle { inner: this.inner.clone() };
848 Ok(DeviceRequest::GetDeviceDescriptor {
849 responder: DeviceGetDeviceDescriptorResponder {
850 control_handle: std::mem::ManuallyDrop::new(control_handle),
851 tx_id: header.tx_id,
852 },
853 })
854 }
855 0x65912d7d5e3a07c8 => {
856 header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
857 let mut req = fidl::new_empty!(
858 DeviceGetConfigurationDescriptorSizeRequest,
859 fidl::encoding::DefaultFuchsiaResourceDialect
860 );
861 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<DeviceGetConfigurationDescriptorSizeRequest>(&header, _body_bytes, handles, &mut req)?;
862 let control_handle = DeviceControlHandle { inner: this.inner.clone() };
863 Ok(DeviceRequest::GetConfigurationDescriptorSize {
864 config: req.config,
865
866 responder: DeviceGetConfigurationDescriptorSizeResponder {
867 control_handle: std::mem::ManuallyDrop::new(control_handle),
868 tx_id: header.tx_id,
869 },
870 })
871 }
872 0x1859a4e4421d2036 => {
873 header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
874 let mut req = fidl::new_empty!(
875 DeviceGetConfigurationDescriptorRequest,
876 fidl::encoding::DefaultFuchsiaResourceDialect
877 );
878 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<DeviceGetConfigurationDescriptorRequest>(&header, _body_bytes, handles, &mut req)?;
879 let control_handle = DeviceControlHandle { inner: this.inner.clone() };
880 Ok(DeviceRequest::GetConfigurationDescriptor {
881 config: req.config,
882
883 responder: DeviceGetConfigurationDescriptorResponder {
884 control_handle: std::mem::ManuallyDrop::new(control_handle),
885 tx_id: header.tx_id,
886 },
887 })
888 }
889 0x5ff601b3b6891337 => {
890 header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
891 let mut req = fidl::new_empty!(
892 DeviceGetStringDescriptorRequest,
893 fidl::encoding::DefaultFuchsiaResourceDialect
894 );
895 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<DeviceGetStringDescriptorRequest>(&header, _body_bytes, handles, &mut req)?;
896 let control_handle = DeviceControlHandle { inner: this.inner.clone() };
897 Ok(DeviceRequest::GetStringDescriptor {
898 desc_id: req.desc_id,
899 lang_id: req.lang_id,
900
901 responder: DeviceGetStringDescriptorResponder {
902 control_handle: std::mem::ManuallyDrop::new(control_handle),
903 tx_id: header.tx_id,
904 },
905 })
906 }
907 0x45348c50850b641d => {
908 header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
909 let mut req = fidl::new_empty!(
910 DeviceSetInterfaceRequest,
911 fidl::encoding::DefaultFuchsiaResourceDialect
912 );
913 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<DeviceSetInterfaceRequest>(&header, _body_bytes, handles, &mut req)?;
914 let control_handle = DeviceControlHandle { inner: this.inner.clone() };
915 Ok(DeviceRequest::SetInterface {
916 interface_number: req.interface_number,
917 alt_setting: req.alt_setting,
918
919 responder: DeviceSetInterfaceResponder {
920 control_handle: std::mem::ManuallyDrop::new(control_handle),
921 tx_id: header.tx_id,
922 },
923 })
924 }
925 0x34a73eef491c2ce0 => {
926 header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
927 let mut req = fidl::new_empty!(
928 fidl::encoding::EmptyPayload,
929 fidl::encoding::DefaultFuchsiaResourceDialect
930 );
931 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
932 let control_handle = DeviceControlHandle { inner: this.inner.clone() };
933 Ok(DeviceRequest::GetDeviceId {
934 responder: DeviceGetDeviceIdResponder {
935 control_handle: std::mem::ManuallyDrop::new(control_handle),
936 tx_id: header.tx_id,
937 },
938 })
939 }
940 0xce263c86f7bbbcd => {
941 header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
942 let mut req = fidl::new_empty!(
943 fidl::encoding::EmptyPayload,
944 fidl::encoding::DefaultFuchsiaResourceDialect
945 );
946 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
947 let control_handle = DeviceControlHandle { inner: this.inner.clone() };
948 Ok(DeviceRequest::GetHubDeviceId {
949 responder: DeviceGetHubDeviceIdResponder {
950 control_handle: std::mem::ManuallyDrop::new(control_handle),
951 tx_id: header.tx_id,
952 },
953 })
954 }
955 0x73f644382a2335fd => {
956 header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
957 let mut req = fidl::new_empty!(
958 fidl::encoding::EmptyPayload,
959 fidl::encoding::DefaultFuchsiaResourceDialect
960 );
961 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
962 let control_handle = DeviceControlHandle { inner: this.inner.clone() };
963 Ok(DeviceRequest::GetConfiguration {
964 responder: DeviceGetConfigurationResponder {
965 control_handle: std::mem::ManuallyDrop::new(control_handle),
966 tx_id: header.tx_id,
967 },
968 })
969 }
970 0x12bf6e43b045ee9d => {
971 header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
972 let mut req = fidl::new_empty!(
973 DeviceSetConfigurationRequest,
974 fidl::encoding::DefaultFuchsiaResourceDialect
975 );
976 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<DeviceSetConfigurationRequest>(&header, _body_bytes, handles, &mut req)?;
977 let control_handle = DeviceControlHandle { inner: this.inner.clone() };
978 Ok(DeviceRequest::SetConfiguration {
979 configuration: req.configuration,
980
981 responder: DeviceSetConfigurationResponder {
982 control_handle: std::mem::ManuallyDrop::new(control_handle),
983 tx_id: header.tx_id,
984 },
985 })
986 }
987 _ => Err(fidl::Error::UnknownOrdinal {
988 ordinal: header.ordinal,
989 protocol_name:
990 <DeviceMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
991 }),
992 }))
993 },
994 )
995 }
996}
997
998#[derive(Debug)]
999pub enum DeviceRequest {
1000 GetDeviceSpeed { responder: DeviceGetDeviceSpeedResponder },
1002 GetDeviceDescriptor { responder: DeviceGetDeviceDescriptorResponder },
1004 GetConfigurationDescriptorSize {
1006 config: u8,
1007 responder: DeviceGetConfigurationDescriptorSizeResponder,
1008 },
1009 GetConfigurationDescriptor { config: u8, responder: DeviceGetConfigurationDescriptorResponder },
1011 GetStringDescriptor { desc_id: u8, lang_id: u16, responder: DeviceGetStringDescriptorResponder },
1030 SetInterface { interface_number: u8, alt_setting: u8, responder: DeviceSetInterfaceResponder },
1032 GetDeviceId { responder: DeviceGetDeviceIdResponder },
1035 GetHubDeviceId { responder: DeviceGetHubDeviceIdResponder },
1038 GetConfiguration { responder: DeviceGetConfigurationResponder },
1040 SetConfiguration { configuration: u8, responder: DeviceSetConfigurationResponder },
1042}
1043
1044impl DeviceRequest {
1045 #[allow(irrefutable_let_patterns)]
1046 pub fn into_get_device_speed(self) -> Option<(DeviceGetDeviceSpeedResponder)> {
1047 if let DeviceRequest::GetDeviceSpeed { responder } = self {
1048 Some((responder))
1049 } else {
1050 None
1051 }
1052 }
1053
1054 #[allow(irrefutable_let_patterns)]
1055 pub fn into_get_device_descriptor(self) -> Option<(DeviceGetDeviceDescriptorResponder)> {
1056 if let DeviceRequest::GetDeviceDescriptor { responder } = self {
1057 Some((responder))
1058 } else {
1059 None
1060 }
1061 }
1062
1063 #[allow(irrefutable_let_patterns)]
1064 pub fn into_get_configuration_descriptor_size(
1065 self,
1066 ) -> Option<(u8, DeviceGetConfigurationDescriptorSizeResponder)> {
1067 if let DeviceRequest::GetConfigurationDescriptorSize { config, responder } = self {
1068 Some((config, responder))
1069 } else {
1070 None
1071 }
1072 }
1073
1074 #[allow(irrefutable_let_patterns)]
1075 pub fn into_get_configuration_descriptor(
1076 self,
1077 ) -> Option<(u8, DeviceGetConfigurationDescriptorResponder)> {
1078 if let DeviceRequest::GetConfigurationDescriptor { config, responder } = self {
1079 Some((config, responder))
1080 } else {
1081 None
1082 }
1083 }
1084
1085 #[allow(irrefutable_let_patterns)]
1086 pub fn into_get_string_descriptor(
1087 self,
1088 ) -> Option<(u8, u16, DeviceGetStringDescriptorResponder)> {
1089 if let DeviceRequest::GetStringDescriptor { desc_id, lang_id, responder } = self {
1090 Some((desc_id, lang_id, responder))
1091 } else {
1092 None
1093 }
1094 }
1095
1096 #[allow(irrefutable_let_patterns)]
1097 pub fn into_set_interface(self) -> Option<(u8, u8, DeviceSetInterfaceResponder)> {
1098 if let DeviceRequest::SetInterface { interface_number, alt_setting, responder } = self {
1099 Some((interface_number, alt_setting, responder))
1100 } else {
1101 None
1102 }
1103 }
1104
1105 #[allow(irrefutable_let_patterns)]
1106 pub fn into_get_device_id(self) -> Option<(DeviceGetDeviceIdResponder)> {
1107 if let DeviceRequest::GetDeviceId { responder } = self { Some((responder)) } else { None }
1108 }
1109
1110 #[allow(irrefutable_let_patterns)]
1111 pub fn into_get_hub_device_id(self) -> Option<(DeviceGetHubDeviceIdResponder)> {
1112 if let DeviceRequest::GetHubDeviceId { responder } = self {
1113 Some((responder))
1114 } else {
1115 None
1116 }
1117 }
1118
1119 #[allow(irrefutable_let_patterns)]
1120 pub fn into_get_configuration(self) -> Option<(DeviceGetConfigurationResponder)> {
1121 if let DeviceRequest::GetConfiguration { responder } = self {
1122 Some((responder))
1123 } else {
1124 None
1125 }
1126 }
1127
1128 #[allow(irrefutable_let_patterns)]
1129 pub fn into_set_configuration(self) -> Option<(u8, DeviceSetConfigurationResponder)> {
1130 if let DeviceRequest::SetConfiguration { configuration, responder } = self {
1131 Some((configuration, responder))
1132 } else {
1133 None
1134 }
1135 }
1136
1137 pub fn method_name(&self) -> &'static str {
1139 match *self {
1140 DeviceRequest::GetDeviceSpeed { .. } => "get_device_speed",
1141 DeviceRequest::GetDeviceDescriptor { .. } => "get_device_descriptor",
1142 DeviceRequest::GetConfigurationDescriptorSize { .. } => {
1143 "get_configuration_descriptor_size"
1144 }
1145 DeviceRequest::GetConfigurationDescriptor { .. } => "get_configuration_descriptor",
1146 DeviceRequest::GetStringDescriptor { .. } => "get_string_descriptor",
1147 DeviceRequest::SetInterface { .. } => "set_interface",
1148 DeviceRequest::GetDeviceId { .. } => "get_device_id",
1149 DeviceRequest::GetHubDeviceId { .. } => "get_hub_device_id",
1150 DeviceRequest::GetConfiguration { .. } => "get_configuration",
1151 DeviceRequest::SetConfiguration { .. } => "set_configuration",
1152 }
1153 }
1154}
1155
1156#[derive(Debug, Clone)]
1157pub struct DeviceControlHandle {
1158 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
1159}
1160
1161impl fidl::endpoints::ControlHandle for DeviceControlHandle {
1162 fn shutdown(&self) {
1163 self.inner.shutdown()
1164 }
1165
1166 fn shutdown_with_epitaph(&self, status: zx_status::Status) {
1167 self.inner.shutdown_with_epitaph(status)
1168 }
1169
1170 fn is_closed(&self) -> bool {
1171 self.inner.channel().is_closed()
1172 }
1173 fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
1174 self.inner.channel().on_closed()
1175 }
1176
1177 #[cfg(target_os = "fuchsia")]
1178 fn signal_peer(
1179 &self,
1180 clear_mask: zx::Signals,
1181 set_mask: zx::Signals,
1182 ) -> Result<(), zx_status::Status> {
1183 use fidl::Peered;
1184 self.inner.channel().signal_peer(clear_mask, set_mask)
1185 }
1186}
1187
1188impl DeviceControlHandle {}
1189
1190#[must_use = "FIDL methods require a response to be sent"]
1191#[derive(Debug)]
1192pub struct DeviceGetDeviceSpeedResponder {
1193 control_handle: std::mem::ManuallyDrop<DeviceControlHandle>,
1194 tx_id: u32,
1195}
1196
1197impl std::ops::Drop for DeviceGetDeviceSpeedResponder {
1201 fn drop(&mut self) {
1202 self.control_handle.shutdown();
1203 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1205 }
1206}
1207
1208impl fidl::endpoints::Responder for DeviceGetDeviceSpeedResponder {
1209 type ControlHandle = DeviceControlHandle;
1210
1211 fn control_handle(&self) -> &DeviceControlHandle {
1212 &self.control_handle
1213 }
1214
1215 fn drop_without_shutdown(mut self) {
1216 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1218 std::mem::forget(self);
1220 }
1221}
1222
1223impl DeviceGetDeviceSpeedResponder {
1224 pub fn send(self, mut speed: u32) -> Result<(), fidl::Error> {
1228 let _result = self.send_raw(speed);
1229 if _result.is_err() {
1230 self.control_handle.shutdown();
1231 }
1232 self.drop_without_shutdown();
1233 _result
1234 }
1235
1236 pub fn send_no_shutdown_on_err(self, mut speed: u32) -> Result<(), fidl::Error> {
1238 let _result = self.send_raw(speed);
1239 self.drop_without_shutdown();
1240 _result
1241 }
1242
1243 fn send_raw(&self, mut speed: u32) -> Result<(), fidl::Error> {
1244 self.control_handle.inner.send::<DeviceGetDeviceSpeedResponse>(
1245 (speed,),
1246 self.tx_id,
1247 0x623cd7927fb449de,
1248 fidl::encoding::DynamicFlags::empty(),
1249 )
1250 }
1251}
1252
1253#[must_use = "FIDL methods require a response to be sent"]
1254#[derive(Debug)]
1255pub struct DeviceGetDeviceDescriptorResponder {
1256 control_handle: std::mem::ManuallyDrop<DeviceControlHandle>,
1257 tx_id: u32,
1258}
1259
1260impl std::ops::Drop for DeviceGetDeviceDescriptorResponder {
1264 fn drop(&mut self) {
1265 self.control_handle.shutdown();
1266 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1268 }
1269}
1270
1271impl fidl::endpoints::Responder for DeviceGetDeviceDescriptorResponder {
1272 type ControlHandle = DeviceControlHandle;
1273
1274 fn control_handle(&self) -> &DeviceControlHandle {
1275 &self.control_handle
1276 }
1277
1278 fn drop_without_shutdown(mut self) {
1279 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1281 std::mem::forget(self);
1283 }
1284}
1285
1286impl DeviceGetDeviceDescriptorResponder {
1287 pub fn send(self, mut desc: &[u8; 18]) -> Result<(), fidl::Error> {
1291 let _result = self.send_raw(desc);
1292 if _result.is_err() {
1293 self.control_handle.shutdown();
1294 }
1295 self.drop_without_shutdown();
1296 _result
1297 }
1298
1299 pub fn send_no_shutdown_on_err(self, mut desc: &[u8; 18]) -> Result<(), fidl::Error> {
1301 let _result = self.send_raw(desc);
1302 self.drop_without_shutdown();
1303 _result
1304 }
1305
1306 fn send_raw(&self, mut desc: &[u8; 18]) -> Result<(), fidl::Error> {
1307 self.control_handle.inner.send::<DeviceGetDeviceDescriptorResponse>(
1308 (desc,),
1309 self.tx_id,
1310 0x5f761371f4b9f34a,
1311 fidl::encoding::DynamicFlags::empty(),
1312 )
1313 }
1314}
1315
1316#[must_use = "FIDL methods require a response to be sent"]
1317#[derive(Debug)]
1318pub struct DeviceGetConfigurationDescriptorSizeResponder {
1319 control_handle: std::mem::ManuallyDrop<DeviceControlHandle>,
1320 tx_id: u32,
1321}
1322
1323impl std::ops::Drop for DeviceGetConfigurationDescriptorSizeResponder {
1327 fn drop(&mut self) {
1328 self.control_handle.shutdown();
1329 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1331 }
1332}
1333
1334impl fidl::endpoints::Responder for DeviceGetConfigurationDescriptorSizeResponder {
1335 type ControlHandle = DeviceControlHandle;
1336
1337 fn control_handle(&self) -> &DeviceControlHandle {
1338 &self.control_handle
1339 }
1340
1341 fn drop_without_shutdown(mut self) {
1342 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1344 std::mem::forget(self);
1346 }
1347}
1348
1349impl DeviceGetConfigurationDescriptorSizeResponder {
1350 pub fn send(self, mut s: i32, mut size: u16) -> Result<(), fidl::Error> {
1354 let _result = self.send_raw(s, size);
1355 if _result.is_err() {
1356 self.control_handle.shutdown();
1357 }
1358 self.drop_without_shutdown();
1359 _result
1360 }
1361
1362 pub fn send_no_shutdown_on_err(self, mut s: i32, mut size: u16) -> Result<(), fidl::Error> {
1364 let _result = self.send_raw(s, size);
1365 self.drop_without_shutdown();
1366 _result
1367 }
1368
1369 fn send_raw(&self, mut s: i32, mut size: u16) -> Result<(), fidl::Error> {
1370 self.control_handle.inner.send::<DeviceGetConfigurationDescriptorSizeResponse>(
1371 (s, size),
1372 self.tx_id,
1373 0x65912d7d5e3a07c8,
1374 fidl::encoding::DynamicFlags::empty(),
1375 )
1376 }
1377}
1378
1379#[must_use = "FIDL methods require a response to be sent"]
1380#[derive(Debug)]
1381pub struct DeviceGetConfigurationDescriptorResponder {
1382 control_handle: std::mem::ManuallyDrop<DeviceControlHandle>,
1383 tx_id: u32,
1384}
1385
1386impl std::ops::Drop for DeviceGetConfigurationDescriptorResponder {
1390 fn drop(&mut self) {
1391 self.control_handle.shutdown();
1392 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1394 }
1395}
1396
1397impl fidl::endpoints::Responder for DeviceGetConfigurationDescriptorResponder {
1398 type ControlHandle = DeviceControlHandle;
1399
1400 fn control_handle(&self) -> &DeviceControlHandle {
1401 &self.control_handle
1402 }
1403
1404 fn drop_without_shutdown(mut self) {
1405 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1407 std::mem::forget(self);
1409 }
1410}
1411
1412impl DeviceGetConfigurationDescriptorResponder {
1413 pub fn send(self, mut s: i32, mut desc: &[u8]) -> Result<(), fidl::Error> {
1417 let _result = self.send_raw(s, desc);
1418 if _result.is_err() {
1419 self.control_handle.shutdown();
1420 }
1421 self.drop_without_shutdown();
1422 _result
1423 }
1424
1425 pub fn send_no_shutdown_on_err(self, mut s: i32, mut desc: &[u8]) -> Result<(), fidl::Error> {
1427 let _result = self.send_raw(s, desc);
1428 self.drop_without_shutdown();
1429 _result
1430 }
1431
1432 fn send_raw(&self, mut s: i32, mut desc: &[u8]) -> Result<(), fidl::Error> {
1433 self.control_handle.inner.send::<DeviceGetConfigurationDescriptorResponse>(
1434 (s, desc),
1435 self.tx_id,
1436 0x1859a4e4421d2036,
1437 fidl::encoding::DynamicFlags::empty(),
1438 )
1439 }
1440}
1441
1442#[must_use = "FIDL methods require a response to be sent"]
1443#[derive(Debug)]
1444pub struct DeviceGetStringDescriptorResponder {
1445 control_handle: std::mem::ManuallyDrop<DeviceControlHandle>,
1446 tx_id: u32,
1447}
1448
1449impl std::ops::Drop for DeviceGetStringDescriptorResponder {
1453 fn drop(&mut self) {
1454 self.control_handle.shutdown();
1455 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1457 }
1458}
1459
1460impl fidl::endpoints::Responder for DeviceGetStringDescriptorResponder {
1461 type ControlHandle = DeviceControlHandle;
1462
1463 fn control_handle(&self) -> &DeviceControlHandle {
1464 &self.control_handle
1465 }
1466
1467 fn drop_without_shutdown(mut self) {
1468 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1470 std::mem::forget(self);
1472 }
1473}
1474
1475impl DeviceGetStringDescriptorResponder {
1476 pub fn send(
1480 self,
1481 mut s: i32,
1482 mut desc: &str,
1483 mut actual_lang_id: u16,
1484 ) -> Result<(), fidl::Error> {
1485 let _result = self.send_raw(s, desc, actual_lang_id);
1486 if _result.is_err() {
1487 self.control_handle.shutdown();
1488 }
1489 self.drop_without_shutdown();
1490 _result
1491 }
1492
1493 pub fn send_no_shutdown_on_err(
1495 self,
1496 mut s: i32,
1497 mut desc: &str,
1498 mut actual_lang_id: u16,
1499 ) -> Result<(), fidl::Error> {
1500 let _result = self.send_raw(s, desc, actual_lang_id);
1501 self.drop_without_shutdown();
1502 _result
1503 }
1504
1505 fn send_raw(
1506 &self,
1507 mut s: i32,
1508 mut desc: &str,
1509 mut actual_lang_id: u16,
1510 ) -> Result<(), fidl::Error> {
1511 self.control_handle.inner.send::<DeviceGetStringDescriptorResponse>(
1512 (s, desc, actual_lang_id),
1513 self.tx_id,
1514 0x5ff601b3b6891337,
1515 fidl::encoding::DynamicFlags::empty(),
1516 )
1517 }
1518}
1519
1520#[must_use = "FIDL methods require a response to be sent"]
1521#[derive(Debug)]
1522pub struct DeviceSetInterfaceResponder {
1523 control_handle: std::mem::ManuallyDrop<DeviceControlHandle>,
1524 tx_id: u32,
1525}
1526
1527impl std::ops::Drop for DeviceSetInterfaceResponder {
1531 fn drop(&mut self) {
1532 self.control_handle.shutdown();
1533 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1535 }
1536}
1537
1538impl fidl::endpoints::Responder for DeviceSetInterfaceResponder {
1539 type ControlHandle = DeviceControlHandle;
1540
1541 fn control_handle(&self) -> &DeviceControlHandle {
1542 &self.control_handle
1543 }
1544
1545 fn drop_without_shutdown(mut self) {
1546 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1548 std::mem::forget(self);
1550 }
1551}
1552
1553impl DeviceSetInterfaceResponder {
1554 pub fn send(self, mut s: i32) -> Result<(), fidl::Error> {
1558 let _result = self.send_raw(s);
1559 if _result.is_err() {
1560 self.control_handle.shutdown();
1561 }
1562 self.drop_without_shutdown();
1563 _result
1564 }
1565
1566 pub fn send_no_shutdown_on_err(self, mut s: i32) -> Result<(), fidl::Error> {
1568 let _result = self.send_raw(s);
1569 self.drop_without_shutdown();
1570 _result
1571 }
1572
1573 fn send_raw(&self, mut s: i32) -> Result<(), fidl::Error> {
1574 self.control_handle.inner.send::<DeviceSetInterfaceResponse>(
1575 (s,),
1576 self.tx_id,
1577 0x45348c50850b641d,
1578 fidl::encoding::DynamicFlags::empty(),
1579 )
1580 }
1581}
1582
1583#[must_use = "FIDL methods require a response to be sent"]
1584#[derive(Debug)]
1585pub struct DeviceGetDeviceIdResponder {
1586 control_handle: std::mem::ManuallyDrop<DeviceControlHandle>,
1587 tx_id: u32,
1588}
1589
1590impl std::ops::Drop for DeviceGetDeviceIdResponder {
1594 fn drop(&mut self) {
1595 self.control_handle.shutdown();
1596 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1598 }
1599}
1600
1601impl fidl::endpoints::Responder for DeviceGetDeviceIdResponder {
1602 type ControlHandle = DeviceControlHandle;
1603
1604 fn control_handle(&self) -> &DeviceControlHandle {
1605 &self.control_handle
1606 }
1607
1608 fn drop_without_shutdown(mut self) {
1609 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1611 std::mem::forget(self);
1613 }
1614}
1615
1616impl DeviceGetDeviceIdResponder {
1617 pub fn send(self, mut device_id: u32) -> Result<(), fidl::Error> {
1621 let _result = self.send_raw(device_id);
1622 if _result.is_err() {
1623 self.control_handle.shutdown();
1624 }
1625 self.drop_without_shutdown();
1626 _result
1627 }
1628
1629 pub fn send_no_shutdown_on_err(self, mut device_id: u32) -> Result<(), fidl::Error> {
1631 let _result = self.send_raw(device_id);
1632 self.drop_without_shutdown();
1633 _result
1634 }
1635
1636 fn send_raw(&self, mut device_id: u32) -> Result<(), fidl::Error> {
1637 self.control_handle.inner.send::<DeviceGetDeviceIdResponse>(
1638 (device_id,),
1639 self.tx_id,
1640 0x34a73eef491c2ce0,
1641 fidl::encoding::DynamicFlags::empty(),
1642 )
1643 }
1644}
1645
1646#[must_use = "FIDL methods require a response to be sent"]
1647#[derive(Debug)]
1648pub struct DeviceGetHubDeviceIdResponder {
1649 control_handle: std::mem::ManuallyDrop<DeviceControlHandle>,
1650 tx_id: u32,
1651}
1652
1653impl std::ops::Drop for DeviceGetHubDeviceIdResponder {
1657 fn drop(&mut self) {
1658 self.control_handle.shutdown();
1659 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1661 }
1662}
1663
1664impl fidl::endpoints::Responder for DeviceGetHubDeviceIdResponder {
1665 type ControlHandle = DeviceControlHandle;
1666
1667 fn control_handle(&self) -> &DeviceControlHandle {
1668 &self.control_handle
1669 }
1670
1671 fn drop_without_shutdown(mut self) {
1672 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1674 std::mem::forget(self);
1676 }
1677}
1678
1679impl DeviceGetHubDeviceIdResponder {
1680 pub fn send(self, mut hub_device_id: u32) -> Result<(), fidl::Error> {
1684 let _result = self.send_raw(hub_device_id);
1685 if _result.is_err() {
1686 self.control_handle.shutdown();
1687 }
1688 self.drop_without_shutdown();
1689 _result
1690 }
1691
1692 pub fn send_no_shutdown_on_err(self, mut hub_device_id: u32) -> Result<(), fidl::Error> {
1694 let _result = self.send_raw(hub_device_id);
1695 self.drop_without_shutdown();
1696 _result
1697 }
1698
1699 fn send_raw(&self, mut hub_device_id: u32) -> Result<(), fidl::Error> {
1700 self.control_handle.inner.send::<DeviceGetHubDeviceIdResponse>(
1701 (hub_device_id,),
1702 self.tx_id,
1703 0xce263c86f7bbbcd,
1704 fidl::encoding::DynamicFlags::empty(),
1705 )
1706 }
1707}
1708
1709#[must_use = "FIDL methods require a response to be sent"]
1710#[derive(Debug)]
1711pub struct DeviceGetConfigurationResponder {
1712 control_handle: std::mem::ManuallyDrop<DeviceControlHandle>,
1713 tx_id: u32,
1714}
1715
1716impl std::ops::Drop for DeviceGetConfigurationResponder {
1720 fn drop(&mut self) {
1721 self.control_handle.shutdown();
1722 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1724 }
1725}
1726
1727impl fidl::endpoints::Responder for DeviceGetConfigurationResponder {
1728 type ControlHandle = DeviceControlHandle;
1729
1730 fn control_handle(&self) -> &DeviceControlHandle {
1731 &self.control_handle
1732 }
1733
1734 fn drop_without_shutdown(mut self) {
1735 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1737 std::mem::forget(self);
1739 }
1740}
1741
1742impl DeviceGetConfigurationResponder {
1743 pub fn send(self, mut configuration: u8) -> Result<(), fidl::Error> {
1747 let _result = self.send_raw(configuration);
1748 if _result.is_err() {
1749 self.control_handle.shutdown();
1750 }
1751 self.drop_without_shutdown();
1752 _result
1753 }
1754
1755 pub fn send_no_shutdown_on_err(self, mut configuration: u8) -> Result<(), fidl::Error> {
1757 let _result = self.send_raw(configuration);
1758 self.drop_without_shutdown();
1759 _result
1760 }
1761
1762 fn send_raw(&self, mut configuration: u8) -> Result<(), fidl::Error> {
1763 self.control_handle.inner.send::<DeviceGetConfigurationResponse>(
1764 (configuration,),
1765 self.tx_id,
1766 0x73f644382a2335fd,
1767 fidl::encoding::DynamicFlags::empty(),
1768 )
1769 }
1770}
1771
1772#[must_use = "FIDL methods require a response to be sent"]
1773#[derive(Debug)]
1774pub struct DeviceSetConfigurationResponder {
1775 control_handle: std::mem::ManuallyDrop<DeviceControlHandle>,
1776 tx_id: u32,
1777}
1778
1779impl std::ops::Drop for DeviceSetConfigurationResponder {
1783 fn drop(&mut self) {
1784 self.control_handle.shutdown();
1785 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1787 }
1788}
1789
1790impl fidl::endpoints::Responder for DeviceSetConfigurationResponder {
1791 type ControlHandle = DeviceControlHandle;
1792
1793 fn control_handle(&self) -> &DeviceControlHandle {
1794 &self.control_handle
1795 }
1796
1797 fn drop_without_shutdown(mut self) {
1798 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1800 std::mem::forget(self);
1802 }
1803}
1804
1805impl DeviceSetConfigurationResponder {
1806 pub fn send(self, mut s: i32) -> Result<(), fidl::Error> {
1810 let _result = self.send_raw(s);
1811 if _result.is_err() {
1812 self.control_handle.shutdown();
1813 }
1814 self.drop_without_shutdown();
1815 _result
1816 }
1817
1818 pub fn send_no_shutdown_on_err(self, mut s: i32) -> Result<(), fidl::Error> {
1820 let _result = self.send_raw(s);
1821 self.drop_without_shutdown();
1822 _result
1823 }
1824
1825 fn send_raw(&self, mut s: i32) -> Result<(), fidl::Error> {
1826 self.control_handle.inner.send::<DeviceSetConfigurationResponse>(
1827 (s,),
1828 self.tx_id,
1829 0x12bf6e43b045ee9d,
1830 fidl::encoding::DynamicFlags::empty(),
1831 )
1832 }
1833}
1834
1835#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
1836pub struct ServiceMarker;
1837
1838#[cfg(target_os = "fuchsia")]
1839impl fidl::endpoints::ServiceMarker for ServiceMarker {
1840 type Proxy = ServiceProxy;
1841 type Request = ServiceRequest;
1842 const SERVICE_NAME: &'static str = "fuchsia.hardware.usb.device.Service";
1843}
1844
1845#[cfg(target_os = "fuchsia")]
1848pub enum ServiceRequest {
1849 Device(DeviceRequestStream),
1850}
1851
1852#[cfg(target_os = "fuchsia")]
1853impl fidl::endpoints::ServiceRequest for ServiceRequest {
1854 type Service = ServiceMarker;
1855
1856 fn dispatch(name: &str, _channel: fidl::AsyncChannel) -> Self {
1857 match name {
1858 "device" => Self::Device(
1859 <DeviceRequestStream as fidl::endpoints::RequestStream>::from_channel(_channel),
1860 ),
1861 _ => panic!("no such member protocol name for service Service"),
1862 }
1863 }
1864
1865 fn member_names() -> &'static [&'static str] {
1866 &["device"]
1867 }
1868}
1869#[cfg(target_os = "fuchsia")]
1870pub struct ServiceProxy(#[allow(dead_code)] Box<dyn fidl::endpoints::MemberOpener>);
1871
1872#[cfg(target_os = "fuchsia")]
1873impl fidl::endpoints::ServiceProxy for ServiceProxy {
1874 type Service = ServiceMarker;
1875
1876 fn from_member_opener(opener: Box<dyn fidl::endpoints::MemberOpener>) -> Self {
1877 Self(opener)
1878 }
1879}
1880
1881#[cfg(target_os = "fuchsia")]
1882impl ServiceProxy {
1883 pub fn connect_to_device(&self) -> Result<DeviceProxy, fidl::Error> {
1884 let (proxy, server_end) = fidl::endpoints::create_proxy::<DeviceMarker>();
1885 self.connect_channel_to_device(server_end)?;
1886 Ok(proxy)
1887 }
1888
1889 pub fn connect_to_device_sync(&self) -> Result<DeviceSynchronousProxy, fidl::Error> {
1892 let (proxy, server_end) = fidl::endpoints::create_sync_proxy::<DeviceMarker>();
1893 self.connect_channel_to_device(server_end)?;
1894 Ok(proxy)
1895 }
1896
1897 pub fn connect_channel_to_device(
1900 &self,
1901 server_end: fidl::endpoints::ServerEnd<DeviceMarker>,
1902 ) -> Result<(), fidl::Error> {
1903 self.0.open_member("device", server_end.into_channel())
1904 }
1905
1906 pub fn instance_name(&self) -> &str {
1907 self.0.instance_name()
1908 }
1909}
1910
1911mod internal {
1912 use super::*;
1913}