|
MeshX 0.4
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.
|
Header file for Generic Server Models in MeshX BLE Mesh. More...
Go to the source code of this file.
Typedefs | |
| typedef struct meshx_gen_srv_cb_param | meshx_gen_srv_cb_param_t |
| typedef struct meshx_gen_server_state | meshx_gen_server_state_t |
| Generic Server Model state Used to set/restore the model state values internally. | |
| typedef control_task_msg_handle_t | meshx_server_cb |
Functions | |
| meshx_err_t | meshx_plat_on_off_gen_srv_create (void *p_model, void **p_pub, void **p_onoff_srv) |
| Creates a Generic OnOff Server model and its publication context. | |
| meshx_err_t | meshx_plat_level_gen_srv_create (void *p_model, void **p_pub, void **p_level_srv) |
| Creates a Generic Level Server model and its publication context. | |
| meshx_err_t | meshx_plat_battery_gen_srv_create (void *p_model, void **p_pub, void **p_battery_srv) |
| Creates a Generic Battery Server model and its publication context. | |
| meshx_err_t | meshx_plat_location_gen_srv_create (void *p_model, void **p_pub, void **p_location_srv) |
| Creates a Generic Location Server model and its publication context. | |
| meshx_err_t | meshx_plat_power_onoff_gen_srv_create (void *p_model, void **p_pub, void **p_power_onoff_srv) |
| Creates a Generic Power OnOff Server model and its publication context. | |
| meshx_err_t | meshx_plat_power_onoff_setup_gen_srv_create (void *p_model, void **p_pub, void **p_power_onoff_setup_srv) |
| Creates a Generic Power OnOff Setup Server model and its publication context. | |
| meshx_err_t | meshx_plat_power_level_gen_srv_create (void *p_model, void **p_pub, void **p_power_level_srv) |
| Creates a Generic Power Level Server model and its publication context. | |
| meshx_err_t | meshx_plat_def_trans_time_gen_srv_create (void *p_model, void **p_pub, void **p_trans_time_srv) |
| Creates a Generic Default Transition Time Server model and its publication context. | |
| meshx_err_t | meshx_plat_gen_srv_delete (void **p_pub, void **p_srv) |
| Deletes the Generic OnOff Server model and its associated resources. | |
| meshx_err_t | meshx_plat_gen_srv_init (void) |
| Initialize the generic server model platform. | |
| meshx_err_t | meshx_plat_set_gen_srv_state (void *p_model, const meshx_gen_server_state_t *state, uint16_t state_len) |
| Set the state of a generic server model. | |
| meshx_err_t | meshx_plat_gen_on_off_srv_restore (void *p_model, uint8_t state) |
| Restores the state of the Generic OnOff Server model. | |
| meshx_err_t | meshx_plat_gen_srv_send_status (meshx_model_t *p_model, meshx_ctx_t *p_ctx, meshx_ptr_t p_data, uint32_t data_len) |
| Send a status message from the Generic Server model. | |
Header file for Generic Server Models in MeshX BLE Mesh.
Copyright (c) 2024 - 2025 MeshX
This file defines the structures, types, and APIs for implementing Generic Server Models in the MeshX BLE Mesh stack. It includes definitions for various state change events, server callbacks, and functions to create, delete, and manage the state of Generic Server Models.
| typedef struct meshx_gen_server_state meshx_gen_server_state_t |
Generic Server Model state Used to set/restore the model state values internally.
| typedef struct meshx_gen_srv_cb_param meshx_gen_srv_cb_param_t |
| meshx_err_t meshx_plat_battery_gen_srv_create | ( | void * | p_model, |
| void ** | p_pub, | ||
| void ** | p_battery_srv ) |
Creates a Generic Battery Server model and its publication context.
This function initializes the Generic Battery Server model, its publication context, and allocates memory for the server instance. It checks for invalid arguments and handles memory allocation failures.
| [out] | p_model | Pointer to the model structure to be created. |
| [out] | p_pub | Pointer to the publication context to be created. |
| [out] | p_battery_srv | Pointer to the Battery server instance to be allocated. |
| meshx_err_t meshx_plat_def_trans_time_gen_srv_create | ( | void * | p_model, |
| void ** | p_pub, | ||
| void ** | p_trans_time_srv ) |
Creates a Generic Default Transition Time Server model and its publication context.
This function initializes the Generic Default Transition Time Server model, its publication context, and allocates memory for the server instance. It checks for invalid arguments and handles memory allocation failures.
| [out] | p_model | Pointer to the model structure to be created. |
| [out] | p_pub | Pointer to the publication context to be created. |
| [out] | p_trans_time_srv | Pointer to the Default Transition Time server instance to be allocated. |
| meshx_err_t meshx_plat_gen_on_off_srv_restore | ( | void * | p_model, |
| uint8_t | state ) |
Restores the state of the Generic OnOff Server model.
This function sets the user data of the specified model to the given state. It checks if the model pointer is valid before proceeding with the operation.
| [in] | p_model | Pointer to the model structure. |
| [in] | state | The state to be restored in the model. |
| meshx_err_t meshx_plat_gen_srv_delete | ( | void ** | p_pub, |
| void ** | p_srv ) |
Deletes the Generic OnOff Server model and its associated resources.
This function frees the memory allocated for the Generic OnOff Server and sets the pointer to NULL. It also deletes the model publication resources associated with the server.
| [in,out] | p_pub | Pointer to the publication structure to be deleted. |
| [in,out] | p_srv | Pointer to the Generic Server structure to be freed. |
| meshx_err_t meshx_plat_gen_srv_init | ( | void | ) |
Initialize the generic server model platform.
| meshx_err_t meshx_plat_gen_srv_send_status | ( | meshx_model_t * | p_model, |
| meshx_ctx_t * | p_ctx, | ||
| meshx_ptr_t | p_data, | ||
| uint32_t | data_len ) |
Send a status message from the Generic Server model.
This function sends a status message to the specified context with the provided data.
| [in] | p_model | Pointer to the model instance. |
| [in] | p_ctx | Pointer to the context structure containing destination address and other parameters. |
| [in] | p_data | Pointer to the data to be sent. |
| [in] | data_len | Length of the data to be sent. |
| meshx_err_t meshx_plat_level_gen_srv_create | ( | void * | p_model, |
| void ** | p_pub, | ||
| void ** | p_level_srv ) |
Creates a Generic Level Server model and its publication context.
This function initializes the Generic Level Server model, its publication context, and allocates memory for the server instance. It checks for invalid arguments and handles memory allocation failures.
| [out] | p_model | Pointer to the model structure to be created. |
| [out] | p_pub | Pointer to the publication context to be created. |
| [out] | p_level_srv | Pointer to the Level server instance to be allocated. |
| meshx_err_t meshx_plat_location_gen_srv_create | ( | void * | p_model, |
| void ** | p_pub, | ||
| void ** | p_location_srv ) |
Creates a Generic Location Server model and its publication context.
This function initializes the Generic Location Server model, its publication context, and allocates memory for the server instance. It checks for invalid arguments and handles memory allocation failures.
| [out] | p_model | Pointer to the model structure to be created. |
| [out] | p_pub | Pointer to the publication context to be created. |
| [out] | p_location_srv | Pointer to the Location server instance to be allocated. |
| meshx_err_t meshx_plat_on_off_gen_srv_create | ( | void * | p_model, |
| void ** | p_pub, | ||
| void ** | p_onoff_srv ) |
Creates a Generic OnOff Server model and its publication context.
This function initializes the Generic OnOff Server model, its publication context, and allocates memory for the server instance. It checks for invalid arguments and handles memory allocation failures.
| [out] | p_model | Pointer to the model structure to be created. |
| [out] | p_pub | Pointer to the publication context to be created. |
| [out] | p_onoff_srv | Pointer to the OnOff server instance to be allocated. |
| meshx_err_t meshx_plat_power_level_gen_srv_create | ( | void * | p_model, |
| void ** | p_pub, | ||
| void ** | p_power_level_srv ) |
Creates a Generic Power Level Server model and its publication context.
This function initializes the Generic Power Level Server model, its publication context, and allocates memory for the server instance. It checks for invalid arguments and handles memory allocation failures.
| [out] | p_model | Pointer to the model structure to be created. |
| [out] | p_pub | Pointer to the publication context to be created. |
| [out] | p_power_level_srv | Pointer to the Power Level server instance to be allocated. |
| meshx_err_t meshx_plat_power_onoff_gen_srv_create | ( | void * | p_model, |
| void ** | p_pub, | ||
| void ** | p_power_onoff_srv ) |
Creates a Generic Power OnOff Server model and its publication context.
This function initializes the Generic Power OnOff Server model, its publication context, and allocates memory for the server instance. It checks for invalid arguments and handles memory allocation failures.
| [out] | p_model | Pointer to the model structure to be created. |
| [out] | p_pub | Pointer to the publication context to be created. |
| [out] | p_power_onoff_srv | Pointer to the Power OnOff server instance to be allocated. |
| meshx_err_t meshx_plat_power_onoff_setup_gen_srv_create | ( | void * | p_model, |
| void ** | p_pub, | ||
| void ** | p_power_onoff_setup_srv ) |
Creates a Generic Power OnOff Setup Server model and its publication context.
This function initializes the Generic Power OnOff Setup Server model, its publication context, and allocates memory for the server instance. It checks for invalid arguments and handles memory allocation failures.
| [out] | p_model | Pointer to the model structure to be created. |
| [out] | p_pub | Pointer to the publication context to be created. |
| [out] | p_power_onoff_setup_srv | Pointer to the Power OnOff setup server instance to be allocated. |
| meshx_err_t meshx_plat_set_gen_srv_state | ( | void * | p_model, |
| const meshx_gen_server_state_t * | state, | ||
| uint16_t | state_len ) |
Set the state of a generic server model.
This function updates the on/off state of a specified generic server model.
| [in] | p_model | Pointer to the model whose state is to be set. |
| [in] | state | The desired on/off state to set for the model. |
| [in] | state_len | The length of the state data. |