mirror of
https://github.com/espressif/esp-idf.git
synced 2024-10-05 20:47:46 -04:00
ble_mesh: rename ble mesh client model variables and functions
This commit is contained in:
parent
317f4c5ff5
commit
708bff3b17
@ -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;
|
cfg_client_cb.params = arg->cfg_client_get_state.params;
|
||||||
role_param.model = (struct bt_mesh_model *)cfg_client_cb.params->model;
|
role_param.model = (struct bt_mesh_model *)cfg_client_cb.params->model;
|
||||||
role_param.role = cfg_client_cb.params->msg_role;
|
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__);
|
LOG_ERROR("%s, Failed to set model role", __func__);
|
||||||
return;
|
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;
|
cfg_client_cb.params = arg->cfg_client_set_state.params;
|
||||||
role_param.model = (struct bt_mesh_model *)cfg_client_cb.params->model;
|
role_param.model = (struct bt_mesh_model *)cfg_client_cb.params->model;
|
||||||
role_param.role = cfg_client_cb.params->msg_role;
|
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__);
|
LOG_ERROR("%s, Failed to set model role", __func__);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -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_generic_client_cb_param_t generic_client_cb = {0};
|
||||||
esp_ble_mesh_client_common_param_t *params = NULL;
|
esp_ble_mesh_client_common_param_t *params = NULL;
|
||||||
btc_ble_mesh_generic_client_args_t *arg = 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};
|
bt_mesh_role_param_t role_param = {0};
|
||||||
|
|
||||||
if (!msg || !msg->arg) {
|
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;
|
params = arg->generic_client_get_state.params;
|
||||||
role_param.model = (struct bt_mesh_model *)params->model;
|
role_param.model = (struct bt_mesh_model *)params->model;
|
||||||
role_param.role = params->msg_role;
|
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__);
|
LOG_ERROR("%s, Failed to set model role", __func__);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -487,7 +487,7 @@ void btc_mesh_generic_client_call_handler(btc_msg_t *msg)
|
|||||||
params = arg->generic_client_set_state.params;
|
params = arg->generic_client_set_state.params;
|
||||||
role_param.model = (struct bt_mesh_model *)params->model;
|
role_param.model = (struct bt_mesh_model *)params->model;
|
||||||
role_param.role = params->msg_role;
|
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__);
|
LOG_ERROR("%s, Failed to set model role", __func__);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -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;
|
health_client_cb.params = arg->health_client_get_state.params;
|
||||||
role_param.model = (struct bt_mesh_model *)health_client_cb.params->model;
|
role_param.model = (struct bt_mesh_model *)health_client_cb.params->model;
|
||||||
role_param.role = health_client_cb.params->msg_role;
|
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__);
|
LOG_ERROR("%s, Failed to set model role", __func__);
|
||||||
return;
|
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;
|
health_client_cb.params = arg->health_client_set_state.params;
|
||||||
role_param.model = (struct bt_mesh_model *)health_client_cb.params->model;
|
role_param.model = (struct bt_mesh_model *)health_client_cb.params->model;
|
||||||
role_param.role = health_client_cb.params->msg_role;
|
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__);
|
LOG_ERROR("%s, Failed to set model role", __func__);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -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_light_client_cb_param_t light_client_cb = {0};
|
||||||
esp_ble_mesh_client_common_param_t *params = NULL;
|
esp_ble_mesh_client_common_param_t *params = NULL;
|
||||||
btc_ble_mesh_light_client_args_t *arg = 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};
|
bt_mesh_role_param_t role_param = {0};
|
||||||
|
|
||||||
if (!msg || !msg->arg) {
|
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;
|
params = arg->light_client_get_state.params;
|
||||||
role_param.model = (struct bt_mesh_model *)params->model;
|
role_param.model = (struct bt_mesh_model *)params->model;
|
||||||
role_param.role = params->msg_role;
|
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__);
|
LOG_ERROR("%s, Failed to set model role", __func__);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -327,7 +327,7 @@ void btc_mesh_light_client_call_handler(btc_msg_t *msg)
|
|||||||
params = arg->light_client_set_state.params;
|
params = arg->light_client_set_state.params;
|
||||||
role_param.model = (struct bt_mesh_model *)params->model;
|
role_param.model = (struct bt_mesh_model *)params->model;
|
||||||
role_param.role = params->msg_role;
|
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__);
|
LOG_ERROR("%s, Failed to set model role", __func__);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -299,8 +299,8 @@ static void btc_ble_mesh_client_model_op_cb(struct bt_mesh_model *model,
|
|||||||
struct net_buf_simple *buf)
|
struct net_buf_simple *buf)
|
||||||
{
|
{
|
||||||
esp_ble_mesh_model_cb_param_t mesh_param = {0};
|
esp_ble_mesh_model_cb_param_t mesh_param = {0};
|
||||||
bt_mesh_client_common_t *client_param = NULL;
|
bt_mesh_client_user_data_t *client_param = NULL;
|
||||||
bt_mesh_internal_data_t *data = NULL;
|
bt_mesh_client_internal_data_t *data = NULL;
|
||||||
bt_mesh_client_node_t *node = NULL;
|
bt_mesh_client_node_t *node = NULL;
|
||||||
btc_msg_t msg = {0};
|
btc_msg_t msg = {0};
|
||||||
bt_status_t ret;
|
bt_status_t ret;
|
||||||
@ -310,14 +310,14 @@ static void btc_ble_mesh_client_model_op_cb(struct bt_mesh_model *model,
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
client_param = (bt_mesh_client_common_t *)model->user_data;
|
client_param = (bt_mesh_client_user_data_t *)model->user_data;
|
||||||
data = (bt_mesh_internal_data_t *)client_param->internal_data;
|
data = (bt_mesh_client_internal_data_t *)client_param->internal_data;
|
||||||
if (!data) {
|
if (!data) {
|
||||||
LOG_ERROR("%s, Client internal_data is NULL", __func__);
|
LOG_ERROR("%s, Client internal_data is NULL", __func__);
|
||||||
return;
|
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) {
|
if (node == NULL) {
|
||||||
msg.act = ESP_BLE_MESH_CLIENT_MODEL_RECV_PUBLISH_MSG_EVT;
|
msg.act = ESP_BLE_MESH_CLIENT_MODEL_RECV_PUBLISH_MSG_EVT;
|
||||||
mesh_param.client_recv_publish_msg.opcode = mesh_opcode;
|
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)
|
static void btc_client_model_timeout_cb(struct k_work *work)
|
||||||
{
|
{
|
||||||
esp_ble_mesh_model_cb_param_t mesh_param = {0};
|
esp_ble_mesh_model_cb_param_t mesh_param = {0};
|
||||||
bt_mesh_client_common_t *client_param = NULL;
|
bt_mesh_client_user_data_t *client_param = NULL;
|
||||||
bt_mesh_internal_data_t *data = NULL;
|
bt_mesh_client_internal_data_t *data = NULL;
|
||||||
bt_mesh_client_node_t *node = NULL;
|
bt_mesh_client_node_t *node = NULL;
|
||||||
btc_msg_t msg = {0};
|
btc_msg_t msg = {0};
|
||||||
bt_status_t ret;
|
bt_status_t ret;
|
||||||
@ -606,8 +606,8 @@ static void btc_client_model_timeout_cb(struct k_work *work)
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
client_param = (bt_mesh_client_common_t *)node->ctx.model->user_data;
|
client_param = (bt_mesh_client_user_data_t *)node->ctx.model->user_data;
|
||||||
data = (bt_mesh_internal_data_t *)client_param->internal_data;
|
data = (bt_mesh_client_internal_data_t *)client_param->internal_data;
|
||||||
if (!data) {
|
if (!data) {
|
||||||
LOG_ERROR("%s, Client internal_data is NULL", __func__);
|
LOG_ERROR("%s, Client internal_data is NULL", __func__);
|
||||||
return;
|
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: {
|
case BLE_MESH_MODEL_ID_GEN_ONOFF_CLI: {
|
||||||
model->op = ((esp_ble_mesh_model_op_t *)gen_onoff_cli_op);
|
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) {
|
if (cli != NULL) {
|
||||||
cli->publish_status = btc_mesh_generic_client_publish_callback;
|
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: {
|
case BLE_MESH_MODEL_ID_GEN_LEVEL_CLI: {
|
||||||
model->op = ((esp_ble_mesh_model_op_t *)gen_level_cli_op);
|
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) {
|
if (cli != NULL) {
|
||||||
cli->publish_status = btc_mesh_generic_client_publish_callback;
|
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: {
|
case BLE_MESH_MODEL_ID_GEN_DEF_TRANS_TIME_CLI: {
|
||||||
model->op = ((esp_ble_mesh_model_op_t *)gen_def_trans_time_cli_op);
|
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) {
|
if (cli != NULL) {
|
||||||
cli->publish_status = btc_mesh_generic_client_publish_callback;
|
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: {
|
case BLE_MESH_MODEL_ID_GEN_POWER_ONOFF_CLI: {
|
||||||
model->op = ((esp_ble_mesh_model_op_t *)gen_power_onoff_cli_op);
|
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) {
|
if (cli != NULL) {
|
||||||
cli->publish_status = btc_mesh_generic_client_publish_callback;
|
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: {
|
case BLE_MESH_MODEL_ID_GEN_POWER_LEVEL_CLI: {
|
||||||
model->op = ((esp_ble_mesh_model_op_t *)gen_power_level_cli_op);
|
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) {
|
if (cli != NULL) {
|
||||||
cli->publish_status = btc_mesh_generic_client_publish_callback;
|
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: {
|
case BLE_MESH_MODEL_ID_GEN_BATTERY_CLI: {
|
||||||
model->op = ((esp_ble_mesh_model_op_t *)gen_battery_cli_op);
|
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) {
|
if (cli != NULL) {
|
||||||
cli->publish_status = btc_mesh_generic_client_publish_callback;
|
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: {
|
case BLE_MESH_MODEL_ID_GEN_LOCATION_CLI: {
|
||||||
model->op = ((esp_ble_mesh_model_op_t *)gen_location_cli_op);
|
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) {
|
if (cli != NULL) {
|
||||||
cli->publish_status = btc_mesh_generic_client_publish_callback;
|
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: {
|
case BLE_MESH_MODEL_ID_GEN_PROP_CLI: {
|
||||||
model->op = ((esp_ble_mesh_model_op_t *)gen_property_cli_op);
|
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) {
|
if (cli != NULL) {
|
||||||
cli->publish_status = btc_mesh_generic_client_publish_callback;
|
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: {
|
case BLE_MESH_MODEL_ID_LIGHT_LIGHTNESS_CLI: {
|
||||||
model->op = ((esp_ble_mesh_model_op_t *)light_lightness_cli_op);
|
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) {
|
if (cli != NULL) {
|
||||||
cli->publish_status = btc_mesh_light_client_publish_callback;
|
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: {
|
case BLE_MESH_MODEL_ID_LIGHT_CTL_CLI: {
|
||||||
model->op = ((esp_ble_mesh_model_op_t *)light_ctl_cli_op);
|
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) {
|
if (cli != NULL) {
|
||||||
cli->publish_status = btc_mesh_light_client_publish_callback;
|
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: {
|
case BLE_MESH_MODEL_ID_LIGHT_HSL_CLI: {
|
||||||
model->op = ((esp_ble_mesh_model_op_t *)light_hsl_cli_op);
|
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) {
|
if (cli != NULL) {
|
||||||
cli->publish_status = btc_mesh_light_client_publish_callback;
|
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: {
|
case BLE_MESH_MODEL_ID_LIGHT_XYL_CLI: {
|
||||||
model->op = ((esp_ble_mesh_model_op_t *)light_xyl_cli_op);
|
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) {
|
if (cli != NULL) {
|
||||||
cli->publish_status = btc_mesh_light_client_publish_callback;
|
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: {
|
case BLE_MESH_MODEL_ID_LIGHT_LC_CLI: {
|
||||||
model->op = ((esp_ble_mesh_model_op_t *)light_lc_cli_op);
|
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) {
|
if (cli != NULL) {
|
||||||
cli->publish_status = btc_mesh_light_client_publish_callback;
|
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: {
|
case BLE_MESH_MODEL_ID_TIME_CLI: {
|
||||||
model->op = ((esp_ble_mesh_model_op_t *)time_cli_op);
|
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) {
|
if (cli != NULL) {
|
||||||
cli->publish_status = btc_mesh_time_scene_client_publish_callback;
|
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: {
|
case BLE_MESH_MODEL_ID_SCENE_CLI: {
|
||||||
model->op = ((esp_ble_mesh_model_op_t *)scene_cli_op);
|
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) {
|
if (cli != NULL) {
|
||||||
cli->publish_status = btc_mesh_time_scene_client_publish_callback;
|
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: {
|
case BLE_MESH_MODEL_ID_SCHEDULER_CLI: {
|
||||||
model->op = ((esp_ble_mesh_model_op_t *)scheduler_cli_op);
|
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) {
|
if (cli != NULL) {
|
||||||
cli->publish_status = btc_mesh_time_scene_client_publish_callback;
|
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};
|
bt_mesh_role_param_t common = {0};
|
||||||
common.model = (struct bt_mesh_model *)(arg->model_publish.model);
|
common.model = (struct bt_mesh_model *)(arg->model_publish.model);
|
||||||
common.role = arg->model_publish.device_role;
|
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__);
|
LOG_ERROR("%s, Failed to set model role", __func__);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -1467,7 +1467,7 @@ void btc_mesh_model_call_handler(btc_msg_t *msg)
|
|||||||
arg->model_send.ctx->srv_send = false;
|
arg->model_send.ctx->srv_send = false;
|
||||||
common.model = (struct bt_mesh_model *)(arg->model_send.model);
|
common.model = (struct bt_mesh_model *)(arg->model_send.model);
|
||||||
common.role = arg->model_send.device_role;
|
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__);
|
LOG_ERROR("%s, Failed to set model role", __func__);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -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_sensor_client_cb_param_t sensor_client_cb = {0};
|
||||||
esp_ble_mesh_client_common_param_t *params = NULL;
|
esp_ble_mesh_client_common_param_t *params = NULL;
|
||||||
btc_ble_mesh_sensor_client_args_t *arg = 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};
|
bt_mesh_role_param_t role_param = {0};
|
||||||
|
|
||||||
if (!msg || !msg->arg) {
|
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;
|
params = arg->sensor_client_get_state.params;
|
||||||
role_param.model = (struct bt_mesh_model *)params->model;
|
role_param.model = (struct bt_mesh_model *)params->model;
|
||||||
role_param.role = params->msg_role;
|
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__);
|
LOG_ERROR("%s, Failed to set model role", __func__);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -578,7 +578,7 @@ void btc_mesh_sensor_client_call_handler(btc_msg_t *msg)
|
|||||||
params = arg->sensor_client_set_state.params;
|
params = arg->sensor_client_set_state.params;
|
||||||
role_param.model = (struct bt_mesh_model *)params->model;
|
role_param.model = (struct bt_mesh_model *)params->model;
|
||||||
role_param.role = params->msg_role;
|
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__);
|
LOG_ERROR("%s, Failed to set model role", __func__);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -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};
|
esp_ble_mesh_time_scene_client_cb_param_t time_scene_client_cb = {0};
|
||||||
btc_ble_mesh_time_scene_client_args_t *arg = NULL;
|
btc_ble_mesh_time_scene_client_args_t *arg = NULL;
|
||||||
esp_ble_mesh_client_common_param_t *params = 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};
|
bt_mesh_role_param_t role_param = {0};
|
||||||
|
|
||||||
if (!msg || !msg->arg) {
|
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;
|
params = arg->time_scene_client_get_state.params;
|
||||||
role_param.model = (struct bt_mesh_model *)params->model;
|
role_param.model = (struct bt_mesh_model *)params->model;
|
||||||
role_param.role = params->msg_role;
|
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__);
|
LOG_ERROR("%s, Failed to set model role", __func__);
|
||||||
return;
|
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;
|
params = arg->time_scene_client_set_state.params;
|
||||||
role_param.model = (struct bt_mesh_model *)params->model;
|
role_param.model = (struct bt_mesh_model *)params->model;
|
||||||
role_param.role = params->msg_role;
|
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__);
|
LOG_ERROR("%s, Failed to set model role", __func__);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -740,7 +740,7 @@ static int model_send(struct bt_mesh_model *model,
|
|||||||
tx->ctx->app_idx, tx->ctx->addr);
|
tx->ctx->app_idx, tx->ctx->addr);
|
||||||
BT_DBG("len %u: %s", msg->len, bt_hex(msg->data, msg->len));
|
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) {
|
if (role == ROLE_NVAL) {
|
||||||
BT_ERR("%s, Failed to get model role", __func__);
|
BT_ERR("%s, Failed to get model role", __func__);
|
||||||
return -EINVAL;
|
return -EINVAL;
|
||||||
@ -819,7 +819,7 @@ int bt_mesh_model_send(struct bt_mesh_model *model,
|
|||||||
struct bt_mesh_subnet *sub = NULL;
|
struct bt_mesh_subnet *sub = NULL;
|
||||||
u8_t role;
|
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) {
|
if (role == ROLE_NVAL) {
|
||||||
BT_ERR("%s, Failed to get model role", __func__);
|
BT_ERR("%s, Failed to get model role", __func__);
|
||||||
return -EINVAL;
|
return -EINVAL;
|
||||||
|
@ -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. */
|
/* If it is a publish message, sent to the user directly. */
|
||||||
buf.data = (u8_t *)status;
|
buf.data = (u8_t *)status;
|
||||||
buf.len = (u16_t)len;
|
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) {
|
if (!node) {
|
||||||
BT_DBG("Unexpected config status message 0x%x", ctx->recv_op);
|
BT_DBG("Unexpected config status message 0x%x", ctx->recv_op);
|
||||||
} else {
|
} else {
|
||||||
|
@ -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. */
|
/* If it is a publish message, sent to the user directly. */
|
||||||
buf.data = (u8_t *)status;
|
buf.data = (u8_t *)status;
|
||||||
buf.len = (u16_t)len;
|
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) {
|
if (!node) {
|
||||||
BT_DBG("Unexpected health status message 0x%x", ctx->recv_op);
|
BT_DBG("Unexpected health status message 0x%x", ctx->recv_op);
|
||||||
} else {
|
} else {
|
||||||
@ -169,7 +169,7 @@ static void health_current_status(struct bt_mesh_model *model,
|
|||||||
bt_hex(buf->data, buf->len));
|
bt_hex(buf->data, buf->len));
|
||||||
|
|
||||||
/* Health current status is a publish message, sent to the user directly. */
|
/* 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;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -23,8 +23,8 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
/* Config client model common structure */
|
/* Config client model common structure */
|
||||||
typedef bt_mesh_client_common_t bt_mesh_config_client_t;
|
typedef bt_mesh_client_user_data_t bt_mesh_config_client_t;
|
||||||
typedef bt_mesh_internal_data_t config_internal_data_t;
|
typedef bt_mesh_client_internal_data_t config_internal_data_t;
|
||||||
|
|
||||||
extern const struct bt_mesh_model_op bt_mesh_cfg_cli_op[];
|
extern const struct bt_mesh_model_op bt_mesh_cfg_cli_op[];
|
||||||
|
|
||||||
|
@ -23,10 +23,8 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
/* Health client model common structure */
|
/* Health client model common structure */
|
||||||
typedef bt_mesh_client_common_t bt_mesh_health_client_t;
|
typedef bt_mesh_client_user_data_t bt_mesh_health_client_t;
|
||||||
typedef bt_mesh_internal_data_t health_internal_data_t;
|
typedef bt_mesh_client_internal_data_t health_internal_data_t;
|
||||||
|
|
||||||
typedef bt_mesh_internal_data_t health_client_internal_data_t;
|
|
||||||
|
|
||||||
extern const struct bt_mesh_model_op bt_mesh_health_cli_op[];
|
extern const struct bt_mesh_model_op bt_mesh_health_cli_op[];
|
||||||
|
|
||||||
|
@ -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);
|
tx->ctx->app_idx, tx->ctx->addr);
|
||||||
BT_DBG("len %u: %s", msg->len, bt_hex(msg->data, msg->len));
|
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) {
|
if (role == ROLE_NVAL) {
|
||||||
BT_ERR("%s, Failed to get model role", __func__);
|
BT_ERR("%s, Failed to get model role", __func__);
|
||||||
return -EINVAL;
|
return -EINVAL;
|
||||||
|
@ -25,13 +25,13 @@
|
|||||||
#include "mesh.h"
|
#include "mesh.h"
|
||||||
#include "client_common.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 bt_mesh_msg_ctx *ctx,
|
||||||
struct net_buf_simple *buf,
|
struct net_buf_simple *buf, bool need_pub)
|
||||||
bool need_pub)
|
|
||||||
{
|
{
|
||||||
bt_mesh_internal_data_t *data = NULL;
|
bt_mesh_client_internal_data_t *data = NULL;
|
||||||
bt_mesh_client_common_t *cli = NULL;
|
bt_mesh_client_user_data_t *cli = NULL;
|
||||||
bt_mesh_client_node_t *node = NULL;
|
bt_mesh_client_node_t *node = NULL;
|
||||||
u32_t rsp;
|
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;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
cli = (bt_mesh_client_common_t *)model->user_data;
|
cli = (bt_mesh_client_user_data_t *)model->user_data;
|
||||||
if (!cli) {
|
if (!cli) {
|
||||||
BT_ERR("%s, Clinet user_data is NULL", __func__);
|
BT_ERR("%s, Clinet user_data is NULL", __func__);
|
||||||
return NULL;
|
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
|
* message, then the message is from another element and
|
||||||
* push it to application layer.
|
* 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) {
|
if (!data) {
|
||||||
BT_ERR("%s, Client internal_data is NULL", __func__);
|
BT_ERR("%s, Client internal_data is NULL", __func__);
|
||||||
return NULL;
|
return NULL;
|
||||||
@ -172,8 +172,8 @@ int bt_mesh_client_send_msg(struct bt_mesh_model *model,
|
|||||||
const struct bt_mesh_send_cb *cb,
|
const struct bt_mesh_send_cb *cb,
|
||||||
void *cb_data)
|
void *cb_data)
|
||||||
{
|
{
|
||||||
bt_mesh_internal_data_t *internal = NULL;
|
bt_mesh_client_internal_data_t *internal = NULL;
|
||||||
bt_mesh_client_common_t *cli = NULL;
|
bt_mesh_client_user_data_t *cli = NULL;
|
||||||
bt_mesh_client_node_t *node = NULL;
|
bt_mesh_client_node_t *node = NULL;
|
||||||
int err;
|
int err;
|
||||||
|
|
||||||
@ -182,9 +182,9 @@ int bt_mesh_client_send_msg(struct bt_mesh_model *model,
|
|||||||
return -EINVAL;
|
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.");
|
__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.");
|
__ASSERT(internal, "Invalid internal value when sent client msg.");
|
||||||
|
|
||||||
if (!need_ack) {
|
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)
|
int bt_mesh_client_init(struct bt_mesh_model *model)
|
||||||
{
|
{
|
||||||
bt_mesh_internal_data_t *data = NULL;
|
bt_mesh_client_internal_data_t *data = NULL;
|
||||||
bt_mesh_client_common_t *cli = NULL;
|
bt_mesh_client_user_data_t *cli = NULL;
|
||||||
|
|
||||||
if (!model) {
|
if (!model) {
|
||||||
BT_ERR("%s, Invalid parameter", __func__);
|
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 */
|
/* 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) {
|
if (!data) {
|
||||||
BT_ERR("%s, Failed to allocate memory", __func__);
|
BT_ERR("%s, Failed to allocate memory", __func__);
|
||||||
return -ENOMEM;
|
return -ENOMEM;
|
||||||
@ -275,16 +275,16 @@ int bt_mesh_client_free_node(sys_slist_t *queue, bt_mesh_client_node_t *node)
|
|||||||
return 0;
|
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) {
|
if (!common || !common->model || !common->model->user_data) {
|
||||||
BT_ERR("%s, Invalid parameter", __func__);
|
BT_ERR("%s, Invalid parameter", __func__);
|
||||||
return -EINVAL;
|
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) {
|
switch (common->role) {
|
||||||
#if CONFIG_BLE_MESH_NODE
|
#if CONFIG_BLE_MESH_NODE
|
||||||
@ -315,4 +315,3 @@ int bt_mesh_set_model_role(bt_mesh_role_param_t *common)
|
|||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -535,7 +535,7 @@ static void generic_status(struct bt_mesh_model *model,
|
|||||||
|
|
||||||
buf->data = val;
|
buf->data = val;
|
||||||
buf->len = len;
|
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) {
|
if (!node) {
|
||||||
BT_DBG("Unexpected generic status message 0x%x", rsp);
|
BT_DBG("Unexpected generic status message 0x%x", rsp);
|
||||||
} else {
|
} else {
|
||||||
@ -687,7 +687,7 @@ const struct bt_mesh_model_op gen_property_cli_op[] = {
|
|||||||
BLE_MESH_MODEL_OP_END,
|
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);
|
NET_BUF_SIMPLE_DEFINE(msg, BLE_MESH_GEN_GET_STATE_MSG_LEN);
|
||||||
int err;
|
int err;
|
||||||
@ -736,7 +736,7 @@ static int gen_get_state(struct bt_mesh_common_param *common, void *value)
|
|||||||
return err;
|
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)
|
void *value, u16_t value_len, bool need_ack)
|
||||||
{
|
{
|
||||||
struct net_buf_simple *msg = NULL;
|
struct net_buf_simple *msg = NULL;
|
||||||
@ -918,7 +918,7 @@ end:
|
|||||||
return err;
|
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;
|
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);
|
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;
|
bt_mesh_generic_client_t *client = NULL;
|
||||||
u16_t length = 0;
|
u16_t length = 0;
|
||||||
|
@ -17,17 +17,23 @@
|
|||||||
|
|
||||||
#include "mesh_access.h"
|
#include "mesh_access.h"
|
||||||
|
|
||||||
/** Mesh Client Model Context */
|
/** Client model opcode pair table */
|
||||||
typedef struct {
|
typedef struct {
|
||||||
u32_t cli_op; /* The client opcode */
|
u32_t cli_op; /* Client message opcode */
|
||||||
u32_t status_op; /* The server status opcode corresponding to the client opcode */
|
u32_t status_op; /* Corresponding status message opcode */
|
||||||
} bt_mesh_client_op_pair_t;
|
} bt_mesh_client_op_pair_t;
|
||||||
|
|
||||||
/** Mesh Client Model Context */
|
/** Client model user data context */
|
||||||
typedef struct {
|
typedef struct {
|
||||||
|
/** Pointer to the client model */
|
||||||
struct bt_mesh_model *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;
|
const bt_mesh_client_op_pair_t *op_pair;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief This function is a callback function used to push the received unsolicited
|
* @brief This function is a callback function used to push the received unsolicited
|
||||||
* messages to the application layer.
|
* messages to the application layer.
|
||||||
@ -40,26 +46,42 @@ typedef struct {
|
|||||||
* @return None
|
* @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 (*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 {
|
typedef struct {
|
||||||
sys_slist_t queue;
|
sys_slist_t queue;
|
||||||
} bt_mesh_internal_data_t;
|
} bt_mesh_client_internal_data_t;
|
||||||
|
|
||||||
|
/** Client model sending message related context */
|
||||||
typedef struct {
|
typedef struct {
|
||||||
sys_snode_t client_node;
|
sys_snode_t client_node;
|
||||||
struct bt_mesh_msg_ctx ctx;
|
struct bt_mesh_msg_ctx ctx; /* Message context */
|
||||||
u32_t opcode; /* Indicate the opcode of the message sending */
|
u32_t opcode; /* Message opcode */
|
||||||
u32_t op_pending; /* Indicate the status message waiting for */
|
u32_t op_pending; /* Expected status message opcode */
|
||||||
struct k_delayed_work timer; /* Message send Timer. Only for stack-internal use. */
|
struct k_delayed_work timer; /* Time used to get response. Only for internal use. */
|
||||||
} bt_mesh_client_node_t;
|
} 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);
|
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 model Mesh (client) Model that the message belongs to.
|
||||||
* @param ctx Message context, includes keys, TTL, etc.
|
* @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
|
* @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.
|
* @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 bt_mesh_msg_ctx *ctx,
|
||||||
struct net_buf_simple *buf,
|
struct net_buf_simple *buf, bool need_pub);
|
||||||
bool need_pub);
|
|
||||||
|
|
||||||
bool bt_mesh_client_find_opcode_in_list(sys_slist_t *list, u32_t opcode);
|
bool bt_mesh_client_find_opcode_in_list(sys_slist_t *list, u32_t opcode);
|
||||||
|
|
||||||
@ -94,18 +116,9 @@ enum {
|
|||||||
FAST_PROV,
|
FAST_PROV,
|
||||||
};
|
};
|
||||||
|
|
||||||
#define ROLE_NVAL 0xFF
|
#define ROLE_NVAL 0xFF
|
||||||
|
|
||||||
struct bt_mesh_common_param {
|
typedef struct {
|
||||||
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 {
|
|
||||||
struct bt_mesh_model *model; /* The client model structure */
|
struct bt_mesh_model *model; /* The client model structure */
|
||||||
u8_t role; /* Role of the device - Node/Provisioner */
|
u8_t role; /* Role of the device - Node/Provisioner */
|
||||||
} bt_mesh_role_param_t;
|
} 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.
|
* @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
|
* @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_ */
|
#endif /* _MODEL_COMMON_H_ */
|
||||||
|
|
||||||
|
@ -25,8 +25,8 @@
|
|||||||
#include "client_common.h"
|
#include "client_common.h"
|
||||||
|
|
||||||
/* Generic client model common structure */
|
/* Generic client model common structure */
|
||||||
typedef bt_mesh_client_common_t bt_mesh_generic_client_t;
|
typedef bt_mesh_client_user_data_t bt_mesh_generic_client_t;
|
||||||
typedef bt_mesh_internal_data_t generic_internal_data_t;
|
typedef bt_mesh_client_internal_data_t generic_internal_data_t;
|
||||||
|
|
||||||
/* Generic OnOff Client Model Context */
|
/* Generic OnOff Client Model Context */
|
||||||
extern const struct bt_mesh_model_op gen_onoff_cli_op[];
|
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, \
|
BLE_MESH_MODEL(BLE_MESH_MODEL_ID_GEN_ONOFF_CLI, \
|
||||||
gen_onoff_cli_op, cli_pub, cli_data)
|
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 {
|
struct bt_mesh_gen_onoff_status {
|
||||||
bool op_en; /* Indicate whether optional parameters included */
|
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, \
|
BLE_MESH_MODEL(BLE_MESH_MODEL_ID_GEN_LEVEL_CLI, \
|
||||||
gen_level_cli_op, cli_pub, cli_data)
|
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 {
|
struct bt_mesh_gen_level_status {
|
||||||
bool op_en; /* Indicate whether optional parameters included */
|
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, \
|
BLE_MESH_MODEL(BLE_MESH_MODEL_ID_GEN_DEF_TRANS_TIME_CLI, \
|
||||||
gen_def_trans_time_cli_op, cli_pub, cli_data)
|
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 {
|
struct bt_mesh_gen_def_trans_time_set {
|
||||||
u8_t trans_time; /* The value of the Generic Default Transition Time state */
|
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, \
|
BLE_MESH_MODEL(BLE_MESH_MODEL_ID_GEN_POWER_ONOFF_CLI, \
|
||||||
gen_power_onoff_cli_op, cli_pub, cli_data)
|
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 {
|
struct bt_mesh_gen_onpowerup_set {
|
||||||
u8_t onpowerup; /* The value of the Generic OnPowerUp state */
|
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, \
|
BLE_MESH_MODEL(BLE_MESH_MODEL_ID_GEN_POWER_LEVEL_CLI, \
|
||||||
gen_power_level_cli_op, cli_pub, cli_data)
|
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 {
|
struct bt_mesh_gen_power_level_status {
|
||||||
bool op_en; /* Indicate whether optional parameters included */
|
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, \
|
BLE_MESH_MODEL(BLE_MESH_MODEL_ID_GEN_BATTERY_CLI, \
|
||||||
gen_battery_cli_op, cli_pub, cli_data)
|
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 {
|
struct bt_mesh_gen_battery_status {
|
||||||
u32_t battery_level : 8; /* Value of Generic Battery Level state */
|
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, \
|
BLE_MESH_MODEL(BLE_MESH_MODEL_ID_GEN_LOCATION_CLI, \
|
||||||
gen_location_cli_op, cli_pub, cli_data)
|
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 {
|
struct bt_mesh_gen_loc_global_status {
|
||||||
s32_t global_latitude; /* Global Coordinates (Latitude) */
|
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, \
|
BLE_MESH_MODEL(BLE_MESH_MODEL_ID_GEN_PROP_CLI, \
|
||||||
gen_property_cli_op, cli_pub, cli_data)
|
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 bt_mesh_gen_user_properties_status {
|
||||||
struct net_buf_simple *user_property_ids; /* Buffer contains a sequence of N User Property IDs */
|
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
|
* @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.
|
* @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
|
* @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_ */
|
#endif /* _GENERIC_CLIENT_H_ */
|
||||||
|
@ -25,8 +25,8 @@
|
|||||||
#include "client_common.h"
|
#include "client_common.h"
|
||||||
|
|
||||||
/* Light client model common structure */
|
/* Light client model common structure */
|
||||||
typedef bt_mesh_client_common_t bt_mesh_light_client_t;
|
typedef bt_mesh_client_user_data_t bt_mesh_light_client_t;
|
||||||
typedef bt_mesh_internal_data_t light_internal_data_t;
|
typedef bt_mesh_client_internal_data_t light_internal_data_t;
|
||||||
|
|
||||||
/* Light Lightness Client Model Context */
|
/* Light Lightness Client Model Context */
|
||||||
extern const struct bt_mesh_model_op light_lightness_cli_op[];
|
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, \
|
BLE_MESH_MODEL(BLE_MESH_MODEL_ID_LIGHT_LIGHTNESS_CLI, \
|
||||||
light_lightness_cli_op, cli_pub, cli_data)
|
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 {
|
struct bt_mesh_light_lightness_status {
|
||||||
bool op_en; /* Indicate whether optional parameters included */
|
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, \
|
BLE_MESH_MODEL(BLE_MESH_MODEL_ID_LIGHT_CTL_CLI, \
|
||||||
light_ctl_cli_op, cli_pub, cli_data)
|
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 {
|
struct bt_mesh_light_ctl_status {
|
||||||
bool op_en; /* Indicate whether optional parameters included */
|
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, \
|
BLE_MESH_MODEL(BLE_MESH_MODEL_ID_LIGHT_HSL_CLI, \
|
||||||
light_hsl_cli_op, cli_pub, cli_data)
|
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 {
|
struct bt_mesh_light_hsl_status {
|
||||||
bool op_en; /* Indicate whether optional parameters included */
|
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, \
|
BLE_MESH_MODEL(BLE_MESH_MODEL_ID_LIGHT_XYL_CLI, \
|
||||||
light_xyl_cli_op, cli_pub, cli_data)
|
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 {
|
struct bt_mesh_light_xyl_status {
|
||||||
bool op_en; /* Indicate whether optional parameters included */
|
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, \
|
BLE_MESH_MODEL(BLE_MESH_MODEL_ID_LIGHT_LC_CLI, \
|
||||||
light_lc_cli_op, cli_pub, cli_data)
|
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 {
|
struct bt_mesh_light_lc_mode_status {
|
||||||
u8_t mode; /* The present value of the Light LC Mode state */
|
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
|
* @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.
|
* @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
|
* @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_ */
|
#endif /* _LIGHTING_CLIENT_H_ */
|
||||||
|
@ -41,8 +41,8 @@ extern const struct bt_mesh_model_op sensor_cli_op[];
|
|||||||
BLE_MESH_MODEL(BLE_MESH_MODEL_ID_SENSOR_CLI, \
|
BLE_MESH_MODEL(BLE_MESH_MODEL_ID_SENSOR_CLI, \
|
||||||
sensor_cli_op, cli_pub, cli_data)
|
sensor_cli_op, cli_pub, cli_data)
|
||||||
|
|
||||||
typedef bt_mesh_client_common_t bt_mesh_sensor_client_t;
|
typedef bt_mesh_client_user_data_t bt_mesh_sensor_client_t;
|
||||||
typedef bt_mesh_internal_data_t sensor_internal_data_t;
|
typedef bt_mesh_client_internal_data_t sensor_internal_data_t;
|
||||||
|
|
||||||
struct bt_mesh_sensor_descriptor_status {
|
struct bt_mesh_sensor_descriptor_status {
|
||||||
struct net_buf_simple *descriptor; /* Sequence of 8-octet sensor descriptors (optional) */
|
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
|
* @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.
|
* @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
|
* @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_ */
|
#endif /* _SENSOR_CLIENT_H_ */
|
||||||
|
@ -25,8 +25,8 @@
|
|||||||
#include "client_common.h"
|
#include "client_common.h"
|
||||||
|
|
||||||
/* Time scene client model common structure */
|
/* Time scene client model common structure */
|
||||||
typedef bt_mesh_client_common_t bt_mesh_time_scene_client_t;
|
typedef bt_mesh_client_user_data_t bt_mesh_time_scene_client_t;
|
||||||
typedef bt_mesh_internal_data_t time_scene_internal_data_t;
|
typedef bt_mesh_client_internal_data_t time_scene_internal_data_t;
|
||||||
|
|
||||||
/* Time Client Model Context */
|
/* Time Client Model Context */
|
||||||
extern const struct bt_mesh_model_op time_cli_op[];
|
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, \
|
BLE_MESH_MODEL(BLE_MESH_MODEL_ID_TIME_CLI, \
|
||||||
time_cli_op, cli_pub, cli_data)
|
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 {
|
struct bt_mesh_time_status {
|
||||||
u8_t tai_seconds[5]; /* The current TAI time in seconds */
|
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, \
|
BLE_MESH_MODEL(BLE_MESH_MODEL_ID_SCENE_CLI, \
|
||||||
scene_cli_op, cli_pub, cli_data)
|
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 {
|
struct bt_mesh_scene_status {
|
||||||
bool op_en; /* Indicate whether optional parameters included */
|
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, \
|
BLE_MESH_MODEL(BLE_MESH_MODEL_ID_SCHEDULER_CLI, \
|
||||||
scheduler_cli_op, cli_pub, cli_data)
|
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 {
|
struct bt_mesh_scheduler_status {
|
||||||
u16_t schedules; /* Bit field indicating defined Actions in the Schedule Register */
|
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
|
* @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.
|
* @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
|
* @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_ */
|
#endif /* _TIME_SCENE_CLIENT_H_ */
|
||||||
|
@ -650,7 +650,7 @@ static void light_status(struct bt_mesh_model *model,
|
|||||||
|
|
||||||
buf->data = val;
|
buf->data = val;
|
||||||
buf->len = len;
|
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) {
|
if (!node) {
|
||||||
BT_DBG("Unexpected light status message 0x%x", rsp);
|
BT_DBG("Unexpected light status message 0x%x", rsp);
|
||||||
} else {
|
} else {
|
||||||
@ -770,7 +770,7 @@ const struct bt_mesh_model_op light_lc_cli_op[] = {
|
|||||||
BLE_MESH_MODEL_OP_END,
|
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);
|
NET_BUF_SIMPLE_DEFINE(msg, BLE_MESH_LIGHT_GET_STATE_MSG_LEN);
|
||||||
int err;
|
int err;
|
||||||
@ -801,7 +801,7 @@ static int light_get_state(struct bt_mesh_common_param *common, void *value)
|
|||||||
return err;
|
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)
|
void *value, u16_t value_len, bool need_ack)
|
||||||
{
|
{
|
||||||
struct net_buf_simple *msg = NULL;
|
struct net_buf_simple *msg = NULL;
|
||||||
@ -1042,7 +1042,7 @@ end:
|
|||||||
return err;
|
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;
|
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);
|
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;
|
bt_mesh_light_client_t *client = NULL;
|
||||||
u16_t length = 0;
|
u16_t length = 0;
|
||||||
|
@ -262,7 +262,7 @@ static void sensor_status(struct bt_mesh_model *model,
|
|||||||
|
|
||||||
buf->data = val;
|
buf->data = val;
|
||||||
buf->len = len;
|
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) {
|
if (!node) {
|
||||||
BT_DBG("Unexpected sensor status message 0x%x", rsp);
|
BT_DBG("Unexpected sensor status message 0x%x", rsp);
|
||||||
} else {
|
} else {
|
||||||
@ -352,7 +352,7 @@ const struct bt_mesh_model_op sensor_cli_op[] = {
|
|||||||
BLE_MESH_MODEL_OP_END,
|
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)
|
void *value, u16_t value_len, bool need_ack)
|
||||||
{
|
{
|
||||||
struct net_buf_simple *msg = NULL;
|
struct net_buf_simple *msg = NULL;
|
||||||
@ -460,7 +460,7 @@ end:
|
|||||||
return err;
|
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;
|
bt_mesh_sensor_client_t *client = NULL;
|
||||||
u16_t length = 0;
|
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);
|
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;
|
bt_mesh_sensor_client_t *client = NULL;
|
||||||
u16_t length = 0;
|
u16_t length = 0;
|
||||||
|
@ -299,7 +299,7 @@ static void time_scene_status(struct bt_mesh_model *model,
|
|||||||
|
|
||||||
buf->data = val;
|
buf->data = val;
|
||||||
buf->len = len;
|
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) {
|
if (!node) {
|
||||||
BT_DBG("Unexpected time scene status message 0x%x", rsp);
|
BT_DBG("Unexpected time scene status message 0x%x", rsp);
|
||||||
} else {
|
} else {
|
||||||
@ -369,7 +369,7 @@ const struct bt_mesh_model_op scheduler_cli_op[] = {
|
|||||||
BLE_MESH_MODEL_OP_END,
|
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);
|
NET_BUF_SIMPLE_DEFINE(msg, BLE_MESH_SCENE_GET_STATE_MSG_LEN);
|
||||||
int err;
|
int err;
|
||||||
@ -400,7 +400,7 @@ static int time_scene_get_state(struct bt_mesh_common_param *common, void *value
|
|||||||
return err;
|
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)
|
void *value, u16_t value_len, bool need_ack)
|
||||||
{
|
{
|
||||||
struct net_buf_simple *msg = NULL;
|
struct net_buf_simple *msg = NULL;
|
||||||
@ -497,7 +497,7 @@ end:
|
|||||||
return err;
|
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;
|
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);
|
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;
|
bt_mesh_time_scene_client_t *client = NULL;
|
||||||
u16_t length = 0;
|
u16_t length = 0;
|
||||||
|
@ -56,6 +56,6 @@ void bt_mesh_free_buf(struct net_buf_simple *buf);
|
|||||||
*
|
*
|
||||||
* @return 0 - Node, 1 - Provisioner
|
* @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_ */
|
#endif /* _MESH_COMMON_H_ */
|
@ -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) {
|
if (srv_send) {
|
||||||
BT_DBG("%s, Message is sent by a server model", __func__);
|
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;
|
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;
|
return client->msg_role;
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user