helium / semtech-udp

Apache License 2.0
9 stars 8 forks source link

Valid TX_ACKs are not decoded #77

Closed timcooijmans closed 1 year ago

timcooijmans commented 1 year ago

The SX1302 PacketForwarder Semtech GWMP protocol defines all fields in the txpk_ack JSON-structure in the TX_ACK packet as optional. (source: https://github.com/Lora-net/sx1302_hal/blob/master/packet_forwarder/PROTOCOL.md#55-tx_ack-packet)

The result is that valid packets such as {"txpk_ack":{}} are not decoded and an error is thrown. In practice we also see {"txpk_ack":{"error":""}} but we can debate if that's a valid packet or not.

Test to show issue:

fn tx_ack_deser_minimal() {
    let json = "{\"txpk_ack\":{}}";
    let parsed: Data = serde_json::from_str(json).expect("Error parsing tx_ack");
    if let Err(_) = parsed.get_result() {
        assert!(false);
    }
}
lthiery commented 1 year ago

resolved in #78