Listen for deviceChange and add new devices if new ones are created

This commit is contained in:
Micke Prag 2011-02-08 12:46:19 +00:00
parent f80f37dd18
commit acdbbcc47b

View file

@ -26,6 +26,8 @@ com.telldus.schedulersimplegui = function() {
deviceList.push(item);
}
view.setProperty('deviceModel', deviceList);
//Listen for device-change
com.telldus.core.deviceChange.connect(deviceChange);
//points:
//from storage...
@ -95,6 +97,14 @@ com.telldus.schedulersimplegui = function() {
deviceList.push({name:'Stallet istallet'});
}
function deviceChange( deviceId, eventType ) {
if (eventType == com.telldus.core.TELLSTICK_DEVICE_ADDED) {
var item = com.telldus.core.deviceList.getDevice(deviceId);
item.isEnabled = "enabled";
deviceList.push(item);
}
}
function getSun(riseset, rowWidth, pointWidth){
var date = new Date();
var timevalues = com.telldus.suncalculator.riseset(date);