diff --git a/atem-connection-rs/src/commands/device_profile/topology.rs b/atem-connection-rs/src/commands/device_profile/topology.rs index 68fa16e..39f3d51 100644 --- a/atem-connection-rs/src/commands/device_profile/topology.rs +++ b/atem-connection-rs/src/commands/device_profile/topology.rs @@ -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], diff --git a/atem-connection-rs/src/commands/parse_commands.rs b/atem-connection-rs/src/commands/parse_commands.rs index cb7d854..acbd4a6 100644 --- a/atem-connection-rs/src/commands/parse_commands.rs +++ b/atem-connection-rs/src/commands/parse_commands.rs @@ -7,8 +7,11 @@ use crate::{ use super::{ command_base::{CommandDeserializer, DeserializedCommand}, - device_profile::product_identifier::{ - ProductIdentifierDeserializer, DESERIALIZE_PRODUCT_IDENTIFIER_RAW_NAME, + 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}, @@ -64,6 +67,7 @@ fn command_deserializer_from_string(command_str: &str) -> Option Some(Box::::default()), DESERIALIZE_TALLY_BY_SOURCE_RAW_NAME => Some(Box::::default()), DESERIALIZE_TIME_RAW_NAME => Some(Box::::default()), + DESERIALIZE_TOPOLOGY_RAW_NAME => Some(Box::::default()), DESERIALIZE_PRODUCT_IDENTIFIER_RAW_NAME => { Some(Box::::default()) } diff --git a/atem-connection-rs/src/state/info.rs b/atem-connection-rs/src/state/info.rs index ce564cc..2f965f9 100644 --- a/atem-connection-rs/src/state/info.rs +++ b/atem-connection-rs/src/state/info.rs @@ -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)]