|
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.
|
This file contains the API definitions for the MeshX application. More...
#include "unit_test.h"#include <meshx_common.h>#include <meshx_control_task.h>#include <interface/ble_mesh/server/meshx_ble_mesh_sensor_srv.h>Go to the source code of this file.
Data Structures | |
| struct | meshx_api_relay_server_evt |
| Structure defines the payload for MESHX_ELEMENT_TYPE_RELAY_SERVER. More... | |
| struct | meshx_api_light_cwww_server_evt |
| Structure defines the payload for MESHX_ELEMENT_TYPE_LIGHT_CWWW_SERVER. More... | |
| struct | meshx_api_light_hsl_server_evt |
| Structure defines the payload for MESHX_ELEMENT_TYPE_LIGHT_HSL_SERVER. More... | |
| struct | meshx_api_sensor_server_evt |
| Structure defines the payload for MESHX_ELEMENT_TYPE_SENSOR_SERVER. More... | |
| struct | meshx_api_relay_client_state |
| Structure defines the payload for MESHX_ELEMENT_TYPE_RELAY_CLIENT. More... | |
| struct | meshx_api_light_cwww_client_evt |
| Structure defines the payload for MESHX_ELEMENT_TYPE_LIGHT_CWWW_CLIENT. More... | |
| union | meshx_data_payload |
| Structure for the BLE Mesh application control message. More... | |
| union | meshx_ctrl_payload |
| Structure defines the payload for meshx_ctrl_payload. More... | |
| struct | meshx_app_element_msg_header |
| Structure for the BLE Mesh application element message header. More... | |
| struct | meshx_ctrl_msg_header |
| Structure for the BLE Mesh application control message header. More... | |
| struct | meshx_app_api_msg |
| Structure for the BLE Mesh application API message. More... | |
Macros | |
| #define | MESHX_APP_API_MSG_MAX_SIZE sizeof(meshx_data_payload_t) |
| #define | MESHX_ELEMENT_FUNC_ID_RELAY_SERVER_ONN_OFF 0x00 |
| #define | MESHX_ELEMENT_FUNC_ID_LIGHT_CWWW_SERVER_ONN_OFF 0x00 |
| #define | MESHX_ELEMENT_FUNC_ID_LIGHT_CWWW_SERVER_CTL 0x01 |
| #define | MESHX_ELEMENT_FUNC_ID_LIGHT_HSL_SERVER_ONN_OFF 0x00 |
| #define | MESHX_ELEMENT_FUNC_ID_LIGHT_HSL_SERVER_HSL 0x01 |
| #define | MESHX_ELEMENT_FUNC_ID_LIGHT_CWWW_CLIENT_ONN_OFF 0x00 |
| #define | MESHX_ELEMENT_FUNC_ID_LIGHT_CWWW_CLIENT_CTL 0x01 |
| #define | MESHX_ELEMENT_FUNC_ID_SENSOR_SERVER_DATA 0x00 |
Typedefs | |
| typedef enum meshx_api_type | meshx_api_type_t |
| Enumeration of BLE Mesh application API message types. | |
| typedef struct meshx_api_relay_server_evt | meshx_api_relay_server_evt_t |
| Structure defines the payload for MESHX_ELEMENT_TYPE_RELAY_SERVER. | |
| typedef struct meshx_api_light_cwww_server_evt | meshx_api_light_cwww_server_evt_t |
| Structure defines the payload for MESHX_ELEMENT_TYPE_LIGHT_CWWW_SERVER. | |
| typedef struct meshx_api_light_hsl_server_evt | meshx_api_light_hsl_server_evt_t |
| Structure defines the payload for MESHX_ELEMENT_TYPE_LIGHT_HSL_SERVER. | |
| typedef struct meshx_api_sensor_server_evt | meshx_api_sensor_server_evt_t |
| Structure defines the payload for MESHX_ELEMENT_TYPE_SENSOR_SERVER. | |
| typedef struct meshx_api_relay_client_state | meshx_api_relay_client_evt_t |
| Structure defines the payload for MESHX_ELEMENT_TYPE_RELAY_CLIENT. | |
| typedef struct meshx_api_light_cwww_client_evt | meshx_api_light_cwww_client_evt_t |
| Structure defines the payload for MESHX_ELEMENT_TYPE_LIGHT_CWWW_CLIENT. | |
| typedef union meshx_data_payload | meshx_data_payload_t |
| Structure for the BLE Mesh application control message. | |
| typedef union meshx_ctrl_payload | meshx_ctrl_payload_t |
| Structure defines the payload for meshx_ctrl_payload. | |
| typedef struct meshx_app_element_msg_header | meshx_app_element_msg_header_t |
| Structure for the BLE Mesh application element message header. | |
| typedef struct meshx_ctrl_msg_header | meshx_ctrl_msg_header_t |
| Structure for the BLE Mesh application control message header. | |
| typedef struct meshx_app_api_msg | meshx_app_api_msg_t |
| Structure for the BLE Mesh application API message. | |
| typedef meshx_err_t(* | meshx_app_data_cb_t) (const meshx_app_element_msg_header_t *msg_hdr, const meshx_data_payload_t *msg) |
| BLE Mesh application callback function. | |
| typedef meshx_err_t(* | meshx_app_ctrl_cb_t) (const meshx_ctrl_msg_header_t *msg_hdr, const meshx_ctrl_payload_t *msg) |
| BLE Mesh application control callback function. | |
Enumerations | |
| enum | meshx_api_type { MESHX_API_TYPE_DATA = CONTROL_TASK_MSG_EVT_DATA , MESHX_API_TYPE_CTRL = CONTROL_TASK_MSG_EVT_CTRL } |
| Enumeration of BLE Mesh application API message types. More... | |
Functions | |
| meshx_err_t | meshx_send_msg_to_app (uint16_t element_id, uint16_t element_type, uint16_t func_id, uint16_t msg_len, const void *msg) |
| Sends a message to the BLE Mesh application. | |
| meshx_err_t | meshx_send_ctrl_msg_to_app (meshx_ctrl_evt_t evt, uint16_t msg_len, const void *msg) |
| Sends a control message to the BLE Mesh application. | |
| meshx_err_t | meshx_send_msg_to_element (uint16_t element_id, uint16_t element_type, uint16_t func_id, uint16_t msg_len, const void *msg) |
| Sends a message to the element. | |
| meshx_err_t | meshx_app_reg_element_callback (meshx_app_data_cb_t cb) |
| Registers the BLE Mesh application callback. | |
| meshx_err_t | meshx_app_reg_system_events_callback (meshx_app_ctrl_cb_t cb) |
| Registers the BLE Mesh application control callback. | |
| uint16_t | meshx_get_net_key_id (void) |
| Get the network key identifier. | |
This file contains the API definitions for the MeshX application.
Copyright © 2024 - 2025 MeshX
The MeshX API provides functions and structures to interact with the BLE Mesh application. It includes message types, payload structures, and callback function definitions.
| #define MESHX_APP_API_MSG_MAX_SIZE sizeof(meshx_data_payload_t) |
| #define MESHX_ELEMENT_FUNC_ID_LIGHT_CWWW_CLIENT_CTL 0x01 |
| #define MESHX_ELEMENT_FUNC_ID_LIGHT_CWWW_CLIENT_ONN_OFF 0x00 |
| #define MESHX_ELEMENT_FUNC_ID_LIGHT_CWWW_SERVER_CTL 0x01 |
| #define MESHX_ELEMENT_FUNC_ID_LIGHT_CWWW_SERVER_ONN_OFF 0x00 |
| #define MESHX_ELEMENT_FUNC_ID_LIGHT_HSL_SERVER_HSL 0x01 |
| #define MESHX_ELEMENT_FUNC_ID_LIGHT_HSL_SERVER_ONN_OFF 0x00 |
| #define MESHX_ELEMENT_FUNC_ID_RELAY_SERVER_ONN_OFF 0x00 |
| #define MESHX_ELEMENT_FUNC_ID_SENSOR_SERVER_DATA 0x00 |
| typedef struct meshx_api_light_cwww_client_evt meshx_api_light_cwww_client_evt_t |
Structure defines the payload for MESHX_ELEMENT_TYPE_LIGHT_CWWW_CLIENT.
| typedef struct meshx_api_light_cwww_server_evt meshx_api_light_cwww_server_evt_t |
Structure defines the payload for MESHX_ELEMENT_TYPE_LIGHT_CWWW_SERVER.
| typedef struct meshx_api_light_hsl_server_evt meshx_api_light_hsl_server_evt_t |
Structure defines the payload for MESHX_ELEMENT_TYPE_LIGHT_HSL_SERVER.
| typedef struct meshx_api_relay_client_state meshx_api_relay_client_evt_t |
Structure defines the payload for MESHX_ELEMENT_TYPE_RELAY_CLIENT.
| typedef struct meshx_api_relay_server_evt meshx_api_relay_server_evt_t |
Structure defines the payload for MESHX_ELEMENT_TYPE_RELAY_SERVER.
| typedef struct meshx_api_sensor_server_evt meshx_api_sensor_server_evt_t |
Structure defines the payload for MESHX_ELEMENT_TYPE_SENSOR_SERVER.
| typedef enum meshx_api_type meshx_api_type_t |
Enumeration of BLE Mesh application API message types.
| typedef struct meshx_app_api_msg meshx_app_api_msg_t |
Structure for the BLE Mesh application API message.
This structure defines the BLE Mesh application API message.
| typedef meshx_err_t(* meshx_app_ctrl_cb_t) (const meshx_ctrl_msg_header_t *msg_hdr, const meshx_ctrl_payload_t *msg) |
BLE Mesh application control callback function.
This function is the BLE Mesh application control callback function.
| [in] | msg_hdr | Pointer to the BLE Mesh application control message header. |
| [in] | msg | Pointer to the message. |
| typedef meshx_err_t(* meshx_app_data_cb_t) (const meshx_app_element_msg_header_t *msg_hdr, const meshx_data_payload_t *msg) |
BLE Mesh application callback function.
This function is the BLE Mesh application callback function.
| [in] | msg_hdr | Pointer to the BLE Mesh application message header. |
| [in] | msg | Pointer to the message. |
| typedef struct meshx_app_element_msg_header meshx_app_element_msg_header_t |
Structure for the BLE Mesh application element message header.
| typedef struct meshx_ctrl_msg_header meshx_ctrl_msg_header_t |
Structure for the BLE Mesh application control message header.
This structure defines the header for BLE Mesh application control messages.
| typedef union meshx_ctrl_payload meshx_ctrl_payload_t |
Structure defines the payload for meshx_ctrl_payload.
| typedef union meshx_data_payload meshx_data_payload_t |
Structure for the BLE Mesh application control message.
This structure defines the BLE Mesh application control payloads.
| enum meshx_api_type |
Enumeration of BLE Mesh application API message types.
| meshx_err_t meshx_app_reg_element_callback | ( | meshx_app_data_cb_t | cb | ) |
Registers the BLE Mesh application callback.
This function registers the BLE Mesh application data path callback.
| [in] | cb | Pointer to the application callback. |
| meshx_err_t meshx_app_reg_system_events_callback | ( | meshx_app_ctrl_cb_t | cb | ) |
Registers the BLE Mesh application control callback.
This function registers the BLE Mesh application control callback.
| [in] | cb | Pointer to the control callback. |
| uint16_t meshx_get_net_key_id | ( | void | ) |
| meshx_err_t meshx_send_ctrl_msg_to_app | ( | meshx_ctrl_evt_t | evt, |
| uint16_t | msg_len, | ||
| const void * | msg ) |
Sends a control message to the BLE Mesh application.
This function sends a control message to the BLE Mesh application.
| [in] | evt | The event ID. |
| [in] | msg_len | The message length. |
| [in] | msg | Pointer to the message. |
| meshx_err_t meshx_send_msg_to_app | ( | uint16_t | element_id, |
| uint16_t | element_type, | ||
| uint16_t | func_id, | ||
| uint16_t | msg_len, | ||
| const void * | msg ) |
Sends a message to the BLE Mesh application.
This function sends a message to the BLE Mesh application.
| [in] | element_id | The element ID. |
| [in] | element_type | The element type. |
| [in] | func_id | The function ID. |
| [in] | msg_len | The message length. |
| [in] | msg | Pointer to the message. |
| meshx_err_t meshx_send_msg_to_element | ( | uint16_t | element_id, |
| uint16_t | element_type, | ||
| uint16_t | func_id, | ||
| uint16_t | msg_len, | ||
| const void * | msg ) |
Sends a message to the element.
This function sends a message to the element from BLE mesh Application
| [in] | element_id | The element ID. |
| [in] | element_type | The element type. |
| [in] | func_id | The function ID. |
| [in] | msg_len | The message length. |
| [in] | msg | Pointer to the message. |