From 5dd0d35218440a1ab391f566cc95cbc233ccbe8e Mon Sep 17 00:00:00 2001 From: Bhautik Ardeshana Date: Tue, 30 May 2023 17:32:40 +0530 Subject: CR490 Implementation: add tx_count to the DATA_TRANSFER_STATUS_NTF Bug: 274711916 Test: Test data transfer Change-Id: Ieb2354fe4f10e79f3c2b01a6b39cf33ab4e795c4 --- src/rust/uwb_core/src/session/session_manager.rs | 1 + src/rust/uwb_core/src/uci/notification.rs | 3 +++ src/rust/uwb_core/src/uci/uci_manager.rs | 9 +++++++++ src/rust/uwb_uci_packets/uci_packets.pdl | 7 ++++--- 4 files changed, 17 insertions(+), 3 deletions(-) diff --git a/src/rust/uwb_core/src/session/session_manager.rs b/src/rust/uwb_core/src/session/session_manager.rs index 104d3f3..e49dd9c 100644 --- a/src/rust/uwb_core/src/session/session_manager.rs +++ b/src/rust/uwb_core/src/session/session_manager.rs @@ -376,6 +376,7 @@ impl SessionManagerActor { session_token, uci_sequence_number: _, status: _, + tx_count: _, } => { match self.active_sessions.get(&session_token) { Some(_) => { diff --git a/src/rust/uwb_core/src/uci/notification.rs b/src/rust/uwb_core/src/uci/notification.rs index 2e955f6..eab8233 100644 --- a/src/rust/uwb_core/src/uci/notification.rs +++ b/src/rust/uwb_core/src/uci/notification.rs @@ -85,6 +85,8 @@ pub enum SessionNotification { uci_sequence_number: u8, /// Data Transfer Status Code status: DataTransferNtfStatusCode, + /// Transmission count + tx_count: u8, }, } @@ -271,6 +273,7 @@ impl TryFrom for SessionNotificatio session_token: evt.get_session_token(), uci_sequence_number: evt.get_uci_sequence_number(), status: evt.get_status(), + tx_count: evt.get_tx_count(), }) } _ => { diff --git a/src/rust/uwb_core/src/uci/uci_manager.rs b/src/rust/uwb_core/src/uci/uci_manager.rs index f2563eb..24c0737 100644 --- a/src/rust/uwb_core/src/uci/uci_manager.rs +++ b/src/rust/uwb_core/src/uci/uci_manager.rs @@ -1179,6 +1179,7 @@ impl UciManagerActor { session_token: _, uci_sequence_number: _, status: _, + tx_count: _, } => { // Reset the UciDataSnd Retryer since we received a DataTransferStatusNtf. let _ = self.uci_data_snd_retryer.take(); @@ -1233,10 +1234,12 @@ impl UciManagerActor { session_token, uci_sequence_number, status, + tx_count, } => Ok(SessionNotification::DataTransferStatus { session_token: self.get_session_id(&session_token).await?, uci_sequence_number, status, + tx_count, }), SessionNotification::DataCredit { session_token, credit_availability } => { Ok(SessionNotification::DataCredit { @@ -2760,6 +2763,7 @@ mod tests { 0x01, 0x02, 0x03, // AppData ]; let status = DataTransferNtfStatusCode::UciDataTransferStatusRepetitionOk; + let tx_count = 0x00; let (uci_manager, mut mock_hal) = setup_uci_manager_with_session_active( |mut hal| async move { @@ -2776,6 +2780,7 @@ mod tests { // TODO(b/282230468): Remove the u16-to-u8 conversion once spec is updated. uci_sequence_number: uci_sequence_number.try_into().unwrap(), status, + tx_count, }, )); hal.expected_send_packet(data_packet_snd, ntfs, Ok(())); @@ -2819,6 +2824,7 @@ mod tests { ]; let mut expected_data_snd_payload_fragment_2 = Vec::new(); let status = DataTransferNtfStatusCode::UciDataTransferStatusRepetitionOk; + let tx_count = 0x00; // Setup the app data for both the Tx data packet and expected packet fragments. let app_data_len_fragment_1 = 255 - expected_data_snd_payload_fragment_1.len(); @@ -2865,6 +2871,7 @@ mod tests { // TODO(b/282230468): Remove the u16-to-u8 conversion once spec is updated. uci_sequence_number: uci_sequence_number.try_into().unwrap(), status, + tx_count, }, )); hal.expected_send_packet(data_packet_snd_fragment_2, ntfs, Ok(())); @@ -2892,6 +2899,7 @@ mod tests { let oid = 0x0; let session_id = 0x5; let session_token = 0x5; + let tx_count = 0x01; let dest_mac_address = vec![0xa0, 0xb0, 0xc0, 0xd0, 0xa1, 0xb1, 0xc1, 0xd1]; let uci_sequence_number: u16 = 0xa; let app_data = vec![0x01, 0x02, 0x03]; @@ -2927,6 +2935,7 @@ mod tests { // TODO(b/282230468): Remove the u16-to-u8 conversion once spec is updated. uci_sequence_number: uci_sequence_number.try_into().unwrap(), status, + tx_count, }, )); hal.expected_send_packet(data_packet_snd, ntfs, Ok(())); diff --git a/src/rust/uwb_uci_packets/uci_packets.pdl b/src/rust/uwb_uci_packets/uci_packets.pdl index cca8612..12bdb6c 100644 --- a/src/rust/uwb_uci_packets/uci_packets.pdl +++ b/src/rust/uwb_uci_packets/uci_packets.pdl @@ -248,7 +248,8 @@ enum AppConfigTlvType : 8 { RFU_APP_CFG_TLV_TYPE_RANGE_1 = 0x3D..0x44, SESSION_KEY = 0x45, SUBSESSION_KEY = 0x46, - RFU_APP_CFG_TLV_TYPE_RANGE_2 = 0x47..0x9F, + SESSION_DATA_TRANSFER_STATUS_NTF_CONFIG = 0x47, + RFU_APP_CFG_TLV_TYPE_RANGE_2 = 0x48..0x9F, VENDOR_SPECIFIC_APP_CFG_TLV_TYPE_RANGE_1 = 0xA0..0xDF { // CCC specific @@ -974,11 +975,11 @@ packet DataTransferStatusNtf : SessionControlNotification (opcode = 0x05) { // S session_token: 32, // Session ID or Session Handle (based on UWBS version) uci_sequence_number: 8, status: DataTransferNtfStatusCode, - // TODO(b/269779288): Add the tx_count field for implementing the DATA_REPETITION added in CR490. + tx_count: 8, } test DataTransferStatusNtf { - "\x62\x05\x00\x06\x00\x00\x00\x00\x00\x00\x01\x01\x00", + "\x62\x05\x00\x06\x00\x00\x00\x00\x00\x00\x01\x01\x00\x00", } packet SessionQueryMaxDataSizeCmd : SessionConfigCommand (opcode = 0xB) { //QUERY_MAX_DATA_SIZE -- cgit v1.2.3