mirror of
https://github.com/espressif/esp-nimble.git
synced 2026-06-06 05:14:45 +00:00
mesh: Add macros to encoded model publication periods
These macros are helpful for using the configuration client API with periodic model publication.
This commit is contained in:
@@ -72,6 +72,48 @@ int bt_mesh_cfg_mod_app_bind_vnd(u16_t net_idx, u16_t addr, u16_t elem_addr,
|
||||
u16_t mod_app_idx, u16_t mod_id, u16_t cid,
|
||||
u8_t *status);
|
||||
|
||||
/** @def BT_MESH_PUB_PERIOD_100MS
|
||||
*
|
||||
* @brief Helper macro to encode model publication period in units of 100ms
|
||||
*
|
||||
* @param steps Number of 100ms steps.
|
||||
*
|
||||
* @return Encoded value that can be assigned to bt_mesh_cfg_mod_pub.period
|
||||
*/
|
||||
#define BT_MESH_PUB_PERIOD_100MS(steps) ((steps) & BIT_MASK(6))
|
||||
|
||||
/** @def BT_MESH_PUB_PERIOD_SEC
|
||||
*
|
||||
* @brief Helper macro to encode model publication period in units of 1 second
|
||||
*
|
||||
* @param steps Number of 1 second steps.
|
||||
*
|
||||
* @return Encoded value that can be assigned to bt_mesh_cfg_mod_pub.period
|
||||
*/
|
||||
#define BT_MESH_PUB_PERIOD_SEC(steps) (((steps) & BIT_MASK(6)) | (1 << 6))
|
||||
|
||||
/** @def BT_MESH_PUB_PERIOD_10SEC
|
||||
*
|
||||
* @brief Helper macro to encode model publication period in units of 10
|
||||
* seconds
|
||||
*
|
||||
* @param steps Number of 10 second steps.
|
||||
*
|
||||
* @return Encoded value that can be assigned to bt_mesh_cfg_mod_pub.period
|
||||
*/
|
||||
#define BT_MESH_PUB_PERIOD_10SEC(steps) (((steps) & BIT_MASK(6)) | (2 << 6))
|
||||
|
||||
/** @def BT_MESH_PUB_PERIOD_10MIN
|
||||
*
|
||||
* @brief Helper macro to encode model publication period in units of 10
|
||||
* minutes
|
||||
*
|
||||
* @param steps Number of 10 minute steps.
|
||||
*
|
||||
* @return Encoded value that can be assigned to bt_mesh_cfg_mod_pub.period
|
||||
*/
|
||||
#define BT_MESH_PUB_PERIOD_10MIN(steps) (((steps) & BIT_MASK(6)) | (3 << 6))
|
||||
|
||||
struct bt_mesh_cfg_mod_pub {
|
||||
u16_t addr;
|
||||
u16_t app_idx;
|
||||
|
||||
Reference in New Issue
Block a user