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_location_sensor__common::*;
11use futures::future::{self, MaybeDone, TryFutureExt};
12use zx_status;
13
14#[derive(Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
15pub struct WlanBaseStationWatcherReportCurrentStationsRequest {
16 pub stations: fidl::endpoints::ClientEnd<fidl_fuchsia_wlan_policy::ScanResultIteratorMarker>,
17}
18
19impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect>
20 for WlanBaseStationWatcherReportCurrentStationsRequest
21{
22}
23
24#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
25pub struct WlanBaseStationWatcherMarker;
26
27impl fidl::endpoints::ProtocolMarker for WlanBaseStationWatcherMarker {
28 type Proxy = WlanBaseStationWatcherProxy;
29 type RequestStream = WlanBaseStationWatcherRequestStream;
30 #[cfg(target_os = "fuchsia")]
31 type SynchronousProxy = WlanBaseStationWatcherSynchronousProxy;
32
33 const DEBUG_NAME: &'static str = "fuchsia.location.sensor.WlanBaseStationWatcher";
34}
35impl fidl::endpoints::DiscoverableProtocolMarker for WlanBaseStationWatcherMarker {}
36
37pub trait WlanBaseStationWatcherProxyInterface: Send + Sync {
38 fn r#report_current_stations(
39 &self,
40 stations: fidl::endpoints::ClientEnd<fidl_fuchsia_wlan_policy::ScanResultIteratorMarker>,
41 ) -> Result<(), fidl::Error>;
42}
43#[derive(Debug)]
44#[cfg(target_os = "fuchsia")]
45pub struct WlanBaseStationWatcherSynchronousProxy {
46 client: fidl::client::sync::Client,
47}
48
49#[cfg(target_os = "fuchsia")]
50impl fidl::endpoints::SynchronousProxy for WlanBaseStationWatcherSynchronousProxy {
51 type Proxy = WlanBaseStationWatcherProxy;
52 type Protocol = WlanBaseStationWatcherMarker;
53
54 fn from_channel(inner: fidl::Channel) -> Self {
55 Self::new(inner)
56 }
57
58 fn into_channel(self) -> fidl::Channel {
59 self.client.into_channel()
60 }
61
62 fn as_channel(&self) -> &fidl::Channel {
63 self.client.as_channel()
64 }
65}
66
67#[cfg(target_os = "fuchsia")]
68impl WlanBaseStationWatcherSynchronousProxy {
69 pub fn new(channel: fidl::Channel) -> Self {
70 let protocol_name =
71 <WlanBaseStationWatcherMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
72 Self { client: fidl::client::sync::Client::new(channel, protocol_name) }
73 }
74
75 pub fn into_channel(self) -> fidl::Channel {
76 self.client.into_channel()
77 }
78
79 pub fn wait_for_event(
82 &self,
83 deadline: zx::MonotonicInstant,
84 ) -> Result<WlanBaseStationWatcherEvent, fidl::Error> {
85 WlanBaseStationWatcherEvent::decode(self.client.wait_for_event(deadline)?)
86 }
87
88 pub fn r#report_current_stations(
91 &self,
92 mut stations: fidl::endpoints::ClientEnd<
93 fidl_fuchsia_wlan_policy::ScanResultIteratorMarker,
94 >,
95 ) -> Result<(), fidl::Error> {
96 self.client.send::<WlanBaseStationWatcherReportCurrentStationsRequest>(
97 (stations,),
98 0x28fb79c8f0a302ca,
99 fidl::encoding::DynamicFlags::empty(),
100 )
101 }
102}
103
104#[cfg(target_os = "fuchsia")]
105impl From<WlanBaseStationWatcherSynchronousProxy> for zx::NullableHandle {
106 fn from(value: WlanBaseStationWatcherSynchronousProxy) -> Self {
107 value.into_channel().into()
108 }
109}
110
111#[cfg(target_os = "fuchsia")]
112impl From<fidl::Channel> for WlanBaseStationWatcherSynchronousProxy {
113 fn from(value: fidl::Channel) -> Self {
114 Self::new(value)
115 }
116}
117
118#[cfg(target_os = "fuchsia")]
119impl fidl::endpoints::FromClient for WlanBaseStationWatcherSynchronousProxy {
120 type Protocol = WlanBaseStationWatcherMarker;
121
122 fn from_client(value: fidl::endpoints::ClientEnd<WlanBaseStationWatcherMarker>) -> Self {
123 Self::new(value.into_channel())
124 }
125}
126
127#[derive(Debug, Clone)]
128pub struct WlanBaseStationWatcherProxy {
129 client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
130}
131
132impl fidl::endpoints::Proxy for WlanBaseStationWatcherProxy {
133 type Protocol = WlanBaseStationWatcherMarker;
134
135 fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
136 Self::new(inner)
137 }
138
139 fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
140 self.client.into_channel().map_err(|client| Self { client })
141 }
142
143 fn as_channel(&self) -> &::fidl::AsyncChannel {
144 self.client.as_channel()
145 }
146}
147
148impl WlanBaseStationWatcherProxy {
149 pub fn new(channel: ::fidl::AsyncChannel) -> Self {
151 let protocol_name =
152 <WlanBaseStationWatcherMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
153 Self { client: fidl::client::Client::new(channel, protocol_name) }
154 }
155
156 pub fn take_event_stream(&self) -> WlanBaseStationWatcherEventStream {
162 WlanBaseStationWatcherEventStream { event_receiver: self.client.take_event_receiver() }
163 }
164
165 pub fn r#report_current_stations(
168 &self,
169 mut stations: fidl::endpoints::ClientEnd<
170 fidl_fuchsia_wlan_policy::ScanResultIteratorMarker,
171 >,
172 ) -> Result<(), fidl::Error> {
173 WlanBaseStationWatcherProxyInterface::r#report_current_stations(self, stations)
174 }
175}
176
177impl WlanBaseStationWatcherProxyInterface for WlanBaseStationWatcherProxy {
178 fn r#report_current_stations(
179 &self,
180 mut stations: fidl::endpoints::ClientEnd<
181 fidl_fuchsia_wlan_policy::ScanResultIteratorMarker,
182 >,
183 ) -> Result<(), fidl::Error> {
184 self.client.send::<WlanBaseStationWatcherReportCurrentStationsRequest>(
185 (stations,),
186 0x28fb79c8f0a302ca,
187 fidl::encoding::DynamicFlags::empty(),
188 )
189 }
190}
191
192pub struct WlanBaseStationWatcherEventStream {
193 event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
194}
195
196impl std::marker::Unpin for WlanBaseStationWatcherEventStream {}
197
198impl futures::stream::FusedStream for WlanBaseStationWatcherEventStream {
199 fn is_terminated(&self) -> bool {
200 self.event_receiver.is_terminated()
201 }
202}
203
204impl futures::Stream for WlanBaseStationWatcherEventStream {
205 type Item = Result<WlanBaseStationWatcherEvent, fidl::Error>;
206
207 fn poll_next(
208 mut self: std::pin::Pin<&mut Self>,
209 cx: &mut std::task::Context<'_>,
210 ) -> std::task::Poll<Option<Self::Item>> {
211 match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
212 &mut self.event_receiver,
213 cx
214 )?) {
215 Some(buf) => std::task::Poll::Ready(Some(WlanBaseStationWatcherEvent::decode(buf))),
216 None => std::task::Poll::Ready(None),
217 }
218 }
219}
220
221#[derive(Debug)]
222pub enum WlanBaseStationWatcherEvent {}
223
224impl WlanBaseStationWatcherEvent {
225 fn decode(
227 mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
228 ) -> Result<WlanBaseStationWatcherEvent, fidl::Error> {
229 let (bytes, _handles) = buf.split_mut();
230 let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
231 debug_assert_eq!(tx_header.tx_id, 0);
232 match tx_header.ordinal {
233 _ => Err(fidl::Error::UnknownOrdinal {
234 ordinal: tx_header.ordinal,
235 protocol_name:
236 <WlanBaseStationWatcherMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
237 }),
238 }
239 }
240}
241
242pub struct WlanBaseStationWatcherRequestStream {
244 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
245 is_terminated: bool,
246}
247
248impl std::marker::Unpin for WlanBaseStationWatcherRequestStream {}
249
250impl futures::stream::FusedStream for WlanBaseStationWatcherRequestStream {
251 fn is_terminated(&self) -> bool {
252 self.is_terminated
253 }
254}
255
256impl fidl::endpoints::RequestStream for WlanBaseStationWatcherRequestStream {
257 type Protocol = WlanBaseStationWatcherMarker;
258 type ControlHandle = WlanBaseStationWatcherControlHandle;
259
260 fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
261 Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
262 }
263
264 fn control_handle(&self) -> Self::ControlHandle {
265 WlanBaseStationWatcherControlHandle { inner: self.inner.clone() }
266 }
267
268 fn into_inner(
269 self,
270 ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
271 {
272 (self.inner, self.is_terminated)
273 }
274
275 fn from_inner(
276 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
277 is_terminated: bool,
278 ) -> Self {
279 Self { inner, is_terminated }
280 }
281}
282
283impl futures::Stream for WlanBaseStationWatcherRequestStream {
284 type Item = Result<WlanBaseStationWatcherRequest, fidl::Error>;
285
286 fn poll_next(
287 mut self: std::pin::Pin<&mut Self>,
288 cx: &mut std::task::Context<'_>,
289 ) -> std::task::Poll<Option<Self::Item>> {
290 let this = &mut *self;
291 if this.inner.check_shutdown(cx) {
292 this.is_terminated = true;
293 return std::task::Poll::Ready(None);
294 }
295 if this.is_terminated {
296 panic!("polled WlanBaseStationWatcherRequestStream after completion");
297 }
298 fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
299 |bytes, handles| {
300 match this.inner.channel().read_etc(cx, bytes, handles) {
301 std::task::Poll::Ready(Ok(())) => {}
302 std::task::Poll::Pending => return std::task::Poll::Pending,
303 std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
304 this.is_terminated = true;
305 return std::task::Poll::Ready(None);
306 }
307 std::task::Poll::Ready(Err(e)) => {
308 return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
309 e.into(),
310 ))));
311 }
312 }
313
314 let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
316
317 std::task::Poll::Ready(Some(match header.ordinal {
318 0x28fb79c8f0a302ca => {
319 header.validate_request_tx_id(fidl::MethodType::OneWay)?;
320 let mut req = fidl::new_empty!(WlanBaseStationWatcherReportCurrentStationsRequest, fidl::encoding::DefaultFuchsiaResourceDialect);
321 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<WlanBaseStationWatcherReportCurrentStationsRequest>(&header, _body_bytes, handles, &mut req)?;
322 let control_handle = WlanBaseStationWatcherControlHandle {
323 inner: this.inner.clone(),
324 };
325 Ok(WlanBaseStationWatcherRequest::ReportCurrentStations {stations: req.stations,
326
327 control_handle,
328 })
329 }
330 _ => Err(fidl::Error::UnknownOrdinal {
331 ordinal: header.ordinal,
332 protocol_name: <WlanBaseStationWatcherMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
333 }),
334 }))
335 },
336 )
337 }
338}
339
340#[derive(Debug)]
342pub enum WlanBaseStationWatcherRequest {
343 ReportCurrentStations {
346 stations: fidl::endpoints::ClientEnd<fidl_fuchsia_wlan_policy::ScanResultIteratorMarker>,
347 control_handle: WlanBaseStationWatcherControlHandle,
348 },
349}
350
351impl WlanBaseStationWatcherRequest {
352 #[allow(irrefutable_let_patterns)]
353 pub fn into_report_current_stations(
354 self,
355 ) -> Option<(
356 fidl::endpoints::ClientEnd<fidl_fuchsia_wlan_policy::ScanResultIteratorMarker>,
357 WlanBaseStationWatcherControlHandle,
358 )> {
359 if let WlanBaseStationWatcherRequest::ReportCurrentStations { stations, control_handle } =
360 self
361 {
362 Some((stations, control_handle))
363 } else {
364 None
365 }
366 }
367
368 pub fn method_name(&self) -> &'static str {
370 match *self {
371 WlanBaseStationWatcherRequest::ReportCurrentStations { .. } => {
372 "report_current_stations"
373 }
374 }
375 }
376}
377
378#[derive(Debug, Clone)]
379pub struct WlanBaseStationWatcherControlHandle {
380 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
381}
382
383impl fidl::endpoints::ControlHandle for WlanBaseStationWatcherControlHandle {
384 fn shutdown(&self) {
385 self.inner.shutdown()
386 }
387
388 fn shutdown_with_epitaph(&self, status: zx_status::Status) {
389 self.inner.shutdown_with_epitaph(status)
390 }
391
392 fn is_closed(&self) -> bool {
393 self.inner.channel().is_closed()
394 }
395 fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
396 self.inner.channel().on_closed()
397 }
398
399 #[cfg(target_os = "fuchsia")]
400 fn signal_peer(
401 &self,
402 clear_mask: zx::Signals,
403 set_mask: zx::Signals,
404 ) -> Result<(), zx_status::Status> {
405 use fidl::Peered;
406 self.inner.channel().signal_peer(clear_mask, set_mask)
407 }
408}
409
410impl WlanBaseStationWatcherControlHandle {}
411
412mod internal {
413 use super::*;
414
415 impl fidl::encoding::ResourceTypeMarker for WlanBaseStationWatcherReportCurrentStationsRequest {
416 type Borrowed<'a> = &'a mut Self;
417 fn take_or_borrow<'a>(
418 value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
419 ) -> Self::Borrowed<'a> {
420 value
421 }
422 }
423
424 unsafe impl fidl::encoding::TypeMarker for WlanBaseStationWatcherReportCurrentStationsRequest {
425 type Owned = Self;
426
427 #[inline(always)]
428 fn inline_align(_context: fidl::encoding::Context) -> usize {
429 4
430 }
431
432 #[inline(always)]
433 fn inline_size(_context: fidl::encoding::Context) -> usize {
434 4
435 }
436 }
437
438 unsafe impl
439 fidl::encoding::Encode<
440 WlanBaseStationWatcherReportCurrentStationsRequest,
441 fidl::encoding::DefaultFuchsiaResourceDialect,
442 > for &mut WlanBaseStationWatcherReportCurrentStationsRequest
443 {
444 #[inline]
445 unsafe fn encode(
446 self,
447 encoder: &mut fidl::encoding::Encoder<
448 '_,
449 fidl::encoding::DefaultFuchsiaResourceDialect,
450 >,
451 offset: usize,
452 _depth: fidl::encoding::Depth,
453 ) -> fidl::Result<()> {
454 encoder
455 .debug_check_bounds::<WlanBaseStationWatcherReportCurrentStationsRequest>(offset);
456 fidl::encoding::Encode::<
458 WlanBaseStationWatcherReportCurrentStationsRequest,
459 fidl::encoding::DefaultFuchsiaResourceDialect,
460 >::encode(
461 (<fidl::encoding::Endpoint<
462 fidl::endpoints::ClientEnd<fidl_fuchsia_wlan_policy::ScanResultIteratorMarker>,
463 > as fidl::encoding::ResourceTypeMarker>::take_or_borrow(
464 &mut self.stations
465 ),),
466 encoder,
467 offset,
468 _depth,
469 )
470 }
471 }
472 unsafe impl<
473 T0: fidl::encoding::Encode<
474 fidl::encoding::Endpoint<
475 fidl::endpoints::ClientEnd<fidl_fuchsia_wlan_policy::ScanResultIteratorMarker>,
476 >,
477 fidl::encoding::DefaultFuchsiaResourceDialect,
478 >,
479 >
480 fidl::encoding::Encode<
481 WlanBaseStationWatcherReportCurrentStationsRequest,
482 fidl::encoding::DefaultFuchsiaResourceDialect,
483 > for (T0,)
484 {
485 #[inline]
486 unsafe fn encode(
487 self,
488 encoder: &mut fidl::encoding::Encoder<
489 '_,
490 fidl::encoding::DefaultFuchsiaResourceDialect,
491 >,
492 offset: usize,
493 depth: fidl::encoding::Depth,
494 ) -> fidl::Result<()> {
495 encoder
496 .debug_check_bounds::<WlanBaseStationWatcherReportCurrentStationsRequest>(offset);
497 self.0.encode(encoder, offset + 0, depth)?;
501 Ok(())
502 }
503 }
504
505 impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
506 for WlanBaseStationWatcherReportCurrentStationsRequest
507 {
508 #[inline(always)]
509 fn new_empty() -> Self {
510 Self {
511 stations: fidl::new_empty!(
512 fidl::encoding::Endpoint<
513 fidl::endpoints::ClientEnd<
514 fidl_fuchsia_wlan_policy::ScanResultIteratorMarker,
515 >,
516 >,
517 fidl::encoding::DefaultFuchsiaResourceDialect
518 ),
519 }
520 }
521
522 #[inline]
523 unsafe fn decode(
524 &mut self,
525 decoder: &mut fidl::encoding::Decoder<
526 '_,
527 fidl::encoding::DefaultFuchsiaResourceDialect,
528 >,
529 offset: usize,
530 _depth: fidl::encoding::Depth,
531 ) -> fidl::Result<()> {
532 decoder.debug_check_bounds::<Self>(offset);
533 fidl::decode!(
535 fidl::encoding::Endpoint<
536 fidl::endpoints::ClientEnd<fidl_fuchsia_wlan_policy::ScanResultIteratorMarker>,
537 >,
538 fidl::encoding::DefaultFuchsiaResourceDialect,
539 &mut self.stations,
540 decoder,
541 offset + 0,
542 _depth
543 )?;
544 Ok(())
545 }
546 }
547}