knx-listener
Advanced tools
Comparing version 0.0.3 to 0.0.4
@@ -60,2 +60,6 @@ "use strict"; | ||
}, 0); | ||
const ref = this.qmanager.on('disconnect', () => { | ||
clearInterval(interval); | ||
ref.unsubscribe(); | ||
}); | ||
interval.unref(); | ||
@@ -168,2 +172,2 @@ } | ||
exports.BusListener = BusListener; | ||
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiYnVzLWxpc3RlbmVyLmpzIiwic291cmNlUm9vdCI6IiIsInNvdXJjZXMiOlsiLi4vc3JjL2J1cy1saXN0ZW5lci50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiO0FBQUEsNkNBTXNCO0FBVXRCLG1EQUV5QjtBQU96QiwyQ0FFcUI7QUFLckI7SUFTRTtRQUNFLElBQUksQ0FBQyxXQUFXLEdBQUcsSUFBSSxHQUFHLEVBQUUsQ0FBQztRQUM3QixJQUFJLENBQUMsUUFBUSxHQUFHLElBQUksNEJBQVksRUFBRSxDQUFDO0lBQ3JDLENBQUM7SUFJTSxJQUFJLENBQUMsVUFBa0IsRUFBRSxVQUFrQixFQUFFLEVBQ2xELE9BQU8sRUFBRSxTQUFTLE1BQ3dDLEVBQUU7UUFDNUQsTUFBTSxDQUFDLElBQUksQ0FBQyxRQUFRLENBQUMsT0FBTyxFQUFFLENBQUMsSUFBSSxDQUFDLENBQUMsSUFBSTtZQUN2QyxJQUFJLENBQUMsWUFBWSxHQUFHO2dCQUNsQixFQUFFLEVBQUUsc0JBQVU7Z0JBQ2QsUUFBUSxFQUFFLENBQWE7Z0JBQ3ZCLElBQUksRUFBRSxJQUFJLENBQUMsSUFBSTthQUNoQixDQUFDO1lBQ0YsTUFBTSxDQUFDLElBQUksQ0FBQyxVQUFVLENBQUMsVUFBVSxFQUFFLFVBQVUsQ0FBQyxDQUFDLElBQUksQ0FBQyxDQUFDLFFBQVE7Z0JBRTNELElBQUksQ0FBQyxNQUFNLEdBQUcsUUFBUSxDQUFDLFV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HNlbmRlci5hZGRyZXNzID09PSBob3N0ICYmXG4gICAgICAgICAgc2VuZGVyLmZhbWlseSA9PT0gJ0lQdjQnICYmXG4gICAgICAgICAgc2VuZGVyLnBvcnQgPT09IHBvcnQgJiZcbiAgICAgICAgICByZXMuc2VydmljZUlkID09PSBTZXJ2aWNlLkNvbm5lY3RSZXNwb25zZSAmJlxuICAgICAgICAgIHJlcy5jb25uZWN0aW9uVHlwZSA9PT0gQ29ubmVjdGlvbi5UdW5uZWw7XG4gICAgICB9KTtcbiAgfVxuICAvKipcbiAgICogU3VwcG9ydGVkIGV2ZW50c1xuICAgKi9cbiAgb24oZXZlbnQ6ICd1bnByb2Nlc3NlZCcsIGNiOiAoZXJyOiBFcnJvciwgcmF3PzogQnVmZmVyLCByZW1vdGU/OiBBZGRyZXNzSW5mbykgPT4gdm9pZCk6IFN1YnNjcmliZXI7XG4gIG9uPFQ+KGV2ZW50OiAncXVlcnknLCBjYjogKHF1ZXJ5OiBULCBzZW5kZXI/OiBBZGRyZXNzSW5mbykgPT4gdm9pZCk6IFN1YnNjcmliZXI7XG4gIG9uKGV2ZW50OiBzdHJpbmcsIGNiOiAoLi4uYXJnczogYW55W10pID0+IHZvaWQpOiBTdWJzY3JpYmVyIHtcbiAgICByZXR1cm4gdGhpcy5xbWFuYWdlci5vbihldmVudCwgY2IpO1xuICB9XG59XG4iXX0= |
@@ -0,2 +1,9 @@ | ||
export * from './utils/async-socket'; | ||
export * from './utils/smart-cursor'; | ||
export * from './utils/index'; | ||
export { BusListener } from './bus-listener'; | ||
export * from './interfaces'; | ||
export * from './serializer'; | ||
export * from './deserializer'; | ||
export * from './constants'; | ||
export * from './query-manager'; | ||
export * from './bus-listener'; |
@@ -5,5 +5,10 @@ "use strict"; | ||
} | ||
__export(require("./utils/async-socket")); | ||
__export(require("./utils/smart-cursor")); | ||
__export(require("./utils/index")); | ||
var bus_listener_1 = require("./bus-listener"); | ||
exports.BusListener = bus_listener_1.BusListener; | ||
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiaW5kZXguanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi9zcmMvaW5kZXgudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6Ijs7OztBQUFBLG1DQUE4QjtBQUM5QiwrQ0FBNkM7QUFBcEMscUNBQUEsV0FBVyxDQUFBIiwic291cmNlc0NvbnRlbnQiOlsiZXhwb3J0ICogZnJvbSAnLi91dGlscy9pbmRleCc7XG5leHBvcnQgeyBCdXNMaXN0ZW5lciB9IGZyb20gJy4vYnVzLWxpc3RlbmVyJztcbiJdfQ== | ||
__export(require("./serializer")); | ||
__export(require("./deserializer")); | ||
__export(require("./constants")); | ||
__export(require("./query-manager")); | ||
__export(require("./bus-listener")); | ||
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiaW5kZXguanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi9zcmMvaW5kZXgudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6Ijs7OztBQUFBLDBDQUFxQztBQUNyQywwQ0FBcUM7QUFDckMsbUNBQThCO0FBRTlCLGtDQUE2QjtBQUM3QixvQ0FBK0I7QUFDL0IsaUNBQTRCO0FBQzVCLHFDQUFnQztBQUNoQyxvQ0FBK0IiLCJzb3VyY2VzQ29udGVudCI6WyJleHBvcnQgKiBmcm9tICcuL3V0aWxzL2FzeW5jLXNvY2tldCc7XG5leHBvcnQgKiBmcm9tICcuL3V0aWxzL3NtYXJ0LWN1cnNvcic7XG5leHBvcnQgKiBmcm9tICcuL3V0aWxzL2luZGV4JztcbmV4cG9ydCAqIGZyb20gJy4vaW50ZXJmYWNlcyc7XG5leHBvcnQgKiBmcm9tICcuL3NlcmlhbGl6ZXInO1xuZXhwb3J0ICogZnJvbSAnLi9kZXNlcmlhbGl6ZXInO1xuZXhwb3J0ICogZnJvbSAnLi9jb25zdGFudHMnO1xuZXhwb3J0ICogZnJvbSAnLi9xdWVyeS1tYW5hZ2VyJztcbmV4cG9ydCAqIGZyb20gJy4vYnVzLWxpc3RlbmVyJztcbiJdfQ== |
@@ -5,5 +5,5 @@ /// <reference types="node" /> | ||
export declare class QueryManager extends AsyncSocket { | ||
constructor(); | ||
connect(port?: number): Promise<RemoteInfo>; | ||
request<T>(host: string, port: number, data: Buffer, select: (res: T, sender?: RemoteInfo) => boolean, timeout?: number): Promise<T>; | ||
private process(raw, remote); | ||
} |
@@ -8,5 +8,8 @@ "use strict"; | ||
class QueryManager extends async_socket_1.AsyncSocket { | ||
constructor() { | ||
super(); | ||
super.on('raw', this.process.bind(this)); | ||
connect(port = 0) { | ||
const ref = super.on('raw', this.process.bind(this)); | ||
return super.connect(port).catch((err) => { | ||
ref.unsubscribe(); | ||
throw err; | ||
}); | ||
} | ||
@@ -27,3 +30,5 @@ request(host, port, data, select, timeout) { | ||
ref.unsubscribe(); | ||
reject(tslib_1.__assign({}, new Error(`Request timeout`), { code: 'ETIMEOUT' })); | ||
const err = new Error(`Request timeout`); | ||
err.code = 'ETIMEOUT'; | ||
reject(err); | ||
}, timeout > 200 ? timeout : 200).unref(); | ||
@@ -74,2 +79,2 @@ return super.send(host, port, data).catch((err) => { | ||
exports.QueryManager = QueryManager; | ||
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoicXVlcnktbWFuYWdlci5qcyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbIi4uL3NyYy9xdWVyeS1tYW5hZ2VyLnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiI7O0FBR0EsdURBRThCO0FBQzlCLHVEQUU4QjtBQUM5QixpREFPd0I7QUFDeEIsNkNBRXNCO0FBU3RCLGtCQUEwQixTQUFRLDBCQUFXO0lBQzNDO1FBQ0UsS0FBSyxFQUFFLENBQUM7UUFFUixLQUFLLENBQUMsRUFBRSxDQUFDLEtBQUssRUFBRSxJQUFJLENBQU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sIHsgLi4uY2hhbm5lbCB9LCByZW1vdGUpO1xuICAgICAgICB9XG4gICAgICAgIGRlZmF1bHQ6IHRocm93IG5ldyBFcnJvcihgRmFpbGVkIHRvIHByb2Nlc3MgJHtoZWFkZXIuc2VydmljZUlkfWApO1xuICAgICAgfVxuICAgIH0gY2F0Y2ggKGVycikge1xuICAgICAgcmV0dXJuIHRoaXMuZXZlbnRzLmVtaXQoJ3VucHJvY2Vzc2VkJywgZXJyLCByYXcsIHJlbW90ZSk7XG4gICAgfVxuICB9XG59XG4iXX0= |
/// <reference types="node" /> | ||
import { AddressInfo } from 'dgram'; | ||
import { RemoteInfo } from 'dgram'; | ||
import { EventEmitter } from 'events'; | ||
@@ -9,8 +9,9 @@ import { Subscriber } from '../interfaces'; | ||
isConnected(): boolean; | ||
connect(port?: number): Promise<AddressInfo>; | ||
connect(port?: number): Promise<RemoteInfo>; | ||
complete<T>(cb?: () => T): Promise<T>; | ||
disconnect<T>(cb?: () => T): Promise<T>; | ||
send(host: string, port: number, data: any): Promise<void>; | ||
on(event: 'raw', cb: (raw: Buffer, sender: AddressInfo) => void): Subscriber; | ||
on<T>(event: string, cb: (query: T, sender: AddressInfo) => void): Subscriber; | ||
on(event: 'disconnect', cb: () => void): Subscriber; | ||
on(event: 'raw', cb: (raw: Buffer, sender: RemoteInfo) => void): Subscriber; | ||
on<T>(event: string, cb: (query: T, sender: RemoteInfo) => void): Subscriber; | ||
} |
@@ -23,2 +23,3 @@ "use strict"; | ||
this.socket = undefined; | ||
this.events.emit('disconnect'); | ||
this.events.removeAllListeners(); | ||
@@ -91,2 +92,2 @@ }) | ||
exports.AsyncSocket = AsyncSocket; | ||
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiYXN5bmMtc29ja2V0LmpzIiwic291cmNlUm9vdCI6IiIsInNvdXJjZXMiOlsiLi4vLi4vc3JjL3V0aWxzL2FzeW5jLXNvY2tldC50cyJdLCJuYW1lcyI6W10sIm1hc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2NrZXQuc2VuZChkYXRhLCBwb3J0LCBob3N0LCAoZXJyLCBieXRlcykgPT4ge1xuICAgICAgICAgIGlmIChlcnIpIHtcbiAgICAgICAgICAgIHJlamVjdChlcnIpO1xuICAgICAgICAgIH1cbiAgICAgICAgICBpZiAoYnl0ZXMgIT09IGRhdGEubGVuZ3RoKSB7XG4gICAgICAgICAgICByZWplY3QobmV3IEVycm9yKGBFeHBlY3RlZCB0byBzZW5kICR7ZGF0YS5sZW5ndGh9IGJ5dGVzLCBidXQgc2VudCAke2J5dGVzfWApKTtcbiAgICAgICAgICB9XG4gICAgICAgICAgcmVzb2x2ZSgpO1xuICAgICAgICB9KTtcbiAgICAgIH0gZWxzZSB7XG4gICAgICAgIHRocm93IG5ldyBFcnJvcihgTm8gY29ubmVjdGlvbmApO1xuICAgICAgfVxuICAgIH0pO1xuICB9XG4gIG9uKGV2ZW50OiAncmF3JywgY2I6IChyYXc6IEJ1ZmZlciwgc2VuZGVyOiBBZGRyZXNzSW5mbykgPT4gdm9pZCk6IFN1YnNjcmliZXI7XG4gIG9uPFQ+KGV2ZW50OiBzdHJpbmcsIGNiOiAocXVlcnk6IFQsIHNlbmRlcjogQWRkcmVzc0luZm8pID0+IHZvaWQpOiBTdWJzY3JpYmVyO1xuICBvbihldmVudDogc3RyaW5nLCBjYjogKC4uLmFyZ3M6IGFueVtdKSA9PiB2b2lkKTogU3Vic2NyaWJlciB7XG4gICAgaWYgKHRoaXMuZXZlbnRzLm9uKGV2ZW50LCBjYikpIHtcbiAgICAgIHJldHVybiB7XG4gICAgICAgIHVuc3Vic2NyaWJlOiAoKSA9PiB0aGlzLmV2ZW50cy5yZW1vdmVMaXN0ZW5lcihldmVudCwgY2IpLFxuICAgICAgfTtcbiAgICB9IGVsc2Uge1xuICAgICAgdGhyb3cgbmV3IEVycm9yKGBGYWlsZWQgdG8gc3Vic2NyaWJlYCk7XG4gICAgfVxuICB9XG59XG4iXX0= | ||
//# sourceMappingURL=data:application/json;base64,eyJ2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mVyO1xuICBvbihldmVudDogc3RyaW5nLCBjYjogKC4uLmFyZ3M6IGFueVtdKSA9PiB2b2lkKTogU3Vic2NyaWJlciB7XG4gICAgaWYgKHRoaXMuZXZlbnRzLm9uKGV2ZW50LCBjYikpIHtcbiAgICAgIHJldHVybiB7XG4gICAgICAgIHVuc3Vic2NyaWJlOiAoKSA9PiB0aGlzLmV2ZW50cy5yZW1vdmVMaXN0ZW5lcihldmVudCwgY2IpLFxuICAgICAgfTtcbiAgICB9IGVsc2Uge1xuICAgICAgdGhyb3cgbmV3IEVycm9yKGBGYWlsZWQgdG8gc3Vic2NyaWJlYCk7XG4gICAgfVxuICB9XG59XG4iXX0= |
{ | ||
"name": "knx-listener", | ||
"license": "MIT", | ||
"version": "0.0.3", | ||
"version": "0.0.4", | ||
"main": "./dist/index.js", | ||
@@ -6,0 +6,0 @@ "types": "./dist/index.d.ts", |
@@ -26,3 +26,3 @@ # KNX Listener | ||
### Write value `1` to `0/0/1` through `192.168.0.100` | ||
### Write value **1** to **0/0/1** through **192.168.0.100** | ||
``` | ||
@@ -43,3 +43,3 @@ Usage bin/groupswrite.js -s <ip address> -g <group address> -d <XX:XX:..> | ||
### Read value from `0/0/1` through `192.168.0.100` | ||
### Read value from **0/0/1** through **192.168.0.100** | ||
``` | ||
@@ -70,4 +70,3 @@ Usage bin/groupsread.js -s <ip address> -g <group address> | ||
() => process.exit(), | ||
() => process.exit(), | ||
); | ||
() => process.exit()); | ||
}; | ||
@@ -104,12 +103,12 @@ | ||
## TODO | ||
* Generate `JSDoc` | ||
* Generate JSDoc | ||
* Integration testing | ||
* Create another npm module for data types decoding | ||
* Create `REST API` with `express` | ||
* Create stream using websockets to broadcast telegrams to rich web apps | ||
* Create `ETS` project parser to get | ||
* Create another npm module for data types encoding/decoding | ||
## What is next? | ||
* You may record telegrams to a database and `return last values` on demand | ||
* You may build visualization with any `KNX gateway` | ||
* You may delagate decoding of data to your `thick` clients (rich & mobile apps) | ||
* You may create stream using websockets to broadcast telegrams to rich web apps | ||
* You may create ETS project parser to get group address and store them in db | ||
* You may create REST API with express | ||
* You may record telegrams to a database and return last values on demand | ||
* You may build visualization with any KNX gateway | ||
* You may delegate decoding of data to your rich clients |
@@ -112,2 +112,7 @@ import { | ||
}, 0); | ||
const ref = this.qmanager.on('disconnect', () => { | ||
// when disconnect scheduled | ||
clearInterval(interval); | ||
ref.unsubscribe(); | ||
}); | ||
interval.unref(); // let node exit | ||
@@ -114,0 +119,0 @@ } |
@@ -0,2 +1,9 @@ | ||
export * from './utils/async-socket'; | ||
export * from './utils/smart-cursor'; | ||
export * from './utils/index'; | ||
export { BusListener } from './bus-listener'; | ||
export * from './interfaces'; | ||
export * from './serializer'; | ||
export * from './deserializer'; | ||
export * from './constants'; | ||
export * from './query-manager'; | ||
export * from './bus-listener'; |
@@ -30,6 +30,10 @@ import { | ||
export class QueryManager extends AsyncSocket { | ||
constructor() { | ||
super(); | ||
connect(port: number = 0 /* OS assigned port */): Promise<RemoteInfo> { | ||
// forward raw data for processing | ||
super.on('raw', this.process.bind(this)); | ||
const ref = super.on('raw', this.process.bind(this)); | ||
return super.connect(port).catch((err) => { | ||
ref.unsubscribe(); | ||
// propagate error to the caller | ||
throw err; | ||
}); | ||
} | ||
@@ -58,3 +62,5 @@ /** | ||
ref.unsubscribe(); // avoid memory leak | ||
reject({ ...new Error(`Request timeout`), code: 'ETIMEOUT' }); | ||
const err: NodeJS.ErrnoException = new Error(`Request timeout`); | ||
err.code = 'ETIMEOUT'; | ||
reject(err); | ||
}, timeout > 200 ? timeout : 200).unref(); // unref timeout to let node exit | ||
@@ -61,0 +67,0 @@ // make request and propagate errors |
import { | ||
createSocket, | ||
Socket, | ||
AddressInfo, | ||
RemoteInfo, | ||
} from 'dgram'; | ||
@@ -23,3 +23,3 @@ import { | ||
connect(port: number = 0 /* OS assigned port */) { | ||
return new Promise<AddressInfo>((resolve, reject) => { | ||
return new Promise<RemoteInfo>((resolve, reject) => { | ||
if (this.isConnected()) { | ||
@@ -34,3 +34,5 @@ resolve(this.socket.address()); | ||
this.socket = undefined; | ||
// remove all used listeners | ||
// emit disconnect event | ||
this.events.emit('disconnect'); | ||
// and remove all listeners to prevent any memory leak | ||
this.events.removeAllListeners(); | ||
@@ -88,4 +90,5 @@ }) | ||
} | ||
on(event: 'raw', cb: (raw: Buffer, sender: AddressInfo) => void): Subscriber; | ||
on<T>(event: string, cb: (query: T, sender: AddressInfo) => void): Subscriber; | ||
on(event: 'disconnect', cb: () => void): Subscriber; | ||
on(event: 'raw', cb: (raw: Buffer, sender: RemoteInfo) => void): Subscriber; | ||
on<T>(event: string, cb: (query: T, sender: RemoteInfo) => void): Subscriber; | ||
on(event: string, cb: (...args: any[]) => void): Subscriber { | ||
@@ -92,0 +95,0 @@ if (this.events.on(event, cb)) { |
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
190969
2819
111