diff options
author | Matthias P. Braendli <matthias.braendli@mpb.li> | 2024-01-14 18:00:54 +0100 |
---|---|---|
committer | Matthias P. Braendli <matthias.braendli@mpb.li> | 2024-01-14 18:00:54 +0100 |
commit | f43d92a9827967b86f73f811df262fc53b75c396 (patch) | |
tree | 4e290444fddeea9dcbbb84a1f1baa6b48905093b /src | |
parent | a1cc9912e6dc80d1152e4c1eef9d00b6c2f215a1 (diff) | |
download | cats-radio-node-f43d92a9827967b86f73f811df262fc53b75c396.tar.gz cats-radio-node-f43d92a9827967b86f73f811df262fc53b75c396.tar.bz2 cats-radio-node-f43d92a9827967b86f73f811df262fc53b75c396.zip |
Move cutting the length prefix to the fake receiver
Diffstat (limited to 'src')
-rw-r--r-- | src/main.rs | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/src/main.rs b/src/main.rs index 7423e3f..42044be 100644 --- a/src/main.rs +++ b/src/main.rs @@ -42,7 +42,8 @@ async fn main() -> std::io::Result<()> { let mut buf = [0; 1024]; while let Ok((len, addr)) = sock_r.recv_from(&mut buf).await { println!("{:?} bytes received from {:?}", len, addr); - let packet = buf[..len].to_vec(); + // Cut the length prefix, which isn't returned by the real radio + let packet = buf[2..len].to_vec(); let rssi = 0f64; radio_rx_queue.send((packet, rssi)).await.expect("Inject frame"); } @@ -80,7 +81,7 @@ async fn main() -> std::io::Result<()> { while let Some((packet_data, rssi)) = packet_receive.recv().await { debug!("RX RSSI {} len {}", rssi, packet_data.len()); let mut buf = [0; MAX_PACKET_LEN]; - match ham_cats::packet::Packet::fully_decode(&packet_data[2..], &mut buf) { + match ham_cats::packet::Packet::fully_decode(&packet_data, &mut buf) { Ok(packet) => { if let Some(ident) = packet.identification() { debug!(" From {}-{}", ident.callsign, ident.ssid); |