diff --git a/crates/core/src/bcudp/xml.rs b/crates/core/src/bcudp/xml.rs index ba5daea..82ad353 100644 --- a/crates/core/src/bcudp/xml.rs +++ b/crates/core/src/bcudp/xml.rs @@ -150,7 +150,7 @@ pub struct D2cCr { /// Called timer but not sure what it is a timer of pub timer: Timer, /// Unknown seems to be 0 on success and -3 on fail - pub rsp: u32, + pub rsp: i32, /// Client ID pub cid: i32, /// Camera ID @@ -358,7 +358,7 @@ pub struct D2cCfm { /// Type of connection observed values are `"local"` pub conn: String, /// Unknown known values are `0`, `-3, seems to be 0 on success and -3 on fail` - pub rsp: u32, + pub rsp: i32, /// The client connection ID pub cid: i32, /// The camera connection ID @@ -377,7 +377,7 @@ pub struct C2rCfm { /// Type of connection observed values are `"local"` pub conn: String, /// Unknown known values are `0`, `-3, seems to be 0 on success and -3 on fail` - pub rsp: u32, + pub rsp: i32, /// The client connection ID pub cid: i32, /// The camera connection ID @@ -439,3 +439,39 @@ pub struct D2cHb { /// The camera connection ID pub did: i32, } + +/// This test was added because of issues with Argus3 during discovery +#[test] +fn test_d2c_c_r_deser() { + let sample = indoc::indoc!( + r#" + + + + 3000 + 20000 + 60000 + + 0 + -376737975 + 49 + + + "# + ); + let b: UdpXml = UdpXml::try_parse(sample.as_bytes()).unwrap(); + + assert_matches::assert_matches!( + b, + UdpXml::D2cCr(D2cCr { + timer: Timer { + def: 3000, + hb: 20000, + hbt: 60000, + }, + rsp: 0, + cid: -376737975, + did: 49, + }) + ); +}