Skip to content

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'
    setup_property_callbacks();     // register DO1/DO2/STATE/etc.

    connectivity_init();
    coldwave_backend_attach(COLDWAVE_BACKEND_URL, backend_ca, backend_ca_len);

    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, budget-aware sync and backend communication.