是否有任何使用自定义传感器的文档示例,例如 TMP35 和使用 Java 的 cumulocity

Is there any documented example of using a custom sensor say TMP35 with cumulocity using Java

我很难理解我们究竟在哪里绑定硬件,例如 TMP35 温度传感器与软件(即在 Java API 中)。

是否有任何关于此或任何自定义传感器(驱动程序尚不可用)的文档示例?

或者任何人都可以概述实现相同目标的方法吗? 我需要延长 c8y.lx.driver.Driver class 吗?

感谢任何指点。


我认为 TMP35 无法与 cumulocity 服务器通信。因此,也许任何人都可以提供一种使用 Cumulocity 制作自定义传感器的方法(它也具有通信方式并且已启用 Java)link?这就是我想知道的?

我知道有一些经过认证的设备开箱即用。

有两个步骤:

  1. 使用 Java 从模拟传感器获取数据。
  2. 将数据发送到 Cumulocity。

第 1 步与 Cumulocity 无关。您需要一个 ADC,并且 Google 提供了一些关于如何连接它们的示例(例如 http://www.lediouris.net/RaspberryPI/ADC/readme.html)。

第二步就很简单了。创建 "MeasurementPollingDriver" 的子类并实现 运行()。在 运行() 中,使用步骤 1 中的方法查询传感器并将其转换为测量值。使用 super.sendMeasurement(measurement) 发送该测量值。 Here 是一个例子。

如果您有带回调的设备库,您可以直接从 MeasurementPollingDriver 复制代码

TemperatureMeasurement measurement = ...;
MeasurementRepresentation measurementRep = new MeasurementRepresentation();
measurementRep.setSource(mo);
measurementRep.set(measurement);
measurementRep.setTime(new Date());
measurements.create(measurementRep);