Convert RawPacket into ImprovPacket
This commit is contained in:
@@ -11,14 +11,13 @@ use hex;
|
||||
use improv_setup::improv::{
|
||||
IMPROV_HEADER,
|
||||
IMPROV_VERSION,
|
||||
PacketType,
|
||||
RPCCommand,
|
||||
CurrentState,
|
||||
calculate_checksum,
|
||||
ImprovDataToPacket,
|
||||
ImprovDataFromPacket,
|
||||
RawPacket,
|
||||
CurrentStateResponse,
|
||||
ImprovPacket,
|
||||
RequestCurrentStateCommand,
|
||||
};
|
||||
use log::{
|
||||
@@ -149,9 +148,7 @@ async fn main() -> Result<()>{
|
||||
// type
|
||||
println!("Type: {}", &raw_packet.r#type);
|
||||
|
||||
if raw_packet.r#type == PacketType::CurrentState {
|
||||
let current_state_response = CurrentStateResponse::try_from_raw_packet(&raw_packet).unwrap();
|
||||
|
||||
if let ImprovPacket::CurrentStateResponse(current_state_response) = ImprovPacket::try_from_raw_packet(&raw_packet).unwrap() {
|
||||
println!("Current state: {}", ¤t_state_response.current_state);
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user