Skip to main content



      Home
Home » Eclipse Projects » Kura » Getting properties changes from broker via MQTT
Getting properties changes from broker via MQTT [message #1750470] Wed, 21 December 2016 06:37 Go to next message
Eclipse UserFriend
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 Go to previous message
Eclipse UserFriend
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
Previous Topic:Connect HSQL Database
Next Topic:Information about kura crypto API
Goto Forum:
  


Current Time: Wed Jul 30 18:53:58 EDT 2025

Powered by FUDForum. Page generated in 0.02739 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top