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

Commit 14974462 authored by Chris Manton's avatar Chris Manton Committed by Gerrit Code Review
Browse files

Merge "bta:: Use proper types tBTM_STATUS encryption_status" into main

parents 1ec53726 92000811
Loading
Loading
Loading
Loading
+3 −3
Original line number Diff line number Diff line
@@ -1843,7 +1843,7 @@ private:
        break;

      case BTA_GATTC_ENC_CMPL_CB_EVT: {
        uint8_t encryption_status;
        tBTM_STATUS encryption_status;
        if (BTM_IsEncrypted(p_data->enc_cmpl.remote_bda, BT_TRANSPORT_LE)) {
          encryption_status = BTM_SUCCESS;
        } else {
@@ -1910,7 +1910,7 @@ private:
      return;
    }

    int result =
    tBTM_STATUS result =
            BTM_SetEncryption(device->addr, BT_TRANSPORT_LE, nullptr, nullptr, BTM_BLE_SEC_ENCRYPT);

    log::info("Encryption required for {}. Request result: 0x{:02x}", device->addr, result);
@@ -2048,7 +2048,7 @@ private:
    OnCsisNotification(evt.conn_id, evt.handle, evt.len, evt.value);
  }

  void OnLeEncryptionComplete(const RawAddress& address, uint8_t status) {
  void OnLeEncryptionComplete(const RawAddress& address, tBTM_STATUS status) {
    log::info("{}", address);
    auto device = FindDeviceByAddress(address);
    if (device == nullptr) {
+1 −1
Original line number Diff line number Diff line
@@ -1870,7 +1870,7 @@ private:
      return;
    }

    int result =
    tBTM_STATUS result =
            BTM_SetEncryption(device->addr, BT_TRANSPORT_LE, nullptr, nullptr, BTM_BLE_SEC_ENCRYPT);

    log::info("Encryption required for {}. Request result: 0x{:02x}", device->addr, result);
+6 −4
Original line number Diff line number Diff line
@@ -60,6 +60,7 @@
#include "stack/include/acl_api.h"
#include "stack/include/bt_types.h"
#include "stack/include/btm_client_interface.h"
#include "stack/include/btm_status.h"
#include "stack/include/main_thread.h"
#include "state_machine.h"
#include "storage_helper.h"
@@ -2154,7 +2155,8 @@ public:
      return;
    }

    int result = BTM_SetEncryption(address, BT_TRANSPORT_LE, nullptr, nullptr, BTM_BLE_SEC_ENCRYPT);
    tBTM_STATUS result =
            BTM_SetEncryption(address, BT_TRANSPORT_LE, nullptr, nullptr, BTM_BLE_SEC_ENCRYPT);

    log::info("Encryption required for {}. Request result: 0x{:02x}", address, result);

@@ -2231,7 +2233,7 @@ public:
    }
  }

  void OnEncryptionComplete(const RawAddress& address, uint8_t status) {
  void OnEncryptionComplete(const RawAddress& address, tBTM_STATUS status) {
    log::info("{} status 0x{:02x}", address, status);
    LeAudioDevice* leAudioDevice = leAudioDevices_.FindByAddress(address);
    if (leAudioDevice == NULL || (leAudioDevice->conn_id_ == GATT_INVALID_CONN_ID)) {
@@ -2241,7 +2243,7 @@ public:
    }

    if (status != BTM_SUCCESS) {
      log::error("Encryption failed status: {}", int{status});
      log::error("Encryption failed status: {}", btm_status_text(status));
      if (leAudioDevice->GetConnectionState() ==
          DeviceConnectState::CONNECTED_BY_USER_GETTING_READY) {
        callbacks_->OnConnectionState(ConnectionState::DISCONNECTED, address);
@@ -5800,7 +5802,7 @@ void le_audio_gattc_callback(tBTA_GATTC_EVT event, tBTA_GATTC* p_data) {
      break;

    case BTA_GATTC_ENC_CMPL_CB_EVT: {
      uint8_t encryption_status;
      tBTM_STATUS encryption_status;
      if (BTM_IsEncrypted(p_data->enc_cmpl.remote_bda, BT_TRANSPORT_LE)) {
        encryption_status = BTM_SUCCESS;
      } else {
+2 −1
Original line number Diff line number Diff line
@@ -400,7 +400,8 @@ bool VolumeControlDevice::IsEncryptionEnabled() {
}

bool VolumeControlDevice::EnableEncryption() {
  int result = BTM_SetEncryption(address, BT_TRANSPORT_LE, nullptr, nullptr, BTM_BLE_SEC_ENCRYPT);
  tBTM_STATUS result =
          BTM_SetEncryption(address, BT_TRANSPORT_LE, nullptr, nullptr, BTM_BLE_SEC_ENCRYPT);
  log::info("{}: result=0x{:02x}", address, result);

  return result != BTM_ERR_KEY_MISSING;
+3 −3
Original line number Diff line number Diff line
@@ -188,7 +188,7 @@ public:
    }
  }

  void OnEncryptionComplete(const RawAddress& address, uint8_t success) {
  void OnEncryptionComplete(const RawAddress& address, tBTM_STATUS success) {
    VolumeControlDevice* device = volume_control_devices_.FindByAddress(address);
    if (!device) {
      log::error("Skipping unknown device {}", address);
@@ -196,7 +196,7 @@ public:
    }

    if (success != BTM_SUCCESS) {
      log::error("encryption failed status: {}", int{success});
      log::error("encryption failed status: {}", btm_status_text(success));
      // If the encryption failed, do not remove the device.
      // Disconnect only, since the Android will try to re-enable encryption
      // after disconnection
@@ -1158,7 +1158,7 @@ private:
      } break;

      case BTA_GATTC_ENC_CMPL_CB_EVT: {
        uint8_t encryption_status;
        tBTM_STATUS encryption_status;
        if (BTM_IsEncrypted(p_data->enc_cmpl.remote_bda, BT_TRANSPORT_LE)) {
          encryption_status = BTM_SUCCESS;
        } else {