sl4f_lib/virtual_camera/
commands.rs

1// Copyright 2021 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.
4
5use crate::server::Facade;
6use crate::virtual_camera::facade::VirtualCameraFacade;
7use crate::virtual_camera::types::VirtualCameraMethod;
8use anyhow::Error;
9use async_trait::async_trait;
10use serde_json::Value;
11
12#[async_trait(?Send)]
13impl Facade for VirtualCameraFacade {
14    async fn handle_request(&self, method: String, args: Value) -> Result<Value, Error> {
15        match method.parse()? {
16            VirtualCameraMethod::AddStreamConfig => self.add_stream_config(args).await,
17            VirtualCameraMethod::AddToDeviceWatcher => self.add_to_device_watcher().await,
18            // TODO(b/195762320) Add remaining method parsing for AddDataSource,
19            // SetDataSourceForStreamConfig, ClearDataSourceForStreamConfig
20        }
21    }
22}