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

Commit 50e6c05d authored by Treehugger Robot's avatar Treehugger Robot Committed by Gerrit Code Review
Browse files

Merge "GD Advertising: Trigger callback when advertising terminated"

parents 25bc7082 e13db26b
Loading
Loading
Loading
Loading
+2 −0
Original line number Diff line number Diff line
@@ -825,7 +825,9 @@ enum ErrorCode: 8 {
  ENCRYPTION_MODE_NOT_ACCEPTABLE = 0x25,
  ROLE_SWITCH_FAILED = 0x35,
  CONTROLLER_BUSY = 0x3A,
  ADVERTISING_TIMEOUT = 0x3C,
  CONNECTION_FAILED_ESTABLISHMENT = 0x3E,
  LIMIT_REACHED = 0x43,
}

// Events that are defined with their respective commands
+6 −2
Original line number Diff line number Diff line
@@ -183,8 +183,12 @@ struct LeAdvertisingManager::impl : public bluetooth::hci::LeAddressManagerCallb

    AddressWithType advertiser_address = advertising_sets_[event_view.GetAdvertisingHandle()].current_address;

    acl_manager_->OnAdvertisingSetTerminated(
        event_view.GetStatus(), event_view.GetConnectionHandle(), advertiser_address);
    auto status = event_view.GetStatus();
    acl_manager_->OnAdvertisingSetTerminated(status, event_view.GetConnectionHandle(), advertiser_address);
    if (status == ErrorCode::LIMIT_REACHED || status == ErrorCode::ADVERTISING_TIMEOUT) {
      advertising_callbacks_->OnAdvertisingEnabled(advertiser_id, false, (uint8_t)status);
      return;
    }

    if (!advertising_sets_[advertiser_id].directed) {
      // TODO calculate remaining duration and advertising events