Skip to content
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

Access to CoapResponse Object in RegistrationManager #24

Closed
JaroslawLegierski opened this issue Nov 24, 2022 · 8 comments
Closed

Access to CoapResponse Object in RegistrationManager #24

JaroslawLegierski opened this issue Nov 24, 2022 · 8 comments

Comments

@JaroslawLegierski
Copy link

JaroslawLegierski commented Nov 24, 2022

As part of the tests 1338 I would like to replace the californium coap stack by java-coap in the LwM2M Leshan client. In the first stage, I was able to register the modified leshan-demo-client in the LwM2M server (using RegistrationManager) but unfortunately I have a problem with response. I must forward some information from CoapResponse to the LwM2M layer. Is there any callback mechanism implemented in RegistrationManager that allows me to get a access to coapresponse Object?

@sbernard31
Copy link
Collaborator

@JaroslawLegierski do you have any code to share ?

@JaroslawLegierski
Copy link
Author

JaroslawLegierski commented Nov 30, 2022

Together with @adamsero we made this modification in RegistrationManager. But after recent internal discussions, I don't know if this is the right way to go. Maybe we need in java-coap mechanism similar to MessageObserver from Cf ?

@sbernard31
Copy link
Collaborator

I'm not sure to get what you try to achieve here.

FMPOV you should not try to reuse RegistrationManager, I guess this is an implementation of CoAP resource directory.

And LWM2M has pretty much same kind of concept which is already implemented in Leshan.

I guess you "just" want :
For sending request: take LWM2M request, translate it to a java-coap request, then send it, wait for response and translate it to LWM2M response.
For Receiving : find the hook where you receive request, take the java-coap request, translate it to a LWM2M request, give it to Leshan, get the LWM2M response then translate it to java-coap response then send it.

I guess it should have API to doing this in java-coap.
(I guess difficulty will come with observe , dtls, ...)

You need to find how to create a coap server (we need it for LWM2M client and server)
Find the API to handle CoAP request.
Find the API to Send CoAP Request.

There is some hints in the java-coap README about this.

@szysas
Copy link
Collaborator

szysas commented Dec 1, 2022

I also think reusing RegistrationManager class might not be the right thing to do. Registration management is a core part of LwM2M so I'd say that it should come from Leshan.
@JaroslawLegierski I can help with API and usage, just say what you need.

@JaroslawLegierski
Copy link
Author

@szysas I have question in coap token topic - in californium we have something like RandomTokenGenerator. Does something similar exist in java-coap or do we have to generate the token ourselves ?

@szysas
Copy link
Collaborator

szysas commented Dec 13, 2022

No, there is no such a generator. It should be simple to implement with Filter class, like this: EtagGeneratorFilter

@sbernard31
Copy link
Collaborator

I created dedicated issue to talk about java-coap in leshan at #27

@JaroslawLegierski maybe we can close this one ?

@JaroslawLegierski
Copy link
Author

Yes - very good idea

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants