Points added to schedule when clicking save

This commit is contained in:
Stefan Persson 2011-02-08 16:26:57 +00:00
parent acdbbcc47b
commit a7d4c323d8
5 changed files with 330 additions and 11 deletions

View file

@ -19,8 +19,11 @@ function getEventRunTime(event, date){
date = 0; date = 0;
} }
currentEventRuntimeTimestamp = (event.d.time * 1000) + date; currentEventRuntimeTimestamp = (event.d.time * 1000) + date;
print("currentEventRuntimeTimestamp: " + new Date(currentEventRuntimeTimestamp));
currentEventRuntimeTimestamp += (offset * 1000); //this is really not useful for absolute values, but exists for consistency currentEventRuntimeTimestamp += (offset * 1000); //this is really not useful for absolute values, but exists for consistency
print("currentEventRuntimeTimestamp1: " + new Date(currentEventRuntimeTimestamp));
currentEventRuntimeTimestamp = com.telldus.scheduler.fuzzify(currentEventRuntimeTimestamp, parseInt(event.d.fuzzinessBefore), parseInt(event.d.fuzzinessAfter)); currentEventRuntimeTimestamp = com.telldus.scheduler.fuzzify(currentEventRuntimeTimestamp, parseInt(event.d.fuzzinessBefore), parseInt(event.d.fuzzinessAfter));
print("currentEventRuntimeTimestamp2: " + new Date(currentEventRuntimeTimestamp));
} }
else if(event.d.type == com.telldus.scheduler.EVENTTYPE_SUNRISE || event.d.type == com.telldus.scheduler.EVENTTYPE_SUNSET){ else if(event.d.type == com.telldus.scheduler.EVENTTYPE_SUNRISE || event.d.type == com.telldus.scheduler.EVENTTYPE_SUNSET){
currentEventRuntimeTimestamp = getSunUpDownForDate(date, parseInt(event.d.type)); currentEventRuntimeTimestamp = getSunUpDownForDate(date, parseInt(event.d.type));
@ -88,6 +91,7 @@ function getNextEventRunTime(nextRunTime, event, date, pastGracePeriod){
} }
var currentEventRuntimeTimestamp = getEventRunTime(event, date); var currentEventRuntimeTimestamp = getEventRunTime(event, date);
print("EventRunTime: " + new Date(currentEventRuntimeTimestamp));
if((nextRunTime === null || currentEventRuntimeTimestamp < nextRunTime) && currentEventRuntimeTimestamp > (new Date().getTime() - pastGracePeriod)){ //earlier than other events, but later than "now" if((nextRunTime === null || currentEventRuntimeTimestamp < nextRunTime) && currentEventRuntimeTimestamp > (new Date().getTime() - pastGracePeriod)){ //earlier than other events, but later than "now"
nextRunTime = currentEventRuntimeTimestamp; nextRunTime = currentEventRuntimeTimestamp;
} }
@ -259,6 +263,7 @@ com.telldus.scheduler.JobRecurringDay = function(jobdata){ com.telldus.scheduler
* type is com.telldus.scheduler.JOBTYPE_RECURRING_WEEK * type is com.telldus.scheduler.JOBTYPE_RECURRING_WEEK
* Extra/different event properties: * Extra/different event properties:
* value - day of week * value - day of week
* time - seconds into the day
*/ */
com.telldus.scheduler.JobRecurringWeek = function(jobdata){ com.telldus.scheduler.Job.call(this, jobdata); } com.telldus.scheduler.JobRecurringWeek = function(jobdata){ com.telldus.scheduler.Job.call(this, jobdata); }
@ -337,7 +342,6 @@ com.telldus.scheduler.JobRecurringWeek.prototype.getNextRunTime = function(){
} }
var pastGracePeriod = getGracePeriod(this.v); var pastGracePeriod = getGracePeriod(this.v);
for(var key in this.v.events){ for(var key in this.v.events){
//get next correct day of week, may be today too //get next correct day of week, may be today too
var weekday = parseInt(this.v.events[key].d.value); var weekday = parseInt(this.v.events[key].d.value);
@ -345,6 +349,7 @@ com.telldus.scheduler.JobRecurringWeek.prototype.getNextRunTime = function(){
print("Incorrect weekday value"); print("Incorrect weekday value");
continue; continue;
} }
print("Weekday... " + weekday);
var returnDate = new Date(); var returnDate = new Date();
var minStartTime = new Date(this.v.startdate); var minStartTime = new Date(this.v.startdate);
if(minStartTime > returnDate){ if(minStartTime > returnDate){
@ -367,7 +372,6 @@ com.telldus.scheduler.JobRecurringWeek.prototype.getNextRunTime = function(){
nextRunTime = nextTempRunTime; nextRunTime = nextTempRunTime;
} }
} }
return nextRunTime; return nextRunTime;
} }

View file

@ -23,7 +23,7 @@ com.telldus.scheduler = function() {
function init(){ function init(){
JobDaylightSavingReload.prototype = new com.telldus.scheduler.Job(); JobDaylightSavingReload.prototype = new com.telldus.scheduler.Job();
setDaylightSavingJobFunctions(); setDaylightSavingJobFunctions();
loadJobs(); //TODO remove this after testing is done //loadJobs(); //TODO remove this after testing is done
} }
@ -40,6 +40,28 @@ com.telldus.scheduler = function() {
return key; return key;
} }
//add several jobs at once, withou recalculating timer between each
function addJobs(jobs){
if(storedJobs.length == 0){
print("Adding daylight saving time");
var daylightSavingReloadKey = storedJobs.push(getDaylightSavingReloadJob());
updateJobInList(daylightSavingReloadKey, true); //waitForMore = don't sort array and recalculate timer yet
}
var returnKeys = new Array();
for(var i=0;i<jobs.length;i++){
var job = jobs[i];
var key = storedJobs.push(job);
job.key = key;
print("Adding job");
updateJobInList(key, true); //waitForMore = don't sort array and recalculate timer yet
returnKeys.push(key);
}
joblist.sort(compareTime);
runNextJob();
return returnKeys;
}
function fuzzify(currentTimestamp, fuzzinessBefore, fuzzinessAfter){ function fuzzify(currentTimestamp, fuzzinessBefore, fuzzinessAfter){
if(fuzzinessAfter != 0 || fuzzinessBefore != 0){ if(fuzzinessAfter != 0 || fuzzinessBefore != 0){
var interval = fuzzinessAfter + fuzzinessBefore; var interval = fuzzinessAfter + fuzzinessBefore;
@ -145,7 +167,7 @@ com.telldus.scheduler = function() {
print("Has started a job wait"); print("Has started a job wait");
} }
function updateJobInList(id){ function updateJobInList(id, waitForMore){
if(!joblist){ if(!joblist){
joblist = new Array(); joblist = new Array();
} }
@ -167,9 +189,10 @@ com.telldus.scheduler = function() {
} }
joblist.push(new RunJob(id, nextRunTime)); joblist.push(new RunJob(id, nextRunTime));
if(waitForMore == undefined){
joblist.sort(compareTime); joblist.sort(compareTime);
runNextJob(); runNextJob();
}
} }
function updateJob(key, job){ function updateJob(key, job){
@ -257,6 +280,7 @@ com.telldus.scheduler = function() {
return { //Public functions return { //Public functions
addJob: addJob, //job, returns: storage id addJob: addJob, //job, returns: storage id
addJobs: addJobs, //jobs (array), returns: storage id's in array
fuzzify: fuzzify, //timestamp, max fuzziness before, max fuzziness after, returns: new random timestamp within min/max fuzziness-boundries fuzzify: fuzzify, //timestamp, max fuzziness before, max fuzziness after, returns: new random timestamp within min/max fuzziness-boundries
removeJob: removeJob, //storage id removeJob: removeJob, //storage id
updateJob: updateJob, //storage id, job updateJob: updateJob, //storage id, job

View file

@ -12,9 +12,13 @@ com.telldus.schedulersimplegui = function() {
function init() { function init() {
view = new com.telldus.qml.view({ view = new com.telldus.qml.view({
addDevice: addDevice, addDevice: addDevice,
addJobsToSchedule: addJobsToSchedule,
getJob: getJob,
getMethodFromState: getMethodFromState,
getSunRiseTime: getSunRiseTime, getSunRiseTime: getSunRiseTime,
getSunSetTime: getSunSetTime, getSunSetTime: getSunSetTime,
getSunData: getSunData getSunData: getSunData,
getTypeFromTriggerstate: getTypeFromTriggerstate
}); });
//devices: //devices:
@ -23,6 +27,7 @@ com.telldus.schedulersimplegui = function() {
for(var i=0; i < list.length; ++i) { for(var i=0; i < list.length; ++i) {
var item = list[i]; var item = list[i];
item.isEnabled = "enabled"; item.isEnabled = "enabled";
item.hasChanged = "false";
deviceList.push(item); deviceList.push(item);
} }
view.setProperty('deviceModel', deviceList); view.setProperty('deviceModel', deviceList);
@ -59,7 +64,27 @@ com.telldus.schedulersimplegui = function() {
event.d = {id: 0, value: 3, fuzzinessBefore: 0, fuzzinessAfter: 0, type: com.telldus.scheduler.EVENTTYPE_ABSOLUTE, offset: 0, time: 300}; //(new Date().getTime())/1000 + 20 event.d = {id: 0, value: 3, fuzzinessBefore: 0, fuzzinessAfter: 0, type: com.telldus.scheduler.EVENTTYPE_ABSOLUTE, offset: 0, time: 300}; //(new Date().getTime())/1000 + 20
job.addEvent(event); job.addEvent(event);
//job.addEvent(new Event({id: 0, value: "", fuzzinessBefore: 0, fuzzinessAfter: 0, type: com.telldus.scheduler.EVENTTYPE_ABSOLUTE, offset: 10, time: (new Date().getTime())/1000 + 20})); //job.addEvent(new Event({id: 0, value: "", fuzzinessBefore: 0, fuzzinessAfter: 0, type: com.telldus.scheduler.EVENTTYPE_ABSOLUTE, offset: 10, time: (new Date().getTime())/1000 + 20}));
com.telldus.scheduler.addJob(job);
var jobs = new Array();
jobs.push(job);
job = new com.telldus.scheduler.JobRecurringWeek({id: 4, executeFunc: execFunc, name: "testnamn15", type: com.telldus.scheduler.JOBTYPE_RECURRING_WEEK, startdate: startdate, lastRun: 0, device: 1, method: 1, value: ""});
var event = {};
event.d = {id: 0, value: 3, fuzzinessBefore: 0, fuzzinessAfter: 0, type: com.telldus.scheduler.EVENTTYPE_ABSOLUTE, offset: 0, time: 100}; //(new Date().getTime())/1000 + 20
job.addEvent(event);
jobs.push(job);
//hm, timerkeys... kommer ju få tillbaka alla på en ggn, eller iaf per device... (om ett addjob/device)
//tänkte ändå alltid uppdatera alla (dvs ta bort/lägga till) för varje device, om den alls har ändrats...
//man kunde klart koppla en key till en point, men isf måste man på ngt sätt lagra när den tas bort...
//och jämför när man lägger till nya (iofs bara kolla om ngn key finns på pointen, annars är den ny)
//ett jobb/punkt (med flera events, per dag)
//lägga till alla jobb/device (för alla dagar) på en ggn (om device hasChanged), ta bort alla tidigare...
//alla timers kommer ju att ha försvunnit vid avstängning, så det behöver man inte bry sig om...
// var timerkeys = com.telldus.scheduler.addJobs(jobs);
// for(var i=0;i<timerkeys.length;i++){
// print("ENA: " + timerkeys[i]);
// }
//newRecurringMonthJob.save(); //newRecurringMonthJob.save();
/* /*
var newAbsoluteJob = getJob({id: 5, name: "testnamn15", type: com.telldus.scheduler.JOBTYPE_RECURRING_MONTH, startdate: startdate2, lastRun: 0, device: 1, method: 1, value: "", pastGracePeriod: 90}); var newAbsoluteJob = getJob({id: 5, name: "testnamn15", type: com.telldus.scheduler.JOBTYPE_RECURRING_MONTH, startdate: startdate2, lastRun: 0, device: 1, method: 1, value: "", pastGracePeriod: 90});
@ -105,6 +130,55 @@ com.telldus.schedulersimplegui = function() {
} }
} }
function addJobsToSchedule(points){
//print("Uppe: " + points["TEST"]);
var jobs = new Array();
for(var i=0;i<points.length;i++){
print("EN POINT " + points[i]);
jobs.push(getJob(points[i]));
}
return com.telldus.scheduler.addJobs(jobs);
}
function getJob(pointArray){ //deviceId, pointName, startdate, lastrun, pointMethod, pointDimValue, pointTime, pointType, pointFuzzinessBefore, pointFuzzinessAfter, pointOffset, pointDays
var execFunc = function(job){ print("Custom execute function running"); print("Job: " + job.v.name); return 42; }; //TODO default later
//TODO dimValue ok? Or other number expected?
var job = new com.telldus.scheduler.JobRecurringWeek({id: pointArray[0], executeFunc: execFunc, name: pointArray[1], type: com.telldus.scheduler.JOBTYPE_RECURRING_WEEK, startdate: pointArray[2], lastRun: pointArray[3], device: pointArray[0], method: pointArray[4], value: pointArray[5]});
var event = {};
var pointFuzzinessBefore = (pointArray[8]*60);
var pointFuzzinessAfter = (pointArray[9]*60);
var pointOffset = (pointArray[10]*60);
event.d = {id: pointArray[0], value: pointArray[11][0], fuzzinessBefore: pointFuzzinessBefore, fuzzinessAfter: pointFuzzinessAfter, type: pointArray[7], offset: pointOffset, time: pointArray[6]};
job.addEvent(event);
for(var i=1;i<pointArray[11].length;i++){
event = {};
pointDay = pointArray[11][i];
event.d = {id: pointArray[0], value: pointDay, fuzzinessBefore: pointFuzzinessBefore, fuzzinessAfter: pointFuzzinessAfter, type: pointArray[7], offset: pointOffset, time: pointArray[6]};
job.addEvent(event);
}
return job;
}
function getMethodFromState(state){
var pointMethod = "";
if(state == "on"){
pointMethod = com.telldus.core.TELLSTICK_TURNON;
}
else if(state == "off"){
pointMethod = com.telldus.core.TELLSTICK_TURNOFF;
}
else if(state == "dim"){
pointMethod = com.telldus.core.TELLSTICK_DIM;
}
else if(state == "bell"){
pointMethod = com.telldus.core.TELLSTICK_BELL;
}
return pointMethod;
}
function getSun(riseset, rowWidth, pointWidth){ function getSun(riseset, rowWidth, pointWidth){
var date = new Date(); var date = new Date();
var timevalues = com.telldus.suncalculator.riseset(date); var timevalues = com.telldus.suncalculator.riseset(date);
@ -133,6 +207,70 @@ com.telldus.schedulersimplegui = function() {
function getSunSetTime(rowWidth, pointWidth){ function getSunSetTime(rowWidth, pointWidth){
return getSun("set", rowWidth, pointWidth); return getSun("set", rowWidth, pointWidth);
} }
function getTypeFromTriggerstate(triggerstate){
var type = "";
if(triggerstate == "sunrise"){
type = com.telldus.scheduler.EVENTTYPE_SUNRISE;
}
else if(triggerstate == "sunset"){
type = com.telldus.scheduler.EVENTTYPE_SUNSET;
}
else{
type = com.telldus.scheduler.EVENTTYPE_ABSOLUTE;
}
return type;
}
/*
function pointToJob(point){
print("ngt");
print("4: " + point.absoluteHour);
var execFunc = function(job){ print("Custom execute function running"); print("Job: " + job.v.name); return 42; }; //TODO default later
print("1");
print("5: " + point);
var deviceId = point.deviceRow.deviceId; //not really in use yet
print("2 " + deviceId);
var pointName = "Job_" + deviceId;
var lastrun = 0; //TODO
var startdate = new Date(); //startdate, not in use, always "now"
var pointDimValue = point.dimvalue;
var pointMethod = getMethodFromState.callWith(point.state);
var job = getJob.callWith(deviceId, execFunc, pointName, startdate, lastrun, deviceId, pointMethod, pointDimValue);
print("Jobtest: " + job);
var pointTime = point.absoluteHour * 3600 + point.absoluteMinute * 60;
var pointType = getTypeFromTriggerstate.callWith(point.triggerstate);
if(point.triggerstate == "sunrise"){
var suntime = main.sunData[0].split(':');
pointTime = suntime[0] * 3600 + suntime[1] * 60;
}
else if(point.triggerstate == "sunset"){
var suntime = main.sunData[1].split(':');
pointTime = suntime[0] * 3600 + suntime[1] * 60;
}
var pointFuzzinessBefore = point.fuzzyBefore;
var pointFuzzinessAfter = point.fuzzyAfter;
var pointOffset = point.offset;
var pointDay = point.deviceRow.parent.parent.daydate.getDay(); //different per event
var event = {};
event.d = {id: deviceId, value: pointDay, fuzzinessBefore: pointFuzzinessBefore, fuzzinessAfter: pointFuzzinessAfter, type: pointType, offset: pointOffset, time: pointTime};
print("Job: " + job.v.name);
job.addEvent(event);
for(var childPoint in point.childPoints){
event = {};
pointDay = point.childPoints[childPoint].deviceRow.parent.parent.daydate.getDay(); //different per event
event.d = {id: deviceId, value: pointDay, fuzzinessBefore: pointFuzzinessBefore, fuzzinessAfter: pointFuzzinessAfter, type: pointType, offset: pointOffset, time: pointTime};
job.addEvent(event);
}
return job;
}
*/
return { //Public functions return { //Public functions
init:init init:init

View file

@ -409,8 +409,20 @@ import "schedulerscripts.js" as Scripts
} }
} }
} }
} }
Button{
id: save
text: "Save changes"
anchors.horizontalCenter: parent.horizontalCenter
anchors.horizontalCenterOffset: -30
anchors.top: mainContent.bottom
anchors.topMargin: 30
onClicked: {
saveAll();
}
}
/* Not in use, adding all devices always instead /* Not in use, adding all devices always instead
Component{ Component{
id: addButtonComponent id: addButtonComponent
@ -516,4 +528,145 @@ import "schedulerscripts.js" as Scripts
var hourSize = constDeviceRowWidth/24; //(main.width - 100)/24; //TODO constant or something? var hourSize = constDeviceRowWidth/24; //(main.width - 100)/24; //TODO constant or something?
return hourSize * suntime[0] + hourSize * suntime[1]/60; return hourSize * suntime[0] + hourSize * suntime[1]/60;
} }
function saveAll(){
print("Save all and reset jobs");
//var jobs = new Array();
var points = new Array();
var days = Scripts.getDays();
for(var i=0;i<deviceModel.length;i++){
//punkt 1 och 2 (och 3)
var deviceId = deviceModel.get(i).id;
for(var j=0;j<days.length;j++){
var row = Scripts.getDeviceRow(days[j].daydate.getDay(), deviceId);
for(var k=0;k<row.children.length;k++){
var point = row.children[k];
if(point.isPoint && point.parentPoint == undefined){ //and not disabled
print("and step 4");
points.push(pointToArray(point));
//jobs.push(pointToJob(point));
}
}
}
}
print("after loops");
//if(jobs.length > 0){
//var timerkeys = addJobsToSchedule.callWith(jobs);
//}
if(points.length > 0){
/*
print("Nerifrån: " + points[0].absoluteHour);
var koll = {"TEST": 55};
print("Koll: " + koll["TEST"]);
var underarray = new Array();
underarray.push("hejsan");
underarray.push("hoppsan");
koll = new Array();
koll.push(underarray);
koll.push(8);
*/
addJobsToSchedule.callWith(points); //{"TEST": 55}); //points);
}
//1. for each device (som har hasChanged set):
//2. ta bort alla timers med keys till denna device
//3. om disabled = gör inte mer... annars:
//4. alla punkter på alla dagar här, gå igenom:
//5. om punkt, om inte har parentPoint, och inte disabled (senare):
//6. gör om punkt till jobb (pointToJob), lägg till array, med events för alla childPoints (och sig själv)
//7. skicka in denna array till schedulern (addJobs)
//8. få tillbaka ny array med timerkeys, spara denna på devicen
}
function pointToArray(point){ //TODO another way than using arrays...
var deviceId = point.deviceRow.deviceId; //not really in use yet
var pointName = "Job_" + deviceId;
var lastrun = 0; //TODO
var startdate = new Date(); //startdate, not in use, always "now"
var pointDimValue = point.dimvalue;
var pointMethod = getMethodFromState.callWith(point.state);
var pointTime = point.absoluteHour * 3600 + point.absoluteMinute * 60;
var pointType = getTypeFromTriggerstate.callWith(point.triggerstate);
if(point.triggerstate == "sunrise"){
var suntime = main.sunData[0].split(':');
pointTime = suntime[0] * 3600 + suntime[1] * 60;
}
else if(point.triggerstate == "sunset"){
var suntime = main.sunData[1].split(':');
pointTime = suntime[0] * 3600 + suntime[1] * 60;
}
var pointFuzzinessBefore = point.fuzzyBefore;
var pointFuzzinessAfter = point.fuzzyAfter;
var pointOffset = point.triggerstate == "absolute" ? 0 : point.offset;
var pointDays = new Array();
pointDays.push(point.deviceRow.parent.parent.daydate.getDay());
for(var childPoint in point.childPoints){
pointDays.push(point.childPoints[childPoint].deviceRow.parent.parent.daydate.getDay()); //different per event
}
return new Array(deviceId, pointName, startdate, lastrun, pointMethod, pointDimValue, pointTime, pointType, pointFuzzinessBefore, pointFuzzinessAfter, pointOffset, pointDays);
}
/*
function pointToJob(point){
var execFunc = function(job){ print("Custom execute function running"); print("Job: " + job.v.name); return 42; }; //TODO default later
var deviceId = point.deviceRow.deviceId; //not really in use yet
var pointName = "Job_" + deviceId;
var lastrun = 0; //TODO
var startdate = new Date(); //startdate, not in use, always "now"
var pointDimValue = point.dimvalue;
var pointMethod = getMethodFromState.callWith(point.state);
var job = getJob.callWith(deviceId, execFunc, pointName, startdate, lastrun, deviceId, pointMethod, pointDimValue); //ERROR here, cannot return this
print("Jobtest: " + job);
var pointTime = point.absoluteHour * 3600 + point.absoluteMinute * 60;
var pointType = getTypeFromTriggerstate.callWith(point.triggerstate);
if(point.triggerstate == "sunrise"){
var suntime = main.sunData[0].split(':');
pointTime = suntime[0] * 3600 + suntime[1] * 60;
}
else if(point.triggerstate == "sunset"){
var suntime = main.sunData[1].split(':');
pointTime = suntime[0] * 3600 + suntime[1] * 60;
}
var pointFuzzinessBefore = point.fuzzyBefore;
var pointFuzzinessAfter = point.fuzzyAfter;
var pointOffset = point.offset;
var pointDay = point.deviceRow.parent.parent.daydate.getDay(); //different per event
var event = {};
event.d = {id: deviceId, value: pointDay, fuzzinessBefore: pointFuzzinessBefore, fuzzinessAfter: pointFuzzinessAfter, type: pointType, offset: pointOffset, time: pointTime};
print("Job: " + job.v.name);
job.addEvent(event);
for(var childPoint in point.childPoints){
event = {};
pointDay = point.childPoints[childPoint].deviceRow.parent.parent.daydate.getDay(); //different per event
event.d = {id: deviceId, value: pointDay, fuzzinessBefore: pointFuzzinessBefore, fuzzinessAfter: pointFuzzinessAfter, type: pointType, offset: pointOffset, time: pointTime};
job.addEvent(event);
}
//job.addEvent(new Event({id: 0, value: "", fuzzinessBefore: 0, fuzzinessAfter: 0, type: com.telldus.scheduler.EVENTTYPE_ABSOLUTE, offset: 10, time: (new Date().getTime())/1000 + 20}));
return job;
/*
var jobs = new Array();
jobs.push(job);
//hm, timerkeys... kommer ju få tillbaka alla på en ggn, eller iaf per device... (om ett addjob/device)
//tänkte ändå alltid uppdatera alla (dvs ta bort/lägga till) för varje device, om den alls har ändrats...
//man kunde klart koppla en key till en point, men isf måste man på ngt sätt lagra när den tas bort...
//och jämför när man lägger till nya (iofs bara kolla om ngn key finns på pointen, annars är den ny)
//ett jobb/punkt (med flera events, per dag)
//lägga till alla jobb/device (för alla dagar) på en ggn (om device hasChanged), ta bort alla tidigare...
//alla timers kommer ju att ha försvunnit vid avstängning, så det behöver man inte bry sig om...
var timerkeys = com.telldus.scheduler.addJobs(jobs);
*/
//}
} }

View file

@ -303,7 +303,7 @@ function getDeviceRow(dayOfWeek, deviceId){
if(dayListViewComp.children.length == undefined){ if(dayListViewComp.children.length == undefined){
return null; return null;
} }
print("DeviceIndex: " + currentDeviceIndex + " och " + deviceId + ", och sedan " + days.length); //print("DeviceIndex: " + currentDeviceIndex + " och " + deviceId + ", och sedan " + days.length);
var pointParent = dayListViewComp.children[0].children[currentDeviceIndex]; var pointParent = dayListViewComp.children[0].children[currentDeviceIndex];
return pointParent; return pointParent;
} }