From b56998c26f892bf57429562380e612a26027d573 Mon Sep 17 00:00:00 2001 From: Marcel Wagner Date: Thu, 3 Oct 2019 19:13:58 +0200 Subject: [PATCH 1/3] lib/proxies/iot.mqtt.js: Revised the MQTT module in oisp-agent and added callback results for testing MQTT connection with oisp-admin. Signed-off-by: Marcel Wagner --- lib/proxies/iot.mqtt.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/lib/proxies/iot.mqtt.js b/lib/proxies/iot.mqtt.js index 0b70d76..d3e7cc2 100644 --- a/lib/proxies/iot.mqtt.js +++ b/lib/proxies/iot.mqtt.js @@ -76,8 +76,9 @@ IoTKitMQTTCloud.prototype.health = function (device, callback) { var topic = common.buildPath(me.topics.health, device); var data = { 'detail': 'mqtt'}; me.client.publish(topic, data, me.pubArgs); + callback(1) } else { - callback(); + callback(0); } }); From a8d791b7d1bcc030a9e781cb69038ccbda5877e1 Mon Sep 17 00:00:00 2001 From: Marcel Wagner Date: Fri, 4 Oct 2019 18:14:23 +0200 Subject: [PATCH 2/3] lib/proxies/iot.mqtt.js: Moved mqtt topic definition from Agent Config to SDK Signed-off-by: Marcel Wagner --- lib/proxies/iot.mqtt.js | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/lib/proxies/iot.mqtt.js b/lib/proxies/iot.mqtt.js index d3e7cc2..e50d7ad 100644 --- a/lib/proxies/iot.mqtt.js +++ b/lib/proxies/iot.mqtt.js @@ -25,12 +25,18 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. var common = require('../common'), Broker = require("../../api/mqtt/connector"); +var topic = { + "metric_topic": "server/metric/{accountid}/{deviceid}", + "health": "server/devices/{deviceid}/health", + "health_status": "device/{deviceid}/health" + } + function IoTKitMQTTCloud(conf, broker) { var me = this; me.client = broker; me.type = 'mqtt'; - me.topics = conf.connector[me.type].topic; + me.topics = topic; me.pubArgs = { qos: 1, retain: false From 093594c2361f090c8cfc824c3eab9e156e6747d7 Mon Sep 17 00:00:00 2001 From: Scott Ware Date: Mon, 7 Oct 2019 13:56:14 +0100 Subject: [PATCH 3/3] Bump version for v1.1.1 release Signed-off-by: Scott Ware --- lib/proxies/iot.mqtt.js | 8 ++++---- package.json | 2 +- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/lib/proxies/iot.mqtt.js b/lib/proxies/iot.mqtt.js index e50d7ad..2e0a567 100644 --- a/lib/proxies/iot.mqtt.js +++ b/lib/proxies/iot.mqtt.js @@ -26,10 +26,10 @@ var common = require('../common'), Broker = require("../../api/mqtt/connector"); var topic = { - "metric_topic": "server/metric/{accountid}/{deviceid}", - "health": "server/devices/{deviceid}/health", - "health_status": "device/{deviceid}/health" - } + "metric_topic": "server/metric/{accountid}/{deviceid}", + "health": "server/devices/{deviceid}/health", + "health_status": "device/{deviceid}/health" +} function IoTKitMQTTCloud(conf, broker) { diff --git a/package.json b/package.json index 9e48e02..6aad8af 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "@open-iot-service-platform/oisp-sdk-js", - "version": "1.1.0", + "version": "1.1.1", "description": "OISP SDK for Node.js", "main": "index.js", "scripts": {