fix: up to spec
This commit is contained in:
parent
c0929538d2
commit
a62fd81bf2
6 changed files with 7 additions and 8 deletions
|
@ -7,7 +7,7 @@ use crate::packet::packet_data::PacketData;
|
|||
pub mod vec;
|
||||
pub mod errors;
|
||||
|
||||
#[derive(Debug, Clone)]
|
||||
#[derive(Debug, Clone, PartialEq, Eq)]
|
||||
pub enum NodeManagementCommand {
|
||||
Ping,
|
||||
RegisterNode { device_id: Identifier },
|
||||
|
|
|
@ -8,7 +8,7 @@ use std::io;
|
|||
|
||||
pub mod vec;
|
||||
|
||||
#[derive(Debug, Clone)]
|
||||
#[derive(Debug, Clone, PartialEq, Eq)]
|
||||
pub enum PropertyControlCommand {
|
||||
Register {
|
||||
property_name: String,
|
||||
|
|
|
@ -7,7 +7,7 @@ use crate::{
|
|||
|
||||
pub mod vec;
|
||||
|
||||
#[derive(Debug, Clone)]
|
||||
#[derive(Debug, Clone, PartialEq, Eq)]
|
||||
pub enum RawDataTransmission {
|
||||
SetupTransmission {
|
||||
/// The total size of the data being sent.
|
||||
|
|
|
@ -1,7 +1,6 @@
|
|||
use std::io;
|
||||
use crate::data_types::{DataType, get_data_types};
|
||||
use crate::identifier::{Identifier, self};
|
||||
use crate::prelude::as_u64_be;
|
||||
use crate::identifier::Identifier;
|
||||
|
||||
impl Into<Vec<u8>> for DataType {
|
||||
fn into(self) -> Vec<u8> {
|
||||
|
|
|
@ -17,7 +17,7 @@ pub const FULL_PACKET_SIZE: usize = 65559;
|
|||
pub const BASE_PACKET_SIZE: usize = 65555;
|
||||
|
||||
/// The abstraction for all DomoProto packets.
|
||||
#[derive(Debug, Clone)]
|
||||
#[derive(Debug, Clone, PartialEq, Eq)]
|
||||
pub struct Packet {
|
||||
pub dest: Identifier,
|
||||
pub src: Identifier,
|
||||
|
@ -40,7 +40,7 @@ impl Default for Packet {
|
|||
command: 0x00,
|
||||
packet_id: Identifier::random(),
|
||||
reply_to: Identifier::default(),
|
||||
data: PacketData::Unknown(vec![])
|
||||
data: PacketData::NodeManagement(crate::commands::node_management::NodeManagementCommand::Ping)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -5,7 +5,7 @@ use crate::commands::raw_data_transmission::RawDataTransmission;
|
|||
use crate::packet::raw_packet::RawPacket;
|
||||
|
||||
/// Abstraction used for interpreting the data in a packet.
|
||||
#[derive(Debug, Clone)]
|
||||
#[derive(Debug, Clone, PartialEq, Eq)]
|
||||
pub enum PacketData {
|
||||
NodeManagement(NodeManagementCommand),
|
||||
PropertyControl(PropertyControlCommand),
|
||||
|
|
Loading…
Reference in a new issue