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_config_server.c
Go to the documentation of this file.
1
12
13#include "meshx_config_server.h"
14
15#define CONFIG_SRV_INIT_MAGIC 0x2307
16
17#if CONFIG_ENABLE_CONFIG_SERVER
18static uint16_t config_srv_init_flag = 0;
19
26
39
53 const dev_struct_t *pdev,
55 const void *params
56)
57{
58 if(!pdev || !params)
59 {
60 return MESHX_INVALID_ARG;
61 }
62 const meshx_config_srv_cb_param_t *pub_param = (const meshx_config_srv_cb_param_t *)params;
63
65 {
66 return MESHX_INVALID_ARG;
67 }
68 /* Map event to config event */
70 for (uint16_t i = 0; i < config_srv_evt_map_count; i++)
71 {
72 if (config_server_model_evt_map_table[i].model_op_code == pub_param->ctx.opcode)
73 {
74 config_evt = config_server_model_evt_map_table[i].config_evt;
75 break;
76 }
77 }
78 if (config_evt == CONTROL_TASK_MSG_EVT_CONFIG_ALL)
79 {
80 return MESHX_INVALID_ARG;
81 }
82 /* Publish the event */
85 config_evt,
86 pub_param,
88}
89
111
123{
124 if (cb == NULL || config_evt_bmap == 0)
125 {
126 return MESHX_INVALID_ARG; // Invalid arguments
127 }
128
131 config_evt_bmap,
133
134}
135
152{
153 return meshx_plat_get_config_srv_instance(p_conf_srv);
154}
155
175
176#endif /* CONFIG_ENABLE_CONFIG_SERVER */
#define MESHX_MODEL_OP_MODEL_APP_BIND
void * meshx_ptr_t
#define MESHX_MODEL_OP_NET_KEY_DELETE
#define MESHX_MODEL_ID_CONFIG_SRV
BLE Mesh models related Model ID and Opcode definitions.
#define MESHX_MODEL_OP_MODEL_SUB_ADD
#define MESHX_MODEL_OP_MODEL_PUB_SET
#define MESHX_MODEL_OP_MODEL_SUB_DELETE
#define MESHX_MODEL_OP_APP_KEY_ADD
#define MESHX_MODEL_OP_MODEL_APP_UNBIND
#define MESHX_MODEL_OP_NET_KEY_ADD
#define MESHX_MODEL_OP_APP_KEY_DELETE
struct meshx_config_srv_cb_param meshx_config_srv_cb_param_t
control_task_msg_evt_config_t config_evt_t
meshx_err_t meshx_plat_config_srv_init(void)
Initializes the MeshX platform configuration server.
meshx_err_t meshx_plat_get_config_srv_instance(meshx_ptr_t *p_conf_srv)
Retrieve the instance of the BLE Mesh configuration server.
meshx_err_t meshx_plat_get_config_srv_model(meshx_ptr_t p_model)
Retrieves the configuration server model for the BLE Mesh.
control_task_msg_handle_t config_srv_cb_t
struct dev_struct dev_struct_t
Structure representing the device composition and elements.
static const config_server_model_evt_map_t config_server_model_evt_map_table[]
static meshx_err_t meshx_config_server_control_task_handler(const dev_struct_t *pdev, control_task_msg_evt_t evt, const void *params)
Handles the configuration server events from the control task.
struct config_server_model_evt_map config_server_model_evt_map_t
meshx_err_t meshx_get_config_srv_instance(void **p_conf_srv)
Retrieves the instance of the MeshX configuration server.
meshx_err_t meshx_init_config_server()
Initializes the Configuration Server.
static uint16_t config_srv_init_flag
#define CONFIG_SRV_INIT_MAGIC
uint16_t config_srv_evt_map_count
meshx_err_t meshx_get_config_srv_model(meshx_ptr_t p_model)
Retrieves the configuration server model for the MeshX framework.
meshx_err_t meshx_config_server_cb_reg(config_srv_cb_t cb, uint32_t config_evt_bmap)
Registers a configuration server callback for specific events.
Header file for the meshxuction configuration server model.
uint32_t control_task_msg_evt_t
Type definition for control task message event.
CONTROL_TASK_MSG_EVT_NET_KEY_DEL
CONTROL_TASK_MSG_EVT_APP_KEY_DEL
CONTROL_TASK_MSG_EVT_SUB_DEL
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.
CONTROL_TASK_MSG_EVT_APP_KEY_UNBIND
@ CONTROL_TASK_MSG_CODE_FRM_BLE
@ CONTROL_TASK_MSG_CODE_CONFIG
CONTROL_TASK_MSG_EVT_APP_KEY_ADD
CONTROL_TASK_MSG_EVT_PUB_ADD
CONTROL_TASK_MSG_EVT_APP_KEY_BIND
CONTROL_TASK_MSG_EVT_SUB_ADD
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.
CONTROL_TASK_MSG_EVT_CONFIG_ALL
CONTROL_TASK_MSG_EVT_NET_KEY_ADD
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_INVALID_ARG
Definition meshx_err.h:42