-
Notifications
You must be signed in to change notification settings - Fork 408
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
Registration Update Trigger #453
Comments
AFAIK, there is nothing which prevents to implement it. How could this look like ? |
Well, I tried to add it myself but couldn't successfully send the update command to the registration engine instance from my custom server class. Was wondering if someone had already tried it and succeeded since it's not in the demo client. |
I'm finishing something and I will try this. |
Yeah, I needed this... :) #405 I'm using it like this in our sensor simulator, in a class that extends the org.eclipse.leshan.client.object.Server object:
|
Tested with master, I added this is at the end of LeshanClientDemo : // Change the location through the Console
try (Scanner scanner = new Scanner(System.in)) {
while (scanner.hasNext()) {
String nextMove = scanner.next();
if ("u".equals(nextMove)) {
client.triggerRegistrationUpdate();
} else {
locationInstance.moveLocation(nextMove);
}
}
} When I type ureturn in standard input, it triggers successfully an update. |
Is it also possible to add the same functionality when the client receives an execute request to resource /1/0/8 from the server? |
Yes, I think this is the sample of code provided by @bolddp above. |
@bolddp How do you get the client object in order to trigger the registration update? |
I have a Sensor class that owns both the LeshanClient and the settings for it. This sensor is then injected into a subclass of org.eclipse.leshan.client.object.Server. That way, the Server instance, that is created before the actual client it will belong to, can reference the client later on like in the code sample above. |
Hi bolddp, is it possible for you to share the skeleton of your sensor class? How do you inject the sensor into a the subclass you mentioned? |
Sure. I've removed some irrelevant code, and some constant references are not included so it doesn't compile, but I hope it's clear enough: https://gist.github.com/bolddp/d4f13efe502d0915c550e4fc429aeb0a |
@bolddp That helped a lot. Thanks! |
I reopen this because we could implement this in Leshan demo. |
Hi @sbernard31, I have a question. It is possible to make the client update more frequent such that sending two updates in 60 seconds. Thanks :) |
Currently, |
Hi @sbernard31 I usually modify the value by sending write request through leshan server. Is there a way to modify the lifetime internally inside leshan client ? Do you have code example ? Thanks :) |
In https://github.com/eclipse/leshan/wiki/Getting-Started-:-Client#create-my-own-objects You can set the lifetime at client creation :
You can also set a large lifetime and create your own periodic task and call |
Thanks @sbernard31 As for the server object defined in LWM2M, the lifetime will serve as update period. Thanks :) |
What is I'm not sure to get the point. |
Yes, should be RedisTokenHandler. I think. Regards :) |
I created a PR #802 which adds a new |
Update registration trigger is not implemented in the demo client. Is there anything preventing the implementation?
The text was updated successfully, but these errors were encountered: