fundamentum_sdk_mqtt/models/
command.rs

1//! `Command` module
2//!
3
4use super::commands::{ConfigUpdateParameters, FirmwareUpdateParameters, RebootParameters};
5use serde::{Deserialize, Serialize};
6
7/// Definition of the command parameters
8#[derive(Debug, Clone, Serialize, Deserialize, PartialEq, Eq, Hash)]
9#[serde(tag = "command_short_name", content = "parameters")]
10#[serde(rename_all = "kebab-case")]
11pub enum CommandParameters {
12    /// Configuration update command parameters
13    CustomConfigurationUpdate(ConfigUpdateParameters),
14
15    /// Firmware update command parameters
16    FirmwareUpdate(FirmwareUpdateParameters),
17
18    /// Reboot command parameters
19    Reboot(RebootParameters),
20}
21
22/// `Command` definition
23#[derive(Debug, Clone, Serialize, Deserialize, PartialEq, Eq, Hash)]
24pub struct Command {
25    /// Unique command's id
26    pub device_command_id: u64,
27
28    /// Command's parameters
29    #[serde(flatten)]
30    pub parameters: CommandParameters,
31}