feat: _top

This commit is contained in:
Baud 2024-03-19 20:40:51 +00:00
parent 25460d77cd
commit 5e5d3508f0
3 changed files with 50 additions and 19 deletions

View File

@ -3,6 +3,7 @@ use std::sync::Arc;
use crate::{
commands::command_base::{CommandDeserializer, DeserializedCommand},
enums::ProtocolVersion,
state::info::{AtemCapabilites, MultiviewerInfo},
};
pub const DESERIALIZE_TOPOLOGY_RAW_NAME: &str = "_top";
@ -29,17 +30,43 @@ pub struct Topology {
impl DeserializedCommand for Topology {
fn raw_name(&self) -> &'static str {
todo!()
DESERIALIZE_TOPOLOGY_RAW_NAME
}
fn apply_to_state(&self, state: &mut crate::state::AtemState) {
todo!()
state.info.capabilities = Some(AtemCapabilites::new(
self.mix_effects,
self.sources,
self.auxilliaries,
self.mix_minus_outputs,
self.media_players,
self.serial_ports,
self.max_hyperdecks,
self.dves,
self.stingers,
self.super_sources,
self.talkback_channels,
self.downstream_keyers,
self.camera_control,
self.advanced_chroma_keyers,
self.only_configurable_outputs,
));
if let Some(multiviewers) = self.multiviewers {
let window_count = if let Some(mv) = &state.info.multiviewer {
*mv.window_count()
} else {
10
};
state.info.multiviewer = Some(MultiviewerInfo::new(multiviewers, window_count))
}
}
}
pub struct TopologyCommandDeserializer {}
#[derive(Default)]
pub struct TopologyDeserializer {}
impl CommandDeserializer for TopologyCommandDeserializer {
impl CommandDeserializer for TopologyDeserializer {
fn deserialize(
&self,
buffer: &[u8],

View File

@ -7,9 +7,12 @@ use crate::{
use super::{
command_base::{CommandDeserializer, DeserializedCommand},
device_profile::product_identifier::{
device_profile::{
product_identifier::{
ProductIdentifierDeserializer, DESERIALIZE_PRODUCT_IDENTIFIER_RAW_NAME,
},
topology::{TopologyDeserializer, DESERIALIZE_TOPOLOGY_RAW_NAME},
},
init_complete::{InitCompleteDeserializer, DESERIALIZE_INIT_COMPLETE_RAW_NAME},
mix_effects::program_input::{ProgramInputDeserializer, DESERIALIZE_PROGRAM_INPUT_RAW_NAME},
tally_by_source::{TallyBySourceDeserializer, DESERIALIZE_TALLY_BY_SOURCE_RAW_NAME},
@ -64,6 +67,7 @@ fn command_deserializer_from_string(command_str: &str) -> Option<Box<dyn Command
DESERIALIZE_PROGRAM_INPUT_RAW_NAME => Some(Box::<ProgramInputDeserializer>::default()),
DESERIALIZE_TALLY_BY_SOURCE_RAW_NAME => Some(Box::<TallyBySourceDeserializer>::default()),
DESERIALIZE_TIME_RAW_NAME => Some(Box::<TimeDeserializer>::default()),
DESERIALIZE_TOPOLOGY_RAW_NAME => Some(Box::<TopologyDeserializer>::default()),
DESERIALIZE_PRODUCT_IDENTIFIER_RAW_NAME => {
Some(Box::<ProductIdentifierDeserializer>::default())
}

View File

@ -3,17 +3,17 @@ use crate::enums::{Model, ProtocolVersion};
#[derive(Clone, PartialEq, Getters, new)]
pub struct AtemCapabilites {
mix_effects: u8,
sources: u64,
auxilliaries: u64,
mix_minus_outputs: u64,
media_players: u64,
serial_ports: u64,
max_hyperdecks: u64,
dves: u64,
stingers: u64,
super_sources: u64,
talkback_channels: u64,
downstream_keyers: u64,
sources: u8,
auxilliaries: u8,
mix_minus_outputs: u8,
media_players: u8,
serial_ports: u8,
max_hyperdecks: u8,
dves: u8,
stingers: u8,
super_sources: u8,
talkback_channels: u8,
downstream_keyers: u8,
camera_control: bool,
advanced_chroma_keyers: bool,
only_configurable_outputs: bool,
@ -55,8 +55,8 @@ pub struct MediaPoolInfo {
#[derive(Clone, PartialEq, Getters, new)]
pub struct MultiviewerInfo {
count: u64,
window_count: u64,
count: u8,
window_count: u8,
}
#[derive(Clone, PartialEq, new)]