summaryrefslogtreecommitdiff
path: root/src/rust/uwb_uci_packets
diff options
context:
space:
mode:
authorAyush Jain <ayushjain@google.com>2023-02-24 08:51:28 +0000
committerAyush Jain <ayushjain@google.com>2023-02-24 23:33:34 +0000
commita39b3547cc4031896ba789091a169e3a9881ac80 (patch)
treedc97f85f370d668d94b7705fbbe4aa32374bcccc /src/rust/uwb_uci_packets
parentfae0533ee10bdc5b142e8f815b759fc419cfdc7b (diff)
downloaduwb-a39b3547cc4031896ba789091a169e3a9881ac80.tar.gz
Fixes for DATA_MESSAGE_SND
1) Fix the UCI Data Packet header length extracted during fragmentation. 2) Fix the payload data size definition in the Data Message (SND/RCV) packets. It cannot be larger than the size defined in the UCI spec (even for an unfragmented packet). Test: atest Bug: 268567239 Change-Id: I274e37d2018348c9570b3eab006274d086988161
Diffstat (limited to 'src/rust/uwb_uci_packets')
-rw-r--r--src/rust/uwb_uci_packets/src/lib.rs4
-rw-r--r--src/rust/uwb_uci_packets/uci_packets.pdl4
2 files changed, 5 insertions, 3 deletions
diff --git a/src/rust/uwb_uci_packets/src/lib.rs b/src/rust/uwb_uci_packets/src/lib.rs
index d88de5e..7b3aee0 100644
--- a/src/rust/uwb_uci_packets/src/lib.rs
+++ b/src/rust/uwb_uci_packets/src/lib.rs
@@ -33,6 +33,8 @@ const MAX_PAYLOAD_LEN: usize = 255;
pub const UCI_PACKET_HAL_HEADER_LEN: usize = 4;
// Unfragmented UCI packet header len.
const UCI_PACKET_HEADER_LEN: usize = 7;
+// Unfragmented UCI DATA_MESSAGE_SND packet header len.
+const UCI_DATA_SND_PACKET_HEADER_LEN: usize = 6;
// Opcode field byte position (within UCI packet header) and mask (of bits to be used).
const UCI_CONTROL_PACKET_HEADER_OPCODE_BYTE_POSITION: usize = 1;
@@ -498,7 +500,7 @@ impl From<UciDataSndPacket> for Vec<UciDataPacketHalPacket> {
let dpf = packet.get_data_packet_format().into();
// get payload by stripping the header.
- let payload = packet.to_bytes().slice(UCI_PACKET_HEADER_LEN..);
+ let payload = packet.to_bytes().slice(UCI_DATA_SND_PACKET_HEADER_LEN..);
if payload.is_empty() {
fragments.push(
UciDataPacketHalBuilder {
diff --git a/src/rust/uwb_uci_packets/uci_packets.pdl b/src/rust/uwb_uci_packets/uci_packets.pdl
index ef694a7..da388f8 100644
--- a/src/rust/uwb_uci_packets/uci_packets.pdl
+++ b/src/rust/uwb_uci_packets/uci_packets.pdl
@@ -447,7 +447,7 @@ packet UciDataSnd : UciDataPacket (data_packet_format = DATA_SND, message_type =
dest_mac_address: 64,
dest_fira_component: FiraComponent,
uci_sequence_number: 8,
- _size_(data): 32,
+ _size_(data): 16,
data: 8[]
}
@@ -458,7 +458,7 @@ packet UciDataRcv : UciDataPacket (data_packet_format = DATA_RCV, message_type =
source_mac_address: 64,
source_fira_component: FiraComponent,
dest_fira_component: FiraComponent,
- _size_(data): 32,
+ _size_(data): 16,
data: 8[]
}