fix: TryFrom will now translate into an Unknown if command group is not known
This commit is contained in:
parent
a69d80f01c
commit
4be6659662
1 changed files with 2 additions and 1 deletions
|
@ -1,4 +1,5 @@
|
||||||
use std::io;
|
use std::io;
|
||||||
|
use std::os::linux::raw;
|
||||||
use crate::commands::property_control::PropertyControlCommand;
|
use crate::commands::property_control::PropertyControlCommand;
|
||||||
use crate::commands::node_management::NodeManagementCommand;
|
use crate::commands::node_management::NodeManagementCommand;
|
||||||
use crate::commands::raw_data_transmission::RawDataTransmission;
|
use crate::commands::raw_data_transmission::RawDataTransmission;
|
||||||
|
@ -40,7 +41,7 @@ impl TryFrom<RawPacket> for PacketData {
|
||||||
0x0 => Ok(PacketData::NodeManagement(NodeManagementCommand::try_from(raw_packet)?)),
|
0x0 => Ok(PacketData::NodeManagement(NodeManagementCommand::try_from(raw_packet)?)),
|
||||||
0x1 => Ok(PacketData::PropertyControl(PropertyControlCommand::try_from(raw_packet)?)),
|
0x1 => Ok(PacketData::PropertyControl(PropertyControlCommand::try_from(raw_packet)?)),
|
||||||
0xF => Ok(PacketData::RawDataTransmission(RawDataTransmission::try_from(raw_packet)?)),
|
0xF => Ok(PacketData::RawDataTransmission(RawDataTransmission::try_from(raw_packet)?)),
|
||||||
_ => Err(io::Error::new(io::ErrorKind::InvalidInput, "command group is unsupported"))
|
_ => Ok(PacketData::Unknown(raw_packet.data))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
Loading…
Reference in a new issue