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

Commit a8020441 authored by Chris Manton's avatar Chris Manton
Browse files

btm_history: Log start and stop le advertising

Bug: 188074901
Tag: #refactor
Test: gd/cert/run

Change-Id: Ifc7d6e2eee27e4d15acf34318c8d3b883d85d72d
parent d89db029
Loading
Loading
Loading
Loading
+11 −2
Original line number Diff line number Diff line
@@ -18,6 +18,7 @@

#include "le_advertising_manager.h"

#include <base/logging.h>
#include <hardware/bluetooth.h>
#include <hardware/bt_gatt.h>

@@ -34,10 +35,9 @@
#include "main/shim/helpers.h"
#include "stack/include/ble_advertiser.h"
#include "stack/include/btm_api.h"
#include "stack/include/btm_log_history.h"
#include "types/raw_address.h"

#include <base/logging.h>

using bluetooth::hci::Address;
using bluetooth::hci::AddressType;
using bluetooth::hci::ErrorCode;
@@ -45,6 +45,10 @@ using bluetooth::hci::GapData;
using bluetooth::hci::OwnAddressType;
using std::vector;

namespace {
constexpr char kBtmLogTag[] = "ADV";
}

class BleAdvertiserInterfaceImpl : public BleAdvertiserInterface,
                                   public bluetooth::hci::AdvertisingCallback {
 public:
@@ -63,6 +67,8 @@ class BleAdvertiserInterfaceImpl : public BleAdvertiserInterface,
  void Unregister(uint8_t advertiser_id) override {
    LOG(INFO) << __func__ << " in shim layer";
    bluetooth::shim::GetAdvertising()->RemoveAdvertiser(advertiser_id);
    BTM_LogHistory(kBtmLogTag, RawAddress::kEmpty, "Le advert stopped",
                   base::StringPrintf("advert_id:%d", advertiser_id));
  }

  void GetOwnAddress(uint8_t advertiser_id, GetAddressCallback cb) override {
@@ -187,6 +193,9 @@ class BleAdvertiserInterfaceImpl : public BleAdvertiserInterface,

    LOG(INFO) << "create advertising set, reg_id:" << reg_id
              << ", id:" << (uint16_t)id;

    BTM_LogHistory(kBtmLogTag, RawAddress::kEmpty, "Le advert started",
                   base::StringPrintf("advert_id:%d", reg_id));
  }

  void SetPeriodicAdvertisingParameters(