herald  2.0.0
ble_database.h
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  BLEDatabase() = default;
28  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 
48  virtual void remove(const TargetIdentifier& targetIdentifier) = 0;
49 };
50 
51 } // end namespace
52 } // end namespace
53 
54 #endif
Definition: ble_database_delegate.h:15
Definition: ble_database.h:25
virtual void remove(const TargetIdentifier &targetIdentifier)=0
Cannot name a function delete in C++. remove is common.
Definition: ble_device.h:181
Definition: ble_mac_address.h:18
The main data workhorse class of the Herald API.
Definition: data.h:33
Definition: payload_data.h:13
Definition: target_identifier.h:17
Contains all low-level Herald datatype implementations.
Definition: base64_string.h:14
Acts as a non-global memory arena for arbitrary classes.
Definition: aggregates.h:15