@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,42 @@
|
|
|
1
|
+
import { Bonjour } from 'bonjour-service';
|
|
2
|
+
import createDebug from 'debug';
|
|
3
|
+
import { SoundTouchDevice } from '../device/SoundTouchDevice';
|
|
4
|
+
/**
|
|
5
|
+
* Starts mDNS discovery for SoundTouch devices and invokes the callback on first sight of each host.
|
|
6
|
+
*
|
|
7
|
+
* @param onDeviceFound Callback invoked when a new SoundTouch device is found.
|
|
8
|
+
* @param returns a handle that can be used to stop discovery when no longer needed.
|
|
9
|
+
*/
|
|
10
|
+
export class SoundTouchDiscovery {
|
|
11
|
+
static start(onDeviceFound) {
|
|
12
|
+
this.log('🔍 Starting SoundTouch discovery...');
|
|
13
|
+
const instance = new Bonjour();
|
|
14
|
+
const seen = new Set();
|
|
15
|
+
const browser = instance.find({ type: 'soundtouch', protocol: 'tcp' }, (service) => {
|
|
16
|
+
const host = service.addresses?.[0];
|
|
17
|
+
if (!host) {
|
|
18
|
+
this.log('⚠️ Service without address, skipping: %O', service);
|
|
19
|
+
return;
|
|
20
|
+
}
|
|
21
|
+
if (seen.has(host)) {
|
|
22
|
+
this.log('🔁 Duplicate host %s ignored', host);
|
|
23
|
+
return;
|
|
24
|
+
}
|
|
25
|
+
seen.add(host);
|
|
26
|
+
this.log('✅ Discovered SoundTouch host %s', host);
|
|
27
|
+
onDeviceFound(new SoundTouchDevice(host));
|
|
28
|
+
});
|
|
29
|
+
browser.on('error', (error) => {
|
|
30
|
+
this.log('❌ Bonjour discovery error: %O', error);
|
|
31
|
+
});
|
|
32
|
+
return {
|
|
33
|
+
stop: () => {
|
|
34
|
+
this.log('🛑 Stopping SoundTouch discovery...');
|
|
35
|
+
browser.stop();
|
|
36
|
+
instance.destroy();
|
|
37
|
+
},
|
|
38
|
+
};
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
SoundTouchDiscovery.log = createDebug('soundretouch:discovery');
|
|
42
|
+
//# sourceMappingURL=SoundTouchDiscovery.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"SoundTouchDiscovery.js","sourceRoot":"","sources":["../../../src/discovery/SoundTouchDiscovery.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,iBAAiB,CAAA;AACzC,OAAO,WAAW,MAAM,OAAO,CAAA;AAE/B,OAAO,EAAE,gBAAgB,EAAE,MAAM,4BAA4B,CAAA;AAS7D;;;;;GAKG;AACH,MAAM,OAAO,mBAAmB;IAG5B,MAAM,CAAC,KAAK,CAAC,aAAiD;QAC1D,IAAI,CAAC,GAAG,CAAC,qCAAqC,CAAC,CAAA;QAE/C,MAAM,QAAQ,GAAG,IAAI,OAAO,EAAE,CAAA;QAC9B,MAAM,IAAI,GAAG,IAAI,GAAG,EAAU,CAAA;QAC9B,MAAM,OAAO,GAAG,QAAQ,CAAC,IAAI,CAAC,EAAE,IAAI,EAAE,YAAY,EAAE,QAAQ,EAAE,KAAK,EAAE,EAAE,CAAC,OAAO,EAAE,EAAE;YAC/E,MAAM,IAAI,GAAG,OAAO,CAAC,SAAS,EAAE,CAAC,CAAC,CAAC,CAAA;YACnC,IAAI,CAAC,IAAI,EAAE,CAAC;gBACR,IAAI,CAAC,GAAG,CAAC,0CAA0C,EAAE,OAAO,CAAC,CAAA;gBAC7D,OAAM;YACV,CAAC;YAED,IAAI,IAAI,CAAC,GAAG,CAAC,IAAI,CAAC,EAAE,CAAC;gBACjB,IAAI,CAAC,GAAG,CAAC,8BAA8B,EAAE,IAAI,CAAC,CAAA;gBAC9C,OAAM;YACV,CAAC;YAED,IAAI,CAAC,GAAG,CAAC,IAAI,CAAC,CAAA;YACd,IAAI,CAAC,GAAG,CAAC,iCAAiC,EAAE,IAAI,CAAC,CAAA;YACjD,aAAa,CAAC,IAAI,gBAAgB,CAAC,IAAI,CAAC,CAAC,CAAA;QAC7C,CAAC,CAAC,CAAA;QAEF,OAAO,CAAC,EAAE,CAAC,OAAO,EAAE,CAAC,KAAK,EAAE,EAAE;YAC1B,IAAI,CAAC,GAAG,CAAC,+BAA+B,EAAE,KAAK,CAAC,CAAA;QACpD,CAAC,CAAC,CAAA;QAEF,OAAO;YACH,IAAI,EAAE,GAAG,EAAE;gBACP,IAAI,CAAC,GAAG,CAAC,qCAAqC,CAAC,CAAA;gBAC/C,OAAO,CAAC,IAAI,EAAE,CAAA;gBACd,QAAQ,CAAC,OAAO,EAAE,CAAA;YACtB,CAAC;SACJ,CAAA;IACL,CAAC;;AAnCuB,uBAAG,GAAG,WAAW,CAAC,wBAAwB,CAAC,CAAA"}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { HttpClient } from '../client/http';
|
|
2
|
+
import { AudioProductLevelControls, AudioProductLevelControlsUpdate } from '../types/AudioProductLevelControls';
|
|
3
|
+
/**
|
|
4
|
+
* Gets the current front-center and rear-surround level settings from the device.
|
|
5
|
+
*
|
|
6
|
+
* GET /audioproductlevelcontrols
|
|
7
|
+
*
|
|
8
|
+
* @returns Promise<AudioProductLevelControls> A promise that resolves to the level controls payload as returned by the device.
|
|
9
|
+
*/
|
|
10
|
+
export declare function fetchAudioProductLevelControls(client: HttpClient): Promise<AudioProductLevelControls>;
|
|
11
|
+
/**
|
|
12
|
+
* Updates front-center and/or rear-surround levels for the device. Only included values are changed.
|
|
13
|
+
*
|
|
14
|
+
* POST /audioproductlevelcontrols
|
|
15
|
+
*
|
|
16
|
+
* @param values Level values to update (frontCenterSpeakerLevel and/or rearSurroundSpeakersLevel).
|
|
17
|
+
* @returns A promise that resolves when the device accepts the level update.
|
|
18
|
+
*
|
|
19
|
+
* @example
|
|
20
|
+
* await device.setAudioProductLevelControls({ frontCenterSpeakerLevel: 1 })
|
|
21
|
+
* await device.setAudioProductLevelControls({ rearSurroundSpeakersLevel: -2 })
|
|
22
|
+
*/
|
|
23
|
+
export declare function setAudioProductLevelControls(client: HttpClient, values: AudioProductLevelControlsUpdate): Promise<void>;
|
|
24
|
+
//# sourceMappingURL=audioProductLevelControls.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"audioProductLevelControls.d.ts","sourceRoot":"","sources":["../../../src/endpoints/audioProductLevelControls.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,UAAU,EAAE,MAAM,gBAAgB,CAAA;AAC3C,OAAO,EAAE,yBAAyB,EAAE,+BAA+B,EAAE,MAAM,oCAAoC,CAAA;AAsB/G;;;;;;GAMG;AACH,wBAAsB,8BAA8B,CAAC,MAAM,EAAE,UAAU,GAAG,OAAO,CAAC,yBAAyB,CAAC,CAO3G;AAED;;;;;;;;;;;GAWG;AACH,wBAAsB,4BAA4B,CAAC,MAAM,EAAE,UAAU,EAAE,MAAM,EAAE,+BAA+B,GAAG,OAAO,CAAC,IAAI,CAAC,CAO7H"}
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
import createDebug from 'debug';
|
|
2
|
+
const log = createDebug('soundretouch:endpoints:audioproductlevelcontrols');
|
|
3
|
+
function buildAudioProductLevelControlsXml(values) {
|
|
4
|
+
const parts = [];
|
|
5
|
+
if (values.frontCenterSpeakerLevel !== undefined) {
|
|
6
|
+
parts.push(`<frontCenterSpeakerLevel value="${values.frontCenterSpeakerLevel}" />`);
|
|
7
|
+
}
|
|
8
|
+
if (values.rearSurroundSpeakersLevel !== undefined) {
|
|
9
|
+
parts.push(`<rearSurroundSpeakersLevel value="${values.rearSurroundSpeakersLevel}" />`);
|
|
10
|
+
}
|
|
11
|
+
return `<audioproductlevelcontrols>${parts.join('')}</audioproductlevelcontrols>`;
|
|
12
|
+
}
|
|
13
|
+
/**
|
|
14
|
+
* Gets the current front-center and rear-surround level settings from the device.
|
|
15
|
+
*
|
|
16
|
+
* GET /audioproductlevelcontrols
|
|
17
|
+
*
|
|
18
|
+
* @returns Promise<AudioProductLevelControls> A promise that resolves to the level controls payload as returned by the device.
|
|
19
|
+
*/
|
|
20
|
+
export async function fetchAudioProductLevelControls(client) {
|
|
21
|
+
log('GET /audioproductlevelcontrols');
|
|
22
|
+
const data = await client.getXml('/audioproductlevelcontrols');
|
|
23
|
+
log('response %O', data.audioproductlevelcontrols ?? {});
|
|
24
|
+
return data.audioproductlevelcontrols ?? {};
|
|
25
|
+
}
|
|
26
|
+
/**
|
|
27
|
+
* Updates front-center and/or rear-surround levels for the device. Only included values are changed.
|
|
28
|
+
*
|
|
29
|
+
* POST /audioproductlevelcontrols
|
|
30
|
+
*
|
|
31
|
+
* @param values Level values to update (frontCenterSpeakerLevel and/or rearSurroundSpeakersLevel).
|
|
32
|
+
* @returns A promise that resolves when the device accepts the level update.
|
|
33
|
+
*
|
|
34
|
+
* @example
|
|
35
|
+
* await device.setAudioProductLevelControls({ frontCenterSpeakerLevel: 1 })
|
|
36
|
+
* await device.setAudioProductLevelControls({ rearSurroundSpeakersLevel: -2 })
|
|
37
|
+
*/
|
|
38
|
+
export async function setAudioProductLevelControls(client, values) {
|
|
39
|
+
const body = buildAudioProductLevelControlsXml(values);
|
|
40
|
+
log('POST /audioproductlevelcontrols');
|
|
41
|
+
log('payload %s', body);
|
|
42
|
+
await client.post('/audioproductlevelcontrols', body);
|
|
43
|
+
}
|
|
44
|
+
//# sourceMappingURL=audioProductLevelControls.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"audioProductLevelControls.js","sourceRoot":"","sources":["../../../src/endpoints/audioProductLevelControls.ts"],"names":[],"mappings":"AAAA,OAAO,WAAW,MAAM,OAAO,CAAA;AAK/B,MAAM,GAAG,GAAG,WAAW,CAAC,kDAAkD,CAAC,CAAA;AAM3E,SAAS,iCAAiC,CAAC,MAAuC;IAC9E,MAAM,KAAK,GAAa,EAAE,CAAA;IAE1B,IAAI,MAAM,CAAC,uBAAuB,KAAK,SAAS,EAAE,CAAC;QAC/C,KAAK,CAAC,IAAI,CAAC,mCAAmC,MAAM,CAAC,uBAAuB,MAAM,CAAC,CAAA;IACvF,CAAC;IAED,IAAI,MAAM,CAAC,yBAAyB,KAAK,SAAS,EAAE,CAAC;QACjD,KAAK,CAAC,IAAI,CAAC,qCAAqC,MAAM,CAAC,yBAAyB,MAAM,CAAC,CAAA;IAC3F,CAAC;IAED,OAAO,8BAA8B,KAAK,CAAC,IAAI,CAAC,EAAE,CAAC,8BAA8B,CAAA;AACrF,CAAC;AAED;;;;;;GAMG;AACH,MAAM,CAAC,KAAK,UAAU,8BAA8B,CAAC,MAAkB;IACnE,GAAG,CAAC,gCAAgC,CAAC,CAAA;IAErC,MAAM,IAAI,GAAG,MAAM,MAAM,CAAC,MAAM,CAAoC,4BAA4B,CAAC,CAAA;IACjG,GAAG,CAAC,aAAa,EAAE,IAAI,CAAC,yBAAyB,IAAI,EAAE,CAAC,CAAA;IAExD,OAAO,IAAI,CAAC,yBAAyB,IAAI,EAAE,CAAA;AAC/C,CAAC;AAED;;;;;;;;;;;GAWG;AACH,MAAM,CAAC,KAAK,UAAU,4BAA4B,CAAC,MAAkB,EAAE,MAAuC;IAC1G,MAAM,IAAI,GAAG,iCAAiC,CAAC,MAAM,CAAC,CAAA;IAEtD,GAAG,CAAC,iCAAiC,CAAC,CAAA;IACtC,GAAG,CAAC,YAAY,EAAE,IAAI,CAAC,CAAA;IAEvB,MAAM,MAAM,CAAC,IAAI,CAAC,4BAA4B,EAAE,IAAI,CAAC,CAAA;AACzD,CAAC"}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { HttpClient } from '../client/http';
|
|
2
|
+
import { AudioProductToneControls, AudioProductToneControlsUpdate } from '../types/AudioProductToneControls';
|
|
3
|
+
/**
|
|
4
|
+
* Gets the current bass and treble settings from the device.
|
|
5
|
+
*
|
|
6
|
+
* GET /audioproducttonecontrols
|
|
7
|
+
*
|
|
8
|
+
* @returns Promise<AudioProductToneControls> A promise that resolves to the tone controls payload as returned by the device.
|
|
9
|
+
*/
|
|
10
|
+
export declare function fetchAudioProductToneControls(client: HttpClient): Promise<AudioProductToneControls>;
|
|
11
|
+
/**
|
|
12
|
+
* Updates bass and/or treble settings for the device. Only included values are changed.
|
|
13
|
+
*
|
|
14
|
+
* POST /audioproducttonecontrols
|
|
15
|
+
*
|
|
16
|
+
* @param values Tone values to update (bass and/or treble).
|
|
17
|
+
* @returns A promise that resolves when the device accepts the tone update.
|
|
18
|
+
*
|
|
19
|
+
* @example
|
|
20
|
+
* await device.setAudioProductToneControls({ bass: 2 })
|
|
21
|
+
* await device.setAudioProductToneControls({ treble: -1 })
|
|
22
|
+
*/
|
|
23
|
+
export declare function setAudioProductToneControls(client: HttpClient, values: AudioProductToneControlsUpdate): Promise<void>;
|
|
24
|
+
//# sourceMappingURL=audioProductToneControls.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"audioProductToneControls.d.ts","sourceRoot":"","sources":["../../../src/endpoints/audioProductToneControls.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,UAAU,EAAE,MAAM,gBAAgB,CAAA;AAC3C,OAAO,EAAE,wBAAwB,EAAE,8BAA8B,EAAE,MAAM,mCAAmC,CAAA;AAsB5G;;;;;;GAMG;AACH,wBAAsB,6BAA6B,CAAC,MAAM,EAAE,UAAU,GAAG,OAAO,CAAC,wBAAwB,CAAC,CAOzG;AAED;;;;;;;;;;;GAWG;AACH,wBAAsB,2BAA2B,CAAC,MAAM,EAAE,UAAU,EAAE,MAAM,EAAE,8BAA8B,GAAG,OAAO,CAAC,IAAI,CAAC,CAO3H"}
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
import createDebug from 'debug';
|
|
2
|
+
const log = createDebug('soundretouch:endpoints:audioproducttonecontrols');
|
|
3
|
+
function buildAudioProductToneControlsXml(values) {
|
|
4
|
+
const parts = [];
|
|
5
|
+
if (values.bass !== undefined) {
|
|
6
|
+
parts.push(`<bass value="${values.bass}" />`);
|
|
7
|
+
}
|
|
8
|
+
if (values.treble !== undefined) {
|
|
9
|
+
parts.push(`<treble value="${values.treble}" />`);
|
|
10
|
+
}
|
|
11
|
+
return `<audioproducttonecontrols>${parts.join('')}</audioproducttonecontrols>`;
|
|
12
|
+
}
|
|
13
|
+
/**
|
|
14
|
+
* Gets the current bass and treble settings from the device.
|
|
15
|
+
*
|
|
16
|
+
* GET /audioproducttonecontrols
|
|
17
|
+
*
|
|
18
|
+
* @returns Promise<AudioProductToneControls> A promise that resolves to the tone controls payload as returned by the device.
|
|
19
|
+
*/
|
|
20
|
+
export async function fetchAudioProductToneControls(client) {
|
|
21
|
+
log('GET /audioproducttonecontrols');
|
|
22
|
+
const data = await client.getXml('/audioproducttonecontrols');
|
|
23
|
+
log('response %O', data.audioproducttonecontrols ?? {});
|
|
24
|
+
return data.audioproducttonecontrols ?? {};
|
|
25
|
+
}
|
|
26
|
+
/**
|
|
27
|
+
* Updates bass and/or treble settings for the device. Only included values are changed.
|
|
28
|
+
*
|
|
29
|
+
* POST /audioproducttonecontrols
|
|
30
|
+
*
|
|
31
|
+
* @param values Tone values to update (bass and/or treble).
|
|
32
|
+
* @returns A promise that resolves when the device accepts the tone update.
|
|
33
|
+
*
|
|
34
|
+
* @example
|
|
35
|
+
* await device.setAudioProductToneControls({ bass: 2 })
|
|
36
|
+
* await device.setAudioProductToneControls({ treble: -1 })
|
|
37
|
+
*/
|
|
38
|
+
export async function setAudioProductToneControls(client, values) {
|
|
39
|
+
const body = buildAudioProductToneControlsXml(values);
|
|
40
|
+
log('POST /audioproducttonecontrols');
|
|
41
|
+
log('payload %s', body);
|
|
42
|
+
await client.post('/audioproducttonecontrols', body);
|
|
43
|
+
}
|
|
44
|
+
//# sourceMappingURL=audioProductToneControls.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"audioProductToneControls.js","sourceRoot":"","sources":["../../../src/endpoints/audioProductToneControls.ts"],"names":[],"mappings":"AAAA,OAAO,WAAW,MAAM,OAAO,CAAA;AAK/B,MAAM,GAAG,GAAG,WAAW,CAAC,iDAAiD,CAAC,CAAA;AAM1E,SAAS,gCAAgC,CAAC,MAAsC;IAC5E,MAAM,KAAK,GAAa,EAAE,CAAA;IAE1B,IAAI,MAAM,CAAC,IAAI,KAAK,SAAS,EAAE,CAAC;QAC5B,KAAK,CAAC,IAAI,CAAC,gBAAgB,MAAM,CAAC,IAAI,MAAM,CAAC,CAAA;IACjD,CAAC;IAED,IAAI,MAAM,CAAC,MAAM,KAAK,SAAS,EAAE,CAAC;QAC9B,KAAK,CAAC,IAAI,CAAC,kBAAkB,MAAM,CAAC,MAAM,MAAM,CAAC,CAAA;IACrD,CAAC;IAED,OAAO,6BAA6B,KAAK,CAAC,IAAI,CAAC,EAAE,CAAC,6BAA6B,CAAA;AACnF,CAAC;AAED;;;;;;GAMG;AACH,MAAM,CAAC,KAAK,UAAU,6BAA6B,CAAC,MAAkB;IAClE,GAAG,CAAC,+BAA+B,CAAC,CAAA;IAEpC,MAAM,IAAI,GAAG,MAAM,MAAM,CAAC,MAAM,CAAmC,2BAA2B,CAAC,CAAA;IAC/F,GAAG,CAAC,aAAa,EAAE,IAAI,CAAC,wBAAwB,IAAI,EAAE,CAAC,CAAA;IAEvD,OAAO,IAAI,CAAC,wBAAwB,IAAI,EAAE,CAAA;AAC9C,CAAC;AAED;;;;;;;;;;;GAWG;AACH,MAAM,CAAC,KAAK,UAAU,2BAA2B,CAAC,MAAkB,EAAE,MAAsC;IACxG,MAAM,IAAI,GAAG,gCAAgC,CAAC,MAAM,CAAC,CAAA;IAErD,GAAG,CAAC,gCAAgC,CAAC,CAAA;IACrC,GAAG,CAAC,YAAY,EAAE,IAAI,CAAC,CAAA;IAEvB,MAAM,MAAM,CAAC,IAAI,CAAC,2BAA2B,EAAE,IAAI,CAAC,CAAA;AACxD,CAAC"}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { HttpClient } from '../client/http';
|
|
2
|
+
import { AudioDspControls } from '../types/AudioDspControls';
|
|
3
|
+
/**
|
|
4
|
+
* Gets the current DSP settings for the device.
|
|
5
|
+
*
|
|
6
|
+
* GET /audiodspcontrols
|
|
7
|
+
*
|
|
8
|
+
* @returns Promise<AudioDspControls> A promise that resolves to the DSP controls payload as returned by the device.
|
|
9
|
+
*/
|
|
10
|
+
export declare function fetchAudioDspControls(client: HttpClient): Promise<AudioDspControls>;
|
|
11
|
+
/**
|
|
12
|
+
* Updates DSP settings for the device. Only included values are changed.
|
|
13
|
+
*
|
|
14
|
+
* POST /audiodspcontrols
|
|
15
|
+
*
|
|
16
|
+
* @param values DSP values to update (audiomode and/or videosyncaudiodelay).
|
|
17
|
+
* @returns A promise that resolves when the device accepts the DSP update.
|
|
18
|
+
*
|
|
19
|
+
* @example
|
|
20
|
+
* await device.setAudioDspControls({ audiomode: 'movie' })
|
|
21
|
+
* await device.setAudioDspControls({ videosyncaudiodelay: 150 })
|
|
22
|
+
*/
|
|
23
|
+
export declare function setAudioDspControls(client: HttpClient, values: AudioDspControls): Promise<void>;
|
|
24
|
+
//# sourceMappingURL=audiodspcontrols.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"audiodspcontrols.d.ts","sourceRoot":"","sources":["../../../src/endpoints/audiodspcontrols.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,UAAU,EAAE,MAAM,gBAAgB,CAAA;AAC3C,OAAO,EAAE,gBAAgB,EAAE,MAAM,2BAA2B,CAAA;AAsB5D;;;;;;GAMG;AACH,wBAAsB,qBAAqB,CAAC,MAAM,EAAE,UAAU,GAAG,OAAO,CAAC,gBAAgB,CAAC,CAOzF;AAED;;;;;;;;;;;GAWG;AACH,wBAAsB,mBAAmB,CAAC,MAAM,EAAE,UAAU,EAAE,MAAM,EAAE,gBAAgB,GAAG,OAAO,CAAC,IAAI,CAAC,CAOrG"}
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
import createDebug from 'debug';
|
|
2
|
+
const log = createDebug('soundretouch:endpoints:audiodspcontrols');
|
|
3
|
+
function buildAudioDspControlsXml(values) {
|
|
4
|
+
const parts = [];
|
|
5
|
+
if (values.audiomode !== undefined) {
|
|
6
|
+
parts.push(`audiomode="${values.audiomode}"`);
|
|
7
|
+
}
|
|
8
|
+
if (values.videosyncaudiodelay !== undefined) {
|
|
9
|
+
parts.push(`videosyncaudiodelay="${values.videosyncaudiodelay}"`);
|
|
10
|
+
}
|
|
11
|
+
return `<audiodspcontrols ${parts.join(' ')} />`;
|
|
12
|
+
}
|
|
13
|
+
/**
|
|
14
|
+
* Gets the current DSP settings for the device.
|
|
15
|
+
*
|
|
16
|
+
* GET /audiodspcontrols
|
|
17
|
+
*
|
|
18
|
+
* @returns Promise<AudioDspControls> A promise that resolves to the DSP controls payload as returned by the device.
|
|
19
|
+
*/
|
|
20
|
+
export async function fetchAudioDspControls(client) {
|
|
21
|
+
log('GET /audiodspcontrols');
|
|
22
|
+
const data = await client.getXml('/audiodspcontrols');
|
|
23
|
+
log('response %O', data.audiodspcontrols ?? {});
|
|
24
|
+
return data.audiodspcontrols ?? {};
|
|
25
|
+
}
|
|
26
|
+
/**
|
|
27
|
+
* Updates DSP settings for the device. Only included values are changed.
|
|
28
|
+
*
|
|
29
|
+
* POST /audiodspcontrols
|
|
30
|
+
*
|
|
31
|
+
* @param values DSP values to update (audiomode and/or videosyncaudiodelay).
|
|
32
|
+
* @returns A promise that resolves when the device accepts the DSP update.
|
|
33
|
+
*
|
|
34
|
+
* @example
|
|
35
|
+
* await device.setAudioDspControls({ audiomode: 'movie' })
|
|
36
|
+
* await device.setAudioDspControls({ videosyncaudiodelay: 150 })
|
|
37
|
+
*/
|
|
38
|
+
export async function setAudioDspControls(client, values) {
|
|
39
|
+
const body = buildAudioDspControlsXml(values);
|
|
40
|
+
log('POST /audiodspcontrols');
|
|
41
|
+
log('payload %s', body);
|
|
42
|
+
await client.post('/audiodspcontrols', body);
|
|
43
|
+
}
|
|
44
|
+
//# sourceMappingURL=audiodspcontrols.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"audiodspcontrols.js","sourceRoot":"","sources":["../../../src/endpoints/audiodspcontrols.ts"],"names":[],"mappings":"AAAA,OAAO,WAAW,MAAM,OAAO,CAAA;AAK/B,MAAM,GAAG,GAAG,WAAW,CAAC,yCAAyC,CAAC,CAAA;AAMlE,SAAS,wBAAwB,CAAC,MAAwB;IACtD,MAAM,KAAK,GAAa,EAAE,CAAA;IAE1B,IAAI,MAAM,CAAC,SAAS,KAAK,SAAS,EAAE,CAAC;QACjC,KAAK,CAAC,IAAI,CAAC,cAAc,MAAM,CAAC,SAAS,GAAG,CAAC,CAAA;IACjD,CAAC;IAED,IAAI,MAAM,CAAC,mBAAmB,KAAK,SAAS,EAAE,CAAC;QAC3C,KAAK,CAAC,IAAI,CAAC,wBAAwB,MAAM,CAAC,mBAAmB,GAAG,CAAC,CAAA;IACrE,CAAC;IAED,OAAO,qBAAqB,KAAK,CAAC,IAAI,CAAC,GAAG,CAAC,KAAK,CAAA;AACpD,CAAC;AAED;;;;;;GAMG;AACH,MAAM,CAAC,KAAK,UAAU,qBAAqB,CAAC,MAAkB;IAC1D,GAAG,CAAC,uBAAuB,CAAC,CAAA;IAE5B,MAAM,IAAI,GAAG,MAAM,MAAM,CAAC,MAAM,CAA2B,mBAAmB,CAAC,CAAA;IAC/E,GAAG,CAAC,aAAa,EAAE,IAAI,CAAC,gBAAgB,IAAI,EAAE,CAAC,CAAA;IAE/C,OAAO,IAAI,CAAC,gBAAgB,IAAI,EAAE,CAAA;AACtC,CAAC;AAED;;;;;;;;;;;GAWG;AACH,MAAM,CAAC,KAAK,UAAU,mBAAmB,CAAC,MAAkB,EAAE,MAAwB;IAClF,MAAM,IAAI,GAAG,wBAAwB,CAAC,MAAM,CAAC,CAAA;IAE7C,GAAG,CAAC,wBAAwB,CAAC,CAAA;IAC7B,GAAG,CAAC,YAAY,EAAE,IAAI,CAAC,CAAA;IAEvB,MAAM,MAAM,CAAC,IAAI,CAAC,mBAAmB,EAAE,IAAI,CAAC,CAAA;AAChD,CAAC"}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { HttpClient } from '../client/http';
|
|
2
|
+
import { Bass } from '../types/Bass';
|
|
3
|
+
/**
|
|
4
|
+
* Gets the current bass setting from the device.
|
|
5
|
+
*
|
|
6
|
+
* GET /bass
|
|
7
|
+
*
|
|
8
|
+
* @returns Promise<Bass> A promise that resolves to the bass payload as returned by the device.
|
|
9
|
+
*/
|
|
10
|
+
export declare function fetchBass(client: HttpClient): Promise<Bass>;
|
|
11
|
+
/**
|
|
12
|
+
* Sets the bass level for the device.
|
|
13
|
+
*
|
|
14
|
+
* POST /bass
|
|
15
|
+
*
|
|
16
|
+
* @param value Bass value to set.
|
|
17
|
+
* @returns A promise that resolves when the device accepts the bass value.
|
|
18
|
+
*
|
|
19
|
+
* @example
|
|
20
|
+
* await device.setBass(5)
|
|
21
|
+
*/
|
|
22
|
+
export declare function setBass(client: HttpClient, value: number): Promise<void>;
|
|
23
|
+
//# sourceMappingURL=bass.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"bass.d.ts","sourceRoot":"","sources":["../../../src/endpoints/bass.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,UAAU,EAAE,MAAM,gBAAgB,CAAA;AAC3C,OAAO,EAAE,IAAI,EAAE,MAAM,eAAe,CAAA;AAQpC;;;;;;GAMG;AACH,wBAAsB,SAAS,CAAC,MAAM,EAAE,UAAU,GAAG,OAAO,CAAC,IAAI,CAAC,CAOjE;AAED;;;;;;;;;;GAUG;AACH,wBAAsB,OAAO,CAAC,MAAM,EAAE,UAAU,EAAE,KAAK,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CAO9E"}
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import createDebug from 'debug';
|
|
2
|
+
const log = createDebug('soundretouch:endpoints:bass');
|
|
3
|
+
/**
|
|
4
|
+
* Gets the current bass setting from the device.
|
|
5
|
+
*
|
|
6
|
+
* GET /bass
|
|
7
|
+
*
|
|
8
|
+
* @returns Promise<Bass> A promise that resolves to the bass payload as returned by the device.
|
|
9
|
+
*/
|
|
10
|
+
export async function fetchBass(client) {
|
|
11
|
+
log('GET /bass');
|
|
12
|
+
const data = await client.getXml('/bass');
|
|
13
|
+
log('response %O', data.bass ?? {});
|
|
14
|
+
return data.bass ?? {};
|
|
15
|
+
}
|
|
16
|
+
/**
|
|
17
|
+
* Sets the bass level for the device.
|
|
18
|
+
*
|
|
19
|
+
* POST /bass
|
|
20
|
+
*
|
|
21
|
+
* @param value Bass value to set.
|
|
22
|
+
* @returns A promise that resolves when the device accepts the bass value.
|
|
23
|
+
*
|
|
24
|
+
* @example
|
|
25
|
+
* await device.setBass(5)
|
|
26
|
+
*/
|
|
27
|
+
export async function setBass(client, value) {
|
|
28
|
+
const body = `<bass>${value}</bass>`;
|
|
29
|
+
log('POST /bass');
|
|
30
|
+
log('payload %s', body);
|
|
31
|
+
await client.post('/bass', body);
|
|
32
|
+
}
|
|
33
|
+
//# sourceMappingURL=bass.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"bass.js","sourceRoot":"","sources":["../../../src/endpoints/bass.ts"],"names":[],"mappings":"AAAA,OAAO,WAAW,MAAM,OAAO,CAAA;AAK/B,MAAM,GAAG,GAAG,WAAW,CAAC,6BAA6B,CAAC,CAAA;AAMtD;;;;;;GAMG;AACH,MAAM,CAAC,KAAK,UAAU,SAAS,CAAC,MAAkB;IAC9C,GAAG,CAAC,WAAW,CAAC,CAAA;IAEhB,MAAM,IAAI,GAAG,MAAM,MAAM,CAAC,MAAM,CAAe,OAAO,CAAC,CAAA;IACvD,GAAG,CAAC,aAAa,EAAE,IAAI,CAAC,IAAI,IAAI,EAAE,CAAC,CAAA;IAEnC,OAAO,IAAI,CAAC,IAAI,IAAI,EAAE,CAAA;AAC1B,CAAC;AAED;;;;;;;;;;GAUG;AACH,MAAM,CAAC,KAAK,UAAU,OAAO,CAAC,MAAkB,EAAE,KAAa;IAC3D,MAAM,IAAI,GAAG,SAAS,KAAK,SAAS,CAAA;IAEpC,GAAG,CAAC,YAAY,CAAC,CAAA;IACjB,GAAG,CAAC,YAAY,EAAE,IAAI,CAAC,CAAA;IAEvB,MAAM,MAAM,CAAC,IAAI,CAAC,OAAO,EAAE,IAAI,CAAC,CAAA;AACpC,CAAC"}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { HttpClient } from '../client/http';
|
|
2
|
+
import { BassCapabilities } from '../types/BassCapabilities';
|
|
3
|
+
/**
|
|
4
|
+
* Gets bass capability information for the device.
|
|
5
|
+
*
|
|
6
|
+
* GET /bassCapabilities
|
|
7
|
+
*
|
|
8
|
+
* @returns Promise<BassCapabilities> A promise that resolves to the bass capabilities payload as returned by the device.
|
|
9
|
+
*/
|
|
10
|
+
export declare function fetchBassCapabilities(client: HttpClient): Promise<BassCapabilities>;
|
|
11
|
+
//# sourceMappingURL=bassCapabilities.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"bassCapabilities.d.ts","sourceRoot":"","sources":["../../../src/endpoints/bassCapabilities.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,UAAU,EAAE,MAAM,gBAAgB,CAAA;AAC3C,OAAO,EAAE,gBAAgB,EAAE,MAAM,2BAA2B,CAAA;AAQ5D;;;;;;GAMG;AACH,wBAAsB,qBAAqB,CAAC,MAAM,EAAE,UAAU,GAAG,OAAO,CAAC,gBAAgB,CAAC,CAOzF"}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import createDebug from 'debug';
|
|
2
|
+
const log = createDebug('soundretouch:endpoints:basscapabilities');
|
|
3
|
+
/**
|
|
4
|
+
* Gets bass capability information for the device.
|
|
5
|
+
*
|
|
6
|
+
* GET /bassCapabilities
|
|
7
|
+
*
|
|
8
|
+
* @returns Promise<BassCapabilities> A promise that resolves to the bass capabilities payload as returned by the device.
|
|
9
|
+
*/
|
|
10
|
+
export async function fetchBassCapabilities(client) {
|
|
11
|
+
log('GET /bassCapabilities');
|
|
12
|
+
const data = await client.getXml('/bassCapabilities');
|
|
13
|
+
log('response %O', data.bassCapabilities ?? {});
|
|
14
|
+
return data.bassCapabilities ?? {};
|
|
15
|
+
}
|
|
16
|
+
//# sourceMappingURL=bassCapabilities.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"bassCapabilities.js","sourceRoot":"","sources":["../../../src/endpoints/bassCapabilities.ts"],"names":[],"mappings":"AAAA,OAAO,WAAW,MAAM,OAAO,CAAA;AAK/B,MAAM,GAAG,GAAG,WAAW,CAAC,yCAAyC,CAAC,CAAA;AAMlE;;;;;;GAMG;AACH,MAAM,CAAC,KAAK,UAAU,qBAAqB,CAAC,MAAkB;IAC1D,GAAG,CAAC,uBAAuB,CAAC,CAAA;IAE5B,MAAM,IAAI,GAAG,MAAM,MAAM,CAAC,MAAM,CAA2B,mBAAmB,CAAC,CAAA;IAC/E,GAAG,CAAC,aAAa,EAAE,IAAI,CAAC,gBAAgB,IAAI,EAAE,CAAC,CAAA;IAE/C,OAAO,IAAI,CAAC,gBAAgB,IAAI,EAAE,CAAA;AACtC,CAAC"}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { HttpClient } from '../client/http';
|
|
2
|
+
import { Capabilities } from '../types/Capabilities';
|
|
3
|
+
/**
|
|
4
|
+
* Retrieves system capabilities for the device.
|
|
5
|
+
*
|
|
6
|
+
* GET /capabilities
|
|
7
|
+
*
|
|
8
|
+
* @returns Promise<Capabilities> A promise that resolves to the capabilities payload as returned by the device.
|
|
9
|
+
*/
|
|
10
|
+
export declare function fetchCapabilities(client: HttpClient): Promise<Capabilities>;
|
|
11
|
+
//# sourceMappingURL=capabilities.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"capabilities.d.ts","sourceRoot":"","sources":["../../../src/endpoints/capabilities.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,UAAU,EAAE,MAAM,gBAAgB,CAAA;AAC3C,OAAO,EAAE,YAAY,EAAE,MAAM,uBAAuB,CAAA;AAQpD;;;;;;GAMG;AACH,wBAAsB,iBAAiB,CAAC,MAAM,EAAE,UAAU,GAAG,OAAO,CAAC,YAAY,CAAC,CAOjF"}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import createDebug from 'debug';
|
|
2
|
+
const log = createDebug('soundretouch:endpoints:capabilities');
|
|
3
|
+
/**
|
|
4
|
+
* Retrieves system capabilities for the device.
|
|
5
|
+
*
|
|
6
|
+
* GET /capabilities
|
|
7
|
+
*
|
|
8
|
+
* @returns Promise<Capabilities> A promise that resolves to the capabilities payload as returned by the device.
|
|
9
|
+
*/
|
|
10
|
+
export async function fetchCapabilities(client) {
|
|
11
|
+
log('GET /capabilities');
|
|
12
|
+
const data = await client.getXml('/capabilities');
|
|
13
|
+
log('response %O', data.capabilities ?? {});
|
|
14
|
+
return data.capabilities ?? {};
|
|
15
|
+
}
|
|
16
|
+
//# sourceMappingURL=capabilities.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"capabilities.js","sourceRoot":"","sources":["../../../src/endpoints/capabilities.ts"],"names":[],"mappings":"AAAA,OAAO,WAAW,MAAM,OAAO,CAAA;AAK/B,MAAM,GAAG,GAAG,WAAW,CAAC,qCAAqC,CAAC,CAAA;AAM9D;;;;;;GAMG;AACH,MAAM,CAAC,KAAK,UAAU,iBAAiB,CAAC,MAAkB;IACtD,GAAG,CAAC,mBAAmB,CAAC,CAAA;IAExB,MAAM,IAAI,GAAG,MAAM,MAAM,CAAC,MAAM,CAAuB,eAAe,CAAC,CAAA;IACvE,GAAG,CAAC,aAAa,EAAE,IAAI,CAAC,YAAY,IAAI,EAAE,CAAC,CAAA;IAE3C,OAAO,IAAI,CAAC,YAAY,IAAI,EAAE,CAAA;AAClC,CAAC"}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { HttpClient } from '../client/http';
|
|
2
|
+
import { DeviceInfo } from '../types/DeviceInfo';
|
|
3
|
+
/**
|
|
4
|
+
* Gets device information including identifiers, components, and network info.
|
|
5
|
+
*
|
|
6
|
+
* GET /info
|
|
7
|
+
*
|
|
8
|
+
* @returns Promise<DeviceInfo> A promise that resolves to the device info payload as returned by the device.
|
|
9
|
+
*/
|
|
10
|
+
export declare function fetchInfo(client: HttpClient): Promise<DeviceInfo>;
|
|
11
|
+
//# sourceMappingURL=info.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"info.d.ts","sourceRoot":"","sources":["../../../src/endpoints/info.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,UAAU,EAAE,MAAM,gBAAgB,CAAA;AAC3C,OAAO,EAAE,UAAU,EAAE,MAAM,qBAAqB,CAAA;AAQhD;;;;;;GAMG;AACH,wBAAsB,SAAS,CAAC,MAAM,EAAE,UAAU,GAAG,OAAO,CAAC,UAAU,CAAC,CAOvE"}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import createDebug from 'debug';
|
|
2
|
+
const log = createDebug('soundretouch:endpoints:info');
|
|
3
|
+
/**
|
|
4
|
+
* Gets device information including identifiers, components, and network info.
|
|
5
|
+
*
|
|
6
|
+
* GET /info
|
|
7
|
+
*
|
|
8
|
+
* @returns Promise<DeviceInfo> A promise that resolves to the device info payload as returned by the device.
|
|
9
|
+
*/
|
|
10
|
+
export async function fetchInfo(client) {
|
|
11
|
+
log('GET /info');
|
|
12
|
+
const data = await client.getXml('/info');
|
|
13
|
+
log('response %O', data.info ?? {});
|
|
14
|
+
return data.info ?? {};
|
|
15
|
+
}
|
|
16
|
+
//# sourceMappingURL=info.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"info.js","sourceRoot":"","sources":["../../../src/endpoints/info.ts"],"names":[],"mappings":"AAAA,OAAO,WAAW,MAAM,OAAO,CAAA;AAK/B,MAAM,GAAG,GAAG,WAAW,CAAC,6BAA6B,CAAC,CAAA;AAMtD;;;;;;GAMG;AACH,MAAM,CAAC,KAAK,UAAU,SAAS,CAAC,MAAkB;IAC9C,GAAG,CAAC,WAAW,CAAC,CAAA;IAEhB,MAAM,IAAI,GAAG,MAAM,MAAM,CAAC,MAAM,CAAe,OAAO,CAAC,CAAA;IACvD,GAAG,CAAC,aAAa,EAAE,IAAI,CAAC,IAAI,IAAI,EAAE,CAAC,CAAA;IAEnC,OAAO,IAAI,CAAC,IAAI,IAAI,EAAE,CAAA;AAC1B,CAAC"}
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import { HttpClient } from '../client/http';
|
|
2
|
+
import { KeyState, KeyValue } from '../types/Enums';
|
|
3
|
+
export type SoundTouchKey = KeyValue;
|
|
4
|
+
export type KeyPressState = KeyState;
|
|
5
|
+
/**
|
|
6
|
+
* Sends a remote button press or release to the device.
|
|
7
|
+
*
|
|
8
|
+
* POST /key
|
|
9
|
+
*
|
|
10
|
+
* Keys are used as a simple means to interact with the SoundTouch speaker.
|
|
11
|
+
* For a full listing of supported keys see "KEY VALUE" in section 4.1 of the API docs.
|
|
12
|
+
* It is good practice to send a "press" followed by a "release" to simulate a full key click.
|
|
13
|
+
*
|
|
14
|
+
* @param key Key value to send.
|
|
15
|
+
* @param state Key state to send: "press" or "release".
|
|
16
|
+
* @param sender Sender label to include in the request.
|
|
17
|
+
* @returns A promise that resolves when the device accepts the key event.
|
|
18
|
+
*
|
|
19
|
+
* @example
|
|
20
|
+
* await sendKeyPress(client, 'PLAY', 'press', 'Gabbo')
|
|
21
|
+
* await sendKeyPress(client, 'PLAY', 'release', 'Gabbo')
|
|
22
|
+
*/
|
|
23
|
+
export declare function sendKeyPress(client: HttpClient, key: SoundTouchKey, state?: KeyPressState, sender?: string): Promise<void>;
|
|
24
|
+
/**
|
|
25
|
+
* Sends a press then release sequence for a key.
|
|
26
|
+
*
|
|
27
|
+
* POST /key
|
|
28
|
+
*
|
|
29
|
+
* @param key Key value to send.
|
|
30
|
+
* @param sender Sender label to include in the request.
|
|
31
|
+
* @returns A promise that resolves when the device accepts both key events.
|
|
32
|
+
*
|
|
33
|
+
* @example
|
|
34
|
+
* await sendKeyPressAndRelease(client, 'PLAY', 'Gabbo')
|
|
35
|
+
*/
|
|
36
|
+
export declare function sendKeyPressAndRelease(client: HttpClient, key: SoundTouchKey, sender?: string): Promise<void>;
|
|
37
|
+
//# sourceMappingURL=key.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"key.d.ts","sourceRoot":"","sources":["../../../src/endpoints/key.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,UAAU,EAAE,MAAM,gBAAgB,CAAA;AAC3C,OAAO,EAAE,QAAQ,EAAE,QAAQ,EAAE,MAAM,gBAAgB,CAAA;AAInD,MAAM,MAAM,aAAa,GAAG,QAAQ,CAAA;AACpC,MAAM,MAAM,aAAa,GAAG,QAAQ,CAAA;AAEpC;;;;;;;;;;;;;;;;;GAiBG;AACH,wBAAsB,YAAY,CAAC,MAAM,EAAE,UAAU,EAAE,GAAG,EAAE,aAAa,EAAE,KAAK,GAAE,aAAuB,EAAE,MAAM,SAAqB,GAAG,OAAO,CAAC,IAAI,CAAC,CAOrJ;AAED;;;;;;;;;;;GAWG;AACH,wBAAsB,sBAAsB,CAAC,MAAM,EAAE,UAAU,EAAE,GAAG,EAAE,aAAa,EAAE,MAAM,SAAqB,GAAG,OAAO,CAAC,IAAI,CAAC,CAM/H"}
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
import createDebug from 'debug';
|
|
2
|
+
const log = createDebug('soundretouch:endpoints:key');
|
|
3
|
+
/**
|
|
4
|
+
* Sends a remote button press or release to the device.
|
|
5
|
+
*
|
|
6
|
+
* POST /key
|
|
7
|
+
*
|
|
8
|
+
* Keys are used as a simple means to interact with the SoundTouch speaker.
|
|
9
|
+
* For a full listing of supported keys see "KEY VALUE" in section 4.1 of the API docs.
|
|
10
|
+
* It is good practice to send a "press" followed by a "release" to simulate a full key click.
|
|
11
|
+
*
|
|
12
|
+
* @param key Key value to send.
|
|
13
|
+
* @param state Key state to send: "press" or "release".
|
|
14
|
+
* @param sender Sender label to include in the request.
|
|
15
|
+
* @returns A promise that resolves when the device accepts the key event.
|
|
16
|
+
*
|
|
17
|
+
* @example
|
|
18
|
+
* await sendKeyPress(client, 'PLAY', 'press', 'Gabbo')
|
|
19
|
+
* await sendKeyPress(client, 'PLAY', 'release', 'Gabbo')
|
|
20
|
+
*/
|
|
21
|
+
export async function sendKeyPress(client, key, state = 'press', sender = 'soundretouch-api') {
|
|
22
|
+
const body = `<key state="${state}" sender="${sender}">${key}</key>`;
|
|
23
|
+
log('POST /key');
|
|
24
|
+
log('payload %s', body);
|
|
25
|
+
await client.post('/key', body);
|
|
26
|
+
}
|
|
27
|
+
/**
|
|
28
|
+
* Sends a press then release sequence for a key.
|
|
29
|
+
*
|
|
30
|
+
* POST /key
|
|
31
|
+
*
|
|
32
|
+
* @param key Key value to send.
|
|
33
|
+
* @param sender Sender label to include in the request.
|
|
34
|
+
* @returns A promise that resolves when the device accepts both key events.
|
|
35
|
+
*
|
|
36
|
+
* @example
|
|
37
|
+
* await sendKeyPressAndRelease(client, 'PLAY', 'Gabbo')
|
|
38
|
+
*/
|
|
39
|
+
export async function sendKeyPressAndRelease(client, key, sender = 'soundretouch-api') {
|
|
40
|
+
log('POST /key (press)');
|
|
41
|
+
await sendKeyPress(client, key, 'press', sender);
|
|
42
|
+
log('POST /key (release)');
|
|
43
|
+
await sendKeyPress(client, key, 'release', sender);
|
|
44
|
+
}
|
|
45
|
+
//# sourceMappingURL=key.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"key.js","sourceRoot":"","sources":["../../../src/endpoints/key.ts"],"names":[],"mappings":"AAAA,OAAO,WAAW,MAAM,OAAO,CAAA;AAK/B,MAAM,GAAG,GAAG,WAAW,CAAC,4BAA4B,CAAC,CAAA;AAKrD;;;;;;;;;;;;;;;;;GAiBG;AACH,MAAM,CAAC,KAAK,UAAU,YAAY,CAAC,MAAkB,EAAE,GAAkB,EAAE,QAAuB,OAAO,EAAE,MAAM,GAAG,kBAAkB;IAClI,MAAM,IAAI,GAAG,eAAe,KAAK,aAAa,MAAM,KAAK,GAAG,QAAQ,CAAA;IAEpE,GAAG,CAAC,WAAW,CAAC,CAAA;IAChB,GAAG,CAAC,YAAY,EAAE,IAAI,CAAC,CAAA;IAEvB,MAAM,MAAM,CAAC,IAAI,CAAC,MAAM,EAAE,IAAI,CAAC,CAAA;AACnC,CAAC;AAED;;;;;;;;;;;GAWG;AACH,MAAM,CAAC,KAAK,UAAU,sBAAsB,CAAC,MAAkB,EAAE,GAAkB,EAAE,MAAM,GAAG,kBAAkB;IAC5G,GAAG,CAAC,mBAAmB,CAAC,CAAA;IACxB,MAAM,YAAY,CAAC,MAAM,EAAE,GAAG,EAAE,OAAO,EAAE,MAAM,CAAC,CAAA;IAEhD,GAAG,CAAC,qBAAqB,CAAC,CAAA;IAC1B,MAAM,YAAY,CAAC,MAAM,EAAE,GAAG,EAAE,SAAS,EAAE,MAAM,CAAC,CAAA;AACtD,CAAC"}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { HttpClient } from '../client/http';
|
|
2
|
+
/**
|
|
3
|
+
* Sets the device name.
|
|
4
|
+
*
|
|
5
|
+
* POST /name
|
|
6
|
+
*
|
|
7
|
+
* @param name The name to assign to the device.
|
|
8
|
+
* @returns A promise that resolves when the device accepts the new name.
|
|
9
|
+
*
|
|
10
|
+
* @example
|
|
11
|
+
* await device.setName('Living Room')
|
|
12
|
+
*/
|
|
13
|
+
export declare function setName(client: HttpClient, name: string): Promise<void>;
|
|
14
|
+
//# sourceMappingURL=name.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"name.d.ts","sourceRoot":"","sources":["../../../src/endpoints/name.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,UAAU,EAAE,MAAM,gBAAgB,CAAA;AAQ3C;;;;;;;;;;GAUG;AACH,wBAAsB,OAAO,CAAC,MAAM,EAAE,UAAU,EAAE,IAAI,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CAO7E"}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import createDebug from 'debug';
|
|
2
|
+
const log = createDebug('soundretouch:endpoints:name');
|
|
3
|
+
function escapeXml(value) {
|
|
4
|
+
return value.replace(/&/g, '&').replace(/</g, '<').replace(/>/g, '>').replace(/"/g, '"').replace(/'/g, ''');
|
|
5
|
+
}
|
|
6
|
+
/**
|
|
7
|
+
* Sets the device name.
|
|
8
|
+
*
|
|
9
|
+
* POST /name
|
|
10
|
+
*
|
|
11
|
+
* @param name The name to assign to the device.
|
|
12
|
+
* @returns A promise that resolves when the device accepts the new name.
|
|
13
|
+
*
|
|
14
|
+
* @example
|
|
15
|
+
* await device.setName('Living Room')
|
|
16
|
+
*/
|
|
17
|
+
export async function setName(client, name) {
|
|
18
|
+
const body = `<name>${escapeXml(name)}</name>`;
|
|
19
|
+
log('POST /name');
|
|
20
|
+
log('payload %s', body);
|
|
21
|
+
await client.post('/name', body);
|
|
22
|
+
}
|
|
23
|
+
//# sourceMappingURL=name.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"name.js","sourceRoot":"","sources":["../../../src/endpoints/name.ts"],"names":[],"mappings":"AAAA,OAAO,WAAW,MAAM,OAAO,CAAA;AAI/B,MAAM,GAAG,GAAG,WAAW,CAAC,6BAA6B,CAAC,CAAA;AAEtD,SAAS,SAAS,CAAC,KAAa;IAC5B,OAAO,KAAK,CAAC,OAAO,CAAC,IAAI,EAAE,OAAO,CAAC,CAAC,OAAO,CAAC,IAAI,EAAE,MAAM,CAAC,CAAC,OAAO,CAAC,IAAI,EAAE,MAAM,CAAC,CAAC,OAAO,CAAC,IAAI,EAAE,QAAQ,CAAC,CAAC,OAAO,CAAC,IAAI,EAAE,QAAQ,CAAC,CAAA;AACnI,CAAC;AAED;;;;;;;;;;GAUG;AACH,MAAM,CAAC,KAAK,UAAU,OAAO,CAAC,MAAkB,EAAE,IAAY;IAC1D,MAAM,IAAI,GAAG,SAAS,SAAS,CAAC,IAAI,CAAC,SAAS,CAAA;IAE9C,GAAG,CAAC,YAAY,CAAC,CAAA;IACjB,GAAG,CAAC,YAAY,EAAE,IAAI,CAAC,CAAA;IAEvB,MAAM,MAAM,CAAC,IAAI,CAAC,OAAO,EAAE,IAAI,CAAC,CAAA;AACpC,CAAC"}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { HttpClient } from '../client/http';
|
|
2
|
+
import { NowPlaying } from '../types/NowPlaying';
|
|
3
|
+
/**
|
|
4
|
+
* Gets info about the currently playing media.
|
|
5
|
+
*
|
|
6
|
+
* GET /now_playing
|
|
7
|
+
*
|
|
8
|
+
* @returns Promise<NowPlaying> A promise that resolves to the now playing payload as returned by the device.
|
|
9
|
+
*/
|
|
10
|
+
export declare function fetchNowPlaying(client: HttpClient): Promise<NowPlaying>;
|
|
11
|
+
//# sourceMappingURL=nowPlaying.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"nowPlaying.d.ts","sourceRoot":"","sources":["../../../src/endpoints/nowPlaying.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,UAAU,EAAE,MAAM,gBAAgB,CAAA;AAC3C,OAAO,EAAE,UAAU,EAAE,MAAM,qBAAqB,CAAA;AAQhD;;;;;;GAMG;AACH,wBAAsB,eAAe,CAAC,MAAM,EAAE,UAAU,GAAG,OAAO,CAAC,UAAU,CAAC,CAO7E"}
|