Appearance
Attaching to the Coldwave Backend
Backend FQDN and (optional) CA certificate are part of coldwave_init_t::backend and have already been consumed by coldwave_init(). To trigger the actual connection, call:
cpp
int rc = coldwave_backend_attach();
if (rc != CW_OK) {
// CW_ERR_NOT_INITIALIZED – coldwave_init() did not succeed
// CW_ERR_ALREADY_ATTACHED – attach already pending / online
// CW_ERR_NO_BACKEND – no backend.fqdn was provided at init
// handle attach error
}
// The call is non-blocking; the connection is established asynchronously.
// Wait until the backend connection is online if you need it before proceeding:
while (!coldwave_backend_attached()) {
osDelay(100);
}Notes:
- A non-null
backend.ca_certenables TLS/DTLS; passingnullptrfalls back to unencrypted UDP (PTP only). coldwave_backend_attached()returnstrueonce the device is logically connected to the backend.- Tear the connection down with
coldwave_backend_detach(); the flake CoreWorker stays alive andcoldwave_backend_attach()can be called again without going throughcoldwave_init()once more.
After this point, service->sync() can exchange property updates with the backend.