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