add rflink32 support

This commit is contained in:
Robin Appelman 2024-05-07 22:37:20 +02:00
commit a5bb4b1d80
5 changed files with 140 additions and 1 deletions

View file

@ -9,10 +9,18 @@ pub enum Topic {
Result(Device),
Other(String),
Status(Device),
Msg(Device),
}
impl From<&str> for Topic {
fn from(raw: &str) -> Self {
if let Some(rf_name) = raw.strip_suffix("/msg") {
let device = Device {
hostname: rf_name.to_string(),
};
return Topic::Msg(device);
}
let mut parts = raw.split('/');
if let (Some(prefix), Some(hostname), Some(cmd)) =
(parts.next(), parts.next(), parts.next())