pub enum McCommand {
Show 13 variants
PackageVersionReq,
PackageVersionAns(PackageVersion),
McGroupStatusReq {
req_group_mask: u8,
},
McGroupStatusAns {
ans_group_mask: u8,
nb_total_groups: u8,
},
McGroupStatusItem {
mc_group_id: u8,
mc_addr: u32,
},
McGroupSetupReq {
mc_group_id: u8,
mc_addr: u32,
mc_key_encrypted: [u8; 16],
min_mc_fcnt: u32,
max_mc_fcnt: u32,
},
McGroupSetupAns {
mc_group_id: u8,
id_error: bool,
},
McGroupDeleteReq {
mc_group_id: u8,
},
McGroupDeleteAns {
mc_group_id: u8,
group_undefined: bool,
},
McClassCSessionReq {
mc_group_id: u8,
session_time: u32,
time_out: u8,
dl_frequency_hz: u32,
data_rate: u8,
},
McClassCSessionAns {
status: SessionStatus,
time_to_start: Option<u32>,
},
McClassBSessionReq {
mc_group_id: u8,
session_time: u32,
time_out: u8,
periodicity: u8,
dl_frequency_hz: u32,
data_rate: u8,
},
McClassBSessionAns {
status: SessionStatus,
time_to_start: Option<u32>,
},
}Expand description
One command of the remote multicast setup package.
Variants§
PackageVersionReq
The server asking which version of this package the device implements.
PackageVersionAns(PackageVersion)
The device’s answer, section 4.1.
McGroupStatusReq
The server asking which groups the device holds, section 4.2.
McGroupStatusAns
The device’s answer, section 4.2. The groups themselves follow in the message.
Fields
McGroupStatusItem
One group of a status answer: its identifier and its address.
McGroupSetupReq
The server creating or changing a group, section 4.3.
Fields
McGroupSetupAns
The device’s answer, section 4.3.
Fields
McGroupDeleteReq
The server deleting a group, section 4.4.
McGroupDeleteAns
The device’s answer, section 4.4.
McClassCSessionReq
The server opening a Class C window on a group, section 4.5.
Fields
McClassCSessionAns
The device’s answer, section 4.5.
Fields
status: SessionStatusWhat the device made of it.
McClassBSessionReq
The server opening a Class B window on a group, section 4.6.
Fields
McClassBSessionAns
The device’s answer, section 4.6.
Fields
status: SessionStatusWhat the device made of it.
Implementations§
Source§impl McCommand
impl McCommand
Sourcepub const fn direction(&self) -> Direction
pub const fn direction(&self) -> Direction
Which way this command travels.
§Returns
Direction::Uplink for what a device sends, Direction::Downlink for what a
server sends.
Sourcepub fn parse(
direction: Direction,
bytes: &[u8],
) -> Result<(McCommand, usize), LorawanError>
pub fn parse( direction: Direction, bytes: &[u8], ) -> Result<(McCommand, usize), LorawanError>
Reads one command from the front of a message.
A status answer reads only its own byte: the groups it covers follow as
McCommand::McGroupStatusItem records, five bytes each, which
McCommand::status_item reads.
§Arguments
direction- which way the frame carrying it traveled.bytes- the message, from this command’s identifier on.
§Returns
The command and how many bytes it took.
§Errors
LorawanError::MalformedFrame when the message ends inside the command, and
LorawanError::UnknownCommand for an identifier this package does not define.
Sourcepub fn status_item(bytes: &[u8]) -> Result<(McCommand, usize), LorawanError>
pub fn status_item(bytes: &[u8]) -> Result<(McCommand, usize), LorawanError>
Reads one group record of a status answer, section 4.2.
§Arguments
bytes- the message from the record on, five bytes or more.
§Returns
The record and how many bytes it took.
§Errors
LorawanError::MalformedFrame when the message ends inside the record.
Sourcepub fn encode(&self, out: &mut [u8]) -> Result<usize, LorawanError>
pub fn encode(&self, out: &mut [u8]) -> Result<usize, LorawanError>
Writes this command out.
§Arguments
out- where to write it, at leastMAX_COMMANDbytes for any command.
§Returns
How many bytes were written.
§Errors
LorawanError::PayloadTooLong when the buffer is too small.