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,261 @@
|
|
|
1
|
+
// Created from: packages/grenton-api/interfaces/object_push_v1.xml, object name="Push" version="1"
|
|
2
|
+
|
|
3
|
+
import { rawExecutionBuilderFactory } from "../../../core/execution-builder"
|
|
4
|
+
import { RemoteGate } from "../../../core/remote-gate"
|
|
5
|
+
|
|
6
|
+
enum EventType {
|
|
7
|
+
OnSend = 0,
|
|
8
|
+
OnOverflow = 1
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
enum PropertyType {
|
|
12
|
+
Message = 0,
|
|
13
|
+
Title = 1,
|
|
14
|
+
LastSendTime = 2,
|
|
15
|
+
Interval = 3
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
enum MethodType {
|
|
19
|
+
ClearMessage = 1,
|
|
20
|
+
ClearTitle = 3,
|
|
21
|
+
Send = 4
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
declare class PushRaw {
|
|
25
|
+
add_event(event: EventType, callback: () => void): void;
|
|
26
|
+
get(property: PropertyType): any;
|
|
27
|
+
set(property: PropertyType, value: any): void;
|
|
28
|
+
execute(method: MethodType, ...args: any[]): any;
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
interface IPush {
|
|
32
|
+
/**
|
|
33
|
+
* Zdarzenie wywoływane przy wysłaniu notyfikacji
|
|
34
|
+
* @param callback
|
|
35
|
+
*/
|
|
36
|
+
addOnSend: (callback: () => void) => void
|
|
37
|
+
/**
|
|
38
|
+
* Zdarzenie wywoływane przy przepełnieniu kolejki
|
|
39
|
+
* @param callback
|
|
40
|
+
*/
|
|
41
|
+
addOnOverflow: (callback: () => void) => void
|
|
42
|
+
/** Czyści bufor wyjściowy (skrzynkę nadawczą) */
|
|
43
|
+
clearMessage: () => void
|
|
44
|
+
/** Czyści bufor tytułu */
|
|
45
|
+
clearTitle: () => void
|
|
46
|
+
/** Wysyła powiadomienie */
|
|
47
|
+
send: () => void
|
|
48
|
+
/** Buffor wyjściowy dla notyfikacji push (skrzynka nadawcza) */
|
|
49
|
+
message: string
|
|
50
|
+
/** Buffor wyjściowy dla tytułu notyfikacji push (skrzynka nadawcza) */
|
|
51
|
+
title: string
|
|
52
|
+
/** Czas wysłania ostatniej notyfikacji push */
|
|
53
|
+
readonly lastSendTime: string
|
|
54
|
+
/** Interwał pomiędzy kolejnymi notyfikacjami */
|
|
55
|
+
interval: number
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
class Push implements IPush {
|
|
59
|
+
private onSendCallbacks: Array<() => void> = [];
|
|
60
|
+
private onOverflowCallbacks: Array<() => void> = [];
|
|
61
|
+
|
|
62
|
+
constructor(private raw: PushRaw) {
|
|
63
|
+
this.raw.add_event(EventType.OnSend, () => {
|
|
64
|
+
this.onSendCallbacks.forEach(callback => { callback(); });
|
|
65
|
+
});
|
|
66
|
+
this.raw.add_event(EventType.OnOverflow, () => {
|
|
67
|
+
this.onOverflowCallbacks.forEach(callback => { callback(); });
|
|
68
|
+
});
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
/**
|
|
72
|
+
* Zdarzenie wywoływane przy wysłaniu notyfikacji
|
|
73
|
+
* @param callback
|
|
74
|
+
*/
|
|
75
|
+
addOnSend(callback: () => void): void {
|
|
76
|
+
this.onSendCallbacks.push(callback);
|
|
77
|
+
}
|
|
78
|
+
/**
|
|
79
|
+
* Zdarzenie wywoływane przy przepełnieniu kolejki
|
|
80
|
+
* @param callback
|
|
81
|
+
*/
|
|
82
|
+
addOnOverflow(callback: () => void): void {
|
|
83
|
+
this.onOverflowCallbacks.push(callback);
|
|
84
|
+
}
|
|
85
|
+
/** Czyści bufor wyjściowy (skrzynkę nadawczą) */
|
|
86
|
+
clearMessage(): void {
|
|
87
|
+
this.raw.execute(MethodType.ClearMessage);
|
|
88
|
+
}
|
|
89
|
+
/** Czyści bufor tytułu */
|
|
90
|
+
clearTitle(): void {
|
|
91
|
+
this.raw.execute(MethodType.ClearTitle);
|
|
92
|
+
}
|
|
93
|
+
/** Wysyła powiadomienie */
|
|
94
|
+
send(): void {
|
|
95
|
+
this.raw.execute(MethodType.Send);
|
|
96
|
+
}
|
|
97
|
+
/**
|
|
98
|
+
* Buffor wyjściowy dla notyfikacji push (skrzynka nadawcza)
|
|
99
|
+
* @returns {string}
|
|
100
|
+
*/
|
|
101
|
+
get message(): string {
|
|
102
|
+
return this.raw.get(PropertyType.Message);
|
|
103
|
+
}
|
|
104
|
+
set message(value: string) {
|
|
105
|
+
this.raw.set(PropertyType.Message, value);
|
|
106
|
+
}
|
|
107
|
+
/**
|
|
108
|
+
* Buffor wyjściowy dla tytułu notyfikacji push (skrzynka nadawcza)
|
|
109
|
+
* @returns {string}
|
|
110
|
+
*/
|
|
111
|
+
get title(): string {
|
|
112
|
+
return this.raw.get(PropertyType.Title);
|
|
113
|
+
}
|
|
114
|
+
set title(value: string) {
|
|
115
|
+
this.raw.set(PropertyType.Title, value);
|
|
116
|
+
}
|
|
117
|
+
/**
|
|
118
|
+
* Czas wysłania ostatniej notyfikacji push
|
|
119
|
+
* @returns {string}
|
|
120
|
+
*/
|
|
121
|
+
get lastSendTime(): string {
|
|
122
|
+
return this.raw.get(PropertyType.LastSendTime);
|
|
123
|
+
}
|
|
124
|
+
/**
|
|
125
|
+
* Interwał pomiędzy kolejnymi notyfikacjami
|
|
126
|
+
* @returns {number}
|
|
127
|
+
*/
|
|
128
|
+
get interval(): number {
|
|
129
|
+
return this.raw.get(PropertyType.Interval);
|
|
130
|
+
}
|
|
131
|
+
set interval(value: number) {
|
|
132
|
+
this.raw.set(PropertyType.Interval, value);
|
|
133
|
+
}
|
|
134
|
+
}
|
|
135
|
+
|
|
136
|
+
class PushRemote implements IPush {
|
|
137
|
+
constructor(private objectName: string, private gate: RemoteGate) {
|
|
138
|
+
|
|
139
|
+
}
|
|
140
|
+
|
|
141
|
+
/**
|
|
142
|
+
* Zdarzenie wywoływane przy wysłaniu notyfikacji
|
|
143
|
+
* @param callback
|
|
144
|
+
*/
|
|
145
|
+
addOnSend(_callback: () => void): void {
|
|
146
|
+
// Remote events are not supported
|
|
147
|
+
}
|
|
148
|
+
/**
|
|
149
|
+
* Zdarzenie wywoływane przy przepełnieniu kolejki
|
|
150
|
+
* @param callback
|
|
151
|
+
*/
|
|
152
|
+
addOnOverflow(_callback: () => void): void {
|
|
153
|
+
// Remote events are not supported
|
|
154
|
+
}
|
|
155
|
+
|
|
156
|
+
/** Czyści bufor wyjściowy (skrzynkę nadawczą) */
|
|
157
|
+
clearMessage(): void {
|
|
158
|
+
const cmd: string | null = rawExecutionBuilderFactory(this.objectName)
|
|
159
|
+
.execute()
|
|
160
|
+
.addParameter(MethodType.ClearMessage)
|
|
161
|
+
.build();
|
|
162
|
+
this.gate.runScript(cmd!);
|
|
163
|
+
}
|
|
164
|
+
|
|
165
|
+
/** Czyści bufor tytułu */
|
|
166
|
+
clearTitle(): void {
|
|
167
|
+
const cmd: string | null = rawExecutionBuilderFactory(this.objectName)
|
|
168
|
+
.execute()
|
|
169
|
+
.addParameter(MethodType.ClearTitle)
|
|
170
|
+
.build();
|
|
171
|
+
this.gate.runScript(cmd!);
|
|
172
|
+
}
|
|
173
|
+
|
|
174
|
+
/** Wysyła powiadomienie */
|
|
175
|
+
send(): void {
|
|
176
|
+
const cmd: string | null = rawExecutionBuilderFactory(this.objectName)
|
|
177
|
+
.execute()
|
|
178
|
+
.addParameter(MethodType.Send)
|
|
179
|
+
.build();
|
|
180
|
+
this.gate.runScript(cmd!);
|
|
181
|
+
}
|
|
182
|
+
|
|
183
|
+
/**
|
|
184
|
+
* Buffor wyjściowy dla notyfikacji push (skrzynka nadawcza)
|
|
185
|
+
* @returns {string}
|
|
186
|
+
*/
|
|
187
|
+
get message(): string {
|
|
188
|
+
const cmd: string | null = rawExecutionBuilderFactory(this.objectName)
|
|
189
|
+
.get()
|
|
190
|
+
.addParameter(PropertyType.Message)
|
|
191
|
+
.build();
|
|
192
|
+
return this.gate.runScript(cmd!);
|
|
193
|
+
}
|
|
194
|
+
|
|
195
|
+
set message(value: string) {
|
|
196
|
+
const cmd: string | null = rawExecutionBuilderFactory(this.objectName)
|
|
197
|
+
.set()
|
|
198
|
+
.addParameter(PropertyType.Message)
|
|
199
|
+
.addParameter(value)
|
|
200
|
+
.build();
|
|
201
|
+
this.gate.runScript(cmd!);
|
|
202
|
+
}
|
|
203
|
+
|
|
204
|
+
/**
|
|
205
|
+
* Buffor wyjściowy dla tytułu notyfikacji push (skrzynka nadawcza)
|
|
206
|
+
* @returns {string}
|
|
207
|
+
*/
|
|
208
|
+
get title(): string {
|
|
209
|
+
const cmd: string | null = rawExecutionBuilderFactory(this.objectName)
|
|
210
|
+
.get()
|
|
211
|
+
.addParameter(PropertyType.Title)
|
|
212
|
+
.build();
|
|
213
|
+
return this.gate.runScript(cmd!);
|
|
214
|
+
}
|
|
215
|
+
|
|
216
|
+
set title(value: string) {
|
|
217
|
+
const cmd: string | null = rawExecutionBuilderFactory(this.objectName)
|
|
218
|
+
.set()
|
|
219
|
+
.addParameter(PropertyType.Title)
|
|
220
|
+
.addParameter(value)
|
|
221
|
+
.build();
|
|
222
|
+
this.gate.runScript(cmd!);
|
|
223
|
+
}
|
|
224
|
+
|
|
225
|
+
/**
|
|
226
|
+
* Czas wysłania ostatniej notyfikacji push
|
|
227
|
+
* @returns {string}
|
|
228
|
+
*/
|
|
229
|
+
get lastSendTime(): string {
|
|
230
|
+
const cmd: string | null = rawExecutionBuilderFactory(this.objectName)
|
|
231
|
+
.get()
|
|
232
|
+
.addParameter(PropertyType.LastSendTime)
|
|
233
|
+
.build();
|
|
234
|
+
return this.gate.runScript(cmd!);
|
|
235
|
+
}
|
|
236
|
+
|
|
237
|
+
/**
|
|
238
|
+
* Interwał pomiędzy kolejnymi notyfikacjami
|
|
239
|
+
* @returns {number}
|
|
240
|
+
*/
|
|
241
|
+
get interval(): number {
|
|
242
|
+
const cmd: string | null = rawExecutionBuilderFactory(this.objectName)
|
|
243
|
+
.get()
|
|
244
|
+
.addParameter(PropertyType.Interval)
|
|
245
|
+
.build();
|
|
246
|
+
return this.gate.runScript(cmd!);
|
|
247
|
+
}
|
|
248
|
+
|
|
249
|
+
set interval(value: number) {
|
|
250
|
+
const cmd: string | null = rawExecutionBuilderFactory(this.objectName)
|
|
251
|
+
.set()
|
|
252
|
+
.addParameter(PropertyType.Interval)
|
|
253
|
+
.addParameter(value)
|
|
254
|
+
.build();
|
|
255
|
+
this.gate.runScript(cmd!);
|
|
256
|
+
}
|
|
257
|
+
}
|
|
258
|
+
|
|
259
|
+
export {
|
|
260
|
+
Push, PushRaw, PushRemote
|
|
261
|
+
}
|
|
@@ -0,0 +1,304 @@
|
|
|
1
|
+
// Created from: packages/grenton-api/interfaces/object_scheduler_v1.xml, object name="Scheduler" version="1"
|
|
2
|
+
|
|
3
|
+
import { rawExecutionBuilderFactory } from "../../../core/execution-builder"
|
|
4
|
+
import { RemoteGate } from "../../../core/remote-gate"
|
|
5
|
+
|
|
6
|
+
enum EventType {
|
|
7
|
+
OnHarmonogram = 0,
|
|
8
|
+
OnStart = 1,
|
|
9
|
+
OnStop = 2
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
enum PropertyType {
|
|
13
|
+
Data = 0,
|
|
14
|
+
State = 1,
|
|
15
|
+
Value = 2,
|
|
16
|
+
Min = 3,
|
|
17
|
+
Max = 4
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
enum MethodType {
|
|
21
|
+
Start = 0,
|
|
22
|
+
Stop = 1
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
enum StateType {
|
|
26
|
+
Off = 0,
|
|
27
|
+
On = 1
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
declare class SchedulerRaw {
|
|
31
|
+
add_event(event: EventType, callback: () => void): void;
|
|
32
|
+
get(property: PropertyType): any;
|
|
33
|
+
set(property: PropertyType, value: any): void;
|
|
34
|
+
execute(method: MethodType, ...args: any[]): any;
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
interface IScheduler {
|
|
38
|
+
/**
|
|
39
|
+
* Zdarzenie wywoływane co 15 minut zgodnie z harmonogramem
|
|
40
|
+
* @param callback
|
|
41
|
+
*/
|
|
42
|
+
addOnHarmonogram: (callback: () => void) => void
|
|
43
|
+
/**
|
|
44
|
+
* Zdarzenie wywoływane przy wznowieniu pracy
|
|
45
|
+
* @param callback
|
|
46
|
+
*/
|
|
47
|
+
addOnStart: (callback: () => void) => void
|
|
48
|
+
/**
|
|
49
|
+
* Zdarzenie wywoływane przy zatrzymaniu pracy
|
|
50
|
+
* @param callback
|
|
51
|
+
*/
|
|
52
|
+
addOnStop: (callback: () => void) => void
|
|
53
|
+
/** Przełączenie w stan aktywny (State=1) */
|
|
54
|
+
start: () => void
|
|
55
|
+
/** Przełączenie w stan zatrzymania (State=0) */
|
|
56
|
+
stop: () => void
|
|
57
|
+
/** Ciąg znaków definiujący harmonogram zmian wartości */
|
|
58
|
+
data: string
|
|
59
|
+
/** Stan działania harmonogramu: 1 - harmonogram aktywny, 0 - harmonogram nieaktywny */
|
|
60
|
+
readonly state: StateType
|
|
61
|
+
/** Wartość wyjściowa zmieniana co 15 minut zgodnie z harmonogramem */
|
|
62
|
+
readonly value: number
|
|
63
|
+
/** Minimalna wartość dla ustawienia zakresu wartości interfejsu graficznego */
|
|
64
|
+
min: number
|
|
65
|
+
/** Maksymalna wartość dla ustawienia zakresu wartości interfejsu graficznego */
|
|
66
|
+
max: number
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
class Scheduler implements IScheduler {
|
|
70
|
+
private onHarmonogramCallbacks: Array<() => void> = [];
|
|
71
|
+
private onStartCallbacks: Array<() => void> = [];
|
|
72
|
+
private onStopCallbacks: Array<() => void> = [];
|
|
73
|
+
|
|
74
|
+
constructor(private raw: SchedulerRaw) {
|
|
75
|
+
this.raw.add_event(EventType.OnHarmonogram, () => {
|
|
76
|
+
this.onHarmonogramCallbacks.forEach(callback => {
|
|
77
|
+
callback();
|
|
78
|
+
});
|
|
79
|
+
});
|
|
80
|
+
|
|
81
|
+
this.raw.add_event(EventType.OnStart, () => {
|
|
82
|
+
this.onStartCallbacks.forEach(callback => {
|
|
83
|
+
callback();
|
|
84
|
+
});
|
|
85
|
+
});
|
|
86
|
+
|
|
87
|
+
this.raw.add_event(EventType.OnStop, () => {
|
|
88
|
+
this.onStopCallbacks.forEach(callback => {
|
|
89
|
+
callback();
|
|
90
|
+
});
|
|
91
|
+
});
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
/**
|
|
95
|
+
* Zdarzenie wywoływane co 15 minut zgodnie z harmonogramem
|
|
96
|
+
* @param callback
|
|
97
|
+
*/
|
|
98
|
+
addOnHarmonogram(callback: () => void): void {
|
|
99
|
+
this.onHarmonogramCallbacks.push(callback);
|
|
100
|
+
}
|
|
101
|
+
/**
|
|
102
|
+
* Zdarzenie wywoływane przy wznowieniu pracy
|
|
103
|
+
* @param callback
|
|
104
|
+
*/
|
|
105
|
+
addOnStart(callback: () => void): void {
|
|
106
|
+
this.onStartCallbacks.push(callback);
|
|
107
|
+
}
|
|
108
|
+
/**
|
|
109
|
+
* Zdarzenie wywoływane przy zatrzymaniu pracy
|
|
110
|
+
* @param callback
|
|
111
|
+
*/
|
|
112
|
+
addOnStop(callback: () => void): void {
|
|
113
|
+
this.onStopCallbacks.push(callback);
|
|
114
|
+
}
|
|
115
|
+
/** Przełączenie w stan aktywny (State=1) */
|
|
116
|
+
start(): void {
|
|
117
|
+
this.raw.execute(MethodType.Start);
|
|
118
|
+
}
|
|
119
|
+
/** Przełączenie w stan zatrzymania (State=0) */
|
|
120
|
+
stop(): void {
|
|
121
|
+
this.raw.execute(MethodType.Stop);
|
|
122
|
+
}
|
|
123
|
+
/**
|
|
124
|
+
* Ciąg znaków definiujący harmonogram zmian wartości
|
|
125
|
+
* @returns {string}
|
|
126
|
+
*/
|
|
127
|
+
get data(): string {
|
|
128
|
+
return this.raw.get(PropertyType.Data);
|
|
129
|
+
}
|
|
130
|
+
set data(value: string) {
|
|
131
|
+
this.raw.set(PropertyType.Data, value);
|
|
132
|
+
}
|
|
133
|
+
/**
|
|
134
|
+
* Stan działania harmonogramu: 1 - harmonogram aktywny, 0 - harmonogram nieaktywny
|
|
135
|
+
* @returns {StateType}
|
|
136
|
+
*/
|
|
137
|
+
get state(): StateType {
|
|
138
|
+
return this.raw.get(PropertyType.State);
|
|
139
|
+
}
|
|
140
|
+
/**
|
|
141
|
+
* Wartość wyjściowa zmieniana co 15 minut zgodnie z harmonogramem
|
|
142
|
+
* @returns {number}
|
|
143
|
+
*/
|
|
144
|
+
get value(): number {
|
|
145
|
+
return this.raw.get(PropertyType.Value);
|
|
146
|
+
}
|
|
147
|
+
/**
|
|
148
|
+
* Minimalna wartość dla ustawienia zakresu wartości interfejsu graficznego
|
|
149
|
+
* @returns {number}
|
|
150
|
+
*/
|
|
151
|
+
get min(): number {
|
|
152
|
+
return this.raw.get(PropertyType.Min);
|
|
153
|
+
}
|
|
154
|
+
set min(value: number) {
|
|
155
|
+
this.raw.set(PropertyType.Min, value);
|
|
156
|
+
}
|
|
157
|
+
/**
|
|
158
|
+
* Maksymalna wartość dla ustawienia zakresu wartości interfejsu graficznego
|
|
159
|
+
* @returns {number}
|
|
160
|
+
*/
|
|
161
|
+
get max(): number {
|
|
162
|
+
return this.raw.get(PropertyType.Max);
|
|
163
|
+
}
|
|
164
|
+
set max(value: number) {
|
|
165
|
+
this.raw.set(PropertyType.Max, value);
|
|
166
|
+
}
|
|
167
|
+
}
|
|
168
|
+
|
|
169
|
+
class SchedulerRemote implements IScheduler {
|
|
170
|
+
constructor(private objectName: string, private gate: RemoteGate) {
|
|
171
|
+
|
|
172
|
+
}
|
|
173
|
+
|
|
174
|
+
/**
|
|
175
|
+
* Zdarzenie wywoływane co 15 minut zgodnie z harmonogramem
|
|
176
|
+
* @param callback
|
|
177
|
+
*/
|
|
178
|
+
addOnHarmonogram(_callback: () => void): void {
|
|
179
|
+
// Remote events are not supported
|
|
180
|
+
}
|
|
181
|
+
/**
|
|
182
|
+
* Zdarzenie wywoływane przy wznowieniu pracy
|
|
183
|
+
* @param callback
|
|
184
|
+
*/
|
|
185
|
+
addOnStart(_callback: () => void): void {
|
|
186
|
+
// Remote events are not supported
|
|
187
|
+
}
|
|
188
|
+
/**
|
|
189
|
+
* Zdarzenie wywoływane przy zatrzymaniu pracy
|
|
190
|
+
* @param callback
|
|
191
|
+
*/
|
|
192
|
+
addOnStop(_callback: () => void): void {
|
|
193
|
+
// Remote events are not supported
|
|
194
|
+
}
|
|
195
|
+
|
|
196
|
+
/** Przełączenie w stan aktywny (State=1) */
|
|
197
|
+
start(): void {
|
|
198
|
+
const cmd: string | null = rawExecutionBuilderFactory(this.objectName)
|
|
199
|
+
.execute()
|
|
200
|
+
.addParameter(MethodType.Start)
|
|
201
|
+
.build();
|
|
202
|
+
this.gate.runScript(cmd!);
|
|
203
|
+
}
|
|
204
|
+
|
|
205
|
+
/** Przełączenie w stan zatrzymania (State=0) */
|
|
206
|
+
stop(): void {
|
|
207
|
+
const cmd: string | null = rawExecutionBuilderFactory(this.objectName)
|
|
208
|
+
.execute()
|
|
209
|
+
.addParameter(MethodType.Stop)
|
|
210
|
+
.build();
|
|
211
|
+
this.gate.runScript(cmd!);
|
|
212
|
+
}
|
|
213
|
+
|
|
214
|
+
/**
|
|
215
|
+
* Ciąg znaków definiujący harmonogram zmian wartości
|
|
216
|
+
* @returns {string}
|
|
217
|
+
*/
|
|
218
|
+
get data(): string {
|
|
219
|
+
const cmd: string | null = rawExecutionBuilderFactory(this.objectName)
|
|
220
|
+
.get()
|
|
221
|
+
.addParameter(PropertyType.Data)
|
|
222
|
+
.build();
|
|
223
|
+
return this.gate.runScript(cmd!);
|
|
224
|
+
}
|
|
225
|
+
|
|
226
|
+
set data(value: string) {
|
|
227
|
+
const cmd: string | null = rawExecutionBuilderFactory(this.objectName)
|
|
228
|
+
.set()
|
|
229
|
+
.addParameter(PropertyType.Data)
|
|
230
|
+
.addParameter(value)
|
|
231
|
+
.build();
|
|
232
|
+
this.gate.runScript(cmd!);
|
|
233
|
+
}
|
|
234
|
+
|
|
235
|
+
/**
|
|
236
|
+
* Stan działania harmonogramu: 1 - harmonogram aktywny, 0 - harmonogram nieaktywny
|
|
237
|
+
* @returns {StateType}
|
|
238
|
+
*/
|
|
239
|
+
get state(): StateType {
|
|
240
|
+
const cmd: string | null = rawExecutionBuilderFactory(this.objectName)
|
|
241
|
+
.get()
|
|
242
|
+
.addParameter(PropertyType.State)
|
|
243
|
+
.build();
|
|
244
|
+
return this.gate.runScript(cmd!);
|
|
245
|
+
}
|
|
246
|
+
|
|
247
|
+
/**
|
|
248
|
+
* Wartość wyjściowa zmieniana co 15 minut zgodnie z harmonogramem
|
|
249
|
+
* @returns {number}
|
|
250
|
+
*/
|
|
251
|
+
get value(): number {
|
|
252
|
+
const cmd: string | null = rawExecutionBuilderFactory(this.objectName)
|
|
253
|
+
.get()
|
|
254
|
+
.addParameter(PropertyType.Value)
|
|
255
|
+
.build();
|
|
256
|
+
return this.gate.runScript(cmd!);
|
|
257
|
+
}
|
|
258
|
+
|
|
259
|
+
/**
|
|
260
|
+
* Minimalna wartość dla ustawienia zakresu wartości interfejsu graficznego
|
|
261
|
+
* @returns {number}
|
|
262
|
+
*/
|
|
263
|
+
get min(): number {
|
|
264
|
+
const cmd: string | null = rawExecutionBuilderFactory(this.objectName)
|
|
265
|
+
.get()
|
|
266
|
+
.addParameter(PropertyType.Min)
|
|
267
|
+
.build();
|
|
268
|
+
return this.gate.runScript(cmd!);
|
|
269
|
+
}
|
|
270
|
+
|
|
271
|
+
set min(value: number) {
|
|
272
|
+
const cmd: string | null = rawExecutionBuilderFactory(this.objectName)
|
|
273
|
+
.set()
|
|
274
|
+
.addParameter(PropertyType.Min)
|
|
275
|
+
.addParameter(value)
|
|
276
|
+
.build();
|
|
277
|
+
this.gate.runScript(cmd!);
|
|
278
|
+
}
|
|
279
|
+
|
|
280
|
+
/**
|
|
281
|
+
* Maksymalna wartość dla ustawienia zakresu wartości interfejsu graficznego
|
|
282
|
+
* @returns {number}
|
|
283
|
+
*/
|
|
284
|
+
get max(): number {
|
|
285
|
+
const cmd: string | null = rawExecutionBuilderFactory(this.objectName)
|
|
286
|
+
.get()
|
|
287
|
+
.addParameter(PropertyType.Max)
|
|
288
|
+
.build();
|
|
289
|
+
return this.gate.runScript(cmd!);
|
|
290
|
+
}
|
|
291
|
+
|
|
292
|
+
set max(value: number) {
|
|
293
|
+
const cmd: string | null = rawExecutionBuilderFactory(this.objectName)
|
|
294
|
+
.set()
|
|
295
|
+
.addParameter(PropertyType.Max)
|
|
296
|
+
.addParameter(value)
|
|
297
|
+
.build();
|
|
298
|
+
this.gate.runScript(cmd!);
|
|
299
|
+
}
|
|
300
|
+
}
|
|
301
|
+
|
|
302
|
+
export {
|
|
303
|
+
Scheduler, SchedulerRaw, SchedulerRemote, StateType
|
|
304
|
+
}
|