leshan
leshan copied to clipboard
Add support to "/" for Read-Composite.
Currently this is not supported :
[{"n":"/"}]
(source : http://www.openmobilealliance.org/release/LightweightM2M/V1_1_1-20190617-A/HTML-Version/OMA-TS-LightweightM2M_Core-V1_1_1-20190617-A.html#Table-745-10-SenML-JSON-payload-in-the-request-to-all-objects)
Together with @JaroslawLegierski we came up with an implementation for this case. Let me know what you think about this kind of solution.
I'm not sure I get it :thinking:
It looks like a kind of HACK at leshan-server-demo side as you change a ReadCompositeRequest on / by ReadCompositeRequest on all specific object supported by the client (https://github.com/eclipse/leshan/commit/1a782cefd25679864c57814ad513f95c8e8bd96c#diff-8f94b871acdc39fb01247b73d4d7814389187176c1af3b0a6628efe7e1f4f62e)
The idea is more to add support of this feature in the library itself.
I mean we want to be able to create a new ReadCompositeRequest("/");
:warning: I don't think so much about this feature but I guess the harder part is about making Encoder/Decoder compatible with it. This needs not so easy changes because current API is not adapted.
E.g for decoder :
Map<LwM2mPath, LwM2mNode> decodeNodes(byte[] content,
ContentFormat format, List<LwM2mPath> paths, LwM2mModel model)
throws CodecException;
when you call it with paths = ["/3","/2/0","/5/0/1"]
You should get something like a map { "/3"=> LwM2mObject, "2/0"=>LwM2mObjectInstance, "5/0/1"=>LwM2mSingleResource}
And so when you call it with paths = ["/3","/2/0","/5/0/1"] you should get {"/"=> LwM2mRoot}
But a LwM2mRoot which extends LwM2mNode does not exist for now.
Finally I was able to create a rough PoC, you can find it here. There's obviously a lot to improve in the code, but let me know if you even like my approach.
I looked at this quickly and I feel it goes in the right direction.
The main design issue is how we should handle LwM2mRoot.getId() ?
(By the way I will be unavailable until 22th August)
@sbernard31 do you think we could advance with this issue?
I currently have hard time working on Transport Layer abstraction. :sweat_smile:
But I can review PR or code and give some feedback is needed from time to time.
Keep in mind that I will not integrate new feature in master before to get transport layer integrated. (bug fix can be integrated)
@sbernard31 Here is a proposal of displaying read-composite on root path. I’ve implemented it as a list, below is a link to changes. https://github.com/eclipse-leshan/leshan/compare/master...JaroslawLegierski:leshan:opl/composite_on_root
I look at you work and with a Leshan client demo this looks like :
That changes a lot of other composite display.
Should we try to have something which looks more like others :
It's also totally OK if some feature supported by Leshan library is not in demo OR have no UI in demo. So are we sure we want a UI for it ?
Also maybe better to first focus on a PR about adding support of "/" to read composite in library with some integration tests. Then once this is done, focus on the UI ?
@sbernard31 I added integration tests for root case. Could you take a look on it?
I looked at it quickly, I think this is the right direction. Maybe you can review your code, clean it if needed, remove everything about demo then create a PR about it ? :slightly_smiling_face:
This is implemented by #1534 and will be available in next release 2.0.0-M14.