Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Kura » MQTT configure application /CONF-V1/PUT
MQTT configure application /CONF-V1/PUT [message #1777857] Tue, 05 December 2017 12:06 Go to next message
F T is currently offline F TFriend
Messages: 2
Registered: December 2017
Junior Member
I would like to configure an configurable application via the Kapua REST-API. In order to do that, I can publish a mqtt message on a config topic of the device. But how do I have to serialize the payload? Can anyone please provide me with an example?

Topic: $EDC/account_name/client_id/CONF-V1/PUT/configurations/org.eclipse.kura.data.DataService

[...]

String xmlPayLoad = "<?xml version=\"1.0\" encoding=\"utf-8\"?>"
+ "<esf:configurations xmlns:esf=\"..."xmlns:ocd=\"...">"
+ "<esf:configuration pid=\"org.eclipse.kura.data.DataService\">" + "<esf:properties>"
+ "<esf:property array=\"false\" encrypted=\"false\" name=\"connect.auto-on-startup\" type=\"Boolean\">"
+ "<esf:value>false</esf:value>" + "</esf:property>" + "</esf:properties>" + "</esf:configuration>"
+ "</esf:configurations>";

payload.setBody(xmlPayLoad.getBytes());
payload.setTimestamp(new Date());
msg.setEdcPayload(payload);

apisWeb.type(MediaType.APPLICATION_XML).accept(MediaType.APPLICATION_XML).post(msg);
Re: MQTT configure application /CONF-V1/PUT [message #1777965 is a reply to message #1777857] Thu, 07 December 2017 00:07 Go to previous messageGo to next message
David Woodard is currently offline David WoodardFriend
Messages: 420
Registered: July 2014
Senior Member
Hello,

Have you reviewed this documentation [1]? I believe it covers what you are trying to do.

[1] http://eclipse.github.io/kura/ref/mqtt-namespace.html


Thanks,
--Dave
Re: MQTT configure application /CONF-V1/PUT [message #1777999 is a reply to message #1777965] Thu, 07 December 2017 14:11 Go to previous message
F T is currently offline F TFriend
Messages: 2
Registered: December 2017
Junior Member
Hello,

thanks for your reply. I already reviewed this documentation. But I can't figure out why I can not update an application configuration using this code:

msg = new EdcMessage();
msg.setTopic("$EDC/account/client/CONF-V1/PUT/configurations/org.eclipse.kura.watchdog.WatchdogService");

String xmlStr = "<?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"yes\"?>" +
"<ns2:configuration xmlns:ns2=<http://eurotech.com/esf/2.0 xmlns=<http://www.osgi.org/xmlns/metatype/v1.2.0>" +
"pid=\"org.eclipse.kura.watchdog.WatchdogService\"><OCD id=\"org.eclipse.kura.watchdog.WatchdogService\" name=\"WatchdogService\" description=\"WatchdogService Configuration\">" +
"<Icon resource=\"WatchdogService\"/>" +
"<AD id=\"pingInterval\" name=\"Watchdog refresh interval\" required=\"true\" default=\"10000\" cardinality=\"0\" type=\"Integer\" description=\"\"/>" +
"</OCD>" +
"<ns2:properties>" +
"<ns2:property type=\"Integer\" array=\"false\" name=\"pingInterval\">" +
"<ns2:value>11000</ns2:value>" +
"</ns2:property>" +
"</ns2:properties>" +
"</ns2:configuration>";

payload.setBody(xmlStr.getBytes());
payload.setTimestamp(new Date());
msg.setEdcPayload(payload);

apisWeb.type(MediaType.APPLICATION_XML).accept(MediaType.APPLICATION_XML).post(msg);

I think the xml file is wrong, because the client is receiving the mqtt message. Any help is appreciated!
Previous Topic:Simulator for S7
Next Topic:Bluetooth interface is not found
Goto Forum:
  


Current Time: Thu Sep 20 17:59:44 GMT 2018

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

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

Back to the top