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

Method to_le_bytes

lrwn/src/fhdr.rs:111–132  ·  view source on GitHub ↗
(&self)

Source from the content-addressed store, hash-verified

109 }
110
111 pub fn to_le_bytes(&self) -> Result<[u8; 1]> {
112 if self.f_opts_len > 15 {
113 return Err(anyhow!("max value of f_opts_len is 15"));
114 }
115
116 let mut b: u8 = 0;
117 if self.adr {
118 b |= 0x80;
119 }
120 if self.adr_ack_req {
121 b |= 0x40;
122 }
123 if self.ack {
124 b |= 0x20;
125 }
126 if self.class_b || self.f_pending {
127 b |= 0x10;
128 }
129 b |= self.f_opts_len & 0x0f;
130
131 Ok([b])
132 }
133}
134
135#[cfg(test)]

Callers 15

get_ping_offsetFunction · 0.45
to_bytesMethod · 0.45
encodeMethod · 0.45
get_s_keyFunction · 0.45
get_js_keyFunction · 0.45
to_vecMethod · 0.45
to_vecMethod · 0.45
encode_freqFunction · 0.45
to_vecMethod · 0.45

Calls

no outgoing calls

Tested by

no test coverage detected