Appearance
Minimal Telemetry Example
Putting it all together, a minimal telemetry setup looks like this:
cpp
static flake::Service* service = nullptr;
void app_init()
{
// Obtain device_id (e.g. IMEI) from modem or NVM
char imei[IMEI_LENGTH + 1] = {};
load_or_query_imei(imei, sizeof(imei));
coldwave_init_app(imei); // fills global 'service'; backend FQDN/CA
// were set on coldwave_init_t::backend
// before coldwave_init()
setup_property_callbacks(); // register DO1/DO2/STATE/etc.
connectivity_init();
coldwave_backend_attach(); // non-blocking, parameterless
while (!coldwave_backend_attached()) {
osDelay(100);
}
}
void app_main_loop()
{
while (true) {
update_status_properties(); // set<PWR>, set<HEAP>, set<RTC>, ...
service->sync(1000); // send/receive updates
osDelay(1000);
}
}This pattern is sufficient to:
- publish device telemetry as properties, and
- receive commands/configuration via property callbacks,
while Coldwave takes care of transport and backend communication.