};
// TODO: the spec is inconsistent about which bit in packet[25] is EOF
// https://github.com/M17-Project/M17_spec/issues/147
- let final_frame = (packet[25] & 0x04) > 0;
- let number = packet[25] >> 3;
+ let final_frame = (packet[25] & 0x80) > 0;
+ let number = (packet[25] >> 2) & 0x1f;
let counter = if final_frame {
PacketFrameCounter::FinalFrame {
payload_len: number as usize,
match frame.counter {
PacketFrameCounter::Frame { index } => {
type1[0..25].copy_from_slice(&frame.payload);
- type1[25] = (index as u8) << 3;
+ type1[25] = (index as u8) << 2;
}
PacketFrameCounter::FinalFrame { payload_len } => {
type1[0..payload_len].copy_from_slice(&frame.payload[0..payload_len]);
- type1[25] = ((payload_len as u8) << 3) | 0x04;
+ type1[25] = ((payload_len as u8) << 2) | 0x80;
}
}
let type3 = fec::encode(&type1, 206, p_3);