Getting properties changes from broker via MQTT [message #1750470] |
Wed, 21 December 2016 06:37  |
Eclipse User |
|
|
|
Hello,
as desribed on the 32. slide of this presentation (https://www.eclipsecon.org/europe2015/sites/default/files/slides/Shoot-A-Pi_v3_0.pdf) where it fetches commands from the cloud, would it be possible to get an int value which would set new publish rate in my app?
public void onMessageArrived(String deviceId,
String appTopic,
KuraPayload msg, int qos, boolean retain) {
Object command = msg.getMetric("Command");
if (command != null) {
switch (command.toString()) {
case "NewGame":
GameLogic.startGame();
break;
case "StopGame":
GameLogic.stopGame();
break;
}
}
}
Is it possible to change this part and update properties(publish rate) this way?
Like this:
Object new_publish_rate = msg.getMetric("Publish rate");
Now the question is how to set it, it is set manually throught Kura web UI right now and the update is similar to the one in the publisher example from the workspace zip.
Thank you in advance.
|
|
|
Re: Getting properties changes from broker via MQTT [message #1750515 is a reply to message #1750470] |
Wed, 21 December 2016 18:59  |
Eclipse User |
|
|
|
Hello,
Yes, you can pass that metric to the application. I can't recall how publish rate is used in the demo, but I don't think you need to update the component. If you receive the metric, you should be able to assign it directly to the desired field within the class.
Thanks,
--Dave
|
|
|
Powered by
FUDForum. Page generated in 0.02990 seconds