else if(buf.StartsWith(L"DateTime", 0) == true)
{
ret = sscanf(convertedString.get(), "DateTime='%d/%d/%d %d:%d:%d'%s", &(pConvertedTime->tm_mon), &(pConvertedTime->tm_mday), &(pConvertedTime->tm_year), &(pConvertedTime->tm_hour), &(pConvertedTime->tm_min), &(pConvertedTime->tm_sec), garbage);
- SysTryReturnResult(NID_SYS, ret == 6, E_INVALID_FORMAT, "The specified condition format is not compatible.");
+ SysTryReturnResult(NID_SYS, ret == 6, E_INVALID_FORMAT, "The specified condition format is not compatible.");
}
else
{
SysTryReturnResult(NID_SYS, ret == E_SUCCESS, E_INVALID_CONDITION, "It is not valid date time.");
alarmDayOfWeek = alarmDayOfWeek/3;
week = weekFlag[alarmDayOfWeek];
-
+
unique_ptr<char[]> convertedString(_StringConverter::CopyToCharArrayN(buf));
SysTryReturnResult(NID_SYS, convertedString.get() != null, E_OUT_OF_MEMORY, "Memory allocation failure.");
int todayDayOfWeek;
std::unique_ptr<Tizen::Locales::Calendar> pCalendar(Tizen::Locales::Calendar::CreateInstanceN(Tizen::Locales::CALENDAR_GREGORIAN));
SysTryReturnResult(NID_SYS, pCalendar != NULL, E_OUT_OF_MEMORY, "[E_OUT_OF_MEMORY] The memory is insufficient.");
-
+
pCalendar->SetTime(currentTime);
todayDayOfWeek = pCalendar->GetTimeField(TIME_FIELD_DAY_OF_WEEK);
-
+
if(alarmDayOfWeek == todayDayOfWeek)
{
if(alarmTime < currentTime)
alarmTime.AddDays(days);
}
SysLog(NID_SYS, "Alarm time is %ls", alarmTime.ToString().GetPointer());
-
+
pConvertedTime->tm_year = alarmTime.GetYear();
pConvertedTime->tm_mon = alarmTime.GetMonth();
pConvertedTime->tm_mday = alarmTime.GetDay();
int count = 0;
count = strTok.GetTokenCount();
-
+
for (int index = 0; index < count; index++)
{
String tokenValue;
tokenValue.Trim();
r = Convert(tokenValue, &expireTime, week);
SysTryReturnResult(NID_SYS, r == E_SUCCESS, E_INVALID_FORMAT, "It is not valid date time format.");
-
+
r = validateCheck.SetValue(expireTime.tm_year, expireTime.tm_mon, expireTime.tm_mday, expireTime.tm_hour, expireTime.tm_min, expireTime.tm_sec);
SysTryReturnResult(NID_SYS, r == E_SUCCESS, E_INVALID_CONDITION, "It is not valid date time.");
-
+
DateTime currentTime;
SystemTime::GetCurrentTime(TIME_MODE_WALL, currentTime);
expireTime.tm_min = validateCheck.GetMinute();
expireTime.tm_sec = validateCheck.GetSecond();
- SysTryReturnResult(NID_SYS, validateCheck > currentTime, E_INVALID_CONDITION, "Required time does not greater than current time. (%ls/%ls)", validateCheck.ToString().GetPointer(), currentTime.ToString().GetPointer());
+ SysTryReturnResult(NID_SYS, validateCheck > currentTime, E_INVALID_CONDITION, "Required time does not greater than current time. (%ls/%ls)", validateCheck.ToString().GetPointer(), currentTime.ToString().GetPointer());
expireTime.tm_year -= _ADJUST_YEAR_FOR_TM;
expireTime.tm_mon -= _ADJUST_MONTH_FOR_TM;
ret = service_set_package(service, packageName);
SysTryCatch(NID_SYS, ret == SERVICE_ERROR_NONE, r = E_SYSTEM, r, "It is failed to create service for %s", packageName);
-
+
ret = alarm_schedule_with_recurrence_week_flag(service, &expireTime, week, &reservedAlarmId);
SysTryCatch(NID_SYS, ret == ALARM_ERROR_NONE, r = E_SYSTEM, r, "It is failed to set the Alarm time for %s", packageName);
SysLogException(NID_SYS, E_SYSTEM, "It is failed to register requested condition.");
r = E_SYSTEM;
}
-
}
}
else
SystemTime::GetCurrentTime(TIME_MODE_WALL, currentTime);
if(appLaunchCondition.GetConditionString().StartsWith(L"DueTime", 0) == true)
- {
+ {
SysTryReturnResult(NID_SYS, period >= ALARM_PERIOD_MIN && period <= ALARM_PERIOD_MAX, E_INVALID_CONDITION, "Required period is not valid. (%d)", period);
SysTryReturnResult(NID_SYS, validateCheck.GetYear() >= (int)(1970), E_INVALID_FORMAT, "It is not valid date time format.");
{
TimeSpan diffTimeSpan = currentTimeSpan - expireTimeSpan;
long long minutes = diffTimeSpan.GetTicks()/(long long)(1000)/(long long)(60);
-
+
int quotient = (int)((long long)minutes/period);
int remainder = minutes % period;
validateCheck.AddMinutes(quotient * period);
}
-
+
SysLog(NID_SYS, "Correct time is %ls", validateCheck.ToString().GetPointer());
expireTime.tm_year = validateCheck.GetYear();
expireTime.tm_mon = validateCheck.GetMonth();
expireTime.tm_hour = validateCheck.GetHour();
expireTime.tm_min = validateCheck.GetMinute();
expireTime.tm_sec = validateCheck.GetSecond();
-
}
- SysTryReturnResult(NID_SYS, validateCheck > currentTime, E_INVALID_CONDITION, "Required time does not greater thancurrent time. (%ls/%ls)", validateCheck.ToString().GetPointer(), currentTime.ToString().GetPointer());
+ SysTryReturnResult(NID_SYS, validateCheck > currentTime, E_INVALID_CONDITION, "Required time does not greater thancurrent time. (%ls/%ls)", validateCheck.ToString().GetPointer(), currentTime.ToString().GetPointer());
expireTime.tm_year -= _ADJUST_YEAR_FOR_TM;
expireTime.tm_mon -= _ADJUST_MONTH_FOR_TM;
ret = service_set_package(service, packageName);
SysTryCatch(NID_SYS, ret == SERVICE_ERROR_NONE, r = E_SYSTEM, r, "It is failed to create service for %s", packageName);
-
+
ret = alarm_schedule_at_date(service, &expireTime, period * _SECOND_OF_MINUTE, &reservedAlarmId);
SysTryCatch(NID_SYS, ret == ALARM_ERROR_NONE, r = E_SYSTEM, r, "It is failed to set the Alarm time for %s", packageName);
delete pEnum;
garbageCollector.RemoveAll(true);
-
+
return r;
}
SysLog(NID_SYS, "Reserved condition list is empty");
return null;
}
-
+
while(pMapEnum->MoveNext() == E_SUCCESS)
{
pKey = static_cast<Integer *>(pMapEnum->GetKey());
AppId appId(pAppLaunchCondition->GetAppId());
String condition(pAppLaunchCondition->GetConditionString());
+ IList* pArgs = pAppLaunchCondition->GetLaunchArgs();
+
+ std::unique_ptr<Tizen::Base::Collection::ArrayList> pArguments(new (std::nothrow) ArrayList(SingleObjectDeleter));
+ SysTryCatch(NID_APP, pArguments != null, r = E_OUT_OF_MEMORY, r, "failed to allocate 'pArguments'!");
+
+ pArguments->Construct();
+
+ for (int i = 0; i < pArgs->GetCount() ; i++)
+ {
+ r = pArguments->Add(* new (std::nothrow) String(* static_cast<const String*>(pArgs->GetAt(i))));
+ SysTryCatch(NID_APP, !IsFailed(r), , r, "[%s]", GetErrorMessage(r));
+ }
- pNewAppLaunchCondition = pAlarmCondHandler->GetAppLaunchConditionN(*(new AppId(appId)), *(new String(condition)));
+ pNewAppLaunchCondition = pAlarmCondHandler->GetAppLaunchConditionN(*(new AppId(appId)), *(new String(condition)), pArguments.release());
SysTryCatch(NID_SYS, pNewAppLaunchCondition != null, r = E_OUT_OF_MEMORY, r, "It is failed to create pAppLaunchCondition");
updateList.Add(pKey, pNewAppLaunchCondition);
}
_AppLaunchCondition*
-_AlarmConditionHandler::GetAppLaunchConditionN(const AppId& appId, const Tizen::Base::String& condition)
+_AlarmConditionHandler::GetAppLaunchConditionN(const AppId& appId, const Tizen::Base::String& condition, const IList* pArgs)
{
result r = E_SYSTEM;
_AppLaunchCondition* pAppLaunchCondition = new (std::nothrow) _AppLaunchCondition();
SysTryCatch(NID_SYS, pAppLaunchCondition != null, r = E_OUT_OF_MEMORY, r, "It is failed to create pAppLaunchCondition");
- r = pAppLaunchCondition->Construct(appId, condition, null, AppManager::LAUNCH_OPTION_DEFAULT, null);
+ r = pAppLaunchCondition->Construct(appId, condition, pArgs, AppManager::LAUNCH_OPTION_DEFAULT, null);
SysTryCatch(NID_SYS, !IsFailed(r), , r, "It is failed to pAppLaunchCondition->Constructor");
return pAppLaunchCondition;