2017-11-12 13:48:55 +02:00
|
|
|
/** @file
|
|
|
|
* @brief Bluetooth Mesh Configuration Client Model APIs.
|
|
|
|
*/
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Copyright (c) 2017 Intel Corporation
|
|
|
|
*
|
|
|
|
* SPDX-License-Identifier: Apache-2.0
|
|
|
|
*/
|
2018-09-14 10:43:44 -07:00
|
|
|
#ifndef ZEPHYR_INCLUDE_BLUETOOTH_MESH_CFG_CLI_H_
|
|
|
|
#define ZEPHYR_INCLUDE_BLUETOOTH_MESH_CFG_CLI_H_
|
2017-11-12 13:48:55 +02:00
|
|
|
|
|
|
|
/**
|
|
|
|
* @brief Bluetooth Mesh
|
|
|
|
* @defgroup bt_mesh_cfg_cli Bluetooth Mesh Configuration Client Model
|
|
|
|
* @ingroup bt_mesh
|
|
|
|
* @{
|
|
|
|
*/
|
|
|
|
|
|
|
|
/** Mesh Configuration Client Model Context */
|
2017-11-12 17:47:00 +02:00
|
|
|
struct bt_mesh_cfg_cli {
|
|
|
|
struct bt_mesh_model *model;
|
|
|
|
|
|
|
|
struct k_sem op_sync;
|
|
|
|
u32_t op_pending;
|
|
|
|
void *op_param;
|
2017-11-12 13:48:55 +02:00
|
|
|
};
|
|
|
|
|
|
|
|
extern const struct bt_mesh_model_op bt_mesh_cfg_cli_op[];
|
|
|
|
|
|
|
|
#define BT_MESH_MODEL_CFG_CLI(cli_data) \
|
|
|
|
BT_MESH_MODEL(BT_MESH_MODEL_ID_CFG_CLI, \
|
|
|
|
bt_mesh_cfg_cli_op, NULL, cli_data)
|
|
|
|
|
2017-11-12 17:47:00 +02:00
|
|
|
int bt_mesh_cfg_comp_data_get(u16_t net_idx, u16_t addr, u8_t page,
|
|
|
|
u8_t *status, struct net_buf_simple *comp);
|
|
|
|
|
2017-11-12 18:33:47 +02:00
|
|
|
int bt_mesh_cfg_beacon_get(u16_t net_idx, u16_t addr, u8_t *status);
|
|
|
|
|
|
|
|
int bt_mesh_cfg_beacon_set(u16_t net_idx, u16_t addr, u8_t val, u8_t *status);
|
|
|
|
|
2017-11-12 21:10:05 +02:00
|
|
|
int bt_mesh_cfg_ttl_get(u16_t net_idx, u16_t addr, u8_t *ttl);
|
|
|
|
|
|
|
|
int bt_mesh_cfg_ttl_set(u16_t net_idx, u16_t addr, u8_t val, u8_t *ttl);
|
|
|
|
|
|
|
|
int bt_mesh_cfg_friend_get(u16_t net_idx, u16_t addr, u8_t *status);
|
|
|
|
|
|
|
|
int bt_mesh_cfg_friend_set(u16_t net_idx, u16_t addr, u8_t val, u8_t *status);
|
|
|
|
|
|
|
|
int bt_mesh_cfg_gatt_proxy_get(u16_t net_idx, u16_t addr, u8_t *status);
|
|
|
|
|
|
|
|
int bt_mesh_cfg_gatt_proxy_set(u16_t net_idx, u16_t addr, u8_t val,
|
|
|
|
u8_t *status);
|
|
|
|
|
|
|
|
int bt_mesh_cfg_relay_get(u16_t net_idx, u16_t addr, u8_t *status,
|
|
|
|
u8_t *transmit);
|
|
|
|
|
|
|
|
int bt_mesh_cfg_relay_set(u16_t net_idx, u16_t addr, u8_t new_relay,
|
|
|
|
u8_t new_transmit, u8_t *status, u8_t *transmit);
|
|
|
|
|
2017-12-01 10:54:38 +02:00
|
|
|
int bt_mesh_cfg_net_key_add(u16_t net_idx, u16_t addr, u16_t key_net_idx,
|
|
|
|
const u8_t net_key[16], u8_t *status);
|
|
|
|
|
2017-11-12 23:04:36 +02:00
|
|
|
int bt_mesh_cfg_app_key_add(u16_t net_idx, u16_t addr, u16_t key_net_idx,
|
|
|
|
u16_t key_app_idx, const u8_t app_key[16],
|
|
|
|
u8_t *status);
|
|
|
|
|
2017-11-12 23:38:44 +02:00
|
|
|
int bt_mesh_cfg_mod_app_bind(u16_t net_idx, u16_t addr, u16_t elem_addr,
|
|
|
|
u16_t mod_app_idx, u16_t mod_id, u8_t *status);
|
|
|
|
|
|
|
|
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);
|
|
|
|
|
2018-10-25 11:43:05 +01:00
|
|
|
/** @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))
|
|
|
|
|
2017-11-16 12:29:31 +02:00
|
|
|
struct bt_mesh_cfg_mod_pub {
|
|
|
|
u16_t addr;
|
|
|
|
u16_t app_idx;
|
|
|
|
bool cred_flag;
|
|
|
|
u8_t ttl;
|
|
|
|
u8_t period;
|
|
|
|
u8_t transmit;
|
|
|
|
};
|
|
|
|
|
|
|
|
int bt_mesh_cfg_mod_pub_get(u16_t net_idx, u16_t addr, u16_t elem_addr,
|
|
|
|
u16_t mod_id, struct bt_mesh_cfg_mod_pub *pub,
|
|
|
|
u8_t *status);
|
|
|
|
|
|
|
|
int bt_mesh_cfg_mod_pub_get_vnd(u16_t net_idx, u16_t addr, u16_t elem_addr,
|
|
|
|
u16_t mod_id, u16_t cid,
|
|
|
|
struct bt_mesh_cfg_mod_pub *pub, u8_t *status);
|
|
|
|
|
|
|
|
int bt_mesh_cfg_mod_pub_set(u16_t net_idx, u16_t addr, u16_t elem_addr,
|
|
|
|
u16_t mod_id, struct bt_mesh_cfg_mod_pub *pub,
|
|
|
|
u8_t *status);
|
|
|
|
|
|
|
|
int bt_mesh_cfg_mod_pub_set_vnd(u16_t net_idx, u16_t addr, u16_t elem_addr,
|
|
|
|
u16_t mod_id, u16_t cid,
|
|
|
|
struct bt_mesh_cfg_mod_pub *pub, u8_t *status);
|
|
|
|
|
2017-11-12 23:51:28 +02:00
|
|
|
int bt_mesh_cfg_mod_sub_add(u16_t net_idx, u16_t addr, u16_t elem_addr,
|
|
|
|
u16_t sub_addr, u16_t mod_id, u8_t *status);
|
|
|
|
|
|
|
|
int bt_mesh_cfg_mod_sub_add_vnd(u16_t net_idx, u16_t addr, u16_t elem_addr,
|
|
|
|
u16_t sub_addr, u16_t mod_id, u16_t cid,
|
|
|
|
u8_t *status);
|
|
|
|
|
2017-11-18 11:52:21 +02:00
|
|
|
int bt_mesh_cfg_mod_sub_del(u16_t net_idx, u16_t addr, u16_t elem_addr,
|
|
|
|
u16_t sub_addr, u16_t mod_id, u8_t *status);
|
|
|
|
|
|
|
|
int bt_mesh_cfg_mod_sub_del_vnd(u16_t net_idx, u16_t addr, u16_t elem_addr,
|
|
|
|
u16_t sub_addr, u16_t mod_id, u16_t cid,
|
|
|
|
u8_t *status);
|
|
|
|
|
|
|
|
int bt_mesh_cfg_mod_sub_overwrite(u16_t net_idx, u16_t addr, u16_t elem_addr,
|
|
|
|
u16_t sub_addr, u16_t mod_id, u8_t *status);
|
|
|
|
|
|
|
|
int bt_mesh_cfg_mod_sub_overwrite_vnd(u16_t net_idx, u16_t addr,
|
|
|
|
u16_t elem_addr, u16_t sub_addr,
|
|
|
|
u16_t mod_id, u16_t cid, u8_t *status);
|
|
|
|
|
2017-11-24 13:36:05 +02:00
|
|
|
int bt_mesh_cfg_mod_sub_va_add(u16_t net_idx, u16_t addr, u16_t elem_addr,
|
|
|
|
const u8_t label[16], u16_t mod_id,
|
|
|
|
u16_t *virt_addr, u8_t *status);
|
|
|
|
|
|
|
|
int bt_mesh_cfg_mod_sub_va_add_vnd(u16_t net_idx, u16_t addr, u16_t elem_addr,
|
|
|
|
const u8_t label[16], u16_t mod_id,
|
|
|
|
u16_t cid, u16_t *virt_addr, u8_t *status);
|
|
|
|
|
|
|
|
int bt_mesh_cfg_mod_sub_va_del(u16_t net_idx, u16_t addr, u16_t elem_addr,
|
|
|
|
const u8_t label[16], u16_t mod_id,
|
|
|
|
u16_t *virt_addr, u8_t *status);
|
|
|
|
|
|
|
|
int bt_mesh_cfg_mod_sub_va_del_vnd(u16_t net_idx, u16_t addr, u16_t elem_addr,
|
|
|
|
const u8_t label[16], u16_t mod_id,
|
|
|
|
u16_t cid, u16_t *virt_addr, u8_t *status);
|
|
|
|
|
|
|
|
int bt_mesh_cfg_mod_sub_va_overwrite(u16_t net_idx, u16_t addr,
|
|
|
|
u16_t elem_addr, const u8_t label[16],
|
|
|
|
u16_t mod_id, u16_t *virt_addr,
|
|
|
|
u8_t *status);
|
|
|
|
|
|
|
|
int bt_mesh_cfg_mod_sub_va_overwrite_vnd(u16_t net_idx, u16_t addr,
|
|
|
|
u16_t elem_addr, const u8_t label[16],
|
|
|
|
u16_t mod_id, u16_t cid,
|
|
|
|
u16_t *virt_addr, u8_t *status);
|
|
|
|
|
2017-11-16 14:21:23 +02:00
|
|
|
struct bt_mesh_cfg_hb_sub {
|
|
|
|
u16_t src;
|
|
|
|
u16_t dst;
|
|
|
|
u8_t period;
|
|
|
|
u8_t count;
|
|
|
|
u8_t min;
|
|
|
|
u8_t max;
|
|
|
|
};
|
|
|
|
|
|
|
|
int bt_mesh_cfg_hb_sub_set(u16_t net_idx, u16_t addr,
|
|
|
|
struct bt_mesh_cfg_hb_sub *sub, u8_t *status);
|
2017-11-13 00:22:09 +02:00
|
|
|
|
2017-11-16 14:21:23 +02:00
|
|
|
int bt_mesh_cfg_hb_sub_get(u16_t net_idx, u16_t addr,
|
|
|
|
struct bt_mesh_cfg_hb_sub *sub, u8_t *status);
|
2017-11-14 20:42:48 +02:00
|
|
|
|
2017-11-16 12:50:13 +02:00
|
|
|
struct bt_mesh_cfg_hb_pub {
|
|
|
|
u16_t dst;
|
|
|
|
u8_t count;
|
|
|
|
u8_t period;
|
|
|
|
u8_t ttl;
|
|
|
|
u16_t feat;
|
|
|
|
u16_t net_idx;
|
|
|
|
};
|
|
|
|
|
|
|
|
int bt_mesh_cfg_hb_pub_set(u16_t net_idx, u16_t addr,
|
|
|
|
const struct bt_mesh_cfg_hb_pub *pub, u8_t *status);
|
2017-11-14 10:46:22 +02:00
|
|
|
|
2017-11-16 12:50:13 +02:00
|
|
|
int bt_mesh_cfg_hb_pub_get(u16_t net_idx, u16_t addr,
|
|
|
|
struct bt_mesh_cfg_hb_pub *pub, u8_t *status);
|
2017-11-14 20:18:04 +02:00
|
|
|
|
2017-11-14 20:45:26 +02:00
|
|
|
s32_t bt_mesh_cfg_cli_timeout_get(void);
|
|
|
|
void bt_mesh_cfg_cli_timeout_set(s32_t timeout);
|
|
|
|
|
2017-11-12 13:48:55 +02:00
|
|
|
/**
|
|
|
|
* @}
|
|
|
|
*/
|
|
|
|
|
2018-09-14 10:43:44 -07:00
|
|
|
#endif /* ZEPHYR_INCLUDE_BLUETOOTH_MESH_CFG_CLI_H_ */
|