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::NullableHandle {
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 { Some((responder)) } else { None }
1095 }
1096
1097 #[allow(irrefutable_let_patterns)]
1098 pub fn into_get_hub_device_id(self) -> Option<(DeviceGetHubDeviceIdResponder)> {
1099 if let DeviceRequest::GetHubDeviceId { responder } = self {
1100 Some((responder))
1101 } else {
1102 None
1103 }
1104 }
1105
1106 #[allow(irrefutable_let_patterns)]
1107 pub fn into_get_configuration(self) -> Option<(DeviceGetConfigurationResponder)> {
1108 if let DeviceRequest::GetConfiguration { responder } = self {
1109 Some((responder))
1110 } else {
1111 None
1112 }
1113 }
1114
1115 #[allow(irrefutable_let_patterns)]
1116 pub fn into_set_configuration(self) -> Option<(u8, DeviceSetConfigurationResponder)> {
1117 if let DeviceRequest::SetConfiguration { configuration, responder } = self {
1118 Some((configuration, responder))
1119 } else {
1120 None
1121 }
1122 }
1123
1124 pub fn method_name(&self) -> &'static str {
1126 match *self {
1127 DeviceRequest::GetDeviceSpeed { .. } => "get_device_speed",
1128 DeviceRequest::GetDeviceDescriptor { .. } => "get_device_descriptor",
1129 DeviceRequest::GetConfigurationDescriptorSize { .. } => {
1130 "get_configuration_descriptor_size"
1131 }
1132 DeviceRequest::GetConfigurationDescriptor { .. } => "get_configuration_descriptor",
1133 DeviceRequest::GetStringDescriptor { .. } => "get_string_descriptor",
1134 DeviceRequest::SetInterface { .. } => "set_interface",
1135 DeviceRequest::GetDeviceId { .. } => "get_device_id",
1136 DeviceRequest::GetHubDeviceId { .. } => "get_hub_device_id",
1137 DeviceRequest::GetConfiguration { .. } => "get_configuration",
1138 DeviceRequest::SetConfiguration { .. } => "set_configuration",
1139 }
1140 }
1141}
1142
1143#[derive(Debug, Clone)]
1144pub struct DeviceControlHandle {
1145 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
1146}
1147
1148impl fidl::endpoints::ControlHandle for DeviceControlHandle {
1149 fn shutdown(&self) {
1150 self.inner.shutdown()
1151 }
1152
1153 fn shutdown_with_epitaph(&self, status: zx_status::Status) {
1154 self.inner.shutdown_with_epitaph(status)
1155 }
1156
1157 fn is_closed(&self) -> bool {
1158 self.inner.channel().is_closed()
1159 }
1160 fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
1161 self.inner.channel().on_closed()
1162 }
1163
1164 #[cfg(target_os = "fuchsia")]
1165 fn signal_peer(
1166 &self,
1167 clear_mask: zx::Signals,
1168 set_mask: zx::Signals,
1169 ) -> Result<(), zx_status::Status> {
1170 use fidl::Peered;
1171 self.inner.channel().signal_peer(clear_mask, set_mask)
1172 }
1173}
1174
1175impl DeviceControlHandle {}
1176
1177#[must_use = "FIDL methods require a response to be sent"]
1178#[derive(Debug)]
1179pub struct DeviceGetDeviceSpeedResponder {
1180 control_handle: std::mem::ManuallyDrop<DeviceControlHandle>,
1181 tx_id: u32,
1182}
1183
1184impl std::ops::Drop for DeviceGetDeviceSpeedResponder {
1188 fn drop(&mut self) {
1189 self.control_handle.shutdown();
1190 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1192 }
1193}
1194
1195impl fidl::endpoints::Responder for DeviceGetDeviceSpeedResponder {
1196 type ControlHandle = DeviceControlHandle;
1197
1198 fn control_handle(&self) -> &DeviceControlHandle {
1199 &self.control_handle
1200 }
1201
1202 fn drop_without_shutdown(mut self) {
1203 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1205 std::mem::forget(self);
1207 }
1208}
1209
1210impl DeviceGetDeviceSpeedResponder {
1211 pub fn send(self, mut speed: u32) -> Result<(), fidl::Error> {
1215 let _result = self.send_raw(speed);
1216 if _result.is_err() {
1217 self.control_handle.shutdown();
1218 }
1219 self.drop_without_shutdown();
1220 _result
1221 }
1222
1223 pub fn send_no_shutdown_on_err(self, mut speed: u32) -> Result<(), fidl::Error> {
1225 let _result = self.send_raw(speed);
1226 self.drop_without_shutdown();
1227 _result
1228 }
1229
1230 fn send_raw(&self, mut speed: u32) -> Result<(), fidl::Error> {
1231 self.control_handle.inner.send::<DeviceGetDeviceSpeedResponse>(
1232 (speed,),
1233 self.tx_id,
1234 0x623cd7927fb449de,
1235 fidl::encoding::DynamicFlags::empty(),
1236 )
1237 }
1238}
1239
1240#[must_use = "FIDL methods require a response to be sent"]
1241#[derive(Debug)]
1242pub struct DeviceGetDeviceDescriptorResponder {
1243 control_handle: std::mem::ManuallyDrop<DeviceControlHandle>,
1244 tx_id: u32,
1245}
1246
1247impl std::ops::Drop for DeviceGetDeviceDescriptorResponder {
1251 fn drop(&mut self) {
1252 self.control_handle.shutdown();
1253 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1255 }
1256}
1257
1258impl fidl::endpoints::Responder for DeviceGetDeviceDescriptorResponder {
1259 type ControlHandle = DeviceControlHandle;
1260
1261 fn control_handle(&self) -> &DeviceControlHandle {
1262 &self.control_handle
1263 }
1264
1265 fn drop_without_shutdown(mut self) {
1266 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1268 std::mem::forget(self);
1270 }
1271}
1272
1273impl DeviceGetDeviceDescriptorResponder {
1274 pub fn send(self, mut desc: &[u8; 18]) -> Result<(), fidl::Error> {
1278 let _result = self.send_raw(desc);
1279 if _result.is_err() {
1280 self.control_handle.shutdown();
1281 }
1282 self.drop_without_shutdown();
1283 _result
1284 }
1285
1286 pub fn send_no_shutdown_on_err(self, mut desc: &[u8; 18]) -> Result<(), fidl::Error> {
1288 let _result = self.send_raw(desc);
1289 self.drop_without_shutdown();
1290 _result
1291 }
1292
1293 fn send_raw(&self, mut desc: &[u8; 18]) -> Result<(), fidl::Error> {
1294 self.control_handle.inner.send::<DeviceGetDeviceDescriptorResponse>(
1295 (desc,),
1296 self.tx_id,
1297 0x5f761371f4b9f34a,
1298 fidl::encoding::DynamicFlags::empty(),
1299 )
1300 }
1301}
1302
1303#[must_use = "FIDL methods require a response to be sent"]
1304#[derive(Debug)]
1305pub struct DeviceGetConfigurationDescriptorSizeResponder {
1306 control_handle: std::mem::ManuallyDrop<DeviceControlHandle>,
1307 tx_id: u32,
1308}
1309
1310impl std::ops::Drop for DeviceGetConfigurationDescriptorSizeResponder {
1314 fn drop(&mut self) {
1315 self.control_handle.shutdown();
1316 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1318 }
1319}
1320
1321impl fidl::endpoints::Responder for DeviceGetConfigurationDescriptorSizeResponder {
1322 type ControlHandle = DeviceControlHandle;
1323
1324 fn control_handle(&self) -> &DeviceControlHandle {
1325 &self.control_handle
1326 }
1327
1328 fn drop_without_shutdown(mut self) {
1329 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1331 std::mem::forget(self);
1333 }
1334}
1335
1336impl DeviceGetConfigurationDescriptorSizeResponder {
1337 pub fn send(self, mut s: i32, mut size: u16) -> Result<(), fidl::Error> {
1341 let _result = self.send_raw(s, size);
1342 if _result.is_err() {
1343 self.control_handle.shutdown();
1344 }
1345 self.drop_without_shutdown();
1346 _result
1347 }
1348
1349 pub fn send_no_shutdown_on_err(self, mut s: i32, mut size: u16) -> Result<(), fidl::Error> {
1351 let _result = self.send_raw(s, size);
1352 self.drop_without_shutdown();
1353 _result
1354 }
1355
1356 fn send_raw(&self, mut s: i32, mut size: u16) -> Result<(), fidl::Error> {
1357 self.control_handle.inner.send::<DeviceGetConfigurationDescriptorSizeResponse>(
1358 (s, size),
1359 self.tx_id,
1360 0x65912d7d5e3a07c8,
1361 fidl::encoding::DynamicFlags::empty(),
1362 )
1363 }
1364}
1365
1366#[must_use = "FIDL methods require a response to be sent"]
1367#[derive(Debug)]
1368pub struct DeviceGetConfigurationDescriptorResponder {
1369 control_handle: std::mem::ManuallyDrop<DeviceControlHandle>,
1370 tx_id: u32,
1371}
1372
1373impl std::ops::Drop for DeviceGetConfigurationDescriptorResponder {
1377 fn drop(&mut self) {
1378 self.control_handle.shutdown();
1379 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1381 }
1382}
1383
1384impl fidl::endpoints::Responder for DeviceGetConfigurationDescriptorResponder {
1385 type ControlHandle = DeviceControlHandle;
1386
1387 fn control_handle(&self) -> &DeviceControlHandle {
1388 &self.control_handle
1389 }
1390
1391 fn drop_without_shutdown(mut self) {
1392 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1394 std::mem::forget(self);
1396 }
1397}
1398
1399impl DeviceGetConfigurationDescriptorResponder {
1400 pub fn send(self, mut s: i32, mut desc: &[u8]) -> Result<(), fidl::Error> {
1404 let _result = self.send_raw(s, desc);
1405 if _result.is_err() {
1406 self.control_handle.shutdown();
1407 }
1408 self.drop_without_shutdown();
1409 _result
1410 }
1411
1412 pub fn send_no_shutdown_on_err(self, mut s: i32, mut desc: &[u8]) -> Result<(), fidl::Error> {
1414 let _result = self.send_raw(s, desc);
1415 self.drop_without_shutdown();
1416 _result
1417 }
1418
1419 fn send_raw(&self, mut s: i32, mut desc: &[u8]) -> Result<(), fidl::Error> {
1420 self.control_handle.inner.send::<DeviceGetConfigurationDescriptorResponse>(
1421 (s, desc),
1422 self.tx_id,
1423 0x1859a4e4421d2036,
1424 fidl::encoding::DynamicFlags::empty(),
1425 )
1426 }
1427}
1428
1429#[must_use = "FIDL methods require a response to be sent"]
1430#[derive(Debug)]
1431pub struct DeviceGetStringDescriptorResponder {
1432 control_handle: std::mem::ManuallyDrop<DeviceControlHandle>,
1433 tx_id: u32,
1434}
1435
1436impl std::ops::Drop for DeviceGetStringDescriptorResponder {
1440 fn drop(&mut self) {
1441 self.control_handle.shutdown();
1442 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1444 }
1445}
1446
1447impl fidl::endpoints::Responder for DeviceGetStringDescriptorResponder {
1448 type ControlHandle = DeviceControlHandle;
1449
1450 fn control_handle(&self) -> &DeviceControlHandle {
1451 &self.control_handle
1452 }
1453
1454 fn drop_without_shutdown(mut self) {
1455 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1457 std::mem::forget(self);
1459 }
1460}
1461
1462impl DeviceGetStringDescriptorResponder {
1463 pub fn send(
1467 self,
1468 mut s: i32,
1469 mut desc: &str,
1470 mut actual_lang_id: u16,
1471 ) -> Result<(), fidl::Error> {
1472 let _result = self.send_raw(s, desc, actual_lang_id);
1473 if _result.is_err() {
1474 self.control_handle.shutdown();
1475 }
1476 self.drop_without_shutdown();
1477 _result
1478 }
1479
1480 pub fn send_no_shutdown_on_err(
1482 self,
1483 mut s: i32,
1484 mut desc: &str,
1485 mut actual_lang_id: u16,
1486 ) -> Result<(), fidl::Error> {
1487 let _result = self.send_raw(s, desc, actual_lang_id);
1488 self.drop_without_shutdown();
1489 _result
1490 }
1491
1492 fn send_raw(
1493 &self,
1494 mut s: i32,
1495 mut desc: &str,
1496 mut actual_lang_id: u16,
1497 ) -> Result<(), fidl::Error> {
1498 self.control_handle.inner.send::<DeviceGetStringDescriptorResponse>(
1499 (s, desc, actual_lang_id),
1500 self.tx_id,
1501 0x5ff601b3b6891337,
1502 fidl::encoding::DynamicFlags::empty(),
1503 )
1504 }
1505}
1506
1507#[must_use = "FIDL methods require a response to be sent"]
1508#[derive(Debug)]
1509pub struct DeviceSetInterfaceResponder {
1510 control_handle: std::mem::ManuallyDrop<DeviceControlHandle>,
1511 tx_id: u32,
1512}
1513
1514impl std::ops::Drop for DeviceSetInterfaceResponder {
1518 fn drop(&mut self) {
1519 self.control_handle.shutdown();
1520 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1522 }
1523}
1524
1525impl fidl::endpoints::Responder for DeviceSetInterfaceResponder {
1526 type ControlHandle = DeviceControlHandle;
1527
1528 fn control_handle(&self) -> &DeviceControlHandle {
1529 &self.control_handle
1530 }
1531
1532 fn drop_without_shutdown(mut self) {
1533 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1535 std::mem::forget(self);
1537 }
1538}
1539
1540impl DeviceSetInterfaceResponder {
1541 pub fn send(self, mut s: i32) -> Result<(), fidl::Error> {
1545 let _result = self.send_raw(s);
1546 if _result.is_err() {
1547 self.control_handle.shutdown();
1548 }
1549 self.drop_without_shutdown();
1550 _result
1551 }
1552
1553 pub fn send_no_shutdown_on_err(self, mut s: i32) -> Result<(), fidl::Error> {
1555 let _result = self.send_raw(s);
1556 self.drop_without_shutdown();
1557 _result
1558 }
1559
1560 fn send_raw(&self, mut s: i32) -> Result<(), fidl::Error> {
1561 self.control_handle.inner.send::<DeviceSetInterfaceResponse>(
1562 (s,),
1563 self.tx_id,
1564 0x45348c50850b641d,
1565 fidl::encoding::DynamicFlags::empty(),
1566 )
1567 }
1568}
1569
1570#[must_use = "FIDL methods require a response to be sent"]
1571#[derive(Debug)]
1572pub struct DeviceGetDeviceIdResponder {
1573 control_handle: std::mem::ManuallyDrop<DeviceControlHandle>,
1574 tx_id: u32,
1575}
1576
1577impl std::ops::Drop for DeviceGetDeviceIdResponder {
1581 fn drop(&mut self) {
1582 self.control_handle.shutdown();
1583 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1585 }
1586}
1587
1588impl fidl::endpoints::Responder for DeviceGetDeviceIdResponder {
1589 type ControlHandle = DeviceControlHandle;
1590
1591 fn control_handle(&self) -> &DeviceControlHandle {
1592 &self.control_handle
1593 }
1594
1595 fn drop_without_shutdown(mut self) {
1596 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1598 std::mem::forget(self);
1600 }
1601}
1602
1603impl DeviceGetDeviceIdResponder {
1604 pub fn send(self, mut device_id: u32) -> Result<(), fidl::Error> {
1608 let _result = self.send_raw(device_id);
1609 if _result.is_err() {
1610 self.control_handle.shutdown();
1611 }
1612 self.drop_without_shutdown();
1613 _result
1614 }
1615
1616 pub fn send_no_shutdown_on_err(self, mut device_id: u32) -> Result<(), fidl::Error> {
1618 let _result = self.send_raw(device_id);
1619 self.drop_without_shutdown();
1620 _result
1621 }
1622
1623 fn send_raw(&self, mut device_id: u32) -> Result<(), fidl::Error> {
1624 self.control_handle.inner.send::<DeviceGetDeviceIdResponse>(
1625 (device_id,),
1626 self.tx_id,
1627 0x34a73eef491c2ce0,
1628 fidl::encoding::DynamicFlags::empty(),
1629 )
1630 }
1631}
1632
1633#[must_use = "FIDL methods require a response to be sent"]
1634#[derive(Debug)]
1635pub struct DeviceGetHubDeviceIdResponder {
1636 control_handle: std::mem::ManuallyDrop<DeviceControlHandle>,
1637 tx_id: u32,
1638}
1639
1640impl std::ops::Drop for DeviceGetHubDeviceIdResponder {
1644 fn drop(&mut self) {
1645 self.control_handle.shutdown();
1646 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1648 }
1649}
1650
1651impl fidl::endpoints::Responder for DeviceGetHubDeviceIdResponder {
1652 type ControlHandle = DeviceControlHandle;
1653
1654 fn control_handle(&self) -> &DeviceControlHandle {
1655 &self.control_handle
1656 }
1657
1658 fn drop_without_shutdown(mut self) {
1659 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1661 std::mem::forget(self);
1663 }
1664}
1665
1666impl DeviceGetHubDeviceIdResponder {
1667 pub fn send(self, mut hub_device_id: u32) -> Result<(), fidl::Error> {
1671 let _result = self.send_raw(hub_device_id);
1672 if _result.is_err() {
1673 self.control_handle.shutdown();
1674 }
1675 self.drop_without_shutdown();
1676 _result
1677 }
1678
1679 pub fn send_no_shutdown_on_err(self, mut hub_device_id: u32) -> Result<(), fidl::Error> {
1681 let _result = self.send_raw(hub_device_id);
1682 self.drop_without_shutdown();
1683 _result
1684 }
1685
1686 fn send_raw(&self, mut hub_device_id: u32) -> Result<(), fidl::Error> {
1687 self.control_handle.inner.send::<DeviceGetHubDeviceIdResponse>(
1688 (hub_device_id,),
1689 self.tx_id,
1690 0xce263c86f7bbbcd,
1691 fidl::encoding::DynamicFlags::empty(),
1692 )
1693 }
1694}
1695
1696#[must_use = "FIDL methods require a response to be sent"]
1697#[derive(Debug)]
1698pub struct DeviceGetConfigurationResponder {
1699 control_handle: std::mem::ManuallyDrop<DeviceControlHandle>,
1700 tx_id: u32,
1701}
1702
1703impl std::ops::Drop for DeviceGetConfigurationResponder {
1707 fn drop(&mut self) {
1708 self.control_handle.shutdown();
1709 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1711 }
1712}
1713
1714impl fidl::endpoints::Responder for DeviceGetConfigurationResponder {
1715 type ControlHandle = DeviceControlHandle;
1716
1717 fn control_handle(&self) -> &DeviceControlHandle {
1718 &self.control_handle
1719 }
1720
1721 fn drop_without_shutdown(mut self) {
1722 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1724 std::mem::forget(self);
1726 }
1727}
1728
1729impl DeviceGetConfigurationResponder {
1730 pub fn send(self, mut configuration: u8) -> Result<(), fidl::Error> {
1734 let _result = self.send_raw(configuration);
1735 if _result.is_err() {
1736 self.control_handle.shutdown();
1737 }
1738 self.drop_without_shutdown();
1739 _result
1740 }
1741
1742 pub fn send_no_shutdown_on_err(self, mut configuration: u8) -> Result<(), fidl::Error> {
1744 let _result = self.send_raw(configuration);
1745 self.drop_without_shutdown();
1746 _result
1747 }
1748
1749 fn send_raw(&self, mut configuration: u8) -> Result<(), fidl::Error> {
1750 self.control_handle.inner.send::<DeviceGetConfigurationResponse>(
1751 (configuration,),
1752 self.tx_id,
1753 0x73f644382a2335fd,
1754 fidl::encoding::DynamicFlags::empty(),
1755 )
1756 }
1757}
1758
1759#[must_use = "FIDL methods require a response to be sent"]
1760#[derive(Debug)]
1761pub struct DeviceSetConfigurationResponder {
1762 control_handle: std::mem::ManuallyDrop<DeviceControlHandle>,
1763 tx_id: u32,
1764}
1765
1766impl std::ops::Drop for DeviceSetConfigurationResponder {
1770 fn drop(&mut self) {
1771 self.control_handle.shutdown();
1772 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1774 }
1775}
1776
1777impl fidl::endpoints::Responder for DeviceSetConfigurationResponder {
1778 type ControlHandle = DeviceControlHandle;
1779
1780 fn control_handle(&self) -> &DeviceControlHandle {
1781 &self.control_handle
1782 }
1783
1784 fn drop_without_shutdown(mut self) {
1785 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1787 std::mem::forget(self);
1789 }
1790}
1791
1792impl DeviceSetConfigurationResponder {
1793 pub fn send(self, mut s: i32) -> Result<(), fidl::Error> {
1797 let _result = self.send_raw(s);
1798 if _result.is_err() {
1799 self.control_handle.shutdown();
1800 }
1801 self.drop_without_shutdown();
1802 _result
1803 }
1804
1805 pub fn send_no_shutdown_on_err(self, mut s: i32) -> Result<(), fidl::Error> {
1807 let _result = self.send_raw(s);
1808 self.drop_without_shutdown();
1809 _result
1810 }
1811
1812 fn send_raw(&self, mut s: i32) -> Result<(), fidl::Error> {
1813 self.control_handle.inner.send::<DeviceSetConfigurationResponse>(
1814 (s,),
1815 self.tx_id,
1816 0x12bf6e43b045ee9d,
1817 fidl::encoding::DynamicFlags::empty(),
1818 )
1819 }
1820}
1821
1822#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
1823pub struct ServiceMarker;
1824
1825#[cfg(target_os = "fuchsia")]
1826impl fidl::endpoints::ServiceMarker for ServiceMarker {
1827 type Proxy = ServiceProxy;
1828 type Request = ServiceRequest;
1829 const SERVICE_NAME: &'static str = "fuchsia.hardware.usb.device.Service";
1830}
1831
1832#[cfg(target_os = "fuchsia")]
1835pub enum ServiceRequest {
1836 Device(DeviceRequestStream),
1837}
1838
1839#[cfg(target_os = "fuchsia")]
1840impl fidl::endpoints::ServiceRequest for ServiceRequest {
1841 type Service = ServiceMarker;
1842
1843 fn dispatch(name: &str, _channel: fidl::AsyncChannel) -> Self {
1844 match name {
1845 "device" => Self::Device(
1846 <DeviceRequestStream as fidl::endpoints::RequestStream>::from_channel(_channel),
1847 ),
1848 _ => panic!("no such member protocol name for service Service"),
1849 }
1850 }
1851
1852 fn member_names() -> &'static [&'static str] {
1853 &["device"]
1854 }
1855}
1856#[cfg(target_os = "fuchsia")]
1857pub struct ServiceProxy(#[allow(dead_code)] Box<dyn fidl::endpoints::MemberOpener>);
1858
1859#[cfg(target_os = "fuchsia")]
1860impl fidl::endpoints::ServiceProxy for ServiceProxy {
1861 type Service = ServiceMarker;
1862
1863 fn from_member_opener(opener: Box<dyn fidl::endpoints::MemberOpener>) -> Self {
1864 Self(opener)
1865 }
1866}
1867
1868#[cfg(target_os = "fuchsia")]
1869impl ServiceProxy {
1870 pub fn connect_to_device(&self) -> Result<DeviceProxy, fidl::Error> {
1871 let (proxy, server_end) = fidl::endpoints::create_proxy::<DeviceMarker>();
1872 self.connect_channel_to_device(server_end)?;
1873 Ok(proxy)
1874 }
1875
1876 pub fn connect_to_device_sync(&self) -> Result<DeviceSynchronousProxy, fidl::Error> {
1879 let (proxy, server_end) = fidl::endpoints::create_sync_proxy::<DeviceMarker>();
1880 self.connect_channel_to_device(server_end)?;
1881 Ok(proxy)
1882 }
1883
1884 pub fn connect_channel_to_device(
1887 &self,
1888 server_end: fidl::endpoints::ServerEnd<DeviceMarker>,
1889 ) -> Result<(), fidl::Error> {
1890 self.0.open_member("device", server_end.into_channel())
1891 }
1892
1893 pub fn instance_name(&self) -> &str {
1894 self.0.instance_name()
1895 }
1896}
1897
1898mod internal {
1899 use super::*;
1900}