Replace Tactility SystemEvents with new kernel implementation (#598)
TactilityKernel now has a system event API to replace the one from the Tactility subproject. It also implements several tests for it.
This commit is contained in:
committed by
GitHub
parent
6e55e71e67
commit
acb2f1d4c7
@@ -1,28 +0,0 @@
|
||||
#pragma once
|
||||
|
||||
#include <cstdint>
|
||||
#include <functional>
|
||||
|
||||
namespace tt::kernel {
|
||||
|
||||
enum class SystemEvent {
|
||||
BootSplash,
|
||||
/** Gained IP address */
|
||||
NetworkConnected,
|
||||
NetworkDisconnected,
|
||||
Time,
|
||||
};
|
||||
|
||||
/** Value 0 mean "no subscription" */
|
||||
typedef uint32_t SystemEventSubscription;
|
||||
constexpr SystemEventSubscription NoSystemEventSubscription = 0U;
|
||||
|
||||
typedef std::function<void(SystemEvent)> OnSystemEvent;
|
||||
|
||||
void publishSystemEvent(SystemEvent event);
|
||||
|
||||
SystemEventSubscription subscribeSystemEvent(SystemEvent event, OnSystemEvent handler);
|
||||
|
||||
void unsubscribeSystemEvent(SystemEventSubscription subscription);
|
||||
|
||||
}
|
||||
@@ -1,21 +1,22 @@
|
||||
#pragma once
|
||||
|
||||
#include <Tactility/SystemEvents.h>
|
||||
#include <Tactility/service/Service.h>
|
||||
|
||||
#include <memory>
|
||||
|
||||
struct Device;
|
||||
struct SystemEvent;
|
||||
|
||||
namespace tt::service::rtctime {
|
||||
|
||||
class RtcTimeService final : public Service {
|
||||
|
||||
kernel::SystemEventSubscription timeEventSubscription = 0;
|
||||
bool timeEventSubscribed = false;
|
||||
Device* rtcDevice = nullptr;
|
||||
|
||||
Device* findRtcDevice();
|
||||
void onTimeChanged(kernel::SystemEvent event);
|
||||
void onTimeChanged();
|
||||
static void onTimeChangedTrampoline(struct SystemEvent* event, void* context);
|
||||
|
||||
public:
|
||||
|
||||
|
||||
Reference in New Issue
Block a user