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,700 @@
1
+ // Created from: packages/grenton-api/interfaces/module_SMART_PANEL_FM_4_fv03_03.xml, object name="PANEL" version="03.03"
2
+
3
+ import { rawExecutionBuilderFactory } from "../../core/execution-builder"
4
+ import { RemoteGate } from "../../core/remote-gate"
5
+
6
+ enum EventType {
7
+ OnGestureUp = 0,
8
+ OnGestureDown = 1,
9
+ OnGestureLeft = 2,
10
+ OnGestureRight = 3,
11
+ OnProximityDetect = 4,
12
+ }
13
+
14
+ enum PropertyType {
15
+ GestureIconUp = 4,
16
+ GestureIconDown = 5,
17
+ GestureIconLeft = 6,
18
+ GestureIconRight = 7,
19
+ ProximitySens = 10,
20
+ ProximityTimeout = 11,
21
+ ProximityValue = 12,
22
+ BuzzerValue = 13,
23
+ }
24
+
25
+ enum MethodType {
26
+ SwitchOnDisplay = 0,
27
+ ShowButtons = 1,
28
+ ClearScreen = 2,
29
+ PrintText = 3,
30
+ DrawLine = 4,
31
+ DrawPoint = 5,
32
+ DrawIcon = 6,
33
+ DisplayContent = 7,
34
+ PrintFloat = 20,
35
+ }
36
+
37
+ enum BuzzerValueType {
38
+ Off = 0,
39
+ On = 1,
40
+ }
41
+
42
+ declare class PanelRaw {
43
+ add_event(event: EventType, callback: () => void): void;
44
+ get(property: PropertyType): any;
45
+ set(property: PropertyType, value: any): void;
46
+ execute(method: number, ...args: any[]): any;
47
+ }
48
+
49
+ interface IPanel {
50
+ /**
51
+ * Zdarzenie wywoływane w przypadku wykonania gestu w górę
52
+ * @param callback
53
+ */
54
+ addOnGestureUp: (callback: () => void) => void
55
+ /**
56
+ * Zdarzenie wywoływane w przypadku wykonania gestu w dół
57
+ * @param callback
58
+ */
59
+ addOnGestureDown: (callback: () => void) => void
60
+ /**
61
+ * Zdarzenie wywoływane w przypadku wykonania gestu w lewo
62
+ * @param callback
63
+ */
64
+ addOnGestureLeft: (callback: () => void) => void
65
+ /**
66
+ * Zdarzenie wywoływane w przypadku wykonania gestu w prawo
67
+ * @param callback
68
+ */
69
+ addOnGestureRight: (callback: () => void) => void
70
+ /**
71
+ * Zdarzenie wywoływane w przypadku wykrycia zbliżającej się do wyświetlacza osoby
72
+ * @param callback
73
+ */
74
+ addOnProximityDetect: (callback: () => void) => void
75
+ /** Wybudza wyświetlacz z trybu uśpienia */
76
+ switchOnDisplay: () => void
77
+ /** Zmienia tryb wyświetlania na 'buttons'. Czyści wyświetlacz i wyświetla ponownie ikony (lub tekst) dla wszystkich przycisków */
78
+ showButtons: () => void
79
+ /** Czyści zawartość wyświetlacza w trybie 'freedraw' */
80
+ clearScreen: () => void
81
+ /**
82
+ * Wyświetla tekst w trybie 'freedraw'. x, y - współrzędne; txt - string; font size: 1=10p, 2=14p, 3=32p
83
+ * @param {number} x
84
+ * @param {number} y
85
+ * @param {string} txt
86
+ * @param {number} fontSize
87
+ */
88
+ printText: (x: number, y: number, txt: string, fontSize: number) => void
89
+ /**
90
+ * Wyświetla liczbę w trybie 'freedraw'. x, y - współrzędne; number - liczba; precision - ilość miejsc po przecinku; font size: 1=10p, 2=14p, 3=32p
91
+ * @param {number} x
92
+ * @param {number} y
93
+ * @param {number} number
94
+ * @param {number} precision
95
+ * @param {number} fontSize
96
+ */
97
+ printFloat: (x: number, y: number, number: number, precision: number, fontSize: number) => void
98
+ /**
99
+ * Rysuje linię w trybie 'freedraw'. x, y - współrzędne początkowe; xe, ye - współrzędne końcowe; color - 0 czarny, 1 biały
100
+ * @param {number} x
101
+ * @param {number} y
102
+ * @param {number} xe
103
+ * @param {number} ye
104
+ * @param {number} color
105
+ */
106
+ drawLine: (x: number, y: number, xe: number, ye: number, color: number) => void
107
+ /**
108
+ * Rysuje punkt w trybie 'freedraw'. x, y - współrzędne w pikselach; color - 0 czarny, 1 biały
109
+ * @param {number} x
110
+ * @param {number} y
111
+ * @param {number} color
112
+ */
113
+ drawPoint: (x: number, y: number, color: number) => void
114
+ /**
115
+ * Rysuje ikonę (bmp) w trybie 'freedraw'. x, y - współrzędne; filename - nazwa pliku (bez rozszerzenia)
116
+ * @param {number} x
117
+ * @param {number} y
118
+ * @param {string} filename
119
+ */
120
+ drawIcon: (x: number, y: number, filename: string) => void
121
+ /** Wyświetla zawartość bufora pamięci graficznej. Zmienia tryb wyświetlania na 'freedraw' */
122
+ displayContent: () => void
123
+ /** Nazwa pliku BMP z ikoną dla gestu Góra (bez rozszerzenia) */
124
+ readonly gestureIconUp: string
125
+ /**
126
+ * Ustawia ikonę dla wykonania gestu w górę
127
+ * @param {string} filename
128
+ */
129
+ setGestureIconUp: (filename: string) => void
130
+ /** Nazwa pliku BMP z ikoną dla gestu Dół (bez rozszerzenia) */
131
+ readonly gestureIconDown: string
132
+ /**
133
+ * Ustawia ikonę dla wykonania gestu w dół
134
+ * @param {string} filename
135
+ */
136
+ setGestureIconDown: (filename: string) => void
137
+ /** Nazwa pliku BMP z ikoną dla gestu Lewo (bez rozszerzenia) */
138
+ readonly gestureIconLeft: string
139
+ /**
140
+ * Ustawia ikonę dla wykonania gestu w lewo
141
+ * @param {string} filename
142
+ */
143
+ setGestureIconLeft: (filename: string) => void
144
+ /** Nazwa pliku BMP z ikoną dla gestu Prawo (bez rozszerzenia) */
145
+ readonly gestureIconRight: string
146
+ /**
147
+ * Ustawia ikonę dla wykonania gestu w prawo
148
+ * @param {string} filename
149
+ */
150
+ setGestureIconRight: (filename: string) => void
151
+ /** Czułość sensora zbliżeniowego */
152
+ readonly proximitySens: number
153
+ /**
154
+ * Ustawia wartość ProximitySens
155
+ * @param {number} value
156
+ */
157
+ setProximitySens: (value: number) => void
158
+ /** Czas po jakim wyświetlacz zostanie wygaszony */
159
+ readonly proximityTimeout: number
160
+ /**
161
+ * Ustawia czas w sekundach po jakim wyświetlacz gaśnie
162
+ * @param {number} value
163
+ */
164
+ setProximityTimeout: (value: number) => void
165
+ /** Sygnał sensora zbliżeniowego */
166
+ readonly proximityValue: number
167
+ /** Sterowanie sygnalizacją dźwiękową: 0 - Off, 1 - On */
168
+ readonly buzzerValue: BuzzerValueType
169
+ /**
170
+ * Ustawia wartość BuzzerValue: 0 - Off, 1 - On
171
+ * @param {BuzzerValueType} value
172
+ */
173
+ setBuzzerValue: (value: BuzzerValueType) => void
174
+ }
175
+
176
+ class PanelRemote implements IPanel {
177
+ constructor(private objectName: string, private gate: RemoteGate) {
178
+ }
179
+
180
+ addOnGestureUp(_callback: () => void): void {
181
+ // Remote events are not supported
182
+ }
183
+ addOnGestureDown(_callback: () => void): void {
184
+ // Remote events are not supported
185
+ }
186
+ addOnGestureLeft(_callback: () => void): void {
187
+ // Remote events are not supported
188
+ }
189
+ addOnGestureRight(_callback: () => void): void {
190
+ // Remote events are not supported
191
+ }
192
+ addOnProximityDetect(_callback: () => void): void {
193
+ // Remote events are not supported
194
+ }
195
+
196
+ /** Wybudza wyświetlacz z trybu uśpienia */
197
+ switchOnDisplay(): void {
198
+ const cmd: string | null = rawExecutionBuilderFactory(this.objectName)
199
+ .execute()
200
+ .addParameter(MethodType.SwitchOnDisplay)
201
+ .build();
202
+ this.gate.runScript(cmd!);
203
+ }
204
+
205
+ /** Zmienia tryb wyświetlania na 'buttons'. Czyści wyświetlacz i wyświetla ponownie ikony (lub tekst) dla wszystkich przycisków */
206
+ showButtons(): void {
207
+ const cmd: string | null = rawExecutionBuilderFactory(this.objectName)
208
+ .execute()
209
+ .addParameter(MethodType.ShowButtons)
210
+ .build();
211
+ this.gate.runScript(cmd!);
212
+ }
213
+
214
+ /** Czyści zawartość wyświetlacza w trybie 'freedraw' */
215
+ clearScreen(): void {
216
+ const cmd: string | null = rawExecutionBuilderFactory(this.objectName)
217
+ .execute()
218
+ .addParameter(MethodType.ClearScreen)
219
+ .build();
220
+ this.gate.runScript(cmd!);
221
+ }
222
+
223
+ /**
224
+ * Wyświetla tekst w trybie 'freedraw'. x, y - współrzędne; txt - string; font size: 1=10p, 2=14p, 3=32p
225
+ * @param {number} x
226
+ * @param {number} y
227
+ * @param {string} txt
228
+ * @param {number} fontSize
229
+ */
230
+ printText(x: number, y: number, txt: string, fontSize: number): void {
231
+ const cmd: string | null = rawExecutionBuilderFactory(this.objectName)
232
+ .execute()
233
+ .addParameter(MethodType.PrintText)
234
+ .addParameter(x)
235
+ .addParameter(y)
236
+ .addParameter(txt)
237
+ .addParameter(fontSize)
238
+ .build();
239
+ this.gate.runScript(cmd!);
240
+ }
241
+
242
+ /**
243
+ * Wyświetla liczbę w trybie 'freedraw'. x, y - współrzędne; number - liczba; precision - ilość miejsc po przecinku; font size: 1=10p, 2=14p, 3=32p
244
+ * @param {number} x
245
+ * @param {number} y
246
+ * @param {number} number
247
+ * @param {number} precision
248
+ * @param {number} fontSize
249
+ */
250
+ printFloat(x: number, y: number, number: number, precision: number, fontSize: number): void {
251
+ const cmd: string | null = rawExecutionBuilderFactory(this.objectName)
252
+ .execute()
253
+ .addParameter(MethodType.PrintFloat)
254
+ .addParameter(x)
255
+ .addParameter(y)
256
+ .addParameter(number)
257
+ .addParameter(precision)
258
+ .addParameter(fontSize)
259
+ .build();
260
+ this.gate.runScript(cmd!);
261
+ }
262
+
263
+ /**
264
+ * Rysuje linię w trybie 'freedraw'. x, y - współrzędne początkowe; xe, ye - współrzędne końcowe; color - 0 czarny, 1 biały
265
+ * @param {number} x
266
+ * @param {number} y
267
+ * @param {number} xe
268
+ * @param {number} ye
269
+ * @param {number} color
270
+ */
271
+ drawLine(x: number, y: number, xe: number, ye: number, color: number): void {
272
+ const cmd: string | null = rawExecutionBuilderFactory(this.objectName)
273
+ .execute()
274
+ .addParameter(MethodType.DrawLine)
275
+ .addParameter(x)
276
+ .addParameter(y)
277
+ .addParameter(xe)
278
+ .addParameter(ye)
279
+ .addParameter(color)
280
+ .build();
281
+ this.gate.runScript(cmd!);
282
+ }
283
+
284
+ /**
285
+ * Rysuje punkt w trybie 'freedraw'. x, y - współrzędne w pikselach; color - 0 czarny, 1 biały
286
+ * @param {number} x
287
+ * @param {number} y
288
+ * @param {number} color
289
+ */
290
+ drawPoint(x: number, y: number, color: number): void {
291
+ const cmd: string | null = rawExecutionBuilderFactory(this.objectName)
292
+ .execute()
293
+ .addParameter(MethodType.DrawPoint)
294
+ .addParameter(x)
295
+ .addParameter(y)
296
+ .addParameter(color)
297
+ .build();
298
+ this.gate.runScript(cmd!);
299
+ }
300
+
301
+ /**
302
+ * Rysuje ikonę (bmp) w trybie 'freedraw'. x, y - współrzędne; filename - nazwa pliku (bez rozszerzenia)
303
+ * @param {number} x
304
+ * @param {number} y
305
+ * @param {string} filename
306
+ */
307
+ drawIcon(x: number, y: number, filename: string): void {
308
+ const cmd: string | null = rawExecutionBuilderFactory(this.objectName)
309
+ .execute()
310
+ .addParameter(MethodType.DrawIcon)
311
+ .addParameter(x)
312
+ .addParameter(y)
313
+ .addParameter(filename)
314
+ .build();
315
+ this.gate.runScript(cmd!);
316
+ }
317
+
318
+ /** Wyświetla zawartość bufora pamięci graficznej. Zmienia tryb wyświetlania na 'freedraw' */
319
+ displayContent(): void {
320
+ const cmd: string | null = rawExecutionBuilderFactory(this.objectName)
321
+ .execute()
322
+ .addParameter(MethodType.DisplayContent)
323
+ .build();
324
+ this.gate.runScript(cmd!);
325
+ }
326
+
327
+ /** Nazwa pliku BMP z ikoną dla gestu Góra (bez rozszerzenia) */
328
+ get gestureIconUp(): string {
329
+ const cmd: string | null = rawExecutionBuilderFactory(this.objectName)
330
+ .get()
331
+ .addParameter(PropertyType.GestureIconUp)
332
+ .build();
333
+ return this.gate.runScript(cmd!);
334
+ }
335
+
336
+ /**
337
+ * Ustawia ikonę dla wykonania gestu w górę
338
+ * @param {string} filename
339
+ */
340
+ setGestureIconUp(filename: string): void {
341
+ const cmd: string | null = rawExecutionBuilderFactory(this.objectName)
342
+ .set()
343
+ .addParameter(PropertyType.GestureIconUp)
344
+ .addParameter(filename)
345
+ .build();
346
+ this.gate.runScript(cmd!);
347
+ }
348
+
349
+ /** Nazwa pliku BMP z ikoną dla gestu Dół (bez rozszerzenia) */
350
+ get gestureIconDown(): string {
351
+ const cmd: string | null = rawExecutionBuilderFactory(this.objectName)
352
+ .get()
353
+ .addParameter(PropertyType.GestureIconDown)
354
+ .build();
355
+ return this.gate.runScript(cmd!);
356
+ }
357
+
358
+ /**
359
+ * Ustawia ikonę dla wykonania gestu w dół
360
+ * @param {string} filename
361
+ */
362
+ setGestureIconDown(filename: string): void {
363
+ const cmd: string | null = rawExecutionBuilderFactory(this.objectName)
364
+ .set()
365
+ .addParameter(PropertyType.GestureIconDown)
366
+ .addParameter(filename)
367
+ .build();
368
+ this.gate.runScript(cmd!);
369
+ }
370
+
371
+ /** Nazwa pliku BMP z ikoną dla gestu Lewo (bez rozszerzenia) */
372
+ get gestureIconLeft(): string {
373
+ const cmd: string | null = rawExecutionBuilderFactory(this.objectName)
374
+ .get()
375
+ .addParameter(PropertyType.GestureIconLeft)
376
+ .build();
377
+ return this.gate.runScript(cmd!);
378
+ }
379
+
380
+ /**
381
+ * Ustawia ikonę dla wykonania gestu w lewo
382
+ * @param {string} filename
383
+ */
384
+ setGestureIconLeft(filename: string): void {
385
+ const cmd: string | null = rawExecutionBuilderFactory(this.objectName)
386
+ .set()
387
+ .addParameter(PropertyType.GestureIconLeft)
388
+ .addParameter(filename)
389
+ .build();
390
+ this.gate.runScript(cmd!);
391
+ }
392
+
393
+ /** Nazwa pliku BMP z ikoną dla gestu Prawo (bez rozszerzenia) */
394
+ get gestureIconRight(): string {
395
+ const cmd: string | null = rawExecutionBuilderFactory(this.objectName)
396
+ .get()
397
+ .addParameter(PropertyType.GestureIconRight)
398
+ .build();
399
+ return this.gate.runScript(cmd!);
400
+ }
401
+
402
+ /**
403
+ * Ustawia ikonę dla wykonania gestu w prawo
404
+ * @param {string} filename
405
+ */
406
+ setGestureIconRight(filename: string): void {
407
+ const cmd: string | null = rawExecutionBuilderFactory(this.objectName)
408
+ .set()
409
+ .addParameter(PropertyType.GestureIconRight)
410
+ .addParameter(filename)
411
+ .build();
412
+ this.gate.runScript(cmd!);
413
+ }
414
+
415
+ /** Czułość sensora zbliżeniowego */
416
+ get proximitySens(): number {
417
+ const cmd: string | null = rawExecutionBuilderFactory(this.objectName)
418
+ .get()
419
+ .addParameter(PropertyType.ProximitySens)
420
+ .build();
421
+ return this.gate.runScript(cmd!);
422
+ }
423
+
424
+ /**
425
+ * Ustawia wartość ProximitySens
426
+ * @param {number} value
427
+ */
428
+ setProximitySens(value: number): void {
429
+ const cmd: string | null = rawExecutionBuilderFactory(this.objectName)
430
+ .set()
431
+ .addParameter(PropertyType.ProximitySens)
432
+ .addParameter(value)
433
+ .build();
434
+ this.gate.runScript(cmd!);
435
+ }
436
+
437
+ /** Czas po jakim wyświetlacz zostanie wygaszony */
438
+ get proximityTimeout(): number {
439
+ const cmd: string | null = rawExecutionBuilderFactory(this.objectName)
440
+ .get()
441
+ .addParameter(PropertyType.ProximityTimeout)
442
+ .build();
443
+ return this.gate.runScript(cmd!);
444
+ }
445
+
446
+ /**
447
+ * Ustawia czas w sekundach po jakim wyświetlacz gaśnie
448
+ * @param {number} value
449
+ */
450
+ setProximityTimeout(value: number): void {
451
+ const cmd: string | null = rawExecutionBuilderFactory(this.objectName)
452
+ .set()
453
+ .addParameter(PropertyType.ProximityTimeout)
454
+ .addParameter(value)
455
+ .build();
456
+ this.gate.runScript(cmd!);
457
+ }
458
+
459
+ /** Sygnał sensora zbliżeniowego */
460
+ get proximityValue(): number {
461
+ const cmd: string | null = rawExecutionBuilderFactory(this.objectName)
462
+ .get()
463
+ .addParameter(PropertyType.ProximityValue)
464
+ .build();
465
+ return this.gate.runScript(cmd!);
466
+ }
467
+
468
+ /** Sterowanie sygnalizacją dźwiękową: 0 - Off, 1 - On */
469
+ get buzzerValue(): BuzzerValueType {
470
+ const cmd: string | null = rawExecutionBuilderFactory(this.objectName)
471
+ .get()
472
+ .addParameter(PropertyType.BuzzerValue)
473
+ .build();
474
+ return this.gate.runScript(cmd!);
475
+ }
476
+
477
+ /**
478
+ * Ustawia wartość BuzzerValue: 0 - Off, 1 - On
479
+ * @param {BuzzerValueType} value
480
+ */
481
+ setBuzzerValue(value: BuzzerValueType): void {
482
+ const cmd: string | null = rawExecutionBuilderFactory(this.objectName)
483
+ .set()
484
+ .addParameter(PropertyType.BuzzerValue)
485
+ .addParameter(value)
486
+ .build();
487
+ this.gate.runScript(cmd!);
488
+ }
489
+ }
490
+
491
+ class Panel implements IPanel {
492
+ private onGestureUpCallbacks: Array<() => void> = [];
493
+ private onGestureDownCallbacks: Array<() => void> = [];
494
+ private onGestureLeftCallbacks: Array<() => void> = [];
495
+ private onGestureRightCallbacks: Array<() => void> = [];
496
+ private onProximityDetectCallbacks: Array<() => void> = [];
497
+
498
+ constructor(private raw: PanelRaw) {
499
+ this.raw.add_event(EventType.OnGestureUp, () => {
500
+ this.onGestureUpCallbacks.forEach(callback => { callback(); });
501
+ });
502
+ this.raw.add_event(EventType.OnGestureDown, () => {
503
+ this.onGestureDownCallbacks.forEach(callback => { callback(); });
504
+ });
505
+ this.raw.add_event(EventType.OnGestureLeft, () => {
506
+ this.onGestureLeftCallbacks.forEach(callback => { callback(); });
507
+ });
508
+ this.raw.add_event(EventType.OnGestureRight, () => {
509
+ this.onGestureRightCallbacks.forEach(callback => { callback(); });
510
+ });
511
+ this.raw.add_event(EventType.OnProximityDetect, () => {
512
+ this.onProximityDetectCallbacks.forEach(callback => { callback(); });
513
+ });
514
+ }
515
+
516
+ /**
517
+ * Zdarzenie wywoływane w przypadku wykonania gestu w górę
518
+ * @param callback
519
+ */
520
+ addOnGestureUp(callback: () => void): void {
521
+ this.onGestureUpCallbacks.push(callback);
522
+ }
523
+ /**
524
+ * Zdarzenie wywoływane w przypadku wykonania gestu w dół
525
+ * @param callback
526
+ */
527
+ addOnGestureDown(callback: () => void): void {
528
+ this.onGestureDownCallbacks.push(callback);
529
+ }
530
+ /**
531
+ * Zdarzenie wywoływane w przypadku wykonania gestu w lewo
532
+ * @param callback
533
+ */
534
+ addOnGestureLeft(callback: () => void): void {
535
+ this.onGestureLeftCallbacks.push(callback);
536
+ }
537
+ /**
538
+ * Zdarzenie wywoływane w przypadku wykonania gestu w prawo
539
+ * @param callback
540
+ */
541
+ addOnGestureRight(callback: () => void): void {
542
+ this.onGestureRightCallbacks.push(callback);
543
+ }
544
+ /**
545
+ * Zdarzenie wywoływane w przypadku wykrycia zbliżającej się do wyświetlacza osoby
546
+ * @param callback
547
+ */
548
+ addOnProximityDetect(callback: () => void): void {
549
+ this.onProximityDetectCallbacks.push(callback);
550
+ }
551
+ /** Wybudza wyświetlacz z trybu uśpienia */
552
+ switchOnDisplay(): void {
553
+ this.raw.execute(MethodType.SwitchOnDisplay);
554
+ }
555
+ /** Zmienia tryb wyświetlania na 'buttons'. Czyści wyświetlacz i wyświetla ponownie ikony (lub tekst) dla wszystkich przycisków */
556
+ showButtons(): void {
557
+ this.raw.execute(MethodType.ShowButtons);
558
+ }
559
+ /** Czyści zawartość wyświetlacza w trybie 'freedraw' */
560
+ clearScreen(): void {
561
+ this.raw.execute(MethodType.ClearScreen);
562
+ }
563
+ /**
564
+ * Wyświetla tekst w trybie 'freedraw'. x, y - współrzędne; txt - string; font size: 1=10p, 2=14p, 3=32p
565
+ * @param {number} x
566
+ * @param {number} y
567
+ * @param {string} txt
568
+ * @param {number} fontSize
569
+ */
570
+ printText(x: number, y: number, txt: string, fontSize: number): void {
571
+ this.raw.execute(MethodType.PrintText, x, y, txt, fontSize);
572
+ }
573
+ /**
574
+ * Wyświetla liczbę w trybie 'freedraw'. x, y - współrzędne; number - liczba; precision - ilość miejsc po przecinku; font size: 1=10p, 2=14p, 3=32p
575
+ * @param {number} x
576
+ * @param {number} y
577
+ * @param {number} number
578
+ * @param {number} precision
579
+ * @param {number} fontSize
580
+ */
581
+ printFloat(x: number, y: number, number: number, precision: number, fontSize: number): void {
582
+ this.raw.execute(MethodType.PrintFloat, x, y, number, precision, fontSize);
583
+ }
584
+ /**
585
+ * Rysuje linię w trybie 'freedraw'. x, y - współrzędne początkowe; xe, ye - współrzędne końcowe; color - 0 czarny, 1 biały
586
+ * @param {number} x
587
+ * @param {number} y
588
+ * @param {number} xe
589
+ * @param {number} ye
590
+ * @param {number} color
591
+ */
592
+ drawLine(x: number, y: number, xe: number, ye: number, color: number): void {
593
+ this.raw.execute(MethodType.DrawLine, x, y, xe, ye, color);
594
+ }
595
+ /**
596
+ * Rysuje punkt w trybie 'freedraw'. x, y - współrzędne w pikselach; color - 0 czarny, 1 biały
597
+ * @param {number} x
598
+ * @param {number} y
599
+ * @param {number} color
600
+ */
601
+ drawPoint(x: number, y: number, color: number): void {
602
+ this.raw.execute(MethodType.DrawPoint, x, y, color);
603
+ }
604
+ /**
605
+ * Rysuje ikonę (bmp) w trybie 'freedraw'. x, y - współrzędne; filename - nazwa pliku (bez rozszerzenia)
606
+ * @param {number} x
607
+ * @param {number} y
608
+ * @param {string} filename
609
+ */
610
+ drawIcon(x: number, y: number, filename: string): void {
611
+ this.raw.execute(MethodType.DrawIcon, x, y, filename);
612
+ }
613
+ /** Wyświetla zawartość bufora pamięci graficznej. Zmienia tryb wyświetlania na 'freedraw' */
614
+ displayContent(): void {
615
+ this.raw.execute(MethodType.DisplayContent);
616
+ }
617
+ /** Nazwa pliku BMP z ikoną dla gestu Góra (bez rozszerzenia) */
618
+ get gestureIconUp(): string {
619
+ return this.raw.get(PropertyType.GestureIconUp);
620
+ }
621
+ /**
622
+ * Ustawia ikonę dla wykonania gestu w górę
623
+ * @param {string} filename
624
+ */
625
+ setGestureIconUp(filename: string): void {
626
+ this.raw.set(PropertyType.GestureIconUp, filename);
627
+ }
628
+ /** Nazwa pliku BMP z ikoną dla gestu Dół (bez rozszerzenia) */
629
+ get gestureIconDown(): string {
630
+ return this.raw.get(PropertyType.GestureIconDown);
631
+ }
632
+ /**
633
+ * Ustawia ikonę dla wykonania gestu w dół
634
+ * @param {string} filename
635
+ */
636
+ setGestureIconDown(filename: string): void {
637
+ this.raw.set(PropertyType.GestureIconDown, filename);
638
+ }
639
+ /** Nazwa pliku BMP z ikoną dla gestu Lewo (bez rozszerzenia) */
640
+ get gestureIconLeft(): string {
641
+ return this.raw.get(PropertyType.GestureIconLeft);
642
+ }
643
+ /**
644
+ * Ustawia ikonę dla wykonania gestu w lewo
645
+ * @param {string} filename
646
+ */
647
+ setGestureIconLeft(filename: string): void {
648
+ this.raw.set(PropertyType.GestureIconLeft, filename);
649
+ }
650
+ /** Nazwa pliku BMP z ikoną dla gestu Prawo (bez rozszerzenia) */
651
+ get gestureIconRight(): string {
652
+ return this.raw.get(PropertyType.GestureIconRight);
653
+ }
654
+ /**
655
+ * Ustawia ikonę dla wykonania gestu w prawo
656
+ * @param {string} filename
657
+ */
658
+ setGestureIconRight(filename: string): void {
659
+ this.raw.set(PropertyType.GestureIconRight, filename);
660
+ }
661
+ /** Czułość sensora zbliżeniowego */
662
+ get proximitySens(): number {
663
+ return this.raw.get(PropertyType.ProximitySens);
664
+ }
665
+ /**
666
+ * Ustawia wartość ProximitySens
667
+ * @param {number} value
668
+ */
669
+ setProximitySens(value: number): void {
670
+ this.raw.set(PropertyType.ProximitySens, value);
671
+ }
672
+ /** Czas po jakim wyświetlacz zostanie wygaszony */
673
+ get proximityTimeout(): number {
674
+ return this.raw.get(PropertyType.ProximityTimeout);
675
+ }
676
+ /**
677
+ * Ustawia czas w sekundach po jakim wyświetlacz gaśnie
678
+ * @param {number} value
679
+ */
680
+ setProximityTimeout(value: number): void {
681
+ this.raw.set(PropertyType.ProximityTimeout, value);
682
+ }
683
+ /** Sygnał sensora zbliżeniowego */
684
+ get proximityValue(): number {
685
+ return this.raw.get(PropertyType.ProximityValue);
686
+ }
687
+ /** Sterowanie sygnalizacją dźwiękową: 0 - Off, 1 - On */
688
+ get buzzerValue(): BuzzerValueType {
689
+ return this.raw.get(PropertyType.BuzzerValue);
690
+ }
691
+ /**
692
+ * Ustawia wartość BuzzerValue: 0 - Off, 1 - On
693
+ * @param {BuzzerValueType} value
694
+ */
695
+ setBuzzerValue(value: BuzzerValueType): void {
696
+ this.raw.set(PropertyType.BuzzerValue, value);
697
+ }
698
+ }
699
+
700
+ export { Panel, PanelRaw, PanelRemote, BuzzerValueType }