MCPcopy Create free account
hub / github.com/chirpstack/chirpstack / to_u8

Method to_u8

lrwn/src/maccommand.rs:85–118  ·  view source on GitHub ↗
(&self)

Source from the content-addressed store, hash-verified

83
84impl CID {
85 pub fn to_u8(&self) -> u8 {
86 match self {
87 // LoRaWAN
88 CID::ResetInd | CID::ResetConf => 0x01,
89 CID::LinkCheckReq | CID::LinkCheckAns => 0x02,
90 CID::LinkADRReq | CID::LinkADRAns => 0x03,
91 CID::DutyCycleReq | CID::DutyCycleAns => 0x04,
92 CID::RxParamSetupReq | CID::RxParamSetupAns => 0x05,
93 CID::DevStatusReq | CID::DevStatusAns => 0x06,
94 CID::NewChannelReq | CID::NewChannelAns => 0x07,
95 CID::RxTimingSetupReq | CID::RxTimingSetupAns => 0x08,
96 CID::TxParamSetupReq | CID::TxParamSetupAns => 0x09,
97 CID::DlChannelReq | CID::DlChannelAns => 0x0a,
98 CID::RekeyConf | CID::RekeyInd => 0x0b,
99 CID::ADRParamSetupReq | CID::ADRParamSetupAns => 0x0c,
100 CID::DeviceTimeReq | CID::DeviceTimeAns => 0x0d,
101 CID::ForceRejoinReq => 0x0e,
102 CID::RejoinParamSetupReq | CID::RejoinParamSetupAns => 0x0f,
103 CID::PingSlotInfoReq | CID::PingSlotInfoAns => 0x10,
104 CID::PingSlotChannelReq | CID::PingSlotChannelAns => 0x11,
105 CID::BeaconFreqReq | CID::BeaconFreqAns => 0x13, // 0x12 is deprecated
106 CID::DeviceModeInd | CID::DeviceModeConf => 0x20,
107 // Relay
108 CID::RelayConfReq | CID::RelayConfAns => 0x40,
109 CID::EndDeviceConfReq | CID::EndDeviceConfAns => 0x41,
110 CID::FilterListReq | CID::FilterListAns => 0x42,
111 CID::UpdateUplinkListReq | CID::UpdateUplinkListAns => 0x43,
112 CID::CtrlUplinkListReq | CID::CtrlUplinkListAns => 0x44,
113 CID::ConfigureFwdLimitReq | CID::ConfigureFwdLimitAns => 0x45,
114 CID::NotifyNewEndDeviceReq => 0x46,
115 // Raw
116 CID::Raw => 0xff,
117 }
118 }
119
120 pub fn from_u8(uplink: bool, v: u8) -> Result<Self> {
121 Ok(if uplink {

Callers 13

filter_mac_commandsFunction · 0.45
set_pendingFunction · 0.45
get_pendingFunction · 0.45
serializeFunction · 0.45
handleFunction · 0.45
handleFunction · 0.45
handleFunction · 0.45
handleFunction · 0.45
handleFunction · 0.45
to_vecMethod · 0.45
encodeMethod · 0.45

Calls

no outgoing calls

Tested by

no test coverage detected