Search code examples
fiwareiotfiware-orion

FIWARE IoT Agent: how to send the location attribut to the contextBroker Entity?


I want to add location information to my entity in the contextBroker using the MQTT IoT Agent. I followed this link to do so https://github.com/telefonicaid/fiware-IoTAgent-Cplusplus/blob/develop/doc/modules.md

My problem is that the attribut "location" was sent as String to the contextBroker not as "coords"

Here is what I sent to the MQTT IoT agent:

int qos = 1;
boolean retain = false;

String topic = "myKey/sensorId/location";
String payload= "12.5/14.5";

this.dataService.publish(topic, position.getBytes(), qos, retain, 2);

I assume that the location attribut in the contextBroker will have the type "coords", something like that:

{
    "name":"position",
    "type":"coords",
    "value":"33.000,-3.234234",
    "metadatas":[
    {
        "name":"location",
        "type":"string",
        "value":"WGS84"
    }]
}

But what I got in the contextBroker is this:

"location" : {
        "value" : "12.5/14.5",
        "type" : "string",
        "md" : [
            {
                "name" : "TimeInstant",
                "type" : "ISO8601",
                "value" : "2015-11-24T16:26:09.530507"
            }
        ],
        "creDate" : 1448382369,
        "modDate" : 1448382369
    }

What have I missed? Thanks in advance for your help!


Solution

  • Exactly, you have the full description in the subsection "Conversion to Location Entity..." at the sections "MQTT" and "Ultralight" here:

    https://github.com/telefonicaid/fiware-IoTAgent-Cplusplus/blob/develop/doc/modules.md

    Thanks for using FIWARE!