From 70514e463ff0e9ba74d294ba57ae471c8cd0ea9b Mon Sep 17 00:00:00 2001 From: Chris Manton Date: Thu, 5 Nov 2020 14:27:00 -0800 Subject: [PATCH] Enum-ify stack/include/btm_api_types::BTM_AUTH_ Towards readable code Bug: 163134718 Tag: #refactor Test: gd/cert/run --host Change-Id: I5e17d7d826bbae3570efd9dbf2ae35cf0f11d484 --- stack/include/btm_api_types.h | 50 ++++++++++++++++++++++--------------------- 1 file changed, 26 insertions(+), 24 deletions(-) diff --git a/stack/include/btm_api_types.h b/stack/include/btm_api_types.h index be1045b41..6148bfd6a 100644 --- a/stack/include/btm_api_types.h +++ b/stack/include/btm_api_types.h @@ -622,30 +622,32 @@ typedef uint8_t tBTM_IO_CAP; #define BTM_MAX_PASSKEY_VAL (999999) -/* MITM Protection Not Required - Single Profile/non-bonding Numeric comparison - * with automatic accept allowed */ -// NO_BONDING -#define BTM_AUTH_SP_NO 0 -/* MITM Protection Required - Single Profile/non-bonding. Use IO Capabilities to - * determine authentication procedure */ -// NO_BONDING_MITM_PROTECTION -#define BTM_AUTH_SP_YES 1 -/* MITM Protection Not Required - All Profiles/dedicated bonding Numeric - * comparison with automatic accept allowed */ -// DEDICATED_BONDING -#define BTM_AUTH_AP_NO 2 -/* MITM Protection Required - All Profiles/dedicated bonding Use IO Capabilities - * to determine authentication procedure */ -// DEDICATED_BONDING_MITM_PROTECTION -#define BTM_AUTH_AP_YES 3 -/* MITM Protection Not Required - Single Profiles/general bonding Numeric - * comparison with automatic accept allowed */ -// GENERAL_BONDING -#define BTM_AUTH_SPGB_NO 4 -/* MITM Protection Required - Single Profiles/general bonding Use IO - * Capabilities to determine authentication procedure */ -// GENERAL_BONDING_MITM_PROTECTION -#define BTM_AUTH_SPGB_YES 5 +typedef enum : uint8_t { + /* MITM Protection Not Required - Single Profile/non-bonding Numeric + * comparison with automatic accept allowed */ + // NO_BONDING + BTM_AUTH_SP_NO = 0, + /* MITM Protection Required - Single Profile/non-bonding. Use IO Capabilities + * to determine authentication procedure */ + // NO_BONDING_MITM_PROTECTION + BTM_AUTH_SP_YES = 1, + /* MITM Protection Not Required - All Profiles/dedicated bonding Numeric + * comparison with automatic accept allowed */ + // DEDICATED_BONDING + BTM_AUTH_AP_NO = 2, + /* MITM Protection Required - All Profiles/dedicated bonding Use IO + * Capabilities to determine authentication procedure */ + // DEDICATED_BONDING_MITM_PROTECTION + BTM_AUTH_AP_YES = 3, + /* MITM Protection Not Required - Single Profiles/general bonding Numeric + * comparison with automatic accept allowed */ + // GENERAL_BONDING + BTM_AUTH_SPGB_NO = 4, + /* MITM Protection Required - Single Profiles/general bonding Use IO + * Capabilities to determine authentication procedure */ + // GENERAL_BONDING_MITM_PROTECTION + BTM_AUTH_SPGB_YES = 5, +} tBTM_AUTH; /* this bit is ORed with BTM_AUTH_SP_* when IO exchange for dedicated bonding */ #define BTM_AUTH_DD_BOND 2 -- 2.11.0