access.h 2.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081
  1. /* Bluetooth Mesh */
  2. /*
  3. * SPDX-FileCopyrightText: 2017 Intel Corporation
  4. *
  5. * SPDX-License-Identifier: Apache-2.0
  6. */
  7. #ifndef _ACCESS_H_
  8. #define _ACCESS_H_
  9. #include "net.h"
  10. #ifdef __cplusplus
  11. extern "C" {
  12. #endif
  13. /* bt_mesh_model.flags */
  14. enum {
  15. BLE_MESH_MOD_BIND_PENDING = BIT(0),
  16. BLE_MESH_MOD_SUB_PENDING = BIT(1),
  17. BLE_MESH_MOD_PUB_PENDING = BIT(2),
  18. };
  19. void bt_mesh_elem_register(struct bt_mesh_elem *elem, uint8_t count);
  20. uint8_t bt_mesh_elem_count(void);
  21. /* Find local element based on unicast or group address */
  22. struct bt_mesh_elem *bt_mesh_elem_find(uint16_t addr);
  23. uint16_t *bt_mesh_model_find_group(struct bt_mesh_model *mod, uint16_t addr);
  24. int bt_mesh_get_opcode(struct net_buf_simple *buf,
  25. uint32_t *opcode, bool pull_buf);
  26. bool bt_mesh_fixed_group_match(uint16_t addr);
  27. bool bt_mesh_fixed_direct_match(struct bt_mesh_subnet *sub, uint16_t addr);
  28. void bt_mesh_model_foreach(void (*func)(struct bt_mesh_model *mod,
  29. struct bt_mesh_elem *elem,
  30. bool vnd, bool primary,
  31. void *user_data),
  32. void *user_data);
  33. int32_t bt_mesh_model_pub_period_get(struct bt_mesh_model *mod);
  34. void bt_mesh_comp_provision(uint16_t addr);
  35. void bt_mesh_comp_unprovision(void);
  36. uint16_t bt_mesh_primary_addr(void);
  37. const struct bt_mesh_comp *bt_mesh_comp_get(void);
  38. struct bt_mesh_model *bt_mesh_model_get(bool vnd, uint8_t elem_idx, uint8_t mod_idx);
  39. void bt_mesh_model_recv(struct bt_mesh_net_rx *rx, struct net_buf_simple *buf);
  40. int bt_mesh_comp_register(const struct bt_mesh_comp *comp);
  41. int bt_mesh_comp_deregister(void);
  42. const uint8_t *bt_mesh_dev_key_get(uint16_t dst);
  43. size_t bt_mesh_rx_netkey_size(void);
  44. struct bt_mesh_subnet *bt_mesh_rx_netkey_get(size_t index);
  45. size_t bt_mesh_rx_devkey_size(void);
  46. const uint8_t *bt_mesh_rx_devkey_get(size_t index, uint16_t src);
  47. size_t bt_mesh_rx_appkey_size(void);
  48. struct bt_mesh_app_key *bt_mesh_rx_appkey_get(size_t index);
  49. #ifdef __cplusplus
  50. }
  51. #endif
  52. #endif /* _ACCESS_H_ */