- discovery and description (configuration: discovery timeout, subnet (indirectly defines network interface), upnp MX/ST (like upnp:all ) parameters, auto-get-device-description) --> output: JS-Object per Device, containing SSDP result + Baseurl + uuid etc.- discovery will start on input, settings can be overriden by msg-properties
The main Idea is to limit necessary UPnp knowledge and SOAP stuff handling
I still agree on separate flows but since I already have discovery working I just need to package it
var upnp = require('node-upnp-utils');
console.log ("[");
// Set an event listener for 'added' event
upnp.on('added', (device) => {
// This callback function will be called whenever an device is found.
var address = device['address'];
var name = device['description']['device']['friendlyName'];
var modelName = device['description']['device']['modelName'];
var manufacturer = device['description']['device']['manufacturer'];
var modelDescription = device['description']['device']['modelDescription'];
var location = device['headers']['LOCATION'];
var USN = device['headers']['USN'];
name = "\"name\":\"" + name + "\","
manufacturer = "\"manufacturer\":\"" + manufacturer + "\","
modelName = "\"modelName\":\"" + modelName + "\","
modelDescription = "\"modelDescription\":\"" + modelDescription + "\","
location = "\"location \":\"" + location + "\","
USN = "\"USN \":\"" + USN + "\","
address = "\"address\":\"" + address + "\""
var data = "{" +name + manufacturer + modelName + modelDescription + location + USN + address + "},"
console.log (data);
});
// Start the discovery process
upnp.startDiscovery();
// Stop the discovery process in 15 seconds
setTimeout(() => {
upnp.stopDiscovery(() => {
console.log ("{}]");
process.exit();
});
}, 15000);