Function esp_idf_sys::esp_mesh_set_network_duty_cycle

source ยท
pub unsafe extern "C" fn esp_mesh_set_network_duty_cycle(
    nwk_duty: c_int,
    duration_mins: c_int,
    applied_rule: c_int,
) -> esp_err_t
Expand description

@brief Set the network duty cycle, duration and rule - The range of nwk_duty values is 1 to 100. The default value is 10. - nwk_duty is the network duty cycle the entire network or the up-link path will use. A device that successfully sets the nwk_duty is known as a NWK-DUTY-MASTER. - duration_mins specifies how long the specified nwk_duty will be used. Once duration_mins expires, the root will take over as the NWK-DUTY-MASTER. If an existing NWK-DUTY-MASTER leaves the network, the root will take over as the NWK-DUTY-MASTER again. - duration_mins = (-1) represents nwk_duty will be used until a new NWK-DUTY-MASTER with a different nwk_duty appears. - Only the root can set duration_mins to (-1). - If applied_rule is set to MESH_PS_NETWORK_DUTY_APPLIED_ENTIRE, the nwk_duty will be used by the entire network. - If applied_rule is set to MESH_PS_NETWORK_DUTY_APPLIED_UPLINK, the nwk_duty will only be used by the up-link path nodes. - The root does not accept MESH_PS_NETWORK_DUTY_APPLIED_UPLINK. - A nwk_duty with duration_mins(-1) set by the root is the default network duty cycle used by the entire network.

@attention This API can be called at any time after mesh is started. - In self-organized network, if this API is called before mesh is started in all devices, (1)nwk_duty shall be set to the same value for all devices; (2)duration_mins shall be set to (-1); (3)applied_rule shall be set to MESH_PS_NETWORK_DUTY_APPLIED_ENTIRE; after the voted root appears, the root will become the NWK-DUTY-MASTER and broadcast the nwk_duty and its identity of NWK-DUTY-MASTER. - If the root is specified (FIXED-ROOT), call this API in the root to provide a default nwk_duty for the entire network. - After joins the network, any device can call this API to change the nwk_duty, duration_mins or applied_rule.

@param[in] nwk_duty network duty cycle @param[in] duration_mins duration (unit: minutes) @param[in] applied_rule only support MESH_PS_NETWORK_DUTY_APPLIED_ENTIRE

@return

  • ESP_OK
  • ESP_FAIL