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,911 @@
|
|
|
1
|
+
// Created from: packages/grenton-api/interfaces/object_modbus_rtu_v1.xml, object name="ModbusRTU" version="1"
|
|
2
|
+
|
|
3
|
+
import { rawExecutionBuilderFactory } from "../../../core/execution-builder"
|
|
4
|
+
import { RemoteGate } from "../../../core/remote-gate"
|
|
5
|
+
|
|
6
|
+
enum EventType {
|
|
7
|
+
OnValueChange = 0,
|
|
8
|
+
OnValueRead = 1,
|
|
9
|
+
OnValueWritten = 2,
|
|
10
|
+
OnError = 3
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
enum PropertyType {
|
|
14
|
+
TransmissionSpeed = 0,
|
|
15
|
+
Parity = 1,
|
|
16
|
+
StopBits = 2,
|
|
17
|
+
DeviceAddress = 5,
|
|
18
|
+
ResponseTimeout = 6,
|
|
19
|
+
RefreshInterval = 7,
|
|
20
|
+
RegisterAddress = 8,
|
|
21
|
+
RegisterType = 10,
|
|
22
|
+
AlwaysWriteMultiple = 11,
|
|
23
|
+
InputOutputCount = 12,
|
|
24
|
+
DataType = 14,
|
|
25
|
+
DataWidth = 15,
|
|
26
|
+
Endianness = 16,
|
|
27
|
+
BitFieldWidth = 17,
|
|
28
|
+
BitFieldPosition = 18,
|
|
29
|
+
Divisor = 19,
|
|
30
|
+
InitialValueAccess = 20,
|
|
31
|
+
InitialValue = 21,
|
|
32
|
+
Value = 22,
|
|
33
|
+
RawValue = 23,
|
|
34
|
+
IsValueValid = 24,
|
|
35
|
+
ErrorCode = 25
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
enum MethodType {
|
|
39
|
+
ReadValue = 0,
|
|
40
|
+
WriteValue = 1
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
enum TransmissionSpeedType {
|
|
44
|
+
_1200 = 1200,
|
|
45
|
+
_2400 = 2400,
|
|
46
|
+
_4800 = 4800,
|
|
47
|
+
_9600 = 9600,
|
|
48
|
+
_19200 = 19200,
|
|
49
|
+
_38400 = 38400,
|
|
50
|
+
_57600 = 57600,
|
|
51
|
+
_115200 = 115200
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
enum ParityType {
|
|
55
|
+
None = 0,
|
|
56
|
+
Odd = 1,
|
|
57
|
+
Even = 2
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
enum StopBitsType {
|
|
61
|
+
One = 0,
|
|
62
|
+
OneAndHalf = 1,
|
|
63
|
+
Two = 2
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
enum RegisterTypeType {
|
|
67
|
+
DiscreteOutputsCoils = 0,
|
|
68
|
+
DiscreteInputs = 1,
|
|
69
|
+
HoldingRegisters = 2,
|
|
70
|
+
InputRegisters = 3
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
enum AlwaysWriteMultipleType {
|
|
74
|
+
No = 0,
|
|
75
|
+
Yes = 1
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
enum DataTypeType {
|
|
79
|
+
UnsignedInteger = 0,
|
|
80
|
+
SignedInteger = 1,
|
|
81
|
+
FloatingPoint = 2
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
enum DataWidthType {
|
|
85
|
+
_16 = 16,
|
|
86
|
+
_32 = 32,
|
|
87
|
+
_48 = 48,
|
|
88
|
+
_64 = 64
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
enum EndiannessType {
|
|
92
|
+
BigEndian = 0,
|
|
93
|
+
LittleBigEndian = 1,
|
|
94
|
+
BigLittleEndian = 2,
|
|
95
|
+
LittleEndian = 3
|
|
96
|
+
}
|
|
97
|
+
|
|
98
|
+
enum InitialValueAccessType {
|
|
99
|
+
Read = 0,
|
|
100
|
+
Write = 1
|
|
101
|
+
}
|
|
102
|
+
|
|
103
|
+
declare class ModbusRTURaw {
|
|
104
|
+
add_event(event: EventType, callback: () => void): void;
|
|
105
|
+
get(property: PropertyType): any;
|
|
106
|
+
set(property: PropertyType, value: any): void;
|
|
107
|
+
execute(method: MethodType, ...args: any[]): any;
|
|
108
|
+
}
|
|
109
|
+
|
|
110
|
+
interface IModbusRTU {
|
|
111
|
+
/**
|
|
112
|
+
* Zdarzenie wywoływane w przypadku zmiany wartości cechy Value przez Modbus
|
|
113
|
+
* @param callback
|
|
114
|
+
*/
|
|
115
|
+
addOnValueChange: (callback: () => void) => void
|
|
116
|
+
/**
|
|
117
|
+
* Zdarzenie wywoływane po zakończeniu odczytu rozpoczętego przez ReadValue
|
|
118
|
+
* @param callback
|
|
119
|
+
*/
|
|
120
|
+
addOnValueRead: (callback: () => void) => void
|
|
121
|
+
/**
|
|
122
|
+
* Zdarzenie wywoływane po zakończeniu zapisu rozpoczętego przez WriteValue
|
|
123
|
+
* @param callback
|
|
124
|
+
*/
|
|
125
|
+
addOnValueWritten: (callback: () => void) => void
|
|
126
|
+
/**
|
|
127
|
+
* Zdarzenie wywoływane gdy urządzenie slave zgłasza błąd
|
|
128
|
+
* @param callback
|
|
129
|
+
*/
|
|
130
|
+
addOnError: (callback: () => void) => void
|
|
131
|
+
/** Rozpoczyna odczyt wartości z urządzenia. Czeka na zakończenie odczytu w przypadku braku OnValueRead. */
|
|
132
|
+
readValue: () => void
|
|
133
|
+
/**
|
|
134
|
+
* Zapisuje nową wartość do urządzenia.
|
|
135
|
+
* @param {string} value
|
|
136
|
+
*/
|
|
137
|
+
writeValue: (value: string) => void
|
|
138
|
+
/** Prędkość transmisji */
|
|
139
|
+
transmissionSpeed: TransmissionSpeedType
|
|
140
|
+
/** Bit parzystości: 0 - None 1 - Odd 2 - Even */
|
|
141
|
+
parity: ParityType
|
|
142
|
+
/** Bity stopu: 0 - 1 bit stopu 1 - 1.5 bitu stopu 2 - 2 bity stopu */
|
|
143
|
+
stopBits: StopBitsType
|
|
144
|
+
/** Adres urządzenia Modbus */
|
|
145
|
+
deviceAddress: number
|
|
146
|
+
/** Czas na odpowiedź na ramkę w krokach 25ms */
|
|
147
|
+
responseTimeout: number
|
|
148
|
+
/** Minimalny okres odświeżania w krokach 5ms. Wartość 0 wyłącza automatyczne odświeżanie. */
|
|
149
|
+
refreshInterval: number
|
|
150
|
+
/** Adres obsługiwanego rejestru */
|
|
151
|
+
registerAddress: number
|
|
152
|
+
/** Typ rejestru Modbus: 0 - wyjścia dwustanowe (coils) - funkcja Modbus: 5 (zapis pojedynczego wyjścia), 15 (zapis wielu wyjść), lub 1 (odczyt stanu wyjść) 1 - wejścia dwustanowe - funkcja Modbus: 2 2 - rejestry pamiętające - funkcja Modbus: 6 (zapis pojedynczego rejestru), 16 (zapis wielu rejestrów), lub 3 (odczyt rejestrów) 3 - rejestry wejściowe - funkcja Modbus: 4 */
|
|
153
|
+
registerType: RegisterTypeType
|
|
154
|
+
/** Zawsze używaj funkcji 15 lub 16 do zapisu wartości */
|
|
155
|
+
alwaysWriteMultiple: AlwaysWriteMultipleType
|
|
156
|
+
/** Określa liczbę dyskretnych wejść / wyjść podlegających operacji odczytu / zapisu */
|
|
157
|
+
inputOutputCount: number
|
|
158
|
+
/** Typ wartości: 0 - Liczba całkowita, stałoprzecinkowa lub pole bitowe bez bitu znaku 1 - Liczba całkowita, stałoprzecinkowa lub pole bitowe z bitem znaku 2 - Liczba zmiennoprzecinkowa */
|
|
159
|
+
dataType: DataTypeType
|
|
160
|
+
/** Szerokość danych (1 do 4 rejestrów 16 bitowych) */
|
|
161
|
+
dataWidth: DataWidthType
|
|
162
|
+
/** Kolejność bajtów: 0 - kolejność słów: Big Endian; kolejność bajtów w słowie: Big Endian (SwapBytesAndWords) 1 - kolejność słów: Little Endian; kolejność bajtów w słowie: Big Endian (SwapBytes) 2 - kolejność słów: Big Endian; kolejność bajtów w słowie: Little Endian (SwapWords) 3 - kolejność słów: Little Endian; kolejność bajtów w słowie: Little Endian (NoSwap) */
|
|
163
|
+
endianness: EndiannessType
|
|
164
|
+
/** Liczba bitów pola bitowego. Suma BitFieldWidth i Position powinna być <= DataWidth; 0 oznacza brak pola bitowego (pełna szerokość danych DataWidth) */
|
|
165
|
+
bitFieldWidth: number
|
|
166
|
+
/** Pozycja najmłodszego bitu pola bitowego. Suma BitFieldWidth i Position powinna być <= DataWidth. */
|
|
167
|
+
bitFieldPosition: number
|
|
168
|
+
/** Dzielnik */
|
|
169
|
+
divisor: string
|
|
170
|
+
/** Metoda pierwszego dostępu do wartości Value: 0 - wartość początkowa Value jest odczytywana z urządzenia 1 - wartość początkowa Value jest zapisywana do urządzenia */
|
|
171
|
+
initialValueAccess: InitialValueAccessType
|
|
172
|
+
/** Zwraca ostatnio odczytaną wartość */
|
|
173
|
+
readonly value: number
|
|
174
|
+
/** Nieprzeskalowana wartość rejestru */
|
|
175
|
+
readonly rawValue: number
|
|
176
|
+
/** Określa, czy wartość jest zgodna ze stanem obiektu */
|
|
177
|
+
readonly isValueValid: number
|
|
178
|
+
/** 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 */
|
|
179
|
+
readonly errorCode: number
|
|
180
|
+
}
|
|
181
|
+
|
|
182
|
+
class ModbusRTU implements IModbusRTU {
|
|
183
|
+
private onValueChangeCallbacks: Array<() => void> = [];
|
|
184
|
+
private onValueReadCallbacks: Array<() => void> = [];
|
|
185
|
+
private onValueWrittenCallbacks: Array<() => void> = [];
|
|
186
|
+
private onErrorCallbacks: Array<() => void> = [];
|
|
187
|
+
|
|
188
|
+
constructor(private raw: ModbusRTURaw) {
|
|
189
|
+
this.raw.add_event(EventType.OnValueChange, () => {
|
|
190
|
+
this.onValueChangeCallbacks.forEach(callback => { callback(); });
|
|
191
|
+
});
|
|
192
|
+
this.raw.add_event(EventType.OnValueRead, () => {
|
|
193
|
+
this.onValueReadCallbacks.forEach(callback => { callback(); });
|
|
194
|
+
});
|
|
195
|
+
this.raw.add_event(EventType.OnValueWritten, () => {
|
|
196
|
+
this.onValueWrittenCallbacks.forEach(callback => { callback(); });
|
|
197
|
+
});
|
|
198
|
+
this.raw.add_event(EventType.OnError, () => {
|
|
199
|
+
this.onErrorCallbacks.forEach(callback => { callback(); });
|
|
200
|
+
});
|
|
201
|
+
}
|
|
202
|
+
|
|
203
|
+
/**
|
|
204
|
+
* Zdarzenie wywoływane w przypadku zmiany wartości cechy Value przez Modbus
|
|
205
|
+
* @param callback
|
|
206
|
+
*/
|
|
207
|
+
addOnValueChange(callback: () => void): void {
|
|
208
|
+
this.onValueChangeCallbacks.push(callback);
|
|
209
|
+
}
|
|
210
|
+
/**
|
|
211
|
+
* Zdarzenie wywoływane po zakończeniu odczytu rozpoczętego przez ReadValue
|
|
212
|
+
* @param callback
|
|
213
|
+
*/
|
|
214
|
+
addOnValueRead(callback: () => void): void {
|
|
215
|
+
this.onValueReadCallbacks.push(callback);
|
|
216
|
+
}
|
|
217
|
+
/**
|
|
218
|
+
* Zdarzenie wywoływane po zakończeniu zapisu rozpoczętego przez WriteValue
|
|
219
|
+
* @param callback
|
|
220
|
+
*/
|
|
221
|
+
addOnValueWritten(callback: () => void): void {
|
|
222
|
+
this.onValueWrittenCallbacks.push(callback);
|
|
223
|
+
}
|
|
224
|
+
/**
|
|
225
|
+
* Zdarzenie wywoływane gdy urządzenie slave zgłasza błąd
|
|
226
|
+
* @param callback
|
|
227
|
+
*/
|
|
228
|
+
addOnError(callback: () => void): void {
|
|
229
|
+
this.onErrorCallbacks.push(callback);
|
|
230
|
+
}
|
|
231
|
+
/** Rozpoczyna odczyt wartości z urządzenia. Czeka na zakończenie odczytu w przypadku braku OnValueRead. */
|
|
232
|
+
readValue(): void {
|
|
233
|
+
this.raw.execute(MethodType.ReadValue);
|
|
234
|
+
}
|
|
235
|
+
/**
|
|
236
|
+
* Zapisuje nową wartość do urządzenia.
|
|
237
|
+
* @param {string} value
|
|
238
|
+
*/
|
|
239
|
+
writeValue(value: string): void {
|
|
240
|
+
this.raw.execute(MethodType.WriteValue, value);
|
|
241
|
+
}
|
|
242
|
+
/**
|
|
243
|
+
* Prędkość transmisji
|
|
244
|
+
* @returns {TransmissionSpeedType}
|
|
245
|
+
*/
|
|
246
|
+
get transmissionSpeed(): TransmissionSpeedType {
|
|
247
|
+
return this.raw.get(PropertyType.TransmissionSpeed);
|
|
248
|
+
}
|
|
249
|
+
set transmissionSpeed(value: TransmissionSpeedType) {
|
|
250
|
+
this.raw.set(PropertyType.TransmissionSpeed, value);
|
|
251
|
+
}
|
|
252
|
+
/**
|
|
253
|
+
* Bit parzystości: 0 - None 1 - Odd 2 - Even
|
|
254
|
+
* @returns {ParityType}
|
|
255
|
+
*/
|
|
256
|
+
get parity(): ParityType {
|
|
257
|
+
return this.raw.get(PropertyType.Parity);
|
|
258
|
+
}
|
|
259
|
+
set parity(value: ParityType) {
|
|
260
|
+
this.raw.set(PropertyType.Parity, value);
|
|
261
|
+
}
|
|
262
|
+
/**
|
|
263
|
+
* Bity stopu: 0 - 1 bit stopu 1 - 1.5 bitu stopu 2 - 2 bity stopu
|
|
264
|
+
* @returns {StopBitsType}
|
|
265
|
+
*/
|
|
266
|
+
get stopBits(): StopBitsType {
|
|
267
|
+
return this.raw.get(PropertyType.StopBits);
|
|
268
|
+
}
|
|
269
|
+
set stopBits(value: StopBitsType) {
|
|
270
|
+
this.raw.set(PropertyType.StopBits, value);
|
|
271
|
+
}
|
|
272
|
+
/**
|
|
273
|
+
* Adres urządzenia Modbus
|
|
274
|
+
* @returns {number}
|
|
275
|
+
*/
|
|
276
|
+
get deviceAddress(): number {
|
|
277
|
+
return this.raw.get(PropertyType.DeviceAddress);
|
|
278
|
+
}
|
|
279
|
+
set deviceAddress(value: number) {
|
|
280
|
+
this.raw.set(PropertyType.DeviceAddress, value);
|
|
281
|
+
}
|
|
282
|
+
/**
|
|
283
|
+
* Czas na odpowiedź na ramkę w krokach 25ms
|
|
284
|
+
* @returns {number}
|
|
285
|
+
*/
|
|
286
|
+
get responseTimeout(): number {
|
|
287
|
+
return this.raw.get(PropertyType.ResponseTimeout);
|
|
288
|
+
}
|
|
289
|
+
set responseTimeout(value: number) {
|
|
290
|
+
this.raw.set(PropertyType.ResponseTimeout, value);
|
|
291
|
+
}
|
|
292
|
+
/**
|
|
293
|
+
* Minimalny okres odświeżania w krokach 5ms. Wartość 0 wyłącza automatyczne odświeżanie.
|
|
294
|
+
* @returns {number}
|
|
295
|
+
*/
|
|
296
|
+
get refreshInterval(): number {
|
|
297
|
+
return this.raw.get(PropertyType.RefreshInterval);
|
|
298
|
+
}
|
|
299
|
+
set refreshInterval(value: number) {
|
|
300
|
+
this.raw.set(PropertyType.RefreshInterval, value);
|
|
301
|
+
}
|
|
302
|
+
/**
|
|
303
|
+
* Adres obsługiwanego rejestru
|
|
304
|
+
* @returns {number}
|
|
305
|
+
*/
|
|
306
|
+
get registerAddress(): number {
|
|
307
|
+
return this.raw.get(PropertyType.RegisterAddress);
|
|
308
|
+
}
|
|
309
|
+
set registerAddress(value: number) {
|
|
310
|
+
this.raw.set(PropertyType.RegisterAddress, value);
|
|
311
|
+
}
|
|
312
|
+
/**
|
|
313
|
+
* Typ rejestru Modbus: 0 - wyjścia dwustanowe (coils) - funkcja Modbus: 5 (zapis pojedynczego wyjścia), 15 (zapis wielu wyjść), lub 1 (odczyt stanu wyjść) 1 - wejścia dwustanowe - funkcja Modbus: 2 2 - rejestry pamiętające - funkcja Modbus: 6 (zapis pojedynczego rejestru), 16 (zapis wielu rejestrów), lub 3 (odczyt rejestrów) 3 - rejestry wejściowe - funkcja Modbus: 4
|
|
314
|
+
* @returns {RegisterTypeType}
|
|
315
|
+
*/
|
|
316
|
+
get registerType(): RegisterTypeType {
|
|
317
|
+
return this.raw.get(PropertyType.RegisterType);
|
|
318
|
+
}
|
|
319
|
+
set registerType(value: RegisterTypeType) {
|
|
320
|
+
this.raw.set(PropertyType.RegisterType, value);
|
|
321
|
+
}
|
|
322
|
+
/**
|
|
323
|
+
* Zawsze używaj funkcji 15 lub 16 do zapisu wartości
|
|
324
|
+
* @returns {AlwaysWriteMultipleType}
|
|
325
|
+
*/
|
|
326
|
+
get alwaysWriteMultiple(): AlwaysWriteMultipleType {
|
|
327
|
+
return this.raw.get(PropertyType.AlwaysWriteMultiple);
|
|
328
|
+
}
|
|
329
|
+
set alwaysWriteMultiple(value: AlwaysWriteMultipleType) {
|
|
330
|
+
this.raw.set(PropertyType.AlwaysWriteMultiple, value);
|
|
331
|
+
}
|
|
332
|
+
/**
|
|
333
|
+
* Określa liczbę dyskretnych wejść / wyjść podlegających operacji odczytu / zapisu
|
|
334
|
+
* @returns {number}
|
|
335
|
+
*/
|
|
336
|
+
get inputOutputCount(): number {
|
|
337
|
+
return this.raw.get(PropertyType.InputOutputCount);
|
|
338
|
+
}
|
|
339
|
+
set inputOutputCount(value: number) {
|
|
340
|
+
this.raw.set(PropertyType.InputOutputCount, value);
|
|
341
|
+
}
|
|
342
|
+
/**
|
|
343
|
+
* Typ wartości: 0 - Liczba całkowita, stałoprzecinkowa lub pole bitowe bez bitu znaku 1 - Liczba całkowita, stałoprzecinkowa lub pole bitowe z bitem znaku 2 - Liczba zmiennoprzecinkowa
|
|
344
|
+
* @returns {DataTypeType}
|
|
345
|
+
*/
|
|
346
|
+
get dataType(): DataTypeType {
|
|
347
|
+
return this.raw.get(PropertyType.DataType);
|
|
348
|
+
}
|
|
349
|
+
set dataType(value: DataTypeType) {
|
|
350
|
+
this.raw.set(PropertyType.DataType, value);
|
|
351
|
+
}
|
|
352
|
+
/**
|
|
353
|
+
* Szerokość danych (1 do 4 rejestrów 16 bitowych)
|
|
354
|
+
* @returns {DataWidthType}
|
|
355
|
+
*/
|
|
356
|
+
get dataWidth(): DataWidthType {
|
|
357
|
+
return this.raw.get(PropertyType.DataWidth);
|
|
358
|
+
}
|
|
359
|
+
set dataWidth(value: DataWidthType) {
|
|
360
|
+
this.raw.set(PropertyType.DataWidth, value);
|
|
361
|
+
}
|
|
362
|
+
/**
|
|
363
|
+
* Kolejność bajtów: 0 - kolejność słów: Big Endian; kolejność bajtów w słowie: Big Endian (SwapBytesAndWords) 1 - kolejność słów: Little Endian; kolejność bajtów w słowie: Big Endian (SwapBytes) 2 - kolejność słów: Big Endian; kolejność bajtów w słowie: Little Endian (SwapWords) 3 - kolejność słów: Little Endian; kolejność bajtów w słowie: Little Endian (NoSwap)
|
|
364
|
+
* @returns {EndiannessType}
|
|
365
|
+
*/
|
|
366
|
+
get endianness(): EndiannessType {
|
|
367
|
+
return this.raw.get(PropertyType.Endianness);
|
|
368
|
+
}
|
|
369
|
+
set endianness(value: EndiannessType) {
|
|
370
|
+
this.raw.set(PropertyType.Endianness, value);
|
|
371
|
+
}
|
|
372
|
+
/**
|
|
373
|
+
* Liczba bitów pola bitowego. Suma BitFieldWidth i Position powinna być <= DataWidth; 0 oznacza brak pola bitowego (pełna szerokość danych DataWidth)
|
|
374
|
+
* @returns {number}
|
|
375
|
+
*/
|
|
376
|
+
get bitFieldWidth(): number {
|
|
377
|
+
return this.raw.get(PropertyType.BitFieldWidth);
|
|
378
|
+
}
|
|
379
|
+
set bitFieldWidth(value: number) {
|
|
380
|
+
this.raw.set(PropertyType.BitFieldWidth, value);
|
|
381
|
+
}
|
|
382
|
+
/**
|
|
383
|
+
* Pozycja najmłodszego bitu pola bitowego. Suma BitFieldWidth i Position powinna być <= DataWidth.
|
|
384
|
+
* @returns {number}
|
|
385
|
+
*/
|
|
386
|
+
get bitFieldPosition(): number {
|
|
387
|
+
return this.raw.get(PropertyType.BitFieldPosition);
|
|
388
|
+
}
|
|
389
|
+
set bitFieldPosition(value: number) {
|
|
390
|
+
this.raw.set(PropertyType.BitFieldPosition, value);
|
|
391
|
+
}
|
|
392
|
+
/**
|
|
393
|
+
* Dzielnik
|
|
394
|
+
* @returns {string}
|
|
395
|
+
*/
|
|
396
|
+
get divisor(): string {
|
|
397
|
+
return this.raw.get(PropertyType.Divisor);
|
|
398
|
+
}
|
|
399
|
+
set divisor(value: string) {
|
|
400
|
+
this.raw.set(PropertyType.Divisor, value);
|
|
401
|
+
}
|
|
402
|
+
/**
|
|
403
|
+
* Metoda pierwszego dostępu do wartości Value: 0 - wartość początkowa Value jest odczytywana z urządzenia 1 - wartość początkowa Value jest zapisywana do urządzenia
|
|
404
|
+
* @returns {InitialValueAccessType}
|
|
405
|
+
*/
|
|
406
|
+
get initialValueAccess(): InitialValueAccessType {
|
|
407
|
+
return this.raw.get(PropertyType.InitialValueAccess);
|
|
408
|
+
}
|
|
409
|
+
set initialValueAccess(value: InitialValueAccessType) {
|
|
410
|
+
this.raw.set(PropertyType.InitialValueAccess, value);
|
|
411
|
+
}
|
|
412
|
+
set initialValue(value: string) {
|
|
413
|
+
this.raw.set(PropertyType.InitialValue, value);
|
|
414
|
+
}
|
|
415
|
+
/**
|
|
416
|
+
* Zwraca ostatnio odczytaną wartość
|
|
417
|
+
* @returns {number}
|
|
418
|
+
*/
|
|
419
|
+
get value(): number {
|
|
420
|
+
return this.raw.get(PropertyType.Value);
|
|
421
|
+
}
|
|
422
|
+
/**
|
|
423
|
+
* Nieprzeskalowana wartość rejestru
|
|
424
|
+
* @returns {number}
|
|
425
|
+
*/
|
|
426
|
+
get rawValue(): number {
|
|
427
|
+
return this.raw.get(PropertyType.RawValue);
|
|
428
|
+
}
|
|
429
|
+
/**
|
|
430
|
+
* Określa, czy wartość jest zgodna ze stanem obiektu
|
|
431
|
+
* @returns {number}
|
|
432
|
+
*/
|
|
433
|
+
get isValueValid(): number {
|
|
434
|
+
return this.raw.get(PropertyType.IsValueValid);
|
|
435
|
+
}
|
|
436
|
+
/**
|
|
437
|
+
* 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
|
|
438
|
+
* @returns {number}
|
|
439
|
+
*/
|
|
440
|
+
get errorCode(): number {
|
|
441
|
+
return this.raw.get(PropertyType.ErrorCode);
|
|
442
|
+
}
|
|
443
|
+
}
|
|
444
|
+
|
|
445
|
+
class ModbusRTURemote implements IModbusRTU {
|
|
446
|
+
constructor(private objectName: string, private gate: RemoteGate) {
|
|
447
|
+
|
|
448
|
+
}
|
|
449
|
+
|
|
450
|
+
/**
|
|
451
|
+
* Zdarzenie wywoływane w przypadku zmiany wartości cechy Value przez Modbus
|
|
452
|
+
* @param callback
|
|
453
|
+
*/
|
|
454
|
+
addOnValueChange(_callback: () => void): void {
|
|
455
|
+
// Remote events are not supported
|
|
456
|
+
}
|
|
457
|
+
/**
|
|
458
|
+
* Zdarzenie wywoływane po zakończeniu odczytu rozpoczętego przez ReadValue
|
|
459
|
+
* @param callback
|
|
460
|
+
*/
|
|
461
|
+
addOnValueRead(_callback: () => void): void {
|
|
462
|
+
// Remote events are not supported
|
|
463
|
+
}
|
|
464
|
+
/**
|
|
465
|
+
* Zdarzenie wywoływane po zakończeniu zapisu rozpoczętego przez WriteValue
|
|
466
|
+
* @param callback
|
|
467
|
+
*/
|
|
468
|
+
addOnValueWritten(_callback: () => void): void {
|
|
469
|
+
// Remote events are not supported
|
|
470
|
+
}
|
|
471
|
+
/**
|
|
472
|
+
* Zdarzenie wywoływane gdy urządzenie slave zgłasza błąd
|
|
473
|
+
* @param callback
|
|
474
|
+
*/
|
|
475
|
+
addOnError(_callback: () => void): void {
|
|
476
|
+
// Remote events are not supported
|
|
477
|
+
}
|
|
478
|
+
|
|
479
|
+
/** Rozpoczyna odczyt wartości z urządzenia. Czeka na zakończenie odczytu w przypadku braku OnValueRead. */
|
|
480
|
+
readValue(): void {
|
|
481
|
+
const cmd: string | null = rawExecutionBuilderFactory(this.objectName)
|
|
482
|
+
.execute()
|
|
483
|
+
.addParameter(MethodType.ReadValue)
|
|
484
|
+
.build();
|
|
485
|
+
this.gate.runScript(cmd!);
|
|
486
|
+
}
|
|
487
|
+
|
|
488
|
+
/**
|
|
489
|
+
* Zapisuje nową wartość do urządzenia.
|
|
490
|
+
* @param {string} value
|
|
491
|
+
*/
|
|
492
|
+
writeValue(value: string): void {
|
|
493
|
+
const cmd: string | null = rawExecutionBuilderFactory(this.objectName)
|
|
494
|
+
.execute()
|
|
495
|
+
.addParameter(MethodType.WriteValue)
|
|
496
|
+
.addParameter(value)
|
|
497
|
+
.build();
|
|
498
|
+
this.gate.runScript(cmd!);
|
|
499
|
+
}
|
|
500
|
+
|
|
501
|
+
/**
|
|
502
|
+
* Prędkość transmisji
|
|
503
|
+
* @returns {TransmissionSpeedType}
|
|
504
|
+
*/
|
|
505
|
+
get transmissionSpeed(): TransmissionSpeedType {
|
|
506
|
+
const cmd: string | null = rawExecutionBuilderFactory(this.objectName)
|
|
507
|
+
.get()
|
|
508
|
+
.addParameter(PropertyType.TransmissionSpeed)
|
|
509
|
+
.build();
|
|
510
|
+
return this.gate.runScript(cmd!);
|
|
511
|
+
}
|
|
512
|
+
|
|
513
|
+
set transmissionSpeed(value: TransmissionSpeedType) {
|
|
514
|
+
const cmd: string | null = rawExecutionBuilderFactory(this.objectName)
|
|
515
|
+
.set()
|
|
516
|
+
.addParameter(PropertyType.TransmissionSpeed)
|
|
517
|
+
.addParameter(value)
|
|
518
|
+
.build();
|
|
519
|
+
this.gate.runScript(cmd!);
|
|
520
|
+
}
|
|
521
|
+
|
|
522
|
+
/**
|
|
523
|
+
* Bit parzystości: 0 - None 1 - Odd 2 - Even
|
|
524
|
+
* @returns {ParityType}
|
|
525
|
+
*/
|
|
526
|
+
get parity(): ParityType {
|
|
527
|
+
const cmd: string | null = rawExecutionBuilderFactory(this.objectName)
|
|
528
|
+
.get()
|
|
529
|
+
.addParameter(PropertyType.Parity)
|
|
530
|
+
.build();
|
|
531
|
+
return this.gate.runScript(cmd!);
|
|
532
|
+
}
|
|
533
|
+
|
|
534
|
+
set parity(value: ParityType) {
|
|
535
|
+
const cmd: string | null = rawExecutionBuilderFactory(this.objectName)
|
|
536
|
+
.set()
|
|
537
|
+
.addParameter(PropertyType.Parity)
|
|
538
|
+
.addParameter(value)
|
|
539
|
+
.build();
|
|
540
|
+
this.gate.runScript(cmd!);
|
|
541
|
+
}
|
|
542
|
+
|
|
543
|
+
/**
|
|
544
|
+
* Bity stopu: 0 - 1 bit stopu 1 - 1.5 bitu stopu 2 - 2 bity stopu
|
|
545
|
+
* @returns {StopBitsType}
|
|
546
|
+
*/
|
|
547
|
+
get stopBits(): StopBitsType {
|
|
548
|
+
const cmd: string | null = rawExecutionBuilderFactory(this.objectName)
|
|
549
|
+
.get()
|
|
550
|
+
.addParameter(PropertyType.StopBits)
|
|
551
|
+
.build();
|
|
552
|
+
return this.gate.runScript(cmd!);
|
|
553
|
+
}
|
|
554
|
+
|
|
555
|
+
set stopBits(value: StopBitsType) {
|
|
556
|
+
const cmd: string | null = rawExecutionBuilderFactory(this.objectName)
|
|
557
|
+
.set()
|
|
558
|
+
.addParameter(PropertyType.StopBits)
|
|
559
|
+
.addParameter(value)
|
|
560
|
+
.build();
|
|
561
|
+
this.gate.runScript(cmd!);
|
|
562
|
+
}
|
|
563
|
+
|
|
564
|
+
/**
|
|
565
|
+
* Adres urządzenia Modbus
|
|
566
|
+
* @returns {number}
|
|
567
|
+
*/
|
|
568
|
+
get deviceAddress(): number {
|
|
569
|
+
const cmd: string | null = rawExecutionBuilderFactory(this.objectName)
|
|
570
|
+
.get()
|
|
571
|
+
.addParameter(PropertyType.DeviceAddress)
|
|
572
|
+
.build();
|
|
573
|
+
return this.gate.runScript(cmd!);
|
|
574
|
+
}
|
|
575
|
+
|
|
576
|
+
set deviceAddress(value: number) {
|
|
577
|
+
const cmd: string | null = rawExecutionBuilderFactory(this.objectName)
|
|
578
|
+
.set()
|
|
579
|
+
.addParameter(PropertyType.DeviceAddress)
|
|
580
|
+
.addParameter(value)
|
|
581
|
+
.build();
|
|
582
|
+
this.gate.runScript(cmd!);
|
|
583
|
+
}
|
|
584
|
+
|
|
585
|
+
/**
|
|
586
|
+
* Czas na odpowiedź na ramkę w krokach 25ms
|
|
587
|
+
* @returns {number}
|
|
588
|
+
*/
|
|
589
|
+
get responseTimeout(): number {
|
|
590
|
+
const cmd: string | null = rawExecutionBuilderFactory(this.objectName)
|
|
591
|
+
.get()
|
|
592
|
+
.addParameter(PropertyType.ResponseTimeout)
|
|
593
|
+
.build();
|
|
594
|
+
return this.gate.runScript(cmd!);
|
|
595
|
+
}
|
|
596
|
+
|
|
597
|
+
set responseTimeout(value: number) {
|
|
598
|
+
const cmd: string | null = rawExecutionBuilderFactory(this.objectName)
|
|
599
|
+
.set()
|
|
600
|
+
.addParameter(PropertyType.ResponseTimeout)
|
|
601
|
+
.addParameter(value)
|
|
602
|
+
.build();
|
|
603
|
+
this.gate.runScript(cmd!);
|
|
604
|
+
}
|
|
605
|
+
|
|
606
|
+
/**
|
|
607
|
+
* Minimalny okres odświeżania w krokach 5ms. Wartość 0 wyłącza automatyczne odświeżanie.
|
|
608
|
+
* @returns {number}
|
|
609
|
+
*/
|
|
610
|
+
get refreshInterval(): number {
|
|
611
|
+
const cmd: string | null = rawExecutionBuilderFactory(this.objectName)
|
|
612
|
+
.get()
|
|
613
|
+
.addParameter(PropertyType.RefreshInterval)
|
|
614
|
+
.build();
|
|
615
|
+
return this.gate.runScript(cmd!);
|
|
616
|
+
}
|
|
617
|
+
|
|
618
|
+
set refreshInterval(value: number) {
|
|
619
|
+
const cmd: string | null = rawExecutionBuilderFactory(this.objectName)
|
|
620
|
+
.set()
|
|
621
|
+
.addParameter(PropertyType.RefreshInterval)
|
|
622
|
+
.addParameter(value)
|
|
623
|
+
.build();
|
|
624
|
+
this.gate.runScript(cmd!);
|
|
625
|
+
}
|
|
626
|
+
|
|
627
|
+
/**
|
|
628
|
+
* Adres obsługiwanego rejestru
|
|
629
|
+
* @returns {number}
|
|
630
|
+
*/
|
|
631
|
+
get registerAddress(): number {
|
|
632
|
+
const cmd: string | null = rawExecutionBuilderFactory(this.objectName)
|
|
633
|
+
.get()
|
|
634
|
+
.addParameter(PropertyType.RegisterAddress)
|
|
635
|
+
.build();
|
|
636
|
+
return this.gate.runScript(cmd!);
|
|
637
|
+
}
|
|
638
|
+
|
|
639
|
+
set registerAddress(value: number) {
|
|
640
|
+
const cmd: string | null = rawExecutionBuilderFactory(this.objectName)
|
|
641
|
+
.set()
|
|
642
|
+
.addParameter(PropertyType.RegisterAddress)
|
|
643
|
+
.addParameter(value)
|
|
644
|
+
.build();
|
|
645
|
+
this.gate.runScript(cmd!);
|
|
646
|
+
}
|
|
647
|
+
|
|
648
|
+
/**
|
|
649
|
+
* Typ rejestru Modbus: 0 - wyjścia dwustanowe (coils) - funkcja Modbus: 5 (zapis pojedynczego wyjścia), 15 (zapis wielu wyjść), lub 1 (odczyt stanu wyjść) 1 - wejścia dwustanowe - funkcja Modbus: 2 2 - rejestry pamiętające - funkcja Modbus: 6 (zapis pojedynczego rejestru), 16 (zapis wielu rejestrów), lub 3 (odczyt rejestrów) 3 - rejestry wejściowe - funkcja Modbus: 4
|
|
650
|
+
* @returns {RegisterTypeType}
|
|
651
|
+
*/
|
|
652
|
+
get registerType(): RegisterTypeType {
|
|
653
|
+
const cmd: string | null = rawExecutionBuilderFactory(this.objectName)
|
|
654
|
+
.get()
|
|
655
|
+
.addParameter(PropertyType.RegisterType)
|
|
656
|
+
.build();
|
|
657
|
+
return this.gate.runScript(cmd!);
|
|
658
|
+
}
|
|
659
|
+
|
|
660
|
+
set registerType(value: RegisterTypeType) {
|
|
661
|
+
const cmd: string | null = rawExecutionBuilderFactory(this.objectName)
|
|
662
|
+
.set()
|
|
663
|
+
.addParameter(PropertyType.RegisterType)
|
|
664
|
+
.addParameter(value)
|
|
665
|
+
.build();
|
|
666
|
+
this.gate.runScript(cmd!);
|
|
667
|
+
}
|
|
668
|
+
|
|
669
|
+
/**
|
|
670
|
+
* Zawsze używaj funkcji 15 lub 16 do zapisu wartości
|
|
671
|
+
* @returns {AlwaysWriteMultipleType}
|
|
672
|
+
*/
|
|
673
|
+
get alwaysWriteMultiple(): AlwaysWriteMultipleType {
|
|
674
|
+
const cmd: string | null = rawExecutionBuilderFactory(this.objectName)
|
|
675
|
+
.get()
|
|
676
|
+
.addParameter(PropertyType.AlwaysWriteMultiple)
|
|
677
|
+
.build();
|
|
678
|
+
return this.gate.runScript(cmd!);
|
|
679
|
+
}
|
|
680
|
+
|
|
681
|
+
set alwaysWriteMultiple(value: AlwaysWriteMultipleType) {
|
|
682
|
+
const cmd: string | null = rawExecutionBuilderFactory(this.objectName)
|
|
683
|
+
.set()
|
|
684
|
+
.addParameter(PropertyType.AlwaysWriteMultiple)
|
|
685
|
+
.addParameter(value)
|
|
686
|
+
.build();
|
|
687
|
+
this.gate.runScript(cmd!);
|
|
688
|
+
}
|
|
689
|
+
|
|
690
|
+
/**
|
|
691
|
+
* Określa liczbę dyskretnych wejść / wyjść podlegających operacji odczytu / zapisu
|
|
692
|
+
* @returns {number}
|
|
693
|
+
*/
|
|
694
|
+
get inputOutputCount(): number {
|
|
695
|
+
const cmd: string | null = rawExecutionBuilderFactory(this.objectName)
|
|
696
|
+
.get()
|
|
697
|
+
.addParameter(PropertyType.InputOutputCount)
|
|
698
|
+
.build();
|
|
699
|
+
return this.gate.runScript(cmd!);
|
|
700
|
+
}
|
|
701
|
+
|
|
702
|
+
set inputOutputCount(value: number) {
|
|
703
|
+
const cmd: string | null = rawExecutionBuilderFactory(this.objectName)
|
|
704
|
+
.set()
|
|
705
|
+
.addParameter(PropertyType.InputOutputCount)
|
|
706
|
+
.addParameter(value)
|
|
707
|
+
.build();
|
|
708
|
+
this.gate.runScript(cmd!);
|
|
709
|
+
}
|
|
710
|
+
|
|
711
|
+
/**
|
|
712
|
+
* Typ wartości: 0 - Liczba całkowita, stałoprzecinkowa lub pole bitowe bez bitu znaku 1 - Liczba całkowita, stałoprzecinkowa lub pole bitowe z bitem znaku 2 - Liczba zmiennoprzecinkowa
|
|
713
|
+
* @returns {DataTypeType}
|
|
714
|
+
*/
|
|
715
|
+
get dataType(): DataTypeType {
|
|
716
|
+
const cmd: string | null = rawExecutionBuilderFactory(this.objectName)
|
|
717
|
+
.get()
|
|
718
|
+
.addParameter(PropertyType.DataType)
|
|
719
|
+
.build();
|
|
720
|
+
return this.gate.runScript(cmd!);
|
|
721
|
+
}
|
|
722
|
+
|
|
723
|
+
set dataType(value: DataTypeType) {
|
|
724
|
+
const cmd: string | null = rawExecutionBuilderFactory(this.objectName)
|
|
725
|
+
.set()
|
|
726
|
+
.addParameter(PropertyType.DataType)
|
|
727
|
+
.addParameter(value)
|
|
728
|
+
.build();
|
|
729
|
+
this.gate.runScript(cmd!);
|
|
730
|
+
}
|
|
731
|
+
|
|
732
|
+
/**
|
|
733
|
+
* Szerokość danych (1 do 4 rejestrów 16 bitowych)
|
|
734
|
+
* @returns {DataWidthType}
|
|
735
|
+
*/
|
|
736
|
+
get dataWidth(): DataWidthType {
|
|
737
|
+
const cmd: string | null = rawExecutionBuilderFactory(this.objectName)
|
|
738
|
+
.get()
|
|
739
|
+
.addParameter(PropertyType.DataWidth)
|
|
740
|
+
.build();
|
|
741
|
+
return this.gate.runScript(cmd!);
|
|
742
|
+
}
|
|
743
|
+
|
|
744
|
+
set dataWidth(value: DataWidthType) {
|
|
745
|
+
const cmd: string | null = rawExecutionBuilderFactory(this.objectName)
|
|
746
|
+
.set()
|
|
747
|
+
.addParameter(PropertyType.DataWidth)
|
|
748
|
+
.addParameter(value)
|
|
749
|
+
.build();
|
|
750
|
+
this.gate.runScript(cmd!);
|
|
751
|
+
}
|
|
752
|
+
|
|
753
|
+
/**
|
|
754
|
+
* Kolejność bajtów: 0 - kolejność słów: Big Endian; kolejność bajtów w słowie: Big Endian (SwapBytesAndWords) 1 - kolejność słów: Little Endian; kolejność bajtów w słowie: Big Endian (SwapBytes) 2 - kolejność słów: Big Endian; kolejność bajtów w słowie: Little Endian (SwapWords) 3 - kolejność słów: Little Endian; kolejność bajtów w słowie: Little Endian (NoSwap)
|
|
755
|
+
* @returns {EndiannessType}
|
|
756
|
+
*/
|
|
757
|
+
get endianness(): EndiannessType {
|
|
758
|
+
const cmd: string | null = rawExecutionBuilderFactory(this.objectName)
|
|
759
|
+
.get()
|
|
760
|
+
.addParameter(PropertyType.Endianness)
|
|
761
|
+
.build();
|
|
762
|
+
return this.gate.runScript(cmd!);
|
|
763
|
+
}
|
|
764
|
+
|
|
765
|
+
set endianness(value: EndiannessType) {
|
|
766
|
+
const cmd: string | null = rawExecutionBuilderFactory(this.objectName)
|
|
767
|
+
.set()
|
|
768
|
+
.addParameter(PropertyType.Endianness)
|
|
769
|
+
.addParameter(value)
|
|
770
|
+
.build();
|
|
771
|
+
this.gate.runScript(cmd!);
|
|
772
|
+
}
|
|
773
|
+
|
|
774
|
+
/**
|
|
775
|
+
* Liczba bitów pola bitowego. Suma BitFieldWidth i Position powinna być <= DataWidth; 0 oznacza brak pola bitowego (pełna szerokość danych DataWidth)
|
|
776
|
+
* @returns {number}
|
|
777
|
+
*/
|
|
778
|
+
get bitFieldWidth(): number {
|
|
779
|
+
const cmd: string | null = rawExecutionBuilderFactory(this.objectName)
|
|
780
|
+
.get()
|
|
781
|
+
.addParameter(PropertyType.BitFieldWidth)
|
|
782
|
+
.build();
|
|
783
|
+
return this.gate.runScript(cmd!);
|
|
784
|
+
}
|
|
785
|
+
|
|
786
|
+
set bitFieldWidth(value: number) {
|
|
787
|
+
const cmd: string | null = rawExecutionBuilderFactory(this.objectName)
|
|
788
|
+
.set()
|
|
789
|
+
.addParameter(PropertyType.BitFieldWidth)
|
|
790
|
+
.addParameter(value)
|
|
791
|
+
.build();
|
|
792
|
+
this.gate.runScript(cmd!);
|
|
793
|
+
}
|
|
794
|
+
|
|
795
|
+
/**
|
|
796
|
+
* Pozycja najmłodszego bitu pola bitowego. Suma BitFieldWidth i Position powinna być <= DataWidth.
|
|
797
|
+
* @returns {number}
|
|
798
|
+
*/
|
|
799
|
+
get bitFieldPosition(): number {
|
|
800
|
+
const cmd: string | null = rawExecutionBuilderFactory(this.objectName)
|
|
801
|
+
.get()
|
|
802
|
+
.addParameter(PropertyType.BitFieldPosition)
|
|
803
|
+
.build();
|
|
804
|
+
return this.gate.runScript(cmd!);
|
|
805
|
+
}
|
|
806
|
+
|
|
807
|
+
set bitFieldPosition(value: number) {
|
|
808
|
+
const cmd: string | null = rawExecutionBuilderFactory(this.objectName)
|
|
809
|
+
.set()
|
|
810
|
+
.addParameter(PropertyType.BitFieldPosition)
|
|
811
|
+
.addParameter(value)
|
|
812
|
+
.build();
|
|
813
|
+
this.gate.runScript(cmd!);
|
|
814
|
+
}
|
|
815
|
+
|
|
816
|
+
/**
|
|
817
|
+
* Dzielnik
|
|
818
|
+
* @returns {string}
|
|
819
|
+
*/
|
|
820
|
+
get divisor(): string {
|
|
821
|
+
const cmd: string | null = rawExecutionBuilderFactory(this.objectName)
|
|
822
|
+
.get()
|
|
823
|
+
.addParameter(PropertyType.Divisor)
|
|
824
|
+
.build();
|
|
825
|
+
return this.gate.runScript(cmd!);
|
|
826
|
+
}
|
|
827
|
+
|
|
828
|
+
set divisor(value: string) {
|
|
829
|
+
const cmd: string | null = rawExecutionBuilderFactory(this.objectName)
|
|
830
|
+
.set()
|
|
831
|
+
.addParameter(PropertyType.Divisor)
|
|
832
|
+
.addParameter(value)
|
|
833
|
+
.build();
|
|
834
|
+
this.gate.runScript(cmd!);
|
|
835
|
+
}
|
|
836
|
+
|
|
837
|
+
/**
|
|
838
|
+
* Metoda pierwszego dostępu do wartości Value: 0 - wartość początkowa Value jest odczytywana z urządzenia 1 - wartość początkowa Value jest zapisywana do urządzenia
|
|
839
|
+
* @returns {InitialValueAccessType}
|
|
840
|
+
*/
|
|
841
|
+
get initialValueAccess(): InitialValueAccessType {
|
|
842
|
+
const cmd: string | null = rawExecutionBuilderFactory(this.objectName)
|
|
843
|
+
.get()
|
|
844
|
+
.addParameter(PropertyType.InitialValueAccess)
|
|
845
|
+
.build();
|
|
846
|
+
return this.gate.runScript(cmd!);
|
|
847
|
+
}
|
|
848
|
+
|
|
849
|
+
set initialValueAccess(value: InitialValueAccessType) {
|
|
850
|
+
const cmd: string | null = rawExecutionBuilderFactory(this.objectName)
|
|
851
|
+
.set()
|
|
852
|
+
.addParameter(PropertyType.InitialValueAccess)
|
|
853
|
+
.addParameter(value)
|
|
854
|
+
.build();
|
|
855
|
+
this.gate.runScript(cmd!);
|
|
856
|
+
}
|
|
857
|
+
|
|
858
|
+
/**
|
|
859
|
+
* Zwraca ostatnio odczytaną wartość
|
|
860
|
+
* @returns {number}
|
|
861
|
+
*/
|
|
862
|
+
get value(): number {
|
|
863
|
+
const cmd: string | null = rawExecutionBuilderFactory(this.objectName)
|
|
864
|
+
.get()
|
|
865
|
+
.addParameter(PropertyType.Value)
|
|
866
|
+
.build();
|
|
867
|
+
return this.gate.runScript(cmd!);
|
|
868
|
+
}
|
|
869
|
+
|
|
870
|
+
/**
|
|
871
|
+
* Nieprzeskalowana wartość rejestru
|
|
872
|
+
* @returns {number}
|
|
873
|
+
*/
|
|
874
|
+
get rawValue(): number {
|
|
875
|
+
const cmd: string | null = rawExecutionBuilderFactory(this.objectName)
|
|
876
|
+
.get()
|
|
877
|
+
.addParameter(PropertyType.RawValue)
|
|
878
|
+
.build();
|
|
879
|
+
return this.gate.runScript(cmd!);
|
|
880
|
+
}
|
|
881
|
+
|
|
882
|
+
/**
|
|
883
|
+
* Określa, czy wartość jest zgodna ze stanem obiektu
|
|
884
|
+
* @returns {number}
|
|
885
|
+
*/
|
|
886
|
+
get isValueValid(): number {
|
|
887
|
+
const cmd: string | null = rawExecutionBuilderFactory(this.objectName)
|
|
888
|
+
.get()
|
|
889
|
+
.addParameter(PropertyType.IsValueValid)
|
|
890
|
+
.build();
|
|
891
|
+
return this.gate.runScript(cmd!);
|
|
892
|
+
}
|
|
893
|
+
|
|
894
|
+
/**
|
|
895
|
+
* 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
|
|
896
|
+
* @returns {number}
|
|
897
|
+
*/
|
|
898
|
+
get errorCode(): number {
|
|
899
|
+
const cmd: string | null = rawExecutionBuilderFactory(this.objectName)
|
|
900
|
+
.get()
|
|
901
|
+
.addParameter(PropertyType.ErrorCode)
|
|
902
|
+
.build();
|
|
903
|
+
return this.gate.runScript(cmd!);
|
|
904
|
+
}
|
|
905
|
+
}
|
|
906
|
+
|
|
907
|
+
export {
|
|
908
|
+
ModbusRTU, ModbusRTURaw, ModbusRTURemote,
|
|
909
|
+
TransmissionSpeedType, ParityType, StopBitsType, RegisterTypeType,
|
|
910
|
+
AlwaysWriteMultipleType, DataTypeType, DataWidthType, EndiannessType, InitialValueAccessType
|
|
911
|
+
}
|