Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 932cd5db authored by Chris Manton's avatar Chris Manton
Browse files

Enum-ify stack/btm/security_device_record::tBTM_SM4_

Towards readable code

Bug: 163134718
Tag: #refactor
Test: gd/cert/run --host

Change-Id: Idf55cc17565dcc19dec61d2d477438044af7e318
parent d058b3ca
Loading
Loading
Loading
Loading
+14 −13
Original line number Diff line number Diff line
@@ -152,6 +152,20 @@ typedef enum : uint8_t {
  BTM_SEC_STATE_DISCONNECTING_BOTH = 9,
} tSECURITY_STATE;

typedef enum : uint8_t {
  BTM_SM4_UNKNOWN = 0x00,
  BTM_SM4_KNOWN = 0x10,
  BTM_SM4_TRUE = 0x11,
  BTM_SM4_REQ_PEND = 0x08, /* set this bit when getting remote features */
  BTM_SM4_UPGRADE = 0x04,  /* set this bit when upgrading link key */
  BTM_SM4_RETRY = 0x02,    /* set this bit to retry on HCI_ERR_KEY_MISSING or \
                              HCI_ERR_LMP_ERR_TRANS_COLLISION */
  BTM_SM4_DD_ACP =
      0x20, /* set this bit to indicate peer initiated dedicated bonding */
  BTM_SM4_CONN_PEND = 0x40, /* set this bit to indicate accepting acl conn; to
                             be cleared on \ btm_acl_created */
} tBTM_SM4_BIT;

/*
 * Define structure for Security Device Record.
 * A record exists for each device authenticated with this device
@@ -302,19 +316,6 @@ typedef struct {
                             name */
  uint8_t link_key_type;  /* Type of key used in pairing   */

#define BTM_SM4_UNKNOWN 0x00
#define BTM_SM4_KNOWN 0x10
#define BTM_SM4_TRUE 0x11
#define BTM_SM4_REQ_PEND 0x08 /* set this bit when getting remote features */
#define BTM_SM4_UPGRADE 0x04  /* set this bit when upgrading link key */
#define BTM_SM4_RETRY                                     \
  0x02 /* set this bit to retry on HCI_ERR_KEY_MISSING or \
          HCI_ERR_LMP_ERR_TRANS_COLLISION */
#define BTM_SM4_DD_ACP \
  0x20 /* set this bit to indicate peer initiated dedicated bonding */
#define BTM_SM4_CONN_PEND                                               \
  0x40 /* set this bit to indicate accepting acl conn; to be cleared on \
          btm_acl_created */
  uint8_t sm4;                /* BTM_SM4_TRUE, if the peer supports SM4 */
  tBTM_IO_CAP rmt_io_caps;    /* IO capability of the peer device */
  tBTM_AUTH_REQ rmt_auth_req; /* the auth_req flag as in the IO caps rsp evt */