Phase 1: foundation modules
Central Config with all tunables (retention, GPS timeout, colors, event type keys, menu item metadata). Event / EventStore handle persistence via Application.Storage with 7-day pruning. Logger mirrors the same retention. LayoutMetrics and Haversine provide resolution-independent geometry helpers. German UI strings and placeholder menu icons landed alongside so the build stays green. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
parent
6f56c337f7
commit
43f970d764
19 changed files with 409 additions and 2 deletions
41
source/Event.mc
Normal file
41
source/Event.mc
Normal file
|
|
@ -0,0 +1,41 @@
|
|||
import Toybox.Lang;
|
||||
|
||||
// Value object for a protocol entry. Serialized as a plain Dictionary
|
||||
// so Application.Storage can persist it.
|
||||
class Event {
|
||||
public var type as String;
|
||||
public var timestamp as Number; // unix seconds
|
||||
public var lat as Float or Null;
|
||||
public var lon as Float or Null;
|
||||
public var accuracy as Float or Null;
|
||||
|
||||
function initialize(type as String, timestamp as Number,
|
||||
lat as Float or Null, lon as Float or Null,
|
||||
accuracy as Float or Null) {
|
||||
self.type = type;
|
||||
self.timestamp = timestamp;
|
||||
self.lat = lat;
|
||||
self.lon = lon;
|
||||
self.accuracy = accuracy;
|
||||
}
|
||||
|
||||
function toDict() as Dictionary {
|
||||
return {
|
||||
"t" => type,
|
||||
"ts" => timestamp,
|
||||
"lat" => lat,
|
||||
"lon" => lon,
|
||||
"acc" => accuracy
|
||||
};
|
||||
}
|
||||
|
||||
static function fromDict(d as Dictionary) as Event {
|
||||
return new Event(
|
||||
d["t"] as String,
|
||||
d["ts"] as Number,
|
||||
d["lat"] as Float or Null,
|
||||
d["lon"] as Float or Null,
|
||||
d["acc"] as Float or Null
|
||||
);
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue