Move wayvr-ipc to our workspace (#324)
This commit is contained in:
71
wayvr-ipc/src/packet_client.rs
Normal file
71
wayvr-ipc/src/packet_client.rs
Normal file
@@ -0,0 +1,71 @@
|
||||
// Contents of this file should be the same as on wlx-overlay-s.
|
||||
|
||||
use std::collections::HashMap;
|
||||
|
||||
use serde::{Deserialize, Serialize};
|
||||
|
||||
use super::{ipc::Serial, packet_server};
|
||||
|
||||
#[derive(Debug, Clone, Deserialize, Serialize)]
|
||||
pub struct Handshake {
|
||||
pub protocol_version: u32, // always set to PROTOCOL_VERSION
|
||||
pub magic: String, // always set to CONNECTION_MAGIC
|
||||
pub client_name: String,
|
||||
}
|
||||
|
||||
#[derive(Debug, Clone, Deserialize, Serialize)]
|
||||
pub enum AttachTo {
|
||||
None,
|
||||
HandLeft,
|
||||
HandRight,
|
||||
Head,
|
||||
Stage,
|
||||
}
|
||||
|
||||
#[derive(Debug, Serialize, Deserialize)]
|
||||
pub struct WvrProcessLaunchParams {
|
||||
pub name: String,
|
||||
pub exec: String,
|
||||
pub target_display: packet_server::WvrDisplayHandle,
|
||||
pub env: Vec<String>,
|
||||
pub args: String,
|
||||
pub userdata: HashMap<String, String>,
|
||||
}
|
||||
|
||||
#[derive(Clone, Debug, Serialize, Deserialize)]
|
||||
pub struct WvrDisplayCreateParams {
|
||||
pub width: u16,
|
||||
pub height: u16,
|
||||
pub name: String,
|
||||
pub scale: Option<f32>,
|
||||
pub attach_to: AttachTo,
|
||||
}
|
||||
|
||||
#[derive(Clone, Debug, Serialize, Deserialize)]
|
||||
pub struct WlxHapticsParams {
|
||||
pub intensity: f32,
|
||||
pub duration: f32,
|
||||
pub frequency: f32,
|
||||
}
|
||||
|
||||
#[derive(Debug, Serialize, Deserialize)]
|
||||
pub enum PacketClient {
|
||||
Handshake(Handshake),
|
||||
WvrDisplayCreate(Serial, WvrDisplayCreateParams),
|
||||
WvrDisplayGet(Serial, packet_server::WvrDisplayHandle),
|
||||
WvrDisplayList(Serial),
|
||||
WvrDisplayRemove(Serial, packet_server::WvrDisplayHandle),
|
||||
WvrDisplaySetVisible(packet_server::WvrDisplayHandle, bool),
|
||||
WvrDisplayWindowList(Serial, packet_server::WvrDisplayHandle),
|
||||
WvrDisplaySetWindowLayout(
|
||||
packet_server::WvrDisplayHandle,
|
||||
packet_server::WvrDisplayWindowLayout,
|
||||
),
|
||||
WvrWindowSetVisible(packet_server::WvrWindowHandle, bool),
|
||||
WvrProcessGet(Serial, packet_server::WvrProcessHandle),
|
||||
WvrProcessLaunch(Serial, WvrProcessLaunchParams),
|
||||
WvrProcessList(Serial),
|
||||
WvrProcessTerminate(packet_server::WvrProcessHandle),
|
||||
WlxHaptics(WlxHapticsParams),
|
||||
WlxInputState(Serial),
|
||||
}
|
||||
Reference in New Issue
Block a user