knx.ts 1.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (99) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +211 -0
  3. package/dist/@types/interfaces/DPTs.d.ts +144 -0
  4. package/dist/@types/interfaces/DPTs.js +3 -0
  5. package/dist/@types/interfaces/EMI.d.ts +396 -0
  6. package/dist/@types/interfaces/EMI.js +2 -0
  7. package/dist/@types/interfaces/ServiceMessage.d.ts +11 -0
  8. package/dist/@types/interfaces/ServiceMessage.js +2 -0
  9. package/dist/@types/interfaces/SystemStatus.d.ts +18 -0
  10. package/dist/@types/interfaces/SystemStatus.js +2 -0
  11. package/dist/@types/interfaces/connection.d.ts +139 -0
  12. package/dist/@types/interfaces/connection.js +2 -0
  13. package/dist/@types/interfaces/localEndPoint.d.ts +5 -0
  14. package/dist/@types/interfaces/localEndPoint.js +2 -0
  15. package/dist/@types/types/AllDpts.d.ts +3 -0
  16. package/dist/@types/types/AllDpts.js +3 -0
  17. package/dist/@types/types/DecodedDPTType.d.ts +21 -0
  18. package/dist/@types/types/DecodedDPTType.js +2 -0
  19. package/dist/connection/KNXService.d.ts +58 -0
  20. package/dist/connection/KNXService.js +242 -0
  21. package/dist/connection/KNXTunneling.d.ts +44 -0
  22. package/dist/connection/KNXTunneling.js +509 -0
  23. package/dist/connection/KNXnetIPServer.d.ts +64 -0
  24. package/dist/connection/KNXnetIPServer.js +900 -0
  25. package/dist/connection/Router.d.ts +49 -0
  26. package/dist/connection/Router.js +269 -0
  27. package/dist/connection/TPUART.d.ts +32 -0
  28. package/dist/connection/TPUART.js +497 -0
  29. package/dist/connection/TunnelConnection.d.ts +57 -0
  30. package/dist/connection/TunnelConnection.js +167 -0
  31. package/dist/core/CEMI.d.ts +1130 -0
  32. package/dist/core/CEMI.js +1281 -0
  33. package/dist/core/ControlField.d.ts +57 -0
  34. package/dist/core/ControlField.js +120 -0
  35. package/dist/core/ControlFieldExtended.d.ts +56 -0
  36. package/dist/core/ControlFieldExtended.js +114 -0
  37. package/dist/core/EMI.d.ts +2515 -0
  38. package/dist/core/EMI.js +3898 -0
  39. package/dist/core/KNXAddInfoTypes.d.ts +225 -0
  40. package/dist/core/KNXAddInfoTypes.js +602 -0
  41. package/dist/core/KNXnetIPHeader.d.ts +10 -0
  42. package/dist/core/KNXnetIPHeader.js +38 -0
  43. package/dist/core/KNXnetIPStructures.d.ts +179 -0
  44. package/dist/core/KNXnetIPStructures.js +622 -0
  45. package/dist/core/MessageCodeField.d.ts +886 -0
  46. package/dist/core/MessageCodeField.js +399 -0
  47. package/dist/core/SystemStatus.d.ts +144 -0
  48. package/dist/core/SystemStatus.js +325 -0
  49. package/dist/core/data/KNXData.d.ts +7 -0
  50. package/dist/core/data/KNXData.js +30 -0
  51. package/dist/core/data/KNXDataDecode.d.ts +396 -0
  52. package/dist/core/data/KNXDataDecode.js +1186 -0
  53. package/dist/core/data/KNXDataEncode.d.ts +332 -0
  54. package/dist/core/data/KNXDataEncode.js +1504 -0
  55. package/dist/core/enum/APCIEnum.d.ts +587 -0
  56. package/dist/core/enum/APCIEnum.js +591 -0
  57. package/dist/core/enum/EnumControlField.d.ts +24 -0
  58. package/dist/core/enum/EnumControlField.js +36 -0
  59. package/dist/core/enum/EnumControlFieldExtended.d.ts +36 -0
  60. package/dist/core/enum/EnumControlFieldExtended.js +41 -0
  61. package/dist/core/enum/EnumShortACKFrame.d.ts +6 -0
  62. package/dist/core/enum/EnumShortACKFrame.js +10 -0
  63. package/dist/core/enum/ErrorCodeSet.d.ts +57 -0
  64. package/dist/core/enum/ErrorCodeSet.js +2 -0
  65. package/dist/core/enum/KNXnetIPEnum.d.ts +95 -0
  66. package/dist/core/enum/KNXnetIPEnum.js +90 -0
  67. package/dist/core/enum/SAP.d.ts +19 -0
  68. package/dist/core/enum/SAP.js +23 -0
  69. package/dist/core/layers/data/APDU.d.ts +38 -0
  70. package/dist/core/layers/data/APDU.js +115 -0
  71. package/dist/core/layers/data/NPDU.d.ts +73 -0
  72. package/dist/core/layers/data/NPDU.js +103 -0
  73. package/dist/core/layers/data/TPDU.d.ts +53 -0
  74. package/dist/core/layers/data/TPDU.js +73 -0
  75. package/dist/core/layers/interfaces/APCI.d.ts +61 -0
  76. package/dist/core/layers/interfaces/APCI.js +92 -0
  77. package/dist/core/layers/interfaces/TPCI.d.ts +110 -0
  78. package/dist/core/layers/interfaces/TPCI.js +196 -0
  79. package/dist/core/resources/DeviceDescriptorType.d.ts +46 -0
  80. package/dist/core/resources/DeviceDescriptorType.js +69 -0
  81. package/dist/errors/DPTNotFound.d.ts +6 -0
  82. package/dist/errors/DPTNotFound.js +15 -0
  83. package/dist/errors/InvalidKnxAddresExeption.d.ts +3 -0
  84. package/dist/errors/InvalidKnxAddresExeption.js +9 -0
  85. package/dist/index.d.ts +7 -0
  86. package/dist/index.js +18 -0
  87. package/dist/utils/CEMIAdapter.d.ts +16 -0
  88. package/dist/utils/CEMIAdapter.js +94 -0
  89. package/dist/utils/KNXHelper.d.ts +78 -0
  90. package/dist/utils/KNXHelper.js +338 -0
  91. package/dist/utils/Logger.d.ts +17 -0
  92. package/dist/utils/Logger.js +96 -0
  93. package/dist/utils/MessageCodeTranslator.d.ts +19 -0
  94. package/dist/utils/MessageCodeTranslator.js +77 -0
  95. package/dist/utils/checksumFrame.d.ts +18 -0
  96. package/dist/utils/checksumFrame.js +41 -0
  97. package/dist/utils/localIp.d.ts +7 -0
  98. package/dist/utils/localIp.js +45 -0
  99. package/package.json +49 -0
@@ -0,0 +1,396 @@
1
+ import { ControlField } from "../../core/ControlField";
2
+ import { Priority } from "../../core/enum/EnumControlField";
3
+ import { AddressType } from "../../core/enum/EnumControlFieldExtended";
4
+ import { SAP } from "../../core/enum/SAP";
5
+ import { APCI } from "../../core/layers/interfaces/APCI";
6
+ import { SystemStatus, Status } from "../../core/SystemStatus";
7
+ export type bits4 = 0 | 1 | 2 | 3 | 4 | 5 | 6 | 7;
8
+ export interface PEI_Switch_req {
9
+ systemStatus: SystemStatus;
10
+ LL: bits4;
11
+ NL: bits4;
12
+ TLG: bits4;
13
+ TLC: bits4;
14
+ TLL: bits4;
15
+ AL: bits4;
16
+ MAN: bits4;
17
+ PEI: bits4;
18
+ USR: bits4;
19
+ res: bits4;
20
+ }
21
+ export interface L_Busmon_ind {
22
+ status: Status;
23
+ timeStamp: number;
24
+ controlField1: ControlField;
25
+ /**
26
+ * Data Link Protocol Data Unit (LPDU) - This is the actual data payload of the message.
27
+ * It contains the information that is being monitored on the bus.
28
+ *
29
+ * For example, a telegram might contain a control field, a source address, a destination address, and the actual data being transmitted.
30
+ */
31
+ LPDU: Buffer;
32
+ }
33
+ /**
34
+ * It shall be possible to send up to 28 octets of plain data by this service.
35
+ *
36
+ * In “time” optionally a time delay before sending the message on the bus can be specified. If
37
+ * “time”=00000000h the frame shall be sent immediately. Otherwise the frame shall be sent if the free
38
+ * running system counter of the sending device equals the value given in “time”.
39
+ */
40
+ export interface L_Plain_Data_req {
41
+ time: number;
42
+ data: Buffer;
43
+ }
44
+ /**
45
+ * The NPDU shall correspond to the LPDU of an L_Data-Frame without the Control Field, Source
46
+ * Address, Destination Address, Address Type Flag and the octet count.
47
+ *
48
+ * As far as is understood, for example in octet 5 of the L_Data_Standard Frame of the TP1 medium the NPCI corresponds to the hop count which is 3 bits
49
+ */
50
+ export type NPCI = 0 | 1 | 2 | 3 | 4 | 6 | 7;
51
+ export interface L_Data_req {
52
+ control: {
53
+ priority: Priority;
54
+ ackRequest: boolean;
55
+ };
56
+ destinationAddress: string;
57
+ addressType: AddressType;
58
+ NPCI: NPCI;
59
+ NPDU: Buffer;
60
+ }
61
+ export interface L_Data_con {
62
+ control: {
63
+ priority: Priority;
64
+ /**
65
+ * This Confirm flag shall indicate whether this L_Data.con is a positive
66
+ * confirmation or a negative confirmation
67
+ *
68
+ * - false - This shall be a positive confirmation.
69
+ *
70
+ * - true - This shall be a negative confirmation.
71
+ */
72
+ confirm: boolean;
73
+ };
74
+ destinationAddress: string;
75
+ addressType: AddressType;
76
+ NPCI: NPCI;
77
+ NPDU: Buffer;
78
+ }
79
+ export interface L_Data_ind extends Omit<L_Data_req, "control"> {
80
+ sourceAddress: string;
81
+ control: {
82
+ priority: Priority;
83
+ };
84
+ }
85
+ export interface L_Poll_Data_Req {
86
+ pollingGroup: number;
87
+ nrOfSlots: bits4;
88
+ }
89
+ export interface L_Poll_Data_Con {
90
+ pollingGroup: number;
91
+ nrOfSlots: bits4;
92
+ control: {
93
+ confirm: boolean;
94
+ };
95
+ }
96
+ export interface L_SystemBroadcast_req {
97
+ destinationAddress: string;
98
+ addressType: 1 | 0;
99
+ NPCI: NPCI;
100
+ control: L_Data_con["control"] & {
101
+ /**
102
+ * This flag shall indicate whether a Data Link Layer acknowledge shall be requested when the frame is transmitted on KNX or whether this is don’t care.
103
+ * - false = Don't care
104
+ * - true = no L2-acknowledge requested
105
+ */
106
+ ackRequest: boolean;
107
+ };
108
+ NPDU: Buffer;
109
+ }
110
+ export interface L_SystemBroadcast_con extends Omit<L_Data_con, "control"> {
111
+ control: {
112
+ notRepeat: boolean;
113
+ priority: Priority;
114
+ /**
115
+ * This Confirm flag shall indicate whether this L_Data.con is a positive
116
+ * confirmation or a negative confirmation
117
+ *
118
+ * - false - This shall be a positive confirmation.
119
+ *
120
+ * - true - This shall be a negative confirmation.
121
+ */
122
+ confirm: boolean;
123
+ };
124
+ }
125
+ export interface L_SystemBroadcast_ind extends L_SystemBroadcast_con {
126
+ sourceAddress: string;
127
+ }
128
+ export interface N_Data_Individual_req_Ctor {
129
+ control: {
130
+ frameType: boolean;
131
+ repeat: boolean;
132
+ systemBroadcast: boolean;
133
+ priority: Priority;
134
+ ackRequest: boolean;
135
+ confirm: boolean;
136
+ };
137
+ destinationAddress: string;
138
+ TPDU: Buffer;
139
+ }
140
+ export interface N_Data_Individual_con_Ctor {
141
+ control: {
142
+ confirm: boolean;
143
+ };
144
+ destinationAddress: string;
145
+ TPDU: Buffer;
146
+ }
147
+ export interface N_Data_Individual_ind_Ctor {
148
+ control: {
149
+ priority: number;
150
+ };
151
+ sourceAddress: string;
152
+ destinationAddress: string;
153
+ hopCount: number;
154
+ TPDU: Buffer;
155
+ }
156
+ export interface N_Data_Group_req_Ctor {
157
+ control: {
158
+ priority: number;
159
+ };
160
+ destinationAddress: string;
161
+ APDU: Buffer;
162
+ }
163
+ export interface N_Data_Group_con_Ctor {
164
+ control: {
165
+ confirm: boolean;
166
+ };
167
+ destinationAddress: string;
168
+ APDU: Buffer;
169
+ }
170
+ export interface N_Data_Group_ind_Ctor {
171
+ control: {
172
+ priority: number;
173
+ };
174
+ sourceAddress: string;
175
+ destinationAddress: string;
176
+ hopCount: number;
177
+ APDU: Buffer;
178
+ }
179
+ export interface N_Data_Broadcast_req_Ctor {
180
+ control: {
181
+ priority: number;
182
+ };
183
+ hopCountType: NPCI;
184
+ TPDU: Buffer;
185
+ }
186
+ export interface N_Data_Broadcast_con_Ctor {
187
+ control: {
188
+ confirm: boolean;
189
+ };
190
+ TPDU: Buffer;
191
+ }
192
+ export interface N_Data_Broadcast_ind_Ctor {
193
+ control: {
194
+ priority: number;
195
+ };
196
+ sourceAddress: string;
197
+ hopCount: number;
198
+ TPDU: Buffer;
199
+ }
200
+ export interface N_Poll_Data_Req {
201
+ pollingGroup: string;
202
+ nrOfSlots: bits4;
203
+ }
204
+ export interface N_Poll_Data_Con {
205
+ pollingGroup: string;
206
+ nrOfSlots: bits4;
207
+ pollData: Buffer;
208
+ }
209
+ export interface T_Connect_req {
210
+ destinationAddress: string;
211
+ }
212
+ export interface T_Connect_ind {
213
+ sourceAddress: string;
214
+ control: Omit<InstanceType<typeof ControlField>, "describe" | "buffer">;
215
+ }
216
+ export interface T_Disconnect_con {
217
+ control: Omit<InstanceType<typeof ControlField>, "describe" | "buffer">;
218
+ }
219
+ export interface T_Data_Connected_req {
220
+ control: {
221
+ priority: InstanceType<typeof ControlField>["priority"];
222
+ };
223
+ hopCount: 0 | 1 | 2 | 3 | 4 | 5 | 6 | 7;
224
+ APDU: Buffer;
225
+ }
226
+ export interface T_Data_Connected_con {
227
+ control: {
228
+ confirm: boolean;
229
+ };
230
+ APDU: Buffer;
231
+ }
232
+ export interface T_Data_Connected_ind {
233
+ control: {
234
+ priority: number;
235
+ };
236
+ sourceAddress: string;
237
+ APDU: Buffer;
238
+ hopCount: 0 | 1 | 2 | 3 | 4 | 5 | 6 | 7;
239
+ }
240
+ export interface T_Data_Group_req {
241
+ control: {
242
+ priority: number;
243
+ };
244
+ APDU: Buffer;
245
+ hopCount: number;
246
+ }
247
+ export interface T_Data_Group_con {
248
+ control: {
249
+ confirm: boolean;
250
+ };
251
+ data: Buffer;
252
+ }
253
+ export interface T_Data_Group_ind {
254
+ control: {
255
+ priority: number;
256
+ };
257
+ APDU: Buffer;
258
+ }
259
+ export interface T_Data_Individual_req {
260
+ control: {
261
+ priority: number;
262
+ };
263
+ destinationAddress: string;
264
+ APDU: Buffer;
265
+ hopCount: number;
266
+ }
267
+ export interface T_Data_Individual_con {
268
+ control: {
269
+ confirm: boolean;
270
+ };
271
+ destinationAddress: string;
272
+ APDU: Buffer;
273
+ }
274
+ export interface T_Data_Individual_ind {
275
+ control: {
276
+ priority: number;
277
+ };
278
+ sourceAddress: string;
279
+ destinationAddress: string;
280
+ APDU: Buffer;
281
+ hopCount: 0 | 1 | 2 | 3 | 4 | 5 | 6 | 7;
282
+ }
283
+ export interface T_Data_Broadcast_req {
284
+ control: {
285
+ priority: number;
286
+ };
287
+ APDU: Buffer;
288
+ hopCount: number;
289
+ }
290
+ export interface T_Data_Broadcast_con {
291
+ control: {
292
+ confirm: boolean;
293
+ };
294
+ APDU: Buffer;
295
+ }
296
+ export interface T_Data_Broadcast_ind {
297
+ control: {
298
+ priority: number;
299
+ };
300
+ sourceAddress: string;
301
+ APDU: Buffer;
302
+ hopCount: 0 | 1 | 2 | 3 | 4 | 5 | 6 | 7;
303
+ }
304
+ export interface T_Poll_Data_req {
305
+ control: any;
306
+ pollingGroup: string;
307
+ numberOfSlots: 0 | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15;
308
+ }
309
+ export interface T_Poll_Data_con {
310
+ control: any;
311
+ sourceAddress: string;
312
+ pollingGroup: string;
313
+ pollData: Buffer;
314
+ nrOfSlots: 0 | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15;
315
+ }
316
+ export interface M_Connect_ind {
317
+ sourceAddress: string;
318
+ }
319
+ export interface M_User_Data_Connected_req {
320
+ control: {
321
+ priority: number;
322
+ };
323
+ APDU: Buffer;
324
+ hopCount: number;
325
+ }
326
+ export interface M_User_Data_Connected_con {
327
+ control: {
328
+ confirm: boolean;
329
+ };
330
+ APDU: Buffer;
331
+ }
332
+ export interface M_User_Data_Connected_ind {
333
+ control: {
334
+ priority: number;
335
+ };
336
+ sourceAddress: string;
337
+ APDU: Buffer;
338
+ }
339
+ export interface A_Data_Group_req {
340
+ control: {
341
+ priority: number;
342
+ };
343
+ sap: SAP;
344
+ apci: APCI;
345
+ data: Buffer;
346
+ hopCount: number;
347
+ }
348
+ export interface A_Data_Group_con {
349
+ control: {
350
+ confirm: boolean;
351
+ };
352
+ sap: SAP;
353
+ apci: APCI;
354
+ data: Buffer;
355
+ }
356
+ export interface A_Data_Group_ind {
357
+ control: {
358
+ priority: number;
359
+ };
360
+ sap: SAP;
361
+ apci: APCI;
362
+ data: Buffer;
363
+ }
364
+ export interface M_User_Data_Individual_req {
365
+ control: {
366
+ priority: number;
367
+ };
368
+ destinationAddress: string;
369
+ data: Buffer;
370
+ hopCount: number;
371
+ }
372
+ export interface M_User_Data_Individual_con {
373
+ control: {
374
+ confirm: boolean;
375
+ };
376
+ destinationAddress: string;
377
+ data: Buffer;
378
+ }
379
+ export interface M_User_Data_Individual_ind {
380
+ control: {
381
+ priority: number;
382
+ };
383
+ sourceAddress: string;
384
+ destinationAddress: string;
385
+ data: Buffer;
386
+ }
387
+ export interface A_Poll_Data_req {
388
+ pollingGroup: string;
389
+ numberOfSlots: number;
390
+ }
391
+ export interface A_Poll_Data_con {
392
+ sourceAddress: string;
393
+ pollingGroup: string;
394
+ numberOfSlots: number;
395
+ pollData: Buffer;
396
+ }
@@ -0,0 +1,2 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -0,0 +1,11 @@
1
+ export interface DescribeEstructure {
2
+ /**
3
+ * Proporciona una descripción legible del estado actual de las propiedades del sistema.
4
+ * @returns Un objeto que describe el estado de cada propiedad.
5
+ */
6
+ describe(): Record<string, string | number | Buffer | Record<string, any>>;
7
+ }
8
+ export interface ServiceMessage extends DescribeEstructure {
9
+ /** Write the service to the buffer */
10
+ toBuffer(): Buffer;
11
+ }
@@ -0,0 +1,2 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -0,0 +1,18 @@
1
+ export interface StatusValues {
2
+ frameError: boolean;
3
+ bitError: boolean;
4
+ parityError: boolean;
5
+ overflow: boolean;
6
+ lost: boolean;
7
+ sequenceNumber: 0 | 1 | 2 | 3 | 4 | 5 | 6 | 7;
8
+ }
9
+ export interface SystemStatusValues {
10
+ PROG?: false;
11
+ LLM?: boolean;
12
+ TLE?: boolean;
13
+ ALE?: boolean;
14
+ SE?: boolean;
15
+ UE?: boolean;
16
+ DM?: false;
17
+ PARITY?: boolean;
18
+ }
@@ -0,0 +1,2 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -0,0 +1,139 @@
1
+ import { LoggerOptions } from "pino";
2
+ import { ConnectionType } from "../../core/enum/KNXnetIPEnum";
3
+ /**
4
+ * Options for configuring a KNX Tunneling connection.
5
+ */
6
+ export interface KNXTunnelingOptions extends KNXnetIPOptions {
7
+ /**
8
+ * The transport protocol to use for the connection.
9
+ * 'UDP' is the default and standard for KNXnet/IP.
10
+ * 'TCP' is optional and used for connection-oriented communication.
11
+ */
12
+ transport?: "UDP" | "TCP";
13
+ /**
14
+ * The type of connection to establish.
15
+ * Defaults to TUNNEL_CONNECTION (0x04) for standard telegram exchange.
16
+ * Use DEVICE_MGMT_CONNECTION (0x03) for device configuration and management.
17
+ */
18
+ connectionType?: ConnectionType;
19
+ /**
20
+ * If true, sends a "Route Back" HPAI (IP 0.0.0.0 and port 0).
21
+ * This instructs the KNXnet/IP server to respond directly to the source IP and port
22
+ * from which the request originated. Essential for environments with NAT,
23
+ * firewalls, or VPNs like ZeroTier.
24
+ */
25
+ useRouteBack?: boolean;
26
+ /**
27
+ * Maximum number of messages allowed in the outgoing queue.
28
+ * Defaults to 100.
29
+ */
30
+ maxQueueSize?: number;
31
+ }
32
+ export interface KNXnetIPServerOptions extends KNXnetIPOptions {
33
+ individualAddress?: string;
34
+ serialNumber?: Buffer;
35
+ friendlyName?: string;
36
+ macAddress?: string;
37
+ /**
38
+ * Defines the client address pool for KNXnet/IP Tunneling connections (e.g. "15.15.10:10" or "1.1.1:5").
39
+ * Format: "START_ADDRESS:COUNT". This dictates how many tunneling clients can connect concurrently
40
+ * and which individual addresses they will receive. Defaults to 15 connections starting from Area.Line.1.
41
+ */
42
+ clientAddrs?: string;
43
+ /**
44
+ * The minimum delay between two consecutive ROUTING_INDICATION frames sent to the bus.
45
+ * Default is 20ms (standard for TP1 compatibility).
46
+ * Setting this to a lower value can increase performance but may flood slow KNX segments.
47
+ */
48
+ routingDelay?: number;
49
+ /**
50
+ * Optional configuration for bridging to external connections (TPUART, Tunneling).
51
+ */
52
+ externals?: ExternalManagerOptions;
53
+ /**
54
+ * It abruptly stops a Tunneling client connection if it exceeds this limit of request messages per second; this is done to prevent performance degradation (the default is 100); to disable it, set it to less than 1
55
+ */
56
+ MAX_PENDING_REQUESTS_PER_CLIENT?: number;
57
+ /**
58
+ * If true, the server will join the multicast group on all valid host network interfaces (Multi-homing).
59
+ * This improves discovery in multi-interface systems but can be disabled for specific network isolation.
60
+ * Defaults to true.
61
+ */
62
+ useAllInterfaces?: boolean;
63
+ }
64
+ export interface ExternalManagerOptions {
65
+ /**
66
+ * Optional configuration for a physical TPUART connection.
67
+ */
68
+ tpuart?: TPUARTOptions;
69
+ /**
70
+ * Optional list of outbound KNX IP Tunneling client connections.
71
+ */
72
+ tunneling?: KNXTunnelingOptions[];
73
+ /**
74
+ * Pino logger configuration for the Router bridge.
75
+ */
76
+ logOptions?: LoggerOptions;
77
+ }
78
+ export interface KNXLoggerOptions extends LoggerOptions {
79
+ /**
80
+ * Use pino-pretty but it's slow
81
+ */
82
+ pretty?: boolean;
83
+ /**
84
+ * Enable or disable logging. Defaults to true.
85
+ */
86
+ enabled?: boolean;
87
+ /**
88
+ * If true, logs will be written to a file using pino-roll.
89
+ */
90
+ logToFile?: boolean;
91
+ /**
92
+ * Directory where log files will be stored. Defaults to './logs'.
93
+ */
94
+ logDir?: string;
95
+ /**
96
+ * Filename for the log file. If not provided, it defaults to YYYY-MM-DD.log.
97
+ */
98
+ logFilename?: string;
99
+ /**
100
+ * Max size of a single log file before rotation (e.g., '10M', '1G').
101
+ */
102
+ logSize?: string;
103
+ /**
104
+ * Rotation interval (e.g., '1d', '1h').
105
+ */
106
+ logInterval?: string;
107
+ /**
108
+ * Number of rotated log files to keep.
109
+ */
110
+ logKeepCount?: number;
111
+ }
112
+ export interface KNXnetIPOptions {
113
+ ip?: string;
114
+ port?: number;
115
+ localIp?: string;
116
+ localPort?: number;
117
+ /**
118
+ * Pino logger configuration.
119
+ */
120
+ logOptions?: KNXLoggerOptions;
121
+ }
122
+ export interface TPUARTOptions extends KNXnetIPOptions {
123
+ /**
124
+ * The serial port path (e.g., "/dev/ttyS0" or "COM3").
125
+ */
126
+ path: string;
127
+ /**
128
+ * Optional physical address to assign to the TPUART chip (e.g., "1.1.255").
129
+ */
130
+ individualAddress?: string;
131
+ /**
132
+ * If true, the TPUART will send an ACK for all group telegrams.
133
+ */
134
+ ackGroup?: boolean;
135
+ /**
136
+ * If true, the TPUART will send an ACK for all individual telegrams.
137
+ */
138
+ ackIndividual?: boolean;
139
+ }
@@ -0,0 +1,2 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -0,0 +1,5 @@
1
+ export interface LocalEndPoint {
2
+ host: string;
3
+ port: number;
4
+ toBytes: () => Buffer<ArrayBuffer>;
5
+ }
@@ -0,0 +1,2 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -0,0 +1,3 @@
1
+ import { KnxDataEncoder } from "../../core/data/KNXDataEncode";
2
+ import { DPT1, DPT2, DPT3, DPT4, DPT5, DPT5001, DPT5002, DPT6, DPT6020, DPT7, DPT8, DPT9, DPT10001, DPT11001, DPT12001, DPT13001, DPT14, DPT15, DPT16, DPT16002, DPT20, DPT27001, DPT28001, DPT238600, DPT245600, DPT250600, DPT251600, DPT29 } from "../interfaces/DPTs";
3
+ export type AllDpts<Dpt extends (typeof KnxDataEncoder.dptEnum)[number] | string | null> = Dpt extends 1 | "1" | `1.${number}` ? DPT1 : Dpt extends 2 | "2" | `2.${number}` ? DPT2 : Dpt extends 3007 | "3.007" | 3008 | "3.008" ? DPT3 : Dpt extends 4001 | "4.001" | 4 | "4" | `4.${number}` ? DPT4 : Dpt extends 5001 | "5.001" ? DPT5001 : Dpt extends 5002 | "5.002" ? DPT5002 : Dpt extends 5 | "5" | `5.${number}` ? DPT5 : Dpt extends 6020 | "6.020" ? DPT6020 : Dpt extends 6 | "6" | 6010 | "6.010" | `6.${number}` ? DPT6 : Dpt extends 7 | "7" | `7.${number}` ? DPT7 : Dpt extends 8 | "8" | `8.${number}` ? DPT8 : Dpt extends 9 | "9" | `9.${number}` ? DPT9 : Dpt extends 10001 | "10.001" | 10 | "10" | `10.${number}` ? DPT10001 : Dpt extends 11001 | "11.001" | 11 | "11" | `11.${number}` ? DPT11001 : Dpt extends 12 | "12" | `12.${number}` ? DPT12001 : Dpt extends 13 | "13" | `13.${number}` ? DPT13001 : Dpt extends 14 | "14" | `14.${number}` ? DPT14 : Dpt extends 15 | "15" | `15.${number}` ? DPT15 : Dpt extends 16002 | "16.002" ? DPT16002 : Dpt extends 16 | "16" | `16.${number}` ? DPT16 : Dpt extends 20 | "20" | `20.${number}` ? DPT20 : Dpt extends 27001 | "27.001" | 27 | "27" | `27.${number}` ? DPT27001 : Dpt extends 28001 | "28.001" | 28 | "28" | `28.${number}` ? DPT28001 : Dpt extends 29 | "29" | `29.${number}` ? DPT29 : Dpt extends 238600 | "238.600" ? DPT238600 : Dpt extends 245600 | "245.600" ? DPT245600 : Dpt extends 250600 | "250.600" ? DPT250600 : Dpt extends 251600 | "251.600" ? DPT251600 : Buffer;
@@ -0,0 +1,3 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ // #endregion
@@ -0,0 +1,21 @@
1
+ import { KnxDataDecode } from "../../core/data/KNXDataDecode";
2
+ type decode = typeof KnxDataDecode;
3
+ export type DecodedDPT1 = ReturnType<decode["asDpt1"]>;
4
+ export type DecodedDPT2 = ReturnType<decode["asDpt2"]>;
5
+ export type DecodedDPT3007 = ReturnType<decode["asDpt3007"]>;
6
+ export type DecodedDPT3008 = ReturnType<decode["asDpt3008"]>;
7
+ export type DecodedDPT6020 = ReturnType<decode["asDpt6020"]>;
8
+ export type DecodedDPT7012 = ReturnType<decode["asDpt7012"]>;
9
+ export type DecodedDPT10001 = ReturnType<decode["asDpt10001"]>;
10
+ export type DecodedDPT11001 = ReturnType<decode["asDpt11001"]>;
11
+ export type DecodedDPTValueUnit = ReturnType<decode["asDpt12001"]> | ReturnType<decode["asDpt12002"]>;
12
+ export type DecodedDPT15000 = ReturnType<decode["asDpt15000"]>;
13
+ export type DecodedDPT16002 = ReturnType<decode["asDpt16002"]>;
14
+ export type DecodedDPT27001 = ReturnType<decode["asDpt27001"]>;
15
+ export type DecodedDPT232600 = ReturnType<decode["asDpt232600"]>;
16
+ export type DecodedDPT238600 = ReturnType<decode["asDpt238600"]>;
17
+ export type DecodedDPT245600 = ReturnType<decode["asDpt245600"]>;
18
+ export type DecodedDPT250600 = ReturnType<decode["asDpt250600"]>;
19
+ export type DecodedDPT251600 = ReturnType<decode["asDpt251600"]>;
20
+ export type DecodedDPTType<T extends number | string> = T extends 1 | "1" | `1.${number}` ? DecodedDPT1 : T extends 2 | "2" | `2.${number}` ? DecodedDPT2 : T extends 3007 | "3.007" ? DecodedDPT3007 : T extends 3008 | "3.008" ? DecodedDPT3008 : T extends 4001 | "4.001" | 4002 | "4.002" | 4 | "4" | `4.${number}` ? string : T extends 5001 | "5.001" | 5002 | "5.002" ? string : T extends 5 | "5" | `5.${number}` ? number : T extends 6001 | "6.001" | 6010 | "6.010" ? string : T extends 6020 | "6.020" ? DecodedDPT6020 : T extends 6 | "6" | `6.${number}` ? number : T extends 7001 | "7.001" | 7002 | "7.002" | 7003 | "7.003" | 7004 | "7.004" | 7005 | "7.005" | 7006 | "7.006" | 7007 | "7.007" | 7011 | "7.011" | 7013 | "7.013" ? string : T extends 7012 | "7.012" ? DecodedDPT7012 : T extends 7 | "7" | `7.${number}` ? number : T extends 8 | "8" | `8.${number}` ? number : T extends 9 | "9" | `9.${number}` ? number : T extends 10001 | "10.001" | 10 | "10" | `10.${number}` ? DecodedDPT10001 : T extends 11001 | "11.001" | 11 | "11" | `11.${number}` ? DecodedDPT11001 : T extends 12001 | "12.001" | 12002 | "12.002" | 12 | "12" | `12.${number}` ? DecodedDPTValueUnit : T extends 13001 | "13.001" | 13002 | "13.002" | 13010 | "13.010" | 13011 | "13.011" | 13012 | "13.012" | 13013 | "13.013" | 13014 | "13.014" | 13015 | "13.015" | 13016 | "13.016" | 13100 | "13.100" ? DecodedDPTValueUnit : T extends 13 | "13" | `13.${number}` ? number : T extends 14 | "14" | `14.${number}` ? number : T extends 15000 | "15.000" | 15 | "15" | `15.${number}` ? DecodedDPT15000 : T extends 16002 | "16.002" ? DecodedDPT16002 : T extends 16 | "16" | `16.${number}` ? string : T extends 20001 | "20.001" | 20002 | "20.002" | 20003 | "20.003" | 20004 | "20.004" | 20005 | "20.005" | 20006 | "20.006" | 20007 | "20.007" | 20008 | "20.008" | 20011 | "20.011" | 20012 | "20.012" | 20013 | "20.013" | 20014 | "20.014" | 20017 | "20.017" | 20020 | "20.020" | 20021 | "20.021" | 20022 | "20.022" ? string : T extends 20 | "20" | `20.${number}` ? number : T extends 27001 | "27.001" | 27 | "27" | `27.${number}` ? DecodedDPT27001 : T extends 28001 | "28.001" | 28 | "28" | `28.${number}` ? string : T extends 29010 | "29.010" | 29011 | "29.011" | 29012 | "29.012" | 29 | "29" | `29.${number}` ? number : T extends 232600 | "232.600" ? DecodedDPT232600 : T extends 238600 | "238.600" ? DecodedDPT238600 : T extends 245600 | "245.600" ? DecodedDPT245600 : T extends 250600 | "250.600" ? DecodedDPT250600 : T extends 251600 | "251.600" ? DecodedDPT251600 : any;
21
+ export {};
@@ -0,0 +1,2 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -0,0 +1,58 @@
1
+ import { EventEmitter } from "events";
2
+ import dgram from "dgram";
3
+ import net from "net";
4
+ import { SRP } from "../core/KNXnetIPStructures";
5
+ import { ServiceMessage } from "../@types/interfaces/ServiceMessage";
6
+ import { KnxDataEncoder } from "../core/data/KNXDataEncode";
7
+ import { AllDpts } from "../@types/types/AllDpts";
8
+ import { KNXnetIPOptions, KNXnetIPServerOptions, KNXTunnelingOptions, TPUARTOptions } from "../@types/interfaces/connection";
9
+ import { Logger } from "pino";
10
+ export declare abstract class KNXService extends EventEmitter {
11
+ protected socket: dgram.Socket | net.Socket | null;
12
+ readonly options: KNXnetIPOptions | KNXnetIPServerOptions | KNXTunnelingOptions | TPUARTOptions;
13
+ protected _transport: "UDP" | "TCP";
14
+ protected logger: Logger;
15
+ constructor(options?: KNXnetIPOptions | KNXnetIPServerOptions | KNXTunnelingOptions | TPUARTOptions);
16
+ abstract connect(): Promise<void>;
17
+ abstract disconnect(): void;
18
+ abstract send(data: Buffer | ServiceMessage): Promise<void>;
19
+ /**
20
+ * Optional: Enable or disable busmonitor mode.
21
+ */
22
+ setBusmonitor?(enabled: boolean): Promise<void>;
23
+ /**
24
+ * Optional: Overriden by links that support selective routing (knxd pattern).
25
+ * Return false to block a specific group address.
26
+ */
27
+ shouldFilterGroup?(groupAddress: string): boolean;
28
+ /**
29
+ * Optional: Overriden by links that support selective routing (knxd pattern).
30
+ * Return false to block a specific individual address.
31
+ */
32
+ shouldFilterIA?(individualAddress: string): boolean;
33
+ /**
34
+ * Send a GroupValue_Write telegram to a group address.
35
+ * @param destination The group address (e.g., "1/1/1")
36
+ * @param value The value to write.
37
+ * @param dpt Optional Datapoint Type to help with encoding.
38
+ */
39
+ write<T extends (typeof KnxDataEncoder.dptEnum)[number] | string | null>(destination: string, dpt: T, value: AllDpts<T>): Promise<void>;
40
+ /**
41
+ * Send a GroupValue_Read telegram to a group address.
42
+ * @param destination The group address (e.g., "1/1/1")
43
+ */
44
+ read(destination: string): Promise<void>;
45
+ /**
46
+ * Discovery Process (Search Request)
47
+ */
48
+ static discover(timeout?: number, localIp?: string): Promise<any[]>;
49
+ /**
50
+ * Extended Discovery Process (Search Request Extended)
51
+ * Allows searching with filters (SRPs).
52
+ */
53
+ static discoverExtended(srps: SRP[], timeout?: number, localIp?: string): Promise<any[]>;
54
+ /**
55
+ * Description Request (Self Description) * Queries a specific device for its capabilities.
56
+ */
57
+ describe(): Promise<any>;
58
+ }