sl4f_lib/wlan/
commands.rs1use crate::server::Facade;
6use anyhow::{Error, format_err};
7use async_trait::async_trait;
8use log::*;
9use serde_json::{Value, to_value};
10
11use crate::wlan::facade::WlanFacade;
13
14#[async_trait(?Send)]
15impl Facade for WlanFacade {
16 async fn handle_request(&self, method: String, _args: Value) -> Result<Value, Error> {
17 match method.as_ref() {
18 "status" => {
19 info!(tag = "WlanFacade"; "fetching connection status");
20 let result = self.status().await?;
21 to_value(result).map_err(|e| format_err!("error handling connection status: {}", e))
22 }
23 _ => return Err(format_err!("unsupported command!")),
24 }
25 }
26}