简体   繁体   English

使用iotagent-node-lib

[英]Using iotagent-node-lib

I have receiving data from our sensors using GET. 我已经使用GET从我们的传感器接收数据。 The request format is: http://IP:PORT/PATH?Operation=InsertObservation&value=0.0012&unit_id=123456&sensor_id=75648 . 请求格式为: http:// IP:PORT / PATH?Operation = InsertObservation&value = 0.0012&unit_id = 123456&sensor_id = 75648 How I can, using iotagent-node-lib, write them to Orion Context Broker? 如何使用iotagent-node-lib将它们写入Orion Context Broker?

The fast answer is: "using the iotagentLib.update() method". 快速的答案是:“使用iotagentLib.update()方法”。 The slow and complete one imply some other steps you will need to complete to have a fully working agent. 缓慢而完整的步骤意味着您需要完成一些其他步骤才能拥有完整的代理。 I suggest you take a look at the code of https://github.com/telefonicaid/sigfox-iotagent . 我建议您看一下https://github.com/telefonicaid/sigfox-iotagent的代码。 That's one of the latest IOTAs we started to develop, and makes use of the IoT Agent Node Lib. 那是我们开始开发的最新IOTA之一,并利用了IoT Agent Node Lib。 Sigfox callbacks use HTTP calls much like your approach, so it should be really easy to modify the Sigfox Agent's code to feet your needs. Sigfox回调使用HTTP调用非常像您的方法,因此修改Sigfox代理的代码来满足您的需求应该非常容易。 Most of the interesting code is in this file: 大多数有趣的代码在此文件中:

https://github.com/telefonicaid/sigfox-iotagent/blob/develop/lib/sigfoxHandlers.js https://github.com/telefonicaid/sigfox-iotagent/blob/develop/lib/sigfoxHandlers.js

I think you can reuse most of the code, excluding the sigfoxParser. 我认为您可以重用大多数代码,但不包括sigfoxParser。 If you have further doubts, you should be able to solve your doubts using iotagent-node-lib documentation. 如果您还有其他疑问,则应该可以使用iotagent-node-lib文档解决您的疑问。

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

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