Merge "wifi(tests): Unit tests for iface event cb's" into qt-dev

This commit is contained in:
Roshan Pius 2019-05-24 06:21:05 +00:00 committed by Android (Google) Code Review
commit 4ae7dd19ba
18 changed files with 317 additions and 30 deletions

View file

@ -142,12 +142,14 @@ LOCAL_CPPFLAGS := -Wall -Werror -Wextra
LOCAL_SRC_FILES := \
tests/hidl_struct_util_unit_tests.cpp \
tests/main.cpp \
tests/mock_interface_tool.cpp \
tests/mock_wifi_feature_flags.cpp \
tests/mock_wifi_iface_util.cpp \
tests/mock_wifi_legacy_hal.cpp \
tests/mock_wifi_mode_controller.cpp \
tests/ringbuffer_unit_tests.cpp \
tests/wifi_ap_iface_unit_tests.cpp \
tests/wifi_nan_iface_unit_tests.cpp \
tests/wifi_chip_unit_tests.cpp \
tests/wifi_iface_util_unit_tests.cpp
LOCAL_STATIC_LIBRARIES := \

View file

@ -48,12 +48,14 @@ int main(int /*argc*/, char** argv) {
configureRpcThreadpool(1, true /* callerWillJoin */);
const auto iface_tool =
std::make_shared<android::wifi_system::InterfaceTool>();
// Setup hwbinder service
android::sp<android::hardware::wifi::V1_3::IWifi> service =
new android::hardware::wifi::V1_3::implementation::Wifi(
std::make_shared<WifiLegacyHal>(),
iface_tool, std::make_shared<WifiLegacyHal>(iface_tool),
std::make_shared<WifiModeController>(),
std::make_shared<WifiIfaceUtil>(),
std::make_shared<WifiIfaceUtil>(iface_tool),
std::make_shared<WifiFeatureFlags>());
if (kLazyService) {
LazyServiceRegistrar registrar;

View file

@ -0,0 +1,29 @@
/*
* Copyright (C) 2019 The Android Open Source Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#include <android-base/logging.h>
#include <android-base/macros.h>
#include <gmock/gmock.h>
#undef NAN // This is weird, NAN is defined in bionic/libc/include/math.h:38
#include "mock_interface_tool.h"
namespace android {
namespace wifi_system {
MockInterfaceTool::MockInterfaceTool() {}
} // namespace wifi_system
} // namespace android

View file

@ -0,0 +1,44 @@
/*
* Copyright (C) 2019 The Android Open Source Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#ifndef MOCK_INTERFACE_TOOL_H
#define MOCK_INTERFACE_TOOL_H
#include <gmock/gmock.h>
#include <wifi_system/interface_tool.h>
namespace android {
namespace wifi_system {
class MockInterfaceTool : public InterfaceTool {
public:
MockInterfaceTool();
MOCK_METHOD1(GetUpState, bool(const char* if_name));
MOCK_METHOD2(SetUpState, bool(const char* if_name, bool request_up));
MOCK_METHOD1(SetWifiUpState, bool(bool request_up));
MOCK_METHOD2(SetMacAddress,
bool(const char* if_name,
const std::array<uint8_t, ETH_ALEN>& address));
MOCK_METHOD1(GetFactoryMacAddress,
std::array<uint8_t, ETH_ALEN>(const char* if_name));
}; // class MockInterfaceTool
} // namespace wifi_system
} // namespace android
#endif // MOCK_INTERFACE_TOOL_H

View file

@ -28,7 +28,9 @@ namespace V1_3 {
namespace implementation {
namespace iface_util {
MockWifiIfaceUtil::MockWifiIfaceUtil() : WifiIfaceUtil() {}
MockWifiIfaceUtil::MockWifiIfaceUtil(
const std::weak_ptr<wifi_system::InterfaceTool> iface_tool)
: WifiIfaceUtil(iface_tool) {}
} // namespace iface_util
} // namespace implementation
} // namespace V1_3

View file

@ -30,12 +30,16 @@ namespace iface_util {
class MockWifiIfaceUtil : public WifiIfaceUtil {
public:
MockWifiIfaceUtil();
MockWifiIfaceUtil(
const std::weak_ptr<wifi_system::InterfaceTool> iface_tool);
MOCK_METHOD1(getFactoryMacAddress,
std::array<uint8_t, 6>(const std::string&));
MOCK_METHOD2(setMacAddress,
bool(const std::string&, const std::array<uint8_t, 6>&));
MOCK_METHOD0(getOrCreateRandomMacAddress, std::array<uint8_t, 6>());
MOCK_METHOD2(registerIfaceEventHandlers,
void(const std::string&, IfaceEventHandlers));
MOCK_METHOD1(unregisterIfaceEventHandlers, void(const std::string&));
};
} // namespace iface_util
} // namespace implementation

View file

@ -28,7 +28,9 @@ namespace V1_3 {
namespace implementation {
namespace legacy_hal {
MockWifiLegacyHal::MockWifiLegacyHal() : WifiLegacyHal() {}
MockWifiLegacyHal::MockWifiLegacyHal(
const std::weak_ptr<wifi_system::InterfaceTool> iface_tool)
: WifiLegacyHal(iface_tool) {}
} // namespace legacy_hal
} // namespace implementation
} // namespace V1_3

View file

@ -30,7 +30,8 @@ namespace legacy_hal {
class MockWifiLegacyHal : public WifiLegacyHal {
public:
MockWifiLegacyHal();
MockWifiLegacyHal(
const std::weak_ptr<wifi_system::InterfaceTool> iface_tool);
MOCK_METHOD0(initialize, wifi_error());
MOCK_METHOD0(start, wifi_error());
MOCK_METHOD2(stop, wifi_error(std::unique_lock<std::recursive_mutex>*,

View file

@ -22,6 +22,7 @@
#undef NAN // This is weird, NAN is defined in bionic/libc/include/math.h:38
#include "wifi_ap_iface.h"
#include "mock_interface_tool.h"
#include "mock_wifi_feature_flags.h"
#include "mock_wifi_iface_util.h"
#include "mock_wifi_legacy_hal.h"
@ -42,10 +43,12 @@ namespace implementation {
class WifiApIfaceTest : public Test {
protected:
std::shared_ptr<NiceMock<wifi_system::MockInterfaceTool>> iface_tool_{
new NiceMock<wifi_system::MockInterfaceTool>};
std::shared_ptr<NiceMock<legacy_hal::MockWifiLegacyHal>> legacy_hal_{
new NiceMock<legacy_hal::MockWifiLegacyHal>};
new NiceMock<legacy_hal::MockWifiLegacyHal>(iface_tool_)};
std::shared_ptr<NiceMock<iface_util::MockWifiIfaceUtil>> iface_util_{
new NiceMock<iface_util::MockWifiIfaceUtil>};
new NiceMock<iface_util::MockWifiIfaceUtil>(iface_tool_)};
std::shared_ptr<NiceMock<feature_flags::MockWifiFeatureFlags>>
feature_flags_{new NiceMock<feature_flags::MockWifiFeatureFlags>};
};

View file

@ -22,6 +22,7 @@
#undef NAN // This is weird, NAN is defined in bionic/libc/include/math.h:38
#include "wifi_chip.h"
#include "mock_interface_tool.h"
#include "mock_wifi_feature_flags.h"
#include "mock_wifi_iface_util.h"
#include "mock_wifi_legacy_hal.h"
@ -263,12 +264,14 @@ class WifiChipTest : public Test {
sp<WifiChip> chip_;
ChipId chip_id_ = kFakeChipId;
std::shared_ptr<NiceMock<wifi_system::MockInterfaceTool>> iface_tool_{
new NiceMock<wifi_system::MockInterfaceTool>};
std::shared_ptr<NiceMock<legacy_hal::MockWifiLegacyHal>> legacy_hal_{
new NiceMock<legacy_hal::MockWifiLegacyHal>};
new NiceMock<legacy_hal::MockWifiLegacyHal>(iface_tool_)};
std::shared_ptr<NiceMock<mode_controller::MockWifiModeController>>
mode_controller_{new NiceMock<mode_controller::MockWifiModeController>};
std::shared_ptr<NiceMock<iface_util::MockWifiIfaceUtil>> iface_util_{
new NiceMock<iface_util::MockWifiIfaceUtil>};
new NiceMock<iface_util::MockWifiIfaceUtil>(iface_tool_)};
std::shared_ptr<NiceMock<feature_flags::MockWifiFeatureFlags>>
feature_flags_{new NiceMock<feature_flags::MockWifiFeatureFlags>};

View file

@ -21,10 +21,15 @@
#undef NAN
#include "wifi_iface_util.h"
#include "mock_interface_tool.h"
using testing::NiceMock;
using testing::Test;
namespace {
constexpr uint8_t kValidUnicastLocallyAssignedMacAddressMask = 0x02;
constexpr uint8_t kMacAddress[] = {0x02, 0x12, 0x45, 0x56, 0xab, 0xcc};
constexpr char kIfaceName[] = "test-wlan0";
bool isValidUnicastLocallyAssignedMacAddress(
const std::array<uint8_t, 6>& mac_address) {
@ -38,19 +43,52 @@ namespace hardware {
namespace wifi {
namespace V1_3 {
namespace implementation {
namespace iface_util {
class WifiIfaceUtilTest : public Test {
protected:
iface_util::WifiIfaceUtil iface_util_;
std::shared_ptr<NiceMock<wifi_system::MockInterfaceTool>> iface_tool_{
new NiceMock<wifi_system::MockInterfaceTool>};
WifiIfaceUtil* iface_util_ = new WifiIfaceUtil(iface_tool_);
};
TEST_F(WifiIfaceUtilTest, GetOrCreateRandomMacAddress) {
auto mac_address = iface_util_.getOrCreateRandomMacAddress();
auto mac_address = iface_util_->getOrCreateRandomMacAddress();
ASSERT_TRUE(isValidUnicastLocallyAssignedMacAddress(mac_address));
// All further calls should return the same MAC address.
ASSERT_EQ(mac_address, iface_util_.getOrCreateRandomMacAddress());
ASSERT_EQ(mac_address, iface_util_.getOrCreateRandomMacAddress());
ASSERT_EQ(mac_address, iface_util_->getOrCreateRandomMacAddress());
ASSERT_EQ(mac_address, iface_util_->getOrCreateRandomMacAddress());
}
TEST_F(WifiIfaceUtilTest, IfaceEventHandlers_SetMacAddress) {
std::array<uint8_t, 6> mac_address = {};
std::copy(std::begin(kMacAddress), std::end(kMacAddress),
std::begin(mac_address));
EXPECT_CALL(*iface_tool_, SetMacAddress(testing::_, testing::_))
.WillRepeatedly(testing::Return(true));
EXPECT_CALL(*iface_tool_, SetUpState(testing::_, testing::_))
.WillRepeatedly(testing::Return(true));
// Register for iface state toggle events.
bool callback_invoked = false;
iface_util::IfaceEventHandlers event_handlers = {};
event_handlers.on_state_toggle_off_on =
[&callback_invoked](const std::string& /* iface_name */) {
callback_invoked = true;
};
iface_util_->registerIfaceEventHandlers(kIfaceName, event_handlers);
// Invoke setMacAddress and ensure that the cb is invoked.
ASSERT_TRUE(iface_util_->setMacAddress(kIfaceName, mac_address));
ASSERT_TRUE(callback_invoked);
// Unregister for iface state toggle events.
callback_invoked = false;
iface_util_->unregisterIfaceEventHandlers(kIfaceName);
// Invoke setMacAddress and ensure that the cb is not invoked.
ASSERT_TRUE(iface_util_->setMacAddress(kIfaceName, mac_address));
ASSERT_FALSE(callback_invoked);
}
} // namespace iface_util
} // namespace implementation
} // namespace V1_3
} // namespace wifi

View file

@ -0,0 +1,148 @@
/*
* Copyright (C) 2019, The Android Open Source Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#include <android-base/logging.h>
#include <android-base/macros.h>
#include <cutils/properties.h>
#include <gmock/gmock.h>
#undef NAN // This is weird, NAN is defined in bionic/libc/include/math.h:38
#include "wifi_nan_iface.h"
#include "mock_interface_tool.h"
#include "mock_wifi_feature_flags.h"
#include "mock_wifi_iface_util.h"
#include "mock_wifi_legacy_hal.h"
using testing::NiceMock;
using testing::Return;
using testing::Test;
namespace {
constexpr char kIfaceName[] = "mockWlan0";
} // namespace
namespace android {
namespace hardware {
namespace wifi {
namespace V1_3 {
namespace implementation {
bool CaptureIfaceEventHandlers(
const std::string& /* iface_name*/,
iface_util::IfaceEventHandlers in_iface_event_handlers,
iface_util::IfaceEventHandlers* out_iface_event_handlers) {
*out_iface_event_handlers = in_iface_event_handlers;
return true;
}
class MockNanIfaceEventCallback : public IWifiNanIfaceEventCallback {
public:
MockNanIfaceEventCallback() = default;
MOCK_METHOD3(notifyCapabilitiesResponse,
Return<void>(uint16_t, const WifiNanStatus&,
const NanCapabilities&));
MOCK_METHOD2(notifyEnableResponse,
Return<void>(uint16_t, const WifiNanStatus&));
MOCK_METHOD2(notifyConfigResponse,
Return<void>(uint16_t, const WifiNanStatus&));
MOCK_METHOD2(notifyDisableResponse,
Return<void>(uint16_t, const WifiNanStatus&));
MOCK_METHOD3(notifyStartPublishResponse,
Return<void>(uint16_t, const WifiNanStatus&, uint8_t));
MOCK_METHOD2(notifyStopPublishResponse,
Return<void>(uint16_t, const WifiNanStatus&));
MOCK_METHOD3(notifyStartSubscribeResponse,
Return<void>(uint16_t, const WifiNanStatus&, uint8_t));
MOCK_METHOD2(notifyStopSubscribeResponse,
Return<void>(uint16_t, const WifiNanStatus&));
MOCK_METHOD2(notifyTransmitFollowupResponse,
Return<void>(uint16_t, const WifiNanStatus&));
MOCK_METHOD2(notifyCreateDataInterfaceResponse,
Return<void>(uint16_t, const WifiNanStatus&));
MOCK_METHOD2(notifyDeleteDataInterfaceResponse,
Return<void>(uint16_t, const WifiNanStatus&));
MOCK_METHOD3(notifyInitiateDataPathResponse,
Return<void>(uint16_t, const WifiNanStatus&, uint32_t));
MOCK_METHOD2(notifyRespondToDataPathIndicationResponse,
Return<void>(uint16_t, const WifiNanStatus&));
MOCK_METHOD2(notifyTerminateDataPathResponse,
Return<void>(uint16_t, const WifiNanStatus&));
MOCK_METHOD1(eventClusterEvent, Return<void>(const NanClusterEventInd&));
MOCK_METHOD1(eventDisabled, Return<void>(const WifiNanStatus&));
MOCK_METHOD2(eventPublishTerminated,
Return<void>(uint8_t, const WifiNanStatus&));
MOCK_METHOD2(eventSubscribeTerminated,
Return<void>(uint8_t, const WifiNanStatus&));
MOCK_METHOD1(eventMatch, Return<void>(const NanMatchInd&));
MOCK_METHOD2(eventMatchExpired, Return<void>(uint8_t, uint32_t));
MOCK_METHOD1(eventFollowupReceived,
Return<void>(const NanFollowupReceivedInd&));
MOCK_METHOD2(eventTransmitFollowup,
Return<void>(uint16_t, const WifiNanStatus&));
MOCK_METHOD1(eventDataPathRequest,
Return<void>(const NanDataPathRequestInd&));
MOCK_METHOD1(eventDataPathConfirm,
Return<void>(const NanDataPathConfirmInd&));
MOCK_METHOD1(eventDataPathTerminated, Return<void>(uint32_t));
};
class WifiNanIfaceTest : public Test {
protected:
std::shared_ptr<NiceMock<wifi_system::MockInterfaceTool>> iface_tool_{
new NiceMock<wifi_system::MockInterfaceTool>};
std::shared_ptr<NiceMock<legacy_hal::MockWifiLegacyHal>> legacy_hal_{
new NiceMock<legacy_hal::MockWifiLegacyHal>(iface_tool_)};
std::shared_ptr<NiceMock<iface_util::MockWifiIfaceUtil>> iface_util_{
new NiceMock<iface_util::MockWifiIfaceUtil>(iface_tool_)};
};
TEST_F(WifiNanIfaceTest, IfacEventHandlers_OnStateToggleOffOn) {
iface_util::IfaceEventHandlers captured_iface_event_handlers = {};
EXPECT_CALL(*legacy_hal_,
nanRegisterCallbackHandlers(testing::_, testing::_))
.WillOnce(testing::Return(legacy_hal::WIFI_SUCCESS));
EXPECT_CALL(*iface_util_,
registerIfaceEventHandlers(testing::_, testing::_))
.WillOnce(testing::Invoke(
bind(CaptureIfaceEventHandlers, std::placeholders::_1,
std::placeholders::_2, &captured_iface_event_handlers)));
sp<WifiNanIface> nan_iface =
new WifiNanIface(kIfaceName, legacy_hal_, iface_util_);
// Register a mock nan event callback.
sp<NiceMock<MockNanIfaceEventCallback>> mock_event_callback{
new NiceMock<MockNanIfaceEventCallback>};
nan_iface->registerEventCallback(
mock_event_callback, [](const WifiStatus& status) {
ASSERT_EQ(WifiStatusCode::SUCCESS, status.code);
});
// Ensure that the eventDisabled() function in mock callback will be
// invoked.
WifiNanStatus expected_nan_status = {
NanStatusType::UNSUPPORTED_CONCURRENCY_NAN_DISABLED, ""};
EXPECT_CALL(*mock_event_callback, eventDisabled(expected_nan_status))
.Times(1);
// Trigger the iface state toggle callback.
captured_iface_event_handlers.on_state_toggle_off_on(kIfaceName);
}
} // namespace implementation
} // namespace V1_3
} // namespace wifi
} // namespace hardware
} // namespace android

View file

@ -34,11 +34,13 @@ using hidl_return_util::validateAndCall;
using hidl_return_util::validateAndCallWithLock;
Wifi::Wifi(
const std::shared_ptr<wifi_system::InterfaceTool> iface_tool,
const std::shared_ptr<legacy_hal::WifiLegacyHal> legacy_hal,
const std::shared_ptr<mode_controller::WifiModeController> mode_controller,
const std::shared_ptr<iface_util::WifiIfaceUtil> iface_util,
const std::shared_ptr<feature_flags::WifiFeatureFlags> feature_flags)
: legacy_hal_(legacy_hal),
: iface_tool_(iface_tool),
legacy_hal_(legacy_hal),
mode_controller_(mode_controller),
iface_util_(iface_util),
feature_flags_(feature_flags),

View file

@ -40,7 +40,8 @@ namespace implementation {
*/
class Wifi : public V1_3::IWifi {
public:
Wifi(const std::shared_ptr<legacy_hal::WifiLegacyHal> legacy_hal,
Wifi(const std::shared_ptr<wifi_system::InterfaceTool> iface_tool,
const std::shared_ptr<legacy_hal::WifiLegacyHal> legacy_hal,
const std::shared_ptr<mode_controller::WifiModeController>
mode_controller,
const std::shared_ptr<iface_util::WifiIfaceUtil> iface_util,
@ -77,6 +78,7 @@ class Wifi : public V1_3::IWifi {
// Instance is created in this root level |IWifi| HIDL interface object
// and shared with all the child HIDL interface objects.
std::shared_ptr<wifi_system::InterfaceTool> iface_tool_;
std::shared_ptr<legacy_hal::WifiLegacyHal> legacy_hal_;
std::shared_ptr<mode_controller::WifiModeController> mode_controller_;
std::shared_ptr<iface_util::WifiIfaceUtil> iface_util_;

View file

@ -39,25 +39,28 @@ namespace V1_3 {
namespace implementation {
namespace iface_util {
WifiIfaceUtil::WifiIfaceUtil()
: random_mac_address_(nullptr), event_handlers_map_() {}
WifiIfaceUtil::WifiIfaceUtil(
const std::weak_ptr<wifi_system::InterfaceTool> iface_tool)
: iface_tool_(iface_tool),
random_mac_address_(nullptr),
event_handlers_map_() {}
std::array<uint8_t, 6> WifiIfaceUtil::getFactoryMacAddress(
const std::string& iface_name) {
return iface_tool_.GetFactoryMacAddress(iface_name.c_str());
return iface_tool_.lock()->GetFactoryMacAddress(iface_name.c_str());
}
bool WifiIfaceUtil::setMacAddress(const std::string& iface_name,
const std::array<uint8_t, 6>& mac) {
if (!iface_tool_.SetUpState(iface_name.c_str(), false)) {
if (!iface_tool_.lock()->SetUpState(iface_name.c_str(), false)) {
LOG(ERROR) << "SetUpState(false) failed.";
return false;
}
if (!iface_tool_.SetMacAddress(iface_name.c_str(), mac)) {
if (!iface_tool_.lock()->SetMacAddress(iface_name.c_str(), mac)) {
LOG(ERROR) << "SetMacAddress failed.";
return false;
}
if (!iface_tool_.SetUpState(iface_name.c_str(), true)) {
if (!iface_tool_.lock()->SetUpState(iface_name.c_str(), true)) {
LOG(ERROR) << "SetUpState(true) failed.";
return false;
}

View file

@ -40,7 +40,7 @@ struct IfaceEventHandlers {
*/
class WifiIfaceUtil {
public:
WifiIfaceUtil();
WifiIfaceUtil(const std::weak_ptr<wifi_system::InterfaceTool> iface_tool);
virtual ~WifiIfaceUtil() = default;
virtual std::array<uint8_t, 6> getFactoryMacAddress(
@ -60,7 +60,7 @@ class WifiIfaceUtil {
private:
std::array<uint8_t, 6> createRandomMacAddress();
wifi_system::InterfaceTool iface_tool_;
std::weak_ptr<wifi_system::InterfaceTool> iface_tool_;
std::unique_ptr<std::array<uint8_t, 6>> random_mac_address_;
std::map<std::string, IfaceEventHandlers> event_handlers_map_;
};

View file

@ -333,10 +333,12 @@ void onAsyncNanEventScheduleUpdate(NanDataPathScheduleUpdateInd* event) {
}
// End of the free-standing "C" style callbacks.
WifiLegacyHal::WifiLegacyHal()
WifiLegacyHal::WifiLegacyHal(
const std::weak_ptr<wifi_system::InterfaceTool> iface_tool)
: global_handle_(nullptr),
awaiting_event_loop_termination_(false),
is_started_(false) {}
is_started_(false),
iface_tool_(iface_tool) {}
wifi_error WifiLegacyHal::initialize() {
LOG(DEBUG) << "Initialize legacy HAL";
@ -371,7 +373,7 @@ wifi_error WifiLegacyHal::start() {
property_set(kDriverPropName, "ok");
LOG(DEBUG) << "Starting legacy HAL";
if (!iface_tool_.SetWifiUpState(true)) {
if (!iface_tool_.lock()->SetWifiUpState(true)) {
LOG(ERROR) << "Failed to set WiFi interface up";
return WIFI_ERROR_UNKNOWN;
}
@ -407,7 +409,7 @@ wifi_error WifiLegacyHal::stop(
// Invalidate all the internal pointers now that the HAL is
// stopped.
invalidate();
iface_tool_.SetWifiUpState(false);
iface_tool_.lock()->SetWifiUpState(false);
on_stop_complete_user_callback();
is_started_ = false;
};

View file

@ -170,7 +170,7 @@ using on_radio_mode_change_callback =
*/
class WifiLegacyHal {
public:
WifiLegacyHal();
WifiLegacyHal(const std::weak_ptr<wifi_system::InterfaceTool> iface_tool);
virtual ~WifiLegacyHal() = default;
// Initialize the legacy HAL function table.
@ -391,7 +391,7 @@ class WifiLegacyHal {
std::condition_variable_any stop_wait_cv_;
// Flag to indicate if the legacy HAL has been started.
bool is_started_;
wifi_system::InterfaceTool iface_tool_;
std::weak_ptr<wifi_system::InterfaceTool> iface_tool_;
};
} // namespace legacy_hal