sl4f_lib/hwinfo/
commands.rs1use crate::server::Facade;
6use anyhow::Error;
7use async_trait::async_trait;
8use serde_json::{to_value, Value};
9
10use crate::hwinfo::facade::HwinfoFacade;
11
12#[async_trait(?Send)]
13impl Facade for HwinfoFacade {
14 async fn handle_request(&self, method: String, _args: Value) -> Result<Value, Error> {
15 match method.as_ref() {
16 "HwinfoGetDeviceInfo" => {
17 let result = self.get_device_info().await?;
18 Ok(to_value(result)?)
19 }
20 "HwinfoGetProductInfo" => {
21 let result = self.get_product_info().await?;
22 Ok(to_value(result)?)
23 }
24 "HwinfoGetBoardInfo" => {
25 let result = self.get_board_info().await?;
26 Ok(to_value(result)?)
27 }
28 _ => bail!("Invalid Hwinfo FIDL method: {:?}", method),
29 }
30 }
31}