MeshX 0.3
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_api.h
Go to the documentation of this file.
1
10
11#ifndef __MESHX_API_H__
12#define __MESHX_API_H__
13
14#include <meshx_common.h>
15#include <meshx_elements.h>
16#include <meshx_control_task.h>
17
18#define MESHX_APP_API_MSG_MAX_SIZE sizeof(meshx_data_payload_t)
19
20/* MeshX Function ID Relay Server */
21#define MESHX_ELEMENT_FUNC_ID_RELAY_SERVER_ONN_OFF 0x00
22
23/* MeshX Function ID Light CWWW Server */
24#define MESHX_ELEMENT_FUNC_ID_LIGHT_CWWW_SERVER_ONN_OFF 0x00
25#define MESHX_ELEMENT_FUNC_ID_LIGHT_CWWW_SERVER_CTL 0x01
26
27/* MeshX Function ID Light CWWW Server */
28#define MESHX_ELEMENT_FUNC_ID_LIGHT_CWWW_CLIENT_ONN_OFF 0x00
29#define MESHX_ELEMENT_FUNC_ID_LIGHT_CWWW_CLIENT_CTL 0x01
38
50
58
63{
64 union
65 {
66 struct
67 {
68 uint8_t state;
70 struct
71 {
72 uint16_t lightness;
73 uint16_t temperature;
74 uint16_t delta_uv;
80
89
94{
95 uint8_t err_code;
96 union
97 {
98 struct
99 {
100 uint8_t state;
102 struct
103 {
104 uint16_t lightness;
105 uint16_t temperature;
106 uint16_t delta_uv;
125
133
141{
142 uint16_t element_id; /* Element ID */
143 uint16_t element_type; /* meshx_element_type_t */
144 uint16_t func_id; /* Functionality number */
145 uint16_t msg_len; /* Length of the message */
147
155{
156 uint16_t evt; /* Event */
157 uint16_t reserved; /* Reserved */
159
176
188
200
214meshx_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);
215
229meshx_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);
230
241
252
253#endif /* __MESHX_API_H__ */
union meshx_data_payload meshx_data_payload_t
Structure for the BLE Mesh application control message.
union meshx_ctrl_payload meshx_ctrl_payload_t
Structure defines the payload for meshx_ctrl_payload.
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.
Definition meshx_api.h:187
struct meshx_ctrl_msg_header meshx_ctrl_msg_header_t
Structure for the BLE Mesh application control message header.
struct meshx_app_element_msg_header meshx_app_element_msg_header_t
Structure for the BLE Mesh application element message header.
meshx_api_type
Enumeration of BLE Mesh application API message types.
Definition meshx_api.h:34
@ MESHX_API_TYPE_DATA
Definition meshx_api.h:35
@ MESHX_API_TYPE_CTRL
Definition meshx_api.h:36
enum meshx_api_type meshx_api_type_t
Enumeration of BLE Mesh application API message types.
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.
Definition meshx_api.c:96
struct meshx_api_relay_client_state meshx_api_relay_client_evt_t
Structure defines the payload for MESHX_ELEMENT_TYPE_RELAY_CLIENT.
enum meshx_element_type meshx_element_type_t
Enumeration of BLE Mesh application API message types.
struct meshx_api_relay_server_evt meshx_api_relay_server_evt_t
Structure defines the payload for MESHX_ELEMENT_TYPE_RELAY_SERVER.
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.
Definition meshx_api.h:199
struct meshx_app_api_msg meshx_app_api_msg_t
Structure for the BLE Mesh application API 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.
Definition meshx_api.c:124
meshx_err_t meshx_app_reg_element_callback(meshx_app_data_cb_t cb)
Registers the BLE Mesh application callback.
Definition meshx_api.c:148
meshx_element_type
Enumeration of BLE Mesh application API message types.
Definition meshx_api.h:43
@ MESHX_ELEMENT_TYPE_LIGHT_CWWW_CLIENT
Definition meshx_api.h:47
@ MESHX_ELEMENT_TYPE_RELAY_CLIENT
Definition meshx_api.h:45
@ MESHX_ELEMENT_TYPE_MAX
Definition meshx_api.h:48
@ MESHX_ELEMENT_TYPE_LIGHT_CWWW_SERVER
Definition meshx_api.h:46
@ MESHX_ELEMENT_TYPE_RELAY_SERVER
Definition meshx_api.h:44
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.
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.
meshx_err_t meshx_app_reg_system_events_callback(meshx_app_ctrl_cb_t cb)
Registers the BLE Mesh application control callback.
Definition meshx_api.c:176
#define MESHX_APP_API_MSG_MAX_SIZE
Definition meshx_api.h:18
Common application definitions and includes for BLE Mesh Node.
Header file for the control task in the BLE mesh node application.
CONTROL_TASK_MSG_EVT_CTRL
CONTROL_TASK_MSG_EVT_DATA
Header file for MeshX elements.
meshx_err_t
MeshX Error Codes.
Definition meshx_err.h:39
Structure defines the payload for MESHX_ELEMENT_TYPE_LIGHT_CWWW_CLIENT.
Definition meshx_api.h:94
struct meshx_api_light_cwww_client_evt::@347235105244230326232000270243372246073133053316::@202375373323027037070222212050326072162342057303 on_off
struct meshx_api_light_cwww_client_evt::@347235105244230326232000270243372246073133053316::@153162234125000074275266213156212277206313354032 ctl
union meshx_api_light_cwww_client_evt::@347235105244230326232000270243372246073133053316 state_change
Structure defines the payload for MESHX_ELEMENT_TYPE_LIGHT_CWWW_SERVER.
Definition meshx_api.h:63
union meshx_api_light_cwww_server_evt::@257165005032013366004013204037032016036030275264 state_change
struct meshx_api_light_cwww_server_evt::@257165005032013366004013204037032016036030275264::@375004001161356005102054253202024137247030164222 on_off
struct meshx_api_light_cwww_server_evt::@257165005032013366004013204037032016036030275264::@245341060156102221224175046143367317210200103050 ctl
Structure defines the payload for MESHX_ELEMENT_TYPE_RELAY_CLIENT.
Definition meshx_api.h:85
Structure defines the payload for MESHX_ELEMENT_TYPE_RELAY_SERVER.
Definition meshx_api.h:55
Structure for the BLE Mesh application API message.
Definition meshx_api.h:167
union meshx_app_api_msg::@336376344215041027113126022265212173363045212317 msg_type_u
uint8_t data[MESHX_APP_API_MSG_MAX_SIZE]
Definition meshx_api.h:174
meshx_app_element_msg_header_t element_msg
Definition meshx_api.h:171
meshx_ctrl_msg_header_t ctrl_msg
Definition meshx_api.h:170
Structure for the BLE Mesh application element message header.
Definition meshx_api.h:141
Structure for the BLE Mesh application control message header.
Definition meshx_api.h:155
Structure defines the payload for meshx_ctrl_payload.
Definition meshx_api.h:130
Structure for the BLE Mesh application control message.
Definition meshx_api.h:119
meshx_api_relay_server_evt_t relay_server_evt
Definition meshx_api.h:121
meshx_api_relay_client_evt_t relay_client_evt
Definition meshx_api.h:120
meshx_api_light_cwww_client_evt_t light_cwww_client_evt
Definition meshx_api.h:122
meshx_api_light_cwww_server_evt_t light_cwww_server_evt
Definition meshx_api.h:123