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_ble_mesh_gen_cli.h File Reference

Header file for BLE Mesh Generic Client functionality in the MeshX framework. This file contains declarations and includes required for implementing BLE Mesh Generic Client operations. More...

Go to the source code of this file.

Data Structures

struct  meshx_gen_onoff_set_t
struct  meshx_gen_level_set_t
struct  meshx_gen_delta_set_t
struct  meshx_gen_move_set_t
struct  meshx_gen_def_trans_time_set_t
struct  meshx_gen_onpowerup_set_t
struct  meshx_gen_power_level_set_t
struct  meshx_gen_power_default_set_t
struct  meshx_gen_power_range_set_t
struct  meshx_gen_loc_global_set_t
struct  meshx_gen_loc_local_set_t
union  meshx_gen_cli_set_t
 Generic Client Model set message union. More...
struct  meshx_gen_onoff_status_cb_t
struct  meshx_gen_level_status_cb_t
struct  meshx_gen_def_trans_time_status_cb_t
struct  meshx_gen_onpowerup_status_cb_t
struct  meshx_gen_power_level_status_cb_t
struct  meshx_gen_power_last_status_cb_t
struct  meshx_gen_power_default_status_cb_t
struct  meshx_gen_power_range_status_cb_t
struct  meshx_gen_battery_status_cb_t
struct  meshx_gen_loc_global_status_cb_t
struct  meshx_gen_loc_local_status_cb_t
struct  meshx_gen_user_properties_status_cb_t
struct  meshx_gen_user_property_status_cb_t
struct  meshx_gen_admin_properties_status_cb_t
struct  meshx_gen_admin_property_status_cb_t
struct  meshx_gen_manufacturer_properties_status_cb_t
struct  meshx_gen_manufacturer_property_status_cb_t
struct  meshx_gen_client_properties_status_cb_t
union  meshx_gen_client_status_cb_t
 Generic Client Model received message union. More...
struct  meshx_gen_cli_cb_param
 Callback parameters for Generic Client Model events. This structure is used to pass information about the received messages and their context to the application. It includes the context, model pointer, event type, and status values. The status values are encapsulated in a union to handle different types of status messages that the Generic Client Model can receive. Each status type corresponds to a specific operation code (opcode) defined in the BLE Mesh specification, allowing the application to handle them appropriately. More...
struct  meshx_gen_client_send_params
 Generic Client Model send parameters. More...

Typedefs

typedef struct meshx_gen_cli_cb_param meshx_gen_cli_cb_param_t
 Callback parameters for Generic Client Model events. This structure is used to pass information about the received messages and their context to the application. It includes the context, model pointer, event type, and status values. The status values are encapsulated in a union to handle different types of status messages that the Generic Client Model can receive. Each status type corresponds to a specific operation code (opcode) defined in the BLE Mesh specification, allowing the application to handle them appropriately.
typedef struct meshx_gen_client_send_params meshx_gen_client_send_params_t
 Generic Client Model send parameters.
typedef control_task_msg_handle_t meshx_gen_client_cb_t

Enumerations

enum  meshx_gen_cli_evt_t {
  MESHX_GEN_CLI_EVT_GET = (1UL << (0)) ,
  MESHX_GEN_CLI_EVT_SET = (1UL << (1)) ,
  MESHX_GEN_CLI_PUBLISH = (1UL << (2)) ,
  MESHX_GEN_CLI_TIMEOUT = (1UL << (3)) ,
  MESHX_GEN_CLI_EVT_ALL
}

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_plat_on_off_gen_cli_create (meshx_ptr_t p_model, meshx_ptr_t *p_pub, meshx_ptr_t *p_onoff_cli)
 Creates a Generic OnOff client model and its publication context.
meshx_err_t meshx_plat_gen_cli_delete (meshx_ptr_t *p_pub, meshx_ptr_t *p_cli)
 Deletes the Generic OnOff Client model and its associated resources.
meshx_err_t meshx_plat_gen_cli_init (void)
 Initialize the meshxuction generic client.
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.

Detailed Description

Header file for BLE Mesh Generic Client functionality in the MeshX framework. This file contains declarations and includes required for implementing BLE Mesh Generic Client operations.

Copyright (c) 2024 - 2025 MeshX

Author
Pranjal Chanda

Typedef Documentation

◆ meshx_gen_cli_cb_param_t

Callback parameters for Generic Client Model events. This structure is used to pass information about the received messages and their context to the application. It includes the context, model pointer, event type, and status values. The status values are encapsulated in a union to handle different types of status messages that the Generic Client Model can receive. Each status type corresponds to a specific operation code (opcode) defined in the BLE Mesh specification, allowing the application to handle them appropriately.

◆ meshx_gen_client_cb_t

◆ meshx_gen_client_send_params_t

Generic Client Model send parameters.

Enumeration Type Documentation

◆ meshx_gen_cli_evt_t

Enumerator
MESHX_GEN_CLI_EVT_GET (1UL << (0)) 
MESHX_GEN_CLI_EVT_SET (1UL << (1)) 
MESHX_GEN_CLI_PUBLISH (1UL << (2)) 
MESHX_GEN_CLI_TIMEOUT (1UL << (3)) 
MESHX_GEN_CLI_EVT_ALL ( MESHX_GEN_CLI_EVT_GET | MESHX_GEN_CLI_EVT_SET | MESHX_GEN_CLI_PUBLISH | MESHX_GEN_CLI_TIMEOUT) 
19{
#define MESHX_BIT(nr)
Definition meshx_ble_mesh_cmn_def.h:22
meshx_gen_cli_evt_t
Definition meshx_ble_mesh_gen_cli.h:19
@ MESHX_GEN_CLI_EVT_ALL
Definition meshx_ble_mesh_gen_cli.h:24
@ MESHX_GEN_CLI_EVT_GET
Definition meshx_ble_mesh_gen_cli.h:20
@ MESHX_GEN_CLI_EVT_SET
Definition meshx_ble_mesh_gen_cli.h:21
@ MESHX_GEN_CLI_PUBLISH
Definition meshx_ble_mesh_gen_cli.h:22
@ MESHX_GEN_CLI_TIMEOUT
Definition meshx_ble_mesh_gen_cli.h:23

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_plat_gen_cli_delete()

meshx_err_t meshx_plat_gen_cli_delete ( meshx_ptr_t * p_pub,
meshx_ptr_t * p_cli )

Deletes the Generic OnOff Client model and its associated resources.

This function frees the memory allocated for the Generic OnOff Client and sets the pointer to NULL. It also deletes the model publication resources associated with the client.

Parameters
[in,out]p_pubPointer to the publication structure to be deleted.
[in,out]p_cliPointer to the OnOff Client structure to be freed.
Returns
  • MESHX_SUCCESS: Model and publication deleted successfully.
  • MESHX_FAIL: Failed to delete the model or publication.

◆ meshx_plat_gen_cli_init()

meshx_err_t meshx_plat_gen_cli_init ( void )

Initialize the meshxuction generic client.

This function sets up the necessary configurations and initializes the meshxuction generic client for the BLE mesh node.

Returns
  • MESHX_SUCCESS: Success
  • MESHX_FAIL: Failed to initialize the client

◆ meshx_plat_gen_cli_send_msg()

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.

This function sends a message from a Generic Client model to a specified address within the BLE Mesh network, using the provided opcode and parameters.

Parameters
[in]p_modelPointer to the Generic Client model instance.
[in]p_setPointer to the structure containing the message parameters to set.
[in]opcodeOperation code specifying the type of message to send.
[in]addrDestination address within the BLE Mesh network.
[in]net_idxNetwork index identifying the subnet to use.
[in]app_idxApplication key index to encrypt the message.
[in]is_get_opcodeFlag indicating if the opcode is a GET request.
Returns
meshx_err_t Result of the operation. Returns MESHX_OK on success or an error code on failure.

◆ meshx_plat_on_off_gen_cli_create()

meshx_err_t meshx_plat_on_off_gen_cli_create ( meshx_ptr_t p_model,
meshx_ptr_t * p_pub,
meshx_ptr_t * p_onoff_cli )

Creates a Generic OnOff client model and its publication context.

This function initializes the Generic OnOff client model, its publication context, and allocates memory for the client instance. It checks for invalid arguments and handles memory allocation failures.

Parameters
[out]p_modelPointer to the model structure to be created.
[out]p_pubPointer to the publication context to be created.
[out]p_onoff_cliPointer to the OnOff client instance to be allocated.
Returns
  • MESHX_SUCCESS: Successfully created the model and publication context.
  • MESHX_INVALID_ARG: One or more arguments are invalid.
  • MESHX_NO_MEM: Memory allocation failed.