Mountain/RPC/CocoonService/Output/
CreateOutputChannel.rs1use serde_json::json;
4use tauri::Emitter;
5use tonic::{Response, Status};
6use ::Vine::Generated::{CreateOutputChannelRequest, CreateOutputChannelResponse};
7
8use crate::{RPC::CocoonService::CocoonServiceImpl, dev_log};
9
10pub async fn Fn(
11 Service:&CocoonServiceImpl,
12
13 Request:CreateOutputChannelRequest,
14) -> Result<Response<CreateOutputChannelResponse>, Status> {
15 dev_log!("cocoon", "[CocoonService] create_output_channel: '{}'", Request.name);
16
17 let _ = Service
21 .environment
22 .ApplicationHandle
23 .emit("sky://output/create", json!({ "id": Request.name, "name": Request.name }));
24
25 Ok(Response::new(CreateOutputChannelResponse { channel_id:Request.name.clone() }))
26}