grenton-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 (107) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +86 -0
  3. package/dist/analog-din/fv02_01/analog-in.ts +271 -0
  4. package/dist/clu/calendar/v1/calendar.ts +308 -0
  5. package/dist/clu/clu-zwave-2/fv515_03/clu-zwave-2.ts +1302 -0
  6. package/dist/clu/event-scheduler/v1/event-scheduler.ts +537 -0
  7. package/dist/clu/multi-fan-ac-thermostat/v1/multi-fan-ac-thermostat.ts +1163 -0
  8. package/dist/clu/pid-controller/v1/pid-controller.ts +536 -0
  9. package/dist/clu/presence-sensor/v1/presence-sensor.ts +313 -0
  10. package/dist/clu/presence-sensor/v2/presence-sensor.ts +470 -0
  11. package/dist/clu/push/v1/push.ts +261 -0
  12. package/dist/clu/scheduler/v1/scheduler.ts +304 -0
  13. package/dist/clu/statistics/v1/statistics.ts +413 -0
  14. package/dist/clu/statistics-pulse/v1/statistics-pulse.ts +218 -0
  15. package/dist/clu/sunrise-sunset-calendar/v1/sunrise-sunset-calendar.ts +389 -0
  16. package/dist/clu/sunrise-sunset-calendar/v2/sunrise-sunset-calendar.ts +659 -0
  17. package/dist/clu/sunrise-sunset-calendar/v3/sunrise-sunset-calendar.ts +659 -0
  18. package/dist/clu/thermostat/v1/thermostat.ts +768 -0
  19. package/dist/clu/thermostat/v2/thermostat.ts +861 -0
  20. package/dist/clu/timer/v1/timer.ts +369 -0
  21. package/dist/core/execution-builder.ts +55 -0
  22. package/dist/core/remote-gate.ts +17 -0
  23. package/dist/digital-in-din/fv02_01/din.ts +310 -0
  24. package/dist/examples/light_turned_on_by_calendar/Clu_OnInit.ts +26 -0
  25. package/dist/examples/light_turned_on_by_presence_sensor/Clu_OnInit.ts +35 -0
  26. package/dist/examples/light_turned_on_by_switch/Clu_OnInit.ts +16 -0
  27. package/dist/gate/cool-master/v1/cool-master.ts +782 -0
  28. package/dist/gate/cool-master-net/v1/cool-master-net.ts +334 -0
  29. package/dist/gate/denon-marantz-avr/v1/denon-marantz-avr.ts +724 -0
  30. package/dist/gate/heos/v1/heos.ts +1224 -0
  31. package/dist/gate/http/fv1000_03/clu-gate-http.ts +405 -0
  32. package/dist/gate/http/fv1000_03_hv1/clu-gate-http.ts +352 -0
  33. package/dist/gate/http/fv1100_03/clu-gate-http.ts +589 -0
  34. package/dist/gate/http/fv1110_03/clu-gate-http.ts +589 -0
  35. package/dist/gate/http/fv1300_03/clu-gate-http.ts +589 -0
  36. package/dist/gate/http/fv1400_03/clu-gate-http.ts +677 -0
  37. package/dist/gate/http-listener/v1/http-listener.ts +299 -0
  38. package/dist/gate/http-listener/v2/http-listener.ts +325 -0
  39. package/dist/gate/http-request/v1/http-request.ts +645 -0
  40. package/dist/gate/http-request/v2/http-request.ts +709 -0
  41. package/dist/gate/input/v1/input.ts +171 -0
  42. package/dist/gate/jablotron/v1/jablotron.ts +100 -0
  43. package/dist/gate/jablotron-device/v1/jablotron-device.ts +171 -0
  44. package/dist/gate/jablotron-output/v1/jablotron-output.ts +240 -0
  45. package/dist/gate/jablotron-section/v1/jablotron-section.ts +260 -0
  46. package/dist/gate/modbus/v1/modbus.ts +609 -0
  47. package/dist/gate/modbus/v2/modbus.ts +690 -0
  48. package/dist/gate/modbus-client/v1/modbus-client.ts +827 -0
  49. package/dist/gate/modbus-rtu/v1/modbus-rtu.ts +911 -0
  50. package/dist/gate/modbus-server/v1/modbus-server.ts +405 -0
  51. package/dist/gate/modbus-slave-config-rtu/v1/modbus-slave-config-rtu.ts +160 -0
  52. package/dist/gate/modbus-slave-rtu/v1/modbus-slave-rtu.ts +371 -0
  53. package/dist/gate/modbus-value/v1/modbus-value.ts +856 -0
  54. package/dist/gate/music-cast/v1/music-cast.ts +1298 -0
  55. package/dist/gate/output/v1/output.ts +240 -0
  56. package/dist/gate/satel/v1/satel.ts +359 -0
  57. package/dist/gate/satel-input/v1/satel-input.ts +171 -0
  58. package/dist/gate/satel-output/v1/satel-output.ts +240 -0
  59. package/dist/gate/satel-zone/v1/satel-zone.ts +235 -0
  60. package/dist/gate/sonos/v1/sonos.ts +934 -0
  61. package/dist/gate/timer/v2/timer.ts +253 -0
  62. package/dist/gate/zone/v1/zone.ts +235 -0
  63. package/dist/io-module-din-8/fv02_02/din.ts +354 -0
  64. package/dist/io-module-din-8/fv02_02/dout.ts +360 -0
  65. package/dist/one-wire/fv01_10/onew-sensor.ts +269 -0
  66. package/dist/one-wire/fv01_28/onew-sensor.ts +269 -0
  67. package/dist/one-wire/fv02_28/onew-sensor.ts +350 -0
  68. package/dist/one-wire/fv03_28/onew-sensor.ts +435 -0
  69. package/dist/relay-din-2/fv02_02/dout.ts +544 -0
  70. package/dist/relay-din-4/fv01_02/dout.ts +340 -0
  71. package/dist/relay-din-4/fv02_02/dout.ts +368 -0
  72. package/dist/roller-shutter-din-3/fv03_02/roller-shutter.ts +1078 -0
  73. package/dist/smart-panel-fm-4/fv03_03/panel-button.ts +550 -0
  74. package/dist/smart-panel-fm-4/fv03_03/panel-sens-light.ts +238 -0
  75. package/dist/smart-panel-fm-4/fv03_03/panel-sens-temp.ts +239 -0
  76. package/dist/smart-panel-fm-4/fv03_03/panel.ts +700 -0
  77. package/dist/smart-panel-fm-4/fv04_03/panel-button.ts +567 -0
  78. package/dist/smart-panel-fm-4/fv04_03/panel-page.ts +516 -0
  79. package/dist/smart-panel-fm-4/fv04_03/panel-sens-light.ts +238 -0
  80. package/dist/smart-panel-fm-4/fv04_03/panel-sens-temp.ts +239 -0
  81. package/dist/smart-panel-fm-4/fv04_03/panel.ts +1026 -0
  82. package/dist/smart-panel-fm-4/fv05_03/panel-button.ts +567 -0
  83. package/dist/smart-panel-fm-4/fv05_03/panel-page.ts +620 -0
  84. package/dist/smart-panel-fm-4/fv05_03/panel-sens-light.ts +238 -0
  85. package/dist/smart-panel-fm-4/fv05_03/panel-sens-temp.ts +266 -0
  86. package/dist/smart-panel-fm-4/fv05_03/panel.ts +1109 -0
  87. package/dist/smart-panel-fm-4/fv06_03/panel-button.ts +567 -0
  88. package/dist/smart-panel-fm-4/fv06_03/panel-page.ts +877 -0
  89. package/dist/smart-panel-fm-4/fv06_03/panel-sens-light.ts +238 -0
  90. package/dist/smart-panel-fm-4/fv06_03/panel-sens-temp.ts +297 -0
  91. package/dist/smart-panel-fm-4/fv06_03/panel.ts +1138 -0
  92. package/dist/smart-panel-fm-4/fv07_03/panel-button.ts +567 -0
  93. package/dist/smart-panel-fm-4/fv07_03/panel-page.ts +864 -0
  94. package/dist/smart-panel-fm-4/fv07_03/panel-sens-light.ts +238 -0
  95. package/dist/smart-panel-fm-4/fv07_03/panel-sens-temp.ts +297 -0
  96. package/dist/smart-panel-fm-4/fv07_03/panel.ts +1135 -0
  97. package/dist/touch-panel-fm-4/fv01_02/panel-button.ts +418 -0
  98. package/dist/touch-panel-fm-4/fv01_02/panel-sens-light.ts +238 -0
  99. package/dist/touch-panel-fm-4/fv01_02/panel-sens-temp.ts +257 -0
  100. package/dist/touch-panel-fm-4/fv01_02/panel.ts +75 -0
  101. package/dist/touch-panel-fm-4/fv01_02/power-supply-voltage.ts +322 -0
  102. package/dist/touch-panel-fm-8/fv01_02/panel-button.ts +418 -0
  103. package/dist/touch-panel-fm-8/fv01_02/panel-sens-light.ts +238 -0
  104. package/dist/touch-panel-fm-8/fv01_02/panel-sens-temp.ts +270 -0
  105. package/dist/touch-panel-fm-8/fv01_02/panel.ts +75 -0
  106. package/dist/touch-panel-fm-8/fv01_02/power-supply-voltage.ts +322 -0
  107. package/package.json +16 -0
@@ -0,0 +1,537 @@
1
+ // Created from: packages/grenton-api/interfaces/object_event_scheduler_v1.xml, object name="EventScheduler" version="1"
2
+
3
+ import { rawExecutionBuilderFactory } from "../../../core/execution-builder"
4
+ import { RemoteGate } from "../../../core/remote-gate"
5
+
6
+ enum EventType {
7
+ OnStart = 0,
8
+ OnStop = 1,
9
+ OnEvent = 2,
10
+ OnRuleAdd = 3,
11
+ OnRuleDelete = 4
12
+ }
13
+
14
+ enum PropertyType {
15
+ RuleList = 0,
16
+ CurrentRule = 1,
17
+ NextRule = 2,
18
+ RuleCount = 3,
19
+ RuleAvailableCount = 4,
20
+ State = 5
21
+ }
22
+
23
+ enum MethodType {
24
+ Start = 0,
25
+ Stop = 1,
26
+ AddRule = 2,
27
+ DeleteRule = 3,
28
+ GetRule = 4,
29
+ EnableRule = 5,
30
+ DisableRule = 6,
31
+ GetRules = 7,
32
+ GetNextRule = 8
33
+ }
34
+
35
+ enum StateType {
36
+ Off = 0,
37
+ On = 1
38
+ }
39
+
40
+ declare class EventSchedulerRaw {
41
+ add_event(event: EventType, callback: () => void): void;
42
+ get(property: PropertyType): any;
43
+ set(property: PropertyType, value: any): void;
44
+ execute(method: MethodType, ...args: any[]): any;
45
+ }
46
+
47
+ interface IEventScheduler {
48
+ /**
49
+ * Zdarzenie wywoływane przy uruchomieniu Event Schedulera
50
+ * @param callback
51
+ */
52
+ addOnStart: (callback: () => void) => void
53
+ /**
54
+ * Zdarzenie wywoływane przy dezaktywacji Event Scheduler
55
+ * @param callback
56
+ */
57
+ addOnStop: (callback: () => void) => void
58
+ /**
59
+ * Zdarzenie docelowe wywołane na podstawie ustawionych reguł i aktualnym czasie urządzenia
60
+ * @param callback
61
+ */
62
+ addOnEvent: (callback: () => void) => void
63
+ /**
64
+ * Zdarzenie wywołane podczas dodania reguły do listy
65
+ * @param callback
66
+ */
67
+ addOnRuleAdd: (callback: () => void) => void
68
+ /**
69
+ * Zdarzenie wywołane podczas usunięcia reguły z listy
70
+ * @param callback
71
+ */
72
+ addOnRuleDelete: (callback: () => void) => void
73
+ /** Uruchamia Event Scheduler */
74
+ start: () => void
75
+ /** Zatrzymuje Event Scheduler */
76
+ stop: () => void
77
+ /**
78
+ * Dodaje regułę do listy. Podaj regułę crone "minute hour * * day_of_week". Zwraca numer id przydzielonej reguły. 0 - błąd
79
+ * @param {string} record
80
+ * @returns {string}
81
+ */
82
+ addRule: (record: string) => string
83
+ /**
84
+ * Usuwa regułę o podanym id z listy. Zwraca 0 - ok, 1 - błąd
85
+ * @param {number} id
86
+ * @returns {number}
87
+ */
88
+ deleteRule: (id: number) => number
89
+ /**
90
+ * Zwraca regułę w formacie {id, rule_state, "crone"} dla podanego id rule_state: 0(wyłączona), 1(włączona)
91
+ * @param {number} id
92
+ * @returns {string}
93
+ */
94
+ getRule: (id: number) => string
95
+ /**
96
+ * Zmienia stan reguły na aktywny. Zwraca 0 - ok, 1 - błąd
97
+ * @param {number} id
98
+ * @returns {number}
99
+ */
100
+ enableRule: (id: number) => number
101
+ /**
102
+ * Zmienia stan reguły na nieaktywny. Zwraca 0 - ok, 1 - błąd
103
+ * @param {number} id
104
+ * @returns {number}
105
+ */
106
+ disableRule: (id: number) => number
107
+ /**
108
+ * Lista wszystkich reguł w formacie {{id, rule_state, "crone"},{id, rule_state, "crone"},...} rule_state: 0(wyłączona), 1(włączona)
109
+ * @returns {string}
110
+ */
111
+ getRules: () => string
112
+ /**
113
+ * Reguła z listy dla następnego zdarzenia {id, rule_state, "crone"} rule_state: 0(wyłączona), 1(włączona)
114
+ * @returns {string}
115
+ */
116
+ getNextRule: () => string
117
+ /** Lista wszystkich reguł w formacie {{id, rule_state, "crone"},{id, rule_state, "crone"},...} rule_state: 0(wyłączona), 1(włączona) */
118
+ readonly ruleList: string
119
+ /** Reguła z listy, która odpowiada za aktualne zdarzenie {id, rule_state, "crone"} Zwraca uruchomioną regułę przez 1 minutę, następnie "N\A" rule_state: 0(wyłączona), 1(włączona) */
120
+ readonly currentRule: string
121
+ /** Reguła z listy dla następnego zdarzenia {id, rule_state, "crone"} rule_state: 0(wyłączona), 1(włączona) */
122
+ readonly nextRule: string
123
+ /** Liczba dodanych reguł */
124
+ readonly ruleCount: number
125
+ /** Liczba reguł które mogą być dodane do istniejącej listy (wolne miejsce) */
126
+ readonly ruleAvailableCount: number
127
+ /** Aktualny stan Event Schedulera */
128
+ state: StateType
129
+ }
130
+
131
+ class EventScheduler implements IEventScheduler {
132
+ private onStartCallbacks: Array<() => void> = [];
133
+ private onStopCallbacks: Array<() => void> = [];
134
+ private onEventCallbacks: Array<() => void> = [];
135
+ private onRuleAddCallbacks: Array<() => void> = [];
136
+ private onRuleDeleteCallbacks: Array<() => void> = [];
137
+
138
+ constructor(private raw: EventSchedulerRaw) {
139
+ this.raw.add_event(EventType.OnStart, () => {
140
+ this.onStartCallbacks.forEach(callback => { callback(); });
141
+ });
142
+ this.raw.add_event(EventType.OnStop, () => {
143
+ this.onStopCallbacks.forEach(callback => { callback(); });
144
+ });
145
+ this.raw.add_event(EventType.OnEvent, () => {
146
+ this.onEventCallbacks.forEach(callback => { callback(); });
147
+ });
148
+ this.raw.add_event(EventType.OnRuleAdd, () => {
149
+ this.onRuleAddCallbacks.forEach(callback => { callback(); });
150
+ });
151
+ this.raw.add_event(EventType.OnRuleDelete, () => {
152
+ this.onRuleDeleteCallbacks.forEach(callback => { callback(); });
153
+ });
154
+ }
155
+
156
+ /**
157
+ * Zdarzenie wywoływane przy uruchomieniu Event Schedulera
158
+ * @param callback
159
+ */
160
+ addOnStart(callback: () => void): void {
161
+ this.onStartCallbacks.push(callback);
162
+ }
163
+ /**
164
+ * Zdarzenie wywoływane przy dezaktywacji Event Scheduler
165
+ * @param callback
166
+ */
167
+ addOnStop(callback: () => void): void {
168
+ this.onStopCallbacks.push(callback);
169
+ }
170
+ /**
171
+ * Zdarzenie docelowe wywołane na podstawie ustawionych reguł i aktualnym czasie urządzenia
172
+ * @param callback
173
+ */
174
+ addOnEvent(callback: () => void): void {
175
+ this.onEventCallbacks.push(callback);
176
+ }
177
+ /**
178
+ * Zdarzenie wywołane podczas dodania reguły do listy
179
+ * @param callback
180
+ */
181
+ addOnRuleAdd(callback: () => void): void {
182
+ this.onRuleAddCallbacks.push(callback);
183
+ }
184
+ /**
185
+ * Zdarzenie wywołane podczas usunięcia reguły z listy
186
+ * @param callback
187
+ */
188
+ addOnRuleDelete(callback: () => void): void {
189
+ this.onRuleDeleteCallbacks.push(callback);
190
+ }
191
+ /** Uruchamia Event Scheduler */
192
+ start(): void {
193
+ this.raw.execute(MethodType.Start);
194
+ }
195
+ /** Zatrzymuje Event Scheduler */
196
+ stop(): void {
197
+ this.raw.execute(MethodType.Stop);
198
+ }
199
+ /**
200
+ * Dodaje regułę do listy. Podaj regułę crone "minute hour * * day_of_week". Zwraca numer id przydzielonej reguły. 0 - błąd
201
+ * @param {string} record
202
+ * @returns {string}
203
+ */
204
+ addRule(record: string): string {
205
+ return this.raw.execute(MethodType.AddRule, record);
206
+ }
207
+ /**
208
+ * Usuwa regułę o podanym id z listy. Zwraca 0 - ok, 1 - błąd
209
+ * @param {number} id
210
+ * @returns {number}
211
+ */
212
+ deleteRule(id: number): number {
213
+ return this.raw.execute(MethodType.DeleteRule, id);
214
+ }
215
+ /**
216
+ * Zwraca regułę w formacie {id, rule_state, "crone"} dla podanego id rule_state: 0(wyłączona), 1(włączona)
217
+ * @param {number} id
218
+ * @returns {string}
219
+ */
220
+ getRule(id: number): string {
221
+ return this.raw.execute(MethodType.GetRule, id);
222
+ }
223
+ /**
224
+ * Zmienia stan reguły na aktywny. Zwraca 0 - ok, 1 - błąd
225
+ * @param {number} id
226
+ * @returns {number}
227
+ */
228
+ enableRule(id: number): number {
229
+ return this.raw.execute(MethodType.EnableRule, id);
230
+ }
231
+ /**
232
+ * Zmienia stan reguły na nieaktywny. Zwraca 0 - ok, 1 - błąd
233
+ * @param {number} id
234
+ * @returns {number}
235
+ */
236
+ disableRule(id: number): number {
237
+ return this.raw.execute(MethodType.DisableRule, id);
238
+ }
239
+ /**
240
+ * Lista wszystkich reguł w formacie {{id, rule_state, "crone"},{id, rule_state, "crone"},...} rule_state: 0(wyłączona), 1(włączona)
241
+ * @returns {string}
242
+ */
243
+ getRules(): string {
244
+ return this.raw.execute(MethodType.GetRules);
245
+ }
246
+ /**
247
+ * Reguła z listy dla następnego zdarzenia {id, rule_state, "crone"} rule_state: 0(wyłączona), 1(włączona)
248
+ * @returns {string}
249
+ */
250
+ getNextRule(): string {
251
+ return this.raw.execute(MethodType.GetNextRule);
252
+ }
253
+ /**
254
+ * Lista wszystkich reguł w formacie {{id, rule_state, "crone"},{id, rule_state, "crone"},...} rule_state: 0(wyłączona), 1(włączona)
255
+ * @returns {string}
256
+ */
257
+ get ruleList(): string {
258
+ return this.raw.get(PropertyType.RuleList);
259
+ }
260
+ /**
261
+ * Reguła z listy, która odpowiada za aktualne zdarzenie {id, rule_state, "crone"} Zwraca uruchomioną regułę przez 1 minutę, następnie "N\A" rule_state: 0(wyłączona), 1(włączona)
262
+ * @returns {string}
263
+ */
264
+ get currentRule(): string {
265
+ return this.raw.get(PropertyType.CurrentRule);
266
+ }
267
+ /**
268
+ * Reguła z listy dla następnego zdarzenia {id, rule_state, "crone"} rule_state: 0(wyłączona), 1(włączona)
269
+ * @returns {string}
270
+ */
271
+ get nextRule(): string {
272
+ return this.raw.get(PropertyType.NextRule);
273
+ }
274
+ /**
275
+ * Liczba dodanych reguł
276
+ * @returns {number}
277
+ */
278
+ get ruleCount(): number {
279
+ return this.raw.get(PropertyType.RuleCount);
280
+ }
281
+ /**
282
+ * Liczba reguł które mogą być dodane do istniejącej listy (wolne miejsce)
283
+ * @returns {number}
284
+ */
285
+ get ruleAvailableCount(): number {
286
+ return this.raw.get(PropertyType.RuleAvailableCount);
287
+ }
288
+ /**
289
+ * Aktualny stan Event Schedulera
290
+ * @returns {StateType}
291
+ */
292
+ get state(): StateType {
293
+ return this.raw.get(PropertyType.State);
294
+ }
295
+ set state(value: StateType) {
296
+ this.raw.set(PropertyType.State, value);
297
+ }
298
+ }
299
+
300
+ class EventSchedulerRemote implements IEventScheduler {
301
+ constructor(private objectName: string, private gate: RemoteGate) {
302
+
303
+ }
304
+
305
+ /**
306
+ * Zdarzenie wywoływane przy uruchomieniu Event Schedulera
307
+ * @param callback
308
+ */
309
+ addOnStart(_callback: () => void): void {
310
+ // Remote events are not supported
311
+ }
312
+ /**
313
+ * Zdarzenie wywoływane przy dezaktywacji Event Scheduler
314
+ * @param callback
315
+ */
316
+ addOnStop(_callback: () => void): void {
317
+ // Remote events are not supported
318
+ }
319
+ /**
320
+ * Zdarzenie docelowe wywołane na podstawie ustawionych reguł i aktualnym czasie urządzenia
321
+ * @param callback
322
+ */
323
+ addOnEvent(_callback: () => void): void {
324
+ // Remote events are not supported
325
+ }
326
+ /**
327
+ * Zdarzenie wywołane podczas dodania reguły do listy
328
+ * @param callback
329
+ */
330
+ addOnRuleAdd(_callback: () => void): void {
331
+ // Remote events are not supported
332
+ }
333
+ /**
334
+ * Zdarzenie wywołane podczas usunięcia reguły z listy
335
+ * @param callback
336
+ */
337
+ addOnRuleDelete(_callback: () => void): void {
338
+ // Remote events are not supported
339
+ }
340
+
341
+ /** Uruchamia Event Scheduler */
342
+ start(): void {
343
+ const cmd: string | null = rawExecutionBuilderFactory(this.objectName)
344
+ .execute()
345
+ .addParameter(MethodType.Start)
346
+ .build();
347
+ this.gate.runScript(cmd!);
348
+ }
349
+
350
+ /** Zatrzymuje Event Scheduler */
351
+ stop(): void {
352
+ const cmd: string | null = rawExecutionBuilderFactory(this.objectName)
353
+ .execute()
354
+ .addParameter(MethodType.Stop)
355
+ .build();
356
+ this.gate.runScript(cmd!);
357
+ }
358
+
359
+ /**
360
+ * Dodaje regułę do listy. Podaj regułę crone "minute hour * * day_of_week". Zwraca numer id przydzielonej reguły. 0 - błąd
361
+ * @param {string} record
362
+ * @returns {string}
363
+ */
364
+ addRule(record: string): string {
365
+ const cmd: string | null = rawExecutionBuilderFactory(this.objectName)
366
+ .execute()
367
+ .addParameter(MethodType.AddRule)
368
+ .addParameter(record)
369
+ .build();
370
+ return this.gate.runScript(cmd!);
371
+ }
372
+
373
+ /**
374
+ * Usuwa regułę o podanym id z listy. Zwraca 0 - ok, 1 - błąd
375
+ * @param {number} id
376
+ * @returns {number}
377
+ */
378
+ deleteRule(id: number): number {
379
+ const cmd: string | null = rawExecutionBuilderFactory(this.objectName)
380
+ .execute()
381
+ .addParameter(MethodType.DeleteRule)
382
+ .addParameter(id)
383
+ .build();
384
+ return this.gate.runScript(cmd!);
385
+ }
386
+
387
+ /**
388
+ * Zwraca regułę w formacie {id, rule_state, "crone"} dla podanego id rule_state: 0(wyłączona), 1(włączona)
389
+ * @param {number} id
390
+ * @returns {string}
391
+ */
392
+ getRule(id: number): string {
393
+ const cmd: string | null = rawExecutionBuilderFactory(this.objectName)
394
+ .execute()
395
+ .addParameter(MethodType.GetRule)
396
+ .addParameter(id)
397
+ .build();
398
+ return this.gate.runScript(cmd!);
399
+ }
400
+
401
+ /**
402
+ * Zmienia stan reguły na aktywny. Zwraca 0 - ok, 1 - błąd
403
+ * @param {number} id
404
+ * @returns {number}
405
+ */
406
+ enableRule(id: number): number {
407
+ const cmd: string | null = rawExecutionBuilderFactory(this.objectName)
408
+ .execute()
409
+ .addParameter(MethodType.EnableRule)
410
+ .addParameter(id)
411
+ .build();
412
+ return this.gate.runScript(cmd!);
413
+ }
414
+
415
+ /**
416
+ * Zmienia stan reguły na nieaktywny. Zwraca 0 - ok, 1 - błąd
417
+ * @param {number} id
418
+ * @returns {number}
419
+ */
420
+ disableRule(id: number): number {
421
+ const cmd: string | null = rawExecutionBuilderFactory(this.objectName)
422
+ .execute()
423
+ .addParameter(MethodType.DisableRule)
424
+ .addParameter(id)
425
+ .build();
426
+ return this.gate.runScript(cmd!);
427
+ }
428
+
429
+ /**
430
+ * Lista wszystkich reguł w formacie {{id, rule_state, "crone"},{id, rule_state, "crone"},...} rule_state: 0(wyłączona), 1(włączona)
431
+ * @returns {string}
432
+ */
433
+ getRules(): string {
434
+ const cmd: string | null = rawExecutionBuilderFactory(this.objectName)
435
+ .execute()
436
+ .addParameter(MethodType.GetRules)
437
+ .build();
438
+ return this.gate.runScript(cmd!);
439
+ }
440
+
441
+ /**
442
+ * Reguła z listy dla następnego zdarzenia {id, rule_state, "crone"} rule_state: 0(wyłączona), 1(włączona)
443
+ * @returns {string}
444
+ */
445
+ getNextRule(): string {
446
+ const cmd: string | null = rawExecutionBuilderFactory(this.objectName)
447
+ .execute()
448
+ .addParameter(MethodType.GetNextRule)
449
+ .build();
450
+ return this.gate.runScript(cmd!);
451
+ }
452
+
453
+ /**
454
+ * Lista wszystkich reguł w formacie {{id, rule_state, "crone"},{id, rule_state, "crone"},...} rule_state: 0(wyłączona), 1(włączona)
455
+ * @returns {string}
456
+ */
457
+ get ruleList(): string {
458
+ const cmd: string | null = rawExecutionBuilderFactory(this.objectName)
459
+ .get()
460
+ .addParameter(PropertyType.RuleList)
461
+ .build();
462
+ return this.gate.runScript(cmd!);
463
+ }
464
+
465
+ /**
466
+ * Reguła z listy, która odpowiada za aktualne zdarzenie {id, rule_state, "crone"} Zwraca uruchomioną regułę przez 1 minutę, następnie "N\A" rule_state: 0(wyłączona), 1(włączona)
467
+ * @returns {string}
468
+ */
469
+ get currentRule(): string {
470
+ const cmd: string | null = rawExecutionBuilderFactory(this.objectName)
471
+ .get()
472
+ .addParameter(PropertyType.CurrentRule)
473
+ .build();
474
+ return this.gate.runScript(cmd!);
475
+ }
476
+
477
+ /**
478
+ * Reguła z listy dla następnego zdarzenia {id, rule_state, "crone"} rule_state: 0(wyłączona), 1(włączona)
479
+ * @returns {string}
480
+ */
481
+ get nextRule(): string {
482
+ const cmd: string | null = rawExecutionBuilderFactory(this.objectName)
483
+ .get()
484
+ .addParameter(PropertyType.NextRule)
485
+ .build();
486
+ return this.gate.runScript(cmd!);
487
+ }
488
+
489
+ /**
490
+ * Liczba dodanych reguł
491
+ * @returns {number}
492
+ */
493
+ get ruleCount(): number {
494
+ const cmd: string | null = rawExecutionBuilderFactory(this.objectName)
495
+ .get()
496
+ .addParameter(PropertyType.RuleCount)
497
+ .build();
498
+ return this.gate.runScript(cmd!);
499
+ }
500
+
501
+ /**
502
+ * Liczba reguł które mogą być dodane do istniejącej listy (wolne miejsce)
503
+ * @returns {number}
504
+ */
505
+ get ruleAvailableCount(): number {
506
+ const cmd: string | null = rawExecutionBuilderFactory(this.objectName)
507
+ .get()
508
+ .addParameter(PropertyType.RuleAvailableCount)
509
+ .build();
510
+ return this.gate.runScript(cmd!);
511
+ }
512
+
513
+ /**
514
+ * Aktualny stan Event Schedulera
515
+ * @returns {StateType}
516
+ */
517
+ get state(): StateType {
518
+ const cmd: string | null = rawExecutionBuilderFactory(this.objectName)
519
+ .get()
520
+ .addParameter(PropertyType.State)
521
+ .build();
522
+ return this.gate.runScript(cmd!);
523
+ }
524
+
525
+ set state(value: StateType) {
526
+ const cmd: string | null = rawExecutionBuilderFactory(this.objectName)
527
+ .set()
528
+ .addParameter(PropertyType.State)
529
+ .addParameter(value)
530
+ .build();
531
+ this.gate.runScript(cmd!);
532
+ }
533
+ }
534
+
535
+ export {
536
+ EventScheduler, EventSchedulerRaw, EventSchedulerRemote, StateType
537
+ }