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,240 @@
|
|
|
1
|
+
// Created from: packages/grenton-api/interfaces/object_output_v1.xml, object name="Output" version="1"
|
|
2
|
+
|
|
3
|
+
import { rawExecutionBuilderFactory } from "../../../core/execution-builder"
|
|
4
|
+
import { RemoteGate } from "../../../core/remote-gate"
|
|
5
|
+
|
|
6
|
+
enum EventType {
|
|
7
|
+
OnChange = 0,
|
|
8
|
+
OnSwitchOn = 1,
|
|
9
|
+
OnSwitchOff = 2
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
enum PropertyType {
|
|
13
|
+
Value = 0,
|
|
14
|
+
Nr = 1,
|
|
15
|
+
UserPassword = 2
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
enum MethodType {
|
|
19
|
+
SwitchOn = 0,
|
|
20
|
+
SwitchOff = 1
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
enum ValueType {
|
|
24
|
+
Off = 0,
|
|
25
|
+
On = 1
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
declare class OutputRaw {
|
|
29
|
+
add_event(event: EventType, callback: () => void): void;
|
|
30
|
+
get(property: PropertyType): any;
|
|
31
|
+
set(property: PropertyType, value: any): void;
|
|
32
|
+
execute(method: MethodType, ...args: any[]): any;
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
interface IOutput {
|
|
36
|
+
/**
|
|
37
|
+
* Zdarzenie wywoływane przy zmianie stanu (niezależnie od wartości)
|
|
38
|
+
* @param callback
|
|
39
|
+
*/
|
|
40
|
+
addOnChange: (callback: () => void) => void
|
|
41
|
+
/**
|
|
42
|
+
* Zdarzenie wywoływane przy ustawieniu On na wyjściu
|
|
43
|
+
* @param callback
|
|
44
|
+
*/
|
|
45
|
+
addOnSwitchOn: (callback: () => void) => void
|
|
46
|
+
/**
|
|
47
|
+
* Zdarzenie wywoływane przy ustawieniu Off na wyjściu
|
|
48
|
+
* @param callback
|
|
49
|
+
*/
|
|
50
|
+
addOnSwitchOff: (callback: () => void) => void
|
|
51
|
+
/** Załącza wyjście */
|
|
52
|
+
switchOn: () => void
|
|
53
|
+
/** Wyłącza wyjście */
|
|
54
|
+
switchOff: () => void
|
|
55
|
+
/** Zwraca stan wyjścia: 1 - wyjście załączone, 0 - wyjście wyłączone, -1 - stan wyjścia nieznany (brak połączenia z centralką) */
|
|
56
|
+
readonly value: ValueType
|
|
57
|
+
/** Parametr definiujący, do którego wyjścia odnosi się obiekt */
|
|
58
|
+
nr: number
|
|
59
|
+
/** Hasło użytkownika, dla _ zastosuje hasło administratora */
|
|
60
|
+
userPassword: string
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
class Output implements IOutput {
|
|
64
|
+
private onChangeCallbacks: Array<() => void> = [];
|
|
65
|
+
private onSwitchOnCallbacks: Array<() => void> = [];
|
|
66
|
+
private onSwitchOffCallbacks: Array<() => void> = [];
|
|
67
|
+
|
|
68
|
+
constructor(private raw: OutputRaw) {
|
|
69
|
+
this.raw.add_event(EventType.OnChange, () => {
|
|
70
|
+
this.onChangeCallbacks.forEach(callback => { callback(); });
|
|
71
|
+
});
|
|
72
|
+
this.raw.add_event(EventType.OnSwitchOn, () => {
|
|
73
|
+
this.onSwitchOnCallbacks.forEach(callback => { callback(); });
|
|
74
|
+
});
|
|
75
|
+
this.raw.add_event(EventType.OnSwitchOff, () => {
|
|
76
|
+
this.onSwitchOffCallbacks.forEach(callback => { callback(); });
|
|
77
|
+
});
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
/**
|
|
81
|
+
* Zdarzenie wywoływane przy zmianie stanu (niezależnie od wartości)
|
|
82
|
+
* @param callback
|
|
83
|
+
*/
|
|
84
|
+
addOnChange(callback: () => void): void {
|
|
85
|
+
this.onChangeCallbacks.push(callback);
|
|
86
|
+
}
|
|
87
|
+
/**
|
|
88
|
+
* Zdarzenie wywoływane przy ustawieniu On na wyjściu
|
|
89
|
+
* @param callback
|
|
90
|
+
*/
|
|
91
|
+
addOnSwitchOn(callback: () => void): void {
|
|
92
|
+
this.onSwitchOnCallbacks.push(callback);
|
|
93
|
+
}
|
|
94
|
+
/**
|
|
95
|
+
* Zdarzenie wywoływane przy ustawieniu Off na wyjściu
|
|
96
|
+
* @param callback
|
|
97
|
+
*/
|
|
98
|
+
addOnSwitchOff(callback: () => void): void {
|
|
99
|
+
this.onSwitchOffCallbacks.push(callback);
|
|
100
|
+
}
|
|
101
|
+
/** Załącza wyjście */
|
|
102
|
+
switchOn(): void {
|
|
103
|
+
this.raw.execute(MethodType.SwitchOn);
|
|
104
|
+
}
|
|
105
|
+
/** Wyłącza wyjście */
|
|
106
|
+
switchOff(): void {
|
|
107
|
+
this.raw.execute(MethodType.SwitchOff);
|
|
108
|
+
}
|
|
109
|
+
/**
|
|
110
|
+
* Zwraca stan wyjścia: 1 - wyjście załączone, 0 - wyjście wyłączone, -1 - stan wyjścia nieznany (brak połączenia z centralką)
|
|
111
|
+
* @returns {ValueType}
|
|
112
|
+
*/
|
|
113
|
+
get value(): ValueType {
|
|
114
|
+
return this.raw.get(PropertyType.Value);
|
|
115
|
+
}
|
|
116
|
+
/**
|
|
117
|
+
* Parametr definiujący, do którego wyjścia odnosi się obiekt
|
|
118
|
+
* @returns {number}
|
|
119
|
+
*/
|
|
120
|
+
get nr(): number {
|
|
121
|
+
return this.raw.get(PropertyType.Nr);
|
|
122
|
+
}
|
|
123
|
+
set nr(value: number) {
|
|
124
|
+
this.raw.set(PropertyType.Nr, value);
|
|
125
|
+
}
|
|
126
|
+
/**
|
|
127
|
+
* Hasło użytkownika, dla _ zastosuje hasło administratora
|
|
128
|
+
* @returns {string}
|
|
129
|
+
*/
|
|
130
|
+
get userPassword(): string {
|
|
131
|
+
return this.raw.get(PropertyType.UserPassword);
|
|
132
|
+
}
|
|
133
|
+
set userPassword(value: string) {
|
|
134
|
+
this.raw.set(PropertyType.UserPassword, value);
|
|
135
|
+
}
|
|
136
|
+
}
|
|
137
|
+
|
|
138
|
+
class OutputRemote implements IOutput {
|
|
139
|
+
constructor(private objectName: string, private gate: RemoteGate) {
|
|
140
|
+
|
|
141
|
+
}
|
|
142
|
+
|
|
143
|
+
/**
|
|
144
|
+
* Zdarzenie wywoływane przy zmianie stanu (niezależnie od wartości)
|
|
145
|
+
* @param callback
|
|
146
|
+
*/
|
|
147
|
+
addOnChange(_callback: () => void): void {
|
|
148
|
+
// Remote events are not supported
|
|
149
|
+
}
|
|
150
|
+
/**
|
|
151
|
+
* Zdarzenie wywoływane przy ustawieniu On na wyjściu
|
|
152
|
+
* @param callback
|
|
153
|
+
*/
|
|
154
|
+
addOnSwitchOn(_callback: () => void): void {
|
|
155
|
+
// Remote events are not supported
|
|
156
|
+
}
|
|
157
|
+
/**
|
|
158
|
+
* Zdarzenie wywoływane przy ustawieniu Off na wyjściu
|
|
159
|
+
* @param callback
|
|
160
|
+
*/
|
|
161
|
+
addOnSwitchOff(_callback: () => void): void {
|
|
162
|
+
// Remote events are not supported
|
|
163
|
+
}
|
|
164
|
+
|
|
165
|
+
/** Załącza wyjście */
|
|
166
|
+
switchOn(): void {
|
|
167
|
+
const cmd: string | null = rawExecutionBuilderFactory(this.objectName)
|
|
168
|
+
.execute()
|
|
169
|
+
.addParameter(MethodType.SwitchOn)
|
|
170
|
+
.build();
|
|
171
|
+
this.gate.runScript(cmd!);
|
|
172
|
+
}
|
|
173
|
+
|
|
174
|
+
/** Wyłącza wyjście */
|
|
175
|
+
switchOff(): void {
|
|
176
|
+
const cmd: string | null = rawExecutionBuilderFactory(this.objectName)
|
|
177
|
+
.execute()
|
|
178
|
+
.addParameter(MethodType.SwitchOff)
|
|
179
|
+
.build();
|
|
180
|
+
this.gate.runScript(cmd!);
|
|
181
|
+
}
|
|
182
|
+
|
|
183
|
+
/**
|
|
184
|
+
* Zwraca stan wyjścia: 1 - wyjście załączone, 0 - wyjście wyłączone, -1 - stan wyjścia nieznany (brak połączenia z centralką)
|
|
185
|
+
* @returns {ValueType}
|
|
186
|
+
*/
|
|
187
|
+
get value(): ValueType {
|
|
188
|
+
const cmd: string | null = rawExecutionBuilderFactory(this.objectName)
|
|
189
|
+
.get()
|
|
190
|
+
.addParameter(PropertyType.Value)
|
|
191
|
+
.build();
|
|
192
|
+
return this.gate.runScript(cmd!);
|
|
193
|
+
}
|
|
194
|
+
|
|
195
|
+
/**
|
|
196
|
+
* Parametr definiujący, do którego wyjścia odnosi się obiekt
|
|
197
|
+
* @returns {number}
|
|
198
|
+
*/
|
|
199
|
+
get nr(): number {
|
|
200
|
+
const cmd: string | null = rawExecutionBuilderFactory(this.objectName)
|
|
201
|
+
.get()
|
|
202
|
+
.addParameter(PropertyType.Nr)
|
|
203
|
+
.build();
|
|
204
|
+
return this.gate.runScript(cmd!);
|
|
205
|
+
}
|
|
206
|
+
|
|
207
|
+
set nr(value: number) {
|
|
208
|
+
const cmd: string | null = rawExecutionBuilderFactory(this.objectName)
|
|
209
|
+
.set()
|
|
210
|
+
.addParameter(PropertyType.Nr)
|
|
211
|
+
.addParameter(value)
|
|
212
|
+
.build();
|
|
213
|
+
this.gate.runScript(cmd!);
|
|
214
|
+
}
|
|
215
|
+
|
|
216
|
+
/**
|
|
217
|
+
* Hasło użytkownika, dla _ zastosuje hasło administratora
|
|
218
|
+
* @returns {string}
|
|
219
|
+
*/
|
|
220
|
+
get userPassword(): string {
|
|
221
|
+
const cmd: string | null = rawExecutionBuilderFactory(this.objectName)
|
|
222
|
+
.get()
|
|
223
|
+
.addParameter(PropertyType.UserPassword)
|
|
224
|
+
.build();
|
|
225
|
+
return this.gate.runScript(cmd!);
|
|
226
|
+
}
|
|
227
|
+
|
|
228
|
+
set userPassword(value: string) {
|
|
229
|
+
const cmd: string | null = rawExecutionBuilderFactory(this.objectName)
|
|
230
|
+
.set()
|
|
231
|
+
.addParameter(PropertyType.UserPassword)
|
|
232
|
+
.addParameter(value)
|
|
233
|
+
.build();
|
|
234
|
+
this.gate.runScript(cmd!);
|
|
235
|
+
}
|
|
236
|
+
}
|
|
237
|
+
|
|
238
|
+
export {
|
|
239
|
+
Output, OutputRaw, OutputRemote, ValueType
|
|
240
|
+
}
|
|
@@ -0,0 +1,359 @@
|
|
|
1
|
+
// Created from: packages/grenton-api/interfaces/object_satel_v1.xml, object name="Satel" version="1"
|
|
2
|
+
|
|
3
|
+
import { rawExecutionBuilderFactory } from "../../../core/execution-builder"
|
|
4
|
+
import { RemoteGate } from "../../../core/remote-gate"
|
|
5
|
+
|
|
6
|
+
enum EventType {
|
|
7
|
+
OnConnected = 0,
|
|
8
|
+
OnDisconnected = 1,
|
|
9
|
+
OnError = 2
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
enum PropertyType {
|
|
13
|
+
State = 0,
|
|
14
|
+
LastError = 1,
|
|
15
|
+
IP = 2,
|
|
16
|
+
Port = 3,
|
|
17
|
+
AdminPassword = 4,
|
|
18
|
+
UpdateTime = 5,
|
|
19
|
+
EncryptionEnabled = 6,
|
|
20
|
+
EncryptionKey = 7
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
enum StateType {
|
|
24
|
+
Disconnected = 0,
|
|
25
|
+
Connected = 1
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
enum EncryptionEnabledType {
|
|
29
|
+
False = 0,
|
|
30
|
+
True = 1
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
declare class SatelRaw {
|
|
34
|
+
add_event(event: EventType, callback: () => void): void;
|
|
35
|
+
get(property: PropertyType): any;
|
|
36
|
+
set(property: PropertyType, value: any): void;
|
|
37
|
+
execute(method: number, ...args: any[]): any;
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
interface ISatel {
|
|
41
|
+
/**
|
|
42
|
+
* Zdarzenie wywoływane po nawiązaniu połączenia z centralką
|
|
43
|
+
* @param callback
|
|
44
|
+
*/
|
|
45
|
+
addOnConnected: (callback: () => void) => void
|
|
46
|
+
/**
|
|
47
|
+
* Zdarzenie wywoływane po zerwaniu połączenia z centralką
|
|
48
|
+
* @param callback
|
|
49
|
+
*/
|
|
50
|
+
addOnDisconnected: (callback: () => void) => void
|
|
51
|
+
/**
|
|
52
|
+
* Zdarzenie wywoływane po wystąpieniu błędu centralki (LastError)
|
|
53
|
+
* @param callback
|
|
54
|
+
*/
|
|
55
|
+
addOnError: (callback: () => void) => void
|
|
56
|
+
/** Stan centralki: 0 - brak połączenia z centralką 1 - połączono z centralką */
|
|
57
|
+
readonly state: StateType
|
|
58
|
+
/** Ostatni kod błędu modułu ETHM (Satel): 0 - ok 1 - nieprawidłowe hasło */
|
|
59
|
+
readonly lastError: number
|
|
60
|
+
ip: string
|
|
61
|
+
/** Port modułu ETHM (Satel) */
|
|
62
|
+
port: number
|
|
63
|
+
/** Hasło administratora Satel */
|
|
64
|
+
adminPassword: string
|
|
65
|
+
/** Okres aktualizacji stanu centralki */
|
|
66
|
+
updateTime: number
|
|
67
|
+
/** Szyfrowanie: True - załączone False - wyłączone */
|
|
68
|
+
encryptionEnabled: EncryptionEnabledType
|
|
69
|
+
/** Klucz szyfrowania Satel */
|
|
70
|
+
encryptionKey: string
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
class Satel implements ISatel {
|
|
74
|
+
private onConnectedCallbacks: Array<() => void> = [];
|
|
75
|
+
private onDisconnectedCallbacks: Array<() => void> = [];
|
|
76
|
+
private onErrorCallbacks: Array<() => void> = [];
|
|
77
|
+
|
|
78
|
+
constructor(private raw: SatelRaw) {
|
|
79
|
+
this.raw.add_event(EventType.OnConnected, () => {
|
|
80
|
+
this.onConnectedCallbacks.forEach(callback => { callback(); });
|
|
81
|
+
});
|
|
82
|
+
this.raw.add_event(EventType.OnDisconnected, () => {
|
|
83
|
+
this.onDisconnectedCallbacks.forEach(callback => { callback(); });
|
|
84
|
+
});
|
|
85
|
+
this.raw.add_event(EventType.OnError, () => {
|
|
86
|
+
this.onErrorCallbacks.forEach(callback => { callback(); });
|
|
87
|
+
});
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
/**
|
|
91
|
+
* Zdarzenie wywoływane po nawiązaniu połączenia z centralką
|
|
92
|
+
* @param callback
|
|
93
|
+
*/
|
|
94
|
+
addOnConnected(callback: () => void): void {
|
|
95
|
+
this.onConnectedCallbacks.push(callback);
|
|
96
|
+
}
|
|
97
|
+
/**
|
|
98
|
+
* Zdarzenie wywoływane po zerwaniu połączenia z centralką
|
|
99
|
+
* @param callback
|
|
100
|
+
*/
|
|
101
|
+
addOnDisconnected(callback: () => void): void {
|
|
102
|
+
this.onDisconnectedCallbacks.push(callback);
|
|
103
|
+
}
|
|
104
|
+
/**
|
|
105
|
+
* Zdarzenie wywoływane po wystąpieniu błędu centralki (LastError)
|
|
106
|
+
* @param callback
|
|
107
|
+
*/
|
|
108
|
+
addOnError(callback: () => void): void {
|
|
109
|
+
this.onErrorCallbacks.push(callback);
|
|
110
|
+
}
|
|
111
|
+
/**
|
|
112
|
+
* Stan centralki: 0 - brak połączenia z centralką 1 - połączono z centralką
|
|
113
|
+
* @returns {StateType}
|
|
114
|
+
*/
|
|
115
|
+
get state(): StateType {
|
|
116
|
+
return this.raw.get(PropertyType.State);
|
|
117
|
+
}
|
|
118
|
+
/**
|
|
119
|
+
* Ostatni kod błędu modułu ETHM (Satel): 0 - ok 1 - nieprawidłowe hasło
|
|
120
|
+
* @returns {number}
|
|
121
|
+
*/
|
|
122
|
+
get lastError(): number {
|
|
123
|
+
return this.raw.get(PropertyType.LastError);
|
|
124
|
+
}
|
|
125
|
+
get ip(): string {
|
|
126
|
+
return this.raw.get(PropertyType.IP);
|
|
127
|
+
}
|
|
128
|
+
set ip(value: string) {
|
|
129
|
+
this.raw.set(PropertyType.IP, value);
|
|
130
|
+
}
|
|
131
|
+
/**
|
|
132
|
+
* Port modułu ETHM (Satel)
|
|
133
|
+
* @returns {number}
|
|
134
|
+
*/
|
|
135
|
+
get port(): number {
|
|
136
|
+
return this.raw.get(PropertyType.Port);
|
|
137
|
+
}
|
|
138
|
+
set port(value: number) {
|
|
139
|
+
this.raw.set(PropertyType.Port, value);
|
|
140
|
+
}
|
|
141
|
+
/**
|
|
142
|
+
* Hasło administratora Satel
|
|
143
|
+
* @returns {string}
|
|
144
|
+
*/
|
|
145
|
+
get adminPassword(): string {
|
|
146
|
+
return this.raw.get(PropertyType.AdminPassword);
|
|
147
|
+
}
|
|
148
|
+
set adminPassword(value: string) {
|
|
149
|
+
this.raw.set(PropertyType.AdminPassword, value);
|
|
150
|
+
}
|
|
151
|
+
/**
|
|
152
|
+
* Okres aktualizacji stanu centralki
|
|
153
|
+
* @returns {number}
|
|
154
|
+
*/
|
|
155
|
+
get updateTime(): number {
|
|
156
|
+
return this.raw.get(PropertyType.UpdateTime);
|
|
157
|
+
}
|
|
158
|
+
set updateTime(value: number) {
|
|
159
|
+
this.raw.set(PropertyType.UpdateTime, value);
|
|
160
|
+
}
|
|
161
|
+
/**
|
|
162
|
+
* Szyfrowanie: True - załączone False - wyłączone
|
|
163
|
+
* @returns {EncryptionEnabledType}
|
|
164
|
+
*/
|
|
165
|
+
get encryptionEnabled(): EncryptionEnabledType {
|
|
166
|
+
return this.raw.get(PropertyType.EncryptionEnabled);
|
|
167
|
+
}
|
|
168
|
+
set encryptionEnabled(value: EncryptionEnabledType) {
|
|
169
|
+
this.raw.set(PropertyType.EncryptionEnabled, value);
|
|
170
|
+
}
|
|
171
|
+
/**
|
|
172
|
+
* Klucz szyfrowania Satel
|
|
173
|
+
* @returns {string}
|
|
174
|
+
*/
|
|
175
|
+
get encryptionKey(): string {
|
|
176
|
+
return this.raw.get(PropertyType.EncryptionKey);
|
|
177
|
+
}
|
|
178
|
+
set encryptionKey(value: string) {
|
|
179
|
+
this.raw.set(PropertyType.EncryptionKey, value);
|
|
180
|
+
}
|
|
181
|
+
}
|
|
182
|
+
|
|
183
|
+
class SatelRemote implements ISatel {
|
|
184
|
+
constructor(private objectName: string, private gate: RemoteGate) {
|
|
185
|
+
|
|
186
|
+
}
|
|
187
|
+
|
|
188
|
+
/**
|
|
189
|
+
* Zdarzenie wywoływane po nawiązaniu połączenia z centralką
|
|
190
|
+
* @param callback
|
|
191
|
+
*/
|
|
192
|
+
addOnConnected(_callback: () => void): void {
|
|
193
|
+
// Remote events are not supported
|
|
194
|
+
}
|
|
195
|
+
/**
|
|
196
|
+
* Zdarzenie wywoływane po zerwaniu połączenia z centralką
|
|
197
|
+
* @param callback
|
|
198
|
+
*/
|
|
199
|
+
addOnDisconnected(_callback: () => void): void {
|
|
200
|
+
// Remote events are not supported
|
|
201
|
+
}
|
|
202
|
+
/**
|
|
203
|
+
* Zdarzenie wywoływane po wystąpieniu błędu centralki (LastError)
|
|
204
|
+
* @param callback
|
|
205
|
+
*/
|
|
206
|
+
addOnError(_callback: () => void): void {
|
|
207
|
+
// Remote events are not supported
|
|
208
|
+
}
|
|
209
|
+
|
|
210
|
+
/**
|
|
211
|
+
* Stan centralki: 0 - brak połączenia z centralką 1 - połączono z centralką
|
|
212
|
+
* @returns {StateType}
|
|
213
|
+
*/
|
|
214
|
+
get state(): StateType {
|
|
215
|
+
const cmd: string | null = rawExecutionBuilderFactory(this.objectName)
|
|
216
|
+
.get()
|
|
217
|
+
.addParameter(PropertyType.State)
|
|
218
|
+
.build();
|
|
219
|
+
return this.gate.runScript(cmd!);
|
|
220
|
+
}
|
|
221
|
+
|
|
222
|
+
/**
|
|
223
|
+
* Ostatni kod błędu modułu ETHM (Satel): 0 - ok 1 - nieprawidłowe hasło
|
|
224
|
+
* @returns {number}
|
|
225
|
+
*/
|
|
226
|
+
get lastError(): number {
|
|
227
|
+
const cmd: string | null = rawExecutionBuilderFactory(this.objectName)
|
|
228
|
+
.get()
|
|
229
|
+
.addParameter(PropertyType.LastError)
|
|
230
|
+
.build();
|
|
231
|
+
return this.gate.runScript(cmd!);
|
|
232
|
+
}
|
|
233
|
+
|
|
234
|
+
get ip(): string {
|
|
235
|
+
const cmd: string | null = rawExecutionBuilderFactory(this.objectName)
|
|
236
|
+
.get()
|
|
237
|
+
.addParameter(PropertyType.IP)
|
|
238
|
+
.build();
|
|
239
|
+
return this.gate.runScript(cmd!);
|
|
240
|
+
}
|
|
241
|
+
|
|
242
|
+
set ip(value: string) {
|
|
243
|
+
const cmd: string | null = rawExecutionBuilderFactory(this.objectName)
|
|
244
|
+
.set()
|
|
245
|
+
.addParameter(PropertyType.IP)
|
|
246
|
+
.addParameter(value)
|
|
247
|
+
.build();
|
|
248
|
+
this.gate.runScript(cmd!);
|
|
249
|
+
}
|
|
250
|
+
|
|
251
|
+
/**
|
|
252
|
+
* Port modułu ETHM (Satel)
|
|
253
|
+
* @returns {number}
|
|
254
|
+
*/
|
|
255
|
+
get port(): number {
|
|
256
|
+
const cmd: string | null = rawExecutionBuilderFactory(this.objectName)
|
|
257
|
+
.get()
|
|
258
|
+
.addParameter(PropertyType.Port)
|
|
259
|
+
.build();
|
|
260
|
+
return this.gate.runScript(cmd!);
|
|
261
|
+
}
|
|
262
|
+
|
|
263
|
+
set port(value: number) {
|
|
264
|
+
const cmd: string | null = rawExecutionBuilderFactory(this.objectName)
|
|
265
|
+
.set()
|
|
266
|
+
.addParameter(PropertyType.Port)
|
|
267
|
+
.addParameter(value)
|
|
268
|
+
.build();
|
|
269
|
+
this.gate.runScript(cmd!);
|
|
270
|
+
}
|
|
271
|
+
|
|
272
|
+
/**
|
|
273
|
+
* Hasło administratora Satel
|
|
274
|
+
* @returns {string}
|
|
275
|
+
*/
|
|
276
|
+
get adminPassword(): string {
|
|
277
|
+
const cmd: string | null = rawExecutionBuilderFactory(this.objectName)
|
|
278
|
+
.get()
|
|
279
|
+
.addParameter(PropertyType.AdminPassword)
|
|
280
|
+
.build();
|
|
281
|
+
return this.gate.runScript(cmd!);
|
|
282
|
+
}
|
|
283
|
+
|
|
284
|
+
set adminPassword(value: string) {
|
|
285
|
+
const cmd: string | null = rawExecutionBuilderFactory(this.objectName)
|
|
286
|
+
.set()
|
|
287
|
+
.addParameter(PropertyType.AdminPassword)
|
|
288
|
+
.addParameter(value)
|
|
289
|
+
.build();
|
|
290
|
+
this.gate.runScript(cmd!);
|
|
291
|
+
}
|
|
292
|
+
|
|
293
|
+
/**
|
|
294
|
+
* Okres aktualizacji stanu centralki
|
|
295
|
+
* @returns {number}
|
|
296
|
+
*/
|
|
297
|
+
get updateTime(): number {
|
|
298
|
+
const cmd: string | null = rawExecutionBuilderFactory(this.objectName)
|
|
299
|
+
.get()
|
|
300
|
+
.addParameter(PropertyType.UpdateTime)
|
|
301
|
+
.build();
|
|
302
|
+
return this.gate.runScript(cmd!);
|
|
303
|
+
}
|
|
304
|
+
|
|
305
|
+
set updateTime(value: number) {
|
|
306
|
+
const cmd: string | null = rawExecutionBuilderFactory(this.objectName)
|
|
307
|
+
.set()
|
|
308
|
+
.addParameter(PropertyType.UpdateTime)
|
|
309
|
+
.addParameter(value)
|
|
310
|
+
.build();
|
|
311
|
+
this.gate.runScript(cmd!);
|
|
312
|
+
}
|
|
313
|
+
|
|
314
|
+
/**
|
|
315
|
+
* Szyfrowanie: True - załączone False - wyłączone
|
|
316
|
+
* @returns {EncryptionEnabledType}
|
|
317
|
+
*/
|
|
318
|
+
get encryptionEnabled(): EncryptionEnabledType {
|
|
319
|
+
const cmd: string | null = rawExecutionBuilderFactory(this.objectName)
|
|
320
|
+
.get()
|
|
321
|
+
.addParameter(PropertyType.EncryptionEnabled)
|
|
322
|
+
.build();
|
|
323
|
+
return this.gate.runScript(cmd!);
|
|
324
|
+
}
|
|
325
|
+
|
|
326
|
+
set encryptionEnabled(value: EncryptionEnabledType) {
|
|
327
|
+
const cmd: string | null = rawExecutionBuilderFactory(this.objectName)
|
|
328
|
+
.set()
|
|
329
|
+
.addParameter(PropertyType.EncryptionEnabled)
|
|
330
|
+
.addParameter(value)
|
|
331
|
+
.build();
|
|
332
|
+
this.gate.runScript(cmd!);
|
|
333
|
+
}
|
|
334
|
+
|
|
335
|
+
/**
|
|
336
|
+
* Klucz szyfrowania Satel
|
|
337
|
+
* @returns {string}
|
|
338
|
+
*/
|
|
339
|
+
get encryptionKey(): string {
|
|
340
|
+
const cmd: string | null = rawExecutionBuilderFactory(this.objectName)
|
|
341
|
+
.get()
|
|
342
|
+
.addParameter(PropertyType.EncryptionKey)
|
|
343
|
+
.build();
|
|
344
|
+
return this.gate.runScript(cmd!);
|
|
345
|
+
}
|
|
346
|
+
|
|
347
|
+
set encryptionKey(value: string) {
|
|
348
|
+
const cmd: string | null = rawExecutionBuilderFactory(this.objectName)
|
|
349
|
+
.set()
|
|
350
|
+
.addParameter(PropertyType.EncryptionKey)
|
|
351
|
+
.addParameter(value)
|
|
352
|
+
.build();
|
|
353
|
+
this.gate.runScript(cmd!);
|
|
354
|
+
}
|
|
355
|
+
}
|
|
356
|
+
|
|
357
|
+
export {
|
|
358
|
+
Satel, SatelRaw, SatelRemote, StateType, EncryptionEnabledType
|
|
359
|
+
}
|