mm_os 3.2.0 → 3.2.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/core/com/mqtt/index.js +8 -6
- package/package.json +1 -1
package/core/com/mqtt/index.js
CHANGED
|
@@ -124,13 +124,14 @@ MQTT.prototype.update_after = async function() {
|
|
|
124
124
|
var _this = this;
|
|
125
125
|
var list = this.list;
|
|
126
126
|
for (var i = 0; i < list.length; i++) {
|
|
127
|
-
|
|
127
|
+
var o = list[i];
|
|
128
|
+
if (o.config && o.config.state === 1) {
|
|
128
129
|
o.send = function(topic, msg, qos = 0, retain = false) {
|
|
129
130
|
if (topic) {
|
|
130
131
|
_this.send(topic, msg, qos, retain);
|
|
131
132
|
}
|
|
132
133
|
};
|
|
133
|
-
|
|
134
|
+
await o.exec('init');
|
|
134
135
|
var topics = o.config.topic;
|
|
135
136
|
if (topics) {
|
|
136
137
|
for (var n = 0; n < topics.length; n++) {
|
|
@@ -265,14 +266,15 @@ MQTT.prototype.receive = async function(push_topic, msg) {
|
|
|
265
266
|
}
|
|
266
267
|
var ret;
|
|
267
268
|
var list = this.list;
|
|
268
|
-
for (var i = 0
|
|
269
|
+
for (var i = 0; i < list.length; i++) {
|
|
270
|
+
var o = list[i];
|
|
269
271
|
if (o.config.state === 1) {
|
|
270
272
|
var topics = o.config.topic;
|
|
271
273
|
if (topics) {
|
|
272
|
-
for (var
|
|
273
|
-
var topic = topics[
|
|
274
|
+
for (var n = 0; n < topics.length; n++) {
|
|
275
|
+
var topic = topics[n];
|
|
274
276
|
if (this.match(push_topic, topic)) {
|
|
275
|
-
ret = await o.exec('handle', push_topic, msg, topic,
|
|
277
|
+
ret = await o.exec('handle', push_topic, msg, topic, n);
|
|
276
278
|
}
|
|
277
279
|
}
|
|
278
280
|
}
|