This commit is contained in:
pvvx 2017-04-24 17:04:01 +03:00
parent 7bfffd015c
commit 58093484e1
5 changed files with 51 additions and 47 deletions

View file

@ -56,14 +56,14 @@
<td class="label">Auth Mode:</td> <td class="label">Auth Mode:</td>
<td><select name='wifi_st_auth'> <td><select name='wifi_st_auth'>
<option value='0'>OPEN</option> <option value='0'>OPEN</option>
<option value='1'>WEP_PSK</option> <option value='1'>WEP PSK</option>
<option value='2'>WEP_SHAREDK</option> <option value='2'>WEP Shared</option>
<option value='3'>WPA_TKIP_PSK</option> <option value='3'>WPA TKIP</option>
<option value='4'>WPA_AES_PSK</option> <option value='4'>WPA AES</option>
<option value='5'>WPA2_TKIP_PSK</option> <option value='5'>WPA2 TKIP</option>
<option value='6'>WPA2_AES_PSK</option> <option value='6'>WPA2 AES</option>
<option value='7'>WPA2_MIXED_PSK</option> <option value='7'>WPA2 Mixed</option>
<option value='8'>WPA_WPA2_MIXED</option> <option value='8'>WPA2/WPA AES</option>
<option value='9'>UNKNOWN</option> <option value='9'>UNKNOWN</option>
</select></td> </select></td>
</tr> </tr>

View file

@ -1,5 +1,5 @@
define call1 define call1
set $ImageSize = 0xF140 set $ImageSize = 0xF120
set $ImageAddr = 0x0D0000 set $ImageAddr = 0x0D0000
end end
define call2 define call2

View file

@ -10,60 +10,57 @@
//========================================= //=========================================
//==== Wlan Config ======================== //==== Wlan Config ========================
#define DEF_WIFI_MODE RTW_MODE_STA // RTW_MODE_STA_AP, RTW_MODE_AP, RTW_MODE_STA #define DEF_WIFI_MODE RTW_MODE_STA // Стартовый режим 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_AP_STATIONS 3 // Max number of STAs, should be 1..3, default is 3
#define DEF_WIFI_COUNTRY RTW_COUNTRY_RU #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_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_BGN RTW_NETWORK_BGN // rtw_network_mode_t
#define DEF_WIFI_ST_SLEEP 0 // 0 - none, 1 - on #define DEF_WIFI_ST_SLEEP 0 // 0 - none, 1 - on
//#define USE_NETBIOS 3 // 0 - off, 1 - ST, 2 - AP, 3 - AP+ST
#define DEF_LOAD_CFG ( 0 \ /* Опции загрузки конфигов по старту */
| BID_WIFI_AP_CFG \ //#define DEF_LOAD_CFG 0 // старт в назначенном конфигами режиме по умолчанию
| BID_WIFI_ST_CFG \ //#define DEF_LOAD_CFG BID_ALL_WIFI_CFG // старт в назначенном конфигами режиме по умолчанию, с загрузками последних конфигураций ST и AP
| BID_AP_DHCP_CFG \ #define DEF_LOAD_CFG (BID_ALL_WIFI_CFG | BID_WIFI_CFG) // старт в записанном режиме
| BID_ST_DHCP_CFG )//\
// | BID_WIFI_CFG \ /* Опции разрешения записи конфигов по упешному соединению или выполнению операции установок режимов WiFi без ошибок */
//) #define DEF_SAVE_CFG (BID_ALL_WIFI_CFG | BID_WIFI_CFG) // сохранение по успешному соединению/выполненю для всех конфигов:
#define DEF_SAVE_CFG ( 0 \ // (для ST или AP пишутся раздельно) с проверкой на изменения
| BID_WIFI_AP_CFG \
| BID_WIFI_ST_CFG \
| BID_AP_DHCP_CFG \
| BID_ST_DHCP_CFG \
| BID_WIFI_CFG \
)
//==== Interface 0 - wlan0 = AP =========== //==== Interface 0 - wlan0 = AP ===========
#define DEF_AP_SSID "RTL871X" #define DEF_AP_SSID "RTL871X"
#define DEF_AP_PASSWORD "0123456789" #define DEF_AP_PASSWORD "0123456789"
/* RTW_SECURITY_OPEN - Open Security /* Варианты типов Security для AP:
RTW_SECURITY_OPEN - Open Security
RTW_SECURITY_WPA_TKIP_PSK - WPA Security RTW_SECURITY_WPA_TKIP_PSK - WPA Security
RTW_SECURITY_WPA2_AES_PSK - WPA2 Security using AES cipher RTW_SECURITY_WPA2_AES_PSK - WPA2 Security using AES cipher
RTW_SECURITY_WPA2_MIXED_PSK - WPA2 Security using AES and/or TKIP ciphers RTW_SECURITY_WPA2_MIXED_PSK - WPA2 Security using AES and/or TKIP ciphers */
WEP security is NOT IMPLEMENTED. It is NOT SECURE! */ #define DEF_AP_SECURITY RTW_SECURITY_WPA2_AES_PSK // WEP security is NOT IMPLEMENTED. It is NOT SECURE!
#define DEF_AP_SECURITY RTW_SECURITY_WPA2_AES_PSK #define DEF_AP_BEACON 100 // 100...6000 ms
#define DEF_AP_BEACON 100 // 100...6000 ms #define DEF_AP_CHANNEL 1 // 1..14
#define DEF_AP_CHANNEL 1 // 1..14 #define DEF_AP_CHANNEL 1 // 1..14
#define DEF_AP_CHANNEL 1 // 1..14 #define DEF_AP_DHCP_MODE 1 // =0 dhcp off, =1 - dhcp on
#define DEF_AP_DHCP_MODE 1 // =0 dhcp off, =1 - dhcp on
#define DEF_AP_IP IP4ADDR(192,168,4,1) #define DEF_AP_IP IP4ADDR(192,168,4,1)
#define DEF_AP_MSK IP4ADDR(255,255,255,0) #define DEF_AP_MSK IP4ADDR(255,255,255,0)
#define DEF_AP_GW IP4ADDR(192,168,4,1) #define DEF_AP_GW IP4ADDR(192,168,4,1)
#define DEF_AP_DHCP_START 2 #define DEF_AP_DHCP_START 2 // DHCP ip start xx.xx.xx.nn
#define DEF_AP_DHCP_STOP 15 #define DEF_AP_DHCP_STOP 15 // DHCP ip stop xx.xx.xx.nn
//==== Interface 1 - wlan1 = STA ========== //==== Interface 1 - wlan1 = STA ==========
#define DEF_ST_SSID "HOMEAP" #define DEF_ST_SSID "HOMEAP" // Имя SSID AP (роутера) для присоединения по умолчанию (первый старт)
#define DEF_ST_PASSWORD "0123456789" #define DEF_ST_PASSWORD "0123456789" // Пароль AP (роутера) для присоединения по умолчанию (первый старт)
#define DEF_ST_SECURITY RTW_SECURITY_WPA_WPA2_MIXED #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, #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. // station will connect to the router with both ssid[] and bssid[] matched.
#define DEF_ST_CHANNEL 1 // 1..14 #define DEF_ST_CHANNEL 1 // 1..14
#define DEF_ST_AUTORECONNECT 1 // 0 - none, 1..254 - count, 255 - all #define DEF_ST_AUTORECONNECT 1 // 0 - none, 1..254 - count, 255 - all
#define DEF_ST_RECONNECT_PAUSE 1 // 5 sec #define DEF_ST_RECONNECT_PAUSE 1 // 5 sec
#define DEF_ST_DHCP_MODE 1 // =0 dhcp off, =1 - dhcp on, =2 Static ip, =3 - auto #define DEF_ST_DHCP_MODE 1 // =0 dhcp off,
// =1 - dhcp on, - динамический ip
// =2 Static ip, - fixed ip
// =3 - auto fix - старт в режиме "dhcp on", после получения ip - фиксация и переключение в режим рестартов со "Static ip"
#define DEF_ST_IP IP4ADDR(192,168,1,100) #define DEF_ST_IP IP4ADDR(192,168,1,100)
#define DEF_ST_MSK IP4ADDR(255,255,255,0) #define DEF_ST_MSK IP4ADDR(255,255,255,0)
#define DEF_ST_GW IP4ADDR(192,168,1,1) #define DEF_ST_GW IP4ADDR(192,168,1,1)
//==== Interface 2 - eth0 ================= //==== Interface 2 - eth0 =================
#define DEF_EH_DHCP_MODE 1 // =0 dhcp off, =1 - dhcp on #define DEF_EH_DHCP_MODE 1 // =0 dhcp off, =1 - dhcp on
#define DEF_EH_IP IP4ADDR(192,168,7,200) #define DEF_EH_IP IP4ADDR(192,168,7,200)
#define DEF_EH_MSK IP4ADDR(255,255,255,0) #define DEF_EH_MSK IP4ADDR(255,255,255,0)
#define DEF_EH_GW IP4ADDR(192,168,7,1) #define DEF_EH_GW IP4ADDR(192,168,7,1)

View file

@ -212,7 +212,7 @@ LOCAL void fATSF(int argc, char *argv[])
uint64_t tsf = get_tsf(); uint64_t tsf = get_tsf();
printf("\nTSF: %08x%08x\n", (uint32_t)(tsf>>32), (uint32_t)(tsf)); printf("\nTSF: %08x%08x\n", (uint32_t)(tsf>>32), (uint32_t)(tsf));
} }
#if 0
/* -------- WiFi Scan ------------------------------- */ /* -------- WiFi Scan ------------------------------- */
volatile uint8_t scan_end; volatile uint8_t scan_end;
/* -------- WiFi Scan ------------------------------- */ /* -------- WiFi Scan ------------------------------- */
@ -245,8 +245,11 @@ LOCAL rtw_result_t _scan_result_handler( rtw_scan_handler_result_t* malloced_sca
} }
/* -------- WiFi Scan ------------------------------- */ /* -------- WiFi Scan ------------------------------- */
#define scan_channels 14 #define scan_channels 14
#endif
void api_wifi_scan(void);
LOCAL void fATSN(int argc, char *argv[]) LOCAL void fATSN(int argc, char *argv[])
{ {
#if 0
int i; int i;
u8 *channel_list = (u8*)pvPortMalloc(scan_channels*2); u8 *channel_list = (u8*)pvPortMalloc(scan_channels*2);
if(channel_list) { if(channel_list) {
@ -271,6 +274,9 @@ LOCAL void fATSN(int argc, char *argv[])
} else { } else {
printf("ERROR: Can't malloc memory for channel list\n"); printf("ERROR: Can't malloc memory for channel list\n");
}; };
#else
api_wifi_scan();
#endif
} }
#if defined(CONFIG_ENABLE_WPS_AP) && CONFIG_ENABLE_WPS_AP #if defined(CONFIG_ENABLE_WPS_AP) && CONFIG_ENABLE_WPS_AP

View file

@ -114,6 +114,7 @@ SRC_C += sdk/component/common/api/wifi/wifi_simple_config.c
SRC_C += sdk/component/common/api/wifi/wifi_util.c SRC_C += sdk/component/common/api/wifi/wifi_util.c
SRC_C += sdk/component/common/api/lwip_netconf.c SRC_C += sdk/component/common/api/lwip_netconf.c
SRC_C += sdk/component/common/api/wifi_api.c SRC_C += sdk/component/common/api/wifi_api.c
SRC_C += sdk/component/common/api/wifi_api_scan.c
#network - app #network - app
#SRC_C += sdk/component/common/utilities/ssl_client.c #SRC_C += sdk/component/common/utilities/ssl_client.c