diff options
author | Shreshta Manu <shreshtabm@google.com> | 2023-12-13 18:29:04 +0000 |
---|---|---|
committer | Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com> | 2023-12-13 18:29:04 +0000 |
commit | 1734eab8c0c1c9402d43dd075d1b19c624087995 (patch) | |
tree | 3938001f6734ada5f3edb43d97589a8f4749d45f | |
parent | c040bef3c933e92e48fe7f87d12532fce6a52b07 (diff) | |
parent | 5100eb322e6fa1ed6dc7db36501a42774de885ef (diff) | |
download | uwb-1734eab8c0c1c9402d43dd075d1b19c624087995.tar.gz |
[uwb] Anchor location denoted by WGS-84 uses 12 bytes am: 5100eb322e
Original change: https://googleplex-android-review.googlesource.com/c/platform/external/uwb/+/25639139
Change-Id: I4ca0f102c9868d9f8b30e24bd81a256810d0ae06
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
-rw-r--r-- | src/rust/uwb_uci_packets/src/lib.rs | 21 |
1 files changed, 11 insertions, 10 deletions
diff --git a/src/rust/uwb_uci_packets/src/lib.rs b/src/rust/uwb_uci_packets/src/lib.rs index d3e7c8a..eab7f9f 100644 --- a/src/rust/uwb_uci_packets/src/lib.rs +++ b/src/rust/uwb_uci_packets/src/lib.rs @@ -128,8 +128,8 @@ impl DlTdoaRangingMeasurement { let initiator_responder_tof = extract_u16(bytes, &mut ptr, 2)?; let dt_location_type = (message_control >> 5) & 0x3; let dt_anchor_location = match DTAnchorLocationType::from_u16(dt_location_type)? { - DTAnchorLocationType::Wgs84 => extract_vec(bytes, &mut ptr, 10)?, - DTAnchorLocationType::Relative => extract_vec(bytes, &mut ptr, 12)?, + DTAnchorLocationType::Wgs84 => extract_vec(bytes, &mut ptr, 12)?, + DTAnchorLocationType::Relative => extract_vec(bytes, &mut ptr, 10)?, _ => vec![], }; let active_ranging_rounds = ((message_control >> 7) & 0xf) as u8; @@ -1035,7 +1035,7 @@ mod tests { // All Fields in Little Endian (LE) // First measurement 0x0a, 0x01, 0x33, 0x05, // 2(Mac address), Status, Message Type - 0x33, 0x05, 0x02, 0x05, // 2(Message control), 2(Block Index) + 0x53, 0x05, 0x02, 0x05, // 2(Message control), 2(Block Index) 0x07, 0x09, 0x0a, 0x01, // Round Index, NLoS, 2(AoA Azimuth) 0x02, 0x05, 0x07, 0x09, // AoA Azimuth FOM, 2(AoA Elevation), AoA Elevation FOM 0x0a, 0x01, 0x02, 0x05, // RSSI, 3(Tx Timestamp..) @@ -1064,9 +1064,10 @@ mod tests { 0x0a, 0x01, 0x02, 0x05, // 2(Responder Reply Time), 2(Initiator-Responder ToF) 0x07, 0x09, 0x07, 0x09, // 4(Anchor Location..) 0x05, 0x07, 0x09, 0x0a, // 4(Anchor Location..) - 0x01, 0x02, 0x05, 0x07, // 2(Anchor Location..), 2(Active Ranging Rounds..) - 0x09, 0x0a, 0x01, 0x02, // 4(Active Ranging Rounds..) - 0x05, 0x07, 0x09, 0x05, // 4(Active Ranging Rounds) + 0x01, 0x02, 0x01, 0x02, // 4(Anchor Location) + 0x05, 0x07, 0x09, 0x0a, // 4(Active Ranging Rounds..) + 0x01, 0x02, 0x05, 0x07, // 4(Active Ranging Rounds..) + 0x09, 0x05, // 2(Active Ranging Rounds) ]; let measurements = ShortAddressDlTdoaRangingMeasurement::parse(&bytes, 2).unwrap(); @@ -1076,7 +1077,7 @@ mod tests { assert_eq!(*mac_address_1, 0x010a); assert_eq!(measurement_1.status, 0x33); assert_eq!(measurement_1.message_type, 0x05); - assert_eq!(measurement_1.message_control, 0x0533); + assert_eq!(measurement_1.message_control, 0x0553); assert_eq!(measurement_1.block_index, 0x0502); assert_eq!(measurement_1.round_index, 0x07); assert_eq!(measurement_1.nlos, 0x09); @@ -1123,11 +1124,11 @@ mod tests { assert_eq!(measurement_2.responder_reply_time, 0x010a0907); assert_eq!(measurement_2.initiator_responder_tof, 0x0502); assert_eq!( - measurement_1.dt_anchor_location, - vec![0x07, 0x09, 0x07, 0x09, 0x05, 0x07, 0x09, 0x0a, 0x01, 0x02] + measurement_2.dt_anchor_location, + vec![0x07, 0x09, 0x07, 0x09, 0x05, 0x07, 0x09, 0x0a, 0x01, 0x02, 0x01, 0x02] ); assert_eq!( - measurement_1.ranging_rounds, + measurement_2.ranging_rounds, vec![0x05, 0x07, 0x09, 0x0a, 0x01, 0x02, 0x05, 0x07, 0x09, 0x05,] ); } |