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,609 @@
1
+ // Created from: packages/grenton-api/interfaces/object_modbus_v1.xml, object name="Modbus" 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
+ OnError = 1
9
+ }
10
+
11
+ enum PropertyType {
12
+ DeviceAddress = 0,
13
+ AccessRights = 1,
14
+ RegisterAddress = 2,
15
+ TransmisionSpeed = 3,
16
+ ValueType = 4,
17
+ BitPosition = 5,
18
+ BitCount = 6,
19
+ RefreshInterval = 8,
20
+ ResponseTimeout = 9,
21
+ Divisor = 10,
22
+ Endianess = 11,
23
+ RegisterType = 12,
24
+ ErrorCode = 13,
25
+ Value = 14,
26
+ RegisterValue = 15
27
+ }
28
+
29
+ enum AccessRightsType {
30
+ Read = 0,
31
+ ReadWrite = 1
32
+ }
33
+
34
+ enum TransmisionSpeedType {
35
+ _1200 = 1200,
36
+ _2400 = 2400,
37
+ _4800 = 4800,
38
+ _9600 = 9600,
39
+ _19200 = 19200,
40
+ _38400 = 38400,
41
+ _57600 = 57600,
42
+ _115200 = 115200
43
+ }
44
+
45
+ enum ValueTypeType {
46
+ Number = 1,
47
+ Float = 2,
48
+ Bit = 3
49
+ }
50
+
51
+ enum EndianessType {
52
+ NoSwap = 0,
53
+ SwapBytesAndWords = 1,
54
+ SwapBytes = 2,
55
+ SwapWords = 3
56
+ }
57
+
58
+ enum RegisterTypeType {
59
+ BitOutputsInputs = 0,
60
+ BinaryInputs = 1,
61
+ HoldingRegisters = 2,
62
+ InputRegisters = 3
63
+ }
64
+
65
+ declare class ModbusRaw {
66
+ add_event(event: EventType, callback: () => void): void;
67
+ get(property: PropertyType): any;
68
+ set(property: PropertyType, value: any): void;
69
+ execute(method: number, ...args: any[]): any;
70
+ }
71
+
72
+ interface IModbus {
73
+ /**
74
+ * Zdarzenie wywoływane przy zmianie stanu (niezależnie od wartości)
75
+ * @param callback
76
+ */
77
+ addOnChange: (callback: () => void) => void
78
+ /**
79
+ * Zdarzenie wywoływane gdy urządzenie slave zgłasza błąd
80
+ * @param callback
81
+ */
82
+ addOnError: (callback: () => void) => void
83
+ /** Adres urządzenia Modbus */
84
+ deviceAddress: number
85
+ /** Tryb pracy: 0 - odczyt 1 - odczyt/zapis */
86
+ accessRights: AccessRightsType
87
+ /** Adres obsługiwanego rejestru */
88
+ registerAddress: number
89
+ /** Prędkość transmisji */
90
+ transmisionSpeed: TransmisionSpeedType
91
+ /** Typ zmiennej: 1 - Number 2 - Float 3 - Bit */
92
+ valueType: ValueTypeType
93
+ /** Pozycja bitu (dotyczy dostępu bitowego do 16bit rejestrów - typu bit) */
94
+ bitPosition: number
95
+ /** Liczba bitów rejestru: Dla 16 bitowych rejestrów - podanie wartości > 16 spowoduje odczyt / zapis 2 rejestrów Dla rejestrów bitowych / dwustanowych - określa liczbę odczytywanych / zapisywanych rejestrów W przypadku typu bit - określa liczbę bitów 16 bitowego rejestru podlegających operacji odczytu / zapisu */
96
+ bitCount: number
97
+ /** Czas odświeżania */
98
+ refreshInterval: number
99
+ /** Czas na odpowiedź */
100
+ responseTimeout: number
101
+ /** Dzielnik */
102
+ divisor: number
103
+ /** 0 - NoSwap - Little Endian 1 - SwapBytesAndWords - BigEndian 2 - SwapBytes - bajty w słowie: BigEndian; słowa: Little Endian 3 - SwapWords - bajty w słowie: LittleEndian, słowa: Big Endian */
104
+ endianess: EndianessType
105
+ /** Typ rejestru Modbus: 0 - wyjścia / wejścia bitowe - bitowe rejestry wyjśc/wejść. Dla zapisu pojedynczego wyjścia - funkcja Modbus: 5, dla wielu wyjść - funkcja Modbus: 15 1 - wejścia dwustanowe - 'discrete inputs' - funkcja Modbus: 3 2 - rejestry pamiętające - rejestry 16 bitowe. Zapis wartości 16bit - funkcja Modbus: 6, Zapis wartości 32bit - funkcja Modbus: 16. Odczyt - funkcja Modbus: 3 3 - rejestry wejściowe - rejestry 16 bitowe - funkcja Modbus: 4 */
106
+ registerType: RegisterTypeType
107
+ /** Kod błędu: 1 – niedozwolona funkcja 2 – niedozwolony numer rejestru 3 – niedozwolona wartość danej 4 – uszkodzenie w przyłączonym urządzeniu 5 – potwierdzenie pozytywne 6 – brak gotowości 7 – potwierdzenie negatywne 8 – błąd parzystości pamięci 10 - ścieżka bramy niedostępna 11 - brak odpowiedzi urządzenia docelowego 0 - poprawny odczyt/zapis rejestru -1 - nieaktualna wartość ostatniegoodczytanego rejestru -2 - przekroczenie czasu odpowiedzi -3 - błąd ramki (problem ze zdekodowaniem odpowiedzi) -4 - nieoczekiwany rozmiar odpowiedzi -5 - nieoczekiwany kod odpowiedzi -6 - nieprawidłowy stan obiektu -7 - błąd połączenia */
108
+ readonly errorCode: number
109
+ /** Wartość odczytu / zapisu */
110
+ value: number
111
+ /** Nieprzeskalowana wartość rejestru */
112
+ readonly registerValue: number
113
+ }
114
+
115
+ class Modbus implements IModbus {
116
+ private onChangeCallbacks: Array<() => void> = [];
117
+ private onErrorCallbacks: Array<() => void> = [];
118
+
119
+ constructor(private raw: ModbusRaw) {
120
+ this.raw.add_event(EventType.OnChange, () => {
121
+ this.onChangeCallbacks.forEach(callback => { callback(); });
122
+ });
123
+ this.raw.add_event(EventType.OnError, () => {
124
+ this.onErrorCallbacks.forEach(callback => { callback(); });
125
+ });
126
+ }
127
+
128
+ /**
129
+ * Zdarzenie wywoływane przy zmianie stanu (niezależnie od wartości)
130
+ * @param callback
131
+ */
132
+ addOnChange(callback: () => void): void {
133
+ this.onChangeCallbacks.push(callback);
134
+ }
135
+ /**
136
+ * Zdarzenie wywoływane gdy urządzenie slave zgłasza błąd
137
+ * @param callback
138
+ */
139
+ addOnError(callback: () => void): void {
140
+ this.onErrorCallbacks.push(callback);
141
+ }
142
+ /**
143
+ * Adres urządzenia Modbus
144
+ * @returns {number}
145
+ */
146
+ get deviceAddress(): number {
147
+ return this.raw.get(PropertyType.DeviceAddress);
148
+ }
149
+ set deviceAddress(value: number) {
150
+ this.raw.set(PropertyType.DeviceAddress, value);
151
+ }
152
+ /**
153
+ * Tryb pracy: 0 - odczyt 1 - odczyt/zapis
154
+ * @returns {AccessRightsType}
155
+ */
156
+ get accessRights(): AccessRightsType {
157
+ return this.raw.get(PropertyType.AccessRights);
158
+ }
159
+ set accessRights(value: AccessRightsType) {
160
+ this.raw.set(PropertyType.AccessRights, value);
161
+ }
162
+ /**
163
+ * Adres obsługiwanego rejestru
164
+ * @returns {number}
165
+ */
166
+ get registerAddress(): number {
167
+ return this.raw.get(PropertyType.RegisterAddress);
168
+ }
169
+ set registerAddress(value: number) {
170
+ this.raw.set(PropertyType.RegisterAddress, value);
171
+ }
172
+ /**
173
+ * Prędkość transmisji
174
+ * @returns {TransmisionSpeedType}
175
+ */
176
+ get transmisionSpeed(): TransmisionSpeedType {
177
+ return this.raw.get(PropertyType.TransmisionSpeed);
178
+ }
179
+ set transmisionSpeed(value: TransmisionSpeedType) {
180
+ this.raw.set(PropertyType.TransmisionSpeed, value);
181
+ }
182
+ /**
183
+ * Typ zmiennej: 1 - Number 2 - Float 3 - Bit
184
+ * @returns {ValueTypeType}
185
+ */
186
+ get valueType(): ValueTypeType {
187
+ return this.raw.get(PropertyType.ValueType);
188
+ }
189
+ set valueType(value: ValueTypeType) {
190
+ this.raw.set(PropertyType.ValueType, value);
191
+ }
192
+ /**
193
+ * Pozycja bitu (dotyczy dostępu bitowego do 16bit rejestrów - typu bit)
194
+ * @returns {number}
195
+ */
196
+ get bitPosition(): number {
197
+ return this.raw.get(PropertyType.BitPosition);
198
+ }
199
+ set bitPosition(value: number) {
200
+ this.raw.set(PropertyType.BitPosition, value);
201
+ }
202
+ /**
203
+ * Liczba bitów rejestru: Dla 16 bitowych rejestrów - podanie wartości > 16 spowoduje odczyt / zapis 2 rejestrów Dla rejestrów bitowych / dwustanowych - określa liczbę odczytywanych / zapisywanych rejestrów W przypadku typu bit - określa liczbę bitów 16 bitowego rejestru podlegających operacji odczytu / zapisu
204
+ * @returns {number}
205
+ */
206
+ get bitCount(): number {
207
+ return this.raw.get(PropertyType.BitCount);
208
+ }
209
+ set bitCount(value: number) {
210
+ this.raw.set(PropertyType.BitCount, value);
211
+ }
212
+ /**
213
+ * Czas odświeżania
214
+ * @returns {number}
215
+ */
216
+ get refreshInterval(): number {
217
+ return this.raw.get(PropertyType.RefreshInterval);
218
+ }
219
+ set refreshInterval(value: number) {
220
+ this.raw.set(PropertyType.RefreshInterval, value);
221
+ }
222
+ /**
223
+ * Czas na odpowiedź
224
+ * @returns {number}
225
+ */
226
+ get responseTimeout(): number {
227
+ return this.raw.get(PropertyType.ResponseTimeout);
228
+ }
229
+ set responseTimeout(value: number) {
230
+ this.raw.set(PropertyType.ResponseTimeout, value);
231
+ }
232
+ /**
233
+ * Dzielnik
234
+ * @returns {number}
235
+ */
236
+ get divisor(): number {
237
+ return this.raw.get(PropertyType.Divisor);
238
+ }
239
+ set divisor(value: number) {
240
+ this.raw.set(PropertyType.Divisor, value);
241
+ }
242
+ /**
243
+ * 0 - NoSwap - Little Endian 1 - SwapBytesAndWords - BigEndian 2 - SwapBytes - bajty w słowie: BigEndian; słowa: Little Endian 3 - SwapWords - bajty w słowie: LittleEndian, słowa: Big Endian
244
+ * @returns {EndianessType}
245
+ */
246
+ get endianess(): EndianessType {
247
+ return this.raw.get(PropertyType.Endianess);
248
+ }
249
+ set endianess(value: EndianessType) {
250
+ this.raw.set(PropertyType.Endianess, value);
251
+ }
252
+ /**
253
+ * Typ rejestru Modbus: 0 - wyjścia / wejścia bitowe - bitowe rejestry wyjśc/wejść. Dla zapisu pojedynczego wyjścia - funkcja Modbus: 5, dla wielu wyjść - funkcja Modbus: 15 1 - wejścia dwustanowe - 'discrete inputs' - funkcja Modbus: 3 2 - rejestry pamiętające - rejestry 16 bitowe. Zapis wartości 16bit - funkcja Modbus: 6, Zapis wartości 32bit - funkcja Modbus: 16. Odczyt - funkcja Modbus: 3 3 - rejestry wejściowe - rejestry 16 bitowe - funkcja Modbus: 4
254
+ * @returns {RegisterTypeType}
255
+ */
256
+ get registerType(): RegisterTypeType {
257
+ return this.raw.get(PropertyType.RegisterType);
258
+ }
259
+ set registerType(value: RegisterTypeType) {
260
+ this.raw.set(PropertyType.RegisterType, value);
261
+ }
262
+ /**
263
+ * Kod błędu: 1 – niedozwolona funkcja 2 – niedozwolony numer rejestru 3 – niedozwolona wartość danej 4 – uszkodzenie w przyłączonym urządzeniu 5 – potwierdzenie pozytywne 6 – brak gotowości 7 – potwierdzenie negatywne 8 – błąd parzystości pamięci 10 - ścieżka bramy niedostępna 11 - brak odpowiedzi urządzenia docelowego 0 - poprawny odczyt/zapis rejestru -1 - nieaktualna wartość ostatniegoodczytanego rejestru -2 - przekroczenie czasu odpowiedzi -3 - błąd ramki (problem ze zdekodowaniem odpowiedzi) -4 - nieoczekiwany rozmiar odpowiedzi -5 - nieoczekiwany kod odpowiedzi -6 - nieprawidłowy stan obiektu -7 - błąd połączenia
264
+ * @returns {number}
265
+ */
266
+ get errorCode(): number {
267
+ return this.raw.get(PropertyType.ErrorCode);
268
+ }
269
+ /**
270
+ * Wartość odczytu / zapisu
271
+ * @returns {number}
272
+ */
273
+ get value(): number {
274
+ return this.raw.get(PropertyType.Value);
275
+ }
276
+ set value(v: number) {
277
+ this.raw.set(PropertyType.Value, v);
278
+ }
279
+ /**
280
+ * Nieprzeskalowana wartość rejestru
281
+ * @returns {number}
282
+ */
283
+ get registerValue(): number {
284
+ return this.raw.get(PropertyType.RegisterValue);
285
+ }
286
+ }
287
+
288
+ class ModbusRemote implements IModbus {
289
+ constructor(private objectName: string, private gate: RemoteGate) {
290
+
291
+ }
292
+
293
+ /**
294
+ * Zdarzenie wywoływane przy zmianie stanu (niezależnie od wartości)
295
+ * @param callback
296
+ */
297
+ addOnChange(_callback: () => void): void {
298
+ // Remote events are not supported
299
+ }
300
+ /**
301
+ * Zdarzenie wywoływane gdy urządzenie slave zgłasza błąd
302
+ * @param callback
303
+ */
304
+ addOnError(_callback: () => void): void {
305
+ // Remote events are not supported
306
+ }
307
+
308
+ /**
309
+ * Adres urządzenia Modbus
310
+ * @returns {number}
311
+ */
312
+ get deviceAddress(): number {
313
+ const cmd: string | null = rawExecutionBuilderFactory(this.objectName)
314
+ .get()
315
+ .addParameter(PropertyType.DeviceAddress)
316
+ .build();
317
+ return this.gate.runScript(cmd!);
318
+ }
319
+
320
+ set deviceAddress(value: number) {
321
+ const cmd: string | null = rawExecutionBuilderFactory(this.objectName)
322
+ .set()
323
+ .addParameter(PropertyType.DeviceAddress)
324
+ .addParameter(value)
325
+ .build();
326
+ this.gate.runScript(cmd!);
327
+ }
328
+
329
+ /**
330
+ * Tryb pracy: 0 - odczyt 1 - odczyt/zapis
331
+ * @returns {AccessRightsType}
332
+ */
333
+ get accessRights(): AccessRightsType {
334
+ const cmd: string | null = rawExecutionBuilderFactory(this.objectName)
335
+ .get()
336
+ .addParameter(PropertyType.AccessRights)
337
+ .build();
338
+ return this.gate.runScript(cmd!);
339
+ }
340
+
341
+ set accessRights(value: AccessRightsType) {
342
+ const cmd: string | null = rawExecutionBuilderFactory(this.objectName)
343
+ .set()
344
+ .addParameter(PropertyType.AccessRights)
345
+ .addParameter(value)
346
+ .build();
347
+ this.gate.runScript(cmd!);
348
+ }
349
+
350
+ /**
351
+ * Adres obsługiwanego rejestru
352
+ * @returns {number}
353
+ */
354
+ get registerAddress(): number {
355
+ const cmd: string | null = rawExecutionBuilderFactory(this.objectName)
356
+ .get()
357
+ .addParameter(PropertyType.RegisterAddress)
358
+ .build();
359
+ return this.gate.runScript(cmd!);
360
+ }
361
+
362
+ set registerAddress(value: number) {
363
+ const cmd: string | null = rawExecutionBuilderFactory(this.objectName)
364
+ .set()
365
+ .addParameter(PropertyType.RegisterAddress)
366
+ .addParameter(value)
367
+ .build();
368
+ this.gate.runScript(cmd!);
369
+ }
370
+
371
+ /**
372
+ * Prędkość transmisji
373
+ * @returns {TransmisionSpeedType}
374
+ */
375
+ get transmisionSpeed(): TransmisionSpeedType {
376
+ const cmd: string | null = rawExecutionBuilderFactory(this.objectName)
377
+ .get()
378
+ .addParameter(PropertyType.TransmisionSpeed)
379
+ .build();
380
+ return this.gate.runScript(cmd!);
381
+ }
382
+
383
+ set transmisionSpeed(value: TransmisionSpeedType) {
384
+ const cmd: string | null = rawExecutionBuilderFactory(this.objectName)
385
+ .set()
386
+ .addParameter(PropertyType.TransmisionSpeed)
387
+ .addParameter(value)
388
+ .build();
389
+ this.gate.runScript(cmd!);
390
+ }
391
+
392
+ /**
393
+ * Typ zmiennej: 1 - Number 2 - Float 3 - Bit
394
+ * @returns {ValueTypeType}
395
+ */
396
+ get valueType(): ValueTypeType {
397
+ const cmd: string | null = rawExecutionBuilderFactory(this.objectName)
398
+ .get()
399
+ .addParameter(PropertyType.ValueType)
400
+ .build();
401
+ return this.gate.runScript(cmd!);
402
+ }
403
+
404
+ set valueType(value: ValueTypeType) {
405
+ const cmd: string | null = rawExecutionBuilderFactory(this.objectName)
406
+ .set()
407
+ .addParameter(PropertyType.ValueType)
408
+ .addParameter(value)
409
+ .build();
410
+ this.gate.runScript(cmd!);
411
+ }
412
+
413
+ /**
414
+ * Pozycja bitu (dotyczy dostępu bitowego do 16bit rejestrów - typu bit)
415
+ * @returns {number}
416
+ */
417
+ get bitPosition(): number {
418
+ const cmd: string | null = rawExecutionBuilderFactory(this.objectName)
419
+ .get()
420
+ .addParameter(PropertyType.BitPosition)
421
+ .build();
422
+ return this.gate.runScript(cmd!);
423
+ }
424
+
425
+ set bitPosition(value: number) {
426
+ const cmd: string | null = rawExecutionBuilderFactory(this.objectName)
427
+ .set()
428
+ .addParameter(PropertyType.BitPosition)
429
+ .addParameter(value)
430
+ .build();
431
+ this.gate.runScript(cmd!);
432
+ }
433
+
434
+ /**
435
+ * Liczba bitów rejestru: Dla 16 bitowych rejestrów - podanie wartości > 16 spowoduje odczyt / zapis 2 rejestrów Dla rejestrów bitowych / dwustanowych - określa liczbę odczytywanych / zapisywanych rejestrów W przypadku typu bit - określa liczbę bitów 16 bitowego rejestru podlegających operacji odczytu / zapisu
436
+ * @returns {number}
437
+ */
438
+ get bitCount(): number {
439
+ const cmd: string | null = rawExecutionBuilderFactory(this.objectName)
440
+ .get()
441
+ .addParameter(PropertyType.BitCount)
442
+ .build();
443
+ return this.gate.runScript(cmd!);
444
+ }
445
+
446
+ set bitCount(value: number) {
447
+ const cmd: string | null = rawExecutionBuilderFactory(this.objectName)
448
+ .set()
449
+ .addParameter(PropertyType.BitCount)
450
+ .addParameter(value)
451
+ .build();
452
+ this.gate.runScript(cmd!);
453
+ }
454
+
455
+ /**
456
+ * Czas odświeżania
457
+ * @returns {number}
458
+ */
459
+ get refreshInterval(): number {
460
+ const cmd: string | null = rawExecutionBuilderFactory(this.objectName)
461
+ .get()
462
+ .addParameter(PropertyType.RefreshInterval)
463
+ .build();
464
+ return this.gate.runScript(cmd!);
465
+ }
466
+
467
+ set refreshInterval(value: number) {
468
+ const cmd: string | null = rawExecutionBuilderFactory(this.objectName)
469
+ .set()
470
+ .addParameter(PropertyType.RefreshInterval)
471
+ .addParameter(value)
472
+ .build();
473
+ this.gate.runScript(cmd!);
474
+ }
475
+
476
+ /**
477
+ * Czas na odpowiedź
478
+ * @returns {number}
479
+ */
480
+ get responseTimeout(): number {
481
+ const cmd: string | null = rawExecutionBuilderFactory(this.objectName)
482
+ .get()
483
+ .addParameter(PropertyType.ResponseTimeout)
484
+ .build();
485
+ return this.gate.runScript(cmd!);
486
+ }
487
+
488
+ set responseTimeout(value: number) {
489
+ const cmd: string | null = rawExecutionBuilderFactory(this.objectName)
490
+ .set()
491
+ .addParameter(PropertyType.ResponseTimeout)
492
+ .addParameter(value)
493
+ .build();
494
+ this.gate.runScript(cmd!);
495
+ }
496
+
497
+ /**
498
+ * Dzielnik
499
+ * @returns {number}
500
+ */
501
+ get divisor(): number {
502
+ const cmd: string | null = rawExecutionBuilderFactory(this.objectName)
503
+ .get()
504
+ .addParameter(PropertyType.Divisor)
505
+ .build();
506
+ return this.gate.runScript(cmd!);
507
+ }
508
+
509
+ set divisor(value: number) {
510
+ const cmd: string | null = rawExecutionBuilderFactory(this.objectName)
511
+ .set()
512
+ .addParameter(PropertyType.Divisor)
513
+ .addParameter(value)
514
+ .build();
515
+ this.gate.runScript(cmd!);
516
+ }
517
+
518
+ /**
519
+ * 0 - NoSwap - Little Endian 1 - SwapBytesAndWords - BigEndian 2 - SwapBytes - bajty w słowie: BigEndian; słowa: Little Endian 3 - SwapWords - bajty w słowie: LittleEndian, słowa: Big Endian
520
+ * @returns {EndianessType}
521
+ */
522
+ get endianess(): EndianessType {
523
+ const cmd: string | null = rawExecutionBuilderFactory(this.objectName)
524
+ .get()
525
+ .addParameter(PropertyType.Endianess)
526
+ .build();
527
+ return this.gate.runScript(cmd!);
528
+ }
529
+
530
+ set endianess(value: EndianessType) {
531
+ const cmd: string | null = rawExecutionBuilderFactory(this.objectName)
532
+ .set()
533
+ .addParameter(PropertyType.Endianess)
534
+ .addParameter(value)
535
+ .build();
536
+ this.gate.runScript(cmd!);
537
+ }
538
+
539
+ /**
540
+ * Typ rejestru Modbus: 0 - wyjścia / wejścia bitowe - bitowe rejestry wyjśc/wejść. Dla zapisu pojedynczego wyjścia - funkcja Modbus: 5, dla wielu wyjść - funkcja Modbus: 15 1 - wejścia dwustanowe - 'discrete inputs' - funkcja Modbus: 3 2 - rejestry pamiętające - rejestry 16 bitowe. Zapis wartości 16bit - funkcja Modbus: 6, Zapis wartości 32bit - funkcja Modbus: 16. Odczyt - funkcja Modbus: 3 3 - rejestry wejściowe - rejestry 16 bitowe - funkcja Modbus: 4
541
+ * @returns {RegisterTypeType}
542
+ */
543
+ get registerType(): RegisterTypeType {
544
+ const cmd: string | null = rawExecutionBuilderFactory(this.objectName)
545
+ .get()
546
+ .addParameter(PropertyType.RegisterType)
547
+ .build();
548
+ return this.gate.runScript(cmd!);
549
+ }
550
+
551
+ set registerType(value: RegisterTypeType) {
552
+ const cmd: string | null = rawExecutionBuilderFactory(this.objectName)
553
+ .set()
554
+ .addParameter(PropertyType.RegisterType)
555
+ .addParameter(value)
556
+ .build();
557
+ this.gate.runScript(cmd!);
558
+ }
559
+
560
+ /**
561
+ * Kod błędu: 1 – niedozwolona funkcja 2 – niedozwolony numer rejestru 3 – niedozwolona wartość danej 4 – uszkodzenie w przyłączonym urządzeniu 5 – potwierdzenie pozytywne 6 – brak gotowości 7 – potwierdzenie negatywne 8 – błąd parzystości pamięci 10 - ścieżka bramy niedostępna 11 - brak odpowiedzi urządzenia docelowego 0 - poprawny odczyt/zapis rejestru -1 - nieaktualna wartość ostatniegoodczytanego rejestru -2 - przekroczenie czasu odpowiedzi -3 - błąd ramki (problem ze zdekodowaniem odpowiedzi) -4 - nieoczekiwany rozmiar odpowiedzi -5 - nieoczekiwany kod odpowiedzi -6 - nieprawidłowy stan obiektu -7 - błąd połączenia
562
+ * @returns {number}
563
+ */
564
+ get errorCode(): number {
565
+ const cmd: string | null = rawExecutionBuilderFactory(this.objectName)
566
+ .get()
567
+ .addParameter(PropertyType.ErrorCode)
568
+ .build();
569
+ return this.gate.runScript(cmd!);
570
+ }
571
+
572
+ /**
573
+ * Wartość odczytu / zapisu
574
+ * @returns {number}
575
+ */
576
+ get value(): number {
577
+ const cmd: string | null = rawExecutionBuilderFactory(this.objectName)
578
+ .get()
579
+ .addParameter(PropertyType.Value)
580
+ .build();
581
+ return this.gate.runScript(cmd!);
582
+ }
583
+
584
+ set value(v: number) {
585
+ const cmd: string | null = rawExecutionBuilderFactory(this.objectName)
586
+ .set()
587
+ .addParameter(PropertyType.Value)
588
+ .addParameter(v)
589
+ .build();
590
+ this.gate.runScript(cmd!);
591
+ }
592
+
593
+ /**
594
+ * Nieprzeskalowana wartość rejestru
595
+ * @returns {number}
596
+ */
597
+ get registerValue(): number {
598
+ const cmd: string | null = rawExecutionBuilderFactory(this.objectName)
599
+ .get()
600
+ .addParameter(PropertyType.RegisterValue)
601
+ .build();
602
+ return this.gate.runScript(cmd!);
603
+ }
604
+ }
605
+
606
+ export {
607
+ Modbus, ModbusRaw, ModbusRemote,
608
+ AccessRightsType, TransmisionSpeedType, ValueTypeType, EndianessType, RegisterTypeType
609
+ }