Deregister your device
Devices usually deregister from Device Management services for one of two reasons:
-
The registration session lifetime on the LwM2M server expires. Device Management Client is marked as deregistered. For example, if the client has not been able to send its
register_update()
within the registered lifetime due to connectivity issues, it will be dropped to thederegistered
state by LwM2M server. -
Device Management Client requests deregistration by calling the
MbedCloudClient::close()
API:MbedCloudClient::close();
The result of that request can be:
-
Success
If Device Management Client is successfully deregistered from the Device Management service, your application receives the result through the unregistered callback:
MbedCloudClient::on_unregistered(void(*fn)(void));
-
Failure
If the deregistration operation fails, your application receives the result through the error callback:
MbedCloudClient::on_error(void(*fn)(int));
The
error
parameter passed with the callback contains more information on the error; use it to fix the problem.
-
When Device Management Client is deregistered from the LwM2M server for any reason, it will be marked as deregistered
in the Device Management services. All queued messages will be removed from the server-queue.
If Device Management Client tries to connect to the services while in the deregistered
state, it will be forced to perform a full registration again.
Deregister does not remove the device identity from the device, so the device will use the same identity to register with the Device Management service next time.