Generate response structs from packet

This commit is contained in:
2024-12-18 20:00:26 +01:00
parent 7b7c85f976
commit 9a2b76864c
2 changed files with 47 additions and 4 deletions

View File

@@ -16,7 +16,9 @@ use improv_setup::improv::{
CurrentState,
calculate_checksum,
ImprovDataToPacket,
ImprovDataFromPacket,
ImprovPacket,
CurrentStateResponse,
RequestCurrentStateCommand,
};
use log::{
@@ -148,8 +150,9 @@ async fn main() -> Result<()>{
println!("Type: {}", &improv_packet.r#type);
if improv_packet.r#type == PacketType::CurrentState {
let current_state = CurrentState::try_from(&improv_packet.data[0]).unwrap();
println!("Current state: {}", &current_state);
let current_state_response = CurrentStateResponse::try_from_packet(&improv_packet).unwrap();
println!("Current state: {}", &current_state_response.current_state);
}
},