From 784deb685ea1a7a63ae6e031ed497921913c2b88 Mon Sep 17 00:00:00 2001 From: liuyuanyuan Date: Wed, 28 Aug 2024 19:38:28 +0800 Subject: [PATCH] add napi Signed-off-by: liuyuanyuan --- wifi/frameworks/js/napi/inc/wifi_napi_utils.h | 6 ++++++ wifi/frameworks/js/napi/src/wifi_napi_entry.cpp | 11 +++++++++++ 2 files changed, 17 insertions(+) diff --git a/wifi/frameworks/js/napi/inc/wifi_napi_utils.h b/wifi/frameworks/js/napi/inc/wifi_napi_utils.h index d3d0875fc..2f6942501 100644 --- a/wifi/frameworks/js/napi/inc/wifi_napi_utils.h +++ b/wifi/frameworks/js/napi/inc/wifi_napi_utils.h @@ -244,6 +244,12 @@ enum class WifiChannelWidthJs { WIDTH_INVALID, }; +enum class WifiCategoryJs { + DEFAULT = 1, + WIFI6 = 2, + WIFI6_PLUS = 3 +}; + enum class WifiStandardJs { WIFI_STANDARD_UNDEFINED = 0, WIFI_STANDARD_11A = 1, diff --git a/wifi/frameworks/js/napi/src/wifi_napi_entry.cpp b/wifi/frameworks/js/napi/src/wifi_napi_entry.cpp index 4bcf6bd96..2012c65fc 100644 --- a/wifi/frameworks/js/napi/src/wifi_napi_entry.cpp +++ b/wifi/frameworks/js/napi/src/wifi_napi_entry.cpp @@ -180,6 +180,15 @@ static napi_value WifiChannelWidthInit(napi_env env) static_cast(WifiChannelWidthJs::WIDTH_INVALID), "WIDTH_INVALID"); return wifiChannelWidth; } +static napi_value WifiCategoryInit(napi_env env) +{ + napi_value wifiCategory = nullptr; + napi_create_object(env, &wifiCategory); + SetNamedPropertyByInteger(env, wifiCategory, static_cast(WifiCategoryJs::DEFAULT), "DEFAULT"); + SetNamedPropertyByInteger(env, wifiCategory, static_cast(WifiCategoryJs::WIFI6), "WIFI6"); + SetNamedPropertyByInteger(env, wifiCategory, static_cast(WifiCategoryJs::WIFI6_PLUS), "WIFI6_PLUS"); + return wifiCategory; +} static napi_value WifiStandardInit(napi_env env) { napi_value wifiStandard = nullptr; @@ -272,6 +281,7 @@ static napi_value PropertyValueInit(napi_env env, napi_value exports) napi_value bandTypeObj = WifiBandTypeInit(env); napi_value proxyMethodObj = ProxyMethodInit(env); napi_value wapiPskTypeObj = WapiPskTypeInit(env); + napi_value wifiCategoryObj = WifiCategoryInit(env); #endif napi_property_descriptor exportFuncs[] = { #ifdef ENABLE_NAPI_WIFI_MANAGER @@ -282,6 +292,7 @@ static napi_value PropertyValueInit(napi_env env, napi_value exports) DECLARE_NAPI_PROPERTY("WifiBandType", bandTypeObj), DECLARE_NAPI_PROPERTY("ProxyMethod", proxyMethodObj), DECLARE_NAPI_PROPERTY("WapiPskType", wapiPskTypeObj), + DECLARE_NAPI_PROPERTY("WifiCategory", wifiCategoryObj), #endif DECLARE_NAPI_PROPERTY("SuppState", suppStateObj), DECLARE_NAPI_PROPERTY("WifiSecurityType", securityTypeObj),