fix: up to spec

This commit is contained in:
Strix 2023-12-04 14:02:53 +01:00
parent c0929538d2
commit a62fd81bf2
No known key found for this signature in database
GPG key ID: 5F35B3B8537287A7
6 changed files with 7 additions and 8 deletions

View file

@ -7,7 +7,7 @@ use crate::packet::packet_data::PacketData;
pub mod vec; pub mod vec;
pub mod errors; pub mod errors;
#[derive(Debug, Clone)] #[derive(Debug, Clone, PartialEq, Eq)]
pub enum NodeManagementCommand { pub enum NodeManagementCommand {
Ping, Ping,
RegisterNode { device_id: Identifier }, RegisterNode { device_id: Identifier },

View file

@ -8,7 +8,7 @@ use std::io;
pub mod vec; pub mod vec;
#[derive(Debug, Clone)] #[derive(Debug, Clone, PartialEq, Eq)]
pub enum PropertyControlCommand { pub enum PropertyControlCommand {
Register { Register {
property_name: String, property_name: String,

View file

@ -7,7 +7,7 @@ use crate::{
pub mod vec; pub mod vec;
#[derive(Debug, Clone)] #[derive(Debug, Clone, PartialEq, Eq)]
pub enum RawDataTransmission { pub enum RawDataTransmission {
SetupTransmission { SetupTransmission {
/// The total size of the data being sent. /// The total size of the data being sent.

View file

@ -1,7 +1,6 @@
use std::io; use std::io;
use crate::data_types::{DataType, get_data_types}; use crate::data_types::{DataType, get_data_types};
use crate::identifier::{Identifier, self}; use crate::identifier::Identifier;
use crate::prelude::as_u64_be;
impl Into<Vec<u8>> for DataType { impl Into<Vec<u8>> for DataType {
fn into(self) -> Vec<u8> { fn into(self) -> Vec<u8> {

View file

@ -17,7 +17,7 @@ pub const FULL_PACKET_SIZE: usize = 65559;
pub const BASE_PACKET_SIZE: usize = 65555; pub const BASE_PACKET_SIZE: usize = 65555;
/// The abstraction for all DomoProto packets. /// The abstraction for all DomoProto packets.
#[derive(Debug, Clone)] #[derive(Debug, Clone, PartialEq, Eq)]
pub struct Packet { pub struct Packet {
pub dest: Identifier, pub dest: Identifier,
pub src: Identifier, pub src: Identifier,
@ -40,7 +40,7 @@ impl Default for Packet {
command: 0x00, command: 0x00,
packet_id: Identifier::random(), packet_id: Identifier::random(),
reply_to: Identifier::default(), reply_to: Identifier::default(),
data: PacketData::Unknown(vec![]) data: PacketData::NodeManagement(crate::commands::node_management::NodeManagementCommand::Ping)
} }
} }
} }

View file

@ -5,7 +5,7 @@ use crate::commands::raw_data_transmission::RawDataTransmission;
use crate::packet::raw_packet::RawPacket; use crate::packet::raw_packet::RawPacket;
/// Abstraction used for interpreting the data in a packet. /// Abstraction used for interpreting the data in a packet.
#[derive(Debug, Clone)] #[derive(Debug, Clone, PartialEq, Eq)]
pub enum PacketData { pub enum PacketData {
NodeManagement(NodeManagementCommand), NodeManagement(NodeManagementCommand),
PropertyControl(PropertyControlCommand), PropertyControl(PropertyControlCommand),