From 497bc413a19ad9640485e24cd85febab07bfcab6 Mon Sep 17 00:00:00 2001 From: zhangfeng Date: Sat, 5 Feb 2022 07:23:03 +0000 Subject: [PATCH] =?UTF-8?q?1.=20Hisi=E8=A7=A3=E8=80=A6=E5=B7=AE=E5=BC=82?= =?UTF-8?q?=E5=8C=96=E5=A4=84=E7=90=86=EF=BC=9B=202.=20=E4=BF=AE=E6=94=B9P?= =?UTF-8?q?2P=20=E8=BF=9E=E6=8E=A5=E9=85=8D=E7=BD=AE=E4=B8=AD=E2=80=9Cgrou?= =?UTF-8?q?pOwnerIntent=E2=80=9D=E4=B8=BA=E9=BB=98=E8=AE=A4=E5=80=BC-1(?= =?UTF-8?q?=E7=B3=BB=E7=BB=9F=E8=87=AA=E5=8A=A8=E9=80=89=E6=8B=A9)?= =?UTF-8?q?=E6=97=B6=E8=A2=AB=E6=A0=A1=E9=AA=8C=E9=94=99=E8=AF=AF=E6=8B=A6?= =?UTF-8?q?=E6=88=AA=E9=97=AE=E9=A2=98=20=20=20=20p2p=5Fstate=5Fmachine.cp?= =?UTF-8?q?p/IsConfigUnusable?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 3. 修改扫描结果上报值与对外定义不一致问题; 4. 耦合头文件去耦合; 5. 删除gn中不再需要的依赖; 6. 日志优化。 Signed-off-by: z00588131 --- interfaces/innerkits/native_cpp/napi/BUILD.gn | 12 +------ .../native_cpp/napi/wifi_napi_event.cpp | 24 +++++-------- .../native_cpp/napi/wifi_napi_event.h | 1 + .../native_cpp/napi/wifi_napi_hotspot.cpp | 1 + .../native_cpp/napi/wifi_napi_p2p.cpp | 2 +- .../wifi_standard/include/wifi_hotspot.h | 4 +-- .../wifi_standard/include/wifi_p2p.h | 3 +- .../wifi_standard/include/wifi_scan.h | 4 +-- .../wifi_standard/interfaces/i_wifi_hotspot.h | 4 +-- .../interfaces/i_wifi_hotspot_callback.h | 4 +-- .../wifi_standard/interfaces/i_wifi_scan.h | 4 +-- .../wifi_standard/interfaces/wifi_msg.h | 8 +---- .../wifi_standard/interfaces/wifi_p2p_msg.h | 11 ++++-- .../wifi_standard/interfaces/wifi_scan_msg.h | 4 +-- .../common/include/wifi_internal_msg.h | 4 ++- .../common/net_helper/dhcpd_interface.h | 5 +-- .../common/wifi_broadcast_helper.h | 5 +-- .../idl_client/idl_interface/i_wifi.c | 5 ++- .../wifi_manage/wifi_ap/ap_config_use.h | 5 +-- .../wifi_manage/wifi_ap/ap_define.h | 5 ++- .../wifi_manage/wifi_ap/ap_monitor.cpp | 2 +- .../wifi_manage/wifi_ap/ap_monitor.h | 5 ++- .../wifi_manage/wifi_ap/ap_started_state.h | 4 ++- .../wifi_manage/wifi_ap/ap_stations_manager.h | 3 +- .../wifi_manage/wifi_hid2d_service_utils.cpp | 4 +-- .../wifi_p2p/p2p_state_machine.cpp | 3 +- .../wifi_p2p/wifi_p2p_device_manager.h | 4 +-- .../wifi_p2p/wifi_p2p_group_info_proxy.h | 4 +-- .../wifi_standard/wifi_hal/etc/init/BUILD.gn | 10 ++---- .../wifi_ap/Mock/mock_wifi_ap_hal_interface.h | 6 ++-- .../wifi_ap/Mock/mock_wifi_settings.h | 4 +-- .../wifi_ap/Mock/operator_overload.h | 4 +-- .../test/Mock/mock_wifi_p2p_hal_interface.h | 2 +- .../wifi_p2p/test/Mock/mock_wifi_settings.h | 36 ++----------------- 34 files changed, 85 insertions(+), 121 deletions(-) diff --git a/interfaces/innerkits/native_cpp/napi/BUILD.gn b/interfaces/innerkits/native_cpp/napi/BUILD.gn index 514e7e66f..d821d3197 100755 --- a/interfaces/innerkits/native_cpp/napi/BUILD.gn +++ b/interfaces/innerkits/native_cpp/napi/BUILD.gn @@ -1,4 +1,4 @@ -# Copyright (C) 2021 Huawei Device Co., Ltd. +# Copyright (C) 2021-2022 Huawei Device Co., Ltd. # 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 @@ -19,13 +19,11 @@ ohos_shared_library("wifi") { "//third_party/node/src", "//native_engine", "//utils/native/base/include", - "//utils/system/safwk/native/include", "//foundation/communication/wifi/services/wifi_standard/wifi_framework/common/log", "//foundation/communication/wifi/interfaces/innerkits/native_cpp/wifi_standard/interfaces", "//base/hiviewdfx/hilog/interfaces/native/innerkits/include", "//foundation/communication/wifi/interfaces/innerkits/native_cpp/wifi_standard/include", "//foundation/communication/wifi/services/wifi_standard/wifi_framework/common/net_helper", - "//base/notification/ces_standard/frameworks/core/include", ] sources = [ @@ -38,9 +36,6 @@ ohos_shared_library("wifi") { ] deps = [ "//base/hiviewdfx/hilog/interfaces/native/innerkits:libhilog", - "//base/notification/ces_standard/frameworks/core:cesfwk_core", - "//base/notification/ces_standard/frameworks/native:cesfwk_innerkits", - "//foundation/aafwk/standard/interfaces/innerkits/want:want", "//foundation/ace/napi:ace_napi", "//foundation/communication/wifi/interfaces/innerkits/native_cpp/wifi_standard:wifi_sdk", "//utils/native/base:utils", @@ -59,13 +54,11 @@ ohos_shared_library("wifi_native_js") { "//third_party/node/src", "//native_engine", "//utils/native/base/include", - "//utils/system/safwk/native/include", "//foundation/communication/wifi/services/wifi_standard/wifi_framework/common/log", "//foundation/communication/wifi/interfaces/innerkits/native_cpp/wifi_standard/interfaces", "//base/hiviewdfx/hilog/interfaces/native/innerkits/include", "//foundation/communication/wifi/interfaces/innerkits/native_cpp/wifi_standard/include", "//foundation/communication/wifi/services/wifi_standard/wifi_framework/common/net_helper", - "//base/notification/ces_standard/frameworks/core/include", ] sources = [ @@ -78,9 +71,6 @@ ohos_shared_library("wifi_native_js") { ] deps = [ "//base/hiviewdfx/hilog/interfaces/native/innerkits:libhilog", - "//base/notification/ces_standard/frameworks/core:cesfwk_core", - "//base/notification/ces_standard/frameworks/native:cesfwk_innerkits", - "//foundation/aafwk/standard/interfaces/innerkits/want:want", "//foundation/ace/napi:ace_napi", "//foundation/communication/wifi/interfaces/innerkits/native_cpp/wifi_standard:wifi_sdk", "//utils/native/base:utils", diff --git a/interfaces/innerkits/native_cpp/napi/wifi_napi_event.cpp b/interfaces/innerkits/native_cpp/napi/wifi_napi_event.cpp index e863c08ed..1492e6533 100755 --- a/interfaces/innerkits/native_cpp/napi/wifi_napi_event.cpp +++ b/interfaces/innerkits/native_cpp/napi/wifi_napi_event.cpp @@ -18,7 +18,6 @@ #include "wifi_napi_utils.h" #include "wifi_device.h" #include "wifi_scan.h" -#include "wifi_p2p.h" #include "wifi_logger.h" namespace OHOS { @@ -77,36 +76,29 @@ void NapiEvent::EventNotify(AsyncEventData *asyncEvent) [](uv_work_t* work) {}, [](uv_work_t* work, int status) { AsyncEventData *asyncData = static_cast(work->data); - if (asyncData == nullptr) { - WIFI_LOGE("asyncData is null."); - return; - } WIFI_LOGI("Napi event uv_queue_work, env: %{public}p, status: %{public}d", asyncData->env, status); + napi_value handler = nullptr; napi_handle_scope scope = nullptr; napi_open_handle_scope(asyncData->env, &scope); if (scope == nullptr) { WIFI_LOGE("scope is nullptr"); napi_close_handle_scope(asyncData->env, scope); - return; + goto EXIT; } napi_value undefine; napi_get_undefined(asyncData->env, &undefine); - napi_value handler = nullptr; napi_get_reference_value(asyncData->env, asyncData->callbackRef, &handler); - WIFI_LOGI("Push event to js, env: %{public}p, ref : %{public}p", asyncData->env, &asyncData->callbackRef); if (napi_call_function(asyncData->env, nullptr, handler, 1, &asyncData->jsEvent, &undefine) != napi_ok) { WIFI_LOGE("Report event to Js failed"); } napi_close_handle_scope(asyncData->env, scope); - if (asyncData != nullptr) { - delete asyncData; - asyncData = nullptr; - } - if (work != nullptr) { - delete work; - work = nullptr; - } + + EXIT: + delete asyncData; + asyncData = nullptr; + delete work; + work = nullptr; } ); } diff --git a/interfaces/innerkits/native_cpp/napi/wifi_napi_event.h b/interfaces/innerkits/native_cpp/napi/wifi_napi_event.h index 1928a2149..d3f7920c3 100755 --- a/interfaces/innerkits/native_cpp/napi/wifi_napi_event.h +++ b/interfaces/innerkits/native_cpp/napi/wifi_napi_event.h @@ -22,6 +22,7 @@ #include "napi/native_api.h" #include "wifi_errcode.h" #include +#include "wifi_p2p.h" #include "wifi_hotspot.h" namespace OHOS { diff --git a/interfaces/innerkits/native_cpp/napi/wifi_napi_hotspot.cpp b/interfaces/innerkits/native_cpp/napi/wifi_napi_hotspot.cpp index 5875c686b..185a7d6fa 100755 --- a/interfaces/innerkits/native_cpp/napi/wifi_napi_hotspot.cpp +++ b/interfaces/innerkits/native_cpp/napi/wifi_napi_hotspot.cpp @@ -17,6 +17,7 @@ #include "wifi_hotspot.h" #include "wifi_logger.h" #include +#include namespace OHOS { namespace Wifi { diff --git a/interfaces/innerkits/native_cpp/napi/wifi_napi_p2p.cpp b/interfaces/innerkits/native_cpp/napi/wifi_napi_p2p.cpp index 443b76f3f..574662b53 100755 --- a/interfaces/innerkits/native_cpp/napi/wifi_napi_p2p.cpp +++ b/interfaces/innerkits/native_cpp/napi/wifi_napi_p2p.cpp @@ -297,7 +297,7 @@ static void JsObjToP2pConfig(const napi_env& env, const napi_value& object, Wifi int groupOwnerIntent = -1; std::string groupName = ""; int band = static_cast(GroupOwnerBand::GO_BAND_AUTO); - JsObjectToString(env, object, "macAddress", WIFI_MAC_LENGTH + 1, address); + JsObjectToString(env, object, "macAddress", WIFI_STR_MAC_LENGTH + 1, address); JsObjectToInt(env, object, "goBand", band); JsObjectToInt(env, object, "netId", netId); JsObjectToString(env, object, "passphrase", MAX_PASSPHRASE_LENGTH + 1, passphrase); diff --git a/interfaces/innerkits/native_cpp/wifi_standard/include/wifi_hotspot.h b/interfaces/innerkits/native_cpp/wifi_standard/include/wifi_hotspot.h index 375b427e1..fdcdeea67 100644 --- a/interfaces/innerkits/native_cpp/wifi_standard/include/wifi_hotspot.h +++ b/interfaces/innerkits/native_cpp/wifi_standard/include/wifi_hotspot.h @@ -1,5 +1,5 @@ /* - * Copyright (C) 2021 Huawei Device Co., Ltd. + * Copyright (C) 2021-2022 Huawei Device Co., Ltd. * 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 @@ -21,7 +21,7 @@ #include #include "wifi_errcode.h" -#include "wifi_msg.h" +#include "wifi_ap_msg.h" #include "i_wifi_hotspot_callback.h" namespace OHOS { diff --git a/interfaces/innerkits/native_cpp/wifi_standard/include/wifi_p2p.h b/interfaces/innerkits/native_cpp/wifi_standard/include/wifi_p2p.h index 6fb8ccf35..6656b2b17 100644 --- a/interfaces/innerkits/native_cpp/wifi_standard/include/wifi_p2p.h +++ b/interfaces/innerkits/native_cpp/wifi_standard/include/wifi_p2p.h @@ -12,11 +12,12 @@ * See the License for the specific language governing permissions and * limitations under the License. */ + #ifndef OHOS_WIFI_P2P_H #define OHOS_WIFI_P2P_H #include "wifi_errcode.h" -#include "wifi_msg.h" +#include "wifi_p2p_msg.h" #include "i_wifi_p2p_callback.h" namespace OHOS { diff --git a/interfaces/innerkits/native_cpp/wifi_standard/include/wifi_scan.h b/interfaces/innerkits/native_cpp/wifi_standard/include/wifi_scan.h index 419789c6a..1b71a3552 100644 --- a/interfaces/innerkits/native_cpp/wifi_standard/include/wifi_scan.h +++ b/interfaces/innerkits/native_cpp/wifi_standard/include/wifi_scan.h @@ -1,5 +1,5 @@ /* - * Copyright (C) 2021 Huawei Device Co., Ltd. + * Copyright (C) 2021-2022 Huawei Device Co., Ltd. * 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 @@ -16,8 +16,8 @@ #ifndef OHOS_WIFI_SCAN_H #define OHOS_WIFI_SCAN_H -#include "wifi_msg.h" #include "wifi_errcode.h" +#include "wifi_scan_msg.h" #include "i_wifi_scan_callback.h" namespace OHOS { diff --git a/interfaces/innerkits/native_cpp/wifi_standard/interfaces/i_wifi_hotspot.h b/interfaces/innerkits/native_cpp/wifi_standard/interfaces/i_wifi_hotspot.h index 3469e00c1..2dec3195e 100644 --- a/interfaces/innerkits/native_cpp/wifi_standard/interfaces/i_wifi_hotspot.h +++ b/interfaces/innerkits/native_cpp/wifi_standard/interfaces/i_wifi_hotspot.h @@ -1,5 +1,5 @@ /* - * Copyright (C) 2021 Huawei Device Co., Ltd. + * Copyright (C) 2021-2022 Huawei Device Co., Ltd. * 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 @@ -20,7 +20,7 @@ #include "message_parcel.h" #include "message_option.h" #include "wifi_errcode.h" -#include "wifi_msg.h" +#include "wifi_ap_msg.h" #include "define.h" #include "wifi_errcode.h" #include "i_wifi_hotspot_callback.h" diff --git a/interfaces/innerkits/native_cpp/wifi_standard/interfaces/i_wifi_hotspot_callback.h b/interfaces/innerkits/native_cpp/wifi_standard/interfaces/i_wifi_hotspot_callback.h index 98804f4c9..5c3244eb7 100644 --- a/interfaces/innerkits/native_cpp/wifi_standard/interfaces/i_wifi_hotspot_callback.h +++ b/interfaces/innerkits/native_cpp/wifi_standard/interfaces/i_wifi_hotspot_callback.h @@ -1,5 +1,5 @@ /* - * Copyright (C) 2021 Huawei Device Co., Ltd. + * Copyright (C) 2021-2022 Huawei Device Co., Ltd. * 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 @@ -21,7 +21,7 @@ #include #include "message_parcel.h" #include "message_option.h" -#include "wifi_msg.h" +#include "wifi_ap_msg.h" #include "define.h" namespace OHOS { diff --git a/interfaces/innerkits/native_cpp/wifi_standard/interfaces/i_wifi_scan.h b/interfaces/innerkits/native_cpp/wifi_standard/interfaces/i_wifi_scan.h index 093fb572e..105b1f736 100644 --- a/interfaces/innerkits/native_cpp/wifi_standard/interfaces/i_wifi_scan.h +++ b/interfaces/innerkits/native_cpp/wifi_standard/interfaces/i_wifi_scan.h @@ -1,5 +1,5 @@ /* - * Copyright (C) 2021 Huawei Device Co., Ltd. + * Copyright (C) 2021-2022 Huawei Device Co., Ltd. * 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 @@ -21,7 +21,7 @@ #include "wifi_errcode.h" #include "message_parcel.h" #include "message_option.h" -#include "wifi_msg.h" +#include "wifi_scan_msg.h" #include "wifi_errcode.h" #include "i_wifi_scan_callback.h" diff --git a/interfaces/innerkits/native_cpp/wifi_standard/interfaces/wifi_msg.h b/interfaces/innerkits/native_cpp/wifi_standard/interfaces/wifi_msg.h index 0d78b16aa..d3efc1dfc 100755 --- a/interfaces/innerkits/native_cpp/wifi_standard/interfaces/wifi_msg.h +++ b/interfaces/innerkits/native_cpp/wifi_standard/interfaces/wifi_msg.h @@ -1,5 +1,5 @@ /* - * Copyright (C) 2021 Huawei Device Co., Ltd. + * Copyright (C) 2021-2022 Huawei Device Co., Ltd. * 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 @@ -23,9 +23,6 @@ #include #include #include "ip_tools.h" -#include "wifi_ap_msg.h" -#include "wifi_scan_msg.h" -#include "wifi_p2p_msg.h" namespace OHOS { namespace Wifi { @@ -34,9 +31,6 @@ namespace Wifi { #define INVALID_NETWORK_ID (-1) #define IPV4_ADDRESS_TYPE 0 #define IPV6_ADDRESS_TYPE 1 -#define DEVICE_NAME_LENGTH 32 -#define WIFI_MAC_LENGTH 17 -#define MAX_PASSPHRASE_LENGTH 63 enum class SupplicantState { DISCONNECTED = 0, diff --git a/interfaces/innerkits/native_cpp/wifi_standard/interfaces/wifi_p2p_msg.h b/interfaces/innerkits/native_cpp/wifi_standard/interfaces/wifi_p2p_msg.h index 32616f15e..880f08518 100644 --- a/interfaces/innerkits/native_cpp/wifi_standard/interfaces/wifi_p2p_msg.h +++ b/interfaces/innerkits/native_cpp/wifi_standard/interfaces/wifi_p2p_msg.h @@ -12,6 +12,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ + #ifndef OHOS_WIFI_P2P_MSG_H #define OHOS_WIFI_P2P_MSG_H @@ -22,6 +23,10 @@ namespace OHOS { namespace Wifi { +constexpr int WIFI_STR_MAC_LENGTH = 17; +constexpr int MAX_PASSPHRASE_LENGTH = 63; +constexpr int DEVICE_NAME_LENGTH = 32; + enum class P2pGroupStatus { GS_CREATING, GS_CREATED, GS_STARTED, GS_REMOVING, GS_INVALID }; enum class P2pServiceStatus : unsigned char { PSRS_SUCCESS, @@ -289,8 +294,10 @@ private: std::string bssid; /* the length is 17 characters. */ std::string pin; /* the length is 4 or 8 characters. */ }; -const int MAX_GROUP_OWNER_INTENT = 15; + +const int AUTO_GROUP_OWNER_VALUE = -1; const int MIN_GROUP_OWNER_INTENT = 0; +const int MAX_GROUP_OWNER_INTENT = 15; class WifiP2pConfig { public: WifiP2pConfig() @@ -298,7 +305,7 @@ public: goBand(GroupOwnerBand::GO_BAND_AUTO), netId(-1), passphrase(""), - groupOwnerIntent(-1), + groupOwnerIntent(AUTO_GROUP_OWNER_VALUE), groupName("") {} WifiP2pConfig(const WifiP2pConfig &config) diff --git a/interfaces/innerkits/native_cpp/wifi_standard/interfaces/wifi_scan_msg.h b/interfaces/innerkits/native_cpp/wifi_standard/interfaces/wifi_scan_msg.h index fe0c2fd7a..11b42b234 100755 --- a/interfaces/innerkits/native_cpp/wifi_standard/interfaces/wifi_scan_msg.h +++ b/interfaces/innerkits/native_cpp/wifi_standard/interfaces/wifi_scan_msg.h @@ -92,8 +92,8 @@ struct WifiInfoElem { }; enum class ScanHandleNotify { - SCAN_OK = 0, - SCAN_FAIL, + SCAN_FAIL = 0, + SCAN_OK = 1, }; struct WifiScanParams { diff --git a/services/wifi_standard/wifi_framework/common/include/wifi_internal_msg.h b/services/wifi_standard/wifi_framework/common/include/wifi_internal_msg.h index f94f91efd..92f7cd4cb 100755 --- a/services/wifi_standard/wifi_framework/common/include/wifi_internal_msg.h +++ b/services/wifi_standard/wifi_framework/common/include/wifi_internal_msg.h @@ -1,5 +1,5 @@ /* - * Copyright (C) 2021 Huawei Device Co., Ltd. + * Copyright (C) 2021-2022 Huawei Device Co., Ltd. * 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 @@ -17,7 +17,9 @@ #define OHOS_WIFI_INTERNAL_MSG_H #include "wifi_msg.h" +#include "wifi_scan_msg.h" #include "wifi_p2p_msg.h" +#include "wifi_ap_msg.h" namespace OHOS { namespace Wifi { diff --git a/services/wifi_standard/wifi_framework/common/net_helper/dhcpd_interface.h b/services/wifi_standard/wifi_framework/common/net_helper/dhcpd_interface.h index 4fd9cc7ae..7dac1b3a1 100644 --- a/services/wifi_standard/wifi_framework/common/net_helper/dhcpd_interface.h +++ b/services/wifi_standard/wifi_framework/common/net_helper/dhcpd_interface.h @@ -1,5 +1,5 @@ /* - * Copyright (C) 2021 Huawei Device Co., Ltd. + * Copyright (C) 2021-2022 Huawei Device Co., Ltd. * 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 @@ -12,6 +12,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ + #ifndef OHOS_DHCPD_INTERFACE_H #define OHOS_DHCPD_INTERFACE_H #include @@ -22,7 +23,7 @@ #include "ipv4_address.h" #include "ipv6_address.h" #include "mac_address.h" -#include "wifi_msg.h" +#include "wifi_ap_msg.h" #include "i_dhcp_service.h" #define IP_V4 0 diff --git a/services/wifi_standard/wifi_framework/wifi_manage/common/wifi_broadcast_helper.h b/services/wifi_standard/wifi_framework/wifi_manage/common/wifi_broadcast_helper.h index d4f10dd5f..68eea9d5b 100644 --- a/services/wifi_standard/wifi_framework/wifi_manage/common/wifi_broadcast_helper.h +++ b/services/wifi_standard/wifi_framework/wifi_manage/common/wifi_broadcast_helper.h @@ -1,5 +1,5 @@ /* - * Copyright (C) 2021 Huawei Device Co., Ltd. + * Copyright (C) 2021-2022 Huawei Device Co., Ltd. * 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 @@ -16,7 +16,8 @@ #define OHOS_WIFI_BROADCAST_HELPER_H #include -#include "wifi_msg.h" +#include +#include "wifi_p2p_msg.h" namespace OHOS { namespace Wifi { diff --git a/services/wifi_standard/wifi_framework/wifi_manage/idl_client/idl_interface/i_wifi.c b/services/wifi_standard/wifi_framework/wifi_manage/idl_client/idl_interface/i_wifi.c index 915dc1509..d5e307de4 100644 --- a/services/wifi_standard/wifi_framework/wifi_manage/idl_client/idl_interface/i_wifi.c +++ b/services/wifi_standard/wifi_framework/wifi_manage/idl_client/idl_interface/i_wifi.c @@ -1,5 +1,5 @@ /* - * Copyright (C) 2021 Huawei Device Co., Ltd. + * Copyright (C) 2021-2022 Huawei Device Co., Ltd. * 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 @@ -272,6 +272,7 @@ static void IdlCbkWpaEventDeal(Context *context, int event) static int IdlDealStaApEvent(Context *context, int event) { + LOGI("OnTransact deal sta/ap event: %{public}d", event); switch (event) { case WIFI_IDL_CBK_CMD_FAILURE: case WIFI_IDL_CBK_CMD_STARTED: @@ -749,6 +750,7 @@ static int IdlDealP2pEventSecond(Context *context, int event) static int IdlDealP2pEvent(Context *context, int event) { + LOGI("OnTransact deal p2p event: %{public}d", event); if (IdlDealP2pEventFirst(context, event) == 0 || IdlDealP2pEventSecond(context, event) == 0) { return 0; } @@ -759,6 +761,7 @@ int OnTransact(Context *context) { int event = 0; if (ReadInt(context, &event) < 0) { + LOGE("OnTransact read event failed!"); return -1; } if (IdlDealStaApEvent(context, event) < 0 && IdlDealP2pEvent(context, event) < 0) { diff --git a/services/wifi_standard/wifi_framework/wifi_manage/wifi_ap/ap_config_use.h b/services/wifi_standard/wifi_framework/wifi_manage/wifi_ap/ap_config_use.h index 87b3c88b5..fbc012a1f 100644 --- a/services/wifi_standard/wifi_framework/wifi_manage/wifi_ap/ap_config_use.h +++ b/services/wifi_standard/wifi_framework/wifi_manage/wifi_ap/ap_config_use.h @@ -1,5 +1,5 @@ /* - * Copyright (C) 2021 Huawei Device Co., Ltd. + * Copyright (C) 2021-2022 Huawei Device Co., Ltd. * 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 @@ -16,9 +16,10 @@ #define OHOS_AP_CONFIG_UTIL_H #include +#include #include "ap_define.h" #include "ap_macro.h" -#include "wifi_msg.h" +#include "wifi_ap_msg.h" namespace OHOS { namespace Wifi { diff --git a/services/wifi_standard/wifi_framework/wifi_manage/wifi_ap/ap_define.h b/services/wifi_standard/wifi_framework/wifi_manage/wifi_ap/ap_define.h index f11326854..a92c67b85 100644 --- a/services/wifi_standard/wifi_framework/wifi_manage/wifi_ap/ap_define.h +++ b/services/wifi_standard/wifi_framework/wifi_manage/wifi_ap/ap_define.h @@ -1,5 +1,5 @@ /* - * Copyright (C) 2021 Huawei Device Co., Ltd. + * Copyright (C) 2021-2022 Huawei Device Co., Ltd. * 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 @@ -15,11 +15,10 @@ #ifndef OHOS_AP_DEFINE_H #define OHOS_AP_DEFINE_H -#include #include +#include #include "ap_macro.h" -#include "wifi_msg.h" namespace OHOS { namespace Wifi { diff --git a/services/wifi_standard/wifi_framework/wifi_manage/wifi_ap/ap_monitor.cpp b/services/wifi_standard/wifi_framework/wifi_manage/wifi_ap/ap_monitor.cpp index eea3b37b8..d5da6f598 100644 --- a/services/wifi_standard/wifi_framework/wifi_manage/wifi_ap/ap_monitor.cpp +++ b/services/wifi_standard/wifi_framework/wifi_manage/wifi_ap/ap_monitor.cpp @@ -1,5 +1,5 @@ /* - * Copyright (C) 2021 Huawei Device Co., Ltd. + * Copyright (C) 2021-2022 Huawei Device Co., Ltd. * 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 diff --git a/services/wifi_standard/wifi_framework/wifi_manage/wifi_ap/ap_monitor.h b/services/wifi_standard/wifi_framework/wifi_manage/wifi_ap/ap_monitor.h index 6afb5c1c0..6184302dd 100644 --- a/services/wifi_standard/wifi_framework/wifi_manage/wifi_ap/ap_monitor.h +++ b/services/wifi_standard/wifi_framework/wifi_manage/wifi_ap/ap_monitor.h @@ -1,5 +1,5 @@ /* - * Copyright (C) 2021 Huawei Device Co., Ltd. + * Copyright (C) 2021-2022 Huawei Device Co., Ltd. * 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 @@ -12,11 +12,14 @@ * See the License for the specific language governing permissions and * limitations under the License. */ + #ifndef OHOS_AP_MONITOR_H #define OHOS_AP_MONITOR_H #include +#include +#include "wifi_ap_msg.h" #include "ap_define.h" #include "wifi_idl_struct.h" diff --git a/services/wifi_standard/wifi_framework/wifi_manage/wifi_ap/ap_started_state.h b/services/wifi_standard/wifi_framework/wifi_manage/wifi_ap/ap_started_state.h index ff89ea705..71164bfb2 100644 --- a/services/wifi_standard/wifi_framework/wifi_manage/wifi_ap/ap_started_state.h +++ b/services/wifi_standard/wifi_framework/wifi_manage/wifi_ap/ap_started_state.h @@ -1,5 +1,5 @@ /* - * Copyright (C) 2021 Huawei Device Co., Ltd. + * Copyright (C) 2021-2022 Huawei Device Co., Ltd. * 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 @@ -15,9 +15,11 @@ #ifndef OHOS_AP_STARTEND_STATE_H #define OHOS_AP_STARTEND_STATE_H +#include #include "ap_define.h" #include "state.h" #include "wifi_ap_nat_manager.h" +#include "wifi_ap_msg.h" namespace OHOS { namespace Wifi { diff --git a/services/wifi_standard/wifi_framework/wifi_manage/wifi_ap/ap_stations_manager.h b/services/wifi_standard/wifi_framework/wifi_manage/wifi_ap/ap_stations_manager.h index 02ea7d5a3..2b049c7ec 100644 --- a/services/wifi_standard/wifi_framework/wifi_manage/wifi_ap/ap_stations_manager.h +++ b/services/wifi_standard/wifi_framework/wifi_manage/wifi_ap/ap_stations_manager.h @@ -1,5 +1,5 @@ /* - * Copyright (C) 2021 Huawei Device Co., Ltd. + * Copyright (C) 2021-2022 Huawei Device Co., Ltd. * 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 @@ -16,6 +16,7 @@ #define OHOS_STATIONS_MANAGER_H #include "ap_define.h" +#include "wifi_ap_msg.h" #include "wifi_error_no.h" namespace OHOS { diff --git a/services/wifi_standard/wifi_framework/wifi_manage/wifi_hid2d_service_utils.cpp b/services/wifi_standard/wifi_framework/wifi_manage/wifi_hid2d_service_utils.cpp index 24a9a33de..e7d2af27b 100755 --- a/services/wifi_standard/wifi_framework/wifi_manage/wifi_hid2d_service_utils.cpp +++ b/services/wifi_standard/wifi_framework/wifi_manage/wifi_hid2d_service_utils.cpp @@ -54,7 +54,7 @@ bool IpPool::InitIpPool(const std::string& serverIp) std::string IpPool::GetIp(const std::string& gcMac) { - WIFI_LOGI("Get ip, gcMac: %{public}s", gcMac.c_str()); + WIFI_LOGI("Get ip, gcMac: %{private}s", gcMac.c_str()); std::unique_lock guard(g_ipPoolMutex); std::string ip = ""; @@ -70,7 +70,7 @@ std::string IpPool::GetIp(const std::string& gcMac) void IpPool::ReleaseIp(const std::string& gcMac) { - WIFI_LOGI("Release ip, gcMac: %{public}s", gcMac.c_str()); + WIFI_LOGI("Release ip, gcMac: %{private}s", gcMac.c_str()); std::unique_lock guard(g_ipPoolMutex); auto iter = mapGcMacToAllocIp.find(gcMac); diff --git a/services/wifi_standard/wifi_framework/wifi_manage/wifi_p2p/p2p_state_machine.cpp b/services/wifi_standard/wifi_framework/wifi_manage/wifi_p2p/p2p_state_machine.cpp index 90d63bae3..861d8e143 100644 --- a/services/wifi_standard/wifi_framework/wifi_manage/wifi_p2p/p2p_state_machine.cpp +++ b/services/wifi_standard/wifi_framework/wifi_manage/wifi_p2p/p2p_state_machine.cpp @@ -467,7 +467,8 @@ P2pConfigErrCode P2pStateMachine::IsConfigUnusable(const WifiP2pConfigInternal & if (!device.IsValid()) { return P2pConfigErrCode::MAC_NOT_FOUND; } - if (config.GetGroupOwnerIntent() < 0 || config.GetGroupOwnerIntent() > GROUP_OWNER_MAX_INTENT) { + if (config.GetGroupOwnerIntent() < AUTO_GROUP_OWNER_VALUE || + config.GetGroupOwnerIntent() > GROUP_OWNER_MAX_INTENT) { return P2pConfigErrCode::ERR_INTENT; } if (config.GetGroupName().length() > NETWORK_NAME_MAX_LENGTH) { diff --git a/services/wifi_standard/wifi_framework/wifi_manage/wifi_p2p/wifi_p2p_device_manager.h b/services/wifi_standard/wifi_framework/wifi_manage/wifi_p2p/wifi_p2p_device_manager.h index 819368c1a..5e079568a 100644 --- a/services/wifi_standard/wifi_framework/wifi_manage/wifi_p2p/wifi_p2p_device_manager.h +++ b/services/wifi_standard/wifi_framework/wifi_manage/wifi_p2p/wifi_p2p_device_manager.h @@ -1,5 +1,5 @@ /* - * Copyright (C) 2021 Huawei Device Co., Ltd. + * Copyright (C) 2021-2022 Huawei Device Co., Ltd. * 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 @@ -16,7 +16,7 @@ #define OHOS_P2P_DEVICE_MANAGER_H #include -#include "wifi_msg.h" +#include "wifi_p2p_msg.h" namespace OHOS { namespace Wifi { diff --git a/services/wifi_standard/wifi_framework/wifi_manage/wifi_p2p/wifi_p2p_group_info_proxy.h b/services/wifi_standard/wifi_framework/wifi_manage/wifi_p2p/wifi_p2p_group_info_proxy.h index 8be86fad9..ba2ea2721 100644 --- a/services/wifi_standard/wifi_framework/wifi_manage/wifi_p2p/wifi_p2p_group_info_proxy.h +++ b/services/wifi_standard/wifi_framework/wifi_manage/wifi_p2p/wifi_p2p_group_info_proxy.h @@ -1,5 +1,5 @@ /* - * Copyright (C) 2021 Huawei Device Co., Ltd. + * Copyright (C) 2021-2022 Huawei Device Co., Ltd. * 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 @@ -16,7 +16,7 @@ #define OHOS_P2P_WIFI_P2P_GROUP_INFO_PROXY_H #include -#include "wifi_msg.h" +#include "wifi_p2p_msg.h" namespace OHOS { namespace Wifi { diff --git a/services/wifi_standard/wifi_hal/etc/init/BUILD.gn b/services/wifi_standard/wifi_hal/etc/init/BUILD.gn index 9e1db89f9..e0975340c 100755 --- a/services/wifi_standard/wifi_hal/etc/init/BUILD.gn +++ b/services/wifi_standard/wifi_hal/etc/init/BUILD.gn @@ -17,17 +17,13 @@ group("etc") { deps = [ ":hostapd.conf", ":p2p_supplicant.conf", - ":wifi_hal_service.rc", + ":wifi_hal_service.cfg", ":wpa_supplicant.conf", ] } -ohos_prebuilt_etc("wifi_hal_service.rc") { - if (use_musl) { - source = "wifi_hal_service.cfg" - } else { - source = "wifi_hal_service.rc" - } +ohos_prebuilt_etc("wifi_hal_service.cfg") { + source = "wifi_hal_service.cfg" relative_install_dir = "init" part_name = "wifi_standard" subsystem_name = "communication" diff --git a/tests/wifi_standard/wifi_framework/wifi_manage/wifi_ap/Mock/mock_wifi_ap_hal_interface.h b/tests/wifi_standard/wifi_framework/wifi_manage/wifi_ap/Mock/mock_wifi_ap_hal_interface.h index 6cd3dbdb1..91abe442c 100644 --- a/tests/wifi_standard/wifi_framework/wifi_manage/wifi_ap/Mock/mock_wifi_ap_hal_interface.h +++ b/tests/wifi_standard/wifi_framework/wifi_manage/wifi_ap/Mock/mock_wifi_ap_hal_interface.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2021 Huawei Device Co., Ltd. + * Copyright (c) 2021-2022 Huawei Device Co., Ltd. * 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 @@ -15,7 +15,7 @@ #ifndef OHOS_MOCK_WIFI_AP_HAL_INTERFACE_H #define OHOS_MOCK_WIFI_AP_HAL_INTERFACE_H -#include "wifi_msg.h" + #include #include #include @@ -23,7 +23,7 @@ #include "i_wifi_struct.h" #include "wifi_error_no.h" -#include "wifi_msg.h" +#include "wifi_ap_msg.h" #include #include #include diff --git a/tests/wifi_standard/wifi_framework/wifi_manage/wifi_ap/Mock/mock_wifi_settings.h b/tests/wifi_standard/wifi_framework/wifi_manage/wifi_ap/Mock/mock_wifi_settings.h index e86e83733..436c9040c 100644 --- a/tests/wifi_standard/wifi_framework/wifi_manage/wifi_ap/Mock/mock_wifi_settings.h +++ b/tests/wifi_standard/wifi_framework/wifi_manage/wifi_ap/Mock/mock_wifi_settings.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2021 Huawei Device Co., Ltd. + * Copyright (c) 2021-2022 Huawei Device Co., Ltd. * 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 @@ -19,7 +19,7 @@ #include #include -#include "wifi_msg.h" +#include "wifi_ap_msg.h" #include namespace OHOS { diff --git a/tests/wifi_standard/wifi_framework/wifi_manage/wifi_ap/Mock/operator_overload.h b/tests/wifi_standard/wifi_framework/wifi_manage/wifi_ap/Mock/operator_overload.h index 3a63a5b10..9531d2ed7 100644 --- a/tests/wifi_standard/wifi_framework/wifi_manage/wifi_ap/Mock/operator_overload.h +++ b/tests/wifi_standard/wifi_framework/wifi_manage/wifi_ap/Mock/operator_overload.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2021 Huawei Device Co., Ltd. + * Copyright (c) 2021-2022 Huawei Device Co., Ltd. * 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 @@ -16,7 +16,7 @@ #ifndef OHOS_OPERATOR_OVERLOAD_H #define OHOS_OPERATOR_OVERLOAD_H -#include "wifi_msg.h" +#include "wifi_ap_msg.h" namespace OHOS { namespace Wifi { diff --git a/tests/wifi_standard/wifi_framework/wifi_manage/wifi_p2p/test/Mock/mock_wifi_p2p_hal_interface.h b/tests/wifi_standard/wifi_framework/wifi_manage/wifi_p2p/test/Mock/mock_wifi_p2p_hal_interface.h index b942b5e5e..2e050d421 100644 --- a/tests/wifi_standard/wifi_framework/wifi_manage/wifi_p2p/test/Mock/mock_wifi_p2p_hal_interface.h +++ b/tests/wifi_standard/wifi_framework/wifi_manage/wifi_p2p/test/Mock/mock_wifi_p2p_hal_interface.h @@ -19,7 +19,7 @@ #include #include #include -#include "wifi_msg.h" +#include "wifi_p2p_msg.h" #include "wifi_error_no.h" #include "wifi_idl_struct.h" #include "wifi_p2p_event_callback.h" diff --git a/tests/wifi_standard/wifi_framework/wifi_manage/wifi_p2p/test/Mock/mock_wifi_settings.h b/tests/wifi_standard/wifi_framework/wifi_manage/wifi_p2p/test/Mock/mock_wifi_settings.h index 004162b11..b18373588 100644 --- a/tests/wifi_standard/wifi_framework/wifi_manage/wifi_p2p/test/Mock/mock_wifi_settings.h +++ b/tests/wifi_standard/wifi_framework/wifi_manage/wifi_p2p/test/Mock/mock_wifi_settings.h @@ -1,5 +1,5 @@ /* - * Copyright (C) 2021 Huawei Device Co., Ltd. + * Copyright (C) 2021-2022 Huawei Device Co., Ltd. * 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 @@ -19,7 +19,7 @@ #include #include #include -#include "wifi_msg.h" +#include "wifi_p2p_msg.h" #include namespace OHOS { @@ -28,28 +28,11 @@ const int MODE_ADD = 0; const int MODE_DEL = 1; const int MODE_UPDATE = 2; -using ChannelsTable = std::map>; - class MockWifiSettings { public: virtual ~MockWifiSettings() = default; virtual int SetCountryCode(const std::string &countryCode) = 0; virtual int GetCountryCode(std::string &countryCode) = 0; - virtual int GetHotspotState() = 0; - virtual int SetHotspotState(int state) = 0; - virtual int SetHotspotConfig(const HotspotConfig &config) = 0; - virtual int GetHotspotConfig(HotspotConfig &config) = 0; - virtual int GetStationList(std::vector &results) = 0; - virtual int ManageStation(const StationInfo &info, int mode) = 0; /* add / update / remove */ - virtual int ClearStationList() = 0; - virtual int GetBlockList(std::vector &results) = 0; - virtual int ManageBlockList(const StationInfo &info, int mode) = 0; /* add / remove */ - virtual int FindConnStation(const StationInfo &info) = 0; - virtual int GetValidBands(std::vector &bands) = 0; - virtual int SetValidChannels(const ChannelsTable &channelsInfo) = 0; - virtual int GetValidChannels(ChannelsTable &channelsInfo) = 0; - virtual int ClearValidChannels() = 0; - virtual int GetApMaxConnNum() = 0; virtual int SetWifiP2pGroupInfo(const std::vector &groups) = 0; virtual int SetP2pVendorConfig(const P2pVendorConfig &config) = 0; virtual int GetP2pVendorConfig(P2pVendorConfig &config) = 0; @@ -71,21 +54,6 @@ public: MOCK_METHOD1(SetWifiP2pGroupInfo, int(const std::vector &groups)); MOCK_METHOD1(SetCountryCode, int(const std::string &countryCode)); MOCK_METHOD1(GetCountryCode, int(std::string &countryCode)); - MOCK_METHOD0(GetHotspotState, int()); - MOCK_METHOD1(SetHotspotState, int(int)); - MOCK_METHOD1(SetHotspotConfig, int(const HotspotConfig &config)); - MOCK_METHOD1(GetHotspotConfig, int(HotspotConfig &config)); - MOCK_METHOD1(GetStationList, int(std::vector &results)); - MOCK_METHOD2(ManageStation, int(const StationInfo &info, int mode)); - MOCK_METHOD0(ClearStationList, int()); - MOCK_METHOD1(GetBlockList, int(std::vector &results)); - MOCK_METHOD2(ManageBlockList, int(const StationInfo &info, int mode)); - MOCK_METHOD1(FindConnStation, int(const StationInfo &info)); - MOCK_METHOD1(GetValidBands, int(std::vector &bands)); - MOCK_METHOD1(SetValidChannels, int(const ChannelsTable &channelsInfo)); - MOCK_METHOD1(GetValidChannels, int(ChannelsTable &channelsInfo)); - MOCK_METHOD0(ClearValidChannels, int()); - MOCK_METHOD0(GetApMaxConnNum, int()); }; } // namespace Wifi } // namespace OHOS -- Gitee