jacdac_rs/transport/
service_command.rs1#[derive(Debug)]
2pub enum ServiceCommand {
3 Action(u16),
4 RegisterRead(u16),
5 RegisterWrite(u16),
6 Reserved(u16),
7 Events(u16),
8}
9
10impl From<u16> for ServiceCommand {
11 fn from(value: u16) -> Self {
12 match value & 0xF000 {
13 0x0000 => ServiceCommand::Action(value),
14 0x1000 => ServiceCommand::RegisterRead(value),
15 0x2000 => ServiceCommand::RegisterWrite(value),
16 0x3000 | 0x4000 | 0x5000 | 0x6000 | 0x7000 => ServiceCommand::Reserved(value),
17 _ => ServiceCommand::Events(value),
18 }
19 }
20}