void OnDisconnection(hci::ErrorCode reason) override {
btm_sec_disconnected(connection_->GetHandle(),
- static_cast<uint8_t>(reason));
+ static_cast<tHCI_STATUS>(reason));
}
void OnReadRemoteVersionInformationComplete(uint8_t lmp_version,
uint16_t handle{0}; /* TODO Unneeded */
bool enhanced{true}; /* TODO logging metrics only */
- uint8_t status = ToLegacyHciErrorCode(reason);
+ tHCI_STATUS status = ToLegacyHciErrorCode(reason);
acl_ble_connection_fail(legacy_address_with_type, handle, enhanced, status);
}
#include <cstdint>
#include "stack/include/bt_types.h"
+#include "stack/include/hci_error_code.h"
#include "types/raw_address.h"
namespace bluetooth {
namespace legacy {
typedef struct {
- void (*on_connected)(const RawAddress& bda, uint16_t handle, uint8_t status,
- uint8_t enc_mode);
- void (*on_failed)(const RawAddress& bda, uint16_t handle, uint8_t status,
+ void (*on_connected)(const RawAddress& bda, uint16_t handle,
+ tHCI_STATUS status, uint8_t enc_mode);
+ void (*on_failed)(const RawAddress& bda, uint16_t handle, tHCI_STATUS status,
uint8_t enc_mode);
- void (*on_disconnected)(uint16_t handle, uint8_t reason);
+ void (*on_disconnected)(uint16_t handle, tHCI_STATUS reason);
} acl_classic_connection_interface_t;
typedef struct {
const RawAddress& local_rpa, const RawAddress& peer_rpa,
uint8_t peer_addr_type);
void (*on_failed)(const tBLE_BD_ADDR& address_with_type, uint16_t handle,
- bool enhanced, uint8_t status);
- void (*on_disconnected)(uint16_t handle, uint8_t reason);
+ bool enhanced, tHCI_STATUS status);
+ void (*on_disconnected)(uint16_t handle, tHCI_STATUS reason);
} acl_le_connection_interface_t;
typedef struct {
void (*on_role_change)(uint8_t new_role);
void (*on_role_discovery_complete)(uint8_t current_role);
} acl_classic_link_interface_t;
-;
typedef struct {
void (*on_connection_update)(uint16_t connection_interval,
return payload;
}
-inline uint8_t ToLegacyHciErrorCode(hci::ErrorCode reason) {
+inline tHCI_STATUS ToLegacyHciErrorCode(hci::ErrorCode reason) {
switch (reason) {
case hci::ErrorCode::SUCCESS:
return HCI_SUCCESS;
case hci::ErrorCode::CONNECTION_ACCEPT_TIMEOUT:
return HCI_ERR_HOST_TIMEOUT;
case hci::ErrorCode::UNSUPORTED_FEATURE_OR_PARAMETER_VALUE:
- return static_cast<uint8_t>(
+ return static_cast<tHCI_STATUS>(
hci::ErrorCode::UNSUPORTED_FEATURE_OR_PARAMETER_VALUE);
case hci::ErrorCode::INVALID_HCI_COMMAND_PARAMETERS:
return HCI_ERR_ILLEGAL_PARAMETER_FMT;
case hci::ErrorCode::REMOTE_USER_TERMINATED_CONNECTION:
return HCI_ERR_PEER_USER;
case hci::ErrorCode::REMOTE_DEVICE_TERMINATED_CONNECTION_LOW_RESOURCES:
- return static_cast<uint8_t>(
+ return static_cast<tHCI_STATUS>(
hci::ErrorCode::REMOTE_DEVICE_TERMINATED_CONNECTION_LOW_RESOURCES);
case hci::ErrorCode::REMOTE_DEVICE_TERMINATED_CONNECTION_POWER_OFF:
- return static_cast<uint8_t>(
+ return static_cast<tHCI_STATUS>(
hci::ErrorCode::REMOTE_DEVICE_TERMINATED_CONNECTION_POWER_OFF);
case hci::ErrorCode::CONNECTION_TERMINATED_BY_LOCAL_HOST:
return HCI_ERR_CONN_CAUSE_LOCAL_HOST;
case hci::ErrorCode::PAIRING_NOT_ALLOWED:
return HCI_ERR_PAIRING_NOT_ALLOWED;
case hci::ErrorCode::UNKNOWN_LMP_PDU:
- return static_cast<uint8_t>(hci::ErrorCode::UNKNOWN_LMP_PDU);
+ return static_cast<tHCI_STATUS>(hci::ErrorCode::UNKNOWN_LMP_PDU);
case hci::ErrorCode::UNSUPPORTED_REMOTE_OR_LMP_FEATURE:
return HCI_ERR_UNSUPPORTED_REM_FEATURE;
case hci::ErrorCode::SCO_OFFSET_REJECTED:
- return static_cast<uint8_t>(hci::ErrorCode::SCO_OFFSET_REJECTED);
+ return static_cast<tHCI_STATUS>(hci::ErrorCode::SCO_OFFSET_REJECTED);
case hci::ErrorCode::SCO_INTERVAL_REJECTED:
- return static_cast<uint8_t>(hci::ErrorCode::SCO_INTERVAL_REJECTED);
+ return static_cast<tHCI_STATUS>(hci::ErrorCode::SCO_INTERVAL_REJECTED);
case hci::ErrorCode::SCO_AIR_MODE_REJECTED:
- return static_cast<uint8_t>(hci::ErrorCode::SCO_AIR_MODE_REJECTED);
+ return static_cast<tHCI_STATUS>(hci::ErrorCode::SCO_AIR_MODE_REJECTED);
case hci::ErrorCode::INVALID_LMP_OR_LL_PARAMETERS:
- return static_cast<uint8_t>(hci::ErrorCode::INVALID_LMP_OR_LL_PARAMETERS);
+ return static_cast<tHCI_STATUS>(
+ hci::ErrorCode::INVALID_LMP_OR_LL_PARAMETERS);
case hci::ErrorCode::UNSPECIFIED_ERROR:
return HCI_ERR_UNSPECIFIED;
case hci::ErrorCode::UNSUPPORTED_LMP_OR_LL_PARAMETER:
- return static_cast<uint8_t>(
+ return static_cast<tHCI_STATUS>(
hci::ErrorCode::UNSUPPORTED_LMP_OR_LL_PARAMETER);
case hci::ErrorCode::ROLE_CHANGE_NOT_ALLOWED:
- return static_cast<uint8_t>(hci::ErrorCode::ROLE_CHANGE_NOT_ALLOWED);
+ return static_cast<tHCI_STATUS>(hci::ErrorCode::ROLE_CHANGE_NOT_ALLOWED);
case hci::ErrorCode::LINK_LAYER_COLLISION:
return HCI_ERR_LMP_ERR_TRANS_COLLISION;
case hci::ErrorCode::ENCRYPTION_MODE_NOT_ACCEPTABLE:
return HCI_ERR_ENCRY_MODE_NOT_ACCEPTABLE;
case hci::ErrorCode::CONTROLLER_BUSY:
- return static_cast<uint8_t>(hci::ErrorCode::CONTROLLER_BUSY);
+ return static_cast<tHCI_STATUS>(hci::ErrorCode::CONTROLLER_BUSY);
}
}
}
void acl_ble_connection_fail(const tBLE_BD_ADDR& address_with_type,
- uint16_t handle, bool enhanced, uint8_t status) {
+ uint16_t handle, bool enhanced,
+ tHCI_STATUS status) {
if (status != HCI_ERR_ADVERTISING_TIMEOUT) {
btm_cb.ble_ctr_cb.set_connection_state_idle();
btm_ble_clear_topology_mask(BTM_BLE_STATE_INIT_BIT);
return true;
}
-void btm_acl_connected(const RawAddress& bda, uint16_t handle, uint8_t status,
- uint8_t enc_mode) {
+void btm_acl_connected(const RawAddress& bda, uint16_t handle,
+ tHCI_STATUS status, uint8_t enc_mode) {
btm_sec_connected(bda, handle, status, enc_mode);
btm_acl_set_paging(false);
l2c_link_hci_conn_comp(status, handle, bda);
android::bluetooth::hci::STATUS_UNKNOWN);
tBLE_BD_ADDR address_with_type{.bda = bda, .type = bda_type};
- acl_ble_connection_fail(address_with_type, handle, enhanced, status);
+ acl_ble_connection_fail(address_with_type, handle, enhanced,
+ static_cast<tHCI_STATUS>(status));
}
}
return (btm_sec_send_hci_disconnect(p_dev_rec, reason, handle));
}
-/*******************************************************************************
- *
- * Function btm_sec_disconnected
- *
- * Description This function is when a connection to the peer device is
- * dropped
- *
- * Returns void
- *
- ******************************************************************************/
-void btm_sec_disconnected(uint16_t handle, uint8_t reason) {
+void btm_sec_disconnected(uint16_t handle, tHCI_STATUS reason) {
tBTM_SEC_DEV_REC* p_dev_rec = btm_find_dev_by_handle(handle);
uint8_t old_pairing_flags = btm_cb.pairing_flags;
int result = HCI_ERR_AUTH_FAILURE;
#include <cstdint>
#include "stack/btm/security_device_record.h"
#include "stack/include/btm_api_types.h"
+#include "stack/include/hci_error_code.h"
#define BTM_SEC_MAX_COLLISION_DELAY (5000)
* Returns void
*
******************************************************************************/
-void btm_sec_disconnected(uint16_t handle, uint8_t reason);
+void btm_sec_disconnected(uint16_t handle, tHCI_STATUS reason);
/** This function is called when a new connection link key is generated */
void btm_sec_link_key_notification(const RawAddress& p_bda,
}
if (link_type == HCI_LINK_TYPE_ACL) {
- btm_acl_connected(bda, handle, status, enc_mode);
+ btm_acl_connected(bda, handle, static_cast<tHCI_STATUS>(status), enc_mode);
} else {
memset(&esco_data, 0, sizeof(tBTM_ESCO_DATA));
/* esco_data.link_type = HCI_LINK_TYPE_SCO; already zero */
}
/* Notify security manager */
- btm_sec_disconnected(handle, reason);
+ btm_sec_disconnected(handle, static_cast<tHCI_STATUS>(reason));
}
/*******************************************************************************
case HCI_CREATE_CONNECTION:
if (status != HCI_SUCCESS) {
STREAM_TO_BDADDR(bd_addr, p_cmd);
- btm_acl_connected(bd_addr, HCI_INVALID_HANDLE, status, 0);
+ btm_acl_connected(bd_addr, HCI_INVALID_HANDLE,
+ static_cast<tHCI_STATUS>(status), 0);
}
break;
case HCI_AUTHENTICATION_REQUESTED:
// This header contains functions for HCIF-Acl Management to invoke
//
void btm_acl_connection_request(const RawAddress& bda, uint8_t* dc);
-void btm_acl_connected(const RawAddress& bda, uint16_t handle, uint8_t status,
- uint8_t enc_mode);
+void btm_acl_connected(const RawAddress& bda, uint16_t handle,
+ tHCI_STATUS status, uint8_t enc_mode);
void btm_acl_encrypt_change(uint16_t handle, uint8_t status,
uint8_t encr_enable);
void btm_acl_paging(BT_HDR* p, const RawAddress& dest);
uint16_t conn_timeout, const RawAddress& local_rpa,
const RawAddress& peer_rpa, uint8_t peer_addr_type);
void acl_ble_connection_fail(const tBLE_BD_ADDR& address_with_type,
- uint16_t handle, bool enhanced, uint8_t status);
+ uint16_t handle, bool enhanced,
+ tHCI_STATUS status);
void btm_read_local_oob_complete(uint8_t* p);
void btm_rem_oob_req(uint8_t* p);
void btm_sec_auth_complete(uint16_t handle, uint8_t status);
-void btm_sec_disconnected(uint16_t handle, uint8_t reason);
+void btm_sec_disconnected(uint16_t handle, tHCI_STATUS reason);
void btm_sec_encrypt_change(uint16_t handle, uint8_t status,
uint8_t encr_enable);
void btm_sec_link_key_notification(const RawAddress& p_bda,