yxc_api_cmd.js
//new function returning an array of all found devices

new function returning an array of all found devices
new function returning an array of all found devices
async discover(timeout) {
		try {
			const foundDevices = await this.discoverSSDP(timeout);
			let musicdevices = [];
			try {
				await Promise.all(
					foundDevices.map(async (device) => {
						const deviceinfo = await this.getXML(device.location);
						musicdevices.push({
							ip: device.address,
							model: deviceinfo[0],
							name: deviceinfo[1],
							systemId: deviceinfo[2],
							deviceId: deviceinfo[3]
						});
					})
				);
				return Promise.resolve(musicdevices);
			} catch (error) {
				return Promise.reject(error);
			}
		} catch (error) {
			return Promise.reject(error);
		}
	}
async discover ( timeout ) { try { const foundDevices = await this . discoverSSDP ( timeout ) ; let musicdevices = [ ] ; try { await Promise . all ( foundDevices . map ( async ( device ) => { const deviceinfo = await this . getXML ( device . location ) ; musicdevices . push ( { ip : device . address , model : deviceinfo [ 0 ] , name : deviceinfo [ 1 ] , systemId : deviceinfo [ 2 ] , deviceId : deviceinfo [ 3 ] } ) ; } ) ) ; return Promise . resolve ( musicdevices ) ; } catch ( error ) { return Promise . reject ( error ) ; } } catch ( error ) { return Promise . reject ( error ) ; } }
new function returning an array of all found devices
new function returning an array of all found devices