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 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 },
|
||||||
|
|
|
@ -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,
|
||||||
|
|
|
@ -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.
|
||||||
|
|
|
@ -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> {
|
||||||
|
|
|
@ -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)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -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),
|
||||||
|
|
Loading…
Reference in a new issue