Receive a packet targeted to self over the mesh network @attention Mesh RX queue should be checked regularly to avoid running out of memory. - Use esp_mesh_get_rx_pending() to check the number of packets available in the queue waiting to be received by applications. flag could be MESH_DATA_FROMDS or MESH_DATA_TODS.
pointer to the received mesh packet - Field proto is the data protocol in use. Should follow it to parse the received data. - Field tos is the transmission tos (type of service) in use.
timeout_ms
int
wait time if a packet isn't immediately available (0:no wait, portMAX_DELAY:wait forever)
flag
int*
bitmap for data received - MESH_DATA_FROMDS represents data from external IP network - MESH_DATA_TODS represents data directed upward within the mesh network
Send a packet over the mesh network - Send a packet to any device in the mesh network. - Send a packet to external IP network. @attention This API is not reentrant. Generally, we suggest esp_mesh_recv_toDS() is called after a connection with IP network is created. Thus data outgoing to external IP network via socket is just from reading esp_mesh_recv_toDS() which avoids unnecessary memory copy.
Receive a packet targeted to external IP network - Root uses this API to receive packets destined to external IP network - Root forwards the received packets to the final destination via socket. - If no socket connection is ready to send out the received packets and this esp_mesh_recv_toDS() hasn't been called by applications, packets from the whole mesh network will be pending in toDS queue. Use esp_mesh_get_rx_pending() to check the number of packets available in the queue waiting to be received by applications in case of running out of memory in the root. Using esp_mesh_set_xon_qsize() users may configure the RX queue size, default:32. If this size is too large, and esp_mesh_recv_toDS() isn't called in time, there is a risk that a great deal of memory is occupied by the pending packets. If this size is too small, it will impact the efficiency on upstream. How to decide this value depends on the specific application scenarios. @attention This API is only called by the root. flag could be MESH_DATA_TODS.