Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Kura » Publish PPMP Protocol(including the PPMP format to the publish method)
Publish PPMP Protocol [message #1785527] Mon, 16 April 2018 09:18 Go to next message
Ahmed Gharssellaoui is currently offline Ahmed GharssellaouiFriend
Messages: 31
Registered: February 2018
Member
Hi dears,

I am trying to integrate the PPMP protocol (Eclipse Unide) to eclipse Kura.
I was able to publish some data through MQTT with the integrated method doPublsih() but it's only reserved to KuraPayLoad instances, how can I implement my own payLoad so I can integrate the PPMP format ?
Re: Publish PPMP Protocol [message #1785528 is a reply to message #1785527] Mon, 16 April 2018 09:37 Go to previous messageGo to next message
Matteo Maiero is currently offline Matteo MaieroFriend
Messages: 263
Registered: July 2015
Location: Italy
Senior Member
Hi,
the KuraPayload is a generic representation of Data that is known to all the applications that want to publish and all the cloud services.
If you want to keep compatibility, the kura payload is a must have, in my opinion.
What you can do is to have your application publishing in kura payload and than have a PPMP publisher that parses kura payload and publishes the PPMP format. In this way you can keep compatibility.

If you are not interested in that, you'll need to specify your own APIs or use the data service ones that should be more loose.

Best regards,
Matteo
Re: Publish PPMP Protocol [message #1785971 is a reply to message #1785528] Mon, 23 April 2018 16:40 Go to previous messageGo to next message
Ahmed Gharssellaoui is currently offline Ahmed GharssellaouiFriend
Messages: 31
Registered: February 2018
Member
Dear Matteo,

I have tried to publish the do the following:

1 - Create a json object with metric data following the PPMP schematic (ppmpMsg.json).

2 - Add the ppmpMsg as a metric payload:
payload.addMetric("PPMP", ppmpMsg.getJSON());

3 - Use the MQTT publish method to publish this payload.

However when I publish, I get this log:

Cannot publish topic: sacem12Cannot encode this value: {"content-spec":"urn:spec:\/\/eclipse.org\/unide\/measurement-message#v2","device":{"deviceID":"13245"},"measurements":[{"series":{"current":[18.0],"unit":[0],"$_time":[0]},"ts":"2018-04-23T12:21:21.652-0400"}]}

Re: Publish PPMP Protocol [message #1785984 is a reply to message #1785971] Mon, 23 April 2018 19:43 Go to previous messageGo to next message
Matteo Maiero is currently offline Matteo MaieroFriend
Messages: 263
Registered: July 2015
Location: Italy
Senior Member
Hi,
I believe that the content should be put in the body of the message instead of in a metric.

Best regards,
Matteo
Re: Publish PPMP Protocol [message #1786018 is a reply to message #1785984] Tue, 24 April 2018 08:32 Go to previous messageGo to next message
Ahmed Gharssellaoui is currently offline Ahmed GharssellaouiFriend
Messages: 31
Registered: February 2018
Member
Hi dear Matteo,
I tried to do that, setting my ppmpMsg as a KuraPalyLoad but I couldn't do that using the class methods,
the only method to add data to a KurapayLoad, is using the addMetric method.
Any idea how can I publish my JSON file (PPMP message) ?

Kindest regards
Ahmed

[Updated on: Tue, 24 April 2018 08:34]

Report message to a moderator

Re: Publish PPMP Protocol [message #1786020 is a reply to message #1786018] Tue, 24 April 2018 08:38 Go to previous messageGo to next message
Matteo Maiero is currently offline Matteo MaieroFriend
Messages: 263
Registered: July 2015
Location: Italy
Senior Member
I'm sorry, couldn't you use the setBody?
https://github.com/eclipse/kura/blob/develop/kura/org.eclipse.kura.api/src/main/java/org/eclipse/kura/message/KuraPayload.java#L123
Re: Publish PPMP Protocol [message #1786023 is a reply to message #1786020] Tue, 24 April 2018 09:31 Go to previous messageGo to next message
Ahmed Gharssellaoui is currently offline Ahmed GharssellaouiFriend
Messages: 31
Registered: February 2018
Member
Thanks,
I get it now,
the problem is to set the body I need a byte array, so I need to convert my json message to an array of byte, and when I publish it I receive an anomaly message,
I think I need to convert the message in the client too, from byte array, which is not a proper solution if I understand well.

I am sorry if I couldn't follow properly.
Re: Publish PPMP Protocol [message #1786024 is a reply to message #1786023] Tue, 24 April 2018 09:33 Go to previous messageGo to next message
Matteo Maiero is currently offline Matteo MaieroFriend
Messages: 263
Registered: July 2015
Location: Italy
Senior Member
You'll receive the message as a base64 string in the message body. What you'll have to do is to convert it back.

I believe it's a doable approach, but that depends on what you do in your broker side.
Re: Publish PPMP Protocol [message #1786025 is a reply to message #1786024] Tue, 24 April 2018 09:41 Go to previous message
Ahmed Gharssellaoui is currently offline Ahmed GharssellaouiFriend
Messages: 31
Registered: February 2018
Member
The broker side ?
I will just use the ecipse broker : iot.eclipse.org
and my clients will be a dash board in a computer and I don't thin that it will be a problem in that case.
However, I will use a constrained device like NodeMCU as mqtt client too, to display some data, in this case those operations of conversion can be costly.
but this is the only solution to publish my own payload, yes ?
Previous Topic:Azure IoT hub Certificate Authority Connection
Next Topic:Issue with kura installation on Raspberry Pi 2
Goto Forum:
  


Current Time: Sun Sep 23 06:05:43 GMT 2018

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

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

Back to the top