LWM2M Leshan How to configure the default period of an observe?

975 Views Asked by At

I am currently working on a lwm2m project, using the leshan eclipse project.

When observing a resource, lwm2m seems to use the default minimum period and the default maximum period, two resources of the "LWM2M Server" object.

Basically, from what I understood, the default minimum period (/1/0/2) is the minimum period of time between two observed values (no matter how many times the value of the observed resource changes, the client will only send one message every x seconds, x being set by the default minimum period). the default maximum period is the maximum period of time between two messages : even if the value doesn't change, the client will send a message after a while.

But these values are used for every resources of every objects of a client. I would like to know if it is possible to be more precise. I would like to be able to set a default minimum period and a default maximum period for every resources I want to observe. Is it possible?

2

There are 2 best solutions below

0
On

You can pass minimum period and maximum period in WriteAttributesRequest which should be sent before setting observe. This WriteAttributesRequest needs resource path for which it has to set this minimum period and maximum period. Once WriteAttributesRequest is successful you can set observe which will follow earlier given period values.

0
On

Observe/notify is one of heaviest operations for constrained clients - you need loop/thread/timer to implement it. Imagine that you will have timer per object - it will affect CPU usage and battery drain.

You can extend client and server to support such logic, but I am afraid standard does not provide such capabilities.