diff --git a/components/esp_wifi/include/esp_mesh.h b/components/esp_wifi/include/esp_mesh.h index ab8f8a4c86..f146b5e730 100644 --- a/components/esp_wifi/include/esp_mesh.h +++ b/components/esp_wifi/include/esp_mesh.h @@ -505,8 +505,13 @@ typedef struct { * @brief Mesh softAP configuration */ typedef struct { - uint8_t password[64]; /**< mesh softAP password */ - uint8_t max_connection; /**< max number of stations allowed to connect in, max 10 */ + uint8_t password[64]; /**< mesh softAP password */ + /** + * max number of stations allowed to connect in, default 6, max 10 + * = max_connection + nonmesh_max_connection + */ + uint8_t max_connection; /**< max mesh connections */ + uint8_t nonmesh_max_connection; /**< max non-mesh connections */ } mesh_ap_cfg_t; /** @@ -947,7 +952,8 @@ esp_err_t esp_mesh_set_ap_authmode(wifi_auth_mode_t authmode); wifi_auth_mode_t esp_mesh_get_ap_authmode(void); /** - * @brief Set mesh softAP max connection value + * @brief Set mesh max connection value + * - Set mesh softAP max connection = mesh max connection + non-mesh max connection * * @attention This API shall be called before mesh is started. * @@ -960,12 +966,19 @@ wifi_auth_mode_t esp_mesh_get_ap_authmode(void); esp_err_t esp_mesh_set_ap_connections(int connections); /** - * @brief Get mesh softAP max connection configuration + * @brief Get mesh max connection configuration * - * @return the number of max connections + * @return the number of mesh max connections */ int esp_mesh_get_ap_connections(void); +/** + * @brief Get non-mesh max connection configuration + * + * @return the number of non-mesh max connections + */ +int esp_mesh_get_non_mesh_connections(void); + /** * @brief Get current layer value over the mesh network * diff --git a/components/esp_wifi/include/esp_wifi_types.h b/components/esp_wifi/include/esp_wifi_types.h index 03b8ae6a75..503e8d7bb0 100644 --- a/components/esp_wifi/include/esp_wifi_types.h +++ b/components/esp_wifi/include/esp_wifi_types.h @@ -272,7 +272,8 @@ typedef struct { uint32_t phy_11g:1; /**< bit: 1 flag to identify if 11g mode is enabled or not */ uint32_t phy_11n:1; /**< bit: 2 flag to identify if 11n mode is enabled or not */ uint32_t phy_lr:1; /**< bit: 3 flag to identify if low rate is enabled or not */ - uint32_t reserved:28; /**< bit: 4..31 reserved */ + uint32_t is_mesh_child:1;/**< bit: 4 flag to identify mesh child */ + uint32_t reserved:27; /**< bit: 5..31 reserved */ } wifi_sta_info_t; #define ESP_WIFI_MAX_CONN_NUM (10) /**< max number of stations which can connect to ESP32 soft-AP */ @@ -669,12 +670,14 @@ typedef struct { typedef struct { uint8_t mac[6]; /**< MAC address of the station connected to ESP32 soft-AP */ uint8_t aid; /**< the aid that ESP32 soft-AP gives to the station connected to */ + bool is_mesh_child; /**< flag to identify mesh child */ } wifi_event_ap_staconnected_t; /** Argument structure for WIFI_EVENT_AP_STADISCONNECTED event */ typedef struct { uint8_t mac[6]; /**< MAC address of the station disconnects to ESP32 soft-AP */ uint8_t aid; /**< the aid that ESP32 soft-AP gave to the station disconnects to */ + bool is_mesh_child; /**< flag to identify mesh child */ } wifi_event_ap_stadisconnected_t; /** Argument structure for WIFI_EVENT_AP_PROBEREQRECVED event */ diff --git a/components/esp_wifi/lib b/components/esp_wifi/lib index 58e915cb63..279d472db0 160000 --- a/components/esp_wifi/lib +++ b/components/esp_wifi/lib @@ -1 +1 @@ -Subproject commit 58e915cb636f3beff824a855ca95668ab6539b8b +Subproject commit 279d472db0c4cbd73219fd88065a777bfb1499d2 diff --git a/examples/mesh/internal_communication/main/Kconfig.projbuild b/examples/mesh/internal_communication/main/Kconfig.projbuild index c8aa139a17..b3c530c041 100644 --- a/examples/mesh/internal_communication/main/Kconfig.projbuild +++ b/examples/mesh/internal_communication/main/Kconfig.projbuild @@ -154,7 +154,14 @@ menu "Example Configuration" range 1 10 default 6 help - The number of stations allowed to connect in. + The number of mesh stations allowed to connect in. + + config MESH_NON_MESH_AP_CONNECTIONS + int "Mesh Non Mesh AP Connections" + range 0 9 + default 0 + help + The number of non-mesh stations allowed to connect in. config MESH_ROUTE_TABLE_SIZE int "Mesh Routing Table Size" diff --git a/examples/mesh/internal_communication/main/mesh_main.c b/examples/mesh/internal_communication/main/mesh_main.c index 595ab3712b..26f5a3ba7a 100644 --- a/examples/mesh/internal_communication/main/mesh_main.c +++ b/examples/mesh/internal_communication/main/mesh_main.c @@ -432,6 +432,7 @@ void app_main(void) /* mesh softAP */ ESP_ERROR_CHECK(esp_mesh_set_ap_authmode(CONFIG_MESH_AP_AUTHMODE)); cfg.mesh_ap.max_connection = CONFIG_MESH_AP_CONNECTIONS; + cfg.mesh_ap.nonmesh_max_connection = CONFIG_MESH_NON_MESH_AP_CONNECTIONS; memcpy((uint8_t *) &cfg.mesh_ap.password, CONFIG_MESH_AP_PASSWD, strlen(CONFIG_MESH_AP_PASSWD)); ESP_ERROR_CHECK(esp_mesh_set_config(&cfg)); diff --git a/examples/mesh/ip_internal_network/main/Kconfig.projbuild b/examples/mesh/ip_internal_network/main/Kconfig.projbuild index d4aec56eea..28708ae787 100644 --- a/examples/mesh/ip_internal_network/main/Kconfig.projbuild +++ b/examples/mesh/ip_internal_network/main/Kconfig.projbuild @@ -55,7 +55,14 @@ menu "Example Configuration" range 1 10 default 6 help - The number of stations allowed to connect in. + The number of mesh stations allowed to connect in. + + config MESH_NON_MESH_AP_CONNECTIONS + int "Mesh Non Mesh AP Connections" + range 0 9 + default 0 + help + The number of non-mesh stations allowed to connect in. config MESH_MAX_LAYER int "Mesh Max Layer" diff --git a/examples/mesh/ip_internal_network/main/mesh_main.c b/examples/mesh/ip_internal_network/main/mesh_main.c index c5ba9b7768..72e4a82d4c 100644 --- a/examples/mesh/ip_internal_network/main/mesh_main.c +++ b/examples/mesh/ip_internal_network/main/mesh_main.c @@ -416,6 +416,7 @@ void app_main(void) /* mesh softAP */ ESP_ERROR_CHECK(esp_mesh_set_ap_authmode(CONFIG_MESH_AP_AUTHMODE)); cfg.mesh_ap.max_connection = CONFIG_MESH_AP_CONNECTIONS; + cfg.mesh_ap.nonmesh_max_connection = CONFIG_MESH_NON_MESH_AP_CONNECTIONS; memcpy((uint8_t *) &cfg.mesh_ap.password, CONFIG_MESH_AP_PASSWD, strlen(CONFIG_MESH_AP_PASSWD)); ESP_ERROR_CHECK(esp_mesh_set_config(&cfg)); diff --git a/examples/mesh/manual_networking/main/Kconfig.projbuild b/examples/mesh/manual_networking/main/Kconfig.projbuild index 0dbac81842..aa4673773e 100644 --- a/examples/mesh/manual_networking/main/Kconfig.projbuild +++ b/examples/mesh/manual_networking/main/Kconfig.projbuild @@ -67,7 +67,14 @@ menu "Example Configuration" range 1 10 default 6 help - The number of stations allowed to connect in. + The number of mesh stations allowed to connect in. + + config MESH_NON_MESH_AP_CONNECTIONS + int "Mesh Non Mesh AP Connections" + range 0 9 + default 0 + help + The number of non-mesh stations allowed to connect in. config MESH_MAX_LAYER int "Mesh Max Layer" diff --git a/examples/mesh/manual_networking/main/mesh_main.c b/examples/mesh/manual_networking/main/mesh_main.c index 6bf136e044..3cbfdad6c8 100644 --- a/examples/mesh/manual_networking/main/mesh_main.c +++ b/examples/mesh/manual_networking/main/mesh_main.c @@ -322,6 +322,7 @@ void app_main(void) /* mesh softAP */ ESP_ERROR_CHECK(esp_mesh_set_ap_authmode(CONFIG_MESH_AP_AUTHMODE)); cfg.mesh_ap.max_connection = CONFIG_MESH_AP_CONNECTIONS; + cfg.mesh_ap.nonmesh_max_connection = CONFIG_MESH_NON_MESH_AP_CONNECTIONS; memcpy((uint8_t *) &cfg.mesh_ap.password, CONFIG_MESH_AP_PASSWD, strlen(CONFIG_MESH_AP_PASSWD)); ESP_ERROR_CHECK(esp_mesh_set_config(&cfg));