mirror of
https://github.com/Evolution-X/hardware_interfaces
synced 2026-02-01 22:04:26 +00:00
[RTT] Condition RTT Controller on availability of a STA mode
Condition creation of the RTT controller on the chip being in a mode which can support a STA (whether one is already created or one could be created). This is the default behavior on currently supported Wi-Fi devices. Note: this is part of the reference HAL implementation - it is not expected to reflect behavior of all devices. Vendors may and should replace or modify the reference HAL implementation. Bug: 79565105 Bug: 111218083 Test: ACTS RangeApSupporting11McTest:test_rtt_in_and_after_softap_mode Change-Id: If76b6598acb22f7821b34f7f1c8ae2873a6dac1d
This commit is contained in:
@@ -204,6 +204,19 @@ class WifiChipTest : public Test {
|
||||
}
|
||||
}
|
||||
|
||||
bool createRttController() {
|
||||
bool success = false;
|
||||
chip_->createRttController(
|
||||
NULL, [&success](const WifiStatus& status,
|
||||
const sp<IWifiRttController>& rtt) {
|
||||
if (WifiStatusCode::SUCCESS == status.code) {
|
||||
ASSERT_NE(rtt.get(), nullptr);
|
||||
success = true;
|
||||
}
|
||||
});
|
||||
return success;
|
||||
}
|
||||
|
||||
public:
|
||||
void SetUp() override {
|
||||
chip_ = new WifiChip(chip_id_, legacy_hal_, mode_controller_,
|
||||
@@ -386,6 +399,29 @@ TEST_F(WifiChipV1_AwareIfaceCombinationTest, ApMode_CreateNan_ShouldFail) {
|
||||
ASSERT_TRUE(createIface(IfaceType::NAN).empty());
|
||||
}
|
||||
|
||||
TEST_F(WifiChipV1IfaceCombinationTest, RttControllerFlowStaModeNoSta) {
|
||||
findModeAndConfigureForIfaceType(IfaceType::STA);
|
||||
ASSERT_TRUE(createRttController());
|
||||
}
|
||||
|
||||
TEST_F(WifiChipV1IfaceCombinationTest, RttControllerFlowStaModeWithSta) {
|
||||
findModeAndConfigureForIfaceType(IfaceType::STA);
|
||||
ASSERT_FALSE(createIface(IfaceType::STA).empty());
|
||||
ASSERT_TRUE(createRttController());
|
||||
}
|
||||
|
||||
TEST_F(WifiChipV1IfaceCombinationTest, RttControllerFlowApToSta) {
|
||||
findModeAndConfigureForIfaceType(IfaceType::AP);
|
||||
const auto ap_iface_name = createIface(IfaceType::AP);
|
||||
ASSERT_FALSE(ap_iface_name.empty());
|
||||
ASSERT_FALSE(createRttController());
|
||||
|
||||
removeIface(IfaceType::AP, ap_iface_name);
|
||||
|
||||
findModeAndConfigureForIfaceType(IfaceType::STA);
|
||||
ASSERT_TRUE(createRttController());
|
||||
}
|
||||
|
||||
////////// V2 + Aware Iface Combinations ////////////
|
||||
// Mode 1 - STA + STA/AP
|
||||
// - STA + P2P/NAN
|
||||
@@ -540,6 +576,24 @@ TEST_F(WifiChipV2_AwareIfaceCombinationTest,
|
||||
ASSERT_NE(sta_iface_name, ap_iface_name);
|
||||
}
|
||||
|
||||
TEST_F(WifiChipV2_AwareIfaceCombinationTest, RttControllerFlowStaModeNoSta) {
|
||||
findModeAndConfigureForIfaceType(IfaceType::STA);
|
||||
ASSERT_TRUE(createRttController());
|
||||
}
|
||||
|
||||
TEST_F(WifiChipV2_AwareIfaceCombinationTest, RttControllerFlowStaModeWithSta) {
|
||||
findModeAndConfigureForIfaceType(IfaceType::STA);
|
||||
ASSERT_FALSE(createIface(IfaceType::STA).empty());
|
||||
ASSERT_TRUE(createRttController());
|
||||
}
|
||||
|
||||
TEST_F(WifiChipV2_AwareIfaceCombinationTest, RttControllerFlow) {
|
||||
findModeAndConfigureForIfaceType(IfaceType::STA);
|
||||
ASSERT_FALSE(createIface(IfaceType::STA).empty());
|
||||
ASSERT_FALSE(createIface(IfaceType::AP).empty());
|
||||
ASSERT_TRUE(createRttController());
|
||||
}
|
||||
|
||||
////////// V1 Iface Combinations when AP creation is disabled //////////
|
||||
class WifiChipV1_AwareDisabledApIfaceCombinationTest : public WifiChipTest {
|
||||
public:
|
||||
|
||||
@@ -930,6 +930,12 @@ WifiStatus WifiChip::removeStaIfaceInternal(const std::string& ifname) {
|
||||
|
||||
std::pair<WifiStatus, sp<IWifiRttController>>
|
||||
WifiChip::createRttControllerInternal(const sp<IWifiIface>& bound_iface) {
|
||||
if (sta_ifaces_.size() == 0 &&
|
||||
!canCurrentModeSupportIfaceOfType(IfaceType::STA)) {
|
||||
LOG(ERROR) << "createRttControllerInternal: Chip cannot support STAs "
|
||||
"(and RTT by extension)";
|
||||
return {createWifiStatus(WifiStatusCode::ERROR_NOT_AVAILABLE), {}};
|
||||
}
|
||||
sp<WifiRttController> rtt =
|
||||
new WifiRttController(getWlan0IfaceName(), bound_iface, legacy_hal_);
|
||||
rtt_controllers_.emplace_back(rtt);
|
||||
|
||||
Reference in New Issue
Block a user