Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

The addition of a resource instance is not detected by LwM2mTestObject (3442) #1618

Closed
slaft opened this issue May 29, 2024 · 3 comments
Closed
Labels
bug Dysfunctionnal behavior client Impact LWM2M client

Comments

@slaft
Copy link

slaft commented May 29, 2024

Hi,
I'm testing the future 2.0.0-M15 (from the nightly build).

I use the Leshan client to test the server part (based on Leshan). The Leshan client is configured with an instance of LwM2mTestObject and a ResourceListener. I send a WriteRequest from the server:

  • mode: UPDATE
  • path: /3442/0/1120
  • the resource to write has 2 instances:
    • id: 0 and value: 1025
    • id: 1 and value: 1026

The LwM2mTestObject initially has 1 instance of the resource 1120 (id: 0, value: 1024), so I expect to be notified for change (in the ResourceListener) for: /3442/0/1120/0, /3442/0/1120/1 (and /3442/0/1120 which is something new compared to 2.0.0-M14).
But /3442/0/1120/1 is missing from the notification (the instance is nevertheless created).

newValue.getInstances().forEach((newInstanceId, newInstance) -> {
LwM2mResourceInstance previousInstance = newValue.getInstances().get(newInstanceId);
if (previousInstance == null) {
// addition
changedResources.add(getResourceInstancePath(resourceid, newInstanceId));
}
});

I guess that the issue is just that it should be previousValue instead newValue on L128.

@sbernard31
Copy link
Contributor

Hi @slaft, Good Catch ! and Thx a lot for taking time to report that 🙏

Following your explanation and reading the code I pretty sure you're right.

I'm gonna fix that.

Do you try your fix and does it solves your issue ?

@slaft
Copy link
Author

slaft commented May 29, 2024

Thanks. I've just tested it, yes it does solve the issue.

@sbernard31
Copy link
Contributor

It is fixed in master and will be available in 2.0.0-M15.

# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
bug Dysfunctionnal behavior client Impact LWM2M client
Projects
None yet
Development

No branches or pull requests

2 participants