diff --git a/lib/Af.js b/lib/Af.js index 128bb60..fa63e14 100644 --- a/lib/Af.js +++ b/lib/Af.js @@ -8,7 +8,8 @@ const EventEmitter = require('eventemitter2'), assert = require('assert'), CcZnp = require('cc-znp'), Qos = require('./Qos'), - Debug = require('debug') + Debug = require('debug'), + ZclMeta = require('./packet/ZclMeta'); var zcl = require('./Packet'), zutils = CcZnp.utils, @@ -463,7 +464,9 @@ class Af extends EventEmitter { else // from local ep to remote ep mandatoryEvent = 'ZCL:foundation:' + nwkAddr.toString(16) + ':' + dstEp.getEpId() + ':' + srcEp.getEpId() + ':' + seqNum; - areq = this.waitFor(mandatoryEvent) + const foundationCommand = ZclMeta.foundation.get(zclId.foundation(cmd).key) + + areq = this.waitFor(mandatoryEvent, {filter:arg0=>(arg0.zclData.cmdId === 'defaultRsp' || arg0.zclData.cmdId === foundationCommand.rsp)}) } var afOptions = cfg.afOptions !== undefined ? cfg.afOptions : {} @@ -532,7 +535,7 @@ class Af extends EventEmitter { frameType: 1, // functional command frame manufSpec: cfg.manufSpec !== undefined ? cfg.manufSpec : 0, direction: cfg.direction !== undefined ? cfg.direction : 0, // 0: client-to-server, 1: server-to-client - disDefaultRsp: cfg.disDefaultRsp !== undefined ? cfg.disDefaultRsp : 0 // enable deafult response command + disDefaultRsp: cfg.disDefaultRsp !== undefined ? cfg.disDefaultRsp : 0 // disable default response command }; if (frameCntl.manufSpec === 1) diff --git a/lib/packet/defs/meta.json b/lib/packet/defs/meta.json index 5ce72e5..7d9835e 100644 --- a/lib/packet/defs/meta.json +++ b/lib/packet/defs/meta.json @@ -4,7 +4,8 @@ "params": [ ["attrId", 1] ], - "knownBufLen": 2 + "knownBufLen": 2, + "rsp": "readRsp" }, "readRsp": { "params": [ @@ -20,7 +21,8 @@ ["dataType", 0], ["attrData", 33] ], - "knownBufLen": 3 + "knownBufLen": 3, + "rsp": "writeRsp" }, "writeUndiv": { "params": [ @@ -28,7 +30,8 @@ ["dataType", 0], ["attrData", 33] ], - "knownBufLen": 3 + "knownBufLen": 3, + "rsp": "writeRsp" }, "writeRsp": { "params": [ @@ -50,7 +53,8 @@ ["attrId", 1], ["extra", 34] ], - "knownBufLen": 3 + "knownBufLen": 3, + "rsp": "configReportRsp" }, "configReportRsp": { "params": [ @@ -63,7 +67,8 @@ ["direction", 0], ["attrId", 1] ], - "knownBufLen": 3 + "knownBufLen": 3, + "rsp": "readReportConfigRsp" }, "readReportConfigRsp": { "params": [ @@ -94,7 +99,8 @@ ["startAttrId", 1], ["maxAttrIds", 0] ], - "knownBufLen": 3 + "knownBufLen": 3, + "rsp": "discoverRsp" }, "discoverRsp": { "params": [ @@ -108,7 +114,8 @@ ["attrId", 1], ["selector", 36] ], - "knownBufLen": 2 + "knownBufLen": 2, + "rsp": "readRsp" }, "writeStrcut": { "params": [ @@ -117,7 +124,8 @@ ["dataType", 0], ["attrData", 37] ], - "knownBufLen": 3 + "knownBufLen": 3, + "rsp": "writeStrcutRsp" }, "writeStrcutRsp": { "params": [