FIWARE 物联网代理:如何将位置属性发送到上下文代理实体?
FIWARE IoT Agent: how to send the location attribut to the contextBroker Entity?
我想使用 MQTT IoT 代理将位置信息添加到我在 contextBroker 中的实体。
我按照这个 link 这样做 https://github.com/telefonicaid/fiware-IoTAgent-Cplusplus/blob/develop/doc/modules.md
我的问题是属性 "location" 是作为字符串发送到 contextBroker 而不是 "coords"
这是我发送给 MQTT IoT 代理的内容:
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
}
我错过了什么?预先感谢您的帮助!
我明白了,我必须在 IoT Agent 中使用属性 "location" 注册设备才能开始使用它。
"attributes": [
{ "object_id":"location",
"type": "coords",
"name":"position"
} ]
确切地说,您在 "MQTT" 和 "Ultralight" 部分的 "Conversion to Location Entity..." 小节中有完整的描述:
https://github.com/telefonicaid/fiware-IoTAgent-Cplusplus/blob/develop/doc/modules.md
感谢使用FIWARE!
我想使用 MQTT IoT 代理将位置信息添加到我在 contextBroker 中的实体。 我按照这个 link 这样做 https://github.com/telefonicaid/fiware-IoTAgent-Cplusplus/blob/develop/doc/modules.md
我的问题是属性 "location" 是作为字符串发送到 contextBroker 而不是 "coords"
这是我发送给 MQTT IoT 代理的内容:
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
}
我错过了什么?预先感谢您的帮助!
我明白了,我必须在 IoT Agent 中使用属性 "location" 注册设备才能开始使用它。
"attributes": [
{ "object_id":"location",
"type": "coords",
"name":"position"
} ]
确切地说,您在 "MQTT" 和 "Ultralight" 部分的 "Conversion to Location Entity..." 小节中有完整的描述:
https://github.com/telefonicaid/fiware-IoTAgent-Cplusplus/blob/develop/doc/modules.md
感谢使用FIWARE!