summaryrefslogtreecommitdiff
path: root/src/rust/uwb_uci_packets
diff options
context:
space:
mode:
authorAyush Jain <ayushjain@google.com>2023-02-16 19:43:34 +0000
committerAyush Jain <ayushjain@google.com>2023-02-16 19:55:32 +0000
commitfae0533ee10bdc5b142e8f815b759fc419cfdc7b (patch)
tree6d3832a75f5ef086cd3bfc6a837d35ac45997bc4 /src/rust/uwb_uci_packets
parent73d63c7eb0135853a1f4f2609ebf91fe5635fd64 (diff)
downloaduwb-fae0533ee10bdc5b142e8f815b759fc419cfdc7b.tar.gz
Change order of HAL Data/Control packet definition
The UCI HAL Data packet has a constraint for the message_type field, while the UCI HAL Control packet deson't (because it covers multiple values). This leads to parsing errors for the UCI HAL data packet. The workaround for this issue is to switch the order of these definitions. This will result in packet bytes first being attempted to be parsed as a UCI HAL Data packet, and then as a Control packet. The code was tested by injecting Data packets in the UciManager (on a HAL Open), and verified that the UWBSessionManager.onDataReceived() is called. Tested for both unfragmented and fragmented data Rx packets (https://paste.googleplex.com/5893713451548672). Bug: 266016401, 269175546 Test: atest ServiceUwbTests FrameworkUwbTests Change-Id: I887c9c9f2918f62e0260a3d3b79b225e5591a131
Diffstat (limited to 'src/rust/uwb_uci_packets')
-rw-r--r--src/rust/uwb_uci_packets/uci_packets.pdl15
1 files changed, 9 insertions, 6 deletions
diff --git a/src/rust/uwb_uci_packets/uci_packets.pdl b/src/rust/uwb_uci_packets/uci_packets.pdl
index bb1b529..ef694a7 100644
--- a/src/rust/uwb_uci_packets/uci_packets.pdl
+++ b/src/rust/uwb_uci_packets/uci_packets.pdl
@@ -384,17 +384,20 @@ packet UciPacketHal {
_body_
}
-packet UciControlPacketHal: UciPacketHal {
- opcode: 6,
- _reserved_: 2,
+// The UciDataPacketHal must be declared before the UciControlPacketHal for correct parsing to
+// happen. This is required as the Data packet specifies a value for the 'message_type' constraint,
+// while the Control packet does not (as it encompasses multiple 'message_type' values).
+packet UciDataPacketHal: UciPacketHal (message_type = DATA) {
_reserved_: 8,
- _size_(_payload_): 8,
+ _size_(_payload_): 16,
_payload_,
}
-packet UciDataPacketHal: UciPacketHal (message_type = DATA) {
+packet UciControlPacketHal: UciPacketHal {
+ opcode: 6,
+ _reserved_: 2,
_reserved_: 8,
- _size_(_payload_): 16,
+ _size_(_payload_): 8,
_payload_,
}