MeshX 0.3
This repository provides an implementation for Bluetooth Low Energy (BLE) Mesh network nodes. The project allows you to create BLE mesh nodes that can communicate with each other, enabling the development of smart home solutions or other IoT-based applications.
Loading...
Searching...
No Matches
meshx_light_server.c
Go to the documentation of this file.
1
12
13#include "meshx_light_server.h"
14#include "meshx_gen_server.h"
15
16#if CONFIG_ENABLE_LIGHT_SERVER
17#define MESHX_SERVER_INIT_MAGIC_NO 0x2483
18
19static uint16_t meshx_lighting_server_init = 0;
20
32
49
65{
67 (uint16_t)(params->ctx.opcode)))
68 {
69 return MESHX_SUCCESS; // No action needed for non-light group opcodes
70 }
72 evt,
73 params,
75}
76
94
112
131
144 meshx_model_t *p_model,
145 meshx_ctx_t *ctx,
147)
148{
149 if (!p_model || !ctx || !state_change)
150 return MESHX_INVALID_ARG;
151
153 {
154 return MESHX_NOT_SUPPORTED;
155 }
156
158 p_model,
159 ctx,
160 state_change
161 );
162}
163
164#endif /* CONFIG_ENABLE_LIGHT_SERVER */
struct meshx_model meshx_model_t
struct meshx_ctx meshx_ctx_t
Structure to hold context information for BLE Mesh operations.
#define MESHX_MODEL_OP_LIGHT_CTL_STATUS
#define MESHX_MODEL_OP_LIGHT_LIGHTNESS_STATUS
#define MESHX_MODEL_OP_LIGHT_CTL_TEMPERATURE_STATUS
#define MESHX_MODEL_OP_LIGHT_LIGHTNESS_LINEAR_STATUS
#define MESHX_MODEL_OP_LIGHT_HSL_STATUS
#define MESHX_MODEL_OP_LIGHT_HSL_HUE_STATUS
#define MESHX_MODEL_OP_LIGHT_HSL_SATURATION_STATUS
struct meshx_lighting_server_cb_param meshx_lighting_server_cb_param_t
meshx_err_t meshx_plat_gen_light_srv_send_status(const meshx_model_t *p_model, const meshx_ctx_t *p_ctx, const meshx_lighting_server_state_change_t *state_change)
Send a status message from the Light Server. This function constructs and sends a status message cont...
meshx_err_t meshx_plat_light_srv_init(void)
Initialize the platform-specific Light Server.
enum __packed control_task_msg_evt_to_ble control_task_msg_evt_to_ble_t
Enumeration for control task message events to BLE.
meshx_err_t(* control_task_msg_handle_t)(dev_struct_t *pdev, control_task_msg_evt_t evt, void *params)
Function pointer type for control task message handler.
meshx_err_t control_task_msg_unsubscribe(control_task_msg_code_t msg_code, control_task_msg_evt_t evt_bmap, control_task_msg_handle_t callback)
Deregister a callback for a specific message code and event bitmap.
@ CONTROL_TASK_MSG_CODE_FRM_BLE
@ CONTROL_TASK_MSG_CODE_TO_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 control_task_msg_subscribe(control_task_msg_code_t msg_code, control_task_msg_evt_t evt_bmap, control_task_msg_handle_t callback)
Subscribe to a control task message.
meshx_err_t
MeshX Error Codes.
Definition meshx_err.h:39
@ MESHX_SUCCESS
Definition meshx_err.h:40
@ MESHX_INVALID_ARG
Definition meshx_err.h:42
@ MESHX_NOT_SUPPORTED
Definition meshx_err.h:47
@ MESHX_FAIL
Definition meshx_err.h:41
#define MESHX_SERVER_INIT_MAGIC_NO
Header file for the generic server model in the BLE mesh node application.
meshx_err_t meshx_lighting_srv_init(void)
Initialize the meshxuction lighting server.
meshx_err_t meshx_gen_light_srv_status_send(meshx_model_t *p_model, meshx_ctx_t *ctx, meshx_lighting_server_state_change_t *state_change)
Sends a status message for the Lighting Server model.
meshx_err_t meshx_lighting_srv_dereg_cb(uint32_t model_id, meshx_lighting_server_cb cb)
Callback function to deregister a lighting server model.
meshx_err_t meshx_is_status_in_gen_light_grp(uint16_t opcode)
Checks if the given opcode belongs to the Generic Light group.
meshx_err_t meshx_lighting_reg_cb(uint32_t model_id, meshx_lighting_server_cb cb)
Register a callback function for the lighting server model.
static uint16_t meshx_lighting_server_init
meshx_err_t meshx_gen_light_srv_send_msg_to_ble(control_task_msg_evt_to_ble_t evt, const meshx_lighting_server_cb_param_t *params)
Sends a message to the BLE subsystem via the control task.
Header file for the production lighting server.
control_task_msg_handle_t meshx_lighting_server_cb
Lighting Server Model state change value union.