简体   繁体   English

具有阵列的Fiware ContextBroker实体

[英]Fiware ContextBroker Entity with Array

Is it possible create an entity in Fiware, where a specific attribute will be send as an array? 是否可以在Fiware中创建一个实体,在其中将特定属性作为数组发送? Something like that? 这样的东西? Having multiple pressure sensors inside a room where I would like to receive them in one update?! 我想在一次更新中收到一个房间内的多个压力传感器吗?

So this is basically creating the Entity 所以这基本上是创建实体

{
  "id": "Room1",
  "type": "Room",
  "temperature": {
    "value": 23,
    "type": "Float"
  },
  "pressure": {
    "value": 720,
    "type": "Integer"
  }
}

and I would like to receive updates in one update message with all pressure information inside this "Entity" 并且我想在一条更新消息中收到包含该“实体”中所有压力信息的更新

{
  "id": "Room1",
  "type": "Room",
  "temperature": {
    "value": 23,
    "type": "Float"
  },
  "pressure": [{
    "value": 720,
    "type": "Integer"
  },
  {
    "value": 500,
    "type": "Integer"
  },
 ]
}

Thanks in advance! 提前致谢!

-pd -pd

Not exactly the same you are proposing but you can have all the values in an array. 您提出的建议并不完全相同,但是您可以将所有值放在一个数组中。 Something like this: 像这样:

{
  "id": "Room1",
  "type": "Room",
  "temperature": {
    "value": 23,
    "type": "Float"
  },
  "pressure": {
    "value": [720, 500],
    "type": "Integer"
  }
}

or, if you need type information in each one, you could try: 或者,如果您每个人都需要输入类型信息,则可以尝试:

{
  "id": "Room1",
  "type": "Room",
  "temperature": {
    "value": 23,
    "type": "Float"
  },
  "pressure": {
    "value": [
       {"value": 720, "type": "Integer"},
       {"value": 500, "type": "Integer"}
    ],
    "type": "Array"
  }
}

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM