OpenMobileAlliance / OMA_LwM2M_for_Developers

OMA LightweightM2M public resources.
http://openmobilealliance.github.io/OMA_LwM2M_for_Developers/
Other
239 stars 52 forks source link

LWM2M object and resource definition questions #562

Closed burchmere21 closed 1 month ago

burchmere21 commented 1 year ago

I have very little background with LWM2M so excuse me if the question lacks the proper terminology or detail. If a defined object exists, but an LWM2M client device supports resource(s) that are not defined for that particular object - how is that best handled?

For example: IPSO Object ID 3303 - Temperature 3303/0/5700 = sensor value 3303/0/5601 = min measured value 3303/0/5602 = max measured value 3303/0/??? = average measured value (over some period of time configured elsewhere) Is it allowable to define new resources for an existing object? Or is it preferred to define a new object? Can the new resource or object be "private"? What is the preferred approach and what are optional approaches?

Thanks.

sbernard31 commented 1 year ago

(I'm not an author of the specification, I just share my current understanding)

I understand that your question is : "How to extend existing object ?"

1. Updating the registered Object

If you think the resource you want to add makes sense for everyone, maybe you should try to open a PR to update the object ?
I don't know if this is possible to update an object if you are not the owner ?
I don't know who decides if a resource should be added to an object too ?
@jpradocueva maybe you can clarify the process.

2. Extending the object with private optional resource

Another solution could be to add new optional resource. As you modify the object you could want to increment version number but if you do that you could face conflict with new official version of the object. So maybe the solution could be to extend an existing version with "private" optional resource without incrementing object version. But if several devices do that you could face conflict ID too and it could begin to be hard to know which model to use at server side ...

So it could works in some case but not 100% future proof and maybe not really defined by the specification ? It seems there is some private ID range for resource but I don't know the purpose of this ?

Category Resource ID Range Description
Common Resources 0 - 2047 Common resource defined inside Objects. Inside of an Object the resourceIDs must be unique but it can be reused in different Objects.
Reusable Resources 2048 - 26240 Resources registered by companies, standards organisations or alliances. Note: ResourceID is finally allocated by OMNA Staff. Private registrations are not allowed
Private Resources 26241 - 32768 Private resource range, no registration is necessary and open to re-use.

(See : https://technical.openmobilealliance.org/OMNA/LwM2M/LwM2MRegistry.html)

3. Creating a new object with a different ID

You can create an extended version with a new ID. This is for sure allowed by the specification but you lost interoperability with device which are using "not" extended version of the object ...

About range id you should probably use Company Reserved range ? But I don't know if this is mandatory to reserve a range ?

Class URN segment Object ID range Description
OMA oma 0-1023 Objects Produced by the Open Mobile Alliance.
reserved N/A 1024-2047 Reserved for future use.
SDO ext 2048-10240 Objects registered by third party standards organisations or alliances.
Vendors x 10241-32768 Objects registered by vendors or individuals.
Company Reserved x 32769-42768 Company bulk reservation of up to 50 Object IDs. This range is to create private LwM2M Objects that are not published on the OMNA Lightweight Object registry.
Test N/A 42769-42800 Object IDs for testing purpose. These IDs MUST NOT be used in production as collisions with other Object IDs are possible.
reserved N/A 42801-65534 Reserved for future use.

See :

By the past same kind of question was asked and I tried to get clarification without success (https://github.com/OpenMobileAlliance/OMA_LwM2M_for_Developers/issues/429#issuecomment-468187850)

Anyway any clarification from OMA about all of this is welcomed :pray: