]> granicus.if.org Git - esp-idf/commitdiff
ble_mesh: rename ble mesh client model variables and functions
authorlly <lly@espressif.com>
Mon, 2 Sep 2019 04:06:20 +0000 (12:06 +0800)
committerlly <lly@espressif.com>
Mon, 9 Sep 2019 09:15:16 +0000 (17:15 +0800)
25 files changed:
components/bt/esp_ble_mesh/btc/btc_ble_mesh_config_model.c
components/bt/esp_ble_mesh/btc/btc_ble_mesh_generic_model.c
components/bt/esp_ble_mesh/btc/btc_ble_mesh_health_model.c
components/bt/esp_ble_mesh/btc/btc_ble_mesh_lighting_model.c
components/bt/esp_ble_mesh/btc/btc_ble_mesh_prov.c
components/bt/esp_ble_mesh/btc/btc_ble_mesh_sensor_model.c
components/bt/esp_ble_mesh/btc/btc_ble_mesh_time_scene_model.c
components/bt/esp_ble_mesh/mesh_core/access.c
components/bt/esp_ble_mesh/mesh_core/cfg_cli.c
components/bt/esp_ble_mesh/mesh_core/health_cli.c
components/bt/esp_ble_mesh/mesh_core/include/cfg_cli.h
components/bt/esp_ble_mesh/mesh_core/include/health_cli.h
components/bt/esp_ble_mesh/mesh_core/transport.c
components/bt/esp_ble_mesh/mesh_models/client/client_common.c
components/bt/esp_ble_mesh/mesh_models/client/generic_client.c
components/bt/esp_ble_mesh/mesh_models/client/include/client_common.h
components/bt/esp_ble_mesh/mesh_models/client/include/generic_client.h
components/bt/esp_ble_mesh/mesh_models/client/include/lighting_client.h
components/bt/esp_ble_mesh/mesh_models/client/include/sensor_client.h
components/bt/esp_ble_mesh/mesh_models/client/include/time_scene_client.h
components/bt/esp_ble_mesh/mesh_models/client/lighting_client.c
components/bt/esp_ble_mesh/mesh_models/client/sensor_client.c
components/bt/esp_ble_mesh/mesh_models/client/time_scene_client.c
components/bt/esp_ble_mesh/mesh_models/common/include/mesh_common.h
components/bt/esp_ble_mesh/mesh_models/common/mesh_common.c

index 0937721bb296eb6b7a594e9037db3597031d04c6..30257a5c6aebacaf25a6e207f8d24b12c29cf75e 100644 (file)
@@ -389,7 +389,7 @@ void btc_mesh_cfg_client_call_handler(btc_msg_t *msg)
         cfg_client_cb.params = arg->cfg_client_get_state.params;
         role_param.model = (struct bt_mesh_model *)cfg_client_cb.params->model;
         role_param.role = cfg_client_cb.params->msg_role;
-        if (bt_mesh_set_model_role(&role_param)) {
+        if (bt_mesh_set_client_model_role(&role_param)) {
             LOG_ERROR("%s, Failed to set model role", __func__);
             return;
         }
@@ -405,7 +405,7 @@ void btc_mesh_cfg_client_call_handler(btc_msg_t *msg)
         cfg_client_cb.params = arg->cfg_client_set_state.params;
         role_param.model = (struct bt_mesh_model *)cfg_client_cb.params->model;
         role_param.role = cfg_client_cb.params->msg_role;
-        if (bt_mesh_set_model_role(&role_param)) {
+        if (bt_mesh_set_client_model_role(&role_param)) {
             LOG_ERROR("%s, Failed to set model role", __func__);
             return;
         }
index 761fbeebe52abb7b645b3ba4f40f91f1ff8eb276..fc0854a42aca8147bd5321280d4ab7d8c632ec1c 100644 (file)
@@ -443,7 +443,7 @@ void btc_mesh_generic_client_call_handler(btc_msg_t *msg)
     esp_ble_mesh_generic_client_cb_param_t generic_client_cb = {0};
     esp_ble_mesh_client_common_param_t *params = NULL;
     btc_ble_mesh_generic_client_args_t *arg = NULL;
-    struct bt_mesh_common_param common = {0};
+    bt_mesh_client_common_param_t common = {0};
     bt_mesh_role_param_t role_param = {0};
 
     if (!msg || !msg->arg) {
@@ -458,7 +458,7 @@ void btc_mesh_generic_client_call_handler(btc_msg_t *msg)
         params = arg->generic_client_get_state.params;
         role_param.model = (struct bt_mesh_model *)params->model;
         role_param.role = params->msg_role;
-        if (bt_mesh_set_model_role(&role_param)) {
+        if (bt_mesh_set_client_model_role(&role_param)) {
             LOG_ERROR("%s, Failed to set model role", __func__);
             return;
         }
@@ -487,7 +487,7 @@ void btc_mesh_generic_client_call_handler(btc_msg_t *msg)
         params = arg->generic_client_set_state.params;
         role_param.model = (struct bt_mesh_model *)params->model;
         role_param.role = params->msg_role;
-        if (bt_mesh_set_model_role(&role_param)) {
+        if (bt_mesh_set_client_model_role(&role_param)) {
             LOG_ERROR("%s, Failed to set model role", __func__);
             return;
         }
index 1f6d88340b2d338fd597b0d9a9400f14121356d8..f5a176af88553d7937f0f14fd937bc9e9a7b70a4 100644 (file)
@@ -489,7 +489,7 @@ void btc_mesh_health_client_call_handler(btc_msg_t *msg)
         health_client_cb.params = arg->health_client_get_state.params;
         role_param.model = (struct bt_mesh_model *)health_client_cb.params->model;
         role_param.role = health_client_cb.params->msg_role;
-        if (bt_mesh_set_model_role(&role_param)) {
+        if (bt_mesh_set_client_model_role(&role_param)) {
             LOG_ERROR("%s, Failed to set model role", __func__);
             return;
         }
@@ -506,7 +506,7 @@ void btc_mesh_health_client_call_handler(btc_msg_t *msg)
         health_client_cb.params = arg->health_client_set_state.params;
         role_param.model = (struct bt_mesh_model *)health_client_cb.params->model;
         role_param.role = health_client_cb.params->msg_role;
-        if (bt_mesh_set_model_role(&role_param)) {
+        if (bt_mesh_set_client_model_role(&role_param)) {
             LOG_ERROR("%s, Failed to set model role", __func__);
             return;
         }
index d07dba47a01dcf8104375caa2aedcb044d397511..9a1b57edf3ae74131ffc533f3e72df4daa5fa85e 100644 (file)
@@ -283,7 +283,7 @@ void btc_mesh_light_client_call_handler(btc_msg_t *msg)
     esp_ble_mesh_light_client_cb_param_t light_client_cb = {0};
     esp_ble_mesh_client_common_param_t *params = NULL;
     btc_ble_mesh_light_client_args_t *arg = NULL;
-    struct bt_mesh_common_param common = {0};
+    bt_mesh_client_common_param_t common = {0};
     bt_mesh_role_param_t role_param = {0};
 
     if (!msg || !msg->arg) {
@@ -298,7 +298,7 @@ void btc_mesh_light_client_call_handler(btc_msg_t *msg)
         params = arg->light_client_get_state.params;
         role_param.model = (struct bt_mesh_model *)params->model;
         role_param.role = params->msg_role;
-        if (bt_mesh_set_model_role(&role_param)) {
+        if (bt_mesh_set_client_model_role(&role_param)) {
             LOG_ERROR("%s, Failed to set model role", __func__);
             return;
         }
@@ -327,7 +327,7 @@ void btc_mesh_light_client_call_handler(btc_msg_t *msg)
         params = arg->light_client_set_state.params;
         role_param.model = (struct bt_mesh_model *)params->model;
         role_param.role = params->msg_role;
-        if (bt_mesh_set_model_role(&role_param)) {
+        if (bt_mesh_set_client_model_role(&role_param)) {
             LOG_ERROR("%s, Failed to set model role", __func__);
             return;
         }
index e1517d6bb363f1844ec52af87d52b59361dd4623..4d11458dc39521b60157c7ac7329091007cf1964 100644 (file)
@@ -299,8 +299,8 @@ static void btc_ble_mesh_client_model_op_cb(struct bt_mesh_model *model,
         struct net_buf_simple *buf)
 {
     esp_ble_mesh_model_cb_param_t mesh_param = {0};
-    bt_mesh_client_common_t *client_param = NULL;
-    bt_mesh_internal_data_t *data = NULL;
+    bt_mesh_client_user_data_t *client_param = NULL;
+    bt_mesh_client_internal_data_t *data = NULL;
     bt_mesh_client_node_t *node = NULL;
     btc_msg_t msg = {0};
     bt_status_t ret;
@@ -310,14 +310,14 @@ static void btc_ble_mesh_client_model_op_cb(struct bt_mesh_model *model,
         return;
     }
 
-    client_param = (bt_mesh_client_common_t *)model->user_data;
-    data = (bt_mesh_internal_data_t *)client_param->internal_data;
+    client_param = (bt_mesh_client_user_data_t *)model->user_data;
+    data = (bt_mesh_client_internal_data_t *)client_param->internal_data;
     if (!data) {
         LOG_ERROR("%s, Client internal_data is NULL", __func__);
         return;
     }
 
-    node = bt_mesh_is_model_message_publish(model, ctx, buf, false);
+    node = bt_mesh_is_client_recv_publish_msg(model, ctx, buf, false);
     if (node == NULL) {
         msg.act = ESP_BLE_MESH_CLIENT_MODEL_RECV_PUBLISH_MSG_EVT;
         mesh_param.client_recv_publish_msg.opcode = mesh_opcode;
@@ -594,8 +594,8 @@ static void btc_prov_register_complete_cb(int err_code)
 static void btc_client_model_timeout_cb(struct k_work *work)
 {
     esp_ble_mesh_model_cb_param_t mesh_param = {0};
-    bt_mesh_client_common_t *client_param = NULL;
-    bt_mesh_internal_data_t *data = NULL;
+    bt_mesh_client_user_data_t *client_param = NULL;
+    bt_mesh_client_internal_data_t *data = NULL;
     bt_mesh_client_node_t *node = NULL;
     btc_msg_t msg = {0};
     bt_status_t ret;
@@ -606,8 +606,8 @@ static void btc_client_model_timeout_cb(struct k_work *work)
         return;
     }
 
-    client_param = (bt_mesh_client_common_t *)node->ctx.model->user_data;
-    data = (bt_mesh_internal_data_t *)client_param->internal_data;
+    client_param = (bt_mesh_client_user_data_t *)node->ctx.model->user_data;
+    data = (bt_mesh_client_internal_data_t *)client_param->internal_data;
     if (!data) {
         LOG_ERROR("%s, Client internal_data is NULL", __func__);
         return;
@@ -986,7 +986,7 @@ static void btc_mesh_model_op_add(esp_ble_mesh_model_t *model)
     }
     case BLE_MESH_MODEL_ID_GEN_ONOFF_CLI: {
         model->op = ((esp_ble_mesh_model_op_t *)gen_onoff_cli_op);
-        bt_mesh_gen_onoff_cli_t *cli = (bt_mesh_gen_onoff_cli_t *)model->user_data;
+        bt_mesh_gen_onoff_client_t *cli = (bt_mesh_gen_onoff_client_t *)model->user_data;
         if (cli != NULL) {
             cli->publish_status = btc_mesh_generic_client_publish_callback;
         }
@@ -994,7 +994,7 @@ static void btc_mesh_model_op_add(esp_ble_mesh_model_t *model)
     }
     case BLE_MESH_MODEL_ID_GEN_LEVEL_CLI: {
         model->op = ((esp_ble_mesh_model_op_t *)gen_level_cli_op);
-        bt_mesh_gen_level_cli_t *cli = (bt_mesh_gen_level_cli_t *)model->user_data;
+        bt_mesh_gen_level_client_t *cli = (bt_mesh_gen_level_client_t *)model->user_data;
         if (cli != NULL) {
             cli->publish_status = btc_mesh_generic_client_publish_callback;
         }
@@ -1002,7 +1002,7 @@ static void btc_mesh_model_op_add(esp_ble_mesh_model_t *model)
     }
     case BLE_MESH_MODEL_ID_GEN_DEF_TRANS_TIME_CLI: {
         model->op = ((esp_ble_mesh_model_op_t *)gen_def_trans_time_cli_op);
-        bt_mesh_gen_def_trans_time_cli_t *cli = (bt_mesh_gen_def_trans_time_cli_t *)model->user_data;
+        bt_mesh_gen_def_trans_time_client_t *cli = (bt_mesh_gen_def_trans_time_client_t *)model->user_data;
         if (cli != NULL) {
             cli->publish_status = btc_mesh_generic_client_publish_callback;
         }
@@ -1010,7 +1010,7 @@ static void btc_mesh_model_op_add(esp_ble_mesh_model_t *model)
     }
     case BLE_MESH_MODEL_ID_GEN_POWER_ONOFF_CLI: {
         model->op = ((esp_ble_mesh_model_op_t *)gen_power_onoff_cli_op);
-        bt_mesh_gen_power_onoff_cli_t *cli = (bt_mesh_gen_power_onoff_cli_t *)model->user_data;
+        bt_mesh_gen_power_onoff_client_t *cli = (bt_mesh_gen_power_onoff_client_t *)model->user_data;
         if (cli != NULL) {
             cli->publish_status = btc_mesh_generic_client_publish_callback;
         }
@@ -1018,7 +1018,7 @@ static void btc_mesh_model_op_add(esp_ble_mesh_model_t *model)
     }
     case BLE_MESH_MODEL_ID_GEN_POWER_LEVEL_CLI: {
         model->op = ((esp_ble_mesh_model_op_t *)gen_power_level_cli_op);
-        bt_mesh_gen_power_level_cli_t *cli = (bt_mesh_gen_power_level_cli_t *)model->user_data;
+        bt_mesh_gen_power_level_client_t *cli = (bt_mesh_gen_power_level_client_t *)model->user_data;
         if (cli != NULL) {
             cli->publish_status = btc_mesh_generic_client_publish_callback;
         }
@@ -1026,7 +1026,7 @@ static void btc_mesh_model_op_add(esp_ble_mesh_model_t *model)
     }
     case BLE_MESH_MODEL_ID_GEN_BATTERY_CLI: {
         model->op = ((esp_ble_mesh_model_op_t *)gen_battery_cli_op);
-        bt_mesh_gen_battery_cli_t *cli = (bt_mesh_gen_battery_cli_t *)model->user_data;
+        bt_mesh_gen_battery_client_t *cli = (bt_mesh_gen_battery_client_t *)model->user_data;
         if (cli != NULL) {
             cli->publish_status = btc_mesh_generic_client_publish_callback;
         }
@@ -1034,7 +1034,7 @@ static void btc_mesh_model_op_add(esp_ble_mesh_model_t *model)
     }
     case BLE_MESH_MODEL_ID_GEN_LOCATION_CLI: {
         model->op = ((esp_ble_mesh_model_op_t *)gen_location_cli_op);
-        bt_mesh_gen_location_cli_t *cli = (bt_mesh_gen_location_cli_t *)model->user_data;
+        bt_mesh_gen_location_client_t *cli = (bt_mesh_gen_location_client_t *)model->user_data;
         if (cli != NULL) {
             cli->publish_status = btc_mesh_generic_client_publish_callback;
         }
@@ -1042,7 +1042,7 @@ static void btc_mesh_model_op_add(esp_ble_mesh_model_t *model)
     }
     case BLE_MESH_MODEL_ID_GEN_PROP_CLI: {
         model->op = ((esp_ble_mesh_model_op_t *)gen_property_cli_op);
-        bt_mesh_gen_property_cli_t *cli = (bt_mesh_gen_property_cli_t *)model->user_data;
+        bt_mesh_gen_property_client_t *cli = (bt_mesh_gen_property_client_t *)model->user_data;
         if (cli != NULL) {
             cli->publish_status = btc_mesh_generic_client_publish_callback;
         }
@@ -1050,7 +1050,7 @@ static void btc_mesh_model_op_add(esp_ble_mesh_model_t *model)
     }
     case BLE_MESH_MODEL_ID_LIGHT_LIGHTNESS_CLI: {
         model->op = ((esp_ble_mesh_model_op_t *)light_lightness_cli_op);
-        bt_mesh_light_lightness_cli_t *cli = (bt_mesh_light_lightness_cli_t *)model->user_data;
+        bt_mesh_light_lightness_client_t *cli = (bt_mesh_light_lightness_client_t *)model->user_data;
         if (cli != NULL) {
             cli->publish_status = btc_mesh_light_client_publish_callback;
         }
@@ -1058,7 +1058,7 @@ static void btc_mesh_model_op_add(esp_ble_mesh_model_t *model)
     }
     case BLE_MESH_MODEL_ID_LIGHT_CTL_CLI: {
         model->op = ((esp_ble_mesh_model_op_t *)light_ctl_cli_op);
-        bt_mesh_light_ctl_cli_t *cli = (bt_mesh_light_ctl_cli_t *)model->user_data;
+        bt_mesh_light_ctl_client_t *cli = (bt_mesh_light_ctl_client_t *)model->user_data;
         if (cli != NULL) {
             cli->publish_status = btc_mesh_light_client_publish_callback;
         }
@@ -1066,7 +1066,7 @@ static void btc_mesh_model_op_add(esp_ble_mesh_model_t *model)
     }
     case BLE_MESH_MODEL_ID_LIGHT_HSL_CLI: {
         model->op = ((esp_ble_mesh_model_op_t *)light_hsl_cli_op);
-        bt_mesh_light_hsl_cli_t *cli = (bt_mesh_light_hsl_cli_t *)model->user_data;
+        bt_mesh_light_hsl_client_t *cli = (bt_mesh_light_hsl_client_t *)model->user_data;
         if (cli != NULL) {
             cli->publish_status = btc_mesh_light_client_publish_callback;
         }
@@ -1074,7 +1074,7 @@ static void btc_mesh_model_op_add(esp_ble_mesh_model_t *model)
     }
     case BLE_MESH_MODEL_ID_LIGHT_XYL_CLI: {
         model->op = ((esp_ble_mesh_model_op_t *)light_xyl_cli_op);
-        bt_mesh_light_xyl_cli_t *cli = (bt_mesh_light_xyl_cli_t *)model->user_data;
+        bt_mesh_light_xyl_client_t *cli = (bt_mesh_light_xyl_client_t *)model->user_data;
         if (cli != NULL) {
             cli->publish_status = btc_mesh_light_client_publish_callback;
         }
@@ -1082,7 +1082,7 @@ static void btc_mesh_model_op_add(esp_ble_mesh_model_t *model)
     }
     case BLE_MESH_MODEL_ID_LIGHT_LC_CLI: {
         model->op = ((esp_ble_mesh_model_op_t *)light_lc_cli_op);
-        bt_mesh_light_lc_cli_t *cli = (bt_mesh_light_lc_cli_t *)model->user_data;
+        bt_mesh_light_lc_client_t *cli = (bt_mesh_light_lc_client_t *)model->user_data;
         if (cli != NULL) {
             cli->publish_status = btc_mesh_light_client_publish_callback;
         }
@@ -1098,7 +1098,7 @@ static void btc_mesh_model_op_add(esp_ble_mesh_model_t *model)
     }
     case BLE_MESH_MODEL_ID_TIME_CLI: {
         model->op = ((esp_ble_mesh_model_op_t *)time_cli_op);
-        bt_mesh_time_scene_client_t *cli = (bt_mesh_time_scene_client_t *)model->user_data;
+        bt_mesh_time_client_t *cli = (bt_mesh_time_client_t *)model->user_data;
         if (cli != NULL) {
             cli->publish_status = btc_mesh_time_scene_client_publish_callback;
         }
@@ -1106,7 +1106,7 @@ static void btc_mesh_model_op_add(esp_ble_mesh_model_t *model)
     }
     case BLE_MESH_MODEL_ID_SCENE_CLI: {
         model->op = ((esp_ble_mesh_model_op_t *)scene_cli_op);
-        bt_mesh_time_scene_client_t *cli = (bt_mesh_time_scene_client_t *)model->user_data;
+        bt_mesh_scene_client_t *cli = (bt_mesh_scene_client_t *)model->user_data;
         if (cli != NULL) {
             cli->publish_status = btc_mesh_time_scene_client_publish_callback;
         }
@@ -1114,7 +1114,7 @@ static void btc_mesh_model_op_add(esp_ble_mesh_model_t *model)
     }
     case BLE_MESH_MODEL_ID_SCHEDULER_CLI: {
         model->op = ((esp_ble_mesh_model_op_t *)scheduler_cli_op);
-        bt_mesh_time_scene_client_t *cli = (bt_mesh_time_scene_client_t *)model->user_data;
+        bt_mesh_scheduler_client_t *cli = (bt_mesh_scheduler_client_t *)model->user_data;
         if (cli != NULL) {
             cli->publish_status = btc_mesh_time_scene_client_publish_callback;
         }
@@ -1429,7 +1429,7 @@ void btc_mesh_model_call_handler(btc_msg_t *msg)
             bt_mesh_role_param_t common = {0};
             common.model = (struct bt_mesh_model *)(arg->model_publish.model);
             common.role  = arg->model_publish.device_role;
-            if (bt_mesh_set_model_role(&common)) {
+            if (bt_mesh_set_client_model_role(&common)) {
                 LOG_ERROR("%s, Failed to set model role", __func__);
                 return;
             }
@@ -1467,7 +1467,7 @@ void btc_mesh_model_call_handler(btc_msg_t *msg)
         arg->model_send.ctx->srv_send = false;
         common.model = (struct bt_mesh_model *)(arg->model_send.model);
         common.role  = arg->model_send.device_role;
-        if (bt_mesh_set_model_role(&common)) {
+        if (bt_mesh_set_client_model_role(&common)) {
             LOG_ERROR("%s, Failed to set model role", __func__);
             return;
         }
index b9f3de6bdeb9fa547c20e700dde32a3281367946..df267023a712789eac74819b413c2a31fadba13c 100644 (file)
@@ -534,7 +534,7 @@ void btc_mesh_sensor_client_call_handler(btc_msg_t *msg)
     esp_ble_mesh_sensor_client_cb_param_t sensor_client_cb = {0};
     esp_ble_mesh_client_common_param_t *params = NULL;
     btc_ble_mesh_sensor_client_args_t *arg = NULL;
-    struct bt_mesh_common_param common = {0};
+    bt_mesh_client_common_param_t common = {0};
     bt_mesh_role_param_t role_param = {0};
 
     if (!msg || !msg->arg) {
@@ -549,7 +549,7 @@ void btc_mesh_sensor_client_call_handler(btc_msg_t *msg)
         params = arg->sensor_client_get_state.params;
         role_param.model = (struct bt_mesh_model *)params->model;
         role_param.role = params->msg_role;
-        if (bt_mesh_set_model_role(&role_param)) {
+        if (bt_mesh_set_client_model_role(&role_param)) {
             LOG_ERROR("%s, Failed to set model role", __func__);
             return;
         }
@@ -578,7 +578,7 @@ void btc_mesh_sensor_client_call_handler(btc_msg_t *msg)
         params = arg->sensor_client_set_state.params;
         role_param.model = (struct bt_mesh_model *)params->model;
         role_param.role = params->msg_role;
-        if (bt_mesh_set_model_role(&role_param)) {
+        if (bt_mesh_set_client_model_role(&role_param)) {
             LOG_ERROR("%s, Failed to set model role", __func__);
             return;
         }
index 4f03567dc933743ed23bb8e13807ed0424fb1c8f..907c1430ff40bc882da3eab9c4ddf8c0adb0bb4e 100644 (file)
@@ -285,7 +285,7 @@ void btc_mesh_time_scene_client_call_handler(btc_msg_t *msg)
     esp_ble_mesh_time_scene_client_cb_param_t time_scene_client_cb = {0};
     btc_ble_mesh_time_scene_client_args_t *arg = NULL;
     esp_ble_mesh_client_common_param_t *params = NULL;
-    struct bt_mesh_common_param common = {0};
+    bt_mesh_client_common_param_t common = {0};
     bt_mesh_role_param_t role_param = {0};
 
     if (!msg || !msg->arg) {
@@ -300,7 +300,7 @@ void btc_mesh_time_scene_client_call_handler(btc_msg_t *msg)
         params = arg->time_scene_client_get_state.params;
         role_param.model = (struct bt_mesh_model *)params->model;
         role_param.role = params->msg_role;
-        if (bt_mesh_set_model_role(&role_param)) {
+        if (bt_mesh_set_client_model_role(&role_param)) {
             LOG_ERROR("%s, Failed to set model role", __func__);
             return;
         }
@@ -329,7 +329,7 @@ void btc_mesh_time_scene_client_call_handler(btc_msg_t *msg)
         params = arg->time_scene_client_set_state.params;
         role_param.model = (struct bt_mesh_model *)params->model;
         role_param.role = params->msg_role;
-        if (bt_mesh_set_model_role(&role_param)) {
+        if (bt_mesh_set_client_model_role(&role_param)) {
             LOG_ERROR("%s, Failed to set model role", __func__);
             return;
         }
index 6184d30091e1c058cfcd4bf2bca3892e625a4315..d8365ecdd52371cb06ea0fbe2bdcfd5c8c43673b 100644 (file)
@@ -740,7 +740,7 @@ static int model_send(struct bt_mesh_model *model,
            tx->ctx->app_idx, tx->ctx->addr);
     BT_DBG("len %u: %s", msg->len, bt_hex(msg->data, msg->len));
 
-    role = bt_mesh_get_model_role(model, tx->ctx->srv_send);
+    role = bt_mesh_get_device_role(model, tx->ctx->srv_send);
     if (role == ROLE_NVAL) {
         BT_ERR("%s, Failed to get model role", __func__);
         return -EINVAL;
@@ -819,7 +819,7 @@ int bt_mesh_model_send(struct bt_mesh_model *model,
     struct bt_mesh_subnet *sub = NULL;
     u8_t role;
 
-    role = bt_mesh_get_model_role(model, ctx->srv_send);
+    role = bt_mesh_get_device_role(model, ctx->srv_send);
     if (role == ROLE_NVAL) {
         BT_ERR("%s, Failed to get model role", __func__);
         return -EINVAL;
index aa2daf0da8b1aedb0f976064d3d2bae47cbbd983..7e2f717b43de50402b3d25629328a56ce0751edb 100644 (file)
@@ -139,7 +139,7 @@ static void cfg_client_cancel(struct bt_mesh_model *model,
     /* If it is a publish message, sent to the user directly. */
     buf.data = (u8_t *)status;
     buf.len  = (u16_t)len;
-    node = bt_mesh_is_model_message_publish(model, ctx, &buf, true);
+    node = bt_mesh_is_client_recv_publish_msg(model, ctx, &buf, true);
     if (!node) {
         BT_DBG("Unexpected config status message 0x%x", ctx->recv_op);
     } else {
index c66e42afcd626839ebec9f1e1979d4532494bb59..05e47cd29598bf258dd2a7dc0adf42abc6585bfa 100644 (file)
@@ -95,7 +95,7 @@ static void health_client_cancel(struct bt_mesh_model *model,
     /* If it is a publish message, sent to the user directly. */
     buf.data = (u8_t *)status;
     buf.len  = (u16_t)len;
-    node = bt_mesh_is_model_message_publish(model, ctx, &buf, true);
+    node = bt_mesh_is_client_recv_publish_msg(model, ctx, &buf, true);
     if (!node) {
         BT_DBG("Unexpected health status message 0x%x", ctx->recv_op);
     } else {
@@ -169,7 +169,7 @@ static void health_current_status(struct bt_mesh_model *model,
            bt_hex(buf->data, buf->len));
 
     /* Health current status is a publish message, sent to the user directly. */
-    if (!(node = bt_mesh_is_model_message_publish(model, ctx, buf, true))) {
+    if (!(node = bt_mesh_is_client_recv_publish_msg(model, ctx, buf, true))) {
         return;
     }
 
index 8f46a045ad007018a271d61cf82090b01fc50290..5bf8b2032f22c8995b46cf01b0f6a7ec1f322e5f 100644 (file)
@@ -23,8 +23,8 @@
  */
 
 /* Config client model common structure */
-typedef bt_mesh_client_common_t bt_mesh_config_client_t;
-typedef bt_mesh_internal_data_t config_internal_data_t;
+typedef bt_mesh_client_user_data_t      bt_mesh_config_client_t;
+typedef bt_mesh_client_internal_data_t  config_internal_data_t;
 
 extern const struct bt_mesh_model_op bt_mesh_cfg_cli_op[];
 
index b1e1b693d0161020a02cddad5ba15f27acc9c7b6..4f080766cd4a0075c5397ebaa2dfad47756e5ff2 100644 (file)
  */
 
 /* Health client model common structure */
-typedef bt_mesh_client_common_t bt_mesh_health_client_t;
-typedef bt_mesh_internal_data_t health_internal_data_t;
-
-typedef bt_mesh_internal_data_t health_client_internal_data_t;
+typedef bt_mesh_client_user_data_t      bt_mesh_health_client_t;
+typedef bt_mesh_client_internal_data_t  health_internal_data_t;
 
 extern const struct bt_mesh_model_op bt_mesh_health_cli_op[];
 
index 0902783515597569cbf41bcd1e89a49913bc9da4..98f93cb04eb9fd6172ede0ed38abf3f368a5ae4d 100644 (file)
@@ -474,7 +474,7 @@ int bt_mesh_trans_send(struct bt_mesh_net_tx *tx, struct net_buf_simple *msg,
            tx->ctx->app_idx, tx->ctx->addr);
     BT_DBG("len %u: %s", msg->len, bt_hex(msg->data, msg->len));
 
-    role = bt_mesh_get_model_role(tx->ctx->model, tx->ctx->srv_send);
+    role = bt_mesh_get_device_role(tx->ctx->model, tx->ctx->srv_send);
     if (role == ROLE_NVAL) {
         BT_ERR("%s, Failed to get model role", __func__);
         return -EINVAL;
index 8802e424cce3844e51766170ab6d52ca7b4891fd..c2590935bcff342100b66fc5c903abb2434f4929 100644 (file)
 #include "mesh.h"
 #include "client_common.h"
 
-bt_mesh_client_node_t *bt_mesh_is_model_message_publish(struct bt_mesh_model *model,
+bt_mesh_client_node_t *bt_mesh_is_client_recv_publish_msg(
+        struct bt_mesh_model *model,
         struct bt_mesh_msg_ctx *ctx,
-        struct net_buf_simple *buf,
-        bool need_pub)
+        struct net_buf_simple *buf, bool need_pub)
 {
-    bt_mesh_internal_data_t *data = NULL;
-    bt_mesh_client_common_t *cli = NULL;
+    bt_mesh_client_internal_data_t *data = NULL;
+    bt_mesh_client_user_data_t *cli = NULL;
     bt_mesh_client_node_t *node = NULL;
     u32_t rsp;
 
@@ -40,7 +40,7 @@ bt_mesh_client_node_t *bt_mesh_is_model_message_publish(struct bt_mesh_model *mo
         return NULL;
     }
 
-    cli = (bt_mesh_client_common_t *)model->user_data;
+    cli = (bt_mesh_client_user_data_t *)model->user_data;
     if (!cli) {
         BT_ERR("%s, Clinet user_data is NULL", __func__);
         return NULL;
@@ -65,7 +65,7 @@ bt_mesh_client_node_t *bt_mesh_is_model_message_publish(struct bt_mesh_model *mo
      *  message, then the message is from another element and
      *  push it to application layer.
      */
-    data = (bt_mesh_internal_data_t *)cli->internal_data;
+    data = (bt_mesh_client_internal_data_t *)cli->internal_data;
     if (!data) {
         BT_ERR("%s, Client internal_data is NULL", __func__);
         return NULL;
@@ -172,8 +172,8 @@ int bt_mesh_client_send_msg(struct bt_mesh_model *model,
                             const struct bt_mesh_send_cb *cb,
                             void *cb_data)
 {
-    bt_mesh_internal_data_t *internal = NULL;
-    bt_mesh_client_common_t *cli = NULL;
+    bt_mesh_client_internal_data_t *internal = NULL;
+    bt_mesh_client_user_data_t *cli = NULL;
     bt_mesh_client_node_t *node = NULL;
     int err;
 
@@ -182,9 +182,9 @@ int bt_mesh_client_send_msg(struct bt_mesh_model *model,
         return -EINVAL;
     }
 
-    cli = (bt_mesh_client_common_t *)model->user_data;
+    cli = (bt_mesh_client_user_data_t *)model->user_data;
     __ASSERT(cli, "Invalid client value when sent client msg.");
-    internal = (bt_mesh_internal_data_t *)cli->internal_data;
+    internal = (bt_mesh_client_internal_data_t *)cli->internal_data;
     __ASSERT(internal, "Invalid internal value when sent client msg.");
 
     if (!need_ack) {
@@ -224,8 +224,8 @@ int bt_mesh_client_send_msg(struct bt_mesh_model *model,
 
 int bt_mesh_client_init(struct bt_mesh_model *model)
 {
-    bt_mesh_internal_data_t *data = NULL;
-    bt_mesh_client_common_t *cli = NULL;
+    bt_mesh_client_internal_data_t *data = NULL;
+    bt_mesh_client_user_data_t *cli = NULL;
 
     if (!model) {
         BT_ERR("%s, Invalid parameter", __func__);
@@ -244,7 +244,7 @@ int bt_mesh_client_init(struct bt_mesh_model *model)
     }
 
     /* TODO: call osi_free() when deinit function is invoked */
-    data = osi_calloc(sizeof(bt_mesh_internal_data_t));
+    data = osi_calloc(sizeof(bt_mesh_client_internal_data_t));
     if (!data) {
         BT_ERR("%s, Failed to allocate memory", __func__);
         return -ENOMEM;
@@ -275,16 +275,16 @@ int bt_mesh_client_free_node(sys_slist_t *queue, bt_mesh_client_node_t *node)
     return 0;
 }
 
-int bt_mesh_set_model_role(bt_mesh_role_param_t *common)
+int bt_mesh_set_client_model_role(bt_mesh_role_param_t *common)
 {
-    bt_mesh_client_common_t *client = NULL;
+    bt_mesh_client_user_data_t *client = NULL;
 
     if (!common || !common->model || !common->model->user_data) {
         BT_ERR("%s, Invalid parameter", __func__);
         return -EINVAL;
     }
 
-    client = (bt_mesh_client_common_t *)common->model->user_data;
+    client = (bt_mesh_client_user_data_t *)common->model->user_data;
 
     switch (common->role) {
 #if CONFIG_BLE_MESH_NODE
@@ -315,4 +315,3 @@ int bt_mesh_set_model_role(bt_mesh_role_param_t *common)
 
     return 0;
 }
-
index 9e963095dd1758b8197756d3e180f5b8a2127962..32860a603d5d306445f6b131332949fa3f29af48 100644 (file)
@@ -535,7 +535,7 @@ static void generic_status(struct bt_mesh_model *model,
 
     buf->data = val;
     buf->len  = len;
-    node = bt_mesh_is_model_message_publish(model, ctx, buf, true);
+    node = bt_mesh_is_client_recv_publish_msg(model, ctx, buf, true);
     if (!node) {
         BT_DBG("Unexpected generic status message 0x%x", rsp);
     } else {
@@ -687,7 +687,7 @@ const struct bt_mesh_model_op gen_property_cli_op[] = {
     BLE_MESH_MODEL_OP_END,
 };
 
-static int gen_get_state(struct bt_mesh_common_param *common, void *value)
+static int gen_get_state(bt_mesh_client_common_param_t *common, void *value)
 {
     NET_BUF_SIMPLE_DEFINE(msg, BLE_MESH_GEN_GET_STATE_MSG_LEN);
     int err;
@@ -736,7 +736,7 @@ static int gen_get_state(struct bt_mesh_common_param *common, void *value)
     return err;
 }
 
-static int gen_set_state(struct bt_mesh_common_param *common,
+static int gen_set_state(bt_mesh_client_common_param_t *common,
                          void *value, u16_t value_len, bool need_ack)
 {
     struct net_buf_simple *msg = NULL;
@@ -918,7 +918,7 @@ end:
     return err;
 }
 
-int bt_mesh_generic_client_get_state(struct bt_mesh_common_param *common, void *get, void *status)
+int bt_mesh_generic_client_get_state(bt_mesh_client_common_param_t *common, void *get, void *status)
 {
     bt_mesh_generic_client_t *client = NULL;
 
@@ -981,7 +981,7 @@ int bt_mesh_generic_client_get_state(struct bt_mesh_common_param *common, void *
     return gen_get_state(common, get);
 }
 
-int bt_mesh_generic_client_set_state(struct bt_mesh_common_param *common, void *set, void *status)
+int bt_mesh_generic_client_set_state(bt_mesh_client_common_param_t *common, void *set, void *status)
 {
     bt_mesh_generic_client_t *client = NULL;
     u16_t length   = 0;
index 55d78831d3632e81cb23e3514b86dae6bddf07aa..384d08a05dc4fb28bb73942a5cee72393dc7ac11 100644 (file)
 
 #include "mesh_access.h"
 
-/** Mesh Client Model Context */
+/** Client model opcode pair table */
 typedef struct {
-    u32_t cli_op;              /* The client opcode */
-    u32_t status_op;           /* The server status opcode corresponding to the client opcode */
+    u32_t cli_op;       /* Client message opcode */
+    u32_t status_op;    /* Corresponding status message opcode */
 } bt_mesh_client_op_pair_t;
 
-/** Mesh Client Model Context */
+/** Client model user data context */
 typedef struct {
+    /** Pointer to the client model */
     struct bt_mesh_model *model;
-    int op_pair_size; /* the size of op_pair */
+
+    /** Size of the opcode pair table */
+    int op_pair_size;
+
+    /** Pointer to the opcode pair table */
     const bt_mesh_client_op_pair_t *op_pair;
+
     /**
      * @brief This function is a callback function used to push the received unsolicited
      *        messages to the application layer.
@@ -40,26 +46,42 @@ typedef struct {
      * @return None
      */
     void (*publish_status)(u32_t opcode, struct bt_mesh_model *model, struct bt_mesh_msg_ctx *ctx, struct net_buf_simple *buf);
-    void *internal_data; /* Pointer of the structure of internal data */
-    u8_t msg_role; /* device role of the tx message */
-} bt_mesh_client_common_t;
 
+    /** Pointer to the internal data of client model */
+    void *internal_data;
+
+    /** Role of the device to which the client model belongs */
+    u8_t msg_role;
+} bt_mesh_client_user_data_t;
+
+/** Client model internal data context */
 typedef struct  {
     sys_slist_t queue;
-} bt_mesh_internal_data_t;
+} bt_mesh_client_internal_data_t;
 
+/** Client model sending message related context */
 typedef struct {
     sys_snode_t client_node;
-    struct bt_mesh_msg_ctx ctx;
-    u32_t opcode;     /* Indicate the opcode of the message sending */
-    u32_t op_pending; /* Indicate the status message waiting for    */
-    struct k_delayed_work timer; /* Message send Timer. Only for stack-internal use. */
+    struct bt_mesh_msg_ctx ctx;     /* Message context */
+    u32_t opcode;                   /* Message opcode */
+    u32_t op_pending;               /* Expected status message opcode */
+    struct k_delayed_work timer;    /* Time used to get response. Only for internal use. */
 } bt_mesh_client_node_t;
 
+/** Client model sending message parameters */
+typedef struct {
+    u32_t opcode;                       /* Message opcode */
+    struct bt_mesh_model *model;        /* Pointer to the client model */
+    struct bt_mesh_msg_ctx ctx;         /* Message context */
+    s32_t msg_timeout;                  /* Time to get corresponding response */
+    const struct bt_mesh_send_cb *cb;   /* User defined callback function */
+    void *cb_data;                      /* User defined callback value */
+} bt_mesh_client_common_param_t;
+
 int bt_mesh_client_init(struct bt_mesh_model *model);
 
 /**
- * @brief Check the msg is a publish msg or not
+ * @brief Check if the msg received by client model is a publish msg or not
  *
  * @param model     Mesh (client) Model that the message belongs to.
  * @param ctx       Message context, includes keys, TTL, etc.
@@ -67,10 +89,10 @@ int bt_mesh_client_init(struct bt_mesh_model *model);
  * @param need_pub  Indicate if the msg sent to app layer as a publish msg
  * @return 0 on success, or (negative) error code on failure.
  */
-bt_mesh_client_node_t *bt_mesh_is_model_message_publish(struct bt_mesh_model *model,
+bt_mesh_client_node_t *bt_mesh_is_client_recv_publish_msg(
+        struct bt_mesh_model *model,
         struct bt_mesh_msg_ctx *ctx,
-        struct net_buf_simple *buf,
-        bool need_pub);
+        struct net_buf_simple *buf, bool need_pub);
 
 bool bt_mesh_client_find_opcode_in_list(sys_slist_t *list, u32_t opcode);
 
@@ -94,18 +116,9 @@ enum {
     FAST_PROV,
 };
 
-#define ROLE_NVAL 0xFF
+#define ROLE_NVAL   0xFF
 
-struct bt_mesh_common_param {
-    u32_t opcode;                     /* Message opcode           */
-    struct bt_mesh_model *model;      /* Pointer to cli structure */
-    struct bt_mesh_msg_ctx ctx;       /* Message context */
-    s32_t msg_timeout;                /* Time to get response messages */
-    const struct bt_mesh_send_cb *cb; /* User defined callback function       */
-    void *cb_data;                    /* Data as parameter of the cb function */
-};
-
-typedef struct bt_mesh_role_param {
+typedef struct {
     struct bt_mesh_model *model;    /* The client model structure */
     u8_t  role;                     /* Role of the device - Node/Provisioner */
 } bt_mesh_role_param_t;
@@ -113,11 +126,11 @@ typedef struct bt_mesh_role_param {
 /**
  * @brief This function copies node_index for stack internal use.
  *
- * @param[in] common: Pointer to the struct bt_mesh_role_param structure
+ * @param[in] common: Pointer to the bt_mesh_role_param_t structure
  *
  * @return Zero - success, otherwise - fail
  */
-int bt_mesh_set_model_role(bt_mesh_role_param_t *common);
+int bt_mesh_set_client_model_role(bt_mesh_role_param_t *common);
 
 #endif /* _MODEL_COMMON_H_ */
 
index b3cee9c75663ce5df0a560c14bac607f84cf16e7..e697e25716d07cf1abf55c026305c09bc54a63a4 100644 (file)
@@ -25,8 +25,8 @@
 #include "client_common.h"
 
 /* Generic client model common structure */
-typedef bt_mesh_client_common_t bt_mesh_generic_client_t;
-typedef bt_mesh_internal_data_t generic_internal_data_t;
+typedef bt_mesh_client_user_data_t      bt_mesh_generic_client_t;
+typedef bt_mesh_client_internal_data_t  generic_internal_data_t;
 
 /* Generic OnOff Client Model Context */
 extern const struct bt_mesh_model_op gen_onoff_cli_op[];
@@ -45,7 +45,7 @@ extern const struct bt_mesh_model_op gen_onoff_cli_op[];
         BLE_MESH_MODEL(BLE_MESH_MODEL_ID_GEN_ONOFF_CLI,     \
                     gen_onoff_cli_op, cli_pub, cli_data)
 
-typedef bt_mesh_client_common_t bt_mesh_gen_onoff_cli_t;
+typedef bt_mesh_client_user_data_t  bt_mesh_gen_onoff_client_t;
 
 struct bt_mesh_gen_onoff_status {
     bool op_en;         /* Indicate whether optional parameters included  */
@@ -79,7 +79,7 @@ extern const struct bt_mesh_model_op gen_level_cli_op[];
         BLE_MESH_MODEL(BLE_MESH_MODEL_ID_GEN_LEVEL_CLI,     \
                     gen_level_cli_op, cli_pub, cli_data)
 
-typedef bt_mesh_client_common_t bt_mesh_gen_level_cli_t;
+typedef bt_mesh_client_user_data_t  bt_mesh_gen_level_client_t;
 
 struct bt_mesh_gen_level_status {
     bool  op_en;         /* Indicate whether optional parameters included      */
@@ -130,7 +130,7 @@ extern const struct bt_mesh_model_op gen_def_trans_time_cli_op[];
         BLE_MESH_MODEL(BLE_MESH_MODEL_ID_GEN_DEF_TRANS_TIME_CLI,    \
                     gen_def_trans_time_cli_op, cli_pub, cli_data)
 
-typedef bt_mesh_client_common_t bt_mesh_gen_def_trans_time_cli_t;
+typedef bt_mesh_client_user_data_t  bt_mesh_gen_def_trans_time_client_t;
 
 struct bt_mesh_gen_def_trans_time_set {
     u8_t trans_time;  /* The value of the Generic Default Transition Time state */
@@ -157,7 +157,7 @@ extern const struct bt_mesh_model_op gen_power_onoff_cli_op[];
         BLE_MESH_MODEL(BLE_MESH_MODEL_ID_GEN_POWER_ONOFF_CLI,   \
                     gen_power_onoff_cli_op, cli_pub, cli_data)
 
-typedef bt_mesh_client_common_t bt_mesh_gen_power_onoff_cli_t;
+typedef bt_mesh_client_user_data_t  bt_mesh_gen_power_onoff_client_t;
 
 struct bt_mesh_gen_onpowerup_set {
     u8_t onpowerup;  /* The value of the Generic OnPowerUp state */
@@ -184,7 +184,7 @@ extern const struct bt_mesh_model_op gen_power_level_cli_op[];
         BLE_MESH_MODEL(BLE_MESH_MODEL_ID_GEN_POWER_LEVEL_CLI,   \
                     gen_power_level_cli_op, cli_pub, cli_data)
 
-typedef bt_mesh_client_common_t bt_mesh_gen_power_level_cli_t;
+typedef bt_mesh_client_user_data_t  bt_mesh_gen_power_level_client_t;
 
 struct bt_mesh_gen_power_level_status {
     bool  op_en;         /* Indicate whether optional parameters included         */
@@ -241,7 +241,7 @@ extern const struct bt_mesh_model_op gen_battery_cli_op[];
         BLE_MESH_MODEL(BLE_MESH_MODEL_ID_GEN_BATTERY_CLI,   \
                     gen_battery_cli_op, cli_pub, cli_data)
 
-typedef bt_mesh_client_common_t bt_mesh_gen_battery_cli_t;
+typedef bt_mesh_client_user_data_t  bt_mesh_gen_battery_client_t;
 
 struct bt_mesh_gen_battery_status {
     u32_t battery_level     : 8;  /* Value of Generic Battery Level state             */
@@ -267,7 +267,7 @@ extern const struct bt_mesh_model_op gen_location_cli_op[];
         BLE_MESH_MODEL(BLE_MESH_MODEL_ID_GEN_LOCATION_CLI,  \
                     gen_location_cli_op, cli_pub, cli_data)
 
-typedef bt_mesh_client_common_t bt_mesh_gen_location_cli_t;
+typedef bt_mesh_client_user_data_t  bt_mesh_gen_location_client_t;
 
 struct bt_mesh_gen_loc_global_status {
     s32_t global_latitude;  /* Global Coordinates (Latitude)  */
@@ -314,7 +314,7 @@ extern const struct bt_mesh_model_op gen_property_cli_op[];
         BLE_MESH_MODEL(BLE_MESH_MODEL_ID_GEN_PROP_CLI,      \
                     gen_property_cli_op, cli_pub, cli_data)
 
-typedef bt_mesh_client_common_t bt_mesh_gen_property_cli_t;
+typedef bt_mesh_client_user_data_t  bt_mesh_gen_property_client_t;
 
 struct bt_mesh_gen_user_properties_status {
     struct net_buf_simple *user_property_ids; /* Buffer contains a sequence of N User Property IDs */
@@ -475,7 +475,7 @@ int bt_mesh_gen_property_cli_init(struct bt_mesh_model *model, bool primary);
  *
  * @return Zero-success, other-fail
  */
-int bt_mesh_generic_client_get_state(struct bt_mesh_common_param *common, void *get, void *status);
+int bt_mesh_generic_client_get_state(bt_mesh_client_common_param_t *common, void *get, void *status);
 
 /**
  * @brief This function is called to set generic states.
@@ -486,6 +486,6 @@ int bt_mesh_generic_client_get_state(struct bt_mesh_common_param *common, void *
  *
  * @return Zero-success, other-fail
  */
-int bt_mesh_generic_client_set_state(struct bt_mesh_common_param *common, void *set, void *status);
+int bt_mesh_generic_client_set_state(bt_mesh_client_common_param_t *common, void *set, void *status);
 
 #endif /* _GENERIC_CLIENT_H_ */
index bd2b735a6ef4490e529568173592bfbe7e5a8e83..85020521555c6001b39e786066ecba22ba7dd63e 100644 (file)
@@ -25,8 +25,8 @@
 #include "client_common.h"
 
 /* Light client model common structure */
-typedef bt_mesh_client_common_t bt_mesh_light_client_t;
-typedef bt_mesh_internal_data_t light_internal_data_t;
+typedef bt_mesh_client_user_data_t      bt_mesh_light_client_t;
+typedef bt_mesh_client_internal_data_t  light_internal_data_t;
 
 /* Light Lightness Client Model Context */
 extern const struct bt_mesh_model_op light_lightness_cli_op[];
@@ -45,7 +45,7 @@ extern const struct bt_mesh_model_op light_lightness_cli_op[];
         BLE_MESH_MODEL(BLE_MESH_MODEL_ID_LIGHT_LIGHTNESS_CLI,   \
                     light_lightness_cli_op, cli_pub, cli_data)
 
-typedef bt_mesh_client_common_t bt_mesh_light_lightness_cli_t;
+typedef bt_mesh_client_user_data_t  bt_mesh_light_lightness_client_t;
 
 struct bt_mesh_light_lightness_status {
     bool  op_en;             /* Indicate whether optional parameters included           */
@@ -117,7 +117,7 @@ extern const struct bt_mesh_model_op light_ctl_cli_op[];
         BLE_MESH_MODEL(BLE_MESH_MODEL_ID_LIGHT_CTL_CLI,     \
                     light_ctl_cli_op, cli_pub, cli_data)
 
-typedef bt_mesh_client_common_t bt_mesh_light_ctl_cli_t;
+typedef bt_mesh_client_user_data_t  bt_mesh_light_ctl_client_t;
 
 struct bt_mesh_light_ctl_status {
     bool  op_en;                   /* Indicate whether optional parameters included        */
@@ -196,7 +196,7 @@ extern const struct bt_mesh_model_op light_hsl_cli_op[];
         BLE_MESH_MODEL(BLE_MESH_MODEL_ID_LIGHT_HSL_CLI,     \
                     light_hsl_cli_op, cli_pub, cli_data)
 
-typedef bt_mesh_client_common_t bt_mesh_light_hsl_cli_t;
+typedef bt_mesh_client_user_data_t  bt_mesh_light_hsl_client_t;
 
 struct bt_mesh_light_hsl_status {
     bool  op_en;          /* Indicate whether optional parameters included */
@@ -298,7 +298,7 @@ extern const struct bt_mesh_model_op light_xyl_cli_op[];
         BLE_MESH_MODEL(BLE_MESH_MODEL_ID_LIGHT_XYL_CLI,     \
                     light_xyl_cli_op, cli_pub, cli_data)
 
-typedef bt_mesh_client_common_t bt_mesh_light_xyl_cli_t;
+typedef bt_mesh_client_user_data_t  bt_mesh_light_xyl_client_t;
 
 struct bt_mesh_light_xyl_status {
     bool  op_en;         /* Indicate whether optional parameters included      */
@@ -370,7 +370,7 @@ extern const struct bt_mesh_model_op light_lc_cli_op[];
         BLE_MESH_MODEL(BLE_MESH_MODEL_ID_LIGHT_LC_CLI,      \
                     light_lc_cli_op, cli_pub, cli_data)
 
-typedef bt_mesh_client_common_t bt_mesh_light_lc_cli_t;
+typedef bt_mesh_client_user_data_t  bt_mesh_light_lc_client_t;
 
 struct bt_mesh_light_lc_mode_status {
     u8_t mode; /* The present value of the Light LC Mode state */
@@ -476,7 +476,7 @@ int bt_mesh_light_lc_cli_init(struct bt_mesh_model *model, bool primary);
  *
  * @return Zero-success, other-fail
  */
-int bt_mesh_light_client_get_state(struct bt_mesh_common_param *common, void *get, void *status);
+int bt_mesh_light_client_get_state(bt_mesh_client_common_param_t *common, void *get, void *status);
 
 /**
  * @brief This function is called to set light states.
@@ -487,6 +487,6 @@ int bt_mesh_light_client_get_state(struct bt_mesh_common_param *common, void *ge
  *
  * @return Zero-success, other-fail
  */
-int bt_mesh_light_client_set_state(struct bt_mesh_common_param *common, void *set, void *status);
+int bt_mesh_light_client_set_state(bt_mesh_client_common_param_t *common, void *set, void *status);
 
 #endif /* _LIGHTING_CLIENT_H_ */
index 14b450513e97c3b3c9007d3d21ec0c82ae3b0de3..39855bd9a7b6de5cfdde0fa13f2da6e510538f39 100644 (file)
@@ -41,8 +41,8 @@ extern const struct bt_mesh_model_op sensor_cli_op[];
         BLE_MESH_MODEL(BLE_MESH_MODEL_ID_SENSOR_CLI,    \
                     sensor_cli_op, cli_pub, cli_data)
 
-typedef bt_mesh_client_common_t bt_mesh_sensor_client_t;
-typedef bt_mesh_internal_data_t sensor_internal_data_t;
+typedef bt_mesh_client_user_data_t      bt_mesh_sensor_client_t;
+typedef bt_mesh_client_internal_data_t  sensor_internal_data_t;
 
 struct bt_mesh_sensor_descriptor_status {
     struct net_buf_simple *descriptor; /* Sequence of 8-octet sensor descriptors (optional) */
@@ -151,7 +151,7 @@ int bt_mesh_sensor_cli_init(struct bt_mesh_model *model, bool primary);
  *
  * @return Zero-success, other-fail
  */
-int bt_mesh_sensor_client_get_state(struct bt_mesh_common_param *common, void *get, void *status);
+int bt_mesh_sensor_client_get_state(bt_mesh_client_common_param_t *common, void *get, void *status);
 
 /**
  * @brief This function is called to set sensor states.
@@ -162,6 +162,6 @@ int bt_mesh_sensor_client_get_state(struct bt_mesh_common_param *common, void *g
  *
  * @return Zero-success, other-fail
  */
-int bt_mesh_sensor_client_set_state(struct bt_mesh_common_param *common, void *set, void *status);
+int bt_mesh_sensor_client_set_state(bt_mesh_client_common_param_t *common, void *set, void *status);
 
 #endif /* _SENSOR_CLIENT_H_ */
index b6c8d18bf075e73808e8d685c42749c77847c509..182316e05df3d4c900773470cfd2b7b73d8eb6c7 100644 (file)
@@ -25,8 +25,8 @@
 #include "client_common.h"
 
 /* Time scene client model common structure */
-typedef bt_mesh_client_common_t bt_mesh_time_scene_client_t;
-typedef bt_mesh_internal_data_t time_scene_internal_data_t;
+typedef bt_mesh_client_user_data_t      bt_mesh_time_scene_client_t;
+typedef bt_mesh_client_internal_data_t  time_scene_internal_data_t;
 
 /* Time Client Model Context */
 extern const struct bt_mesh_model_op time_cli_op[];
@@ -45,7 +45,7 @@ extern const struct bt_mesh_model_op time_cli_op[];
         BLE_MESH_MODEL(BLE_MESH_MODEL_ID_TIME_CLI,      \
                     time_cli_op, cli_pub, cli_data)
 
-typedef bt_mesh_client_common_t bt_mesh_time_cli_t;
+typedef bt_mesh_client_user_data_t  bt_mesh_time_client_t;
 
 struct bt_mesh_time_status {
     u8_t  tai_seconds[5];     /* The current TAI time in seconds */
@@ -115,7 +115,7 @@ extern const struct bt_mesh_model_op scene_cli_op[];
         BLE_MESH_MODEL(BLE_MESH_MODEL_ID_SCENE_CLI,     \
                     scene_cli_op, cli_pub, cli_data)
 
-typedef bt_mesh_client_common_t bt_mesh_scene_cli_t;
+typedef bt_mesh_client_user_data_t  bt_mesh_scene_client_t;
 
 struct bt_mesh_scene_status {
     bool  op_en;         /* Indicate whether optional parameters included */
@@ -164,7 +164,7 @@ extern const struct bt_mesh_model_op scheduler_cli_op[];
         BLE_MESH_MODEL(BLE_MESH_MODEL_ID_SCHEDULER_CLI,     \
                     scheduler_cli_op, cli_pub, cli_data)
 
-typedef bt_mesh_client_common_t bt_mesh_scheduler_cli_t;
+typedef bt_mesh_client_user_data_t  bt_mesh_scheduler_client_t;
 
 struct bt_mesh_scheduler_status {
     u16_t schedules; /* Bit field indicating defined Actions in the Schedule Register */
@@ -241,7 +241,7 @@ int bt_mesh_scheduler_cli_init(struct bt_mesh_model *model, bool primary);
  *
  * @return Zero-success, other-fail
  */
-int bt_mesh_time_scene_client_get_state(struct bt_mesh_common_param *common, void *get, void *status);
+int bt_mesh_time_scene_client_get_state(bt_mesh_client_common_param_t *common, void *get, void *status);
 
 /**
  * @brief This function is called to set scene states.
@@ -252,6 +252,6 @@ int bt_mesh_time_scene_client_get_state(struct bt_mesh_common_param *common, voi
  *
  * @return Zero-success, other-fail
  */
-int bt_mesh_time_scene_client_set_state(struct bt_mesh_common_param *common, void *set, void *status);
+int bt_mesh_time_scene_client_set_state(bt_mesh_client_common_param_t *common, void *set, void *status);
 
 #endif /* _TIME_SCENE_CLIENT_H_ */
index 8f0481b86d2888c1ddcbca860e36cb13e5c4d3e2..d71f3ccce5f85595650d8110f07c60641cb51a9d 100644 (file)
@@ -650,7 +650,7 @@ static void light_status(struct bt_mesh_model *model,
 
     buf->data = val;
     buf->len  = len;
-    node = bt_mesh_is_model_message_publish(model, ctx, buf, true);
+    node = bt_mesh_is_client_recv_publish_msg(model, ctx, buf, true);
     if (!node) {
         BT_DBG("Unexpected light status message 0x%x", rsp);
     } else {
@@ -770,7 +770,7 @@ const struct bt_mesh_model_op light_lc_cli_op[] = {
     BLE_MESH_MODEL_OP_END,
 };
 
-static int light_get_state(struct bt_mesh_common_param *common, void *value)
+static int light_get_state(bt_mesh_client_common_param_t *common, void *value)
 {
     NET_BUF_SIMPLE_DEFINE(msg, BLE_MESH_LIGHT_GET_STATE_MSG_LEN);
     int err;
@@ -801,7 +801,7 @@ static int light_get_state(struct bt_mesh_common_param *common, void *value)
     return err;
 }
 
-static int light_set_state(struct bt_mesh_common_param *common,
+static int light_set_state(bt_mesh_client_common_param_t *common,
                            void *value, u16_t value_len, bool need_ack)
 {
     struct net_buf_simple *msg = NULL;
@@ -1042,7 +1042,7 @@ end:
     return err;
 }
 
-int bt_mesh_light_client_get_state(struct bt_mesh_common_param *common, void *get, void *status)
+int bt_mesh_light_client_get_state(bt_mesh_client_common_param_t *common, void *get, void *status)
 {
     bt_mesh_light_client_t *client = NULL;
 
@@ -1095,7 +1095,7 @@ int bt_mesh_light_client_get_state(struct bt_mesh_common_param *common, void *ge
     return light_get_state(common, get);
 }
 
-int bt_mesh_light_client_set_state(struct bt_mesh_common_param *common, void *set, void *status)
+int bt_mesh_light_client_set_state(bt_mesh_client_common_param_t *common, void *set, void *status)
 {
     bt_mesh_light_client_t *client = NULL;
     u16_t length   = 0;
index 26ea1f8d7e7a833258b8b7efc1cca1f60871df15..2187f18551e65e6ff432533239f3b4da91cada44 100644 (file)
@@ -262,7 +262,7 @@ static void sensor_status(struct bt_mesh_model *model,
 
     buf->data = val;
     buf->len  = len;
-    node = bt_mesh_is_model_message_publish(model, ctx, buf, true);
+    node = bt_mesh_is_client_recv_publish_msg(model, ctx, buf, true);
     if (!node) {
         BT_DBG("Unexpected sensor status message 0x%x", rsp);
     } else {
@@ -352,7 +352,7 @@ const struct bt_mesh_model_op sensor_cli_op[] = {
     BLE_MESH_MODEL_OP_END,
 };
 
-static int sensor_act_state(struct bt_mesh_common_param *common,
+static int sensor_act_state(bt_mesh_client_common_param_t *common,
                             void *value, u16_t value_len, bool need_ack)
 {
     struct net_buf_simple *msg = NULL;
@@ -460,7 +460,7 @@ end:
     return err;
 }
 
-int bt_mesh_sensor_client_get_state(struct bt_mesh_common_param *common, void *get, void *status)
+int bt_mesh_sensor_client_get_state(bt_mesh_client_common_param_t *common, void *get, void *status)
 {
     bt_mesh_sensor_client_t *client = NULL;
     u16_t length = 0;
@@ -525,7 +525,7 @@ int bt_mesh_sensor_client_get_state(struct bt_mesh_common_param *common, void *g
     return sensor_act_state(common, get, length, true);
 }
 
-int bt_mesh_sensor_client_set_state(struct bt_mesh_common_param *common, void *set, void *status)
+int bt_mesh_sensor_client_set_state(bt_mesh_client_common_param_t *common, void *set, void *status)
 {
     bt_mesh_sensor_client_t *client = NULL;
     u16_t length = 0;
index 921c504ae34b7e200b8df3708a071787b4cd64d7..3632c653b01d3b6acc57194758972f33441c4a0b 100644 (file)
@@ -299,7 +299,7 @@ static void time_scene_status(struct bt_mesh_model *model,
 
     buf->data = val;
     buf->len = len;
-    node = bt_mesh_is_model_message_publish(model, ctx, buf, true);
+    node = bt_mesh_is_client_recv_publish_msg(model, ctx, buf, true);
     if (!node) {
         BT_DBG("Unexpected time scene status message 0x%x", rsp);
     } else {
@@ -369,7 +369,7 @@ const struct bt_mesh_model_op scheduler_cli_op[] = {
     BLE_MESH_MODEL_OP_END,
 };
 
-static int time_scene_get_state(struct bt_mesh_common_param *common, void *value)
+static int time_scene_get_state(bt_mesh_client_common_param_t *common, void *value)
 {
     NET_BUF_SIMPLE_DEFINE(msg, BLE_MESH_SCENE_GET_STATE_MSG_LEN);
     int err;
@@ -400,7 +400,7 @@ static int time_scene_get_state(struct bt_mesh_common_param *common, void *value
     return err;
 }
 
-static int time_scene_set_state(struct bt_mesh_common_param *common,
+static int time_scene_set_state(bt_mesh_client_common_param_t *common,
                                 void *value, u16_t value_len, bool need_ack)
 {
     struct net_buf_simple *msg = NULL;
@@ -497,7 +497,7 @@ end:
     return err;
 }
 
-int bt_mesh_time_scene_client_get_state(struct bt_mesh_common_param *common, void *get, void *status)
+int bt_mesh_time_scene_client_get_state(bt_mesh_client_common_param_t *common, void *get, void *status)
 {
     bt_mesh_time_scene_client_t *client = NULL;
 
@@ -535,7 +535,7 @@ int bt_mesh_time_scene_client_get_state(struct bt_mesh_common_param *common, voi
     return time_scene_get_state(common, get);
 }
 
-int bt_mesh_time_scene_client_set_state(struct bt_mesh_common_param *common, void *set, void *status)
+int bt_mesh_time_scene_client_set_state(bt_mesh_client_common_param_t *common, void *set, void *status)
 {
     bt_mesh_time_scene_client_t *client = NULL;
     u16_t length = 0;
index 501450c272ecfa0fe4997fcf0775c3f99cbd7969..2355bf0f3de2fb5f599515c606e717c719b91597 100644 (file)
@@ -56,6 +56,6 @@ void bt_mesh_free_buf(struct net_buf_simple *buf);
  *
  * @return 0 - Node, 1 - Provisioner
  */
-u8_t bt_mesh_get_model_role(struct bt_mesh_model *model, bool srv_send);
+u8_t bt_mesh_get_device_role(struct bt_mesh_model *model, bool srv_send);
 
 #endif /* _MESH_COMMON_H_ */
\ No newline at end of file
index 9e7185d451de9f7de5276760958fdcca7b686294..704e540a20b672e1a52f26513a7bc0e544297d90 100644 (file)
@@ -46,9 +46,9 @@ void bt_mesh_free_buf(struct net_buf_simple *buf)
     }
 }
 
-u8_t bt_mesh_get_model_role(struct bt_mesh_model *model, bool srv_send)
+u8_t bt_mesh_get_device_role(struct bt_mesh_model *model, bool srv_send)
 {
-    bt_mesh_client_common_t *client = NULL;
+    bt_mesh_client_user_data_t *client = NULL;
 
     if (srv_send) {
         BT_DBG("%s, Message is sent by a server model", __func__);
@@ -60,7 +60,7 @@ u8_t bt_mesh_get_model_role(struct bt_mesh_model *model, bool srv_send)
         return ROLE_NVAL;
     }
 
-    client = (bt_mesh_client_common_t *)model->user_data;
+    client = (bt_mesh_client_user_data_t *)model->user_data;
 
     return client->msg_role;
 }