mirror of
				https://github.com/espressif/esp-idf.git
				synced 2025-10-31 04:59:55 +00:00 
			
		
		
		
	esp_wifi_mesh: add non mesh connections access
This commit is contained in:
		| @@ -506,7 +506,12 @@ typedef struct { | |||||||
|  */ |  */ | ||||||
| typedef struct { | typedef struct { | ||||||
|     uint8_t password[64];              /**< mesh softAP password */ |     uint8_t password[64];              /**< mesh softAP password */ | ||||||
|     uint8_t max_connection;    /**< max number of stations allowed to connect in, max 10 */ |     /** | ||||||
|  |      * 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; | } 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); | 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. |  * @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); | 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); | 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 |  * @brief      Get current layer value over the mesh network | ||||||
|  * |  * | ||||||
|   | |||||||
| @@ -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_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_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 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; | } wifi_sta_info_t; | ||||||
|  |  | ||||||
| #define ESP_WIFI_MAX_CONN_NUM  (10)       /**< max number of stations which can connect to ESP32 soft-AP */ | #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 { | typedef struct { | ||||||
|     uint8_t mac[6];           /**< MAC address of the station connected to ESP32 soft-AP */ |     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  */ |     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; | } wifi_event_ap_staconnected_t; | ||||||
|  |  | ||||||
| /** Argument structure for WIFI_EVENT_AP_STADISCONNECTED event */ | /** Argument structure for WIFI_EVENT_AP_STADISCONNECTED event */ | ||||||
| typedef struct { | typedef struct { | ||||||
|     uint8_t mac[6];           /**< MAC address of the station disconnects to ESP32 soft-AP */ |     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  */ |     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; | } wifi_event_ap_stadisconnected_t; | ||||||
|  |  | ||||||
| /** Argument structure for WIFI_EVENT_AP_PROBEREQRECVED event */ | /** Argument structure for WIFI_EVENT_AP_PROBEREQRECVED event */ | ||||||
|   | |||||||
 Submodule components/esp_wifi/lib updated: 58e915cb63...279d472db0
									
								
							| @@ -154,7 +154,14 @@ menu "Example Configuration" | |||||||
|         range 1 10 |         range 1 10 | ||||||
|         default 6 |         default 6 | ||||||
|         help |         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 |     config MESH_ROUTE_TABLE_SIZE | ||||||
|         int "Mesh Routing Table Size" |         int "Mesh Routing Table Size" | ||||||
|   | |||||||
| @@ -432,6 +432,7 @@ void app_main(void) | |||||||
|     /* mesh softAP */ |     /* mesh softAP */ | ||||||
|     ESP_ERROR_CHECK(esp_mesh_set_ap_authmode(CONFIG_MESH_AP_AUTHMODE)); |     ESP_ERROR_CHECK(esp_mesh_set_ap_authmode(CONFIG_MESH_AP_AUTHMODE)); | ||||||
|     cfg.mesh_ap.max_connection = CONFIG_MESH_AP_CONNECTIONS; |     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, |     memcpy((uint8_t *) &cfg.mesh_ap.password, CONFIG_MESH_AP_PASSWD, | ||||||
|            strlen(CONFIG_MESH_AP_PASSWD)); |            strlen(CONFIG_MESH_AP_PASSWD)); | ||||||
|     ESP_ERROR_CHECK(esp_mesh_set_config(&cfg)); |     ESP_ERROR_CHECK(esp_mesh_set_config(&cfg)); | ||||||
|   | |||||||
| @@ -55,7 +55,14 @@ menu "Example Configuration" | |||||||
|         range 1 10 |         range 1 10 | ||||||
|         default 6 |         default 6 | ||||||
|         help |         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 |     config MESH_MAX_LAYER | ||||||
|         int "Mesh Max Layer" |         int "Mesh Max Layer" | ||||||
|   | |||||||
| @@ -416,6 +416,7 @@ void app_main(void) | |||||||
|     /* mesh softAP */ |     /* mesh softAP */ | ||||||
|     ESP_ERROR_CHECK(esp_mesh_set_ap_authmode(CONFIG_MESH_AP_AUTHMODE)); |     ESP_ERROR_CHECK(esp_mesh_set_ap_authmode(CONFIG_MESH_AP_AUTHMODE)); | ||||||
|     cfg.mesh_ap.max_connection = CONFIG_MESH_AP_CONNECTIONS; |     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, |     memcpy((uint8_t *) &cfg.mesh_ap.password, CONFIG_MESH_AP_PASSWD, | ||||||
|            strlen(CONFIG_MESH_AP_PASSWD)); |            strlen(CONFIG_MESH_AP_PASSWD)); | ||||||
|     ESP_ERROR_CHECK(esp_mesh_set_config(&cfg)); |     ESP_ERROR_CHECK(esp_mesh_set_config(&cfg)); | ||||||
|   | |||||||
| @@ -67,7 +67,14 @@ menu "Example Configuration" | |||||||
|         range 1 10 |         range 1 10 | ||||||
|         default 6 |         default 6 | ||||||
|         help |         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 |     config MESH_MAX_LAYER | ||||||
|         int "Mesh Max Layer" |         int "Mesh Max Layer" | ||||||
|   | |||||||
| @@ -322,6 +322,7 @@ void app_main(void) | |||||||
|     /* mesh softAP */ |     /* mesh softAP */ | ||||||
|     ESP_ERROR_CHECK(esp_mesh_set_ap_authmode(CONFIG_MESH_AP_AUTHMODE)); |     ESP_ERROR_CHECK(esp_mesh_set_ap_authmode(CONFIG_MESH_AP_AUTHMODE)); | ||||||
|     cfg.mesh_ap.max_connection = CONFIG_MESH_AP_CONNECTIONS; |     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, |     memcpy((uint8_t *) &cfg.mesh_ap.password, CONFIG_MESH_AP_PASSWD, | ||||||
|            strlen(CONFIG_MESH_AP_PASSWD)); |            strlen(CONFIG_MESH_AP_PASSWD)); | ||||||
|     ESP_ERROR_CHECK(esp_mesh_set_config(&cfg)); |     ESP_ERROR_CHECK(esp_mesh_set_config(&cfg)); | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user
	 shenjun
					shenjun