pub unsafe extern "C" fn esp_mesh_recv_toDS(
    from: *mut mesh_addr_t,
    to: *mut mesh_addr_t,
    data: *mut mesh_data_t,
    timeout_ms: c_int,
    flag: *mut c_int,
    opt: *mut mesh_opt_t,
    opt_count: c_int
) -> esp_err_t
Expand description

@brief 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.

@param[out] from the address of the original source of the packet @param[out] to the address contains remote IP address and port (IPv4:PORT) @param[out] data pointer to the received packet - Contain the protocol and applications should follow it to parse the data. @param[in] timeout_ms wait time if a packet isn’t immediately available (0:no wait, portMAX_DELAY:wait forever) @param[out] flag bitmap for data received - MESH_DATA_TODS represents the received data target to external IP network. Root shall forward this data to external IP network via the association with router.

        flag could be MESH_DATA_TODS.

@param[out] opt options desired to receive @param[in] opt_count option count desired to receive

@return

  • ESP_OK
  • ESP_ERR_MESH_ARGUMENT
  • ESP_ERR_MESH_NOT_START
  • ESP_ERR_MESH_TIMEOUT
  • ESP_ERR_MESH_DISCARD
  • ESP_ERR_MESH_RECV_RELEASE