var gCurrentssidItem =0; | |
var IsWpsMatch = false; | |
var gCurrentAPItem = 0; | |
var callCount = 0; | |
var g24gAuthType; | |
var g24gEncryAlg; | |
var g24gPassword; | |
var gWifiBSEnable = 0; | |
(function($) { | |
$.fn.objWifiSet = function() { | |
var gAutoOffEnable; | |
var gAutoOffTimeout; | |
var wifiDetailedInfoMap = new Map(); | |
var gMultiplessidenable; | |
//var gCurrentssidItem =0; | |
var gWirelessAPNum = 0; | |
var gWirelessSSIDNum = 0; | |
var gChangeSSID = false; | |
var gWirelessType = 0; | |
var gWifi6Support = 0; | |
var gWifiBSSupport = 0; | |
this.onLoad = function(flag) { | |
if(flag) { | |
LoadWebPage("html/wifi/wireless_settings.html"); | |
$("#selWifiBandSteering").change(function() { | |
if(1==$(this).val()) { | |
RefreshssidInfo(); | |
} else { | |
RefreshssidInfo(); | |
} | |
}); | |
$("#selWifiEnabledSwitch").change(function() { | |
if(1==$(this).val()) { | |
$("#divDisabledWifi").show(); | |
RefreshWifiRFSwitch(1); | |
RefreshFreqBandData(); | |
GetWifiAutoOffSetting(); | |
} else { | |
$("#divDisabledWifi").hide(); | |
} | |
}); | |
$("#selWifiAPList").change(function() { | |
gCurrentAPItem =$(this).val(); | |
RefreshWifiRFSwitch(0); | |
RefreshFreqBandData(); | |
GetWifiAutoOffSetting(); | |
}); | |
$("#lt_wifiSet_EditSSID").click(function() { | |
/* | |
if(gChangeSSID){ | |
$("#divSSIDchange").show(); | |
gChangeSSID = true; | |
}else{ | |
$("#divSSIDchange").hide(); | |
gChangeSSID = false; | |
} | |
*/ | |
$("#divSSIDchange").show(); | |
$("#selMultiSSID").change(function() { | |
gCurrentssidItem =$(this).val(); | |
RefreshssidInfo(); | |
}); | |
}); | |
//根据认证类型,生成加密方式下拉列表 | |
$("#selWifiAuthType").change(function() { | |
UpdateWifiEncryAlg($(this).val()); | |
if ($("#selRfBand").val() == 1) | |
g24gAuthType = $(this).val(); | |
if("none" == $(this).val()) { | |
$("#divEncryAlg").hide(); | |
$("#divPassWd").hide(); | |
$("#divwepKeyFormat").hide(); | |
} else if("WEP" == $(this).val()) { | |
$("#divEncryAlg").show(); | |
$("#divPassWd").show(); | |
$("#divwepKeyFormat").show(); | |
} else if ("WAPI-PSK" == $(this).val()) { | |
$("#divEncryAlg").hide(); | |
$("#divPassWd").show(); | |
$("#divwepKeyFormat").hide(); | |
} else { | |
$("#divEncryAlg").show(); | |
$("#divPassWd").show(); | |
$("#divwepKeyFormat").hide(); | |
} | |
if ("WPA-PSK" == $(this).val() || "WEP" == $(this).val() || "WPA3-SAE" == $(this).val() || "none" == $(this).val()) | |
$("#divWpsCfgDlg").hide(); | |
else | |
$("#divWpsCfgDlg").show(); | |
/* | |
if("Mixed" == $(this).val() || "WPA-PSK" == $(this).val()) { | |
$("#divWpaGroupKey").show(); | |
} else { | |
$("#divWpaGroupKey").hide(); | |
} | |
*/ | |
}); | |
$("#selEncryAlg").change(function() { | |
if ($("#selRfBand").val() == 1) | |
g24gEncryAlg = $(this).val(); | |
if ("TKIP" == $(this).val()) { | |
if ($("#selWifiAuthType").val() == "WPA-PSK") | |
$("#divWpsCfgDlg").hide(); | |
else | |
$("#divWpsCfgDlg").show(); | |
} else { | |
if ($("#selWifiAuthType").val() == "WPA-PSK" || $("#selWifiAuthType").val() == "WEP") | |
$("#divWpsCfgDlg").hide(); | |
else | |
$("#divWpsCfgDlg").show(); | |
} | |
}); | |
$("#selRfBand").change(function() { | |
if(1 == $(this).val()) { | |
$("#div5G80211Protocol").hide(); | |
$("#div2_4G80211Protocol").show(); | |
$("#selWifi24GChannel").show(); | |
$("#selWifi5GChannel").hide(); | |
} else { | |
$("#div5G80211Protocol").show(); | |
$("#div2_4G80211Protocol").hide(); | |
$("#selWifi24GChannel").hide(); | |
$("#selWifi5GChannel").show(); | |
} | |
RefreshFreqBandData(); | |
}); | |
$("#sel2_4G80211Protocol").change(function() { | |
if("11ng" == $(this).val()) { | |
$("#div80211nBandWidth").show(); | |
if (gWifi6Support == 1) { | |
//$("#div80211nBW40Extend").show(); | |
if ($("#sel80211nBandWidth option").length < 3) { | |
$("#sel80211nBandWidth").append("<option value='HT40-'>HT40-</option>"); | |
$("#sel80211nBandWidth").append("<option value='HT40+'>HT40+</option>"); | |
} | |
} | |
else { | |
// $("#div80211nBW40Extend").hide(); | |
$("#sel80211nBandWidth option[value='HT40-']").remove(); | |
$("#sel80211nBandWidth option[value='HT40+']").remove(); | |
} | |
$("#div80211acBandWidth").hide(); | |
$("#div80211axBandWidth").hide(); | |
} else if("11ax" == $(this).val() || "11bgnax" == $(this).val()) { | |
$("#div80211axBandWidth").show(); | |
$("#sel80211axBandWidth option[value='HE80']").remove(); | |
$("#div80211nBandWidth").hide(); | |
$("#div80211acBandWidth").hide(); | |
} else { | |
$("#div80211axBandWidth").hide(); | |
$("#div80211nBandWidth").hide(); | |
$("#div80211acBandWidth").hide(); | |
} | |
}); | |
$("#sel5G80211Protocol").change(function() { | |
if("11na" == $(this).val()) { | |
$("#div80211acBandWidth").hide(); | |
$("#div80211axBandWidth").hide(); | |
$("#div80211nBandWidth").show(); | |
if (gWifi6Support == 1) { | |
//$("#div80211nBW40Extend").show(); | |
if ($("#sel80211nBandWidth option").length < 3) { | |
$("#sel80211nBandWidth").append("<option value='HT40-'>HT40-</option>"); | |
$("#sel80211nBandWidth").append("<option value='HT40+'>HT40+</option>"); | |
} | |
} | |
else { | |
// $("#div80211nBW40Extend").hide(); | |
$("#sel80211nBandWidth option[value='HT40-']").remove(); | |
$("#sel80211nBandWidth option[value='HT40+']").remove(); | |
} | |
} else if("11ac" == $(this).val()) { | |
$("#div80211nBandWidth").hide(); | |
$("#div80211axBandWidth").hide(); | |
$("#div80211acBandWidth").show(); | |
} else if ("11ax" == $(this).val() || "11anacax" == $(this).val()) { | |
$("#div80211nBandWidth").hide(); | |
$("#div80211acBandWidth").hide(); | |
$("#div80211axBandWidth").show(); | |
if ($("#sel80211axBandWidth option").length < 3) | |
$("#sel80211axBandWidth").append("<option value='HE80'>HE80</option>"); | |
} | |
else { | |
$("#div80211acBandWidth").hide(); | |
$("#div80211nBandWidth").hide(); | |
$("#div80211axBandWidth").hide(); | |
} | |
}); | |
$("#sel24GSSIDList").change(function() { | |
gCurrentssidItem =$(this).val(); | |
RefreshssidInfo(); | |
if("none" == $("#selWifiAuthType").val()) { | |
$("#divEncryAlg").hide(); | |
$("#divPassWd").hide(); | |
$("#divwepKeyFormat").hide(); | |
} else if("WEP" == $("#selWifiAuthType").val()) { | |
$("#divEncryAlg").show(); | |
$("#divPassWd").show(); | |
$("#divwepKeyFormat").show(); | |
} else { | |
$("#divEncryAlg").show(); | |
$("#divPassWd").show(); | |
$("#divwepKeyFormat").hide(); | |
} | |
}); | |
/* | |
$("#txtPasswd,#txtAutoOffWifiTimeout,#txtWifiSSID,#txtWpaGroupKeyUpdateInterval").click(function() { | |
$("#wifiSetErrorLogs").hide().text(""); | |
}); | |
*/ | |
$("#selAutoOffWifiSwitch").click(function() { | |
if(1 == $(this).val()) { | |
$("#divWifiAutoOffTimeout").show(); | |
} else { | |
$("#divWifiAutoOffTimeout").hide(); | |
} | |
}); | |
} //end flag | |
if (GetWifiDetailedInfo() == true) { | |
RefreshWifiRFSwitch(0); | |
RefreshFreqBandData(); | |
GetWifiAutoOffSetting(); | |
} | |
} | |
this.SaveData = function() { | |
var retCode; | |
entryIdx = "AP" + gCurrentAPItem; | |
var entry24GSwitch = "RGW/wireless/"+entryIdx+"/wifi_if_24G/switch"; | |
var entry5GSwitch = "RGW/wireless/"+entryIdx+"/wifi_if_5G/switch"; | |
if(0 == $("#selWifiEnabledSwitch").val()) { | |
if("on" == wifiDetailedInfoMap.get(entry24GSwitch) | |
|| "on" == wifiDetailedInfoMap.get(entry5GSwitch) ) { | |
CloseWifi(); | |
} else { | |
return; | |
} | |
} else { | |
if(!ValidateData()) { | |
return; | |
} | |
ModifyWifiConfig(); | |
SetWifiAutoOffSetting(); | |
} | |
} | |
function GetWifiAutoOffSetting() { | |
var retXml = PostXml("wireless","wifi_get_auto_off_setting"); | |
var entryIdx; | |
entryIdx = "AP" + gCurrentAPItem;; | |
$(retXml).find(entryIdx).each(function() { | |
gAutoOffEnable = $(this).find("auto_off_enable").text(); | |
gAutoOffTimeout = $(this).find("auto_off_timeout").text(); | |
}); | |
$("#selAutoOffWifiSwitch").val(gAutoOffEnable); | |
if(1 == gAutoOffEnable) { | |
$("#divWifiAutoOffTimeout").show(); | |
$("#txtAutoOffWifiTimeout").val(gAutoOffTimeout); | |
} else { | |
$("#divWifiAutoOffTimeout").hide(); | |
} | |
} | |
function SetWifiAutoOffSetting() { | |
var configMap = new Map(); | |
var curAutoOffEnable = $("#selAutoOffWifiSwitch").val(); | |
var curTimeout = $("#txtAutoOffWifiTimeout").val(); | |
if(1 == curAutoOffEnable && ("" == curTimeout || !IsNumber(curTimeout) || curTimeout <= 0 || curTimeout > 2147483647)) { | |
$("#wifiSetErrorLogs").show().text(jQuery.i18n.prop('lAutoOffTimeoutError')); | |
return; | |
} else { | |
$("#wifiSetErrorLogs").hide().text(""); | |
} | |
if(curAutoOffEnable != gAutoOffEnable) { | |
configMap.put("RGW/wireless/wifi_device", gCurrentAPItem); | |
configMap.put("RGW/wireless/auto_off_enable",curAutoOffEnable); | |
if(1 == curAutoOffEnable) { | |
configMap.put("RGW/wireless/auto_off_timeout",curTimeout); | |
} | |
} else if (1 == curAutoOffEnable && curTimeout != gAutoOffTimeout) { | |
configMap.put("RGW/wireless/wifi_device", gCurrentAPItem); | |
configMap.put("RGW/wireless/auto_off_enable",1); | |
configMap.put("RGW/wireless/auto_off_timeout",curTimeout); | |
} | |
if(configMap.isEmpty()) { | |
return; | |
} | |
var retXml = PostXml("wireless","wifi_set_auto_off_setting",configMap); | |
if("OK" != $(retXml).find("setting_response").text()) { | |
alert("wifi_set_auto_off_setting failed."); | |
} | |
GetWifiAutoOffSetting(); | |
} | |
function ValidateData() { | |
//验证Wep模式下密码长度 | |
var strPasswd = $("#txtPasswd").val(); | |
var authType = $("#selWifiAuthType").val(); | |
var ret = true; | |
var strErrMsg; | |
var regex = /\s/; | |
if (regex.test(strPasswd)) { | |
strErrMsg = jQuery.i18n.prop('lt_wifiset_PasswdSpaceError'); | |
ret = false; | |
} | |
if("WEP" == authType) { | |
switch($("#selWepKeyFormat").val()) { | |
case "5": | |
if(!IsASCIIStr(strPasswd) || 5 != strPasswd.length) { | |
strErrMsg = jQuery.i18n.prop('lt_wifiset_WepPasswd5AsciiError'); | |
ret = false; | |
} | |
break; | |
case "13": | |
if(!IsASCIIStr(strPasswd) || 13 != strPasswd.length) { | |
strErrMsg = jQuery.i18n.prop('lt_wifiset_WepPasswd13AsciiError'); | |
ret = false; | |
} | |
break; | |
case "10": | |
if(!IsHexStr(strPasswd) || 10 != strPasswd.length) { | |
strErrMsg = jQuery.i18n.prop('lt_wifiset_WepPasswd10HexError'); | |
ret = false; | |
} | |
break; | |
case "26": | |
if(!IsHexStr(strPasswd) || 26 != strPasswd.length) { | |
strErrMsg = jQuery.i18n.prop('lt_wifiset_WepPasswd26HexError'); | |
ret = false; | |
} | |
break; | |
} | |
} else if("WPA2-PSK" == authType || "Mixed" == authType || "WPA3-SAE" == authType || "WPA2-WPA3" == authType || "WPA-PSK" == authType) { | |
if(IsChineseChar(strPasswd) || strPasswd.length > 64 || strPasswd.length < 8) { | |
strErrMsg = jQuery.i18n.prop('lt_wifiset_WPA2PSKPasswdError'); | |
ret = false; | |
} | |
} | |
/* | |
if("WPA-PSK" == authType || "Mixed" == authType) { | |
var WpaGroupKeyUpdateInterval = $("#txtWpaGroupKeyUpdateInterval").val(); | |
if("" == WpaGroupKeyUpdateInterval || !IsNumber(WpaGroupKeyUpdateInterval || | |
parseInt(WpaGroupKeyUpdateInterval)>100 || parseInt(WpaGroupKeyUpdateInterval)<1)) { | |
strErrMsg = jQuery.i18n.prop('lt_wifiset_WPAGroupRekeyError'); | |
ret = false; | |
} | |
} | |
*/ | |
if($("#txtWifiSSID").val()== "") { | |
strErrMsg = jQuery.i18n.prop('lt_wifiSet_SsidIsEmpty'); | |
ret = false; | |
} else if (checkSsidLength(32) == false) { | |
ret = false; | |
} | |
if(!ret) { | |
$("#wifiSetErrorLogs").show().text(strErrMsg); | |
return false; | |
} | |
return true; | |
} | |
function CloseWifi() { | |
var configMap = new Map(); | |
var retXml; | |
var i=gCurrentAPItem; | |
//for(;i<gWirelessAPNum;i++){ | |
if("on" == wifiDetailedInfoMap.get("RGW/wireless/AP"+ i +"/wifi_if_24G/switch")) { | |
configMap.put("RGW/wireless/wifi_if_24G/switch","off"); | |
configMap.put("RGW/wireless/wifi_device",i); | |
retXml = PostXml("wireless","wifi_set_2.4g",configMap); | |
} | |
if("on" == wifiDetailedInfoMap.get("RGW/wireless/AP"+ i +"/wifi_if_5G/switch")) { | |
configMap.put("RGW/wireless/wifi_if_5G/switch","off"); | |
configMap.put("RGW/wireless/wifi_device",i); | |
retXml = PostXml("wireless","wifi_set_5g",configMap); | |
} | |
if("OK" != $(retXml).find("setting_response").text()) { | |
alert("Close Wifi failed."); | |
} | |
//} | |
GetWifiDetailedInfo(); | |
RefreshWifiRFSwitch(0); | |
RefreshFreqBandData(); | |
} | |
function ModifyWifiConfig() { | |
var retXml; | |
var curWifiConfigMap = new Map(); | |
var post_type = 0; | |
var ssid_5g; | |
if (gWifiBSSupport == 1) { | |
if (gWifiBSEnable != $("#selWifiBandSteering").val() ||1 == $("#selWifiBandSteering").val()) { | |
curWifiConfigMap.put("RGW/wireless/bs_enable", $("#selWifiBandSteering").val()); | |
if ($("#selWifiBandSteering").val() == 1) | |
post_type = 1; | |
else | |
post_type = 2; | |
} | |
} | |
curWifiConfigMap.put("RGW/wireless/wifi_device", gCurrentAPItem); | |
if(1 == $("#selRfBand").val()) { //24G | |
curWifiConfigMap.put("RGW/wireless/wifi_if_24G/switch", "on"); | |
curWifiConfigMap.put("RGW/wireless/wifi_if_24G/net_mode", $("#sel2_4G80211Protocol").val()); | |
curWifiConfigMap.put("RGW/wireless/wifi_if_24G/channel",$("#selWifi24GChannel").val()); | |
if("11ng" == $("#sel2_4G80211Protocol").val()) { | |
curWifiConfigMap.put("RGW/wireless/wifi_if_24G/bandwidth",$("#sel80211nBandWidth").val()); | |
} else if ("11ax" == $("#sel2_4G80211Protocol").val() || "11bgnax" == $("#sel2_4G80211Protocol").val()) { | |
curWifiConfigMap.put("RGW/wireless/wifi_if_24G/bandwidth",$("#sel80211axBandWidth").val()); | |
} | |
curWifiConfigMap.put("RGW/wireless/wifi_if_24G/hidden",$("#selHideSSID").val()); | |
curWifiConfigMap.put("RGW/wireless/wifi_if_24G/isolate",$("#selApIsolateSwitch").val()); | |
curWifiConfigMap.put("RGW/wireless/wifi_if_24G/ssid",$("#txtWifiSSID").val()); | |
// curWifiConfigMap.put("RGW/wireless/wifi_if_24G/wpa_group_rekey",$("#txtWpaGroupKeyUpdateInterval").val()); | |
curWifiConfigMap.put("RGW/wireless/wifi_if_24G/encryption",GetEncryptionTag( $("#selWifiAuthType").val(),$("#selEncryAlg").val())); | |
curWifiConfigMap.put("RGW/wireless/wifi_if_24G/multi_ssid", $("#selMultiSSIDSwitch").val()); | |
curWifiConfigMap.put("RGW/wireless/wifi_if_24G/ssid_index", $("#sel24GSSIDList").val()); | |
//if(gChangeSSID){ | |
// curWifiConfigMap.put("RGW/wireless/wifi_if_24G/ssid",$("#txtWifiSSID").val()); | |
//} | |
if("WEP" == $("#selWifiAuthType").val()) { | |
curWifiConfigMap.put("RGW/wireless/wifi_if_24G/key",1); | |
curWifiConfigMap.put("RGW/wireless/wifi_if_24G/key1",$("#txtPasswd").val()); | |
} else { | |
curWifiConfigMap.put("RGW/wireless/wifi_if_24G/key",$("#txtPasswd").val()); | |
} | |
if (post_type == 0) { | |
var configMap = curWifiConfigMap.getChange(wifiDetailedInfoMap); | |
if(0 == configMap.size()) { | |
return true; | |
} | |
//ShowDlg("PleaseWait", 120, 100); | |
retXml = PostXml("wireless","wifi_set_2.4g",configMap); | |
//CloseDlg(); | |
} | |
} | |
if (2 == $("#selRfBand").val() || post_type != 0) { | |
curWifiConfigMap.put("RGW/wireless/wifi_if_5G/switch", "on"); | |
curWifiConfigMap.put("RGW/wireless/wifi_if_5G/net_mode", $("#sel5G80211Protocol").val()); | |
curWifiConfigMap.put("RGW/wireless/wifi_if_5G/channel",$("#selWifi5GChannel").val()); | |
if("11na" == $("#sel5G80211Protocol").val()) { | |
curWifiConfigMap.put("RGW/wireless/wifi_if_5G/bandwidth",$("#sel80211nBandWidth").val()); | |
} else if("11ac" == $("#sel5G80211Protocol").val()) { | |
curWifiConfigMap.put("RGW/wireless/wifi_if_5G/bandwidth",$("#sel80211acBandWidth").val()); | |
} else if ("11ax" == $("#sel5G80211Protocol").val() || "11anacax" == $("#sel5G80211Protocol").val()) { | |
curWifiConfigMap.put("RGW/wireless/wifi_if_5G/bandwidth",$("#sel80211axBandWidth").val()); | |
} | |
curWifiConfigMap.put("RGW/wireless/wifi_if_5G/hidden",$("#selHideSSID").val()); | |
curWifiConfigMap.put("RGW/wireless/wifi_if_5G/isolate",$("#selApIsolateSwitch").val()); | |
ssid_5g = $("#txtWifiSSID").val(); | |
if (post_type == 2) | |
ssid_5g += "_5g"; | |
curWifiConfigMap.put("RGW/wireless/wifi_if_5G/ssid", ssid_5g); | |
//curWifiConfigMap.put("RGW/wireless/wifi_if_5G/wpa_group_rekey",$("#txtWpaGroupKeyUpdateInterval").val()); | |
curWifiConfigMap.put("RGW/wireless/wifi_if_5G/encryption",GetEncryptionTag( $("#selWifiAuthType").val(),$("#selEncryAlg").val())); | |
curWifiConfigMap.put("RGW/wireless/wifi_if_5G/multi_ssid", $("#selMultiSSIDSwitch").val()); | |
curWifiConfigMap.put("RGW/wireless/wifi_if_5G/ssid_index", $("#sel5GSSIDList").val()); | |
//if(gChangeSSID){ | |
//curWifiConfigMap.put("RGW/wireless/wifi_if_5G/ssid",$("#txtWifiSSID").val()); | |
//} | |
if("WEP" == $("#selWifiAuthType").val()) { | |
curWifiConfigMap.put("RGW/wireless/wifi_if_5G/key",1); | |
curWifiConfigMap.put("RGW/wireless/wifi_if_5G/key1",$("#txtPasswd").val()); | |
} else { | |
curWifiConfigMap.put("RGW/wireless/wifi_if_5G/key",$("#txtPasswd").val()); | |
} | |
if (post_type == 0) { | |
var configMap = curWifiConfigMap.getChange(wifiDetailedInfoMap); | |
if(0 == configMap.size()) { | |
return true; | |
} | |
retXml = PostXml("wireless","wifi_set_5g",configMap); | |
} | |
}//end wifi_set_5g | |
if (post_type != 0) { | |
var configMap = curWifiConfigMap.getChange(wifiDetailedInfoMap); | |
if(0 == configMap.size()) { | |
return true; | |
} | |
retXml = PostXml("wireless","wifi_set_all",configMap); | |
} | |
if("OK" != $(retXml).find("setting_response").text()) { | |
alert("config wifi failed."); | |
} | |
if(gChangeSSID){ | |
gChangeSSID = false; | |
} | |
GetWifiDetailedInfo(); | |
RefreshWifiRFSwitch(0); | |
RefreshFreqBandData(); | |
} | |
function UpdateWifiEncryAlg(strAuthType) { | |
$("#selEncryAlg").empty(); | |
switch(strAuthType) { | |
case "WPA-PSK": | |
$("#selEncryAlg").append("<option value='AES-CCMP'>AES-CCMP</option>"); | |
$("#selEncryAlg").append("<option value='TKIP'>TKIP</option>"); | |
$("#selEncryAlg").append("<option value='TKIP/AES-CCMP'>TKIP/AES-CCMP</option>"); | |
break; | |
case "WPA2-PSK": | |
$("#selEncryAlg").append("<option value='AES-CCMP'>AES-CCMP</option>"); | |
$("#selEncryAlg").append("<option value='TKIP/AES-CCMP'>TKIP/AES-CCMP</option>"); | |
break; | |
case "Mixed": | |
$("#selEncryAlg").append("<option value='AES-CCMP'>AES-CCMP</option>"); | |
$("#selEncryAlg").append("<option value='AES-CCMP/TKIP'>AES-CCMP/TKIP</option>"); | |
break; | |
case "WEP": | |
$("#selEncryAlg").append("<option value='Open'>Open</option>"); | |
$("#selEncryAlg").append("<option value='Shared-key'>Shared-key</option>"); | |
break; | |
case "WPA3-SAE": | |
case "WPA2-WPA3": | |
$("#selEncryAlg").append("<option value='AES-CCMP'>AES-CCMP</option>"); | |
break; | |
} | |
} | |
function Updatehwmode(bandType, wifi6) { | |
$("#sel2_4G80211Protocol").empty(); | |
$("#sel5G80211Protocol").empty(); | |
switch(bandType) { | |
case 1: | |
$("#sel2_4G80211Protocol").append("<option id='lt_wifiSet_opt80211n' value='11ng'>802.11b/g/n</option>"); | |
$("#sel2_4G80211Protocol").append("<option id='lt_wifiSet_opt80211gb' value='11bg'>802.11b/g</option>"); | |
$("#sel2_4G80211Protocol").append("<option id='lt_wifiSet_opt80211b_only' value='11b'>802.11b</option>"); | |
$("#sel2_4G80211Protocol").append("<option id='lt_wifiSet_opt80211g_only' value='11g'>802.11g</option>"); | |
if (wifi6 == "1") { | |
$("#sel2_4G80211Protocol").append("<option id='lt_wifiSet_opt80211bgnax' value='11bgnax'>802.11b/g/n/ax</option>"); | |
$("#sel2_4G80211Protocol").append("<option id='lt_wifiSet_opt80211ax' value='11ax'>802.11ax</option>"); | |
} | |
break; | |
case 2: | |
$("#sel5G80211Protocol").append("<option value='11a'>802.11a</option>"); | |
$("#sel5G80211Protocol").append("<option value='11na'>802.11n</option>"); | |
$("#sel5G80211Protocol").append("<option value='11ac'>802.11ac</option>"); | |
if (wifi6 == "1") { | |
$("#sel5G80211Protocol").append("<option value='11anacax'>802.11a/n/ac/ax</option>"); | |
$("#sel5G80211Protocol").append("<option value='11ax'>802.11ax</option>"); | |
} | |
break; | |
} | |
} | |
function GetWifiBasicInfo() { | |
wifiDetailedInfoMap.clear(); | |
var retXml = PostXml("wireless","wifi_get_basic_info"); | |
var wifi24GStatus,wifi5GStatus; | |
$(retXml).find("wifi_if_24G").each(function() { | |
wifi24GStatus = $(this).find("switch").text(); | |
}); | |
$(retXml).find("wifi_if_5G").each(function() { | |
wifi5GStatus = $(this).find("switch").text(); | |
}); | |
if("off" == wifi24GStatus && "off" == wifi5GStatus) { | |
$("#selWifiEnabledSwitch").val(0); | |
$("#divDisabledWifi").hide(); | |
return; | |
} else { | |
$("#selWifiEnabledSwitch").val(1); | |
$("#divDisabledWifi").show(); | |
if("on" == wifi24GStatus) { | |
$("#selRfBand").val(1); | |
} else { | |
$("#selRfBand").val(2); | |
} | |
} | |
GetWifiDetailedInfo(); | |
//RefreshFreqBandData(); | |
} | |
function BandSteeringSupport() { | |
var ret = 0; | |
if ("1" == wifiDetailedInfoMap.get("RGW/wireless/bs_support")) | |
{ | |
if ("on" == wifiDetailedInfoMap.get("RGW/wireless/AP0/wifi_if_24G/switch") | |
&& "on" == wifiDetailedInfoMap.get("RGW/wireless/AP1/wifi_if_5G/switch") ) | |
ret = 1; | |
else if ("on" == wifiDetailedInfoMap.get("RGW/wireless/AP0/wifi_if_5G/switch") | |
&& "on" == wifiDetailedInfoMap.get("RGW/wireless/AP1/wifi_if_24G/switch") ) | |
ret = 2; | |
} | |
return ret; | |
} | |
function RefreshWifiRFSwitch(onlyBandType) { | |
var band24GSupport = 0; | |
var band5GSupport = 0; | |
if (null != wifiDetailedInfoMap.get("RGW/wireless/AP" + gCurrentAPItem+"/wifi_if_24G/switch")) | |
band24GSupport = 1; | |
if (null != wifiDetailedInfoMap.get("RGW/wireless/AP" + gCurrentAPItem+"/wifi_if_5G/switch")) | |
band5GSupport = 1; | |
if (onlyBandType == 1) | |
{ | |
if (band24GSupport && band5GSupport) { | |
$("#optRfBand24G").show(); | |
$("#optRfBand5G").show(); | |
} else if (band24GSupport) { | |
$("#selRfBand").val(1); | |
$("#optRfBand5G").hide(); | |
} else if (band5GSupport) { | |
$("#selRfBand").val(2); | |
$("#optRfBand24G").hide(); | |
} | |
return; | |
} | |
if (band24GSupport && band5GSupport) { | |
if("off" == wifiDetailedInfoMap.get("RGW/wireless/AP" + gCurrentAPItem+"/wifi_if_24G/switch") | |
&& "off" == wifiDetailedInfoMap.get("RGW/wireless/AP" + gCurrentAPItem+"/wifi_if_5G/switch") ) { | |
$("#selWifiEnabledSwitch").val(0); | |
$("#divDisabledWifi").hide(); | |
} else { | |
$("#selWifiEnabledSwitch").val(1); | |
$("#divDisabledWifi").show(); | |
if("on" == wifiDetailedInfoMap.get("RGW/wireless/AP" + gCurrentAPItem+"/wifi_if_24G/switch")) { | |
$("#selRfBand").val(1); | |
} else { | |
$("#selRfBand").val(2); | |
} | |
} | |
} else if (band24GSupport) { | |
if("off" == wifiDetailedInfoMap.get("RGW/wireless/AP" + gCurrentAPItem+"/wifi_if_24G/switch")) { | |
$("#selWifiEnabledSwitch").val(0); | |
$("#divDisabledWifi").hide(); | |
} else { | |
$("#selWifiEnabledSwitch").val(1); | |
$("#divDisabledWifi").show(); | |
$("#selRfBand").val(1); | |
$("#optRfBand5G").hide(); | |
} | |
} else if (band5GSupport) { | |
if("off" == wifiDetailedInfoMap.get("RGW/wireless/AP" + gCurrentAPItem+"/wifi_if_5G/switch")) { | |
$("#selWifiEnabledSwitch").val(0); | |
$("#divDisabledWifi").hide(); | |
} else { | |
$("#selWifiEnabledSwitch").val(1); | |
$("#divDisabledWifi").show(); | |
$("#selRfBand").val(2); | |
$("#optRfBand24G").hide(); | |
} | |
} else { | |
$("#selWifiEnabledSwitch").val(0); | |
$("#divDisabledWifi").hide(); | |
} | |
} | |
function RefreshssidInfo(){ | |
var bs_enable = $("#selWifiBandSteering").val(); | |
if(1 == $("#selRfBand").val()) { //24G | |
if ("1" == wifiDetailedInfoMap.get("RGW/wireless/AP" + gCurrentAPItem+"/wifi_if_24G/unsupport_multi_ssid")) | |
$("#divMultiSSID").hide(); | |
else | |
$("#divMultiSSID").show(); | |
$("#selHideSSID").val(wifiDetailedInfoMap.get("RGW/wireless/AP"+gCurrentAPItem+"/wifi_if_24G/ssid"+gCurrentssidItem+"/hidden")); | |
$("#selApIsolateSwitch").val(wifiDetailedInfoMap.get("RGW/wireless/AP"+gCurrentAPItem+"/wifi_if_24G/ssid"+gCurrentssidItem+"/isolate")); | |
if(wifiDetailedInfoMap.get("RGW/wireless/AP"+gCurrentAPItem+"/wifi_if_24G/n_ssid")>1) | |
$("#selMultiSSIDSwitch").val("1"); | |
else | |
$("#selMultiSSIDSwitch").val("0"); | |
$("#txtWifiSSID").val(wifiDetailedInfoMap.get("RGW/wireless/AP"+gCurrentAPItem+"/wifi_if_24G/ssid"+gCurrentssidItem+"/ssid")); | |
//$("#txtWpaGroupKeyUpdateInterval").val(wifiDetailedInfoMap.get("RGW/wireless/AP"+gCurrentAPItem+"/wifi_if_24G/ssid"+gCurrentssidItem+"/wpa_group_rekey")); | |
$("#txtPasswd").val(wifiDetailedInfoMap.get("RGW/wireless/AP"+gCurrentAPItem+"/wifi_if_24G/ssid"+gCurrentssidItem+"/key")); | |
var encryptionMap = ParseEncryption(wifiDetailedInfoMap.get("RGW/wireless/AP"+gCurrentAPItem+"/wifi_if_24G/ssid"+gCurrentssidItem+"/encryption")); | |
UpdateWifiEncryAlg(encryptionMap.get("authType")); | |
$("#selWifiAuthType").val(encryptionMap.get("authType")); | |
$("#selEncryAlg").val(encryptionMap.get("ciphers")); | |
if("WEP" == encryptionMap.get("authType")) { | |
$("#divwepKeyFormat").show(); | |
$("#selWepKeyFormat").val(wifiDetailedInfoMap.get("RGW/wireless/AP"+gCurrentAPItem+"/wifi_if_24G/ssid"+gCurrentssidItem+"/key").length); | |
} | |
$("#lt_wifiSet_EditSSID").show(); | |
$("#txtWifiSSID").attr("disabled", false); | |
$("#txtPasswd").attr("disabled", false); | |
$("#selWifiAuthType").attr("disabled", false); | |
$("#selEncryAlg").attr("disabled", false); | |
$("#selWepKeyFormat").attr("disabled", false); | |
if (bs_enable) { | |
$("#divSSIDSetting").show(); | |
$("#divAuthTypeSetting").show(); | |
} | |
} else { | |
var bs_support = BandSteeringSupport(); | |
var APIndex; | |
var wifi_if_ssid; | |
var add_suffix = 0; | |
var ssid_str; | |
var ssid_unify = 0; | |
var ssid_num = 0; | |
if ("1" == wifiDetailedInfoMap.get("RGW/wireless/AP" + gCurrentAPItem+"/wifi_if_5G/unsupport_multi_ssid")) | |
$("#divMultiSSID").hide(); | |
else | |
$("#divMultiSSID").show(); | |
if (bs_enable == 1) { | |
if (bs_support == 1) { | |
APIndex = 0; | |
wifi_if_ssid = "/wifi_if_24G/ssid"; | |
ssid_unify = 1; | |
} | |
else if (bs_support == 2) { | |
APIndex = 1; | |
wifi_if_ssid = "/wifi_if_24G/ssid"; | |
ssid_unify = 1; | |
} | |
else { | |
APIndex = gCurrentAPItem; | |
wifi_if_ssid = "wifi_if_5G/ssid"; | |
} | |
} | |
else { | |
APIndex = gCurrentAPItem; | |
wifi_if_ssid = "/wifi_if_5G/ssid"; | |
if (bs_support == 1) { | |
if (wifiDetailedInfoMap.get("RGW/wireless/AP0/wifi_if_24G/ssid"+gCurrentssidItem+"/ssid") == | |
wifiDetailedInfoMap.get("RGW/wireless/AP1/wifi_if_5G/ssid"+gCurrentssidItem+"/ssid")) | |
add_suffix = 1; | |
} else if (bs_support == 2) { | |
if (wifiDetailedInfoMap.get("RGW/wireless/AP1/wifi_if_24G/ssid"+gCurrentssidItem+"/ssid") == | |
wifiDetailedInfoMap.get("RGW/wireless/AP0/wifi_if_5G/ssid"+gCurrentssidItem+"/ssid")) | |
add_suffix = 1; | |
} | |
} | |
$("#selHideSSID").val(wifiDetailedInfoMap.get("RGW/wireless/AP"+APIndex+wifi_if_ssid+gCurrentssidItem+"/hidden")); | |
$("#selApIsolateSwitch").val(wifiDetailedInfoMap.get("RGW/wireless/AP"+APIndex+wifi_if_ssid+gCurrentssidItem+"/isolate")); | |
/* should use current AP 5G config */ | |
ssid_num = wifiDetailedInfoMap.get("RGW/wireless/AP"+gCurrentAPItem+"/wifi_if_5G/n_ssid"); | |
if(ssid_num > 1) | |
$("#selMultiSSIDSwitch").val("1"); | |
else | |
$("#selMultiSSIDSwitch").val("0"); | |
ssid_str = wifiDetailedInfoMap.get("RGW/wireless/AP"+APIndex+wifi_if_ssid+gCurrentssidItem+"/ssid"); | |
if (add_suffix == 1) | |
ssid_str += "_5g"; | |
if (bs_support > 0) { | |
$("#sel5GSSIDList").empty(); | |
if($("#sel5GSSIDList option").size() != ssid_num) { | |
var idx =0; | |
for ( ; idx < ssid_num; idx++ ) { | |
var opt_ap = document.createElement("option"); | |
document.getElementById("sel5GSSIDList").options.add(opt_ap); | |
opt_ap.id = "opt5GSSID"+idx; | |
opt_ap.text = ssid_str; | |
opt_ap.value = idx; | |
} | |
$("#sel5GSSIDList").val(gCurrentssidItem); | |
} | |
} | |
//$("#txtWifiSSID").val(wifiDetailedInfoMap.get("RGW/wireless/AP"+APIndex+wifi_if_ssid+gCurrentssidItem+"/ssid")); | |
$("#txtWifiSSID").val(ssid_str); | |
//$("#txtWpaGroupKeyUpdateInterval").val(wifiDetailedInfoMap.get("RGW/wireless/AP"+gCurrentAPItem+"/wifi_if_5G/ssid"+gCurrentssidItem+"/wpa_group_rekey")); | |
$("#txtPasswd").val(wifiDetailedInfoMap.get("RGW/wireless/AP"+APIndex+wifi_if_ssid+gCurrentssidItem+"/key")); | |
var encryptionMap = ParseEncryption(wifiDetailedInfoMap.get("RGW/wireless/AP"+APIndex+wifi_if_ssid+gCurrentssidItem+"/encryption")); | |
UpdateWifiEncryAlg(encryptionMap.get("authType")); | |
$("#selWifiAuthType").val(encryptionMap.get("authType")); | |
$("#selEncryAlg").val(encryptionMap.get("ciphers")); | |
if("WEP" == encryptionMap.get("authType")) { | |
$("#divwepKeyFormat").show(); | |
$("#selWepKeyFormat").val(wifiDetailedInfoMap.get("RGW/wireless/AP"+APIndex+wifi_if_ssid+gCurrentssidItem+"/key").length); | |
} | |
if (ssid_unify == 1) { | |
$("#divSSIDSetting").hide(); | |
$("#divAuthTypeSetting").hide(); | |
$("#divEncryAlg").hide(); | |
$("#divwepKeyFormat").hide(); | |
$("#divPassWd").hide(); | |
$("#divWpsCfgDlg").hide(); | |
$("#lt_wifiSet_EditSSID").hide(); | |
$("#sel5GSSIDList").attr("disabled", true); | |
$("#txtWifiSSID").attr("disabled", true); | |
$("#txtPasswd").attr("disabled", true); | |
$("#selWifiAuthType").attr("disabled", true); | |
$("#selEncryAlg").attr("disabled", true); | |
$("#selWepKeyFormat").attr("disabled", true); | |
} | |
else { | |
$("#divSSIDSetting").show(); | |
$("#divAuthTypeSetting").show(); | |
$("#divEncryAlg").show(); | |
$("#divwepKeyFormat").show(); | |
$("#divPassWd").show(); | |
$("#lt_wifiSet_EditSSID").show(); | |
$("#sel5GSSIDList").attr("disabled", false); | |
$("#txtWifiSSID").attr("disabled", false); | |
$("#txtPasswd").attr("disabled", false); | |
$("#selWifiAuthType").attr("disabled", false); | |
$("#selEncryAlg").attr("disabled", false); | |
$("#selWepKeyFormat").attr("disabled", false); | |
} | |
if (gWirelessType == 1) | |
$("#lt_wifiSet_WAPI").hide(); | |
if (1 == $("#selRfBand").val() || 0 == $("#selWifiBandSteering").val()) { | |
if("none" == $("#selWifiAuthType").val()) { | |
$("#divEncryAlg").hide(); | |
$("#divPassWd").hide(); | |
$("#divwepKeyFormat").hide(); | |
} else if("WEP" == $("#selWifiAuthType").val()) { | |
$("#divEncryAlg").show(); | |
$("#divPassWd").show(); | |
$("#divwepKeyFormat").show(); | |
} else { | |
$("#divEncryAlg").show(); | |
$("#divPassWd").show(); | |
$("#divwepKeyFormat").hide(); | |
} | |
if("WPA-PSK" == $("#selWifiAuthType").val() || "WEP" == $("#selWifiAuthType").val()) { | |
$("#divWpsCfgDlg").hide(); | |
} else { | |
$("#divWpsCfgDlg").show(); | |
} | |
} | |
} | |
} | |
function RefreshFreqBandData() { | |
var net_mode; | |
$("#div80211nBandWidth").hide(); | |
$("#div80211acBandWidth").hide(); | |
$("#div80211axBandWidth").hide(); | |
$("#div5G80211Protocol").hide(); | |
$("#div2_4G80211Protocol").hide(); | |
$("#divwepKeyFormat").hide(); | |
if(1 == $("#selRfBand").val()) { //24G | |
Updatehwmode(1, gWifi6Support); | |
$("#div2_4G80211Protocol").show(); | |
$("#sel2_4G80211Protocol").val(wifiDetailedInfoMap.get("RGW/wireless/AP"+gCurrentAPItem+"/wifi_if_24G/net_mode")); | |
$("#selWifi24GChannel").show(); | |
$("#selWifi5GChannel").hide(); | |
var first_channel = parseInt(wifiDetailedInfoMap.get("RGW/wireless/AP"+gCurrentAPItem+"/wifi_if_24G/first_channel")); | |
var last_channel = parseInt(wifiDetailedInfoMap.get("RGW/wireless/AP"+gCurrentAPItem+"/wifi_if_24G/last_channel")); | |
/*hide below than first channel*/ | |
for (var channelIdx = 1; channelIdx < first_channel; channelIdx++) { | |
var optionId = "#lt_wifiSet_optCH" + channelIdx; | |
$(optionId).hide(); | |
} | |
/*hide higer than last channel*/ | |
for (var channelIdx = last_channel + 1; channelIdx <= 14; channelIdx++) { | |
var optionId = "#lt_wifiSet_optCH" + channelIdx; | |
$(optionId).hide(); | |
} | |
/*allowed rangel*/ | |
for (var channelIdx = first_channel; channelIdx < last_channel; channelIdx++) { | |
var optionId = "#lt_wifiSet_optCH" + channelIdx; | |
$(optionId).show(); | |
} | |
$("#selWifi24GChannel").val(wifiDetailedInfoMap.get("RGW/wireless/AP"+gCurrentAPItem+"/wifi_if_24G/channel")); | |
net_mode = wifiDetailedInfoMap.get("RGW/wireless/AP"+gCurrentAPItem+"/wifi_if_24G/net_mode"); | |
if("11ng" == net_mode) { | |
$("#div80211nBandWidth").show(); | |
if (gWifi6Support == 1) { | |
//$("#div80211nBW40Extend").show(); | |
if ($("#sel80211nBandWidth option").length < 3) { | |
$("#sel80211nBandWidth").append("<option value='HT40-'>HT40-</option>"); | |
$("#sel80211nBandWidth").append("<option value='HT40+'>HT40+</option>"); | |
} | |
} | |
else { | |
// $("#div80211nBW40Extend").hide(); | |
$("#sel80211nBandWidth option[value='HT40-']").remove(); | |
$("#sel80211nBandWidth option[value='HT40+']").remove(); | |
} | |
$("#sel80211nBandWidth").val(wifiDetailedInfoMap.get("RGW/wireless/AP"+gCurrentAPItem+"/wifi_if_24G/bandwidth")); | |
} else if("11ax" == net_mode ||"11bgnax" == net_mode) { | |
$("#div80211axBandWidth").show(); | |
$("#sel80211axBandWidth option[value='HE80']").remove(); | |
$("#sel80211axBandWidth").val(wifiDetailedInfoMap.get("RGW/wireless/AP"+gCurrentAPItem+"/wifi_if_24G/bandwidth")); | |
} | |
$("#sel24GSSIDList").show(); | |
$("#sel5GSSIDList").hide(); | |
} else { | |
Updatehwmode(2, gWifi6Support); | |
$("#div5G80211Protocol").show(); | |
$("#sel5G80211Protocol").val(wifiDetailedInfoMap.get("RGW/wireless/AP"+gCurrentAPItem+"/wifi_if_5G/net_mode")); | |
$("#selWifi24GChannel").hide(); | |
$("#selWifi5GChannel").show(); | |
$("#selWifi5GChannel").val(wifiDetailedInfoMap.get("RGW/wireless/AP"+gCurrentAPItem+"/wifi_if_5G/channel")); | |
net_mode = wifiDetailedInfoMap.get("RGW/wireless/AP"+gCurrentAPItem+"/wifi_if_5G/net_mode"); | |
if("11na" == net_mode) { | |
$("#div80211nBandWidth").show(); | |
if (gWifi6Support == 1) { | |
//$("#div80211nBW40Extend").show(); | |
if ($("#sel80211nBandWidth option").length < 3) { | |
$("#sel80211nBandWidth").append("<option value='HT40-'>HT40-</option>"); | |
$("#sel80211nBandWidth").append("<option value='HT40+'>HT40+</option>"); | |
} | |
} | |
else { | |
// $("#div80211nBW40Extend").hide(); | |
$("#sel80211nBandWidth option[value='HT40-']").remove(); | |
$("#sel80211nBandWidth option[value='HT40+']").remove(); | |
} | |
$("#sel80211nBandWidth").val(wifiDetailedInfoMap.get("RGW/wireless/AP"+gCurrentAPItem+"wifi_if_5G/bandwidth")); | |
} else if("11ac" == net_mode) { | |
$("#div80211acBandWidth").show(); | |
$("#sel80211acBandWidth").val(wifiDetailedInfoMap.get("RGW/wireless/AP"+gCurrentAPItem+"/wifi_if_5G/bandwidth")); | |
} else if("11ax" == net_mode || "11anacax" == net_mode) { | |
$("#div80211axBandWidth").show(); | |
if ($("#sel80211axBandWidth option").length < 3) | |
$("#sel80211axBandWidth").append("<option value='HE80'>HE80</option>"); | |
$("#sel80211axBandWidth").val(wifiDetailedInfoMap.get("RGW/wireless/AP"+gCurrentAPItem+"/wifi_if_5G/bandwidth")); | |
} | |
$("#sel5GSSIDList").show(); | |
$("#sel24GSSIDList").hide(); | |
} | |
RefreshssidInfo(); | |
if (gWirelessType == 1) | |
$("#lt_wifiSet_WAPI").hide(); | |
if (1 == $("#selRfBand").val() || 0 == $("#selWifiBandSteering").val()) { | |
if("none" == $("#selWifiAuthType").val()) { | |
$("#divEncryAlg").hide(); | |
$("#divPassWd").hide(); | |
$("#divwepKeyFormat").hide(); | |
} else if("WEP" == $("#selWifiAuthType").val()) { | |
$("#divEncryAlg").show(); | |
$("#divPassWd").show(); | |
$("#divwepKeyFormat").show(); | |
} else { | |
$("#divEncryAlg").show(); | |
$("#divPassWd").show(); | |
$("#divwepKeyFormat").hide(); | |
} | |
/* | |
if("Mixed" == $("#selWifiAuthType").val() || "WPA-PSK" == $("#selWifiAuthType").val()) { | |
$("#divWpaGroupKey").show(); | |
} else { | |
$("#divWpaGroupKey").hide(); | |
} | |
*/ | |
if ("WPA-PSK" == $("#selWifiAuthType").val() || "WEP" == $("#selWifiAuthType").val() || "WPA3-SAE" == $("#selWifiAuthType").val() || "none" == $("#selWifiAuthType").val() || "1" == $("#selHideSSID").val()) | |
$("#divWpsCfgDlg").hide(); | |
else | |
$("#divWpsCfgDlg").show(); | |
} | |
} | |
function GetWifiDetailedInfo() { | |
wifiDetailedInfoMap.clear(); | |
$("#selWifiAPList").empty(); | |
var idx =0; | |
var retXml = PostXml("wireless","wifi_get_detail"); | |
var wirelessAPNum = $(retXml).find("wireless_num").text(); | |
gWirelessAPNum = wirelessAPNum; | |
gWirelessType = $(retXml).find("wireless_type").text(); | |
gWifi6Support = $(retXml).find("wifi6_support").text(); | |
gCurrentAPItem = $(retXml).find("current_ap").text(); | |
gWifiBSSupport = $(retXml).find("bs_support").text(); | |
gWifiBSEnable = $(retXml).find("bs_enable").text(); | |
var ssidNum; | |
if (wirelessAPNum == 0) { | |
$("#divWireless").hide(); | |
$("#wifiSetErrorLogs").show().text(jQuery.i18n.prop('lNoWiFiCardError')); | |
return false; | |
} | |
if (gWifiBSSupport == 1) { | |
$("#divWifiBandSteering").show(); | |
$("#selWifiBandSteering").val(gWifiBSEnable); | |
} | |
else { | |
$("#divWifiBandSteering").hide(); | |
} | |
if (gWirelessType == 1) { | |
$("#dropdownBW40").hide(); | |
// $("#div80211nBW40Extend").hide(); | |
$("#sel80211nBandWidth option[value='HT40-']").remove(); | |
$("#sel80211nBandWidth option[value='HT40+']").remove(); | |
$("#lt_wifiSet_WAPI").hide(); | |
} | |
if($("#selWifiAPList option").size()!=wirelessAPNum){ | |
for ( ; idx < wirelessAPNum; idx++ ){ | |
var opt_ap = document.createElement("option"); | |
document.getElementById("selWifiAPList").options.add(opt_ap); | |
opt_ap.id = "optWifiAP"+idx; | |
opt_ap.text = "AP"+idx; | |
opt_ap.value = idx; | |
} | |
if (gCurrentAPItem == 0) | |
$("#selWifiAPList").val("0"); | |
else | |
$("#selWifiAPList").val("1"); | |
} | |
wifiDetailedInfoMap.put("RGW/wireless/wireless_num", $(retXml).find("wireless_num").text()); | |
wifiDetailedInfoMap.put("RGW/wireless/bs_support", $(retXml).find("bs_support").text()); | |
var i=0; | |
for(;i<wirelessAPNum;i++){ | |
$(retXml).find("AP"+i).each(function() { | |
/*24G info start*/ | |
$(this).find("wifi_if_24G").each(function(){ | |
wifiDetailedInfoMap.put("RGW/wireless/AP"+i+"/wifi_if_24G/switch",$(this).find("switch").text()); | |
wifiDetailedInfoMap.put("RGW/wireless/AP"+i+"/wifi_if_24G/net_mode",$(this).find("net_mode").text()); | |
wifiDetailedInfoMap.put("RGW/wireless/AP"+i+"/wifi_if_24G/channel",$(this).find("channel").text()); | |
wifiDetailedInfoMap.put("RGW/wireless/AP"+i+"/wifi_if_24G/first_channel",$(this).find("first_channel").text()); | |
wifiDetailedInfoMap.put("RGW/wireless/AP"+i+"/wifi_if_24G/last_channel",$(this).find("last_channel").text()); | |
wifiDetailedInfoMap.put("RGW/wireless/AP"+i+"/wifi_if_24G/bandwidth",$(this).find("bandwidth").text()); | |
wifiDetailedInfoMap.put("RGW/wireless/AP"+i+"/wifi_if_24G/unsupport_multi_ssid",$(this).find("unsupport_multi_ssid").text()); | |
var j=0; | |
ssidNum = $(this).find("n_ssid").text(); | |
wifiDetailedInfoMap.put("RGW/wireless/AP"+i+"/wifi_if_24G/n_ssid",ssidNum); | |
for(;j<ssidNum;j++){ | |
$(this).find("ssid"+j).each(function(){ | |
wifiDetailedInfoMap.put("RGW/wireless/AP"+ i +"/wifi_if_24G/ssid"+ j +"/hidden",$(this).find("hidden").text()); | |
wifiDetailedInfoMap.put("RGW/wireless/AP"+ i +"/wifi_if_24G/ssid"+ j +"/isolate",$(this).find("isolate").text()); | |
wifiDetailedInfoMap.put("RGW/wireless/AP"+ i +"/wifi_if_24G/ssid"+ j +"/ssid",$(this).find("ssid").text()); | |
wifiDetailedInfoMap.put("RGW/wireless/AP"+ i +"/wifi_if_24G/ssid"+ j +"/encryption",$(this).find("encryption").text()); | |
if (j == 0) { | |
var encryptionMap = ParseEncryption($(this).find("encryption").text()); | |
g24gAuthType = encryptionMap.get("authType"); | |
g24gEncryAlg = encryptionMap.get("ciphers"); | |
} | |
if ("none" != $(this).find("encryption").text()) { | |
if ($(this).find("encryption").text().indexOf("psk") >= 0){ | |
wifiDetailedInfoMap.put("RGW/wireless/AP"+ i +"/wifi_if_24G/ssid"+ j +"/wpa_group_rekey",$(this).find("wpa_group_rekey").text()); | |
if (j == 0) | |
g24gRekey = $(this).find("wpa_group_rekey").text(); | |
} | |
//In WEP mode, this can be an integer specifying which key index to use (key1, key2, key3, or key4.) | |
if("wep+shared" == $(this).find("encryption").text() | |
|| "wep" == $(this).find("encryption").text()) { | |
var WepKeyTag = "key" + $(this).find("key").text(); | |
wifiDetailedInfoMap.put("RGW/wireless/AP"+ i +"/wifi_if_24G/ssid"+ j +"/key",$(this).find(WepKeyTag).text()); | |
if (j == 0) | |
g24gPassword = $(this).find(WepKeyTag).text(); | |
} else { | |
wifiDetailedInfoMap.put("RGW/wireless/AP"+ i +"/wifi_if_24G/ssid"+ j +"/key",$(this).find("key").text()); | |
if (j == 0) | |
g24gPassword = $(this).find("key").text(); | |
} | |
} | |
}); | |
} | |
$("#sel24GSSIDList").empty(); | |
if($("#sel24GSSIDList option").size()!=ssidNum){ | |
idx = 0; | |
for ( ; idx < ssidNum; idx++ ){ | |
var opt_ap = document.createElement("option"); | |
document.getElementById("sel24GSSIDList").options.add(opt_ap); | |
opt_ap.id = "opt24GSSID"+idx; | |
opt_ap.text = wifiDetailedInfoMap.get("RGW/wireless/AP"+ i +"/wifi_if_24G/ssid"+ idx +"/ssid") ; | |
opt_ap.value = idx; | |
} | |
$("#sel24GSSIDList").val("0"); | |
gCurrentssidItem = 0; | |
} | |
}); | |
/*24G info end*/ | |
/*5G info start*/ | |
$(this).find("wifi_if_5G").each(function(){ | |
wifiDetailedInfoMap.put("RGW/wireless/AP"+i+"/wifi_if_5G/switch",$(this).find("switch").text()); | |
wifiDetailedInfoMap.put("RGW/wireless/AP"+i+"/wifi_if_5G/net_mode",$(this).find("net_mode").text()); | |
wifiDetailedInfoMap.put("RGW/wireless/AP"+i+"/wifi_if_5G/channel",$(this).find("channel").text()); | |
wifiDetailedInfoMap.put("RGW/wireless/AP"+i+"/wifi_if_5G/bandwidth",$(this).find("bandwidth").text()); | |
wifiDetailedInfoMap.put("RGW/wireless/AP"+i+"/wifi_if_5G/unsupport_multi_ssid",$(this).find("unsupport_multi_ssid").text()); | |
var j=0; | |
ssidNum = $(this).find("n_ssid").text(); | |
wifiDetailedInfoMap.put("RGW/wireless/AP"+i+"/wifi_if_5G/n_ssid",ssidNum); | |
for(;j<ssidNum;j++){ | |
$(this).find("ssid"+j).each(function(){ | |
wifiDetailedInfoMap.put("RGW/wireless/AP"+ i +"/wifi_if_5G/ssid"+ j +"/hidden",$(this).find("hidden").text()); | |
wifiDetailedInfoMap.put("RGW/wireless/AP"+ i +"/wifi_if_5G/ssid"+ j +"/isolate",$(this).find("isolate").text()); | |
wifiDetailedInfoMap.put("RGW/wireless/AP"+ i +"/wifi_if_5G/ssid"+ j +"/ssid",$(this).find("ssid").text()); | |
wifiDetailedInfoMap.put("RGW/wireless/AP"+ i +"/wifi_if_5G/ssid"+ j +"/encryption",$(this).find("encryption").text()); | |
if ("none" != $(this).find("encryption").text()) { | |
if ($(this).find("encryption").text().indexOf("psk") >= 0) { | |
wifiDetailedInfoMap.put("RGW/wireless/AP"+ i +"/wifi_if_5G/ssid"+ j +"/wpa_group_rekey",$(this).find("wpa_group_rekey").text()); | |
} | |
//In WEP mode, this can be an integer specifying which key index to use (key1, key2, key3, or key4.) | |
if("wep+shared" == $(this).find("encryption").text() | |
|| "wep" == $(this).find("encryption").text()) { | |
var WepKeyTag = "key" + $(this).find("key").text(); | |
wifiDetailedInfoMap.put("RGW/wireless/AP"+ i +"/wifi_if_5G/ssid"+ j +"/key",$(this).find(WepKeyTag).text()); | |
} else { | |
wifiDetailedInfoMap.put("RGW/wireless/AP"+ i +"/wifi_if_5G/ssid"+ j +"/key",$(this).find("key").text()); | |
} | |
} | |
}); | |
} | |
$("#sel5GSSIDList").empty(); | |
if($("#sel5GSSIDList option").size()!=ssidNum){ | |
idx =0; | |
for ( ; idx < ssidNum; idx++ ){ | |
var opt_ap = document.createElement("option"); | |
document.getElementById("sel5GSSIDList").options.add(opt_ap); | |
opt_ap.id = "opt5GSSID"+idx; | |
opt_ap.text = wifiDetailedInfoMap.get("RGW/wireless/AP"+ i +"/wifi_if_5G/ssid"+ idx +"/ssid") ; | |
opt_ap.value = idx; | |
} | |
$("#sel5GSSIDList").val("0"); | |
gCurrentssidItem = 0; | |
} | |
}); | |
/*5G info end*/ | |
}); | |
} | |
return true; | |
} | |
//由认证类型和加密方式获取 encryption tag | |
function GetEncryptionTag(authType,ciphers) { | |
switch(authType) { | |
case "WPA-PSK": | |
if("AES-CCMP" == ciphers) return "psk+ccmp"; | |
else if("TKIP" == ciphers) return "psk"; | |
else if("TKIP/AES-CCMP" == ciphers) return "psk+tkip+ccmp"; | |
break; | |
case "WPA2-PSK": | |
if("AES-CCMP" == ciphers) return "psk2"; | |
else if("TKIP/AES-CCMP" == ciphers) return "psk2+tkip+ccmp"; | |
break; | |
case "Mixed": | |
if("AES-CCMP/TKIP" == ciphers) return "psk-mixed"; | |
else if("AES-CCMP" == ciphers) return "psk-mixed+aes"; | |
break; | |
case "WEP": | |
if("Open" == ciphers) return "wep"; | |
else if("Shared-key" == ciphers) return "wep+shared"; | |
break; | |
case "none": | |
return "none"; | |
break; | |
case "WPA3-SAE": | |
return "sae"; | |
case "WPA2-WPA3": | |
return "sae-mixed"; | |
default: | |
return ""; | |
} | |
} | |
//解析 encryption tag 得到认证类型和加密方式 | |
function ParseEncryption(encryptInfo) { | |
var encryptInfoMap = new Map(); | |
switch(encryptInfo) { | |
//WPA-PSK | |
case "psk+ccmp": | |
case "psk+aes": | |
encryptInfoMap.put("authType","WPA-PSK"); | |
encryptInfoMap.put("ciphers","AES-CCMP"); | |
break; | |
case "psk": | |
case "psk+tkip": | |
encryptInfoMap.put("authType","WPA-PSK"); | |
encryptInfoMap.put("ciphers","TKIP"); | |
break; | |
case "psk+tkip+ccmp": | |
case "psk+tkip+aes": | |
encryptInfoMap.put("authType","WPA-PSK"); | |
encryptInfoMap.put("ciphers","TKIP/AES-CCMP"); | |
break; | |
//WPA2-PSK | |
case "psk2": | |
case "psk2+ccmp": | |
case "psk2+aes": | |
encryptInfoMap.put("authType","WPA2-PSK"); | |
encryptInfoMap.put("ciphers","AES-CCMP"); | |
break; | |
case "psk2+tkip+ccmp": | |
case "psk2+tkip+aes": | |
encryptInfoMap.put("authType","WPA2-PSK"); | |
encryptInfoMap.put("ciphers","TKIP/AES-CCMP"); | |
break; | |
//WPA/WPA2-MIXED | |
case "psk-mixed": | |
case "psk-mixed+tkip+aes": | |
case "psk-mixed+tkip+ccmp": | |
encryptInfoMap.put("authType","Mixed"); | |
encryptInfoMap.put("ciphers","AES-CCMP/TKIP"); | |
break; | |
case "psk-mixed+aes": | |
case "psk-mixed+ccmp": | |
encryptInfoMap.put("authType","Mixed"); | |
encryptInfoMap.put("ciphers","AES-CCMP"); | |
break; | |
//MEP | |
case "wep": | |
encryptInfoMap.put("authType","WEP"); | |
encryptInfoMap.put("ciphers","Open"); | |
break; | |
case "wep+shared": | |
encryptInfoMap.put("authType","WEP"); | |
encryptInfoMap.put("ciphers","Shared-key"); | |
break; | |
case "none": | |
encryptInfoMap.put("authType","none"); | |
encryptInfoMap.put("ciphers",""); | |
break; | |
//WPA3 | |
case "sae": | |
encryptInfoMap.put("authType","WPA3-SAE"); | |
encryptInfoMap.put("ciphers","AES-CCMP"); | |
break; | |
//WPA2/WPA3-MIXED | |
case "sae-mixed": | |
encryptInfoMap.put("authType","WPA2-WPA3"); | |
encryptInfoMap.put("ciphers","AES-CCMP"); | |
break; | |
default: | |
encryptInfoMap.put("authType",""); | |
encryptInfoMap.put("ciphers",""); | |
break; | |
} | |
return encryptInfoMap; | |
} | |
return this; | |
} | |
})(jQuery); | |
function ShowWPSCfgDlg() { | |
ShowDlg("MBAddWPSClient", 300, 200); | |
localizeWPSDialog(); | |
$("#lWPSStatus").text(""); | |
if(IsWpsMatch) { | |
DisabledWPSBtn(); | |
} | |
} | |
function DisabledWPSBtn() { | |
$("#btnRegister").attr("disabled", true); | |
$("#btnPush").attr("disabled", true); | |
$("#txtRouterPinMB").attr("disabled", true); | |
$("#divcancel_session").show(); | |
} | |
function EnabledWPSBtn() { | |
$("#btnRegister").attr("disabled", false); | |
$("#btnPush").attr("disabled", false); | |
$("#txtRouterPinMB").attr("disabled", false); | |
$("#divcancel_session").hide(); | |
} | |
function localizeWPSDialog() { | |
$("#h1AddWPSClient").text(jQuery.i18n.prop("h1AddWPSClient")); | |
$("#lWPStext").text(jQuery.i18n.prop("lWPStext")); | |
$("#lCancelWpsSession").text(jQuery.i18n.prop("lCancelWpsSession")); | |
$("#spanWPSPushButton").text(jQuery.i18n.prop("spanWPSPushButton")); | |
$("#spanEnterPin").text(jQuery.i18n.prop("spanEnterPin")); | |
$("#btnPush").text(jQuery.i18n.prop("btnPush")); | |
$("#btnRegister").text(jQuery.i18n.prop("btnRegister")); | |
$("#btnClose").text(jQuery.i18n.prop("btnClose")); | |
} | |
function WPSClientClose() { | |
hm(); | |
} | |
function QueryWpsStatus() { | |
var retXml = PostXml("wireless","wifi_call_wps_status"); | |
var WPSStatus; | |
WPSStatus = $(retXml).find("wps_status").text(); | |
if (WPSStatus == 0) { | |
callCount++; | |
if ((callCount < 10) && IsWpsMatch) { | |
$("#lWPSStatus").text(jQuery.i18n.prop("lWpsMatchWait")); | |
showAlert("lWpsMatchWait"); | |
setTimeout(QueryWpsStatus, 3000); | |
} else { | |
$("#lWPSStatus").text(jQuery.i18n.prop("lWpsMatchFailed")); | |
showAlert("lWpsMatchFailed"); | |
callCount = 0; | |
EnabledWPSBtn(); | |
IsWpsMatch = false; | |
} | |
} else if ((WPSStatus == 1 ||"" == WPSStatus) && IsWpsMatch) { | |
$("#lWPSStatus").text(jQuery.i18n.prop("lWpsMatchPro")); | |
setTimeout(QueryWpsStatus, 3000); | |
} else if (WPSStatus == 2) { | |
$("#lWPSStatus").text(jQuery.i18n.prop("lWpsMatchSuccess")); | |
showAlert("lWpsMatchSuccess"); | |
callCount = 0; | |
EnabledWPSBtn(); | |
IsWpsMatch = false; | |
} else if (WPSStatus == 3) { | |
$("#lWPSStatus").text(jQuery.i18n.prop("lWpsMatchFailed")); | |
showAlert("lWpsMatchFailed"); | |
callCount = 0; | |
EnabledWPSBtn(); | |
IsWpsMatch = false; | |
} | |
} | |
function btnPushClicked() { | |
var mapData = new Map(); | |
mapData.put("RGW/wps/wifi_iface_index", gCurrentAPItem); | |
if (gWifiBSEnable == "1") | |
mapData.put("RGW/wps/wifi_5g_prefer", 1); | |
var retXml = PostXml("wireless","wifi_call_wps_pbc", mapData); | |
if("OK" != $(retXml).find("wps_call_pbc_result").text()) { | |
showAlert("lt_WpsPushButtonFail"); | |
return; | |
} | |
IsWpsMatch = true; | |
setTimeout(QueryWpsStatus, 3000); | |
} | |
function btnRegisterClicked() { | |
var mapData = new Map(); | |
var client_pin = $("#txtRouterPinMB").val(); | |
if("-" == client_pin.substr(4,1)) { | |
client = client_pin.replace("-",""); | |
} | |
if((client_pin.length == 8 || client_pin.length == 4) && IsNumber(client_pin)) { | |
mapData.put("RGW/wps/wps_enable", 1); | |
mapData.put("RGW/wps/wps_pin", client_pin); | |
mapData.put("RGW/wps/wifi_iface_index", gCurrentAPItem); | |
if (gWifiBSEnable == "1") | |
mapData.put("RGW/wps/wifi_5g_prefer", 1); | |
var retXml = PostXml("wireless","wifi_call_wps_pin", mapData); | |
if("OK" != $(retXml).find("wps_call_pin_result").text()) { | |
showAlert("lt_WpsPinFail"); | |
return; | |
} | |
IsWpsMatch = true; | |
setTimeout(QueryWpsStatus, 3000); | |
} | |
else { | |
$("#lWPSError").show(); | |
$("#lWPSError").text(jQuery.i18n.prop("lWPSPinError")); | |
} | |
} | |
function RouterPinMBChange() { | |
$("#lWPSError").hide(); | |
} | |
function AutoOffWifiTimeoutChange() { | |
$("#wifiSetErrorLogs").hide().text(""); | |
} | |
function cancelSessionClicked() { | |
var retXml = PostXml("wireless","wifi_call_wps_cancle"); | |
if("OK" != $(retXml).find("wps_call_cancel_result").text()) { | |
showAlert("lt_WpsCancelFail"); | |
return; | |
} | |
IsWpsMatch = false; | |
} | |
function lengthInUtf8Bytes(str) { | |
var m = encodeURIComponent(str).match(/%[89ABab]/g); | |
return str.length + (m ? m.length : 0); | |
} | |
function checkSsidLength(maxLength) { | |
var inputLen = lengthInUtf8Bytes($("#txtWifiSSID").val()); | |
if (inputLen > maxLength) | |
{ | |
showAlert("lt_ssidLenError"); | |
return false; | |
} | |
else | |
return true; | |
} | |
function checkPassWDLength() { | |
var strPasswd = $("#txtPasswd").val(); | |
var authType = $("#selWifiAuthType").val(); | |
var ret = true; | |
var strErrMsg; | |
var regex = /\s/; | |
if (regex.test(strPasswd)) { | |
strErrMsg = jQuery.i18n.prop('lt_wifiset_PasswdSpaceError'); | |
ret = false; | |
} | |
if("WEP" == authType) { | |
switch($("#selWepKeyFormat").val()) { | |
case "5": | |
if(!IsASCIIStr(strPasswd) || 5 != strPasswd.length) { | |
strErrMsg = jQuery.i18n.prop('lt_wifiset_WepPasswd5AsciiError'); | |
ret = false; | |
} | |
break; | |
case "13": | |
if(!IsASCIIStr(strPasswd) || 13 != strPasswd.length) { | |
strErrMsg = jQuery.i18n.prop('lt_wifiset_WepPasswd13AsciiError'); | |
ret = false; | |
} | |
break; | |
case "10": | |
if(!IsHexStr(strPasswd) || 10 != strPasswd.length) { | |
strErrMsg = jQuery.i18n.prop('lt_wifiset_WepPasswd10HexError'); | |
ret = false; | |
} | |
break; | |
case "26": | |
if(!IsHexStr(strPasswd) || 26 != strPasswd.length) { | |
strErrMsg = jQuery.i18n.prop('lt_wifiset_WepPasswd26HexError'); | |
ret = false; | |
} | |
break; | |
} | |
} else if("WPA2-PSK" == authType || "Mixed" == authType || "WPA3-SAE" == authType || "WPA2-WPA3" == authType || "WPA-PSK" == authType) { | |
if(IsChineseChar(strPasswd) || strPasswd.length > 64 || strPasswd.length < 8) { | |
strErrMsg = jQuery.i18n.prop('lt_wifiset_WPA2PSKPasswdError'); | |
ret = false; | |
} | |
} | |
if(!ret) { | |
$("#wifiSetErrorLogs").show().text(strErrMsg); | |
ret = false; | |
} | |
else | |
{ | |
$("#wifiSetErrorLogs").hide().text(""); | |
if ($("#selRfBand").val() == 1) | |
g24gPassword= strPasswd; | |
} | |
return ret; | |
} |