herald  2.0.0
concrete_ble_receiver.h
1 // Copyright 2020-2021 Herald Project Contributors
2 // SPDX-License-Identifier: Apache-2.0
3 //
4 
5 #ifndef HERALD_DEFAULT_BLE_CONCRETE_RECEIVER_H
6 #define HERALD_DEFAULT_BLE_CONCRETE_RECEIVER_H
7 
8 #include "../bluetooth_state_manager.h"
9 #include "../ble_receiver.h"
10 #include "../../payload/payload_data_supplier.h"
11 #include "../../datatype/data.h"
12 #include "../../datatype/target_identifier.h"
13 
14 #include <optional>
15 
16 namespace herald {
17 namespace ble {
18 
19 using namespace herald::datatype;
20 using namespace herald::payload;
21 
23 template <typename ContextT, typename PayloadDataSupplierT, typename BLEDatabaseT, typename SensorDelegateSetT>
25 public:
26  ConcreteBLEReceiver(ContextT& ctx, BluetoothStateManager& bluetoothStateManager,
27  PayloadDataSupplierT& payloadDataSupplier, BLEDatabaseT& bleDatabase, SensorDelegateSetT& dels) {}
28  ConcreteBLEReceiver(const ConcreteBLEReceiver& from) = delete;
31 
32  // Coordination overrides - Since v1.2-beta3
33  std::optional<std::reference_wrapper<CoordinationProvider>> coordinationProvider() {
34  return {};
35  }
36 
37  // bool immediateSend(Data data, const TargetIdentifier& targetIdentifier) {
38  // return false;
39  // }
40  // bool immediateSendAll(Data data) {
41  // return false;
42  // }
43 
44  // Sensor overrides
45  void start() {}
46  void stop() {}
47 
48  // Herald V1 Protocol Provider methods
49  bool openConnection(const TargetIdentifier& toTarget) override {
50  return false;
51  }
52 
53  bool closeConnection(const TargetIdentifier& toTarget) override {
54  return true;
55  }
56 
58  ;
59  }
60 
61  std::optional<Activity> serviceDiscovery(Activity) override {
62  return {};
63  }
64 
65  std::optional<Activity> readPayload(Activity) override {
66  return {};
67  }
68 
69  // std::optional<Activity> immediateSend(Activity) override {
70  // return {};
71  // }
72 
73  // std::optional<Activity> immediateSendAll(Activity) override {
74  // return {};
75  // }
76 
77 };
78 
79 }
80 }
81 
82 #endif
Definition: bluetooth_state_manager.h:19
Dummy implementation of a ConcreteBLEReceiver that does nothing (used for testing)
Definition: concrete_ble_receiver.h:24
bool closeConnection(const TargetIdentifier &toTarget) override
Definition: concrete_ble_receiver.h:53
void restartScanningAndAdvertising() override
Definition: concrete_ble_receiver.h:57
bool openConnection(const TargetIdentifier &toTarget) override
Definition: concrete_ble_receiver.h:49
Definition: ble_protocols.h:22
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
An activity that needs to be performed due to some state being achieved in a Sensor.
Definition: activities.h:75