#include <meshx_base_model_class.hpp>
◆ base_client_model_cb_reg_t
template<typename baseClientModelDerived_t, typename ble_mesh_send_msg_params_t, typename ble_mesh_plat_model_cb_params_t>
| using meshXBaseClientModel< baseClientModelDerived_t, ble_mesh_send_msg_params_t, ble_mesh_plat_model_cb_params_t >::base_client_model_cb_reg_t |
|
private |
Initial value:struct base_client_model_cb_reg
{
}
meshXBaseClientModel()=delete
meshx_ptr_t p_plat_model
Definition meshx_base_model_class.hpp:261
uint32_t model_id
Definition meshx_base_model_class.hpp:52
std::function< meshx_err_t(dev_struct_t *, control_task_msg_evt_t, meshx_ptr_t)> control_msg_cb
Definition meshx_base_model_class.hpp:32
void * meshx_ptr_t
Definition meshx_ble_mesh_cmn_def.h:636
249 {
254 };
Definition meshx_base_model_class.hpp:244
◆ base_client_model_resend_ctx_t
template<typename baseClientModelDerived_t, typename ble_mesh_send_msg_params_t, typename ble_mesh_plat_model_cb_params_t>
| using meshXBaseClientModel< baseClientModelDerived_t, ble_mesh_send_msg_params_t, ble_mesh_plat_model_cb_params_t >::base_client_model_resend_ctx_t |
|
private |
Initial value:struct base_client_model_resend_ctx
{
ble_mesh_plat_model_cb_params_t param;
}
◆ meshXBaseClientModel() [1/2]
template<typename baseClientModelDerived_t, typename ble_mesh_send_msg_params_t, typename ble_mesh_plat_model_cb_params_t>
| meshXBaseClientModel< baseClientModelDerived_t, ble_mesh_send_msg_params_t, ble_mesh_plat_model_cb_params_t >::meshXBaseClientModel |
( |
| ) |
|
|
delete |
◆ ~meshXBaseClientModel()
template<typename baseClientModelDerived_t, typename ble_mesh_send_msg_params_t, typename ble_mesh_plat_model_cb_params_t>
◆ meshXBaseClientModel() [2/2]
template<typename baseClientModelDerived_t, typename ble_mesh_send_msg_params_t, typename ble_mesh_plat_model_cb_params_t>
Constructor for the meshXBaseClientModel template class.
- Parameters
-
| [in] | model_id | The unique 32-bit identifier of the Generic Client model. |
| [in] | p_plat_model | Pointer to the platform-specific model structure. |
| [in] | from_ble_cb | The callback function to handle BLE mesh messages. |
260{
262
264 {
267 return;
268 }
269
272 });
273
276}
static meshx_err_t base_from_ble_msg_handle(dev_struct_t *pdev, control_task_msg_evt_t evt, meshx_ptr_t params)
Template-based static message handler for BLE Mesh Generic Client models.
Definition meshx_base_model_class.cpp:364
static std::once_flag plat_client_init_flag
Definition meshx_base_model_class.hpp:263
static std::forward_list< base_client_model_cb_reg_t > base_client_model_cb_list
Definition meshx_base_model_class.hpp:264
meshx_err_t status
Definition meshx_base_model_class.hpp:55
control_task_msg_handle_t from_ble_cb
Definition meshx_base_model_class.hpp:54
#define MESHX_LOGE(module_id, format,...)
Definition meshx_log.h:114
#define MESHX_LOGD(module_id, format,...)
Definition meshx_log.h:132
◆ base_from_ble_msg_handle()
template<typename baseClientModelDerived_t, typename ble_mesh_send_msg_params_t, typename ble_mesh_plat_model_cb_params_t>
Template-based static message handler for BLE Mesh Generic Client models.
This is the core static message handling function that processes incoming BLE mesh messages for all instances of a specific template instantiation. It provides a centralized dispatch mechanism with enhanced debugging, validation, and error handling.
Key Features:
- Template-specific static dispatch (one handler per template instantiation)
- Model ID validation against supported Generic Client models
- Enhanced logging with template type identification
- Timeout and error handling with automatic retry mechanism
- ACK handling for reliable message delivery
- Callback routing based on registered model IDs
Message Processing Flow:
- Validates input parameters and model ID
- Searches the template-specific callback list for matching model ID
- Handles timeout/error cases with retry mechanism via TXCM
- Processes successful messages and handles ACK
- Invokes the registered application callback
- Template Parameters
-
| baseClientModelDerived_t | The derived client model class type |
| ble_mesh_plat_model_cb_params_t | Platform-specific callback parameter type |
| ble_mesh_send_msg_params_t | Platform-specific send message parameter type |
- Parameters
-
| [in] | pdev | Pointer to the device structure associated with the BLE Mesh node. Must not be NULL. |
| [in] | evt | Control task message event type (typically contains model context). |
| [in] | params | Pointer to platform-specific message parameters structure. Must not be NULL and contain valid model_id. |
- Return values
-
| MESHX_SUCCESS | Message processed successfully by registered callback. |
| MESHX_INVALID_ARG | Invalid parameters or unsupported model ID. |
| Other | Error codes from callback execution or TXCM operations. |
- Note
- This function is automatically registered as the message handler during construction.
-
Each template instantiation gets its own static instance of this function.
-
Enhanced with template type identification for improved debugging.
- See also
- base_txcm_handle_resend() for retry mechanism details.
-
base_txcm_handle_ack() for ACK processing details.
366{
368 {
371 }
372
373
375
380
382 {
384 {
385
387 {
388 continue;
389 }
390
392 "op|src|dst:%04" PRIx32 "|%04x|%04x",
394
395 if (
node.cb ==
nullptr)
396 {
398 continue;
399 }
400
402 {
407 }
408 else
409 {
413
415 }
416
418 }
419 }
420
423
425}
static meshx_err_t base_txcm_handle_resend(uint16_t model_id, const ble_mesh_plat_model_cb_params_t *param)
Resend a message for the given model ID and parameter.
Definition meshx_base_model_class.cpp:305
static meshx_err_t base_txcm_handle_ack(uint16_t src_addr)
Resend an acknowledgement message for the given source address.
Definition meshx_base_model_class.cpp:288
#define MESHX_LOGW(module_id, format,...)
Definition meshx_log.h:120
◆ base_handle_txcm_msg()
template<typename baseClientModelDerived_t, typename ble_mesh_send_msg_params_t, typename ble_mesh_plat_model_cb_params_t>
Template-based TXCM (Transmission Control Module) message handler for timeout scenarios.
This function handles control task messages from the Transmission Control Module (TXCM), specifically for timeout and resend scenarios in Generic Client models. It processes timeout events by setting appropriate error codes and invoking registered callbacks to notify the application layer of transmission failures.
Key Responsibilities:
- Processes TXCM timeout notifications for failed message transmissions
- Sets timeout error codes (MESHX_TIMEOUT, MESHX_BASE_CLI_TIMEOUT)
- Routes timeout events to registered application callbacks
- Provides template-specific error logging and debugging
- Maintains consistency with C implementation error handling patterns
Timeout Processing Flow:
- Searches template-specific callback list for matching model ID
- Sets timeout error codes in the parameter structure
- Validates callback function is not null
- Invokes registered callback with timeout notification
- Returns gracefully if no callback is registered (consistent with C impl)
- Template Parameters
-
| baseClientModelDerived_t | The derived client model class type |
| ble_mesh_plat_model_cb_params_t | Platform-specific callback parameter type |
| ble_mesh_send_msg_params_t | Platform-specific send message parameter type |
- Parameters
-
| [in] | pdev | Pointer to the device structure associated with the BLE Mesh node. Must not be NULL. |
| [in] | evt | Control task message event type (unused in current implementation). |
| [in] | param | Pointer to resend context containing model ID and callback parameters. Must not be NULL and contain valid model_id. |
- Return values
-
| MESHX_SUCCESS | Timeout processed successfully or no callback registered. |
| Other | Error codes from callback execution. |
- Note
- This function is called by the TXCM when message transmission timeouts occur.
-
Each template instantiation maintains its own callback list and handler.
-
Enhanced with template type identification for debugging purposes.
- See also
- base_from_ble_msg_handle() for normal message processing.
-
base_txcm_handle_resend() for retry mechanism details.
470{
475 {
477 {
478
480 {
481 continue;
482 }
483
486 if(
node.cb ==
nullptr)
487 {
489 continue;
490 }
493 }
494 }
495
497 {
500 }
501
503}
#define MESHX_UNUSED(x)
Definition meshx_err.h:19
◆ base_txcm_handle_ack()
template<typename baseClientModelDerived_t, typename ble_mesh_send_msg_params_t, typename ble_mesh_plat_model_cb_params_t>
| meshx_err_t meshXBaseClientModel< baseClientModelDerived_t, ble_mesh_send_msg_params_t, ble_mesh_plat_model_cb_params_t >::base_txcm_handle_ack |
( |
uint16_t | src_addr | ) |
|
|
staticprotected |
Resend an acknowledgement message for the given source address.
This function resends an acknowledgement message for the given source address.
- Parameters
-
| [in] | src_addr | The source address associated with the acknowledgement message. |
- Return values
-
| MESHX_SUCCESS | if the acknowledgement message was resent successfully, otherwise an error code. |
289{
293}
meshx_err_t meshx_txcm_request_send(meshx_txcm_sig_t request_type, uint16_t dest_addr, meshx_cptr_t msg_param, uint16_t msg_param_len, meshx_txcm_fn_model_send_t send_fn)
Sends a request to the Tx Control module.
Definition meshx_txcm.c:672
◆ base_txcm_handle_resend()
template<typename baseClientModelDerived_t, typename ble_mesh_send_msg_params_t, typename ble_mesh_plat_model_cb_params_t>
| meshx_err_t meshXBaseClientModel< baseClientModelDerived_t, ble_mesh_send_msg_params_t, ble_mesh_plat_model_cb_params_t >::base_txcm_handle_resend |
( |
uint16_t | model_id, |
|
|
const ble_mesh_plat_model_cb_params_t * | param ) |
|
staticprotected |
Resend a message for the given model ID and parameter.
This function resends a message for the given model ID and parameter.
- Parameters
-
| [in] | model_id | The unique identifier of the generic client model. |
| [in] | param | The parameter associated with the re-sending. |
- Return values
-
| MESHX_SUCCESS | if the message was resent successfully, otherwise an error code. |
306{
309 .param = {}
310 };
312
319}
struct base_client_model_resend_ctx { uint16_t model_id; ble_mesh_plat_model_cb_params_t param; } base_client_model_resend_ctx_t
Definition meshx_base_model_class.hpp:255
◆ from_ble_dereg_cb()
template<typename baseClientModelDerived_t, typename ble_mesh_send_msg_params_t, typename ble_mesh_plat_model_cb_params_t>
| meshx_err_t meshXBaseClientModel< baseClientModelDerived_t, ble_mesh_send_msg_params_t, ble_mesh_plat_model_cb_params_t >::from_ble_dereg_cb |
( |
void | | ) |
const |
|
overridevirtual |
Deregister BLE message callback for this model.
Deregisters a callback function associated with a model ID.
Automatically called during model destruction to remove the callback function that handles BLE messages for this model's ID.
- Returns
- MESHX_SUCCESS if deregistration successful, error code otherwise
This function deregisters the callback function associated with the given model ID, allowing the server to stop handling events or messages related to that model.
- Returns
- meshx_err_t Returns an error code indicating the result of the deregistration. Possible values include success or specific error codes.
Reimplemented from meshXBaseModel< ble_mesh_send_msg_params_t >.
507{
508
510
511
514 });
515
517}
struct base_client_model_cb_reg { uint16_t model_id; meshx_ptr_t p_plat_model; control_msg_cb cb; meshXBaseClientModel *instance; } base_client_model_cb_reg_t
Definition meshx_base_model_class.hpp:248
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.
Definition meshx_control_task.c:172
◆ get_client_type_name()
template<typename baseClientModelDerived_t, typename ble_mesh_send_msg_params_t, typename ble_mesh_plat_model_cb_params_t>
| constexpr const char * meshXBaseClientModel< baseClientModelDerived_t, ble_mesh_send_msg_params_t, ble_mesh_plat_model_cb_params_t >::get_client_type_name |
( |
| ) |
|
|
inlinestaticconstexprprotected |
◆ set_plat_model_ptr()
template<typename baseClientModelDerived_t, typename ble_mesh_send_msg_params_t, typename ble_mesh_plat_model_cb_params_t>
| void meshXBaseClientModel< baseClientModelDerived_t, ble_mesh_send_msg_params_t, ble_mesh_plat_model_cb_params_t >::set_plat_model_ptr |
( |
meshx_ptr_t | p_model | ) |
|
Set the platform model pointer and update the registration list.
- Parameters
-
| [in] | p_model | Pointer to the platform model instance. |
521{
524 {
525 if (
node.instance ==
this)
526 {
528 break;
529 }
530 }
531}
◆ validate_client_model_id()
template<typename baseClientModelDerived_t, typename ble_mesh_send_msg_params_t, typename ble_mesh_plat_model_cb_params_t>
| virtual meshx_err_t meshXBaseClientModel< baseClientModelDerived_t, ble_mesh_send_msg_params_t, ble_mesh_plat_model_cb_params_t >::validate_client_model_id |
( |
uint32_t | model_id | ) |
|
|
protectedpure virtual |
◆ base_client_model_cb_list
template<typename baseClientModelDerived_t, typename ble_mesh_send_msg_params_t, typename ble_mesh_plat_model_cb_params_t>
◆ p_plat_model
template<typename baseClientModelDerived_t, typename ble_mesh_send_msg_params_t, typename ble_mesh_plat_model_cb_params_t>
◆ plat_client_init_flag
template<typename baseClientModelDerived_t, typename ble_mesh_send_msg_params_t, typename ble_mesh_plat_model_cb_params_t>
| std::once_flag meshXBaseClientModel< baseClientModelDerived_t, ble_mesh_send_msg_params_t, ble_mesh_plat_model_cb_params_t >::plat_client_init_flag |
|
staticprotected |
The documentation for this class was generated from the following files: