summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAyush Jain <ayushjain@google.com>2023-10-16 23:01:18 +0000
committerAyush Jain <ayushjain@google.com>2023-12-02 01:08:26 +0000
commitdfd3cad11eccdec2205714586c32cb7ef9af54ab (patch)
treeba94f6b8ab1f5b4032fd71c21a26cb59baafb891
parent9eb6fe4f424198656c1e6ac53f7d762f61461751 (diff)
downloaduwb-dfd3cad11eccdec2205714586c32cb7ef9af54ab.tar.gz
Store UCI CORE_GET_DEVICE_INFO RSP.
This will be used in a future CL to determine the UWBS UCI version, and based on that parse the Capability tags in a CORE_GET_CAPS_INFO RSP. Confirmed with debug logs (not submitted) that the response is stored: 12-02 01:06:20.037 1653 2381 D uwb : uwb_core::uci::uci_manager: AKJ: will call open_hal() 12-02 01:06:20.048 1653 2381 D uwb : uwb_core::uci::uci_manager: AKJ: open_hal() succeeded, will call core_get_device_info() 12-02 01:06:20.049 1653 3670 D uwb : uwb_core::uci::uci_manager: AKJ: store_if_uwbs_device_info called 12-02 01:06:20.049 1653 3670 D uwb : uwb_core::uci::uci_manager: AKJ: get_device_info_rsp = Some(GetDeviceInfoResponse { status: UciStatusOk, uci_version: 4097, mac_version: 4097, phy_version: 4097, uci_test_version: 4097, vendor_spec_info: [] }) Test: atest libuwb_uci_jni_rust_tests libuwb_core_tests libuwb_uci_packet_tests Test: Manual Bug: 301834443 Change-Id: I4376679287247fabb1192be95e95c4510b52f397
-rw-r--r--src/rust/uwb_core/src/uci/uci_manager.rs13
1 files changed, 13 insertions, 0 deletions
diff --git a/src/rust/uwb_core/src/uci/uci_manager.rs b/src/rust/uwb_core/src/uci/uci_manager.rs
index 4ec189f..471f62e 100644
--- a/src/rust/uwb_core/src/uci/uci_manager.rs
+++ b/src/rust/uwb_core/src/uci/uci_manager.rs
@@ -707,6 +707,10 @@ struct UciManagerActor<T: UciHal, U: UciLogger> {
// session related commands. This map stores the app provided session id to UWBS generated
// session handle mapping if provided, else reuses session id.
session_id_to_token_map: Arc<Mutex<HashMap<SessionId, SessionToken>>>,
+
+ // Used to store the UWBS response for the UCI CMD CORE_GET_DEVICE_INFO. This will help us
+ // identify the UWBS supported UCI version and change our behavior accordingly.
+ get_device_info_rsp: Option<GetDeviceInfoResponse>,
}
impl<T: UciHal, U: UciLogger> UciManagerActor<T, U> {
@@ -742,6 +746,7 @@ impl<T: UciHal, U: UciLogger> UciManagerActor<T, U> {
radar_data_rcv_notf_sender: mpsc::unbounded_channel().0,
last_init_session_id: None,
session_id_to_token_map,
+ get_device_info_rsp: None,
}
}
@@ -845,6 +850,13 @@ impl<T: UciHal, U: UciLogger> UciManagerActor<T, U> {
Ok(())
}
+ // Store the GET_DEVICE_INFO RSP from UWBS.
+ fn store_if_uwbs_device_info(&mut self, resp: &UciResponse) {
+ if let UciResponse::CoreGetDeviceInfo(Ok(get_device_info_rsp)) = resp {
+ self.get_device_info_rsp = Some(get_device_info_rsp.clone());
+ }
+ }
+
async fn handle_cmd(
&mut self,
cmd: UciManagerCmd,
@@ -1196,6 +1208,7 @@ impl<T: UciHal, U: UciLogger> UciManagerActor<T, U> {
error!("Session init response received without a sesson id stored! Something has gone badly wrong: {:?}", resp);
return;
}
+ self.store_if_uwbs_device_info(&resp);
if let Some(uci_cmd_retryer) = self.uci_cmd_retryer.take() {
uci_cmd_retryer.send_result(Ok(resp));