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::Handle {
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 fn shutdown_with_epitaph(&self, status: zx_status::Status) {
388 self.inner.shutdown_with_epitaph(status)
389 }
390
391 fn is_closed(&self) -> bool {
392 self.inner.channel().is_closed()
393 }
394 fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
395 self.inner.channel().on_closed()
396 }
397
398 #[cfg(target_os = "fuchsia")]
399 fn signal_peer(
400 &self,
401 clear_mask: zx::Signals,
402 set_mask: zx::Signals,
403 ) -> Result<(), zx_status::Status> {
404 use fidl::Peered;
405 self.inner.channel().signal_peer(clear_mask, set_mask)
406 }
407}
408
409impl WlanBaseStationWatcherControlHandle {}
410
411mod internal {
412 use super::*;
413
414 impl fidl::encoding::ResourceTypeMarker for WlanBaseStationWatcherReportCurrentStationsRequest {
415 type Borrowed<'a> = &'a mut Self;
416 fn take_or_borrow<'a>(
417 value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
418 ) -> Self::Borrowed<'a> {
419 value
420 }
421 }
422
423 unsafe impl fidl::encoding::TypeMarker for WlanBaseStationWatcherReportCurrentStationsRequest {
424 type Owned = Self;
425
426 #[inline(always)]
427 fn inline_align(_context: fidl::encoding::Context) -> usize {
428 4
429 }
430
431 #[inline(always)]
432 fn inline_size(_context: fidl::encoding::Context) -> usize {
433 4
434 }
435 }
436
437 unsafe impl
438 fidl::encoding::Encode<
439 WlanBaseStationWatcherReportCurrentStationsRequest,
440 fidl::encoding::DefaultFuchsiaResourceDialect,
441 > for &mut WlanBaseStationWatcherReportCurrentStationsRequest
442 {
443 #[inline]
444 unsafe fn encode(
445 self,
446 encoder: &mut fidl::encoding::Encoder<
447 '_,
448 fidl::encoding::DefaultFuchsiaResourceDialect,
449 >,
450 offset: usize,
451 _depth: fidl::encoding::Depth,
452 ) -> fidl::Result<()> {
453 encoder
454 .debug_check_bounds::<WlanBaseStationWatcherReportCurrentStationsRequest>(offset);
455 fidl::encoding::Encode::<
457 WlanBaseStationWatcherReportCurrentStationsRequest,
458 fidl::encoding::DefaultFuchsiaResourceDialect,
459 >::encode(
460 (<fidl::encoding::Endpoint<
461 fidl::endpoints::ClientEnd<fidl_fuchsia_wlan_policy::ScanResultIteratorMarker>,
462 > as fidl::encoding::ResourceTypeMarker>::take_or_borrow(
463 &mut self.stations
464 ),),
465 encoder,
466 offset,
467 _depth,
468 )
469 }
470 }
471 unsafe impl<
472 T0: fidl::encoding::Encode<
473 fidl::encoding::Endpoint<
474 fidl::endpoints::ClientEnd<fidl_fuchsia_wlan_policy::ScanResultIteratorMarker>,
475 >,
476 fidl::encoding::DefaultFuchsiaResourceDialect,
477 >,
478 >
479 fidl::encoding::Encode<
480 WlanBaseStationWatcherReportCurrentStationsRequest,
481 fidl::encoding::DefaultFuchsiaResourceDialect,
482 > for (T0,)
483 {
484 #[inline]
485 unsafe fn encode(
486 self,
487 encoder: &mut fidl::encoding::Encoder<
488 '_,
489 fidl::encoding::DefaultFuchsiaResourceDialect,
490 >,
491 offset: usize,
492 depth: fidl::encoding::Depth,
493 ) -> fidl::Result<()> {
494 encoder
495 .debug_check_bounds::<WlanBaseStationWatcherReportCurrentStationsRequest>(offset);
496 self.0.encode(encoder, offset + 0, depth)?;
500 Ok(())
501 }
502 }
503
504 impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
505 for WlanBaseStationWatcherReportCurrentStationsRequest
506 {
507 #[inline(always)]
508 fn new_empty() -> Self {
509 Self {
510 stations: fidl::new_empty!(
511 fidl::encoding::Endpoint<
512 fidl::endpoints::ClientEnd<
513 fidl_fuchsia_wlan_policy::ScanResultIteratorMarker,
514 >,
515 >,
516 fidl::encoding::DefaultFuchsiaResourceDialect
517 ),
518 }
519 }
520
521 #[inline]
522 unsafe fn decode(
523 &mut self,
524 decoder: &mut fidl::encoding::Decoder<
525 '_,
526 fidl::encoding::DefaultFuchsiaResourceDialect,
527 >,
528 offset: usize,
529 _depth: fidl::encoding::Depth,
530 ) -> fidl::Result<()> {
531 decoder.debug_check_bounds::<Self>(offset);
532 fidl::decode!(
534 fidl::encoding::Endpoint<
535 fidl::endpoints::ClientEnd<fidl_fuchsia_wlan_policy::ScanResultIteratorMarker>,
536 >,
537 fidl::encoding::DefaultFuchsiaResourceDialect,
538 &mut self.stations,
539 decoder,
540 offset + 0,
541 _depth
542 )?;
543 Ok(())
544 }
545 }
546}