mirror of
https://github.com/pvvx/RTL00_WEB.git
synced 2024-12-25 07:25:17 +00:00
update
This commit is contained in:
parent
58093484e1
commit
163c8c1876
17 changed files with 336 additions and 409 deletions
|
@ -20,11 +20,14 @@
|
|||
</tr>
|
||||
</form>
|
||||
</table>
|
||||
<p class="center">
|
||||
Reset event = ~sys_res_event~ (1-power, 2-reset, 3-software, 4-wdt)<br>
|
||||
</p>
|
||||
</div>
|
||||
~inc:footer.inc~
|
||||
<script type="text/javascript">
|
||||
function DeepSleep(){
|
||||
var dstim = parseInt(document.getElementById('ds_time').value,10);
|
||||
newAJAXCommand('/web.cgi?&sys_dsleep=0x' + dstim.toString(16), null, 0);
|
||||
}
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
||||
|
||||
|
|
|
@ -26,13 +26,14 @@
|
|||
<td class="label">BSSID:</td>
|
||||
<td><input name='wifi_st_bssid' maxlength='31' value='~wifi_st_bssid~' id='inputbsid'></td>
|
||||
<td class="label">AutoConnect:</td>
|
||||
<td><input type='hidden' name='wifi_st_aucn' value='0'>
|
||||
<input type='checkbox' name='wifi_st_aucn' value='1'></td>
|
||||
<td><input type='hidden' id='wifi_mode' name='wifi_mode' value='3'>
|
||||
<input type='hidden' id='wifi_st_auth' name='wifi_st_auth' value='6'>
|
||||
<input type='checkbox' id='wifi_st_aucn' name='wifi_st_aucn' value='1' onChange="newMode(this);"></td>
|
||||
</tr>
|
||||
</table>
|
||||
<p class="center">
|
||||
<input type='submit' value='Set Config' class="button">
|
||||
<input type='hidden' name='wifi_newcfg' value='0xfff'>
|
||||
<input type='hidden' name='wifi_newcfg' value='0x1a'>
|
||||
</p>
|
||||
</form>
|
||||
<div id="connection"></div>
|
||||
|
@ -43,22 +44,45 @@
|
|||
<script src="/scripts.js"></script>
|
||||
<script type="text/javascript">
|
||||
var AUTH = {
|
||||
0: "OPEN",
|
||||
1: "WEP",
|
||||
2: "WPA-PSK",
|
||||
3: "WPA2-PSK",
|
||||
4: "WPA-WPA2-PSK",
|
||||
5: "MAX"};
|
||||
var cfg = { wifi_st_aucn: "~wifi_st_aucn~" };
|
||||
0:"OPEN",
|
||||
1:"WEP PSK",
|
||||
2:"WEP Shared",
|
||||
3:"WPA TKIP",
|
||||
4:"WPA AES",
|
||||
5:"WPA2 TKIP",
|
||||
6:"WPA2 AES",
|
||||
7:"WPA2 Mixed",
|
||||
8:"WPA2/WPA AES",
|
||||
9:"UNKNOWN"};
|
||||
var WPST = {
|
||||
0:"DEFAULT",
|
||||
1:"USER",
|
||||
2:"MACHINE",
|
||||
3:"REKEY",
|
||||
4:"PUSHBUTTON",
|
||||
5:"REGISTRAR",
|
||||
6:"NONE"};
|
||||
var BSST = {
|
||||
0:"INFRA",
|
||||
1:"ADHOC",
|
||||
2:"ANY",
|
||||
3:"UNKNOWN"};
|
||||
var cfg = {
|
||||
wifi_st_aucn: "~wifi_mode~" & 1,
|
||||
wifi_mode: "~wifi_mode~" };
|
||||
setFormValues(document.forms[0], cfg);
|
||||
var startTime = new Date();
|
||||
newAJAXCommand('/web.cgi?wifi_scan=1');
|
||||
setTimeout("newAJAXCommand('scan.xml', updateScan)", 2500);
|
||||
setTimeout("newAJAXCommand('scan.xml', updateScan)", 1600);
|
||||
function newMode(Obj) {
|
||||
if (Obj.checked) $("wifi_mode").value = ~wifi_mode~ | 1;
|
||||
else $("wifi_mode").value = ~wifi_mode~;
|
||||
}
|
||||
function updateScan(xmlData) {
|
||||
if(!xmlData) return;
|
||||
var total = getXMLValue(xmlData, 'total');
|
||||
if (total==0) {
|
||||
if((new Date()-startTime)>10000) {
|
||||
if((new Date()-startTime)>7000) {
|
||||
startTime = new Date();
|
||||
$('scanResult').innerHTML="Scan failed. Try again.";
|
||||
newAJAXCommand('/web.cgi?wifi_scan=1');
|
||||
|
@ -75,19 +99,21 @@ function updateScan(xmlData) {
|
|||
var ssid=getXMLValue(ap, 'ss');
|
||||
var rs=getXMLValue(ap, 'rs');
|
||||
var hd=getXMLValue(ap, 'hd');
|
||||
var ws=getXMLValue(ap, 'ws');
|
||||
r=document.all.aps.insertRow();
|
||||
c=r.insertCell(0);c.innerHTML="<a href=# >"+ssid+"</a>";c.ssid=ssid;c.bsid=bsid;c.onclick=onApClick;
|
||||
c=r.insertCell(1);c.innerHTML="<a href=# >"+bsid+"</a>";c.ssid=ssid;c.bsid=bsid;c.onclick=onApClick;c.ondblclick=onInfo;c.title='DoubleClick = MF info';
|
||||
c=r.insertCell(0);c.innerHTML="<a href=# >"+ssid+"</a>";c.ssid=ssid;c.bsid=bsid;c.au=au;c.onclick=onApClick;
|
||||
c=r.insertCell(1);c.innerHTML="<a href=# >"+bsid+"</a>";c.ssid=ssid;c.bsid=bsid;c.au=au;c.onclick=onApClick;c.ondblclick=onInfo;c.title='DoubleClick = MF info';
|
||||
(r.insertCell(2)).innerHTML=AUTH[au];
|
||||
(r.insertCell(3)).innerText=ch;
|
||||
(r.insertCell(4)).innerText=rs;
|
||||
(r.insertCell(5)).innerText=hd;
|
||||
(r.insertCell(5)).innerHTML=BSST[hd];
|
||||
}
|
||||
$('stform').style.display='';
|
||||
}
|
||||
function onApClick() {
|
||||
$('inputssid').value=this.ssid;
|
||||
$('inputbsid').value=this.bsid;
|
||||
$('wifi_st_auth').value=this.au;
|
||||
}
|
||||
function onInfo() {
|
||||
s = this.bsid;
|
||||
|
|
|
@ -1 +1 @@
|
|||
<?xml version="1.0" encoding="windows-1251"?><response>~wifi_scan~</response>
|
||||
<?xml version="1.0" encoding="windows-1251"?><response>~xml_scan~</response>
|
||||
|
|
|
@ -23,6 +23,13 @@
|
|||
<td class="label">WEB close timeout:</td>
|
||||
<td><input title='1...65535 sec, 0 - not limited' name='cfg_web_twcls' maxlength='5' value='~cfg_web_twcls~'></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="label">PowerSave Enable:</td>
|
||||
<td>
|
||||
<input type="hidden" name='cfg_sleep' value='0'>
|
||||
<input title='If On - LogUART input disable' type='checkbox' name='cfg_sleep' value='1'>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="label">LogUART Printf() enable:</td>
|
||||
<td>
|
||||
|
@ -76,6 +83,7 @@
|
|||
~inc:footer.inc~
|
||||
<script type="text/javascript">
|
||||
var cfg = {
|
||||
cfg_sleep:"~cfg_sleep~",
|
||||
cfg_debug:"~cfg_debug~",
|
||||
cfg_web_twd:"~cfg_web_twd~",
|
||||
cfg_pinclr:"~cfg_pinclr~",
|
||||
|
|
|
@ -8,18 +8,32 @@
|
|||
~inc:menu.inc~
|
||||
<div class="content">
|
||||
<form method='post' action='/timeout.htm'>
|
||||
<input type='hidden' name='wifi_rdcfg' value='0xffffffff'>
|
||||
<table class="form">
|
||||
<tr>
|
||||
<td colspan="2"><h2 class="title">WiFi SoftAP</h2></td>
|
||||
<td colspan="2"><h2 class="title">WiFi Station</h2></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="label">WiFi Mode:</td>
|
||||
<td class="label">Mode:</td>
|
||||
<td><select name='wifi_mode'>
|
||||
<option value='1'>STATION_MODE</option>
|
||||
<option value='2'>SOFTAP_MODE</option>
|
||||
<option value='3'>STATIONAP_MODE</option>
|
||||
<option value='1'>Station</option>
|
||||
<option value='2'>SoftAP</option>
|
||||
<option value='3'>Station+SoftAP</option>
|
||||
</select></td>
|
||||
<td class="label">Status:</td>
|
||||
<td><select name='wifi_st_status'>
|
||||
<option value='0'>Off</option>
|
||||
<option value='1'>Start</option>
|
||||
<option value='2'>ReConnect</option>
|
||||
<option value='3'>Connected</option>
|
||||
</select></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="label">IEEE PHY:</td>
|
||||
<td><select name='wifi_phy'>
|
||||
<option value='1'>802.11b</option>
|
||||
<option value='3'>802.11g</option>
|
||||
<option value='11'>802.11n</option>
|
||||
</select></td>
|
||||
<td class="label">SSID:</td>
|
||||
<td><input name='wifi_st_ssid' maxlength='31' value='~wifi_st_ssid~'></td>
|
||||
|
@ -27,8 +41,8 @@
|
|||
<tr>
|
||||
<td class="label">AP SSID:</td>
|
||||
<td><input name='wifi_ap_ssid' maxlength='31' value='~wifi_ap_ssid~'></td>
|
||||
<td class="label">Password:</td>
|
||||
<td><input name='wifi_st_psw' maxlength='63' value='~wifi_st_psw~'></td>
|
||||
<td class="label">BSSID:</td>
|
||||
<td><input name='wifi_st_bssid' maxlength='17' value='~wifi_st_bssid~'></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="label">Hidden SSID:</td>
|
||||
|
@ -36,17 +50,17 @@
|
|||
<input type='hidden' name='wifi_ap_hssid' value='0'>
|
||||
<input type='checkbox' name='wifi_ap_hssid' value='1'>
|
||||
</td>
|
||||
<td class="label">BSSID:</td>
|
||||
<td><input name='wifi_st_bssid' maxlength='17' value='~wifi_st_bssid~'></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="label">AP Password:</td>
|
||||
<td><input name='wifi_ap_psw' maxlength='63' value='~wifi_ap_psw~'></td>
|
||||
<td class="label">Use BSSID:</td>
|
||||
<td>
|
||||
<input type='hidden' name='wifi_st_sbss' value='0'>
|
||||
<input type='checkbox' name='wifi_st_sbss' value='1'>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="label">AP Password:</td>
|
||||
<td><input name='wifi_ap_psw' maxlength='63' value='~wifi_ap_psw~'></td>
|
||||
<td class="label">Password:</td>
|
||||
<td><input name='wifi_st_psw' maxlength='63' value='~wifi_st_psw~'></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="label">Channel:</td>
|
||||
|
@ -67,30 +81,20 @@
|
|||
<option value='9'>UNKNOWN</option>
|
||||
</select></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="label">IEEE PHY:</td>
|
||||
<td><select name='wifi_phy'>
|
||||
<option value='1'>802.11b</option>
|
||||
<option value='3'>802.11g</option>
|
||||
<option value='11'>802.11n</option>
|
||||
</select></td>
|
||||
<td class="label">IP:</td>
|
||||
<td><input type='text' title='Static ip, if dhcp: off' name='wifi_st_ip' maxlength='31' value='~wifi_st_ip~'></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="label">Auth Mode:</td>
|
||||
<td><select name='wifi_ap_auth'>
|
||||
<option value='0'>OPEN</option>
|
||||
<option value='1'>WPA_WPA2_PSK</option>
|
||||
</select></td>
|
||||
<td class="label">Subnet Mask:</td>
|
||||
<td><input name='wifi_st_msk' maxlength='31' value='~wifi_st_msk~'></td>
|
||||
<td class="label">Gateway:</td>
|
||||
<td><input name='wifi_st_gw' maxlength='31' value='~wifi_st_gw~'></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="label">IP:</td>
|
||||
<td><input name='wifi_ap_ip' maxlength='31' value='~wifi_ap_ip~'></td>
|
||||
<td class="label">Gateway:</td>
|
||||
<td><input name='wifi_st_gw' maxlength='31' value='~wifi_st_gw~'></td>
|
||||
<td class="label">Subnet Mask:</td>
|
||||
<td><input name='wifi_st_msk' maxlength='31' value='~wifi_st_msk~'></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="label">Subnet Mask:</td>
|
||||
|
@ -140,17 +144,25 @@
|
|||
<option value='3'>25%</option>
|
||||
<option value='4'>12.5%</option>
|
||||
</select></td>
|
||||
<td class="label">Sleep Mode:</td>
|
||||
<td><select name='wifi_sleep'>
|
||||
<option value='0'>Off</option>
|
||||
<option value='1'>On</option>
|
||||
</select></td>
|
||||
<td class="label">IP:</td>
|
||||
<td><input type='text' title='Static ip, if dhcp: off' name='wifi_st_ip' maxlength='31' value='~wifi_st_ip~'></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="label">Beacon (ms):</td>
|
||||
<td><input title='100...60000' name='wifi_ap_bint' maxlength='5' value='~wifi_ap_bint~'></td>
|
||||
<td class="label">PowerSave:</td>
|
||||
<td><select name='wifi_st_sleep'>
|
||||
<option value='0'>Sleep Off</option>
|
||||
<option value='1'>IPS</option>
|
||||
<option value='2'>LPS</option>
|
||||
<option value='3'>IPS/LPS</option>
|
||||
</select></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="label">Max connections:</td>
|
||||
<td><input title='1..3, Default: 3.' name='wifi_ap_mcns' maxlength='1' value='~wifi_ap_mcns~'></td>
|
||||
<td class="label">Beacon (ms):</td>
|
||||
<td><input title='100...60000' name='wifi_ap_bint' maxlength='5' value='~wifi_ap_bint~'></td>
|
||||
<td class="label">LPS DTIM:</td>
|
||||
<td><input title='0 - Sleep Off, 1..255 - Sleep On. 1..255 - DTIM.' name='wifi_st_dtim' maxlength='5' value='~wifi_st_dtim~'></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="label">AP Host Name:</td>
|
||||
|
@ -172,11 +184,12 @@ for (var i=1; i < 14; i++) {
|
|||
chlnum.options[i] = new Option(((i<10)?'0':'')+i,i);
|
||||
}
|
||||
var cfg = {
|
||||
wifi_mode:"~wifi_cmode~",
|
||||
wifi_st_status: "~wifi_st_status~",
|
||||
wifi_ap_chl:"~wifi_ap_chl~",
|
||||
wifi_ap_auth:"~wifi_ap_auth~",
|
||||
wifi_phy:"~wifi_bgn~",
|
||||
wifi_mode:"~wifi_mode~",
|
||||
wifi_sleep:"~wifi_sleep~",
|
||||
wifi_st_sleep:"~wifi_st_sleep~",
|
||||
wifi_st_auth:"~wifi_st_auth~",
|
||||
wifi_st_sbss:"~wifi_st_sbss~",
|
||||
wifi_ap_hssid:"~wifi_ap_hssid~",
|
||||
|
|
|
@ -167,7 +167,7 @@ flashimage2p:
|
|||
flashwebfs:
|
||||
@$(OPENOCD) -f interface/$(FLASHER).cfg -c "transport select swd" -f $(FLASHER_PATH)rtl8710.ocd -c "init" -c "adapter_khz $(FLASHER_SPEED)" -c "reset halt" \
|
||||
-c "rtl8710_flash_auto_erase 1" -c "rtl8710_flash_auto_verify 1" \
|
||||
-c "rtl8710_flash_write $(BIN_DIR)/webpages.espfs 0xd0000" \
|
||||
-c "rtl8710_flash_write $(BIN_DIR)/WEBFiles.bin 0xd0000" \
|
||||
-c "rtl8710_reboot" -c "reset run" -c shutdown
|
||||
|
||||
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
define call1
|
||||
set $ImageSize = 0xF120
|
||||
set $ImageSize = 0xF6E0
|
||||
set $ImageAddr = 0x0D0000
|
||||
end
|
||||
define call2
|
||||
|
|
|
@ -67,8 +67,8 @@
|
|||
//on/off relative commands in log service
|
||||
#define CONFIG_SSL_CLIENT 0
|
||||
#define CONFIG_WEBSERVER 0
|
||||
#define CONFIG_OTA_UPDATE 0
|
||||
#define CONFIG_BSD_TCP 0 //NOTE : Enable CONFIG_BSD_TCP will increase about 11KB code size
|
||||
#define CONFIG_OTA_UPDATE 1
|
||||
#define CONFIG_BSD_TCP 1 //NOTE : Enable CONFIG_BSD_TCP will increase about 11KB code size
|
||||
#define CONFIG_AIRKISS 0 //on or off tencent airkiss
|
||||
#define CONFIG_UART_SOCKET 0 // Set: CONFIG_UART_EN, CONFIG_UART_SOCKET
|
||||
#define CONFIG_UART_XMODEM 0 //support uart xmodem upgrade or not
|
||||
|
@ -156,7 +156,7 @@
|
|||
//#define CONFIG_EXAMPLE_UART_ADAPTER 1
|
||||
//#define CONFIG_EXAMPLE_MDNS
|
||||
#define USE_FLASH_EEP 1
|
||||
#define CONFIG_WLAN_CONNECT_CB 1
|
||||
#define CONFIG_WLAN_CONNECT_CB 0
|
||||
|
||||
//#define CONFIG_FATFS_EN 1 // FatFs & SD
|
||||
#ifdef CONFIG_FATFS_EN
|
||||
|
|
|
@ -10,7 +10,7 @@
|
|||
#define FEEP_ID_SYS_CFG 0x5359
|
||||
|
||||
struct sys_bits_config {
|
||||
uint16 hi_speed_enable : 1; //0 0x0000001 =1 Set CPU 160 MHz ...
|
||||
uint16 powersave_enable : 1; //0 0x0000001 =1 Включение режима экономии энергии (актуально в режиме ST), отключает LogUART
|
||||
uint16 pin_clear_cfg_enable : 1; //1 0x0000002 =1 Проверять ножку RX на сброс конфигурации WiFi
|
||||
uint16 debug_print_enable : 1; //2 0x0000004 =1 Вывод отладочной информации на GPIO2
|
||||
uint16 web_time_wait_delete : 1; //3 0x0000008 =1 Закрывать соединение и убивать pcb c TIME_WAIT
|
||||
|
@ -21,7 +21,7 @@ struct sys_bits_config {
|
|||
uint16 mdb_reopen : 1; //8 0x0000100 =1 открытие нового соединения modbus ведет к закрытию старого соединения (в режиме modbus = сервер)
|
||||
};
|
||||
|
||||
#define SYS_CFG_HI_SPEED 0x0000001 // Set CPU 160 MHz ...
|
||||
#define SYS_CFG_POWERSAVE 0x0000001 // Включение режима экономии энергии (актуально в режиме ST)
|
||||
#define SYS_CFG_PIN_CLR_ENA 0x0000002 // Проверять ножку RX на сброс конфигурации WiFi
|
||||
#define SYS_CFG_DEBUG_ENA 0x0000004 // Вывод отладочной информации на GPIO2
|
||||
#define SYS_CFG_TWPCB_DEL 0x0000008 // Закрывать соединение и убивать pcb c TIME_WAIT
|
||||
|
|
|
@ -1,33 +1,15 @@
|
|||
#ifndef _user_config_h_
|
||||
#define _user_config_h_
|
||||
|
||||
//#include "sdk/sdk_config.h"
|
||||
|
||||
#define SYS_VERSION "1.0.0"
|
||||
#define SDK_VERSION "3.5.3"
|
||||
|
||||
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
// Конфигурация для проекта MODBUS-RS-485
|
||||
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
|
||||
#define USE_WEB 80 // включить в трансялцию порт Web, если =0 - по умолчанию выключен
|
||||
#define WEBSOCKET_ENA 1 // включить WEBSOCKET
|
||||
#define USE_SNTP 1 // включить в трансялцию драйвер SNTP, если =0 - по умолчанию выключен, = 1 - по умолчанию включен.
|
||||
#define USE_NETBIOS 1 // включить в трансялцию драйвер NETBIOS, если =0 - по умолчанию выключен.
|
||||
|
||||
//#define USE_CPU_SPEED 166 // установить частоту CPU (по умолчанию 83)
|
||||
/*
|
||||
|
||||
|
||||
#define USE_RS485DRV // использовать RS-485 драйвер
|
||||
#define MDB_RS485_MASTER // Modbus RTU RS-485 master & slave
|
||||
#define USE_MODBUS 502 // включить в трансялцию Modbus TCP, если =0 - по умолчанию выключен
|
||||
#define MDB_ID_ESP 50 // номер устройства RTL на шине modbus
|
||||
|
||||
//#define USE_CAPTDNS 0 // включить в трансялцию DNS отвечающий на всё запросы клиента при соединении к AP модуля
|
||||
// указанием на данный WebHttp (http://aesp8266/), если =0 - по умолчанию выключен
|
||||
|
||||
*/
|
||||
#define WEB_DEBUG_FUNCTIONS 1 // =1 - включить в WEB отладочные функции, =0 отключить (остается только конфигурация WiFi)
|
||||
|
||||
#endif // _user_config_h_
|
||||
|
||||
|
|
|
@ -10,19 +10,19 @@
|
|||
|
||||
//=========================================
|
||||
//==== Wlan Config ========================
|
||||
#define DEF_WIFI_MODE RTW_MODE_STA // Стартовый режим WiFi: RTW_MODE_STA_AP, RTW_MODE_AP, RTW_MODE_STA, RTW_MODE_NONE
|
||||
#define DEF_WIFI_MODE RTW_MODE_STA_AP // Стартовый режим WiFi: RTW_MODE_STA_AP, RTW_MODE_AP, RTW_MODE_STA, RTW_MODE_NONE
|
||||
#define DEF_WIFI_AP_STATIONS 3 // Max number of STAs, should be 1..3, default is 3
|
||||
#define DEF_WIFI_COUNTRY RTW_COUNTRY_RU // Регион использования WiFi...
|
||||
#define DEF_WIFI_TX_PWR RTW_TX_PWR_PERCENTAGE_25 // RTW_TX_PWR_PERCENTAGE_75 // RTW_TX_PWR_PERCENTAGE_100
|
||||
#define DEF_WIFI_BGN RTW_NETWORK_BGN // rtw_network_mode_t
|
||||
#define DEF_WIFI_ST_SLEEP 0 // 0 - none, 1 - on
|
||||
#define DEF_WIFI_ADAPTIVITY RTW_ADAPTIVITY_NORMAL // RTW_ADAPTIVITY_DISABLE/RTW_ADAPTIVITY_NORMAL/RTW_ADAPTIVITY_CARRIER_SENSE
|
||||
|
||||
/* Опции загрузки конфигов по старту */
|
||||
//#define DEF_LOAD_CFG 0 // старт в назначенном конфигами режиме по умолчанию
|
||||
//#define DEF_LOAD_CFG BID_ALL_WIFI_CFG // старт в назначенном конфигами режиме по умолчанию, с загрузками последних конфигураций ST и AP
|
||||
//#define DEF_LOAD_CFG 0 // старт в назначенном режиме по умолчанию
|
||||
//#define DEF_LOAD_CFG BID_ALL_WIFI_CFG // старт в назначенном общем режиме по умолчанию, с загрузками последних конфигураций ST и AP
|
||||
#define DEF_LOAD_CFG (BID_ALL_WIFI_CFG | BID_WIFI_CFG) // старт в записанном режиме
|
||||
|
||||
/* Опции разрешения записи конфигов по упешному соединению или выполнению операции установок режимов WiFi без ошибок */
|
||||
/* Опции разрешения записи конфигов по упсешному соединению или выполнению операции установок режимов WiFi без ошибок */
|
||||
#define DEF_SAVE_CFG (BID_ALL_WIFI_CFG | BID_WIFI_CFG) // сохранение по успешному соединению/выполненю для всех конфигов:
|
||||
// (для ST или AP пишутся раздельно) с проверкой на изменения
|
||||
//==== Interface 0 - wlan0 = AP ===========
|
||||
|
@ -41,17 +41,20 @@
|
|||
#define DEF_AP_IP IP4ADDR(192,168,4,1)
|
||||
#define DEF_AP_MSK IP4ADDR(255,255,255,0)
|
||||
#define DEF_AP_GW IP4ADDR(192,168,4,1)
|
||||
#define DEF_AP_DHCP_START 2 // DHCP ip start xx.xx.xx.nn
|
||||
#define DEF_AP_DHCP_STOP 15 // DHCP ip stop xx.xx.xx.nn
|
||||
// if not defined DHCP_START && DHCP_STOP -> 2..255
|
||||
//#define DEF_AP_DHCP_START 2 // DHCP ip start xx.xx.xx.2
|
||||
//#define DEF_AP_DHCP_STOP 15 // DHCP ip stop xx.xx.xx.15
|
||||
//==== Interface 1 - wlan1 = STA ==========
|
||||
#define DEF_ST_SSID "HOMEAP" // Имя SSID AP (роутера) для присоединения по умолчанию (первый старт)
|
||||
#define DEF_ST_PASSWORD "0123456789" // Пароль AP (роутера) для присоединения по умолчанию (первый старт)
|
||||
#define DEF_ST_SECURITY RTW_SECURITY_WPA_WPA2_MIXED // Тип Security
|
||||
#define DEF_ST_BSSID { 0xff, 0xff, 0xff, 0xff, 0xff, 0xff } // If bssid set is not ff.ff.ff.ff.ff.ff,
|
||||
// station will connect to the router with both ssid[] and bssid[] matched.
|
||||
#define DEF_ST_USE_BSSID 0 // station will connect to the router with both ssid[] and bssid[] matched.
|
||||
#define DEF_ST_CHANNEL 1 // 1..14
|
||||
#define DEF_ST_AUTORECONNECT 1 // 0 - none, 1..254 - count, 255 - all
|
||||
#define DEF_ST_RECONNECT_PAUSE 1 // 5 sec
|
||||
#define DEF_ST_SLEEP 3 // 0 - Off, 1 - IPS, 2 - LPS, 3 - IPS/LPS mode
|
||||
#define DEF_ST_LPS_DTIM 0 // LPS DTIM
|
||||
#define DEF_ST_DHCP_MODE 1 // =0 dhcp off,
|
||||
// =1 - dhcp on, - динамический ip
|
||||
// =2 Static ip, - fixed ip
|
||||
|
|
|
@ -36,28 +36,28 @@ LOCAL void fATPN(int argc, char *argv[]){
|
|||
pswlen = strlen(wifi_st_cfg.password);
|
||||
strncpy(wifi_st_cfg.password, argv[2], NDIS_802_11_LENGTH_SSID);
|
||||
if(pswlen > 7) {
|
||||
wifi_st_cfg.security_type = RTW_SECURITY_WPA2_AES_PSK;
|
||||
wifi_st_cfg.security = IDX_SECURITY_WPA2_AES_PSK;
|
||||
}
|
||||
else if(!pswlen) {
|
||||
wifi_st_cfg.security_type = RTW_SECURITY_OPEN;
|
||||
wifi_st_cfg.security = IDX_SECURITY_OPEN;
|
||||
}
|
||||
else {
|
||||
printf("password len < 8!\n");
|
||||
wifi_st_cfg.security_type = RTW_SECURITY_OPEN;
|
||||
wifi_st_cfg.security = IDX_SECURITY_OPEN;
|
||||
}
|
||||
}
|
||||
else {
|
||||
// default
|
||||
wifi_st_cfg.password[0] = 0;
|
||||
wifi_st_cfg.security_type = RTW_SECURITY_OPEN;
|
||||
wifi_st_cfg.security = IDX_SECURITY_OPEN;
|
||||
}
|
||||
if(argc > 3) {
|
||||
if(pswlen > 7) {
|
||||
wifi_st_cfg.security_type = idx_to_rtw_security(atoi(argv[3]));
|
||||
wifi_st_cfg.security = atoi(argv[3]);
|
||||
}
|
||||
else {
|
||||
printf("password len < 8!\n");
|
||||
wifi_st_cfg.security_type = RTW_SECURITY_OPEN;
|
||||
wifi_st_cfg.security = IDX_SECURITY_OPEN;
|
||||
}
|
||||
}
|
||||
if(argc > 4) {
|
||||
|
@ -69,6 +69,9 @@ LOCAL void fATPN(int argc, char *argv[]){
|
|||
}
|
||||
else wifi_st_cfg.reconnect_pause = 5;
|
||||
show_wifi_st_cfg();
|
||||
#if CONFIG_WLAN_CONNECT_CB
|
||||
connect_close();
|
||||
#endif
|
||||
wifi_run(wifi_run_mode | RTW_MODE_STA);
|
||||
}
|
||||
}
|
||||
|
@ -86,22 +89,22 @@ LOCAL void fATPA(int argc, char *argv[]){
|
|||
strncpy(wifi_ap_cfg.password, argv[2], NDIS_802_11_LENGTH_SSID);
|
||||
int i = strlen(wifi_ap_cfg.password);
|
||||
if(i > 7) {
|
||||
wifi_ap_cfg.security_type = RTW_SECURITY_WPA2_AES_PSK;
|
||||
wifi_ap_cfg.security = 1; // IDX_SECURITY_WPA2_AES_PSK;
|
||||
}
|
||||
else if(i == 0) {
|
||||
wifi_ap_cfg.security_type = RTW_SECURITY_OPEN;
|
||||
wifi_ap_cfg.security = 0; // IDX_SECURITY_OPEN;
|
||||
}
|
||||
else {
|
||||
printf("password len < 8!\n");
|
||||
wifi_ap_cfg.security_type = RTW_SECURITY_OPEN;
|
||||
wifi_ap_cfg.security = 0; // IDX_SECURITY_OPEN;
|
||||
}
|
||||
}
|
||||
else {
|
||||
wifi_ap_cfg.password[0] = 0;
|
||||
wifi_ap_cfg.security_type = RTW_SECURITY_OPEN;
|
||||
wifi_ap_cfg.security = 0; // IDX_SECURITY_OPEN;
|
||||
}
|
||||
if(argc > 3) {
|
||||
wifi_ap_cfg.security_type = (argv[3][0] == '0')? RTW_SECURITY_OPEN : RTW_SECURITY_WPA2_AES_PSK;
|
||||
wifi_ap_cfg.security = (argv[3][0] == '0')? 0 : 1; //RTW_SECURITY_OPEN : RTW_SECURITY_WPA2_AES_PSK;
|
||||
}
|
||||
if(argc > 4) {
|
||||
wifi_ap_cfg.channel = atoi(argv[4]);
|
||||
|
@ -118,6 +121,9 @@ LOCAL void fATPA(int argc, char *argv[]){
|
|||
else wifi_ap_cfg.max_sta = 3;
|
||||
|
||||
show_wifi_ap_cfg();
|
||||
#if CONFIG_WLAN_CONNECT_CB
|
||||
connect_close();
|
||||
#endif
|
||||
wifi_run(wifi_run_mode | RTW_MODE_AP);
|
||||
}
|
||||
}
|
||||
|
@ -127,9 +133,13 @@ LOCAL void fATPA(int argc, char *argv[]){
|
|||
LOCAL void fATWR(int argc, char *argv[]){
|
||||
rtw_mode_t mode = RTW_MODE_NONE;
|
||||
if(argc > 1) mode = atoi(argv[1]);
|
||||
#if CONFIG_WLAN_CONNECT_CB
|
||||
connect_close();
|
||||
#endif
|
||||
wifi_run(mode);
|
||||
}
|
||||
|
||||
#if CONFIG_WLAN_CONNECT_CB
|
||||
// Close connections
|
||||
LOCAL void fATOF(int argc, char *argv[]){
|
||||
connect_close();
|
||||
|
@ -139,8 +149,25 @@ LOCAL void fATOF(int argc, char *argv[]){
|
|||
LOCAL void fATON(int argc, char *argv[]){
|
||||
connect_start();
|
||||
}
|
||||
#endif
|
||||
|
||||
LOCAL void fATWI(int argc, char *argv[]) {
|
||||
#if 1
|
||||
if(argc > 2) {
|
||||
uint8_t c = argv[1][0] | 0x20;
|
||||
if(c == 's') {
|
||||
int i = atoi(argv[2]);
|
||||
printf("Save configs(%d)..\n", i);
|
||||
write_wifi_cfg(atoi(argv[2]));
|
||||
}
|
||||
else if(c == 'l') {
|
||||
wifi_cfg.load_flg = atoi(argv[2]);
|
||||
}
|
||||
else if(c == 'm') {
|
||||
wifi_cfg.mode = atoi(argv[2]);
|
||||
}
|
||||
}
|
||||
#endif
|
||||
rtw_wifi_setting_t Setting;
|
||||
if((wifi_run_mode & RTW_MODE_AP)
|
||||
&& wifi_get_setting(wlan_ap_name, &Setting) == 0) {
|
||||
|
@ -164,22 +191,6 @@ LOCAL void fATWI(int argc, char *argv[]) {
|
|||
printf(&str_rom_57ch3Dch0A[25]); // "================================\n"
|
||||
show_wifi_st_cfg();
|
||||
printf("\n");
|
||||
#if 1
|
||||
if(argc > 2) {
|
||||
uint8_t c = argv[1][0] | 0x20;
|
||||
if(c == 's') {
|
||||
int i = atoi(argv[2]);
|
||||
printf("Save configs(%d)..\n", i);
|
||||
write_wifi_cfg(atoi(argv[2]));
|
||||
}
|
||||
else if(c == 'l') {
|
||||
wifi_cfg.load_flg = atoi(argv[2]);
|
||||
}
|
||||
else if(c == 'm') {
|
||||
wifi_cfg.mode = atoi(argv[2]);
|
||||
}
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
extern uint8_t rtw_power_percentage_idx;
|
||||
|
@ -212,71 +223,53 @@ LOCAL void fATSF(int argc, char *argv[])
|
|||
uint64_t tsf = get_tsf();
|
||||
printf("\nTSF: %08x%08x\n", (uint32_t)(tsf>>32), (uint32_t)(tsf));
|
||||
}
|
||||
#if 0
|
||||
/* -------- WiFi Scan ------------------------------- */
|
||||
volatile uint8_t scan_end;
|
||||
/* -------- WiFi Scan ------------------------------- */
|
||||
LOCAL rtw_result_t _scan_result_handler( rtw_scan_handler_result_t* malloced_scan_result )
|
||||
{
|
||||
if (malloced_scan_result->scan_complete != RTW_TRUE) {
|
||||
rtw_scan_result_t* record = &malloced_scan_result->ap_details;
|
||||
record->SSID.val[record->SSID.len] = 0; /* Ensure the SSID is null terminated */
|
||||
if(scan_end == 1) {
|
||||
printf("\nScan networks:\n\n");
|
||||
printf("N\tType\tMAC\t\t\tSignal\tCh\tWPS\tSecyrity\tSSID\n\n");
|
||||
};
|
||||
printf("%d\t", scan_end++);
|
||||
printf("%s\t", (record->bss_type == RTW_BSS_TYPE_ADHOC)? "Adhoc": "Infra");
|
||||
printf(MAC_FMT, MAC_ARG(record->BSSID.octet));
|
||||
printf("\t%d\t", record->signal_strength);
|
||||
printf("%d\t", record->channel);
|
||||
printf("%d\t", record->wps_type);
|
||||
{
|
||||
uint8 * s = rtw_security_to_str(record->security);
|
||||
printf("%s\t", s);
|
||||
if(strlen(s) < 8) printf("\t");
|
||||
}
|
||||
printf("%s\n", record->SSID.val);
|
||||
} else {
|
||||
scan_end = 0;
|
||||
printf("\n");
|
||||
|
||||
LOCAL void fATWP(int argc, char *argv[]) {
|
||||
if(argc > 1) {
|
||||
release_wakelock(0xffff);
|
||||
wifi_set_power_mode(1, 1);
|
||||
wifi_set_lps_dtim(atoi(argv[1]));
|
||||
}
|
||||
else {
|
||||
unsigned char x;
|
||||
if(wifi_get_lps_dtim(&x) >= 0) {
|
||||
printf("DTIM: %d\n", x);
|
||||
}
|
||||
}
|
||||
}
|
||||
/* -------- WiFi Scan ------------------------------- */
|
||||
LOCAL void scan_result_handler(internal_scan_handler_t* ap_scan_result)
|
||||
{
|
||||
if (ap_scan_result) {
|
||||
if(ap_scan_result->scan_cnt) {
|
||||
printf("\nScan networks:\n\n");
|
||||
printf("N\tType\tMAC\t\t\tSignal\tCh\tWPS\tSecyrity\tSSID\n\n");
|
||||
for(int i = 0 ; i < ap_scan_result->scan_cnt; i++) {
|
||||
rtw_scan_result_t* record = &ap_scan_result->ap_details[i];
|
||||
printf("%d\t", i+1);
|
||||
printf("%s\t", (record->bss_type == RTW_BSS_TYPE_ADHOC)? "Adhoc": "Infra");
|
||||
printf(MAC_FMT, MAC_ARG(record->BSSID.octet));
|
||||
printf("\t%d\t", record->signal_strength);
|
||||
printf("%d\t", record->channel);
|
||||
printf("%d\t", record->wps_type);
|
||||
{
|
||||
uint8 * s = rtw_security_to_str(record->security);
|
||||
printf("%s\t", s);
|
||||
if(strlen(s) < 8) printf("\t");
|
||||
}
|
||||
record->SSID.val[record->SSID.len] = '\0';
|
||||
printf("%s\n", record->SSID.val);
|
||||
}
|
||||
|
||||
}
|
||||
} else {
|
||||
printf("Scan networks: None!\n");
|
||||
}
|
||||
return RTW_SUCCESS;
|
||||
}
|
||||
/* -------- WiFi Scan ------------------------------- */
|
||||
#define scan_channels 14
|
||||
#endif
|
||||
void api_wifi_scan(void);
|
||||
LOCAL void fATSN(int argc, char *argv[])
|
||||
{
|
||||
#if 0
|
||||
int i;
|
||||
u8 *channel_list = (u8*)pvPortMalloc(scan_channels*2);
|
||||
if(channel_list) {
|
||||
scan_end = 1;
|
||||
u8 * pscan_config = &channel_list[scan_channels];
|
||||
//parse command channel list
|
||||
for(i = 1; i <= scan_channels; i++){
|
||||
*(channel_list + i - 1) = i;
|
||||
*(pscan_config + i - 1) = PSCAN_ENABLE;
|
||||
};
|
||||
if(wifi_set_pscan_chan(channel_list, pscan_config, scan_channels) < 0){
|
||||
printf("ERROR: wifi set partial scan channel fail\n");
|
||||
} else if(wifi_scan_networks(_scan_result_handler, NULL ) != RTW_SUCCESS){
|
||||
printf("ERROR: wifi scan failed\n");
|
||||
} else {
|
||||
i = 300;
|
||||
while(i-- && scan_end) {
|
||||
vTaskDelay(10);
|
||||
};
|
||||
};
|
||||
vPortFree(channel_list);
|
||||
} else {
|
||||
printf("ERROR: Can't malloc memory for channel list\n");
|
||||
};
|
||||
#else
|
||||
api_wifi_scan();
|
||||
#endif
|
||||
api_wifi_scan(scan_result_handler);
|
||||
}
|
||||
|
||||
#if defined(CONFIG_ENABLE_WPS_AP) && CONFIG_ENABLE_WPS_AP
|
||||
|
@ -315,16 +308,17 @@ MON_RAM_TAB_SECTION COMMAND_TABLE console_cmd_wifi_api[] = {
|
|||
{"P2P_CONNECT", 0, cmd_p2p_connect, ": p2p connect"},
|
||||
#endif
|
||||
{"ATWR", 0, fATWR, ": WIFI Connect, Disconnect"},
|
||||
// {"ATON", 0, fATON, ": Open connections"},
|
||||
// {"ATOF", 0, fATOF, ": Close connections"},
|
||||
#if CONFIG_WLAN_CONNECT_CB
|
||||
{"ATON", 0, fATON, ": Open connections"},
|
||||
{"ATOFF", 0, fATOF, ": Close connections"},
|
||||
#endif
|
||||
{"ATWI", 0, fATWI, ": WiFi Info"},
|
||||
#if CONFIG_DEBUG_LOG > 3
|
||||
{"ATWT", 1, fATWT, "=<tx_power>: WiFi tx power: 0 - 100%, 1 - 75%, 2 - 50%, 3 - 25%, 4 - 12.5%"},
|
||||
{"ATSF", 0, fATSF, ": Test TSF value"},
|
||||
#endif
|
||||
{"ATWP", 0, fATWP, ": WiFi power"},
|
||||
{"ATSN", 0, fATSN, ": Scan networks"}
|
||||
|
||||
|
||||
};
|
||||
|
||||
|
||||
|
|
|
@ -6,7 +6,14 @@
|
|||
*/
|
||||
#include <platform_opts.h>
|
||||
#include "rtl8195a.h"
|
||||
#include "drv_types.h"
|
||||
#if 1
|
||||
#include "drv_types.h" // or #include "wlan_lib.h"
|
||||
#else
|
||||
#include "wifi_constants.h"
|
||||
#include "wifi_structures.h"
|
||||
#include "wlan_lib.h" // or #include "drv_types.h"
|
||||
#endif
|
||||
|
||||
//#include "section_config.h"
|
||||
//#include "hal_diag.h"
|
||||
#include "rtl8195a/rtl_libc.h"
|
||||
|
|
|
@ -8,6 +8,7 @@
|
|||
#include "platform_autoconf.h"
|
||||
#include "autoconf.h"
|
||||
#include "FreeRTOS.h"
|
||||
#include "freertos_pmu.h"
|
||||
#include "task.h"
|
||||
#include "diag.h"
|
||||
#include "netbios/netbios.h"
|
||||
|
@ -71,6 +72,7 @@ void user_init_thrd(void) {
|
|||
|
||||
/* Load cfg, init WiFi + LwIP init, WiFi start if wifi_cfg.mode != RTW_MODE_NONE */
|
||||
wifi_init();
|
||||
|
||||
#if defined(USE_NETBIOS)
|
||||
if(syscfg.cfg.b.netbios_ena) netbios_init();
|
||||
#endif
|
||||
|
@ -80,6 +82,10 @@ void user_init_thrd(void) {
|
|||
// webstuff_init(); // httpd_init();
|
||||
webserver_init(syscfg.web_port);
|
||||
|
||||
if(syscfg.cfg.b.powersave_enable) {
|
||||
release_wakelock(~WAKELOCK_WLAN);
|
||||
}
|
||||
|
||||
// xTaskCreate(x_init_thrd, "wifi_init", 1024, NULL, tskIDLE_PRIORITY + 1 + PRIORITIE_OFFSET, NULL);
|
||||
|
||||
/* Kill init thread after all init tasks done */
|
||||
|
|
|
@ -19,7 +19,6 @@
|
|||
#include "webfs/webfs.h"
|
||||
#include "rtl8195a/rtl_libc.h"
|
||||
#include "user/sys_cfg.h"
|
||||
#include "wifi_conf.h"
|
||||
#include "wifi_api.h"
|
||||
#include "sys_api.h"
|
||||
#include "esp_comp.h"
|
||||
|
@ -56,72 +55,10 @@
|
|||
|
||||
extern struct netif xnetif[NET_IF_NUM]; /* network interface structure */
|
||||
|
||||
#if 0
|
||||
/******************************************************************************
|
||||
* FunctionName : WiFi scan
|
||||
* Description : Processing scan network
|
||||
* Parameters : none (Calback)
|
||||
* Returns : none
|
||||
*******************************************************************************/
|
||||
#define scan_channels 14
|
||||
volatile uint8_t scan_end;
|
||||
|
||||
/* -------- WiFi Scan ------------------------------- */
|
||||
LOCAL rtw_result_t _scan_result_handler( rtw_scan_handler_result_t* malloced_scan_result )
|
||||
{
|
||||
if (malloced_scan_result->scan_complete != RTW_TRUE) {
|
||||
rtw_scan_result_t* record = &malloced_scan_result->ap_details;
|
||||
record->SSID.val[record->SSID.len] = 0; /* Ensure the SSID is null terminated */
|
||||
if(scan_end == 1) {
|
||||
printf("\nScan networks:\n\n");
|
||||
printf("N\tType\tMAC\t\t\tSignal\tCh\tWPS\tSecyrity\tSSID\n\n");
|
||||
};
|
||||
printf("%d\t", scan_end++);
|
||||
printf("%s\t", (record->bss_type == RTW_BSS_TYPE_ADHOC)? "Adhoc": "Infra");
|
||||
printf(MAC_FMT, MAC_ARG(record->BSSID.octet));
|
||||
printf("\t%d\t", record->signal_strength);
|
||||
printf("%d\t", record->channel);
|
||||
printf("%d\t", record->wps_type);
|
||||
int i = 0;
|
||||
for(; record->security != tab_code_rtw_secyrity[i] && tab_code_rtw_secyrity[i] != RTW_SECURITY_UNKNOWN; i++);
|
||||
printf("%s \t", tab_txt_rtw_secyrity[i]);
|
||||
printf("%s\n", record->SSID.val);
|
||||
} else {
|
||||
scan_end = 0;
|
||||
printf("\n");
|
||||
}
|
||||
return RTW_SUCCESS;
|
||||
}
|
||||
/* -------- WiFi Scan ------------------------------- */
|
||||
void web_wifi_scan(void) {
|
||||
int i;
|
||||
u8 *channel_list = (u8*)pvPortMalloc(scan_channels*2);
|
||||
if(channel_list) {
|
||||
scan_end = 1;
|
||||
u8 * pscan_config = &channel_list[scan_channels];
|
||||
//parse command channel list
|
||||
for(i = 1; i <= scan_channels; i++){
|
||||
*(channel_list + i - 1) = i;
|
||||
*(pscan_config + i - 1) = PSCAN_ENABLE;
|
||||
};
|
||||
if(wifi_set_pscan_chan(channel_list, pscan_config, scan_channels) < 0){
|
||||
printf("ERROR: wifi set partial scan channel fail\n");
|
||||
} else if(wifi_scan_networks(_scan_result_handler, NULL ) != RTW_SUCCESS){
|
||||
printf("ERROR: wifi scan failed\n");
|
||||
} else {
|
||||
i = 300;
|
||||
while(i-- && scan_end) {
|
||||
vTaskDelay(10);
|
||||
};
|
||||
};
|
||||
vPortFree(channel_list);
|
||||
} else {
|
||||
printf("ERROR: Can't malloc memory for channel list\n");
|
||||
};
|
||||
}
|
||||
#endif
|
||||
|
||||
#if WEB_DEBUG_FUNCTIONS
|
||||
//#define TEST_SEND_WAVE
|
||||
#endif // #if WEB_DEBUG_FUNCTIONS
|
||||
|
||||
#ifdef TEST_SEND_WAVE
|
||||
//-------------------------------------------------------------------------------
|
||||
|
@ -181,84 +118,52 @@ void ICACHE_FLASH_ATTR web_test_adc(TCP_SERV_CONN *ts_conn)
|
|||
SetSCB(SCB_FCLOSE | SCB_DISCONNECT); // connection close
|
||||
}
|
||||
#endif // TEST_SEND_WAVE
|
||||
#if 0
|
||||
//===============================================================================
|
||||
// WiFi Saved Aps XML
|
||||
//-------------------------------------------------------------------------------
|
||||
void ICACHE_FLASH_ATTR wifi_aps_xml(TCP_SERV_CONN *ts_conn)
|
||||
{
|
||||
struct buf_html_string {
|
||||
uint8 ssid[32*6 + 1];
|
||||
uint8 psw[64*6 + 1];
|
||||
};
|
||||
WEB_SRV_CONN *web_conn = (WEB_SRV_CONN *) ts_conn->linkd;
|
||||
struct station_config config[5];
|
||||
struct buf_html_string * buf = (struct buf_html_string *)os_malloc(sizeof(struct buf_html_string));
|
||||
if(buf == NULL) return;
|
||||
int total_aps = wifi_station_get_ap_info(config);
|
||||
// Check if this is a first round call
|
||||
if(CheckSCB(SCB_RETRYCB)==0) {
|
||||
tcp_puts_fd("<total>%u</total><cur>%u</cur>", total_aps, wifi_station_get_current_ap_id());
|
||||
if(total_aps == 0) return;
|
||||
web_conn->udata_start = 0;
|
||||
}
|
||||
while(web_conn->msgbuflen + 74 + 32 <= web_conn->msgbufsize) {
|
||||
if(web_conn->udata_start < total_aps) {
|
||||
struct station_config *p = (struct station_config *)&config[web_conn->udata_start];
|
||||
if(web_conn->msgbuflen + 74 + htmlcode(buf->ssid, p->ssid, 32*6, 32) + htmlcode(buf->psw, p->password, 64*6, 64) > web_conn->msgbufsize) break;
|
||||
tcp_puts_fd("<aps id=\"%u\"><ss>%s</ss><ps>%s</ps><bs>" MACSTR "</bs><bt>%d</bt></aps>",
|
||||
web_conn->udata_start, buf->ssid, buf->psw, MAC2STR(p->bssid), p->bssid_set);
|
||||
web_conn->udata_start++;
|
||||
if(web_conn->udata_start >= total_aps) {
|
||||
ClrSCB(SCB_RETRYCB);
|
||||
os_free(buf);
|
||||
return;
|
||||
}
|
||||
}
|
||||
else {
|
||||
ClrSCB(SCB_RETRYCB);
|
||||
os_free(buf);
|
||||
return;
|
||||
}
|
||||
}
|
||||
// repeat in the next call ...
|
||||
SetSCB(SCB_RETRYCB);
|
||||
SetNextFunSCB(wifi_aps_xml);
|
||||
os_free(buf);
|
||||
return;
|
||||
}
|
||||
|
||||
//===============================================================================
|
||||
// WiFi Scan XML
|
||||
//-------------------------------------------------------------------------------
|
||||
void ICACHE_FLASH_ATTR web_wscan_xml(TCP_SERV_CONN *ts_conn)
|
||||
LOCAL void ICACHE_FLASH_ATTR web_wscan_xml(TCP_SERV_CONN *ts_conn)
|
||||
{
|
||||
struct bss_scan_info si;
|
||||
WEB_SRV_CONN *web_conn = (WEB_SRV_CONN *) ts_conn->linkd;
|
||||
web_scan_handler_t * pwscn_rec = &web_scan_handler_ptr;
|
||||
// Check if this is a first round call
|
||||
if(CheckSCB(SCB_RETRYCB)==0) {
|
||||
tcp_puts_fd("<total>%d</total>", total_scan_infos);
|
||||
if(total_scan_infos == 0) return;
|
||||
web_conn->udata_start = 0;
|
||||
int i = 0;
|
||||
web_conn->udata_start = 0;
|
||||
if(pwscn_rec->flg == 2) {
|
||||
i = pwscn_rec->ap_count;
|
||||
wifi_set_timer_scan(7000);
|
||||
} else if(pwscn_rec->flg == 0) api_wifi_scan(NULL);
|
||||
tcp_puts_fd("<total>%d</total>", i);
|
||||
if(i == 0) return;
|
||||
}
|
||||
while(web_conn->msgbuflen + 96 + 32 <= web_conn->msgbufsize) {
|
||||
if(web_conn->udata_start < total_scan_infos) {
|
||||
struct bss_scan_info *p = (struct bss_scan_info *)buf_scan_infos;
|
||||
p += web_conn->udata_start;
|
||||
ets_memcpy(&si, p, sizeof(si));
|
||||
/*
|
||||
uint8 ssid[33];
|
||||
ssid[32] = '\0';
|
||||
ets_memcpy(ssid, si.ssid, 32); */
|
||||
while(web_conn->msgbuflen + 96 + 10 + 32 <= web_conn->msgbufsize) {
|
||||
if(pwscn_rec->flg && web_conn->udata_start < pwscn_rec->ap_count) {
|
||||
rtw_scan_result_t *si = &pwscn_rec->ap_details[web_conn->udata_start];
|
||||
uint8 ssid[32*6 + 1];
|
||||
if(web_conn->msgbuflen + 96 + htmlcode(ssid, si.ssid, 32*6, 32) > web_conn->msgbufsize) break;
|
||||
tcp_puts_fd("<ap id=\"%d\"><ch>%d</ch><au>%d</au><bs>" MACSTR "</bs><ss>%s</ss><rs>%d</rs><hd>%d</hd></ap>", web_conn->udata_start, si.channel, si.authmode, MAC2STR(si.bssid), ssid, si.rssi, si.is_hidden);
|
||||
int len = si->SSID.len;
|
||||
if(len > 32) len = 32;
|
||||
si->SSID.val[len] = '\0';
|
||||
if(web_conn->msgbuflen + 96 + 10 + htmlcode(ssid, si->SSID.val, 32*6, 32) > web_conn->msgbufsize) break;
|
||||
tcp_puts_fd("<ap id=\"%d\"><ch>%d</ch><au>%d</au><bs>" MACSTR "</bs><ss>%s</ss><rs>%d</rs><hd>%d</hd><wp>%d</wp></ap>",
|
||||
web_conn->udata_start,
|
||||
si->channel,
|
||||
rtw_security_to_idx(si->security),
|
||||
MAC2STR(si->BSSID.octet),
|
||||
ssid,
|
||||
si->signal_strength,
|
||||
// si->band, // rtw_802_11_band_t
|
||||
si->bss_type & 3, // rtw_bss_type_t
|
||||
si->wps_type); // rtw_wps_type_t
|
||||
web_conn->udata_start++;
|
||||
if(web_conn->udata_start >= total_scan_infos) {
|
||||
if(web_conn->udata_start >= pwscn_rec->ap_count) {
|
||||
wifi_close_scan();
|
||||
ClrSCB(SCB_RETRYCB);
|
||||
return;
|
||||
}
|
||||
}
|
||||
else {
|
||||
wifi_close_scan();
|
||||
ClrSCB(SCB_RETRYCB);
|
||||
return;
|
||||
}
|
||||
|
@ -268,46 +173,6 @@ void ICACHE_FLASH_ATTR web_wscan_xml(TCP_SERV_CONN *ts_conn)
|
|||
SetNextFunSCB(web_wscan_xml);
|
||||
return;
|
||||
}
|
||||
//===============================================================================
|
||||
// WiFi Probe Request XML
|
||||
//-------------------------------------------------------------------------------
|
||||
void ICACHE_FLASH_ATTR web_ProbeRequest_xml(TCP_SERV_CONN *ts_conn)
|
||||
{
|
||||
struct s_probe_requests pr;
|
||||
WEB_SRV_CONN *web_conn = (WEB_SRV_CONN *) ts_conn->linkd;
|
||||
// Check if this is a first round call
|
||||
uint32 cnt = (probe_requests_count < MAX_COUNT_BUF_PROBEREQS)? probe_requests_count : MAX_COUNT_BUF_PROBEREQS;
|
||||
if(CheckSCB(SCB_RETRYCB)==0) {
|
||||
if(cnt == 0) {
|
||||
tcp_strcpy_fd("<total>0</total>");
|
||||
return;
|
||||
}
|
||||
web_conn->udata_start = 0;
|
||||
}
|
||||
while(web_conn->msgbuflen + 92 <= web_conn->msgbufsize) {
|
||||
if(web_conn->udata_start < cnt) {
|
||||
struct s_probe_requests *p = (struct s_probe_requests *)&buf_probe_requests;
|
||||
p += web_conn->udata_start;
|
||||
ets_memcpy(&pr, p, sizeof(struct s_probe_requests));
|
||||
tcp_puts_fd("<pr id=\"%u\"><mac>" MACSTR "</mac><min>%d</min><max>%d</max></pr>", web_conn->udata_start, MAC2STR(pr.mac), pr.rssi_min, pr.rssi_max);
|
||||
web_conn->udata_start++;
|
||||
if(web_conn->udata_start >= cnt) {
|
||||
tcp_puts_fd("<total>%d</total>", cnt);
|
||||
ClrSCB(SCB_RETRYCB);
|
||||
return;
|
||||
}
|
||||
}
|
||||
else {
|
||||
ClrSCB(SCB_RETRYCB);
|
||||
return;
|
||||
}
|
||||
}
|
||||
// repeat in the next call ...
|
||||
SetSCB(SCB_RETRYCB);
|
||||
SetNextFunSCB(web_ProbeRequest_xml);
|
||||
return;
|
||||
}
|
||||
#endif
|
||||
#ifdef USE_MODBUS
|
||||
//===============================================================================
|
||||
// Mdb XML
|
||||
|
@ -495,14 +360,18 @@ void ICACHE_FLASH_ATTR web_int_callback(TCP_SERV_CONN *ts_conn, uint8 *cstr)
|
|||
else ifcmp("stop") tcp_puts("0x%08x", web_conn->udata_stop);
|
||||
else ifcmp("xml_") {
|
||||
cstr+=4;
|
||||
web_conn->udata_start&=~3;
|
||||
ifcmp("ram") tcp_puts("0x%08x", *((uint32*)web_conn->udata_start));
|
||||
else tcp_put('?');
|
||||
web_conn->udata_start += 4;
|
||||
ifcmp("scan") web_wscan_xml(ts_conn);
|
||||
else {
|
||||
web_conn->udata_start&=~3;
|
||||
ifcmp("ram") tcp_puts("0x%08x", *((uint32*)web_conn->udata_start));
|
||||
else tcp_put('?');
|
||||
web_conn->udata_start += 4;
|
||||
}
|
||||
}
|
||||
else ifcmp("sys_") {
|
||||
cstr+=4;
|
||||
ifcmp("cid") tcp_puts("%08x", HalGetChipId());
|
||||
ifcmp("url") tcp_strcpy(get_new_hostname());
|
||||
else ifcmp("cid") tcp_puts("%08x", HalGetChipId());
|
||||
else ifcmp("fid") tcp_puts("%08x", spi_flash_get_id());
|
||||
else ifcmp("fsize") tcp_puts("%u", spi_flash_real_size()); // flashchip->chip_size
|
||||
else ifcmp("sdkver") tcp_strcpy_fd(SDK_VERSION);
|
||||
|
@ -524,9 +393,11 @@ void ICACHE_FLASH_ATTR web_int_callback(TCP_SERV_CONN *ts_conn, uint8 *cstr)
|
|||
}
|
||||
else ifcmp("clkcpu") tcp_puts("%u", HalGetCpuClk());
|
||||
else ifcmp("debug") tcp_put('1' - (print_off & 1)); // rtl_print on/off
|
||||
#if WEB_DEBUG_FUNCTIONS
|
||||
else ifcmp("restart") web_conn->web_disc_cb = (web_func_disc_cb)sys_reset;
|
||||
else ifcmp("ram") tcp_puts("0x%08x", *((uint32 *)(ahextoul(cstr+3)&(~3))));
|
||||
else ifcmp("rdec") tcp_puts("%d", *((uint32 *)(ahextoul(cstr+4)&(~3))));
|
||||
#endif // #if WEB_DEBUG_FUNCTIONS
|
||||
else ifcmp("ip") {
|
||||
uint32 cur_ip;
|
||||
if(netif_default != NULL) cur_ip = netif_default->ip_addr.addr;
|
||||
|
@ -549,6 +420,7 @@ void ICACHE_FLASH_ATTR web_int_callback(TCP_SERV_CONN *ts_conn, uint8 *cstr)
|
|||
else ifcmp("twd") tcp_put((syscfg.cfg.b.web_time_wait_delete)? '1' : '0');
|
||||
else tcp_put('?');
|
||||
}
|
||||
else ifcmp("sleep") tcp_put((syscfg.cfg.b.powersave_enable)? '1' : '0');
|
||||
else ifcmp("pinclr") tcp_put((syscfg.cfg.b.pin_clear_cfg_enable)? '1' : '0');
|
||||
else ifcmp("debug") tcp_put((syscfg.cfg.b.debug_print_enable)? '1' : '0');
|
||||
#ifdef USE_NETBIOS
|
||||
|
@ -572,36 +444,28 @@ void ICACHE_FLASH_ATTR web_int_callback(TCP_SERV_CONN *ts_conn, uint8 *cstr)
|
|||
else ifcmp("cmode") tcp_puts("%d", wifi_mode);
|
||||
else ifcmp("mode") tcp_puts("%d", wifi_cfg.mode);
|
||||
else ifcmp("bgn") tcp_puts("%d", wifi_cfg.bgn);
|
||||
else ifcmp("sleep") tcp_puts("%d", wifi_cfg.sleep);
|
||||
else ifcmp("txpow") tcp_puts("%u", wifi_cfg.tx_pwr);
|
||||
else ifcmp("lflg") tcp_puts("%u", wifi_cfg.load_flg);
|
||||
else ifcmp("sflg") tcp_puts("%u", wifi_cfg.save_flg);
|
||||
else ifcmp("adpt") tcp_puts("%u", wifi_cfg.adaptivity);
|
||||
else ifcmp("country") tcp_puts("%u", wifi_cfg.country_code);
|
||||
else ifcmp("ap_") {
|
||||
cstr+=3;
|
||||
ifcmp("ssid") {
|
||||
int len = os_strlen(wifi_ap_cfg.ssid);
|
||||
if(len > sizeof(wifi_ap_cfg.ssid)) {
|
||||
len = sizeof(wifi_ap_cfg.ssid);
|
||||
}
|
||||
os_memcpy((char *)&web_conn->msgbuf[web_conn->msgbuflen], wifi_ap_cfg.ssid, len);
|
||||
web_conn->msgbuflen += len;
|
||||
wifi_ap_cfg.ssid[NDIS_802_11_LENGTH_SSID] = '\0';
|
||||
tcp_strcpy(wifi_ap_cfg.ssid);
|
||||
}
|
||||
else ifcmp("psw") {
|
||||
int len = os_strlen(wifi_ap_cfg.password);
|
||||
if(len > sizeof(wifi_ap_cfg.password)) {
|
||||
len = sizeof(wifi_ap_cfg.password);
|
||||
}
|
||||
os_memcpy((char *)&web_conn->msgbuf[web_conn->msgbuflen], wifi_ap_cfg.password, len);
|
||||
web_conn->msgbuflen += len;
|
||||
wifi_ap_cfg.password[IW_PASSPHRASE_MAX_SIZE] = '\0';
|
||||
tcp_strcpy(wifi_ap_cfg.password);
|
||||
}
|
||||
else ifcmp("chl") tcp_puts("%u", wifi_ap_cfg.channel);
|
||||
else ifcmp("mcns") tcp_puts("%u", wifi_ap_cfg.max_sta);
|
||||
else ifcmp("auth") tcp_put((wifi_ap_cfg.security_type == RTW_SECURITY_OPEN) ? '0' : '1');
|
||||
else ifcmp("auth") tcp_put((wifi_ap_cfg.security) ? '1' : '0');
|
||||
else ifcmp("hssid") tcp_put((wifi_ap_cfg.ssid_hidden & 1) + '0');
|
||||
else ifcmp("bint") tcp_puts("%u", wifi_ap_cfg.beacon_interval);
|
||||
else ifcmp("mac") tcp_puts(MACSTR, MAC2STR(xnetif[WLAN_AP_NETIF_NUM].hwaddr));
|
||||
else ifcmp("hostname") tcp_strcpy(lwip_host_name[WLAN_AP_NETIF_NUM]);
|
||||
else ifcmp("hostname") tcp_strcpy(lwip_host_name[1]);
|
||||
else ifcmp("dhcp") tcp_puts("%u", wifi_ap_dhcp.mode);
|
||||
else ifcmp("ip") tcp_puts(IPSTR, IP2STR(&wifi_ap_dhcp.ip));
|
||||
else ifcmp("gw") tcp_puts(IPSTR, IP2STR(&wifi_ap_dhcp.gw));
|
||||
|
@ -622,31 +486,26 @@ void ICACHE_FLASH_ATTR web_int_callback(TCP_SERV_CONN *ts_conn, uint8 *cstr)
|
|||
wifi_get_rssi(&rssi);
|
||||
tcp_puts("%d", rssi);
|
||||
}
|
||||
else ifcmp("status") tcp_puts("%u", wifi_st_status);
|
||||
else ifcmp("arec") tcp_puts("%u", wifi_st_cfg.autoreconnect);
|
||||
else ifcmp("rect") tcp_puts("%u", wifi_st_cfg.reconnect_pause);
|
||||
else ifcmp("ssid") {
|
||||
int len = os_strlen(wifi_st_cfg.ssid);
|
||||
if(len > sizeof(wifi_st_cfg.ssid)) {
|
||||
len = sizeof(wifi_st_cfg.ssid);
|
||||
}
|
||||
os_memcpy((char *)&web_conn->msgbuf[web_conn->msgbuflen], wifi_st_cfg.ssid, len);
|
||||
web_conn->msgbuflen += len;
|
||||
}
|
||||
ifcmp("ssid") {
|
||||
wifi_st_cfg.ssid[NDIS_802_11_LENGTH_SSID] = '\0';
|
||||
tcp_strcpy(wifi_st_cfg.ssid);
|
||||
}
|
||||
else ifcmp("psw") {
|
||||
int len = os_strlen(wifi_st_cfg.password);
|
||||
if(len > sizeof(wifi_st_cfg.password)) {
|
||||
len = sizeof(wifi_st_cfg.password);
|
||||
}
|
||||
os_memcpy((char *)&web_conn->msgbuf[web_conn->msgbuflen], wifi_st_cfg.password, len);
|
||||
web_conn->msgbuflen += len;
|
||||
wifi_st_cfg.password[IW_PASSPHRASE_MAX_SIZE] = '\0';
|
||||
tcp_strcpy(wifi_st_cfg.password);
|
||||
}
|
||||
else ifcmp("mac") tcp_puts(MACSTR, MAC2STR(xnetif[WLAN_ST_NETIF_NUM].hwaddr));
|
||||
else ifcmp("bssid") tcp_puts(MACSTR, MAC2STR(wifi_st_cfg.bssid));
|
||||
else ifcmp("sbss") tcp_puts("%u", wifi_st_cfg.flg);
|
||||
else ifcmp("sleep") tcp_puts("%d", wifi_st_cfg.sleep);
|
||||
else ifcmp("dtim") tcp_puts("%u", wifi_st_cfg.dtim);
|
||||
#if LWIP_NETIF_HOSTNAME
|
||||
else ifcmp("hostname") tcp_strcpy(lwip_host_name[WLAN_ST_NETIF_NUM]);
|
||||
else ifcmp("hostname") tcp_strcpy(lwip_host_name[0]);
|
||||
#endif
|
||||
else ifcmp("auth") tcp_puts("%u", rtw_security_to_idx(wifi_st_cfg.security_type));
|
||||
else ifcmp("auth") tcp_puts("%u", wifi_st_cfg.security);
|
||||
else ifcmp("dhcp") tcp_puts("%u", wifi_st_dhcp.mode);
|
||||
else ifcmp("ip") tcp_puts(IPSTR, IP2STR(&wifi_st_dhcp.ip));
|
||||
else ifcmp("gw") tcp_puts(IPSTR, IP2STR(&wifi_st_dhcp.gw));
|
||||
|
@ -665,6 +524,7 @@ void ICACHE_FLASH_ATTR web_int_callback(TCP_SERV_CONN *ts_conn, uint8 *cstr)
|
|||
cstr+=5;
|
||||
if(*cstr == '_') {
|
||||
cstr++;
|
||||
#if WEB_DEBUG_FUNCTIONS
|
||||
ifcmp("all") {
|
||||
web_conn->udata_start = 0;
|
||||
web_conn->udata_stop = spi_flash_real_size();
|
||||
|
@ -675,7 +535,9 @@ void ICACHE_FLASH_ATTR web_int_callback(TCP_SERV_CONN *ts_conn, uint8 *cstr)
|
|||
web_conn->udata_stop = web_conn->udata_start + FLASH_SECTOR_SIZE;
|
||||
web_get_flash(ts_conn);
|
||||
}
|
||||
else ifcmp("disk") {
|
||||
else
|
||||
#endif // #if WEB_DEBUG_FUNCTIONS
|
||||
ifcmp("disk") {
|
||||
web_conn->udata_start = WEBFS_base_addr();
|
||||
web_conn->udata_stop = web_conn->udata_start + WEBFS_curent_size();
|
||||
web_get_flash(ts_conn);
|
||||
|
@ -684,14 +546,18 @@ void ICACHE_FLASH_ATTR web_int_callback(TCP_SERV_CONN *ts_conn, uint8 *cstr)
|
|||
}
|
||||
else web_get_flash(ts_conn);
|
||||
}
|
||||
#if WEB_DEBUG_FUNCTIONS
|
||||
else ifcmp("ram") web_get_ram(ts_conn);
|
||||
#endif // #if WEB_DEBUG_FUNCTIONS
|
||||
else tcp_put('?');
|
||||
}
|
||||
#if WEB_DEBUG_FUNCTIONS
|
||||
else ifcmp("hexdmp") {
|
||||
if(cstr[6]=='d') ts_conn->flag.user_option1 = 1;
|
||||
else ts_conn->flag.user_option1 = 0;
|
||||
web_hexdump(ts_conn);
|
||||
}
|
||||
#endif // #if WEB_DEBUG_FUNCTIONS
|
||||
else ifcmp("web_") {
|
||||
cstr+=4;
|
||||
ifcmp("port") tcp_puts("%u", ts_conn->pcfg->port);
|
||||
|
|
|
@ -7,6 +7,7 @@
|
|||
#ifdef USE_WEB
|
||||
#include "autoconf.h"
|
||||
#include "FreeRTOS.h"
|
||||
#include "freertos_pmu.h"
|
||||
#include "task.h"
|
||||
#include "diag.h"
|
||||
#include "lwip/ip.h"
|
||||
|
@ -82,6 +83,7 @@ void ICACHE_FLASH_ATTR web_int_vars(TCP_SERV_CONN *ts_conn, uint8 *pcmd, uint8 *
|
|||
#endif
|
||||
ifcmp("start") web_conn->udata_start = val;
|
||||
else ifcmp("stop") web_conn->udata_stop = val;
|
||||
#if WEB_DEBUG_FUNCTIONS
|
||||
else ifcmp("sys_") {
|
||||
cstr+=4;
|
||||
ifcmp("restart") {
|
||||
|
@ -89,6 +91,7 @@ void ICACHE_FLASH_ATTR web_int_vars(TCP_SERV_CONN *ts_conn, uint8 *pcmd, uint8 *
|
|||
}
|
||||
else ifcmp("ram") { uint32 *ptr = (uint32 *)(ahextoul(cstr+3)&(~3)); str_array(pvar, ptr, 32); }
|
||||
else ifcmp("debug") print_off = (!val) & 1; // rtl_print on/off
|
||||
else ifcmp("dsleep") deepsleep_ex(DSLEEP_WAKEUP_BY_TIMER, val);
|
||||
#ifdef USE_LWIP_PING
|
||||
else ifcmp("ping") {
|
||||
// struct ping_option *pingopt = (struct ping_option *)UartDev.rcv_buff.pRcvMsgBuff;
|
||||
|
@ -100,6 +103,7 @@ void ICACHE_FLASH_ATTR web_int_vars(TCP_SERV_CONN *ts_conn, uint8 *pcmd, uint8 *
|
|||
}
|
||||
#endif
|
||||
}
|
||||
#endif // #if WEB_DEBUG_FUNCTIONS
|
||||
else ifcmp("cfg_") {
|
||||
cstr += 4;
|
||||
ifcmp("web_") {
|
||||
|
@ -134,6 +138,11 @@ void ICACHE_FLASH_ATTR web_int_vars(TCP_SERV_CONN *ts_conn, uint8 *pcmd, uint8 *
|
|||
#endif
|
||||
}
|
||||
else ifcmp("pinclr") syscfg.cfg.b.pin_clear_cfg_enable = (val)? 1 : 0;
|
||||
else ifcmp("sleep") {
|
||||
syscfg.cfg.b.powersave_enable = (val)? 1 : 0;
|
||||
if(val) release_wakelock(~WAKELOCK_WLAN);
|
||||
else acquire_wakelock(~WAKELOCK_WLAN);
|
||||
}
|
||||
else ifcmp("debug") {
|
||||
syscfg.cfg.b.debug_print_enable = val;
|
||||
print_off = (!val) & 1; // rtl_print on/off
|
||||
|
@ -170,7 +179,8 @@ void ICACHE_FLASH_ATTR web_int_vars(TCP_SERV_CONN *ts_conn, uint8 *pcmd, uint8 *
|
|||
}
|
||||
else ifcmp("wifi_") {
|
||||
cstr+=5;
|
||||
ifcmp("rdcfg") web_conn->udata_stop = read_wifi_cfg(val);
|
||||
ifcmp("scan") api_wifi_scan(NULL);
|
||||
else ifcmp("rdcfg") web_conn->udata_stop = read_wifi_cfg(val);
|
||||
else ifcmp("newcfg") {
|
||||
web_conn->web_disc_cb = (web_func_disc_cb)wifi_run;
|
||||
web_conn->web_disc_par = wifi_cfg.mode;
|
||||
|
@ -179,8 +189,8 @@ void ICACHE_FLASH_ATTR web_int_vars(TCP_SERV_CONN *ts_conn, uint8 *pcmd, uint8 *
|
|||
else ifcmp("bgn") wifi_cfg.bgn = val;
|
||||
else ifcmp("lflg") wifi_cfg.load_flg = val;
|
||||
else ifcmp("sflg") wifi_cfg.save_flg = val;
|
||||
else ifcmp("sleep") wifi_cfg.sleep = val;
|
||||
else ifcmp("txpow") wifi_cfg.tx_pwr = val;
|
||||
else ifcmp("adpt") wifi_cfg.adaptivity = val;
|
||||
else ifcmp("country") wifi_cfg.country_code = val;
|
||||
// else ifcmp("scan") {
|
||||
// web_conn->web_disc_par = val;
|
||||
|
@ -192,10 +202,10 @@ void ICACHE_FLASH_ATTR web_int_vars(TCP_SERV_CONN *ts_conn, uint8 *pcmd, uint8 *
|
|||
ifcmp("ssid") {
|
||||
if(pvar[0]!='\0') {
|
||||
int len = os_strlen(pvar);
|
||||
if(len > sizeof(wifi_ap_cfg.ssid)) {
|
||||
len = sizeof(wifi_ap_cfg.ssid);
|
||||
if(len > NDIS_802_11_LENGTH_SSID) {
|
||||
len = NDIS_802_11_LENGTH_SSID;
|
||||
}
|
||||
else os_memset(wifi_ap_cfg.ssid, 0, sizeof(wifi_ap_cfg.ssid));
|
||||
os_memset(wifi_ap_cfg.ssid, 0, sizeof(wifi_ap_cfg.ssid));
|
||||
os_memcpy(wifi_ap_cfg.ssid, pvar, len);
|
||||
#ifdef USE_NETBIOS
|
||||
// netbios_set_name(wlan_ap_netifn, wifi_ap_cfg.ssid);
|
||||
|
@ -204,15 +214,15 @@ void ICACHE_FLASH_ATTR web_int_vars(TCP_SERV_CONN *ts_conn, uint8 *pcmd, uint8 *
|
|||
}
|
||||
else ifcmp("psw") {
|
||||
int len = os_strlen(pvar);
|
||||
if(len > sizeof(wifi_ap_cfg.password)) {
|
||||
len = sizeof(wifi_ap_cfg.password);
|
||||
if(len > IW_PASSPHRASE_MAX_SIZE) {
|
||||
len = IW_PASSPHRASE_MAX_SIZE;
|
||||
}
|
||||
else os_memset(wifi_ap_cfg.password, 0, sizeof(wifi_ap_cfg.password));
|
||||
os_memset(wifi_ap_cfg.password, 0, sizeof(wifi_ap_cfg.password));
|
||||
os_memcpy(wifi_ap_cfg.password, pvar, len);
|
||||
}
|
||||
else ifcmp("chl") wifi_ap_cfg.channel = val;
|
||||
else ifcmp("mcns") wifi_ap_cfg.max_sta = val;
|
||||
else ifcmp("auth") wifi_ap_cfg.security_type = (val != 0);
|
||||
else ifcmp("auth") wifi_ap_cfg.security = val; // =1 IDX_SECURITY_WPA2_AES_PSK, =0 IDX_SECURITY_OPEN
|
||||
else ifcmp("hssid") wifi_ap_cfg.ssid_hidden = val;
|
||||
else ifcmp("bint") wifi_ap_cfg.beacon_interval = val;
|
||||
#if LWIP_NETIF_HOSTNAME
|
||||
|
@ -221,9 +231,11 @@ void ICACHE_FLASH_ATTR web_int_vars(TCP_SERV_CONN *ts_conn, uint8 *pcmd, uint8 *
|
|||
if(len >= LWIP_NETIF_HOSTNAME_SIZE) {
|
||||
len = LWIP_NETIF_HOSTNAME_SIZE-1;
|
||||
}
|
||||
os_memcpy(lwip_host_name[wlan_ap_netifn], pvar, len);
|
||||
lwip_host_name[wlan_ap_netifn][len] = 0;
|
||||
netbios_set_name(wlan_ap_netifn, pvar);
|
||||
if(len) {
|
||||
os_memset(lwip_host_name[1], 0, LWIP_NETIF_HOSTNAME_SIZE);
|
||||
os_memcpy(lwip_host_name[1], pvar, len);
|
||||
}
|
||||
netbios_set_name(WLAN_AP_NETIF_NUM, lwip_host_name[1]);
|
||||
}
|
||||
#endif
|
||||
else ifcmp("dhcp") wifi_ap_dhcp.mode = val;
|
||||
|
@ -244,33 +256,37 @@ void ICACHE_FLASH_ATTR web_int_vars(TCP_SERV_CONN *ts_conn, uint8 *pcmd, uint8 *
|
|||
else ifcmp("ssid") {
|
||||
if(pvar[0]!='\0') {
|
||||
int len = os_strlen(pvar);
|
||||
if(len > sizeof(wifi_st_cfg.ssid)) {
|
||||
len = sizeof(wifi_st_cfg.ssid);
|
||||
if(len > NDIS_802_11_LENGTH_SSID) {
|
||||
len = NDIS_802_11_LENGTH_SSID;
|
||||
}
|
||||
else os_memset(wifi_st_cfg.ssid, 0, sizeof(wifi_st_cfg.ssid));
|
||||
os_memset(wifi_st_cfg.ssid, 0, sizeof(wifi_st_cfg.ssid));
|
||||
os_memcpy(wifi_st_cfg.ssid, pvar, len);
|
||||
}
|
||||
}
|
||||
else ifcmp("psw") {
|
||||
int len = os_strlen(pvar);
|
||||
if(len > sizeof(wifi_st_cfg.password)) {
|
||||
len = sizeof(wifi_st_cfg.password);
|
||||
if(len > IW_PASSPHRASE_MAX_SIZE) {
|
||||
len = IW_PASSPHRASE_MAX_SIZE;
|
||||
}
|
||||
else os_memset(wifi_st_cfg.password, 0, sizeof(wifi_st_cfg.password));
|
||||
os_memset(wifi_st_cfg.password, 0, sizeof(wifi_st_cfg.password));
|
||||
os_memcpy(wifi_st_cfg.password, pvar, len);
|
||||
}
|
||||
else ifcmp("auth") wifi_st_cfg.security_type = idx_to_rtw_security(val);
|
||||
else ifcmp("auth") wifi_st_cfg.security = val;
|
||||
else ifcmp("bssid") strtomac(pvar, wifi_st_cfg.bssid);
|
||||
else ifcmp("sbss") wifi_st_cfg.flg = val;
|
||||
else ifcmp("sleep") wifi_st_cfg.sleep = val;
|
||||
else ifcmp("dtim") wifi_st_cfg.dtim = val;
|
||||
#if LWIP_NETIF_HOSTNAME
|
||||
else ifcmp("hostname") {
|
||||
int len = os_strlen(pvar);
|
||||
if(len >= LWIP_NETIF_HOSTNAME_SIZE) {
|
||||
len = LWIP_NETIF_HOSTNAME_SIZE-1;
|
||||
}
|
||||
os_memcpy(lwip_host_name[wlan_st_netifn], pvar, len);
|
||||
lwip_host_name[wlan_st_netifn][len] = 0;
|
||||
netbios_set_name(wlan_st_netifn, pvar);
|
||||
if(len) {
|
||||
os_memset(lwip_host_name[0], 0, LWIP_NETIF_HOSTNAME_SIZE);
|
||||
os_memcpy(lwip_host_name[0], pvar, len);
|
||||
netbios_set_name(WLAN_ST_NETIF_NUM, lwip_host_name[0]);
|
||||
}
|
||||
}
|
||||
#endif
|
||||
else ifcmp("dhcp") wifi_st_dhcp.mode = val;
|
||||
|
@ -287,6 +303,7 @@ void ICACHE_FLASH_ATTR web_int_vars(TCP_SERV_CONN *ts_conn, uint8 *pcmd, uint8 *
|
|||
else os_printf(" - none!\n");
|
||||
#endif
|
||||
}
|
||||
#if WEB_DEBUG_FUNCTIONS
|
||||
else if(web_conn->bffiles[0]==WEBFS_WEBCGI_HANDLE && CheckSCB(SCB_GET)) {
|
||||
ifcmp("hexdmp") {
|
||||
#if DEBUGSOO > 5
|
||||
|
@ -348,6 +365,7 @@ void ICACHE_FLASH_ATTR web_int_vars(TCP_SERV_CONN *ts_conn, uint8 *pcmd, uint8 *
|
|||
else os_printf(" - none! ");
|
||||
#endif
|
||||
}
|
||||
#endif // #if WEB_DEBUG_FUNCTIONS
|
||||
#if DEBUGSOO > 5
|
||||
else os_printf(" - none! ");
|
||||
#endif
|
||||
|
|
|
@ -408,7 +408,8 @@ ADD_SRC_C += project/src/user/user_start.c
|
|||
# components
|
||||
ADD_SRC_C += project/src/console/atcmd_user.c
|
||||
ADD_SRC_C += project/src/console/wifi_console.c
|
||||
ADD_SRC_C += project/src/console/pwm_tst.c
|
||||
#ADD_SRC_C += project/src/console/pwm_tst.c
|
||||
#ADD_SRC_C += project/src/console/wlan_tst.c
|
||||
|
||||
#Web-свалка
|
||||
INCLUDES += project/inc/web
|
||||
|
|
Loading…
Reference in a new issue