Ersa Wearable Platform
Embedded smartwatch firmware and application framework
Loading...
Searching...
No Matches
Classes | Functions | Variables
NetSync Namespace Reference

Classes

struct  CalEvent
 
struct  CalTodo
 

Functions

void begin ()
 
size_t eventCount ()
 
const CalEvent & getEvent (size_t index)
 
size_t todoCount ()
 
const CalTodo & getTodo (size_t index)
 
void toggleTodo (size_t index)
 
bool isSyncing ()
 
const char * lastStatus ()
 
time_t parseHttpDateToEpoch (const char *str)
 
bool fetchHttpUtc (time_t &outUtc, uint32_t timeoutMs=ersa::config::HTTP_TIME_TIMEOUT_MS)
 
bool fetchNtpUtc (time_t &outUtc, uint32_t timeoutMs=ersa::config::NTP_SYNC_TIMEOUT_MS)
 
bool fetchTimeWithFallbacks (time_t &outUtc, bool &isHttpFallback, bool updateStatus=true)
 
bool startBootTimeSync ()
 
void tick ()
 
bool syncNtp ()
 
bool syncAll ()
 

Variables

constexpr size_t MAX_EVENTS_PER_DAY = 6
 
constexpr size_t CALENDAR_CACHE_DAYS = 7
 
constexpr size_t MAX_EVENTS = MAX_EVENTS_PER_DAY * CALENDAR_CACHE_DAYS
 
constexpr size_t MAX_TODOS = 12
 

Function Documentation

◆ begin()

void NetSync::begin ( )

Load cached items and initialize synchronization state.

◆ eventCount()

size_t NetSync::eventCount ( )

Return the number of currently retained calendar entries.

◆ fetchHttpUtc()

bool NetSync::fetchHttpUtc ( time_t &  outUtc,
uint32_t  timeoutMs = ersa::config::HTTP_TIME_TIMEOUT_MS 
)

◆ fetchNtpUtc()

bool NetSync::fetchNtpUtc ( time_t &  outUtc,
uint32_t  timeoutMs = ersa::config::NTP_SYNC_TIMEOUT_MS 
)

◆ fetchTimeWithFallbacks()

bool NetSync::fetchTimeWithFallbacks ( time_t &  outUtc,
bool &  isHttpFallback,
bool  updateStatus = true 
)

◆ getEvent()

const CalEvent & NetSync::getEvent ( size_t  index)

Return a cached event by index; callers must check eventCount() first.

◆ getTodo()

const CalTodo & NetSync::getTodo ( size_t  index)

Return a cached task by index; callers must check todoCount() first.

◆ isSyncing()

bool NetSync::isSyncing ( )

Report whether a sync operation currently owns Wi-Fi resources.

◆ lastStatus()

const char * NetSync::lastStatus ( )

Return a borrowed status string describing the latest sync outcome.

◆ parseHttpDateToEpoch()

time_t NetSync::parseHttpDateToEpoch ( const char *  str)

◆ startBootTimeSync()

bool NetSync::startBootTimeSync ( )

Start a non-blocking boot fallback when no phone/manual time has arrived.

◆ syncAll()

bool NetSync::syncAll ( )

Run time and configured CalDAV synchronization for explicit user requests.

◆ syncNtp()

bool NetSync::syncNtp ( )

Run a synchronous NTP/HTTP time sync for explicit foreground requests.

◆ tick()

void NetSync::tick ( )

Apply completed boot-sync results from the UI task, preserving source priority.

◆ todoCount()

size_t NetSync::todoCount ( )

Return the number of currently retained task entries.

◆ toggleTodo()

void NetSync::toggleTodo ( size_t  index)

Toggle a task's local completion bit and persist the updated cache.

Variable Documentation

◆ CALENDAR_CACHE_DAYS

constexpr size_t NetSync::CALENDAR_CACHE_DAYS = 7
constexpr

Number of calendar days represented by the bounded cache.

◆ MAX_EVENTS

constexpr size_t NetSync::MAX_EVENTS = MAX_EVENTS_PER_DAY * CALENDAR_CACHE_DAYS
constexpr

Total fixed event capacity across the cache window.

◆ MAX_EVENTS_PER_DAY

constexpr size_t NetSync::MAX_EVENTS_PER_DAY = 6
constexpr

Maximum events retained for one local calendar day.

◆ MAX_TODOS

constexpr size_t NetSync::MAX_TODOS = 12
constexpr

Maximum task entries retained in RAM and persistent cache.