ble_hs_id.rst 3.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445
  1. NimBLE Host Identity Reference
  2. ------------------------------
  3. Introduction
  4. ~~~~~~~~~~~~
  5. The identity API provides facilities for querying and configuring your device's addresses. BLE's addressing scheme is
  6. quite involved; the summary that follows is only a brief introduction.
  7. BLE defines four address types:
  8. +---------------------------------+---------------------------------------------------------------------------------------------------+-------------+----------------------------------------------+
  9. | Type | Description | Identity? | Configured with |
  10. +=================================+===================================================================================================+=============+==============================================+
  11. | Public | Address assigned by manufacturer; the three most significant bytes form the manufacturer's OUI. | Yes | N/A; read from controller at startup. |
  12. +---------------------------------+---------------------------------------------------------------------------------------------------+-------------+----------------------------------------------+
  13. | Static random | Randomly generated address. | Yes | *ble_hs_id_set_rnd()* |
  14. +---------------------------------+---------------------------------------------------------------------------------------------------+-------------+----------------------------------------------+
  15. | Resolvable private (RPA) | Address randomly generated from an identity address and an identity resolving key (IRK). | No | N/A; generated by controller periodically. |
  16. +---------------------------------+---------------------------------------------------------------------------------------------------+-------------+----------------------------------------------+
  17. | Non-resolvable private (NRPA) | Randomly generated address. | No | *ble_hs_id_set_rnd()* |
  18. +---------------------------------+---------------------------------------------------------------------------------------------------+-------------+----------------------------------------------+
  19. Identity Addresses
  20. ^^^^^^^^^^^^^^^^^^
  21. The third column in the above table indicates the *identity* property of each address type. An identity address never
  22. changes, and a device can be identified by one of its unique identity addresses.
  23. Non-identity addresses are used by devices supporting BLE privacy. A device using the privacy feature frequently changes
  24. its own address to a newly-generated non-identity address. By cycling its address, the device makes it impossible for
  25. eavesdroppers to track its location.
  26. A device can have up to two identity addresses at once: one public and one static random. As indicated in the above table,
  27. the public identity address cannot be configured; the static random identity address can be set by calling *ble_hs_id_set_rnd()*.
  28. The address type is selected on a per-GAP-procedure basis. Each time you initiate a GAP procedure, you indicate which
  29. address type the device should use for the duration of the procedure.
  30. Header
  31. ~~~~~~
  32. .. code-block:: cpp
  33. #include "host/ble_hs.h"