MESH_EVENT_ROUTING_TABLE_REMOVE, /**< routing table is changed by removing leave children */
MESH_EVENT_PARENT_CONNECTED, /**< parent is connected on station interface */
MESH_EVENT_PARENT_DISCONNECTED, /**< parent is disconnected on station interface */
- MESH_EVENT_NO_PARNET_FOUND, /**< no parent found */
+ MESH_EVENT_NO_PARENT_FOUND, /**< no parent found */
MESH_EVENT_LAYER_CHANGE, /**< layer changes over the mesh network */
MESH_EVENT_TODS_STATE, /**< state represents if root is able to access external IP network */
MESH_EVENT_VOTE_STARTED, /**< the process of voting a new root is started either by children or by root */
esp_err_t esp_mesh_get_id(mesh_addr_t *id);
/**
- * @brief set device type over the mesh network(Unimplemented)
+ * @brief specify device type over the mesh network
+ * - MESH_ROOT: designates the root node for a mesh network
+ * - MESH_LEAF: designates a device as a standalone Wi-Fi station
*
- * @param type device type
+ * @attention This API shall be called before esp_mesh_start().
+ *
+ * @param type device type (only support MESH_ROOT, MESH_LEAF)
*
* @return
* - ESP_OK
esp_err_t esp_mesh_set_type(mesh_type_t type);
/**
- * @brief get device type over mesh network
- *
- * @attention This API shall be called after having received the event MESH_EVENT_PARENT_CONNECTED.
+ * @brief get device type over the mesh network
*
* @return mesh type
*
mesh_type_t esp_mesh_get_type(void);
/**
- * @brief set max layer configuration(max:15, default:15)
+ * @brief set max layer configuration(max:25, default:25)
*
* @attention This API shall be called before esp_mesh_start().
*
*/
esp_err_t esp_mesh_flush_upstream_packets(void);
+/**
+ * @brief get the number of nodes in the subnet of a specific child
+ *
+ * @param child_mac an associated child address of this device
+ * @param nodes_num pointer to the number of nodes in the subnet of a specific child
+ *
+ * @return
+ * - ESP_OK
+ * - ESP_ERR_MESH_NOT_START
+ * - ESP_ERR_MESH_ARGUMENT
+ */
+esp_err_t esp_mesh_get_subnet_nodes_num(const mesh_addr_t *child_mac, int *nodes_num);
+
+/**
+ * @brief get nodes in the subnet of a specific child
+ *
+ * @param child_mac an associated child address of this device
+ * @param nodes pointer to nodes in the subnet of a specific child
+ * @param nodes_num the number of nodes in the subnet of a specific child
+ *
+ * @return
+ * - ESP_OK
+ * - ESP_ERR_MESH_NOT_START
+ * - ESP_ERR_MESH_ARGUMENT
+ */
+esp_err_t esp_mesh_get_subnet_nodes_list(const mesh_addr_t *child_mac, mesh_addr_t *nodes, int nodes_num);
+
#ifdef __cplusplus
}
#endif
event.info.routing_table.rt_size_change,
event.info.routing_table.rt_size_new);
break;
- case MESH_EVENT_NO_PARNET_FOUND:
- ESP_LOGI(MESH_TAG, "<MESH_EVENT_NO_PARNET_FOUND>scan times:%d",
+ case MESH_EVENT_NO_PARENT_FOUND:
+ ESP_LOGI(MESH_TAG, "<MESH_EVENT_NO_PARENT_FOUND>scan times:%d",
event.info.no_parent.scan_times);
/* TODO handler for the failure */
break;
/* mesh initialization */
ESP_ERROR_CHECK(esp_mesh_init());
ESP_ERROR_CHECK(esp_mesh_set_max_layer(CONFIG_MESH_MAX_LAYER));
- ESP_ERROR_CHECK(esp_mesh_set_ap_authmode(CONFIG_MESH_AP_AUTHMODE));
ESP_ERROR_CHECK(esp_mesh_set_vote_percentage(1));
ESP_ERROR_CHECK(esp_mesh_set_ap_assoc_expire(10));
#ifdef MESH_FIX_ROOT
memcpy((uint8_t *) &cfg.router.password, CONFIG_MESH_ROUTER_PASSWD,
strlen(CONFIG_MESH_ROUTER_PASSWD));
/* mesh softAP */
+ ESP_ERROR_CHECK(esp_mesh_set_ap_authmode(CONFIG_MESH_AP_AUTHMODE));
cfg.mesh_ap.max_connection = CONFIG_MESH_AP_CONNECTIONS;
memcpy((uint8_t *) &cfg.mesh_ap.password, CONFIG_MESH_AP_PASSWD,
strlen(CONFIG_MESH_AP_PASSWD));
event.info.routing_table.rt_size_change,
event.info.routing_table.rt_size_new);
break;
- case MESH_EVENT_NO_PARNET_FOUND:
- ESP_LOGI(MESH_TAG, "<MESH_EVENT_NO_PARNET_FOUND>scan times:%d",
+ case MESH_EVENT_NO_PARENT_FOUND:
+ ESP_LOGI(MESH_TAG, "<MESH_EVENT_NO_PARENT_FOUND>scan times:%d",
event.info.no_parent.scan_times);
/* TODO handler for the failure */
break;