28 lines
818 B
Rust
28 lines
818 B
Rust
use std::{collections::HashMap, fmt::Debug, sync::Arc};
|
|
|
|
use crate::{enums::ProtocolVersion, state::AtemState};
|
|
|
|
pub trait DeserializedCommand: Send + Sync + Debug {
|
|
fn raw_name(&self) -> &'static str;
|
|
fn apply_to_state(&self, state: &mut AtemState) -> bool;
|
|
}
|
|
|
|
pub trait CommandDeserializer: Send + Sync {
|
|
fn deserialize(&self, buffer: &[u8]) -> Arc<dyn DeserializedCommand>;
|
|
}
|
|
|
|
pub trait SerializableCommand {
|
|
fn payload(&self, version: &ProtocolVersion) -> Vec<u8>;
|
|
}
|
|
|
|
pub trait BasicWritableCommand: SerializableCommand {
|
|
fn get_raw_name(&self) -> &'static str;
|
|
fn get_minimum_version(&self) -> ProtocolVersion;
|
|
}
|
|
|
|
pub trait WritableCommand: BasicWritableCommand {
|
|
fn get_mask_flag(&self) -> HashMap<String, f64>;
|
|
fn get_flag(&self) -> f64;
|
|
fn set_flag(&mut self, flag: f64);
|
|
}
|