27#define MESHX_CLIENT_INIT_MAGIC_NO 0x3728
39 [ESP_BLE_MESH_LIGHT_CLIENT_PUBLISH_EVT] =
"PUBLISH_EVT",
40 [ESP_BLE_MESH_LIGHT_CLIENT_TIMEOUT_EVT] =
"TIMEOUT_EVT",
41 [ESP_BLE_MESH_LIGHT_CLIENT_GET_STATE_EVT] =
"GET_STATE_EVT",
42 [ESP_BLE_MESH_LIGHT_CLIENT_SET_STATE_EVT] =
"SET_STATE_EVT",
69 param->params->ctx.recv_op, param->params->ctx.addr, param->params->ctx.recv_dst);
73 .net_idx = param->params->ctx.net_idx,
74 .app_idx = param->params->ctx.app_idx,
75 .dst_addr = param->params->ctx.recv_dst,
76 .src_addr = param->params->ctx.addr,
77 .opcode = param->params->ctx.recv_op,
78 .p_ctx = ¶m->params->ctx
81 .pub_addr = param->params->model->pub->publish_addr,
82 .model_id = param->params->model->model_id,
83 .el_id = param->params->model->element_idx,
84 .p_model = param->params->model
124 esp_err_t esp_err = esp_ble_mesh_register_light_client_callback(
126 if (esp_err != ESP_OK)
146 if (!p_model || !p_pub || !p_light_ctl_cli)
151 uint16_t model_id = ESP_BLE_MESH_MODEL_ID_LIGHT_CTL_CLI;
197 uint16_t opcode, uint16_t addr,
198 uint16_t net_idx, uint16_t app_idx,
202 if (!p_model || !p_set)
207 esp_ble_mesh_client_common_param_t common = {0};
208 common.model = p_model;
209 common.opcode = opcode;
210 common.ctx.addr = addr;
211 common.ctx.net_idx = net_idx;
212 common.ctx.app_idx = app_idx;
213 common.ctx.send_ttl = BLE_MESH_TTL_DEFAULT;
214 common.msg_timeout = 0;
219 esp_err_t esp_err = esp_ble_mesh_light_client_set_state(
221 (esp_ble_mesh_light_client_set_state_t *)p_set
223 if (esp_err != ESP_OK)
231 esp_err_t esp_err = esp_ble_mesh_light_client_get_state(
233 (esp_ble_mesh_light_client_get_state_t *)p_set
235 if (esp_err != ESP_OK)
static const char * client_state_str[]
Mapping of BLE Mesh client state events to string representations.
meshx_err_t meshx_plat_light_client_send_msg(meshx_ptr_t p_model, meshx_light_client_set_state_t *p_set, uint16_t opcode, uint16_t addr, uint16_t net_idx, uint16_t app_idx, bool is_get_opcode)
Sends a Light Client message over BLE Mesh.
meshx_err_t meshx_plat_light_client_delete(meshx_ptr_t *p_pub, meshx_ptr_t *p_cli)
Deletes the Light client instance and its associated publication context.
static void esp_ble_mesh_light_client_cb(MESHX_GEN_LIGHT_CLI_CB_EVT event, MESHX_GEN_LIGHT_CLI_CB_PARAM *param)
Callback function for BLE Mesh Light Client events.
meshx_err_t meshx_plat_gen_light_client_init(void)
Initialize the Generic Light Client Model. This function sets up the necessary parameters and resourc...
meshx_err_t meshx_plat_light_ctl_client_create(meshx_ptr_t p_model, meshx_ptr_t *p_pub, meshx_ptr_t *p_light_ctl_cli)
Creates and initializes a Light CTL (Color Temperature Light) client model instance.
meshx_err_t meshx_plat_del_model_pub(meshx_ptr_t *p_pub)
Deletes the model and publication objects.
meshx_err_t meshx_plat_client_create(meshx_ptr_t p_model, meshx_ptr_t *p_pub, meshx_ptr_t *p_cli)
Creates and initializes a generic client model for BLE Mesh.
Header file for BLE Mesh Light Client functionality in the MeshX framework. This file contains declar...
struct meshx_gen_light_cli_cb_param meshx_gen_light_cli_cb_param_t
Callback parameters for Generic Light Client Model events. This structure is used to pass information...
Header file for the control task in the BLE mesh node application.
@ CONTROL_TASK_MSG_CODE_FRM_BLE
meshx_err_t control_task_msg_publish(control_task_msg_code_t msg_code, control_task_msg_evt_t msg_evt, const void *msg_evt_params, size_t sizeof_msg_evt_params)
Publish a control task message.
meshx_err_t
MeshX Error Codes.
#define MESHX_CLIENT_INIT_MAGIC_NO
uint16_t meshx_client_init
#define MESHX_LOGE(module_id, format,...)
#define MESHX_LOGD(module_id, format,...)
meshx_gen_light_client_status_cb_t status
Lighting Client Model set message union.