Bluetooth: Mesh: Rename health server code from health to health_srv
This is in anticipation of soon adding health client support, which
could then cause confusion due to the ambiguous API names.
Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
diff --git a/include/bluetooth/mesh/health_srv.h b/include/bluetooth/mesh/health_srv.h
index 2b0b949..508fae7 100644
--- a/include/bluetooth/mesh/health_srv.h
+++ b/include/bluetooth/mesh/health_srv.h
@@ -18,7 +18,7 @@
*/
/** Mesh Health Server Model Context */
-struct bt_mesh_health {
+struct bt_mesh_health_srv {
struct bt_mesh_model *model;
/* Fetch current faults */
@@ -48,12 +48,12 @@
int bt_mesh_fault_update(struct bt_mesh_elem *elem);
-extern const struct bt_mesh_model_op bt_mesh_health_op[];
+extern const struct bt_mesh_model_op bt_mesh_health_srv_op[];
extern struct bt_mesh_model_pub bt_mesh_health_pub;
#define BT_MESH_MODEL_HEALTH_SRV(srv_data) \
BT_MESH_MODEL(BT_MESH_MODEL_ID_HEALTH_SRV, \
- bt_mesh_health_op, &bt_mesh_health_pub, \
+ bt_mesh_health_srv_op, &bt_mesh_health_pub, \
srv_data)
/**
diff --git a/samples/bluetooth/mesh/src/main.c b/samples/bluetooth/mesh/src/main.c
index 1b12103..cfca9c8 100644
--- a/samples/bluetooth/mesh/src/main.c
+++ b/samples/bluetooth/mesh/src/main.c
@@ -35,7 +35,7 @@
.relay_retransmit = BT_MESH_TRANSMIT(2, 20),
};
-static struct bt_mesh_health health_srv = {
+static struct bt_mesh_health_srv health_srv = {
};
static struct bt_mesh_model_pub gen_level_pub;
diff --git a/samples/bluetooth/mesh_demo/src/main.c b/samples/bluetooth/mesh_demo/src/main.c
index 896c1d9..e4c68f9 100644
--- a/samples/bluetooth/mesh_demo/src/main.c
+++ b/samples/bluetooth/mesh_demo/src/main.c
@@ -86,7 +86,7 @@
board_attention(false);
}
-static struct bt_mesh_health health_srv = {
+static struct bt_mesh_health_srv health_srv = {
.attention.on = attention_on,
.attention.off = attention_off,
};
diff --git a/subsys/bluetooth/host/mesh/CMakeLists.txt b/subsys/bluetooth/host/mesh/CMakeLists.txt
index d8db6ae..58a285f 100644
--- a/subsys/bluetooth/host/mesh/CMakeLists.txt
+++ b/subsys/bluetooth/host/mesh/CMakeLists.txt
@@ -10,7 +10,7 @@
crypto.c
access.c
cfg_srv.c
- health.c
+ health_srv.c
)
zephyr_library_sources_ifdef(CONFIG_BT_MESH_LOW_POWER lpn.c)
diff --git a/subsys/bluetooth/host/mesh/access.c b/subsys/bluetooth/host/mesh/access.c
index 146b113..68efbad 100644
--- a/subsys/bluetooth/host/mesh/access.c
+++ b/subsys/bluetooth/host/mesh/access.c
@@ -34,7 +34,7 @@
int (*const init)(struct bt_mesh_model *model, bool primary);
} const model_init[] = {
{ BT_MESH_MODEL_ID_CFG_SRV, bt_mesh_cfg_srv_init },
- { BT_MESH_MODEL_ID_HEALTH_SRV, bt_mesh_health_init },
+ { BT_MESH_MODEL_ID_HEALTH_SRV, bt_mesh_health_srv_init },
#if defined(CONFIG_BT_MESH_CFG_CLI)
{ BT_MESH_MODEL_ID_CFG_CLI, bt_mesh_cfg_cli_init },
#endif
diff --git a/subsys/bluetooth/host/mesh/foundation.h b/subsys/bluetooth/host/mesh/foundation.h
index c33b432..9353600 100644
--- a/subsys/bluetooth/host/mesh/foundation.h
+++ b/subsys/bluetooth/host/mesh/foundation.h
@@ -113,7 +113,7 @@
#define STATUS_INVALID_BINDING 0x11
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_health_srv_init(struct bt_mesh_model *model, bool primary);
int bt_mesh_cfg_cli_init(struct bt_mesh_model *model, bool primary);
diff --git a/subsys/bluetooth/host/mesh/health.c b/subsys/bluetooth/host/mesh/health_srv.c
similarity index 92%
rename from subsys/bluetooth/host/mesh/health.c
rename to subsys/bluetooth/host/mesh/health_srv.c
index 6fd2799..e78a5cc 100644
--- a/subsys/bluetooth/host/mesh/health.c
+++ b/subsys/bluetooth/host/mesh/health_srv.c
@@ -40,13 +40,13 @@
#endif
/* Health Server context of the primary element */
-struct bt_mesh_health *health_srv;
+struct bt_mesh_health_srv *health_srv;
static void health_get_registered(struct bt_mesh_model *mod,
u16_t company_id,
struct net_buf_simple *msg)
{
- struct bt_mesh_health *srv = mod->user_data;
+ struct bt_mesh_health_srv *srv = mod->user_data;
u8_t fault_count;
u8_t *test_id;
int err;
@@ -78,7 +78,7 @@
static size_t health_get_current(struct bt_mesh_model *mod,
struct net_buf_simple *msg)
{
- struct bt_mesh_health *srv = mod->user_data;
+ struct bt_mesh_health_srv *srv = mod->user_data;
const struct bt_mesh_comp *comp;
u8_t *test_id, *company_ptr;
u16_t company_id;
@@ -138,7 +138,7 @@
struct bt_mesh_msg_ctx *ctx,
struct net_buf_simple *buf)
{
- struct bt_mesh_health *srv = model->user_data;
+ struct bt_mesh_health_srv *srv = model->user_data;
u16_t company_id;
company_id = net_buf_simple_pull_le16(buf);
@@ -155,7 +155,7 @@
struct net_buf_simple *buf)
{
struct net_buf_simple *msg = NET_BUF_SIMPLE(HEALTH_STATUS_SIZE);
- struct bt_mesh_health *srv = model->user_data;
+ struct bt_mesh_health_srv *srv = model->user_data;
u16_t company_id;
company_id = net_buf_simple_pull_le16(buf);
@@ -177,7 +177,7 @@
struct bt_mesh_msg_ctx *ctx,
struct net_buf_simple *buf)
{
- struct bt_mesh_health *srv = model->user_data;
+ struct bt_mesh_health_srv *srv = model->user_data;
const struct bt_mesh_comp *comp;
u16_t company_id;
u8_t test_id;
@@ -204,7 +204,7 @@
struct net_buf_simple *buf)
{
struct net_buf_simple *msg = NET_BUF_SIMPLE(HEALTH_STATUS_SIZE);
- struct bt_mesh_health *srv = model->user_data;
+ struct bt_mesh_health_srv *srv = model->user_data;
u16_t company_id;
u8_t test_id;
@@ -237,7 +237,7 @@
{
/* Needed size: opcode (2 bytes) + msg + MIC */
struct net_buf_simple *msg = NET_BUF_SIMPLE(2 + 1 + 4);
- struct bt_mesh_health *srv = model->user_data;
+ struct bt_mesh_health_srv *srv = model->user_data;
u8_t time;
time = k_delayed_work_remaining_get(&srv->attention.timer) / 1000;
@@ -333,7 +333,7 @@
send_health_period_status(model, ctx);
}
-const struct bt_mesh_model_op bt_mesh_health_op[] = {
+const struct bt_mesh_model_op bt_mesh_health_srv_op[] = {
{ OP_HEALTH_FAULT_GET, 2, health_fault_get },
{ OP_HEALTH_FAULT_CLEAR, 2, health_fault_clear },
{ OP_HEALTH_FAULT_CLEAR_UNREL, 2, health_fault_clear_unrel },
@@ -386,8 +386,9 @@
static void attention_off(struct k_work *work)
{
- struct bt_mesh_health *srv = CONTAINER_OF(work, struct bt_mesh_health,
- attention.timer.work);
+ struct bt_mesh_health_srv *srv = CONTAINER_OF(work,
+ struct bt_mesh_health_srv,
+ attention.timer.work);
BT_DBG("");
if (srv->attention.off) {
@@ -395,9 +396,9 @@
}
}
-int bt_mesh_health_init(struct bt_mesh_model *model, bool primary)
+int bt_mesh_health_srv_init(struct bt_mesh_model *model, bool primary)
{
- struct bt_mesh_health *srv = model->user_data;
+ struct bt_mesh_health_srv *srv = model->user_data;
if (!srv) {
if (!primary) {
@@ -421,7 +422,7 @@
void bt_mesh_attention(struct bt_mesh_model *model, u8_t time)
{
- struct bt_mesh_health *srv;
+ struct bt_mesh_health_srv *srv;
if (!model) {
srv = health_srv;
diff --git a/subsys/bluetooth/host/mesh/shell.c b/subsys/bluetooth/host/mesh/shell.c
index 56bb8fb..f71092a 100644
--- a/subsys/bluetooth/host/mesh/shell.c
+++ b/subsys/bluetooth/host/mesh/shell.c
@@ -42,7 +42,7 @@
.relay_retransmit = BT_MESH_TRANSMIT(2, 20),
};
-static struct bt_mesh_health health_srv = {
+static struct bt_mesh_health_srv health_srv = {
};
static struct bt_mesh_cfg_cli cfg_cli = {
diff --git a/tests/bluetooth/mesh/src/main.c b/tests/bluetooth/mesh/src/main.c
index b754124..84e138f 100644
--- a/tests/bluetooth/mesh/src/main.c
+++ b/tests/bluetooth/mesh/src/main.c
@@ -103,7 +103,7 @@
return 0;
}
-static struct bt_mesh_health health_srv = {
+static struct bt_mesh_health_srv health_srv = {
.fault_get_cur = fault_get_cur,
.fault_get_reg = fault_get_reg,
.fault_clear = fault_clear,