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_backlight_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}
25pub type DeviceGetStateNormalizedResult = Result<State, i32>;
26pub type DeviceSetStateNormalizedResult = Result<(), i32>;
27pub type DeviceGetStateAbsoluteResult = Result<State, i32>;
28pub type DeviceSetStateAbsoluteResult = Result<(), i32>;
29pub type DeviceGetMaxAbsoluteBrightnessResult = Result<f64, i32>;
30pub type DeviceSetNormalizedBrightnessScaleResult = Result<(), i32>;
31pub type DeviceGetNormalizedBrightnessScaleResult = Result<f64, i32>;
32
33pub trait DeviceProxyInterface: Send + Sync {
34 type GetStateNormalizedResponseFut: std::future::Future<Output = Result<DeviceGetStateNormalizedResult, fidl::Error>>
35 + Send;
36 fn r#get_state_normalized(&self) -> Self::GetStateNormalizedResponseFut;
37 type SetStateNormalizedResponseFut: std::future::Future<Output = Result<DeviceSetStateNormalizedResult, fidl::Error>>
38 + Send;
39 fn r#set_state_normalized(&self, state: &State) -> Self::SetStateNormalizedResponseFut;
40 type GetStateAbsoluteResponseFut: std::future::Future<Output = Result<DeviceGetStateAbsoluteResult, fidl::Error>>
41 + Send;
42 fn r#get_state_absolute(&self) -> Self::GetStateAbsoluteResponseFut;
43 type SetStateAbsoluteResponseFut: std::future::Future<Output = Result<DeviceSetStateAbsoluteResult, fidl::Error>>
44 + Send;
45 fn r#set_state_absolute(&self, state: &State) -> Self::SetStateAbsoluteResponseFut;
46 type GetMaxAbsoluteBrightnessResponseFut: std::future::Future<Output = Result<DeviceGetMaxAbsoluteBrightnessResult, fidl::Error>>
47 + Send;
48 fn r#get_max_absolute_brightness(&self) -> Self::GetMaxAbsoluteBrightnessResponseFut;
49 type SetNormalizedBrightnessScaleResponseFut: std::future::Future<Output = Result<DeviceSetNormalizedBrightnessScaleResult, fidl::Error>>
50 + Send;
51 fn r#set_normalized_brightness_scale(
52 &self,
53 scale: f64,
54 ) -> Self::SetNormalizedBrightnessScaleResponseFut;
55 type GetNormalizedBrightnessScaleResponseFut: std::future::Future<Output = Result<DeviceGetNormalizedBrightnessScaleResult, fidl::Error>>
56 + Send;
57 fn r#get_normalized_brightness_scale(&self) -> Self::GetNormalizedBrightnessScaleResponseFut;
58}
59#[derive(Debug)]
60#[cfg(target_os = "fuchsia")]
61pub struct DeviceSynchronousProxy {
62 client: fidl::client::sync::Client,
63}
64
65#[cfg(target_os = "fuchsia")]
66impl fidl::endpoints::SynchronousProxy for DeviceSynchronousProxy {
67 type Proxy = DeviceProxy;
68 type Protocol = DeviceMarker;
69
70 fn from_channel(inner: fidl::Channel) -> Self {
71 Self::new(inner)
72 }
73
74 fn into_channel(self) -> fidl::Channel {
75 self.client.into_channel()
76 }
77
78 fn as_channel(&self) -> &fidl::Channel {
79 self.client.as_channel()
80 }
81}
82
83#[cfg(target_os = "fuchsia")]
84impl DeviceSynchronousProxy {
85 pub fn new(channel: fidl::Channel) -> Self {
86 let protocol_name = <DeviceMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
87 Self { client: fidl::client::sync::Client::new(channel, protocol_name) }
88 }
89
90 pub fn into_channel(self) -> fidl::Channel {
91 self.client.into_channel()
92 }
93
94 pub fn wait_for_event(
97 &self,
98 deadline: zx::MonotonicInstant,
99 ) -> Result<DeviceEvent, fidl::Error> {
100 DeviceEvent::decode(self.client.wait_for_event(deadline)?)
101 }
102
103 pub fn r#get_state_normalized(
106 &self,
107 ___deadline: zx::MonotonicInstant,
108 ) -> Result<DeviceGetStateNormalizedResult, fidl::Error> {
109 let _response = self.client.send_query::<
110 fidl::encoding::EmptyPayload,
111 fidl::encoding::ResultType<DeviceGetStateNormalizedResponse, i32>,
112 >(
113 (),
114 0x2506201b5999b9b7,
115 fidl::encoding::DynamicFlags::empty(),
116 ___deadline,
117 )?;
118 Ok(_response.map(|x| x.state))
119 }
120
121 pub fn r#set_state_normalized(
124 &self,
125 mut state: &State,
126 ___deadline: zx::MonotonicInstant,
127 ) -> Result<DeviceSetStateNormalizedResult, fidl::Error> {
128 let _response = self.client.send_query::<
129 DeviceSetStateNormalizedRequest,
130 fidl::encoding::ResultType<fidl::encoding::EmptyStruct, i32>,
131 >(
132 (state,),
133 0x554ac5cb4f9f5b62,
134 fidl::encoding::DynamicFlags::empty(),
135 ___deadline,
136 )?;
137 Ok(_response.map(|x| x))
138 }
139
140 pub fn r#get_state_absolute(
142 &self,
143 ___deadline: zx::MonotonicInstant,
144 ) -> Result<DeviceGetStateAbsoluteResult, fidl::Error> {
145 let _response = self.client.send_query::<
146 fidl::encoding::EmptyPayload,
147 fidl::encoding::ResultType<DeviceGetStateAbsoluteResponse, i32>,
148 >(
149 (),
150 0x1f8ccf01cf526a2b,
151 fidl::encoding::DynamicFlags::empty(),
152 ___deadline,
153 )?;
154 Ok(_response.map(|x| x.state))
155 }
156
157 pub fn r#set_state_absolute(
160 &self,
161 mut state: &State,
162 ___deadline: zx::MonotonicInstant,
163 ) -> Result<DeviceSetStateAbsoluteResult, fidl::Error> {
164 let _response = self.client.send_query::<
165 DeviceSetStateAbsoluteRequest,
166 fidl::encoding::ResultType<fidl::encoding::EmptyStruct, i32>,
167 >(
168 (state,),
169 0x19c100c43faaa178,
170 fidl::encoding::DynamicFlags::empty(),
171 ___deadline,
172 )?;
173 Ok(_response.map(|x| x))
174 }
175
176 pub fn r#get_max_absolute_brightness(
179 &self,
180 ___deadline: zx::MonotonicInstant,
181 ) -> Result<DeviceGetMaxAbsoluteBrightnessResult, fidl::Error> {
182 let _response = self.client.send_query::<
183 fidl::encoding::EmptyPayload,
184 fidl::encoding::ResultType<DeviceGetMaxAbsoluteBrightnessResponse, i32>,
185 >(
186 (),
187 0x2aa0699313d4160d,
188 fidl::encoding::DynamicFlags::empty(),
189 ___deadline,
190 )?;
191 Ok(_response.map(|x| x.max_brightness))
192 }
193
194 pub fn r#set_normalized_brightness_scale(
200 &self,
201 mut scale: f64,
202 ___deadline: zx::MonotonicInstant,
203 ) -> Result<DeviceSetNormalizedBrightnessScaleResult, fidl::Error> {
204 let _response = self.client.send_query::<
205 DeviceSetNormalizedBrightnessScaleRequest,
206 fidl::encoding::ResultType<fidl::encoding::EmptyStruct, i32>,
207 >(
208 (scale,),
209 0x34ee4d2bbf4b2863,
210 fidl::encoding::DynamicFlags::empty(),
211 ___deadline,
212 )?;
213 Ok(_response.map(|x| x))
214 }
215
216 pub fn r#get_normalized_brightness_scale(
219 &self,
220 ___deadline: zx::MonotonicInstant,
221 ) -> Result<DeviceGetNormalizedBrightnessScaleResult, fidl::Error> {
222 let _response =
223 self.client.send_query::<fidl::encoding::EmptyPayload, fidl::encoding::ResultType<
224 DeviceGetNormalizedBrightnessScaleResponse,
225 i32,
226 >>(
227 (),
228 0x4f57df8da3bcb26b,
229 fidl::encoding::DynamicFlags::empty(),
230 ___deadline,
231 )?;
232 Ok(_response.map(|x| x.scale))
233 }
234}
235
236#[cfg(target_os = "fuchsia")]
237impl From<DeviceSynchronousProxy> for zx::Handle {
238 fn from(value: DeviceSynchronousProxy) -> Self {
239 value.into_channel().into()
240 }
241}
242
243#[cfg(target_os = "fuchsia")]
244impl From<fidl::Channel> for DeviceSynchronousProxy {
245 fn from(value: fidl::Channel) -> Self {
246 Self::new(value)
247 }
248}
249
250#[derive(Debug, Clone)]
251pub struct DeviceProxy {
252 client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
253}
254
255impl fidl::endpoints::Proxy for DeviceProxy {
256 type Protocol = DeviceMarker;
257
258 fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
259 Self::new(inner)
260 }
261
262 fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
263 self.client.into_channel().map_err(|client| Self { client })
264 }
265
266 fn as_channel(&self) -> &::fidl::AsyncChannel {
267 self.client.as_channel()
268 }
269}
270
271impl DeviceProxy {
272 pub fn new(channel: ::fidl::AsyncChannel) -> Self {
274 let protocol_name = <DeviceMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
275 Self { client: fidl::client::Client::new(channel, protocol_name) }
276 }
277
278 pub fn take_event_stream(&self) -> DeviceEventStream {
284 DeviceEventStream { event_receiver: self.client.take_event_receiver() }
285 }
286
287 pub fn r#get_state_normalized(
290 &self,
291 ) -> fidl::client::QueryResponseFut<
292 DeviceGetStateNormalizedResult,
293 fidl::encoding::DefaultFuchsiaResourceDialect,
294 > {
295 DeviceProxyInterface::r#get_state_normalized(self)
296 }
297
298 pub fn r#set_state_normalized(
301 &self,
302 mut state: &State,
303 ) -> fidl::client::QueryResponseFut<
304 DeviceSetStateNormalizedResult,
305 fidl::encoding::DefaultFuchsiaResourceDialect,
306 > {
307 DeviceProxyInterface::r#set_state_normalized(self, state)
308 }
309
310 pub fn r#get_state_absolute(
312 &self,
313 ) -> fidl::client::QueryResponseFut<
314 DeviceGetStateAbsoluteResult,
315 fidl::encoding::DefaultFuchsiaResourceDialect,
316 > {
317 DeviceProxyInterface::r#get_state_absolute(self)
318 }
319
320 pub fn r#set_state_absolute(
323 &self,
324 mut state: &State,
325 ) -> fidl::client::QueryResponseFut<
326 DeviceSetStateAbsoluteResult,
327 fidl::encoding::DefaultFuchsiaResourceDialect,
328 > {
329 DeviceProxyInterface::r#set_state_absolute(self, state)
330 }
331
332 pub fn r#get_max_absolute_brightness(
335 &self,
336 ) -> fidl::client::QueryResponseFut<
337 DeviceGetMaxAbsoluteBrightnessResult,
338 fidl::encoding::DefaultFuchsiaResourceDialect,
339 > {
340 DeviceProxyInterface::r#get_max_absolute_brightness(self)
341 }
342
343 pub fn r#set_normalized_brightness_scale(
349 &self,
350 mut scale: f64,
351 ) -> fidl::client::QueryResponseFut<
352 DeviceSetNormalizedBrightnessScaleResult,
353 fidl::encoding::DefaultFuchsiaResourceDialect,
354 > {
355 DeviceProxyInterface::r#set_normalized_brightness_scale(self, scale)
356 }
357
358 pub fn r#get_normalized_brightness_scale(
361 &self,
362 ) -> fidl::client::QueryResponseFut<
363 DeviceGetNormalizedBrightnessScaleResult,
364 fidl::encoding::DefaultFuchsiaResourceDialect,
365 > {
366 DeviceProxyInterface::r#get_normalized_brightness_scale(self)
367 }
368}
369
370impl DeviceProxyInterface for DeviceProxy {
371 type GetStateNormalizedResponseFut = fidl::client::QueryResponseFut<
372 DeviceGetStateNormalizedResult,
373 fidl::encoding::DefaultFuchsiaResourceDialect,
374 >;
375 fn r#get_state_normalized(&self) -> Self::GetStateNormalizedResponseFut {
376 fn _decode(
377 mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
378 ) -> Result<DeviceGetStateNormalizedResult, fidl::Error> {
379 let _response = fidl::client::decode_transaction_body::<
380 fidl::encoding::ResultType<DeviceGetStateNormalizedResponse, i32>,
381 fidl::encoding::DefaultFuchsiaResourceDialect,
382 0x2506201b5999b9b7,
383 >(_buf?)?;
384 Ok(_response.map(|x| x.state))
385 }
386 self.client
387 .send_query_and_decode::<fidl::encoding::EmptyPayload, DeviceGetStateNormalizedResult>(
388 (),
389 0x2506201b5999b9b7,
390 fidl::encoding::DynamicFlags::empty(),
391 _decode,
392 )
393 }
394
395 type SetStateNormalizedResponseFut = fidl::client::QueryResponseFut<
396 DeviceSetStateNormalizedResult,
397 fidl::encoding::DefaultFuchsiaResourceDialect,
398 >;
399 fn r#set_state_normalized(&self, mut state: &State) -> Self::SetStateNormalizedResponseFut {
400 fn _decode(
401 mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
402 ) -> Result<DeviceSetStateNormalizedResult, fidl::Error> {
403 let _response = fidl::client::decode_transaction_body::<
404 fidl::encoding::ResultType<fidl::encoding::EmptyStruct, i32>,
405 fidl::encoding::DefaultFuchsiaResourceDialect,
406 0x554ac5cb4f9f5b62,
407 >(_buf?)?;
408 Ok(_response.map(|x| x))
409 }
410 self.client.send_query_and_decode::<
411 DeviceSetStateNormalizedRequest,
412 DeviceSetStateNormalizedResult,
413 >(
414 (state,),
415 0x554ac5cb4f9f5b62,
416 fidl::encoding::DynamicFlags::empty(),
417 _decode,
418 )
419 }
420
421 type GetStateAbsoluteResponseFut = fidl::client::QueryResponseFut<
422 DeviceGetStateAbsoluteResult,
423 fidl::encoding::DefaultFuchsiaResourceDialect,
424 >;
425 fn r#get_state_absolute(&self) -> Self::GetStateAbsoluteResponseFut {
426 fn _decode(
427 mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
428 ) -> Result<DeviceGetStateAbsoluteResult, fidl::Error> {
429 let _response = fidl::client::decode_transaction_body::<
430 fidl::encoding::ResultType<DeviceGetStateAbsoluteResponse, i32>,
431 fidl::encoding::DefaultFuchsiaResourceDialect,
432 0x1f8ccf01cf526a2b,
433 >(_buf?)?;
434 Ok(_response.map(|x| x.state))
435 }
436 self.client
437 .send_query_and_decode::<fidl::encoding::EmptyPayload, DeviceGetStateAbsoluteResult>(
438 (),
439 0x1f8ccf01cf526a2b,
440 fidl::encoding::DynamicFlags::empty(),
441 _decode,
442 )
443 }
444
445 type SetStateAbsoluteResponseFut = fidl::client::QueryResponseFut<
446 DeviceSetStateAbsoluteResult,
447 fidl::encoding::DefaultFuchsiaResourceDialect,
448 >;
449 fn r#set_state_absolute(&self, mut state: &State) -> Self::SetStateAbsoluteResponseFut {
450 fn _decode(
451 mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
452 ) -> Result<DeviceSetStateAbsoluteResult, fidl::Error> {
453 let _response = fidl::client::decode_transaction_body::<
454 fidl::encoding::ResultType<fidl::encoding::EmptyStruct, i32>,
455 fidl::encoding::DefaultFuchsiaResourceDialect,
456 0x19c100c43faaa178,
457 >(_buf?)?;
458 Ok(_response.map(|x| x))
459 }
460 self.client
461 .send_query_and_decode::<DeviceSetStateAbsoluteRequest, DeviceSetStateAbsoluteResult>(
462 (state,),
463 0x19c100c43faaa178,
464 fidl::encoding::DynamicFlags::empty(),
465 _decode,
466 )
467 }
468
469 type GetMaxAbsoluteBrightnessResponseFut = fidl::client::QueryResponseFut<
470 DeviceGetMaxAbsoluteBrightnessResult,
471 fidl::encoding::DefaultFuchsiaResourceDialect,
472 >;
473 fn r#get_max_absolute_brightness(&self) -> Self::GetMaxAbsoluteBrightnessResponseFut {
474 fn _decode(
475 mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
476 ) -> Result<DeviceGetMaxAbsoluteBrightnessResult, fidl::Error> {
477 let _response = fidl::client::decode_transaction_body::<
478 fidl::encoding::ResultType<DeviceGetMaxAbsoluteBrightnessResponse, i32>,
479 fidl::encoding::DefaultFuchsiaResourceDialect,
480 0x2aa0699313d4160d,
481 >(_buf?)?;
482 Ok(_response.map(|x| x.max_brightness))
483 }
484 self.client.send_query_and_decode::<
485 fidl::encoding::EmptyPayload,
486 DeviceGetMaxAbsoluteBrightnessResult,
487 >(
488 (),
489 0x2aa0699313d4160d,
490 fidl::encoding::DynamicFlags::empty(),
491 _decode,
492 )
493 }
494
495 type SetNormalizedBrightnessScaleResponseFut = fidl::client::QueryResponseFut<
496 DeviceSetNormalizedBrightnessScaleResult,
497 fidl::encoding::DefaultFuchsiaResourceDialect,
498 >;
499 fn r#set_normalized_brightness_scale(
500 &self,
501 mut scale: f64,
502 ) -> Self::SetNormalizedBrightnessScaleResponseFut {
503 fn _decode(
504 mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
505 ) -> Result<DeviceSetNormalizedBrightnessScaleResult, fidl::Error> {
506 let _response = fidl::client::decode_transaction_body::<
507 fidl::encoding::ResultType<fidl::encoding::EmptyStruct, i32>,
508 fidl::encoding::DefaultFuchsiaResourceDialect,
509 0x34ee4d2bbf4b2863,
510 >(_buf?)?;
511 Ok(_response.map(|x| x))
512 }
513 self.client.send_query_and_decode::<
514 DeviceSetNormalizedBrightnessScaleRequest,
515 DeviceSetNormalizedBrightnessScaleResult,
516 >(
517 (scale,),
518 0x34ee4d2bbf4b2863,
519 fidl::encoding::DynamicFlags::empty(),
520 _decode,
521 )
522 }
523
524 type GetNormalizedBrightnessScaleResponseFut = fidl::client::QueryResponseFut<
525 DeviceGetNormalizedBrightnessScaleResult,
526 fidl::encoding::DefaultFuchsiaResourceDialect,
527 >;
528 fn r#get_normalized_brightness_scale(&self) -> Self::GetNormalizedBrightnessScaleResponseFut {
529 fn _decode(
530 mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
531 ) -> Result<DeviceGetNormalizedBrightnessScaleResult, fidl::Error> {
532 let _response = fidl::client::decode_transaction_body::<
533 fidl::encoding::ResultType<DeviceGetNormalizedBrightnessScaleResponse, i32>,
534 fidl::encoding::DefaultFuchsiaResourceDialect,
535 0x4f57df8da3bcb26b,
536 >(_buf?)?;
537 Ok(_response.map(|x| x.scale))
538 }
539 self.client.send_query_and_decode::<
540 fidl::encoding::EmptyPayload,
541 DeviceGetNormalizedBrightnessScaleResult,
542 >(
543 (),
544 0x4f57df8da3bcb26b,
545 fidl::encoding::DynamicFlags::empty(),
546 _decode,
547 )
548 }
549}
550
551pub struct DeviceEventStream {
552 event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
553}
554
555impl std::marker::Unpin for DeviceEventStream {}
556
557impl futures::stream::FusedStream for DeviceEventStream {
558 fn is_terminated(&self) -> bool {
559 self.event_receiver.is_terminated()
560 }
561}
562
563impl futures::Stream for DeviceEventStream {
564 type Item = Result<DeviceEvent, fidl::Error>;
565
566 fn poll_next(
567 mut self: std::pin::Pin<&mut Self>,
568 cx: &mut std::task::Context<'_>,
569 ) -> std::task::Poll<Option<Self::Item>> {
570 match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
571 &mut self.event_receiver,
572 cx
573 )?) {
574 Some(buf) => std::task::Poll::Ready(Some(DeviceEvent::decode(buf))),
575 None => std::task::Poll::Ready(None),
576 }
577 }
578}
579
580#[derive(Debug)]
581pub enum DeviceEvent {}
582
583impl DeviceEvent {
584 fn decode(
586 mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
587 ) -> Result<DeviceEvent, fidl::Error> {
588 let (bytes, _handles) = buf.split_mut();
589 let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
590 debug_assert_eq!(tx_header.tx_id, 0);
591 match tx_header.ordinal {
592 _ => Err(fidl::Error::UnknownOrdinal {
593 ordinal: tx_header.ordinal,
594 protocol_name: <DeviceMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
595 }),
596 }
597 }
598}
599
600pub struct DeviceRequestStream {
602 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
603 is_terminated: bool,
604}
605
606impl std::marker::Unpin for DeviceRequestStream {}
607
608impl futures::stream::FusedStream for DeviceRequestStream {
609 fn is_terminated(&self) -> bool {
610 self.is_terminated
611 }
612}
613
614impl fidl::endpoints::RequestStream for DeviceRequestStream {
615 type Protocol = DeviceMarker;
616 type ControlHandle = DeviceControlHandle;
617
618 fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
619 Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
620 }
621
622 fn control_handle(&self) -> Self::ControlHandle {
623 DeviceControlHandle { inner: self.inner.clone() }
624 }
625
626 fn into_inner(
627 self,
628 ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
629 {
630 (self.inner, self.is_terminated)
631 }
632
633 fn from_inner(
634 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
635 is_terminated: bool,
636 ) -> Self {
637 Self { inner, is_terminated }
638 }
639}
640
641impl futures::Stream for DeviceRequestStream {
642 type Item = Result<DeviceRequest, fidl::Error>;
643
644 fn poll_next(
645 mut self: std::pin::Pin<&mut Self>,
646 cx: &mut std::task::Context<'_>,
647 ) -> std::task::Poll<Option<Self::Item>> {
648 let this = &mut *self;
649 if this.inner.check_shutdown(cx) {
650 this.is_terminated = true;
651 return std::task::Poll::Ready(None);
652 }
653 if this.is_terminated {
654 panic!("polled DeviceRequestStream after completion");
655 }
656 fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
657 |bytes, handles| {
658 match this.inner.channel().read_etc(cx, bytes, handles) {
659 std::task::Poll::Ready(Ok(())) => {}
660 std::task::Poll::Pending => return std::task::Poll::Pending,
661 std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
662 this.is_terminated = true;
663 return std::task::Poll::Ready(None);
664 }
665 std::task::Poll::Ready(Err(e)) => {
666 return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
667 e.into(),
668 ))))
669 }
670 }
671
672 let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
674
675 std::task::Poll::Ready(Some(match header.ordinal {
676 0x2506201b5999b9b7 => {
677 header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
678 let mut req = fidl::new_empty!(
679 fidl::encoding::EmptyPayload,
680 fidl::encoding::DefaultFuchsiaResourceDialect
681 );
682 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
683 let control_handle = DeviceControlHandle { inner: this.inner.clone() };
684 Ok(DeviceRequest::GetStateNormalized {
685 responder: DeviceGetStateNormalizedResponder {
686 control_handle: std::mem::ManuallyDrop::new(control_handle),
687 tx_id: header.tx_id,
688 },
689 })
690 }
691 0x554ac5cb4f9f5b62 => {
692 header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
693 let mut req = fidl::new_empty!(
694 DeviceSetStateNormalizedRequest,
695 fidl::encoding::DefaultFuchsiaResourceDialect
696 );
697 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<DeviceSetStateNormalizedRequest>(&header, _body_bytes, handles, &mut req)?;
698 let control_handle = DeviceControlHandle { inner: this.inner.clone() };
699 Ok(DeviceRequest::SetStateNormalized {
700 state: req.state,
701
702 responder: DeviceSetStateNormalizedResponder {
703 control_handle: std::mem::ManuallyDrop::new(control_handle),
704 tx_id: header.tx_id,
705 },
706 })
707 }
708 0x1f8ccf01cf526a2b => {
709 header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
710 let mut req = fidl::new_empty!(
711 fidl::encoding::EmptyPayload,
712 fidl::encoding::DefaultFuchsiaResourceDialect
713 );
714 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
715 let control_handle = DeviceControlHandle { inner: this.inner.clone() };
716 Ok(DeviceRequest::GetStateAbsolute {
717 responder: DeviceGetStateAbsoluteResponder {
718 control_handle: std::mem::ManuallyDrop::new(control_handle),
719 tx_id: header.tx_id,
720 },
721 })
722 }
723 0x19c100c43faaa178 => {
724 header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
725 let mut req = fidl::new_empty!(
726 DeviceSetStateAbsoluteRequest,
727 fidl::encoding::DefaultFuchsiaResourceDialect
728 );
729 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<DeviceSetStateAbsoluteRequest>(&header, _body_bytes, handles, &mut req)?;
730 let control_handle = DeviceControlHandle { inner: this.inner.clone() };
731 Ok(DeviceRequest::SetStateAbsolute {
732 state: req.state,
733
734 responder: DeviceSetStateAbsoluteResponder {
735 control_handle: std::mem::ManuallyDrop::new(control_handle),
736 tx_id: header.tx_id,
737 },
738 })
739 }
740 0x2aa0699313d4160d => {
741 header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
742 let mut req = fidl::new_empty!(
743 fidl::encoding::EmptyPayload,
744 fidl::encoding::DefaultFuchsiaResourceDialect
745 );
746 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
747 let control_handle = DeviceControlHandle { inner: this.inner.clone() };
748 Ok(DeviceRequest::GetMaxAbsoluteBrightness {
749 responder: DeviceGetMaxAbsoluteBrightnessResponder {
750 control_handle: std::mem::ManuallyDrop::new(control_handle),
751 tx_id: header.tx_id,
752 },
753 })
754 }
755 0x34ee4d2bbf4b2863 => {
756 header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
757 let mut req = fidl::new_empty!(
758 DeviceSetNormalizedBrightnessScaleRequest,
759 fidl::encoding::DefaultFuchsiaResourceDialect
760 );
761 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<DeviceSetNormalizedBrightnessScaleRequest>(&header, _body_bytes, handles, &mut req)?;
762 let control_handle = DeviceControlHandle { inner: this.inner.clone() };
763 Ok(DeviceRequest::SetNormalizedBrightnessScale {
764 scale: req.scale,
765
766 responder: DeviceSetNormalizedBrightnessScaleResponder {
767 control_handle: std::mem::ManuallyDrop::new(control_handle),
768 tx_id: header.tx_id,
769 },
770 })
771 }
772 0x4f57df8da3bcb26b => {
773 header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
774 let mut req = fidl::new_empty!(
775 fidl::encoding::EmptyPayload,
776 fidl::encoding::DefaultFuchsiaResourceDialect
777 );
778 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
779 let control_handle = DeviceControlHandle { inner: this.inner.clone() };
780 Ok(DeviceRequest::GetNormalizedBrightnessScale {
781 responder: DeviceGetNormalizedBrightnessScaleResponder {
782 control_handle: std::mem::ManuallyDrop::new(control_handle),
783 tx_id: header.tx_id,
784 },
785 })
786 }
787 _ => Err(fidl::Error::UnknownOrdinal {
788 ordinal: header.ordinal,
789 protocol_name:
790 <DeviceMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
791 }),
792 }))
793 },
794 )
795 }
796}
797
798#[derive(Debug)]
799pub enum DeviceRequest {
800 GetStateNormalized { responder: DeviceGetStateNormalizedResponder },
803 SetStateNormalized { state: State, responder: DeviceSetStateNormalizedResponder },
806 GetStateAbsolute { responder: DeviceGetStateAbsoluteResponder },
808 SetStateAbsolute { state: State, responder: DeviceSetStateAbsoluteResponder },
811 GetMaxAbsoluteBrightness { responder: DeviceGetMaxAbsoluteBrightnessResponder },
814 SetNormalizedBrightnessScale {
820 scale: f64,
821 responder: DeviceSetNormalizedBrightnessScaleResponder,
822 },
823 GetNormalizedBrightnessScale { responder: DeviceGetNormalizedBrightnessScaleResponder },
826}
827
828impl DeviceRequest {
829 #[allow(irrefutable_let_patterns)]
830 pub fn into_get_state_normalized(self) -> Option<(DeviceGetStateNormalizedResponder)> {
831 if let DeviceRequest::GetStateNormalized { responder } = self {
832 Some((responder))
833 } else {
834 None
835 }
836 }
837
838 #[allow(irrefutable_let_patterns)]
839 pub fn into_set_state_normalized(self) -> Option<(State, DeviceSetStateNormalizedResponder)> {
840 if let DeviceRequest::SetStateNormalized { state, responder } = self {
841 Some((state, responder))
842 } else {
843 None
844 }
845 }
846
847 #[allow(irrefutable_let_patterns)]
848 pub fn into_get_state_absolute(self) -> Option<(DeviceGetStateAbsoluteResponder)> {
849 if let DeviceRequest::GetStateAbsolute { responder } = self {
850 Some((responder))
851 } else {
852 None
853 }
854 }
855
856 #[allow(irrefutable_let_patterns)]
857 pub fn into_set_state_absolute(self) -> Option<(State, DeviceSetStateAbsoluteResponder)> {
858 if let DeviceRequest::SetStateAbsolute { state, responder } = self {
859 Some((state, responder))
860 } else {
861 None
862 }
863 }
864
865 #[allow(irrefutable_let_patterns)]
866 pub fn into_get_max_absolute_brightness(
867 self,
868 ) -> Option<(DeviceGetMaxAbsoluteBrightnessResponder)> {
869 if let DeviceRequest::GetMaxAbsoluteBrightness { responder } = self {
870 Some((responder))
871 } else {
872 None
873 }
874 }
875
876 #[allow(irrefutable_let_patterns)]
877 pub fn into_set_normalized_brightness_scale(
878 self,
879 ) -> Option<(f64, DeviceSetNormalizedBrightnessScaleResponder)> {
880 if let DeviceRequest::SetNormalizedBrightnessScale { scale, responder } = self {
881 Some((scale, responder))
882 } else {
883 None
884 }
885 }
886
887 #[allow(irrefutable_let_patterns)]
888 pub fn into_get_normalized_brightness_scale(
889 self,
890 ) -> Option<(DeviceGetNormalizedBrightnessScaleResponder)> {
891 if let DeviceRequest::GetNormalizedBrightnessScale { responder } = self {
892 Some((responder))
893 } else {
894 None
895 }
896 }
897
898 pub fn method_name(&self) -> &'static str {
900 match *self {
901 DeviceRequest::GetStateNormalized { .. } => "get_state_normalized",
902 DeviceRequest::SetStateNormalized { .. } => "set_state_normalized",
903 DeviceRequest::GetStateAbsolute { .. } => "get_state_absolute",
904 DeviceRequest::SetStateAbsolute { .. } => "set_state_absolute",
905 DeviceRequest::GetMaxAbsoluteBrightness { .. } => "get_max_absolute_brightness",
906 DeviceRequest::SetNormalizedBrightnessScale { .. } => "set_normalized_brightness_scale",
907 DeviceRequest::GetNormalizedBrightnessScale { .. } => "get_normalized_brightness_scale",
908 }
909 }
910}
911
912#[derive(Debug, Clone)]
913pub struct DeviceControlHandle {
914 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
915}
916
917impl fidl::endpoints::ControlHandle for DeviceControlHandle {
918 fn shutdown(&self) {
919 self.inner.shutdown()
920 }
921 fn shutdown_with_epitaph(&self, status: zx_status::Status) {
922 self.inner.shutdown_with_epitaph(status)
923 }
924
925 fn is_closed(&self) -> bool {
926 self.inner.channel().is_closed()
927 }
928 fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
929 self.inner.channel().on_closed()
930 }
931
932 #[cfg(target_os = "fuchsia")]
933 fn signal_peer(
934 &self,
935 clear_mask: zx::Signals,
936 set_mask: zx::Signals,
937 ) -> Result<(), zx_status::Status> {
938 use fidl::Peered;
939 self.inner.channel().signal_peer(clear_mask, set_mask)
940 }
941}
942
943impl DeviceControlHandle {}
944
945#[must_use = "FIDL methods require a response to be sent"]
946#[derive(Debug)]
947pub struct DeviceGetStateNormalizedResponder {
948 control_handle: std::mem::ManuallyDrop<DeviceControlHandle>,
949 tx_id: u32,
950}
951
952impl std::ops::Drop for DeviceGetStateNormalizedResponder {
956 fn drop(&mut self) {
957 self.control_handle.shutdown();
958 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
960 }
961}
962
963impl fidl::endpoints::Responder for DeviceGetStateNormalizedResponder {
964 type ControlHandle = DeviceControlHandle;
965
966 fn control_handle(&self) -> &DeviceControlHandle {
967 &self.control_handle
968 }
969
970 fn drop_without_shutdown(mut self) {
971 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
973 std::mem::forget(self);
975 }
976}
977
978impl DeviceGetStateNormalizedResponder {
979 pub fn send(self, mut result: Result<&State, i32>) -> Result<(), fidl::Error> {
983 let _result = self.send_raw(result);
984 if _result.is_err() {
985 self.control_handle.shutdown();
986 }
987 self.drop_without_shutdown();
988 _result
989 }
990
991 pub fn send_no_shutdown_on_err(
993 self,
994 mut result: Result<&State, i32>,
995 ) -> Result<(), fidl::Error> {
996 let _result = self.send_raw(result);
997 self.drop_without_shutdown();
998 _result
999 }
1000
1001 fn send_raw(&self, mut result: Result<&State, i32>) -> Result<(), fidl::Error> {
1002 self.control_handle
1003 .inner
1004 .send::<fidl::encoding::ResultType<DeviceGetStateNormalizedResponse, i32>>(
1005 result.map(|state| (state,)),
1006 self.tx_id,
1007 0x2506201b5999b9b7,
1008 fidl::encoding::DynamicFlags::empty(),
1009 )
1010 }
1011}
1012
1013#[must_use = "FIDL methods require a response to be sent"]
1014#[derive(Debug)]
1015pub struct DeviceSetStateNormalizedResponder {
1016 control_handle: std::mem::ManuallyDrop<DeviceControlHandle>,
1017 tx_id: u32,
1018}
1019
1020impl std::ops::Drop for DeviceSetStateNormalizedResponder {
1024 fn drop(&mut self) {
1025 self.control_handle.shutdown();
1026 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1028 }
1029}
1030
1031impl fidl::endpoints::Responder for DeviceSetStateNormalizedResponder {
1032 type ControlHandle = DeviceControlHandle;
1033
1034 fn control_handle(&self) -> &DeviceControlHandle {
1035 &self.control_handle
1036 }
1037
1038 fn drop_without_shutdown(mut self) {
1039 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1041 std::mem::forget(self);
1043 }
1044}
1045
1046impl DeviceSetStateNormalizedResponder {
1047 pub fn send(self, mut result: Result<(), i32>) -> Result<(), fidl::Error> {
1051 let _result = self.send_raw(result);
1052 if _result.is_err() {
1053 self.control_handle.shutdown();
1054 }
1055 self.drop_without_shutdown();
1056 _result
1057 }
1058
1059 pub fn send_no_shutdown_on_err(self, mut result: Result<(), i32>) -> Result<(), fidl::Error> {
1061 let _result = self.send_raw(result);
1062 self.drop_without_shutdown();
1063 _result
1064 }
1065
1066 fn send_raw(&self, mut result: Result<(), i32>) -> Result<(), fidl::Error> {
1067 self.control_handle
1068 .inner
1069 .send::<fidl::encoding::ResultType<fidl::encoding::EmptyStruct, i32>>(
1070 result,
1071 self.tx_id,
1072 0x554ac5cb4f9f5b62,
1073 fidl::encoding::DynamicFlags::empty(),
1074 )
1075 }
1076}
1077
1078#[must_use = "FIDL methods require a response to be sent"]
1079#[derive(Debug)]
1080pub struct DeviceGetStateAbsoluteResponder {
1081 control_handle: std::mem::ManuallyDrop<DeviceControlHandle>,
1082 tx_id: u32,
1083}
1084
1085impl std::ops::Drop for DeviceGetStateAbsoluteResponder {
1089 fn drop(&mut self) {
1090 self.control_handle.shutdown();
1091 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1093 }
1094}
1095
1096impl fidl::endpoints::Responder for DeviceGetStateAbsoluteResponder {
1097 type ControlHandle = DeviceControlHandle;
1098
1099 fn control_handle(&self) -> &DeviceControlHandle {
1100 &self.control_handle
1101 }
1102
1103 fn drop_without_shutdown(mut self) {
1104 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1106 std::mem::forget(self);
1108 }
1109}
1110
1111impl DeviceGetStateAbsoluteResponder {
1112 pub fn send(self, mut result: Result<&State, i32>) -> Result<(), fidl::Error> {
1116 let _result = self.send_raw(result);
1117 if _result.is_err() {
1118 self.control_handle.shutdown();
1119 }
1120 self.drop_without_shutdown();
1121 _result
1122 }
1123
1124 pub fn send_no_shutdown_on_err(
1126 self,
1127 mut result: Result<&State, i32>,
1128 ) -> Result<(), fidl::Error> {
1129 let _result = self.send_raw(result);
1130 self.drop_without_shutdown();
1131 _result
1132 }
1133
1134 fn send_raw(&self, mut result: Result<&State, i32>) -> Result<(), fidl::Error> {
1135 self.control_handle
1136 .inner
1137 .send::<fidl::encoding::ResultType<DeviceGetStateAbsoluteResponse, i32>>(
1138 result.map(|state| (state,)),
1139 self.tx_id,
1140 0x1f8ccf01cf526a2b,
1141 fidl::encoding::DynamicFlags::empty(),
1142 )
1143 }
1144}
1145
1146#[must_use = "FIDL methods require a response to be sent"]
1147#[derive(Debug)]
1148pub struct DeviceSetStateAbsoluteResponder {
1149 control_handle: std::mem::ManuallyDrop<DeviceControlHandle>,
1150 tx_id: u32,
1151}
1152
1153impl std::ops::Drop for DeviceSetStateAbsoluteResponder {
1157 fn drop(&mut self) {
1158 self.control_handle.shutdown();
1159 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1161 }
1162}
1163
1164impl fidl::endpoints::Responder for DeviceSetStateAbsoluteResponder {
1165 type ControlHandle = DeviceControlHandle;
1166
1167 fn control_handle(&self) -> &DeviceControlHandle {
1168 &self.control_handle
1169 }
1170
1171 fn drop_without_shutdown(mut self) {
1172 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1174 std::mem::forget(self);
1176 }
1177}
1178
1179impl DeviceSetStateAbsoluteResponder {
1180 pub fn send(self, mut result: Result<(), i32>) -> Result<(), fidl::Error> {
1184 let _result = self.send_raw(result);
1185 if _result.is_err() {
1186 self.control_handle.shutdown();
1187 }
1188 self.drop_without_shutdown();
1189 _result
1190 }
1191
1192 pub fn send_no_shutdown_on_err(self, mut result: Result<(), i32>) -> Result<(), fidl::Error> {
1194 let _result = self.send_raw(result);
1195 self.drop_without_shutdown();
1196 _result
1197 }
1198
1199 fn send_raw(&self, mut result: Result<(), i32>) -> Result<(), fidl::Error> {
1200 self.control_handle
1201 .inner
1202 .send::<fidl::encoding::ResultType<fidl::encoding::EmptyStruct, i32>>(
1203 result,
1204 self.tx_id,
1205 0x19c100c43faaa178,
1206 fidl::encoding::DynamicFlags::empty(),
1207 )
1208 }
1209}
1210
1211#[must_use = "FIDL methods require a response to be sent"]
1212#[derive(Debug)]
1213pub struct DeviceGetMaxAbsoluteBrightnessResponder {
1214 control_handle: std::mem::ManuallyDrop<DeviceControlHandle>,
1215 tx_id: u32,
1216}
1217
1218impl std::ops::Drop for DeviceGetMaxAbsoluteBrightnessResponder {
1222 fn drop(&mut self) {
1223 self.control_handle.shutdown();
1224 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1226 }
1227}
1228
1229impl fidl::endpoints::Responder for DeviceGetMaxAbsoluteBrightnessResponder {
1230 type ControlHandle = DeviceControlHandle;
1231
1232 fn control_handle(&self) -> &DeviceControlHandle {
1233 &self.control_handle
1234 }
1235
1236 fn drop_without_shutdown(mut self) {
1237 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1239 std::mem::forget(self);
1241 }
1242}
1243
1244impl DeviceGetMaxAbsoluteBrightnessResponder {
1245 pub fn send(self, mut result: Result<f64, i32>) -> Result<(), fidl::Error> {
1249 let _result = self.send_raw(result);
1250 if _result.is_err() {
1251 self.control_handle.shutdown();
1252 }
1253 self.drop_without_shutdown();
1254 _result
1255 }
1256
1257 pub fn send_no_shutdown_on_err(self, mut result: Result<f64, i32>) -> Result<(), fidl::Error> {
1259 let _result = self.send_raw(result);
1260 self.drop_without_shutdown();
1261 _result
1262 }
1263
1264 fn send_raw(&self, mut result: Result<f64, i32>) -> Result<(), fidl::Error> {
1265 self.control_handle.inner.send::<fidl::encoding::ResultType<
1266 DeviceGetMaxAbsoluteBrightnessResponse,
1267 i32,
1268 >>(
1269 result.map(|max_brightness| (max_brightness,)),
1270 self.tx_id,
1271 0x2aa0699313d4160d,
1272 fidl::encoding::DynamicFlags::empty(),
1273 )
1274 }
1275}
1276
1277#[must_use = "FIDL methods require a response to be sent"]
1278#[derive(Debug)]
1279pub struct DeviceSetNormalizedBrightnessScaleResponder {
1280 control_handle: std::mem::ManuallyDrop<DeviceControlHandle>,
1281 tx_id: u32,
1282}
1283
1284impl std::ops::Drop for DeviceSetNormalizedBrightnessScaleResponder {
1288 fn drop(&mut self) {
1289 self.control_handle.shutdown();
1290 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1292 }
1293}
1294
1295impl fidl::endpoints::Responder for DeviceSetNormalizedBrightnessScaleResponder {
1296 type ControlHandle = DeviceControlHandle;
1297
1298 fn control_handle(&self) -> &DeviceControlHandle {
1299 &self.control_handle
1300 }
1301
1302 fn drop_without_shutdown(mut self) {
1303 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1305 std::mem::forget(self);
1307 }
1308}
1309
1310impl DeviceSetNormalizedBrightnessScaleResponder {
1311 pub fn send(self, mut result: Result<(), i32>) -> Result<(), fidl::Error> {
1315 let _result = self.send_raw(result);
1316 if _result.is_err() {
1317 self.control_handle.shutdown();
1318 }
1319 self.drop_without_shutdown();
1320 _result
1321 }
1322
1323 pub fn send_no_shutdown_on_err(self, mut result: Result<(), i32>) -> Result<(), fidl::Error> {
1325 let _result = self.send_raw(result);
1326 self.drop_without_shutdown();
1327 _result
1328 }
1329
1330 fn send_raw(&self, mut result: Result<(), i32>) -> Result<(), fidl::Error> {
1331 self.control_handle
1332 .inner
1333 .send::<fidl::encoding::ResultType<fidl::encoding::EmptyStruct, i32>>(
1334 result,
1335 self.tx_id,
1336 0x34ee4d2bbf4b2863,
1337 fidl::encoding::DynamicFlags::empty(),
1338 )
1339 }
1340}
1341
1342#[must_use = "FIDL methods require a response to be sent"]
1343#[derive(Debug)]
1344pub struct DeviceGetNormalizedBrightnessScaleResponder {
1345 control_handle: std::mem::ManuallyDrop<DeviceControlHandle>,
1346 tx_id: u32,
1347}
1348
1349impl std::ops::Drop for DeviceGetNormalizedBrightnessScaleResponder {
1353 fn drop(&mut self) {
1354 self.control_handle.shutdown();
1355 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1357 }
1358}
1359
1360impl fidl::endpoints::Responder for DeviceGetNormalizedBrightnessScaleResponder {
1361 type ControlHandle = DeviceControlHandle;
1362
1363 fn control_handle(&self) -> &DeviceControlHandle {
1364 &self.control_handle
1365 }
1366
1367 fn drop_without_shutdown(mut self) {
1368 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1370 std::mem::forget(self);
1372 }
1373}
1374
1375impl DeviceGetNormalizedBrightnessScaleResponder {
1376 pub fn send(self, mut result: Result<f64, i32>) -> Result<(), fidl::Error> {
1380 let _result = self.send_raw(result);
1381 if _result.is_err() {
1382 self.control_handle.shutdown();
1383 }
1384 self.drop_without_shutdown();
1385 _result
1386 }
1387
1388 pub fn send_no_shutdown_on_err(self, mut result: Result<f64, i32>) -> Result<(), fidl::Error> {
1390 let _result = self.send_raw(result);
1391 self.drop_without_shutdown();
1392 _result
1393 }
1394
1395 fn send_raw(&self, mut result: Result<f64, i32>) -> Result<(), fidl::Error> {
1396 self.control_handle.inner.send::<fidl::encoding::ResultType<
1397 DeviceGetNormalizedBrightnessScaleResponse,
1398 i32,
1399 >>(
1400 result.map(|scale| (scale,)),
1401 self.tx_id,
1402 0x4f57df8da3bcb26b,
1403 fidl::encoding::DynamicFlags::empty(),
1404 )
1405 }
1406}
1407
1408#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
1409pub struct ServiceMarker;
1410
1411#[cfg(target_os = "fuchsia")]
1412impl fidl::endpoints::ServiceMarker for ServiceMarker {
1413 type Proxy = ServiceProxy;
1414 type Request = ServiceRequest;
1415 const SERVICE_NAME: &'static str = "fuchsia.hardware.backlight.Service";
1416}
1417
1418#[cfg(target_os = "fuchsia")]
1421pub enum ServiceRequest {
1422 Backlight(DeviceRequestStream),
1423}
1424
1425#[cfg(target_os = "fuchsia")]
1426impl fidl::endpoints::ServiceRequest for ServiceRequest {
1427 type Service = ServiceMarker;
1428
1429 fn dispatch(name: &str, _channel: fidl::AsyncChannel) -> Self {
1430 match name {
1431 "backlight" => Self::Backlight(
1432 <DeviceRequestStream as fidl::endpoints::RequestStream>::from_channel(_channel),
1433 ),
1434 _ => panic!("no such member protocol name for service Service"),
1435 }
1436 }
1437
1438 fn member_names() -> &'static [&'static str] {
1439 &["backlight"]
1440 }
1441}
1442#[cfg(target_os = "fuchsia")]
1443pub struct ServiceProxy(#[allow(dead_code)] Box<dyn fidl::endpoints::MemberOpener>);
1444
1445#[cfg(target_os = "fuchsia")]
1446impl fidl::endpoints::ServiceProxy for ServiceProxy {
1447 type Service = ServiceMarker;
1448
1449 fn from_member_opener(opener: Box<dyn fidl::endpoints::MemberOpener>) -> Self {
1450 Self(opener)
1451 }
1452}
1453
1454#[cfg(target_os = "fuchsia")]
1455impl ServiceProxy {
1456 pub fn connect_to_backlight(&self) -> Result<DeviceProxy, fidl::Error> {
1457 let (proxy, server_end) = fidl::endpoints::create_proxy::<DeviceMarker>();
1458 self.connect_channel_to_backlight(server_end)?;
1459 Ok(proxy)
1460 }
1461
1462 pub fn connect_to_backlight_sync(&self) -> Result<DeviceSynchronousProxy, fidl::Error> {
1465 let (proxy, server_end) = fidl::endpoints::create_sync_proxy::<DeviceMarker>();
1466 self.connect_channel_to_backlight(server_end)?;
1467 Ok(proxy)
1468 }
1469
1470 pub fn connect_channel_to_backlight(
1473 &self,
1474 server_end: fidl::endpoints::ServerEnd<DeviceMarker>,
1475 ) -> Result<(), fidl::Error> {
1476 self.0.open_member("backlight", server_end.into_channel())
1477 }
1478
1479 pub fn instance_name(&self) -> &str {
1480 self.0.instance_name()
1481 }
1482}
1483
1484mod internal {
1485 use super::*;
1486}