Move LwM2mVersion in DefaultRegistrationEngine as a field instead of local variable
See original GitHub issueI’m migrating LwM2m 1.0 test client to LwM2m 1.1 but I want to keep also the possibility the client to register as a 1.0 device. I’m using a command line parameter which switches the client to support LwM2m 1.0 or 1.1 but when the client registers to the server it always does this as a 1.1 device. I found that this is happening because in the DefaultRegistrationEngine class the LwM2mVersion is used as a local variable in the private Status register(ServerIdentity server) throws InterruptedException
method and it’s always set to the latest supported version.
Is it possible to move the LwM2mVersion as a field which always keeps the latest supported LwM2m version instead of local variable? In this case if someone wants to use Leshan 2.0 libraries but to register a client which support older LwM2m version, he/she can use a ‘setter’ telling the version his/her client wants to use. This will give the possibility to tests some backward compatibility migrating a LwM2m server to support 1.1 but using the same Leshan client libraries.
I can propose this change in a pull request, but currently I don’t have permissions to do that.
Issue Analytics
- State:
- Created a year ago
- Reactions:1
- Comments:5 (4 by maintainers)
Top GitHub Comments
I totally understand that this could be a user request.
At first sight this looks like a simple modification, just using
1.0
or1.1
value for LWM2M version. But there is more behavior changes than this and so providing a client which is able to behave as a LWM2M v1.0 or a LWM2M v1.1 client is not that easy…For now we made the choice to just target LWM2M v1.1 for Leshan v2.x. So, if you really want to test LWM2M v1.0 client you should keep using Leshan v1.x. And using Leshan v2.x when you want to test with a LWM2M v1.1 client.
I can consider this little change but I’m afraid that this bring you (or others) to the wrong way.
The wrong way because you will not really test backward compatibility, you will just test what happens when a client says it is a LWM2M v1.0 one but behave like a LWM2M v1.1 client…
So let’s talk about this, does it sound OK to you to use Leshan v1.x for LWM2M v1.0 and Leshan v2.x for LWM2M v1.1 ? If not, could you explain what you consider as a a problem with this way ? (maybe we will find a solution) 🙏
I close this one but feel free to reopen or comment if needed. (Note that I let #1244 open)