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

Commit a9e7ba44 authored by Jakub Pawlowski's avatar Jakub Pawlowski
Browse files

Get rid of Page shim

Bug: 149757450
Change-Id: I9ce812831a0d8ff62772ea5b98ab4a7e646b162a
parent 47931368
Loading
Loading
Loading
Loading
+2 −2
Original line number Diff line number Diff line
@@ -31,6 +31,7 @@
#include "l2cap/classic/facade.h"
#include "neighbor/discoverability.h"
#include "neighbor/facade/facade.h"
#include "neighbor/page.h"
#include "os/log.h"
#include "os/thread.h"
#include "security/facade.h"
@@ -42,7 +43,6 @@
#include "shim/inquiry.h"
#include "shim/l2cap.h"
#include "shim/name.h"
#include "shim/page.h"
#include "shim/scanning.h"
#include "shim/storage.h"
#include "stack_manager.h"
@@ -113,7 +113,7 @@ class RootFacadeService : public ::bluetooth::facade::RootFacade::Service {
        modules.add<::bluetooth::shim::Inquiry>();
        modules.add<::bluetooth::shim::L2cap>();
        modules.add<::bluetooth::shim::Name>();
        modules.add<::bluetooth::shim::Page>();
        modules.add<::bluetooth::neighbor::PageModule>();
        modules.add<::bluetooth::shim::Scanning>();
        modules.add<::bluetooth::security::SecurityModule>();
        modules.add<::bluetooth::shim::Storage>();
+0 −1
Original line number Diff line number Diff line
@@ -9,7 +9,6 @@ filegroup {
            "l2cap.cc",
            "name.cc",
            "name_db.cc",
            "page.cc",
            "scanning.cc",
            "stack.cc",
            "storage.cc",
+0 −1
Original line number Diff line number Diff line
@@ -36,7 +36,6 @@ class HciLayer;
class L2cap;
class Name;
class NameDb;
class Page;
class Scanning;
class SecurityModule;
class Storage;

system/gd/shim/page.cc

deleted100644 → 0
+0 −93
Original line number Diff line number Diff line
/*
 * Copyright 2019 The Android Open Source Project
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *      http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */
#define LOG_TAG "bt_gd_shim"

#include <functional>
#include <memory>
#include <string>

#include "common/bidi_queue.h"
#include "hci/address.h"
#include "hci/controller.h"
#include "hci/hci_packets.h"
#include "module.h"
#include "neighbor/page.h"
#include "neighbor/scan_parameters.h"
#include "os/handler.h"
#include "os/log.h"
#include "shim/page.h"

namespace bluetooth {
namespace shim {

namespace {
constexpr char kModuleName[] = "shim::Page";
}  // namespace

struct Page::impl {
  impl(neighbor::PageModule* module);
  ~impl();

  neighbor::PageModule* module_{nullptr};
};

const ModuleFactory Page::Factory = ModuleFactory([]() { return new Page(); });

Page::impl::impl(neighbor::PageModule* module) : module_(module) {}

Page::impl::~impl() {}

void Page::SetScanActivity(uint16_t interval, uint16_t window) {
  neighbor::ScanParameters params{.interval = static_cast<neighbor::ScanInterval>(interval),
                                  .window = static_cast<neighbor::ScanWindow>(window)};
  return pimpl_->module_->SetScanActivity(params);
}

void Page::GetScanActivity(uint16_t& interval, uint16_t& window) const {
  neighbor::ScanParameters params = pimpl_->module_->GetScanActivity();

  interval = static_cast<uint16_t>(params.interval);
  window = static_cast<uint16_t>(params.window);
}

void Page::SetInterlacedScan() {
  return pimpl_->module_->SetInterlacedScan();
}
void Page::SetStandardScan() {
  return pimpl_->module_->SetStandardScan();
}

/**
 * Module methods
 */
void Page::ListDependencies(ModuleList* list) {
  list->add<neighbor::PageModule>();
}

void Page::Start() {
  pimpl_ = std::make_unique<impl>(GetDependency<neighbor::PageModule>());
}

void Page::Stop() {
  pimpl_.reset();
}

std::string Page::ToString() const {
  return kModuleName;
}

}  // namespace shim
}  // namespace bluetooth

system/gd/shim/page.h

deleted100644 → 0
+0 −52
Original line number Diff line number Diff line
/*
 * Copyright 2019 The Android Open Source Project
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *      http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */
#pragma once

#include <memory>
#include <string>

#include "module.h"

namespace bluetooth {
namespace shim {

class Page : public bluetooth::Module {
 public:
  void SetScanActivity(uint16_t interval, uint16_t window);
  void GetScanActivity(uint16_t& interval, uint16_t& window) const;

  void SetInterlacedScan();
  void SetStandardScan();

  Page() = default;
  ~Page() = default;

  static const ModuleFactory Factory;

 protected:
  void ListDependencies(ModuleList* list) override;  // Module
  void Start() override;                             // Module
  void Stop() override;                              // Module
  std::string ToString() const override;             // Module

 private:
  struct impl;
  std::unique_ptr<impl> pimpl_;
  DISALLOW_COPY_AND_ASSIGN(Page);
};

}  // namespace shim
}  // namespace bluetooth
Loading