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

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

Initial Entry for le scanning shim

Bug: 143578947
Test: Compiles
Change-Id: If72e353387fd8569e4d2bac8b970fdb5f5595e03
parent 19623b6c
Loading
Loading
Loading
Loading
+1 −0
Original line number Diff line number Diff line
@@ -9,6 +9,7 @@ filegroup {
            "inquiry.cc",
            "l2cap.cc",
            "page.cc",
            "scanning.cc",
            "stack.cc",
    ],
}
+29 −0
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

/**
 * The gd API exported to the legacy api
 */
namespace bluetooth {
namespace shim {

struct IScanning {
  virtual ~IScanning() {}
};

}  // namespace shim
}  // namespace bluetooth
+2 −0
Original line number Diff line number Diff line
@@ -31,6 +31,7 @@ struct IHciLayer;
struct IInquiry;
struct IL2cap;
struct IPage;
struct IScanning;

struct IStack {
  virtual void Start() = 0;
@@ -44,6 +45,7 @@ struct IStack {
  virtual IInquiry* GetInquiry() = 0;
  virtual IL2cap* GetL2cap() = 0;
  virtual IPage* GetPage() = 0;
  virtual IScanning* GetScanning() = 0;

  virtual ~IStack() {}
};
+1 −0
Original line number Diff line number Diff line
@@ -32,4 +32,5 @@
#include "gd/shim/iinquiry.h"
#include "gd/shim/il2cap.h"
#include "gd/shim/ipage.h"
#include "gd/shim/iscanning.h"
#include "gd/shim/istack.h"
+61 −0
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 "hci/address.h"
#include "hci/hci_packets.h"
#include "hci/le_scanning_manager.h"
#include "module.h"
#include "os/handler.h"
#include "os/log.h"
#include "shim/scanning.h"

namespace bluetooth {
namespace shim {

struct Scanning::impl {
  hci::LeScanningManager* module_{nullptr};

  impl(hci::LeScanningManager* module);
  ~impl();
};

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

Scanning::impl::impl(hci::LeScanningManager* scanning_manager) : module_(scanning_manager) {}

Scanning::impl::~impl() {}

/**
 * Module methods
 */
void Scanning::ListDependencies(ModuleList* list) {
  list->add<hci::LeScanningManager>();
}

void Scanning::Start() {
  pimpl_ = std::make_unique<impl>(GetDependency<hci::LeScanningManager>());
}

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

}  // namespace shim
}  // namespace bluetooth
Loading