1

我创建了一个名为 LoraRfInfo 的测量 Java 类。我将 LoraRfInfo 作为测量值添加到 Cumulocity 中,如下所示:

measurementRep.setSource(mo);
measurementRep.setType("tl_LoraRfInfo");
measurementRep.set(loraRfSignal);
measurementRep.setTime(new Date());
measurements.create(measurementRep);

我想在“数据点图”小部件中可视化存储的 LoraRfInfo 测量数据,但不知道该怎么做。任何人都知道如何在 Cumulocity“数据点图”小部件中可视化自定义数据点(即非 c8y_xxx)?

4

2 回答 2

1

It's been a while since the question came up, but this might be useful for anyone who's looking for this.

In Java, you can create your own class if you want to visualize your custom data. The value however always has to be in a

com.cumulocity.model.measurement.MeasurementValue

Therefore, MeasurementValue has to be a property in your custom class.

The display name in Cumulocity will always be packageName_ClassName.

于 2018-02-16T06:56:23.367 回答
0

要在小部件中使用测量值,它们需要遵循http://cumulocity.com/guides/reference/measurements/中描述的结构。在 REST 级别上,这个结构是

{ "tl_LoraRfSignal": {
   "<your measurement>": { "value": ..., "unit": "..." },
   "<your measurement>": { "value": ..., "unit": "..." },
   ...
}

(假设变量 loraRfSignal 后面的类是 tl.LoraRfSignal。)

在 Java 级别,将 MeasurementValue 类型的属性添加到 locaRfSignal。可以在这里找到一个示例:https ://bitbucket.org/m2m/cumulocity-clients-java/src/53216dc587e24476e0578b788672416e8566f92b/device-capability-model/src/main/java/c8y/SignalStrength.java?at=default&fileviewer=file -查看默认

开头的“c8y_”无关紧要。这只是一个命名约定。

于 2016-03-22T09:28:30.460 回答