Miscellaneous.logEvent("i",String.format(context.getResources().getString(R.string.ruleCheckOf),this.getName()),"Rule doesn't apply. We're entering POI: "+oneTrigger.getPointOfInterest().getName()+", not leaving it.",4);
returnfalse;
}
}
else
{
Miscellaneous.logEvent("i",String.format(context.getResources().getString(R.string.ruleCheckOf),this.getName()),"Rule doesn't apply. This is "+activePoi.getName()+", not "+oneTrigger.getPointOfInterest().getName()+".",4);
returnfalse;
}
}
elseif(oneTrigger.getPointOfInterest()==null)
{
if(oneTrigger.getTriggerParameter())
{
Miscellaneous.logEvent("i",String.format(context.getResources().getString(R.string.ruleCheckOf),this.getName()),"Rule doesn't apply. We're at a POI. Rule specifies not at none, so leaving any.",4);
returnfalse;
}
}
}
else//leaving one
{
// We are not at any POI. But if this trigger requires us NOT to be there, that may be fine.
Miscellaneous.logEvent("i",String.format(context.getResources().getString(R.string.ruleCheckOf),this.getName()),"We are not at POI \""+oneTrigger.getPointOfInterest().getName()+"\". But since that's required by this rule that's fine.",4);
}
else
{
Miscellaneous.logEvent("i",String.format(context.getResources().getString(R.string.ruleCheckOf),this.getName()),"Rule doesn't apply. We're not at POI \""+oneTrigger.getPointOfInterest().getName()+"\".",3);
returnfalse;
}
// }
}
elseif(oneTrigger.getPointOfInterest()==null)
{
if(!oneTrigger.getTriggerParameter())
{
Miscellaneous.logEvent("i",String.format(context.getResources().getString(R.string.ruleCheckOf),this.getName()),"Rule doesn't apply. We're at no POI. Rule specifies to be at anyone.",5);
Miscellaneous.logEvent("i","TimeFrame","We're currently ("+calNow.getTime().toString()+") in the specified TimeFrame ("+oneTrigger.getTimeFrame().toString()+"). Trigger of Rule "+this.getName()+" applies.",3);
if(oneTrigger.getTriggerParameter())
{
Miscellaneous.logEvent("i","TimeFrame","That's what's specified. Trigger of Rule "+this.getName()+" applies.",3);
//return true;
}
else
{
Miscellaneous.logEvent("i","TimeFrame","That's not what's specified. Trigger of Rule "+this.getName()+" doesn't apply.",3);
returnfalse;
}
}
else
{
Miscellaneous.logEvent("i","TimeFrame","We're currently ("+calNow.getTime().toString()+", Day: "+String.valueOf(calNow.get(Calendar.DAY_OF_WEEK))+") not in the specified TimeFrame ("+oneTrigger.getTimeFrame().toString()+") because of the time. Trigger of Rule "+this.getName()+" doesn\'t apply..",5);
if(!oneTrigger.getTriggerParameter())
{
Miscellaneous.logEvent("i","TimeFrame","That's what's specified. Trigger of Rule "+this.getName()+" applies.",5);
//return true;
}
else
{
Miscellaneous.logEvent("i","TimeFrame","That's not what's specified. Trigger of Rule "+this.getName()+" doesn't apply.",5);
returnfalse;
}
// return false;
}
}
else
{
Miscellaneous.logEvent("i","TimeFrame","We're currently ("+calNow.getTime().toString()+", Day: "+String.valueOf(calNow.get(Calendar.DAY_OF_WEEK))+") not in the specified TimeFrame ("+oneTrigger.getTimeFrame().toString()+") because of the day. Trigger of Rule "+this.getName()+" doesn\'t apply.",5);
if(oneTrigger.getTriggerParameter2().length()>0)// only check if any wifi name specified, otherwise any wifi will do
{
Miscellaneous.logEvent("i",String.format(context.getResources().getString(R.string.ruleCheckOf),this.getName()),"Wifi name specified, checking that.",4);
Miscellaneous.logEvent("i",String.format(context.getResources().getString(R.string.ruleCheckOf),this.getName()),"Wifi name matches. Rule will apply.",4);
}
else
Miscellaneous.logEvent("i",String.format(context.getResources().getString(R.string.ruleCheckOf),this.getName()),"No wifi name specified, any will do.",4);
}
else
{
Miscellaneous.logEvent("i",String.format(context.getResources().getString(R.string.ruleCheckOf),this.getName()),"Wifi state not correct, demanded "+String.valueOf(oneTrigger.getTriggerParameter()+", got "+String.valueOf(WifiBroadcastReceiver.lastConnectedState)),4);
Miscellaneous.logEvent("i",String.format(context.getResources().getString(R.string.ruleCheckOf),this.getName()),"Rule doesn't apply. We're entering POI: "+oneTrigger.getPointOfInterest().getName()+", not leaving it.",4);
returnfalse;
}
}
else
{
Miscellaneous.logEvent("i",String.format(context.getResources().getString(R.string.ruleCheckOf),this.getName()),"Rule doesn't apply. This is "+activePoi.getName()+", not "+oneTrigger.getPointOfInterest().getName()+".",4);
returnfalse;
}
}
elseif(oneTrigger.getPointOfInterest()==null)
{
if(oneTrigger.getTriggerParameter())
{
Miscellaneous.logEvent("i",String.format(context.getResources().getString(R.string.ruleCheckOf),this.getName()),"Rule doesn't apply. We're at a POI. Rule specifies not at none, so leaving any.",4);
returnfalse;
}
}
}
else//leaving one
{
// We are not at any POI. But if this trigger requires us NOT to be there, that may be fine.
Miscellaneous.logEvent("i",String.format(context.getResources().getString(R.string.ruleCheckOf),this.getName()),"We are not at POI \""+oneTrigger.getPointOfInterest().getName()+"\". But since that's required by this rule that's fine.",4);
}
else
{
Miscellaneous.logEvent("i",String.format(context.getResources().getString(R.string.ruleCheckOf),this.getName()),"Rule doesn't apply. We're not at POI \""+oneTrigger.getPointOfInterest().getName()+"\".",3);
returnfalse;
}
// }
}
elseif(oneTrigger.getPointOfInterest()==null)
{
if(!oneTrigger.getTriggerParameter())
{
Miscellaneous.logEvent("i",String.format(context.getResources().getString(R.string.ruleCheckOf),this.getName()),"Rule doesn't apply. We're at no POI. Rule specifies to be at anyone.",5);
Miscellaneous.logEvent("i","TimeFrame","We're currently ("+calNow.getTime().toString()+") in the specified TimeFrame ("+oneTrigger.getTimeFrame().toString()+"). Trigger of Rule "+this.getName()+" applies.",3);
if(oneTrigger.getTriggerParameter())
{
Miscellaneous.logEvent("i","TimeFrame","That's what's specified. Trigger of Rule "+this.getName()+" applies.",3);
//return true;
}
else
{
Miscellaneous.logEvent("i","TimeFrame","That's not what's specified. Trigger of Rule "+this.getName()+" doesn't apply.",3);
returnfalse;
}
}
else
{
Miscellaneous.logEvent("i","TimeFrame","We're currently ("+calNow.getTime().toString()+", Day: "+String.valueOf(calNow.get(Calendar.DAY_OF_WEEK))+") not in the specified TimeFrame ("+oneTrigger.getTimeFrame().toString()+") because of the time. Trigger of Rule "+this.getName()+" doesn\'t apply..",5);
if(!oneTrigger.getTriggerParameter())
{
Miscellaneous.logEvent("i","TimeFrame","That's what's specified. Trigger of Rule "+this.getName()+" applies.",5);
//return true;
}
else
{
Miscellaneous.logEvent("i","TimeFrame","That's not what's specified. Trigger of Rule "+this.getName()+" doesn't apply.",5);
returnfalse;
}
// return false;
}
}
else
{
Miscellaneous.logEvent("i","TimeFrame","We're currently ("+calNow.getTime().toString()+", Day: "+String.valueOf(calNow.get(Calendar.DAY_OF_WEEK))+") not in the specified TimeFrame ("+oneTrigger.getTimeFrame().toString()+") because of the day. Trigger of Rule "+this.getName()+" doesn\'t apply.",5);
if(oneTrigger.getTriggerParameter2().length()>0)// only check if any wifi name specified, otherwise any wifi will do
{
Miscellaneous.logEvent("i",String.format(context.getResources().getString(R.string.ruleCheckOf),this.getName()),"Wifi name specified, checking that.",4);
Miscellaneous.logEvent("i",String.format(context.getResources().getString(R.string.ruleCheckOf),this.getName()),"Wifi name matches. Rule will apply.",4);
}
else
Miscellaneous.logEvent("i",String.format(context.getResources().getString(R.string.ruleCheckOf),this.getName()),"No wifi name specified, any will do.",4);
}
else
{
Miscellaneous.logEvent("i",String.format(context.getResources().getString(R.string.ruleCheckOf),this.getName()),"Wifi state not correct, demanded "+String.valueOf(oneTrigger.getTriggerParameter()+", got "+String.valueOf(WifiBroadcastReceiver.lastConnectedState)),4);