mirror of
https://gitee.com/openharmony/communication_wifi.git
synced 2025-02-18 16:00:42 +00:00
添加c变量,与c++保持一致
Signed-off-by: zhaoxu <xuzhaor@isoftstone.com>
This commit is contained in:
parent
30b6247c62
commit
a06d5ce978
@ -149,8 +149,8 @@ static bool GetHotspotconfigFromJs(const napi_env& env, const napi_value& object
|
||||
value = 0;
|
||||
JsObjectToInt(env, object, "leaseTime", value);
|
||||
ClearJsLastException(env);
|
||||
if (value < (int)DHCP_LEASE_TIME_MIN) {
|
||||
value = (int)DHCP_LEASE_TIME;
|
||||
if (value < static_cast<int>(DHCP_LEASE_TIME_MIN)) {
|
||||
value = static_cast<int>(DHCP_LEASE_TIME);
|
||||
}
|
||||
config.SetLeaseTime(value);
|
||||
return true;
|
||||
|
@ -106,6 +106,13 @@ static WifiErrorCode GetHotspotConfigFromC(const HotspotConfig *config, OHOS::Wi
|
||||
return ERROR_WIFI_INVALID_ARGS;
|
||||
}
|
||||
hotspotConfig.SetIpAddress(config->ipAddress);
|
||||
hotspotConfig.SetMaxConn(config->maxConn);
|
||||
int value = config->leaseTime;
|
||||
if (value < static_cast<int>(DHCP_LEASE_TIME_MIN)) {
|
||||
value = static_cast<int>(DHCP_LEASE_TIME);
|
||||
}
|
||||
hotspotConfig.SetLeaseTime(value);
|
||||
hotspotConfig.SetBandWidth(config->apBandWidth);
|
||||
return WIFI_SUCCESS;
|
||||
}
|
||||
|
||||
|
@ -24,6 +24,7 @@ namespace OHOS {
|
||||
namespace Wifi {
|
||||
#define AP_CHANNEL_INVALID (-1)
|
||||
#define AP_CHANNEL_DEFAULT 6
|
||||
#define AP_MAX_CONN_DEFAULT (-1)
|
||||
#define AP_CHANNEL_5G_DEFAULT 149
|
||||
#define AP_CHANNEL_5G_NOT_RECOMMEND (165) // cannot group bandwidth of 40M or above
|
||||
#define WIFI_BSSID_LENGTH 18
|
||||
@ -78,7 +79,7 @@ struct HotspotConfig {
|
||||
securityType = KeyMgmt::WPA2_PSK;
|
||||
band = BandType::BAND_2GHZ;
|
||||
channel = AP_CHANNEL_DEFAULT;
|
||||
maxConn = -1;
|
||||
maxConn = AP_MAX_CONN_DEFAULT;
|
||||
leaseTime = DHCP_LEASE_TIME;
|
||||
apBandWidth = AP_BANDWIDTH_DEFAULT;
|
||||
}
|
||||
|
@ -97,6 +97,12 @@ typedef struct {
|
||||
char preSharedKey[WIFI_MAX_KEY_LEN];
|
||||
/* dhcp server ipv4 address */
|
||||
char ipAddress[WIFI_MAX_IPV4_LEN];
|
||||
/* maximum number of allowed connections */
|
||||
int maxConn;
|
||||
/* lease time */
|
||||
int leaseTime;
|
||||
/* band width */
|
||||
int apBandWidth;
|
||||
} HotspotConfig;
|
||||
|
||||
/**
|
||||
|
Loading…
x
Reference in New Issue
Block a user