Coverage Report

Created: 2021-08-28 18:14

D:\git\skunkworks\herald-for-cpp\herald\include\herald\ble\ble_database.h
Line
Count
Source
1
//  Copyright 2020-2021 Herald Project Contributors
2
//  SPDX-License-Identifier: Apache-2.0
3
//
4
5
#ifndef HERALD_BLE_DATABASE_H
6
#define HERALD_BLE_DATABASE_H
7
8
#include "ble_database_delegate.h"
9
#include "ble_device.h"
10
11
#include "../datatype/payload_data.h"
12
#include "../datatype/payload_sharing_data.h"
13
#include "../datatype/rssi.h"
14
#include "../datatype/target_identifier.h"
15
16
#include <memory>
17
#include <vector>
18
#include <functional>
19
20
namespace herald {
21
namespace ble {
22
23
using namespace herald::datatype;
24
25
class BLEDatabase {
26
public:
27
11
  BLEDatabase() = default;
28
11
  virtual ~BLEDatabase() = default;
29
30
  virtual void add(BLEDatabaseDelegate& delegate) = 0;
31
32
  virtual BLEDevice& device(const BLEMacAddress& mac, const Data& advert/*, const RSSI& rssi*/) = 0;
33
34
  virtual BLEDevice& device(const BLEMacAddress& mac, const BLEMacAddress& pseudo) = 0;
35
  
36
  virtual BLEDevice& device(const BLEMacAddress& mac) = 0;
37
38
  virtual BLEDevice& device(const PayloadData& payloadData) = 0;
39
40
  virtual BLEDevice& device(const TargetIdentifier& targetIdentifier) = 0;
41
42
  virtual std::size_t size() const = 0;
43
44
  virtual std::vector<std::reference_wrapper<BLEDevice>> matches(
45
    const std::function<bool(const BLEDevice&)>& matcher) = 0;
46
47
  /// Cannot name a function delete in C++. remove is common.
48
  virtual void remove(const TargetIdentifier& targetIdentifier) = 0;
49
};
50
51
} // end namespace
52
} // end namespace
53
54
#endif