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.
Loading...
Searching...
No Matches
meshXBaseConfigServerModel Class Reference

Template specialization of meshXBaseServerModel for Config BLE mesh server models. More...

#include <meshx_base_model_common.hpp>

Inheritance diagram for meshXBaseConfigServerModel:
meshXBaseServerModel< meshXBaseConfigServerModel, meshx_config_server_send_params_t, meshx_config_server_restore_params_t, meshx_config_srv_cb_param_t > meshXBaseModel< meshx_config_server_send_params_t >

Public Member Functions

meshx_err_t plat_model_init (void) override
 Initialize platform-specific config server model.
meshx_err_t validate_server_status_opcode (uint16_t opcode) override
 Validate config server model status opcode.
meshx_err_t server_state_restore (meshx_config_server_restore_params_t *param) override
 Restore server state from persistent storage.
meshx_err_t plat_send_msg (meshx_config_server_send_params_t *params) override
 Send message through the config server model.
 meshXBaseConfigServerModel (uint32_t model_id, meshx_ptr_t p_plat_model, const control_msg_cb &from_ble_cb)
 Construct a new meshXBaseConfigServerModel object.
 meshXBaseConfigServerModel ()=delete
 Delete default constructor.
 ~meshXBaseConfigServerModel () final=default
 Virtual destructor for meshXBaseConfigServerModel.
Public Member Functions inherited from meshXBaseServerModel< meshXBaseConfigServerModel, meshx_config_server_send_params_t, meshx_config_server_restore_params_t, meshx_config_srv_cb_param_t >
 meshXBaseServerModel ()=delete
virtual ~meshXBaseServerModel ()=default
meshx_err_t from_ble_dereg_cb (void) const override
 Deregister BLE message callback for this model.
void set_plat_model_ptr (meshx_ptr_t p_model)
 Set the platform model pointer and update the registration list.
Public Member Functions inherited from meshXBaseModel< meshx_config_server_send_params_t >
meshx_err_t from_ble_reg_cb (void) const
 Register BLE message callback for this model.
meshx_err_t get_status (void) const
 Get the current status of the model.
uint32_t get_model_id (void) const
 Get the model identifier.
control_task_msg_handle_t get_from_ble_cb (void) const
 Get the BLE message callback function.
meshXBaseModelType_t get_model_type (void) const
 Get the model type (server/client).
void set_status (meshx_err_t err)
 Set the model status.
void set_model_id (uint32_t id)
 Set the model identifier.
void set_from_ble_cb (control_task_msg_handle_t cb)
 Set the BLE message callback function.
void set_model_type (meshXBaseModelType_t type)
 Set the model type.
 meshXBaseModel (uint32_t model_id, control_task_msg_handle_t from_ble_cb, meshXBaseModelType_t model_type)
 Construct a new meshXBaseModel object.
virtual ~meshXBaseModel ()
 Virtual destructor for meshXBaseModel.

Additional Inherited Members

Static Protected Member Functions inherited from meshXBaseServerModel< meshXBaseConfigServerModel, meshx_config_server_send_params_t, meshx_config_server_restore_params_t, meshx_config_srv_cb_param_t >
static meshx_err_t base_from_ble_msg_handle (dev_struct_t *pdev, control_task_msg_evt_t evt, meshx_ptr_t params)
 Sends a BLE message from a server model.
Protected Attributes inherited from meshXBaseServerModel< meshXBaseConfigServerModel, meshx_config_server_send_params_t, meshx_config_server_restore_params_t, meshx_config_srv_cb_param_t >
meshx_ptr_t p_plat_model
Protected Attributes inherited from meshXBaseModel< meshx_config_server_send_params_t >
uint32_t model_id
meshXBaseModelType_t model_type
control_task_msg_handle_t from_ble_cb
meshx_err_t status
Static Protected Attributes inherited from meshXBaseServerModel< meshXBaseConfigServerModel, meshx_config_server_send_params_t, meshx_config_server_restore_params_t, meshx_config_srv_cb_param_t >
static std::once_flag plat_server_init_flag
static std::forward_list< base_server_model_cb_reg_tbase_server_model_cb_list

Detailed Description

Template specialization of meshXBaseServerModel for Config BLE mesh server models.

This class provides a concrete implementation of the template-based meshXBaseServerModel specifically designed for Config BLE mesh server models. It inherits all the template benefits including type safety, static callback dispatching, and enhanced debugging while providing Config-specific functionality.

Key Features:

  • Inherits template-based architecture from meshXBaseServerModel
  • Provides Config-specific opcode validation and message handling
  • Implements platform-specific message sending
  • Supports configuration and provisioning operations
  • Enhanced error handling and debugging with template type identification
  • Static wrapper functions for C-style callback compatibility

Template Parameters:

Supported Operations:

  • Node identity operations
  • Model composition operations
  • Configuration status updates
  • Provisioning-related configurations
  • Device property operations
  • State restoration from persistent storage
Note
This class uses private inheritance to maintain encapsulation while providing access to base functionality through friendship.
See also
meshXBaseServerModel for base template functionality.
meshx_config_server_send_params_t for send parameter structure.
meshx_config_server_restore_params_t for restore parameter structure.

Constructor & Destructor Documentation

◆ meshXBaseConfigServerModel() [1/2]

meshXBaseConfigServerModel::meshXBaseConfigServerModel ( uint32_t model_id,
meshx_ptr_t p_plat_model,
const control_msg_cb & from_ble_cb )

Construct a new meshXBaseConfigServerModel object.

Parameters
[in]model_idModel identifier for the config server
[in]p_plat_modelPointer to the platform model instance
[in]from_ble_cbCallback function for handling BLE messages
25{
28 {
29 MESHX_LOGE(MODULE_ID_COMMON, "plat_model_init failed");
30 return;
31 }
32}
meshx_err_t plat_model_init(void) override
Initialize platform-specific config server model.
Definition meshx_base_model_common.cpp:36
uint32_t model_id
Definition meshx_base_model_class.hpp:52
control_task_msg_handle_t from_ble_cb
Definition meshx_base_model_class.hpp:54
meshx_err_t get_status(void) const
Definition meshx_base_model_class.hpp:123
void set_status(meshx_err_t err)
Definition meshx_base_model_class.hpp:147
#define MESHX_LOGE(module_id, format,...)
Definition meshx_log.h:114
**This function is called by the parent element when a state change request *is received It validates the request and returns a result to the element not the model layer **return * MESHX_SUCCESS
Definition meshx_model_level.cpp:385
@ MODULE_ID_COMMON
Definition module_id.h:36

◆ meshXBaseConfigServerModel() [2/2]

meshXBaseConfigServerModel::meshXBaseConfigServerModel ( )
delete

Delete default constructor.

◆ ~meshXBaseConfigServerModel()

meshXBaseConfigServerModel::~meshXBaseConfigServerModel ( )
finaldefault

Virtual destructor for meshXBaseConfigServerModel.

Member Function Documentation

◆ plat_model_init()

meshx_err_t meshXBaseConfigServerModel::plat_model_init ( void )
overridevirtual

Initialize platform-specific config server model.

Returns
MESHX_SUCCESS on successful initialization, error code otherwise

Implements meshXBaseModel< meshx_config_server_send_params_t >.

37{
39 std::call_once(plat_server_init_flag, [&]() {
41 });
42 return err;
43}
meshx_err_t meshx_plat_config_srv_init(void)
Initializes the MeshX platform configuration server.
meshx_err_t
MeshX Error Codes.
Definition meshx_err.h:43

◆ plat_send_msg()

meshx_err_t meshXBaseConfigServerModel::plat_send_msg ( meshx_config_server_send_params_t * params)
overridevirtual

Send message through the config server model.

Parameters
[in]paramsPointer to send parameters structure
Returns
MESHX_SUCCESS if message sent successfully, error code otherwise

Implements meshXBaseModel< meshx_config_server_send_params_t >.

84{
85 if (!params || !params->p_model || !params->p_ctx || params->p_ctx->dst_addr == MESHX_ADDR_UNASSIGNED)
86 {
87 return MESHX_INVALID_ARG;
88 }
89
90 if (validate_server_status_opcode((uint16_t)params->p_ctx->opcode) != MESHX_SUCCESS)
91 {
92 return MESHX_INVALID_ARG;
93 }
94
95 /* Platform currently doesn't provide a config-server specific "send status" helper.
96 * Returning NOT_SUPPORTED so callers can handle or platform wrapper can be added.
97 */
98 MESHX_LOGW(MODULE_ID_MODEL_SERVER, "Config server plat_send_msg not supported on this platform");
100}
meshx_err_t validate_server_status_opcode(uint16_t opcode) override
Validate config server model status opcode.
Definition meshx_base_model_common.cpp:47
#define MESHX_ADDR_UNASSIGNED
Definition meshx_ble_mesh_cmn_def.h:30
@ MESHX_INVALID_ARG
Definition meshx_err.h:46
@ MESHX_NOT_SUPPORTED
Definition meshx_err.h:51
#define MESHX_LOGW(module_id, format,...)
Definition meshx_log.h:120
@ MODULE_ID_MODEL_SERVER
Definition module_id.h:34

◆ server_state_restore()

meshx_err_t meshXBaseConfigServerModel::server_state_restore ( meshx_config_server_restore_params_t * param)
overridevirtual

Restore server state from persistent storage.

Parameters
[in]paramPointer to restoration parameters containing state data
Returns
MESHX_SUCCESS on successful restoration, error code otherwise

Implements meshXBaseServerModel< meshXBaseConfigServerModel, meshx_config_server_send_params_t, meshx_config_server_restore_params_t, meshx_config_srv_cb_param_t >.

105{
106 (void)param;
107 /* No platform restore API exposed for config server currently. */
108 return MESHX_SUCCESS;
109}

◆ validate_server_status_opcode()

meshx_err_t meshXBaseConfigServerModel::validate_server_status_opcode ( uint16_t opcode)
overridevirtual

Validate config server model status opcode.

Parameters
[in]opcodeThe opcode to validate
Returns
MESHX_SUCCESS if opcode is valid, error code otherwise

Implements meshXBaseServerModel< meshXBaseConfigServerModel, meshx_config_server_send_params_t, meshx_config_server_restore_params_t, meshx_config_srv_cb_param_t >.

48{
49 switch (opcode)
50 {
75 return MESHX_SUCCESS;
76 default:
77 return MESHX_FAIL;
78 }
79}
#define MESHX_MODEL_OP_VENDOR_MODEL_SUB_LIST
Definition meshx_ble_mesh_cmn_def.h:182
#define MESHX_MODEL_OP_NET_KEY_STATUS
Definition meshx_ble_mesh_cmn_def.h:183
#define MESHX_MODEL_OP_MODEL_SUB_STATUS
Definition meshx_ble_mesh_cmn_def.h:180
#define MESHX_MODEL_OP_RELAY_STATUS
Definition meshx_ble_mesh_cmn_def.h:178
#define MESHX_MODEL_OP_MODEL_APP_STATUS
Definition meshx_ble_mesh_cmn_def.h:188
#define MESHX_MODEL_OP_KEY_REFRESH_PHASE_STATUS
Definition meshx_ble_mesh_cmn_def.h:193
#define MESHX_MODEL_OP_FRIEND_STATUS
Definition meshx_ble_mesh_cmn_def.h:192
#define MESHX_MODEL_OP_BEACON_STATUS
Definition meshx_ble_mesh_cmn_def.h:174
#define MESHX_MODEL_OP_GATT_PROXY_STATUS
Definition meshx_ble_mesh_cmn_def.h:177
#define MESHX_MODEL_OP_SIG_MODEL_APP_LIST
Definition meshx_ble_mesh_cmn_def.h:189
#define MESHX_MODEL_OP_DEFAULT_TTL_STATUS
Definition meshx_ble_mesh_cmn_def.h:176
#define MESHX_MODEL_OP_LPN_POLLTIMEOUT_STATUS
Definition meshx_ble_mesh_cmn_def.h:196
#define MESHX_MODEL_OP_HEARTBEAT_PUB_STATUS
Definition meshx_ble_mesh_cmn_def.h:194
#define MESHX_MODEL_OP_VENDOR_MODEL_APP_LIST
Definition meshx_ble_mesh_cmn_def.h:190
#define MESHX_MODEL_OP_HEARTBEAT_SUB_STATUS
Definition meshx_ble_mesh_cmn_def.h:195
#define MESHX_MODEL_OP_MODEL_PUB_STATUS
Definition meshx_ble_mesh_cmn_def.h:179
#define MESHX_MODEL_OP_COMPOSITION_DATA_STATUS
Definition meshx_ble_mesh_cmn_def.h:175
#define MESHX_MODEL_OP_NODE_RESET_STATUS
Definition meshx_ble_mesh_cmn_def.h:191
#define MESHX_MODEL_OP_APP_KEY_STATUS
Definition meshx_ble_mesh_cmn_def.h:185
#define MESHX_MODEL_OP_NET_KEY_LIST
Definition meshx_ble_mesh_cmn_def.h:184
#define MESHX_MODEL_OP_NETWORK_TRANSMIT_STATUS
Definition meshx_ble_mesh_cmn_def.h:197
#define MESHX_MODEL_OP_NODE_IDENTITY_STATUS
Definition meshx_ble_mesh_cmn_def.h:187
#define MESHX_MODEL_OP_APP_KEY_LIST
Definition meshx_ble_mesh_cmn_def.h:186
#define MESHX_MODEL_OP_SIG_MODEL_SUB_LIST
Definition meshx_ble_mesh_cmn_def.h:181
@ MESHX_FAIL
Definition meshx_err.h:45

The documentation for this class was generated from the following files: