Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    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 11:37 Go to next message
Marina Å abić is currently offline Marina Å abićFriend
Messages: 4
Registered: December 2016
Junior Member
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 23:59 Go to previous message
David Woodard is currently offline David WoodardFriend
Messages: 420
Registered: July 2014
Senior Member
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: Fri Apr 26 19:08:12 GMT 2024

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

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

Back to the top