-
Notifications
You must be signed in to change notification settings - Fork 409
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Implementation of Observe-Composite #1034
Comments
AFAIK, this is not implemented in Californium. It may be possible to replace the |
Good to know. 👍 I didn't look deeply at the LWM2M
If I understand you correctly you want to make the root resource of LWM2M client observable ? public RootResource(RegistrationEngine registrationEngine, CaliforniumEndpointsManager endpointsManager,
BootstrapHandler bootstrapHandler, CoapServer coapServer, LwM2mRootEnabler rootEnabler,
LwM2mNodeEncoder encoder, LwM2mNodeDecoder decoder) {
super("", registrationEngine, endpointsManager);
this.bootstrapHandler = bootstrapHandler;
setVisible(false);
// ---- add the line below ----
setObservable(true);
// ----------------------------
this.coapServer = coapServer;
this.rootEnabler = rootEnabler;
this.encoder = encoder;
this.decoder = decoder;
} HTH |
Thank you a lot :) The solution |
I don't know if RFC7641 allow to observe root. (I don't remember anything which forbid it but I didn't look at this for a while). About californium, I guess nothing prevent this but we will see. @boaks do you know anything about this ? About LWM2M, I understand that "Observe-Composite" is an observe on root but not crystal clear to me. Here is the LWM2M v1.1 spec about this (the one we currently try to implement):
Here is the LWM2M v1.2 spec which could help to better understand, in §transport there is an example with query params which targets root :
@boaks, if I will maybe ask more clarification about this feature to OMA 🤔 . |
FMPOV, RFC7641 doesn't mention that, mainly because there is no difference in the root or other resources. What seems to be special in LwM2M is the relation of the payload of resource and their child resources and the expectations resulting out of that. Until now, I considered that to be limited to the way, "changes are detected". Hope that is still true. |
Some hints: |
For Californium, that seems to be somehow "in between" :-). Using different tokens should enable to have multiple observes. Calling "changed(ObserveRelationFilter)" then hopefully works, to filter the intended relations of such a change. But I'm not that sure. My concern in the comment above is more, that usually lwm2m-clients are not Californium based, so it may get important, how other implementations deal with that. |
I opened an issue to talk about "1 Observe-Composite at a time" : OpenMobileAlliance/OMA_LwM2M_for_Developers#528 There is also a discussion about @boaks, I don't know if you notice that |
AFAIK, GET should not come with payload (at least in a strict interpretation, see FETCH .)
I just added the codepoints on a request. I don't use it, therefore I don't know, if the "support" is correct. |
@MichalWadowskiOrange, if there are other feature/issue that Orange is working on, please let us know. (Even if there is not so much commitment, this is just to be sure we will not start to work on same thing) |
Hi, |
I have a question: In interface ObservationListener on Observe-Composite event should we call newObservation() and onResponse() multiple times (as many as items are in response), or rather should we create CompositeObservation type and create newObservation() onResponse() equivalents? public interface ObservationListener {
///...
void newObservation(CompositeObservation observation, Registration registration);
void cancelled(CompositeObservation observation);
void onResponse(CompositeObservation observation, Registration registration, ObserveResponse response);
void onError(CompositeObservation observation, Registration registration, Exception error);
} |
I guess this is maybe not a good idea. I'm afraid that some users want to get all the data at same time to be able to process it all together. 🤔
This could be a solution but I guess there is a lot of code where you will need to handle those 2 type of Maybe we should consider to have a hierarchy of class : Which could help to reuse some existing code 🤔 And so having something like this : public interface ObservationListener {
///...
void newObservation(Observation observation, Registration registration);
void cancelled(Observation observation);
void onResponse(SingleObservation observation, Registration registration, ObserveResponse response);
void onResponse(CompositeObservation observation, Registration registration, ObserveCompositeResponse response);
void onError(Observation observation, Registration registration, Exception error);
} This is just an idea, I didn't dig this too much. |
At client side all the listener class hierarchy ( ObjectsListener, ObjectListener, ResourceListener) will maybe need to be modified too 🤔 ? I'm currently look at "Add Resource Instance level support to Observe"(#1041) and I will need to modified it too. |
I'm probing your proposition of SingleObservation/CompositeObservation/Observation, and I encounter another issue: in Should we split this declaration into Or maybe should we make the Observation path size agnostic I mean there will be always list of paths? |
We organized our work in the fork: https://github.com/Przem83/leshan and implementation of Observe-Composite is in dev_observe_composite branch. Of course implementation is only the proof of concept 😄 |
My idea about introducing an Observation hierarchy was to avoid to multiply method. Anyway, if you find any argument which makes you feel that first way is better share it because I have no strong opinion for now. |
I'm want to announce that I just implemented observe-compose functionality (in repository that I mentioned earlier) 😄. It needs a lot of code cleaning and the Redis integration is not implemented yet, but you can check the solution in general. |
👍 I could probably look at this next week. |
Do directly linked but I just pushed a PR about Observe Resource Instance (#1054) |
@MichalWadowskiOrange, I looked a little bit at your code. I just made a high level review to look at the direction your take and so here my first remarks: 1) I would keep the name 2) About this part of the code I'm not sure but I don't think this is the right approach. Because I feel we should see Observe-Composite as an only one observe relation. This would be more the CoAP spirit and the LWM2M specification says :
To implement this is that way, you probably need to create a custom @boaks, do you think I have the right approach or I missed something ? (or maybe you think that @MichalWadowskiOrange way is OK too?) |
Thanks for the review 😄 Fortunately I can remove the whole code you mentioned without any impact for the functionality. It's residue of times when I was developing this solution. According to SingleObserveResponse - I wanted to unify the naming to be similar to SingleObservation/CompositeObservation. But I agree that we should keep the naming convention as close to specification as possible 😄 |
I just want to note that the code is ready for review. BTW, should I create separate issue and branch/PR for Cancel Observe-Composite operation? |
I think the next step is to provide PR(s) for this code (or maybe you want to experiment Cancel Observer-composite first) To make easier review and get better feedback. I strongly encourage to try to do several small PRs or at least to several commits. Personally, You could look at #1054, to have an example, in this PR I push all commit on same PR but you can do more PR if needed (maybe easier to review) (We don't use merge so PR must not contains merged commit, you should use rebase instead) Some examples of commit/PRs :
(This is just example and maybe you can find better or more suitable to you, the idea is to separate small consistent modifications) Hoping you approve the approach. 😬
Yes this should be done in other PRs. |
My conclusion from splitting the functionality into separated pull requests: Its easy to discuss every separate piece. It's probably easier to code reveiw, because changes are smaller. But it's very hard to maintain. Splitting work into pieces needs a lot of work, and after changes in one PR it also needs a lot of work to propagate changes into another PRs. The same situation if we need to synchronize with master. I think, creating multiple commits in on PRs is better solution :) Btw. I'm going to holidays :), so I can't participate in project for three weeks. I hope these pull requests will be final :) |
@Michal-Wadowski Enjoy your Holidays 😉 |
I will start to (re)review your PRs and integrate it in a Once this will be done, I will let you "validate" the branch (if wanted) before to integrate it in |
Branch can be reviewed at #1083. |
I agree there is a more extra cost to work like this. But in this particular case I feel there are some issues which could explain this was more painful than it could be :
My advice : If you want to do some code improvement, this is OK and very welcomed but prefer to make it in separate PRs/task or just open an issue. In a general way to not hesitate to do more commit than needed as merging commits (even if there are not consecutive) is often easier than splitting. This is for big/complex feature only : HTH Anyway, I hope that was not a too unpleasant experience, and thx for your work and patience, it is really appreciated 🙏 ! Just to let you know, I will be out of office at the end of day, I'm back begin of September. |
Thank you for cleaning the code in PR #1083 and make one more similar to the currently written code 😄 According to my issues with the code style - I tried to use IntelliJ to do whole the work, but I think it will be much easier to just use Eclipse to polish final code next time. |
@Michal-Wadowski, your work is now integrated in master. I have in mind the "support of timestamped value", I'm not sure if there is something else ? |
Last jenkins job failed because of a test failure:
|
(From ObserveCompositeTest) See #1034 (comment)
No, I have no opinion about what should be done yet (except timestamped values). If I find one I will note here. |
I created a dedicated issue for timestamped values feature : see #1089. I think we can close this one now ?
Please create a new issue instead. @Michal-Wadowski let me know if you are working or plan to work on something else. |
Yes, I think we can close this issue. For now I'm going to work on #1046 |
Hello everyone!
I want to participate in the implementation of Observe-Composite functionality.
I'm working on prototype of this functionality and I have a problem:
In COAP module there is
org.eclipse.californium.core.server.ServerMessageDeliverer.deliverRequest()
method. This method getsResource
according to UriPath passed in request.Then method
checkForObserveOption()
addedsObserveRelation
relation to the exchange. This is necessary to correlate observe client responses with server observe request.But for the Observe-Composite should be passed multiple paths in payload. I could set
LwM2mPath.ROOTPATH
as target and paths in payload like it's done inCoapRequestBuilder.visit(ReadCompositeRequest request)
, but in that case in methodServerMessageDeliverer.deliverRequest()
I will getRootResource
andcheckForObserveOption()
will not pass, becauseRootResource
is not observable.Am I doing this in wrong way, or implementation of COAP may be incomplete?
Thank you in advance for your answer.
The text was updated successfully, but these errors were encountered: