diff --git a/interfaces/innerkits/native_cpp/napi/wifi_napi_hotspot.cpp b/interfaces/innerkits/native_cpp/napi/wifi_napi_hotspot.cpp index d953812c80130063d96943afd430b238461795ec..5ac5889a3b4c7b712b8aeaabba204ed76e29b768 100755 --- a/interfaces/innerkits/native_cpp/napi/wifi_napi_hotspot.cpp +++ b/interfaces/innerkits/native_cpp/napi/wifi_napi_hotspot.cpp @@ -112,6 +112,9 @@ static bool GetHotspotconfigFromJs(const napi_env& env, const napi_value& object value = 0; JsObjectToInt(env, object, "band", value); config.SetBand(BandType(value)); // 1: 2.4G, 2: 5G + if (config.GetBand() == BandType::BAND_5GHZ) { + config.SetChannel(AP_CHANNEL_5G_DEFAULT); + } value = 0; JsObjectToString(env, object, "preSharedKey", 64, str); // 64: max length config.SetPreSharedKey(str); diff --git a/interfaces/innerkits/native_cpp/wifi_standard/interfaces/wifi_ap_msg.h b/interfaces/innerkits/native_cpp/wifi_standard/interfaces/wifi_ap_msg.h index 4ccefe084313033e3b50195b5b4ff35cabb5b7bc..09b0c297d357abb926ee7355d476579af2592ad5 100644 --- a/interfaces/innerkits/native_cpp/wifi_standard/interfaces/wifi_ap_msg.h +++ b/interfaces/innerkits/native_cpp/wifi_standard/interfaces/wifi_ap_msg.h @@ -21,6 +21,7 @@ namespace OHOS { namespace Wifi { #define AP_CHANNEL_DEFAULT 6 +#define AP_CHANNEL_5G_DEFAULT 149 enum class ApState { AP_STATE_NONE = 0, AP_STATE_IDLE, @@ -128,4 +129,4 @@ struct StationInfo { }; } // namespace Wifi } // namespace OHOS -#endif \ No newline at end of file +#endif