NimBLE-Arduino 2.1.2
Loading...
Searching...
No Matches
foundation.h
1/* Bluetooth Mesh */
2
3/*
4 * Copyright (c) 2017 Intel Corporation
5 *
6 * SPDX-License-Identifier: Apache-2.0
7 */
8
9#ifndef __FUNDATION_H__
10#define __FUNDATION_H__
11
12#define OP_APP_KEY_ADD BT_MESH_MODEL_OP_1(0x00)
13#define OP_APP_KEY_UPDATE BT_MESH_MODEL_OP_1(0x01)
14#define OP_DEV_COMP_DATA_STATUS BT_MESH_MODEL_OP_1(0x02)
15#define OP_MOD_PUB_SET BT_MESH_MODEL_OP_1(0x03)
16#define OP_HEALTH_CURRENT_STATUS BT_MESH_MODEL_OP_1(0x04)
17#define OP_HEALTH_FAULT_STATUS BT_MESH_MODEL_OP_1(0x05)
18#define OP_HEARTBEAT_PUB_STATUS BT_MESH_MODEL_OP_1(0x06)
19#define OP_APP_KEY_DEL BT_MESH_MODEL_OP_2(0x80, 0x00)
20#define OP_APP_KEY_GET BT_MESH_MODEL_OP_2(0x80, 0x01)
21#define OP_APP_KEY_LIST BT_MESH_MODEL_OP_2(0x80, 0x02)
22#define OP_APP_KEY_STATUS BT_MESH_MODEL_OP_2(0x80, 0x03)
23#define OP_ATTENTION_GET BT_MESH_MODEL_OP_2(0x80, 0x04)
24#define OP_ATTENTION_SET BT_MESH_MODEL_OP_2(0x80, 0x05)
25#define OP_ATTENTION_SET_UNREL BT_MESH_MODEL_OP_2(0x80, 0x06)
26#define OP_ATTENTION_STATUS BT_MESH_MODEL_OP_2(0x80, 0x07)
27#define OP_DEV_COMP_DATA_GET BT_MESH_MODEL_OP_2(0x80, 0x08)
28#define OP_BEACON_GET BT_MESH_MODEL_OP_2(0x80, 0x09)
29#define OP_BEACON_SET BT_MESH_MODEL_OP_2(0x80, 0x0a)
30#define OP_BEACON_STATUS BT_MESH_MODEL_OP_2(0x80, 0x0b)
31#define OP_DEFAULT_TTL_GET BT_MESH_MODEL_OP_2(0x80, 0x0c)
32#define OP_DEFAULT_TTL_SET BT_MESH_MODEL_OP_2(0x80, 0x0d)
33#define OP_DEFAULT_TTL_STATUS BT_MESH_MODEL_OP_2(0x80, 0x0e)
34#define OP_FRIEND_GET BT_MESH_MODEL_OP_2(0x80, 0x0f)
35#define OP_FRIEND_SET BT_MESH_MODEL_OP_2(0x80, 0x10)
36#define OP_FRIEND_STATUS BT_MESH_MODEL_OP_2(0x80, 0x11)
37#define OP_GATT_PROXY_GET BT_MESH_MODEL_OP_2(0x80, 0x12)
38#define OP_GATT_PROXY_SET BT_MESH_MODEL_OP_2(0x80, 0x13)
39#define OP_GATT_PROXY_STATUS BT_MESH_MODEL_OP_2(0x80, 0x14)
40#define OP_KRP_GET BT_MESH_MODEL_OP_2(0x80, 0x15)
41#define OP_KRP_SET BT_MESH_MODEL_OP_2(0x80, 0x16)
42#define OP_KRP_STATUS BT_MESH_MODEL_OP_2(0x80, 0x17)
43#define OP_MOD_PUB_GET BT_MESH_MODEL_OP_2(0x80, 0x18)
44#define OP_MOD_PUB_STATUS BT_MESH_MODEL_OP_2(0x80, 0x19)
45#define OP_MOD_PUB_VA_SET BT_MESH_MODEL_OP_2(0x80, 0x1a)
46#define OP_MOD_SUB_ADD BT_MESH_MODEL_OP_2(0x80, 0x1b)
47#define OP_MOD_SUB_DEL BT_MESH_MODEL_OP_2(0x80, 0x1c)
48#define OP_MOD_SUB_DEL_ALL BT_MESH_MODEL_OP_2(0x80, 0x1d)
49#define OP_MOD_SUB_OVERWRITE BT_MESH_MODEL_OP_2(0x80, 0x1e)
50#define OP_MOD_SUB_STATUS BT_MESH_MODEL_OP_2(0x80, 0x1f)
51#define OP_MOD_SUB_VA_ADD BT_MESH_MODEL_OP_2(0x80, 0x20)
52#define OP_MOD_SUB_VA_DEL BT_MESH_MODEL_OP_2(0x80, 0x21)
53#define OP_MOD_SUB_VA_OVERWRITE BT_MESH_MODEL_OP_2(0x80, 0x22)
54#define OP_NET_TRANSMIT_GET BT_MESH_MODEL_OP_2(0x80, 0x23)
55#define OP_NET_TRANSMIT_SET BT_MESH_MODEL_OP_2(0x80, 0x24)
56#define OP_NET_TRANSMIT_STATUS BT_MESH_MODEL_OP_2(0x80, 0x25)
57#define OP_RELAY_GET BT_MESH_MODEL_OP_2(0x80, 0x26)
58#define OP_RELAY_SET BT_MESH_MODEL_OP_2(0x80, 0x27)
59#define OP_RELAY_STATUS BT_MESH_MODEL_OP_2(0x80, 0x28)
60#define OP_MOD_SUB_GET BT_MESH_MODEL_OP_2(0x80, 0x29)
61#define OP_MOD_SUB_LIST BT_MESH_MODEL_OP_2(0x80, 0x2a)
62#define OP_MOD_SUB_GET_VND BT_MESH_MODEL_OP_2(0x80, 0x2b)
63#define OP_MOD_SUB_LIST_VND BT_MESH_MODEL_OP_2(0x80, 0x2c)
64#define OP_LPN_TIMEOUT_GET BT_MESH_MODEL_OP_2(0x80, 0x2d)
65#define OP_LPN_TIMEOUT_STATUS BT_MESH_MODEL_OP_2(0x80, 0x2e)
66#define OP_HEALTH_FAULT_CLEAR BT_MESH_MODEL_OP_2(0x80, 0x2f)
67#define OP_HEALTH_FAULT_CLEAR_UNREL BT_MESH_MODEL_OP_2(0x80, 0x30)
68#define OP_HEALTH_FAULT_GET BT_MESH_MODEL_OP_2(0x80, 0x31)
69#define OP_HEALTH_FAULT_TEST BT_MESH_MODEL_OP_2(0x80, 0x32)
70#define OP_HEALTH_FAULT_TEST_UNREL BT_MESH_MODEL_OP_2(0x80, 0x33)
71#define OP_HEALTH_PERIOD_GET BT_MESH_MODEL_OP_2(0x80, 0x34)
72#define OP_HEALTH_PERIOD_SET BT_MESH_MODEL_OP_2(0x80, 0x35)
73#define OP_HEALTH_PERIOD_SET_UNREL BT_MESH_MODEL_OP_2(0x80, 0x36)
74#define OP_HEALTH_PERIOD_STATUS BT_MESH_MODEL_OP_2(0x80, 0x37)
75#define OP_HEARTBEAT_PUB_GET BT_MESH_MODEL_OP_2(0x80, 0x38)
76#define OP_HEARTBEAT_PUB_SET BT_MESH_MODEL_OP_2(0x80, 0x39)
77#define OP_HEARTBEAT_SUB_GET BT_MESH_MODEL_OP_2(0x80, 0x3a)
78#define OP_HEARTBEAT_SUB_SET BT_MESH_MODEL_OP_2(0x80, 0x3b)
79#define OP_HEARTBEAT_SUB_STATUS BT_MESH_MODEL_OP_2(0x80, 0x3c)
80#define OP_MOD_APP_BIND BT_MESH_MODEL_OP_2(0x80, 0x3d)
81#define OP_MOD_APP_STATUS BT_MESH_MODEL_OP_2(0x80, 0x3e)
82#define OP_MOD_APP_UNBIND BT_MESH_MODEL_OP_2(0x80, 0x3f)
83#define OP_NET_KEY_ADD BT_MESH_MODEL_OP_2(0x80, 0x40)
84#define OP_NET_KEY_DEL BT_MESH_MODEL_OP_2(0x80, 0x41)
85#define OP_NET_KEY_GET BT_MESH_MODEL_OP_2(0x80, 0x42)
86#define OP_NET_KEY_LIST BT_MESH_MODEL_OP_2(0x80, 0x43)
87#define OP_NET_KEY_STATUS BT_MESH_MODEL_OP_2(0x80, 0x44)
88#define OP_NET_KEY_UPDATE BT_MESH_MODEL_OP_2(0x80, 0x45)
89#define OP_NODE_IDENTITY_GET BT_MESH_MODEL_OP_2(0x80, 0x46)
90#define OP_NODE_IDENTITY_SET BT_MESH_MODEL_OP_2(0x80, 0x47)
91#define OP_NODE_IDENTITY_STATUS BT_MESH_MODEL_OP_2(0x80, 0x48)
92#define OP_NODE_RESET BT_MESH_MODEL_OP_2(0x80, 0x49)
93#define OP_NODE_RESET_STATUS BT_MESH_MODEL_OP_2(0x80, 0x4a)
94#define OP_SIG_MOD_APP_GET BT_MESH_MODEL_OP_2(0x80, 0x4b)
95#define OP_SIG_MOD_APP_LIST BT_MESH_MODEL_OP_2(0x80, 0x4c)
96#define OP_VND_MOD_APP_GET BT_MESH_MODEL_OP_2(0x80, 0x4d)
97#define OP_VND_MOD_APP_LIST BT_MESH_MODEL_OP_2(0x80, 0x4e)
98
99#define STATUS_SUCCESS 0x00
100#define STATUS_INVALID_ADDRESS 0x01
101#define STATUS_INVALID_MODEL 0x02
102#define STATUS_INVALID_APPKEY 0x03
103#define STATUS_INVALID_NETKEY 0x04
104#define STATUS_INSUFF_RESOURCES 0x05
105#define STATUS_IDX_ALREADY_STORED 0x06
106#define STATUS_NVAL_PUB_PARAM 0x07
107#define STATUS_NOT_SUB_MOD 0x08
108#define STATUS_STORAGE_FAIL 0x09
109#define STATUS_FEAT_NOT_SUPP 0x0a
110#define STATUS_CANNOT_UPDATE 0x0b
111#define STATUS_CANNOT_REMOVE 0x0c
112#define STATUS_CANNOT_BIND 0x0d
113#define STATUS_TEMP_STATE_CHG_FAIL 0x0e
114#define STATUS_CANNOT_SET 0x0f
115#define STATUS_UNSPECIFIED 0x10
116#define STATUS_INVALID_BINDING 0x11
117
118void bt_mesh_model_reset(void);
119
120void bt_mesh_attention(struct bt_mesh_model *model, uint8_t time);
121
122static inline void key_idx_pack(struct os_mbuf *buf,
123 uint16_t idx1, uint16_t idx2)
124{
125 net_buf_simple_add_le16(buf, idx1 | ((idx2 & 0x00f) << 12));
126 net_buf_simple_add_u8(buf, idx2 >> 4);
127}
128
129static inline void key_idx_unpack(struct os_mbuf *buf,
130 uint16_t *idx1, uint16_t *idx2)
131{
132 *idx1 = sys_get_le16(&buf->om_data[0]) & 0xfff;
133 *idx2 = sys_get_le16(&buf->om_data[1]) >> 4;
134 net_buf_simple_pull_mem(buf, 3);
135}
136
137#endif
Definition access.h:444
Definition os_mbuf.h:86
uint8_t * om_data
Definition os_mbuf.h:90