Public Access
Add core runtime: event bus, services, app lifecycle
lib/core is hardware-independent and unit-tested on the host: - EventBus: fixed-size thread-safe queue, delivered on the UI task by dispatch(); drops newest when full and counts drops - Service / ServiceManager: cooperative ticking at per-service intervals, no catch-up bursts, safe across millis() wraparound - App / AppManager: one foreground App, Home always to Launcher, Back offered to the App first, hidden Apps, redraw requests - KeyEvent: logical keys for the upcoming input layer Firmware main loop now ticks services and dispatches events. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01EhqxQ49eCju4CzKYNjZzwT
This commit is contained in:
@@ -0,0 +1,20 @@
|
||||
#pragma once
|
||||
|
||||
#include <cstdint>
|
||||
|
||||
namespace roro {
|
||||
|
||||
// A long-lived background capability (see CONTEXT.md). Services are ticked cooperatively from the
|
||||
// main loop; one that needs real concurrency (e.g. the radio) may run its own task internally and
|
||||
// report through the EventBus.
|
||||
class Service {
|
||||
public:
|
||||
virtual ~Service() = default;
|
||||
virtual const char* name() const = 0;
|
||||
virtual void start() {}
|
||||
virtual void stop() {}
|
||||
virtual void tick(uint32_t nowMs) { (void)nowMs; }
|
||||
virtual uint32_t tickIntervalMs() const { return 1000; }
|
||||
};
|
||||
|
||||
} // namespace roro
|
||||
Reference in New Issue
Block a user