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