knxultimate
Advanced tools
Comparing version 3.0.3 to 3.0.4
@@ -12,2 +12,3 @@ "use strict"; | ||
const apdu_data = Buffer.alloc(2); | ||
value = Number(value); | ||
if (!isFinite(value)) { | ||
@@ -14,0 +15,0 @@ KnxLog_1.default.get().warn('DPT9: cannot write non-numeric or undefined value'); |
@@ -113,3 +113,3 @@ "use strict"; | ||
constructor(options) { | ||
var _a; | ||
var _a, _b; | ||
super(); | ||
@@ -177,3 +177,3 @@ this.commandQueue = []; | ||
this.handleKNXQueue = async () => { | ||
var _a, _b, _c, _d; | ||
var _a, _b; | ||
(_a = this.sysLogger) === null || _a === void 0 ? void 0 : _a.debug(`KNXClient: handleKNXQueue: Start Processing queued KNX.`); | ||
@@ -183,13 +183,8 @@ do { | ||
if (this.commandQueue.length > 0 && this._clearToSend) { | ||
(_b = this.sysLogger) === null || _b === void 0 ? void 0 : _b.debug(`\n\nKNXClient: START.`); | ||
const item = this.commandQueue.pop(); | ||
this.currentItemHandledByTheQueue = item; | ||
if (item.ACK !== undefined) { | ||
await this.processKnxPacketQueueItem(item.knxPacket); | ||
this.setTimerWaitingForACK(item.ACK); | ||
} | ||
else { | ||
await this.processKnxPacketQueueItem(item.knxPacket); | ||
} | ||
(_c = this.sysLogger) === null || _c === void 0 ? void 0 : _c.debug(`KNXClient: END.`); | ||
await this.processKnxPacketQueueItem(item.knxPacket); | ||
} | ||
@@ -199,3 +194,3 @@ if (this.exitProcessingKNXQueueLoop) | ||
} while (this.exitProcessingKNXQueueLoop === false); | ||
(_d = this.sysLogger) === null || _d === void 0 ? void 0 : _d.debug(`KNXClient: handleKNXQueue: Stop Processing queued KNX.`); | ||
(_b = this.sysLogger) === null || _b === void 0 ? void 0 : _b.debug(`KNXClient: handleKNXQueue: Stop Processing queued KNX.`); | ||
}; | ||
@@ -229,2 +224,11 @@ this.timers = new Map(); | ||
this.jKNXSecureKeyring = this._options.jKNXSecureKeyring; | ||
try { | ||
if (Number(this._options.KNXQueueSendIntervalMilliseconds) < 20) { | ||
this._options.KNXQueueSendIntervalMilliseconds = 20; | ||
} | ||
} | ||
catch (error) { | ||
this._options.KNXQueueSendIntervalMilliseconds = 25; | ||
(_a = this.sysLogger) === null || _a === void 0 ? void 0 : _a.error(`KNXQueueSendIntervalMilliseconds:${error.message}. Defaulting to 25`); | ||
} | ||
this.limiter = new limiter_1.RateLimiter({ | ||
@@ -244,3 +248,3 @@ tokensPerInterval: 1, | ||
catch (error) { | ||
(_a = this.sysLogger) === null || _a === void 0 ? void 0 : _a.error(`ipAddressHelper.getLocalAddress:${error.message}`); | ||
(_b = this.sysLogger) === null || _b === void 0 ? void 0 : _b.error(`ipAddressHelper.getLocalAddress:${error.message}`); | ||
throw error; | ||
@@ -388,3 +392,3 @@ } | ||
} | ||
(_a = this.sysLogger) === null || _a === void 0 ? void 0 : _a.debug(`KNXClient: ADDED TELEGRAM TO COMMANDQUEUE. Len: ${this.commandQueue.length}`); | ||
(_a = this.sysLogger) === null || _a === void 0 ? void 0 : _a.debug(`KNXClient: ADDED TELEGRAM TO COMMANDQUEUE. Len: ${this.commandQueue.length}, Priority: ${_priority}`, toBeAdded); | ||
} | ||
@@ -417,4 +421,8 @@ write(dstAddress, data, dptid) { | ||
const knxPacketRequest = KNXProtocol_1.default.newKNXTunnelingRequest(this._channelID, seqNum, cEMIMessage); | ||
if (!this._options.suppress_ack_ldatareq) | ||
if (!this._options.suppress_ack_ldatareq) { | ||
this.send(knxPacketRequest, knxPacketRequest, false, this.getSeqNumber()); | ||
} | ||
else { | ||
this.send(knxPacketRequest, undefined, false, this.getSeqNumber()); | ||
} | ||
if (this._options.localEchoInTunneling) | ||
@@ -450,4 +458,8 @@ this.emit(KNXClientEvents.indication, knxPacketRequest, true); | ||
const knxPacketRequest = KNXProtocol_1.default.newKNXTunnelingRequest(this._channelID, seqNum, cEMIMessage); | ||
if (!this._options.suppress_ack_ldatareq) | ||
if (!this._options.suppress_ack_ldatareq) { | ||
this.send(knxPacketRequest, knxPacketRequest, false, this.getSeqNumber()); | ||
} | ||
else { | ||
this.send(knxPacketRequest, undefined, false, this.getSeqNumber()); | ||
} | ||
if (this._options.localEchoInTunneling) | ||
@@ -482,6 +494,11 @@ this.emit(KNXClientEvents.indication, knxPacketRequest, true); | ||
const knxPacketRequest = KNXProtocol_1.default.newKNXTunnelingRequest(this._channelID, seqNum, cEMIMessage); | ||
if (!this._options.suppress_ack_ldatareq) | ||
if (!this._options.suppress_ack_ldatareq) { | ||
this.send(knxPacketRequest, knxPacketRequest, false, this.getSeqNumber()); | ||
if (this._options.localEchoInTunneling) | ||
} | ||
else { | ||
this.send(knxPacketRequest, undefined, false, this.getSeqNumber()); | ||
} | ||
if (this._options.localEchoInTunneling) { | ||
this.emit(KNXClientEvents.indication, knxPacketRequest, true); | ||
} | ||
} | ||
@@ -533,4 +550,8 @@ } | ||
const knxPacketRequest = KNXProtocol_1.default.newKNXTunnelingRequest(this._channelID, seqNum, cEMIMessage); | ||
if (!this._options.suppress_ack_ldatareq) | ||
if (!this._options.suppress_ack_ldatareq) { | ||
this.send(knxPacketRequest, knxPacketRequest, false, this.getSeqNumber()); | ||
} | ||
else { | ||
this.send(knxPacketRequest, undefined, false, this.getSeqNumber()); | ||
} | ||
if (this._options.localEchoInTunneling) | ||
@@ -583,3 +604,3 @@ this.emit(KNXClientEvents.indication, knxPacketRequest, true); | ||
Connect(knxLayer = TunnelCRI_1.TunnelTypes.TUNNEL_LINKLAYER) { | ||
if (this._clientSocket == null) { | ||
if (this._clientSocket === null) { | ||
throw new Error('No client socket defined'); | ||
@@ -596,3 +617,2 @@ } | ||
} | ||
this.handleKNXQueue(); | ||
this._connectionState = ConncetionState.CONNECTING; | ||
@@ -603,2 +623,3 @@ this._numFailedTelegramACK = 0; | ||
this.emit(KNXClientEvents.connecting, this._options); | ||
this.handleKNXQueue(); | ||
if (this._options.hostProtocol === 'TunnelUDP') { | ||
@@ -822,3 +843,3 @@ const timeoutError = new Error(`Connection timeout to ${this._peerHost}:${this._peerPort}`); | ||
const knxTunnelAck = KNXProtocol_1.default.newKNXTunnelingACK(knxTunnelingRequest.channelID, knxTunnelingRequest.seqCounter, KNXConstants_1.KNX_CONSTANTS.E_NO_ERROR); | ||
this.send(knxTunnelAck, undefined, false, this.getSeqNumber()); | ||
this.send(knxTunnelAck, undefined, true, this.getSeqNumber()); | ||
} | ||
@@ -911,12 +932,12 @@ catch (error) { | ||
sendConnectRequestMessage(cri) { | ||
this.send(KNXProtocol_1.default.newKNXConnectRequest(cri), undefined, false, this.getSeqNumber()); | ||
this.send(KNXProtocol_1.default.newKNXConnectRequest(cri), undefined, true, this.getSeqNumber()); | ||
} | ||
sendConnectionStateRequestMessage(channelID) { | ||
this.send(KNXProtocol_1.default.newKNXConnectionStateRequest(channelID), undefined, false, this.getSeqNumber()); | ||
this.send(KNXProtocol_1.default.newKNXConnectionStateRequest(channelID), undefined, true, this.getSeqNumber()); | ||
} | ||
sendDisconnectRequestMessage(channelID) { | ||
this.send(KNXProtocol_1.default.newKNXDisconnectRequest(channelID), undefined, false, this.getSeqNumber()); | ||
this.send(KNXProtocol_1.default.newKNXDisconnectRequest(channelID), undefined, true, this.getSeqNumber()); | ||
} | ||
sendDisconnectResponseMessage(channelID, status = KNXConstants_1.ConnectionStatus.E_NO_ERROR) { | ||
this.send(KNXProtocol_1.default.newKNXDisconnectResponse(channelID, status), undefined, false, this.getSeqNumber()); | ||
this.send(KNXProtocol_1.default.newKNXDisconnectResponse(channelID, status), undefined, true, this.getSeqNumber()); | ||
} | ||
@@ -927,3 +948,3 @@ sendSecureSessionRequestMessage(cri) { | ||
: KNXConstants_1.KNX_CONSTANTS.IPV4_UDP); | ||
this.send(KNXProtocol_1.default.newKNXSecureSessionRequest(cri, oHPAI), undefined, false, this.getSeqNumber()); | ||
this.send(KNXProtocol_1.default.newKNXSecureSessionRequest(cri, oHPAI), undefined, true, this.getSeqNumber()); | ||
} | ||
@@ -930,0 +951,0 @@ } |
## [3.0.4](https://github.com/Supergiovane/KNXUltimate/compare/v3.0.3...v3.0.4) (2024-10-08) | ||
## [3.0.3](https://github.com/Supergiovane/KNXUltimate/compare/v3.0.2...v3.0.3) (2024-09-16) | ||
@@ -4,0 +6,0 @@ |
{ | ||
"name": "knxultimate", | ||
"description": "KNX IP protocol implementation for Node. This is the ENGINE of Node-Red KNX-Ultimate node.", | ||
"version": "3.0.3", | ||
"version": "3.0.4", | ||
"main": "./build/index.js", | ||
@@ -6,0 +6,0 @@ "engines": { |
![Logo](img/logo-big.png) | ||
[![CI](https://github.com/Supergiovane/KNXUltimate/actions/workflows/ci.yml/badge.svg)](https://github.com/Supergiovane/KNXUltimate/actions/workflows/ci.yml) | ||
[![NPM version][npm-version-image]][npm-url] | ||
[![NPM downloads per month][npm-downloads-month-image]][npm-url] | ||
[![NPM downloads total][npm-downloads-total-image]][npm-url] | ||
[![MIT License][license-image]][license-url] | ||
[![JavaScript Style Guide](https://img.shields.io/badge/code_style-standard-brightgreen.svg)](https://standardjs.com) | ||
[![Youtube][youtube-image]][youtube-url] | ||
@@ -16,0 +10,0 @@ |
@@ -18,2 +18,3 @@ /** | ||
const apdu_data = Buffer.alloc(2) | ||
value = Number(value) // Expect a number | ||
if (!isFinite(value)) { | ||
@@ -20,0 +21,0 @@ Log.get().warn('DPT9: cannot write non-numeric or undefined value') |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
1701865
693
31813
160