diff options
| author | Joel Klinghed <the_jk@spawned.biz> | 2025-10-10 10:01:01 +0200 |
|---|---|---|
| committer | Joel Klinghed <the_jk@spawned.biz> | 2025-10-19 00:13:47 +0200 |
| commit | dad0aaa9b33a5a217ac115334a94fe299dce9e08 (patch) | |
| tree | baeffb1e3ef6a6e100bc2f255581d77c4b9a45d3 /src/looper.hh | |
| parent | 86ec0b5386fc2078891a829026844d2ec21ea7db (diff) | |
Add bluetooth module
Can't really do anything yet, but finds the bluetooth adapter
and registers an agent to make it pairable.
Diffstat (limited to 'src/looper.hh')
| -rw-r--r-- | src/looper.hh | 30 |
1 files changed, 30 insertions, 0 deletions
diff --git a/src/looper.hh b/src/looper.hh index 2f4c672..092dfe5 100644 --- a/src/looper.hh +++ b/src/looper.hh @@ -1,6 +1,7 @@ #ifndef LOOPER_HH #define LOOPER_HH +#include <chrono> #include <cstdint> #include <functional> #include <memory> @@ -15,6 +16,8 @@ constexpr static uint8_t EVENT_READ = 1; constexpr static uint8_t EVENT_WRITE = 2; constexpr static uint8_t EVENT_ERROR = 4; +class Hook; + class Looper { public: virtual ~Looper() = default; @@ -32,12 +35,39 @@ class Looper { virtual bool run(logger::Logger& logger) = 0; virtual void quit() = 0; + virtual void add_hook(Hook* hook) = 0; + virtual void remove_hook(Hook* hook) = 0; + protected: Looper() = default; Looper(Looper const&) = delete; Looper& operator=(Looper const&) = delete; }; +class HookHelper { + public: + virtual ~HookHelper() = default; + + virtual void monitor(int fd, uint8_t events) = 0; + virtual void timeout(std::chrono::milliseconds timeout) = 0; + + protected: + HookHelper() = default; + HookHelper(HookHelper const&) = delete; + HookHelper& operator=(HookHelper const&) = delete; +}; + +class Hook { + public: + virtual ~Hook() = default; + + virtual void before(HookHelper& helper) = 0; + virtual void after() = 0; + + protected: + Hook() = default; +}; + [[nodiscard]] std::unique_ptr<Looper> create(); |
