Skip to main content

Mountain/RPC/CocoonService/Output/
CreateOutputChannel.rs

1#![allow(non_snake_case)]
2
3//! Create a new output channel and notify Sky over `sky://output/create`.
4
5use serde_json::json;
6use tauri::Emitter;
7use tonic::{Response, Status};
8
9use crate::{
10	RPC::CocoonService::CocoonServiceImpl,
11	Vine::Generated::{CreateOutputChannelRequest, CreateOutputChannelResponse},
12	dev_log,
13};
14
15pub async fn Fn(
16	Service:&CocoonServiceImpl,
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}