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,1298 @@
1
+ // Created from: packages/grenton-api/interfaces/object_musiccast_v1.xml, object name="MusicCast" 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
+ OnChange = 3,
11
+ OnMuteChange = 4,
12
+ OnVolumeChange = 5,
13
+ OnTitleChange = 6,
14
+ OnArtistChange = 7,
15
+ OnStateChange = 8,
16
+ OnShuffleChange = 9,
17
+ OnRepeatChange = 10,
18
+ OnPowerChange = 11,
19
+ OnAlbumArtChange = 12,
20
+ OnInputChange = 13,
21
+ OnAutoPowerStandbyChange = 14,
22
+ OnGroupChange = 15
23
+ }
24
+
25
+ enum PropertyType {
26
+ Host = 0,
27
+ UpdatePeriod = 1,
28
+ Status = 2,
29
+ ErrorCode = 3,
30
+ Volume = 4,
31
+ Mute = 5,
32
+ Artist = 6,
33
+ Title = 7,
34
+ State = 8,
35
+ Shuffle = 9,
36
+ Repeat = 10,
37
+ Power = 11,
38
+ AlbumArt = 12,
39
+ ObjectID = 13,
40
+ ServerID = 14,
41
+ Name = 15,
42
+ Role = 16,
43
+ Input = 17,
44
+ AutoPowerStandby = 18
45
+ }
46
+
47
+ enum MethodType {
48
+ Play = 0,
49
+ Pause = 1,
50
+ Stop = 2,
51
+ Next = 3,
52
+ Prev = 4,
53
+ VolumeUp = 5,
54
+ VolumeDown = 6,
55
+ SwitchMute = 7,
56
+ SwitchPlay = 8,
57
+ DestroyGroup = 9,
58
+ JoinGroup = 10,
59
+ LeaveGroup = 11,
60
+ SetInput = 12
61
+ }
62
+
63
+ enum MuteType {
64
+ OFF = 0,
65
+ ON = 1
66
+ }
67
+
68
+ enum ShuffleType {
69
+ Off = 1,
70
+ On = 2,
71
+ Songs = 3,
72
+ Albums = 4
73
+ }
74
+
75
+ enum RepeatType {
76
+ Off = 1,
77
+ One = 2,
78
+ All = 3
79
+ }
80
+
81
+ enum PowerType {
82
+ Standby = 0,
83
+ On = 1
84
+ }
85
+
86
+ enum AutoPowerStandbyType {
87
+ OFF = 0,
88
+ ON = 1
89
+ }
90
+
91
+ declare class MusicCastRaw {
92
+ add_event(event: EventType, callback: () => void): void;
93
+ get(property: PropertyType): any;
94
+ set(property: PropertyType, value: any): void;
95
+ execute(method: MethodType, ...args: any[]): any;
96
+ }
97
+
98
+ interface IMusicCast {
99
+ /**
100
+ * Zdarzenie wywoływane po nawiązaniu połączenia z głośnikiem
101
+ * @param callback
102
+ */
103
+ addOnConnected: (callback: () => void) => void
104
+ /**
105
+ * Zdarzenie wywoływane po zerwaniu połączenia z głośnikiem
106
+ * @param callback
107
+ */
108
+ addOnDisconnected: (callback: () => void) => void
109
+ /**
110
+ * Zdarzenie wywoływane po wystąpieniu błędu
111
+ * @param callback
112
+ */
113
+ addOnError: (callback: () => void) => void
114
+ /**
115
+ * Zdarzenie wywoływane po zmianie wartości Volume, Mute, Artist, Title, State, Shuffle, Repeat, Power, AlbumArt, Input, AutoPowerStandby, ServerID, Role
116
+ * @param callback
117
+ */
118
+ addOnChange: (callback: () => void) => void
119
+ /**
120
+ * Zdarzenie wywoływane po zmianie wartości Mute
121
+ * @param callback
122
+ */
123
+ addOnMuteChange: (callback: () => void) => void
124
+ /**
125
+ * Zdarzenie wywoływane po zmianie wartości Volume
126
+ * @param callback
127
+ */
128
+ addOnVolumeChange: (callback: () => void) => void
129
+ /**
130
+ * Zdarzenie wywoływane po zmianie wartości Title
131
+ * @param callback
132
+ */
133
+ addOnTitleChange: (callback: () => void) => void
134
+ /**
135
+ * Zdarzenie wywoływane po zmianie wartości Artist
136
+ * @param callback
137
+ */
138
+ addOnArtistChange: (callback: () => void) => void
139
+ /**
140
+ * Zdarzenie wywoływane po zmianie wartości State
141
+ * @param callback
142
+ */
143
+ addOnStateChange: (callback: () => void) => void
144
+ /**
145
+ * Zdarzenie wywoływane po zmianie wartości Shuffle
146
+ * @param callback
147
+ */
148
+ addOnShuffleChange: (callback: () => void) => void
149
+ /**
150
+ * Zdarzenie wywoływane po zmianie wartości Repeat
151
+ * @param callback
152
+ */
153
+ addOnRepeatChange: (callback: () => void) => void
154
+ /**
155
+ * Zdarzenie wywoływane po zmianie wartości Power
156
+ * @param callback
157
+ */
158
+ addOnPowerChange: (callback: () => void) => void
159
+ /**
160
+ * Zdarzenie wywoływane po zmianie wartości AlbumArt
161
+ * @param callback
162
+ */
163
+ addOnAlbumArtChange: (callback: () => void) => void
164
+ /**
165
+ * Zdarzenie wywoływane po zmianie wartości Input
166
+ * @param callback
167
+ */
168
+ addOnInputChange: (callback: () => void) => void
169
+ /**
170
+ * Zdarzenie wywoływane po zmianie wartości AutoPowerStandby
171
+ * @param callback
172
+ */
173
+ addOnAutoPowerStandbyChange: (callback: () => void) => void
174
+ /**
175
+ * Zdarzenie wywoływane po zmianie w obrębie grupy (ServerID, Role)
176
+ * @param callback
177
+ */
178
+ addOnGroupChange: (callback: () => void) => void
179
+ /** Rozpoczyna odtwarzanie */
180
+ play: () => void
181
+ /** Wstrzymuje odtwarzanie (pauza) */
182
+ pause: () => void
183
+ /** Zatrzymuje odtwarzanie */
184
+ stop: () => void
185
+ /** Przełącza na następną ścieżkę */
186
+ next: () => void
187
+ /** Przełącza na poprzednią ścieżkę */
188
+ prev: () => void
189
+ /**
190
+ * Zwiększa głośność o wartość określoną w procentach
191
+ * @param {number} volumeStep
192
+ */
193
+ volumeUp: (volumeStep: number) => void
194
+ /**
195
+ * Zmniejsza głośność o wartość określoną w procentach
196
+ * @param {number} volumeStep
197
+ */
198
+ volumeDown: (volumeStep: number) => void
199
+ /** Przełącza stan wyciszenia */
200
+ switchMute: () => void
201
+ /** Przełącza stan odtwarzania pomiędzy pauzą, a odtwarzaniem */
202
+ switchPlay: () => void
203
+ /** Rozbija bieżącą grupę głośników */
204
+ destroyGroup: () => void
205
+ /**
206
+ * Dodaje głośnik do grupy określonej przez ServerID
207
+ * @param {string} serverID
208
+ */
209
+ joinGroup: (serverID: string) => void
210
+ /** Usuwa głośnik z bieżącej grupy */
211
+ leaveGroup: () => void
212
+ /**
213
+ * Ustawia źródło odtwarzania
214
+ * @param {string} input
215
+ */
216
+ setInput: (input: string, autoplay?: number) => void
217
+ /**
218
+ * Ustawia głośność w zakresie od 0% do 100%
219
+ * @param {number} volume
220
+ */
221
+ setVolume: (volume: number) => void
222
+ /**
223
+ * Ustawia stan wyciszenia
224
+ * @param {MuteType} mute
225
+ */
226
+ setMute: (mute: MuteType) => void
227
+ /**
228
+ * Ustawia tryb losowego odtwarzania
229
+ * @param {ShuffleType} shuffle
230
+ */
231
+ setShuffle: (shuffle: ShuffleType) => void
232
+ /**
233
+ * Ustawia tryb powtarzania
234
+ * @param {RepeatType} repeat
235
+ */
236
+ setRepeat: (repeat: RepeatType) => void
237
+ /**
238
+ * Ustawia stan zasilania
239
+ * @param {PowerType} power
240
+ */
241
+ setPower: (power: PowerType) => void
242
+ /**
243
+ * Ustawia stan AutoPowerStandby
244
+ * @param {AutoPowerStandbyType} autoPowerStandby
245
+ */
246
+ setAutoPowerStandby: (autoPowerStandby: AutoPowerStandbyType) => void
247
+ /** Adres IP MusicCast */
248
+ host: string
249
+ /** Okres aktualizacji stanu */
250
+ updatePeriod: number
251
+ /** Stan komunikacji z głośnikiem: 0 - brak połączenia, 1 - połączono */
252
+ readonly status: number
253
+ /** Ostatni kod błędu: 0 - brak błędu, wartości ujemne - ujemny kod odpowiedzi HTTP, wartości dotatnie - kod błędu Yamaha Extended Control */
254
+ readonly errorCode: number
255
+ /** Głośność w zakresie od 0% do 100% */
256
+ readonly volume: number
257
+ /** Stan wyciszenia: 0 - wyłączone, 1 - włączone */
258
+ readonly mute: MuteType
259
+ /** Nazwa autora */
260
+ readonly artist: string
261
+ /** Tytuł utworu */
262
+ readonly title: string
263
+ /** Stan odtwarzania: 1 - odtwarzanie, 2 - zatrzymane, 3 - pauza */
264
+ readonly state: number
265
+ /** Tryb odtwarzania losowego: 1 - wyłączone, 2 - włączone, 3 - utwory, 4 - albumy */
266
+ readonly shuffle: ShuffleType
267
+ /** Tryb powtarzania: 1 - wyłączone, 2 - jeden utwór, 3 - wszystkie utwory */
268
+ readonly repeat: RepeatType
269
+ /** Stan zasilania: 0 - uśpienie, 1 - włączone */
270
+ readonly power: PowerType
271
+ /** Adres okładki albumu */
272
+ readonly albumArt: string
273
+ /** ID obiektu */
274
+ readonly objectID: string
275
+ /** ID obiektu serwera grupy */
276
+ readonly serverID: string
277
+ /** Nazwa głośnika */
278
+ readonly name: string
279
+ /** Rola głośnika w grupie: 1 - nie jest częścią grupy, 2 - klient, 3 - serwer */
280
+ readonly role: number
281
+ /** Źródło odtwarzania */
282
+ readonly input: string
283
+ /** Stan automatycznego uśpienia: 0 - wyłączone, 1 - włączone */
284
+ readonly autoPowerStandby: AutoPowerStandbyType
285
+ }
286
+
287
+ class MusicCast implements IMusicCast {
288
+ private onConnectedCallbacks: Array<() => void> = [];
289
+ private onDisconnectedCallbacks: Array<() => void> = [];
290
+ private onErrorCallbacks: Array<() => void> = [];
291
+ private onChangeCallbacks: Array<() => void> = [];
292
+ private onMuteChangeCallbacks: Array<() => void> = [];
293
+ private onVolumeChangeCallbacks: Array<() => void> = [];
294
+ private onTitleChangeCallbacks: Array<() => void> = [];
295
+ private onArtistChangeCallbacks: Array<() => void> = [];
296
+ private onStateChangeCallbacks: Array<() => void> = [];
297
+ private onShuffleChangeCallbacks: Array<() => void> = [];
298
+ private onRepeatChangeCallbacks: Array<() => void> = [];
299
+ private onPowerChangeCallbacks: Array<() => void> = [];
300
+ private onAlbumArtChangeCallbacks: Array<() => void> = [];
301
+ private onInputChangeCallbacks: Array<() => void> = [];
302
+ private onAutoPowerStandbyChangeCallbacks: Array<() => void> = [];
303
+ private onGroupChangeCallbacks: Array<() => void> = [];
304
+
305
+ constructor(private raw: MusicCastRaw) {
306
+ this.raw.add_event(EventType.OnConnected, () => {
307
+ this.onConnectedCallbacks.forEach(callback => { callback(); });
308
+ });
309
+ this.raw.add_event(EventType.OnDisconnected, () => {
310
+ this.onDisconnectedCallbacks.forEach(callback => { callback(); });
311
+ });
312
+ this.raw.add_event(EventType.OnError, () => {
313
+ this.onErrorCallbacks.forEach(callback => { callback(); });
314
+ });
315
+ this.raw.add_event(EventType.OnChange, () => {
316
+ this.onChangeCallbacks.forEach(callback => { callback(); });
317
+ });
318
+ this.raw.add_event(EventType.OnMuteChange, () => {
319
+ this.onMuteChangeCallbacks.forEach(callback => { callback(); });
320
+ });
321
+ this.raw.add_event(EventType.OnVolumeChange, () => {
322
+ this.onVolumeChangeCallbacks.forEach(callback => { callback(); });
323
+ });
324
+ this.raw.add_event(EventType.OnTitleChange, () => {
325
+ this.onTitleChangeCallbacks.forEach(callback => { callback(); });
326
+ });
327
+ this.raw.add_event(EventType.OnArtistChange, () => {
328
+ this.onArtistChangeCallbacks.forEach(callback => { callback(); });
329
+ });
330
+ this.raw.add_event(EventType.OnStateChange, () => {
331
+ this.onStateChangeCallbacks.forEach(callback => { callback(); });
332
+ });
333
+ this.raw.add_event(EventType.OnShuffleChange, () => {
334
+ this.onShuffleChangeCallbacks.forEach(callback => { callback(); });
335
+ });
336
+ this.raw.add_event(EventType.OnRepeatChange, () => {
337
+ this.onRepeatChangeCallbacks.forEach(callback => { callback(); });
338
+ });
339
+ this.raw.add_event(EventType.OnPowerChange, () => {
340
+ this.onPowerChangeCallbacks.forEach(callback => { callback(); });
341
+ });
342
+ this.raw.add_event(EventType.OnAlbumArtChange, () => {
343
+ this.onAlbumArtChangeCallbacks.forEach(callback => { callback(); });
344
+ });
345
+ this.raw.add_event(EventType.OnInputChange, () => {
346
+ this.onInputChangeCallbacks.forEach(callback => { callback(); });
347
+ });
348
+ this.raw.add_event(EventType.OnAutoPowerStandbyChange, () => {
349
+ this.onAutoPowerStandbyChangeCallbacks.forEach(callback => { callback(); });
350
+ });
351
+ this.raw.add_event(EventType.OnGroupChange, () => {
352
+ this.onGroupChangeCallbacks.forEach(callback => { callback(); });
353
+ });
354
+ }
355
+
356
+ /**
357
+ * Zdarzenie wywoływane po nawiązaniu połączenia z głośnikiem
358
+ * @param callback
359
+ */
360
+ addOnConnected(callback: () => void): void {
361
+ this.onConnectedCallbacks.push(callback);
362
+ }
363
+ /**
364
+ * Zdarzenie wywoływane po zerwaniu połączenia z głośnikiem
365
+ * @param callback
366
+ */
367
+ addOnDisconnected(callback: () => void): void {
368
+ this.onDisconnectedCallbacks.push(callback);
369
+ }
370
+ /**
371
+ * Zdarzenie wywoływane po wystąpieniu błędu
372
+ * @param callback
373
+ */
374
+ addOnError(callback: () => void): void {
375
+ this.onErrorCallbacks.push(callback);
376
+ }
377
+ /**
378
+ * Zdarzenie wywoływane po zmianie wartości Volume, Mute, Artist, Title, State, Shuffle, Repeat, Power, AlbumArt, Input, AutoPowerStandby, ServerID, Role
379
+ * @param callback
380
+ */
381
+ addOnChange(callback: () => void): void {
382
+ this.onChangeCallbacks.push(callback);
383
+ }
384
+ /**
385
+ * Zdarzenie wywoływane po zmianie wartości Mute
386
+ * @param callback
387
+ */
388
+ addOnMuteChange(callback: () => void): void {
389
+ this.onMuteChangeCallbacks.push(callback);
390
+ }
391
+ /**
392
+ * Zdarzenie wywoływane po zmianie wartości Volume
393
+ * @param callback
394
+ */
395
+ addOnVolumeChange(callback: () => void): void {
396
+ this.onVolumeChangeCallbacks.push(callback);
397
+ }
398
+ /**
399
+ * Zdarzenie wywoływane po zmianie wartości Title
400
+ * @param callback
401
+ */
402
+ addOnTitleChange(callback: () => void): void {
403
+ this.onTitleChangeCallbacks.push(callback);
404
+ }
405
+ /**
406
+ * Zdarzenie wywoływane po zmianie wartości Artist
407
+ * @param callback
408
+ */
409
+ addOnArtistChange(callback: () => void): void {
410
+ this.onArtistChangeCallbacks.push(callback);
411
+ }
412
+ /**
413
+ * Zdarzenie wywoływane po zmianie wartości State
414
+ * @param callback
415
+ */
416
+ addOnStateChange(callback: () => void): void {
417
+ this.onStateChangeCallbacks.push(callback);
418
+ }
419
+ /**
420
+ * Zdarzenie wywoływane po zmianie wartości Shuffle
421
+ * @param callback
422
+ */
423
+ addOnShuffleChange(callback: () => void): void {
424
+ this.onShuffleChangeCallbacks.push(callback);
425
+ }
426
+ /**
427
+ * Zdarzenie wywoływane po zmianie wartości Repeat
428
+ * @param callback
429
+ */
430
+ addOnRepeatChange(callback: () => void): void {
431
+ this.onRepeatChangeCallbacks.push(callback);
432
+ }
433
+ /**
434
+ * Zdarzenie wywoływane po zmianie wartości Power
435
+ * @param callback
436
+ */
437
+ addOnPowerChange(callback: () => void): void {
438
+ this.onPowerChangeCallbacks.push(callback);
439
+ }
440
+ /**
441
+ * Zdarzenie wywoływane po zmianie wartości AlbumArt
442
+ * @param callback
443
+ */
444
+ addOnAlbumArtChange(callback: () => void): void {
445
+ this.onAlbumArtChangeCallbacks.push(callback);
446
+ }
447
+ /**
448
+ * Zdarzenie wywoływane po zmianie wartości Input
449
+ * @param callback
450
+ */
451
+ addOnInputChange(callback: () => void): void {
452
+ this.onInputChangeCallbacks.push(callback);
453
+ }
454
+ /**
455
+ * Zdarzenie wywoływane po zmianie wartości AutoPowerStandby
456
+ * @param callback
457
+ */
458
+ addOnAutoPowerStandbyChange(callback: () => void): void {
459
+ this.onAutoPowerStandbyChangeCallbacks.push(callback);
460
+ }
461
+ /**
462
+ * Zdarzenie wywoływane po zmianie w obrębie grupy (ServerID, Role)
463
+ * @param callback
464
+ */
465
+ addOnGroupChange(callback: () => void): void {
466
+ this.onGroupChangeCallbacks.push(callback);
467
+ }
468
+ /** Rozpoczyna odtwarzanie */
469
+ play(): void {
470
+ this.raw.execute(MethodType.Play);
471
+ }
472
+ /** Wstrzymuje odtwarzanie (pauza) */
473
+ pause(): void {
474
+ this.raw.execute(MethodType.Pause);
475
+ }
476
+ /** Zatrzymuje odtwarzanie */
477
+ stop(): void {
478
+ this.raw.execute(MethodType.Stop);
479
+ }
480
+ /** Przełącza na następną ścieżkę */
481
+ next(): void {
482
+ this.raw.execute(MethodType.Next);
483
+ }
484
+ /** Przełącza na poprzednią ścieżkę */
485
+ prev(): void {
486
+ this.raw.execute(MethodType.Prev);
487
+ }
488
+ /**
489
+ * Zwiększa głośność o wartość określoną w procentach
490
+ * @param {number} volumeStep
491
+ */
492
+ volumeUp(volumeStep: number): void {
493
+ this.raw.execute(MethodType.VolumeUp, volumeStep);
494
+ }
495
+ /**
496
+ * Zmniejsza głośność o wartość określoną w procentach
497
+ * @param {number} volumeStep
498
+ */
499
+ volumeDown(volumeStep: number): void {
500
+ this.raw.execute(MethodType.VolumeDown, volumeStep);
501
+ }
502
+ /** Przełącza stan wyciszenia */
503
+ switchMute(): void {
504
+ this.raw.execute(MethodType.SwitchMute);
505
+ }
506
+ /** Przełącza stan odtwarzania pomiędzy pauzą, a odtwarzaniem */
507
+ switchPlay(): void {
508
+ this.raw.execute(MethodType.SwitchPlay);
509
+ }
510
+ /** Rozbija bieżącą grupę głośników */
511
+ destroyGroup(): void {
512
+ this.raw.execute(MethodType.DestroyGroup);
513
+ }
514
+ /**
515
+ * Dodaje głośnik do grupy określonej przez ServerID
516
+ * @param {string} serverID
517
+ */
518
+ joinGroup(serverID: string): void {
519
+ this.raw.execute(MethodType.JoinGroup, serverID);
520
+ }
521
+ /** Usuwa głośnik z bieżącej grupy */
522
+ leaveGroup(): void {
523
+ this.raw.execute(MethodType.LeaveGroup);
524
+ }
525
+ /**
526
+ * Ustawia źródło odtwarzania
527
+ * @param {string} input
528
+ */
529
+ setInput(input: string, autoplay?: number): void {
530
+ this.raw.execute(MethodType.SetInput, input, autoplay);
531
+ }
532
+ /**
533
+ * Ustawia głośność w zakresie od 0% do 100%
534
+ * @param {number} volume
535
+ */
536
+ setVolume(volume: number): void {
537
+ this.raw.set(PropertyType.Volume, volume);
538
+ }
539
+ /**
540
+ * Ustawia stan wyciszenia
541
+ * @param {MuteType} mute
542
+ */
543
+ setMute(mute: MuteType): void {
544
+ this.raw.set(PropertyType.Mute, mute);
545
+ }
546
+ /**
547
+ * Ustawia tryb losowego odtwarzania
548
+ * @param {ShuffleType} shuffle
549
+ */
550
+ setShuffle(shuffle: ShuffleType): void {
551
+ this.raw.set(PropertyType.Shuffle, shuffle);
552
+ }
553
+ /**
554
+ * Ustawia tryb powtarzania
555
+ * @param {RepeatType} repeat
556
+ */
557
+ setRepeat(repeat: RepeatType): void {
558
+ this.raw.set(PropertyType.Repeat, repeat);
559
+ }
560
+ /**
561
+ * Ustawia stan zasilania
562
+ * @param {PowerType} power
563
+ */
564
+ setPower(power: PowerType): void {
565
+ this.raw.set(PropertyType.Power, power);
566
+ }
567
+ /**
568
+ * Ustawia stan AutoPowerStandby
569
+ * @param {AutoPowerStandbyType} autoPowerStandby
570
+ */
571
+ setAutoPowerStandby(autoPowerStandby: AutoPowerStandbyType): void {
572
+ this.raw.set(PropertyType.AutoPowerStandby, autoPowerStandby);
573
+ }
574
+ /**
575
+ * Adres IP MusicCast
576
+ * @returns {string}
577
+ */
578
+ get host(): string {
579
+ return this.raw.get(PropertyType.Host);
580
+ }
581
+ set host(value: string) {
582
+ this.raw.set(PropertyType.Host, value);
583
+ }
584
+ /**
585
+ * Okres aktualizacji stanu
586
+ * @returns {number}
587
+ */
588
+ get updatePeriod(): number {
589
+ return this.raw.get(PropertyType.UpdatePeriod);
590
+ }
591
+ set updatePeriod(value: number) {
592
+ this.raw.set(PropertyType.UpdatePeriod, value);
593
+ }
594
+ /**
595
+ * Stan komunikacji z głośnikiem: 0 - brak połączenia, 1 - połączono
596
+ * @returns {number}
597
+ */
598
+ get status(): number {
599
+ return this.raw.get(PropertyType.Status);
600
+ }
601
+ /**
602
+ * Ostatni kod błędu: 0 - brak błędu, wartości ujemne - ujemny kod odpowiedzi HTTP, wartości dotatnie - kod błędu Yamaha Extended Control
603
+ * @returns {number}
604
+ */
605
+ get errorCode(): number {
606
+ return this.raw.get(PropertyType.ErrorCode);
607
+ }
608
+ /**
609
+ * Głośność w zakresie od 0% do 100%
610
+ * @returns {number}
611
+ */
612
+ get volume(): number {
613
+ return this.raw.get(PropertyType.Volume);
614
+ }
615
+ /**
616
+ * Stan wyciszenia: 0 - wyłączone, 1 - włączone
617
+ * @returns {MuteType}
618
+ */
619
+ get mute(): MuteType {
620
+ return this.raw.get(PropertyType.Mute);
621
+ }
622
+ /**
623
+ * Nazwa autora
624
+ * @returns {string}
625
+ */
626
+ get artist(): string {
627
+ return this.raw.get(PropertyType.Artist);
628
+ }
629
+ /**
630
+ * Tytuł utworu
631
+ * @returns {string}
632
+ */
633
+ get title(): string {
634
+ return this.raw.get(PropertyType.Title);
635
+ }
636
+ /**
637
+ * Stan odtwarzania: 1 - odtwarzanie, 2 - zatrzymane, 3 - pauza
638
+ * @returns {number}
639
+ */
640
+ get state(): number {
641
+ return this.raw.get(PropertyType.State);
642
+ }
643
+ /**
644
+ * Tryb odtwarzania losowego: 1 - wyłączone, 2 - włączone, 3 - utwory, 4 - albumy
645
+ * @returns {ShuffleType}
646
+ */
647
+ get shuffle(): ShuffleType {
648
+ return this.raw.get(PropertyType.Shuffle);
649
+ }
650
+ /**
651
+ * Tryb powtarzania: 1 - wyłączone, 2 - jeden utwór, 3 - wszystkie utwory
652
+ * @returns {RepeatType}
653
+ */
654
+ get repeat(): RepeatType {
655
+ return this.raw.get(PropertyType.Repeat);
656
+ }
657
+ /**
658
+ * Stan zasilania: 0 - uśpienie, 1 - włączone
659
+ * @returns {PowerType}
660
+ */
661
+ get power(): PowerType {
662
+ return this.raw.get(PropertyType.Power);
663
+ }
664
+ /**
665
+ * Adres okładki albumu
666
+ * @returns {string}
667
+ */
668
+ get albumArt(): string {
669
+ return this.raw.get(PropertyType.AlbumArt);
670
+ }
671
+ /**
672
+ * ID obiektu
673
+ * @returns {string}
674
+ */
675
+ get objectID(): string {
676
+ return this.raw.get(PropertyType.ObjectID);
677
+ }
678
+ /**
679
+ * ID obiektu serwera grupy
680
+ * @returns {string}
681
+ */
682
+ get serverID(): string {
683
+ return this.raw.get(PropertyType.ServerID);
684
+ }
685
+ /**
686
+ * Nazwa głośnika
687
+ * @returns {string}
688
+ */
689
+ get name(): string {
690
+ return this.raw.get(PropertyType.Name);
691
+ }
692
+ /**
693
+ * Rola głośnika w grupie: 1 - nie jest częścią grupy, 2 - klient, 3 - serwer
694
+ * @returns {number}
695
+ */
696
+ get role(): number {
697
+ return this.raw.get(PropertyType.Role);
698
+ }
699
+ /**
700
+ * Źródło odtwarzania
701
+ * @returns {string}
702
+ */
703
+ get input(): string {
704
+ return this.raw.get(PropertyType.Input);
705
+ }
706
+ /**
707
+ * Stan automatycznego uśpienia: 0 - wyłączone, 1 - włączone
708
+ * @returns {AutoPowerStandbyType}
709
+ */
710
+ get autoPowerStandby(): AutoPowerStandbyType {
711
+ return this.raw.get(PropertyType.AutoPowerStandby);
712
+ }
713
+ }
714
+
715
+ class MusicCastRemote implements IMusicCast {
716
+ constructor(private objectName: string, private gate: RemoteGate) {
717
+
718
+ }
719
+
720
+ /**
721
+ * Zdarzenie wywoływane po nawiązaniu połączenia z głośnikiem
722
+ * @param callback
723
+ */
724
+ addOnConnected(_callback: () => void): void {
725
+ // Remote events are not supported
726
+ }
727
+ /**
728
+ * Zdarzenie wywoływane po zerwaniu połączenia z głośnikiem
729
+ * @param callback
730
+ */
731
+ addOnDisconnected(_callback: () => void): void {
732
+ // Remote events are not supported
733
+ }
734
+ /**
735
+ * Zdarzenie wywoływane po wystąpieniu błędu
736
+ * @param callback
737
+ */
738
+ addOnError(_callback: () => void): void {
739
+ // Remote events are not supported
740
+ }
741
+ /**
742
+ * Zdarzenie wywoływane po zmianie wartości Volume, Mute, Artist, Title, State, Shuffle, Repeat, Power, AlbumArt, Input, AutoPowerStandby, ServerID, Role
743
+ * @param callback
744
+ */
745
+ addOnChange(_callback: () => void): void {
746
+ // Remote events are not supported
747
+ }
748
+ /**
749
+ * Zdarzenie wywoływane po zmianie wartości Mute
750
+ * @param callback
751
+ */
752
+ addOnMuteChange(_callback: () => void): void {
753
+ // Remote events are not supported
754
+ }
755
+ /**
756
+ * Zdarzenie wywoływane po zmianie wartości Volume
757
+ * @param callback
758
+ */
759
+ addOnVolumeChange(_callback: () => void): void {
760
+ // Remote events are not supported
761
+ }
762
+ /**
763
+ * Zdarzenie wywoływane po zmianie wartości Title
764
+ * @param callback
765
+ */
766
+ addOnTitleChange(_callback: () => void): void {
767
+ // Remote events are not supported
768
+ }
769
+ /**
770
+ * Zdarzenie wywoływane po zmianie wartości Artist
771
+ * @param callback
772
+ */
773
+ addOnArtistChange(_callback: () => void): void {
774
+ // Remote events are not supported
775
+ }
776
+ /**
777
+ * Zdarzenie wywoływane po zmianie wartości State
778
+ * @param callback
779
+ */
780
+ addOnStateChange(_callback: () => void): void {
781
+ // Remote events are not supported
782
+ }
783
+ /**
784
+ * Zdarzenie wywoływane po zmianie wartości Shuffle
785
+ * @param callback
786
+ */
787
+ addOnShuffleChange(_callback: () => void): void {
788
+ // Remote events are not supported
789
+ }
790
+ /**
791
+ * Zdarzenie wywoływane po zmianie wartości Repeat
792
+ * @param callback
793
+ */
794
+ addOnRepeatChange(_callback: () => void): void {
795
+ // Remote events are not supported
796
+ }
797
+ /**
798
+ * Zdarzenie wywoływane po zmianie wartości Power
799
+ * @param callback
800
+ */
801
+ addOnPowerChange(_callback: () => void): void {
802
+ // Remote events are not supported
803
+ }
804
+ /**
805
+ * Zdarzenie wywoływane po zmianie wartości AlbumArt
806
+ * @param callback
807
+ */
808
+ addOnAlbumArtChange(_callback: () => void): void {
809
+ // Remote events are not supported
810
+ }
811
+ /**
812
+ * Zdarzenie wywoływane po zmianie wartości Input
813
+ * @param callback
814
+ */
815
+ addOnInputChange(_callback: () => void): void {
816
+ // Remote events are not supported
817
+ }
818
+ /**
819
+ * Zdarzenie wywoływane po zmianie wartości AutoPowerStandby
820
+ * @param callback
821
+ */
822
+ addOnAutoPowerStandbyChange(_callback: () => void): void {
823
+ // Remote events are not supported
824
+ }
825
+ /**
826
+ * Zdarzenie wywoływane po zmianie w obrębie grupy (ServerID, Role)
827
+ * @param callback
828
+ */
829
+ addOnGroupChange(_callback: () => void): void {
830
+ // Remote events are not supported
831
+ }
832
+
833
+ /** Rozpoczyna odtwarzanie */
834
+ play(): void {
835
+ const cmd: string | null = rawExecutionBuilderFactory(this.objectName)
836
+ .execute()
837
+ .addParameter(MethodType.Play)
838
+ .build();
839
+ this.gate.runScript(cmd!);
840
+ }
841
+
842
+ /** Wstrzymuje odtwarzanie (pauza) */
843
+ pause(): void {
844
+ const cmd: string | null = rawExecutionBuilderFactory(this.objectName)
845
+ .execute()
846
+ .addParameter(MethodType.Pause)
847
+ .build();
848
+ this.gate.runScript(cmd!);
849
+ }
850
+
851
+ /** Zatrzymuje odtwarzanie */
852
+ stop(): void {
853
+ const cmd: string | null = rawExecutionBuilderFactory(this.objectName)
854
+ .execute()
855
+ .addParameter(MethodType.Stop)
856
+ .build();
857
+ this.gate.runScript(cmd!);
858
+ }
859
+
860
+ /** Przełącza na następną ścieżkę */
861
+ next(): void {
862
+ const cmd: string | null = rawExecutionBuilderFactory(this.objectName)
863
+ .execute()
864
+ .addParameter(MethodType.Next)
865
+ .build();
866
+ this.gate.runScript(cmd!);
867
+ }
868
+
869
+ /** Przełącza na poprzednią ścieżkę */
870
+ prev(): void {
871
+ const cmd: string | null = rawExecutionBuilderFactory(this.objectName)
872
+ .execute()
873
+ .addParameter(MethodType.Prev)
874
+ .build();
875
+ this.gate.runScript(cmd!);
876
+ }
877
+
878
+ /**
879
+ * Zwiększa głośność o wartość określoną w procentach
880
+ * @param {number} volumeStep
881
+ */
882
+ volumeUp(volumeStep: number): void {
883
+ const cmd: string | null = rawExecutionBuilderFactory(this.objectName)
884
+ .execute()
885
+ .addParameter(MethodType.VolumeUp)
886
+ .addParameter(volumeStep)
887
+ .build();
888
+ this.gate.runScript(cmd!);
889
+ }
890
+
891
+ /**
892
+ * Zmniejsza głośność o wartość określoną w procentach
893
+ * @param {number} volumeStep
894
+ */
895
+ volumeDown(volumeStep: number): void {
896
+ const cmd: string | null = rawExecutionBuilderFactory(this.objectName)
897
+ .execute()
898
+ .addParameter(MethodType.VolumeDown)
899
+ .addParameter(volumeStep)
900
+ .build();
901
+ this.gate.runScript(cmd!);
902
+ }
903
+
904
+ /** Przełącza stan wyciszenia */
905
+ switchMute(): void {
906
+ const cmd: string | null = rawExecutionBuilderFactory(this.objectName)
907
+ .execute()
908
+ .addParameter(MethodType.SwitchMute)
909
+ .build();
910
+ this.gate.runScript(cmd!);
911
+ }
912
+
913
+ /** Przełącza stan odtwarzania pomiędzy pauzą, a odtwarzaniem */
914
+ switchPlay(): void {
915
+ const cmd: string | null = rawExecutionBuilderFactory(this.objectName)
916
+ .execute()
917
+ .addParameter(MethodType.SwitchPlay)
918
+ .build();
919
+ this.gate.runScript(cmd!);
920
+ }
921
+
922
+ /** Rozbija bieżącą grupę głośników */
923
+ destroyGroup(): void {
924
+ const cmd: string | null = rawExecutionBuilderFactory(this.objectName)
925
+ .execute()
926
+ .addParameter(MethodType.DestroyGroup)
927
+ .build();
928
+ this.gate.runScript(cmd!);
929
+ }
930
+
931
+ /**
932
+ * Dodaje głośnik do grupy określonej przez ServerID
933
+ * @param {string} serverID
934
+ */
935
+ joinGroup(serverID: string): void {
936
+ const cmd: string | null = rawExecutionBuilderFactory(this.objectName)
937
+ .execute()
938
+ .addParameter(MethodType.JoinGroup)
939
+ .addParameter(serverID)
940
+ .build();
941
+ this.gate.runScript(cmd!);
942
+ }
943
+
944
+ /** Usuwa głośnik z bieżącej grupy */
945
+ leaveGroup(): void {
946
+ const cmd: string | null = rawExecutionBuilderFactory(this.objectName)
947
+ .execute()
948
+ .addParameter(MethodType.LeaveGroup)
949
+ .build();
950
+ this.gate.runScript(cmd!);
951
+ }
952
+
953
+ /**
954
+ * Ustawia źródło odtwarzania
955
+ * @param {string} input
956
+ */
957
+ setInput(input: string, autoplay?: number): void {
958
+ const builder = rawExecutionBuilderFactory(this.objectName)
959
+ .execute()
960
+ .addParameter(MethodType.SetInput)
961
+ .addParameter(input);
962
+
963
+ if(autoplay !== undefined) {
964
+ builder.addParameter(autoplay);
965
+ }
966
+
967
+ const cmd: string | null = builder.build();
968
+ this.gate.runScript(cmd!);
969
+ }
970
+
971
+ /**
972
+ * Ustawia głośność w zakresie od 0% do 100%
973
+ * @param {number} volume
974
+ */
975
+ setVolume(volume: number): void {
976
+ const cmd: string | null = rawExecutionBuilderFactory(this.objectName)
977
+ .set()
978
+ .addParameter(PropertyType.Volume)
979
+ .addParameter(volume)
980
+ .build();
981
+ this.gate.runScript(cmd!);
982
+ }
983
+
984
+ /**
985
+ * Ustawia stan wyciszenia
986
+ * @param {MuteType} mute
987
+ */
988
+ setMute(mute: MuteType): void {
989
+ const cmd: string | null = rawExecutionBuilderFactory(this.objectName)
990
+ .set()
991
+ .addParameter(PropertyType.Mute)
992
+ .addParameter(mute)
993
+ .build();
994
+ this.gate.runScript(cmd!);
995
+ }
996
+
997
+ /**
998
+ * Ustawia tryb losowego odtwarzania
999
+ * @param {ShuffleType} shuffle
1000
+ */
1001
+ setShuffle(shuffle: ShuffleType): void {
1002
+ const cmd: string | null = rawExecutionBuilderFactory(this.objectName)
1003
+ .set()
1004
+ .addParameter(PropertyType.Shuffle)
1005
+ .addParameter(shuffle)
1006
+ .build();
1007
+ this.gate.runScript(cmd!);
1008
+ }
1009
+
1010
+ /**
1011
+ * Ustawia tryb powtarzania
1012
+ * @param {RepeatType} repeat
1013
+ */
1014
+ setRepeat(repeat: RepeatType): void {
1015
+ const cmd: string | null = rawExecutionBuilderFactory(this.objectName)
1016
+ .set()
1017
+ .addParameter(PropertyType.Repeat)
1018
+ .addParameter(repeat)
1019
+ .build();
1020
+ this.gate.runScript(cmd!);
1021
+ }
1022
+
1023
+ /**
1024
+ * Ustawia stan zasilania
1025
+ * @param {PowerType} power
1026
+ */
1027
+ setPower(power: PowerType): void {
1028
+ const cmd: string | null = rawExecutionBuilderFactory(this.objectName)
1029
+ .set()
1030
+ .addParameter(PropertyType.Power)
1031
+ .addParameter(power)
1032
+ .build();
1033
+ this.gate.runScript(cmd!);
1034
+ }
1035
+
1036
+ /**
1037
+ * Ustawia stan AutoPowerStandby
1038
+ * @param {AutoPowerStandbyType} autoPowerStandby
1039
+ */
1040
+ setAutoPowerStandby(autoPowerStandby: AutoPowerStandbyType): void {
1041
+ const cmd: string | null = rawExecutionBuilderFactory(this.objectName)
1042
+ .set()
1043
+ .addParameter(PropertyType.AutoPowerStandby)
1044
+ .addParameter(autoPowerStandby)
1045
+ .build();
1046
+ this.gate.runScript(cmd!);
1047
+ }
1048
+
1049
+ /**
1050
+ * Adres IP MusicCast
1051
+ * @returns {string}
1052
+ */
1053
+ get host(): string {
1054
+ const cmd: string | null = rawExecutionBuilderFactory(this.objectName)
1055
+ .get()
1056
+ .addParameter(PropertyType.Host)
1057
+ .build();
1058
+ return this.gate.runScript(cmd!);
1059
+ }
1060
+
1061
+ set host(value: string) {
1062
+ const cmd: string | null = rawExecutionBuilderFactory(this.objectName)
1063
+ .set()
1064
+ .addParameter(PropertyType.Host)
1065
+ .addParameter(value)
1066
+ .build();
1067
+ this.gate.runScript(cmd!);
1068
+ }
1069
+
1070
+ /**
1071
+ * Okres aktualizacji stanu
1072
+ * @returns {number}
1073
+ */
1074
+ get updatePeriod(): number {
1075
+ const cmd: string | null = rawExecutionBuilderFactory(this.objectName)
1076
+ .get()
1077
+ .addParameter(PropertyType.UpdatePeriod)
1078
+ .build();
1079
+ return this.gate.runScript(cmd!);
1080
+ }
1081
+
1082
+ set updatePeriod(value: number) {
1083
+ const cmd: string | null = rawExecutionBuilderFactory(this.objectName)
1084
+ .set()
1085
+ .addParameter(PropertyType.UpdatePeriod)
1086
+ .addParameter(value)
1087
+ .build();
1088
+ this.gate.runScript(cmd!);
1089
+ }
1090
+
1091
+ /**
1092
+ * Stan komunikacji z głośnikiem: 0 - brak połączenia, 1 - połączono
1093
+ * @returns {number}
1094
+ */
1095
+ get status(): number {
1096
+ const cmd: string | null = rawExecutionBuilderFactory(this.objectName)
1097
+ .get()
1098
+ .addParameter(PropertyType.Status)
1099
+ .build();
1100
+ return this.gate.runScript(cmd!);
1101
+ }
1102
+
1103
+ /**
1104
+ * Ostatni kod błędu: 0 - brak błędu, wartości ujemne - ujemny kod odpowiedzi HTTP, wartości dotatnie - kod błędu Yamaha Extended Control
1105
+ * @returns {number}
1106
+ */
1107
+ get errorCode(): number {
1108
+ const cmd: string | null = rawExecutionBuilderFactory(this.objectName)
1109
+ .get()
1110
+ .addParameter(PropertyType.ErrorCode)
1111
+ .build();
1112
+ return this.gate.runScript(cmd!);
1113
+ }
1114
+
1115
+ /**
1116
+ * Głośność w zakresie od 0% do 100%
1117
+ * @returns {number}
1118
+ */
1119
+ get volume(): number {
1120
+ const cmd: string | null = rawExecutionBuilderFactory(this.objectName)
1121
+ .get()
1122
+ .addParameter(PropertyType.Volume)
1123
+ .build();
1124
+ return this.gate.runScript(cmd!);
1125
+ }
1126
+
1127
+ /**
1128
+ * Stan wyciszenia: 0 - wyłączone, 1 - włączone
1129
+ * @returns {MuteType}
1130
+ */
1131
+ get mute(): MuteType {
1132
+ const cmd: string | null = rawExecutionBuilderFactory(this.objectName)
1133
+ .get()
1134
+ .addParameter(PropertyType.Mute)
1135
+ .build();
1136
+ return this.gate.runScript(cmd!);
1137
+ }
1138
+
1139
+ /**
1140
+ * Nazwa autora
1141
+ * @returns {string}
1142
+ */
1143
+ get artist(): string {
1144
+ const cmd: string | null = rawExecutionBuilderFactory(this.objectName)
1145
+ .get()
1146
+ .addParameter(PropertyType.Artist)
1147
+ .build();
1148
+ return this.gate.runScript(cmd!);
1149
+ }
1150
+
1151
+ /**
1152
+ * Tytuł utworu
1153
+ * @returns {string}
1154
+ */
1155
+ get title(): string {
1156
+ const cmd: string | null = rawExecutionBuilderFactory(this.objectName)
1157
+ .get()
1158
+ .addParameter(PropertyType.Title)
1159
+ .build();
1160
+ return this.gate.runScript(cmd!);
1161
+ }
1162
+
1163
+ /**
1164
+ * Stan odtwarzania: 1 - odtwarzanie, 2 - zatrzymane, 3 - pauza
1165
+ * @returns {number}
1166
+ */
1167
+ get state(): number {
1168
+ const cmd: string | null = rawExecutionBuilderFactory(this.objectName)
1169
+ .get()
1170
+ .addParameter(PropertyType.State)
1171
+ .build();
1172
+ return this.gate.runScript(cmd!);
1173
+ }
1174
+
1175
+ /**
1176
+ * Tryb odtwarzania losowego: 1 - wyłączone, 2 - włączone, 3 - utwory, 4 - albumy
1177
+ * @returns {ShuffleType}
1178
+ */
1179
+ get shuffle(): ShuffleType {
1180
+ const cmd: string | null = rawExecutionBuilderFactory(this.objectName)
1181
+ .get()
1182
+ .addParameter(PropertyType.Shuffle)
1183
+ .build();
1184
+ return this.gate.runScript(cmd!);
1185
+ }
1186
+
1187
+ /**
1188
+ * Tryb powtarzania: 1 - wyłączone, 2 - jeden utwór, 3 - wszystkie utwory
1189
+ * @returns {RepeatType}
1190
+ */
1191
+ get repeat(): RepeatType {
1192
+ const cmd: string | null = rawExecutionBuilderFactory(this.objectName)
1193
+ .get()
1194
+ .addParameter(PropertyType.Repeat)
1195
+ .build();
1196
+ return this.gate.runScript(cmd!);
1197
+ }
1198
+
1199
+ /**
1200
+ * Stan zasilania: 0 - uśpienie, 1 - włączone
1201
+ * @returns {PowerType}
1202
+ */
1203
+ get power(): PowerType {
1204
+ const cmd: string | null = rawExecutionBuilderFactory(this.objectName)
1205
+ .get()
1206
+ .addParameter(PropertyType.Power)
1207
+ .build();
1208
+ return this.gate.runScript(cmd!);
1209
+ }
1210
+
1211
+ /**
1212
+ * Adres okładki albumu
1213
+ * @returns {string}
1214
+ */
1215
+ get albumArt(): string {
1216
+ const cmd: string | null = rawExecutionBuilderFactory(this.objectName)
1217
+ .get()
1218
+ .addParameter(PropertyType.AlbumArt)
1219
+ .build();
1220
+ return this.gate.runScript(cmd!);
1221
+ }
1222
+
1223
+ /**
1224
+ * ID obiektu
1225
+ * @returns {string}
1226
+ */
1227
+ get objectID(): string {
1228
+ const cmd: string | null = rawExecutionBuilderFactory(this.objectName)
1229
+ .get()
1230
+ .addParameter(PropertyType.ObjectID)
1231
+ .build();
1232
+ return this.gate.runScript(cmd!);
1233
+ }
1234
+
1235
+ /**
1236
+ * ID obiektu serwera grupy
1237
+ * @returns {string}
1238
+ */
1239
+ get serverID(): string {
1240
+ const cmd: string | null = rawExecutionBuilderFactory(this.objectName)
1241
+ .get()
1242
+ .addParameter(PropertyType.ServerID)
1243
+ .build();
1244
+ return this.gate.runScript(cmd!);
1245
+ }
1246
+
1247
+ /**
1248
+ * Nazwa głośnika
1249
+ * @returns {string}
1250
+ */
1251
+ get name(): string {
1252
+ const cmd: string | null = rawExecutionBuilderFactory(this.objectName)
1253
+ .get()
1254
+ .addParameter(PropertyType.Name)
1255
+ .build();
1256
+ return this.gate.runScript(cmd!);
1257
+ }
1258
+
1259
+ /**
1260
+ * Rola głośnika w grupie: 1 - nie jest częścią grupy, 2 - klient, 3 - serwer
1261
+ * @returns {number}
1262
+ */
1263
+ get role(): number {
1264
+ const cmd: string | null = rawExecutionBuilderFactory(this.objectName)
1265
+ .get()
1266
+ .addParameter(PropertyType.Role)
1267
+ .build();
1268
+ return this.gate.runScript(cmd!);
1269
+ }
1270
+
1271
+ /**
1272
+ * Źródło odtwarzania
1273
+ * @returns {string}
1274
+ */
1275
+ get input(): string {
1276
+ const cmd: string | null = rawExecutionBuilderFactory(this.objectName)
1277
+ .get()
1278
+ .addParameter(PropertyType.Input)
1279
+ .build();
1280
+ return this.gate.runScript(cmd!);
1281
+ }
1282
+
1283
+ /**
1284
+ * Stan automatycznego uśpienia: 0 - wyłączone, 1 - włączone
1285
+ * @returns {AutoPowerStandbyType}
1286
+ */
1287
+ get autoPowerStandby(): AutoPowerStandbyType {
1288
+ const cmd: string | null = rawExecutionBuilderFactory(this.objectName)
1289
+ .get()
1290
+ .addParameter(PropertyType.AutoPowerStandby)
1291
+ .build();
1292
+ return this.gate.runScript(cmd!);
1293
+ }
1294
+ }
1295
+
1296
+ export {
1297
+ MusicCast, MusicCastRaw, MusicCastRemote, MuteType, ShuffleType, RepeatType, PowerType, AutoPowerStandbyType
1298
+ }