/usr/include/osp/security
/usr/include/osp/shell
/usr/include/chromium
+ /usr/include/calendar-service2
inc
)
TARGET_LINK_LIBRARIES(${this_target} "-lnotification" )
TARGET_LINK_LIBRARIES(${this_target} "-lsysman" )
TARGET_LINK_LIBRARIES(${this_target} "-lvconf" )
+TARGET_LINK_LIBRARIES(${this_target} "-lcalendar-service2" )
INSTALL(FILES ${CMAKE_CURRENT_SOURCE_DIR}/etc/rc.d/init.d/boot-osp.sh DESTINATION ../etc/rc.d/init.d)
INSTALL(TARGETS ${this_target} DESTINATION ../usr/apps/${APPID}/bin)
BuildRequires: pkgconfig(osp-shell)
BuildRequires: pkgconfig(sysman)
BuildRequires: pkgconfig(vconf)
+BuildRequires: pkgconfig(calendar-service2)
BuildRequires: osp-appfw-internal-devel
BuildRequires: osp-shell-internal-devel
char request[16] = {0,};
char value[32] = {0, };
char condition[512] = {0, };
- char* response = NULL;
+ char* response = null;
bool executed = false;
- char* registered = NULL;
- char* executionCondition = NULL;
- IMapEnumerator* pMapEnum = NULL;
+ char* registered = null;
+ char* executionCondition = null;
+ IMapEnumerator* pMapEnum = null;
result r = E_SUCCESS;
response = strcat(response, "'\r\n");
}
+ SysTryCatch(NID_IO, response != null, , E_OUT_OF_MEMORY, "[E_OUT_OF_MEMORY] Memory allocation failure.");
r = __pAccessoryMonitor->SendData(response, strlen(response)+1);
SysTryCatch(NID_IO, r == E_SUCCESS, executed = false, E_SYSTEM, "[%s] Fail to send data");
CATCH:
- if(registered != null)
- {
- delete [] registered;
- }
- if(executionCondition != null)
- {
- delete [] executionCondition;
- }
- if(response != null)
- {
- delete [] response;
- }
- if(pMapEnum != null)
- {
- delete pMapEnum;
- }
+ delete [] registered;
+ delete [] executionCondition;
+ delete [] response;
+ delete pMapEnum;
return executed;
}
*/
#include <new>
+#include <unique_ptr.h>
+
#include <appfw/app.h>
#include <FBaseInteger.h>
{
//For condition parsing.
int ret = 0;
- char* convertedString = null;
String buf(appLaunchCondition.GetConditionString());
//For alarm reserve.
SysLog(NID_SYS, "%ls", buf.GetPointer());
- convertedString = _StringConverter::CopyToCharArrayN(buf);
+ std::unique_ptr<char[]> convertedString(_StringConverter::CopyToCharArrayN(buf));
+ SysTryReturnResult(NID_SYS, convertedString.get() != null, E_OUT_OF_MEMORY, "Memory allocation failure.");
if(buf.StartsWith(L"DueTime", 0) == true)
{
- sscanf(convertedString, "DueTime='%d/%d/%d %d:%d:%d' LaunchPeriod='%d'", &(expireTime.tm_mon), &(expireTime.tm_mday), &(expireTime.tm_year), &(expireTime.tm_hour), &(expireTime.tm_min), &(expireTime.tm_sec), &period);
+ sscanf(convertedString.get(), "DueTime='%d/%d/%d %d:%d:%d' LaunchPeriod='%d'", &(expireTime.tm_mon), &(expireTime.tm_mday), &(expireTime.tm_year), &(expireTime.tm_hour), &(expireTime.tm_min), &(expireTime.tm_sec), &period);
}
else if(buf.StartsWith(L"DateTime", 0) == true)
{
- sscanf(convertedString, "DateTime='%d/%d/%d %d:%d:%d'", &(expireTime.tm_mon), &(expireTime.tm_mday), &(expireTime.tm_year), &(expireTime.tm_hour), &(expireTime.tm_min), &(expireTime.tm_sec));
+ sscanf(convertedString.get(), "DateTime='%d/%d/%d %d:%d:%d'", &(expireTime.tm_mon), &(expireTime.tm_mday), &(expireTime.tm_year), &(expireTime.tm_hour), &(expireTime.tm_min), &(expireTime.tm_sec));
}
else
{
- if(convertedString != null)
- {
- SysLog(NID_SYS, "wrong alarm condition");
- delete [] convertedString;
- convertedString = null;
- }
+ SysLog(NID_SYS, "wrong alarm condition");
return E_SYSTEM;
}
service_destroy(service);
}
- if (convertedString != null)
- {
- delete [] convertedString;
- }
-
return r;
}
#include <signal.h>
#include <unique_ptr.h>
+#include <calendar_service.h>
+#include <calendar_types2.h>
+
#include <FIoFile.h>
#include <FBaseSysLog.h>
const String tmpPath = _HEARTBEAT_PATH;
File file;
- file.Construct(tmpPath, "w");
+ (void) file.Construct(tmpPath, "w");
SysLog(NID_APP, "Exit.");
return true;
{
}
+bool
+ConfirmCalendarService(void)
+{
+ int count = 0;
+ long interval = 100;
+ int ret = CALENDAR_ERROR_NONE;
+ int WAIT_COUNT = 20;
+
+ while (true)
+ {
+ int ret = calendar_connect();
+ if (ret == CALENDAR_ERROR_NONE)
+ {
+ calendar_disconnect();
+ SysLog(NID_APP, "Found calendar service on %dth trial.", count);
+ return true;
+ }
+
+ SysLog(NID_APP, "Waiting for calendar service %dth time(%d msec).", count, interval);
+
+ if (count >= WAIT_COUNT)
+ {
+ SysLog(NID_APP, "Count overflow.");
+ return false;
+ }
+
+ Thread::Sleep(interval);
+ count++;
+ interval += 100 * count;
+ }
+
+ return false;
+}
+
void
AppService::OnApplicationLaunched(const AppId& appId, Tizen::App::_AppType type)
{
Tizen::App::Package::_PackageManagerImpl::GetInstance()->AddEventListener(this, 0);
+ ConfirmCalendarService();
+
LaunchUserServices();
}
}