Ersa Wearable Platform
Embedded smartwatch firmware and application framework
Loading...
Searching...
No Matches
scheduler.h
Go to the documentation of this file.
1#pragma once
2
3#include <stdint.h>
4
5namespace ersa::runtime {
6
10 bool wakeSourcesReady{false};
12 bool consoleAttached{false};
14 bool userIdle{false};
18 bool networkWorkActive{false};
20 bool displayBusy{false};
22 bool featureLeaseHeld{false};
24 bool pendingWork{false};
25
32};
33
42public:
44 explicit WakeDeadlineSet(uint32_t maximumWaitMs) : delayMs_(maximumWaitMs) {}
45
47 void includeDelay(uint32_t delayMs) {
49 }
50
52 uint32_t delayMs() const { return delayMs_; }
53
54private:
55 uint32_t delayMs_;
56};
57
61 uint32_t waitMs{25};
62};
63
66public:
73 static LoopSchedule plan(const SleepEligibility& eligibility,
74 bool appDirty, bool inputPending,
75 uint32_t earliestDeadlineMs) {
76 if (eligibility.maySleep()) {
77 return {true, earliestDeadlineMs};
78 }
79 return {false, (appDirty || inputPending) ? 1U : 25U};
80 }
81};
82
83} // namespace ersa::runtime
Definition scheduler.h:65
static LoopSchedule plan(const SleepEligibility &eligibility, bool appDirty, bool inputPending, uint32_t earliestDeadlineMs)
Definition scheduler.h:73
Definition scheduler.h:41
uint32_t delayMs_
Definition scheduler.h:55
WakeDeadlineSet(uint32_t maximumWaitMs)
Definition scheduler.h:44
uint32_t delayMs() const
Definition scheduler.h:52
void includeDelay(uint32_t delayMs)
Definition scheduler.h:47
Definition scheduler.h:5
Definition scheduler.h:59
bool allowAutomaticSleep
Definition scheduler.h:60
uint32_t waitMs
Definition scheduler.h:61
Definition scheduler.h:8
bool networkWorkActive
Definition scheduler.h:18
bool displayBusy
Definition scheduler.h:20
bool maySleep() const
Definition scheduler.h:27
bool featureLeaseHeld
Definition scheduler.h:22
bool userIdle
Definition scheduler.h:14
bool consoleAttached
Definition scheduler.h:12
bool foregroundWorkActive
Definition scheduler.h:16
bool pendingWork
Definition scheduler.h:24
bool wakeSourcesReady
Definition scheduler.h:10