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

Commit 3d67220e authored by Treehugger Robot's avatar Treehugger Robot Committed by Gerrit Code Review
Browse files

Merge "bta::dm Enum-ify tBTA_DM_BLE_SEC_GRANT" into main

parents 766413bf 0d094737
Loading
Loading
Loading
Loading
+10 −1
Original line number Diff line number Diff line
@@ -211,7 +211,16 @@ void BTA_DmBleConfirmReply(const RawAddress& bd_addr, bool accept) {
 *
 ******************************************************************************/
void BTA_DmBleSecurityGrant(const RawAddress& bd_addr, tBTA_DM_BLE_SEC_GRANT res) {
  BTM_SecurityGrant(bd_addr, res);
  const tBTM_STATUS btm_status = [](const tBTA_DM_BLE_SEC_GRANT res) -> tBTM_STATUS {
    switch (res) {
      case tBTA_DM_BLE_SEC_GRANT::BTA_DM_SEC_GRANTED:
        return BTM_SUCCESS;
      case tBTA_DM_BLE_SEC_GRANT::BTA_DM_SEC_PAIR_NOT_SPT:
        return static_cast<tBTM_STATUS>(BTA_DM_AUTH_FAIL_BASE + SMP_PAIR_NOT_SUPPORT);
    }
  }(res);

  BTM_SecurityGrant(bd_addr, btm_status);
}

/*******************************************************************************
+5 −7
Original line number Diff line number Diff line
@@ -24,16 +24,13 @@

#include <cstdint>

#include "bta_api_data_types.h"
#include "internal_include/bt_target.h"
#include "bta/include/bta_api_data_types.h"
#include "stack/include/bt_device_type.h"
#include "stack/include/bt_name.h"
#include "stack/include/bt_octets.h"
#include "stack/include/btm_ble_sec_api_types.h"
#include "stack/include/btm_sec_api_types.h"
#include "stack/include/hci_error_code.h"
#include "types/ble_address_with_type.h"
#include "types/bt_transport.h"
#include "types/raw_address.h"

/* Security Setting Mask */
@@ -117,9 +114,10 @@ typedef struct {
  Octet16 dhk;
} tBTA_BLE_LOCAL_ID_KEYS;

#define BTA_DM_SEC_GRANTED BTA_SUCCESS
#define BTA_DM_SEC_PAIR_NOT_SPT BTA_DM_AUTH_SMP_PAIR_NOT_SUPPORT
typedef uint8_t tBTA_DM_BLE_SEC_GRANT;
enum class tBTA_DM_BLE_SEC_GRANT {
  BTA_DM_SEC_GRANTED = BTA_SUCCESS,
  BTA_DM_SEC_PAIR_NOT_SPT = BTA_DM_AUTH_SMP_PAIR_NOT_SUPPORT
};

/* Structure associated with BTA_DM_BLE_SEC_REQ_EVT */
typedef struct {
+3 −3
Original line number Diff line number Diff line
@@ -2523,7 +2523,7 @@ void btif_dm_cancel_bond(const RawAddress bd_addr) {
  if (is_bonding_or_sdp()) {
    if (pairing_cb.is_ssp) {
      if (pairing_cb.is_le_only) {
        BTA_DmBleSecurityGrant(bd_addr, BTA_DM_SEC_PAIR_NOT_SPT);
        BTA_DmBleSecurityGrant(bd_addr, tBTA_DM_BLE_SEC_GRANT::BTA_DM_SEC_PAIR_NOT_SPT);
      } else {
        BTA_DmConfirm(bd_addr, false);
        BTA_DmBondCancel(bd_addr);
@@ -2645,9 +2645,9 @@ void btif_dm_ssp_reply(const RawAddress bd_addr, bt_ssp_variant_t variant, uint8
      BTA_DmBleConfirmReply(bd_addr, accept);
    } else {
      if (accept) {
        BTA_DmBleSecurityGrant(bd_addr, BTA_DM_SEC_GRANTED);
        BTA_DmBleSecurityGrant(bd_addr, tBTA_DM_BLE_SEC_GRANT::BTA_DM_SEC_GRANTED);
      } else {
        BTA_DmBleSecurityGrant(bd_addr, BTA_DM_SEC_PAIR_NOT_SPT);
        BTA_DmBleSecurityGrant(bd_addr, tBTA_DM_BLE_SEC_GRANT::BTA_DM_SEC_PAIR_NOT_SPT);
      }
    }
  } else {