1// Copyright 2020 The Fuchsia Authors. All rights reserved.
2// Use of this source code is governed by a BSD-style license that can be
3// found in the LICENSE file.
45use 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};
1112#[async_trait(?Send)]
13impl Facade for WlanDeprecatedConfigurationFacade {
14async fn handle_request(&self, method: String, args: Value) -> Result<Value, Error> {
15match method.as_ref() {
16"suggest_ap_mac" => {
17let mac = self.parse_mac_argument(args)?;
18info!(
19 tag = "WlanDeprecatedConfigurationFacade";
20"setting suggested MAC to: {:?}", mac
21 );
22let result = self.suggest_access_point_mac_address(mac).await?;
23 to_value(result).map_err(|e| {
24format_err!("error parsing suggested access point MAC result: {}", e)
25 })
26 }
27_ => return Err(format_err!("unsupported command!")),
28 }
29 }
30}