mirror of
https://github.com/RIOT-OS/RIOT.git
synced 2025-01-18 12:52:44 +01:00
Merge pull request #17415 from gschorcht/cpu/esp/wifi_ap_dynamic_ssid_option
cpu/esp: change dynamic SSID option handling
This commit is contained in:
commit
466fdf5114
@ -1401,11 +1401,11 @@ Furthermore, the following configuration parameters have to be defined:
|
||||
|
||||
<center>
|
||||
|
||||
Parameter | Default | Description
|
||||
:------------------|:--------------------------|:------------
|
||||
ESP_WIFI_SSID | "RIOT_AP" | SSID of the AP to be used.
|
||||
ESP_WIFI_PASS | - | Passphrase used for the AP as clear text (max. 64 chars).
|
||||
ESP_WIFI_STACKSIZE | #THREAD_STACKSIZE_DEFAULT | Stack size used for the WiFi netdev driver thread.
|
||||
Parameter | Default | Description
|
||||
:-------------------|:--------------------------|:------------
|
||||
#ESP_WIFI_SSID | "RIOT_AP" | SSID of the AP to be used.
|
||||
#ESP_WIFI_PASS | - | Passphrase used for the AP as clear text (max. 64 chars).
|
||||
#ESP_WIFI_STACKSIZE | #THREAD_STACKSIZE_DEFAULT | Stack size used for the WiFi netdev driver thread.
|
||||
|
||||
</center>
|
||||
|
||||
@ -1452,15 +1452,19 @@ following configuration parameters have to be defined:
|
||||
|
||||
<center>
|
||||
|
||||
Parameter | Default | Description
|
||||
:------------------|:----------|:------------
|
||||
ESP_WIFI_SSID | "RIOT_AP" | SSID of the AP to be used.
|
||||
ESP_WIFI_EAP_ID | none | Optional anonymous identity used in phase 1 (outer) EAP authentication. If it is not defined, the user name defined for phase 2 (inner) EAP authentication is used as identity in phase 1.
|
||||
ESP_WIFI_EAP_USER | none | User name used in phase 2 (inner) EAP authentication.
|
||||
ESP_WIFI_EAP_PASS | none | Password used in phase 2 (inner) EAP authentication.
|
||||
ESP_WIFI_STACKSIZE | #THREAD_STACKSIZE_DEFAULT | Stack size used for the WiFi netdev driver thread.
|
||||
Parameter | Default | Description
|
||||
:-------------------|:----------|:------------
|
||||
#ESP_WIFI_SSID | "RIOT_AP" | SSID of the AP to be used.
|
||||
ESP_WIFI_EAP_ID | none | Optional anonymous identity used in phase 1 (outer) EAP authentication.[1]
|
||||
ESP_WIFI_EAP_USER | none | User name used in phase 2 (inner) EAP authentication.
|
||||
ESP_WIFI_EAP_PASS | none | Password used in phase 2 (inner) EAP authentication.
|
||||
#ESP_WIFI_STACKSIZE | #THREAD_STACKSIZE_DEFAULT | Stack size used for the WiFi netdev driver thread.
|
||||
|
||||
</center>
|
||||
</center><br>
|
||||
|
||||
[1] If the optional anonymous identy `ESP_WIFI_EAP_ID` is not defined, the user
|
||||
name `ESP_WIFI_EAP_USER` defined for phase 2 (inner) EAP authentication is used
|
||||
as identity in phase 1.
|
||||
|
||||
These configuration parameter definitions, as well as enabling the `esp_wifi`
|
||||
module, can be done either in the makefile of the project or at make command
|
||||
@ -1499,14 +1503,20 @@ The following parameters can be configured:
|
||||
Parameter | Default | Description
|
||||
:-------------------------|:--------------------------|:-------------
|
||||
#ESP_WIFI_SSID | "RIOT_AP" | Static SSID definition for the SoftAP
|
||||
#ESP_WIFI_AP_PREFIX | "RIOT_AP_" | Optional prefix for dynamic SSID, if used, the node will create the SSID based on the prefix + mac address (e.g.: "RIOT_AP_aabbccddeeff"). This is disabled by default and `ESP_WIFI_SSID` is used, define this to enable the usage of the SSID prefix.
|
||||
#ESP_WIFI_PASS | none | The password for the WiFi SoftAP network interface. If no password is provided, the interface will be "open", otherwise it uses WPA2-PSK authentication mode.
|
||||
#ESP_WIFI_SSID_HIDDEN | 0 | Whether the SoftAP SSID should be hidden.
|
||||
#ESP_WIFI_PASS | none | The password for the WiFi SoftAP network interface.[1]
|
||||
#ESP_WIFI_SSID_DYNAMIC | 0 | Defines whether dynamic SSID is used for the SoftAP [2].
|
||||
#ESP_WIFI_SSID_HIDDEN | 0 | Defines whether the SoftAP SSID should be hidden.
|
||||
#ESP_WIFI_MAX_CONN | 4 | The maximum number of connections for the SoftAP.
|
||||
#ESP_WIFI_BEACON_INTERVAL | 100 | The beacon interval time in milliseconds for the SoftAP.
|
||||
#ESP_WIFI_STACKSIZE | #THREAD_STACKSIZE_DEFAULT | Stack size used for the WiFi netdev driver thread.
|
||||
|
||||
</center>
|
||||
</center><br>
|
||||
|
||||
[1] If no password is provided, the interface will be "open", otherwise it
|
||||
uses WPA2-PSK authentication mode.<br>
|
||||
[2] If #ESP_WIFI_SSID_DYNAMIC is set to 1, a dynamic SSID is generated for the
|
||||
SoftAP by extending the defined SSID (`ESP_WIFI_SSID`) with the MAC address
|
||||
of the SoftAP interface used, e.g.: `RIOT_AP_aabbccddeeff`
|
||||
|
||||
These configuration parameter definitions, as well as enabling the `esp_wifi_ap`
|
||||
module, can be done either in the makefile of the project or at make command
|
||||
@ -1514,7 +1524,7 @@ line, for example:
|
||||
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
USEMODULE=esp_wifi_ap \
|
||||
CFLAGS='-DESP_WIFI_SSID=\"MySSID\" -DESP_WIFI_PASS=\"MyPassphrase\" -DESP_WIFI_MAX_CONN=1 \
|
||||
CFLAGS='-DESP_WIFI_SSID=\"MySSID\" -DESP_WIFI_PASS=\"MyPassphrase\" -DESP_WIFI_MAX_CONN=1' \
|
||||
make -C examples/gnrc_networking BOARD=...
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
|
||||
|
@ -759,14 +759,20 @@ The following parameters can be configured:
|
||||
Parameter | Default | Description
|
||||
:-------------------------|:--------------------------|:-------------
|
||||
#ESP_WIFI_SSID | "RIOT_AP" | Static SSID definition for the SoftAP
|
||||
#ESP_WIFI_AP_PREFIX | "RIOT_AP_" | Optional prefix for dynamic SSID, if used, the node will create the SSID based on the prefix + mac address (e.g.: "RIOT_AP_aabbccddeeff"). This is disabled by default and `ESP_WIFI_SSID` is used, define this to enable the usage of the SSID prefix.
|
||||
#ESP_WIFI_PASS | none | The password for the WiFi SoftAP network interface. If no password is provided, the interface will be "open", otherwise it uses WPA2-PSK authentication mode.
|
||||
#ESP_WIFI_SSID_HIDDEN | 0 | Whether the SoftAP SSID should be hidden.
|
||||
#ESP_WIFI_PASS | none | The password for the WiFi SoftAP network interface.[1]
|
||||
#ESP_WIFI_SSID_DYNAMIC | 0 | Defines whether dynamic SSID is used for the SoftAP [2].
|
||||
#ESP_WIFI_SSID_HIDDEN | 0 | Defines whether the SoftAP SSID should be hidden.
|
||||
#ESP_WIFI_MAX_CONN | 4 | The maximum number of connections for the SoftAP.
|
||||
#ESP_WIFI_BEACON_INTERVAL | 100 | The beacon interval time in milliseconds for the SoftAP.
|
||||
#ESP_WIFI_STACKSIZE | #THREAD_STACKSIZE_DEFAULT | Stack size used for the WiFi netdev driver thread.
|
||||
|
||||
</center>
|
||||
</center><br>
|
||||
|
||||
[1] If no password is provided, the interface will be "open", otherwise it
|
||||
uses WPA2-PSK authentication mode.<br>
|
||||
[2] If #ESP_WIFI_SSID_DYNAMIC is set to 1, a dynamic SSID is generated for the
|
||||
SoftAP by extending the defined SSID (`ESP_WIFI_SSID`) with the MAC address
|
||||
of the SoftAP interface used, e.g.: `RIOT_AP_aabbccddeeff`
|
||||
|
||||
These configuration parameter definitions, as well as enabling the `esp_wifi_ap`
|
||||
module, can be done either in the makefile of the project or at make command
|
||||
@ -774,7 +780,7 @@ line, for example:
|
||||
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
USEMODULE=esp_wifi_ap \
|
||||
CFLAGS='-DESP_WIFI_SSID=\"MySSID\" -DESP_WIFI_PASS=\"MyPassphrase\" -DESP_WIFI_MAX_CONN=1 \
|
||||
CFLAGS='-DESP_WIFI_SSID=\"MySSID\" -DESP_WIFI_PASS=\"MyPassphrase\" -DESP_WIFI_MAX_CONN=1' \
|
||||
make -C examples/gnrc_networking BOARD=...
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
|
||||
|
@ -919,13 +919,13 @@ void esp_wifi_setup (esp_wifi_netdev_t* dev)
|
||||
}
|
||||
|
||||
#if defined(MCU_ESP8266) || defined(MODULE_ESP_WIFI_AP)
|
||||
#ifdef ESP_WIFI_AP_PREFIX
|
||||
#if IS_ACTIVE(ESP_WIFI_SSID_DYNAMIC)
|
||||
uint8_t mac[ETHERNET_ADDR_LEN];
|
||||
esp_wifi_get_mac(ESP_MAC_WIFI_SOFTAP, mac);
|
||||
sprintf((char*)wifi_config_ap.ap.ssid, "%s%02x%02x%02x%02x%02x%02x",
|
||||
ESP_WIFI_AP_PREFIX, mac[0], mac[1], mac[2], mac[3], mac[4], mac[5]);
|
||||
sprintf((char*)wifi_config_ap.ap.ssid, "%s_%02x%02x%02x%02x%02x%02x",
|
||||
ESP_WIFI_SSID, mac[0], mac[1], mac[2], mac[3], mac[4], mac[5]);
|
||||
wifi_config_ap.ap.ssid_len = strlen((char*)wifi_config_ap.ap.ssid);
|
||||
#endif /* ESP_WIFI_AP_PREFIX */
|
||||
#endif /* IS_ACTIVE(ESP_WIFI_SSID_DYNAMIC) */
|
||||
/* set the SoftAP configuration */
|
||||
result = esp_wifi_set_config(ESP_IF_WIFI_AP, &wifi_config_ap);
|
||||
if (result != ESP_OK) {
|
||||
|
@ -44,26 +44,30 @@
|
||||
/**
|
||||
* @brief SSID of the AP to be used.
|
||||
*/
|
||||
#if !defined(ESP_WIFI_SSID) && !defined(ESP_WIFI_AP_PREFIX)
|
||||
#ifndef ESP_WIFI_SSID
|
||||
#define ESP_WIFI_SSID "RIOT_AP"
|
||||
#endif
|
||||
|
||||
/**
|
||||
* @brief Prefix to be used as part of the SSID (e.g.: RIOT_AP_aabbccddeeff)
|
||||
*/
|
||||
#if !defined(ESP_WIFI_SSID) && !defined(ESP_WIFI_AP_PREFIX) || defined(DOXYGEN)
|
||||
#define ESP_WIFI_AP_PREFIX "RIOT_AP_"
|
||||
#endif
|
||||
|
||||
/**
|
||||
* @brief Passphrase used for the AP as clear text (max. 64 chars).
|
||||
*/
|
||||
#ifdef DOXYGEN
|
||||
#ifndef ESP_WIFI_PASS
|
||||
#define ESP_WIFI_PASS "ThisistheRIOTporttoESP"
|
||||
#endif
|
||||
|
||||
#if defined(MODULE_ESP_WIFI_AP) || defined(DOXYGEN)
|
||||
|
||||
/**
|
||||
* @brief Use dynamic SSID for the SoftAP
|
||||
*
|
||||
* If set to 1, the SSID for the SoftAP is generated dynamically by extending
|
||||
* the defined SSID (`ESP_WIFI_SSID`) with the MAC address of the SoftAP
|
||||
* interface used, e.g.: `RIOT_AP_aabbccddeeff`
|
||||
*/
|
||||
#ifndef ESP_WIFI_SSID_DYNAMIC
|
||||
#define ESP_WIFI_SSID_DYNAMIC 0
|
||||
#endif
|
||||
|
||||
/**
|
||||
* @brief Whether SoftAP SSID should be hidden.
|
||||
*/
|
||||
|
Loading…
Reference in New Issue
Block a user