knx-listener
Advanced tools
Comparing version 0.0.4 to 0.0.5
@@ -5,4 +5,4 @@ { | ||
"isShellCommand": true, | ||
"args": ["-p", "./tsconfig.dev.json"], | ||
"args": ["-p", "./tsconfig.json"], | ||
"problemMatcher": "$tsc" | ||
} |
@@ -0,1 +1,2 @@ | ||
#!/usr/bin/env node | ||
"use strict"; | ||
@@ -78,2 +79,2 @@ const yargs = require("yargs"); | ||
}); | ||
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiYnVzbW9uaXRvci5qcyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbImJ1c21vbml0b3IudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6IjtBQUFBLCtCQUErQjtBQUMvQiwrQkFBK0I7QUFDL0IsdURBQW1EO0FBQ25ELCtDQUEwRDtBQUMxRCwrQkFBMkM7QUFFM0MsTUFBTSxJQUFJLEdBQUcsS0FBSyxDQUFDLEtBQUssQ0FBQywwQkFBMEIsQ0FBQztLQUNqRCxNQUFNLENBQUMsQ0FBQyxRQUFRLENBQUMsQ0FBQztLQUNsQixLQUFLLENBQUMsR0FBRyxFQUFFLE1BQU0sQ0FBQztLQUNsQixLQUFLLENBQUMsR0FBRyxFQUFFLFFBQVEsQ0FBQztLQUNwQixLQUFLLENBQUMsR0FBRyxFQUFFLFNBQVMsQ0FBQztLQUNyQixPQUFPLENBQUMsTUFBTSxFQUFFLElBQUksQ0FBQztLQUNyQixPQUFPLENBQUMsU0FBUyxFQUFFLENBQUMsQ0FBQztLQUNyQixRQUFRLENBQUMsUUFBUSxFQUFFLG1CQUFtQixDQUFDO0tBQ3ZDLFFBQVEsQ0FBQyxNQUFNLEVBQUUsb0JBQW9CLENBQUM7S0FDdEMsUUFBUSxDQUFDLEdBQUcsRUFBRSw0Q0FBNEMsQ0FBQztLQUMzRCxJQUFJLENBQUMsTUFBTSxDQUFDO0tBQ1osS0FBSyxDQUFDLEdBQUcsRUFBRSxNQUF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N0aW5nICVzJywgZXJyLmNvZGUpO1xuICB9LFxufSkuY2F0Y2goZGllKTtcblxuc2VydmVyLm9uKCdxdWVyeScsIChxdWVyeTogYW55KSA9PiB7XG4gIGNvbnN0IGFjdGlvbiA9ICgoYWN0aW9uKSA9PiB7XG4gICAgc3dpdGNoIChhY3Rpb24pIHtcbiAgICAgIGNhc2UgMHgwMDogcmV0dXJuICdyZWFkJztcbiAgICAgIGNhc2UgMHg0MDogcmV0dXJuICdyZXNwb25zZSc7XG4gICAgICBjYXNlIDB4ODA6IHJldHVybiAnd3JpdGUnO1xuICAgICAgZGVmYXVsdDogcmV0dXJuIHVuZGVmaW5lZDtcbiAgICB9O1xuICB9KShxdWVyeS5hY3Rpb24pO1xuICBpZiAoYWN0aW9uKSB7XG4gICAgY29uc3Qga254YWRkciA9IG51bTJrbnhBZGRyKHF1ZXJ5LmRlc3QpO1xuICAgIGlmIChhY3Rpb24gPT09ICd3cml0ZScgfHwgYWN0aW9uID09PSAncmVzcG9uc2UnKSB7XG4gICAgICBjb25zdCBkYXRhID0gQnVmZmVyLmZyb20ocXVlcnkuZGF0YSlcbiAgICAgICAgLnRvU3RyaW5nKCdoZXgnKS5tYXRjaCgvLnsxLDJ9L2cpLmpvaW4oJzonKTtcbiAgICAgIG9rKCclcyBkYXRhICVzIHRvICVzJywgYWN0aW9uLCBkYXRhLCBrbnhhZGRyKTtcbiAgICB9XG4gICAgaWYgKGFjdGlvbiA9PT0gJ3JlYWQnKSB7XG4gICAgICBvaygncmVhZCAlcycsIGtueGFkZHIpO1xuICAgIH1cbiAgfVxufSk7XG4iXX0= |
@@ -0,1 +1,2 @@ | ||
#!/usr/bin/env node | ||
import * as yargs from 'yargs'; | ||
@@ -2,0 +3,0 @@ import * as chalk from 'chalk'; |
@@ -0,1 +1,2 @@ | ||
#!/usr/bin/env node | ||
"use strict"; | ||
@@ -68,2 +69,2 @@ const chalk = require("chalk"); | ||
}); | ||
//# sourceMappingURL=data:application/json;base64,eyJ2ZX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Ck7XG4gICAgfSk7XG4gIH0pLmNhdGNoKChfZXJyKSA9PiB7XG4gICAgZmFpbChgTm8gcmVzcG9uc2UgcmVjZWl2ZWQgZm9yIHJlYWQgdGVsZWdyYW0gdG8gJXNgLFxuICAgICAgY2hhbGsudW5kZXJsaW5lKGFyZ3YuZ3JvdXBBZGRyZXNzKSk7XG4gIH0pO1xufSk7XG4iXX0= |
@@ -0,1 +1,2 @@ | ||
#!/usr/bin/env node | ||
import * as chalk from 'chalk'; | ||
@@ -2,0 +3,0 @@ import * as yargs from 'yargs'; |
@@ -0,1 +1,2 @@ | ||
#!/usr/bin/env node | ||
"use strict"; | ||
@@ -71,2 +72,2 @@ const chalk = require("chalk"); | ||
}); | ||
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiZ3JvdXBzd3JpdGUuanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyJncm91cHN3cml0ZS50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiO0FBQUEsK0JBQStCO0FBQy9CLCtCQUErQjtBQUMvQiwrQ0FBd0U7QUFDeEUsdURBQW1EO0FBQ25ELCtCQUEyQztBQUUzQyxNQUFNLElBQUksR0FBRyxLQUFLLENBQUMsS0FBSyxDQUFDLDJEQUEyRCxDQUFDO0tBQ2xGLE1BQU0sQ0FBQyxDQUFDLFFBQVEsRUFBRSxjQUFjLEVBQUUsTUFBTSxDQUFDLENBQUM7S0FDMUMsS0FBSyxDQUFDLEdBQUcsRUFBRSxRQUFRLENBQUM7S0FDcEIsS0FBSyxDQUFDLEdBQUcsRUFBRSxNQUFNLENBQUM7S0FDbEIsS0FBSyxDQUFDLEdBQUcsRUFBRSxjQUFjLENBQUM7S0FDMUIsS0FBSyxDQUFDLEdBQUcsRUFBRSxNQUFNLENBQUM7S0FDbEIsS0FBSyxDQUFDLEdBQUcsRUFBRSxNQUFNLENBQUM7S0FDbEIsT0FBTyxDQUFDLE1BQU0sRUFBRSxJQU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
@@ -2,0 +3,0 @@ import * as yargs from 'yargs'; |
@@ -15,2 +15,5 @@ /// <reference types="node" /> | ||
constructor(); | ||
/** | ||
* Initializes tunneling. It is `never-resolving` promise | ||
*/ | ||
bind(remoteHost: string, remotePort: number, {timeout, onFailure}?: { | ||
@@ -20,16 +23,52 @@ timeout?: number; | ||
}): any; | ||
/** | ||
* returns promise, which indicates socket close | ||
*/ | ||
complete<T>(cb?: () => T): Promise<T>; | ||
isConnected(): boolean; | ||
/** | ||
* ready return promises, which only resolves when tunnel is connected | ||
*/ | ||
ready<T>(cb?: () => T): Promise<T>; | ||
/** | ||
* Generates next sequence number to number each knx telegram | ||
*/ | ||
protected nextSeqn(): number; | ||
/** | ||
* Verifies if the sender the one this tunneling was initially bound to | ||
*/ | ||
protected isSameOrigin(res: Channel, sender: AddressInfo): boolean; | ||
/** | ||
* Sends data to the bus | ||
*/ | ||
write(data: Buffer | Uint8Array | number[], groupAddress: number): Promise<TunnelingAck>; | ||
/** | ||
* Sends read request, which will only be resolved when response event received | ||
*/ | ||
read(groupAddress: number): Promise<GroupResponse>; | ||
/** | ||
* Terminates tunneling | ||
*/ | ||
disconnect<T>(cb?: () => T): Promise<T>; | ||
/** | ||
* Pings remote to verify if the channel is still active | ||
*/ | ||
protected startHeartbeat(): Promise<void>; | ||
/** | ||
* Stop heartbeat | ||
*/ | ||
protected stopHeartbeat(): void; | ||
/** | ||
* Send ping | ||
*/ | ||
protected ping(req: Buffer): Promise<Channel>; | ||
/** | ||
* Request tunneling | ||
*/ | ||
protected openTunnel(host: string, port: number): Promise<ConnectResponseTunnel>; | ||
/** | ||
* Supported events | ||
*/ | ||
on(event: 'unprocessed', cb: (err: Error, raw?: Buffer, remote?: AddressInfo) => void): Subscriber; | ||
on<T>(event: 'query', cb: (query: T, sender?: AddressInfo) => void): Subscriber; | ||
} |
@@ -10,2 +10,5 @@ "use strict"; | ||
} | ||
/** | ||
* Initializes tunneling. It is `never-resolving` promise | ||
*/ | ||
bind(remoteHost, remotePort, { timeout, onFailure, } = {}) { | ||
@@ -15,6 +18,7 @@ return this.qmanager.connect().then((sock) => { | ||
ip: constants_1.MyIpNumber, | ||
protocol: 1, | ||
protocol: 1 /* Udp4 */, | ||
port: sock.port, | ||
}; | ||
return this.openTunnel(remoteHost, remotePort).then((response) => { | ||
// when tunneling is open, store important info | ||
this.source = response.knxAddress; | ||
@@ -24,2 +28,3 @@ this.channelId = response.channelId; | ||
this.remotePort = remotePort; | ||
// begin heartbeat to the remote host | ||
return this.startHeartbeat(); | ||
@@ -33,4 +38,7 @@ }); | ||
if (timeout) { | ||
// cast number to uint | ||
timeout = timeout >>> 0; | ||
// schedule retry in `timeout` seconds | ||
return new Promise((resolve) => setTimeout(resolve, timeout).unref()).then(() => { | ||
// call to reconnect | ||
return this.bind(remoteHost, remotePort, { | ||
@@ -42,2 +50,3 @@ timeout, onFailure, | ||
else { | ||
// if no timeout, then propagate error to the caller | ||
throw err; | ||
@@ -47,2 +56,5 @@ } | ||
} | ||
/** | ||
* returns promise, which indicates socket close | ||
*/ | ||
complete(cb) { | ||
@@ -54,2 +66,5 @@ return this.qmanager.complete(cb); | ||
} | ||
/** | ||
* ready return promises, which only resolves when tunnel is connected | ||
*/ | ||
ready(cb) { | ||
@@ -63,2 +78,3 @@ return new Promise((resolve) => { | ||
if (this.isConnected()) { | ||
// when connected, clear interval | ||
clearInterval(interval); | ||
@@ -69,9 +85,13 @@ resolve(typeof cb === 'function' ? cb() : undefined); | ||
const ref = this.qmanager.on('disconnect', () => { | ||
// when disconnect scheduled | ||
clearInterval(interval); | ||
ref.unsubscribe(); | ||
}); | ||
interval.unref(); | ||
interval.unref(); // let node exit | ||
} | ||
}); | ||
} | ||
/** | ||
* Generates next sequence number to number each knx telegram | ||
*/ | ||
nextSeqn() { | ||
@@ -87,2 +107,5 @@ let id = 0; | ||
} | ||
/** | ||
* Verifies if the sender the one this tunneling was initially bound to | ||
*/ | ||
isSameOrigin(res, sender) { | ||
@@ -94,2 +117,5 @@ return res.channelId === this.channelId && | ||
} | ||
/** | ||
* Sends data to the bus | ||
*/ | ||
write(data, groupAddress) { | ||
@@ -106,5 +132,7 @@ const seqn = this.nextSeqn(); | ||
}).then((res) => { | ||
// always free used sequence number | ||
this.sequenceIds.delete(seqn); | ||
return res; | ||
}, (err) => { | ||
// always free used sequence number | ||
this.sequenceIds.delete(seqn); | ||
@@ -114,2 +142,5 @@ throw err; | ||
} | ||
/** | ||
* Sends read request, which will only be resolved when response event received | ||
*/ | ||
read(groupAddress) { | ||
@@ -125,8 +156,10 @@ const seqn = this.nextSeqn(); | ||
return res.dest === groupAddress && | ||
res.action === 64 && | ||
res.action === 64 /* GroupResponse */ && | ||
this.isSameOrigin(res, sender); | ||
}).then((res) => { | ||
// always free used sequence number | ||
this.sequenceIds.delete(seqn); | ||
return res; | ||
}, (err) => { | ||
// always free used sequence number | ||
this.sequenceIds.delete(seqn); | ||
@@ -136,2 +169,5 @@ throw err; | ||
} | ||
/** | ||
* Terminates tunneling | ||
*/ | ||
disconnect(cb) { | ||
@@ -142,2 +178,3 @@ const req = serializer_1.disconnect(this.channelId, this.controlPoint); | ||
}).then(() => { | ||
// when disconnecting, we stop heartbeating | ||
this.stopHeartbeat(); | ||
@@ -147,9 +184,16 @@ return this.qmanager.disconnect(cb); | ||
} | ||
/** | ||
* Pings remote to verify if the channel is still active | ||
*/ | ||
startHeartbeat() { | ||
const req = serializer_1.ping(this.channelId, this.controlPoint); | ||
return new Promise((_resolve, reject) => { | ||
// check connection with the first ping | ||
return this.ping(req).then(() => { | ||
// indicate that tunnel is ready | ||
// if it is successfull, then begin heartbeat every 60s | ||
this.heartbeatInterval = setInterval(() => { | ||
this.ping(req).catch(reject); | ||
}, 60000); | ||
// let node exit without waiting the interval | ||
this.heartbeatInterval.unref(); | ||
@@ -159,4 +203,8 @@ }).catch(reject); | ||
} | ||
/** | ||
* Stop heartbeat | ||
*/ | ||
stopHeartbeat() { | ||
if (this.heartbeatInterval) { | ||
// stop heartbeat if started | ||
clearInterval(this.heartbeatInterval); | ||
@@ -166,2 +214,5 @@ this.heartbeatInterval = undefined; | ||
} | ||
/** | ||
* Send ping | ||
*/ | ||
ping(req) { | ||
@@ -172,2 +223,5 @@ return this.qmanager.request(this.remoteHost, this.remotePort, req, (res, remote) => { | ||
} | ||
/** | ||
* Request tunneling | ||
*/ | ||
openTunnel(host, port) { | ||
@@ -182,4 +236,4 @@ const q = serializer_1.openTunnel({ | ||
sender.port === port && | ||
res.serviceId === 518 && | ||
res.connectionType === 4; | ||
res.serviceId === 518 /* ConnectResponse */ && | ||
res.connectionType === 4 /* Tunnel */; | ||
}); | ||
@@ -192,2 +246,2 @@ } | ||
exports.BusListener = BusListener; | ||
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiYnVzLWxpc3RlbmVyLmpzIiwic291cmNlUm9vdCI6IiIsInNvdXJjZXMiOlsiLi4vc3JjL2J1cy1saXN0ZW5lci50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiO0FBQUEsNkNBTXNCO0FBVXRCLG1EQUV5QjtBQU96QiwyQ0FFcUI7QUFLckI7SUFTRTtRQUNFLElBQUksQ0FBQyxXQUFXLEdBQUcsSUFBSSxHQUFHLEVBQUUsQ0FBQztRQUM3QixJQUFJLENBQUMsUUFBUSxHQUFHLElBQUksNEJBQVksRUFBRSxDQUFDO0lBQ3JDLENBQUM7SUFJTSxJQUFJLENBQUMsVUFBa0IsRUFBRSxVQUFrQixFQUFFLEVBQ2xELE9BQU8sRUFBRSxTQUFTLE1BQ3dDLEVBQUU7UUFDNUQsTUFBTSxDQUFDLElBQUksQ0FBQyxRQUFRLENBQUMsT0FBTyxFQUFFLENBQUMsSUFBSSxDQUFDLENBQUMsSUFBSTtZQUN2QyxJQUFJLENBQUMsWUFBWSxHQUFHO2dCQUNsQixFQUFFLEVBQUUsc0JBQVU7Z0JBQ2QsUUFBUSxFQUFFLENBQWE7Z0JBQ3ZCLElBQUksRUF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cmV0dXJuIHRoaXMucW1hbmFnZXIucmVxdWVzdDxDb25uZWN0UmVzcG9uc2VUdW5uZWw+KFxuICAgICAgaG9zdCwgcG9ydCwgcSwgKHJlcywgc2VuZGVyKSA9PiB7XG4gICAgICAgIHJldHVybiBzZW5kZXIuYWRkcmVzcyA9PT0gaG9zdCAmJlxuICAgICAgICAgIHNlbmRlci5mYW1pbHkgPT09ICdJUHY0JyAmJlxuICAgICAgICAgIHNlbmRlci5wb3J0ID09PSBwb3J0ICYmXG4gICAgICAgICAgcmVzLnNlcnZpY2VJZCA9PT0gU2VydmljZS5Db25uZWN0UmVzcG9uc2UgJiZcbiAgICAgICAgICByZXMuY29ubmVjdGlvblR5cGUgPT09IENvbm5lY3Rpb24uVHVubmVsO1xuICAgICAgfSk7XG4gIH1cbiAgLyoqXG4gICAqIFN1cHBvcnRlZCBldmVudHNcbiAgICovXG4gIG9uKGV2ZW50OiAndW5wcm9jZXNzZWQnLCBjYjogKGVycjogRXJyb3IsIHJhdz86IEJ1ZmZlciwgcmVtb3RlPzogQWRkcmVzc0luZm8pID0+IHZvaWQpOiBTdWJzY3JpYmVyO1xuICBvbjxUPihldmVudDogJ3F1ZXJ5JywgY2I6IChxdWVyeTogVCwgc2VuZGVyPzogQWRkcmVzc0luZm8pID0+IHZvaWQpOiBTdWJzY3JpYmVyO1xuICBvbihldmVudDogc3RyaW5nLCBjYjogKC4uLmFyZ3M6IGFueVtdKSA9PiB2b2lkKTogU3Vic2NyaWJlciB7XG4gICAgcmV0dXJuIHRoaXMucW1hbmFnZXIub24oZXZlbnQsIGNiKTtcbiAgfVxufVxuIl19 |
@@ -52,3 +52,3 @@ "use strict"; | ||
switch (contype) { | ||
case 4: { | ||
case 4 /* Tunnel */: { | ||
if (size !== 0x4) { | ||
@@ -94,10 +94,12 @@ throw new Error(`Failed to read connect response for tunneling at ${pos.cur}`); | ||
const apdu = raw.readUInt16BE(pos.next(2)); | ||
const action = apdu & (128 | | ||
64 | 0); | ||
if (action & (128 | 64)) { | ||
const action = apdu & (128 /* GroupWrite */ | | ||
64 /* GroupResponse */ | 0 /* GroupRead */); | ||
if (action & (128 /* GroupWrite */ | 64 /* GroupResponse */)) { | ||
let data; | ||
if (npduLength > 1) { | ||
// data appended | ||
data = raw.subarray(pos.next(npduLength), pos.cur); | ||
} | ||
else { | ||
// data merged into 6 bits | ||
data = new Uint8Array([apdu & 0x3f]); | ||
@@ -110,2 +112,3 @@ } | ||
else { | ||
// read | ||
return { | ||
@@ -118,2 +121,2 @@ action, dest, source, | ||
; | ||
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiZGVzZXJpYWxpemVyLmpzIiwic291cmNlUm9vdCI6IiIsInNvdXJjZXMiOlsiLi4vc3JjL2Rlc2VyaWFsaXplci50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiO0FBYUEsZ0JBQXVCLEdBQVcsRUFBRSxHQUFnQjtJQUNsRCxNQUFNLFlBQVksR0FBRyxHQUFHLENBQUMsU0FBUyxDQUFDLEdBQUcsQ0FBQyxJQUFJLEVBQUUsQ0FBQyxDQUFDO0lBQy9DLE1BQU0sZUFBZSxHQUFHLEdBQUcsQ0FBQyxTQUFTLENBQUMsR0FBRyxDQUFDLElBQUksRUFBRSxDQUFDLENBQUM7SUFDbEQsTUFBTSxTQUFTLEdBQUcsR0FBRyxDQUFDLFlBQVksQ0FBQyxHQUFHLENBQUMsSUFBSSxDQUFDLENBQUMsQ0FBQyxDQUFDLENBQUM7SUFDaEQsTUFBTSxXQUFXLEdBQUcsR0FBRyxDQUFDLFlBQVksQ0FBQyxHQUFHLENBQUMsSUFBSSxDQUFDLENBQUMsQ0FBQyxDQUFDLENBQUM7SUFDbEQsRUFBRSxDQUFDLENBQUMsWUFBWSxLQUFLLElBQUksQ0FBQyxDQUFDLENBQUM7UUFDMUIsTUFBTSxJQUFJLEtBQUssQ0FBQyx5QkFBeUIsWUFBWSxFQUFFLENBQUMsQ0FBQztJQU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E2QkUocG9zLm5leHQoMikpO1xuICBjb25zdCBhY3Rpb24gPSBhcGR1ICYgKEJ1c0V2ZW50Lkdyb3VwV3JpdGUgfFxuICAgIEJ1c0V2ZW50Lkdyb3VwUmVzcG9uc2UgfCBCdXNFdmVudC5Hcm91cFJlYWQpO1xuICBpZiAoYWN0aW9uICYgKEJ1c0V2ZW50Lkdyb3VwV3JpdGUgfCBCdXNFdmVudC5Hcm91cFJlc3BvbnNlKSkge1xuICAgIGxldCBkYXRhOiBVaW50OEFycmF5O1xuICAgIGlmIChucGR1TGVuZ3RoID4gMSkge1xuICAgICAgLy8gZGF0YSBhcHBlbmRlZFxuICAgICAgZGF0YSA9IHJhdy5zdWJhcnJheShwb3MubmV4dChucGR1TGVuZ3RoKSwgcG9zLmN1cik7XG4gICAgfSBlbHNlIHtcbiAgICAgIC8vIGRhdGEgbWVyZ2VkIGludG8gNiBiaXRzXG4gICAgICBkYXRhID0gbmV3IFVpbnQ4QXJyYXkoW2FwZHUgJiAweDNmXSk7XG4gICAgfVxuICAgIHJldHVybiB7XG4gICAgICBkYXRhLCBhY3Rpb24sIGRlc3QsIHNvdXJjZSxcbiAgICB9O1xuICB9IGVsc2Uge1xuICAgIC8vIHJlYWRcbiAgICByZXR1cm4ge1xuICAgICAgYWN0aW9uLCBkZXN0LCBzb3VyY2UsXG4gICAgfTtcbiAgfVxufTtcbiJdfQ== |
/// <reference types="node" /> | ||
import { RemoteInfo } from 'dgram'; | ||
import { AsyncSocket } from './utils/async-socket'; | ||
/** | ||
* Manages io server queries and tracks resolution of mappable requests | ||
*/ | ||
export declare class QueryManager extends AsyncSocket { | ||
connect(port?: number): Promise<RemoteInfo>; | ||
/** | ||
* Creates a mapable request to track responses with timeout | ||
*/ | ||
request<T>(host: string, port: number, data: Buffer, select: (res: T, sender?: RemoteInfo) => boolean, timeout?: number): Promise<T>; | ||
/** | ||
* Processes raw messages from socket stream | ||
*/ | ||
private process(raw, remote); | ||
} |
@@ -7,15 +7,25 @@ "use strict"; | ||
const serializer_1 = require("./serializer"); | ||
/** | ||
* Manages io server queries and tracks resolution of mappable requests | ||
*/ | ||
class QueryManager extends async_socket_1.AsyncSocket { | ||
connect(port = 0) { | ||
connect(port = 0 /* OS assigned port */) { | ||
// forward raw data for processing | ||
const ref = super.on('raw', this.process.bind(this)); | ||
return super.connect(port).catch((err) => { | ||
ref.unsubscribe(); | ||
// propagate error to the caller | ||
throw err; | ||
}); | ||
} | ||
/** | ||
* Creates a mapable request to track responses with timeout | ||
*/ | ||
request(host, port, data, select, timeout) { | ||
return new Promise((resolve, reject) => { | ||
// keep ref to unsub to avoid a memory leak | ||
const ref = this.on('query', (query, remote) => { | ||
// map response to the request | ||
if (select(query, remote)) { | ||
if (query.status === 0) { | ||
if (query.status === 0 /* NoError */) { | ||
resolve(query); | ||
@@ -28,10 +38,12 @@ } | ||
}); | ||
// set timeout if no response within given time | ||
setTimeout(() => { | ||
ref.unsubscribe(); | ||
ref.unsubscribe(); // avoid memory leak | ||
const err = new Error(`Request timeout`); | ||
err.code = 'ETIMEOUT'; | ||
reject(err); | ||
}, timeout > 200 ? timeout : 200).unref(); | ||
}, timeout > 200 ? timeout : 200).unref(); // unref timeout to let node exit | ||
// make request and propagate errors | ||
return super.send(host, port, data).catch((err) => { | ||
ref.unsubscribe(); | ||
ref.unsubscribe(); // avoid memory leak | ||
reject(err); | ||
@@ -41,2 +53,5 @@ }); | ||
} | ||
/** | ||
* Processes raw messages from socket stream | ||
*/ | ||
process(raw, remote) { | ||
@@ -47,3 +62,3 @@ try { | ||
switch (header.serviceId) { | ||
case 518: { | ||
case 518 /* ConnectResponse */: { | ||
const channel = deserializer_1.channel(raw, pos); | ||
@@ -54,17 +69,18 @@ const sender = deserializer_1.hpai(raw, pos); | ||
} | ||
case 520: { | ||
case 520 /* ConnectStateResponse */: { | ||
const channel = deserializer_1.channel(raw, pos); | ||
return this.events.emit('query', tslib_1.__assign({}, channel), remote); | ||
} | ||
case 1057: { | ||
case 1057 /* TunnelingAck */: { | ||
const seqn = deserializer_1.seqnum(raw, pos); | ||
return this.events.emit('query', tslib_1.__assign({}, seqn), remote); | ||
} | ||
case 1056: { | ||
case 1056 /* TunnelingRequest */: { | ||
const seqn = deserializer_1.seqnum(raw, pos); | ||
const cemi = deserializer_1.tunnelCemi(raw, pos); | ||
this.send(remote.address, remote.port, serializer_1.ack(seqn.seqn, seqn.channelId, 0)); | ||
// reply ack to indicate successful reception of the message | ||
this.send(remote.address, remote.port, serializer_1.ack(seqn.seqn, seqn.channelId, 0 /* NoError */)); | ||
return this.events.emit('query', tslib_1.__assign({}, cemi, seqn), remote); | ||
} | ||
case 522: { | ||
case 522 /* DisconnectResponse */: { | ||
const channel = deserializer_1.channel(raw, pos); | ||
@@ -82,2 +98,2 @@ return this.events.emit('query', tslib_1.__assign({}, channel), remote); | ||
exports.QueryManager = QueryManager; | ||
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoicXVlcnktbWFuYWdlci5qcyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbIi4uL3NyYy9xdWVyeS1tYW5hZ2VyLnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiI7O0FBR0EsdURBRThCO0FBQzlCLHVEQUU4QjtBQUM5QixpREFPd0I7QUFDeEIsNkNBRXNCO0FBU3RCLGtCQUEwQixTQUFRLDBCQUFXO0lBQzNDLE9BQU8sQ0FBQyxPQUFlLENBQUM7UUFFdEIsTUFBTSxHQUFHLEdBQUcsS0FBSyxDQUFDLEVBQUUsQ0FBQyxLQUFLLEVBQUUsSUFBSSxDQUFDLE9BQU8sQ0FBQyxJQUFJLENBQUMsSUFBSSxDQUFDLENBQUMsQ0FBQztRQUNyRCxNQUFNLENBQUMsS0FBSyxDQUFDLE9BQU8sQ0FBQyxJQUFJLENBQUMsQ0FBQyxLQUFLLENBQUMsQ0FBQyxHQUFHO1lBQ25DLEdBQUcsQ0FBQyxXQUFXLEVBQUUsQ0FBQ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()); | ||
raw.writeUInt8(0x10, pos.next()); | ||
raw.writeUInt16BE(service, pos.next(2)); | ||
raw.writeUInt16BE(size + bodyLength, pos.next(2)); | ||
raw.writeUInt8(size, pos.next()); // header length | ||
raw.writeUInt8(0x10, pos.next()); // version | ||
raw.writeUInt16BE(service, pos.next(2)); // service type | ||
raw.writeUInt16BE(size + bodyLength, pos.next(2)); // total length | ||
return raw; | ||
@@ -26,6 +26,6 @@ } | ||
const raw = Buffer.allocUnsafe(size); | ||
raw.writeUInt8(size, pos.next()); | ||
raw.writeUInt8(protocol, pos.next()); | ||
raw.writeUInt32BE(ip, pos.next(4)); | ||
raw.writeUInt16BE(port, pos.next(2)); | ||
raw.writeUInt8(size, pos.next()); // structure length | ||
raw.writeUInt8(protocol, pos.next()); // protocol | ||
raw.writeUInt32BE(ip, pos.next(4)); // ip | ||
raw.writeUInt16BE(port, pos.next(2)); // port | ||
return raw; | ||
@@ -38,6 +38,6 @@ } | ||
const raw = Buffer.allocUnsafe(size); | ||
raw.writeUInt8(size, pos.next()); | ||
raw.writeUInt8(0x04, pos.next()); | ||
raw.writeUInt8(0x02, pos.next()); | ||
raw.writeUInt8(0x00, pos.next()); | ||
raw.writeUInt8(size, pos.next()); // structure length | ||
raw.writeUInt8(0x04, pos.next()); // TUNNEL_CONNECTION | ||
raw.writeUInt8(0x02, pos.next()); // TUNNEL_LINKLAYER | ||
raw.writeUInt8(0x00, pos.next()); // reserved | ||
return raw; | ||
@@ -50,6 +50,9 @@ } | ||
raw.writeUInt8(channelId, pos.next()); | ||
raw.writeUInt8(0x00, pos.next()); | ||
raw.writeUInt8(0x00, pos.next()); // reserved | ||
return raw; | ||
} | ||
; | ||
/** | ||
* Creates buffer of sequence counter, channel id and status code | ||
*/ | ||
function seqnum(seqn, channelId, status = 0x00) { | ||
@@ -59,11 +62,12 @@ const size = 0x04; | ||
const raw = Buffer.allocUnsafe(size); | ||
raw.writeUInt8(size, pos.next()); | ||
raw.writeUInt8(channelId, pos.next()); | ||
raw.writeUInt8(seqn, pos.next()); | ||
raw.writeUInt8(status, pos.next()); | ||
raw.writeUInt8(size, pos.next()); // structure length | ||
raw.writeUInt8(channelId, pos.next()); // channelId | ||
raw.writeUInt8(seqn, pos.next()); // sequenceCounter | ||
raw.writeUInt8(status, pos.next()); // reserved or status | ||
return raw; | ||
} | ||
; | ||
// ready to use messages | ||
function ack(seqn, channelId, status) { | ||
return message(1057, [ | ||
return message(1057 /* TunnelingAck */, [ | ||
seqnum(seqn, channelId, status), | ||
@@ -75,3 +79,3 @@ ]); | ||
function disconnect(channelId, respondTo) { | ||
return message(521, [ | ||
return message(521 /* DisconnectRequest */, [ | ||
channel(channelId), | ||
@@ -84,3 +88,3 @@ hpai(respondTo.protocol, respondTo.ip, respondTo.port), | ||
function ping(channelId, respondTo) { | ||
return message(519, [ | ||
return message(519 /* ConnectionStateRequest */, [ | ||
channel(channelId), | ||
@@ -93,3 +97,3 @@ hpai(respondTo.protocol, respondTo.ip, respondTo.port), | ||
function openTunnel({ receiveAt, respondTo }) { | ||
return message(517, [ | ||
return message(517 /* ConnectRequest */, [ | ||
hpai(respondTo.protocol, respondTo.ip, respondTo.port), | ||
@@ -103,25 +107,29 @@ hpai(receiveAt.protocol, receiveAt.ip, receiveAt.port), | ||
function write({ data, seqn, channelId, source, dest }) { | ||
if (data.length > 16) { | ||
throw new Error(`Data is too long, expected maximum ${16} bytes, got ${data.length}`); | ||
if (data.length > 16 /* Uint128 */) { | ||
// if data is longer than 16 bytes | ||
throw new Error(`Data is too long, expected maximum ${16 /* Uint128 */} bytes, got ${data.length}`); | ||
} | ||
const isUint6 = data.length === 1 && data[0] <= 0x3f; | ||
const size = isUint6 ? 1 : data.length + 1; | ||
// cemi | ||
const isUint6 = data.length === 1 /* Uint8 */ && data[0] <= 0x3f; | ||
const size = isUint6 ? 1 /* Uint8 */ : data.length + 1; | ||
const pos = new smart_cursor_1.SmartCursor(); | ||
const cemi = Buffer.alloc(0x0A + size); | ||
cemi.writeUInt8(0x11, pos.next()); | ||
cemi.writeUInt8(0x00, pos.next()); | ||
cemi.writeUInt8(0xbc, pos.next()); | ||
cemi.writeUInt8(0xe0, pos.next()); | ||
cemi.writeUInt16BE(source, pos.next(2)); | ||
cemi.writeUInt16BE(dest, pos.next(2)); | ||
cemi.writeUInt8(0x11, pos.next()); // L_Data_req | ||
cemi.writeUInt8(0x00, pos.next()); // additional info length | ||
cemi.writeUInt8(0xbc, pos.next()); // control field 1 | ||
cemi.writeUInt8(0xe0, pos.next()); // control field 2 | ||
cemi.writeUInt16BE(source, pos.next(2)); // source address 0.0.0 | ||
cemi.writeUInt16BE(dest, pos.next(2)); // destination address | ||
if (isUint6) { | ||
cemi.writeUInt8(size, pos.next()); | ||
cemi.writeUInt16BE(data[0] | 0x80, pos.next(2)); | ||
// data can be merged | ||
cemi.writeUInt8(size, pos.next()); // payload length | ||
cemi.writeUInt16BE(data[0] | 0x80, pos.next(2)); // 0x80 GROUPVALUE_WRITE | ||
} | ||
else { | ||
cemi.writeUInt8(size, pos.next()); | ||
cemi.writeUInt16BE(0x80, pos.next(2)); | ||
// data must be appended at the end | ||
cemi.writeUInt8(size, pos.next()); // payload length | ||
cemi.writeUInt16BE(0x80, pos.next(2)); // apci 0x80 GROUPVALUE_WRITE | ||
cemi.set(data, pos.next(size)); | ||
} | ||
return message(1056, [ | ||
return message(1056 /* TunnelingRequest */, [ | ||
seqnum(seqn, channelId), | ||
@@ -134,13 +142,14 @@ cemi, | ||
function read(params) { | ||
// cemi | ||
const pos = new smart_cursor_1.SmartCursor(); | ||
const cemi = Buffer.alloc(0x0B); | ||
cemi.writeUInt8(0x11, pos.next()); | ||
cemi.writeUInt8(0x00, pos.next()); | ||
cemi.writeUInt8(0xbc, pos.next()); | ||
cemi.writeUInt8(0xe0, pos.next()); | ||
cemi.writeUInt16BE(params.source, pos.next(2)); | ||
cemi.writeUInt16BE(params.dest, pos.next(2)); | ||
cemi.writeUInt8(0x01, pos.next()); | ||
cemi.writeUInt16BE(0x00, pos.next(2)); | ||
return message(1056, [ | ||
cemi.writeUInt8(0x11, pos.next()); // L_Data_req | ||
cemi.writeUInt8(0x00, pos.next()); // additional info length | ||
cemi.writeUInt8(0xbc, pos.next()); // control field 1 | ||
cemi.writeUInt8(0xe0, pos.next()); // control field 2 | ||
cemi.writeUInt16BE(params.source, pos.next(2)); // source address 0.0.0 | ||
cemi.writeUInt16BE(params.dest, pos.next(2)); // destination address | ||
cemi.writeUInt8(0x01, pos.next()); // payload length | ||
cemi.writeUInt16BE(0x00, pos.next(2)); // 0x00 GROUPVALUE_READ | ||
return message(1056 /* TunnelingRequest */, [ | ||
seqnum(params.seqn, params.channelId), | ||
@@ -152,2 +161,2 @@ cemi, | ||
; | ||
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoic2VyaWFsaXplci5qcyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbIi4uL3NyYy9zZXJpYWxpemVyLnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiI7QUFBQSx1REFFOEI7QUFROUIsZ0JBQWdCLE9BQWdCLEVBQUUsVUFBa0I7SUFDbEQsTUFBTSxJQUFJLEdBQUcsSUFBSSxDQUFDO0lBQ2xCLE1BQU0sR0FBRyxHQUFHLElBQUksMEJBQVcsRUFBRSxDQUFDO0lBQzlCLE1BQU0sR0FBRyxHQUFHLE1BQU0sQ0FBQyxXQUFXLENBQUMsSUFBSSxDQUFDLENBQUM7SUFDckMsR0FBRyxDQUFDLFVBQVUsQ0FBQyxJQUFJLEVBQUUsR0FBRyxDQUFDLElBQUksRUFBRSxDQUFDLENBQUM7SUFDakMsR0FBRyxDQUFDLFVBQVUsQ0FBQyxJQUFJLEVBQUUsR0FBRyxDQUFDLElBQUksRUFBRSxDQUFDLENBQUM7SUFDakMsR0FBRyxDQUFDLGFBQWEsQ0FBQyxPQUFPLEVBQUUsR0FBRyxDQUFDLElBQUksQ0FBQyxDQUFDLENBQUMsQ0F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gcG9zID0gbmV3IFNtYXJ0Q3Vyc29yKCk7XG4gIGNvbnN0IGNlbWkgPSBCdWZmZXIuYWxsb2MoMHgwQik7XG4gIGNlbWkud3JpdGVVSW50OCgweDExLCBwb3MubmV4dCgpKTsgLy8gTF9EYXRhX3JlcVxuICBjZW1pLndyaXRlVUludDgoMHgwMCwgcG9zLm5leHQoKSk7IC8vIGFkZGl0aW9uYWwgaW5mbyBsZW5ndGhcbiAgY2VtaS53cml0ZVVJbnQ4KDB4YmMsIHBvcy5uZXh0KCkpOyAvLyBjb250cm9sIGZpZWxkIDFcbiAgY2VtaS53cml0ZVVJbnQ4KDB4ZTAsIHBvcy5uZXh0KCkpOyAvLyBjb250cm9sIGZpZWxkIDJcbiAgY2VtaS53cml0ZVVJbnQxNkJFKHBhcmFtcy5zb3VyY2UsIHBvcy5uZXh0KDIpKTsgLy8gc291cmNlIGFkZHJlc3MgMC4wLjBcbiAgY2VtaS53cml0ZVVJbnQxNkJFKHBhcmFtcy5kZXN0LCBwb3MubmV4dCgyKSk7IC8vIGRlc3RpbmF0aW9uIGFkZHJlc3NcbiAgY2VtaS53cml0ZVVJbnQ4KDB4MDEsIHBvcy5uZXh0KCkpOyAvLyBwYXlsb2FkIGxlbmd0aFxuICBjZW1pLndyaXRlVUludDE2QkUoMHgwMCwgcG9zLm5leHQoMikpOyAvLyAweDAwIEdST1VQVkFMVUVfUkVBRFxuICByZXR1cm4gbWVzc2FnZShTZXJ2aWNlLlR1bm5lbGluZ1JlcXVlc3QsIFtcbiAgICBzZXFudW0ocGFyYW1zLnNlcW4sIHBhcmFtcy5jaGFubmVsSWQpLFxuICAgIGNlbWksXG4gIF0pO1xufTtcbiJdfQ== |
@@ -5,2 +5,5 @@ /// <reference types="node" /> | ||
import { Subscriber } from '../interfaces'; | ||
/** | ||
* Simple promisable udp socket | ||
*/ | ||
export declare class AsyncSocket { | ||
@@ -7,0 +10,0 @@ private socket; |
"use strict"; | ||
const dgram_1 = require("dgram"); | ||
const events_1 = require("events"); | ||
/** | ||
* Simple promisable udp socket | ||
*/ | ||
class AsyncSocket { | ||
@@ -11,3 +14,3 @@ constructor() { | ||
} | ||
connect(port = 0) { | ||
connect(port = 0 /* OS assigned port */) { | ||
return new Promise((resolve, reject) => { | ||
@@ -24,3 +27,5 @@ if (this.isConnected()) { | ||
this.socket = undefined; | ||
// emit disconnect event | ||
this.events.emit('disconnect'); | ||
// and remove all listeners to prevent any memory leak | ||
this.events.removeAllListeners(); | ||
@@ -93,2 +98,2 @@ }) | ||
exports.AsyncSocket = AsyncSocket; | ||
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiYXN5bmMtc29ja2V0LmpzIiwic291cmNlUm9vdCI6IiIsInNvdXJjZXMiOlsiLi4vLi4vc3JjL3V0aWxzL2FzeW5jLXNvY2tldC50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiO0FBQUEsaUNBSWU7QUFDZixtQ0FFZ0I7QUFRaEI7SUFBQTtRQUVZLFdBQU0sR0FBaUIsSUFBSSxxQkFBWSxFQUFFLENBQUM7SUFrRnRELENBQUM7SUFqRkMsV0FBVztRQUNULE1BQU0sQ0FBQyxJQUFJLENBQUMsTUFBTSxHQUFHLElBQUksR0FBRyxLQUFLLENBQUM7SUFDcEMsQ0FBQztJQUNELE9BQU8sQ0FBQyxPQUFlLENBQUM7UUFDdEIsTUFBTSxDQUFDLElBQUksT0FBTyxDQUFhLENBQUMsT0FBTyxFQUFFLE1BQU07WUFDN0MsRUFBRSxDQUFDLENBQUMsSUFBSSxDQUFDLFdBQVcsRUFBRSxDQUFDLENBQUMsQ0FBQztnQkFDdkIsT0FBTyxDQUFDLElBQUksQ0FBQyxNQUFNLENBQUMsT0FBTyxFQUFFLENBQUMsQ0FBQztZQUNqQyxDQUFDO1lBQUMsSUFBSSxDQUFDLENBQUM7Z0JBQ04sSUFBSSxDQUFDLE1BQU0sR0FBRyxvQkFBWSxDQUFDLE1BQU0sQ0FBQzt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GVsc2Uge1xuICAgICAgdGhyb3cgbmV3IEVycm9yKGBGYWlsZWQgdG8gc3Vic2NyaWJlYCk7XG4gICAgfVxuICB9XG59XG4iXX0= |
@@ -0,1 +1,4 @@ | ||
/** | ||
* Class helper acts as iterrator to access buffer | ||
*/ | ||
export declare class SmartCursor { | ||
@@ -2,0 +5,0 @@ private cursor; |
@@ -7,2 +7,5 @@ "use strict"; | ||
} | ||
/** | ||
* Class helper acts as iterrator to access buffer | ||
*/ | ||
class SmartCursor { | ||
@@ -48,2 +51,2 @@ constructor(i = 0) { | ||
exports.SmartCursor = SmartCursor; | ||
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoic21hcnQtY3Vyc29yLmpzIiwic291cmNlUm9vdCI6IiIsInNvdXJjZXMiOlsiLi4vLi4vc3JjL3V0aWxzL3NtYXJ0LWN1cnNvci50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiO0FBQUEsZUFBZSxDQUFTO0lBQ3RCLEVBQUUsQ0FBQyxDQUFDLENBQUMsR0FBRyxDQUFDLENBQUMsQ0FBQyxDQUFDO1FBQ1YsTUFBTSxLQUFLLENBQUMsNkNBQTZDLENBQUMsQ0FBQztJQUM3RCxDQUFDO0FBQ0gsQ0FBQztBQUtEO0lBR0UsWUFBWSxJQUFZLENBQUM7UUFDdkIsSUFBSSxDQUFDLE1BQU0sR0FBRyxDQUFDLENBQUM7UUFDaEIsSUFBSSxDQUFDLGVBQWUsR0FBRyxDQUFDLENBQUM7SUFDM0IsQ0FBQztJQUNNLElBQUksQ0FBQyxDQUFTO1FBQ25CLEtBQUssQ0FBQyxDQUFDLENBQUMsQ0FBQztRQUNULElBQUksQ0FBQyxNQUFNLEdBQUcsQ0FBQyxDQUFDO1FBQ2hCLElBQUksQ0FBQyxlQUFlLEdBQUcsQ0FBQyxDQUFDO1FBQ3pCLE1BQU0sQ0FBQyxJQUFJLENBQUM7SUFDZCxDQUFDO0lBQ00sSUFBSSx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gICBjaGVjayhuZXh0UG9zKTtcbiAgICBjb25zdCBjbG9uZSA9IHRoaXMuY3Vyc29yO1xuICAgIHRoaXMuY3Vyc29yICs9IG5leHRQb3M7XG4gICAgcmV0dXJuIGNsb25lO1xuICB9XG4gIGdldCBtZW1vcml6ZWQoKSB7XG4gICAgcmV0dXJuIHRoaXMubWVtb3JpemVkQ3Vyc29yO1xuICB9XG4gIGdldCBjdXIoKSB7XG4gICAgcmV0dXJuIHRoaXMuY3Vyc29yO1xuICB9XG59XG4iXX0= |
{ | ||
"name": "knx-listener", | ||
"license": "MIT", | ||
"version": "0.0.4", | ||
"version": "0.0.5", | ||
"main": "./dist/index.js", | ||
@@ -25,2 +25,4 @@ "types": "./dist/index.d.ts", | ||
"scripts": { | ||
"compile:dist": "tsc -p tsconfig.dist.json", | ||
"compile:dev": "tsc -p tsconfig.json", | ||
"start": "node bin/busmonitor.js", | ||
@@ -61,3 +63,8 @@ "busmonitor": "node bin/busmonitor.js", | ||
] | ||
}, | ||
"bin": { | ||
"busmonitor": "./bin/busmonitor.js", | ||
"groupsread": "./bin/groupsread.js", | ||
"groupswrite": "./bin/groupswrite.js" | ||
} | ||
} |
# KNX Listener | ||
A thin client to monitor, write and read telegrams through KNX gateway | ||
A thin node client to monitor, write and read groups telegrams through KNX gateway | ||
@@ -7,4 +7,5 @@ [![npm version](https://badge.fury.io/js/knx-listener.svg)](https://badge.fury.io/js/knx-listener) [![npm](https://img.shields.io/npm/l/express.svg)]() | ||
## Install | ||
Install the knx-listener globally and use commands from the command line | ||
``` | ||
npm install --save knx-listener | ||
sudo npm install -g knx-listener | ||
``` | ||
@@ -23,7 +24,7 @@ ## Remote access to the knx net | ||
``` | ||
node bin/busmonitor -s 192.168.0.100 | ||
busmonitor -s 192.168.1.100 | ||
``` | ||
![](http://i.giphy.com/26xBuNRYG1nGUnj3O.gif) | ||
### Write value **1** to **0/0/1** through **192.168.0.100** | ||
### Write value **1** to **0/0/1** through **192.168.1.100** | ||
``` | ||
@@ -40,7 +41,7 @@ Usage bin/groupswrite.js -s <ip address> -g <group address> -d <XX:XX:..> | ||
``` | ||
node bin/groupswrite -s 192.168.1.100 -g 0/0/1 -d 01 | ||
groupswrite -s 192.168.1.100 -g 0/0/1 -d 01 | ||
``` | ||
![](http://i.giphy.com/26xBvwQEv3gKYdRp6.gif) | ||
### Read value from **0/0/1** through **192.168.0.100** | ||
### Read value from **0/0/1** through **192.168.1.100** | ||
``` | ||
@@ -56,3 +57,3 @@ Usage bin/groupsread.js -s <ip address> -g <group address> | ||
``` | ||
node bin/groupsread -s 192.168.0.100 -g 0/0/1 | ||
groupsread -s 192.168.1.100 -g 0/0/1 | ||
``` | ||
@@ -114,2 +115,2 @@ ![](http://i.giphy.com/l3q2Yr9ZgyRYYQBva.gif) | ||
* You may build visualization with any KNX gateway | ||
* You may delegate decoding of data to your rich clients | ||
* You may delegate endcoding/decoding of data to your rich clients |
@@ -15,4 +15,3 @@ { | ||
"allowJs": false, | ||
"newLine": "LF", | ||
"removeComments": true | ||
"newLine": "LF" | ||
}, | ||
@@ -19,0 +18,0 @@ "include": [ |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
198333
2968
112