FIWARE IoT代理:如何将位置发送到contextBroker实体?

时间:2015-11-24 16:54:55

标签: fiware iot fiware-orion

我想使用MQTT IoT代理在contextBroker中向我的实体添加位置信息。 我按照此链接进行了https://github.com/telefonicaid/fiware-IoTAgent-Cplusplus/blob/develop/doc/modules.md

我的问题是attribut" location"作为字符串发送到contextBroker而不是" coords"

以下是我发送给MQTT物联网代理的内容:

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);

我假设contextBroker中的位置属性将具有" coords"类似的东西:

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

但是我在contextBroker中得到的是:

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

我错过了什么?在此先感谢您的帮助!

2 个答案:

答案 0 :(得分:1)

我想通了,我必须在开始使用之前在IoT Agent中注册具有attribut“location”的设备。

"attributes": [
        {  "object_id":"location",
           "type": "coords",
           "name":"position"
        } ]

答案 1 :(得分:1)

确切地说,您在“MQTT”和“Ultralight”部分的“转换为位置实体......”小节中有完整的描述:

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

感谢您使用FIWARE!