首页 文章

带有Array的Fiware ContextBroker实体

提问于
浏览
1

是否有可能在Fiware中创建一个实体,其中特定属性将作为数组发送?那样的东西?在房间内有多个压力传感器,我希望在一次更新中收到它们?!

所以这基本上是创建实体

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

我希望收到一条更新消息的更新,其中包含此“实体”中的所有压力信息

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

提前致谢!

-pd

1 回答

  • 0

    您建议的不完全相同,但您可以在数组中包含所有值 . 像这样的东西:

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

    或者,如果您需要每个类型的类型信息,您可以尝试:

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

相关问题