summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorShreshta Manu <shreshtabm@google.com>2023-12-13 23:09:07 +0000
committerAutomerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>2023-12-13 23:09:07 +0000
commite7901de8d3daeffab3a11abb49d55a059467fc64 (patch)
tree3938001f6734ada5f3edb43d97589a8f4749d45f
parent941befa9bc6ba939ffe2a91a10be14df725b2343 (diff)
parent4de1a5c38a58629f2f9308f964f412c4773e687c (diff)
downloaduwb-e7901de8d3daeffab3a11abb49d55a059467fc64.tar.gz
[uwb] Anchor location denoted by WGS-84 uses 12 bytes am: 4de1a5c38a
Original change: https://android-review.googlesource.com/c/platform/external/uwb/+/2873474 Change-Id: I91c82fe912d8b70140d96e203143002bc20019a8 Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
-rw-r--r--src/rust/uwb_uci_packets/src/lib.rs21
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,]
);
}