Bluetooth: Mesh: Rename configuration server code from cfg to cfg_srv

Now that there's support for configuration client as well, rename cfg
to cfg_srv to avoid any confusion.

Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
This commit is contained in:
Johan Hedberg 2017-11-13 21:31:25 +02:00 committed by Johan Hedberg
parent 86624941e4
commit 3b252ca2be
9 changed files with 34 additions and 33 deletions

View File

@ -18,7 +18,7 @@
*/
/** Mesh Configuration Server Model Context */
struct bt_mesh_cfg {
struct bt_mesh_cfg_srv {
struct bt_mesh_model *model;
u8_t net_transmit; /* Network Transmit state */
@ -56,11 +56,11 @@ struct bt_mesh_cfg {
} hb_sub;
};
extern const struct bt_mesh_model_op bt_mesh_cfg_op[];
extern const struct bt_mesh_model_op bt_mesh_cfg_srv_op[];
#define BT_MESH_MODEL_CFG_SRV(srv_data) \
BT_MESH_MODEL(BT_MESH_MODEL_ID_CFG_SRV, \
bt_mesh_cfg_op, NULL, srv_data)
bt_mesh_cfg_srv_op, NULL, srv_data)
/**
* @}

View File

@ -15,7 +15,7 @@
#define CID_INTEL 0x0002
static struct bt_mesh_cfg cfg_srv = {
static struct bt_mesh_cfg_srv cfg_srv = {
.relay = BT_MESH_RELAY_DISABLED,
.beacon = BT_MESH_BEACON_ENABLED,
#if defined(CONFIG_BT_MESH_FRIEND)

View File

@ -52,7 +52,7 @@ static void heartbeat(u8_t hops, u16_t feat)
board_play("100H");
}
static struct bt_mesh_cfg cfg_srv = {
static struct bt_mesh_cfg_srv cfg_srv = {
#if defined(CONFIG_BOARD_BBC_MICROBIT)
.relay = BT_MESH_RELAY_ENABLED,
.beacon = BT_MESH_BEACON_DISABLED,

View File

@ -9,7 +9,7 @@ zephyr_library_sources_ifdef(CONFIG_BT_MESH
transport.c
crypto.c
access.c
cfg.c
cfg_srv.c
health.c
)

View File

@ -33,7 +33,7 @@ static const struct {
const u16_t id;
int (*const init)(struct bt_mesh_model *model, bool primary);
} const model_init[] = {
{ BT_MESH_MODEL_ID_CFG_SRV, bt_mesh_conf_init },
{ BT_MESH_MODEL_ID_CFG_SRV, bt_mesh_cfg_srv_init },
{ BT_MESH_MODEL_ID_HEALTH_SRV, bt_mesh_health_init },
#if defined(CONFIG_BT_MESH_CFG_CLI)
{ BT_MESH_MODEL_ID_CFG_CLI, bt_mesh_cfg_cli_init },

View File

@ -35,7 +35,7 @@
#define DEFAULT_TTL 7
static struct bt_mesh_cfg *conf;
static struct bt_mesh_cfg_srv *conf;
static struct label {
u16_t addr;
@ -45,7 +45,7 @@ static struct label {
static void hb_send(struct bt_mesh_model *model)
{
struct bt_mesh_cfg *cfg = model->user_data;
struct bt_mesh_cfg_srv *cfg = model->user_data;
u16_t feat = 0;
struct __packed {
u8_t init_ttl;
@ -652,7 +652,7 @@ static void beacon_set(struct bt_mesh_model *model,
{
/* Needed size: opcode (2 bytes) + msg + MIC */
struct net_buf_simple *msg = NET_BUF_SIMPLE(2 + 1 + 4);
struct bt_mesh_cfg *cfg = model->user_data;
struct bt_mesh_cfg_srv *cfg = model->user_data;
BT_DBG("net_idx 0x%04x app_idx 0x%04x src 0x%04x len %u: %s",
ctx->net_idx, ctx->app_idx, ctx->addr, buf->len,
@ -708,7 +708,7 @@ static void default_ttl_set(struct bt_mesh_model *model,
{
/* Needed size: opcode (2 bytes) + msg + MIC */
struct net_buf_simple *msg = NET_BUF_SIMPLE(2 + 1 + 4);
struct bt_mesh_cfg *cfg = model->user_data;
struct bt_mesh_cfg_srv *cfg = model->user_data;
BT_DBG("net_idx 0x%04x app_idx 0x%04x src 0x%04x len %u: %s",
ctx->net_idx, ctx->app_idx, ctx->addr, buf->len,
@ -760,7 +760,7 @@ static void gatt_proxy_set(struct bt_mesh_model *model,
struct bt_mesh_msg_ctx *ctx,
struct net_buf_simple *buf)
{
struct bt_mesh_cfg *cfg = model->user_data;
struct bt_mesh_cfg_srv *cfg = model->user_data;
struct bt_mesh_subnet *sub;
BT_DBG("net_idx 0x%04x app_idx 0x%04x src 0x%04x len %u: %s",
@ -824,7 +824,7 @@ static void net_transmit_set(struct bt_mesh_model *model,
{
/* Needed size: opcode (2 bytes) + msg + MIC */
struct net_buf_simple *msg = NET_BUF_SIMPLE(2 + 1 + 4);
struct bt_mesh_cfg *cfg = model->user_data;
struct bt_mesh_cfg_srv *cfg = model->user_data;
BT_DBG("net_idx 0x%04x app_idx 0x%04x src 0x%04x len %u: %s",
ctx->net_idx, ctx->app_idx, ctx->addr, buf->len,
@ -874,7 +874,7 @@ static void relay_set(struct bt_mesh_model *model,
{
/* Needed size: opcode (2 bytes) + msg + MIC */
struct net_buf_simple *msg = NET_BUF_SIMPLE(2 + 2 + 4);
struct bt_mesh_cfg *cfg = model->user_data;
struct bt_mesh_cfg_srv *cfg = model->user_data;
BT_DBG("net_idx 0x%04x app_idx 0x%04x src 0x%04x len %u: %s",
ctx->net_idx, ctx->app_idx, ctx->addr, buf->len,
@ -2001,7 +2001,7 @@ static void net_key_update(struct bt_mesh_model *model,
send_net_key_status(model, ctx, idx, STATUS_SUCCESS);
}
static void hb_pub_disable(struct bt_mesh_cfg *cfg)
static void hb_pub_disable(struct bt_mesh_cfg_srv *cfg)
{
BT_DBG("");
@ -2017,7 +2017,7 @@ static void net_key_del(struct bt_mesh_model *model,
struct bt_mesh_msg_ctx *ctx,
struct net_buf_simple *buf)
{
struct bt_mesh_cfg *cfg = model->user_data;
struct bt_mesh_cfg_srv *cfg = model->user_data;
struct bt_mesh_subnet *sub;
u16_t del_idx, i;
u8_t status;
@ -2374,7 +2374,7 @@ static void node_reset(struct bt_mesh_model *model,
{
/* Needed size: opcode (2 bytes) + msg + MIC */
struct net_buf_simple *msg = NET_BUF_SIMPLE(2 + 0 + 4);
struct bt_mesh_cfg *cfg = model->user_data;
struct bt_mesh_cfg_srv *cfg = model->user_data;
int i;
BT_DBG("net_idx 0x%04x app_idx 0x%04x src 0x%04x len %u: %s",
@ -2421,7 +2421,7 @@ static void send_friend_status(struct bt_mesh_model *model,
{
/* Needed size: opcode (2 bytes) + msg + MIC */
struct net_buf_simple *msg = NET_BUF_SIMPLE(2 + 1 + 4);
struct bt_mesh_cfg *cfg = model->user_data;
struct bt_mesh_cfg_srv *cfg = model->user_data;
bt_mesh_model_msg_init(msg, OP_FRIEND_STATUS);
net_buf_simple_add_u8(msg, cfg->frnd);
@ -2446,7 +2446,7 @@ static void friend_set(struct bt_mesh_model *model,
struct bt_mesh_msg_ctx *ctx,
struct net_buf_simple *buf)
{
struct bt_mesh_cfg *cfg = model->user_data;
struct bt_mesh_cfg_srv *cfg = model->user_data;
struct bt_mesh_subnet *sub;
BT_DBG("net_idx 0x%04x app_idx 0x%04x src 0x%04x len %u: %s",
@ -2674,7 +2674,7 @@ static void hb_pub_send_status(struct bt_mesh_model *model,
{
/* Needed size: opcode (1 byte) + msg + MIC */
struct net_buf_simple *msg = NET_BUF_SIMPLE(1 + 10 + 4);
struct bt_mesh_cfg *cfg = model->user_data;
struct bt_mesh_cfg_srv *cfg = model->user_data;
BT_DBG("src 0x%04x status 0x%02x", ctx->addr, status);
@ -2713,7 +2713,7 @@ static void heartbeat_pub_set(struct bt_mesh_model *model,
struct net_buf_simple *buf)
{
struct hb_pub_param *param = (void *)buf->data;
struct bt_mesh_cfg *cfg = model->user_data;
struct bt_mesh_cfg_srv *cfg = model->user_data;
u16_t dst, feat, idx;
u8_t status;
@ -2792,7 +2792,7 @@ static void hb_sub_send_status(struct bt_mesh_model *model,
{
/* Needed size: opcode (2 bytes) + msg + MIC */
struct net_buf_simple *msg = NET_BUF_SIMPLE(2 + 9 + 4);
struct bt_mesh_cfg *cfg = model->user_data;
struct bt_mesh_cfg_srv *cfg = model->user_data;
u16_t period;
s64_t uptime;
@ -2838,7 +2838,7 @@ static void heartbeat_sub_set(struct bt_mesh_model *model,
struct bt_mesh_msg_ctx *ctx,
struct net_buf_simple *buf)
{
struct bt_mesh_cfg *cfg = model->user_data;
struct bt_mesh_cfg_srv *cfg = model->user_data;
u16_t sub_src, sub_dst;
u8_t sub_period;
s32_t period_ms;
@ -2905,7 +2905,7 @@ static void heartbeat_sub_set(struct bt_mesh_model *model,
hb_sub_send_status(model, ctx, STATUS_SUCCESS);
}
const struct bt_mesh_model_op bt_mesh_cfg_op[] = {
const struct bt_mesh_model_op bt_mesh_cfg_srv_op[] = {
{ OP_DEV_COMP_DATA_GET, 1, dev_comp_data_get },
{ OP_APP_KEY_ADD, 19, app_key_add },
{ OP_APP_KEY_UPDATE, 19, app_key_update },
@ -2958,8 +2958,9 @@ const struct bt_mesh_model_op bt_mesh_cfg_op[] = {
static void hb_publish(struct k_work *work)
{
struct bt_mesh_cfg *cfg = CONTAINER_OF(work, struct bt_mesh_cfg,
hb_pub.timer.work);
struct bt_mesh_cfg_srv *cfg = CONTAINER_OF(work,
struct bt_mesh_cfg_srv,
hb_pub.timer.work);
struct bt_mesh_model *model = cfg->model;
struct bt_mesh_subnet *sub;
u16_t period_ms;
@ -2990,7 +2991,7 @@ static void hb_publish(struct k_work *work)
}
}
static bool conf_is_valid(struct bt_mesh_cfg *cfg)
static bool conf_is_valid(struct bt_mesh_cfg_srv *cfg)
{
if (cfg->relay > 0x02) {
return false;
@ -3007,9 +3008,9 @@ static bool conf_is_valid(struct bt_mesh_cfg *cfg)
return true;
}
int bt_mesh_conf_init(struct bt_mesh_model *model, bool primary)
int bt_mesh_cfg_srv_init(struct bt_mesh_model *model, bool primary)
{
struct bt_mesh_cfg *cfg = model->user_data;
struct bt_mesh_cfg_srv *cfg = model->user_data;
if (!cfg) {
BT_ERR("No Configuration Server context provided");
@ -3048,7 +3049,7 @@ int bt_mesh_conf_init(struct bt_mesh_model *model, bool primary)
void bt_mesh_heartbeat(u16_t src, u16_t dst, u8_t hops, u16_t feat)
{
struct bt_mesh_cfg *cfg = conf;
struct bt_mesh_cfg_srv *cfg = conf;
if (!cfg) {
BT_WARN("No configuaration server context available");

View File

@ -112,7 +112,7 @@
#define STATUS_UNSPECIFIED 0x10
#define STATUS_INVALID_BINDING 0x11
int bt_mesh_conf_init(struct bt_mesh_model *model, bool primary);
int bt_mesh_cfg_srv_init(struct bt_mesh_model *model, bool primary);
int bt_mesh_health_init(struct bt_mesh_model *model, bool primary);
int bt_mesh_cfg_cli_init(struct bt_mesh_model *model, bool primary);

View File

@ -21,7 +21,7 @@ static u16_t local = BT_MESH_ADDR_UNASSIGNED;
static u16_t dst = BT_MESH_ADDR_UNASSIGNED;
static u16_t net_idx;
static struct bt_mesh_cfg cfg_srv = {
static struct bt_mesh_cfg_srv cfg_srv = {
.relay = BT_MESH_RELAY_DISABLED,
.beacon = BT_MESH_BEACON_DISABLED,
#if defined(CONFIG_BT_MESH_FRIEND)

View File

@ -17,7 +17,7 @@
static bool has_reg_fault = true;
static struct bt_mesh_cfg cfg_srv = {
static struct bt_mesh_cfg_srv cfg_srv = {
.relay = BT_MESH_RELAY_DISABLED,
.beacon = BT_MESH_BEACON_DISABLED,
#if defined(CONFIG_BT_MESH_FRIEND)