@soundretouch/api 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 +107 -0
- package/dist/index.d.ts +23 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +3 -0
- package/dist/index.js.map +1 -0
- package/dist/src/client/errors.d.ts +35 -0
- package/dist/src/client/errors.d.ts.map +1 -0
- package/dist/src/client/errors.js +44 -0
- package/dist/src/client/errors.js.map +1 -0
- package/dist/src/client/http.d.ts +40 -0
- package/dist/src/client/http.d.ts.map +1 -0
- package/dist/src/client/http.js +88 -0
- package/dist/src/client/http.js.map +1 -0
- package/dist/src/client/ws.d.ts +82 -0
- package/dist/src/client/ws.d.ts.map +1 -0
- package/dist/src/client/ws.js +153 -0
- package/dist/src/client/ws.js.map +1 -0
- package/dist/src/client/xml.d.ts +8 -0
- package/dist/src/client/xml.d.ts.map +1 -0
- package/dist/src/client/xml.js +18 -0
- package/dist/src/client/xml.js.map +1 -0
- package/dist/src/device/SoundTouchDevice.d.ts +457 -0
- package/dist/src/device/SoundTouchDevice.d.ts.map +1 -0
- package/dist/src/device/SoundTouchDevice.js +623 -0
- package/dist/src/device/SoundTouchDevice.js.map +1 -0
- package/dist/src/discovery/SoundTouchDiscovery.d.ts +18 -0
- package/dist/src/discovery/SoundTouchDiscovery.d.ts.map +1 -0
- package/dist/src/discovery/SoundTouchDiscovery.js +42 -0
- package/dist/src/discovery/SoundTouchDiscovery.js.map +1 -0
- package/dist/src/endpoints/audioProductLevelControls.d.ts +24 -0
- package/dist/src/endpoints/audioProductLevelControls.d.ts.map +1 -0
- package/dist/src/endpoints/audioProductLevelControls.js +44 -0
- package/dist/src/endpoints/audioProductLevelControls.js.map +1 -0
- package/dist/src/endpoints/audioProductToneControls.d.ts +24 -0
- package/dist/src/endpoints/audioProductToneControls.d.ts.map +1 -0
- package/dist/src/endpoints/audioProductToneControls.js +44 -0
- package/dist/src/endpoints/audioProductToneControls.js.map +1 -0
- package/dist/src/endpoints/audiodspcontrols.d.ts +24 -0
- package/dist/src/endpoints/audiodspcontrols.d.ts.map +1 -0
- package/dist/src/endpoints/audiodspcontrols.js +44 -0
- package/dist/src/endpoints/audiodspcontrols.js.map +1 -0
- package/dist/src/endpoints/bass.d.ts +23 -0
- package/dist/src/endpoints/bass.d.ts.map +1 -0
- package/dist/src/endpoints/bass.js +33 -0
- package/dist/src/endpoints/bass.js.map +1 -0
- package/dist/src/endpoints/bassCapabilities.d.ts +11 -0
- package/dist/src/endpoints/bassCapabilities.d.ts.map +1 -0
- package/dist/src/endpoints/bassCapabilities.js +16 -0
- package/dist/src/endpoints/bassCapabilities.js.map +1 -0
- package/dist/src/endpoints/capabilities.d.ts +11 -0
- package/dist/src/endpoints/capabilities.d.ts.map +1 -0
- package/dist/src/endpoints/capabilities.js +16 -0
- package/dist/src/endpoints/capabilities.js.map +1 -0
- package/dist/src/endpoints/info.d.ts +11 -0
- package/dist/src/endpoints/info.d.ts.map +1 -0
- package/dist/src/endpoints/info.js +16 -0
- package/dist/src/endpoints/info.js.map +1 -0
- package/dist/src/endpoints/key.d.ts +37 -0
- package/dist/src/endpoints/key.d.ts.map +1 -0
- package/dist/src/endpoints/key.js +45 -0
- package/dist/src/endpoints/key.js.map +1 -0
- package/dist/src/endpoints/name.d.ts +14 -0
- package/dist/src/endpoints/name.d.ts.map +1 -0
- package/dist/src/endpoints/name.js +23 -0
- package/dist/src/endpoints/name.js.map +1 -0
- package/dist/src/endpoints/nowPlaying.d.ts +11 -0
- package/dist/src/endpoints/nowPlaying.d.ts.map +1 -0
- package/dist/src/endpoints/nowPlaying.js +16 -0
- package/dist/src/endpoints/nowPlaying.js.map +1 -0
- package/dist/src/endpoints/presets.d.ts +11 -0
- package/dist/src/endpoints/presets.d.ts.map +1 -0
- package/dist/src/endpoints/presets.js +20 -0
- package/dist/src/endpoints/presets.js.map +1 -0
- package/dist/src/endpoints/select.d.ts +20 -0
- package/dist/src/endpoints/select.d.ts.map +1 -0
- package/dist/src/endpoints/select.js +33 -0
- package/dist/src/endpoints/select.js.map +1 -0
- package/dist/src/endpoints/sources.d.ts +11 -0
- package/dist/src/endpoints/sources.d.ts.map +1 -0
- package/dist/src/endpoints/sources.js +16 -0
- package/dist/src/endpoints/sources.js.map +1 -0
- package/dist/src/endpoints/trackInfo.d.ts +11 -0
- package/dist/src/endpoints/trackInfo.d.ts.map +1 -0
- package/dist/src/endpoints/trackInfo.js +16 -0
- package/dist/src/endpoints/trackInfo.js.map +1 -0
- package/dist/src/endpoints/volume.d.ts +21 -0
- package/dist/src/endpoints/volume.d.ts.map +1 -0
- package/dist/src/endpoints/volume.js +33 -0
- package/dist/src/endpoints/volume.js.map +1 -0
- package/dist/src/endpoints/zone.d.ts +57 -0
- package/dist/src/endpoints/zone.d.ts.map +1 -0
- package/dist/src/endpoints/zone.js +83 -0
- package/dist/src/endpoints/zone.js.map +1 -0
- package/dist/src/types/AudioDspControls.d.ts +7 -0
- package/dist/src/types/AudioDspControls.d.ts.map +1 -0
- package/dist/src/types/AudioDspControls.js +2 -0
- package/dist/src/types/AudioDspControls.js.map +1 -0
- package/dist/src/types/AudioProductLevelControls.d.ts +15 -0
- package/dist/src/types/AudioProductLevelControls.d.ts.map +1 -0
- package/dist/src/types/AudioProductLevelControls.js +2 -0
- package/dist/src/types/AudioProductLevelControls.js.map +1 -0
- package/dist/src/types/AudioProductToneControls.d.ts +15 -0
- package/dist/src/types/AudioProductToneControls.d.ts.map +1 -0
- package/dist/src/types/AudioProductToneControls.js +2 -0
- package/dist/src/types/AudioProductToneControls.js.map +1 -0
- package/dist/src/types/Bass.d.ts +6 -0
- package/dist/src/types/Bass.d.ts.map +1 -0
- package/dist/src/types/Bass.js +2 -0
- package/dist/src/types/Bass.js.map +1 -0
- package/dist/src/types/BassCapabilities.d.ts +8 -0
- package/dist/src/types/BassCapabilities.d.ts.map +1 -0
- package/dist/src/types/BassCapabilities.js +2 -0
- package/dist/src/types/BassCapabilities.js.map +1 -0
- package/dist/src/types/Capabilities.d.ts +10 -0
- package/dist/src/types/Capabilities.d.ts.map +1 -0
- package/dist/src/types/Capabilities.js +2 -0
- package/dist/src/types/Capabilities.js.map +1 -0
- package/dist/src/types/ContentItem.d.ts +5 -0
- package/dist/src/types/ContentItem.d.ts.map +1 -0
- package/dist/src/types/ContentItem.js +2 -0
- package/dist/src/types/ContentItem.js.map +1 -0
- package/dist/src/types/DeviceInfo.d.ts +22 -0
- package/dist/src/types/DeviceInfo.d.ts.map +1 -0
- package/dist/src/types/DeviceInfo.js +2 -0
- package/dist/src/types/DeviceInfo.js.map +1 -0
- package/dist/src/types/Enums.d.ts +8 -0
- package/dist/src/types/Enums.d.ts.map +1 -0
- package/dist/src/types/Enums.js +2 -0
- package/dist/src/types/Enums.js.map +1 -0
- package/dist/src/types/NowPlaying.d.ts +25 -0
- package/dist/src/types/NowPlaying.d.ts.map +1 -0
- package/dist/src/types/NowPlaying.js +2 -0
- package/dist/src/types/NowPlaying.js.map +1 -0
- package/dist/src/types/Presets.d.ts +15 -0
- package/dist/src/types/Presets.d.ts.map +1 -0
- package/dist/src/types/Presets.js +2 -0
- package/dist/src/types/Presets.js.map +1 -0
- package/dist/src/types/Recents.d.ts +14 -0
- package/dist/src/types/Recents.d.ts.map +1 -0
- package/dist/src/types/Recents.js +2 -0
- package/dist/src/types/Recents.js.map +1 -0
- package/dist/src/types/Sources.d.ts +12 -0
- package/dist/src/types/Sources.d.ts.map +1 -0
- package/dist/src/types/Sources.js +2 -0
- package/dist/src/types/Sources.js.map +1 -0
- package/dist/src/types/Updates.d.ts +37 -0
- package/dist/src/types/Updates.d.ts.map +1 -0
- package/dist/src/types/Updates.js +2 -0
- package/dist/src/types/Updates.js.map +1 -0
- package/dist/src/types/Volume.d.ts +6 -0
- package/dist/src/types/Volume.d.ts.map +1 -0
- package/dist/src/types/Volume.js +2 -0
- package/dist/src/types/Volume.js.map +1 -0
- package/dist/src/types/Zone.d.ts +22 -0
- package/dist/src/types/Zone.d.ts.map +1 -0
- package/dist/src/types/Zone.js +2 -0
- package/dist/src/types/Zone.js.map +1 -0
- package/docs/SoundTouch-Web-API.pdf +0 -0
- package/package.json +86 -0
|
@@ -0,0 +1,623 @@
|
|
|
1
|
+
import { HttpClient } from '../client/http';
|
|
2
|
+
import { WebSocketClient } from '../client/ws';
|
|
3
|
+
import { fetchAudioDspControls, setAudioDspControls } from '../endpoints/audiodspcontrols';
|
|
4
|
+
import { fetchAudioProductLevelControls, setAudioProductLevelControls } from '../endpoints/audioProductLevelControls';
|
|
5
|
+
import { fetchAudioProductToneControls, setAudioProductToneControls } from '../endpoints/audioProductToneControls';
|
|
6
|
+
import { fetchBass, setBass } from '../endpoints/bass';
|
|
7
|
+
import { fetchBassCapabilities } from '../endpoints/bassCapabilities';
|
|
8
|
+
import { fetchCapabilities } from '../endpoints/capabilities';
|
|
9
|
+
import { fetchInfo } from '../endpoints/info';
|
|
10
|
+
import { sendKeyPress, sendKeyPressAndRelease } from '../endpoints/key';
|
|
11
|
+
import { setName } from '../endpoints/name';
|
|
12
|
+
import { fetchNowPlaying } from '../endpoints/nowPlaying';
|
|
13
|
+
import { fetchPresets } from '../endpoints/presets';
|
|
14
|
+
import { selectSource } from '../endpoints/select';
|
|
15
|
+
import { fetchSources } from '../endpoints/sources';
|
|
16
|
+
import { fetchTrackInfo } from '../endpoints/trackInfo';
|
|
17
|
+
import { fetchVolume, setVolume } from '../endpoints/volume';
|
|
18
|
+
import { addZoneSlave, fetchZone, removeZoneSlave, setZone } from '../endpoints/zone';
|
|
19
|
+
/**
|
|
20
|
+
* Represents a SoundTouch device and provides methods to interact with it.
|
|
21
|
+
*
|
|
22
|
+
* @param host The hostname or IP address of the SoundTouch device.
|
|
23
|
+
* @param options Optional HTTP and WebSocket client configuration.
|
|
24
|
+
*
|
|
25
|
+
* @example
|
|
26
|
+
* const device = new SoundTouchDevice('192.168.1.x');
|
|
27
|
+
* const info = await device.info();
|
|
28
|
+
*/
|
|
29
|
+
export class SoundTouchDevice {
|
|
30
|
+
constructor(host, options = {}) {
|
|
31
|
+
this.host = host;
|
|
32
|
+
this.httpClient = new HttpClient(host, options.http);
|
|
33
|
+
this.wsClient = new WebSocketClient(this.host, { unwrap: true, ...options.ws });
|
|
34
|
+
}
|
|
35
|
+
/**
|
|
36
|
+
* Gets device information including identifiers, components, and network info.
|
|
37
|
+
*
|
|
38
|
+
* GET /info
|
|
39
|
+
*
|
|
40
|
+
* @returns Promise<DeviceInfo> A promise that resolves to the device info payload as returned by the device.
|
|
41
|
+
*/
|
|
42
|
+
info() {
|
|
43
|
+
return fetchInfo(this.httpClient);
|
|
44
|
+
}
|
|
45
|
+
/**
|
|
46
|
+
* Gets info about the currently playing media.
|
|
47
|
+
*
|
|
48
|
+
* GET /now_playing
|
|
49
|
+
*
|
|
50
|
+
* @returns Promise<NowPlaying> A promise that resolves to the now playing payload as returned by the device.
|
|
51
|
+
*/
|
|
52
|
+
nowPlaying() {
|
|
53
|
+
return fetchNowPlaying(this.httpClient);
|
|
54
|
+
}
|
|
55
|
+
/**
|
|
56
|
+
* Gets track information for the currently playing media.
|
|
57
|
+
*
|
|
58
|
+
* GET /trackInfo
|
|
59
|
+
*
|
|
60
|
+
* @returns Promise<NowPlaying> A promise that resolves to the now playing payload as returned by the device.
|
|
61
|
+
*/
|
|
62
|
+
trackInfo() {
|
|
63
|
+
return fetchTrackInfo(this.httpClient);
|
|
64
|
+
}
|
|
65
|
+
/**
|
|
66
|
+
* Lists available content sources on the device.
|
|
67
|
+
*
|
|
68
|
+
* GET /sources
|
|
69
|
+
*
|
|
70
|
+
* @returns Promise<Sources> A promise that resolves to the sources payload as returned by the device.
|
|
71
|
+
*/
|
|
72
|
+
sources() {
|
|
73
|
+
return fetchSources(this.httpClient);
|
|
74
|
+
}
|
|
75
|
+
/**
|
|
76
|
+
* Selects a content source on the device.
|
|
77
|
+
*
|
|
78
|
+
* Use the /sources endpoint to discover which sources are available for a device.
|
|
79
|
+
* The available sources vary by product and SoundTouch account.
|
|
80
|
+
*
|
|
81
|
+
* POST /select
|
|
82
|
+
*
|
|
83
|
+
* @param item ContentItem describing the source and optional source account.
|
|
84
|
+
* @returns A promise that resolves when the device accepts the selection.
|
|
85
|
+
*
|
|
86
|
+
* @example
|
|
87
|
+
* await device.select({ source: 'AUX', sourceAccount: 'AUX' })
|
|
88
|
+
* await device.select({ source: 'BLUETOOTH' })
|
|
89
|
+
* await device.select({ source: 'PRODUCT', sourceAccount: 'TV' })
|
|
90
|
+
*/
|
|
91
|
+
select(item) {
|
|
92
|
+
return selectSource(this.httpClient, item);
|
|
93
|
+
}
|
|
94
|
+
/**
|
|
95
|
+
* Gets the current volume settings from the device.
|
|
96
|
+
*
|
|
97
|
+
* GET /volume
|
|
98
|
+
*
|
|
99
|
+
* @returns Promise<Volume> A promise that resolves to the volume payload as returned by the device.
|
|
100
|
+
*/
|
|
101
|
+
volume() {
|
|
102
|
+
return fetchVolume(this.httpClient);
|
|
103
|
+
}
|
|
104
|
+
/**
|
|
105
|
+
* Gets the current bass setting from the device.
|
|
106
|
+
*
|
|
107
|
+
* GET /bass
|
|
108
|
+
*
|
|
109
|
+
* @returns Promise<Bass> A promise that resolves to the bass payload as returned by the device.
|
|
110
|
+
*/
|
|
111
|
+
bass() {
|
|
112
|
+
return fetchBass(this.httpClient);
|
|
113
|
+
}
|
|
114
|
+
/**
|
|
115
|
+
* Gets bass capability information for the device.
|
|
116
|
+
*
|
|
117
|
+
* GET /bassCapabilities
|
|
118
|
+
*
|
|
119
|
+
* @returns Promise<BassCapabilities> A promise that resolves to the bass capabilities payload as returned by the device.
|
|
120
|
+
*/
|
|
121
|
+
bassCapabilities() {
|
|
122
|
+
return fetchBassCapabilities(this.httpClient);
|
|
123
|
+
}
|
|
124
|
+
/**
|
|
125
|
+
* Retrieves system capabilities for the device.
|
|
126
|
+
*
|
|
127
|
+
* GET /capabilities
|
|
128
|
+
*
|
|
129
|
+
* @returns Promise<Capabilities> A promise that resolves to the capabilities payload as returned by the device.
|
|
130
|
+
*/
|
|
131
|
+
capabilities() {
|
|
132
|
+
return fetchCapabilities(this.httpClient);
|
|
133
|
+
}
|
|
134
|
+
/**
|
|
135
|
+
* Gets the current DSP settings for the device.
|
|
136
|
+
*
|
|
137
|
+
* GET /audiodspcontrols
|
|
138
|
+
*
|
|
139
|
+
* @returns Promise<AudioDspControls> A promise that resolves to the DSP controls payload as returned by the device.
|
|
140
|
+
*/
|
|
141
|
+
audioDspControls() {
|
|
142
|
+
return fetchAudioDspControls(this.httpClient);
|
|
143
|
+
}
|
|
144
|
+
/**
|
|
145
|
+
* Gets the current bass and treble settings from the device.
|
|
146
|
+
*
|
|
147
|
+
* GET /audioproducttonecontrols
|
|
148
|
+
*
|
|
149
|
+
* @returns Promise<AudioProductToneControls> A promise that resolves to the tone controls payload as returned by the device.
|
|
150
|
+
*/
|
|
151
|
+
audioProductToneControls() {
|
|
152
|
+
return fetchAudioProductToneControls(this.httpClient);
|
|
153
|
+
}
|
|
154
|
+
/**
|
|
155
|
+
* Updates bass and/or treble settings for the device. Only included values are changed.
|
|
156
|
+
*
|
|
157
|
+
* POST /audioproducttonecontrols
|
|
158
|
+
*
|
|
159
|
+
* @param values Tone values to update (bass and/or treble).
|
|
160
|
+
* @returns A promise that resolves when the device accepts the tone update.
|
|
161
|
+
*
|
|
162
|
+
* @example
|
|
163
|
+
* await device.setAudioProductToneControls({ bass: 2 })
|
|
164
|
+
* await device.setAudioProductToneControls({ treble: -1 })
|
|
165
|
+
*/
|
|
166
|
+
setAudioProductToneControls(values) {
|
|
167
|
+
return setAudioProductToneControls(this.httpClient, values);
|
|
168
|
+
}
|
|
169
|
+
/**
|
|
170
|
+
* Gets the current front-center and rear-surround level settings from the device.
|
|
171
|
+
*
|
|
172
|
+
* GET /audioproductlevelcontrols
|
|
173
|
+
*
|
|
174
|
+
* @returns Promise<AudioProductLevelControls> A promise that resolves to the level controls payload as returned by the device.
|
|
175
|
+
*/
|
|
176
|
+
audioProductLevelControls() {
|
|
177
|
+
return fetchAudioProductLevelControls(this.httpClient);
|
|
178
|
+
}
|
|
179
|
+
/**
|
|
180
|
+
* Updates front-center and/or rear-surround levels for the device. Only included values are changed.
|
|
181
|
+
*
|
|
182
|
+
* POST /audioproductlevelcontrols
|
|
183
|
+
*
|
|
184
|
+
* @param values Level values to update (frontCenterSpeakerLevel and/or rearSurroundSpeakersLevel).
|
|
185
|
+
* @returns A promise that resolves when the device accepts the level update.
|
|
186
|
+
*
|
|
187
|
+
* @example
|
|
188
|
+
* await device.setAudioProductLevelControls({ frontCenterSpeakerLevel: 1 })
|
|
189
|
+
* await device.setAudioProductLevelControls({ rearSurroundSpeakersLevel: -2 })
|
|
190
|
+
*/
|
|
191
|
+
setAudioProductLevelControls(values) {
|
|
192
|
+
return setAudioProductLevelControls(this.httpClient, values);
|
|
193
|
+
}
|
|
194
|
+
/**
|
|
195
|
+
* Updates DSP settings for the device. Only included values are changed.
|
|
196
|
+
*
|
|
197
|
+
* POST /audiodspcontrols
|
|
198
|
+
*
|
|
199
|
+
* @param values DSP values to update (audiomode and/or videosyncaudiodelay).
|
|
200
|
+
* @returns A promise that resolves when the device accepts the DSP update.
|
|
201
|
+
*
|
|
202
|
+
* @example
|
|
203
|
+
* await device.setAudioDspControls({ audiomode: 'movie' })
|
|
204
|
+
* await device.setAudioDspControls({ videosyncaudiodelay: 150 })
|
|
205
|
+
*/
|
|
206
|
+
setAudioDspControls(values) {
|
|
207
|
+
return setAudioDspControls(this.httpClient, values);
|
|
208
|
+
}
|
|
209
|
+
/**
|
|
210
|
+
* Gets the list of current presets from the device.
|
|
211
|
+
*
|
|
212
|
+
* GET /presets
|
|
213
|
+
*
|
|
214
|
+
* @returns Promise<Presets> A promise that resolves to the presets payload as returned by the device.
|
|
215
|
+
*/
|
|
216
|
+
presets() {
|
|
217
|
+
return fetchPresets(this.httpClient);
|
|
218
|
+
}
|
|
219
|
+
/**
|
|
220
|
+
* Sets the device name.
|
|
221
|
+
*
|
|
222
|
+
* POST /name
|
|
223
|
+
*
|
|
224
|
+
* @param name The name to assign to the device.
|
|
225
|
+
* @returns A promise that resolves when the device accepts the new name.
|
|
226
|
+
*
|
|
227
|
+
* @example
|
|
228
|
+
* await device.setName('Living Room')
|
|
229
|
+
*/
|
|
230
|
+
setName(name) {
|
|
231
|
+
return setName(this.httpClient, name);
|
|
232
|
+
}
|
|
233
|
+
/**
|
|
234
|
+
* Sets the bass level for the device.
|
|
235
|
+
*
|
|
236
|
+
* POST /bass
|
|
237
|
+
*
|
|
238
|
+
* @param value Bass value to set.
|
|
239
|
+
* @returns A promise that resolves when the device accepts the bass value.
|
|
240
|
+
*/
|
|
241
|
+
setBass(value) {
|
|
242
|
+
return setBass(this.httpClient, value);
|
|
243
|
+
}
|
|
244
|
+
/**
|
|
245
|
+
* Sets the volume level and mute state for the device. Volume ranges between 0 and 100 inclusive.
|
|
246
|
+
*
|
|
247
|
+
* POST /volume
|
|
248
|
+
*
|
|
249
|
+
* The muteenabled setting is applied first, if present. The system will be unmuted if the
|
|
250
|
+
* volume value is larger than the current volume setting.
|
|
251
|
+
*
|
|
252
|
+
* @param value Volume value to set.
|
|
253
|
+
* @param muteenabled Optional mute state to set before applying the volume value.
|
|
254
|
+
* @returns A promise that resolves when the device accepts the volume value.
|
|
255
|
+
*
|
|
256
|
+
* @example
|
|
257
|
+
* await device.setVolume(25)
|
|
258
|
+
* await device.setVolume(10, true)
|
|
259
|
+
*/
|
|
260
|
+
setVolume(value, muteenabled) {
|
|
261
|
+
return setVolume(this.httpClient, value, muteenabled);
|
|
262
|
+
}
|
|
263
|
+
/**
|
|
264
|
+
* Gets the current multi-room zone state from the device.
|
|
265
|
+
*
|
|
266
|
+
* GET /getZone
|
|
267
|
+
*
|
|
268
|
+
* @returns Promise<Zone> A promise that resolves to the zone payload as returned by the device.
|
|
269
|
+
*/
|
|
270
|
+
zone() {
|
|
271
|
+
return fetchZone(this.httpClient);
|
|
272
|
+
}
|
|
273
|
+
/**
|
|
274
|
+
* Creates or updates a multi-room zone.
|
|
275
|
+
*
|
|
276
|
+
* POST /setZone
|
|
277
|
+
*
|
|
278
|
+
* @param config Zone configuration including master, sender IP, and member list.
|
|
279
|
+
* @returns A promise that resolves when the device accepts the zone configuration.
|
|
280
|
+
*/
|
|
281
|
+
setZone(config) {
|
|
282
|
+
return setZone(this.httpClient, config);
|
|
283
|
+
}
|
|
284
|
+
/**
|
|
285
|
+
* Adds one or more slaves to a "play everywhere" zone.
|
|
286
|
+
*
|
|
287
|
+
* POST /addZoneSlave
|
|
288
|
+
*
|
|
289
|
+
* @param config Zone slave configuration including master and member list.
|
|
290
|
+
* @returns A promise that resolves when the device accepts the zone update.
|
|
291
|
+
*/
|
|
292
|
+
addZoneSlave(config) {
|
|
293
|
+
return addZoneSlave(this.httpClient, config);
|
|
294
|
+
}
|
|
295
|
+
/**
|
|
296
|
+
* Removes one or more slaves from a "play everywhere" zone.
|
|
297
|
+
*
|
|
298
|
+
* POST /removeZoneSlave
|
|
299
|
+
*
|
|
300
|
+
* @param config Zone slave configuration including master and member list.
|
|
301
|
+
* @returns A promise that resolves when the device accepts the zone update.
|
|
302
|
+
*/
|
|
303
|
+
removeZoneSlave(config) {
|
|
304
|
+
return removeZoneSlave(this.httpClient, config);
|
|
305
|
+
}
|
|
306
|
+
/**
|
|
307
|
+
* Sends a remote button press or release to the device.
|
|
308
|
+
*
|
|
309
|
+
* POST /key
|
|
310
|
+
*
|
|
311
|
+
* Keys are used as a simple means to interact with the SoundTouch speaker.
|
|
312
|
+
* For a full listing of supported keys see "KEY VALUE" in section 4.1 of the API docs.
|
|
313
|
+
* It is good practice to send a "press" followed by a "release" to simulate a full key click.
|
|
314
|
+
*
|
|
315
|
+
* @param key Key value to send.
|
|
316
|
+
* @param state Key state to send: "press" or "release".
|
|
317
|
+
* @param sender Sender label to include in the request.
|
|
318
|
+
* @returns A promise that resolves when the device accepts the key event.
|
|
319
|
+
*
|
|
320
|
+
* @example
|
|
321
|
+
* await device.keyPress('PLAY', 'press', 'Gabbo')
|
|
322
|
+
* await device.keyPress('PLAY', 'release', 'Gabbo')
|
|
323
|
+
*/
|
|
324
|
+
keyPress(key, state = 'press', sender) {
|
|
325
|
+
return sendKeyPress(this.httpClient, key, state, sender);
|
|
326
|
+
}
|
|
327
|
+
/**
|
|
328
|
+
* Sends a press then release sequence for a key.
|
|
329
|
+
*
|
|
330
|
+
* POST /key
|
|
331
|
+
*
|
|
332
|
+
* @param key Key value to send.
|
|
333
|
+
* @param sender Sender label to include in the request.
|
|
334
|
+
* @returns A promise that resolves when the device accepts both key events.
|
|
335
|
+
*
|
|
336
|
+
* @example
|
|
337
|
+
* await device.keyPressAndRelease('PLAY', 'Gabbo')
|
|
338
|
+
*/
|
|
339
|
+
keyPressAndRelease(key, sender) {
|
|
340
|
+
return sendKeyPressAndRelease(this.httpClient, key, sender);
|
|
341
|
+
}
|
|
342
|
+
/**
|
|
343
|
+
* Subscribes to now playing update notifications.
|
|
344
|
+
*
|
|
345
|
+
* @param handler Callback invoked with the parsed now playing payload.
|
|
346
|
+
* @returns Unsubscribe function.
|
|
347
|
+
*
|
|
348
|
+
* @example
|
|
349
|
+
* device.onNowPlayingUpdated((nowPlaying) => console.log(nowPlaying))
|
|
350
|
+
*/
|
|
351
|
+
onNowPlayingUpdated(handler) {
|
|
352
|
+
this.wsClient.ensureConnected();
|
|
353
|
+
return this.wsClient.onMessage((update) => {
|
|
354
|
+
const nowPlaying = update.nowPlayingUpdated?.nowPlaying;
|
|
355
|
+
if (nowPlaying) {
|
|
356
|
+
handler(nowPlaying);
|
|
357
|
+
}
|
|
358
|
+
});
|
|
359
|
+
}
|
|
360
|
+
/**
|
|
361
|
+
* Subscribes to volume update notifications.
|
|
362
|
+
*
|
|
363
|
+
* @param handler Callback invoked with the parsed volume payload.
|
|
364
|
+
* @returns Unsubscribe function.
|
|
365
|
+
*
|
|
366
|
+
* @example
|
|
367
|
+
* device.onVolumeUpdated((volume) => console.log(volume))
|
|
368
|
+
*/
|
|
369
|
+
onVolumeUpdated(handler) {
|
|
370
|
+
this.wsClient.ensureConnected();
|
|
371
|
+
return this.wsClient.onMessage((update) => {
|
|
372
|
+
const volumeUpdated = update.volumeUpdated;
|
|
373
|
+
if (!volumeUpdated) {
|
|
374
|
+
return;
|
|
375
|
+
}
|
|
376
|
+
handler(volumeUpdated.volume ?? {});
|
|
377
|
+
});
|
|
378
|
+
}
|
|
379
|
+
/**
|
|
380
|
+
* Subscribes to bass update notifications.
|
|
381
|
+
*
|
|
382
|
+
* @param handler Callback invoked when bass changes.
|
|
383
|
+
* @returns Unsubscribe function.
|
|
384
|
+
*
|
|
385
|
+
* @example
|
|
386
|
+
* device.onBassUpdated(() => console.log('Bass changed'))
|
|
387
|
+
*/
|
|
388
|
+
onBassUpdated(handler) {
|
|
389
|
+
this.wsClient.ensureConnected();
|
|
390
|
+
return this.wsClient.onMessage((update) => {
|
|
391
|
+
if (update.bassUpdated) {
|
|
392
|
+
handler();
|
|
393
|
+
}
|
|
394
|
+
});
|
|
395
|
+
}
|
|
396
|
+
/**
|
|
397
|
+
* Subscribes to zone map update notifications.
|
|
398
|
+
*
|
|
399
|
+
* @param handler Callback invoked when the zone map changes.
|
|
400
|
+
* @returns Unsubscribe function.
|
|
401
|
+
*
|
|
402
|
+
* @example
|
|
403
|
+
* device.onZoneUpdated(() => console.log('Zone map changed'))
|
|
404
|
+
*/
|
|
405
|
+
onZoneUpdated(handler) {
|
|
406
|
+
this.wsClient.ensureConnected();
|
|
407
|
+
return this.wsClient.onMessage((update) => {
|
|
408
|
+
if (update.zoneUpdated) {
|
|
409
|
+
handler();
|
|
410
|
+
}
|
|
411
|
+
});
|
|
412
|
+
}
|
|
413
|
+
/**
|
|
414
|
+
* Subscribes to software update status notifications.
|
|
415
|
+
*
|
|
416
|
+
* @param handler Callback invoked when update status changes.
|
|
417
|
+
* @returns Unsubscribe function.
|
|
418
|
+
*
|
|
419
|
+
* @example
|
|
420
|
+
* device.onSwUpdateStatusUpdated(() => console.log('SW update status changed'))
|
|
421
|
+
*/
|
|
422
|
+
onSwUpdateStatusUpdated(handler) {
|
|
423
|
+
this.wsClient.ensureConnected();
|
|
424
|
+
return this.wsClient.onMessage((update) => {
|
|
425
|
+
if (update.swUpdateStatusUpdated) {
|
|
426
|
+
handler();
|
|
427
|
+
}
|
|
428
|
+
});
|
|
429
|
+
}
|
|
430
|
+
/**
|
|
431
|
+
* Subscribes to site survey results update notifications.
|
|
432
|
+
*
|
|
433
|
+
* @param handler Callback invoked when site survey results change.
|
|
434
|
+
* @returns Unsubscribe function.
|
|
435
|
+
*
|
|
436
|
+
* @example
|
|
437
|
+
* device.onSiteSurveyResultsUpdated(() => console.log('Site survey updated'))
|
|
438
|
+
*/
|
|
439
|
+
onSiteSurveyResultsUpdated(handler) {
|
|
440
|
+
this.wsClient.ensureConnected();
|
|
441
|
+
return this.wsClient.onMessage((update) => {
|
|
442
|
+
if (update.siteSurveyResultsUpdated) {
|
|
443
|
+
handler();
|
|
444
|
+
}
|
|
445
|
+
});
|
|
446
|
+
}
|
|
447
|
+
/**
|
|
448
|
+
* Subscribes to sources update notifications.
|
|
449
|
+
*
|
|
450
|
+
* @param handler Callback invoked when sources change.
|
|
451
|
+
* @returns Unsubscribe function.
|
|
452
|
+
*
|
|
453
|
+
* @example
|
|
454
|
+
* device.onSourcesUpdated(() => console.log('Sources updated'))
|
|
455
|
+
*/
|
|
456
|
+
onSourcesUpdated(handler) {
|
|
457
|
+
this.wsClient.ensureConnected();
|
|
458
|
+
return this.wsClient.onMessage((update) => {
|
|
459
|
+
if (update.sourcesUpdated) {
|
|
460
|
+
handler();
|
|
461
|
+
}
|
|
462
|
+
});
|
|
463
|
+
}
|
|
464
|
+
/**
|
|
465
|
+
* Subscribes to now selection update notifications.
|
|
466
|
+
*
|
|
467
|
+
* @param handler Callback invoked with the selected preset.
|
|
468
|
+
* @returns Unsubscribe function.
|
|
469
|
+
*
|
|
470
|
+
* @example
|
|
471
|
+
* device.onNowSelectionUpdated((preset) => console.log(preset))
|
|
472
|
+
*/
|
|
473
|
+
onNowSelectionUpdated(handler) {
|
|
474
|
+
this.wsClient.ensureConnected();
|
|
475
|
+
return this.wsClient.onMessage((update) => {
|
|
476
|
+
const preset = update.nowSelectionUpdated?.preset;
|
|
477
|
+
if (preset) {
|
|
478
|
+
handler(preset);
|
|
479
|
+
}
|
|
480
|
+
});
|
|
481
|
+
}
|
|
482
|
+
/**
|
|
483
|
+
* Subscribes to network connection state notifications.
|
|
484
|
+
*
|
|
485
|
+
* @param handler Callback invoked when connection state changes.
|
|
486
|
+
* @returns Unsubscribe function.
|
|
487
|
+
*
|
|
488
|
+
* @example
|
|
489
|
+
* device.onConnectionStateUpdated(() => console.log('Connection state changed'))
|
|
490
|
+
*/
|
|
491
|
+
onConnectionStateUpdated(handler) {
|
|
492
|
+
this.wsClient.ensureConnected();
|
|
493
|
+
return this.wsClient.onMessage((update) => {
|
|
494
|
+
if (update.connectionStateUpdated) {
|
|
495
|
+
handler();
|
|
496
|
+
}
|
|
497
|
+
});
|
|
498
|
+
}
|
|
499
|
+
/**
|
|
500
|
+
* Subscribes to device info update notifications.
|
|
501
|
+
*
|
|
502
|
+
* @param handler Callback invoked when device info changes.
|
|
503
|
+
* @returns Unsubscribe function.
|
|
504
|
+
*
|
|
505
|
+
* @example
|
|
506
|
+
* device.onInfoUpdated(() => console.log('Device info changed'))
|
|
507
|
+
*/
|
|
508
|
+
onInfoUpdated(handler) {
|
|
509
|
+
this.wsClient.ensureConnected();
|
|
510
|
+
return this.wsClient.onMessage((update) => {
|
|
511
|
+
if (update.infoUpdated) {
|
|
512
|
+
handler();
|
|
513
|
+
}
|
|
514
|
+
});
|
|
515
|
+
}
|
|
516
|
+
/**
|
|
517
|
+
* Subscribes to presets update notifications.
|
|
518
|
+
*
|
|
519
|
+
* @param handler Callback invoked with the parsed presets payload.
|
|
520
|
+
* @returns Unsubscribe function.
|
|
521
|
+
*
|
|
522
|
+
* @example
|
|
523
|
+
* device.onPresetsUpdated((presets) => console.log(presets))
|
|
524
|
+
*/
|
|
525
|
+
onPresetsUpdated(handler) {
|
|
526
|
+
this.wsClient.ensureConnected();
|
|
527
|
+
return this.wsClient.onMessage((update) => {
|
|
528
|
+
const preset = update.presetsUpdated?.presets?.preset;
|
|
529
|
+
if (Array.isArray(preset)) {
|
|
530
|
+
handler(preset);
|
|
531
|
+
return;
|
|
532
|
+
}
|
|
533
|
+
if (preset) {
|
|
534
|
+
handler([preset]);
|
|
535
|
+
}
|
|
536
|
+
});
|
|
537
|
+
}
|
|
538
|
+
/**
|
|
539
|
+
* Subscribes to recents update notifications.
|
|
540
|
+
*
|
|
541
|
+
* @param handler Callback invoked with the parsed recents payload.
|
|
542
|
+
* @returns Unsubscribe function.
|
|
543
|
+
*
|
|
544
|
+
* @example
|
|
545
|
+
* device.onRecentsUpdated((recents) => console.log(recents))
|
|
546
|
+
*/
|
|
547
|
+
onRecentsUpdated(handler) {
|
|
548
|
+
this.wsClient.ensureConnected();
|
|
549
|
+
return this.wsClient.onMessage((update) => {
|
|
550
|
+
const recent = update.recentsUpdated?.recents?.recent;
|
|
551
|
+
if (Array.isArray(recent)) {
|
|
552
|
+
handler(recent);
|
|
553
|
+
return;
|
|
554
|
+
}
|
|
555
|
+
if (recent) {
|
|
556
|
+
handler([recent]);
|
|
557
|
+
}
|
|
558
|
+
});
|
|
559
|
+
}
|
|
560
|
+
/**
|
|
561
|
+
* Subscribes to account mode update notifications.
|
|
562
|
+
*
|
|
563
|
+
* @param handler Callback invoked when account mode changes.
|
|
564
|
+
* @returns Unsubscribe function.
|
|
565
|
+
*
|
|
566
|
+
* @example
|
|
567
|
+
* device.onAcctModeUpdated(() => console.log('Account mode changed'))
|
|
568
|
+
*/
|
|
569
|
+
onAcctModeUpdated(handler) {
|
|
570
|
+
this.wsClient.ensureConnected();
|
|
571
|
+
return this.wsClient.onMessage((update) => {
|
|
572
|
+
if (update.acctModeUpdated) {
|
|
573
|
+
handler();
|
|
574
|
+
}
|
|
575
|
+
});
|
|
576
|
+
}
|
|
577
|
+
/**
|
|
578
|
+
* Subscribes to error notifications.
|
|
579
|
+
*
|
|
580
|
+
* @param handler Callback invoked when an error notification is received.
|
|
581
|
+
* @returns Unsubscribe function.
|
|
582
|
+
*
|
|
583
|
+
* @example
|
|
584
|
+
* device.onErrorNotification((error) => console.log(error))
|
|
585
|
+
*/
|
|
586
|
+
onErrorNotification(handler) {
|
|
587
|
+
this.wsClient.ensureConnected();
|
|
588
|
+
return this.wsClient.onMessage((update) => {
|
|
589
|
+
if (update.errorNotification) {
|
|
590
|
+
handler(update.errorNotification);
|
|
591
|
+
}
|
|
592
|
+
});
|
|
593
|
+
}
|
|
594
|
+
/**
|
|
595
|
+
* Subscribes to WebSocket errors.
|
|
596
|
+
*
|
|
597
|
+
* @param handler Callback invoked when a WebSocket error is raised.
|
|
598
|
+
* @returns Unsubscribe function.
|
|
599
|
+
*
|
|
600
|
+
* @example
|
|
601
|
+
* device.onWebSocketError((error) => console.error(error))
|
|
602
|
+
*/
|
|
603
|
+
onWebSocketError(handler) {
|
|
604
|
+
this.wsClient.ensureConnected();
|
|
605
|
+
return this.wsClient.onError(handler);
|
|
606
|
+
}
|
|
607
|
+
/**
|
|
608
|
+
* Starts listening for async notifications and returns a handle to stop.
|
|
609
|
+
*
|
|
610
|
+
* @returns Handle with a stop method that closes the WebSocket connection.
|
|
611
|
+
*
|
|
612
|
+
* @example
|
|
613
|
+
* const handle = device.listenUpdates()
|
|
614
|
+
* handle.stop()
|
|
615
|
+
*/
|
|
616
|
+
listenUpdates() {
|
|
617
|
+
this.wsClient.ensureConnected();
|
|
618
|
+
return {
|
|
619
|
+
stop: () => this.wsClient.close(),
|
|
620
|
+
};
|
|
621
|
+
}
|
|
622
|
+
}
|
|
623
|
+
//# sourceMappingURL=SoundTouchDevice.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"SoundTouchDevice.js","sourceRoot":"","sources":["../../../src/device/SoundTouchD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;;;;;;OAQG;IACH,mBAAmB,CAAC,OAAiD;QACjE,IAAI,CAAC,QAAQ,CAAC,eAAe,EAAE,CAAA;QAE/B,OAAO,IAAI,CAAC,QAAQ,CAAC,SAAS,CAAU,CAAC,MAAM,EAAE,EAAE;YAC/C,IAAI,MAAM,CAAC,iBAAiB,EAAE,CAAC;gBAC3B,OAAO,CAAC,MAAM,CAAC,iBAAiB,CAAC,CAAA;YACrC,CAAC;QACL,CAAC,CAAC,CAAA;IACN,CAAC;IAED;;;;;;;;OAQG;IACH,gBAAgB,CAAC,OAAiC;QAC9C,IAAI,CAAC,QAAQ,CAAC,eAAe,EAAE,CAAA;QAE/B,OAAO,IAAI,CAAC,QAAQ,CAAC,OAAO,CAAC,OAAO,CAAC,CAAA;IACzC,CAAC;IAED;;;;;;;;OAQG;IACH,aAAa;QACT,IAAI,CAAC,QAAQ,CAAC,eAAe,EAAE,CAAA;QAE/B,OAAO;YACH,IAAI,EAAE,GAAG,EAAE,CAAC,IAAI,CAAC,QAAQ,CAAC,KAAK,EAAE;SACpC,CAAA;IACL,CAAC;CACJ"}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { SoundTouchDevice } from '../device/SoundTouchDevice';
|
|
2
|
+
/**
|
|
3
|
+
* Handle for controlling the discovery process.
|
|
4
|
+
*/
|
|
5
|
+
export type DiscoveryHandle = {
|
|
6
|
+
stop: () => void;
|
|
7
|
+
};
|
|
8
|
+
/**
|
|
9
|
+
* Starts mDNS discovery for SoundTouch devices and invokes the callback on first sight of each host.
|
|
10
|
+
*
|
|
11
|
+
* @param onDeviceFound Callback invoked when a new SoundTouch device is found.
|
|
12
|
+
* @param returns a handle that can be used to stop discovery when no longer needed.
|
|
13
|
+
*/
|
|
14
|
+
export declare class SoundTouchDiscovery {
|
|
15
|
+
private static readonly log;
|
|
16
|
+
static start(onDeviceFound: (device: SoundTouchDevice) => void): DiscoveryHandle;
|
|
17
|
+
}
|
|
18
|
+
//# sourceMappingURL=SoundTouchDiscovery.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"SoundTouchDiscovery.d.ts","sourceRoot":"","sources":["../../../src/discovery/SoundTouchDiscovery.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,gBAAgB,EAAE,MAAM,4BAA4B,CAAA;AAE7D;;GAEG;AACH,MAAM,MAAM,eAAe,GAAG;IAC1B,IAAI,EAAE,MAAM,IAAI,CAAA;CACnB,CAAA;AAED;;;;;GAKG;AACH,qBAAa,mBAAmB;IAC5B,OAAO,CAAC,MAAM,CAAC,QAAQ,CAAC,GAAG,CAAwC;IAEnE,MAAM,CAAC,KAAK,CAAC,aAAa,EAAE,CAAC,MAAM,EAAE,gBAAgB,KAAK,IAAI,GAAG,eAAe;CAkCnF"}
|