sl4f_lib/wlan_deprecated/
commands.rs1use crate::server::Facade;
6use crate::wlan_deprecated::facade::WlanDeprecatedConfigurationFacade;
7use anyhow::{format_err, Error};
8use async_trait::async_trait;
9use log::info;
10use serde_json::{to_value, Value};
11
12#[async_trait(?Send)]
13impl Facade for WlanDeprecatedConfigurationFacade {
14 async fn handle_request(&self, method: String, args: Value) -> Result<Value, Error> {
15 match method.as_ref() {
16 "suggest_ap_mac" => {
17 let mac = self.parse_mac_argument(args)?;
18 info!(
19 tag = "WlanDeprecatedConfigurationFacade";
20 "setting suggested MAC to: {:?}", mac
21 );
22 let result = self.suggest_access_point_mac_address(mac).await?;
23 to_value(result).map_err(|e| {
24 format_err!("error parsing suggested access point MAC result: {}", e)
25 })
26 }
27 _ => return Err(format_err!("unsupported command!")),
28 }
29 }
30}