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
meshx_model_gen_cli.cpp File Reference

Implementation of Generic Client Model shim for C++ migration. More...

#include "meshx_c_header.h"

Functions

meshx_err_t meshx_gen_cli_send_msg (meshx_gen_client_send_params_t *params)
 Sends a Generic Client message over BLE Mesh.
meshx_err_t meshx_gen_client_from_ble_reg_cb (uint32_t model_id, meshx_gen_client_cb_t cb)
meshx_err_t meshx_gen_client_init (void)

Detailed Description

Implementation of Generic Client Model shim for C++ migration.

Function Documentation

◆ meshx_gen_cli_send_msg()

meshx_err_t meshx_gen_cli_send_msg ( meshx_gen_client_send_params_t * params)

Sends a Generic Client message over BLE Mesh.

9{
10 if (!params) return MESHX_INVALID_ARG;
11
12 bool is_get = false;
13 /* Determine if opcode is GET (simplified check, usually based on opcode bitmask) */
14 if ((params->opcode & 0xFF) == 0x8201) { // Example: GEN_ONOFF_GET
15 is_get = true;
16 }
17 // Note: In real implementation, the platform layer should handle opcode properties.
18 // For now, we delegate to platform layer.
19
21 params->model,
22 params->state,
23 params->opcode,
24 params->addr,
25 params->net_idx,
26 params->app_idx,
27 is_get
28 );
29}
meshx_err_t meshx_plat_gen_cli_send_msg(meshx_ptr_t p_model, meshx_gen_cli_set_t *p_set, uint16_t opcode, uint16_t addr, uint16_t net_idx, uint16_t app_idx, bool is_get_opcode)
Sends a Generic Client message over BLE Mesh.
@ MESHX_INVALID_ARG
Definition meshx_err.h:46
uint16_t addr
Definition meshx_ble_mesh_gen_cli.h:299
uint16_t net_idx
Definition meshx_ble_mesh_gen_cli.h:300
meshx_gen_cli_set_t * state
Definition meshx_ble_mesh_gen_cli.h:302
meshx_ptr_t model
Definition meshx_ble_mesh_gen_cli.h:297
uint16_t opcode
Definition meshx_ble_mesh_gen_cli.h:298
uint16_t app_idx
Definition meshx_ble_mesh_gen_cli.h:301

◆ meshx_gen_client_from_ble_reg_cb()

meshx_err_t meshx_gen_client_from_ble_reg_cb ( uint32_t model_id,
meshx_gen_client_cb_t cb )
32{
35 CONTROL_TASK_MSG_EVT_DATA, // Generic data event for client responses
37 );
38}
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.
Definition meshx_control_task.h:188
@ CONTROL_TASK_MSG_CODE_TO_APP
Definition meshx_control_task.h:72
CONTROL_TASK_MSG_EVT_DATA
Definition meshx_control_task.h:88
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.
Definition meshx_control_task.c:142

◆ meshx_gen_client_init()

meshx_err_t meshx_gen_client_init ( void )
41{
43}
meshx_err_t meshx_plat_gen_cli_init(void)
Initialize the meshxuction generic client.