Convert RawPacket into ImprovPacket
This commit is contained in:
@@ -185,6 +185,23 @@ impl RawPacket {
|
||||
}
|
||||
}
|
||||
|
||||
pub enum ImprovPacket {
|
||||
CurrentStateResponse(CurrentStateResponse),
|
||||
RequestCurrentStateCommand(RequestCurrentStateCommand),
|
||||
}
|
||||
|
||||
impl ImprovPacket {
|
||||
pub fn try_from_raw_packet(raw_packet: &RawPacket) -> Result<Self, &str> {
|
||||
match raw_packet.r#type {
|
||||
PacketType::CurrentState => Ok(ImprovPacket::CurrentStateResponse(CurrentStateResponse::try_from_raw_packet(raw_packet)?)),
|
||||
//PacketType::ErrorState => _,
|
||||
//PacketType::RPCCommand => _,
|
||||
//PacketType::RPCResult => _,
|
||||
_ => Err("Conversion into packet type {} not implemented"),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
pub struct CurrentStateResponse {
|
||||
pub current_state: CurrentState,
|
||||
}
|
||||
|
Reference in New Issue
Block a user