mirror of
https://gitee.com/openharmony/communication_wifi.git
synced 2024-12-18 20:40:11 +00:00
从sta中剥离netcheck
Signed-off-by: huxiaomin <huxiaomin2@huawei.com>
This commit is contained in:
parent
5f4688c8f8
commit
f432732f25
@ -28,7 +28,6 @@ local_base_sources = [
|
||||
"sta_auto_connect_service.cpp",
|
||||
"sta_interface.cpp",
|
||||
"sta_monitor.cpp",
|
||||
"sta_network_check.cpp",
|
||||
"sta_saved_device_appraisal.cpp",
|
||||
"sta_service.cpp",
|
||||
"sta_state_machine.cpp",
|
||||
@ -156,7 +155,6 @@ if (defined(ohos_lite)) {
|
||||
"hilog:libhilog",
|
||||
"ipc:ipc_single",
|
||||
"netmanager_base:net_conn_manager_if",
|
||||
"netstack:http_client",
|
||||
"samgr:samgr_proxy",
|
||||
]
|
||||
|
||||
|
@ -38,6 +38,7 @@ local_base_sources = [
|
||||
"net_helper/mac_address.cpp",
|
||||
"net_helper/network_interface.cpp",
|
||||
"net_helper/raw_socket.cpp",
|
||||
"net_helper/sta_network_check.cpp",
|
||||
"utils/wifi_common_event_helper.cpp",
|
||||
"utils/wifi_encryption_util.cpp",
|
||||
"utils/wifi_global_func.cpp",
|
||||
@ -49,6 +50,7 @@ local_base_include_dirs = [
|
||||
"$WIFI_ROOT_DIR/services/wifi_standard/wifi_framework/wifi_toolkit/net_helper",
|
||||
"$WIFI_ROOT_DIR/services/wifi_standard/wifi_framework/wifi_toolkit/utils",
|
||||
"$WIFI_ROOT_DIR/services/wifi_standard/wifi_framework/wifi_toolkit/config",
|
||||
"$WIFI_ROOT_DIR/services/wifi_standard/wifi_framework/wifi_manage/wifi_sta",
|
||||
"//commonlibrary/c_utils/base/include",
|
||||
"//base/hiviewdfx/hilog/interfaces/native/innerkits/include",
|
||||
"$WIFI_ROOT_DIR/interfaces/inner_api",
|
||||
@ -134,6 +136,7 @@ if (defined(ohos_lite)) {
|
||||
"eventhandler:libeventhandler",
|
||||
"hilog:libhilog",
|
||||
"huks:libhukssdk",
|
||||
"netstack:http_client",
|
||||
]
|
||||
|
||||
if (defined(global_parts_info) && defined(global_parts_info.startup_init)) {
|
||||
|
@ -16,6 +16,10 @@
|
||||
#include "sta_network_check.h"
|
||||
#include "wifi_logger.h"
|
||||
#include "wifi_settings.h"
|
||||
#ifndef OHOS_ARCH_LITE
|
||||
#include "http_client_request.h"
|
||||
#include "http_client.h"
|
||||
#endif
|
||||
|
||||
DEFINE_WIFILOG_LABEL("StaNetworkCheck");
|
||||
|
||||
@ -137,13 +141,7 @@ int StaNetworkCheck::HttpPortalDetection(const std::string &url)
|
||||
WIFI_LOGE("http create task failed !");
|
||||
return -1;
|
||||
}
|
||||
RegistHttpCallBack(task);
|
||||
task->Start();
|
||||
return 0;
|
||||
}
|
||||
|
||||
void StaNetworkCheck::RegistHttpCallBack(std::shared_ptr<NetStack::HttpClient::HttpClientTask> task)
|
||||
{
|
||||
task->OnSuccess([task, this](const NetStack::HttpClient::HttpClientRequest &request,
|
||||
const NetStack::HttpClient::HttpClientResponse &response) {
|
||||
std::string url = request.GetURL();
|
||||
@ -180,6 +178,9 @@ void StaNetworkCheck::RegistHttpCallBack(std::shared_ptr<NetStack::HttpClient::H
|
||||
}
|
||||
WIFI_LOGE("HttpPortalDetection OnFailed, url:%{public}s, responseCode:%{public}d", url.c_str(), codeNum);
|
||||
});
|
||||
|
||||
task->Start();
|
||||
return 0;
|
||||
}
|
||||
#endif
|
||||
void StaNetworkCheck::RunNetCheckThreadFunc()
|
@ -31,10 +31,6 @@
|
||||
#include "arp_checker.h"
|
||||
#include "dns_checker.h"
|
||||
#include "wifi_internal_msg.h"
|
||||
#ifndef OHOS_ARCH_LITE
|
||||
#include "http_client_request.h"
|
||||
#include "http_client.h"
|
||||
#endif
|
||||
|
||||
#define HTTP_DETECTION_TIMEOUT 10000
|
||||
#define HTTP_BACKUP_TIMEOUT 3000
|
||||
@ -87,8 +83,6 @@ private:
|
||||
*
|
||||
*/
|
||||
int HttpPortalDetection(const std::string& url);
|
||||
|
||||
void RegistHttpCallBack(std::shared_ptr<NetStack::HttpClient::HttpClientTask> task);
|
||||
#endif
|
||||
/**
|
||||
* @Description : NetCheck thread function
|
@ -37,7 +37,6 @@ ohos_unittest("wifi_sta_unittest") {
|
||||
"$WIFI_ROOT_DIR/services/wifi_standard/wifi_framework/wifi_manage/wifi_sta/sta_auto_connect_service.cpp",
|
||||
"$WIFI_ROOT_DIR/services/wifi_standard/wifi_framework/wifi_manage/wifi_sta/sta_interface.cpp",
|
||||
"$WIFI_ROOT_DIR/services/wifi_standard/wifi_framework/wifi_manage/wifi_sta/sta_monitor.cpp",
|
||||
"$WIFI_ROOT_DIR/services/wifi_standard/wifi_framework/wifi_manage/wifi_sta/sta_network_check.cpp",
|
||||
"$WIFI_ROOT_DIR/services/wifi_standard/wifi_framework/wifi_manage/wifi_sta/sta_saved_device_appraisal.cpp",
|
||||
"$WIFI_ROOT_DIR/services/wifi_standard/wifi_framework/wifi_manage/wifi_sta/sta_service.cpp",
|
||||
"$WIFI_ROOT_DIR/services/wifi_standard/wifi_framework/wifi_manage/wifi_sta/sta_state_machine.cpp",
|
||||
@ -57,7 +56,6 @@ ohos_unittest("wifi_sta_unittest") {
|
||||
"sta_auto_connect_service_test.cpp",
|
||||
"sta_interface_test.cpp",
|
||||
"sta_monitor_test.cpp",
|
||||
"sta_network_check_test.cpp",
|
||||
"sta_saved_device_appraisal_test.cpp",
|
||||
"sta_service_test.cpp",
|
||||
]
|
||||
|
@ -40,9 +40,5 @@ void MockStaNetworkCheck::SetHttpResultInfo(std::string url, int codeNum, int co
|
||||
{
|
||||
WIFI_LOGD("Enter SetHttpResultInfo::[%{public}s].", __FUNCTION__);
|
||||
}
|
||||
void MockStaNetworkCheck::RegistHttpCallBack(std::shared_ptr<NetStack::HttpClient::HttpClientTask> task)
|
||||
{
|
||||
WIFI_LOGD("Enter RegistHttpCallBack::[%{public}s].", __FUNCTION__);
|
||||
}
|
||||
} // namespace Wifi
|
||||
} // namespace OHOS
|
@ -30,7 +30,6 @@ public:
|
||||
void SignalNetCheckThread() override;
|
||||
void StopNetCheckThread() override;
|
||||
void ExitNetCheckThread() override;
|
||||
void RegistHttpCallBack(std::shared_ptr<NetStack::HttpClient::HttpClientTask> task);
|
||||
void SetHttpResultInfo(std::string url, int codeNum, int codeLenNum);
|
||||
};
|
||||
} // namespace OHOS
|
||||
|
@ -41,11 +41,13 @@ ohos_unittest("toolkit_unittest") {
|
||||
"$WIFI_ROOT_DIR/services/wifi_standard/wifi_framework/wifi_toolkit/net_helper/mac_address.cpp",
|
||||
"$WIFI_ROOT_DIR/services/wifi_standard/wifi_framework/wifi_toolkit/net_helper/network_interface.cpp",
|
||||
"$WIFI_ROOT_DIR/services/wifi_standard/wifi_framework/wifi_toolkit/net_helper/raw_socket.cpp",
|
||||
"$WIFI_ROOT_DIR/services/wifi_standard/wifi_framework/wifi_toolkit/net_helper/sta_network_check.cpp",
|
||||
"$WIFI_ROOT_DIR/services/wifi_standard/wifi_framework/wifi_toolkit/utils/network_parser.cpp",
|
||||
"$WIFI_ROOT_DIR/services/wifi_standard/wifi_framework/wifi_toolkit/utils/softap_parser.cpp",
|
||||
"$WIFI_ROOT_DIR/services/wifi_standard/wifi_framework/wifi_toolkit/utils/wifi_encryption_util.cpp",
|
||||
"$WIFI_ROOT_DIR/services/wifi_standard/wifi_framework/wifi_toolkit/utils/wifi_global_func.cpp",
|
||||
"$WIFI_ROOT_DIR/services/wifi_standard/wifi_framework/wifi_toolkit/utils/xml_parser.cpp",
|
||||
"../../wifi_manage/wifi_sta/Mock/mock_sta_network_check.cpp",
|
||||
"arp_checker_test.cpp",
|
||||
"base_address_test.cpp",
|
||||
"dhcpd_interface_test.cpp",
|
||||
@ -58,6 +60,7 @@ ohos_unittest("toolkit_unittest") {
|
||||
"network_parser_test.cpp",
|
||||
"raw_socket_test.cpp",
|
||||
"softap_parser_test.cpp",
|
||||
"sta_network_check_test.cpp",
|
||||
"wifi_config_file_test.cpp",
|
||||
"wifi_encryption_util_test.cpp",
|
||||
"wifi_global_func_test.cpp",
|
||||
@ -73,6 +76,7 @@ ohos_unittest("toolkit_unittest") {
|
||||
"$WIFI_ROOT_DIR/services/wifi_standard/wifi_framework/wifi_toolkit/utils",
|
||||
"$WIFI_ROOT_DIR/services/wifi_standard/wifi_framework/wifi_toolkit/log",
|
||||
"$WIFI_ROOT_DIR/services/wifi_standard/wifi_framework/wifi_toolkit/config",
|
||||
"$WIFI_ROOT_DIR/services/wifi_standard/wifi_framework/wifi_manage/wifi_sta",
|
||||
"$WIFI_ROOT_DIR/interfaces/inner_api",
|
||||
"$WIFI_ROOT_DIR/frameworks/native/interfaces",
|
||||
"$WIFI_ROOT_DIR/services/wifi_standard/include",
|
||||
@ -85,6 +89,7 @@ ohos_unittest("toolkit_unittest") {
|
||||
]
|
||||
|
||||
deps = [
|
||||
"$WIFI_ROOT_DIR/services/wifi_standard/wifi_framework/wifi_toolkit:wifi_toolkit",
|
||||
"//third_party/googletest:gmock_main",
|
||||
"//third_party/googletest:gtest_main",
|
||||
"//third_party/libxml2:xml2",
|
||||
@ -98,6 +103,7 @@ ohos_unittest("toolkit_unittest") {
|
||||
"c_utils:utils",
|
||||
"dhcp:dhcp_sdk",
|
||||
"hilog:libhilog",
|
||||
"netstack:http_client",
|
||||
]
|
||||
if (wifi_feature_with_encryption) {
|
||||
external_deps += [ "huks:libhukssdk" ]
|
||||
|
Loading…
Reference in New Issue
Block a user