LoomNTPSync class

Glue code to synchronize an RTC using an InternetPlat.

Always synchronizes the RTC from Loom_Interrupt_Manager::get_RTC_module().

Base classes

class LoomModule
Abstract root of Loom component modules inheritance hierarchy.

CONSTRUCTORS / DESTRUCTOR

LoomNTPSync(LoomManager* manager, const uint sync_interval_hours = 0)
NTP Sync module constructor.
LoomNTPSync(LoomManager* manager, JsonArrayConst p)
Constructor that takes Json Array, extracts args and delegates to regular constructor.
~LoomNTPSync() defaulted
Destructor.
void second_stage_ctor() override
Sync the RTC using NTP from the internet platform specified.

OPERATION

void measure()
Sync the time if necessary or enabled.
void package(JsonObject json) override
Package a modules measurements or state.
auto dispatch(JsonObject json) -> bool override
Route command to driver.

Enum documentation

enum LoomNTPSync::Error

enumerate errors

Enumerators
OK
INVAL_DEVICE_MANAGE

Failed to receive a Loom Device Manager.

INVAL_INTERNET

Failed to find the correct internet object.

INVAL_TIME

Retrieved a time that was invalid.

INVAL_RTC

Failed to find a RTC.

NON_START

No attempt was made to sync.

NO_CONNECTION

Repeated attempts were made to sync, but there was no response.

Function documentation

LoomNTPSync::LoomNTPSync(LoomManager* manager, const uint sync_interval_hours = 0)

NTP Sync module constructor.

Parameters
manager
sync_interval_hours in Int | <0> | [0-999] | What hourly period to sync the RTC, zero for once on startup.

LoomNTPSync::LoomNTPSync(LoomManager* manager, JsonArrayConst p)

Constructor that takes Json Array, extracts args and delegates to regular constructor.

Parameters
manager
in The array of constuctor args to expand

void LoomNTPSync::measure()

Sync the time if necessary or enabled.

Allows the module to run regularly by emulating a sensor, which have thier measure methods called regularly.

void LoomNTPSync::package(JsonObject json) override

Package a modules measurements or state.

Parameters
json out Object to put data into