-
Notifications
You must be signed in to change notification settings - Fork 413
Description
Following discussion at #1237 (comment), we start to work about Gateway support in Leshan v2.x.
Here is the specification : LwM2M_Gateway-v1.1.1.
A LwM2M Gateway allows a LwM2M Server to manage end IoT devices "behind" the LwM2M Gateway. The protocols
used between the LwM2M Gateway and its connected end IoT devices and any protocol translation carried out by the
LwM2M Gateway are outside the scope of this specification.
This issue aims to discuss/specify modification needed to add Gateway support at Server side.
Registration
Code design
We could add new kind of registration : GatewayRegistration, EndDeviceRegistration.
I don't know yet if we should go with :
- Change
Registrationto make it an interface. - Create a
DeviceRegistrationconcrete class (which replace formerRegistrationone) - Add
GatewayRegistration,EndDeviceRegistrationclasses
OR
- Add
GatewayRegistration,EndDeviceRegistrationclasses which inherit from currentRegistrationone
I have not full design in mind yet but at least :
GatewayRegistrationwill contain a new attribute : list of child end device endpoint nameEndDeviceRegistrationwill contain new attributes : its prefix and the registraiton id of the parent gateway.
Maybe we should also create dedicated LwM2mIdentity class for end device ? Maybe this is even enough and you don't need class above ☝️ ? 🤔 This is maybe more true for end device where we can eventually consider prefix+registrationId parent gateway as part of identity but for Gateway hard to consider the `list of children" as part of identity...
behavior
On gateway registration, in registration payload we know if there is instances of Gateway (obj 25)
If yes we can read object 25 and create a new registration for each instance.
On gateway registration update, we can detect if there is new end device (register) OR if some are removed (deregister)
On gateway deregistration, we need to deregister/remove all child device (ideally in an atomic manner)
How to handle end device ? Maybe it's up to the Gateway to use send operation to notify that IoT Device Objects (resource 3) changed...
Device Management And Service Enablement and Information Reporting Interfaces
Simple Operation
The "Read", "Discover", "Write", "Write-Attributes", "Execute", "Create", "Delete", and "Observe" should works out of the box 🤔
Composite and Send Operation
The "Read-Composite", "Write-Composite", and "Observe-Composite" operations can target the Device Objects by
prepending the name of the targeted Object, Object Instance, Resource, or Resource Instance with the Prefix associated
to an IoT DeviceResources and Resource Instances values from the Device Objects can be part of the reported values
If we don't support that composite and send operation support several end devices at same time there is not too much modification. But the specification allow it and users will probably need it.
For Read-Composite and Observe-Composite request, we need to list path from different device...
So should we modify LwM2mPath to add a possible device prefix ?
For all those operations we need to decode/encode payload from different devices, so from different object models.
That means we need to change API to not only provide a model but a kind of ModelProvider which is able to provide model by prefix.