esp_ble_mesh_defs.h 133 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512151315141515151615171518151915201521152215231524152515261527152815291530153115321533153415351536153715381539154015411542154315441545154615471548154915501551155215531554155515561557155815591560156115621563156415651566156715681569157015711572157315741575157615771578157915801581158215831584158515861587158815891590159115921593159415951596159715981599160016011602160316041605160616071608160916101611161216131614161516161617161816191620162116221623162416251626162716281629163016311632163316341635163616371638163916401641164216431644164516461647164816491650165116521653165416551656165716581659166016611662166316641665166616671668166916701671167216731674167516761677167816791680168116821683168416851686168716881689169016911692169316941695169616971698169917001701170217031704170517061707170817091710171117121713171417151716171717181719172017211722172317241725172617271728172917301731173217331734173517361737173817391740174117421743174417451746174717481749175017511752175317541755175617571758175917601761176217631764176517661767176817691770177117721773177417751776177717781779178017811782178317841785178617871788178917901791179217931794179517961797179817991800180118021803180418051806180718081809181018111812181318141815181618171818181918201821182218231824182518261827182818291830183118321833183418351836183718381839184018411842184318441845184618471848184918501851185218531854185518561857185818591860186118621863186418651866186718681869187018711872187318741875187618771878187918801881188218831884188518861887188818891890189118921893189418951896189718981899190019011902190319041905190619071908190919101911191219131914191519161917191819191920192119221923192419251926192719281929193019311932193319341935193619371938193919401941194219431944194519461947194819491950195119521953195419551956195719581959196019611962196319641965196619671968196919701971197219731974197519761977197819791980198119821983198419851986198719881989199019911992199319941995199619971998199920002001200220032004200520062007200820092010201120122013201420152016201720182019202020212022202320242025202620272028202920302031203220332034203520362037203820392040204120422043204420452046204720482049205020512052205320542055205620572058205920602061206220632064206520662067206820692070207120722073207420752076207720782079208020812082208320842085208620872088208920902091209220932094209520962097209820992100210121022103210421052106210721082109211021112112211321142115211621172118211921202121212221232124212521262127212821292130213121322133213421352136213721382139214021412142214321442145214621472148214921502151215221532154215521562157215821592160216121622163216421652166216721682169217021712172217321742175217621772178217921802181218221832184218521862187218821892190219121922193219421952196219721982199220022012202220322042205220622072208220922102211221222132214221522162217221822192220222122222223222422252226222722282229223022312232223322342235223622372238223922402241224222432244224522462247224822492250225122522253225422552256225722582259226022612262226322642265226622672268
  1. // Copyright 2017-2019 Espressif Systems (Shanghai) PTE LTD
  2. //
  3. // Licensed under the Apache License, Version 2.0 (the "License");
  4. // you may not use this file except in compliance with the License.
  5. // You may obtain a copy of the License at
  6. // http://www.apache.org/licenses/LICENSE-2.0
  7. //
  8. // Unless required by applicable law or agreed to in writing, software
  9. // distributed under the License is distributed on an "AS IS" BASIS,
  10. // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  11. // See the License for the specific language governing permissions and
  12. // limitations under the License.
  13. #ifndef _ESP_BLE_MESH_DEFS_H_
  14. #define _ESP_BLE_MESH_DEFS_H_
  15. #include <stdint.h>
  16. #include "mesh_config.h"
  17. #include "mesh_common.h"
  18. #include "proxy_server.h"
  19. #include "provisioner_main.h"
  20. #ifdef __cplusplus
  21. extern "C" {
  22. #endif
  23. /*!< The maximum length of a BLE Mesh message, including Opcode, Payload and TransMIC */
  24. #define ESP_BLE_MESH_SDU_MAX_LEN 384
  25. /*!< Length of a short Mesh MIC. */
  26. #define ESP_BLE_MESH_MIC_SHORT 4
  27. /*!< Length of a long Mesh MIC. */
  28. #define ESP_BLE_MESH_MIC_LONG 8
  29. /*!< The maximum length of a BLE Mesh provisioned node name */
  30. #define ESP_BLE_MESH_NODE_NAME_MAX_LEN 31
  31. /*!< The maximum length of a BLE Mesh unprovisioned device name */
  32. #define ESP_BLE_MESH_DEVICE_NAME_MAX_LEN DEVICE_NAME_SIZE
  33. /*!< The maximum length of settings user id */
  34. #define ESP_BLE_MESH_SETTINGS_UID_SIZE 20
  35. /*!< Invalid settings index */
  36. #define ESP_BLE_MESH_INVALID_SETTINGS_IDX 0xFF
  37. /*!< Define the BLE Mesh octet 16 bytes size */
  38. #define ESP_BLE_MESH_OCTET16_LEN 16
  39. typedef uint8_t esp_ble_mesh_octet16_t[ESP_BLE_MESH_OCTET16_LEN];
  40. /*!< Define the BLE Mesh octet 8 bytes size */
  41. #define ESP_BLE_MESH_OCTET8_LEN 8
  42. typedef uint8_t esp_ble_mesh_octet8_t[ESP_BLE_MESH_OCTET8_LEN];
  43. /*!< Invalid Company ID */
  44. #define ESP_BLE_MESH_CID_NVAL 0xFFFF
  45. /*!< Special TTL value to request using configured default TTL */
  46. #define ESP_BLE_MESH_TTL_DEFAULT 0xFF
  47. /*!< Maximum allowed TTL value */
  48. #define ESP_BLE_MESH_TTL_MAX 0x7F
  49. #define ESP_BLE_MESH_ADDR_UNASSIGNED 0x0000
  50. #define ESP_BLE_MESH_ADDR_ALL_NODES 0xFFFF
  51. #define ESP_BLE_MESH_ADDR_PROXIES 0xFFFC
  52. #define ESP_BLE_MESH_ADDR_FRIENDS 0xFFFD
  53. #define ESP_BLE_MESH_ADDR_RELAYS 0xFFFE
  54. #define ESP_BLE_MESH_KEY_UNUSED 0xFFFF
  55. #define ESP_BLE_MESH_KEY_DEV 0xFFFE
  56. #define ESP_BLE_MESH_KEY_PRIMARY 0x0000
  57. #define ESP_BLE_MESH_KEY_ANY 0xFFFF
  58. /*!< Primary Network Key index */
  59. #define ESP_BLE_MESH_NET_PRIMARY 0x000
  60. /*!< Relay state value */
  61. #define ESP_BLE_MESH_RELAY_DISABLED 0x00
  62. #define ESP_BLE_MESH_RELAY_ENABLED 0x01
  63. #define ESP_BLE_MESH_RELAY_NOT_SUPPORTED 0x02
  64. /*!< Beacon state value */
  65. #define ESP_BLE_MESH_BEACON_DISABLED 0x00
  66. #define ESP_BLE_MESH_BEACON_ENABLED 0x01
  67. /*!< GATT Proxy state value */
  68. #define ESP_BLE_MESH_GATT_PROXY_DISABLED 0x00
  69. #define ESP_BLE_MESH_GATT_PROXY_ENABLED 0x01
  70. #define ESP_BLE_MESH_GATT_PROXY_NOT_SUPPORTED 0x02
  71. /*!< Friend state value */
  72. #define ESP_BLE_MESH_FRIEND_DISABLED 0x00
  73. #define ESP_BLE_MESH_FRIEND_ENABLED 0x01
  74. #define ESP_BLE_MESH_FRIEND_NOT_SUPPORTED 0x02
  75. /*!< Node identity state value */
  76. #define ESP_BLE_MESH_NODE_IDENTITY_STOPPED 0x00
  77. #define ESP_BLE_MESH_NODE_IDENTITY_RUNNING 0x01
  78. #define ESP_BLE_MESH_NODE_IDENTITY_NOT_SUPPORTED 0x02
  79. /*!< Supported features */
  80. #define ESP_BLE_MESH_FEATURE_RELAY BIT(0)
  81. #define ESP_BLE_MESH_FEATURE_PROXY BIT(1)
  82. #define ESP_BLE_MESH_FEATURE_FRIEND BIT(2)
  83. #define ESP_BLE_MESH_FEATURE_LOW_POWER BIT(3)
  84. #define ESP_BLE_MESH_FEATURE_ALL_SUPPORTED (ESP_BLE_MESH_FEATURE_RELAY | \
  85. ESP_BLE_MESH_FEATURE_PROXY | \
  86. ESP_BLE_MESH_FEATURE_FRIEND | \
  87. ESP_BLE_MESH_FEATURE_LOW_POWER)
  88. #define ESP_BLE_MESH_ADDR_IS_UNICAST(addr) ((addr) && (addr) < 0x8000)
  89. #define ESP_BLE_MESH_ADDR_IS_GROUP(addr) ((addr) >= 0xC000 && (addr) <= 0xFF00)
  90. #define ESP_BLE_MESH_ADDR_IS_VIRTUAL(addr) ((addr) >= 0x8000 && (addr) < 0xC000)
  91. #define ESP_BLE_MESH_ADDR_IS_RFU(addr) ((addr) >= 0xFF00 && (addr) <= 0xFFFB)
  92. #define ESP_BLE_MESH_INVALID_NODE_INDEX 0xFFFF
  93. /** @def ESP_BLE_MESH_TRANSMIT
  94. *
  95. * @brief Encode transmission count & interval steps.
  96. *
  97. * @note For example, ESP_BLE_MESH_TRANSMIT(2, 20) means that the message
  98. * will be sent about 90ms(count is 3, step is 1, interval is 30 ms
  99. * which includes 10ms of advertising interval random delay).
  100. *
  101. * @param count Number of retransmissions (first transmission is excluded).
  102. * @param int_ms Interval steps in milliseconds. Must be greater than 0
  103. * and a multiple of 10.
  104. *
  105. * @return BLE Mesh transmit value that can be used e.g. for the default
  106. * values of the Configuration Model data.
  107. */
  108. #define ESP_BLE_MESH_TRANSMIT(count, int_ms) ((count) | (((int_ms / 10) - 1) << 3))
  109. /** @def ESP_BLE_MESH_GET_TRANSMIT_COUNT
  110. *
  111. * @brief Decode transmit count from a transmit value.
  112. *
  113. * @param transmit Encoded transmit count & interval value.
  114. *
  115. * @return Transmission count (actual transmissions equal to N + 1).
  116. */
  117. #define ESP_BLE_MESH_GET_TRANSMIT_COUNT(transmit) (((transmit) & (uint8_t)BIT_MASK(3)))
  118. /** @def ESP_BLE_MESH_GET_TRANSMIT_INTERVAL
  119. *
  120. * @brief Decode transmit interval from a transmit value.
  121. *
  122. * @param transmit Encoded transmit count & interval value.
  123. *
  124. * @return Transmission interval in milliseconds.
  125. */
  126. #define ESP_BLE_MESH_GET_TRANSMIT_INTERVAL(transmit) ((((transmit) >> 3) + 1) * 10)
  127. /** @def ESP_BLE_MESH_PUBLISH_TRANSMIT
  128. *
  129. * @brief Encode Publish Retransmit count & interval steps.
  130. *
  131. * @param count Number of retransmissions (first transmission is excluded).
  132. * @param int_ms Interval steps in milliseconds. Must be greater than 0
  133. * and a multiple of 50.
  134. *
  135. * @return BLE Mesh transmit value that can be used e.g. for the default
  136. * values of the Configuration Model data.
  137. */
  138. #define ESP_BLE_MESH_PUBLISH_TRANSMIT(count, int_ms) ESP_BLE_MESH_TRANSMIT(count, (int_ms) / 5)
  139. /** @def ESP_BLE_MESH_GET_PUBLISH_TRANSMIT_COUNT
  140. *
  141. * @brief Decode Publish Retransmit count from a given value.
  142. *
  143. * @param transmit Encoded Publish Retransmit count & interval value.
  144. *
  145. * @return Retransmission count (actual transmissions equal to N + 1).
  146. */
  147. #define ESP_BLE_MESH_GET_PUBLISH_TRANSMIT_COUNT(transmit) ESP_BLE_MESH_GET_TRANSMIT_COUNT(transmit)
  148. /** @def ESP_BLE_MESH_GET_PUBLISH_TRANSMIT_INTERVAL
  149. *
  150. * @brief Decode Publish Retransmit interval from a given value.
  151. *
  152. * @param transmit Encoded Publish Retransmit count & interval value.
  153. *
  154. * @return Transmission interval in milliseconds.
  155. */
  156. #define ESP_BLE_MESH_GET_PUBLISH_TRANSMIT_INTERVAL(transmit) ((((transmit) >> 3) + 1) * 50)
  157. /*!< Callbacks which are not needed to be initialized by users (set with 0 and will be initialized internally) */
  158. typedef uint32_t esp_ble_mesh_cb_t;
  159. typedef enum {
  160. ESP_BLE_MESH_TYPE_PROV_CB,
  161. ESP_BLE_MESH_TYPE_OUTPUT_NUM_CB,
  162. ESP_BLE_MESH_TYPE_OUTPUT_STR_CB,
  163. ESP_BLE_MESH_TYPE_INTPUT_CB,
  164. ESP_BLE_MESH_TYPE_LINK_OPEN_CB,
  165. ESP_BLE_MESH_TYPE_LINK_CLOSE_CB,
  166. ESP_BLE_MESH_TYPE_COMPLETE_CB,
  167. ESP_BLE_MESH_TYPE_RESET_CB,
  168. } esp_ble_mesh_cb_type_t;
  169. /*!< This enum value is provisioning authentication oob method */
  170. typedef enum {
  171. ESP_BLE_MESH_NO_OOB,
  172. ESP_BLE_MESH_STATIC_OOB,
  173. ESP_BLE_MESH_OUTPUT_OOB,
  174. ESP_BLE_MESH_INPUT_OOB,
  175. } esp_ble_mesh_oob_method_t;
  176. /*!< This enum value is associated with bt_mesh_output_action_t in mesh_main.h */
  177. typedef enum {
  178. ESP_BLE_MESH_NO_OUTPUT = 0,
  179. ESP_BLE_MESH_BLINK = BIT(0),
  180. ESP_BLE_MESH_BEEP = BIT(1),
  181. ESP_BLE_MESH_VIBRATE = BIT(2),
  182. ESP_BLE_MESH_DISPLAY_NUMBER = BIT(3),
  183. ESP_BLE_MESH_DISPLAY_STRING = BIT(4),
  184. } esp_ble_mesh_output_action_t;
  185. /*!< This enum value is associated with bt_mesh_input_action_t in mesh_main.h */
  186. typedef enum {
  187. ESP_BLE_MESH_NO_INPUT = 0,
  188. ESP_BLE_MESH_PUSH = BIT(0),
  189. ESP_BLE_MESH_TWIST = BIT(1),
  190. ESP_BLE_MESH_ENTER_NUMBER = BIT(2),
  191. ESP_BLE_MESH_ENTER_STRING = BIT(3),
  192. } esp_ble_mesh_input_action_t;
  193. /*!< This enum value is associated with bt_mesh_prov_bearer_t in mesh_main.h */
  194. typedef enum {
  195. ESP_BLE_MESH_PROV_ADV = BIT(0),
  196. ESP_BLE_MESH_PROV_GATT = BIT(1),
  197. } esp_ble_mesh_prov_bearer_t;
  198. /*!< This enum value is associated with bt_mesh_prov_oob_info_t in mesh_main.h */
  199. typedef enum {
  200. ESP_BLE_MESH_PROV_OOB_OTHER = BIT(0),
  201. ESP_BLE_MESH_PROV_OOB_URI = BIT(1),
  202. ESP_BLE_MESH_PROV_OOB_2D_CODE = BIT(2),
  203. ESP_BLE_MESH_PROV_OOB_BAR_CODE = BIT(3),
  204. ESP_BLE_MESH_PROV_OOB_NFC = BIT(4),
  205. ESP_BLE_MESH_PROV_OOB_NUMBER = BIT(5),
  206. ESP_BLE_MESH_PROV_OOB_STRING = BIT(6),
  207. /* 7 - 10 are reserved */
  208. ESP_BLE_MESH_PROV_OOB_ON_BOX = BIT(11),
  209. ESP_BLE_MESH_PROV_OOB_IN_BOX = BIT(12),
  210. ESP_BLE_MESH_PROV_OOB_ON_PAPER = BIT(13),
  211. ESP_BLE_MESH_PROV_OOB_IN_MANUAL = BIT(14),
  212. ESP_BLE_MESH_PROV_OOB_ON_DEV = BIT(15),
  213. } esp_ble_mesh_prov_oob_info_t;
  214. /*!< Maximum length of value used by Static OOB authentication */
  215. #define ESP_BLE_MESH_PROV_STATIC_OOB_MAX_LEN 16
  216. /*!< Maximum length of string used by Output OOB authentication */
  217. #define ESP_BLE_MESH_PROV_OUTPUT_OOB_MAX_LEN 8
  218. /*!< Maximum length of string used by Output OOB authentication */
  219. #define ESP_BLE_MESH_PROV_INPUT_OOB_MAX_LEN 8
  220. /*!< Macros used to define message opcode */
  221. #define ESP_BLE_MESH_MODEL_OP_1(b0) (b0)
  222. #define ESP_BLE_MESH_MODEL_OP_2(b0, b1) (((b0) << 8) | (b1))
  223. #define ESP_BLE_MESH_MODEL_OP_3(b0, cid) ((((b0) << 16) | 0xC00000) | (cid))
  224. /*!< This macro is associated with BLE_MESH_MODEL_CB in mesh_access.h */
  225. #define ESP_BLE_MESH_SIG_MODEL(_id, _op, _pub, _user_data) \
  226. { \
  227. .model_id = (_id), \
  228. .op = _op, \
  229. .keys = { [0 ... (CONFIG_BLE_MESH_MODEL_KEY_COUNT - 1)] = \
  230. ESP_BLE_MESH_KEY_UNUSED }, \
  231. .pub = _pub, \
  232. .groups = { [0 ... (CONFIG_BLE_MESH_MODEL_GROUP_COUNT - 1)] = \
  233. ESP_BLE_MESH_ADDR_UNASSIGNED }, \
  234. .user_data = _user_data, \
  235. }
  236. /*!< This macro is associated with BLE_MESH_MODEL_VND_CB in mesh_access.h */
  237. #define ESP_BLE_MESH_VENDOR_MODEL(_company, _id, _op, _pub, _user_data) \
  238. { \
  239. .vnd.company_id = (_company), \
  240. .vnd.model_id = (_id), \
  241. .op = _op, \
  242. .pub = _pub, \
  243. .keys = { [0 ... (CONFIG_BLE_MESH_MODEL_KEY_COUNT - 1)] = \
  244. ESP_BLE_MESH_KEY_UNUSED }, \
  245. .groups = { [0 ... (CONFIG_BLE_MESH_MODEL_GROUP_COUNT - 1)] = \
  246. ESP_BLE_MESH_ADDR_UNASSIGNED }, \
  247. .user_data = _user_data, \
  248. }
  249. /** @brief Helper to define a BLE Mesh element within an array.
  250. *
  251. * In case the element has no SIG or Vendor models, the helper
  252. * macro ESP_BLE_MESH_MODEL_NONE can be given instead.
  253. *
  254. * @note This macro is associated with BLE_MESH_ELEM in mesh_access.h
  255. *
  256. * @param _loc Location Descriptor.
  257. * @param _mods Array of SIG models.
  258. * @param _vnd_mods Array of vendor models.
  259. */
  260. #define ESP_BLE_MESH_ELEMENT(_loc, _mods, _vnd_mods) \
  261. { \
  262. .location = (_loc), \
  263. .sig_model_count = ARRAY_SIZE(_mods), \
  264. .sig_models = (_mods), \
  265. .vnd_model_count = ARRAY_SIZE(_vnd_mods), \
  266. .vnd_models = (_vnd_mods), \
  267. }
  268. #define ESP_BLE_MESH_PROV(uuid, sta_val, sta_val_len, out_size, out_act, in_size, in_act) { \
  269. .uuid = uuid, \
  270. .static_val = sta_val, \
  271. .static_val_len = sta_val_len, \
  272. .output_size = out_size, \
  273. .output_action = out_act, \
  274. .input_size = in_size, \
  275. .input_action = in_act, \
  276. }
  277. typedef uint8_t UINT8;
  278. typedef uint16_t UINT16;
  279. typedef uint32_t UINT32;
  280. typedef uint64_t UINT64;
  281. #define BT_OCTET32_LEN 32
  282. typedef UINT8 BT_OCTET32[BT_OCTET32_LEN]; /* octet array: size 32 */
  283. #ifndef BD_ADDR_LEN
  284. #define BD_ADDR_LEN 6
  285. typedef uint8_t BD_ADDR[BD_ADDR_LEN];
  286. #endif
  287. typedef uint8_t esp_ble_mesh_bd_addr_t[BD_ADDR_LEN];
  288. #define ESP_BLE_MESH_ADDR_TYPE_PUBLIC 0x00
  289. #define ESP_BLE_MESH_ADDR_TYPE_RANDOM 0x01
  290. #define ESP_BLE_MESH_ADDR_TYPE_RPA_PUBLIC 0x02
  291. #define ESP_BLE_MESH_ADDR_TYPE_RPA_RANDOM 0x03
  292. /// BLE device address type
  293. typedef uint8_t esp_ble_mesh_addr_type_t;
  294. /** BLE Mesh deinit parameters */
  295. typedef struct {
  296. bool erase_flash; /*!< Indicate if erasing flash when deinit mesh stack */
  297. } esp_ble_mesh_deinit_param_t;
  298. typedef struct esp_ble_mesh_model esp_ble_mesh_model_t;
  299. /** Abstraction that describes a BLE Mesh Element.
  300. * This structure is associated with struct bt_mesh_elem in mesh_access.h
  301. */
  302. typedef struct {
  303. /** Element Address, assigned during provisioning. */
  304. uint16_t element_addr;
  305. /** Location Descriptor (GATT Bluetooth Namespace Descriptors) */
  306. const uint16_t location;
  307. const uint8_t sig_model_count; /*!< SIG Model count */
  308. const uint8_t vnd_model_count; /*!< Vendor Model count */
  309. esp_ble_mesh_model_t *sig_models; /*!< SIG Models */
  310. esp_ble_mesh_model_t *vnd_models; /*!< Vendor Models */
  311. } esp_ble_mesh_elem_t;
  312. /** Abstraction that describes a model publication context.
  313. * This structure is associated with struct bt_mesh_model_pub in mesh_access.h
  314. */
  315. typedef struct {
  316. /** Pointer to the model to which the context belongs. Initialized by the stack. */
  317. esp_ble_mesh_model_t *model;
  318. uint16_t publish_addr; /*!< Publish Address. */
  319. uint16_t app_idx:12, /*!< Publish AppKey Index. */
  320. cred:1, /*!< Friendship Credentials Flag. */
  321. send_rel:1; /*!< Force reliable sending (segment acks) */
  322. uint8_t ttl; /*!< Publish Time to Live. */
  323. uint8_t retransmit; /*!< Retransmit Count & Interval Steps. */
  324. uint8_t period; /*!< Publish Period. */
  325. uint8_t period_div:4, /*!< Divisor for the Period. */
  326. fast_period:1, /*!< Use FastPeriodDivisor */
  327. count:3; /*!< Retransmissions left. */
  328. uint32_t period_start; /*!< Start of the current period. */
  329. /** @brief Publication buffer, containing the publication message.
  330. *
  331. * This will get correctly created when the publication context
  332. * has been defined using the ESP_BLE_MESH_MODEL_PUB_DEFINE macro.
  333. *
  334. * ESP_BLE_MESH_MODEL_PUB_DEFINE(name, size);
  335. */
  336. struct net_buf_simple *msg;
  337. /** Callback used to update publish message. Initialized by the stack. */
  338. esp_ble_mesh_cb_t update;
  339. /** Publish Period Timer. Initialized by the stack. */
  340. struct k_delayed_work timer;
  341. /** Role of the device that is going to publish messages */
  342. uint8_t dev_role;
  343. } esp_ble_mesh_model_pub_t;
  344. /** @def ESP_BLE_MESH_MODEL_PUB_DEFINE
  345. *
  346. * Define a model publication context.
  347. *
  348. * @param _name Variable name given to the context.
  349. * @param _msg_len Length of the publication message.
  350. * @param _role Role of the device which contains the model.
  351. */
  352. #define ESP_BLE_MESH_MODEL_PUB_DEFINE(_name, _msg_len, _role) \
  353. NET_BUF_SIMPLE_DEFINE_STATIC(bt_mesh_pub_msg_##_name, _msg_len); \
  354. static esp_ble_mesh_model_pub_t _name = { \
  355. .update = (uint32_t)NULL, \
  356. .msg = &bt_mesh_pub_msg_##_name, \
  357. .dev_role = _role, \
  358. }
  359. /** @def ESP_BLE_MESH_MODEL_OP
  360. *
  361. * Define a model operation context.
  362. *
  363. * @param _opcode Message opcode.
  364. * @param _min_len Message minimum length.
  365. */
  366. #define ESP_BLE_MESH_MODEL_OP(_opcode, _min_len) \
  367. { \
  368. .opcode = _opcode, \
  369. .min_len = _min_len, \
  370. .param_cb = (uint32_t)NULL, \
  371. }
  372. /** Abstraction that describes a model operation context.
  373. * This structure is associated with struct bt_mesh_model_op in mesh_access.h
  374. */
  375. typedef struct {
  376. const uint32_t opcode; /*!< Message opcode */
  377. const size_t min_len; /*!< Message minimum length */
  378. esp_ble_mesh_cb_t param_cb; /*!< Callback used to handle message. Initialized by the stack. */
  379. } esp_ble_mesh_model_op_t;
  380. /** Define the terminator for the model operation table.
  381. * Each model operation struct array must use this terminator as
  382. * the end tag of the operation unit.
  383. */
  384. #define ESP_BLE_MESH_MODEL_OP_END {0, 0, 0}
  385. /** Abstraction that describes a model callback structure.
  386. * This structure is associated with struct bt_mesh_model_cb in mesh_access.h.
  387. */
  388. typedef struct {
  389. /** Callback used during model initialization. Initialized by the stack. */
  390. esp_ble_mesh_cb_t init_cb;
  391. #if CONFIG_BLE_MESH_DEINIT
  392. /** Callback used during model deinitialization. Initialized by the stack. */
  393. esp_ble_mesh_cb_t deinit_cb;
  394. #endif /* CONFIG_BLE_MESH_DEINIT */
  395. } esp_ble_mesh_model_cbs_t;
  396. /** Abstraction that describes a Mesh Model instance.
  397. * This structure is associated with struct bt_mesh_model in mesh_access.h
  398. */
  399. struct esp_ble_mesh_model {
  400. /** Model ID */
  401. union {
  402. const uint16_t model_id; /*!< 16-bit model identifier */
  403. struct {
  404. uint16_t company_id; /*!< 16-bit company identifier */
  405. uint16_t model_id; /*!< 16-bit model identifier */
  406. } vnd; /*!< Structure encapsulating a model ID with a company ID */
  407. };
  408. /** Internal information, mainly for persistent storage */
  409. uint8_t element_idx; /*!< Belongs to Nth element */
  410. uint8_t model_idx; /*!< Is the Nth model in the element */
  411. uint16_t flags; /*!< Information about what has changed */
  412. /** The Element to which this Model belongs */
  413. esp_ble_mesh_elem_t *element;
  414. /** Model Publication */
  415. esp_ble_mesh_model_pub_t *const pub;
  416. /** AppKey List */
  417. uint16_t keys[CONFIG_BLE_MESH_MODEL_KEY_COUNT];
  418. /** Subscription List (group or virtual addresses) */
  419. uint16_t groups[CONFIG_BLE_MESH_MODEL_GROUP_COUNT];
  420. /** Model operation context */
  421. esp_ble_mesh_model_op_t *op;
  422. /** Model callback structure */
  423. esp_ble_mesh_model_cbs_t *cb;
  424. /** Model-specific user data */
  425. void *user_data;
  426. };
  427. /** Helper to define an empty model array.
  428. * This structure is associated with BLE_MESH_MODEL_NONE in mesh_access.h
  429. */
  430. #define ESP_BLE_MESH_MODEL_NONE ((esp_ble_mesh_model_t []){})
  431. /** Message sending context.
  432. * This structure is associated with struct bt_mesh_msg_ctx in mesh_access.h
  433. */
  434. typedef struct {
  435. /** NetKey Index of the subnet through which to send the message. */
  436. uint16_t net_idx;
  437. /** AppKey Index for message encryption. */
  438. uint16_t app_idx;
  439. /** Remote address. */
  440. uint16_t addr;
  441. /** Destination address of a received message. Not used for sending. */
  442. uint16_t recv_dst;
  443. /** RSSI of received packet. Not used for sending. */
  444. int8_t recv_rssi;
  445. /** Received TTL value. Not used for sending. */
  446. uint8_t recv_ttl: 7;
  447. /** Force sending reliably by using segment acknowledgement */
  448. uint8_t send_rel: 1;
  449. /** TTL, or ESP_BLE_MESH_TTL_DEFAULT for default TTL. */
  450. uint8_t send_ttl;
  451. /** Opcode of a received message. Not used for sending message. */
  452. uint32_t recv_op;
  453. /** Model corresponding to the message, no need to be initialized before sending message */
  454. esp_ble_mesh_model_t *model;
  455. /** Indicate if the message is sent by a node server model, no need to be initialized before sending message */
  456. bool srv_send;
  457. } esp_ble_mesh_msg_ctx_t;
  458. /** Provisioning properties & capabilities.
  459. * This structure is associated with struct bt_mesh_prov in mesh_access.h
  460. */
  461. typedef struct {
  462. #if CONFIG_BLE_MESH_NODE
  463. /** The UUID that is used when advertising as an unprovisioned device */
  464. const uint8_t *uuid;
  465. /** Optional URI. This will be advertised separately from the
  466. * unprovisioned beacon, however the unprovisioned beacon will
  467. * contain a hash of it so the two can be associated by the
  468. * provisioner.
  469. */
  470. const char *uri;
  471. /** Out of Band information field. */
  472. esp_ble_mesh_prov_oob_info_t oob_info;
  473. /* NOTE: In order to avoid suffering brute-forcing attack (CVE-2020-26559).
  474. * The Bluetooth SIG recommends that potentially vulnerable mesh provisioners
  475. * support an out-of-band mechanism to exchange the public keys.
  476. * So as an unprovisioned device, it should enable this flag to support
  477. * using an out-of-band mechanism to exchange Public Key.
  478. */
  479. /** Flag indicates whether unprovisioned devices support OOB public key */
  480. bool oob_pub_key;
  481. /** Callback used to notify to set OOB Public Key. Initialized by the stack. */
  482. esp_ble_mesh_cb_t oob_pub_key_cb;
  483. /** Static OOB value */
  484. const uint8_t *static_val;
  485. /** Static OOB value length */
  486. uint8_t static_val_len;
  487. /** Maximum size of Output OOB supported */
  488. uint8_t output_size;
  489. /** Supported Output OOB Actions */
  490. uint16_t output_actions;
  491. /** Maximum size of Input OOB supported */
  492. uint8_t input_size;
  493. /** Supported Input OOB Actions */
  494. uint16_t input_actions;
  495. /** Callback used to output the number. Initialized by the stack. */
  496. esp_ble_mesh_cb_t output_num_cb;
  497. /** Callback used to output the string. Initialized by the stack. */
  498. esp_ble_mesh_cb_t output_str_cb;
  499. /** Callback used to notify to input number/string. Initialized by the stack. */
  500. esp_ble_mesh_cb_t input_cb;
  501. /** Callback used to indicate that link is opened. Initialized by the stack. */
  502. esp_ble_mesh_cb_t link_open_cb;
  503. /** Callback used to indicate that link is closed. Initialized by the stack. */
  504. esp_ble_mesh_cb_t link_close_cb;
  505. /** Callback used to indicate that provisioning is completed. Initialized by the stack. */
  506. esp_ble_mesh_cb_t complete_cb;
  507. /** Callback used to indicate that node has been reset. Initialized by the stack. */
  508. esp_ble_mesh_cb_t reset_cb;
  509. #endif /* CONFIG_BLE_MESH_NODE */
  510. #ifdef CONFIG_BLE_MESH_PROVISIONER
  511. /** Provisioner device UUID */
  512. const uint8_t *prov_uuid;
  513. /** Primary element address of the provisioner */
  514. const uint16_t prov_unicast_addr;
  515. /** Pre-incremental unicast address value to be assigned to the first device */
  516. uint16_t prov_start_address;
  517. /** Attention timer contained in Provisioning Invite PDU */
  518. uint8_t prov_attention;
  519. /** Provisioning Algorithm for the Provisioner */
  520. uint8_t prov_algorithm;
  521. /* NOTE: In order to avoid suffering brute-forcing attack (CVE-2020-26559).
  522. * The Bluetooth SIG recommends that potentially vulnerable mesh provisioners
  523. * use an out-of-band mechanism to exchange the public keys.
  524. */
  525. /** Provisioner public key oob */
  526. uint8_t prov_pub_key_oob;
  527. /** Callback used to notify to set device OOB Public Key. Initialized by the stack. */
  528. esp_ble_mesh_cb_t provisioner_prov_read_oob_pub_key;
  529. /* NOTE: The Bluetooth SIG recommends that mesh implementations enforce a randomly
  530. * selected AuthValue using all of the available bits, where permitted by the
  531. * implementation. A large entropy helps ensure that a brute-force of the AuthValue,
  532. * even a static AuthValue, cannot normally be completed in a reasonable time (CVE-2020-26557).
  533. *
  534. * AuthValues selected using a cryptographically secure random or pseudorandom number
  535. * generator and having the maximum permitted entropy (128-bits) will be most difficult
  536. * to brute-force. AuthValues with reduced entropy or generated in a predictable manner
  537. * will not grant the same level of protection against this vulnerability. Selecting a
  538. * new AuthValue with each provisioning attempt can also make it more difficult to launch
  539. * a brute-force attack by requiring the attacker to restart the search with each
  540. * provisioning attempt (CVE-2020-26556).
  541. */
  542. /** Provisioner static oob value */
  543. uint8_t *prov_static_oob_val;
  544. /** Provisioner static oob value length */
  545. uint8_t prov_static_oob_len;
  546. /** Callback used to notify to input number/string. Initialized by the stack. */
  547. esp_ble_mesh_cb_t provisioner_prov_input;
  548. /** Callback used to output number/string. Initialized by the stack. */
  549. esp_ble_mesh_cb_t provisioner_prov_output;
  550. /** Key refresh and IV update flag */
  551. uint8_t flags;
  552. /** IV index */
  553. uint32_t iv_index;
  554. /** Callback used to indicate that link is opened. Initialized by the stack. */
  555. esp_ble_mesh_cb_t provisioner_link_open;
  556. /** Callback used to indicate that link is closed. Initialized by the stack. */
  557. esp_ble_mesh_cb_t provisioner_link_close;
  558. /** Callback used to indicate that a device is provisioned. Initialized by the stack. */
  559. esp_ble_mesh_cb_t provisioner_prov_comp;
  560. #endif /* CONFIG_BLE_MESH_PROVISIONER */
  561. } esp_ble_mesh_prov_t;
  562. /** Node Composition data context.
  563. * This structure is associated with struct bt_mesh_comp in mesh_access.h
  564. */
  565. typedef struct {
  566. uint16_t cid; /*!< 16-bit SIG-assigned company identifier */
  567. uint16_t pid; /*!< 16-bit vendor-assigned product identifier */
  568. uint16_t vid; /*!< 16-bit vendor-assigned product version identifier */
  569. size_t element_count; /*!< Element count */
  570. esp_ble_mesh_elem_t *elements; /*!< A sequence of elements */
  571. } esp_ble_mesh_comp_t;
  572. /*!< This enum value is the role of the device */
  573. typedef enum {
  574. ROLE_NODE = 0,
  575. ROLE_PROVISIONER,
  576. ROLE_FAST_PROV,
  577. } esp_ble_mesh_dev_role_t;
  578. /*!< Flag which will be set when device is going to be added. */
  579. typedef uint8_t esp_ble_mesh_dev_add_flag_t;
  580. #define ADD_DEV_RM_AFTER_PROV_FLAG BIT(0) /*!< Device will be removed from queue after provisioned successfully */
  581. #define ADD_DEV_START_PROV_NOW_FLAG BIT(1) /*!< Start provisioning device immediately */
  582. #define ADD_DEV_FLUSHABLE_DEV_FLAG BIT(2) /*!< Device can be remove when queue is full and new device is going to added */
  583. /** Information of the device which is going to be added for provisioning. */
  584. typedef struct {
  585. esp_ble_mesh_bd_addr_t addr; /*!< Device address */
  586. esp_ble_mesh_addr_type_t addr_type; /*!< Device address type */
  587. uint8_t uuid[16]; /*!< Device UUID */
  588. uint16_t oob_info; /*!< Device OOB Info */
  589. /*!< ADD_DEV_START_PROV_NOW_FLAG shall not be set if the bearer has both PB-ADV and PB-GATT enabled */
  590. esp_ble_mesh_prov_bearer_t bearer; /*!< Provisioning Bearer */
  591. } esp_ble_mesh_unprov_dev_add_t;
  592. #define DEL_DEV_ADDR_FLAG BIT(0)
  593. #define DEL_DEV_UUID_FLAG BIT(1)
  594. /** Information of the device which is going to be deleted. */
  595. typedef struct {
  596. union {
  597. struct {
  598. esp_ble_mesh_bd_addr_t addr; /*!< Device address */
  599. esp_ble_mesh_addr_type_t addr_type; /*!< Device address type */
  600. };
  601. uint8_t uuid[16]; /*!< Device UUID */
  602. };
  603. uint8_t flag; /*!< BIT0: device address; BIT1: device UUID */
  604. } esp_ble_mesh_device_delete_t;
  605. #define PROV_DATA_NET_IDX_FLAG BIT(0)
  606. #define PROV_DATA_FLAGS_FLAG BIT(1)
  607. #define PROV_DATA_IV_INDEX_FLAG BIT(2)
  608. /** Information of the provisioner which is going to be updated. */
  609. typedef struct {
  610. union {
  611. uint16_t net_idx; /*!< NetKey Index */
  612. uint8_t flags; /*!< Flags */
  613. uint32_t iv_index; /*!< IV Index */
  614. };
  615. uint8_t flag; /*!< BIT0: net_idx; BIT1: flags; BIT2: iv_index */
  616. } esp_ble_mesh_prov_data_info_t;
  617. /** Information of the provisioned node */
  618. typedef struct {
  619. /* Device information */
  620. esp_ble_mesh_bd_addr_t addr; /*!< Node device address */
  621. esp_ble_mesh_addr_type_t addr_type; /*!< Node device address type */
  622. uint8_t dev_uuid[16]; /*!< Device UUID */
  623. uint16_t oob_info; /*!< Node OOB information */
  624. /* Provisioning information */
  625. uint16_t unicast_addr; /*!< Node unicast address */
  626. uint8_t element_num; /*!< Node element number */
  627. uint16_t net_idx; /*!< Node NetKey Index */
  628. uint8_t flags; /*!< Node key refresh flag and iv update flag */
  629. uint32_t iv_index; /*!< Node IV Index */
  630. uint8_t dev_key[16]; /*!< Node device key */
  631. /* Additional information */
  632. char name[ESP_BLE_MESH_NODE_NAME_MAX_LEN + 1]; /*!< Node name */
  633. uint16_t comp_length; /*!< Length of Composition Data */
  634. uint8_t *comp_data; /*!< Value of Composition Data */
  635. } __attribute__((packed)) esp_ble_mesh_node_t;
  636. /** Context of fast provisioning which need to be set. */
  637. typedef struct {
  638. uint16_t unicast_min; /*!< Minimum unicast address used for fast provisioning */
  639. uint16_t unicast_max; /*!< Maximum unicast address used for fast provisioning */
  640. uint16_t net_idx; /*!< Netkey index used for fast provisioning */
  641. uint8_t flags; /*!< Flags used for fast provisioning */
  642. uint32_t iv_index; /*!< IV Index used for fast provisioning */
  643. uint8_t offset; /*!< Offset of the UUID to be compared */
  644. uint8_t match_len; /*!< Length of the UUID to be compared */
  645. uint8_t match_val[16]; /*!< Value of UUID to be compared */
  646. } esp_ble_mesh_fast_prov_info_t;
  647. /*!< This enum value is the action of fast provisioning */
  648. typedef enum {
  649. FAST_PROV_ACT_NONE,
  650. FAST_PROV_ACT_ENTER,
  651. FAST_PROV_ACT_SUSPEND,
  652. FAST_PROV_ACT_EXIT,
  653. FAST_PROV_ACT_MAX,
  654. } esp_ble_mesh_fast_prov_action_t;
  655. /*!< This enum value is the type of proxy filter */
  656. typedef enum {
  657. PROXY_FILTER_WHITELIST,
  658. PROXY_FILTER_BLACKLIST,
  659. } esp_ble_mesh_proxy_filter_type_t;
  660. /*!< Provisioner heartbeat filter type */
  661. #define ESP_BLE_MESH_HEARTBEAT_FILTER_ACCEPTLIST 0x00
  662. #define ESP_BLE_MESH_HEARTBEAT_FILTER_REJECTLIST 0x01
  663. /*!< Provisioner heartbeat filter operation */
  664. #define ESP_BLE_MESH_HEARTBEAT_FILTER_ADD 0x00
  665. #define ESP_BLE_MESH_HEARTBEAT_FILTER_REMOVE 0x01
  666. /** Context of Provisioner heartbeat filter information to be set */
  667. typedef struct {
  668. uint16_t hb_src; /*!< Heartbeat source address (unicast address) */
  669. uint16_t hb_dst; /*!< Heartbeat destination address (unicast address or group address) */
  670. } esp_ble_mesh_heartbeat_filter_info_t;
  671. /*!< This enum value is the event of node/provisioner/fast provisioning */
  672. typedef enum {
  673. ESP_BLE_MESH_PROV_REGISTER_COMP_EVT, /*!< Initialize BLE Mesh provisioning capabilities and internal data information completion event */
  674. ESP_BLE_MESH_NODE_SET_UNPROV_DEV_NAME_COMP_EVT, /*!< Set the unprovisioned device name completion event */
  675. ESP_BLE_MESH_NODE_PROV_ENABLE_COMP_EVT, /*!< Enable node provisioning functionality completion event */
  676. ESP_BLE_MESH_NODE_PROV_DISABLE_COMP_EVT, /*!< Disable node provisioning functionality completion event */
  677. ESP_BLE_MESH_NODE_PROV_LINK_OPEN_EVT, /*!< Establish a BLE Mesh link event */
  678. ESP_BLE_MESH_NODE_PROV_LINK_CLOSE_EVT, /*!< Close a BLE Mesh link event */
  679. ESP_BLE_MESH_NODE_PROV_OOB_PUB_KEY_EVT, /*!< Generate Node input OOB public key event */
  680. ESP_BLE_MESH_NODE_PROV_OUTPUT_NUMBER_EVT, /*!< Generate Node Output Number event */
  681. ESP_BLE_MESH_NODE_PROV_OUTPUT_STRING_EVT, /*!< Generate Node Output String event */
  682. ESP_BLE_MESH_NODE_PROV_INPUT_EVT, /*!< Event requiring the user to input a number or string */
  683. ESP_BLE_MESH_NODE_PROV_COMPLETE_EVT, /*!< Provisioning done event */
  684. ESP_BLE_MESH_NODE_PROV_RESET_EVT, /*!< Provisioning reset event */
  685. ESP_BLE_MESH_NODE_PROV_SET_OOB_PUB_KEY_COMP_EVT, /*!< Node set oob public key completion event */
  686. ESP_BLE_MESH_NODE_PROV_INPUT_NUMBER_COMP_EVT, /*!< Node input number completion event */
  687. ESP_BLE_MESH_NODE_PROV_INPUT_STRING_COMP_EVT, /*!< Node input string completion event */
  688. ESP_BLE_MESH_NODE_PROXY_IDENTITY_ENABLE_COMP_EVT, /*!< Enable BLE Mesh Proxy Identity advertising completion event */
  689. ESP_BLE_MESH_NODE_PROXY_GATT_ENABLE_COMP_EVT, /*!< Enable BLE Mesh GATT Proxy Service completion event */
  690. ESP_BLE_MESH_NODE_PROXY_GATT_DISABLE_COMP_EVT, /*!< Disable BLE Mesh GATT Proxy Service completion event */
  691. ESP_BLE_MESH_NODE_ADD_LOCAL_NET_KEY_COMP_EVT, /*!< Node add NetKey locally completion event */
  692. ESP_BLE_MESH_NODE_ADD_LOCAL_APP_KEY_COMP_EVT, /*!< Node add AppKey locally completion event */
  693. ESP_BLE_MESH_NODE_BIND_APP_KEY_TO_MODEL_COMP_EVT, /*!< Node bind AppKey to model locally completion event */
  694. ESP_BLE_MESH_PROVISIONER_PROV_ENABLE_COMP_EVT, /*!< Provisioner enable provisioning functionality completion event */
  695. ESP_BLE_MESH_PROVISIONER_PROV_DISABLE_COMP_EVT, /*!< Provisioner disable provisioning functionality completion event */
  696. ESP_BLE_MESH_PROVISIONER_RECV_UNPROV_ADV_PKT_EVT, /*!< Provisioner receives unprovisioned device beacon event */
  697. ESP_BLE_MESH_PROVISIONER_PROV_READ_OOB_PUB_KEY_EVT, /*!< Provisioner read unprovisioned device OOB public key event */
  698. ESP_BLE_MESH_PROVISIONER_PROV_INPUT_EVT, /*!< Provisioner input value for provisioning procedure event */
  699. ESP_BLE_MESH_PROVISIONER_PROV_OUTPUT_EVT, /*!< Provisioner output value for provisioning procedure event */
  700. ESP_BLE_MESH_PROVISIONER_PROV_LINK_OPEN_EVT, /*!< Provisioner establish a BLE Mesh link event */
  701. ESP_BLE_MESH_PROVISIONER_PROV_LINK_CLOSE_EVT, /*!< Provisioner close a BLE Mesh link event */
  702. ESP_BLE_MESH_PROVISIONER_PROV_COMPLETE_EVT, /*!< Provisioner provisioning done event */
  703. ESP_BLE_MESH_PROVISIONER_ADD_UNPROV_DEV_COMP_EVT, /*!< Provisioner add a device to the list which contains devices that are waiting/going to be provisioned completion event */
  704. ESP_BLE_MESH_PROVISIONER_PROV_DEV_WITH_ADDR_COMP_EVT, /*!< Provisioner start to provision an unprovisioned device completion event */
  705. ESP_BLE_MESH_PROVISIONER_DELETE_DEV_COMP_EVT, /*!< Provisioner delete a device from the list, close provisioning link with the device completion event */
  706. ESP_BLE_MESH_PROVISIONER_SET_DEV_UUID_MATCH_COMP_EVT, /*!< Provisioner set the value to be compared with part of the unprovisioned device UUID completion event */
  707. ESP_BLE_MESH_PROVISIONER_SET_PROV_DATA_INFO_COMP_EVT, /*!< Provisioner set net_idx/flags/iv_index used for provisioning completion event */
  708. ESP_BLE_MESH_PROVISIONER_SET_STATIC_OOB_VALUE_COMP_EVT, /*!< Provisioner set static oob value used for provisioning completion event */
  709. ESP_BLE_MESH_PROVISIONER_SET_PRIMARY_ELEM_ADDR_COMP_EVT, /*!< Provisioner set unicast address of primary element completion event */
  710. ESP_BLE_MESH_PROVISIONER_PROV_READ_OOB_PUB_KEY_COMP_EVT, /*!< Provisioner read unprovisioned device OOB public key completion event */
  711. ESP_BLE_MESH_PROVISIONER_PROV_INPUT_NUMBER_COMP_EVT, /*!< Provisioner input number completion event */
  712. ESP_BLE_MESH_PROVISIONER_PROV_INPUT_STRING_COMP_EVT, /*!< Provisioner input string completion event */
  713. ESP_BLE_MESH_PROVISIONER_SET_NODE_NAME_COMP_EVT, /*!< Provisioner set node name completion event */
  714. ESP_BLE_MESH_PROVISIONER_ADD_LOCAL_APP_KEY_COMP_EVT, /*!< Provisioner add local app key completion event */
  715. ESP_BLE_MESH_PROVISIONER_UPDATE_LOCAL_APP_KEY_COMP_EVT, /*!< Provisioner update local app key completion event */
  716. ESP_BLE_MESH_PROVISIONER_BIND_APP_KEY_TO_MODEL_COMP_EVT, /*!< Provisioner bind local model with local app key completion event */
  717. ESP_BLE_MESH_PROVISIONER_ADD_LOCAL_NET_KEY_COMP_EVT, /*!< Provisioner add local network key completion event */
  718. ESP_BLE_MESH_PROVISIONER_UPDATE_LOCAL_NET_KEY_COMP_EVT, /*!< Provisioner update local network key completion event */
  719. ESP_BLE_MESH_PROVISIONER_STORE_NODE_COMP_DATA_COMP_EVT, /*!< Provisioner store node composition data completion event */
  720. ESP_BLE_MESH_PROVISIONER_DELETE_NODE_WITH_UUID_COMP_EVT, /*!< Provisioner delete node with uuid completion event */
  721. ESP_BLE_MESH_PROVISIONER_DELETE_NODE_WITH_ADDR_COMP_EVT, /*!< Provisioner delete node with unicast address completion event */
  722. ESP_BLE_MESH_PROVISIONER_ENABLE_HEARTBEAT_RECV_COMP_EVT, /*!< Provisioner start to receive heartbeat message completion event */
  723. ESP_BLE_MESH_PROVISIONER_SET_HEARTBEAT_FILTER_TYPE_COMP_EVT, /*!< Provisioner set the heartbeat filter type completion event */
  724. ESP_BLE_MESH_PROVISIONER_SET_HEARTBEAT_FILTER_INFO_COMP_EVT, /*!< Provisioner set the heartbeat filter information completion event */
  725. ESP_BLE_MESH_PROVISIONER_RECV_HEARTBEAT_MESSAGE_EVT, /*!< Provisioner receive heartbeat message event */
  726. ESP_BLE_MESH_PROVISIONER_DRIECT_ERASE_SETTINGS_COMP_EVT, /*!< Provisioner directly erase settings completion event */
  727. ESP_BLE_MESH_PROVISIONER_OPEN_SETTINGS_WITH_INDEX_COMP_EVT, /*!< Provisioner open settings with index completion event */
  728. ESP_BLE_MESH_PROVISIONER_OPEN_SETTINGS_WITH_UID_COMP_EVT, /*!< Provisioner open settings with user id completion event */
  729. ESP_BLE_MESH_PROVISIONER_CLOSE_SETTINGS_WITH_INDEX_COMP_EVT, /*!< Provisioner close settings with index completion event */
  730. ESP_BLE_MESH_PROVISIONER_CLOSE_SETTINGS_WITH_UID_COMP_EVT, /*!< Provisioner close settings with user id completion event */
  731. ESP_BLE_MESH_PROVISIONER_DELETE_SETTINGS_WITH_INDEX_COMP_EVT, /*!< Provisioner delete settings with index completion event */
  732. ESP_BLE_MESH_PROVISIONER_DELETE_SETTINGS_WITH_UID_COMP_EVT, /*!< Provisioner delete settings with user id completion event */
  733. ESP_BLE_MESH_SET_FAST_PROV_INFO_COMP_EVT, /*!< Set fast provisioning information (e.g. unicast address range, net_idx, etc.) completion event */
  734. ESP_BLE_MESH_SET_FAST_PROV_ACTION_COMP_EVT, /*!< Set fast provisioning action completion event */
  735. ESP_BLE_MESH_HEARTBEAT_MESSAGE_RECV_EVT, /*!< Receive Heartbeat message event */
  736. ESP_BLE_MESH_LPN_ENABLE_COMP_EVT, /*!< Enable Low Power Node completion event */
  737. ESP_BLE_MESH_LPN_DISABLE_COMP_EVT, /*!< Disable Low Power Node completion event */
  738. ESP_BLE_MESH_LPN_POLL_COMP_EVT, /*!< Low Power Node send Friend Poll completion event */
  739. ESP_BLE_MESH_LPN_FRIENDSHIP_ESTABLISH_EVT, /*!< Low Power Node establishes friendship event */
  740. ESP_BLE_MESH_LPN_FRIENDSHIP_TERMINATE_EVT, /*!< Low Power Node terminates friendship event */
  741. ESP_BLE_MESH_FRIEND_FRIENDSHIP_ESTABLISH_EVT, /*!< Friend Node establishes friendship event */
  742. ESP_BLE_MESH_FRIEND_FRIENDSHIP_TERMINATE_EVT, /*!< Friend Node terminates friendship event */
  743. ESP_BLE_MESH_PROXY_CLIENT_RECV_ADV_PKT_EVT, /*!< Proxy Client receives Network ID advertising packet event */
  744. ESP_BLE_MESH_PROXY_CLIENT_CONNECTED_EVT, /*!< Proxy Client establishes connection successfully event */
  745. ESP_BLE_MESH_PROXY_CLIENT_DISCONNECTED_EVT, /*!< Proxy Client terminates connection successfully event */
  746. ESP_BLE_MESH_PROXY_CLIENT_RECV_FILTER_STATUS_EVT, /*!< Proxy Client receives Proxy Filter Status event */
  747. ESP_BLE_MESH_PROXY_CLIENT_CONNECT_COMP_EVT, /*!< Proxy Client connect completion event */
  748. ESP_BLE_MESH_PROXY_CLIENT_DISCONNECT_COMP_EVT, /*!< Proxy Client disconnect completion event */
  749. ESP_BLE_MESH_PROXY_CLIENT_SET_FILTER_TYPE_COMP_EVT, /*!< Proxy Client set filter type completion event */
  750. ESP_BLE_MESH_PROXY_CLIENT_ADD_FILTER_ADDR_COMP_EVT, /*!< Proxy Client add filter address completion event */
  751. ESP_BLE_MESH_PROXY_CLIENT_REMOVE_FILTER_ADDR_COMP_EVT, /*!< Proxy Client remove filter address completion event */
  752. ESP_BLE_MESH_MODEL_SUBSCRIBE_GROUP_ADDR_COMP_EVT, /*!< Local model subscribes group address completion event */
  753. ESP_BLE_MESH_MODEL_UNSUBSCRIBE_GROUP_ADDR_COMP_EVT, /*!< Local model unsubscribes group address completion event */
  754. ESP_BLE_MESH_DEINIT_MESH_COMP_EVT, /*!< De-initialize BLE Mesh stack completion event */
  755. ESP_BLE_MESH_PROV_EVT_MAX,
  756. } esp_ble_mesh_prov_cb_event_t;
  757. /**
  758. * @brief BLE Mesh Node/Provisioner callback parameters union
  759. */
  760. typedef union {
  761. /**
  762. * @brief ESP_BLE_MESH_PROV_REGISTER_COMP_EVT
  763. */
  764. struct ble_mesh_prov_register_comp_param {
  765. int err_code; /*!< Indicate the result of BLE Mesh initialization */
  766. } prov_register_comp; /*!< Event parameter of ESP_BLE_MESH_PROV_REGISTER_COMP_EVT */
  767. /**
  768. * @brief ESP_BLE_MESH_NODE_SET_UNPROV_DEV_NAME_COMP_EVT
  769. */
  770. struct ble_mesh_set_unprov_dev_name_comp_param {
  771. int err_code; /*!< Indicate the result of setting BLE Mesh device name */
  772. } node_set_unprov_dev_name_comp; /*!< Event parameter of ESP_BLE_MESH_NODE_SET_UNPROV_DEV_NAME_COMP_EVT */
  773. /**
  774. * @brief ESP_BLE_MESH_NODE_PROV_ENABLE_COMP_EVT
  775. */
  776. struct ble_mesh_prov_enable_comp_param {
  777. int err_code; /*!< Indicate the result of enabling BLE Mesh device */
  778. } node_prov_enable_comp; /*!< Event parameter of ESP_BLE_MESH_NODE_PROV_ENABLE_COMP_EVT */
  779. /**
  780. * @brief ESP_BLE_MESH_NODE_PROV_DISABLE_COMP_EVT
  781. */
  782. struct ble_mesh_prov_disable_comp_param {
  783. int err_code; /*!< Indicate the result of disabling BLE Mesh device */
  784. } node_prov_disable_comp; /*!< Event parameter of ESP_BLE_MESH_NODE_PROV_DISABLE_COMP_EVT */
  785. /**
  786. * @brief ESP_BLE_MESH_NODE_PROV_LINK_OPEN_EVT
  787. */
  788. struct ble_mesh_link_open_evt_param {
  789. esp_ble_mesh_prov_bearer_t bearer; /*!< Type of the bearer used when device link is open */
  790. } node_prov_link_open; /*!< Event parameter of ESP_BLE_MESH_NODE_PROV_LINK_OPEN_EVT */
  791. /**
  792. * @brief ESP_BLE_MESH_NODE_PROV_LINK_CLOSE_EVT
  793. */
  794. struct ble_mesh_link_close_evt_param {
  795. esp_ble_mesh_prov_bearer_t bearer; /*!< Type of the bearer used when device link is closed */
  796. } node_prov_link_close; /*!< Event parameter of ESP_BLE_MESH_NODE_PROV_LINK_CLOSE_EVT */
  797. /**
  798. * @brief ESP_BLE_MESH_NODE_PROV_OUTPUT_NUMBER_EVT
  799. */
  800. struct ble_mesh_output_num_evt_param {
  801. esp_ble_mesh_output_action_t action; /*!< Action of Output OOB Authentication */
  802. uint32_t number; /*!< Number of Output OOB Authentication */
  803. } node_prov_output_num; /*!< Event parameter of ESP_BLE_MESH_NODE_PROV_OUTPUT_NUMBER_EVT */
  804. /**
  805. * @brief ESP_BLE_MESH_NODE_PROV_OUTPUT_STRING_EVT
  806. */
  807. struct ble_mesh_output_str_evt_param {
  808. char string[8]; /*!< String of Output OOB Authentication */
  809. } node_prov_output_str; /*!< Event parameter of ESP_BLE_MESH_NODE_PROV_OUTPUT_STRING_EVT */
  810. /**
  811. * @brief ESP_BLE_MESH_NODE_PROV_INPUT_EVT
  812. */
  813. struct ble_mesh_input_evt_param {
  814. esp_ble_mesh_input_action_t action; /*!< Action of Input OOB Authentication */
  815. uint8_t size; /*!< Size of Input OOB Authentication */
  816. } node_prov_input; /*!< Event parameter of ESP_BLE_MESH_NODE_PROV_INPUT_EVT */
  817. /**
  818. * @brief ESP_BLE_MESH_NODE_PROV_COMPLETE_EVT
  819. */
  820. struct ble_mesh_provision_complete_evt_param {
  821. uint16_t net_idx; /*!< NetKey Index */
  822. uint8_t net_key[16]; /*!< NetKey */
  823. uint16_t addr; /*!< Primary address */
  824. uint8_t flags; /*!< Flags */
  825. uint32_t iv_index; /*!< IV Index */
  826. } node_prov_complete; /*!< Event parameter of ESP_BLE_MESH_NODE_PROV_COMPLETE_EVT */
  827. /**
  828. * @brief ESP_BLE_MESH_NODE_PROV_RESET_EVT
  829. */
  830. struct ble_mesh_provision_reset_param {
  831. } node_prov_reset; /*!< Event parameter of ESP_BLE_MESH_NODE_PROV_RESET_EVT */
  832. /**
  833. * @brief ESP_BLE_MESH_NODE_PROV_SET_OOB_PUB_KEY_COMP_EVT
  834. */
  835. struct ble_mesh_set_oob_pub_key_comp_param {
  836. int err_code; /*!< Indicate the result of setting OOB Public Key */
  837. } node_prov_set_oob_pub_key_comp; /*!< Event parameter of ESP_BLE_MESH_NODE_PROV_SET_OOB_PUB_KEY_COMP_EVT */
  838. /**
  839. * @brief ESP_BLE_MESH_NODE_PROV_INPUT_NUM_COMP_EVT
  840. */
  841. struct ble_mesh_input_number_comp_param {
  842. int err_code; /*!< Indicate the result of inputting number */
  843. } node_prov_input_num_comp; /*!< Event parameter of ESP_BLE_MESH_NODE_PROV_INPUT_NUM_COMP_EVT */
  844. /**
  845. * @brief ESP_BLE_MESH_NODE_PROV_INPUT_STR_COMP_EVT
  846. */
  847. struct ble_mesh_input_string_comp_param {
  848. int err_code; /*!< Indicate the result of inputting string */
  849. } node_prov_input_str_comp; /*!< Event parameter of ESP_BLE_MESH_NODE_PROV_INPUT_STR_COMP_EVT */
  850. /**
  851. * @brief ESP_BLE_MESH_NODE_PROXY_IDENTITY_ENABLE_COMP_EVT
  852. */
  853. struct ble_mesh_proxy_identity_enable_comp_param {
  854. int err_code; /*!< Indicate the result of enabling Mesh Proxy advertising */
  855. } node_proxy_identity_enable_comp; /*!< Event parameter of ESP_BLE_MESH_NODE_PROXY_IDENTITY_ENABLE_COMP_EVT */
  856. /**
  857. * @brief ESP_BLE_MESH_NODE_PROXY_GATT_ENABLE_COMP_EVT
  858. */
  859. struct ble_mesh_proxy_gatt_enable_comp_param {
  860. int err_code; /*!< Indicate the result of enabling Mesh Proxy Service */
  861. } node_proxy_gatt_enable_comp; /*!< Event parameter of ESP_BLE_MESH_NODE_PROXY_GATT_ENABLE_COMP_EVT */
  862. /**
  863. * @brief ESP_BLE_MESH_NODE_PROXY_GATT_DISABLE_COMP_EVT
  864. */
  865. struct ble_mesh_proxy_gatt_disable_comp_param {
  866. int err_code; /*!< Indicate the result of disabling Mesh Proxy Service */
  867. } node_proxy_gatt_disable_comp; /*!< Event parameter of ESP_BLE_MESH_NODE_PROXY_GATT_DISABLE_COMP_EVT */
  868. /**
  869. * @brief ESP_BLE_MESH_NODE_ADD_LOCAL_NET_KEY_COMP_EVT
  870. */
  871. struct ble_mesh_node_add_local_net_key_comp_param {
  872. int err_code; /*!< Indicate the result of adding local NetKey by the node */
  873. uint16_t net_idx; /*!< NetKey Index */
  874. } node_add_net_key_comp; /*!< Event parameter of ESP_BLE_MESH_NODE_ADD_LOCAL_NET_KEY_COMP_EVT */
  875. /**
  876. * @brief ESP_BLE_MESH_NODE_ADD_LOCAL_APP_KEY_COMP_EVT
  877. */
  878. struct ble_mesh_node_add_local_app_key_comp_param {
  879. int err_code; /*!< Indicate the result of adding local AppKey by the node */
  880. uint16_t net_idx; /*!< NetKey Index */
  881. uint16_t app_idx; /*!< AppKey Index */
  882. } node_add_app_key_comp; /*!< Event parameter of ESP_BLE_MESH_NODE_ADD_LOCAL_APP_KEY_COMP_EVT */
  883. /**
  884. * @brief ESP_BLE_MESH_NODE_BIND_APP_KEY_TO_MODEL_COMP_EVT
  885. */
  886. struct ble_mesh_node_bind_local_mod_app_comp_param {
  887. int err_code; /*!< Indicate the result of binding AppKey with model by the node */
  888. uint16_t element_addr; /*!< Element address */
  889. uint16_t app_idx; /*!< AppKey Index */
  890. uint16_t company_id; /*!< Company ID */
  891. uint16_t model_id; /*!< Model ID */
  892. } node_bind_app_key_to_model_comp; /*!< Event parameter of ESP_BLE_MESH_NODE_BIND_APP_KEY_TO_MODEL_COMP_EVT */
  893. /**
  894. * @brief ESP_BLE_MESH_PROVISIONER_RECV_UNPROV_ADV_PKT_EVT
  895. */
  896. struct ble_mesh_provisioner_recv_unprov_adv_pkt_param {
  897. uint8_t dev_uuid[16]; /*!< Device UUID of the unprovisioned device */
  898. esp_ble_mesh_bd_addr_t addr; /*!< Device address of the unprovisioned device */
  899. esp_ble_mesh_addr_type_t addr_type; /*!< Device address type */
  900. uint16_t oob_info; /*!< OOB Info of the unprovisioned device */
  901. uint8_t adv_type; /*!< Avertising type of the unprovisioned device */
  902. esp_ble_mesh_prov_bearer_t bearer; /*!< Bearer of the unprovisioned device */
  903. int8_t rssi; /*!< RSSI of the received advertising packet */
  904. } provisioner_recv_unprov_adv_pkt; /*!< Event parameter of ESP_BLE_MESH_PROVISIONER_RECV_UNPROV_ADV_PKT_EVT */
  905. /**
  906. * @brief ESP_BLE_MESH_PROVISIONER_PROV_ENABLE_COMP_EVT
  907. */
  908. struct ble_mesh_provisioner_prov_enable_comp_param {
  909. int err_code; /*!< Indicate the result of enabling BLE Mesh Provisioner */
  910. } provisioner_prov_enable_comp; /*!< Event parameter of ESP_BLE_MESH_PROVISIONER_PROV_ENABLE_COMP_EVT */
  911. /**
  912. * @brief ESP_BLE_MESH_PROVISIONER_PROV_DISABLE_COMP_EVT
  913. */
  914. struct ble_mesh_provisioner_prov_disable_comp_param {
  915. int err_code; /*!< Indicate the result of disabling BLE Mesh Provisioner */
  916. } provisioner_prov_disable_comp; /*!< Event parameter of ESP_BLE_MESH_PROVISIONER_PROV_DISABLE_COMP_EVT */
  917. /**
  918. * @brief ESP_BLE_MESH_PROVISIONER_PROV_LINK_OPEN_EVT
  919. */
  920. struct ble_mesh_provisioner_link_open_evt_param {
  921. esp_ble_mesh_prov_bearer_t bearer; /*!< Type of the bearer used when Provisioner link is opened */
  922. } provisioner_prov_link_open; /*!< Event parameter of ESP_BLE_MESH_PROVISIONER_PROV_LINK_OPEN_EVT */
  923. /**
  924. * @brief ESP_BLE_MESH_PROVISIONER_PROV_READ_OOB_PUB_KEY_EVT
  925. */
  926. struct ble_mesh_provisioner_prov_read_oob_pub_key_evt_param {
  927. uint8_t link_idx; /*!< Index of the provisioning link */
  928. } provisioner_prov_read_oob_pub_key; /*!< Event parameter of ESP_BLE_MESH_PROVISIONER_PROV_READ_OOB_PUB_KEY_EVT */
  929. /**
  930. * @brief ESP_BLE_MESH_PROVISIONER_PROV_INPUT_EVT
  931. */
  932. struct ble_mesh_provisioner_prov_input_evt_param {
  933. esp_ble_mesh_oob_method_t method; /*!< Method of device Output OOB Authentication */
  934. esp_ble_mesh_output_action_t action; /*!< Action of device Output OOB Authentication */
  935. uint8_t size; /*!< Size of device Output OOB Authentication */
  936. uint8_t link_idx; /*!< Index of the provisioning link */
  937. } provisioner_prov_input; /*!< Event parameter of ESP_BLE_MESH_PROVISIONER_PROV_INPUT_EVT */
  938. /**
  939. * @brief ESP_BLE_MESH_PROVISIONER_PROV_OUTPUT_EVT
  940. */
  941. struct ble_mesh_provisioner_prov_output_evt_param {
  942. esp_ble_mesh_oob_method_t method; /*!< Method of device Input OOB Authentication */
  943. esp_ble_mesh_input_action_t action; /*!< Action of device Input OOB Authentication */
  944. uint8_t size; /*!< Size of device Input OOB Authentication */
  945. uint8_t link_idx; /*!< Index of the provisioning link */
  946. union {
  947. char string[8]; /*!< String output by the Provisioner */
  948. uint32_t number; /*!< Number output by the Provisioner */
  949. };
  950. } provisioner_prov_output; /*!< Event parameter of ESP_BLE_MESH_PROVISIONER_PROV_OUTPUT_EVT */
  951. /**
  952. * @brief ESP_BLE_MESH_PROVISIONER_PROV_LINK_CLOSE_EVT
  953. */
  954. struct ble_mesh_provisioner_link_close_evt_param {
  955. esp_ble_mesh_prov_bearer_t bearer; /*!< Type of the bearer used when Provisioner link is closed */
  956. uint8_t reason; /*!< Reason of the closed provisioning link */
  957. } provisioner_prov_link_close; /*!< Event parameter of ESP_BLE_MESH_PROVISIONER_PROV_LINK_CLOSE_EVT */
  958. /**
  959. * @brief ESP_BLE_MESH_PROVISIONER_PROV_COMPLETE_EVT
  960. */
  961. struct ble_mesh_provisioner_prov_comp_param {
  962. uint16_t node_idx; /*!< Index of the provisioned device */
  963. esp_ble_mesh_octet16_t device_uuid; /*!< Device UUID of the provisioned device */
  964. uint16_t unicast_addr; /*!< Primary address of the provisioned device */
  965. uint8_t element_num; /*!< Element count of the provisioned device */
  966. uint16_t netkey_idx; /*!< NetKey Index of the provisioned device */
  967. } provisioner_prov_complete; /*!< Event parameter of ESP_BLE_MESH_PROVISIONER_PROV_COMPLETE_EVT */
  968. /**
  969. * @brief ESP_BLE_MESH_PROVISIONER_ADD_UNPROV_DEV_COMP_EVT
  970. */
  971. struct ble_mesh_provisioner_add_unprov_dev_comp_param {
  972. int err_code; /*!< Indicate the result of adding device into queue by the Provisioner */
  973. } provisioner_add_unprov_dev_comp; /*!< Event parameter of ESP_BLE_MESH_PROVISIONER_ADD_UNPROV_DEV_COMP_EVT */
  974. /**
  975. * @brief ESP_BLE_MESH_PROVISIONER_PROV_DEV_WITH_ADDR_COMP_EVT
  976. */
  977. struct ble_mesh_provisioner_prov_dev_with_addr_comp_param {
  978. int err_code; /*!< Indicate the result of Provisioner starting to provision a device */
  979. } provisioner_prov_dev_with_addr_comp; /*!< Event parameter of ESP_BLE_MESH_PROVISIONER_PROV_DEV_WITH_ADDR_COMP_EVT */
  980. /**
  981. * @brief ESP_BLE_MESH_PROVISIONER_DELETE_DEV_COMP_EVT
  982. */
  983. struct ble_mesh_provisioner_delete_dev_comp_param {
  984. int err_code; /*!< Indicate the result of deleting device by the Provisioner */
  985. } provisioner_delete_dev_comp; /*!< Event parameter of ESP_BLE_MESH_PROVISIONER_DELETE_DEV_COMP_EVT */
  986. /**
  987. * @brief ESP_BLE_MESH_PROVISIONER_SET_DEV_UUID_MATCH_COMP_EVT
  988. */
  989. struct ble_mesh_provisioner_set_dev_uuid_match_comp_param {
  990. int err_code; /*!< Indicate the result of setting Device UUID match value by the Provisioner */
  991. } provisioner_set_dev_uuid_match_comp; /*!< Event parameter of ESP_BLE_MESH_PROVISIONER_SET_DEV_UUID_MATCH_COMP_EVT */
  992. /**
  993. * @brief ESP_BLE_MESH_PROVISIONER_SET_PROV_DATA_INFO_COMP_EVT
  994. */
  995. struct ble_mesh_provisioner_set_prov_data_info_comp_param {
  996. int err_code; /*!< Indicate the result of setting provisioning info by the Provisioner */
  997. } provisioner_set_prov_data_info_comp; /*!< Event parameter of ESP_BLE_MESH_PROVISIONER_SET_PROV_DATA_INFO_COMP_EVT */
  998. /**
  999. * @brief ESP_BLE_MESH_PROVISIONER_SET_STATIC_OOB_VALUE_COMP_EVT
  1000. */
  1001. struct ble_mesh_provisioner_set_static_oob_val_comp_param {
  1002. int err_code; /*!< Indicate the result of setting static oob value by the Provisioner */
  1003. } provisioner_set_static_oob_val_comp; /*!< Event parameter of ESP_BLE_MESH_PROVISIONER_SET_STATIC_OOB_VALUE_COMP_EVT */
  1004. /**
  1005. * @brief ESP_BLE_MESH_PROVISIONER_SET_PRIMARY_ELEM_ADDR_COMP_EVT
  1006. */
  1007. struct ble_mesh_provisioner_set_primary_elem_addr_comp_param {
  1008. int err_code; /*!< Indicate the result of setting unicast address of primary element by the Provisioner */
  1009. } provisioner_set_primary_elem_addr_comp; /*!< Event parameter of ESP_BLE_MESH_PROVISIONER_SET_PRIMARY_ELEM_ADDR_COMP_EVT */
  1010. /**
  1011. * @brief ESP_BLE_MESH_PROVISIONER_PROV_READ_OOB_PUB_KEY_COMP_EVT
  1012. */
  1013. struct ble_mesh_provisioner_prov_read_oob_pub_key_comp_param {
  1014. int err_code; /*!< Indicate the result of setting OOB Public Key by the Provisioner */
  1015. } provisioner_prov_read_oob_pub_key_comp; /*!< Event parameter of ESP_BLE_MESH_PROVISIONER_PROV_READ_OOB_PUB_KEY_COMP_EVT */
  1016. /**
  1017. * @brief ESP_BLE_MESH_PROVISIONER_PROV_INPUT_NUMBER_COMP_EVT
  1018. */
  1019. struct ble_mesh_provisioner_prov_input_num_comp_param {
  1020. int err_code; /*!< Indicate the result of inputting number by the Provisioner */
  1021. } provisioner_prov_input_num_comp; /*!< Event parameter of ESP_BLE_MESH_PROVISIONER_PROV_INPUT_NUMBER_COMP_EVT */
  1022. /**
  1023. * @brief ESP_BLE_MESH_PROVISIONER_PROV_INPUT_STRING_COMP_EVT
  1024. */
  1025. struct ble_mesh_provisioner_prov_input_str_comp_param {
  1026. int err_code; /*!< Indicate the result of inputting string by the Provisioner */
  1027. } provisioner_prov_input_str_comp; /*!< Event parameter of ESP_BLE_MESH_PROVISIONER_PROV_INPUT_STRING_COMP_EVT */
  1028. /**
  1029. * @brief ESP_BLE_MESH_PROVISIONER_SET_NODE_NAME_COMP_EVT
  1030. */
  1031. struct ble_mesh_provisioner_set_node_name_comp_param {
  1032. int err_code; /*!< Indicate the result of setting provisioned device name by the Provisioner */
  1033. uint16_t node_index; /*!< Index of the provisioned device */
  1034. } provisioner_set_node_name_comp; /*!< Event parameter of ESP_BLE_MESH_PROVISIONER_SET_NODE_NAME_COMP_EVT */
  1035. /**
  1036. * @brief ESP_BLE_MESH_PROVISIONER_ADD_LOCAL_APP_KEY_COMP_EVT
  1037. */
  1038. struct ble_mesh_provisioner_add_local_app_key_comp_param {
  1039. int err_code; /*!< Indicate the result of adding local AppKey by the Provisioner */
  1040. uint16_t net_idx; /*!< NetKey Index */
  1041. uint16_t app_idx; /*!< AppKey Index */
  1042. } provisioner_add_app_key_comp; /*!< Event parameter of ESP_BLE_MESH_PROVISIONER_ADD_LOCAL_APP_KEY_COMP_EVT */
  1043. /**
  1044. * @brief ESP_BLE_MESH_PROVISIONER_UPDATE_LOCAL_APP_KEY_COMP_EVT
  1045. */
  1046. struct ble_mesh_provisioner_update_local_app_key_comp_param {
  1047. int err_code; /*!< Indicate the result of updating local AppKey by the Provisioner */
  1048. uint16_t net_idx; /*!< NetKey Index */
  1049. uint16_t app_idx; /*!< AppKey Index */
  1050. } provisioner_update_app_key_comp; /*!< Event parameter of ESP_BLE_MESH_PROVISIONER_UPDATE_LOCAL_APP_KEY_COMP_EVT */
  1051. /**
  1052. * @brief ESP_BLE_MESH_PROVISIONER_BIND_APP_KEY_TO_MODEL_COMP_EVT
  1053. */
  1054. struct ble_mesh_provisioner_bind_local_mod_app_comp_param {
  1055. int err_code; /*!< Indicate the result of binding AppKey with model by the Provisioner */
  1056. uint16_t element_addr; /*!< Element address */
  1057. uint16_t app_idx; /*!< AppKey Index */
  1058. uint16_t company_id; /*!< Company ID */
  1059. uint16_t model_id; /*!< Model ID */
  1060. } provisioner_bind_app_key_to_model_comp; /*!< Event parameter of ESP_BLE_MESH_PROVISIONER_BIND_APP_KEY_TO_MODEL_COMP_EVT */
  1061. /**
  1062. * @brief ESP_BLE_MESH_PROVISIONER_ADD_LOCAL_NET_KEY_COMP_EVT
  1063. */
  1064. struct ble_mesh_provisioner_add_local_net_key_comp_param {
  1065. int err_code; /*!< Indicate the result of adding local NetKey by the Provisioner */
  1066. uint16_t net_idx; /*!< NetKey Index */
  1067. } provisioner_add_net_key_comp; /*!< Event parameter of ESP_BLE_MESH_PROVISIONER_ADD_LOCAL_NET_KEY_COMP_EVT */
  1068. /**
  1069. * @brief ESP_BLE_MESH_PROVISIONER_UPDATE_LOCAL_NET_KEY_COMP_EVT
  1070. */
  1071. struct ble_mesh_provisioner_update_local_net_key_comp_param {
  1072. int err_code; /*!< Indicate the result of updating local NetKey by the Provisioner */
  1073. uint16_t net_idx; /*!< NetKey Index */
  1074. } provisioner_update_net_key_comp; /*!< Event parameter of ESP_BLE_MESH_PROVISIONER_UPDATE_LOCAL_NET_KEY_COMP_EVT */
  1075. /**
  1076. * @brief ESP_BLE_MESH_PROVISIONER_STORE_NODE_COMP_DATA_COMP_EVT
  1077. */
  1078. struct ble_mesh_provisioner_store_node_comp_data_comp_param {
  1079. int err_code; /*!< Indicate the result of storing node composition data by the Provisioner */
  1080. uint16_t addr; /*!< Node element address */
  1081. } provisioner_store_node_comp_data_comp; /*!< Event parameter of ESP_BLE_MESH_PROVISIONER_STORE_NODE_COMP_DATA_COMP_EVT */
  1082. /**
  1083. * @brief ESP_BLE_MESH_PROVISIONER_DELETE_NODE_WITH_UUID_COMP_EVT
  1084. */
  1085. struct ble_mesh_provisioner_delete_node_with_uuid_comp_param {
  1086. int err_code; /*!< Indicate the result of deleting node with uuid by the Provisioner */
  1087. uint8_t uuid[16]; /*!< Node device uuid */
  1088. } provisioner_delete_node_with_uuid_comp; /*!< Event parameter of ESP_BLE_MESH_PROVISIONER_DELETE_NODE_WITH_UUID_COMP_EVT */
  1089. /**
  1090. * @brief ESP_BLE_MESH_PROVISIONER_DELETE_NODE_WITH_ADDR_COMP_EVT
  1091. */
  1092. struct ble_mesh_provisioner_delete_node_with_addr_comp_param {
  1093. int err_code; /*!< Indicate the result of deleting node with unicast address by the Provisioner */
  1094. uint16_t unicast_addr; /*!< Node unicast address */
  1095. } provisioner_delete_node_with_addr_comp; /*!< Event parameter of ESP_BLE_MESH_PROVISIONER_DELETE_NODE_WITH_ADDR_COMP_EVT */
  1096. /**
  1097. * @brief ESP_BLE_MESH_PROVISIONER_ENABLE_HEARTBEAT_RECV_COMP_EVT
  1098. */
  1099. struct {
  1100. int err_code; /*!< Indicate the result of enabling/disabling to receive heartbeat messages by the Provisioner */
  1101. bool enable; /*!< Indicate enabling or disabling receiving heartbeat messages */
  1102. } provisioner_enable_heartbeat_recv_comp; /*!< Event parameters of ESP_BLE_MESH_PROVISIONER_ENABLE_HEARTBEAT_RECV_COMP_EVT */
  1103. /**
  1104. * @brief ESP_BLE_MESH_PROVISIONER_SET_HEARTBEAT_FILTER_TYPE_COMP_EVT
  1105. */
  1106. struct {
  1107. int err_code; /*!< Indicate the result of setting the heartbeat filter type by the Provisioner */
  1108. uint8_t type; /*!< Type of the filter used for receiving heartbeat messages */
  1109. } provisioner_set_heartbeat_filter_type_comp; /*!< Event parameters of ESP_BLE_MESH_PROVISIONER_SET_HEARTBEAT_FILTER_TYPE_COMP_EVT */
  1110. /**
  1111. * @brief ESP_BLE_MESH_PROVISIONER_SET_HEARTBEAT_FILTER_INFO_COMP_EVT
  1112. */
  1113. struct {
  1114. int err_code; /*!< Indicate the result of setting the heartbeat filter address by the Provisioner */
  1115. uint8_t op; /*!< Operation (add, remove, clean) */
  1116. uint16_t hb_src; /*!< Heartbeat source address */
  1117. uint16_t hb_dst; /*!< Heartbeat destination address */
  1118. } provisioner_set_heartbeat_filter_info_comp; /*!< Event parameters of ESP_BLE_MESH_PROVISIONER_SET_HEARTBEAT_FILTER_INFO_COMP_EVT */
  1119. /**
  1120. * @brief ESP_BLE_MESH_PROVISIONER_RECV_HEARTBEAT_MESSAGE_EVT
  1121. */
  1122. struct {
  1123. uint16_t hb_src; /*!< Heartbeat source address */
  1124. uint16_t hb_dst; /*!< Heartbeat destination address */
  1125. uint8_t init_ttl; /*!< Heartbeat InitTTL */
  1126. uint8_t rx_ttl; /*!< Heartbeat RxTTL */
  1127. uint8_t hops; /*!< Heartbeat hops (InitTTL - RxTTL + 1) */
  1128. uint16_t feature; /*!< Bit field of currently active features of the node */
  1129. int8_t rssi; /*!< RSSI of the heartbeat message */
  1130. } provisioner_recv_heartbeat; /*!< Event parameters of ESP_BLE_MESH_PROVISIONER_RECV_HEARTBEAT_MESSAGE_EVT */
  1131. /**
  1132. * @brief ESP_BLE_MESH_PROVISIONER_DRIECT_ERASE_SETTINGS_COMP_EVT
  1133. */
  1134. struct {
  1135. int err_code; /*!< Indicate the result of directly erasing settings by the Provisioner */
  1136. } provisioner_direct_erase_settings_comp; /*!< Event parameters of ESP_BLE_MESH_PROVISIONER_DRIECT_ERASE_SETTINGS_COMP_EVT */
  1137. /**
  1138. * @brief ESP_BLE_MESH_PROVISIONER_OPEN_SETTINGS_WITH_INDEX_COMP_EVT
  1139. */
  1140. struct {
  1141. int err_code; /*!< Indicate the result of opening settings with index by the Provisioner */
  1142. uint8_t index; /*!< Index of Provisioner settings */
  1143. } provisioner_open_settings_with_index_comp; /*!< Event parameter of ESP_BLE_MESH_PROVISIONER_OPEN_SETTINGS_WITH_INDEX_COMP_EVT */
  1144. /**
  1145. * @brief ESP_BLE_MESH_PROVISIONER_OPEN_SETTINGS_WITH_UID_COMP_EVT
  1146. */
  1147. struct {
  1148. int err_code; /*!< Indicate the result of opening settings with user id by the Provisioner */
  1149. uint8_t index; /*!< Index of Provisioner settings */
  1150. char uid[ESP_BLE_MESH_SETTINGS_UID_SIZE + 1]; /*!< Provisioner settings user id */
  1151. } provisioner_open_settings_with_uid_comp; /*!< Event parameters of ESP_BLE_MESH_PROVISIONER_OPEN_SETTINGS_WITH_UID_COMP_EVT */
  1152. /**
  1153. * @brief ESP_BLE_MESH_PROVISIONER_CLOSE_SETTINGS_WITH_INDEX_COMP_EVT
  1154. */
  1155. struct {
  1156. int err_code; /*!< Indicate the result of closing settings with index by the Provisioner */
  1157. uint8_t index; /*!< Index of Provisioner settings */
  1158. } provisioner_close_settings_with_index_comp; /*!< Event parameter of ESP_BLE_MESH_PROVISIONER_CLOSE_SETTINGS_WITH_INDEX_COMP_EVT */
  1159. /**
  1160. * @brief ESP_BLE_MESH_PROVISIONER_CLOSE_SETTINGS_WITH_UID_COMP_EVT
  1161. */
  1162. struct {
  1163. int err_code; /*!< Indicate the result of closing settings with user id by the Provisioner */
  1164. uint8_t index; /*!< Index of Provisioner settings */
  1165. char uid[ESP_BLE_MESH_SETTINGS_UID_SIZE + 1]; /*!< Provisioner settings user id */
  1166. } provisioner_close_settings_with_uid_comp; /*!< Event parameters of ESP_BLE_MESH_PROVISIONER_CLOSE_SETTINGS_WITH_UID_COMP_EVT */
  1167. /**
  1168. * @brief ESP_BLE_MESH_PROVISIONER_DELETE_SETTINGS_WITH_INDEX_COMP_EVT
  1169. */
  1170. struct {
  1171. int err_code; /*!< Indicate the result of deleting settings with index by the Provisioner */
  1172. uint8_t index; /*!< Index of Provisioner settings */
  1173. } provisioner_delete_settings_with_index_comp; /*!< Event parameter of ESP_BLE_MESH_PROVISIONER_DELETE_SETTINGS_WITH_INDEX_COMP_EVT */
  1174. /**
  1175. * @brief ESP_BLE_MESH_PROVISIONER_DELETE_SETTINGS_WITH_UID_COMP_EVT
  1176. */
  1177. struct {
  1178. int err_code; /*!< Indicate the result of deleting settings with user id by the Provisioner */
  1179. uint8_t index; /*!< Index of Provisioner settings */
  1180. char uid[ESP_BLE_MESH_SETTINGS_UID_SIZE + 1]; /*!< Provisioner settings user id */
  1181. } provisioner_delete_settings_with_uid_comp; /*!< Event parameters of ESP_BLE_MESH_PROVISIONER_DELETE_SETTINGS_WITH_UID_COMP_EVT */
  1182. /**
  1183. * @brief ESP_BLE_MESH_SET_FAST_PROV_INFO_COMP_EVT
  1184. */
  1185. struct ble_mesh_set_fast_prov_info_comp_param {
  1186. uint8_t status_unicast; /*!< Indicate the result of setting unicast address range of fast provisioning */
  1187. uint8_t status_net_idx; /*!< Indicate the result of setting NetKey Index of fast provisioning */
  1188. uint8_t status_match; /*!< Indicate the result of setting matching Device UUID of fast provisioning */
  1189. } set_fast_prov_info_comp; /*!< Event parameter of ESP_BLE_MESH_SET_FAST_PROV_INFO_COMP_EVT */
  1190. /**
  1191. * @brief ESP_BLE_MESH_SET_FAST_PROV_ACTION_COMP_EVT
  1192. */
  1193. struct ble_mesh_set_fast_prov_action_comp_param {
  1194. uint8_t status_action; /*!< Indicate the result of setting action of fast provisioning */
  1195. } set_fast_prov_action_comp; /*!< Event parameter of ESP_BLE_MESH_SET_FAST_PROV_ACTION_COMP_EVT */
  1196. /**
  1197. * @brief ESP_BLE_MESH_HEARTBEAT_MESSAGE_RECV_EVT
  1198. */
  1199. struct ble_mesh_heartbeat_msg_recv_param {
  1200. uint8_t hops; /*!< Heartbeat hops (InitTTL - RxTTL + 1) */
  1201. uint16_t feature; /*!< Bit field of currently active features of the node */
  1202. } heartbeat_msg_recv; /*!< Event parameter of ESP_BLE_MESH_HEARTBEAT_MESSAGE_RECV_EVT */
  1203. /**
  1204. * @brief ESP_BLE_MESH_LPN_ENABLE_COMP_EVT
  1205. */
  1206. struct ble_mesh_lpn_enable_comp_param {
  1207. int err_code; /*!< Indicate the result of enabling LPN functionality */
  1208. } lpn_enable_comp; /*!< Event parameter of ESP_BLE_MESH_LPN_ENABLE_COMP_EVT */
  1209. /**
  1210. * @brief ESP_BLE_MESH_LPN_DISABLE_COMP_EVT
  1211. */
  1212. struct ble_mesh_lpn_disable_comp_param {
  1213. int err_code; /*!< Indicate the result of disabling LPN functionality */
  1214. } lpn_disable_comp; /*!< Event parameter of ESP_BLE_MESH_LPN_DISABLE_COMP_EVT */
  1215. /**
  1216. * @brief ESP_BLE_MESH_LPN_POLL_COMP_EVT
  1217. */
  1218. struct ble_mesh_lpn_poll_comp_param {
  1219. int err_code; /*!< Indicate the result of sending Friend Poll */
  1220. } lpn_poll_comp; /*!< Event parameter of ESP_BLE_MESH_LPN_POLL_COMP_EVT */
  1221. /**
  1222. * @brief ESP_BLE_MESH_LPN_FRIENDSHIP_ESTABLISH_EVT
  1223. */
  1224. struct ble_mesh_lpn_friendship_establish_param {
  1225. uint16_t friend_addr; /*!< Friend Node unicast address */
  1226. } lpn_friendship_establish; /*!< Event parameter of ESP_BLE_MESH_LPN_FRIENDSHIP_ESTABLISH_EVT */
  1227. /**
  1228. * @brief ESP_BLE_MESH_LPN_FRIENDSHIP_TERMINATE_EVT
  1229. */
  1230. struct ble_mesh_lpn_friendship_terminate_param {
  1231. uint16_t friend_addr; /*!< Friend Node unicast address */
  1232. } lpn_friendship_terminate; /*!< Event parameter of ESP_BLE_MESH_LPN_FRIENDSHIP_TERMINATE_EVT */
  1233. /**
  1234. * @brief ESP_BLE_MESH_FRIEND_FRIENDSHIP_ESTABLISH_EVT
  1235. */
  1236. struct ble_mesh_friend_friendship_establish_param {
  1237. uint16_t lpn_addr; /*!< Low Power Node unicast address */
  1238. } frnd_friendship_establish; /*!< Event parameter of ESP_BLE_MESH_FRIEND_FRIENDSHIP_ESTABLISH_EVT */
  1239. /**
  1240. * @brief ESP_BLE_MESH_FRIEND_FRIENDSHIP_TERMINATE_EVT
  1241. */
  1242. struct ble_mesh_friend_friendship_terminate_param {
  1243. uint16_t lpn_addr; /*!< Low Power Node unicast address */
  1244. /** This enum value is the reason of friendship termination on the friend node side */
  1245. enum {
  1246. ESP_BLE_MESH_FRND_FRIENDSHIP_TERMINATE_ESTABLISH_FAIL, /*!< Friend Offer has been sent, but Friend Offer is not received within 1 second, friendship fails to be established */
  1247. ESP_BLE_MESH_FRND_FRIENDSHIP_TERMINATE_POLL_TIMEOUT, /*!< Friendship is established, PollTimeout timer expires and no Friend Poll/Sub Add/Sub Remove is received */
  1248. ESP_BLE_MESH_FRND_FRIENDSHIP_TERMINATE_RECV_FRND_REQ, /*!< Receive Friend Request from existing Low Power Node */
  1249. ESP_BLE_MESH_FRND_FRIENDSHIP_TERMINATE_RECV_FRND_CLEAR, /*!< Receive Friend Clear from other friend node */
  1250. ESP_BLE_MESH_FRND_FRIENDSHIP_TERMINATE_DISABLE, /*!< Friend feature disabled or corresponding NetKey is deleted */
  1251. } reason; /*!< Friendship terminated reason */
  1252. } frnd_friendship_terminate; /*!< Event parameter of ESP_BLE_MESH_FRIEND_FRIENDSHIP_TERMINATE_EVT */
  1253. /**
  1254. * @brief ESP_BLE_MESH_PROXY_CLIENT_RECV_ADV_PKT_EVT
  1255. */
  1256. struct ble_mesh_proxy_client_recv_adv_pkt_param {
  1257. esp_ble_mesh_bd_addr_t addr; /*!< Device address */
  1258. esp_ble_mesh_addr_type_t addr_type; /*!< Device address type */
  1259. uint16_t net_idx; /*!< Network ID related NetKey Index */
  1260. uint8_t net_id[8]; /*!< Network ID contained in the advertising packet */
  1261. int8_t rssi; /*!< RSSI of the received advertising packet */
  1262. } proxy_client_recv_adv_pkt; /*!< Event parameter of ESP_BLE_MESH_PROXY_CLIENT_RECV_ADV_PKT_EVT */
  1263. /**
  1264. * @brief ESP_BLE_MESH_PROXY_CLIENT_CONNECTED_EVT
  1265. */
  1266. struct ble_mesh_proxy_client_connected_param {
  1267. esp_ble_mesh_bd_addr_t addr; /*!< Device address of the Proxy Server */
  1268. esp_ble_mesh_addr_type_t addr_type; /*!< Device address type */
  1269. uint8_t conn_handle; /*!< Proxy connection handle */
  1270. uint16_t net_idx; /*!< Corresponding NetKey Index */
  1271. } proxy_client_connected; /*!< Event parameter of ESP_BLE_MESH_PROXY_CLIENT_CONNECTED_EVT */
  1272. /**
  1273. * @brief ESP_BLE_MESH_PROXY_CLIENT_DISCONNECTED_EVT
  1274. */
  1275. struct ble_mesh_proxy_client_disconnected_param {
  1276. esp_ble_mesh_bd_addr_t addr; /*!< Device address of the Proxy Server */
  1277. esp_ble_mesh_addr_type_t addr_type; /*!< Device address type */
  1278. uint8_t conn_handle; /*!< Proxy connection handle */
  1279. uint16_t net_idx; /*!< Corresponding NetKey Index */
  1280. uint8_t reason; /*!< Proxy disconnect reason */
  1281. } proxy_client_disconnected; /*!< Event parameter of ESP_BLE_MESH_PROXY_CLIENT_DISCONNECTED_EVT */
  1282. /**
  1283. * @brief ESP_BLE_MESH_PROXY_CLIENT_RECV_FILTER_STATUS_EVT
  1284. */
  1285. struct ble_mesh_proxy_client_recv_filter_status_param {
  1286. uint8_t conn_handle; /*!< Proxy connection handle */
  1287. uint16_t server_addr; /*!< Proxy Server primary element address */
  1288. uint16_t net_idx; /*!< Corresponding NetKey Index */
  1289. uint8_t filter_type; /*!< Proxy Server filter type(whitelist or blacklist) */
  1290. uint16_t list_size; /*!< Number of addresses in the Proxy Server filter list */
  1291. } proxy_client_recv_filter_status; /*!< Event parameter of ESP_BLE_MESH_PROXY_CLIENT_RECV_FILTER_STATUS_EVT */
  1292. /**
  1293. * @brief ESP_BLE_MESH_PROXY_CLIENT_CONNECT_COMP_EVT
  1294. */
  1295. struct ble_mesh_proxy_client_connect_comp_param {
  1296. int err_code; /*!< Indicate the result of Proxy Client connect */
  1297. esp_ble_mesh_bd_addr_t addr; /*!< Device address of the Proxy Server */
  1298. esp_ble_mesh_addr_type_t addr_type; /*!< Device address type */
  1299. uint16_t net_idx; /*!< Corresponding NetKey Index */
  1300. } proxy_client_connect_comp; /*!< Event parameter of ESP_BLE_MESH_PROXY_CLIENT_CONNECT_COMP_EVT */
  1301. /**
  1302. * @brief ESP_BLE_MESH_PROXY_CLIENT_DISCONNECT_COMP_EVT
  1303. */
  1304. struct ble_mesh_proxy_client_disconnect_comp_param {
  1305. int err_code; /*!< Indicate the result of Proxy Client disconnect */
  1306. uint8_t conn_handle; /*!< Proxy connection handle */
  1307. } proxy_client_disconnect_comp; /*!< Event parameter of ESP_BLE_MESH_PROXY_CLIENT_DISCONNECT_COMP_EVT */
  1308. /**
  1309. * @brief ESP_BLE_MESH_PROXY_CLIENT_SET_FILTER_TYPE_COMP_EVT
  1310. */
  1311. struct ble_mesh_proxy_client_set_filter_type_comp_param {
  1312. int err_code; /*!< Indicate the result of Proxy Client set filter type */
  1313. uint8_t conn_handle; /*!< Proxy connection handle */
  1314. uint16_t net_idx; /*!< Corresponding NetKey Index */
  1315. } proxy_client_set_filter_type_comp; /*!< Event parameter of ESP_BLE_MESH_PROXY_CLIENT_SET_FILTER_TYPE_COMP_EVT */
  1316. /**
  1317. * @brief ESP_BLE_MESH_PROXY_CLIENT_ADD_FILTER_ADDR_COMP_EVT
  1318. */
  1319. struct ble_mesh_proxy_client_add_filter_addr_comp_param {
  1320. int err_code; /*!< Indicate the result of Proxy Client add filter address */
  1321. uint8_t conn_handle; /*!< Proxy connection handle */
  1322. uint16_t net_idx; /*!< Corresponding NetKey Index */
  1323. } proxy_client_add_filter_addr_comp; /*!< Event parameter of ESP_BLE_MESH_PROXY_CLIENT_ADD_FILTER_ADDR_COMP_EVT */
  1324. /**
  1325. * @brief ESP_BLE_MESH_PROXY_CLIENT_REMOVE_FILTER_ADDR_COMP_EVT
  1326. */
  1327. struct ble_mesh_proxy_client_remove_filter_addr_comp_param {
  1328. int err_code; /*!< Indicate the result of Proxy Client remove filter address */
  1329. uint8_t conn_handle; /*!< Proxy connection handle */
  1330. uint16_t net_idx; /*!< Corresponding NetKey Index */
  1331. } proxy_client_remove_filter_addr_comp; /*!< Event parameter of ESP_BLE_MESH_PROXY_CLIENT_REMOVE_FILTER_ADDR_COMP_EVT */
  1332. /**
  1333. * @brief ESP_BLE_MESH_MODEL_SUBSCRIBE_GROUP_ADDR_COMP_EVT
  1334. */
  1335. struct ble_mesh_model_sub_group_addr_comp_param {
  1336. int err_code; /*!< Indicate the result of local model subscribing group address */
  1337. uint16_t element_addr; /*!< Element address */
  1338. uint16_t company_id; /*!< Company ID */
  1339. uint16_t model_id; /*!< Model ID */
  1340. uint16_t group_addr; /*!< Group Address */
  1341. } model_sub_group_addr_comp; /*!< Event parameters of ESP_BLE_MESH_MODEL_SUBSCRIBE_GROUP_ADDR_COMP_EVT */
  1342. /**
  1343. * @brief ESP_BLE_MESH_MODEL_UNSUBSCRIBE_GROUP_ADDR_COMP_EVT
  1344. */
  1345. struct ble_mesh_model_unsub_group_addr_comp_param {
  1346. int err_code; /*!< Indicate the result of local model unsubscribing group address */
  1347. uint16_t element_addr; /*!< Element address */
  1348. uint16_t company_id; /*!< Company ID */
  1349. uint16_t model_id; /*!< Model ID */
  1350. uint16_t group_addr; /*!< Group Address */
  1351. } model_unsub_group_addr_comp; /*!< Event parameters of ESP_BLE_MESH_MODEL_UNSUBSCRIBE_GROUP_ADDR_COMP_EVT */
  1352. /**
  1353. * @brief ESP_BLE_MESH_DEINIT_MESH_COMP_EVT
  1354. */
  1355. struct ble_mesh_deinit_mesh_comp_param {
  1356. int err_code; /*!< Indicate the result of BLE Mesh deinitialization */
  1357. } deinit_mesh_comp; /*!< Event parameter of ESP_BLE_MESH_DEINIT_MESH_COMP_EVT */
  1358. } esp_ble_mesh_prov_cb_param_t;
  1359. /**
  1360. * @brief BLE Mesh models related Model ID and Opcode definitions
  1361. */
  1362. /*!< Foundation Models */
  1363. #define ESP_BLE_MESH_MODEL_ID_CONFIG_SRV 0x0000
  1364. #define ESP_BLE_MESH_MODEL_ID_CONFIG_CLI 0x0001
  1365. #define ESP_BLE_MESH_MODEL_ID_HEALTH_SRV 0x0002
  1366. #define ESP_BLE_MESH_MODEL_ID_HEALTH_CLI 0x0003
  1367. /*!< Models from the Mesh Model Specification */
  1368. #define ESP_BLE_MESH_MODEL_ID_GEN_ONOFF_SRV 0x1000
  1369. #define ESP_BLE_MESH_MODEL_ID_GEN_ONOFF_CLI 0x1001
  1370. #define ESP_BLE_MESH_MODEL_ID_GEN_LEVEL_SRV 0x1002
  1371. #define ESP_BLE_MESH_MODEL_ID_GEN_LEVEL_CLI 0x1003
  1372. #define ESP_BLE_MESH_MODEL_ID_GEN_DEF_TRANS_TIME_SRV 0x1004
  1373. #define ESP_BLE_MESH_MODEL_ID_GEN_DEF_TRANS_TIME_CLI 0x1005
  1374. #define ESP_BLE_MESH_MODEL_ID_GEN_POWER_ONOFF_SRV 0x1006
  1375. #define ESP_BLE_MESH_MODEL_ID_GEN_POWER_ONOFF_SETUP_SRV 0x1007
  1376. #define ESP_BLE_MESH_MODEL_ID_GEN_POWER_ONOFF_CLI 0x1008
  1377. #define ESP_BLE_MESH_MODEL_ID_GEN_POWER_LEVEL_SRV 0x1009
  1378. #define ESP_BLE_MESH_MODEL_ID_GEN_POWER_LEVEL_SETUP_SRV 0x100a
  1379. #define ESP_BLE_MESH_MODEL_ID_GEN_POWER_LEVEL_CLI 0x100b
  1380. #define ESP_BLE_MESH_MODEL_ID_GEN_BATTERY_SRV 0x100c
  1381. #define ESP_BLE_MESH_MODEL_ID_GEN_BATTERY_CLI 0x100d
  1382. #define ESP_BLE_MESH_MODEL_ID_GEN_LOCATION_SRV 0x100e
  1383. #define ESP_BLE_MESH_MODEL_ID_GEN_LOCATION_SETUP_SRV 0x100f
  1384. #define ESP_BLE_MESH_MODEL_ID_GEN_LOCATION_CLI 0x1010
  1385. #define ESP_BLE_MESH_MODEL_ID_GEN_ADMIN_PROP_SRV 0x1011
  1386. #define ESP_BLE_MESH_MODEL_ID_GEN_MANUFACTURER_PROP_SRV 0x1012
  1387. #define ESP_BLE_MESH_MODEL_ID_GEN_USER_PROP_SRV 0x1013
  1388. #define ESP_BLE_MESH_MODEL_ID_GEN_CLIENT_PROP_SRV 0x1014
  1389. #define ESP_BLE_MESH_MODEL_ID_GEN_PROP_CLI 0x1015
  1390. #define ESP_BLE_MESH_MODEL_ID_SENSOR_SRV 0x1100
  1391. #define ESP_BLE_MESH_MODEL_ID_SENSOR_SETUP_SRV 0x1101
  1392. #define ESP_BLE_MESH_MODEL_ID_SENSOR_CLI 0x1102
  1393. #define ESP_BLE_MESH_MODEL_ID_TIME_SRV 0x1200
  1394. #define ESP_BLE_MESH_MODEL_ID_TIME_SETUP_SRV 0x1201
  1395. #define ESP_BLE_MESH_MODEL_ID_TIME_CLI 0x1202
  1396. #define ESP_BLE_MESH_MODEL_ID_SCENE_SRV 0x1203
  1397. #define ESP_BLE_MESH_MODEL_ID_SCENE_SETUP_SRV 0x1204
  1398. #define ESP_BLE_MESH_MODEL_ID_SCENE_CLI 0x1205
  1399. #define ESP_BLE_MESH_MODEL_ID_SCHEDULER_SRV 0x1206
  1400. #define ESP_BLE_MESH_MODEL_ID_SCHEDULER_SETUP_SRV 0x1207
  1401. #define ESP_BLE_MESH_MODEL_ID_SCHEDULER_CLI 0x1208
  1402. #define ESP_BLE_MESH_MODEL_ID_LIGHT_LIGHTNESS_SRV 0x1300
  1403. #define ESP_BLE_MESH_MODEL_ID_LIGHT_LIGHTNESS_SETUP_SRV 0x1301
  1404. #define ESP_BLE_MESH_MODEL_ID_LIGHT_LIGHTNESS_CLI 0x1302
  1405. #define ESP_BLE_MESH_MODEL_ID_LIGHT_CTL_SRV 0x1303
  1406. #define ESP_BLE_MESH_MODEL_ID_LIGHT_CTL_SETUP_SRV 0x1304
  1407. #define ESP_BLE_MESH_MODEL_ID_LIGHT_CTL_CLI 0x1305
  1408. #define ESP_BLE_MESH_MODEL_ID_LIGHT_CTL_TEMP_SRV 0x1306
  1409. #define ESP_BLE_MESH_MODEL_ID_LIGHT_HSL_SRV 0x1307
  1410. #define ESP_BLE_MESH_MODEL_ID_LIGHT_HSL_SETUP_SRV 0x1308
  1411. #define ESP_BLE_MESH_MODEL_ID_LIGHT_HSL_CLI 0x1309
  1412. #define ESP_BLE_MESH_MODEL_ID_LIGHT_HSL_HUE_SRV 0x130a
  1413. #define ESP_BLE_MESH_MODEL_ID_LIGHT_HSL_SAT_SRV 0x130b
  1414. #define ESP_BLE_MESH_MODEL_ID_LIGHT_XYL_SRV 0x130c
  1415. #define ESP_BLE_MESH_MODEL_ID_LIGHT_XYL_SETUP_SRV 0x130d
  1416. #define ESP_BLE_MESH_MODEL_ID_LIGHT_XYL_CLI 0x130e
  1417. #define ESP_BLE_MESH_MODEL_ID_LIGHT_LC_SRV 0x130f
  1418. #define ESP_BLE_MESH_MODEL_ID_LIGHT_LC_SETUP_SRV 0x1310
  1419. #define ESP_BLE_MESH_MODEL_ID_LIGHT_LC_CLI 0x1311
  1420. /**
  1421. * esp_ble_mesh_opcode_config_client_get_t belongs to esp_ble_mesh_opcode_t, this typedef is only
  1422. * used to locate the opcodes used by esp_ble_mesh_config_client_get_state.
  1423. * The following opcodes will only be used in the esp_ble_mesh_config_client_get_state function.
  1424. */
  1425. typedef uint32_t esp_ble_mesh_opcode_config_client_get_t;
  1426. #define ESP_BLE_MESH_MODEL_OP_BEACON_GET ESP_BLE_MESH_MODEL_OP_2(0x80, 0x09) /*!< Config Beacon Get */
  1427. #define ESP_BLE_MESH_MODEL_OP_COMPOSITION_DATA_GET ESP_BLE_MESH_MODEL_OP_2(0x80, 0x08) /*!< Config Composition Data Get */
  1428. #define ESP_BLE_MESH_MODEL_OP_DEFAULT_TTL_GET ESP_BLE_MESH_MODEL_OP_2(0x80, 0x0C) /*!< Config Default TTL Get */
  1429. #define ESP_BLE_MESH_MODEL_OP_GATT_PROXY_GET ESP_BLE_MESH_MODEL_OP_2(0x80, 0x12) /*!< Config GATT Proxy Get */
  1430. #define ESP_BLE_MESH_MODEL_OP_RELAY_GET ESP_BLE_MESH_MODEL_OP_2(0x80, 0x26) /*!< Config Relay Get */
  1431. #define ESP_BLE_MESH_MODEL_OP_MODEL_PUB_GET ESP_BLE_MESH_MODEL_OP_2(0x80, 0x18) /*!< Config Model Publication Get */
  1432. #define ESP_BLE_MESH_MODEL_OP_FRIEND_GET ESP_BLE_MESH_MODEL_OP_2(0x80, 0x0F) /*!< Config Friend Get */
  1433. #define ESP_BLE_MESH_MODEL_OP_HEARTBEAT_PUB_GET ESP_BLE_MESH_MODEL_OP_2(0x80, 0x38) /*!< Config Heartbeat Publication Get */
  1434. #define ESP_BLE_MESH_MODEL_OP_HEARTBEAT_SUB_GET ESP_BLE_MESH_MODEL_OP_2(0x80, 0x3a) /*!< Config Heartbeat Subscription Get */
  1435. #define ESP_BLE_MESH_MODEL_OP_NET_KEY_GET ESP_BLE_MESH_MODEL_OP_2(0x80, 0x42) /*!< Config NetKey Get */
  1436. #define ESP_BLE_MESH_MODEL_OP_APP_KEY_GET ESP_BLE_MESH_MODEL_OP_2(0x80, 0x01) /*!< Config AppKey Get */
  1437. #define ESP_BLE_MESH_MODEL_OP_NODE_IDENTITY_GET ESP_BLE_MESH_MODEL_OP_2(0x80, 0x46) /*!< Config Node Identity Get */
  1438. #define ESP_BLE_MESH_MODEL_OP_SIG_MODEL_SUB_GET ESP_BLE_MESH_MODEL_OP_2(0x80, 0x29) /*!< Config SIG Model Subscription Get */
  1439. #define ESP_BLE_MESH_MODEL_OP_VENDOR_MODEL_SUB_GET ESP_BLE_MESH_MODEL_OP_2(0x80, 0x2B) /*!< Config Vendor Model Subscription Get */
  1440. #define ESP_BLE_MESH_MODEL_OP_SIG_MODEL_APP_GET ESP_BLE_MESH_MODEL_OP_2(0x80, 0x4B) /*!< Config SIG Model App Get */
  1441. #define ESP_BLE_MESH_MODEL_OP_VENDOR_MODEL_APP_GET ESP_BLE_MESH_MODEL_OP_2(0x80, 0x4D) /*!< Config Vendor Model App Get */
  1442. #define ESP_BLE_MESH_MODEL_OP_KEY_REFRESH_PHASE_GET ESP_BLE_MESH_MODEL_OP_2(0x80, 0x15) /*!< Config Key Refresh Phase Get */
  1443. #define ESP_BLE_MESH_MODEL_OP_LPN_POLLTIMEOUT_GET ESP_BLE_MESH_MODEL_OP_2(0x80, 0x2D) /*!< Config Low Power Node PollTimeout Get */
  1444. #define ESP_BLE_MESH_MODEL_OP_NETWORK_TRANSMIT_GET ESP_BLE_MESH_MODEL_OP_2(0x80, 0x23) /*!< Config Network Transmit Get */
  1445. /**
  1446. * esp_ble_mesh_opcode_config_client_set_t belongs to esp_ble_mesh_opcode_t, this typedef is
  1447. * only used to locate the opcodes used by esp_ble_mesh_config_client_set_state.
  1448. * The following opcodes will only be used in the esp_ble_mesh_config_client_set_state function.
  1449. */
  1450. typedef uint32_t esp_ble_mesh_opcode_config_client_set_t;
  1451. #define ESP_BLE_MESH_MODEL_OP_BEACON_SET ESP_BLE_MESH_MODEL_OP_2(0x80, 0x0A) /*!< Config Beacon Set */
  1452. #define ESP_BLE_MESH_MODEL_OP_DEFAULT_TTL_SET ESP_BLE_MESH_MODEL_OP_2(0x80, 0x0D) /*!< Config Default TTL Set */
  1453. #define ESP_BLE_MESH_MODEL_OP_GATT_PROXY_SET ESP_BLE_MESH_MODEL_OP_2(0x80, 0x13) /*!< Config GATT Proxy Set */
  1454. #define ESP_BLE_MESH_MODEL_OP_RELAY_SET ESP_BLE_MESH_MODEL_OP_2(0x80, 0x27) /*!< Config Relay Set */
  1455. #define ESP_BLE_MESH_MODEL_OP_MODEL_PUB_SET ESP_BLE_MESH_MODEL_OP_1(0x03) /*!< Config Model Publication Set */
  1456. #define ESP_BLE_MESH_MODEL_OP_MODEL_SUB_ADD ESP_BLE_MESH_MODEL_OP_2(0x80, 0x1B) /*!< Config Model Subscription Add */
  1457. #define ESP_BLE_MESH_MODEL_OP_MODEL_SUB_VIRTUAL_ADDR_ADD ESP_BLE_MESH_MODEL_OP_2(0x80, 0x20) /*!< Config Model Subscription Virtual Address Add */
  1458. #define ESP_BLE_MESH_MODEL_OP_MODEL_SUB_DELETE ESP_BLE_MESH_MODEL_OP_2(0x80, 0x1C) /*!< Config Model Subscription Delete */
  1459. #define ESP_BLE_MESH_MODEL_OP_MODEL_SUB_VIRTUAL_ADDR_DELETE ESP_BLE_MESH_MODEL_OP_2(0x80, 0x21) /*!< Config Model Subscription Virtual Address Delete */
  1460. #define ESP_BLE_MESH_MODEL_OP_MODEL_SUB_OVERWRITE ESP_BLE_MESH_MODEL_OP_2(0x80, 0x1E) /*!< Config Model Subscription Overwrite */
  1461. #define ESP_BLE_MESH_MODEL_OP_MODEL_SUB_VIRTUAL_ADDR_OVERWRITE ESP_BLE_MESH_MODEL_OP_2(0x80, 0x22) /*!< Config Model Subscription Virtual Address Overwrite */
  1462. #define ESP_BLE_MESH_MODEL_OP_NET_KEY_ADD ESP_BLE_MESH_MODEL_OP_2(0x80, 0x40) /*!< Config NetKey Add */
  1463. #define ESP_BLE_MESH_MODEL_OP_APP_KEY_ADD ESP_BLE_MESH_MODEL_OP_1(0x00) /*!< Config AppKey Add */
  1464. #define ESP_BLE_MESH_MODEL_OP_MODEL_APP_BIND ESP_BLE_MESH_MODEL_OP_2(0x80, 0x3D) /*!< Config Model App Bind */
  1465. #define ESP_BLE_MESH_MODEL_OP_NODE_RESET ESP_BLE_MESH_MODEL_OP_2(0x80, 0x49) /*!< Config Node Reset */
  1466. #define ESP_BLE_MESH_MODEL_OP_FRIEND_SET ESP_BLE_MESH_MODEL_OP_2(0x80, 0x10) /*!< Config Friend Set */
  1467. #define ESP_BLE_MESH_MODEL_OP_HEARTBEAT_PUB_SET ESP_BLE_MESH_MODEL_OP_2(0x80, 0x39) /*!< Config Heartbeat Publication Set */
  1468. #define ESP_BLE_MESH_MODEL_OP_HEARTBEAT_SUB_SET ESP_BLE_MESH_MODEL_OP_2(0x80, 0x3B) /*!< Config Heartbeat Subscription Set */
  1469. #define ESP_BLE_MESH_MODEL_OP_NET_KEY_UPDATE ESP_BLE_MESH_MODEL_OP_2(0x80, 0x45) /*!< Config NetKey Update */
  1470. #define ESP_BLE_MESH_MODEL_OP_NET_KEY_DELETE ESP_BLE_MESH_MODEL_OP_2(0x80, 0x41) /*!< Config NetKey Delete */
  1471. #define ESP_BLE_MESH_MODEL_OP_APP_KEY_UPDATE ESP_BLE_MESH_MODEL_OP_1(0x01) /*!< Config AppKey Update */
  1472. #define ESP_BLE_MESH_MODEL_OP_APP_KEY_DELETE ESP_BLE_MESH_MODEL_OP_2(0x80, 0x00) /*!< Config AppKey Delete */
  1473. #define ESP_BLE_MESH_MODEL_OP_NODE_IDENTITY_SET ESP_BLE_MESH_MODEL_OP_2(0x80, 0x47) /*!< Config Node Identity Set */
  1474. #define ESP_BLE_MESH_MODEL_OP_KEY_REFRESH_PHASE_SET ESP_BLE_MESH_MODEL_OP_2(0x80, 0x16) /*!< Config Key Refresh Phase Set */
  1475. #define ESP_BLE_MESH_MODEL_OP_MODEL_PUB_VIRTUAL_ADDR_SET ESP_BLE_MESH_MODEL_OP_2(0x80, 0x1A) /*!< Config Model Publication Virtual Address Set */
  1476. #define ESP_BLE_MESH_MODEL_OP_MODEL_SUB_DELETE_ALL ESP_BLE_MESH_MODEL_OP_2(0x80, 0x1D) /*!< Config Model Subscription Delete All */
  1477. #define ESP_BLE_MESH_MODEL_OP_MODEL_APP_UNBIND ESP_BLE_MESH_MODEL_OP_2(0x80, 0x3F) /*!< Config Model App Unbind */
  1478. #define ESP_BLE_MESH_MODEL_OP_NETWORK_TRANSMIT_SET ESP_BLE_MESH_MODEL_OP_2(0x80, 0x24) /*!< Config Network Transmit Set */
  1479. /**
  1480. * esp_ble_mesh_opcode_config_status_t belongs to esp_ble_mesh_opcode_t, this typedef is only
  1481. * used to locate the opcodes used by the Config Model messages
  1482. * The following opcodes are used by the BLE Mesh Config Server Model internally to respond
  1483. * to the Config Client Model's request messages.
  1484. */
  1485. typedef uint32_t esp_ble_mesh_opcode_config_status_t;
  1486. #define ESP_BLE_MESH_MODEL_OP_BEACON_STATUS ESP_BLE_MESH_MODEL_OP_2(0x80, 0x0B)
  1487. #define ESP_BLE_MESH_MODEL_OP_COMPOSITION_DATA_STATUS ESP_BLE_MESH_MODEL_OP_1(0x02)
  1488. #define ESP_BLE_MESH_MODEL_OP_DEFAULT_TTL_STATUS ESP_BLE_MESH_MODEL_OP_2(0x80, 0x0E)
  1489. #define ESP_BLE_MESH_MODEL_OP_GATT_PROXY_STATUS ESP_BLE_MESH_MODEL_OP_2(0x80, 0x14)
  1490. #define ESP_BLE_MESH_MODEL_OP_RELAY_STATUS ESP_BLE_MESH_MODEL_OP_2(0x80, 0x28)
  1491. #define ESP_BLE_MESH_MODEL_OP_MODEL_PUB_STATUS ESP_BLE_MESH_MODEL_OP_2(0x80, 0x19)
  1492. #define ESP_BLE_MESH_MODEL_OP_MODEL_SUB_STATUS ESP_BLE_MESH_MODEL_OP_2(0x80, 0x1F)
  1493. #define ESP_BLE_MESH_MODEL_OP_SIG_MODEL_SUB_LIST ESP_BLE_MESH_MODEL_OP_2(0x80, 0x2A)
  1494. #define ESP_BLE_MESH_MODEL_OP_VENDOR_MODEL_SUB_LIST ESP_BLE_MESH_MODEL_OP_2(0x80, 0x2C)
  1495. #define ESP_BLE_MESH_MODEL_OP_NET_KEY_STATUS ESP_BLE_MESH_MODEL_OP_2(0x80, 0x44)
  1496. #define ESP_BLE_MESH_MODEL_OP_NET_KEY_LIST ESP_BLE_MESH_MODEL_OP_2(0x80, 0x43)
  1497. #define ESP_BLE_MESH_MODEL_OP_APP_KEY_STATUS ESP_BLE_MESH_MODEL_OP_2(0x80, 0x03)
  1498. #define ESP_BLE_MESH_MODEL_OP_APP_KEY_LIST ESP_BLE_MESH_MODEL_OP_2(0x80, 0x02)
  1499. #define ESP_BLE_MESH_MODEL_OP_NODE_IDENTITY_STATUS ESP_BLE_MESH_MODEL_OP_2(0x80, 0x48)
  1500. #define ESP_BLE_MESH_MODEL_OP_MODEL_APP_STATUS ESP_BLE_MESH_MODEL_OP_2(0x80, 0x3E)
  1501. #define ESP_BLE_MESH_MODEL_OP_SIG_MODEL_APP_LIST ESP_BLE_MESH_MODEL_OP_2(0x80, 0x4C)
  1502. #define ESP_BLE_MESH_MODEL_OP_VENDOR_MODEL_APP_LIST ESP_BLE_MESH_MODEL_OP_2(0x80, 0x4E)
  1503. #define ESP_BLE_MESH_MODEL_OP_NODE_RESET_STATUS ESP_BLE_MESH_MODEL_OP_2(0x80, 0x4A)
  1504. #define ESP_BLE_MESH_MODEL_OP_FRIEND_STATUS ESP_BLE_MESH_MODEL_OP_2(0x80, 0x11)
  1505. #define ESP_BLE_MESH_MODEL_OP_KEY_REFRESH_PHASE_STATUS ESP_BLE_MESH_MODEL_OP_2(0x80, 0x17)
  1506. #define ESP_BLE_MESH_MODEL_OP_HEARTBEAT_PUB_STATUS ESP_BLE_MESH_MODEL_OP_1(0x06)
  1507. #define ESP_BLE_MESH_MODEL_OP_HEARTBEAT_SUB_STATUS ESP_BLE_MESH_MODEL_OP_2(0x80, 0x3C)
  1508. #define ESP_BLE_MESH_MODEL_OP_LPN_POLLTIMEOUT_STATUS ESP_BLE_MESH_MODEL_OP_2(0x80, 0x2E)
  1509. #define ESP_BLE_MESH_MODEL_OP_NETWORK_TRANSMIT_STATUS ESP_BLE_MESH_MODEL_OP_2(0x80, 0x25)
  1510. /**
  1511. * This typedef is only used to indicate the status code contained in some of
  1512. * the Configuration Server Model status message.
  1513. */
  1514. typedef uint8_t esp_ble_mesh_cfg_status_t;
  1515. #define ESP_BLE_MESH_CFG_STATUS_SUCCESS 0x00
  1516. #define ESP_BLE_MESH_CFG_STATUS_INVALID_ADDRESS 0x01
  1517. #define ESP_BLE_MESH_CFG_STATUS_INVALID_MODEL 0x02
  1518. #define ESP_BLE_MESH_CFG_STATUS_INVALID_APPKEY 0x03
  1519. #define ESP_BLE_MESH_CFG_STATUS_INVALID_NETKEY 0x04
  1520. #define ESP_BLE_MESH_CFG_STATUS_INSUFFICIENT_RESOURCES 0x05
  1521. #define ESP_BLE_MESH_CFG_STATUS_KEY_INDEX_ALREADY_STORED 0x06
  1522. #define ESP_BLE_MESH_CFG_STATUS_INVALID_PUBLISH_PARAMETERS 0x07
  1523. #define ESP_BLE_MESH_CFG_STATUS_NOT_A_SUBSCRIBE_MODEL 0x08
  1524. #define ESP_BLE_MESH_CFG_STATUS_STORAGE_FAILURE 0x09
  1525. #define ESP_BLE_MESH_CFG_STATUS_FEATURE_NOT_SUPPORTED 0x0A
  1526. #define ESP_BLE_MESH_CFG_STATUS_CANNOT_UPDATE 0x0B
  1527. #define ESP_BLE_MESH_CFG_STATUS_CANNOT_REMOVE 0x0C
  1528. #define ESP_BLE_MESH_CFG_STATUS_CANNOT_BIND 0x0D
  1529. #define ESP_BLE_MESH_CFG_STATUS_TEMP_UNABLE_TO_CHANGE_STATE 0x0E
  1530. #define ESP_BLE_MESH_CFG_STATUS_CANNOT_SET 0x0F
  1531. #define ESP_BLE_MESH_CFG_STATUS_UNSPECIFIED_ERROR 0x10
  1532. #define ESP_BLE_MESH_CFG_STATUS_INVALID_BINDING 0x11
  1533. /**
  1534. * esp_ble_mesh_opcode_health_client_get_t belongs to esp_ble_mesh_opcode_t, this typedef is
  1535. * only used to locate the opcodes used by esp_ble_mesh_health_client_get_state.
  1536. * The following opcodes will only be used in the esp_ble_mesh_health_client_get_state function.
  1537. */
  1538. typedef uint32_t esp_ble_mesh_opcode_health_client_get_t;
  1539. #define ESP_BLE_MESH_MODEL_OP_HEALTH_FAULT_GET ESP_BLE_MESH_MODEL_OP_2(0x80, 0x31) /*!< Health Fault Get */
  1540. #define ESP_BLE_MESH_MODEL_OP_HEALTH_PERIOD_GET ESP_BLE_MESH_MODEL_OP_2(0x80, 0x34) /*!< Health Period Get */
  1541. #define ESP_BLE_MESH_MODEL_OP_ATTENTION_GET ESP_BLE_MESH_MODEL_OP_2(0x80, 0x04) /*!< Health Attention Get */
  1542. /**
  1543. * esp_ble_mesh_opcode_health_client_set_t belongs to esp_ble_mesh_opcode_t, this typedef is
  1544. * only used to locate the opcodes used by esp_ble_mesh_health_client_set_state.
  1545. * The following opcodes will only be used in the esp_ble_mesh_health_client_set_state function.
  1546. */
  1547. typedef uint32_t esp_ble_mesh_opcode_health_client_set_t;
  1548. #define ESP_BLE_MESH_MODEL_OP_HEALTH_FAULT_CLEAR ESP_BLE_MESH_MODEL_OP_2(0x80, 0x2F) /*!< Health Fault Clear */
  1549. #define ESP_BLE_MESH_MODEL_OP_HEALTH_FAULT_CLEAR_UNACK ESP_BLE_MESH_MODEL_OP_2(0x80, 0x30) /*!< Health Fault Clear Unacknowledged */
  1550. #define ESP_BLE_MESH_MODEL_OP_HEALTH_FAULT_TEST ESP_BLE_MESH_MODEL_OP_2(0x80, 0x32) /*!< Health Fault Test */
  1551. #define ESP_BLE_MESH_MODEL_OP_HEALTH_FAULT_TEST_UNACK ESP_BLE_MESH_MODEL_OP_2(0x80, 0x33) /*!< Health Fault Test Unacknowledged */
  1552. #define ESP_BLE_MESH_MODEL_OP_HEALTH_PERIOD_SET ESP_BLE_MESH_MODEL_OP_2(0x80, 0x35) /*!< Health Period Set */
  1553. #define ESP_BLE_MESH_MODEL_OP_HEALTH_PERIOD_SET_UNACK ESP_BLE_MESH_MODEL_OP_2(0x80, 0x36) /*!< Health Period Set Unacknowledged */
  1554. #define ESP_BLE_MESH_MODEL_OP_ATTENTION_SET ESP_BLE_MESH_MODEL_OP_2(0x80, 0x05) /*!< Health Attention Set */
  1555. #define ESP_BLE_MESH_MODEL_OP_ATTENTION_SET_UNACK ESP_BLE_MESH_MODEL_OP_2(0x80, 0x06) /*!< Health Attention Set Unacknowledged */
  1556. /**
  1557. * esp_ble_mesh_health_model_status_t belongs to esp_ble_mesh_opcode_t, this typedef is
  1558. * only used to locate the opcodes used by the Health Model messages.
  1559. * The following opcodes are used by the BLE Mesh Health Server Model internally to
  1560. * respond to the Health Client Model's request messages.
  1561. */
  1562. typedef uint32_t esp_ble_mesh_health_model_status_t;
  1563. #define ESP_BLE_MESH_MODEL_OP_HEALTH_CURRENT_STATUS ESP_BLE_MESH_MODEL_OP_1(0x04)
  1564. #define ESP_BLE_MESH_MODEL_OP_HEALTH_FAULT_STATUS ESP_BLE_MESH_MODEL_OP_1(0x05)
  1565. #define ESP_BLE_MESH_MODEL_OP_HEALTH_PERIOD_STATUS ESP_BLE_MESH_MODEL_OP_2(0x80, 0x37)
  1566. #define ESP_BLE_MESH_MODEL_OP_ATTENTION_STATUS ESP_BLE_MESH_MODEL_OP_2(0x80, 0x07)
  1567. /**
  1568. * esp_ble_mesh_generic_message_opcode_t belongs to esp_ble_mesh_opcode_t, this typedef is
  1569. * only used to locate the opcodes used by functions esp_ble_mesh_generic_client_get_state
  1570. * & esp_ble_mesh_generic_client_set_state.
  1571. */
  1572. typedef uint32_t esp_ble_mesh_generic_message_opcode_t;
  1573. /*!< Generic OnOff Message Opcode */
  1574. #define ESP_BLE_MESH_MODEL_OP_GEN_ONOFF_GET ESP_BLE_MESH_MODEL_OP_2(0x82, 0x01)
  1575. #define ESP_BLE_MESH_MODEL_OP_GEN_ONOFF_SET ESP_BLE_MESH_MODEL_OP_2(0x82, 0x02)
  1576. #define ESP_BLE_MESH_MODEL_OP_GEN_ONOFF_SET_UNACK ESP_BLE_MESH_MODEL_OP_2(0x82, 0x03)
  1577. #define ESP_BLE_MESH_MODEL_OP_GEN_ONOFF_STATUS ESP_BLE_MESH_MODEL_OP_2(0x82, 0x04)
  1578. /*!< Generic Level Message Opcode */
  1579. #define ESP_BLE_MESH_MODEL_OP_GEN_LEVEL_GET ESP_BLE_MESH_MODEL_OP_2(0x82, 0x05)
  1580. #define ESP_BLE_MESH_MODEL_OP_GEN_LEVEL_SET ESP_BLE_MESH_MODEL_OP_2(0x82, 0x06)
  1581. #define ESP_BLE_MESH_MODEL_OP_GEN_LEVEL_SET_UNACK ESP_BLE_MESH_MODEL_OP_2(0x82, 0x07)
  1582. #define ESP_BLE_MESH_MODEL_OP_GEN_LEVEL_STATUS ESP_BLE_MESH_MODEL_OP_2(0x82, 0x08)
  1583. #define ESP_BLE_MESH_MODEL_OP_GEN_DELTA_SET ESP_BLE_MESH_MODEL_OP_2(0x82, 0x09)
  1584. #define ESP_BLE_MESH_MODEL_OP_GEN_DELTA_SET_UNACK ESP_BLE_MESH_MODEL_OP_2(0x82, 0x0A)
  1585. #define ESP_BLE_MESH_MODEL_OP_GEN_MOVE_SET ESP_BLE_MESH_MODEL_OP_2(0x82, 0x0B)
  1586. #define ESP_BLE_MESH_MODEL_OP_GEN_MOVE_SET_UNACK ESP_BLE_MESH_MODEL_OP_2(0x82, 0x0C)
  1587. /*!< Generic Default Transition Time Message Opcode */
  1588. #define ESP_BLE_MESH_MODEL_OP_GEN_DEF_TRANS_TIME_GET ESP_BLE_MESH_MODEL_OP_2(0x82, 0x0D)
  1589. #define ESP_BLE_MESH_MODEL_OP_GEN_DEF_TRANS_TIME_SET ESP_BLE_MESH_MODEL_OP_2(0x82, 0x0E)
  1590. #define ESP_BLE_MESH_MODEL_OP_GEN_DEF_TRANS_TIME_SET_UNACK ESP_BLE_MESH_MODEL_OP_2(0x82, 0x0F)
  1591. #define ESP_BLE_MESH_MODEL_OP_GEN_DEF_TRANS_TIME_STATUS ESP_BLE_MESH_MODEL_OP_2(0x82, 0x10)
  1592. /*!< Generic Power OnOff Message Opcode */
  1593. #define ESP_BLE_MESH_MODEL_OP_GEN_ONPOWERUP_GET ESP_BLE_MESH_MODEL_OP_2(0x82, 0x11)
  1594. #define ESP_BLE_MESH_MODEL_OP_GEN_ONPOWERUP_STATUS ESP_BLE_MESH_MODEL_OP_2(0x82, 0x12)
  1595. /*!< Generic Power OnOff Setup Message Opcode */
  1596. #define ESP_BLE_MESH_MODEL_OP_GEN_ONPOWERUP_SET ESP_BLE_MESH_MODEL_OP_2(0x82, 0x13)
  1597. #define ESP_BLE_MESH_MODEL_OP_GEN_ONPOWERUP_SET_UNACK ESP_BLE_MESH_MODEL_OP_2(0x82, 0x14)
  1598. /*!< Generic Power Level Message Opcode */
  1599. #define ESP_BLE_MESH_MODEL_OP_GEN_POWER_LEVEL_GET ESP_BLE_MESH_MODEL_OP_2(0x82, 0x15)
  1600. #define ESP_BLE_MESH_MODEL_OP_GEN_POWER_LEVEL_SET ESP_BLE_MESH_MODEL_OP_2(0x82, 0x16)
  1601. #define ESP_BLE_MESH_MODEL_OP_GEN_POWER_LEVEL_SET_UNACK ESP_BLE_MESH_MODEL_OP_2(0x82, 0x17)
  1602. #define ESP_BLE_MESH_MODEL_OP_GEN_POWER_LEVEL_STATUS ESP_BLE_MESH_MODEL_OP_2(0x82, 0x18)
  1603. #define ESP_BLE_MESH_MODEL_OP_GEN_POWER_LAST_GET ESP_BLE_MESH_MODEL_OP_2(0x82, 0x19)
  1604. #define ESP_BLE_MESH_MODEL_OP_GEN_POWER_LAST_STATUS ESP_BLE_MESH_MODEL_OP_2(0x82, 0x1A)
  1605. #define ESP_BLE_MESH_MODEL_OP_GEN_POWER_DEFAULT_GET ESP_BLE_MESH_MODEL_OP_2(0x82, 0x1B)
  1606. #define ESP_BLE_MESH_MODEL_OP_GEN_POWER_DEFAULT_STATUS ESP_BLE_MESH_MODEL_OP_2(0x82, 0x1C)
  1607. #define ESP_BLE_MESH_MODEL_OP_GEN_POWER_RANGE_GET ESP_BLE_MESH_MODEL_OP_2(0x82, 0x1D)
  1608. #define ESP_BLE_MESH_MODEL_OP_GEN_POWER_RANGE_STATUS ESP_BLE_MESH_MODEL_OP_2(0x82, 0x1E)
  1609. /*!< Generic Power Level Setup Message Opcode */
  1610. #define ESP_BLE_MESH_MODEL_OP_GEN_POWER_DEFAULT_SET ESP_BLE_MESH_MODEL_OP_2(0x82, 0x1F)
  1611. #define ESP_BLE_MESH_MODEL_OP_GEN_POWER_DEFAULT_SET_UNACK ESP_BLE_MESH_MODEL_OP_2(0x82, 0x20)
  1612. #define ESP_BLE_MESH_MODEL_OP_GEN_POWER_RANGE_SET ESP_BLE_MESH_MODEL_OP_2(0x82, 0x21)
  1613. #define ESP_BLE_MESH_MODEL_OP_GEN_POWER_RANGE_SET_UNACK ESP_BLE_MESH_MODEL_OP_2(0x82, 0x22)
  1614. /*!< Generic Battery Message Opcode */
  1615. #define ESP_BLE_MESH_MODEL_OP_GEN_BATTERY_GET ESP_BLE_MESH_MODEL_OP_2(0x82, 0x23)
  1616. #define ESP_BLE_MESH_MODEL_OP_GEN_BATTERY_STATUS ESP_BLE_MESH_MODEL_OP_2(0x82, 0x24)
  1617. /*!< Generic Location Message Opcode */
  1618. #define ESP_BLE_MESH_MODEL_OP_GEN_LOC_GLOBAL_GET ESP_BLE_MESH_MODEL_OP_2(0x82, 0x25)
  1619. #define ESP_BLE_MESH_MODEL_OP_GEN_LOC_GLOBAL_STATUS ESP_BLE_MESH_MODEL_OP_1(0x40)
  1620. #define ESP_BLE_MESH_MODEL_OP_GEN_LOC_LOCAL_GET ESP_BLE_MESH_MODEL_OP_2(0x82, 0x26)
  1621. #define ESP_BLE_MESH_MODEL_OP_GEN_LOC_LOCAL_STATUS ESP_BLE_MESH_MODEL_OP_2(0x82, 0x27)
  1622. /*!< Generic Location Setup Message Opcode */
  1623. #define ESP_BLE_MESH_MODEL_OP_GEN_LOC_GLOBAL_SET ESP_BLE_MESH_MODEL_OP_1(0x41)
  1624. #define ESP_BLE_MESH_MODEL_OP_GEN_LOC_GLOBAL_SET_UNACK ESP_BLE_MESH_MODEL_OP_1(0x42)
  1625. #define ESP_BLE_MESH_MODEL_OP_GEN_LOC_LOCAL_SET ESP_BLE_MESH_MODEL_OP_2(0x82, 0x28)
  1626. #define ESP_BLE_MESH_MODEL_OP_GEN_LOC_LOCAL_SET_UNACK ESP_BLE_MESH_MODEL_OP_2(0x82, 0x29)
  1627. /*!< Generic Manufacturer Property Message Opcode */
  1628. #define ESP_BLE_MESH_MODEL_OP_GEN_MANUFACTURER_PROPERTIES_GET ESP_BLE_MESH_MODEL_OP_2(0x82, 0x2A)
  1629. #define ESP_BLE_MESH_MODEL_OP_GEN_MANUFACTURER_PROPERTIES_STATUS ESP_BLE_MESH_MODEL_OP_1(0x43)
  1630. #define ESP_BLE_MESH_MODEL_OP_GEN_MANUFACTURER_PROPERTY_GET ESP_BLE_MESH_MODEL_OP_2(0x82, 0x2B)
  1631. #define ESP_BLE_MESH_MODEL_OP_GEN_MANUFACTURER_PROPERTY_SET ESP_BLE_MESH_MODEL_OP_1(0x44)
  1632. #define ESP_BLE_MESH_MODEL_OP_GEN_MANUFACTURER_PROPERTY_SET_UNACK ESP_BLE_MESH_MODEL_OP_1(0x45)
  1633. #define ESP_BLE_MESH_MODEL_OP_GEN_MANUFACTURER_PROPERTY_STATUS ESP_BLE_MESH_MODEL_OP_1(0x46)
  1634. /*!< Generic Admin Property Message Opcode */
  1635. #define ESP_BLE_MESH_MODEL_OP_GEN_ADMIN_PROPERTIES_GET ESP_BLE_MESH_MODEL_OP_2(0x82, 0x2C)
  1636. #define ESP_BLE_MESH_MODEL_OP_GEN_ADMIN_PROPERTIES_STATUS ESP_BLE_MESH_MODEL_OP_1(0x47)
  1637. #define ESP_BLE_MESH_MODEL_OP_GEN_ADMIN_PROPERTY_GET ESP_BLE_MESH_MODEL_OP_2(0x82, 0x2D)
  1638. #define ESP_BLE_MESH_MODEL_OP_GEN_ADMIN_PROPERTY_SET ESP_BLE_MESH_MODEL_OP_1(0x48)
  1639. #define ESP_BLE_MESH_MODEL_OP_GEN_ADMIN_PROPERTY_SET_UNACK ESP_BLE_MESH_MODEL_OP_1(0x49)
  1640. #define ESP_BLE_MESH_MODEL_OP_GEN_ADMIN_PROPERTY_STATUS ESP_BLE_MESH_MODEL_OP_1(0x4A)
  1641. /*!< Generic User Property Message Opcode */
  1642. #define ESP_BLE_MESH_MODEL_OP_GEN_USER_PROPERTIES_GET ESP_BLE_MESH_MODEL_OP_2(0x82, 0x2E)
  1643. #define ESP_BLE_MESH_MODEL_OP_GEN_USER_PROPERTIES_STATUS ESP_BLE_MESH_MODEL_OP_1(0x4B)
  1644. #define ESP_BLE_MESH_MODEL_OP_GEN_USER_PROPERTY_GET ESP_BLE_MESH_MODEL_OP_2(0x82, 0x2F)
  1645. #define ESP_BLE_MESH_MODEL_OP_GEN_USER_PROPERTY_SET ESP_BLE_MESH_MODEL_OP_1(0x4C)
  1646. #define ESP_BLE_MESH_MODEL_OP_GEN_USER_PROPERTY_SET_UNACK ESP_BLE_MESH_MODEL_OP_1(0x4D)
  1647. #define ESP_BLE_MESH_MODEL_OP_GEN_USER_PROPERTY_STATUS ESP_BLE_MESH_MODEL_OP_1(0x4E)
  1648. /*!< Generic Client Property Message Opcode */
  1649. #define ESP_BLE_MESH_MODEL_OP_GEN_CLIENT_PROPERTIES_GET ESP_BLE_MESH_MODEL_OP_1(0x4F)
  1650. #define ESP_BLE_MESH_MODEL_OP_GEN_CLIENT_PROPERTIES_STATUS ESP_BLE_MESH_MODEL_OP_1(0x50)
  1651. /**
  1652. * esp_ble_mesh_sensor_message_opcode_t belongs to esp_ble_mesh_opcode_t, this typedef is
  1653. * only used to locate the opcodes used by functions esp_ble_mesh_sensor_client_get_state
  1654. * & esp_ble_mesh_sensor_client_set_state.
  1655. */
  1656. typedef uint32_t esp_ble_mesh_sensor_message_opcode_t;
  1657. /*!< Sensor Message Opcode */
  1658. #define ESP_BLE_MESH_MODEL_OP_SENSOR_DESCRIPTOR_GET ESP_BLE_MESH_MODEL_OP_2(0x82, 0x30)
  1659. #define ESP_BLE_MESH_MODEL_OP_SENSOR_DESCRIPTOR_STATUS ESP_BLE_MESH_MODEL_OP_1(0x51)
  1660. #define ESP_BLE_MESH_MODEL_OP_SENSOR_GET ESP_BLE_MESH_MODEL_OP_2(0x82, 0x31)
  1661. #define ESP_BLE_MESH_MODEL_OP_SENSOR_STATUS ESP_BLE_MESH_MODEL_OP_1(0x52)
  1662. #define ESP_BLE_MESH_MODEL_OP_SENSOR_COLUMN_GET ESP_BLE_MESH_MODEL_OP_2(0x82, 0x32)
  1663. #define ESP_BLE_MESH_MODEL_OP_SENSOR_COLUMN_STATUS ESP_BLE_MESH_MODEL_OP_1(0x53)
  1664. #define ESP_BLE_MESH_MODEL_OP_SENSOR_SERIES_GET ESP_BLE_MESH_MODEL_OP_2(0x82, 0x33)
  1665. #define ESP_BLE_MESH_MODEL_OP_SENSOR_SERIES_STATUS ESP_BLE_MESH_MODEL_OP_1(0x54)
  1666. /*!< Sensor Setup Message Opcode */
  1667. #define ESP_BLE_MESH_MODEL_OP_SENSOR_CADENCE_GET ESP_BLE_MESH_MODEL_OP_2(0x82, 0x34)
  1668. #define ESP_BLE_MESH_MODEL_OP_SENSOR_CADENCE_SET ESP_BLE_MESH_MODEL_OP_1(0x55)
  1669. #define ESP_BLE_MESH_MODEL_OP_SENSOR_CADENCE_SET_UNACK ESP_BLE_MESH_MODEL_OP_1(0x56)
  1670. #define ESP_BLE_MESH_MODEL_OP_SENSOR_CADENCE_STATUS ESP_BLE_MESH_MODEL_OP_1(0x57)
  1671. #define ESP_BLE_MESH_MODEL_OP_SENSOR_SETTINGS_GET ESP_BLE_MESH_MODEL_OP_2(0x82, 0x35)
  1672. #define ESP_BLE_MESH_MODEL_OP_SENSOR_SETTINGS_STATUS ESP_BLE_MESH_MODEL_OP_1(0x58)
  1673. #define ESP_BLE_MESH_MODEL_OP_SENSOR_SETTING_GET ESP_BLE_MESH_MODEL_OP_2(0x82, 0x36)
  1674. #define ESP_BLE_MESH_MODEL_OP_SENSOR_SETTING_SET ESP_BLE_MESH_MODEL_OP_1(0x59)
  1675. #define ESP_BLE_MESH_MODEL_OP_SENSOR_SETTING_SET_UNACK ESP_BLE_MESH_MODEL_OP_1(0x5A)
  1676. #define ESP_BLE_MESH_MODEL_OP_SENSOR_SETTING_STATUS ESP_BLE_MESH_MODEL_OP_1(0x5B)
  1677. /**
  1678. * esp_ble_mesh_time_scene_message_opcode_t belongs to esp_ble_mesh_opcode_t, this typedef is
  1679. * only used to locate the opcodes used by functions esp_ble_mesh_time_scene_client_get_state
  1680. * & esp_ble_mesh_time_scene_client_set_state.
  1681. */
  1682. typedef uint32_t esp_ble_mesh_time_scene_message_opcode_t;
  1683. /*!< Time Message Opcode */
  1684. #define ESP_BLE_MESH_MODEL_OP_TIME_GET ESP_BLE_MESH_MODEL_OP_2(0x82, 0x37)
  1685. #define ESP_BLE_MESH_MODEL_OP_TIME_SET ESP_BLE_MESH_MODEL_OP_1(0x5C)
  1686. #define ESP_BLE_MESH_MODEL_OP_TIME_STATUS ESP_BLE_MESH_MODEL_OP_1(0x5D)
  1687. #define ESP_BLE_MESH_MODEL_OP_TIME_ROLE_GET ESP_BLE_MESH_MODEL_OP_2(0x82, 0x38)
  1688. #define ESP_BLE_MESH_MODEL_OP_TIME_ROLE_SET ESP_BLE_MESH_MODEL_OP_2(0x82, 0x39)
  1689. #define ESP_BLE_MESH_MODEL_OP_TIME_ROLE_STATUS ESP_BLE_MESH_MODEL_OP_2(0x82, 0x3A)
  1690. #define ESP_BLE_MESH_MODEL_OP_TIME_ZONE_GET ESP_BLE_MESH_MODEL_OP_2(0x82, 0x3B)
  1691. #define ESP_BLE_MESH_MODEL_OP_TIME_ZONE_SET ESP_BLE_MESH_MODEL_OP_2(0x82, 0x3C)
  1692. #define ESP_BLE_MESH_MODEL_OP_TIME_ZONE_STATUS ESP_BLE_MESH_MODEL_OP_2(0x82, 0x3D)
  1693. #define ESP_BLE_MESH_MODEL_OP_TAI_UTC_DELTA_GET ESP_BLE_MESH_MODEL_OP_2(0x82, 0x3E)
  1694. #define ESP_BLE_MESH_MODEL_OP_TAI_UTC_DELTA_SET ESP_BLE_MESH_MODEL_OP_2(0x82, 0x3F)
  1695. #define ESP_BLE_MESH_MODEL_OP_TAI_UTC_DELTA_STATUS ESP_BLE_MESH_MODEL_OP_2(0x82, 0x40)
  1696. /*!< Scene Message Opcode */
  1697. #define ESP_BLE_MESH_MODEL_OP_SCENE_GET ESP_BLE_MESH_MODEL_OP_2(0x82, 0x41)
  1698. #define ESP_BLE_MESH_MODEL_OP_SCENE_RECALL ESP_BLE_MESH_MODEL_OP_2(0x82, 0x42)
  1699. #define ESP_BLE_MESH_MODEL_OP_SCENE_RECALL_UNACK ESP_BLE_MESH_MODEL_OP_2(0x82, 0x43)
  1700. #define ESP_BLE_MESH_MODEL_OP_SCENE_STATUS ESP_BLE_MESH_MODEL_OP_1(0x5E)
  1701. #define ESP_BLE_MESH_MODEL_OP_SCENE_REGISTER_GET ESP_BLE_MESH_MODEL_OP_2(0x82, 0x44)
  1702. #define ESP_BLE_MESH_MODEL_OP_SCENE_REGISTER_STATUS ESP_BLE_MESH_MODEL_OP_2(0x82, 0x45)
  1703. /*!< Scene Setup Message Opcode */
  1704. #define ESP_BLE_MESH_MODEL_OP_SCENE_STORE ESP_BLE_MESH_MODEL_OP_2(0x82, 0x46)
  1705. #define ESP_BLE_MESH_MODEL_OP_SCENE_STORE_UNACK ESP_BLE_MESH_MODEL_OP_2(0x82, 0x47)
  1706. #define ESP_BLE_MESH_MODEL_OP_SCENE_DELETE ESP_BLE_MESH_MODEL_OP_2(0x82, 0x9E)
  1707. #define ESP_BLE_MESH_MODEL_OP_SCENE_DELETE_UNACK ESP_BLE_MESH_MODEL_OP_2(0x82, 0x9F)
  1708. /*!< Scheduler Message Opcode */
  1709. #define ESP_BLE_MESH_MODEL_OP_SCHEDULER_ACT_GET ESP_BLE_MESH_MODEL_OP_2(0x82, 0x48)
  1710. #define ESP_BLE_MESH_MODEL_OP_SCHEDULER_ACT_STATUS ESP_BLE_MESH_MODEL_OP_1(0x5F)
  1711. #define ESP_BLE_MESH_MODEL_OP_SCHEDULER_GET ESP_BLE_MESH_MODEL_OP_2(0x82, 0x49)
  1712. #define ESP_BLE_MESH_MODEL_OP_SCHEDULER_STATUS ESP_BLE_MESH_MODEL_OP_2(0x82, 0x4A)
  1713. /*!< Scheduler Setup Message Opcode */
  1714. #define ESP_BLE_MESH_MODEL_OP_SCHEDULER_ACT_SET ESP_BLE_MESH_MODEL_OP_1(0x60)
  1715. #define ESP_BLE_MESH_MODEL_OP_SCHEDULER_ACT_SET_UNACK ESP_BLE_MESH_MODEL_OP_1(0x61)
  1716. /**
  1717. * esp_ble_mesh_light_message_opcode_t belongs to esp_ble_mesh_opcode_t, this typedef is
  1718. * only used to locate the opcodes used by functions esp_ble_mesh_light_client_get_state
  1719. * & esp_ble_mesh_light_client_set_state.
  1720. */
  1721. typedef uint32_t esp_ble_mesh_light_message_opcode_t;
  1722. /*!< Light Lightness Message Opcode */
  1723. #define ESP_BLE_MESH_MODEL_OP_LIGHT_LIGHTNESS_GET ESP_BLE_MESH_MODEL_OP_2(0x82, 0x4B)
  1724. #define ESP_BLE_MESH_MODEL_OP_LIGHT_LIGHTNESS_SET ESP_BLE_MESH_MODEL_OP_2(0x82, 0x4C)
  1725. #define ESP_BLE_MESH_MODEL_OP_LIGHT_LIGHTNESS_SET_UNACK ESP_BLE_MESH_MODEL_OP_2(0x82, 0x4D)
  1726. #define ESP_BLE_MESH_MODEL_OP_LIGHT_LIGHTNESS_STATUS ESP_BLE_MESH_MODEL_OP_2(0x82, 0x4E)
  1727. #define ESP_BLE_MESH_MODEL_OP_LIGHT_LIGHTNESS_LINEAR_GET ESP_BLE_MESH_MODEL_OP_2(0x82, 0x4F)
  1728. #define ESP_BLE_MESH_MODEL_OP_LIGHT_LIGHTNESS_LINEAR_SET ESP_BLE_MESH_MODEL_OP_2(0x82, 0x50)
  1729. #define ESP_BLE_MESH_MODEL_OP_LIGHT_LIGHTNESS_LINEAR_SET_UNACK ESP_BLE_MESH_MODEL_OP_2(0x82, 0x51)
  1730. #define ESP_BLE_MESH_MODEL_OP_LIGHT_LIGHTNESS_LINEAR_STATUS ESP_BLE_MESH_MODEL_OP_2(0x82, 0x52)
  1731. #define ESP_BLE_MESH_MODEL_OP_LIGHT_LIGHTNESS_LAST_GET ESP_BLE_MESH_MODEL_OP_2(0x82, 0x53)
  1732. #define ESP_BLE_MESH_MODEL_OP_LIGHT_LIGHTNESS_LAST_STATUS ESP_BLE_MESH_MODEL_OP_2(0x82, 0x54)
  1733. #define ESP_BLE_MESH_MODEL_OP_LIGHT_LIGHTNESS_DEFAULT_GET ESP_BLE_MESH_MODEL_OP_2(0x82, 0x55)
  1734. #define ESP_BLE_MESH_MODEL_OP_LIGHT_LIGHTNESS_DEFAULT_STATUS ESP_BLE_MESH_MODEL_OP_2(0x82, 0x56)
  1735. #define ESP_BLE_MESH_MODEL_OP_LIGHT_LIGHTNESS_RANGE_GET ESP_BLE_MESH_MODEL_OP_2(0x82, 0x57)
  1736. #define ESP_BLE_MESH_MODEL_OP_LIGHT_LIGHTNESS_RANGE_STATUS ESP_BLE_MESH_MODEL_OP_2(0x82, 0x58)
  1737. /*!< Light Lightness Setup Message Opcode */
  1738. #define ESP_BLE_MESH_MODEL_OP_LIGHT_LIGHTNESS_DEFAULT_SET ESP_BLE_MESH_MODEL_OP_2(0x82, 0x59)
  1739. #define ESP_BLE_MESH_MODEL_OP_LIGHT_LIGHTNESS_DEFAULT_SET_UNACK ESP_BLE_MESH_MODEL_OP_2(0x82, 0x5A)
  1740. #define ESP_BLE_MESH_MODEL_OP_LIGHT_LIGHTNESS_RANGE_SET ESP_BLE_MESH_MODEL_OP_2(0x82, 0x5B)
  1741. #define ESP_BLE_MESH_MODEL_OP_LIGHT_LIGHTNESS_RANGE_SET_UNACK ESP_BLE_MESH_MODEL_OP_2(0x82, 0x5C)
  1742. /*!< Light CTL Message Opcode */
  1743. #define ESP_BLE_MESH_MODEL_OP_LIGHT_CTL_GET ESP_BLE_MESH_MODEL_OP_2(0x82, 0x5D)
  1744. #define ESP_BLE_MESH_MODEL_OP_LIGHT_CTL_SET ESP_BLE_MESH_MODEL_OP_2(0x82, 0x5E)
  1745. #define ESP_BLE_MESH_MODEL_OP_LIGHT_CTL_SET_UNACK ESP_BLE_MESH_MODEL_OP_2(0x82, 0x5F)
  1746. #define ESP_BLE_MESH_MODEL_OP_LIGHT_CTL_STATUS ESP_BLE_MESH_MODEL_OP_2(0x82, 0x60)
  1747. #define ESP_BLE_MESH_MODEL_OP_LIGHT_CTL_TEMPERATURE_GET ESP_BLE_MESH_MODEL_OP_2(0x82, 0x61)
  1748. #define ESP_BLE_MESH_MODEL_OP_LIGHT_CTL_TEMPERATURE_RANGE_GET ESP_BLE_MESH_MODEL_OP_2(0x82, 0x62)
  1749. #define ESP_BLE_MESH_MODEL_OP_LIGHT_CTL_TEMPERATURE_RANGE_STATUS ESP_BLE_MESH_MODEL_OP_2(0x82, 0x63)
  1750. #define ESP_BLE_MESH_MODEL_OP_LIGHT_CTL_TEMPERATURE_SET ESP_BLE_MESH_MODEL_OP_2(0x82, 0x64)
  1751. #define ESP_BLE_MESH_MODEL_OP_LIGHT_CTL_TEMPERATURE_SET_UNACK ESP_BLE_MESH_MODEL_OP_2(0x82, 0x65)
  1752. #define ESP_BLE_MESH_MODEL_OP_LIGHT_CTL_TEMPERATURE_STATUS ESP_BLE_MESH_MODEL_OP_2(0x82, 0x66)
  1753. #define ESP_BLE_MESH_MODEL_OP_LIGHT_CTL_DEFAULT_GET ESP_BLE_MESH_MODEL_OP_2(0x82, 0x67)
  1754. #define ESP_BLE_MESH_MODEL_OP_LIGHT_CTL_DEFAULT_STATUS ESP_BLE_MESH_MODEL_OP_2(0x82, 0x68)
  1755. /*!< Light CTL Setup Message Opcode */
  1756. #define ESP_BLE_MESH_MODEL_OP_LIGHT_CTL_DEFAULT_SET ESP_BLE_MESH_MODEL_OP_2(0x82, 0x69)
  1757. #define ESP_BLE_MESH_MODEL_OP_LIGHT_CTL_DEFAULT_SET_UNACK ESP_BLE_MESH_MODEL_OP_2(0x82, 0x6A)
  1758. #define ESP_BLE_MESH_MODEL_OP_LIGHT_CTL_TEMPERATURE_RANGE_SET ESP_BLE_MESH_MODEL_OP_2(0x82, 0x6B)
  1759. #define ESP_BLE_MESH_MODEL_OP_LIGHT_CTL_TEMPERATURE_RANGE_SET_UNACK ESP_BLE_MESH_MODEL_OP_2(0x82, 0x6C)
  1760. /*!< Light HSL Message Opcode */
  1761. #define ESP_BLE_MESH_MODEL_OP_LIGHT_HSL_GET ESP_BLE_MESH_MODEL_OP_2(0x82, 0x6D)
  1762. #define ESP_BLE_MESH_MODEL_OP_LIGHT_HSL_HUE_GET ESP_BLE_MESH_MODEL_OP_2(0x82, 0x6E)
  1763. #define ESP_BLE_MESH_MODEL_OP_LIGHT_HSL_HUE_SET ESP_BLE_MESH_MODEL_OP_2(0x82, 0x6F)
  1764. #define ESP_BLE_MESH_MODEL_OP_LIGHT_HSL_HUE_SET_UNACK ESP_BLE_MESH_MODEL_OP_2(0x82, 0x70)
  1765. #define ESP_BLE_MESH_MODEL_OP_LIGHT_HSL_HUE_STATUS ESP_BLE_MESH_MODEL_OP_2(0x82, 0x71)
  1766. #define ESP_BLE_MESH_MODEL_OP_LIGHT_HSL_SATURATION_GET ESP_BLE_MESH_MODEL_OP_2(0x82, 0x72)
  1767. #define ESP_BLE_MESH_MODEL_OP_LIGHT_HSL_SATURATION_SET ESP_BLE_MESH_MODEL_OP_2(0x82, 0x73)
  1768. #define ESP_BLE_MESH_MODEL_OP_LIGHT_HSL_SATURATION_SET_UNACK ESP_BLE_MESH_MODEL_OP_2(0x82, 0x74)
  1769. #define ESP_BLE_MESH_MODEL_OP_LIGHT_HSL_SATURATION_STATUS ESP_BLE_MESH_MODEL_OP_2(0x82, 0x75)
  1770. #define ESP_BLE_MESH_MODEL_OP_LIGHT_HSL_SET ESP_BLE_MESH_MODEL_OP_2(0x82, 0x76)
  1771. #define ESP_BLE_MESH_MODEL_OP_LIGHT_HSL_SET_UNACK ESP_BLE_MESH_MODEL_OP_2(0x82, 0x77)
  1772. #define ESP_BLE_MESH_MODEL_OP_LIGHT_HSL_STATUS ESP_BLE_MESH_MODEL_OP_2(0x82, 0x78)
  1773. #define ESP_BLE_MESH_MODEL_OP_LIGHT_HSL_TARGET_GET ESP_BLE_MESH_MODEL_OP_2(0x82, 0x79)
  1774. #define ESP_BLE_MESH_MODEL_OP_LIGHT_HSL_TARGET_STATUS ESP_BLE_MESH_MODEL_OP_2(0x82, 0x7A)
  1775. #define ESP_BLE_MESH_MODEL_OP_LIGHT_HSL_DEFAULT_GET ESP_BLE_MESH_MODEL_OP_2(0x82, 0x7B)
  1776. #define ESP_BLE_MESH_MODEL_OP_LIGHT_HSL_DEFAULT_STATUS ESP_BLE_MESH_MODEL_OP_2(0x82, 0x7C)
  1777. #define ESP_BLE_MESH_MODEL_OP_LIGHT_HSL_RANGE_GET ESP_BLE_MESH_MODEL_OP_2(0x82, 0x7D)
  1778. #define ESP_BLE_MESH_MODEL_OP_LIGHT_HSL_RANGE_STATUS ESP_BLE_MESH_MODEL_OP_2(0x82, 0x7E)
  1779. /*!< Light HSL Setup Message Opcode */
  1780. #define ESP_BLE_MESH_MODEL_OP_LIGHT_HSL_DEFAULT_SET ESP_BLE_MESH_MODEL_OP_2(0x82, 0x7F)
  1781. #define ESP_BLE_MESH_MODEL_OP_LIGHT_HSL_DEFAULT_SET_UNACK ESP_BLE_MESH_MODEL_OP_2(0x82, 0x80)
  1782. #define ESP_BLE_MESH_MODEL_OP_LIGHT_HSL_RANGE_SET ESP_BLE_MESH_MODEL_OP_2(0x82, 0x81)
  1783. #define ESP_BLE_MESH_MODEL_OP_LIGHT_HSL_RANGE_SET_UNACK ESP_BLE_MESH_MODEL_OP_2(0x82, 0x82)
  1784. /*!< Light xyL Message Opcode */
  1785. #define ESP_BLE_MESH_MODEL_OP_LIGHT_XYL_GET ESP_BLE_MESH_MODEL_OP_2(0x82, 0x83)
  1786. #define ESP_BLE_MESH_MODEL_OP_LIGHT_XYL_SET ESP_BLE_MESH_MODEL_OP_2(0x82, 0x84)
  1787. #define ESP_BLE_MESH_MODEL_OP_LIGHT_XYL_SET_UNACK ESP_BLE_MESH_MODEL_OP_2(0x82, 0x85)
  1788. #define ESP_BLE_MESH_MODEL_OP_LIGHT_XYL_STATUS ESP_BLE_MESH_MODEL_OP_2(0x82, 0x86)
  1789. #define ESP_BLE_MESH_MODEL_OP_LIGHT_XYL_TARGET_GET ESP_BLE_MESH_MODEL_OP_2(0x82, 0x87)
  1790. #define ESP_BLE_MESH_MODEL_OP_LIGHT_XYL_TARGET_STATUS ESP_BLE_MESH_MODEL_OP_2(0x82, 0x88)
  1791. #define ESP_BLE_MESH_MODEL_OP_LIGHT_XYL_DEFAULT_GET ESP_BLE_MESH_MODEL_OP_2(0x82, 0x89)
  1792. #define ESP_BLE_MESH_MODEL_OP_LIGHT_XYL_DEFAULT_STATUS ESP_BLE_MESH_MODEL_OP_2(0x82, 0x8A)
  1793. #define ESP_BLE_MESH_MODEL_OP_LIGHT_XYL_RANGE_GET ESP_BLE_MESH_MODEL_OP_2(0x82, 0x8B)
  1794. #define ESP_BLE_MESH_MODEL_OP_LIGHT_XYL_RANGE_STATUS ESP_BLE_MESH_MODEL_OP_2(0x82, 0x8C)
  1795. /*!< Light xyL Setup Message Opcode */
  1796. #define ESP_BLE_MESH_MODEL_OP_LIGHT_XYL_DEFAULT_SET ESP_BLE_MESH_MODEL_OP_2(0x82, 0x8D)
  1797. #define ESP_BLE_MESH_MODEL_OP_LIGHT_XYL_DEFAULT_SET_UNACK ESP_BLE_MESH_MODEL_OP_2(0x82, 0x8E)
  1798. #define ESP_BLE_MESH_MODEL_OP_LIGHT_XYL_RANGE_SET ESP_BLE_MESH_MODEL_OP_2(0x82, 0x8F)
  1799. #define ESP_BLE_MESH_MODEL_OP_LIGHT_XYL_RANGE_SET_UNACK ESP_BLE_MESH_MODEL_OP_2(0x82, 0x90)
  1800. /*!< Light Control Message Opcode */
  1801. #define ESP_BLE_MESH_MODEL_OP_LIGHT_LC_MODE_GET ESP_BLE_MESH_MODEL_OP_2(0x82, 0x91)
  1802. #define ESP_BLE_MESH_MODEL_OP_LIGHT_LC_MODE_SET ESP_BLE_MESH_MODEL_OP_2(0x82, 0x92)
  1803. #define ESP_BLE_MESH_MODEL_OP_LIGHT_LC_MODE_SET_UNACK ESP_BLE_MESH_MODEL_OP_2(0x82, 0x93)
  1804. #define ESP_BLE_MESH_MODEL_OP_LIGHT_LC_MODE_STATUS ESP_BLE_MESH_MODEL_OP_2(0x82, 0x94)
  1805. #define ESP_BLE_MESH_MODEL_OP_LIGHT_LC_OM_GET ESP_BLE_MESH_MODEL_OP_2(0x82, 0x95)
  1806. #define ESP_BLE_MESH_MODEL_OP_LIGHT_LC_OM_SET ESP_BLE_MESH_MODEL_OP_2(0x82, 0x96)
  1807. #define ESP_BLE_MESH_MODEL_OP_LIGHT_LC_OM_SET_UNACK ESP_BLE_MESH_MODEL_OP_2(0x82, 0x97)
  1808. #define ESP_BLE_MESH_MODEL_OP_LIGHT_LC_OM_STATUS ESP_BLE_MESH_MODEL_OP_2(0x82, 0x98)
  1809. #define ESP_BLE_MESH_MODEL_OP_LIGHT_LC_LIGHT_ONOFF_GET ESP_BLE_MESH_MODEL_OP_2(0x82, 0x99)
  1810. #define ESP_BLE_MESH_MODEL_OP_LIGHT_LC_LIGHT_ONOFF_SET ESP_BLE_MESH_MODEL_OP_2(0x82, 0x9A)
  1811. #define ESP_BLE_MESH_MODEL_OP_LIGHT_LC_LIGHT_ONOFF_SET_UNACK ESP_BLE_MESH_MODEL_OP_2(0x82, 0x9B)
  1812. #define ESP_BLE_MESH_MODEL_OP_LIGHT_LC_LIGHT_ONOFF_STATUS ESP_BLE_MESH_MODEL_OP_2(0x82, 0x9C)
  1813. #define ESP_BLE_MESH_MODEL_OP_LIGHT_LC_PROPERTY_GET ESP_BLE_MESH_MODEL_OP_2(0x82, 0x9D)
  1814. #define ESP_BLE_MESH_MODEL_OP_LIGHT_LC_PROPERTY_SET ESP_BLE_MESH_MODEL_OP_1(0x62)
  1815. #define ESP_BLE_MESH_MODEL_OP_LIGHT_LC_PROPERTY_SET_UNACK ESP_BLE_MESH_MODEL_OP_1(0x63)
  1816. #define ESP_BLE_MESH_MODEL_OP_LIGHT_LC_PROPERTY_STATUS ESP_BLE_MESH_MODEL_OP_1(0x64)
  1817. typedef uint32_t esp_ble_mesh_opcode_t;
  1818. /*!< End of defines of esp_ble_mesh_opcode_t */
  1819. /**
  1820. * This typedef is only used to indicate the status code contained in some of the
  1821. * server models (e.g. Generic Server Model) status message.
  1822. */
  1823. typedef uint8_t esp_ble_mesh_model_status_t;
  1824. #define ESP_BLE_MESH_MODEL_STATUS_SUCCESS 0x00
  1825. #define ESP_BLE_MESH_MODEL_STATUS_CANNOT_SET_RANGE_MIN 0x01
  1826. #define ESP_BLE_MESH_MODEL_STATUS_CANNOT_SET_RANGE_MAX 0x02
  1827. /**
  1828. * @brief BLE Mesh client models related definitions
  1829. */
  1830. /** Client model Get/Set message opcode and corresponding Status message opcode */
  1831. typedef struct {
  1832. uint32_t cli_op; /*!< The client message opcode */
  1833. uint32_t status_op; /*!< The server status opcode corresponding to the client message opcode */
  1834. } esp_ble_mesh_client_op_pair_t;
  1835. /** Client Model user data context. */
  1836. typedef struct {
  1837. esp_ble_mesh_model_t *model; /*!< Pointer to the client model. Initialized by the stack. */
  1838. int op_pair_size; /*!< Size of the op_pair */
  1839. const esp_ble_mesh_client_op_pair_t *op_pair; /*!< Table containing get/set message opcode and corresponding status message opcode */
  1840. uint32_t publish_status; /*!< Callback used to handle the received unsolicited message. Initialized by the stack. */
  1841. void *internal_data; /*!< Pointer to the internal data of client model */
  1842. uint8_t msg_role; /*!< Role of the device (Node/Provisioner) that is going to send messages */
  1843. } esp_ble_mesh_client_t;
  1844. /** Common parameters of the messages sent by Client Model. */
  1845. typedef struct {
  1846. esp_ble_mesh_opcode_t opcode; /*!< Message opcode */
  1847. esp_ble_mesh_model_t *model; /*!< Pointer to the client model structure */
  1848. esp_ble_mesh_msg_ctx_t ctx; /*!< The context used to send message */
  1849. int32_t msg_timeout; /*!< Timeout value (ms) to get response to the sent message */
  1850. /*!< Note: if using default timeout value in menuconfig, make sure to set this value to 0 */
  1851. uint8_t msg_role; /*!< Role of the device - Node/Provisioner */
  1852. } esp_ble_mesh_client_common_param_t;
  1853. /**
  1854. * @brief BLE Mesh server models related definitions
  1855. */
  1856. /** This enum value is the flag of transition timer operation */
  1857. enum {
  1858. ESP_BLE_MESH_SERVER_TRANS_TIMER_START, /* Proper transition timer has been started */
  1859. ESP_BLE_MESH_SERVER_FLAG_MAX,
  1860. };
  1861. /** Parameters of the server model state transition */
  1862. typedef struct {
  1863. bool just_started; /*!< Indicate if the state transition has just started */
  1864. uint8_t trans_time; /*!< State transition time */
  1865. uint8_t remain_time; /*!< Remaining time of state transition */
  1866. uint8_t delay; /*!< Delay before starting state transition */
  1867. uint32_t quo_tt; /*!< Duration of each divided transition step */
  1868. uint32_t counter; /*!< Number of steps which the transition duration is divided */
  1869. uint32_t total_duration; /*!< State transition total duration */
  1870. int64_t start_timestamp; /*!< Time when the state transition is started */
  1871. /**
  1872. * Flag used to indicate if the transition timer has been started internally.
  1873. *
  1874. * If the model which contains esp_ble_mesh_state_transition_t sets "set_auto_rsp"
  1875. * to ESP_BLE_MESH_SERVER_RSP_BY_APP, the handler of the timer shall be initialized
  1876. * by the users.
  1877. *
  1878. * And users can use this flag to indicate whether the timer is started or not.
  1879. */
  1880. BLE_MESH_ATOMIC_DEFINE(flag, ESP_BLE_MESH_SERVER_FLAG_MAX);
  1881. struct k_delayed_work timer; /*!< Timer used for state transition */
  1882. } esp_ble_mesh_state_transition_t;
  1883. /** Parameters of the server model received last same set message. */
  1884. typedef struct {
  1885. uint8_t tid; /*!< Transaction number of the last message */
  1886. uint16_t src; /*!< Source address of the last message */
  1887. uint16_t dst; /*!< Destination address of the last message */
  1888. int64_t timestamp; /*!< Time when the last message is received */
  1889. } esp_ble_mesh_last_msg_info_t;
  1890. #define ESP_BLE_MESH_SERVER_RSP_BY_APP 0 /*!< Response need to be sent in the application */
  1891. #define ESP_BLE_MESH_SERVER_AUTO_RSP 1 /*!< Response will be sent internally */
  1892. /** Parameters of the Server Model response control */
  1893. typedef struct {
  1894. /**
  1895. * @brief BLE Mesh Server Response Option
  1896. * 1. If get_auto_rsp is set to ESP_BLE_MESH_SERVER_RSP_BY_APP, then the
  1897. * response of Client Get messages need to be replied by the application;
  1898. * 2. If get_auto_rsp is set to ESP_BLE_MESH_SERVER_AUTO_RSP, then the
  1899. * response of Client Get messages will be replied by the server models;
  1900. * 3. If set_auto_rsp is set to ESP_BLE_MESH_SERVER_RSP_BY_APP, then the
  1901. * response of Client Set messages need to be replied by the application;
  1902. * 4. If set_auto_rsp is set to ESP_BLE_MESH_SERVER_AUTO_RSP, then the
  1903. * response of Client Set messages will be replied by the server models;
  1904. * 5. If status_auto_rsp is set to ESP_BLE_MESH_SERVER_RSP_BY_APP, then the
  1905. * response of Server Status messages need to be replied by the application;
  1906. * 6. If status_auto_rsp is set to ESP_BLE_MESH_SERVER_AUTO_RSP, then the
  1907. * response of Server Status messages will be replied by the server models;
  1908. */
  1909. uint8_t get_auto_rsp : 1, /*!< Response control for Client Get messages */
  1910. set_auto_rsp : 1, /*!< Response control for Client Set messages */
  1911. status_auto_rsp : 1; /*!< Response control for Server Status messages */
  1912. } esp_ble_mesh_server_rsp_ctrl_t;
  1913. /**
  1914. * @brief Server model state value union
  1915. */
  1916. typedef union {
  1917. struct {
  1918. uint8_t onoff; /*!< The value of the Generic OnOff state */
  1919. } gen_onoff; /*!< The Generic OnOff state */
  1920. struct {
  1921. int16_t level; /*!< The value of the Generic Level state */
  1922. } gen_level; /*!< The Generic Level state */
  1923. struct {
  1924. uint8_t onpowerup; /*!< The value of the Generic OnPowerUp state */
  1925. } gen_onpowerup; /*!< The Generic OnPowerUp state */
  1926. struct {
  1927. uint16_t power; /*!< The value of the Generic Power Actual state */
  1928. } gen_power_actual; /*!< The Generic Power Actual state */
  1929. struct {
  1930. uint16_t lightness; /*!< The value of the Light Lightness Actual state */
  1931. } light_lightness_actual; /*!< The Light Lightness Actual state */
  1932. struct {
  1933. uint16_t lightness; /*!< The value of the Light Lightness Linear state */
  1934. } light_lightness_linear; /*!< The Light Lightness Linear state */
  1935. struct {
  1936. uint16_t lightness; /*!< The value of the Light CTL Lightness state */
  1937. } light_ctl_lightness; /*!< The Light CTL Lightness state */
  1938. struct {
  1939. uint16_t temperature; /*!< The value of the Light CTL Temperature state */
  1940. int16_t delta_uv; /*!< The value of the Light CTL Delta UV state */
  1941. } light_ctl_temp_delta_uv; /*!< The Light CTL Temperature & Delta UV states */
  1942. struct {
  1943. uint16_t lightness; /*!< The value of the Light HSL Lightness state */
  1944. uint16_t hue; /*!< The value of the Light HSL Hue state */
  1945. uint16_t saturation; /*!< The value of the Light HSL Saturation state */
  1946. } light_hsl; /*!< The Light HSL composite state */
  1947. struct {
  1948. uint16_t lightness; /*!< The value of the Light HSL Lightness state */
  1949. } light_hsl_lightness; /*!< The Light HSL Lightness state */
  1950. struct {
  1951. uint16_t hue; /*!< The value of the Light HSL Hue state */
  1952. } light_hsl_hue; /*!< The Light HSL Hue state */
  1953. struct {
  1954. uint16_t saturation; /*!< The value of the Light HSL Saturation state */
  1955. } light_hsl_saturation; /*!< The Light HSL Saturation state */
  1956. struct {
  1957. uint16_t lightness; /*!< The value of the Light xyL Lightness state */
  1958. } light_xyl_lightness; /*!< The Light xyL Lightness state */
  1959. struct {
  1960. uint8_t onoff; /*!< The value of the Light LC Light OnOff state */
  1961. } light_lc_light_onoff; /*!< The Light LC Light OnOff state */
  1962. } esp_ble_mesh_server_state_value_t;
  1963. /** This enum value is the type of server model states */
  1964. typedef enum {
  1965. ESP_BLE_MESH_GENERIC_ONOFF_STATE,
  1966. ESP_BLE_MESH_GENERIC_LEVEL_STATE,
  1967. ESP_BLE_MESH_GENERIC_ONPOWERUP_STATE,
  1968. ESP_BLE_MESH_GENERIC_POWER_ACTUAL_STATE,
  1969. ESP_BLE_MESH_LIGHT_LIGHTNESS_ACTUAL_STATE,
  1970. ESP_BLE_MESH_LIGHT_LIGHTNESS_LINEAR_STATE,
  1971. ESP_BLE_MESH_LIGHT_CTL_LIGHTNESS_STATE,
  1972. ESP_BLE_MESH_LIGHT_CTL_TEMP_DELTA_UV_STATE,
  1973. ESP_BLE_MESH_LIGHT_HSL_STATE,
  1974. ESP_BLE_MESH_LIGHT_HSL_LIGHTNESS_STATE,
  1975. ESP_BLE_MESH_LIGHT_HSL_HUE_STATE,
  1976. ESP_BLE_MESH_LIGHT_HSL_SATURATION_STATE,
  1977. ESP_BLE_MESH_LIGHT_XYL_LIGHTNESS_STATE,
  1978. ESP_BLE_MESH_LIGHT_LC_LIGHT_ONOFF_STATE,
  1979. ESP_BLE_MESH_SERVER_MODEL_STATE_MAX,
  1980. } esp_ble_mesh_server_state_type_t;
  1981. /*!< This enum value is the event of undefined SIG models and vendor models */
  1982. typedef enum {
  1983. ESP_BLE_MESH_MODEL_OPERATION_EVT, /*!< User-defined models receive messages from peer devices (e.g. get, set, status, etc) event */
  1984. ESP_BLE_MESH_MODEL_SEND_COMP_EVT, /*!< User-defined models send messages completion event */
  1985. ESP_BLE_MESH_MODEL_PUBLISH_COMP_EVT, /*!< User-defined models publish messages completion event */
  1986. ESP_BLE_MESH_CLIENT_MODEL_RECV_PUBLISH_MSG_EVT, /*!< User-defined client models receive publish messages event */
  1987. ESP_BLE_MESH_CLIENT_MODEL_SEND_TIMEOUT_EVT, /*!< Timeout event for the user-defined client models that failed to receive response from peer server models */
  1988. ESP_BLE_MESH_MODEL_PUBLISH_UPDATE_EVT, /*!< When a model is configured to publish messages periodically, this event will occur during every publish period */
  1989. ESP_BLE_MESH_SERVER_MODEL_UPDATE_STATE_COMP_EVT, /*!< Server models update state value completion event */
  1990. ESP_BLE_MESH_MODEL_EVT_MAX,
  1991. } esp_ble_mesh_model_cb_event_t;
  1992. /**
  1993. * @brief BLE Mesh model callback parameters union
  1994. */
  1995. typedef union {
  1996. /**
  1997. * @brief ESP_BLE_MESH_MODEL_OPERATION_EVT
  1998. */
  1999. struct ble_mesh_model_operation_evt_param {
  2000. uint32_t opcode; /*!< Opcode of the received message */
  2001. esp_ble_mesh_model_t *model; /*!< Pointer to the model which receives the message */
  2002. esp_ble_mesh_msg_ctx_t *ctx; /*!< Pointer to the context of the received message */
  2003. uint16_t length; /*!< Length of the received message */
  2004. uint8_t *msg; /*!< Value of the received message */
  2005. } model_operation; /*!< Event parameter of ESP_BLE_MESH_MODEL_OPERATION_EVT */
  2006. /**
  2007. * @brief ESP_BLE_MESH_MODEL_SEND_COMP_EVT
  2008. */
  2009. struct ble_mesh_model_send_comp_param {
  2010. int err_code; /*!< Indicate the result of sending a message */
  2011. uint32_t opcode; /*!< Opcode of the message */
  2012. esp_ble_mesh_model_t *model; /*!< Pointer to the model which sends the message */
  2013. esp_ble_mesh_msg_ctx_t *ctx; /*!< Context of the message */
  2014. } model_send_comp; /*!< Event parameter of ESP_BLE_MESH_MODEL_SEND_COMP_EVT */
  2015. /**
  2016. * @brief ESP_BLE_MESH_MODEL_PUBLISH_COMP_EVT
  2017. */
  2018. struct ble_mesh_model_publish_comp_param {
  2019. int err_code; /*!< Indicate the result of publishing a message */
  2020. esp_ble_mesh_model_t *model; /*!< Pointer to the model which publishes the message */
  2021. } model_publish_comp; /*!< Event parameter of ESP_BLE_MESH_MODEL_PUBLISH_COMP_EVT */
  2022. /**
  2023. * @brief ESP_BLE_MESH_CLIENT_MODEL_RECV_PUBLISH_MSG_EVT
  2024. */
  2025. struct ble_mesh_mod_recv_publish_msg_param {
  2026. uint32_t opcode; /*!< Opcode of the unsolicited received message */
  2027. esp_ble_mesh_model_t *model; /*!< Pointer to the model which receives the message */
  2028. esp_ble_mesh_msg_ctx_t *ctx; /*!< Pointer to the context of the message */
  2029. uint16_t length; /*!< Length of the received message */
  2030. uint8_t *msg; /*!< Value of the received message */
  2031. } client_recv_publish_msg; /*!< Event parameter of ESP_BLE_MESH_CLIENT_MODEL_RECV_PUBLISH_MSG_EVT */
  2032. /**
  2033. * @brief ESP_BLE_MESH_CLIENT_MODEL_SEND_TIMEOUT_EVT
  2034. */
  2035. struct ble_mesh_client_model_send_timeout_param {
  2036. uint32_t opcode; /*!< Opcode of the previously sent message */
  2037. esp_ble_mesh_model_t *model; /*!< Pointer to the model which sends the previous message */
  2038. esp_ble_mesh_msg_ctx_t *ctx; /*!< Pointer to the context of the previous message */
  2039. } client_send_timeout; /*!< Event parameter of ESP_BLE_MESH_CLIENT_MODEL_SEND_TIMEOUT_EVT */
  2040. /**
  2041. * @brief ESP_BLE_MESH_MODEL_PUBLISH_UPDATE_EVT
  2042. */
  2043. struct ble_mesh_model_publish_update_evt_param {
  2044. esp_ble_mesh_model_t *model; /*!< Pointer to the model which is going to update its publish message */
  2045. } model_publish_update; /*!< Event parameter of ESP_BLE_MESH_MODEL_PUBLISH_UPDATE_EVT */
  2046. /**
  2047. * @brief ESP_BLE_MESH_SERVER_MODEL_UPDATE_STATE_COMP_EVT
  2048. */
  2049. struct ble_mesh_server_model_update_state_comp_param {
  2050. int err_code; /*!< Indicate the result of updating server model state */
  2051. esp_ble_mesh_model_t *model; /*!< Pointer to the server model which state value is updated */
  2052. esp_ble_mesh_server_state_type_t type; /*!< Type of the updated server state */
  2053. } server_model_update_state; /*!< Event parameter of ESP_BLE_MESH_SERVER_MODEL_UPDATE_STATE_COMP_EVT */
  2054. } esp_ble_mesh_model_cb_param_t;
  2055. #ifdef __cplusplus
  2056. }
  2057. #endif
  2058. #endif /* _ESP_BLE_MESH_DEFS_H_ */