Bluetooth: GATT: Use enum to declare permissions

This makes it easier to document and more aligned to other parts of the
API that do make use of bitfields.

Change-Id: If1ff89d653537d854a4f788bf845d2ab6fe5bc23
Signed-off-by: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>
This commit is contained in:
Luiz Augusto von Dentz 2016-06-28 17:03:03 +03:00
commit ad8066404f

View file

@ -39,39 +39,39 @@ extern "C" {
#include <bluetooth/att.h> #include <bluetooth/att.h>
/* GATT attribute permission bit field values */ /* GATT attribute permission bit field values */
enum {
/** Attribute read permission. */
BT_GATT_PERM_READ = BIT(0),
/** @def BT_GATT_PERM_READ /** Attribute write permission. */
* @brief Attribute read permission. BT_GATT_PERM_WRITE = BIT(1),
*/
#define BT_GATT_PERM_READ BIT(0) /** Attribute read permission with encryption.
/** @def BT_GATT_PERM_WRITE *
* @brief Attribute write permission. * If set, requires encryption for read access.
*/ */
#define BT_GATT_PERM_WRITE BIT(1) BT_GATT_PERM_READ_ENCRYPT = BIT(2),
/** @def BT_GATT_PERM_READ_ENCRYPT
* @brief Attribute read permission with encryption. /** Attribute write permission with encryption.
* *
* If set, requires encryption for read access. * If set, requires encryption for write access.
*/ */
#define BT_GATT_PERM_READ_ENCRYPT BIT(2) BT_GATT_PERM_WRITE_ENCRYPT = BIT(3),
/** @def BT_GATT_PERM_WRITE_ENCRYPT
* @brief Attribute write permission with encryption. /** Attribute read permission with authentication.
* *
* If set, requires encryption for write access. * If set, requires encryption using authenticated link-key for read
*/ * access.
#define BT_GATT_PERM_WRITE_ENCRYPT BIT(3) */
/** @def BT_GATT_PERM_READ_AUTHEN BT_GATT_PERM_READ_AUTHEN = BIT(4),
* @brief Attribute read permission with authentication.
* /** Attribute write permission with authentication.
* If set, requires encryption using authenticated link-key for read access. *
*/ * If set, requires encryption using authenticated link-key for write
#define BT_GATT_PERM_READ_AUTHEN BIT(4) * access.
/** @def BT_GATT_PERM_WRITE_AUTHEN */
* @brief Attribute write permission with authentication. BT_GATT_PERM_WRITE_AUTHEN = BIT(5),
* };
* If set, requires encryption using authenticated link-key for write access.
*/
#define BT_GATT_PERM_WRITE_AUTHEN BIT(5)
/** @def BT_GATT_ERR /** @def BT_GATT_ERR
* @brief Construct error return value for attribute read and write callbacks. * @brief Construct error return value for attribute read and write callbacks.