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,238 @@
1
+ // Created from: packages/grenton-api/interfaces/module_SMART_PANEL_FM_4_fv03_03.xml, object name="PANELSENSLIGHT" version="03.03"
2
+
3
+ import { rawExecutionBuilderFactory } from "../../core/execution-builder"
4
+ import { RemoteGate } from "../../core/remote-gate"
5
+
6
+ enum EventType {
7
+ OnChange = 0,
8
+ OnRaiseValue = 1,
9
+ OnLowerValue = 2,
10
+ OnOutOfRange = 3,
11
+ }
12
+
13
+ enum PropertyType {
14
+ Value = 0,
15
+ Threshold = 1,
16
+ Sensitivity = 2,
17
+ MinValue = 3,
18
+ MaxValue = 4,
19
+ }
20
+
21
+ declare class PanelSensLightRaw {
22
+ add_event(event: EventType, callback: () => void): void;
23
+ get(property: PropertyType): any;
24
+ set(property: PropertyType, value: any): void;
25
+ }
26
+
27
+ interface IPanelSensLight {
28
+ /**
29
+ * Zdarzenie wywoływane w przypadku zmiany wartości cechy Value
30
+ * @param callback
31
+ */
32
+ addOnChange: (callback: () => void) => void
33
+ /**
34
+ * Zdarzenie wywoływane przy zmianie wartości na wyższą (zbocze narastające)
35
+ * @param callback
36
+ */
37
+ addOnRaiseValue: (callback: () => void) => void
38
+ /**
39
+ * Zdarzenie wywoływane przy zmianie wartości na niższą (zbocze opadające)
40
+ * @param callback
41
+ */
42
+ addOnLowerValue: (callback: () => void) => void
43
+ /**
44
+ * Zdarzenie wywoływane, gdy wartość na wejściu znajduje się poza wyznaczonym zakresem (MinValue - MaxValue)
45
+ * @param callback
46
+ */
47
+ addOnOutOfRange: (callback: () => void) => void
48
+ /** Wartość wejścia w zakresie od 0 do 100 % */
49
+ readonly value: number
50
+ /** Wielkość histerezy (dokładność 0.1%) określająca czułość, przy której następuje wygenerowanie zdarzeń: OnChange, OnLowerValue, OnRaiseValue */
51
+ threshold: number
52
+ /** Okres (w ms), w którym próbkowane wartości są uśredniane */
53
+ sensitivity: number
54
+ /** Minimalna wartość cechy Value, której przekroczenie wywołuje zdarzenie OnOutOfRange */
55
+ minValue: number
56
+ /** Maksymalna wartość cechy Value, której przekroczenie wywołuje zdarzenie OnOutOfRange */
57
+ maxValue: number
58
+ }
59
+
60
+ class PanelSensLightRemote implements IPanelSensLight {
61
+ constructor(private objectName: string, private gate: RemoteGate) {
62
+ }
63
+
64
+ addOnChange(_callback: () => void): void {
65
+ // Remote events are not supported
66
+ }
67
+ addOnRaiseValue(_callback: () => void): void {
68
+ // Remote events are not supported
69
+ }
70
+ addOnLowerValue(_callback: () => void): void {
71
+ // Remote events are not supported
72
+ }
73
+ addOnOutOfRange(_callback: () => void): void {
74
+ // Remote events are not supported
75
+ }
76
+
77
+ /** Wartość wejścia w zakresie od 0 do 100 % */
78
+ get value(): number {
79
+ const cmd: string | null = rawExecutionBuilderFactory(this.objectName)
80
+ .get()
81
+ .addParameter(PropertyType.Value)
82
+ .build();
83
+ return this.gate.runScript(cmd!);
84
+ }
85
+
86
+ /** Wielkość histerezy (dokładność 0.1%) określająca czułość, przy której następuje wygenerowanie zdarzeń: OnChange, OnLowerValue, OnRaiseValue */
87
+ get threshold(): number {
88
+ const cmd: string | null = rawExecutionBuilderFactory(this.objectName)
89
+ .get()
90
+ .addParameter(PropertyType.Threshold)
91
+ .build();
92
+ return this.gate.runScript(cmd!);
93
+ }
94
+ set threshold(value: number) {
95
+ const cmd: string | null = rawExecutionBuilderFactory(this.objectName)
96
+ .set()
97
+ .addParameter(PropertyType.Threshold)
98
+ .addParameter(value)
99
+ .build();
100
+ this.gate.runScript(cmd!);
101
+ }
102
+
103
+ /** Okres (w ms), w którym próbkowane wartości są uśredniane */
104
+ get sensitivity(): number {
105
+ const cmd: string | null = rawExecutionBuilderFactory(this.objectName)
106
+ .get()
107
+ .addParameter(PropertyType.Sensitivity)
108
+ .build();
109
+ return this.gate.runScript(cmd!);
110
+ }
111
+ set sensitivity(value: number) {
112
+ const cmd: string | null = rawExecutionBuilderFactory(this.objectName)
113
+ .set()
114
+ .addParameter(PropertyType.Sensitivity)
115
+ .addParameter(value)
116
+ .build();
117
+ this.gate.runScript(cmd!);
118
+ }
119
+
120
+ /** Minimalna wartość cechy Value, której przekroczenie wywołuje zdarzenie OnOutOfRange */
121
+ get minValue(): number {
122
+ const cmd: string | null = rawExecutionBuilderFactory(this.objectName)
123
+ .get()
124
+ .addParameter(PropertyType.MinValue)
125
+ .build();
126
+ return this.gate.runScript(cmd!);
127
+ }
128
+ set minValue(value: number) {
129
+ const cmd: string | null = rawExecutionBuilderFactory(this.objectName)
130
+ .set()
131
+ .addParameter(PropertyType.MinValue)
132
+ .addParameter(value)
133
+ .build();
134
+ this.gate.runScript(cmd!);
135
+ }
136
+
137
+ /** Maksymalna wartość cechy Value, której przekroczenie wywołuje zdarzenie OnOutOfRange */
138
+ get maxValue(): number {
139
+ const cmd: string | null = rawExecutionBuilderFactory(this.objectName)
140
+ .get()
141
+ .addParameter(PropertyType.MaxValue)
142
+ .build();
143
+ return this.gate.runScript(cmd!);
144
+ }
145
+ set maxValue(value: number) {
146
+ const cmd: string | null = rawExecutionBuilderFactory(this.objectName)
147
+ .set()
148
+ .addParameter(PropertyType.MaxValue)
149
+ .addParameter(value)
150
+ .build();
151
+ this.gate.runScript(cmd!);
152
+ }
153
+ }
154
+
155
+ class PanelSensLight implements IPanelSensLight {
156
+ private onChangeCallbacks: Array<() => void> = [];
157
+ private onRaiseValueCallbacks: Array<() => void> = [];
158
+ private onLowerValueCallbacks: Array<() => void> = [];
159
+ private onOutOfRangeCallbacks: Array<() => void> = [];
160
+
161
+ constructor(private raw: PanelSensLightRaw) {
162
+ this.raw.add_event(EventType.OnChange, () => {
163
+ this.onChangeCallbacks.forEach(callback => { callback(); });
164
+ });
165
+ this.raw.add_event(EventType.OnRaiseValue, () => {
166
+ this.onRaiseValueCallbacks.forEach(callback => { callback(); });
167
+ });
168
+ this.raw.add_event(EventType.OnLowerValue, () => {
169
+ this.onLowerValueCallbacks.forEach(callback => { callback(); });
170
+ });
171
+ this.raw.add_event(EventType.OnOutOfRange, () => {
172
+ this.onOutOfRangeCallbacks.forEach(callback => { callback(); });
173
+ });
174
+ }
175
+
176
+ /**
177
+ * Zdarzenie wywoływane w przypadku zmiany wartości cechy Value
178
+ * @param callback
179
+ */
180
+ addOnChange(callback: () => void): void {
181
+ this.onChangeCallbacks.push(callback);
182
+ }
183
+ /**
184
+ * Zdarzenie wywoływane przy zmianie wartości na wyższą (zbocze narastające)
185
+ * @param callback
186
+ */
187
+ addOnRaiseValue(callback: () => void): void {
188
+ this.onRaiseValueCallbacks.push(callback);
189
+ }
190
+ /**
191
+ * Zdarzenie wywoływane przy zmianie wartości na niższą (zbocze opadające)
192
+ * @param callback
193
+ */
194
+ addOnLowerValue(callback: () => void): void {
195
+ this.onLowerValueCallbacks.push(callback);
196
+ }
197
+ /**
198
+ * Zdarzenie wywoływane, gdy wartość na wejściu znajduje się poza wyznaczonym zakresem (MinValue - MaxValue)
199
+ * @param callback
200
+ */
201
+ addOnOutOfRange(callback: () => void): void {
202
+ this.onOutOfRangeCallbacks.push(callback);
203
+ }
204
+ /** Wartość wejścia w zakresie od 0 do 100 % */
205
+ get value(): number {
206
+ return this.raw.get(PropertyType.Value);
207
+ }
208
+ /** Wielkość histerezy (dokładność 0.1%) określająca czułość, przy której następuje wygenerowanie zdarzeń: OnChange, OnLowerValue, OnRaiseValue */
209
+ get threshold(): number {
210
+ return this.raw.get(PropertyType.Threshold);
211
+ }
212
+ set threshold(value: number) {
213
+ this.raw.set(PropertyType.Threshold, value);
214
+ }
215
+ /** Okres (w ms), w którym próbkowane wartości są uśredniane */
216
+ get sensitivity(): number {
217
+ return this.raw.get(PropertyType.Sensitivity);
218
+ }
219
+ set sensitivity(value: number) {
220
+ this.raw.set(PropertyType.Sensitivity, value);
221
+ }
222
+ /** Minimalna wartość cechy Value, której przekroczenie wywołuje zdarzenie OnOutOfRange */
223
+ get minValue(): number {
224
+ return this.raw.get(PropertyType.MinValue);
225
+ }
226
+ set minValue(value: number) {
227
+ this.raw.set(PropertyType.MinValue, value);
228
+ }
229
+ /** Maksymalna wartość cechy Value, której przekroczenie wywołuje zdarzenie OnOutOfRange */
230
+ get maxValue(): number {
231
+ return this.raw.get(PropertyType.MaxValue);
232
+ }
233
+ set maxValue(value: number) {
234
+ this.raw.set(PropertyType.MaxValue, value);
235
+ }
236
+ }
237
+
238
+ export { PanelSensLight, PanelSensLightRaw, PanelSensLightRemote }
@@ -0,0 +1,239 @@
1
+ // Created from: packages/grenton-api/interfaces/module_SMART_PANEL_FM_4_fv03_03.xml, object name="PANELSENSTEMP" version="03.03"
2
+
3
+ import { rawExecutionBuilderFactory } from "../../core/execution-builder"
4
+ import { RemoteGate } from "../../core/remote-gate"
5
+
6
+ enum EventType {
7
+ OnChange = 0,
8
+ OnRaiseValue = 1,
9
+ OnLowerValue = 2,
10
+ OnOutOfRange = 3,
11
+ }
12
+
13
+ enum PropertyType {
14
+ Value = 0,
15
+ Threshold = 1,
16
+ Sensitivity = 2,
17
+ MinValue = 3,
18
+ MaxValue = 4,
19
+ }
20
+
21
+ declare class PanelSensTempRaw {
22
+ add_event(event: EventType, callback: () => void): void;
23
+ get(property: PropertyType): any;
24
+ set(property: PropertyType, value: any): void;
25
+ }
26
+
27
+ interface IPanelSensTemp {
28
+ /**
29
+ * Zdarzenie wywoływane w przypadku zmiany wartości cechy Value
30
+ * @param callback
31
+ */
32
+ addOnChange: (callback: () => void) => void
33
+ /**
34
+ * Zdarzenie wywoływane przy zmianie wartości na wyższą (zbocze narastające)
35
+ * @param callback
36
+ */
37
+ addOnRaiseValue: (callback: () => void) => void
38
+ /**
39
+ * Zdarzenie wywoływane przy zmianie wartości na niższą (zbocze opadające)
40
+ * @param callback
41
+ */
42
+ addOnLowerValue: (callback: () => void) => void
43
+ /**
44
+ * Zdarzenie wywoływane, gdy wartość na wejściu znajduje się poza wyznaczonym zakresem (MinValue - MaxValue)
45
+ * @param callback
46
+ */
47
+ addOnOutOfRange: (callback: () => void) => void
48
+ /** Wartość wejścia czujnika temperatury w zakresie od 0.0 do 45.0 (°C) */
49
+ readonly value: number
50
+ /** Wielkość histerezy (dokładność 0.1°C) określająca czułość, przy której następuje wygenerowanie zdarzeń: OnChange, OnLowerValue, OnRaiseValue */
51
+ threshold: number
52
+ /** Okres (w ms), w którym próbkowane wartości są uśredniane */
53
+ sensitivity: number
54
+ /** Minimalna wartość cechy Value, której przekroczenie wywołuje zdarzenie OnOutOfRange */
55
+ minValue: number
56
+ /** Maksymalna wartość cechy Value, której przekroczenie wywołuje zdarzenie OnOutOfRange */
57
+ maxValue: number
58
+ }
59
+
60
+ class PanelSensTempRemote implements IPanelSensTemp {
61
+ constructor(private objectName: string, private gate: RemoteGate) {
62
+ }
63
+
64
+ addOnChange(_callback: () => void): void {
65
+ // Remote events are not supported
66
+ }
67
+ addOnRaiseValue(_callback: () => void): void {
68
+ // Remote events are not supported
69
+ }
70
+ addOnLowerValue(_callback: () => void): void {
71
+ // Remote events are not supported
72
+ }
73
+ addOnOutOfRange(_callback: () => void): void {
74
+ // Remote events are not supported
75
+ }
76
+
77
+ /** Wartość wejścia czujnika temperatury w zakresie od 0.0 do 45.0 (°C) */
78
+ get value(): number {
79
+ const cmd: string | null = rawExecutionBuilderFactory(this.objectName)
80
+ .get()
81
+ .addParameter(PropertyType.Value)
82
+ .build();
83
+ return this.gate.runScript(cmd!);
84
+ }
85
+
86
+ /** Wielkość histerezy (dokładność 0.1°C) określająca czułość, przy której następuje wygenerowanie zdarzeń: OnChange, OnLowerValue, OnRaiseValue */
87
+ get threshold(): number {
88
+ const cmd: string | null = rawExecutionBuilderFactory(this.objectName)
89
+ .get()
90
+ .addParameter(PropertyType.Threshold)
91
+ .build();
92
+ return this.gate.runScript(cmd!);
93
+ }
94
+ set threshold(value: number) {
95
+ const cmd: string | null = rawExecutionBuilderFactory(this.objectName)
96
+ .set()
97
+ .addParameter(PropertyType.Threshold)
98
+ .addParameter(value)
99
+ .build();
100
+ this.gate.runScript(cmd!);
101
+ }
102
+
103
+ /** Okres (w ms), w którym próbkowane wartości są uśredniane */
104
+ get sensitivity(): number {
105
+ const cmd: string | null = rawExecutionBuilderFactory(this.objectName)
106
+ .get()
107
+ .addParameter(PropertyType.Sensitivity)
108
+ .build();
109
+ return this.gate.runScript(cmd!);
110
+ }
111
+ set sensitivity(value: number) {
112
+ const cmd: string | null = rawExecutionBuilderFactory(this.objectName)
113
+ .set()
114
+ .addParameter(PropertyType.Sensitivity)
115
+ .addParameter(value)
116
+ .build();
117
+ this.gate.runScript(cmd!);
118
+ }
119
+
120
+ /** Minimalna wartość cechy Value, której przekroczenie wywołuje zdarzenie OnOutOfRange */
121
+ get minValue(): number {
122
+ const cmd: string | null = rawExecutionBuilderFactory(this.objectName)
123
+ .get()
124
+ .addParameter(PropertyType.MinValue)
125
+ .build();
126
+ return this.gate.runScript(cmd!);
127
+ }
128
+ set minValue(value: number) {
129
+ const cmd: string | null = rawExecutionBuilderFactory(this.objectName)
130
+ .set()
131
+ .addParameter(PropertyType.MinValue)
132
+ .addParameter(value)
133
+ .build();
134
+ this.gate.runScript(cmd!);
135
+ }
136
+
137
+ /** Maksymalna wartość cechy Value, której przekroczenie wywołuje zdarzenie OnOutOfRange */
138
+ get maxValue(): number {
139
+ const cmd: string | null = rawExecutionBuilderFactory(this.objectName)
140
+ .get()
141
+ .addParameter(PropertyType.MaxValue)
142
+ .build();
143
+ return this.gate.runScript(cmd!);
144
+ }
145
+ set maxValue(value: number) {
146
+ const cmd: string | null = rawExecutionBuilderFactory(this.objectName)
147
+ .set()
148
+ .addParameter(PropertyType.MaxValue)
149
+ .addParameter(value)
150
+ .build();
151
+ this.gate.runScript(cmd!);
152
+ }
153
+
154
+ }
155
+
156
+ class PanelSensTemp implements IPanelSensTemp {
157
+ private onChangeCallbacks: Array<() => void> = [];
158
+ private onRaiseValueCallbacks: Array<() => void> = [];
159
+ private onLowerValueCallbacks: Array<() => void> = [];
160
+ private onOutOfRangeCallbacks: Array<() => void> = [];
161
+
162
+ constructor(private raw: PanelSensTempRaw) {
163
+ this.raw.add_event(EventType.OnChange, () => {
164
+ this.onChangeCallbacks.forEach(callback => { callback(); });
165
+ });
166
+ this.raw.add_event(EventType.OnRaiseValue, () => {
167
+ this.onRaiseValueCallbacks.forEach(callback => { callback(); });
168
+ });
169
+ this.raw.add_event(EventType.OnLowerValue, () => {
170
+ this.onLowerValueCallbacks.forEach(callback => { callback(); });
171
+ });
172
+ this.raw.add_event(EventType.OnOutOfRange, () => {
173
+ this.onOutOfRangeCallbacks.forEach(callback => { callback(); });
174
+ });
175
+ }
176
+
177
+ /**
178
+ * Zdarzenie wywoływane w przypadku zmiany wartości cechy Value
179
+ * @param callback
180
+ */
181
+ addOnChange(callback: () => void): void {
182
+ this.onChangeCallbacks.push(callback);
183
+ }
184
+ /**
185
+ * Zdarzenie wywoływane przy zmianie wartości na wyższą (zbocze narastające)
186
+ * @param callback
187
+ */
188
+ addOnRaiseValue(callback: () => void): void {
189
+ this.onRaiseValueCallbacks.push(callback);
190
+ }
191
+ /**
192
+ * Zdarzenie wywoływane przy zmianie wartości na niższą (zbocze opadające)
193
+ * @param callback
194
+ */
195
+ addOnLowerValue(callback: () => void): void {
196
+ this.onLowerValueCallbacks.push(callback);
197
+ }
198
+ /**
199
+ * Zdarzenie wywoływane, gdy wartość na wejściu znajduje się poza wyznaczonym zakresem (MinValue - MaxValue)
200
+ * @param callback
201
+ */
202
+ addOnOutOfRange(callback: () => void): void {
203
+ this.onOutOfRangeCallbacks.push(callback);
204
+ }
205
+ /** Wartość wejścia czujnika temperatury w zakresie od 0.0 do 45.0 (°C) */
206
+ get value(): number {
207
+ return this.raw.get(PropertyType.Value);
208
+ }
209
+ /** Wielkość histerezy (dokładność 0.1°C) określająca czułość, przy której następuje wygenerowanie zdarzeń: OnChange, OnLowerValue, OnRaiseValue */
210
+ get threshold(): number {
211
+ return this.raw.get(PropertyType.Threshold);
212
+ }
213
+ set threshold(value: number) {
214
+ this.raw.set(PropertyType.Threshold, value);
215
+ }
216
+ /** Okres (w ms), w którym próbkowane wartości są uśredniane */
217
+ get sensitivity(): number {
218
+ return this.raw.get(PropertyType.Sensitivity);
219
+ }
220
+ set sensitivity(value: number) {
221
+ this.raw.set(PropertyType.Sensitivity, value);
222
+ }
223
+ /** Minimalna wartość cechy Value, której przekroczenie wywołuje zdarzenie OnOutOfRange */
224
+ get minValue(): number {
225
+ return this.raw.get(PropertyType.MinValue);
226
+ }
227
+ set minValue(value: number) {
228
+ this.raw.set(PropertyType.MinValue, value);
229
+ }
230
+ /** Maksymalna wartość cechy Value, której przekroczenie wywołuje zdarzenie OnOutOfRange */
231
+ get maxValue(): number {
232
+ return this.raw.get(PropertyType.MaxValue);
233
+ }
234
+ set maxValue(value: number) {
235
+ this.raw.set(PropertyType.MaxValue, value);
236
+ }
237
+ }
238
+
239
+ export { PanelSensTemp, PanelSensTempRaw, PanelSensTempRemote }