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 DeviceControlHandle {
1162 pub fn shutdown_with_epitaph(&self, status: impl Into<fidl::Epitaph>) {
1163 self.inner.shutdown_with_epitaph(status.into())
1164 }
1165}
1166
1167impl fidl::endpoints::ControlHandle for DeviceControlHandle {
1168 fn shutdown(&self) {
1169 self.inner.shutdown()
1170 }
1171
1172 fn shutdown_with_epitaph(&self, status: fidl::Epitaph) {
1173 self.inner.shutdown_with_epitaph(status)
1174 }
1175
1176 fn is_closed(&self) -> bool {
1177 self.inner.channel().is_closed()
1178 }
1179 fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
1180 self.inner.channel().on_closed()
1181 }
1182
1183 #[cfg(target_os = "fuchsia")]
1184 fn signal_peer(
1185 &self,
1186 clear_mask: zx::Signals,
1187 set_mask: zx::Signals,
1188 ) -> Result<(), zx_status::Status> {
1189 use fidl::Peered;
1190 self.inner.channel().signal_peer(clear_mask, set_mask)
1191 }
1192}
1193
1194impl DeviceControlHandle {}
1195
1196#[must_use = "FIDL methods require a response to be sent"]
1197#[derive(Debug)]
1198pub struct DeviceGetDeviceSpeedResponder {
1199 control_handle: std::mem::ManuallyDrop<DeviceControlHandle>,
1200 tx_id: u32,
1201}
1202
1203impl std::ops::Drop for DeviceGetDeviceSpeedResponder {
1207 fn drop(&mut self) {
1208 self.control_handle.shutdown();
1209 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1211 }
1212}
1213
1214impl fidl::endpoints::Responder for DeviceGetDeviceSpeedResponder {
1215 type ControlHandle = DeviceControlHandle;
1216
1217 fn control_handle(&self) -> &DeviceControlHandle {
1218 &self.control_handle
1219 }
1220
1221 fn drop_without_shutdown(mut self) {
1222 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1224 std::mem::forget(self);
1226 }
1227}
1228
1229impl DeviceGetDeviceSpeedResponder {
1230 pub fn send(self, mut speed: u32) -> Result<(), fidl::Error> {
1234 let _result = self.send_raw(speed);
1235 if _result.is_err() {
1236 self.control_handle.shutdown();
1237 }
1238 self.drop_without_shutdown();
1239 _result
1240 }
1241
1242 pub fn send_no_shutdown_on_err(self, mut speed: u32) -> Result<(), fidl::Error> {
1244 let _result = self.send_raw(speed);
1245 self.drop_without_shutdown();
1246 _result
1247 }
1248
1249 fn send_raw(&self, mut speed: u32) -> Result<(), fidl::Error> {
1250 self.control_handle.inner.send::<DeviceGetDeviceSpeedResponse>(
1251 (speed,),
1252 self.tx_id,
1253 0x623cd7927fb449de,
1254 fidl::encoding::DynamicFlags::empty(),
1255 )
1256 }
1257}
1258
1259#[must_use = "FIDL methods require a response to be sent"]
1260#[derive(Debug)]
1261pub struct DeviceGetDeviceDescriptorResponder {
1262 control_handle: std::mem::ManuallyDrop<DeviceControlHandle>,
1263 tx_id: u32,
1264}
1265
1266impl std::ops::Drop for DeviceGetDeviceDescriptorResponder {
1270 fn drop(&mut self) {
1271 self.control_handle.shutdown();
1272 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1274 }
1275}
1276
1277impl fidl::endpoints::Responder for DeviceGetDeviceDescriptorResponder {
1278 type ControlHandle = DeviceControlHandle;
1279
1280 fn control_handle(&self) -> &DeviceControlHandle {
1281 &self.control_handle
1282 }
1283
1284 fn drop_without_shutdown(mut self) {
1285 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1287 std::mem::forget(self);
1289 }
1290}
1291
1292impl DeviceGetDeviceDescriptorResponder {
1293 pub fn send(self, mut desc: &[u8; 18]) -> Result<(), fidl::Error> {
1297 let _result = self.send_raw(desc);
1298 if _result.is_err() {
1299 self.control_handle.shutdown();
1300 }
1301 self.drop_without_shutdown();
1302 _result
1303 }
1304
1305 pub fn send_no_shutdown_on_err(self, mut desc: &[u8; 18]) -> Result<(), fidl::Error> {
1307 let _result = self.send_raw(desc);
1308 self.drop_without_shutdown();
1309 _result
1310 }
1311
1312 fn send_raw(&self, mut desc: &[u8; 18]) -> Result<(), fidl::Error> {
1313 self.control_handle.inner.send::<DeviceGetDeviceDescriptorResponse>(
1314 (desc,),
1315 self.tx_id,
1316 0x5f761371f4b9f34a,
1317 fidl::encoding::DynamicFlags::empty(),
1318 )
1319 }
1320}
1321
1322#[must_use = "FIDL methods require a response to be sent"]
1323#[derive(Debug)]
1324pub struct DeviceGetConfigurationDescriptorSizeResponder {
1325 control_handle: std::mem::ManuallyDrop<DeviceControlHandle>,
1326 tx_id: u32,
1327}
1328
1329impl std::ops::Drop for DeviceGetConfigurationDescriptorSizeResponder {
1333 fn drop(&mut self) {
1334 self.control_handle.shutdown();
1335 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1337 }
1338}
1339
1340impl fidl::endpoints::Responder for DeviceGetConfigurationDescriptorSizeResponder {
1341 type ControlHandle = DeviceControlHandle;
1342
1343 fn control_handle(&self) -> &DeviceControlHandle {
1344 &self.control_handle
1345 }
1346
1347 fn drop_without_shutdown(mut self) {
1348 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1350 std::mem::forget(self);
1352 }
1353}
1354
1355impl DeviceGetConfigurationDescriptorSizeResponder {
1356 pub fn send(self, mut s: i32, mut size: u16) -> Result<(), fidl::Error> {
1360 let _result = self.send_raw(s, size);
1361 if _result.is_err() {
1362 self.control_handle.shutdown();
1363 }
1364 self.drop_without_shutdown();
1365 _result
1366 }
1367
1368 pub fn send_no_shutdown_on_err(self, mut s: i32, mut size: u16) -> Result<(), fidl::Error> {
1370 let _result = self.send_raw(s, size);
1371 self.drop_without_shutdown();
1372 _result
1373 }
1374
1375 fn send_raw(&self, mut s: i32, mut size: u16) -> Result<(), fidl::Error> {
1376 self.control_handle.inner.send::<DeviceGetConfigurationDescriptorSizeResponse>(
1377 (s, size),
1378 self.tx_id,
1379 0x65912d7d5e3a07c8,
1380 fidl::encoding::DynamicFlags::empty(),
1381 )
1382 }
1383}
1384
1385#[must_use = "FIDL methods require a response to be sent"]
1386#[derive(Debug)]
1387pub struct DeviceGetConfigurationDescriptorResponder {
1388 control_handle: std::mem::ManuallyDrop<DeviceControlHandle>,
1389 tx_id: u32,
1390}
1391
1392impl std::ops::Drop for DeviceGetConfigurationDescriptorResponder {
1396 fn drop(&mut self) {
1397 self.control_handle.shutdown();
1398 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1400 }
1401}
1402
1403impl fidl::endpoints::Responder for DeviceGetConfigurationDescriptorResponder {
1404 type ControlHandle = DeviceControlHandle;
1405
1406 fn control_handle(&self) -> &DeviceControlHandle {
1407 &self.control_handle
1408 }
1409
1410 fn drop_without_shutdown(mut self) {
1411 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1413 std::mem::forget(self);
1415 }
1416}
1417
1418impl DeviceGetConfigurationDescriptorResponder {
1419 pub fn send(self, mut s: i32, mut desc: &[u8]) -> Result<(), fidl::Error> {
1423 let _result = self.send_raw(s, desc);
1424 if _result.is_err() {
1425 self.control_handle.shutdown();
1426 }
1427 self.drop_without_shutdown();
1428 _result
1429 }
1430
1431 pub fn send_no_shutdown_on_err(self, mut s: i32, mut desc: &[u8]) -> Result<(), fidl::Error> {
1433 let _result = self.send_raw(s, desc);
1434 self.drop_without_shutdown();
1435 _result
1436 }
1437
1438 fn send_raw(&self, mut s: i32, mut desc: &[u8]) -> Result<(), fidl::Error> {
1439 self.control_handle.inner.send::<DeviceGetConfigurationDescriptorResponse>(
1440 (s, desc),
1441 self.tx_id,
1442 0x1859a4e4421d2036,
1443 fidl::encoding::DynamicFlags::empty(),
1444 )
1445 }
1446}
1447
1448#[must_use = "FIDL methods require a response to be sent"]
1449#[derive(Debug)]
1450pub struct DeviceGetStringDescriptorResponder {
1451 control_handle: std::mem::ManuallyDrop<DeviceControlHandle>,
1452 tx_id: u32,
1453}
1454
1455impl std::ops::Drop for DeviceGetStringDescriptorResponder {
1459 fn drop(&mut self) {
1460 self.control_handle.shutdown();
1461 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1463 }
1464}
1465
1466impl fidl::endpoints::Responder for DeviceGetStringDescriptorResponder {
1467 type ControlHandle = DeviceControlHandle;
1468
1469 fn control_handle(&self) -> &DeviceControlHandle {
1470 &self.control_handle
1471 }
1472
1473 fn drop_without_shutdown(mut self) {
1474 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1476 std::mem::forget(self);
1478 }
1479}
1480
1481impl DeviceGetStringDescriptorResponder {
1482 pub fn send(
1486 self,
1487 mut s: i32,
1488 mut desc: &str,
1489 mut actual_lang_id: u16,
1490 ) -> Result<(), fidl::Error> {
1491 let _result = self.send_raw(s, desc, actual_lang_id);
1492 if _result.is_err() {
1493 self.control_handle.shutdown();
1494 }
1495 self.drop_without_shutdown();
1496 _result
1497 }
1498
1499 pub fn send_no_shutdown_on_err(
1501 self,
1502 mut s: i32,
1503 mut desc: &str,
1504 mut actual_lang_id: u16,
1505 ) -> Result<(), fidl::Error> {
1506 let _result = self.send_raw(s, desc, actual_lang_id);
1507 self.drop_without_shutdown();
1508 _result
1509 }
1510
1511 fn send_raw(
1512 &self,
1513 mut s: i32,
1514 mut desc: &str,
1515 mut actual_lang_id: u16,
1516 ) -> Result<(), fidl::Error> {
1517 self.control_handle.inner.send::<DeviceGetStringDescriptorResponse>(
1518 (s, desc, actual_lang_id),
1519 self.tx_id,
1520 0x5ff601b3b6891337,
1521 fidl::encoding::DynamicFlags::empty(),
1522 )
1523 }
1524}
1525
1526#[must_use = "FIDL methods require a response to be sent"]
1527#[derive(Debug)]
1528pub struct DeviceSetInterfaceResponder {
1529 control_handle: std::mem::ManuallyDrop<DeviceControlHandle>,
1530 tx_id: u32,
1531}
1532
1533impl std::ops::Drop for DeviceSetInterfaceResponder {
1537 fn drop(&mut self) {
1538 self.control_handle.shutdown();
1539 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1541 }
1542}
1543
1544impl fidl::endpoints::Responder for DeviceSetInterfaceResponder {
1545 type ControlHandle = DeviceControlHandle;
1546
1547 fn control_handle(&self) -> &DeviceControlHandle {
1548 &self.control_handle
1549 }
1550
1551 fn drop_without_shutdown(mut self) {
1552 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1554 std::mem::forget(self);
1556 }
1557}
1558
1559impl DeviceSetInterfaceResponder {
1560 pub fn send(self, mut s: i32) -> Result<(), fidl::Error> {
1564 let _result = self.send_raw(s);
1565 if _result.is_err() {
1566 self.control_handle.shutdown();
1567 }
1568 self.drop_without_shutdown();
1569 _result
1570 }
1571
1572 pub fn send_no_shutdown_on_err(self, mut s: i32) -> Result<(), fidl::Error> {
1574 let _result = self.send_raw(s);
1575 self.drop_without_shutdown();
1576 _result
1577 }
1578
1579 fn send_raw(&self, mut s: i32) -> Result<(), fidl::Error> {
1580 self.control_handle.inner.send::<DeviceSetInterfaceResponse>(
1581 (s,),
1582 self.tx_id,
1583 0x45348c50850b641d,
1584 fidl::encoding::DynamicFlags::empty(),
1585 )
1586 }
1587}
1588
1589#[must_use = "FIDL methods require a response to be sent"]
1590#[derive(Debug)]
1591pub struct DeviceGetDeviceIdResponder {
1592 control_handle: std::mem::ManuallyDrop<DeviceControlHandle>,
1593 tx_id: u32,
1594}
1595
1596impl std::ops::Drop for DeviceGetDeviceIdResponder {
1600 fn drop(&mut self) {
1601 self.control_handle.shutdown();
1602 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1604 }
1605}
1606
1607impl fidl::endpoints::Responder for DeviceGetDeviceIdResponder {
1608 type ControlHandle = DeviceControlHandle;
1609
1610 fn control_handle(&self) -> &DeviceControlHandle {
1611 &self.control_handle
1612 }
1613
1614 fn drop_without_shutdown(mut self) {
1615 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1617 std::mem::forget(self);
1619 }
1620}
1621
1622impl DeviceGetDeviceIdResponder {
1623 pub fn send(self, mut device_id: u32) -> Result<(), fidl::Error> {
1627 let _result = self.send_raw(device_id);
1628 if _result.is_err() {
1629 self.control_handle.shutdown();
1630 }
1631 self.drop_without_shutdown();
1632 _result
1633 }
1634
1635 pub fn send_no_shutdown_on_err(self, mut device_id: u32) -> Result<(), fidl::Error> {
1637 let _result = self.send_raw(device_id);
1638 self.drop_without_shutdown();
1639 _result
1640 }
1641
1642 fn send_raw(&self, mut device_id: u32) -> Result<(), fidl::Error> {
1643 self.control_handle.inner.send::<DeviceGetDeviceIdResponse>(
1644 (device_id,),
1645 self.tx_id,
1646 0x34a73eef491c2ce0,
1647 fidl::encoding::DynamicFlags::empty(),
1648 )
1649 }
1650}
1651
1652#[must_use = "FIDL methods require a response to be sent"]
1653#[derive(Debug)]
1654pub struct DeviceGetHubDeviceIdResponder {
1655 control_handle: std::mem::ManuallyDrop<DeviceControlHandle>,
1656 tx_id: u32,
1657}
1658
1659impl std::ops::Drop for DeviceGetHubDeviceIdResponder {
1663 fn drop(&mut self) {
1664 self.control_handle.shutdown();
1665 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1667 }
1668}
1669
1670impl fidl::endpoints::Responder for DeviceGetHubDeviceIdResponder {
1671 type ControlHandle = DeviceControlHandle;
1672
1673 fn control_handle(&self) -> &DeviceControlHandle {
1674 &self.control_handle
1675 }
1676
1677 fn drop_without_shutdown(mut self) {
1678 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1680 std::mem::forget(self);
1682 }
1683}
1684
1685impl DeviceGetHubDeviceIdResponder {
1686 pub fn send(self, mut hub_device_id: u32) -> Result<(), fidl::Error> {
1690 let _result = self.send_raw(hub_device_id);
1691 if _result.is_err() {
1692 self.control_handle.shutdown();
1693 }
1694 self.drop_without_shutdown();
1695 _result
1696 }
1697
1698 pub fn send_no_shutdown_on_err(self, mut hub_device_id: u32) -> Result<(), fidl::Error> {
1700 let _result = self.send_raw(hub_device_id);
1701 self.drop_without_shutdown();
1702 _result
1703 }
1704
1705 fn send_raw(&self, mut hub_device_id: u32) -> Result<(), fidl::Error> {
1706 self.control_handle.inner.send::<DeviceGetHubDeviceIdResponse>(
1707 (hub_device_id,),
1708 self.tx_id,
1709 0xce263c86f7bbbcd,
1710 fidl::encoding::DynamicFlags::empty(),
1711 )
1712 }
1713}
1714
1715#[must_use = "FIDL methods require a response to be sent"]
1716#[derive(Debug)]
1717pub struct DeviceGetConfigurationResponder {
1718 control_handle: std::mem::ManuallyDrop<DeviceControlHandle>,
1719 tx_id: u32,
1720}
1721
1722impl std::ops::Drop for DeviceGetConfigurationResponder {
1726 fn drop(&mut self) {
1727 self.control_handle.shutdown();
1728 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1730 }
1731}
1732
1733impl fidl::endpoints::Responder for DeviceGetConfigurationResponder {
1734 type ControlHandle = DeviceControlHandle;
1735
1736 fn control_handle(&self) -> &DeviceControlHandle {
1737 &self.control_handle
1738 }
1739
1740 fn drop_without_shutdown(mut self) {
1741 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1743 std::mem::forget(self);
1745 }
1746}
1747
1748impl DeviceGetConfigurationResponder {
1749 pub fn send(self, mut configuration: u8) -> Result<(), fidl::Error> {
1753 let _result = self.send_raw(configuration);
1754 if _result.is_err() {
1755 self.control_handle.shutdown();
1756 }
1757 self.drop_without_shutdown();
1758 _result
1759 }
1760
1761 pub fn send_no_shutdown_on_err(self, mut configuration: u8) -> Result<(), fidl::Error> {
1763 let _result = self.send_raw(configuration);
1764 self.drop_without_shutdown();
1765 _result
1766 }
1767
1768 fn send_raw(&self, mut configuration: u8) -> Result<(), fidl::Error> {
1769 self.control_handle.inner.send::<DeviceGetConfigurationResponse>(
1770 (configuration,),
1771 self.tx_id,
1772 0x73f644382a2335fd,
1773 fidl::encoding::DynamicFlags::empty(),
1774 )
1775 }
1776}
1777
1778#[must_use = "FIDL methods require a response to be sent"]
1779#[derive(Debug)]
1780pub struct DeviceSetConfigurationResponder {
1781 control_handle: std::mem::ManuallyDrop<DeviceControlHandle>,
1782 tx_id: u32,
1783}
1784
1785impl std::ops::Drop for DeviceSetConfigurationResponder {
1789 fn drop(&mut self) {
1790 self.control_handle.shutdown();
1791 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1793 }
1794}
1795
1796impl fidl::endpoints::Responder for DeviceSetConfigurationResponder {
1797 type ControlHandle = DeviceControlHandle;
1798
1799 fn control_handle(&self) -> &DeviceControlHandle {
1800 &self.control_handle
1801 }
1802
1803 fn drop_without_shutdown(mut self) {
1804 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1806 std::mem::forget(self);
1808 }
1809}
1810
1811impl DeviceSetConfigurationResponder {
1812 pub fn send(self, mut s: i32) -> Result<(), fidl::Error> {
1816 let _result = self.send_raw(s);
1817 if _result.is_err() {
1818 self.control_handle.shutdown();
1819 }
1820 self.drop_without_shutdown();
1821 _result
1822 }
1823
1824 pub fn send_no_shutdown_on_err(self, mut s: i32) -> Result<(), fidl::Error> {
1826 let _result = self.send_raw(s);
1827 self.drop_without_shutdown();
1828 _result
1829 }
1830
1831 fn send_raw(&self, mut s: i32) -> Result<(), fidl::Error> {
1832 self.control_handle.inner.send::<DeviceSetConfigurationResponse>(
1833 (s,),
1834 self.tx_id,
1835 0x12bf6e43b045ee9d,
1836 fidl::encoding::DynamicFlags::empty(),
1837 )
1838 }
1839}
1840
1841#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
1842pub struct ServiceMarker;
1843
1844#[cfg(target_os = "fuchsia")]
1845impl fidl::endpoints::ServiceMarker for ServiceMarker {
1846 type Proxy = ServiceProxy;
1847 type Request = ServiceRequest;
1848 const SERVICE_NAME: &'static str = "fuchsia.hardware.usb.device.Service";
1849}
1850
1851#[cfg(target_os = "fuchsia")]
1854pub enum ServiceRequest {
1855 Device(DeviceRequestStream),
1856}
1857
1858#[cfg(target_os = "fuchsia")]
1859impl fidl::endpoints::ServiceRequest for ServiceRequest {
1860 type Service = ServiceMarker;
1861
1862 fn dispatch(name: &str, _channel: fidl::AsyncChannel) -> Self {
1863 match name {
1864 "device" => Self::Device(
1865 <DeviceRequestStream as fidl::endpoints::RequestStream>::from_channel(_channel),
1866 ),
1867 _ => panic!("no such member protocol name for service Service"),
1868 }
1869 }
1870
1871 fn member_names() -> &'static [&'static str] {
1872 &["device"]
1873 }
1874}
1875#[cfg(target_os = "fuchsia")]
1876pub struct ServiceProxy(#[allow(dead_code)] Box<dyn fidl::endpoints::MemberOpener>);
1877
1878#[cfg(target_os = "fuchsia")]
1879impl fidl::endpoints::ServiceProxy for ServiceProxy {
1880 type Service = ServiceMarker;
1881
1882 fn from_member_opener(opener: Box<dyn fidl::endpoints::MemberOpener>) -> Self {
1883 Self(opener)
1884 }
1885}
1886
1887#[cfg(target_os = "fuchsia")]
1888impl ServiceProxy {
1889 pub fn connect_to_device(&self) -> Result<DeviceProxy, fidl::Error> {
1890 let (proxy, server_end) = fidl::endpoints::create_proxy::<DeviceMarker>();
1891 self.connect_channel_to_device(server_end)?;
1892 Ok(proxy)
1893 }
1894
1895 pub fn connect_to_device_sync(&self) -> Result<DeviceSynchronousProxy, fidl::Error> {
1898 let (proxy, server_end) = fidl::endpoints::create_sync_proxy::<DeviceMarker>();
1899 self.connect_channel_to_device(server_end)?;
1900 Ok(proxy)
1901 }
1902
1903 pub fn connect_channel_to_device(
1906 &self,
1907 server_end: fidl::endpoints::ServerEnd<DeviceMarker>,
1908 ) -> Result<(), fidl::Error> {
1909 self.0.open_member("device", server_end.into_channel())
1910 }
1911
1912 pub fn instance_name(&self) -> &str {
1913 self.0.instance_name()
1914 }
1915}
1916
1917mod internal {
1918 use super::*;
1919}