summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorShreshta Manu <shreshtabm@google.com>2023-12-13 05:05:32 +0000
committerShreshta Manu <shreshtabm@google.com>2023-12-13 06:29:00 +0000
commit5100eb322e6fa1ed6dc7db36501a42774de885ef (patch)
tree38957bc15fe1779c276bcfdce3f459a2c3b7d7b0
parent086d9d99931d4f9379d29e1709862829f340ef74 (diff)
downloaduwb-5100eb322e6fa1ed6dc7db36501a42774de885ef.tar.gz
[uwb] Anchor location denoted by WGS-84 uses 12 bytes
WGS-84 coordrinate system uses 12 bytes, relaive coodrinate uses 10 bytes Bug: 316045753 Test: unit test and verified with latest UCI spec Change-Id: I25dd84f8890aa174948442e7b769b9711f971533
-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,]
);
}