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

Commit 1afeb16b authored by Jakub Pawlowski's avatar Jakub Pawlowski
Browse files

Use proper HCI_ERR_* constants in advertisement termination handling

There is no functional change, just making the code pretty, and updating
names to match 5.0 specification.

Test: sl4a AdvertisingSetTest:test_reenabling
Bug: 74198564
Change-Id: I1811e19bd18470adda55f7af7cfee23bcc4d1871
(cherry picked from commit 8e6b9a9760efa5aba116355b4216610e75a54a49)
parent 1014501a
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -1990,7 +1990,7 @@ void btm_ble_conn_complete(uint8_t* p, UNUSED_ATTR uint16_t evt_len,
#endif
  } else {
    role = HCI_ROLE_UNKNOWN;
    if (status != HCI_ERR_DIRECTED_ADVERTISING_TIMEOUT) {
    if (status != HCI_ERR_ADVERTISING_TIMEOUT) {
      btm_ble_set_conn_st(BLE_CONN_IDLE);
#if (BLE_PRIVACY_SPT == TRUE)
      btm_ble_disable_resolving_list(BTM_BLE_RL_INIT, true);
+1 −1
Original line number Diff line number Diff line
@@ -2565,7 +2565,7 @@ void btm_ble_update_link_topology_mask(uint8_t link_role, bool increase) {
 ******************************************************************************/
void btm_ble_update_mode_operation(uint8_t link_role, const RawAddress* bd_addr,
                                   uint8_t status) {
  if (status == HCI_ERR_DIRECTED_ADVERTISING_TIMEOUT) {
  if (status == HCI_ERR_ADVERTISING_TIMEOUT) {
    btm_cb.ble_ctr_cb.inq_var.adv_mode = BTM_BLE_ADV_DISABLE;
    /* make device fall back into undirected adv mode by default */
    btm_cb.ble_ctr_cb.inq_var.directed_conn = BTM_BLE_CONNECT_EVT;
+5 −4
Original line number Diff line number Diff line
@@ -965,11 +965,12 @@ class BleAdvertisingManagerImpl
      uint8_t status, uint8_t advertising_handle, uint16_t connection_handle,
      uint8_t num_completed_extended_adv_events) override {
    AdvertisingInstance* p_inst = &adv_inst[advertising_handle];
    VLOG(1) << __func__ << "status: 0x" << std::hex << +status
            << ", advertising_handle: 0x" << std::hex << +advertising_handle
            << ", connection_handle: 0x" << std::hex << +connection_handle;
    VLOG(1) << __func__ << "status: " << loghex(status)
            << ", advertising_handle: " << loghex(advertising_handle)
            << ", connection_handle: " << loghex(connection_handle);

    if (status == 0x43 || status == 0x3C) {
    if (status == HCI_ERR_LIMIT_REACHED ||
        status == HCI_ERR_ADVERTISING_TIMEOUT) {
      // either duration elapsed, or maxExtAdvEvents reached
      p_inst->enable_status = false;

+2 −1
Original line number Diff line number Diff line
@@ -670,9 +670,10 @@ constexpr uint8_t HCI_LE_STATES_INIT_MASTER_SLAVE_BIT = 41;
#define HCI_ERR_REJ_NO_SUITABLE_CHANNEL 0x39
#define HCI_ERR_CONTROLLER_BUSY 0x3A
#define HCI_ERR_UNACCEPT_CONN_INTERVAL 0x3B
#define HCI_ERR_DIRECTED_ADVERTISING_TIMEOUT 0x3C
#define HCI_ERR_ADVERTISING_TIMEOUT 0x3C
#define HCI_ERR_CONN_TOUT_DUE_TO_MIC_FAILURE 0x3D
#define HCI_ERR_CONN_FAILED_ESTABLISHMENT 0x3E
#define HCI_ERR_LIMIT_REACHED 0x43
#define HCI_ERR_MAC_CONNECTION_FAILED 0x3F

/* ConnectionLess Broadcast errors */