esp_ble_mesh_defs.h 132 KB

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