🎨 Moving project to use event bus

This commit is contained in:
Rune Harlyk
2025-07-08 21:47:06 +02:00
parent 0586775849
commit 6769ffeb20
69 changed files with 497 additions and 496 deletions
+2 -19
View File
@@ -14,21 +14,8 @@ class BluetoothService : public CommBase<> {
BLECharacteristic* rxCharacteristic {nullptr};
bool connected {false};
protected:
template <typename Msg>
using EventBusHandle = typename EventBus<Msg>::Handle;
template <typename Msg>
EventBusHandle<Msg>& getHandle(Topic topic) {
return *static_cast<EventBusHandle<Msg>*>(subscriptionHandle[static_cast<size_t>(topic)]);
}
template <typename Msg>
void setHandle(Topic topic, EventBusHandle<Msg>&& handle) {
subscriptionHandle[static_cast<size_t>(topic)] = new EventBusHandle<Msg>(std::move(handle));
}
std::array<void*, static_cast<size_t>(Topic::COUNT)> subscriptionHandle {};
public:
void begin(const char* name);
private:
void handleReceive(const std::string& data);
@@ -53,8 +40,4 @@ class BluetoothService : public CommBase<> {
if (!v.empty()) svc->handleReceive(v);
}
};
public:
void begin(const char* name);
void loop() {}
};