Display visible WiFi networks

This commit is contained in:
2024-12-26 11:49:09 +01:00
parent e03dbe7165
commit 249b33c74e
2 changed files with 45 additions and 0 deletions

View File

@@ -126,6 +126,7 @@ pub enum RPCCommand {
SendWifiSettings = 0x01,
RequestCurrentState = 0x02,
RequestDeviceInformation = 0x03,
RequestScannedWiFiNetworks = 0x04,
}
impl TryFrom<&u8> for RPCCommand {
@@ -136,6 +137,7 @@ impl TryFrom<&u8> for RPCCommand {
0x01 => Ok(Self::SendWifiSettings),
0x02 => Ok(Self::RequestCurrentState),
0x03 => Ok(Self::RequestDeviceInformation),
0x04 => Ok(Self::RequestScannedWiFiNetworks),
_ => Err(anyhow!("Cannot convert to RPC command")),
}
}
@@ -240,6 +242,7 @@ pub enum ImprovPacket {
ErrorState(ErrorStatePacket),
RequestCurrentState(RequestCurrentStatePacket),
RequestDeviceInformation(RequestDeviceInformationPacket),
RequestScannedWiFiNetworks(RequestScannedWiFiNetworksPacket),
RPCResult(RPCResultPacket),
}
@@ -339,6 +342,22 @@ impl ImprovDataToPacket for RequestDeviceInformationPacket {
}
}
pub struct RequestScannedWiFiNetworksPacket {
}
impl ImprovDataPacketType for RequestScannedWiFiNetworksPacket {
const packet_type: PacketType = PacketType::RPCCommand;
}
impl ImprovDataToPacket for RequestScannedWiFiNetworksPacket {
fn to_bytes(self: &Self) -> Vec<u8> {
let mut out = Vec::new();
out.push(RPCCommand::RequestScannedWiFiNetworks as u8);
out.push(0x00); // rpc command payload length
return out;
}
}
pub struct RPCResultPacket {
pub command_responded_to: RPCCommand,
pub results: Vec<String>,