diff --git a/sensor/hal/BUILD.gn b/sensor/hal/BUILD.gn index 266eddd6a3cbd161f44536e3717e5e9bd171d048..92c187801a7ec053d68da4803d6767270521cf6f 100644 --- a/sensor/hal/BUILD.gn +++ b/sensor/hal/BUILD.gn @@ -12,49 +12,95 @@ #See the License for the specific language governing permissions and #limitations under the License. # - -import("//build/lite/config/component/lite_component.gni") +if (defined(ohos_lite)) { + import("//build/lite/config/component/lite_component.gni") +} else { + import("//build/ohos.gni") +} SENSOR_ROOT_DIR = "//drivers/peripheral/sensor" -FWK_ROOT_DIR = "//drivers/framework" - -shared_library("hdi_sensor") { - sources = [ - "$SENSOR_ROOT_DIR/hal/src/sensor_channel.c", - "$SENSOR_ROOT_DIR/hal/src/sensor_core.c", - "$SENSOR_ROOT_DIR/hal/src/sensor_manager.c", - ] - - include_dirs = [ - "$SENSOR_ROOT_DIR/hal/include", - "$SENSOR_ROOT_DIR/interfaces/include", - "$FWK_ROOT_DIR/include", - "$FWK_ROOT_DIR/include/utils", - "$FWK_ROOT_DIR/include/osal", - "$FWK_ROOT_DIR/include/core", - "$FWK_ROOT_DIR/ability/sbuf/include", - "//drivers/adapter/uhdf/posix/include", - "//third_party/bounds_checking_function/include", - ] - - deps = [ - "//base/hiviewdfx/hilog_lite/frameworks/featured:hilog_shared", - "//drivers/adapter/uhdf/manager:hdf_core", - "//drivers/adapter/uhdf/posix:hdf_posix_osal", - "//third_party/bounds_checking_function:libsec_shared", - ] - public_deps = [ "//third_party/bounds_checking_function:libsec_shared" ] - - cflags = [ - "-Wall", - "-Wextra", - "-Werror", - "-fsigned-char", - "-fno-common", - "-fno-strict-aliasing", - ] -} -lite_component("hdi") { - features = [ ":hdi_sensor" ] +if (defined(ohos_lite)) { + FWK_ROOT_DIR = "//drivers/framework" + shared_library("hdi_sensor") { + sources = [ + "$SENSOR_ROOT_DIR/hal/src/sensor_channel.c", + "$SENSOR_ROOT_DIR/hal/src/sensor_core.c", + "$SENSOR_ROOT_DIR/hal/src/sensor_manager.c", + ] + + include_dirs = [ + "$SENSOR_ROOT_DIR/hal/include", + "$SENSOR_ROOT_DIR/interfaces/include", + "$FWK_ROOT_DIR/include", + "$FWK_ROOT_DIR/include/utils", + "$FWK_ROOT_DIR/include/osal", + "$FWK_ROOT_DIR/include/core", + "$FWK_ROOT_DIR/ability/sbuf/include", + "//drivers/adapter/uhdf/posix/include", + "//third_party/bounds_checking_function/include", + ] + + deps = [ + "//base/hiviewdfx/hilog_lite/frameworks/featured:hilog_shared", + "//drivers/adapter/uhdf/manager:hdf_core", + "//drivers/adapter/uhdf/posix:hdf_posix_osal", + "//third_party/bounds_checking_function:libsec_shared", + ] + public_deps = [ "//third_party/bounds_checking_function:libsec_shared" ] + + cflags = [ + "-Wall", + "-Wextra", + "-Werror", + "-fsigned-char", + "-fno-common", + "-fno-strict-aliasing", + ] + } + + lite_component("hdi") { + features = [ ":hdi_sensor" ] + } +} else { + config("libhdi_sensor_pub_config") { + visibility = [ ":*" ] + + include_dirs = [ "$SENSOR_ROOT_DIR/interfaces/include" ] + } + + ohos_shared_library("hdi_sensor") { + public_configs = [ ":libhdi_sensor_pub_config" ] + sources = [ + "$SENSOR_ROOT_DIR/hal/src/sensor_channel.c", + "$SENSOR_ROOT_DIR/hal/src/sensor_core.c", + "$SENSOR_ROOT_DIR/hal/src/sensor_manager.c", + ] + + include_dirs = [ + "$SENSOR_ROOT_DIR/hal/include", + "$SENSOR_ROOT_DIR/interfaces/include", + "//third_party/bounds_checking_function/include", + ] + + deps = [ + "//drivers/adapter/uhdf2/osal:libhdf_utils", + "//utils/native/base:utils", + ] + defines = [ "__OHOS__USER__" ] + cflags = [ + "-Wall", + "-Wextra", + "-Werror", + "-fsigned-char", + "-fno-common", + "-fno-strict-aliasing", + ] + subsystem_name = "hdf" + if (is_standard_system) { + external_deps = [ "hiviewdfx_hilog_native:libhilog" ] + } else { + external_deps = [ "hilog:libhilog" ] + } + } } diff --git a/sensor/hal/src/sensor_channel.c b/sensor/hal/src/sensor_channel.c index 355bdf74fd84893520bff619226023a4ff0b9b91..63d51c68d2dc88b939c8c5a18c1c9e7a4c878cf3 100644 --- a/sensor/hal/src/sensor_channel.c +++ b/sensor/hal/src/sensor_channel.c @@ -171,7 +171,7 @@ int32_t Unregister(void) manager->hasSensorListener = false; HdfIoServiceGroupRecycle(manager->serviceGroup); manager->serviceGroup = NULL; - manager->recordDataCb = NULL; + manager->recordDataCb = NULL; (void)OsalMutexUnlock(&manager->mutex); diff --git a/sensor/test/BUILD.gn b/sensor/test/BUILD.gn index 9aef547db58e734c72f68448ed1c6ab8bbf5132f..6c3889b2239ed2183ec837c225d4a66ced57b362 100644 --- a/sensor/test/BUILD.gn +++ b/sensor/test/BUILD.gn @@ -11,18 +11,25 @@ # See the License for the specific language governing permissions and # limitations under the License. -import("//build/lite/config/component/lite_component.gni") -import("//build/lite/config/test.gni") +if (defined(ohos_lite)) { + import("//build/lite/config/component/lite_component.gni") + import("//build/lite/config/test.gni") -lite_component("hdf_test_sensor") { - # add hdf subsystem unittest - if (ohos_build_type == "debug") { - if (board_name == "hi3516dv300" || board_name == "hispark_taurus") { - deps = [ - "performance:hdf_peripheral_sensor_test_performance", - "unittest:hdf_peripheral_sensor_test", - ] + lite_component("hdf_test_sensor") { + # add hdf subsystem unittest + if (ohos_build_type == "debug") { + if (board_name == "hi3516dv300" || board_name == "hispark_taurus") { + deps = [ + "performance:hdf_peripheral_sensor_test_performance", + "unittest:hdf_peripheral_sensor_test", + ] + } } + features = [] + } +} else { + group("hdf_test_sensor") { + testonly = true + deps = [ "unittest:hdf_unittest_sensor" ] } - features = [] } diff --git a/sensor/test/unittest/BUILD.gn b/sensor/test/unittest/BUILD.gn index f1e8f6e8bd542b1274a9511584bce233874e83f8..6ae99ac57840c86252db8a6ddb4e74df9799bda6 100644 --- a/sensor/test/unittest/BUILD.gn +++ b/sensor/test/unittest/BUILD.gn @@ -11,38 +11,73 @@ # See the License for the specific language governing permissions and # limitations under the License. -import("//build/lite/config/test.gni") +if (defined(ohos_lite)) { + import("//build/lite/config/component/lite_component.gni") + import("//build/lite/config/test.gni") +} else { + import("//build/ohos.gni") + import("//build/test.gni") + import("//drivers/adapter/uhdf2/uhdf.gni") +} + +if (defined(ohos_lite)) { + unittest("hdf_peripheral_sensor_test") { + output_extension = "bin" + output_dir = "$root_out_dir/test/unittest/hdf" + include_dirs = [ + "//third_party/bounds_checking_function/include", + "//drivers/framework/ability/sbuf/include", + "//drivers/framework/include/platform", + "//drivers/framework/include/core", + "//drivers/framework/include/osal", + "//drivers/framework/include/utils", + "//drivers/peripheral/sensor/interfaces/include", + "//drivers/adapter/uhdf/posix/include", + "//drivers/framework/test/unittest/include", + ] -unittest("hdf_peripheral_sensor_test") { - output_extension = "bin" - output_dir = "$root_out_dir/test/unittest/hdf" - include_dirs = [ - "//third_party/bounds_checking_function/include", - "//drivers/framework/ability/sbuf/include", - "//drivers/framework/include/platform", - "//drivers/framework/include/core", - "//drivers/framework/include/osal", - "//drivers/framework/include/utils", - "//drivers/peripheral/sensor/interfaces/include", - "//drivers/adapter/uhdf/posix/include", - "//drivers/framework/test/unittest/include", - ] + sources = [ "./common/hdf_sensor_test.cpp" ] + cflags = [ + "-Wall", + "-Wextra", + "-Werror", + "-fsigned-char", + "-fno-common", + "-fno-strict-aliasing", + ] + deps = [ + "//base/hiviewdfx/hilog_lite/frameworks/featured:hilog_shared", + "//drivers/adapter/uhdf/manager:hdf_core", + "//drivers/adapter/uhdf/posix:hdf_posix_osal", + "//drivers/adapter/uhdf/test/unittest/common:hdf_test_common", + "//drivers/peripheral/sensor/hal:hdi_sensor", + ] + public_deps = [ "//third_party/bounds_checking_function:libsec_shared" ] + } +} else { + module_output_path = "hdf/sensor" + ohos_unittest("hdf_unittest_sensor") { + module_out_path = module_output_path + include_dirs = [] - sources = [ "./common/hdf_sensor_test.cpp" ] - cflags = [ - "-Wall", - "-Wextra", - "-Werror", - "-fsigned-char", - "-fno-common", - "-fno-strict-aliasing", - ] - deps = [ - "//base/hiviewdfx/hilog_lite/frameworks/featured:hilog_shared", - "//drivers/adapter/uhdf/manager:hdf_core", - "//drivers/adapter/uhdf/posix:hdf_posix_osal", - "//drivers/adapter/uhdf/test/unittest/common:hdf_test_common", - "//drivers/peripheral/sensor/hal:hdi_sensor", - ] - public_deps = [ "//third_party/bounds_checking_function:libsec_shared" ] + sources = [ "./common/hdf_sensor_test.cpp" ] + cflags = [ + "-Wall", + "-Wextra", + "-Werror", + "-fsigned-char", + "-fno-common", + "-fno-strict-aliasing", + ] + deps = [ + "$hdf_uhdf_path/osal:libhdf_utils", + "//drivers/peripheral/sensor/hal:hdi_sensor", + "//utils/native/base:utils", + ] + if (is_standard_system) { + external_deps = [ "hiviewdfx_hilog_native:libhilog" ] + } else { + external_deps = [ "hilog:libhilog" ] + } + } } diff --git a/sensor/test/unittest/common/hdf_sensor_test.cpp b/sensor/test/unittest/common/hdf_sensor_test.cpp index f1b82875be3a4202a29dffe9008c39db22437357..a8817028627580622f89aeaee692bab22cb803b4 100755 --- a/sensor/test/unittest/common/hdf_sensor_test.cpp +++ b/sensor/test/unittest/common/hdf_sensor_test.cpp @@ -41,12 +41,12 @@ namespace { float *data = (float*)event->data; if (event->sensorId == 0) { - printf("time [%lld] sensor id [%d] data [%f]\n\r", event->timestamp, event->sensorId, *(data)); + printf("sensor id [%d] data [%f]\n\r", event->sensorId, *(data)); if (fabs(*data) > 1e-5) { g_sensorDataFlag = 1; } } else if (event->sensorId == 1) { - printf("time [%lld] sensor id [%d] x-[%f] y-[%f] z-[%f]\n\r", event->timestamp, + printf("sensor id [%d] x-[%f] y-[%f] z-[%f]\n\r", event->sensorId, (*data), *(data + 1), *(data + SENSOR_AXISZ)); if (fabs(*data) > 1e-5) { g_sensorDataFlag = 1; @@ -197,7 +197,7 @@ HWTEST_F(HdfSensorTest, GetSensorList002, TestSize.Level1) EXPECT_NE(nullptr, sensorInfo); return; } - printf("get sensor list num[%d] size[%u]\n\r", count, sizeof(*sensorInfo)); + printf("get sensor list num[%d]\n\r", count); info = sensorInfo; testSensorInfo = sensorInfo; accelSensorInfo = sensorInfo; diff --git a/wlan/client/BUILD.gn b/wlan/client/BUILD.gn index 1a1b94e1c0c396bdab88a963511f42534be2a022..a131cfcc94d7a44cd426089553e5f61190d0a0a4 100755 --- a/wlan/client/BUILD.gn +++ b/wlan/client/BUILD.gn @@ -11,45 +11,84 @@ # See the License for the specific language governing permissions and # limitations under the License. -import("//build/lite/config/component/lite_component.gni") - -FWK_ROOT_DIR = "//drivers/framework" - -shared_library("wifi_driver_client") { - output_name = "wifi_driver_client" - sources = [ "src/wifi_driver_client.c" ] - - include_dirs = [ - "include", - "$FWK_ROOT_DIR/include/osal", - "$FWK_ROOT_DIR/include", - "$FWK_ROOT_DIR/include/utils", - "$FWK_ROOT_DIR/core/shared/include", - "$FWK_ROOT_DIR/ability/sbuf/include", - "$FWK_ROOT_DIR/include/core", - "//drivers/adapter/uhdf/posix/include", - "//base/hiviewdfx/hilog_lite/interfaces/native/innerkits", - ] - - deps = [ - "//drivers/adapter/uhdf/posix:hdf_posix_osal", - "//third_party/bounds_checking_function:libsec_shared", - ] - - defines = [ "__USER__" ] - - cflags = [ - "-Wall", - "-Wextra", - "-Werror", - "-fsigned-char", - "-fno-common", - "-fno-strict-aliasing", - "-Wno-format", - "-Wno-format-extra-args", - ] +if (defined(ohos_lite)) { + import("//build/lite/config/component/lite_component.gni") +} else { + import("//build/ohos.gni") } -lite_component("hdi_wifi") { - features = [ ":wifi_driver_client" ] +if (defined(ohos_lite)) { + FWK_ROOT_DIR = "//drivers/framework" + + shared_library("wifi_driver_client") { + output_name = "wifi_driver_client" + sources = [ "src/wifi_driver_client.c" ] + + include_dirs = [ + "include", + "$FWK_ROOT_DIR/include/osal", + "$FWK_ROOT_DIR/include", + "$FWK_ROOT_DIR/include/utils", + "$FWK_ROOT_DIR/core/shared/include", + "$FWK_ROOT_DIR/ability/sbuf/include", + "$FWK_ROOT_DIR/include/core", + "//drivers/adapter/uhdf/posix/include", + "//base/hiviewdfx/hilog_lite/interfaces/native/innerkits", + ] + + deps = [ + "//drivers/adapter/uhdf/posix:hdf_posix_osal", + "//third_party/bounds_checking_function:libsec_shared", + ] + + defines = [ "__USER__" ] + + cflags = [ + "-Wall", + "-Wextra", + "-Werror", + "-fsigned-char", + "-fno-common", + "-fno-strict-aliasing", + "-Wno-format", + "-Wno-format-extra-args", + ] + } + + lite_component("hdi_wifi") { + features = [ ":wifi_driver_client" ] + } +} else { + CLIENT_ROOT_DIR = "//drivers/peripheral/wlan" + + ohos_shared_library("wifi_driver_client") { + sources = [ "$CLIENT_ROOT_DIR/client/src/wifi_driver_client.c" ] + + include_dirs = [ + "$CLIENT_ROOT_DIR/client/include", + "$CLIENT_ROOT_DIR/interfaces/include", + "//third_party/bounds_checking_function/include", + "//base/hiviewdfx/hilog/interfaces/native/innerkits/include", + ] + + deps = [ + "//base/hiviewdfx/hilog/interfaces/native/innerkits:libhilog", + "//drivers/adapter/uhdf2/osal:libhdf_utils", + "//utils/native/base:utils", + ] + + defines = [ "__OHOS__USER__" ] + + cflags = [ + "-Wall", + "-Wextra", + "-Werror", + "-fsigned-char", + "-fno-common", + "-fno-strict-aliasing", + ] + + subsystem_name = "hdf" + install_images = [ "system" ] + } } diff --git a/wlan/client/include/wifi_common_cmd.h b/wlan/client/include/wifi_common_cmd.h index a6f7fb713046375eb809dd39ca99f34266deec3e..7a79db42d09109f83ddc27b799963849b2878d76 100755 --- a/wlan/client/include/wifi_common_cmd.h +++ b/wlan/client/include/wifi_common_cmd.h @@ -34,5 +34,4 @@ enum WifiClientType { #endif #endif - -#endif /* end of wifi_common_cmd.h */ +#endif /* _WIFI_COMMON_CMD_H_ */ diff --git a/wlan/client/include/wifi_driver_client.h b/wlan/client/include/wifi_driver_client.h index 4b551fa20cae2bbbb8b31ed7cd597132b7852926..8c038d00858787ce47d5ab9f50152b2f424706f0 100755 --- a/wlan/client/include/wifi_driver_client.h +++ b/wlan/client/include/wifi_driver_client.h @@ -28,10 +28,8 @@ extern "C" { int32_t WifiMsgServiceInit(void); void WifiMsgServiceDeinit(void); - int32_t WifiMsgRegisterEventListener(struct HdfDevEventlistener *listener); void WifiMsgUnregisterEventListener(struct HdfDevEventlistener *listener); - int32_t WifiCmdBlockSyncSend(const uint32_t cmd, struct HdfSBuf *data, struct HdfSBuf *respData); #ifdef __cplusplus @@ -40,5 +38,4 @@ int32_t WifiCmdBlockSyncSend(const uint32_t cmd, struct HdfSBuf *data, struct Hd #endif #endif - #endif /* end of wifi_driver_client.h */ diff --git a/wlan/client/src/wifi_driver_client.c b/wlan/client/src/wifi_driver_client.c index 6e1d0589340aeba4e4010089107139b6622799c9..4aaf7246f375b762ac0428dbf950c951e2401c71 100755 --- a/wlan/client/src/wifi_driver_client.c +++ b/wlan/client/src/wifi_driver_client.c @@ -34,7 +34,7 @@ int32_t WifiMsgServiceInit(void) g_wifiService = HdfIoServiceBind(DRIVER_SERVICE_NAME); } if (g_wifiService == NULL) { - HDF_LOGE("%s: fail to get remote service!", __func__); + HDF_LOGE("%s: fail to get remote service!, line: %d", __FUNCTION__, __LINE__); return HDF_FAILURE; } return HDF_SUCCESS; @@ -43,10 +43,11 @@ int32_t WifiMsgServiceInit(void) int32_t WifiMsgRegisterEventListener(struct HdfDevEventlistener *listener) { if (g_wifiService == NULL || listener == NULL) { + HDF_LOGE("%s: params or g_wifiService is NULL, line: %d", __FUNCTION__, __LINE__); return HDF_FAILURE; } if (HdfDeviceRegisterEventListener(g_wifiService, listener) != HDF_SUCCESS) { - HDF_LOGE("%s: fail to register event listener", __func__); + HDF_LOGE("%s: fail to register event listener, line: %d", __FUNCTION__, __LINE__); return HDF_FAILURE; } return HDF_SUCCESS; @@ -54,21 +55,23 @@ int32_t WifiMsgRegisterEventListener(struct HdfDevEventlistener *listener) void WifiMsgUnregisterEventListener(struct HdfDevEventlistener *listener) { - if (listener == NULL) { + if (g_wifiService == NULL || listener == NULL) { + HDF_LOGE("%s: params or g_wifiService is NULL, line: %d", __FUNCTION__, __LINE__); return; } if (HdfDeviceUnregisterEventListener(g_wifiService, listener)) { - HDF_LOGE("fail to unregister listener"); + HDF_LOGE("%s: fail to unregister listener, line: %d", __FUNCTION__, __LINE__); } } void WifiMsgServiceDeinit(void) { if (g_wifiService == NULL) { + HDF_LOGE("%s: g_wifiService is NULL, line: %d", __FUNCTION__, __LINE__); return; } if (HdfIoserviceGetListenerCount(g_wifiService) != 0) { - HDF_LOGE("the current EventListener is not empty. cancel the listener registration first."); + HDF_LOGE("%s: EventListener is not empty. cancel listener registration, line: %d", __FUNCTION__, __LINE__); return; } HdfIoServiceRecycle(g_wifiService); @@ -78,15 +81,15 @@ void WifiMsgServiceDeinit(void) int32_t WifiCmdBlockSyncSend(const uint32_t cmd, struct HdfSBuf *reqData, struct HdfSBuf *respData) { if (reqData == NULL) { - HDF_LOGE("%s params is NULL", __func__); + HDF_LOGE("%s: params is NULL, line: %d", __FUNCTION__, __LINE__); return HDF_FAILURE; } if (g_wifiService == NULL || g_wifiService->dispatcher == NULL || g_wifiService->dispatcher->Dispatch == NULL) { - HDF_LOGE("%s:bad remote service found!", __func__); + HDF_LOGE("%s: bad remote service found, line: %d", __FUNCTION__, __LINE__); return HDF_FAILURE; } int32_t ret = g_wifiService->dispatcher->Dispatch(&g_wifiService->object, cmd, reqData, respData); - HDF_LOGI("%s: cmd=%d, ret=%d", __func__, cmd, ret); + HDF_LOGI("%s: cmd=%u, ret=%d, line: %d", __FUNCTION__, cmd, ret, __LINE__); return ret; } diff --git a/wlan/hal/BUILD.gn b/wlan/hal/BUILD.gn index 520051aecb70daaa42f7c34bb53b3aab42fe9e63..1455e74066572a1816b8aead2403adf9f16cd21d 100755 --- a/wlan/hal/BUILD.gn +++ b/wlan/hal/BUILD.gn @@ -11,56 +11,102 @@ # See the License for the specific language governing permissions and # limitations under the License. -import("//build/lite/config/component/lite_component.gni") +if (defined(ohos_lite)) { + import("//build/lite/config/component/lite_component.gni") +} else { + import("//build/ohos.gni") +} -FWK_ROOT_DIR = "//drivers/framework" +if (defined(ohos_lite)) { + FWK_ROOT_DIR = "//drivers/framework" + shared_library("wifi_hal") { + output_name = "wifi_hal" + sources = [ + "src/wifi_hal.c", + "src/wifi_hal_ap_feature.c", + "src/wifi_hal_base_feature.c", + "src/wifi_hal_cmd.c", + "src/wifi_hal_event.c", + "src/wifi_hal_sta_feature.c", + "src/wifi_hal_util.c", + ] -shared_library("wifi_hal") { - output_name = "wifi_hal" - sources = [ - "src/wifi_hal.c", - "src/wifi_hal_ap_feature.c", - "src/wifi_hal_base_feature.c", - "src/wifi_hal_cmd.c", - "src/wifi_hal_event.c", - "src/wifi_hal_sta_feature.c", - "src/wifi_hal_util.c", - ] + include_dirs = [ + "include", + "//drivers/peripheral/wlan/interfaces/include", + "//drivers/peripheral/wlan/client/include", + "$FWK_ROOT_DIR/core/shared/include", + "$FWK_ROOT_DIR/include/core", + "$FWK_ROOT_DIR/include", + "$FWK_ROOT_DIR/include/wifi", + "$FWK_ROOT_DIR/include/utils", + "$FWK_ROOT_DIR/ability/sbuf/include", + "//drivers/adapter/uhdf/posix/include", + "//third_party/bounds_checking_function/include", + "//base/hiviewdfx/hilog_lite/interfaces/native/innerkits", + ] - include_dirs = [ - "include", - "//drivers/peripheral/wlan/interfaces/include", - "//drivers/peripheral/wlan/client/include", - "$FWK_ROOT_DIR/core/shared/include", - "$FWK_ROOT_DIR/include/core", - "$FWK_ROOT_DIR/include", - "$FWK_ROOT_DIR/include/wifi", - "$FWK_ROOT_DIR/include/utils", - "$FWK_ROOT_DIR/ability/sbuf/include", - "//drivers/adapter/uhdf/posix/include", - "//third_party/bounds_checking_function/include", - "//base/hiviewdfx/hilog_lite/interfaces/native/innerkits", - ] + deps = [ + "//drivers/adapter/uhdf/posix:hdf_posix_osal", + "//third_party/bounds_checking_function:libsec_shared", + ] - deps = [ - "//drivers/adapter/uhdf/posix:hdf_posix_osal", - "//third_party/bounds_checking_function:libsec_shared", - ] + defines = [ "__USER__" ] - defines = [ "__USER__" ] + cflags = [ + "-Wall", + "-Wextra", + "-Werror", + "-fsigned-char", + "-fno-common", + "-fno-strict-aliasing", + "-Wno-format", + "-Wno-format-extra-args", + ] + } - cflags = [ - "-Wall", - "-Wextra", - "-Werror", - "-fsigned-char", - "-fno-common", - "-fno-strict-aliasing", - "-Wno-format", - "-Wno-format-extra-args", - ] -} + lite_component("wifi_hal_interface") { + features = [ ":wifi_hal" ] + } +} else { + HAL_ROOT_DIR = "//drivers/peripheral/wlan" -lite_component("wifi_hal_interface") { - features = [ ":wifi_hal" ] + ohos_shared_library("wifi_hal") { + sources = [ + "$HAL_ROOT_DIR/hal/src/wifi_hal.c", + "$HAL_ROOT_DIR/hal/src/wifi_hal_ap_feature.c", + "$HAL_ROOT_DIR/hal/src/wifi_hal_base_feature.c", + "$HAL_ROOT_DIR/hal/src/wifi_hal_cmd.c", + "$HAL_ROOT_DIR/hal/src/wifi_hal_event.c", + "$HAL_ROOT_DIR/hal/src/wifi_hal_sta_feature.c", + "$HAL_ROOT_DIR/hal/src/wifi_hal_util.c", + ] + include_dirs = [ + "$HAL_ROOT_DIR/hal/include", + "$HAL_ROOT_DIR/interfaces/include", + "//third_party/bounds_checking_function/include", + "//drivers/peripheral/wlan/client/include", + "//base/hiviewdfx/hilog/interfaces/native/innerkits/include", + ] + deps = [ + "//drivers/adapter/uhdf2/osal:libhdf_utils", + "//drivers/peripheral/wlan/client:wifi_driver_client", + "//utils/native/base:utils", + ] + defines = [ "__OHOS__USER__" ] + cflags = [ + "-Wall", + "-Wextra", + "-Werror", + "-fsigned-char", + "-fno-common", + "-fno-strict-aliasing", + ] + subsystem_name = "hdf" + if (is_standard_system) { + external_deps = [ "hiviewdfx_hilog_native:libhilog" ] + } else { + external_deps = [ "hilog:libhilog" ] + } + } } diff --git a/wlan/hal/include/wifi_hal_cmd.h b/wlan/hal/include/wifi_hal_cmd.h index 94753e616e883501364d426b17ea41075f5ab516..8416074cb0ad88a93f089b699228042942b7ade9 100644 --- a/wlan/hal/include/wifi_hal_cmd.h +++ b/wlan/hal/include/wifi_hal_cmd.h @@ -47,7 +47,6 @@ enum BaseCommands { CMD_BASE_GET_ADDR, CMD_BASE_SET_MODE, CMD_BASE_GET_HW_FEATURE = 10, -// CMD_BASE_SCAN, CMD_BASE_SET_NETDEV, CMD_BASE_SEND_ACTION, CMD_BASE_SET_CLIENT, @@ -81,7 +80,7 @@ enum STACommands { }; #define MESSAGE_CMD_BITS 16 -#define HDF_WIFI_CMD(SERVICEID, CMDID) (((uint32_t)SERVICEID) << 16) | (CMDID) +#define HDF_WIFI_CMD(SERVICEID, CMDID) ((((uint32_t)SERVICEID) << 16) | (CMDID)) typedef enum { WIFI_HAL_CMD_GET_NETWORK_INFO = HDF_WIFI_CMD(BASE_SERVICE_ID, CMD_BASE_GET_NETWORK_INFO), @@ -123,4 +122,4 @@ void InitIWiFiList(void); #endif #endif -#endif \ No newline at end of file +#endif /* WIFI_HAL_CMD_H */ diff --git a/wlan/hal/include/wifi_hal_common.h b/wlan/hal/include/wifi_hal_common.h index 1c42a9a0d10195e26bf198269d855515dae38bcc..276b8ae38faa85ff3ed5a86fd1c551c4905647ec 100755 --- a/wlan/hal/include/wifi_hal_common.h +++ b/wlan/hal/include/wifi_hal_common.h @@ -39,4 +39,4 @@ struct IWiFiList { #endif #endif -#endif \ No newline at end of file +#endif /* WIFI_HAL_COMMON_H */ diff --git a/wlan/hal/include/wifi_hal_event.h b/wlan/hal/include/wifi_hal_event.h index 284f28f8698630bbcbddb362b2a60256e7e8a69c..887f83afb8b777f0e12a8f1336691bb900c79a92 100755 --- a/wlan/hal/include/wifi_hal_event.h +++ b/wlan/hal/include/wifi_hal_event.h @@ -44,4 +44,4 @@ int32_t WifiHalEventRecv(struct HdfDevEventlistener *listener, #endif #endif -#endif \ No newline at end of file +#endif /* WIFI_HAL_EVENT_H */ diff --git a/wlan/hal/include/wifi_hal_util.h b/wlan/hal/include/wifi_hal_util.h index 3629cbdddae15332f45c4e687b63b1392dbd47d2..4d9f807c969e849c26e4c3f6b49ddbd8cd2bfbc9 100755 --- a/wlan/hal/include/wifi_hal_util.h +++ b/wlan/hal/include/wifi_hal_util.h @@ -35,4 +35,4 @@ void HalMutexUnlock(); #endif #endif -#endif \ No newline at end of file +#endif /* WIFI_HAL_UTIL_H */ diff --git a/wlan/hal/src/wifi_hal.c b/wlan/hal/src/wifi_hal.c index 7e3f71a2b3d8053d364c5b54a39b2bb92b888377..320cc550f40077a62109bf7710adc87ad620c9c6 100644 --- a/wlan/hal/src/wifi_hal.c +++ b/wlan/hal/src/wifi_hal.c @@ -13,8 +13,8 @@ * limitations under the License. */ -#include "wifi_hal.h" #include +#include "wifi_hal.h" #include "hdf_base.h" #include "hdf_log.h" #include "hdf_sbuf.h" @@ -25,15 +25,15 @@ #include "wifi_hal_event.h" #include "wifi_hal_util.h" -#define MAX_AUTH_NUM 1000 - #ifdef __cplusplus #if __cplusplus extern "C" { #endif #endif -static struct HdfDevEventlistener g_wifiHalEventListener; +#define MAX_AUTH_NUM 1000 + +static struct HdfDevEventlistener g_wifiHalEventListener = {0}; static bool g_wifiIsStarted = false; static int32_t StartInner(struct IWiFi *iwifi) @@ -60,10 +60,9 @@ static int32_t StartInner(struct IWiFi *iwifi) WifiMsgServiceDeinit(); return ret; } - ret = HalCmdGetAvailableNetwork(); if (ret != HDF_SUCCESS) { - HDF_LOGE("%s: HalCmdGetIfName failed, line: %d, error no: %d", __FUNCTION__, __LINE__, ret); + HDF_LOGE("%s: HalCmdGetAvailableNetwork failed, line: %d, error no: %d", __FUNCTION__, __LINE__, ret); WifiMsgUnregisterEventListener(&g_wifiHalEventListener); WifiMsgServiceDeinit(); return ret; @@ -91,7 +90,7 @@ static int32_t StopInner(struct IWiFi *iwifi) static int32_t GetSupportFeatureInner(uint8_t *supType, uint32_t size) { - if (supType == NULL || size < (PROTOCOL_80211_IFTYPE_NUM + 1)) { + if (supType == NULL || size <= PROTOCOL_80211_IFTYPE_NUM) { HDF_LOGE("%s: input parameter invalid, line: %d", __FUNCTION__, __LINE__); return HDF_ERR_INVALID_PARAM; } @@ -141,19 +140,19 @@ static int32_t InitFeatureByType(int32_t type, struct IWiFiBaseFeature **ifeatur return ret; } -static int32_t FindValidNetwork(int32_t type, struct IWiFiBaseFeature **fe) +static int32_t FindValidNetwork(int32_t type, struct IWiFiBaseFeature **feature) { struct DListHead *networkHead = GetNetworkHead(); struct IWiFiList *networkNode = NULL; DLIST_FOR_EACH_ENTRY(networkNode, networkHead, struct IWiFiList, entry) { if (networkNode->ifeature == NULL && networkNode->supportMode[type] == 1) { - if (memcpy_s((*fe)->ifName, IFNAME_MAX_LEN, networkNode->ifName, strlen(networkNode->ifName)) != EOK) { + if (memcpy_s((*feature)->ifName, IFNAME_MAX_LEN, networkNode->ifName, strlen(networkNode->ifName)) != EOK) { HDF_LOGE("%s: memcpy_s failed, line: %d", __FUNCTION__, __LINE__); return HDF_FAILURE; } - (*fe)->type = type; - networkNode->ifeature = *fe; + (*feature)->type = type; + networkNode->ifeature = *feature; return HDF_SUCCESS; } } @@ -165,19 +164,24 @@ static int32_t CreateFeatureInner(int32_t type, struct IWiFiBaseFeature **ifeatu { int32_t ret; + if (ifeature == NULL) { + HDF_LOGE("%s: ifeature is null, line: %d", __FUNCTION__, __LINE__); + return HDF_FAILURE; + } ret = InitFeatureByType(type, ifeature); if (ret != HDF_SUCCESS) { HDF_LOGE("%s: init feature failed, line: %d, error no: %d", __FUNCTION__, __LINE__, ret); - *ifeature = NULL; return ret; } ret = FindValidNetwork(type, ifeature); if (ret != HDF_SUCCESS) { HDF_LOGE("%s: create feature failed, line: %d, error no: %d", __FUNCTION__, __LINE__, ret); - free(*ifeature); - *ifeature = NULL; - return HDF_FAILURE; + if (*ifeature != NULL) { + free(*ifeature); + *ifeature = NULL; + } + return ret; } return HDF_SUCCESS; } @@ -192,7 +196,7 @@ static int32_t GetFeatureByIfNameInner(const char *ifName, struct IWiFiBaseFeatu return HDF_ERR_INVALID_PARAM; } DLIST_FOR_EACH_ENTRY(networkNode, networkHead, struct IWiFiList, entry) { - if (!strcmp(networkNode->ifName, ifName)) { + if (strcmp(networkNode->ifName, ifName) == HDF_SUCCESS) { *ifeature = networkNode->ifeature; return HDF_SUCCESS; } @@ -212,7 +216,7 @@ static int32_t DestroyFeatureInner(struct IWiFiBaseFeature *ifeature) } DLIST_FOR_EACH_ENTRY(networkNode, networkHead, struct IWiFiList, entry) { - if (!strcmp(networkNode->ifName, ifeature->ifName)) { + if (strcmp(networkNode->ifName, ifeature->ifName) == HDF_SUCCESS) { free(ifeature); ifeature = NULL; networkNode->ifeature = NULL; @@ -230,22 +234,28 @@ static int32_t RegisterEventCallbackInner(CallbackFunc cbFunc) return HDF_ERR_INVALID_PARAM; } struct CallbackEvent *callbackFunc = GetCallbackFunc(); - if (callbackFunc->cbFunc) { - HDF_LOGE("%s: callback function has been registered, line: %d", __FUNCTION__, __LINE__); + if (callbackFunc != NULL) { + if (callbackFunc->cbFunc != NULL) { + HDF_LOGE("%s: callback function has been registered, line: %d", __FUNCTION__, __LINE__); + return HDF_FAILURE; + } + callbackFunc->cbFunc = cbFunc; + } else { return HDF_FAILURE; } - callbackFunc->cbFunc = cbFunc; return HDF_SUCCESS; } -static int32_t UnRegisterEventCallbackInner(void) +static int32_t UnregisterEventCallbackInner(void) { struct CallbackEvent *callbackFunc = GetCallbackFunc(); - callbackFunc->cbFunc = NULL; + if (callbackFunc != NULL) { + callbackFunc->cbFunc = NULL; + } return HDF_SUCCESS; } -static int32_t ResetDriverInner(const uint8_t chipId) +static int32_t ResetDriverInner(uint8_t chipId) { return HalCmdSetResetDriver(chipId); } @@ -281,6 +291,7 @@ static int32_t GetSupportCombo(uint64_t *combo, uint32_t size) HalMutexUnlock(); return ret; } + static int32_t CreateFeature(int32_t type, struct IWiFiBaseFeature **ifeature) { HalMutexLock(); @@ -313,18 +324,17 @@ static int32_t RegisterEventCallback(CallbackFunc cbFunc) return ret; } -static int32_t UnRegisterEventCallback(void) +static int32_t UnregisterEventCallback(void) { HalMutexLock(); - int32_t ret = UnRegisterEventCallbackInner(); + int32_t ret = UnregisterEventCallbackInner(); HalMutexUnlock(); return ret; } static int32_t ResetDriver(const uint8_t chipId) { - /* Add permission, distinguish liteos kernel from Linux kernel */ - if (getuid() > MAX_AUTH_NUM) { + if (getuid() >= MAX_AUTH_NUM) { HDF_LOGE("%s: don't have authorized access, line: %d", __FUNCTION__, __LINE__); return ERR_UNAUTH_ACCESS; } @@ -339,6 +349,7 @@ int32_t WifiConstruct(struct IWiFi **wifiInstance) { static bool isInited = false; static struct IWiFi singleWifiInstance; + if (!isInited) { if (HalMutexInit() != HDF_SUCCESS) { HDF_LOGE("%s: HalMutexInit failed, line: %d\n", __FUNCTION__, __LINE__); @@ -353,7 +364,7 @@ int32_t WifiConstruct(struct IWiFi **wifiInstance) singleWifiInstance.getFeatureByIfName = GetFeatureByIfName; singleWifiInstance.destroyFeature = DestroyFeature; singleWifiInstance.registerEventCallback = RegisterEventCallback; - singleWifiInstance.unRegisterEventCallback = UnRegisterEventCallback; + singleWifiInstance.unregisterEventCallback = UnregisterEventCallback; singleWifiInstance.resetDriver = ResetDriver; InitIWiFiList(); isInited = true; @@ -371,6 +382,7 @@ int32_t WifiDestruct(struct IWiFi **wifiInstance) *wifiInstance = NULL; if (HalMutexDestroy() != HDF_SUCCESS) { HDF_LOGE("%s: HalMutexDestroy failed, line: %d", __FUNCTION__, __LINE__); + return HDF_FAILURE; } return HDF_SUCCESS; } diff --git a/wlan/hal/src/wifi_hal_ap_feature.c b/wlan/hal/src/wifi_hal_ap_feature.c index af42d2a9db66bcb92be6e2f05edf98f094aa48e4..d61b31180e3d0910ce28a0965f80016446cc2769 100755 --- a/wlan/hal/src/wifi_hal_ap_feature.c +++ b/wlan/hal/src/wifi_hal_ap_feature.c @@ -29,7 +29,7 @@ extern "C" { static int32_t GetAsscociatedStasInner(const struct IWiFiAp *apFeature, struct StaInfo *staInfo, uint32_t size, uint32_t *num) { - if (apFeature == NULL || staInfo == NULL || size <= 0 || num == NULL) { + if (apFeature == NULL || staInfo == NULL || size == 0 || num == NULL) { HDF_LOGE("%s: input parameter invalid, line: %d", __FUNCTION__, __LINE__); return HDF_ERR_INVALID_PARAM; } diff --git a/wlan/hal/src/wifi_hal_cmd.c b/wlan/hal/src/wifi_hal_cmd.c index 76cb93f7a69e778ac348ea57eaf15e2c2170f7c5..791ed86ab752c8b57c99bc98f1cdf4bd6473ab3e 100644 --- a/wlan/hal/src/wifi_hal_cmd.c +++ b/wlan/hal/src/wifi_hal_cmd.c @@ -27,7 +27,7 @@ extern "C" { #endif #endif -static struct DListHead g_networkHead; +static struct DListHead g_networkHead = {0}; struct DListHead *GetNetworkHead(void) { @@ -97,6 +97,7 @@ int32_t HalCmdGetAvailableNetwork(void) } ret = WifiCmdBlockSyncSend(WIFI_HAL_CMD_GET_NETWORK_INFO, data, reply); if (ret != HDF_SUCCESS) { + HDF_LOGE("%s: WifiCmdBlockSyncSend failed, line: %d", __FUNCTION__, __LINE__); HdfSBufRecycle(data); HdfSBufRecycle(reply); return ret; @@ -137,6 +138,7 @@ int32_t HalCmdGetSupportType(uint8_t *supType) GetSupportTypeByList(supType); ret = WifiCmdBlockSyncSend(WIFI_HAL_CMD_IS_SUPPORT_COMBO, data, reply); if (ret != HDF_SUCCESS) { + HDF_LOGE("%s: WifiCmdBlockSyncSend failed, line: %d", __FUNCTION__, __LINE__); HdfSBufRecycle(data); HdfSBufRecycle(reply); return ret; @@ -209,7 +211,7 @@ int32_t GetDeviceMacAddr(struct HdfSBuf *reply, unsigned char *mac, uint8_t len) { uint8_t isEfuseSavedMac; uint32_t replayDataSize = 0; - const uint8_t *replayData = 0; + const uint8_t *replayData = NULL; if (!HdfSbufReadUint8(reply, &isEfuseSavedMac)) { HDF_LOGE("%s: HdfSbufReadUint8 failed, line: %d", __FUNCTION__, __LINE__); @@ -235,11 +237,13 @@ int32_t HalCmdGetDevMacAddr(const char *ifName, int32_t type, unsigned char *mac int32_t ret; struct HdfSBuf *data = HdfSBufObtainDefaultSize(); if (data == NULL) { + HDF_LOGE("%s: Fail to obtain sbuf data, line: %d", __FUNCTION__, __LINE__); return HDF_FAILURE; } struct HdfSBuf *reply = HdfSBufObtainDefaultSize(); if (reply == NULL) { HdfSBufRecycle(data); + HDF_LOGE("%s: Fail to obtain sbuf reply, line: %d", __FUNCTION__, __LINE__); return HDF_FAILURE; } if (!HdfSbufWriteString(data, ifName)) { @@ -256,6 +260,7 @@ int32_t HalCmdGetDevMacAddr(const char *ifName, int32_t type, unsigned char *mac } ret = WifiCmdBlockSyncSend(WIFI_HAL_CMD_GET_DEV_MAC_ADDR, data, reply); if (ret != HDF_SUCCESS) { + HDF_LOGE("%s: WifiCmdBlockSyncSend failed, line: %d", __FUNCTION__, __LINE__); HdfSBufRecycle(data); HdfSBufRecycle(reply); return ret; @@ -271,10 +276,12 @@ int32_t HalCmdSetMacAddr(const char *ifName, unsigned char *mac, uint8_t len) int32_t ret; struct HdfSBuf *data = HdfSBufObtainDefaultSize(); if (data == NULL) { + HDF_LOGE("%s: Fail to obtain sbuf data, line: %d", __FUNCTION__, __LINE__); return HDF_FAILURE; } struct HdfSBuf *reply = HdfSBufObtainDefaultSize(); if (reply == NULL) { + HDF_LOGE("%s: Fail to obtain sbuf reply, line: %d", __FUNCTION__, __LINE__); HdfSBufRecycle(data); return HDF_FAILURE; } @@ -342,6 +349,7 @@ int32_t HalCmdGetValidFreqWithBand(const char *ifName, int32_t band, int32_t *fr } ret = WifiCmdBlockSyncSend(WIFI_HAL_CMD_GET_VALID_FREQ, data, reply); if (ret != HDF_SUCCESS) { + HDF_LOGE("%s: WifiCmdBlockSyncSend failed, line: %d", __FUNCTION__, __LINE__); HdfSBufRecycle(data); HdfSBufRecycle(reply); return ret; @@ -384,12 +392,10 @@ int32_t HalCmdSetTxPower(const char *ifName, int32_t power) static int32_t GetAsscociatedStas(struct HdfSBuf *reply, struct StaInfo *staInfo, uint32_t count, uint32_t *num) { - uint32_t bufSize; uint32_t infoSize; uint32_t replayDataSize = 0; const uint8_t *replayData = 0; - bufSize = sizeof(struct StaInfo) * count; if (!HdfSbufReadUint32(reply, num)) { HDF_LOGE("%s: HdfSbufReadUint32 failed, line: %d", __FUNCTION__, __LINE__); return HDF_FAILURE; @@ -397,10 +403,10 @@ static int32_t GetAsscociatedStas(struct HdfSBuf *reply, struct StaInfo *staInfo if (*num != 0) { infoSize = sizeof(struct StaInfo) * (*num); if (!HdfSbufReadBuffer(reply, (const void **)(&replayData), &replayDataSize) || replayDataSize != infoSize) { - HDF_LOGE("%s: HdfSbufReadBuffer failed, retSize=%d,line: %d", __FUNCTION__, replayDataSize, __LINE__); + HDF_LOGE("%s: HdfSbufReadBuffer failed, relaySize=%d,line: %d", __FUNCTION__, replayDataSize, __LINE__); return HDF_FAILURE; } - if (memcpy_s(staInfo, bufSize, replayData, replayDataSize) != EOK) { + if (memcpy_s(staInfo, sizeof(struct StaInfo) * count, replayData, replayDataSize) != EOK) { HDF_LOGE("%s: memcpy failed, line: %d", __FUNCTION__, __LINE__); return HDF_FAILURE; } @@ -428,6 +434,7 @@ int32_t HalCmdGetAsscociatedStas(const char *ifName, struct StaInfo *staInfo, ui } ret = WifiCmdBlockSyncSend(WIFI_HAL_CMD_GET_ASSOC_STA, data, reply); if (ret != HDF_SUCCESS) { + HDF_LOGE("%s: WifiCmdBlockSyncSend failed, line: %d", __FUNCTION__, __LINE__); HdfSBufRecycle(data); HdfSBufRecycle(reply); return ret; @@ -495,6 +502,7 @@ int32_t HalCmdSetScanningMacAddress(const char *ifName, unsigned char *scanMac, } ret = WifiCmdBlockSyncSend(WIFI_HAL_CMD_SET_SCAN_MAC_ADDR, data, reply); if (ret != HDF_SUCCESS) { + HDF_LOGE("%s: WifiCmdBlockSyncSend failed, line: %d", __FUNCTION__, __LINE__); HdfSBufRecycle(data); HdfSBufRecycle(reply); return ret; @@ -542,7 +550,7 @@ static int32_t GetIfNames(struct HdfSBuf *reply, char **ifNames, uint32_t *num) for (i = 0; i < *num; i++) { if (memcpy_s(*ifNames + i * IFNAME_MAX_LEN, IFNAME_MAX_LEN, replayData + i * IFNAME_MAX_LEN, - replayDataSize) != EOK) { + IFNAME_MAX_LEN) != EOK) { HDF_LOGE("%s: memcpy failed, line: %d", __FUNCTION__, __LINE__); free(*ifNames); *ifNames = NULL; @@ -573,6 +581,7 @@ int32_t HalCmdGetChipId(const char *ifName, uint8_t *chipId) } ret = WifiCmdBlockSyncSend(WIFI_HAL_CMD_GET_CHIPID, data, reply); if (ret != HDF_SUCCESS) { + HDF_LOGE("%s: WifiCmdBlockSyncSend failed, line: %d", __FUNCTION__, __LINE__); HdfSBufRecycle(data); HdfSBufRecycle(reply); return ret; @@ -594,10 +603,12 @@ int32_t HalCmdGetIfNamesByChipId(const uint8_t chipId, char **ifNames, uint32_t struct HdfSBuf *data = HdfSBufObtainDefaultSize(); if (data == NULL) { + HDF_LOGE("%s: Fail to obtain sbuf data, line: %d", __FUNCTION__, __LINE__); return HDF_FAILURE; } struct HdfSBuf *reply = HdfSBufObtainDefaultSize(); if (reply == NULL) { + HDF_LOGE("%s: Fail to obtain sbuf reply, line: %d", __FUNCTION__, __LINE__); HdfSBufRecycle(data); return HDF_FAILURE; } @@ -609,6 +620,7 @@ int32_t HalCmdGetIfNamesByChipId(const uint8_t chipId, char **ifNames, uint32_t } ret = WifiCmdBlockSyncSend(WIFI_HAL_CMD_GET_IFNAMES, data, reply); if (ret != HDF_SUCCESS) { + HDF_LOGE("%s: WifiCmdBlockSyncSend failed, line: %d", __FUNCTION__, __LINE__); HdfSBufRecycle(data); HdfSBufRecycle(reply); return ret; diff --git a/wlan/hal/src/wifi_hal_event.c b/wlan/hal/src/wifi_hal_event.c index 219ffb0d0e8f4ebee75666a351675110560016d5..ff7332b956b1847821454ab10b708c0dc49858f9 100755 --- a/wlan/hal/src/wifi_hal_event.c +++ b/wlan/hal/src/wifi_hal_event.c @@ -49,7 +49,7 @@ int32_t WifiHalEventRecv(struct HdfDevEventlistener *listener, return HDF_FAILURE; } struct CallbackEvent *callbackFunc = GetCallbackFunc(); - if (callbackFunc != NULL && callbackFunc->cbFunc) { + if (callbackFunc != NULL && callbackFunc->cbFunc != NULL) { ret = callbackFunc->cbFunc(id, copyData); } else { HDF_LOGE("%s: callbackFunc have not initialized, line: %d", __FUNCTION__, __LINE__); diff --git a/wlan/interfaces/include/wifi_hal.h b/wlan/interfaces/include/wifi_hal.h index 8b2793df70bff78536c256a90a55c36feabcefab..a11b3f9784cde5e5f5cdfd5b4b17dd62adb4666e 100644 --- a/wlan/interfaces/include/wifi_hal.h +++ b/wlan/interfaces/include/wifi_hal.h @@ -171,7 +171,7 @@ struct IWiFi { * @since 1.0 * @version 1.0 */ - int32_t (*unRegisterEventCallback)(void); + int32_t (*unregisterEventCallback)(void); /** * @brief Destroys a specified {@link IWiFiBaseFeature} object. diff --git a/wlan/interfaces/include/wifi_hal_base_feature.h b/wlan/interfaces/include/wifi_hal_base_feature.h index d2b7e92ac57ba2e6201e701d8ef4124ef0dd4139..70312c88b900b2fe0f2226594ddf7bb8d5a8a64e 100644 --- a/wlan/interfaces/include/wifi_hal_base_feature.h +++ b/wlan/interfaces/include/wifi_hal_base_feature.h @@ -160,7 +160,7 @@ struct IWiFiBaseFeature { * @param band Indicates the frequency band, either 2.4 GHz or 5 GHz. * @param freqs Indicates the pointer to the supported frequencies. * @param count Indicates the number of elements in the frequency array. - * @param num Indicates the pointer to the number of supported frequencies. + * @param num Indicates the number of supported frequencies. * * @return Returns 0 if the supported frequencies are obtained; returns a negative value otherwise. * diff --git a/wlan/test/BUILD.gn b/wlan/test/BUILD.gn index bd8a17b7fb8ea9016d6811893d3e39e4364ccf11..25c94b52ef930e557f15b4b35fdd7a236f695813 100644 --- a/wlan/test/BUILD.gn +++ b/wlan/test/BUILD.gn @@ -11,16 +11,23 @@ # See the License for the specific language governing permissions and # limitations under the License. -import("//build/lite/config/component/lite_component.gni") -import("//build/lite/config/test.gni") - -lite_component("hdf_test_wlan") { - # add hdf subsystem unittest - if (ohos_build_type == "debug") { - deps = [ - "performance:hdf_peripheral_wlan_test_performance", - "unittest:hdf_peripheral_wlan_test", - ] +if (defined(ohos_lite)) { + group("hdf_unittest_wifi") { + if (board_name == "hi3516dv300" || board_name == "hispark_taurus") { + deps = [ + "performance:hdf_hi3516dv300_${ohos_kernel_type}_test_wifi_performance", + "unittest:hdf_hi3516dv300_${ohos_kernel_type}_test_wifi", + ] + } else if (board_name == "hi3518ev300" || board_name == "hispark_aries") { + deps = [ + "performance:hdf_hi3518ev300_${ohos_kernel_type}_test_wifi_performance", + "unittest:hdf_hi3518ev300_${ohos_kernel_type}_test_wifi", + ] + } + } +} else { + group("hdf_test_wifi") { + testonly = true + deps = [ "unittest:hdf_unittest_wifi" ] } - features = [] } diff --git a/wlan/test/performance/BUILD.gn b/wlan/test/performance/BUILD.gn index 7334bf11051598c04813238675e1a08d0703112b..baef81077f9de3266f58873d2186f758a32f26f9 100644 --- a/wlan/test/performance/BUILD.gn +++ b/wlan/test/performance/BUILD.gn @@ -13,44 +13,88 @@ import("//build/lite/config/test.gni") -unittest("hdf_peripheral_wlan_test_performance") { - output_extension = "bin" - output_dir = "$root_out_dir/test/unittest/hdf" - include_dirs = [ - "//third_party/googletest/googletest/include", - "//third_party/bounds_checking_function/include", - "//drivers/framework/ability/sbuf/include", - "//drivers/framework/include/platform", - "//drivers/framework/include/core", - "//drivers/framework/include/osal", - "//drivers/adapter/uhdf/posix/include", - "//drivers/framework/include/utils", - "//drivers/framework/include/config", - "//drivers/framework/include", - "//drivers/peripheral/wlan/client/include", - "//drivers/peripheral/wlan/hal/include", - "//drivers/peripheral/wlan/interfaces/include", - "//drivers/framework/test/unittest/include", - "//base/hiviewdfx/hilog_lite/interfaces/native/innerkits", - ] +if (board_name == "hi3516dv300" || board_name == "hispark_taurus") { + unittest("hdf_hi3516dv300_${ohos_kernel_type}_test_wifi_performance") { + output_extension = "bin" + output_dir = "$root_out_dir/test/unittest/hdf" + include_dirs = [ + "//third_party/googletest/googletest/include", + "//third_party/bounds_checking_function/include", + "//drivers/framework/ability/sbuf/include", + "//drivers/framework/include/platform", + "//drivers/framework/include/core", + "//drivers/framework/include/osal", + "//drivers/adapter/uhdf/posix/include", + "//drivers/framework/include/utils", + "//drivers/framework/include/config", + "//drivers/framework/include", + "//drivers/peripheral/wlan/client/include", + "//drivers/peripheral/wlan/hal/include", + "//drivers/peripheral/wlan/interfaces/include", + "//drivers/framework/test/unittest/include", + "//base/hiviewdfx/hilog_lite/interfaces/native/innerkits", + ] - sources = [ "//drivers/peripheral/wlan/test/performance/common/hdf_wlan_performance_test.cpp" ] - deps = [ - "//base/hiviewdfx/hilog_lite/frameworks/featured:hilog_shared", - "//drivers/adapter/uhdf/manager:hdf_core", - "//drivers/adapter/uhdf/platform:hdf_platform", - "//drivers/adapter/uhdf/posix:hdf_posix_osal", - "//drivers/adapter/uhdf/test/unittest/common:hdf_test_common", - "//drivers/peripheral/wlan/client:hdi_wifi", - "//drivers/peripheral/wlan/hal:wifi_hal_interface", - ] - public_deps = [ "//third_party/bounds_checking_function:libsec_shared" ] - cflags = [ - "-Wall", - "-Wextra", - "-Werror", - "-fsigned-char", - "-fno-common", - "-fno-strict-aliasing", - ] + sources = [ "//drivers/peripheral/wlan/test/performance/common/hdf_wlan_performance_test.cpp" ] + deps = [ + "//base/hiviewdfx/hilog_lite/frameworks/featured:hilog_shared", + "//drivers/adapter/uhdf/manager:hdf_core", + "//drivers/adapter/uhdf/platform:hdf_platform", + "//drivers/adapter/uhdf/posix:hdf_posix_osal", + "//drivers/adapter/uhdf/test/unittest/common:hdf_test_common", + "//drivers/peripheral/wlan/client:hdi_wifi", + "//drivers/peripheral/wlan/hal:wifi_hal_interface", + ] + public_deps = [ "//third_party/bounds_checking_function:libsec_shared" ] + cflags = [ + "-Wall", + "-Wextra", + "-Werror", + "-fsigned-char", + "-fno-common", + "-fno-strict-aliasing", + ] + } +} else if (board_name == "hi3518ev300" || board_name == "hispark_aries") { + unittest("hdf_hi3518ev300_${ohos_kernel_type}_test_wifi_performance") { + output_extension = "bin" + output_dir = "$root_out_dir/test/unittest/hdf" + include_dirs = [ + "//third_party/googletest/googletest/include", + "//third_party/bounds_checking_function/include", + "//drivers/framework/ability/sbuf/include", + "//drivers/framework/include/platform", + "//drivers/framework/include/core", + "//drivers/framework/include/osal", + "//drivers/adapter/uhdf/posix/include", + "//drivers/framework/include/utils", + "//drivers/framework/include/config", + "//drivers/framework/include", + "//drivers/peripheral/wlan/client/include", + "//drivers/peripheral/wlan/hal/include", + "//drivers/peripheral/wlan/interfaces/include", + "//drivers/framework/test/unittest/include", + "//base/hiviewdfx/hilog_lite/interfaces/native/innerkits", + ] + + sources = [ "//drivers/peripheral/wlan/test/performance/common/hdf_wlan_performance_test.cpp" ] + deps = [ + "//base/hiviewdfx/hilog_lite/frameworks/featured:hilog_shared", + "//drivers/adapter/uhdf/manager:hdf_core", + "//drivers/adapter/uhdf/platform:hdf_platform", + "//drivers/adapter/uhdf/posix:hdf_posix_osal", + "//drivers/adapter/uhdf/test/unittest/common:hdf_test_common", + "//drivers/peripheral/wlan/client:hdi_wifi", + "//drivers/peripheral/wlan/hal:wifi_hal_interface", + ] + public_deps = [ "//third_party/bounds_checking_function:libsec_shared" ] + cflags = [ + "-Wall", + "-Wextra", + "-Werror", + "-fsigned-char", + "-fno-common", + "-fno-strict-aliasing", + ] + } } diff --git a/wlan/test/performance/common/hdf_wlan_performance_test.cpp b/wlan/test/performance/common/hdf_wlan_performance_test.cpp index 6e66b87f46f972f40525471f78fac124160e3ede..1f746532ee3981701f0ef751291a803d52ca68df 100644 --- a/wlan/test/performance/common/hdf_wlan_performance_test.cpp +++ b/wlan/test/performance/common/hdf_wlan_performance_test.cpp @@ -112,7 +112,7 @@ static int32_t HalResetCallbackEvent(int32_t event, struct HdfSBuf *sbuf) /** * @tc.name: WifiHalGetSupportFeature001 - * @tc.desc: Wifi hal get support feature function test + * @tc.desc: Get supported features * @tc.type: FUNC * @tc.require: AR000F869J */ @@ -140,7 +140,7 @@ HWTEST_F(HdfWlanPerformanceTest, WifiHalGetSupportFeature001, TestSize.Level1) /** * @tc.name: WifiHalGetSupportCombo001 - * @tc.desc: Wifi hal get support combo function test + * @tc.desc: Get supported combo * @tc.type: FUNC * @tc.require: AR000F869J */ @@ -172,7 +172,7 @@ HWTEST_F(HdfWlanPerformanceTest, WifiHalGetSupportCombo001, TestSize.Level1) /** * @tc.name: WifiHalGetDeviceMacAddress001 - * @tc.desc: Wifi hal get device Mac address function test + * @tc.desc: Get device Mac address for ap mode * @tc.type: FUNC * @tc.require: AR000F869G */ @@ -206,7 +206,7 @@ HWTEST_F(HdfWlanPerformanceTest, WifiHalGetDeviceMacAddress001, TestSize.Level1) /** * @tc.name: WifiHalGetDeviceMacAddress002 - * @tc.desc: Wifi hal get device Mac address function test + * @tc.desc: Get device Mac address for sta mode * @tc.type: FUNC * @tc.require: AR000F869E */ @@ -240,7 +240,7 @@ HWTEST_F(HdfWlanPerformanceTest, WifiHalGetDeviceMacAddress002, TestSize.Level1) /** * @tc.name: WifiHaGetValidFreqsWithBand001 - * @tc.desc: Wifi hal get available freqs with band function test + * @tc.desc: Get available frequencies * @tc.type: FUNC * @tc.require: AR000F869G */ @@ -274,8 +274,8 @@ HWTEST_F(HdfWlanPerformanceTest, WifiHaGetValidFreqsWithBand001, TestSize.Level1 } /** - * @tc.name: WifiHalGetAsscociatedStas001 - * @tc.desc: Wifi hal get asscociated sta info function test + * @tc.name: WifiHalGetAssociatedStas001 + * @tc.desc: Get asscociated STA info * @tc.type: FUNC * @tc.require: AR000F869K */ @@ -308,7 +308,7 @@ HWTEST_F(HdfWlanPerformanceTest, WifiHalGetAsscociatedStas001, TestSize.Level1) /** * @tc.name: WifiHalSetScanningMacAddress001 - * @tc.desc: Wifi hal set scanning Mac address function test + * @tc.desc: Set Mac address scanning * @tc.type: FUNC * @tc.require: AR000F869K */ @@ -340,7 +340,7 @@ HWTEST_F(HdfWlanPerformanceTest, WifiHalSetScanningMacAddress001, TestSize.Level /** * @tc.name: WifiHalGetChipId001 - * @tc.desc: Wifi hal obtain the chip ID function test + * @tc.desc: Obtain the chip ID * @tc.type: FUNC * @tc.require: AR000F869G */ @@ -373,7 +373,7 @@ HWTEST_F(HdfWlanPerformanceTest, WifiHalGetChipId001, TestSize.Level1) /** * @tc.name: WifiHalGetIfNamesByChipId001 - * @tc.desc: Wifi hal obtain all ifNames and the number of the current chip function test + * @tc.desc: Obtain all ifNames and the number of the current chip * @tc.type: FUNC * @tc.require: AR000F869G */ @@ -417,7 +417,7 @@ HWTEST_F(HdfWlanPerformanceTest, WifiHalGetIfNamesByChipId001, TestSize.Level1) /** * @tc.name: WifiHalResetDriver001 - * @tc.desc: Wifi hal Reset the wifi Driver function test + * @tc.desc: Reset the WiFi driver * @tc.type: FUNC * @tc.require: AR000F869G */ diff --git a/wlan/test/unittest/BUILD.gn b/wlan/test/unittest/BUILD.gn index 737c71a653fd820cae039317602bbabc736b2179..be0a22731e161c64bc3aa7996715c5d0e54761a5 100644 --- a/wlan/test/unittest/BUILD.gn +++ b/wlan/test/unittest/BUILD.gn @@ -11,54 +11,153 @@ # See the License for the specific language governing permissions and # limitations under the License. -import("//build/lite/config/test.gni") +if (defined(ohos_lite)) { + import("//build/lite/config/test.gni") +} else { + import("//build/test.gni") + import("//drivers/adapter/uhdf2/uhdf.gni") +} + +if (defined(ohos_lite)) { + if (board_name == "hi3516dv300" || board_name == "hispark_taurus") { + unittest("hdf_hi3516dv300_${ohos_kernel_type}_test_wifi") { + output_extension = "bin" + output_dir = "$root_out_dir/test/unittest/hdf" + include_dirs = [ + "//third_party/googletest/googletest/include", + "//third_party/bounds_checking_function/include", + "//drivers/framework/ability/sbuf/include", + "//drivers/framework/include/platform", + "//drivers/framework/include/core", + "//drivers/framework/include/osal", + "//drivers/adapter/lite/uhdf/posix/include", + "//drivers/framework/include/utils", + "//drivers/framework/include/config", + "//drivers/framework/include", + "//drivers/peripheral/wlan/client/include", + "//drivers/peripheral/wlan/hal/include", + "//drivers/peripheral/wlan/interfaces/include", + "//drivers/framework/test/unittest/include", + "//base/hiviewdfx/hilog_lite/interfaces/native/innerkits", + ] -unittest("hdf_peripheral_wlan_test") { - output_extension = "bin" - output_dir = "$root_out_dir/test/unittest/hdf" - include_dirs = [ - "//third_party/googletest/googletest/include", - "//third_party/bounds_checking_function/include", - "//drivers/framework/ability/sbuf/include", - "//drivers/framework/include/platform", - "//drivers/framework/include/core", - "//drivers/framework/include/osal", - "//drivers/adapter/uhdf/posix/include", - "//drivers/framework/include/utils", - "//drivers/framework/include/config", - "//drivers/framework/include", - "//drivers/peripheral/wlan/client/include", - "//drivers/peripheral/wlan/hal/include", - "//drivers/peripheral/wlan/interfaces/include", - "//drivers/framework/test/unittest/include", - "//base/hiviewdfx/hilog_lite/interfaces/native/innerkits", - ] + sources = [ + "//drivers/peripheral/wlan/test/unittest/common/hdf_client_test.cpp", + "//drivers/peripheral/wlan/test/unittest/common/hdf_flow_control_test.cpp", + "//drivers/peripheral/wlan/test/unittest/common/hdf_message_test.cpp", + "//drivers/peripheral/wlan/test/unittest/common/hdf_module_test.cpp", + "//drivers/peripheral/wlan/test/unittest/common/hdf_net_buff_test.cpp", + "//drivers/peripheral/wlan/test/unittest/common/hdf_net_device_test.cpp", + "//drivers/peripheral/wlan/test/unittest/common/wifi_hal_test.cpp", + ] + deps = [ + "//base/hiviewdfx/hilog_lite/frameworks/featured:hilog_shared", + "//drivers/adapter/lite/uhdf/manager:hdf_core", + "//drivers/adapter/lite/uhdf/platform:hdf_platform", + "//drivers/adapter/lite/uhdf/posix:hdf_posix_osal", + "//drivers/adapter/lite/uhdf/test/unittest/common:hdf_test_common", + "//drivers/peripheral/wlan/client:hdi_wifi", + "//drivers/peripheral/wlan/hal:wifi_hal_interface", + ] + public_deps = [ "//third_party/bounds_checking_function:libsec_shared" ] + cflags = [ + "-Wall", + "-Wextra", + "-Werror", + "-fsigned-char", + "-fno-common", + "-fno-strict-aliasing", + ] + } + } else if (board_name == "hi3518ev300" || board_name == "hispark_aries") { + unittest("hdf_hi3518ev300_${ohos_kernel_type}_test_wifi") { + output_extension = "bin" + output_dir = "$root_out_dir/test/unittest/hdf" + include_dirs = [ + "//third_party/googletest/googletest/include", + "//third_party/bounds_checking_function/include", + "//drivers/framework/ability/sbuf/include", + "//drivers/framework/include/platform", + "//drivers/framework/include/core", + "//drivers/framework/include/osal", + "//drivers/adapter/lite/uhdf/posix/include", + "//drivers/framework/include/utils", + "//drivers/framework/include/config", + "//drivers/framework/include", + "//drivers/peripheral/wlan/client/include", + "//drivers/peripheral/wlan/hal/include", + "//drivers/peripheral/wlan/interfaces/include", + "//drivers/framework/test/unittest/include", + "//base/hiviewdfx/hilog_lite/interfaces/native/innerkits", + ] - sources = [ - "//drivers/peripheral/wlan/test/unittest/common/hdf_client_test.cpp", - "//drivers/peripheral/wlan/test/unittest/common/hdf_flow_control_test.cpp", - "//drivers/peripheral/wlan/test/unittest/common/hdf_message_test.cpp", - "//drivers/peripheral/wlan/test/unittest/common/hdf_module_test.cpp", - "//drivers/peripheral/wlan/test/unittest/common/hdf_net_buff_test.cpp", - "//drivers/peripheral/wlan/test/unittest/common/hdf_net_device_test.cpp", - "//drivers/peripheral/wlan/test/unittest/common/wifi_hal_test.cpp", - ] - deps = [ - "//base/hiviewdfx/hilog_lite/frameworks/featured:hilog_shared", - "//drivers/adapter/uhdf/manager:hdf_core", - "//drivers/adapter/uhdf/platform:hdf_platform", - "//drivers/adapter/uhdf/posix:hdf_posix_osal", - "//drivers/adapter/uhdf/test/unittest/common:hdf_test_common", - "//drivers/peripheral/wlan/client:hdi_wifi", - "//drivers/peripheral/wlan/hal:wifi_hal_interface", - ] - public_deps = [ "//third_party/bounds_checking_function:libsec_shared" ] - cflags = [ - "-Wall", - "-Wextra", - "-Werror", - "-fsigned-char", - "-fno-common", - "-fno-strict-aliasing", - ] + sources = [ + "//drivers/peripheral/wlan/test/unittest/common/hdf_client_test.cpp", + "//drivers/peripheral/wlan/test/unittest/common/hdf_flow_control_test.cpp", + "//drivers/peripheral/wlan/test/unittest/common/hdf_message_test.cpp", + "//drivers/peripheral/wlan/test/unittest/common/hdf_module_test.cpp", + "//drivers/peripheral/wlan/test/unittest/common/hdf_net_buff_test.cpp", + "//drivers/peripheral/wlan/test/unittest/common/hdf_net_device_test.cpp", + "//drivers/peripheral/wlan/test/unittest/common/wifi_hal_test.cpp", + ] + deps = [ + "//base/hiviewdfx/hilog_lite/frameworks/featured:hilog_shared", + "//drivers/adapter/lite/uhdf/manager:hdf_core", + "//drivers/adapter/lite/uhdf/platform:hdf_platform", + "//drivers/adapter/lite/uhdf/posix:hdf_posix_osal", + "//drivers/adapter/lite/uhdf/test/unittest/common:hdf_test_common", + "//drivers/peripheral/wlan/client:hdi_wifi", + "//drivers/peripheral/wlan/hal:wifi_hal_interface", + ] + public_deps = [ "//third_party/bounds_checking_function:libsec_shared" ] + cflags = [ + "-Wall", + "-Wextra", + "-Werror", + "-fsigned-char", + "-fno-common", + "-fno-strict-aliasing", + ] + } + } +} else { + module_output_path = "hdf/wlan" + ohos_unittest("hdf_unittest_wifi") { + module_out_path = module_output_path + include_dirs = [ + "//drivers/framework/test/unittest/include", + "//drivers/peripheral/wlan/client/include", + "//drivers/peripheral/wlan/hal/include", + "//drivers/peripheral/wlan/interfaces/include", + ] + sources = [ + "./common/hdf_client_test.cpp", + "./common/hdf_flow_control_test.cpp", + "./common/hdf_message_test.cpp", + "./common/hdf_module_test.cpp", + "./common/hdf_net_buff_test.cpp", + "./common/hdf_net_device_test.cpp", + "./common/wifi_hal_test.cpp", + ] + cflags = [ + "-Wall", + "-Wextra", + "-Werror", + "-fsigned-char", + "-fno-common", + "-fno-strict-aliasing", + ] + deps = [ + "$hdf_uhdf_path/osal:libhdf_utils", + "$hdf_uhdf_path/test/unittest/common:libhdf_test_common", + "//drivers/peripheral/wlan/client:wifi_driver_client", + "//drivers/peripheral/wlan/hal:wifi_hal", + "//utils/native/base:utils", + ] + if (is_standard_system) { + external_deps = [ "hiviewdfx_hilog_native:libhilog" ] + } else { + external_deps = [ "hilog:libhilog" ] + } + } } diff --git a/wlan/test/unittest/common/hdf_client_test.cpp b/wlan/test/unittest/common/hdf_client_test.cpp index cbba9d2f6faf98a9d24b6f0a9db30943772a3c72..28c4cd51e5f65b225b1d1feda69473dc02090e77 100755 --- a/wlan/test/unittest/common/hdf_client_test.cpp +++ b/wlan/test/unittest/common/hdf_client_test.cpp @@ -29,17 +29,17 @@ class WifiClientTest : public testing::Test { public: static void SetUpTestCase(); static void TearDownTestCase(); - void SetUp() const; - void TearDown() const; + void SetUp(); + void TearDown(); }; void WifiClientTest::SetUpTestCase() {} void WifiClientTest::TearDownTestCase() {} -void WifiClientTest::SetUp() const {} +void WifiClientTest::SetUp() {} -void WifiClientTest::TearDown() const {} +void WifiClientTest::TearDown() {} static int OnWifiEventListener(struct HdfDevEventlistener *listener, struct HdfIoService *service, uint32_t id, struct HdfSBuf *data) @@ -55,7 +55,7 @@ static int OnWifiEventListener(struct HdfDevEventlistener *listener, /** * @tc.name: WifiClientInitAndDeinit001 - * @tc.desc: In normal cases, the WLAN client is initialized and deinitialized once. + * @tc.desc: Initialize and uninitialize the WLAN client only once. * @tc.type: FUNC * @tc.require: AR000F869F, AR000F8QNL */ @@ -70,7 +70,7 @@ HWTEST_F(WifiClientTest, WifiClientInitAndDeinit001, TestSize.Level1) /** * @tc.name: WifiClientInitAndDeinit002 - * @tc.desc: In normal cases, the WLAN client is initialized and deinitialized for multiple times. + * @tc.desc: Initialize and uninitialize the WLAN client for multiple times. * @tc.type: FUNC * @tc.require: AR000F869F, AR000F8QNL */ @@ -106,7 +106,7 @@ HWTEST_F(WifiClientTest, WifiClientInitAndDeinit003, TestSize.Level1) /** * @tc.name: WifiRegisterListener001 - * @tc.desc: Single registration and unregistration of the listener in normal cases. + * @tc.desc: Register the listener for single registration and unregistration. * @tc.type: FUNC * @tc.require: AR000F869F, AR000F8QNL */ @@ -125,7 +125,7 @@ HWTEST_F(WifiClientTest, WifiRegisterListener001, TestSize.Level1) /** * @tc.name: WifiRegisterListener002 - * @tc.desc: Multiple registrations and unregistrations of the listener in normal cases. + * @tc.desc: Register the listener for repeated registration and unregistration. * @tc.type: FUNC * @tc.require: AR000F869F, AR000F8QNL */ @@ -149,7 +149,7 @@ HWTEST_F(WifiClientTest, WifiRegisterListener002, TestSize.Level1) /** * @tc.name: WifiRegisterListener003 - * @tc.desc: In normal cases, multiple listeners are registered and deregistered. + * @tc.desc: Register multiple listeners for registration and unregistration. * @tc.type: FUNC * @tc.require: AR000F869F */ @@ -174,7 +174,7 @@ HWTEST_F(WifiClientTest, WifiRegisterListener003, TestSize.Level1) /** * @tc.name: WifiRegisterListener004 - * @tc.desc: Repeatedly registering a listener. + * @tc.desc: Repeatedly register a listener. * @tc.type: FUNC * @tc.require: AR000F869F */ @@ -197,7 +197,7 @@ HWTEST_F(WifiClientTest, WifiRegisterListener004, TestSize.Level1) /** * @tc.name: WifiRegisterListener005 - * @tc.desc: Registration and unregistration of interception in abnormal cases. + * @tc.desc: In abnormal condition, register the listener and no deregistration operation. * @tc.type: FUNC * @tc.require: AR000F869F */ @@ -215,7 +215,7 @@ HWTEST_F(WifiClientTest, WifiRegisterListener005, TestSize.Level1) /** * @tc.name: WifiRegisterListener006 - * @tc.desc: Deinitialization when the listener is not completely unregistered. + * @tc.desc: Uninitialize a listener when the listener is not completely unregistered. * @tc.type: FUNC * @tc.require: AR000F869F */ @@ -240,7 +240,7 @@ HWTEST_F(WifiClientTest, WifiRegisterListener006, TestSize.Level1) /** * @tc.name: WifiRegisterListener007 - * @tc.desc: Canceling a listener when no listener is registered. + * @tc.desc: Cancel a listener when no listener is registered. * @tc.type: FUNC * @tc.require: AR000F869F */ diff --git a/wlan/test/unittest/common/hdf_flow_control_test.cpp b/wlan/test/unittest/common/hdf_flow_control_test.cpp index 74bb7425a0c9e7bf7c5e96e93c6d1df3a9f68ec4..a72c8b63a5fb153e04e0054d620b362cbe551b40 100644 --- a/wlan/test/unittest/common/hdf_flow_control_test.cpp +++ b/wlan/test/unittest/common/hdf_flow_control_test.cpp @@ -31,8 +31,8 @@ class WiFiFlowControlTest : public testing::Test { public: static void SetUpTestCase(); static void TearDownTestCase(); - void SetUp() const; - void TearDown() const; + void SetUp(); + void TearDown(); }; void WiFiFlowControlTest::SetUpTestCase() @@ -44,14 +44,14 @@ void WiFiFlowControlTest::SetUpTestCase() void WiFiFlowControlTest::TearDownTestCase() { - HdfTestOpenService(); struct HdfTestMsg msg = {TEST_WIFI_TYPE, WIFI_FLOW_CONTROL_DEINIT, -1}; HdfTestSendMsgToService(&msg); + HdfTestCloseService(); } -void WiFiFlowControlTest::SetUp() const {} +void WiFiFlowControlTest::SetUp() {} -void WiFiFlowControlTest::TearDown() const {} +void WiFiFlowControlTest::TearDown() {} /** * @tc.name: WiFiFlowControlGetQueueID001 diff --git a/wlan/test/unittest/common/hdf_message_test.cpp b/wlan/test/unittest/common/hdf_message_test.cpp index 583d1f496e470cb83fb4ef1bd4edb827837c9ae2..3833b6b3fac193beb76b7cf66935599bd9b59b78 100644 --- a/wlan/test/unittest/common/hdf_message_test.cpp +++ b/wlan/test/unittest/common/hdf_message_test.cpp @@ -32,17 +32,23 @@ public: virtual ~WiFiMessageTest() {}; static void SetUpTestCase(); static void TearDownTestCase(); - void SetUp() const; - void TearDown() const; + void SetUp(); + void TearDown(); }; -void WiFiMessageTest::SetUpTestCase() {} +void WiFiMessageTest::SetUpTestCase() +{ + HdfTestOpenService(); +} -void WiFiMessageTest::TearDownTestCase() {} +void WiFiMessageTest::TearDownTestCase() +{ + HdfTestCloseService(); +} -void WiFiMessageTest::SetUp() const {} +void WiFiMessageTest::SetUp() {} -void WiFiMessageTest::TearDown() const {} +void WiFiMessageTest::TearDown() {} /** * @tc.name: WIFI_MESSAGE_QUEUE001 diff --git a/wlan/test/unittest/common/hdf_module_test.cpp b/wlan/test/unittest/common/hdf_module_test.cpp index a1c88f1a27417a1c5e127064f384d3f7261382ea..b6049d9f39833b3acee0ef50bcb386605631fab5 100644 --- a/wlan/test/unittest/common/hdf_module_test.cpp +++ b/wlan/test/unittest/common/hdf_module_test.cpp @@ -31,8 +31,8 @@ class WiFiModuleTest : public testing::Test { public: static void SetUpTestCase(); static void TearDownTestCase(); - void SetUp() const; - void TearDown() const; + void SetUp(); + void TearDown(); }; void WiFiModuleTest::SetUpTestCase() @@ -45,9 +45,9 @@ void WiFiModuleTest::TearDownTestCase() HdfTestCloseService(); } -void WiFiModuleTest::SetUp() const {} +void WiFiModuleTest::SetUp() {} -void WiFiModuleTest::TearDown() const {} +void WiFiModuleTest::TearDown() {} /** * @tc.name: WiFiModuleCreate001 @@ -74,12 +74,12 @@ HWTEST_F(WiFiModuleTest, WiFiModuleAddFeature001, TestSize.Level1) } /** - * @tc.name: WiFiModuleDeteleFeature001 + * @tc.name: WiFiModuleDeleteFeature001 * @tc.desc: wifi module delete feature function test * @tc.type: FUNC * @tc.require: AR000F869K */ -HWTEST_F(WiFiModuleTest, WiFiModuleDeteleFeature001, TestSize.Level1) +HWTEST_F(WiFiModuleTest, WiFiModuleDeleteFeature001, TestSize.Level1) { struct HdfTestMsg msg = {TEST_WIFI_TYPE, WIFI_MODULE_DELETE_FEATURE, -1}; EXPECT_EQ(0, HdfTestSendMsgToService(&msg)); diff --git a/wlan/test/unittest/common/hdf_net_buff_test.cpp b/wlan/test/unittest/common/hdf_net_buff_test.cpp index 24e704150643dbe77ac5fca7d962ead3fe524686..01046baea6101c9d8c23bbcde8b2dbd6f5722cf4 100644 --- a/wlan/test/unittest/common/hdf_net_buff_test.cpp +++ b/wlan/test/unittest/common/hdf_net_buff_test.cpp @@ -31,8 +31,8 @@ class WiFiNetBuffTest : public testing::Test { public: static void SetUpTestCase(); static void TearDownTestCase(); - void SetUp() const; - void TearDown() const; + void SetUp(); + void TearDown(); }; void WiFiNetBuffTest::SetUpTestCase() @@ -45,9 +45,9 @@ void WiFiNetBuffTest::TearDownTestCase() HdfTestCloseService(); } -void WiFiNetBuffTest::SetUp() const {} +void WiFiNetBuffTest::SetUp() {} -void WiFiNetBuffTest::TearDown() const {} +void WiFiNetBuffTest::TearDown() {} /** * @tc.name: WiFiNetBuff001 diff --git a/wlan/test/unittest/common/hdf_net_device_test.cpp b/wlan/test/unittest/common/hdf_net_device_test.cpp index 014eeacc6f5023b40e3ebd1db8f9c1ee4d583bf3..45b00358dfb780836783c5de8ab6af101c04bf5d 100644 --- a/wlan/test/unittest/common/hdf_net_device_test.cpp +++ b/wlan/test/unittest/common/hdf_net_device_test.cpp @@ -31,8 +31,8 @@ class WiFiNetDeviceTest : public testing::Test { public: static void SetUpTestCase(); static void TearDownTestCase(); - void SetUp() const; - void TearDown() const; + void SetUp(); + void TearDown(); }; void WiFiNetDeviceTest::SetUpTestCase() @@ -49,9 +49,9 @@ void WiFiNetDeviceTest::TearDownTestCase() HdfTestCloseService(); } -void WiFiNetDeviceTest::SetUp() const {} +void WiFiNetDeviceTest::SetUp() {} -void WiFiNetDeviceTest::TearDown() const {} +void WiFiNetDeviceTest::TearDown() {} /** * @tc.name: WiFiNetDeviceInit001 diff --git a/wlan/test/unittest/common/wifi_hal_test.cpp b/wlan/test/unittest/common/wifi_hal_test.cpp index e049825fba44c4f58a0fbb6cc262089e1d32dbcc..ad1cdb8ec683fdadef9d24140999e24f7acdd138 100644 --- a/wlan/test/unittest/common/wifi_hal_test.cpp +++ b/wlan/test/unittest/common/wifi_hal_test.cpp @@ -177,7 +177,7 @@ HWTEST_F(WifiHalTest, WifiHalUnRegisterEventCallback001, TestSize.Level1) { int ret; - ret = g_wifi->unRegisterEventCallback(); + ret = g_wifi->unregisterEventCallback(); EXPECT_EQ(HDF_SUCCESS, ret); }