New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

knxultimate

Package Overview
Dependencies
Maintainers
1
Versions
82
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

knxultimate - npm Package Compare versions

Comparing version 1.0.13 to 1.0.14

4

CHANGELOG.md

@@ -10,2 +10,6 @@ ![Sample Node](img/logo.png)

<p>
<b>Version 1.0.14</b> - March 2022<br/>
- Optimized memory allocation to allow the garbage collector to get rid of unref variables.<br/>
</p>
<p>
<b>Version 1.0.13</b> - March 2022<br/>

@@ -12,0 +16,0 @@ - Updated samples and fixed disconnection issues is some circumstaces, where the KNX IP Interface doesn't send the DISCONNECT_RESPONSE datagram to confirm the disconnection.<br/>

2

package.json
{
"name": "knxultimate",
"description": "KNX IP protocol implementation for Node. This is the ENGINE of Node-Red KNX-Ultimate node.",
"version": "1.0.13",
"version": "1.0.14",
"engines": {

@@ -6,0 +6,0 @@ "node": ">=14"

@@ -129,8 +129,12 @@ ![Logo](img/logo-big.png)

});
knxUltimateClient.on(knx.KNXClient.KNXClientEvents.connected, info => {
// The client is connected
console.log("Connected. On Duty", info);
// WARNING, THIS WILL WRITE ON YOUR KNX BUS!
knxUltimateClient.write("0/1/1", false, "1.001");
});
// Connect
knxUltimateClient.Connect();
// WARNING, THIS WILL WRITE ON YOUR KNX BUS!
knxUltimateClient.write("0/1/1", false, "1.001");
```

@@ -137,0 +141,0 @@

@@ -32,7 +32,12 @@ const knx = require("./index.js");

});
knxUltimateClient.on(knx.KNXClient.KNXClientEvents.connected, info => {
// The client is connected
console.log("Connected. On Duty", info);
// WARNING, THIS WILL WRITE ON YOUR KNX BUS!
knxUltimateClient.write("0/1/1", false, "1.001");
});
// Connect
knxUltimateClient.Connect();
// WARNING, THIS WILL WRITE ON YOUR KNX BUS!
knxUltimateClient.write("0/1/1", false, "1.001");

@@ -97,4 +97,4 @@ // Made with love by Supergiovane

this._options = options;//Object.assign(optionsDefaults, options);
this._options.connectionKeepAliveTimeout = KNXConstants.KNX_CONSTANTS.CONNECTION_ALIVE_TIME,
this._localPort = null;
this._options.connectionKeepAliveTimeout = KNXConstants.KNX_CONSTANTS.CONNECTION_ALIVE_TIME;
//this._localPort = null;
this._peerHost = this._options.ipAddr;

@@ -129,4 +129,2 @@ this._peerPort = this._options.ipPort;

this.removeAllListeners();
let conn = this;
// 07/12/2021 Based on protocol instantiate the right socket

@@ -139,7 +137,8 @@ if (this._options.hostProtocol === "TunnelUDP") {

this._clientSocket.on(SocketEvents.close, info => this.emit(KNXClientEvents.close, info));
this._clientSocket.bind({ address: this._options.localIPAddress, port: this._options._peerPort }, () => {
let conn = this;
this._clientSocket.bind({ address: this._options.localIPAddress, port: this._options._peerPort }, function () {
try {
conn._clientSocket.setTTL(128);
} catch (error) {
if (this.sysLogger !== undefined && this.sysLogger !== null) this.sysLogger.error("UDP: Error setting SetTTL " + error.message || "");
if (conn.sysLogger !== undefined && conn.sysLogger !== null) conn.sysLogger.error("UDP: Error setting SetTTL " + error.message || "");
}

@@ -160,27 +159,28 @@ });

} else if (this._options.hostProtocol === "Multicast") {
let conn = this;
this._clientSocket = dgram.createSocket({ type: 'udp4', reuseAddr: true });
this._clientSocket.removeAllListeners(); // 12/03/2022 Remove all listeners
this._clientSocket.on(SocketEvents.listening, function () {
try {
conn._clientSocket.addMembership(conn._peerHost, conn._options.localIPAddress);
} catch (err) {
if (this.sysLogger !== undefined && this.sysLogger !== null) this.sysLogger.error("Multicast: cannot add membership (%s)", err);
try {
this.emit(KNXClientEvents.error, err);
} catch (error) { }
return;
}
});
let conn = this;
this._clientSocket.on(SocketEvents.message, this._processInboundMessage);
this._clientSocket.on(SocketEvents.error, error => this.emit(KNXClientEvents.error, error));
this._clientSocket.on(SocketEvents.close, info => this.emit(KNXClientEvents.close, info));
this._clientSocket.bind(this._peerPort, () => {
this._clientSocket.bind(this._peerPort, function () {
try {
conn._clientSocket.setMulticastTTL(128);
conn._clientSocket.setMulticastInterface(this._options.localIPAddress);
conn._clientSocket.setMulticastInterface(conn._options.localIPAddress);
} catch (error) {
if (this.sysLogger !== undefined && this.sysLogger !== null) this.sysLogger.error("Multicast: Error setting SetTTL " + error.message || "");
if (conn.sysLogger !== undefined && conn.sysLogger !== null) conn.sysLogger.error("Multicast: Error setting SetTTL " + error.message || "");
}
this._localPort = this._clientSocket.address().port;// 07/12/2021 Get the local port used bu the socket
try {
conn._clientSocket.addMembership(conn._peerHost, conn._options.localIPAddress);
} catch (err) {
if (conn.sysLogger !== undefined && conn.sysLogger !== null) conn.sysLogger.error("Multicast: cannot add membership (%s)", err);
try {
conn.emit(KNXClientEvents.error, err);
} catch (error) { }
return;
}
//this._localPort = this._clientSocket.address().port;// 07/12/2021 Get the local port used bu the socket
});

@@ -192,3 +192,3 @@ }

this._connectionState = STATE.DISCONNECTED;
this._tunnelReqTimer = null;
this._timerWaitingForACK = null;
this._numFailedTelegramACK = 0; // 25/12/2021 Keep count of the failed tunnelig ACK telegrams

@@ -245,17 +245,17 @@

}
bindSocketPortAsync(port = KNXConstants.KNX_CONSTANTS.KNX_PORT, host = '0.0.0.0') {
return new Promise((resolve, reject) => {
try {
this._clientSocket.bind(port, host, () => {
this._clientSocket.setMulticastInterface(host);
this._clientSocket.setMulticastTTL(128);
this._options.localIPAddress = host;
resolve();
});
}
catch (err) {
reject(err);
}
});
}
// bindSocketPortAsync(port = KNXConstants.KNX_CONSTANTS.KNX_PORT, host = '0.0.0.0') {
// return new Promise((resolve, reject) => {
// try {
// this._clientSocket.bind(port, host, () => {
// this._clientSocket.setMulticastInterface(host);
// this._clientSocket.setMulticastTTL(128);
// this._options.localIPAddress = host;
// resolve();
// });
// }
// catch (err) {
// reject(err);
// }
// });
// }
send(knxPacket) {

@@ -327,6 +327,4 @@

*
* @param {KNXAddress} srcAddress
* @param {KNXAddress} dstAddress
* @param {KNXDataBuffer} data
* @param {function} cb
*/

@@ -610,3 +608,3 @@ // sendWriteRequest(dstAddress, data) {

let conn = this;
this._clientSocket.connect({ port: this._peerPort, host: this._peerHost, localAddress: this._options.localAddress }, function () {
this._clientSocket.connect( this._peerPort, this._peerHost, function () {
// conn._timer = setTimeout(() => {

@@ -625,2 +623,7 @@ // conn._timer = null;

this._connectionState = STATE.CONNECTED;
// 16/03/2022 These two are referring to tunneling connection, but i set it here as well. Non si sa mai.
this._numFailedTelegramACK = 0; // 25/12/2021 Reset the failed ACK counter
this._clearToSend = true; // 26/12/2021 allow to send
this._clientTunnelSeqNumber = -1;

@@ -685,6 +688,5 @@ try {

this.stopHeartBeat();
if (this._timerTimeoutSendDisconnectRequestMessagetimer !== null) clearTimeout(this._timerTimeoutSendDisconnectRequestMessagetimer);
this._timerTimeoutSendDisconnectRequestMessage = null;
if (this._connectionTimeoutTimer !== null) clearTimeout(this._connectionTimeoutTimer);
if (this._tunnelReqTimer !== null) clearTimeout(this._tunnelReqTimer);
if (this._timerWaitingForACK !== null) clearTimeout(this._timerWaitingForACK);
this._clientTunnelSeqNumber = -1;

@@ -702,4 +704,3 @@ this._channelID = null;

}
this._clearToSend = true; // 26/12/2021 allow to send
this._clearToSend = true; // 26/12/2021 allow to send
}

@@ -733,6 +734,6 @@ _runHeartbeat() {

_setTimerWaitingForACK(knxTunnelingRequest) {
this._clearToSend = false; // 26/12/2021 stop sending until ACK received
const timeoutErr = new errors.RequestTimeoutError(`RequestTimeoutError seqCounter:${knxTunnelingRequest.seqCounter}, DestAddr:${knxTunnelingRequest.cEMIMessage.dstAddress.toString() || "Non definito"}, AckRequested:${knxTunnelingRequest.cEMIMessage.control.ack}, timed out waiting telegram acknowledge by ${this._options.ipAddr || "No Peer host detected"}`);
if (this._tunnelReqTimer !== null) clearTimeout(this._tunnelReqTimer);
this._clearToSend = false; // 26/12/2021 stop sending until ACK received
this._tunnelReqTimer = setTimeout(() => {
if (this._timerWaitingForACK !== null) clearTimeout(this._timerWaitingForACK);
this._timerWaitingForACK = setTimeout(() => {
try {

@@ -812,2 +813,8 @@ this._numFailedTelegramACK += 1;

}
// 16/03/2022
if (this._timerWaitingForACK !== null) clearTimeout(this._timerWaitingForACK);
this._numFailedTelegramACK = 0; // 16/03/2022 Reset the failed ACK counter
this._clearToSend = true; // 16/03/2022 allow to send
this._connectionState = STATE.CONNECTED;

@@ -912,3 +919,3 @@ this._channelID = knxConnectResponse.channelID;

if (knxTunnelingAck.seqCounter === this._getSeqNumber()) {
if (this._tunnelReqTimer !== null) clearTimeout(this._tunnelReqTimer);
if (this._timerWaitingForACK !== null) clearTimeout(this._timerWaitingForACK);
this._numFailedTelegramACK = 0; // 25/12/2021 clear the current ACK failed telegram number

@@ -1013,3 +1020,3 @@ this._clearToSend = true; // I'm ready to send a new datagram now

_sendSearchRequestMessage() {
this.send(KNXProtocol.KNXProtocol.newKNXSearchRequest(new HPAI.HPAI(this._options.localIPAddress, this._localPort)), KNXConstants.KNX_CONSTANTS.KNX_PORT, KNXConstants.KNX_CONSTANTS.KNX_IP);
//this.send(KNXProtocol.KNXProtocol.newKNXSearchRequest(new HPAI.HPAI(this._options.localIPAddress, this._localPort)), KNXConstants.KNX_CONSTANTS.KNX_PORT, KNXConstants.KNX_CONSTANTS.KNX_IP);
}

@@ -1016,0 +1023,0 @@ _sendConnectRequestMessage(cri) {

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc