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.
- package/LICENSE +21 -0
- package/README.md +86 -0
- package/dist/analog-din/fv02_01/analog-in.ts +271 -0
- package/dist/clu/calendar/v1/calendar.ts +308 -0
- package/dist/clu/clu-zwave-2/fv515_03/clu-zwave-2.ts +1302 -0
- package/dist/clu/event-scheduler/v1/event-scheduler.ts +537 -0
- package/dist/clu/multi-fan-ac-thermostat/v1/multi-fan-ac-thermostat.ts +1163 -0
- package/dist/clu/pid-controller/v1/pid-controller.ts +536 -0
- package/dist/clu/presence-sensor/v1/presence-sensor.ts +313 -0
- package/dist/clu/presence-sensor/v2/presence-sensor.ts +470 -0
- package/dist/clu/push/v1/push.ts +261 -0
- package/dist/clu/scheduler/v1/scheduler.ts +304 -0
- package/dist/clu/statistics/v1/statistics.ts +413 -0
- package/dist/clu/statistics-pulse/v1/statistics-pulse.ts +218 -0
- package/dist/clu/sunrise-sunset-calendar/v1/sunrise-sunset-calendar.ts +389 -0
- package/dist/clu/sunrise-sunset-calendar/v2/sunrise-sunset-calendar.ts +659 -0
- package/dist/clu/sunrise-sunset-calendar/v3/sunrise-sunset-calendar.ts +659 -0
- package/dist/clu/thermostat/v1/thermostat.ts +768 -0
- package/dist/clu/thermostat/v2/thermostat.ts +861 -0
- package/dist/clu/timer/v1/timer.ts +369 -0
- package/dist/core/execution-builder.ts +55 -0
- package/dist/core/remote-gate.ts +17 -0
- package/dist/digital-in-din/fv02_01/din.ts +310 -0
- package/dist/examples/light_turned_on_by_calendar/Clu_OnInit.ts +26 -0
- package/dist/examples/light_turned_on_by_presence_sensor/Clu_OnInit.ts +35 -0
- package/dist/examples/light_turned_on_by_switch/Clu_OnInit.ts +16 -0
- package/dist/gate/cool-master/v1/cool-master.ts +782 -0
- package/dist/gate/cool-master-net/v1/cool-master-net.ts +334 -0
- package/dist/gate/denon-marantz-avr/v1/denon-marantz-avr.ts +724 -0
- package/dist/gate/heos/v1/heos.ts +1224 -0
- package/dist/gate/http/fv1000_03/clu-gate-http.ts +405 -0
- package/dist/gate/http/fv1000_03_hv1/clu-gate-http.ts +352 -0
- package/dist/gate/http/fv1100_03/clu-gate-http.ts +589 -0
- package/dist/gate/http/fv1110_03/clu-gate-http.ts +589 -0
- package/dist/gate/http/fv1300_03/clu-gate-http.ts +589 -0
- package/dist/gate/http/fv1400_03/clu-gate-http.ts +677 -0
- package/dist/gate/http-listener/v1/http-listener.ts +299 -0
- package/dist/gate/http-listener/v2/http-listener.ts +325 -0
- package/dist/gate/http-request/v1/http-request.ts +645 -0
- package/dist/gate/http-request/v2/http-request.ts +709 -0
- package/dist/gate/input/v1/input.ts +171 -0
- package/dist/gate/jablotron/v1/jablotron.ts +100 -0
- package/dist/gate/jablotron-device/v1/jablotron-device.ts +171 -0
- package/dist/gate/jablotron-output/v1/jablotron-output.ts +240 -0
- package/dist/gate/jablotron-section/v1/jablotron-section.ts +260 -0
- package/dist/gate/modbus/v1/modbus.ts +609 -0
- package/dist/gate/modbus/v2/modbus.ts +690 -0
- package/dist/gate/modbus-client/v1/modbus-client.ts +827 -0
- package/dist/gate/modbus-rtu/v1/modbus-rtu.ts +911 -0
- package/dist/gate/modbus-server/v1/modbus-server.ts +405 -0
- package/dist/gate/modbus-slave-config-rtu/v1/modbus-slave-config-rtu.ts +160 -0
- package/dist/gate/modbus-slave-rtu/v1/modbus-slave-rtu.ts +371 -0
- package/dist/gate/modbus-value/v1/modbus-value.ts +856 -0
- package/dist/gate/music-cast/v1/music-cast.ts +1298 -0
- package/dist/gate/output/v1/output.ts +240 -0
- package/dist/gate/satel/v1/satel.ts +359 -0
- package/dist/gate/satel-input/v1/satel-input.ts +171 -0
- package/dist/gate/satel-output/v1/satel-output.ts +240 -0
- package/dist/gate/satel-zone/v1/satel-zone.ts +235 -0
- package/dist/gate/sonos/v1/sonos.ts +934 -0
- package/dist/gate/timer/v2/timer.ts +253 -0
- package/dist/gate/zone/v1/zone.ts +235 -0
- package/dist/io-module-din-8/fv02_02/din.ts +354 -0
- package/dist/io-module-din-8/fv02_02/dout.ts +360 -0
- package/dist/one-wire/fv01_10/onew-sensor.ts +269 -0
- package/dist/one-wire/fv01_28/onew-sensor.ts +269 -0
- package/dist/one-wire/fv02_28/onew-sensor.ts +350 -0
- package/dist/one-wire/fv03_28/onew-sensor.ts +435 -0
- package/dist/relay-din-2/fv02_02/dout.ts +544 -0
- package/dist/relay-din-4/fv01_02/dout.ts +340 -0
- package/dist/relay-din-4/fv02_02/dout.ts +368 -0
- package/dist/roller-shutter-din-3/fv03_02/roller-shutter.ts +1078 -0
- package/dist/smart-panel-fm-4/fv03_03/panel-button.ts +550 -0
- package/dist/smart-panel-fm-4/fv03_03/panel-sens-light.ts +238 -0
- package/dist/smart-panel-fm-4/fv03_03/panel-sens-temp.ts +239 -0
- package/dist/smart-panel-fm-4/fv03_03/panel.ts +700 -0
- package/dist/smart-panel-fm-4/fv04_03/panel-button.ts +567 -0
- package/dist/smart-panel-fm-4/fv04_03/panel-page.ts +516 -0
- package/dist/smart-panel-fm-4/fv04_03/panel-sens-light.ts +238 -0
- package/dist/smart-panel-fm-4/fv04_03/panel-sens-temp.ts +239 -0
- package/dist/smart-panel-fm-4/fv04_03/panel.ts +1026 -0
- package/dist/smart-panel-fm-4/fv05_03/panel-button.ts +567 -0
- package/dist/smart-panel-fm-4/fv05_03/panel-page.ts +620 -0
- package/dist/smart-panel-fm-4/fv05_03/panel-sens-light.ts +238 -0
- package/dist/smart-panel-fm-4/fv05_03/panel-sens-temp.ts +266 -0
- package/dist/smart-panel-fm-4/fv05_03/panel.ts +1109 -0
- package/dist/smart-panel-fm-4/fv06_03/panel-button.ts +567 -0
- package/dist/smart-panel-fm-4/fv06_03/panel-page.ts +877 -0
- package/dist/smart-panel-fm-4/fv06_03/panel-sens-light.ts +238 -0
- package/dist/smart-panel-fm-4/fv06_03/panel-sens-temp.ts +297 -0
- package/dist/smart-panel-fm-4/fv06_03/panel.ts +1138 -0
- package/dist/smart-panel-fm-4/fv07_03/panel-button.ts +567 -0
- package/dist/smart-panel-fm-4/fv07_03/panel-page.ts +864 -0
- package/dist/smart-panel-fm-4/fv07_03/panel-sens-light.ts +238 -0
- package/dist/smart-panel-fm-4/fv07_03/panel-sens-temp.ts +297 -0
- package/dist/smart-panel-fm-4/fv07_03/panel.ts +1135 -0
- package/dist/touch-panel-fm-4/fv01_02/panel-button.ts +418 -0
- package/dist/touch-panel-fm-4/fv01_02/panel-sens-light.ts +238 -0
- package/dist/touch-panel-fm-4/fv01_02/panel-sens-temp.ts +257 -0
- package/dist/touch-panel-fm-4/fv01_02/panel.ts +75 -0
- package/dist/touch-panel-fm-4/fv01_02/power-supply-voltage.ts +322 -0
- package/dist/touch-panel-fm-8/fv01_02/panel-button.ts +418 -0
- package/dist/touch-panel-fm-8/fv01_02/panel-sens-light.ts +238 -0
- package/dist/touch-panel-fm-8/fv01_02/panel-sens-temp.ts +270 -0
- package/dist/touch-panel-fm-8/fv01_02/panel.ts +75 -0
- package/dist/touch-panel-fm-8/fv01_02/power-supply-voltage.ts +322 -0
- package/package.json +16 -0
|
@@ -0,0 +1,257 @@
|
|
|
1
|
+
import { rawExecutionBuilderFactory } from "../../core/execution-builder";
|
|
2
|
+
import { RemoteGate } from "../../core/remote-gate";
|
|
3
|
+
|
|
4
|
+
enum EventType {
|
|
5
|
+
OnValueChange = 0,
|
|
6
|
+
OnValueRise = 1,
|
|
7
|
+
OnValueLower = 2,
|
|
8
|
+
OnOutOfRange = 3,
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
enum PropertyType {
|
|
13
|
+
Threshold = 1,
|
|
14
|
+
Sensitivity = 2,
|
|
15
|
+
MinValue = 3,
|
|
16
|
+
MaxValue = 4,
|
|
17
|
+
Value = 0,
|
|
18
|
+
StatisticState = 9
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
enum StatisticState {
|
|
22
|
+
Off = 0,
|
|
23
|
+
On = 1,
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
declare class PanelSensTempRaw {
|
|
27
|
+
addEvent(event: EventType, callback: () => void): void;
|
|
28
|
+
get(property: PropertyType): any;
|
|
29
|
+
set(property: PropertyType, value: any): void;
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
interface IPanelSensTemp {
|
|
33
|
+
/** Zdarzenie wywoływane w przypadku zmiany wartości cechy Value */
|
|
34
|
+
addOnValueChange: (callback: () => void) => void;
|
|
35
|
+
/** Zdarzenie wywoływane przy zmianie wartości na wyższą (zbocze narastające) */
|
|
36
|
+
addOnValueRise: (callback: () => void) => void;
|
|
37
|
+
/** Zdarzenie wywoływane przy zmianie wartości na niższą (zbocze opadające) */
|
|
38
|
+
addOnValueLower: (callback: () => void) => void;
|
|
39
|
+
/** Zdarzenie wywoływane, gdy wartość na wyjściu znajduje się poza wyznaczonym zakresem (MinValue - MaxValue) */
|
|
40
|
+
addOnValueOutOfRange: (callback: () => void) => void;
|
|
41
|
+
/** Wielkość histerezy (dokładność 0.1°C) określająca czułość, przy której następuje wygenerowanie zdarzeń: OnValueChange, OnValueLower, OnValueRise */
|
|
42
|
+
threshold: number;
|
|
43
|
+
/** Czas (w ms) dla którego próbkowane wartości są uśredniane */
|
|
44
|
+
sensitivity: number;
|
|
45
|
+
/** Minimalna wartość cechy Value, której przekroczenie wywołuje zdarzenie OnOutOfRange */
|
|
46
|
+
minValue: number;
|
|
47
|
+
/** Maksymalna wartość cechy Value, której przekroczenie wywołuje zdarzenie OnOutOfRange */
|
|
48
|
+
maxValue: number;
|
|
49
|
+
/** Wartość wejścia w zakresie od 0.0 do 40.0 (°C) */
|
|
50
|
+
readonly value: number;
|
|
51
|
+
/** Włącza raportowanie pomiaru do modułu statystyk */
|
|
52
|
+
statisticState: StatisticState;
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
class PanelSensTempRemote implements IPanelSensTemp {
|
|
56
|
+
constructor(private objectName: string, private gate: RemoteGate) {
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
/** Zdarzenie wywoływane w przypadku zmiany wartości cechy Value */
|
|
60
|
+
addOnValueChange(_callback: () => void): void {
|
|
61
|
+
// Remote events are not supported
|
|
62
|
+
}
|
|
63
|
+
/** Zdarzenie wywoływane przy zmianie wartości na wyższą (zbocze narastające) */
|
|
64
|
+
addOnValueRise(_callback: () => void): void {
|
|
65
|
+
// Remote events are not supported
|
|
66
|
+
}
|
|
67
|
+
/** Zdarzenie wywoływane przy zmianie wartości na niższą (zbocze opadające) */
|
|
68
|
+
addOnValueLower(_callback: () => void): void {
|
|
69
|
+
// Remote events are not supported
|
|
70
|
+
}
|
|
71
|
+
/** Zdarzenie wywoływane, gdy wartość na wyjściu znajduje się poza wyznaczonym zakresem (MinValue - MaxValue) */
|
|
72
|
+
addOnValueOutOfRange(_callback: () => void): void {
|
|
73
|
+
// Remote events are not supported
|
|
74
|
+
}
|
|
75
|
+
/** Wielkość histerezy (dokładność 0.1°C) określająca czułość, przy której następuje wygenerowanie zdarzeń: OnValueChange, OnValueLower, OnValueRise */
|
|
76
|
+
get threshold(): number {
|
|
77
|
+
const cmd: string | null = rawExecutionBuilderFactory(this.objectName)
|
|
78
|
+
.get()
|
|
79
|
+
.addParameter(PropertyType.Threshold)
|
|
80
|
+
.build();
|
|
81
|
+
return this.gate.runScript(cmd!);
|
|
82
|
+
}
|
|
83
|
+
set threshold(value: number) {
|
|
84
|
+
const cmd: string | null = rawExecutionBuilderFactory(this.objectName)
|
|
85
|
+
.set()
|
|
86
|
+
.addParameter(PropertyType.Threshold)
|
|
87
|
+
.addParameter(value)
|
|
88
|
+
.build();
|
|
89
|
+
this.gate.runScript(cmd!);
|
|
90
|
+
}
|
|
91
|
+
/** Czas (w ms) dla którego próbkowane wartości są uśredniane */
|
|
92
|
+
get sensitivity(): number {
|
|
93
|
+
const cmd: string | null = rawExecutionBuilderFactory(this.objectName)
|
|
94
|
+
.get()
|
|
95
|
+
.addParameter(PropertyType.Sensitivity)
|
|
96
|
+
.build();
|
|
97
|
+
return this.gate.runScript(cmd!);
|
|
98
|
+
}
|
|
99
|
+
set sensitivity(value: number) {
|
|
100
|
+
const cmd: string | null = rawExecutionBuilderFactory(this.objectName)
|
|
101
|
+
.set()
|
|
102
|
+
.addParameter(PropertyType.Sensitivity)
|
|
103
|
+
.addParameter(value)
|
|
104
|
+
.build();
|
|
105
|
+
this.gate.runScript(cmd!);
|
|
106
|
+
}
|
|
107
|
+
/** Minimalna wartość cechy Value, której przekroczenie wywołuje zdarzenie OnOutOfRange */
|
|
108
|
+
get minValue(): number {
|
|
109
|
+
const cmd: string | null = rawExecutionBuilderFactory(this.objectName)
|
|
110
|
+
.get()
|
|
111
|
+
.addParameter(PropertyType.MinValue)
|
|
112
|
+
.build();
|
|
113
|
+
return this.gate.runScript(cmd!);
|
|
114
|
+
}
|
|
115
|
+
set minValue(value: number) {
|
|
116
|
+
const cmd: string | null = rawExecutionBuilderFactory(this.objectName)
|
|
117
|
+
.set()
|
|
118
|
+
.addParameter(PropertyType.MinValue)
|
|
119
|
+
.addParameter(value)
|
|
120
|
+
.build();
|
|
121
|
+
this.gate.runScript(cmd!);
|
|
122
|
+
}
|
|
123
|
+
/** Maksymalna wartość cechy Value, której przekroczenie wywołuje zdarzenie OnOutOfRange */
|
|
124
|
+
get maxValue(): number {
|
|
125
|
+
const cmd: string | null = rawExecutionBuilderFactory(this.objectName)
|
|
126
|
+
.get()
|
|
127
|
+
.addParameter(PropertyType.MaxValue)
|
|
128
|
+
.build();
|
|
129
|
+
return this.gate.runScript(cmd!);
|
|
130
|
+
}
|
|
131
|
+
set maxValue(value: number) {
|
|
132
|
+
const cmd: string | null = rawExecutionBuilderFactory(this.objectName)
|
|
133
|
+
.set()
|
|
134
|
+
.addParameter(PropertyType.MaxValue)
|
|
135
|
+
.addParameter(value)
|
|
136
|
+
.build();
|
|
137
|
+
this.gate.runScript(cmd!);
|
|
138
|
+
}
|
|
139
|
+
/** Wartość wejścia w zakresie od 0.0 do 40.0 (°C) */
|
|
140
|
+
get value(): number {
|
|
141
|
+
const cmd: string | null = rawExecutionBuilderFactory(this.objectName)
|
|
142
|
+
.get()
|
|
143
|
+
.addParameter(PropertyType.Value)
|
|
144
|
+
.build();
|
|
145
|
+
return this.gate.runScript(cmd!);
|
|
146
|
+
}
|
|
147
|
+
/** Włącza raportowanie pomiaru do modułu statystyk */
|
|
148
|
+
get statisticState(): StatisticState {
|
|
149
|
+
const cmd: string | null = rawExecutionBuilderFactory(this.objectName)
|
|
150
|
+
.get()
|
|
151
|
+
.addParameter(PropertyType.StatisticState)
|
|
152
|
+
.build();
|
|
153
|
+
return this.gate.runScript(cmd!);
|
|
154
|
+
}
|
|
155
|
+
set statisticState(value: StatisticState) {
|
|
156
|
+
const cmd: string | null = rawExecutionBuilderFactory(this.objectName)
|
|
157
|
+
.set()
|
|
158
|
+
.addParameter(PropertyType.StatisticState)
|
|
159
|
+
.addParameter(value)
|
|
160
|
+
.build();
|
|
161
|
+
this.gate.runScript(cmd!);
|
|
162
|
+
}
|
|
163
|
+
}
|
|
164
|
+
|
|
165
|
+
class PanelSensTemp implements IPanelSensTemp {
|
|
166
|
+
private sensTemp: PanelSensTempRaw
|
|
167
|
+
private onValueChangeCallbacks: Array<() => void> = [];
|
|
168
|
+
private onValueRiseCallbacks: Array<() => void> = [];
|
|
169
|
+
private onValueLowerCallbacks: Array<() => void> = [];
|
|
170
|
+
private onValueOutOfRangeCallbacks: Array<() => void> = [];
|
|
171
|
+
|
|
172
|
+
constructor(sensTemp: PanelSensTempRaw){
|
|
173
|
+
this.sensTemp = sensTemp;
|
|
174
|
+
|
|
175
|
+
this.sensTemp.addEvent(EventType.OnValueChange, () => {
|
|
176
|
+
this.onValueChangeCallbacks.forEach(callback => {
|
|
177
|
+
callback();
|
|
178
|
+
});
|
|
179
|
+
});
|
|
180
|
+
|
|
181
|
+
this.sensTemp.addEvent(EventType.OnValueRise, () => {
|
|
182
|
+
this.onValueRiseCallbacks.forEach(callback => {
|
|
183
|
+
callback();
|
|
184
|
+
});
|
|
185
|
+
});
|
|
186
|
+
|
|
187
|
+
this.sensTemp.addEvent(EventType.OnValueLower, () => {
|
|
188
|
+
this.onValueLowerCallbacks.forEach(callback => {
|
|
189
|
+
callback();
|
|
190
|
+
});
|
|
191
|
+
});
|
|
192
|
+
|
|
193
|
+
this.sensTemp.addEvent(EventType.OnOutOfRange, () => {
|
|
194
|
+
this.onValueOutOfRangeCallbacks.forEach(callback => {
|
|
195
|
+
callback();
|
|
196
|
+
});
|
|
197
|
+
});
|
|
198
|
+
}
|
|
199
|
+
|
|
200
|
+
/** Zdarzenie wywoływane w przypadku zmiany wartości cechy Value */
|
|
201
|
+
addOnValueChange(callback: () => void): void {
|
|
202
|
+
this.onValueChangeCallbacks.push(callback);
|
|
203
|
+
}
|
|
204
|
+
/** Zdarzenie wywoływane przy zmianie wartości na wyższą (zbocze narastające) */
|
|
205
|
+
addOnValueRise(callback: () => void): void {
|
|
206
|
+
this.onValueRiseCallbacks.push(callback);
|
|
207
|
+
}
|
|
208
|
+
/** Zdarzenie wywoływane przy zmianie wartości na niższą (zbocze opadające) */
|
|
209
|
+
addOnValueLower(callback: () => void): void {
|
|
210
|
+
this.onValueLowerCallbacks.push(callback);
|
|
211
|
+
}
|
|
212
|
+
/** Zdarzenie wywoływane, gdy wartość na wyjściu znajduje się poza wyznaczonym zakresem (MinValue - MaxValue) */
|
|
213
|
+
addOnValueOutOfRange(callback: () => void): void {
|
|
214
|
+
this.onValueOutOfRangeCallbacks.push(callback);
|
|
215
|
+
}
|
|
216
|
+
/** Wielkość histerezy (dokładność 0.1°C) określająca czułość, przy której następuje wygenerowanie zdarzeń: OnValueChange, OnValueLower, OnValueRise */
|
|
217
|
+
get threshold(): number {
|
|
218
|
+
return this.sensTemp.get(PropertyType.Threshold);
|
|
219
|
+
}
|
|
220
|
+
set threshold(value: number) {
|
|
221
|
+
this.sensTemp.set(PropertyType.Threshold, value);
|
|
222
|
+
}
|
|
223
|
+
/** Czas (w ms) dla którego próbkowane wartości są uśredniane */
|
|
224
|
+
get sensitivity(): number {
|
|
225
|
+
return this.sensTemp.get(PropertyType.Sensitivity);
|
|
226
|
+
}
|
|
227
|
+
set sensitivity(value: number) {
|
|
228
|
+
this.sensTemp.set(PropertyType.Sensitivity, value);
|
|
229
|
+
}
|
|
230
|
+
/** Minimalna wartość cechy Value, której przekroczenie wywołuje zdarzenie OnOutOfRange */
|
|
231
|
+
get minValue(): number {
|
|
232
|
+
return this.sensTemp.get(PropertyType.MinValue);
|
|
233
|
+
}
|
|
234
|
+
set minValue(value: number) {
|
|
235
|
+
this.sensTemp.set(PropertyType.MinValue, value);
|
|
236
|
+
}
|
|
237
|
+
/** Maksymalna wartość cechy Value, której przekroczenie wywołuje zdarzenie OnOutOfRange */
|
|
238
|
+
get maxValue(): number {
|
|
239
|
+
return this.sensTemp.get(PropertyType.MaxValue);
|
|
240
|
+
}
|
|
241
|
+
set maxValue(value: number) {
|
|
242
|
+
this.sensTemp.set(PropertyType.MaxValue, value);
|
|
243
|
+
}
|
|
244
|
+
/** Wartość wejścia w zakresie od 0.0 do 40.0 (°C) */
|
|
245
|
+
get value(): number {
|
|
246
|
+
return this.sensTemp.get(PropertyType.Value);
|
|
247
|
+
}
|
|
248
|
+
/** Włącza raportowanie pomiaru do modułu statystyk */
|
|
249
|
+
get statisticState(): StatisticState {
|
|
250
|
+
return this.sensTemp.get(PropertyType.StatisticState);
|
|
251
|
+
}
|
|
252
|
+
set statisticState(value: StatisticState) {
|
|
253
|
+
this.sensTemp.set(PropertyType.StatisticState, value);
|
|
254
|
+
}
|
|
255
|
+
}
|
|
256
|
+
|
|
257
|
+
export { PanelSensTemp, PanelSensTempRaw, PanelSensTempRemote, StatisticState }
|
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
// Created from: packages/grenton-api/interfaces/module_2_0_TOUCH_PANEL_FM_4_fv01_02.xml, object name="PANEL" version="01.02"
|
|
2
|
+
|
|
3
|
+
import { rawExecutionBuilderFactory } from "../../core/execution-builder"
|
|
4
|
+
import { RemoteGate } from "../../core/remote-gate"
|
|
5
|
+
|
|
6
|
+
enum PropertyType {
|
|
7
|
+
BuzzerValue = 13,
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
enum BuzzerValueType {
|
|
11
|
+
Off = 0,
|
|
12
|
+
On = 1,
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
declare class PanelRaw {
|
|
16
|
+
get(property: PropertyType): any;
|
|
17
|
+
set(property: PropertyType, value: any): void;
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
interface IPanel {
|
|
21
|
+
/** Sterowanie sygnalizacją dźwiękową: 0 - Off, 1 - On */
|
|
22
|
+
readonly buzzerValue: BuzzerValueType
|
|
23
|
+
/**
|
|
24
|
+
* Ustawia wartość BuzzerValue: 0 - Off, 1 - On
|
|
25
|
+
* @param {BuzzerValueType} value
|
|
26
|
+
*/
|
|
27
|
+
setBuzzerValue: (value: BuzzerValueType) => void
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
class PanelRemote implements IPanel {
|
|
31
|
+
constructor(private objectName: string, private gate: RemoteGate) {
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
/** Sterowanie sygnalizacją dźwiękową: 0 - Off, 1 - On */
|
|
35
|
+
get buzzerValue(): BuzzerValueType {
|
|
36
|
+
const cmd: string | null = rawExecutionBuilderFactory(this.objectName)
|
|
37
|
+
.get()
|
|
38
|
+
.addParameter(PropertyType.BuzzerValue)
|
|
39
|
+
.build();
|
|
40
|
+
return this.gate.runScript(cmd!);
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
/**
|
|
44
|
+
* Ustawia wartość BuzzerValue: 0 - Off, 1 - On
|
|
45
|
+
* @param {BuzzerValueType} value
|
|
46
|
+
*/
|
|
47
|
+
setBuzzerValue(value: BuzzerValueType): void {
|
|
48
|
+
const cmd: string | null = rawExecutionBuilderFactory(this.objectName)
|
|
49
|
+
.set()
|
|
50
|
+
.addParameter(PropertyType.BuzzerValue)
|
|
51
|
+
.addParameter(value)
|
|
52
|
+
.build();
|
|
53
|
+
this.gate.runScript(cmd!);
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
class Panel implements IPanel {
|
|
58
|
+
constructor(private raw: PanelRaw) {
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
/** Sterowanie sygnalizacją dźwiękową: 0 - Off, 1 - On */
|
|
62
|
+
get buzzerValue(): BuzzerValueType {
|
|
63
|
+
return this.raw.get(PropertyType.BuzzerValue);
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
/**
|
|
67
|
+
* Ustawia wartość BuzzerValue: 0 - Off, 1 - On
|
|
68
|
+
* @param {BuzzerValueType} value
|
|
69
|
+
*/
|
|
70
|
+
setBuzzerValue(value: BuzzerValueType): void {
|
|
71
|
+
this.raw.set(PropertyType.BuzzerValue, value);
|
|
72
|
+
}
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
export { Panel, PanelRaw, PanelRemote, BuzzerValueType }
|
|
@@ -0,0 +1,322 @@
|
|
|
1
|
+
// Created from: packages/grenton-api/interfaces/module_2_0_TOUCH_PANEL_FM_4_fv01_02.xml, object name="PowerSupplyVoltage" version="01.02"
|
|
2
|
+
|
|
3
|
+
import { rawExecutionBuilderFactory } from "../../core/execution-builder"
|
|
4
|
+
import { RemoteGate } from "../../core/remote-gate"
|
|
5
|
+
|
|
6
|
+
enum EventType {
|
|
7
|
+
OnValueChange = 0,
|
|
8
|
+
OnValueLower = 1,
|
|
9
|
+
OnValueRise = 2,
|
|
10
|
+
OnOutOfRange = 3,
|
|
11
|
+
OnInRange = 6,
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
enum PropertyType {
|
|
15
|
+
Value = 0,
|
|
16
|
+
ValuePercent = 1,
|
|
17
|
+
Sensitivity = 3,
|
|
18
|
+
MinValue = 5,
|
|
19
|
+
MaxValue = 6,
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
declare class PowerSupplyVoltageRaw {
|
|
23
|
+
add_event(event: EventType, callback: () => void): void;
|
|
24
|
+
get(property: PropertyType): any;
|
|
25
|
+
set(property: PropertyType, value: any): void;
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
interface IPowerSupplyVoltage {
|
|
29
|
+
/**
|
|
30
|
+
* Zdarzenie wywoływane przy zmianie wartości napięcia zasilania o wartość cechy Sensitivity
|
|
31
|
+
* @param callback
|
|
32
|
+
*/
|
|
33
|
+
addOnValueChange: (callback: () => void) => void
|
|
34
|
+
/**
|
|
35
|
+
* Zdarzenie wywoływane przy zmianie wartości napięcia zasilania na niższą o wartość cechy Sensitivity (zbocze opadające)
|
|
36
|
+
* @param callback
|
|
37
|
+
*/
|
|
38
|
+
addOnValueLower: (callback: () => void) => void
|
|
39
|
+
/**
|
|
40
|
+
* Zdarzenie wywoływane przy zmianie wartości napięcia zasilania na wyższą o wartość cechy Sensitivity (zbocze narastające)
|
|
41
|
+
* @param callback
|
|
42
|
+
*/
|
|
43
|
+
addOnValueRise: (callback: () => void) => void
|
|
44
|
+
/**
|
|
45
|
+
* Zdarzenie wywoływane gdy wartość napięcia zasilania znajduje się poza wyznaczonym zakresem (MinValue - MaxValue)
|
|
46
|
+
* @param callback
|
|
47
|
+
*/
|
|
48
|
+
addOnOutOfRange: (callback: () => void) => void
|
|
49
|
+
/**
|
|
50
|
+
* Zdarzenie wywoływane gdy wartość napięcia zasilania powróci do wyznaczonego zakresu (MinValue - MaxValue)
|
|
51
|
+
* @param callback
|
|
52
|
+
*/
|
|
53
|
+
addOnInRange: (callback: () => void) => void
|
|
54
|
+
/** Wartość napięcia zasilania */
|
|
55
|
+
readonly value: number
|
|
56
|
+
/** Wartość napięcia zasilania jako procent wartości maksymalnej (MaxValue) */
|
|
57
|
+
readonly valuePercent: number
|
|
58
|
+
/** Czułość - minimalna zmiana wartości napięcia zasilania, która wywołuje zdarzenia OnValueChange, OnValueLower lub OnValueRise */
|
|
59
|
+
sensitivity: number
|
|
60
|
+
/**
|
|
61
|
+
* Ustawia czułość pomiaru napięcia zasilania
|
|
62
|
+
* @param {number} value
|
|
63
|
+
*/
|
|
64
|
+
setSensitivity: (value: number) => void
|
|
65
|
+
/** Wartość minimalna napięcia zasilania po przekroczeniu której generowane jest zdarzenie OnOutOfRange */
|
|
66
|
+
minValue: number
|
|
67
|
+
/**
|
|
68
|
+
* Ustawia wartość MinValue
|
|
69
|
+
* @param {number} value
|
|
70
|
+
*/
|
|
71
|
+
setMinValue: (value: number) => void
|
|
72
|
+
/** Wartość maksymalna napięcia zasilania po przekroczeniu której generowane jest zdarzenie OnOutOfRange */
|
|
73
|
+
maxValue: number
|
|
74
|
+
/**
|
|
75
|
+
* Ustawia wartość MaxValue
|
|
76
|
+
* @param {number} value
|
|
77
|
+
*/
|
|
78
|
+
setMaxValue: (value: number) => void
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
class PowerSupplyVoltageRemote implements IPowerSupplyVoltage {
|
|
82
|
+
constructor(private objectName: string, private gate: RemoteGate) {
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
addOnValueChange(_callback: () => void): void {
|
|
86
|
+
// Remote events are not supported
|
|
87
|
+
}
|
|
88
|
+
addOnValueLower(_callback: () => void): void {
|
|
89
|
+
// Remote events are not supported
|
|
90
|
+
}
|
|
91
|
+
addOnValueRise(_callback: () => void): void {
|
|
92
|
+
// Remote events are not supported
|
|
93
|
+
}
|
|
94
|
+
addOnOutOfRange(_callback: () => void): void {
|
|
95
|
+
// Remote events are not supported
|
|
96
|
+
}
|
|
97
|
+
addOnInRange(_callback: () => void): void {
|
|
98
|
+
// Remote events are not supported
|
|
99
|
+
}
|
|
100
|
+
|
|
101
|
+
/** Wartość napięcia zasilania */
|
|
102
|
+
get value(): number {
|
|
103
|
+
const cmd: string | null = rawExecutionBuilderFactory(this.objectName)
|
|
104
|
+
.get()
|
|
105
|
+
.addParameter(PropertyType.Value)
|
|
106
|
+
.build();
|
|
107
|
+
return this.gate.runScript(cmd!);
|
|
108
|
+
}
|
|
109
|
+
|
|
110
|
+
/** Wartość napięcia zasilania jako procent wartości maksymalnej (MaxValue) */
|
|
111
|
+
get valuePercent(): number {
|
|
112
|
+
const cmd: string | null = rawExecutionBuilderFactory(this.objectName)
|
|
113
|
+
.get()
|
|
114
|
+
.addParameter(PropertyType.ValuePercent)
|
|
115
|
+
.build();
|
|
116
|
+
return this.gate.runScript(cmd!);
|
|
117
|
+
}
|
|
118
|
+
|
|
119
|
+
/** Czułość - minimalna zmiana wartości napięcia zasilania, która wywołuje zdarzenia OnValueChange, OnValueLower lub OnValueRise */
|
|
120
|
+
get sensitivity(): number {
|
|
121
|
+
const cmd: string | null = rawExecutionBuilderFactory(this.objectName)
|
|
122
|
+
.get()
|
|
123
|
+
.addParameter(PropertyType.Sensitivity)
|
|
124
|
+
.build();
|
|
125
|
+
return this.gate.runScript(cmd!);
|
|
126
|
+
}
|
|
127
|
+
set sensitivity(value: number) {
|
|
128
|
+
const cmd: string | null = rawExecutionBuilderFactory(this.objectName)
|
|
129
|
+
.set()
|
|
130
|
+
.addParameter(PropertyType.Sensitivity)
|
|
131
|
+
.addParameter(value)
|
|
132
|
+
.build();
|
|
133
|
+
this.gate.runScript(cmd!);
|
|
134
|
+
}
|
|
135
|
+
|
|
136
|
+
/**
|
|
137
|
+
* Ustawia czułość pomiaru napięcia zasilania
|
|
138
|
+
* @param {number} value
|
|
139
|
+
*/
|
|
140
|
+
setSensitivity(value: number): void {
|
|
141
|
+
const cmd: string | null = rawExecutionBuilderFactory(this.objectName)
|
|
142
|
+
.set()
|
|
143
|
+
.addParameter(PropertyType.Sensitivity)
|
|
144
|
+
.addParameter(value)
|
|
145
|
+
.build();
|
|
146
|
+
this.gate.runScript(cmd!);
|
|
147
|
+
}
|
|
148
|
+
|
|
149
|
+
/** Wartość minimalna napięcia zasilania po przekroczeniu której generowane jest zdarzenie OnOutOfRange */
|
|
150
|
+
get minValue(): number {
|
|
151
|
+
const cmd: string | null = rawExecutionBuilderFactory(this.objectName)
|
|
152
|
+
.get()
|
|
153
|
+
.addParameter(PropertyType.MinValue)
|
|
154
|
+
.build();
|
|
155
|
+
return this.gate.runScript(cmd!);
|
|
156
|
+
}
|
|
157
|
+
set minValue(value: number) {
|
|
158
|
+
const cmd: string | null = rawExecutionBuilderFactory(this.objectName)
|
|
159
|
+
.set()
|
|
160
|
+
.addParameter(PropertyType.MinValue)
|
|
161
|
+
.addParameter(value)
|
|
162
|
+
.build();
|
|
163
|
+
this.gate.runScript(cmd!);
|
|
164
|
+
}
|
|
165
|
+
|
|
166
|
+
/**
|
|
167
|
+
* Ustawia wartość MinValue
|
|
168
|
+
* @param {number} value
|
|
169
|
+
*/
|
|
170
|
+
setMinValue(value: number): void {
|
|
171
|
+
const cmd: string | null = rawExecutionBuilderFactory(this.objectName)
|
|
172
|
+
.set()
|
|
173
|
+
.addParameter(PropertyType.MinValue)
|
|
174
|
+
.addParameter(value)
|
|
175
|
+
.build();
|
|
176
|
+
this.gate.runScript(cmd!);
|
|
177
|
+
}
|
|
178
|
+
|
|
179
|
+
/** Wartość maksymalna napięcia zasilania po przekroczeniu której generowane jest zdarzenie OnOutOfRange */
|
|
180
|
+
get maxValue(): number {
|
|
181
|
+
const cmd: string | null = rawExecutionBuilderFactory(this.objectName)
|
|
182
|
+
.get()
|
|
183
|
+
.addParameter(PropertyType.MaxValue)
|
|
184
|
+
.build();
|
|
185
|
+
return this.gate.runScript(cmd!);
|
|
186
|
+
}
|
|
187
|
+
set maxValue(value: number) {
|
|
188
|
+
const cmd: string | null = rawExecutionBuilderFactory(this.objectName)
|
|
189
|
+
.set()
|
|
190
|
+
.addParameter(PropertyType.MaxValue)
|
|
191
|
+
.addParameter(value)
|
|
192
|
+
.build();
|
|
193
|
+
this.gate.runScript(cmd!);
|
|
194
|
+
}
|
|
195
|
+
|
|
196
|
+
/**
|
|
197
|
+
* Ustawia wartość MaxValue
|
|
198
|
+
* @param {number} value
|
|
199
|
+
*/
|
|
200
|
+
setMaxValue(value: number): void {
|
|
201
|
+
const cmd: string | null = rawExecutionBuilderFactory(this.objectName)
|
|
202
|
+
.set()
|
|
203
|
+
.addParameter(PropertyType.MaxValue)
|
|
204
|
+
.addParameter(value)
|
|
205
|
+
.build();
|
|
206
|
+
this.gate.runScript(cmd!);
|
|
207
|
+
}
|
|
208
|
+
}
|
|
209
|
+
|
|
210
|
+
class PowerSupplyVoltage implements IPowerSupplyVoltage {
|
|
211
|
+
private onValueChangeCallbacks: Array<() => void> = [];
|
|
212
|
+
private onValueLowerCallbacks: Array<() => void> = [];
|
|
213
|
+
private onValueRiseCallbacks: Array<() => void> = [];
|
|
214
|
+
private onOutOfRangeCallbacks: Array<() => void> = [];
|
|
215
|
+
private onInRangeCallbacks: Array<() => void> = [];
|
|
216
|
+
|
|
217
|
+
constructor(private raw: PowerSupplyVoltageRaw) {
|
|
218
|
+
this.raw.add_event(EventType.OnValueChange, () => {
|
|
219
|
+
this.onValueChangeCallbacks.forEach(callback => { callback(); });
|
|
220
|
+
});
|
|
221
|
+
this.raw.add_event(EventType.OnValueLower, () => {
|
|
222
|
+
this.onValueLowerCallbacks.forEach(callback => { callback(); });
|
|
223
|
+
});
|
|
224
|
+
this.raw.add_event(EventType.OnValueRise, () => {
|
|
225
|
+
this.onValueRiseCallbacks.forEach(callback => { callback(); });
|
|
226
|
+
});
|
|
227
|
+
this.raw.add_event(EventType.OnOutOfRange, () => {
|
|
228
|
+
this.onOutOfRangeCallbacks.forEach(callback => { callback(); });
|
|
229
|
+
});
|
|
230
|
+
this.raw.add_event(EventType.OnInRange, () => {
|
|
231
|
+
this.onInRangeCallbacks.forEach(callback => { callback(); });
|
|
232
|
+
});
|
|
233
|
+
}
|
|
234
|
+
|
|
235
|
+
/**
|
|
236
|
+
* Zdarzenie wywoływane przy zmianie wartości napięcia zasilania o wartość cechy Sensitivity
|
|
237
|
+
* @param callback
|
|
238
|
+
*/
|
|
239
|
+
addOnValueChange(callback: () => void): void {
|
|
240
|
+
this.onValueChangeCallbacks.push(callback);
|
|
241
|
+
}
|
|
242
|
+
/**
|
|
243
|
+
* Zdarzenie wywoływane przy zmianie wartości napięcia zasilania na niższą o wartość cechy Sensitivity (zbocze opadające)
|
|
244
|
+
* @param callback
|
|
245
|
+
*/
|
|
246
|
+
addOnValueLower(callback: () => void): void {
|
|
247
|
+
this.onValueLowerCallbacks.push(callback);
|
|
248
|
+
}
|
|
249
|
+
/**
|
|
250
|
+
* Zdarzenie wywoływane przy zmianie wartości napięcia zasilania na wyższą o wartość cechy Sensitivity (zbocze narastające)
|
|
251
|
+
* @param callback
|
|
252
|
+
*/
|
|
253
|
+
addOnValueRise(callback: () => void): void {
|
|
254
|
+
this.onValueRiseCallbacks.push(callback);
|
|
255
|
+
}
|
|
256
|
+
/**
|
|
257
|
+
* Zdarzenie wywoływane gdy wartość napięcia zasilania znajduje się poza wyznaczonym zakresem (MinValue - MaxValue)
|
|
258
|
+
* @param callback
|
|
259
|
+
*/
|
|
260
|
+
addOnOutOfRange(callback: () => void): void {
|
|
261
|
+
this.onOutOfRangeCallbacks.push(callback);
|
|
262
|
+
}
|
|
263
|
+
/**
|
|
264
|
+
* Zdarzenie wywoływane gdy wartość napięcia zasilania powróci do wyznaczonego zakresu (MinValue - MaxValue)
|
|
265
|
+
* @param callback
|
|
266
|
+
*/
|
|
267
|
+
addOnInRange(callback: () => void): void {
|
|
268
|
+
this.onInRangeCallbacks.push(callback);
|
|
269
|
+
}
|
|
270
|
+
/** Wartość napięcia zasilania */
|
|
271
|
+
get value(): number {
|
|
272
|
+
return this.raw.get(PropertyType.Value);
|
|
273
|
+
}
|
|
274
|
+
/** Wartość napięcia zasilania jako procent wartości maksymalnej (MaxValue) */
|
|
275
|
+
get valuePercent(): number {
|
|
276
|
+
return this.raw.get(PropertyType.ValuePercent);
|
|
277
|
+
}
|
|
278
|
+
/** Czułość - minimalna zmiana wartości napięcia zasilania, która wywołuje zdarzenia OnValueChange, OnValueLower lub OnValueRise */
|
|
279
|
+
get sensitivity(): number {
|
|
280
|
+
return this.raw.get(PropertyType.Sensitivity);
|
|
281
|
+
}
|
|
282
|
+
set sensitivity(value: number) {
|
|
283
|
+
this.raw.set(PropertyType.Sensitivity, value);
|
|
284
|
+
}
|
|
285
|
+
/**
|
|
286
|
+
* Ustawia czułość pomiaru napięcia zasilania
|
|
287
|
+
* @param {number} value
|
|
288
|
+
*/
|
|
289
|
+
setSensitivity(value: number): void {
|
|
290
|
+
this.raw.set(PropertyType.Sensitivity, value);
|
|
291
|
+
}
|
|
292
|
+
/** Wartość minimalna napięcia zasilania po przekroczeniu której generowane jest zdarzenie OnOutOfRange */
|
|
293
|
+
get minValue(): number {
|
|
294
|
+
return this.raw.get(PropertyType.MinValue);
|
|
295
|
+
}
|
|
296
|
+
set minValue(value: number) {
|
|
297
|
+
this.raw.set(PropertyType.MinValue, value);
|
|
298
|
+
}
|
|
299
|
+
/**
|
|
300
|
+
* Ustawia wartość MinValue
|
|
301
|
+
* @param {number} value
|
|
302
|
+
*/
|
|
303
|
+
setMinValue(value: number): void {
|
|
304
|
+
this.raw.set(PropertyType.MinValue, value);
|
|
305
|
+
}
|
|
306
|
+
/** Wartość maksymalna napięcia zasilania po przekroczeniu której generowane jest zdarzenie OnOutOfRange */
|
|
307
|
+
get maxValue(): number {
|
|
308
|
+
return this.raw.get(PropertyType.MaxValue);
|
|
309
|
+
}
|
|
310
|
+
set maxValue(value: number) {
|
|
311
|
+
this.raw.set(PropertyType.MaxValue, value);
|
|
312
|
+
}
|
|
313
|
+
/**
|
|
314
|
+
* Ustawia wartość MaxValue
|
|
315
|
+
* @param {number} value
|
|
316
|
+
*/
|
|
317
|
+
setMaxValue(value: number): void {
|
|
318
|
+
this.raw.set(PropertyType.MaxValue, value);
|
|
319
|
+
}
|
|
320
|
+
}
|
|
321
|
+
|
|
322
|
+
export { PowerSupplyVoltage, PowerSupplyVoltageRaw, PowerSupplyVoltageRemote }
|