Mistake on this page? Email us

Pause and resume feature

Client Lite provides support for sleepy devices that may have power and network constraints. It is important that a device is temporarily disconnected from the network and power in regular interval and is able to resume operation based on the application's decision to reconnect to Device Management.

The APIs described in this chapter manage the firmware update process and enable the application to control the device's connectivity to Device Management.

Calling pause API

When an application calls this API, it pauses Client Lite's timed operation and closes the network connection to Device Management. After this call, your application can continue with your own shutdown logic of the network interface and other peripherals, and prepare your device to enter standby mode, saving power and network bandwidth as well.

Use this API call:

void pdmc_connect_pause();

If your device is a UDP_QUEUE mode device, your application must set the callback handler which you pass to Client Lite through lwm2m_interface_set_queue_sleep_handler().

Whenever the client wakes up to send a registration update, it will stay on-line for a given time. This time is mbed-client.reconnection-count x mbed-client.reconnection-interval x2 (in seconds) defined in the client configuration (can be overridden from your application as well). This time is reset on every incoming and outgoing data packet. This gives Device Management sufficient time to push all queued messages to the client. Once there is enough inactivity on the socket, the timer expires and the application is informed about it through the sleep handler callback. The application can use this as an indication of the device going to sleep and can further implement the logic accordingly.

Note: This API does not deregister Client Lite from Device Management. It just closes the network connection. You may still see your device as registered on Device Management Portal, but it is not reachable.

Calling resume API

When your application is ready to reconnect to Device Management, call this API and pass a valid connected NetworkInterface pointer. Client Lite uses the pointer to open a new network connection to Device Management. This API resumes Client Lite operation and network connection to Device Management. It also updates the registration. You can only call this API after a successful call to pause().

Use this API call:

void pdmc_connect_resume(void *iface);

iface is the handler to a connected NetworkInterface.