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

Commit 6490e776 authored by Zach Johnson's avatar Zach Johnson
Browse files

Format att with new clang-format

find att -regex '.*\.\(cc\|h\|tpp\)' -exec clang-format -style=file -i {} \;

Test: cert/run --host
Bug: 156858180
Tag: #gd-refactor
Change-Id: Ie578b0c59696639f1dc3ed5614a0e44466f666ef
parent 70669bcd
Loading
Loading
Loading
Loading
+19 −13
Original line number Diff line number Diff line
@@ -16,14 +16,15 @@

#define LOG_TAG "att"

#include "att/att_module.h"

#include <memory>
#include "module.h"
#include "os/handler.h"
#include "os/log.h"

#include "att/att_module.h"
#include "l2cap/classic/l2cap_classic_module.h"
#include "l2cap/le/l2cap_le_module.h"
#include "module.h"
#include "os/handler.h"
#include "os/log.h"

namespace bluetooth {
namespace att {
@@ -31,7 +32,8 @@ namespace att {
const ModuleFactory AttModule::Factory = ModuleFactory([]() { return new AttModule(); });

namespace {
void OnAttRegistrationCompleteLe(l2cap::le::FixedChannelManager::RegistrationResult result,
void OnAttRegistrationCompleteLe(
    l2cap::le::FixedChannelManager::RegistrationResult result,
    std::unique_ptr<l2cap::le::FixedChannelService> le_smp_service) {
  LOG_INFO("ATT channel registration complete");
}
@@ -42,15 +44,19 @@ void OnAttConnectionOpenLe(std::unique_ptr<l2cap::le::FixedChannel> channel) {
}  // namespace

struct AttModule::impl {
  impl(os::Handler* att_handler, l2cap::le::L2capLeModule* l2cap_le_module,
  impl(
      os::Handler* att_handler,
      l2cap::le::L2capLeModule* l2cap_le_module,
      l2cap::classic::L2capClassicModule* l2cap_classic_module)
      : att_handler_(att_handler), l2cap_le_module_(l2cap_le_module), l2cap_classic_module_(l2cap_classic_module) {
    // TODO: move that into a ATT manager, or other proper place
    std::unique_ptr<bluetooth::l2cap::le::FixedChannelManager> l2cap_manager_le_(
        l2cap_le_module_->GetFixedChannelManager());
    l2cap_manager_le_->RegisterService(bluetooth::l2cap::kLeAttributeCid,
    l2cap_manager_le_->RegisterService(
        bluetooth::l2cap::kLeAttributeCid,
        common::BindOnce(&OnAttRegistrationCompleteLe),
                                       common::Bind(&OnAttConnectionOpenLe), att_handler_);
        common::Bind(&OnAttConnectionOpenLe),
        att_handler_);
  }

  os::Handler* att_handler_;
@@ -64,8 +70,8 @@ void AttModule::ListDependencies(ModuleList* list) {
}

void AttModule::Start() {
  pimpl_ = std::make_unique<impl>(GetHandler(), GetDependency<l2cap::le::L2capLeModule>(),
                                  GetDependency<l2cap::classic::L2capClassicModule>());
  pimpl_ = std::make_unique<impl>(
      GetHandler(), GetDependency<l2cap::le::L2capLeModule>(), GetDependency<l2cap::classic::L2capClassicModule>());
}

void AttModule::Stop() {