proxy.h 1.8 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374
  1. /** @file
  2. * @brief Proxy APIs.
  3. */
  4. /*
  5. * Copyright (c) 2017 Intel Corporation
  6. *
  7. * SPDX-License-Identifier: Apache-2.0
  8. */
  9. #ifndef ZEPHYR_INCLUDE_BLUETOOTH_MESH_PROXY_H_
  10. #define ZEPHYR_INCLUDE_BLUETOOTH_MESH_PROXY_H_
  11. /**
  12. * @brief Proxy
  13. * @defgroup bt_mesh_proxy Proxy
  14. * @ingroup bt_mesh
  15. * @{
  16. */
  17. #ifdef __cplusplus
  18. extern "C" {
  19. #endif
  20. /** Callbacks for the Proxy feature.
  21. *
  22. * Should be instantiated with @ref BT_MESH_PROXY_CB_DEFINE.
  23. */
  24. struct bt_mesh_proxy_cb {
  25. /** @brief Started sending Node Identity beacons on the given subnet.
  26. *
  27. * @param net_idx Network index the Node Identity beacons are running
  28. * on.
  29. */
  30. void (*identity_enabled)(uint16_t net_idx);
  31. /** @brief Stopped sending Node Identity beacons on the given subnet.
  32. *
  33. * @param net_idx Network index the Node Identity beacons were running
  34. * on.
  35. */
  36. void (*identity_disabled)(uint16_t net_idx);
  37. };
  38. /** @def BT_MESH_PROXY_CB_DEFINE
  39. *
  40. * @brief Register a callback structure for Proxy events.
  41. *
  42. * Registers a structure with callback functions that gets called on various
  43. * Proxy events.
  44. *
  45. * @param _name Name of callback structure.
  46. */
  47. #define BT_MESH_PROXY_CB_DEFINE(_name) \
  48. static const STRUCT_SECTION_ITERABLE( \
  49. bt_mesh_proxy_cb, _CONCAT(bt_mesh_proxy_cb_, _name))
  50. /** @brief Enable advertising with Node Identity.
  51. *
  52. * This API requires that GATT Proxy support has been enabled. Once called
  53. * each subnet will start advertising using Node Identity for the next
  54. * 60 seconds.
  55. *
  56. * @return 0 on success, or (negative) error code on failure.
  57. */
  58. int bt_mesh_proxy_identity_enable(void);
  59. #ifdef __cplusplus
  60. }
  61. #endif
  62. /**
  63. * @}
  64. */
  65. #endif /* ZEPHYR_INCLUDE_BLUETOOTH_MESH_PROXY_H_ */