Can You please tell me if there is anyway to speed up search for a required devices
My script search for device with name arduino and opens it in iframe.
Thanks.
var app = {
initialize: function() {
document.addEventListener('deviceready', this.onDeviceReady.bind(this), false);
},
onDeviceReady: function() {
this.receivedEvent('deviceready');
var serviceType = "upnp:rootdevice";
var success = function(devices) {
for (var key in devices) {
if (devices[key].Server.slice(0, 7) == 'Arduino') {
if (key == '1') {
document.getElementById("loadweb").src = 'http://'+devices[key].LOCATION.split('/')[2].split(':')[0];
}
}
}
}
var failure = function() {
alert("Error calling Service Discovery Plugin");
}
serviceDiscovery.getNetworkServices(serviceType, success, failure);
},
receivedEvent: function(id) {
var parentElement = document.getElementById(id);
var listeningElement = parentElement.querySelector('.listening');
var receivedElement = parentElement.querySelector('.received');
listeningElement.setAttribute('style', 'display:none;');
receivedElement.setAttribute('style', 'display:block;');
console.log('Received Event: ' + id);
}
};
app.initialize();
Can You please tell me if there is anyway to speed up search for a required devices My script search for device with name arduino and opens it in iframe. Thanks.