--- /dev/null
+%define MODULE_NAME alarm
+%define MODULE_LIBNAME capi-appfw-alarm
+Name: native-%{MODULE_NAME}-itc
+Summary: Native API Integration TC (%{name})
+Version: 0.1
+Release: 0
+Group: Development/Tools
+License: Apache-2.0
+Source0: %{name}-%{version}.tar.gz
+BuildRequires: pkgconfig(%{MODULE_LIBNAME})
+BuildRequires: pkgconfig(capi-appfw-alarm)
+BuildRequires: pkgconfig(capi-appfw-preference)
+BuildRequires: pkgconfig(capi-appfw-app-manager)
+BuildRequires: pkgconfig(gobject-2.0)
+BuildRequires: cmake
+BuildRequires: pkgconfig(bundle)
+BuildRequires: pkgconfig(glib-2.0)
+BuildRequires: pkgconfig(capi-system-info)
+BuildRequires: pkgconfig(dlog)
+BuildRequires: pkgconfig(elementary)
+
+%description
+Native API Integration TC (%{name})
+
+%prep
+%setup -q
+
+%build
+
+%define PREFIX "%{_libdir}/%{name}"
+
+export LDFLAGS+="-Wl,--rpath=%{PREFIX} -Wl,--as-needed"
+
+%if %{?ASAN_BUILD:1}0
+ %if %{?DEVICE_BUILD_TYPE_MOBILE:1}0
+ cmake . -DMODULE="%{MODULE_NAME}" -DBUILDTCTYPE="itc" -DDEVICE_BUILD_TYPE="mobile" -DASANBUILD="true" -DCMAKE_INSTALL_PREFIX=%{_prefix}
+ %endif
+ %if %{?DEVICE_BUILD_TYPE_WEARABLE:1}0
+ cmake . -DMODULE="%{MODULE_NAME}" -DBUILDTCTYPE="itc" -DDEVICE_BUILD_TYPE="wearable" -DASANBUILD="true" -DCMAKE_INSTALL_PREFIX=%{_prefix}
+ %endif
+ %if %{?DEVICE_BUILD_TYPE_TV:1}0
+ cmake . -DMODULE="%{MODULE_NAME}" -DBUILDTCTYPE="itc" -DDEVICE_BUILD_TYPE="tv" -DASANBUILD="true" -DCMAKE_INSTALL_PREFIX=%{_prefix}
+ %endif
+ %if %{?DEVICE_BUILD_TYPE_COMMON_IOT:1}0
+ cmake . -DMODULE="%{MODULE_NAME}" -DBUILDTCTYPE="itc" -DDEVICE_BUILD_TYPE="common_iot" -DASANBUILD="true" -DCMAKE_INSTALL_PREFIX=%{_prefix}
+ %endif
+%else
+ %if %{?DEVICE_BUILD_TYPE_MOBILE:1}0
+ cmake . -DMODULE="%{MODULE_NAME}" -DBUILDTCTYPE="itc" -DDEVICE_BUILD_TYPE="mobile" -DASANBUILD="false" -DCMAKE_INSTALL_PREFIX=%{_prefix}
+ %endif
+ %if %{?DEVICE_BUILD_TYPE_WEARABLE:1}0
+ cmake . -DMODULE="%{MODULE_NAME}" -DBUILDTCTYPE="itc" -DDEVICE_BUILD_TYPE="wearable" -DASANBUILD="false" -DCMAKE_INSTALL_PREFIX=%{_prefix}
+ %endif
+ %if %{?DEVICE_BUILD_TYPE_TV:1}0
+ cmake . -DMODULE="%{MODULE_NAME}" -DBUILDTCTYPE="itc" -DDEVICE_BUILD_TYPE="tv" -DASANBUILD="false" -DCMAKE_INSTALL_PREFIX=%{_prefix}
+ %endif
+ %if %{?DEVICE_BUILD_TYPE_COMMON_IOT:1}0
+ cmake . -DMODULE="%{MODULE_NAME}" -DBUILDTCTYPE="itc" -DDEVICE_BUILD_TYPE="common_iot" -DASANBUILD="false" -DCMAKE_INSTALL_PREFIX=%{_prefix}
+ %endif
+%endif
+
+make %{?jobs:-j%jobs}
+
+%install
+rm -rf %{buildroot}
+%make_install
+mkdir -p %{buildroot}/usr/share/license
+cp LICENSE %{buildroot}/usr/share/license/%{name}
+
+mkdir -p %{buildroot}%{APP_PATH}%{name}/data
+
+mkdir -p %{buildroot}%{APP_PATH}%{name}/res
+cp -r src/itc/alarm/res/* %{buildroot}%{APP_PATH}%{name}/res
+
+mkdir -p %{buildroot}/usr/share/packages/
+cp packaging/itc/native-%{MODULE_NAME}-itc.xml %{buildroot}/usr/share/packages/
+mkdir -p %{buildroot}%{APP_PATH}%{name}/bin
+
+%post
+
+%postun
+
+%files
+%{APP_PATH}%{name}/*
+/usr/share/packages/native-%{MODULE_NAME}-itc.xml
+/usr/share/license/%{name}
--- /dev/null
+<?xml version="1.0" encoding="utf-8"?>
+<manifest xmlns="http://tizen.org/ns/packages" package="native-alarm-itc" version="0.1.0" api-version="3.0">
+ <label>CoreApplicationTest</label>
+ <author email="mymail@tizentest.com" href="www.tizentest.com">test</author>
+ <description>Native API test Application</description>
+ <ui-application appid="native.alarm-itc" exec="/usr/apps/native-alarm-itc/bin/tct-alarm-native" nodisplay="false" multiple="false" type="capp" taskmanage="true">
+ <label>CoreApplicationTest</label>
+ </ui-application>
+ <privileges>
+ <privilege>http://tizen.org/privilege/alarm.set</privilege>
+ <privilege>http://tizen.org/privilege/alarm.get</privilege>
+ <privilege>http://tizen.org/privilege/appmanager.launch</privilege>
+ <privilege>http://tizen.org/privilege/download</privilege>
+ <privilege>http://tizen.org/privilege/appdir.shareddata</privilege>
+ </privileges>
+</manifest>
--- /dev/null
+SET(PKG_NAME "alarm")
+
+SET(EXEC_NAME "tct-${PKG_NAME}-native")
+SET(RPM_NAME "native-${PKG_NAME}-itc")
+
+SET(CAPI_LIB "capi-appfw-application")
+SET(TC_SOURCES
+ ITs-alarm-common.c
+ ITs-alarm.c
+)
+
+PKG_CHECK_MODULES(${CAPI_LIB} REQUIRED
+ ${CAPI_LIB}
+ capi-appfw-alarm
+ capi-appfw-application
+ capi-appfw-preference
+ bundle
+ glib-2.0
+ gobject-2.0
+ capi-system-info
+ dlog elementary
+ capi-appfw-app-manager
+)
+
+INCLUDE_DIRECTORIES(
+ ${${CAPI_LIB}_INCLUDE_DIRS}
+)
+
+ADD_EXECUTABLE(${EXEC_NAME} ${EXEC_NAME}.c ${TC_SOURCES} ${COMMON_FILE} ${COMMON_APP_FILE})
+TARGET_LINK_LIBRARIES(${EXEC_NAME}
+ ${${CAPI_LIB}_LIBRARIES}
+ bundle
+)
+
+INSTALL(PROGRAMS ${EXEC_NAME}
+ DESTINATION ${BIN_DIR}/${RPM_NAME}/bin
+)
+
+IF( DEFINED ASAN )
+SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -fPIC -Wall -pie -g -fsanitize=address -fsanitize-recover=address -U_FORTIFY_SOURCE -fno-omit-frame-pointer")
+SET(CMAKE_EXE_LINKER_FLAGS "-Wl,--as-needed -Wl,--rpath=/usr/lib -Wl,-fsanitize=address")
+ELSE()
+SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -O0 -g -fPIE -Wall")
+SET(CMAKE_EXE_LINKER_FLAGS "-Wl,--as-needed -Wl,--rpath=/usr/lib -pie")
+ENDIF()
--- /dev/null
+//
+// Copyright (c) 2014 Samsung Electronics Co., Ltd.
+//
+// Licensed under the Apache License, Version 2.0 (the License);
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+//
+#include "ITs-alarm-common.h"
+
+/** @addtogroup itc-application
+* @ingroup itc
+* @{
+*/
+
+/**
+* @function ApplicationGetDataPath
+* @description Returnes the application data path
+* @parameter pAppDataPath: application data path
+* @return true if succeed else false
+*/
+bool ApplicationGetDataPath(char* pAppDataPath)
+{
+ if ( NULL == pAppDataPath )
+ {
+ FPRINTF("[Line : %d][%s] Null Path provided; Check the input string\\n", __LINE__, API_NAMESPACE);
+ return false;
+ }
+
+ memset(pAppDataPath, 0, PATH_LEN);
+
+ char* pPath = NULL;
+ pPath = app_get_data_path();
+ if ( NULL == pPath )
+ {
+ FPRINTF("[Line : %d][%s] Unable to get application data path; app_get_data_path returned null value \\n", __LINE__, API_NAMESPACE);
+ return false;
+ }
+
+ strcpy(pAppDataPath, pPath);
+
+ FPRINTF("[Line : %d][%s] application data path returned = %s\\n", __LINE__, API_NAMESPACE, pAppDataPath);
+
+ return true;
+}
+
+/**
+* @function ApplicationAppendToAppDataPath
+* @description Appends the input string to application data path
+* @parameter pInputPath: path to append to data path; pFinalPath: final resultant path
+* @return true if succeed else false
+*/
+bool ApplicationAppendToAppDataPath(char* pInputPath, char* pFinalPath)
+{
+ if ( (NULL == pInputPath) || (NULL == pFinalPath) )
+ {
+ FPRINTF("[Line : %d][%s] Null Path provided; Check the input string\\n", __LINE__, API_NAMESPACE);
+ return false;
+ }
+
+ char pAppDataPath[PATH_LEN] = {0,};
+ if ( false == ApplicationGetDataPath(pAppDataPath) )
+ {
+ return false;
+ }
+
+ memset(pFinalPath, 0, PATH_LEN);
+ strcpy(pFinalPath, pAppDataPath);
+ strcat(pFinalPath, pInputPath);
+
+ FPRINTF("[Line : %d][%s] result path returned = %s\\n", __LINE__, API_NAMESPACE, pFinalPath);
+
+ return true;
+}
+
+/**
+* @function AppControlGetError
+* @description Maps error enums to string values
+* @parameter nRet : error code returned
+* @return error string
+*/
+char* AppControlGetError(int nRet)
+{
+ char *szErrorVal = NULL;
+ switch ( nRet )
+ {
+ case APP_CONTROL_ERROR_NONE: szErrorVal = "APP_CONTROL_ERROR_NONE";break;
+ case APP_CONTROL_ERROR_INVALID_PARAMETER: szErrorVal = "APP_CONTROL_ERROR_INVALID_PARAMETER";break;
+ case APP_CONTROL_ERROR_OUT_OF_MEMORY: szErrorVal = "APP_CONTROL_ERROR_OUT_OF_MEMORY";break;
+ case APP_CONTROL_ERROR_APP_NOT_FOUND: szErrorVal = "APP_CONTROL_ERROR_APP_NOT_FOUND";break;
+ case APP_CONTROL_ERROR_KEY_NOT_FOUND: szErrorVal = "APP_CONTROL_ERROR_KEY_NOT_FOUND";break;
+ case APP_CONTROL_ERROR_KEY_REJECTED: szErrorVal = "APP_CONTROL_ERROR_KEY_REJECTED";break;
+ case APP_CONTROL_ERROR_INVALID_DATA_TYPE: szErrorVal = "APP_CONTROL_ERROR_INVALID_DATA_TYPE";break;
+ case APP_CONTROL_ERROR_LAUNCH_REJECTED: szErrorVal = "APP_CONTROL_ERROR_LAUNCH_REJECTED";break;
+ case APP_CONTROL_ERROR_PERMISSION_DENIED: szErrorVal = "APP_CONTROL_ERROR_PERMISSION_DENIED";break;
+ case APP_CONTROL_ERROR_LAUNCH_FAILED: szErrorVal = "APP_CONTROL_ERROR_LAUNCH_FAILED";break;
+ case APP_CONTROL_ERROR_TIMED_OUT: szErrorVal = "APP_CONTROL_ERROR_TIMED_OUT";break;
+ default: szErrorVal = "Undefined Error";break;
+ }
+ return szErrorVal;
+}
+
+/**
+* @function PreferenceGetError
+* @description Maps error enums to string values
+* @parameter nRet : error code returned
+* @return error string
+*/
+char* PreferenceGetError(int nRet)
+{
+ char *szErrorVal = NULL;
+
+ switch ( nRet )
+ {
+ case PREFERENCE_ERROR_NONE: szErrorVal = "PREFERENCE_ERROR_NONE";break;
+ case PREFERENCE_ERROR_INVALID_PARAMETER: szErrorVal = "PREFERENCE_ERROR_INVALID_PARAMETER";break;
+ case PREFERENCE_ERROR_OUT_OF_MEMORY: szErrorVal = "PREFERENCE_ERROR_OUT_OF_MEMORY";break;
+ case PREFERENCE_ERROR_NO_KEY: szErrorVal = "PREFERENCE_ERROR_NO_KEY";break;
+ case PREFERENCE_ERROR_IO_ERROR: szErrorVal = "PREFERENCE_ERROR_IO_ERROR";break;
+ default: szErrorVal = "Undefined Error";break;
+ }
+
+ return szErrorVal;
+}
+
+
+/**
+* @function AlarmGetError
+* @description Maps error enums to string values
+* @parameter nRet : error code returned
+* @return error string
+*/
+char* AlarmGetError(int nRet)
+{
+ char *szErrorVal = NULL;
+
+ switch ( nRet )
+ {
+ case ALARM_ERROR_NONE: szErrorVal = "ALARM_ERROR_NONE";break;
+ case ALARM_ERROR_INVALID_PARAMETER: szErrorVal = "ALARM_ERROR_INVALID_PARAMETER";break;
+ case ALARM_ERROR_INVALID_TIME: szErrorVal = "ALARM_ERROR_INVALID_TIME";break;
+ case ALARM_ERROR_INVALID_DATE: szErrorVal = "ALARM_ERROR_INVALID_DATE";break;
+ case ALARM_ERROR_CONNECTION_FAIL: szErrorVal = "ALARM_ERROR_CONNECTION_FAIL";break;
+ case ALARM_ERROR_OUT_OF_MEMORY: szErrorVal = "ALARM_ERROR_OUT_OF_MEMORY";break;
+ case ALARM_ERROR_PERMISSION_DENIED : szErrorVal = "ALARM_ERROR_PERMISSION_DENIED";break;
+ case ALARM_ERROR_NOT_PERMITTED_APP : szErrorVal = "ALARM_ERROR_NOT_PERMITTED_APP";break;
+ default: szErrorVal = "Undefined Error";break;
+ }
+
+ return szErrorVal;
+}
+
+
+/**
+* @function AppGetError
+* @description Maps error enums to string values
+* @parameter nRet : error code returned
+* @return error string
+*/
+char* AppGetError(int nRet)
+{
+ char *szErrorVal = NULL;
+
+ switch ( nRet )
+ {
+ case APP_ERROR_NONE : szErrorVal = "APP_ERROR_NONE"; break;
+ case APP_ERROR_INVALID_PARAMETER: szErrorVal = "APP_ERROR_INVALID_PARAMETER"; break;
+ case APP_ERROR_OUT_OF_MEMORY: szErrorVal = "APP_ERROR_OUT_OF_MEMORY"; break;
+ case APP_ERROR_INVALID_CONTEXT: szErrorVal = "APP_ERROR_INVALID_CONTEXT"; break;
+ case APP_ERROR_NO_SUCH_FILE: szErrorVal = "APP_ERROR_NO_SUCH_FILE"; break;
+ case APP_ERROR_ALREADY_RUNNING: szErrorVal = "APP_ERROR_ALREADY_RUNNING"; break;
+ default: szErrorVal = "Undefined error"; break;
+ }
+
+ return szErrorVal;
+}
+/**
+* @function AppControlGetLaunchMode
+* @description Maps error enums to string values
+* @parameter nRet : error code returned
+* @return error string
+*/
+char* AppControlGetLaunchMode(app_control_launch_mode_e nRet)
+{
+ char *szErrorVal = NULL;
+
+ switch ( nRet )
+ {
+ case APP_CONTROL_LAUNCH_MODE_SINGLE: szErrorVal = "APP_CONTROL_LAUNCH_MODE_SINGLE"; break;
+ case APP_CONTROL_LAUNCH_MODE_GROUP: szErrorVal = "APP_CONTROL_LAUNCH_MODE_GROUP"; break;
+ default: szErrorVal = "Undefined Error"; break;
+ }
+
+ return szErrorVal;
+}
+
+/**
+* @function AppResourceGetError
+* @description Maps error enums to string values
+* @parameter nRet : error code returned
+* @return error string
+*/
+char* AppResourceGetError(int nRet)
+{
+ char *szErrorVal = NULL;
+
+ switch ( nRet )
+ {
+ case APP_RESOURCE_ERROR_NONE : szErrorVal = "APP_RESOURCE_ERROR_NONE"; break;
+ case APP_RESOURCE_ERROR_INVALID_PARAMETER: szErrorVal = "APP_RESOURCE_ERROR_INVALID_PARAMETER"; break;
+ case APP_RESOURCE_ERROR_OUT_OF_MEMORY: szErrorVal = "APP_RESOURCE_ERROR_OUT_OF_MEMORY"; break;
+ case APP_RESOURCE_ERROR_IO_ERROR: szErrorVal = "APP_RESOURCE_ERROR_IO_ERROR"; break;
+ default: szErrorVal = "Undefined error"; break;
+ }
+
+ return szErrorVal;
+}
+
+/**
+* @function BundleGetError
+* @description Maps error enums to string values
+* @parameter nRet : error code returned
+* @return error string
+*/
+char* BundleGetError(int nRet)
+{
+ char *szErrorVal = NULL;
+ switch ( nRet )
+ {
+ case BUNDLE_ERROR_NONE: szErrorVal = "BUNDLE_ERROR_NONE"; break;
+ case BUNDLE_ERROR_OUT_OF_MEMORY: szErrorVal = "BUNDLE_ERROR_OUT_OF_MEMORY"; break;
+ case BUNDLE_ERROR_INVALID_PARAMETER: szErrorVal = "BUNDLE_ERROR_INVALID_PARAMETER"; break;
+ case BUNDLE_ERROR_KEY_NOT_AVAILABLE: szErrorVal = "BUNDLE_ERROR_KEY_NOT_AVAILABLE"; break;
+ case BUNDLE_ERROR_KEY_EXISTS: szErrorVal = "BUNDLE_ERROR_KEY_EXISTS"; break;
+ default: szErrorVal = "Unknown Error"; break;
+ }
+ return szErrorVal;
+}
+
+/**
+* @function EventGetError
+* @description Event error enums to string values
+* @parameter nRet : error code returned
+* @return error string
+*/
+char* EventGetError(int nRet)
+{
+ char *szErrorVal = NULL;
+ switch ( nRet )
+ {
+ case EVENT_ERROR_NONE:
+ szErrorVal = "EVENT_ERROR_NONE";
+ break;
+ case EVENT_ERROR_INVALID_PARAMETER:
+ szErrorVal = "EVENT_ERROR_INVALID_PARAMETER";
+ break;
+ case EVENT_ERROR_OUT_OF_MEMORY:
+ szErrorVal = "EVENT_ERROR_OUT_OF_MEMORY";
+ break;
+ case EVENT_ERROR_TIMED_OUT:
+ szErrorVal = "EVENT_ERROR_TIMED_OUT";
+ break;
+ case EVENT_ERROR_IO_ERROR:
+ szErrorVal = "EVENT_ERROR_IO_ERROR";
+ break;
+ case EVENT_ERROR_PERMISSION_DENIED:
+ szErrorVal = "EVENT_ERROR_PERMISSION_DENIED";
+ break;
+ default:
+ szErrorVal = "Unknown Error";
+ break;
+ }
+ return szErrorVal;
+}
+
+/**
+ * @function Timeout
+ * @description Called if some callback is not invoked for a particular timeout
+ * @parameter gpointer data
+ * @return gboolean
+ */
+gboolean Timeout(gpointer data)
+{
+ GMainLoop *pMainLoop = NULL;
+ pMainLoop = (GMainLoop *)data;
+ if ( pMainLoop != NULL )
+ {
+ g_main_loop_quit(pMainLoop);
+ }
+ return false;
+}
+
+/** @} */
\ No newline at end of file
--- /dev/null
+//
+// Copyright (c) 2014 Samsung Electronics Co., Ltd.
+//
+// Licensed under the Apache License, Version 2.0 (the License);
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+//
+#ifndef _ITS_APPLICATION_COMMON_H_
+#define _ITS_APPLICATION_COMMON_H_
+
+#include "tct_common.h"
+#include "tct_app_common.h"
+
+#include "app.h"
+#include "app_alarm.h"
+#include "app_control.h"
+#include "app_preference.h"
+#include "app_resource_manager.h"
+#include "app_event.h"
+#include "bundle.h"
+
+#include <glib.h>
+#include <glib-object.h>
+
+/** @addtogroup itc-application
+* @ingroup itc
+* @{
+*/
+GMainLoop *g_pApplicationMainLoop;
+
+#define API_NAMESPACE "APPLICATION_ITC"
+#define WAIT_CALLBACK 5
+#define PATH_LEN 1024
+
+#define TIMEOUT_CB 10000
+#define TEST_HELLOWORLD_APPID "org.tizen.helloworld"
+#define TEST_TESTAPPLICATION_APPID "org.tizen.testapplication"
+
+#define START_TEST {\
+ FPRINTF("[Line : %d][%s] Starting test : %s\\n", __LINE__, API_NAMESPACE, __FUNCTION__);\
+}
+
+#define RUN_POLLING_LOOP {\
+ g_pApplicationMainLoop = g_main_loop_new(NULL, false);\
+ nTimeoutId = g_timeout_add(TIMEOUT_CB, Timeout, g_pApplicationMainLoop);\
+ g_main_loop_run(g_pApplicationMainLoop);\
+ g_source_remove(nTimeoutId);\
+ g_pApplicationMainLoop = NULL;\
+}
+
+gboolean Timeout(gpointer data);
+char* AppControlGetError(int nRet);
+char* PreferenceGetError(int nRet);
+char* AlarmGetError(int nRet);
+char* AppGetError(int nRet);
+char* AppResourceGetError(int nRet);
+char* AppControlGetLaunchMode(app_control_launch_mode_e nRet);
+bool ApplicationGetDataPath(char* pPath); // this function outputs tha application data path
+bool ApplicationAppendToAppDataPath(char* pInputPath, char* pFinalPath); // this function appends the input string to app data path and outputs the final resultant path
+char* BundleGetError(int nRet);
+char* EventGetError(int nRet);
+/** @} */
+#endif //_ITS_APPLICATION_COMMON_H_
\ No newline at end of file
--- /dev/null
+//
+// Copyright (c) 2014 Samsung Electronics Co., Ltd.
+//
+// Licensed under the Apache License, Version 2.0 (the License);
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+//
+#include "ITs-alarm-common.h"
+
+/** @addtogroup itc-alarm
+* @ingroup itc
+* @{
+*/
+//& set: Application
+
+int g_AlarmRegisteredReceived = 0;
+int g_AlarmIDValueReceived = -1;
+
+bool g_bCallBackHit_alarm = false;
+bool g_bUserDataMismatch_alarm = false;
+
+void *g_pUserData_alarm = "user_data_1";
+
+
+/**
+* @function ITs_alarm_startup
+* @description Called before each test
+* @parameter NA
+* @return NA
+*/
+void ITs_alarm_startup(void)
+{
+ g_bCallBackHit_alarm = false;
+ g_bUserDataMismatch_alarm = false;
+
+ struct stat stBuff;
+ if ( stat(ERR_LOG, &stBuff) == 0 )
+ {
+ remove(ERR_LOG);
+ }
+
+#if DEBUG
+ FPRINTF("[Line : %d][%s] TEST SUIT start-up: ITs_alarm_startup\\n", __LINE__, API_NAMESPACE);
+#endif
+ TCT_CheckInstalledApp(2, TEST_HELLOWORLD_APPID, TEST_TESTAPPLICATION_APPID);
+ return;
+}
+
+/**
+* @function ITs_alarm_cleanup
+* @description Called after each test
+* @parameter NA
+* @return NA
+*/
+void ITs_alarm_cleanup(void)
+{
+#if DEBUG
+ FPRINTF("[Line : %d][%s] TEST SUIT clean-up: ITs_alarm_cleanup\\n", __LINE__, API_NAMESPACE);
+#endif
+ return;
+}
+
+/**
+* @function registered_alarm_cb
+* @description callback function for registered alarm
+* @parameter nAlarmID : alarm ID, user_data : user data sent to callback
+* @return true
+*/
+bool registered_alarm_cb(int nAlarmID, void *user_data)
+{
+ g_bCallBackHit_alarm = true;
+ if(strcmp((char *)user_data,(char *)g_pUserData_alarm) != 0)
+ {
+ g_bUserDataMismatch_alarm = true;
+ }
+
+ FPRINTF("[Line : %d][%s] registered_alarm_cb invoked;alarm id = %d\\n", __LINE__, API_NAMESPACE, nAlarmID);
+
+ g_AlarmIDValueReceived = nAlarmID;
+ ++g_AlarmRegisteredReceived;
+ return true;
+}
+
+//& type: auto
+//& purpose: Set Alarm after Delay.
+/**
+* @testcase ITc_alarm_schedule_once_after_delay_p
+* @since_tizen 2.4
+* @author SRID(satyajit.a)
+* @reviewer SRID(gupta.sanjay)
+* @type auto
+* @description Set Alarm after delay and checks the Alarm ID.
+* @scenario Create AppControl\n
+* Set Alarm after Delay\n
+* Check Alarm ID\n
+* Destroy AppControl
+* @apicovered app_control_create, app_control_destroy, alarm_schedule_once_after_delay, alarm_cancel, app_control_set_operation, app_control_set_app_id
+* @passcase When alarm_schedule_once_after_delay is success full and return proper Alarm ID.
+* @failcase If target API fails or return value is not proper.
+* @precondition None
+* @postcondition None
+*/
+int ITc_alarm_schedule_once_after_delay_p(void)
+{
+ START_TEST;
+
+ app_control_h hAppControl;
+ char* pszPackage = TEST_TESTAPPLICATION_APPID;
+
+ int nRet = app_control_create(&hAppControl);
+ PRINT_RESULT(APP_CONTROL_ERROR_NONE, nRet, "app_control_create", AppControlGetError(nRet));
+
+ nRet = app_control_set_operation(hAppControl, APP_CONTROL_OPERATION_DEFAULT);
+ PRINT_RESULT_CLEANUP(APP_CONTROL_ERROR_NONE, nRet, "app_control_set_operation", AppControlGetError(nRet), app_control_destroy(hAppControl));
+
+ nRet = app_control_set_app_id(hAppControl, pszPackage);
+ PRINT_RESULT_CLEANUP(APP_CONTROL_ERROR_NONE, nRet, "app_control_set_app_id", AppControlGetError(nRet), app_control_destroy(hAppControl));
+
+ int nAlarmID = -1;
+ int nDelay = 60;//sample 1 min
+
+ //Target API
+ nRet = alarm_schedule_once_after_delay(hAppControl, nDelay, &nAlarmID);
+ PRINT_RESULT_CLEANUP(ALARM_ERROR_NONE, nRet, "alarm_schedule_once_after_delay", AlarmGetError(nRet), app_control_destroy(hAppControl));
+
+ if ( nAlarmID < 0 )
+ {
+ FPRINTF("[Line : %d][%s] alarm_schedule_once_after_delay on invalid alarm id = %d\\n", __LINE__, API_NAMESPACE, nAlarmID);
+ app_control_destroy(hAppControl);
+ return 1;
+ }
+
+ nRet = alarm_cancel(nAlarmID);
+ PRINT_RESULT_CLEANUP(ALARM_ERROR_NONE, nRet, "alarm_cancel", AlarmGetError(nRet), app_control_destroy(hAppControl));
+
+ nRet = app_control_destroy(hAppControl);
+ PRINT_RESULT(APP_CONTROL_ERROR_NONE, nRet, "app_control_destroy", AppControlGetError(nRet));
+
+ return 0;
+}
+
+//& type: auto
+//& purpose: Set Alarm at Date.
+/**
+* @testcase ITc_alarm_schedule_once_at_date_p
+* @since_tizen 2.4
+* @author SRID(satyajit.a)
+* @reviewer SRID(gupta.sanjay)
+* @type auto
+* @description Set Alarm at date and checks the Alarm ID.
+* @scenario Create AppControl\n
+* Set Alarm at date\n
+* Check Alarm ID\n
+* Destroy AppControl
+* @apicovered app_control_create, app_control_destroy, alarm_schedule_once_at_date, alarm_cancel, app_control_set_operation, app_control_set_app_id
+* @passcase When alarm_schedule_once_at_date is successful and return proper Alarm ID.
+* @failcase If target API fails or return value is not proper.
+* @precondition None
+* @postcondition None
+*/
+int ITc_alarm_schedule_once_at_date_p(void)
+{
+ START_TEST;
+
+ app_control_h hAppControl;
+ char* pszPackage = TEST_TESTAPPLICATION_APPID;
+
+ int nRet = app_control_create(&hAppControl);
+ PRINT_RESULT(APP_CONTROL_ERROR_NONE, nRet, "app_control_create", AppControlGetError(nRet));
+
+ nRet = app_control_set_operation(hAppControl, APP_CONTROL_OPERATION_DEFAULT);
+ PRINT_RESULT_CLEANUP(APP_CONTROL_ERROR_NONE, nRet, "app_control_set_operation", AppControlGetError(nRet), app_control_destroy(hAppControl));
+
+ nRet = app_control_set_app_id(hAppControl, pszPackage);
+ PRINT_RESULT_CLEANUP(APP_CONTROL_ERROR_NONE, nRet, "app_control_set_app_id", AppControlGetError(nRet), app_control_destroy(hAppControl));
+
+ struct tm stDate;
+ alarm_get_current_time(&stDate);
+ stDate.tm_sec += 60;//set after 1 min
+ int nAlarmID = -1;
+
+ //Target API
+ nRet = alarm_schedule_once_at_date(hAppControl, &stDate, &nAlarmID);
+ PRINT_RESULT_CLEANUP(ALARM_ERROR_NONE, nRet, "alarm_schedule_once_at_date", AlarmGetError(nRet), app_control_destroy(hAppControl));
+
+ if ( nAlarmID < 0 )
+ {
+ FPRINTF("[Line : %d][%s] alarm_schedule_once_at_date returned invalid alarm id = %d\\n", __LINE__, API_NAMESPACE, nAlarmID);
+ app_control_destroy(hAppControl);
+ return 1;
+ }
+
+ FPRINTF("[Line : %d][%s] alarm_schedule_once_at_date returned alarm ID = %d\\n", __LINE__, API_NAMESPACE, nAlarmID);
+ nRet = alarm_cancel(nAlarmID);
+ PRINT_RESULT_CLEANUP(ALARM_ERROR_NONE, nRet, "alarm_cancel", AlarmGetError(nRet), app_control_destroy(hAppControl));
+
+ nRet = app_control_destroy(hAppControl);
+ PRINT_RESULT(APP_CONTROL_ERROR_NONE, nRet, "app_control_destroy", AppControlGetError(nRet));
+
+ return 0;
+}
+
+//& type: auto
+//& purpose: Set Alarm at Date with recurrence week set option.
+/**
+* @testcase ITc_alarm_schedule_with_recurrence_week_flag_p
+* @since_tizen 2.3
+* @author SRID(satyajit.a)
+* @reviewer SRID(gupta.sanjay)
+* @type auto
+* @description Set Alarm at date and with recurrence week flag set option.
+* @scenario Create AppControl\n
+* Set Alarm at date with recurrence week flag set option\n
+* Check Alarm ID\n
+* Destroy AppControl
+* @apicovered app_control_create, app_control_destroy, alarm_schedule_with_recurrence_week_flag, alarm_cancel, app_control_set_operation, app_control_set_app_id
+* @passcase When alarm_schedule_with_recurrence_week_flag is successful and return proper Alarm ID.
+* @failcase If target API fails or return value is not proper.
+* @precondition None
+* @postcondition None
+*/
+int ITc_alarm_schedule_with_recurrence_week_flag_p(void)
+{
+ START_TEST;
+
+ app_control_h hAppControl;
+ char* pszPackage = TEST_TESTAPPLICATION_APPID;
+
+ int nRet = app_control_create(&hAppControl);
+ PRINT_RESULT(APP_CONTROL_ERROR_NONE, nRet, "app_control_create", AlarmGetError(nRet));
+
+ nRet = app_control_set_operation(hAppControl, APP_CONTROL_OPERATION_DEFAULT);
+ PRINT_RESULT_CLEANUP(APP_CONTROL_ERROR_NONE, nRet, "app_control_set_operation", AppControlGetError(nRet), app_control_destroy(hAppControl));
+
+ nRet = app_control_set_app_id(hAppControl, pszPackage);
+ PRINT_RESULT_CLEANUP(APP_CONTROL_ERROR_NONE, nRet, "app_control_set_app_id", AppControlGetError(nRet), app_control_destroy(hAppControl));
+
+ struct tm stDate;
+ alarm_get_current_time(&stDate);
+ stDate.tm_sec += 60;//set after 1 min
+
+ alarm_week_flag_e flag_type[] = { ALARM_WEEK_FLAG_SUNDAY,
+ ALARM_WEEK_FLAG_MONDAY,
+ ALARM_WEEK_FLAG_TUESDAY,
+ ALARM_WEEK_FLAG_WEDNESDAY,
+ ALARM_WEEK_FLAG_THURSDAY,
+ ALARM_WEEK_FLAG_FRIDAY,
+ ALARM_WEEK_FLAG_SATURDAY};
+
+ int enum_size = sizeof(flag_type) / sizeof(flag_type[0]);
+ int enum_counter = 0;
+
+ for ( enum_counter=0;enum_counter<enum_size;enum_counter++ )
+ {
+ int nAlarmID = -1;
+ int nWeekday = flag_type[enum_counter];
+ //Target API
+ nRet = alarm_schedule_with_recurrence_week_flag(hAppControl, &stDate, nWeekday, &nAlarmID);
+ PRINT_RESULT_CLEANUP(ALARM_ERROR_NONE, nRet, "alarm_schedule_with_recurrence_week_flag", AlarmGetError(nRet), app_control_destroy(hAppControl));
+
+ if ( nAlarmID < 0 )
+ {
+ FPRINTF("[Line : %d][%s] alarm_schedule_with_recurrence_week_flag for alarm_week_flag_e enum value = %d, returned invalid alarm id = %d\\n", __LINE__, API_NAMESPACE, flag_type[enum_counter], nAlarmID);
+ app_control_destroy(hAppControl);
+ return 1;
+ }
+
+ FPRINTF("[Line : %d][%s] alarm_schedule_with_recurrence_week_flag returned alarm ID = %d for alarm_week_flag_e enum value = %d\\n", __LINE__, API_NAMESPACE, nAlarmID, flag_type[enum_counter]);
+ alarm_cancel(nAlarmID);
+
+ }
+
+ nRet = app_control_destroy(hAppControl);
+ PRINT_RESULT(APP_CONTROL_ERROR_NONE, nRet, "app_control_destroy", AppControlGetError(nRet));
+
+ return 0;
+}
+
+//& type: auto
+//& purpose: Call alarm_foreach_registered_alarm to retrieve all the registered alarms.
+/**
+* @testcase ITc_alarm_foreach_registered_alarm_p
+* @since_tizen 2.3
+* @author SRID(satyajit.a)
+* @reviewer SRID(gupta.sanjay)
+* @type auto
+* @description Call alarm_foreach_registered_alarm to retrieve all the supported alarm information.
+* @scenario registered the alarm\n
+* call alarm_foreach_registered_alarm\n
+* check the callback and retrieve all the information
+* @apicovered alarm_foreach_registered_alarm, alarm_schedule_once_after_delay, alarm_cancel, app_control_create, app_control_set_operation, app_control_set_app_id, app_control_destroy
+* @passcase When alarm_foreach_registered_alarm is successful and callback returns proper value
+* @failcase If target API fails or callback doesn't retrieve supported alarm values.
+* @precondition None
+* @postcondition None
+*/
+int ITc_alarm_foreach_registered_alarm_p(void)
+{
+ START_TEST;
+
+ app_control_h hAppControl;
+ char* pszPackage = TEST_TESTAPPLICATION_APPID;
+
+ int nRet = app_control_create(&hAppControl);
+ PRINT_RESULT(APP_CONTROL_ERROR_NONE, nRet, "app_control_create", AlarmGetError(nRet));
+
+ nRet = app_control_set_operation(hAppControl, APP_CONTROL_OPERATION_DEFAULT);
+ PRINT_RESULT_CLEANUP(APP_CONTROL_ERROR_NONE, nRet, "app_control_set_operation", AppControlGetError(nRet), app_control_destroy(hAppControl));
+
+ nRet = app_control_set_app_id(hAppControl, pszPackage);
+ PRINT_RESULT_CLEANUP(APP_CONTROL_ERROR_NONE, nRet, "app_control_set_app_id", AppControlGetError(nRet), app_control_destroy(hAppControl));
+
+ int nAlarmID = -1;
+ int nDelay = 60;//sample 1 min
+ nRet = alarm_schedule_once_after_delay(hAppControl, nDelay, &nAlarmID);
+ PRINT_RESULT_CLEANUP(ALARM_ERROR_NONE, nRet, "alarm_schedule_once_after_delay", AlarmGetError(nRet), app_control_destroy(hAppControl));
+
+ if ( nAlarmID < 0 )
+ {
+ FPRINTF("[Line : %d][%s] alarm_schedule_once_after_delay failed, alarm id = %d\\n", __LINE__, API_NAMESPACE, nAlarmID);
+ app_control_destroy(hAppControl);
+ return 1;
+ }
+
+ FPRINTF("[Line : %d][%s] alarm_schedule_once_after_delay returned alarm ID = %d\\n", __LINE__, API_NAMESPACE, nAlarmID);
+
+ g_AlarmRegisteredReceived = 0;
+ g_AlarmIDValueReceived = -1;
+
+ //Target API
+ nRet = alarm_foreach_registered_alarm(registered_alarm_cb, g_pUserData_alarm);
+ PRINT_RESULT_CLEANUP(ALARM_ERROR_NONE, nRet, "alarm_foreach_registered_alarm", AlarmGetError(nRet), alarm_cancel(nAlarmID);app_control_destroy(hAppControl));
+
+ if ( g_AlarmRegisteredReceived <= 0 )
+ {
+ FPRINTF("[Line : %d][%s] alarm_foreach_registered_alarm returned invalid total registered alarms = %d\\n", __LINE__, API_NAMESPACE, g_AlarmRegisteredReceived);
+ alarm_cancel(nAlarmID);
+ app_control_destroy(hAppControl);
+ return 1;
+ }
+
+ if(false == g_bCallBackHit_alarm)
+ {
+ FPRINTF("[Line : %d][%s] Callback not invoked\\n", __LINE__, API_NAMESPACE);
+ app_control_destroy(hAppControl);
+ return 1;
+ }
+
+ if(g_bUserDataMismatch_alarm)
+ {
+ FPRINTF("[Line : %d][%s] User data in callback is not same which is passed through caller function.\\n", __LINE__, API_NAMESPACE);
+ app_control_destroy(hAppControl);
+ return 1;
+ }
+
+ nRet = alarm_cancel(nAlarmID);
+ PRINT_RESULT_CLEANUP(ALARM_ERROR_NONE, nRet, "alarm_cancel", AlarmGetError(nRet), app_control_destroy(hAppControl));
+
+ nRet = app_control_destroy(hAppControl);
+ PRINT_RESULT(APP_CONTROL_ERROR_NONE, nRet, "app_control_destroy", AppControlGetError(nRet));
+
+ return 0;
+}
+
+//& type: auto
+//& purpose: Call alarm_get_app_control to get the app_control of the registered alarm.
+/**
+* @testcase ITc_alarm_get_app_control_p
+* @since_tizen 2.3
+* @author SRID(satyajit.a)
+* @reviewer SRID(gupta.sanjay)
+* @type auto
+* @description Call alarm_get_app_control to get app_control of the registered alarm.
+* @scenario registered the alarm\n
+* call alarm_get_app_control\n
+* check the app_control value and compare with original
+* @apicovered alarm_get_app_control, alarm_schedule_once_after_delay, alarm_cancel, app_control_set_app_id, app_control_destroy, app_control_create, app_control_set_operation, app_control_get_app_id
+* @passcase When alarm_get_app_control is successful and returns correct value
+* @failcase If target API fails or callback doesn't retrieve correct values.
+* @precondition None
+* @postcondition None
+*/
+int ITc_alarm_get_app_control_p(void)
+{
+ START_TEST;
+
+ app_control_h hAppControl;
+
+ char* pszPackage = TEST_TESTAPPLICATION_APPID;//sample app string
+ int nRet = app_control_create(&hAppControl);
+ PRINT_RESULT(APP_CONTROL_ERROR_NONE, nRet, "app_control_create", AlarmGetError(nRet));
+
+ nRet = app_control_set_operation(hAppControl, APP_CONTROL_OPERATION_DEFAULT);
+ PRINT_RESULT_CLEANUP(APP_CONTROL_ERROR_NONE, nRet, "app_control_set_operation", AppControlGetError(nRet), app_control_destroy(hAppControl));
+
+ nRet = app_control_set_app_id(hAppControl, pszPackage);
+ PRINT_RESULT_CLEANUP(APP_CONTROL_ERROR_NONE, nRet, "app_control_set_app_id", AppControlGetError(nRet), app_control_destroy(hAppControl));
+
+ int nAlarmID = -1;
+ int nDelay = 60;//sample 1 min
+ nRet = alarm_schedule_once_after_delay(hAppControl, nDelay, &nAlarmID);
+ PRINT_RESULT_CLEANUP(ALARM_ERROR_NONE, nRet, "alarm_schedule_once_after_delay", AlarmGetError(nRet), app_control_destroy(hAppControl));
+
+ if ( nAlarmID < 0 )
+ {
+ FPRINTF("[Line : %d][%s] alarm_schedule_once_after_delay failed, alarm id = %d\\n", __LINE__, API_NAMESPACE, nAlarmID);
+ app_control_destroy(hAppControl);
+ return 1;
+ }
+
+ FPRINTF("[Line : %d][%s] alarm_schedule_once_after_delay returned alarm ID = %d\\n", __LINE__, API_NAMESPACE, nAlarmID);
+ app_control_h hAppControlReceived;
+ char* pszGetVal = NULL;
+ //Target API
+ nRet = alarm_get_app_control(nAlarmID, &hAppControlReceived);
+ PRINT_RESULT_CLEANUP(ALARM_ERROR_NONE, nRet, "alarm_get_app_control", AlarmGetError(nRet), alarm_cancel(nAlarmID);app_control_destroy(hAppControl));
+ if ( NULL == hAppControlReceived)
+ {
+ FPRINTF("[Line : %d][%s] alarm_get_app_control returned NULL Handle\\n", __LINE__, API_NAMESPACE);
+ alarm_cancel(nAlarmID);
+ app_control_destroy(hAppControl);
+ return 1;
+ }
+
+ nRet = app_control_get_app_id(hAppControlReceived, &pszGetVal);
+ PRINT_RESULT_CLEANUP(ALARM_ERROR_NONE, nRet, "app_control_get_app_id", AlarmGetError(nRet), alarm_cancel(nAlarmID);app_control_destroy(hAppControl));
+
+ if ( NULL == pszGetVal)
+ {
+ FPRINTF("[Line : %d][%s] app_control_get_app_id failed, error returned = Get value is NULL\\n", __LINE__, API_NAMESPACE);
+ alarm_cancel(nAlarmID);
+ app_control_destroy(hAppControl);
+ return 1;
+ }
+
+ FREE_MEMORY(pszGetVal);
+ nRet = alarm_cancel(nAlarmID);
+ PRINT_RESULT_CLEANUP(ALARM_ERROR_NONE, nRet, "alarm_cancel", AlarmGetError(nRet), app_control_destroy(hAppControl));
+
+ nRet = app_control_destroy(hAppControl);
+ PRINT_RESULT(APP_CONTROL_ERROR_NONE, nRet, "app_control_destroy", AppControlGetError(nRet));
+
+ return 0;
+}
+
+//& type: auto
+//& purpose: Call alarm_get_scheduled_period to get the scheduled period of the registered alarms.
+/**
+* @testcase ITc_alarm_get_scheduled_period_p
+* @since_tizen 2.3
+* @author SRID(satyajit.a)
+* @reviewer SRID(gupta.sanjay)
+* @type auto
+* @description Call alarm_get_scheduled_period to get the scheduled period of the registered alarms.
+* @scenario registered the alarm\n
+* call alarm_get_scheduled_period\n
+* check the value received
+* @apicovered alarm_get_scheduled_period, alarm_schedule_once_after_delay, alarm_cancel, app_control_destroy, app_control_create, app_control_set_operation, app_control_set_app_id
+* @passcase When alarm_get_scheduled_period is successful and returns proper value
+* @failcase If target API fails or doesn't return correct value.
+* @precondition None
+* @postcondition None
+*/
+int ITc_alarm_get_scheduled_period_p(void)
+{
+ START_TEST;
+
+ app_control_h hAppControl;
+ char* pszPackage = TEST_TESTAPPLICATION_APPID;
+
+ int nRet = app_control_create(&hAppControl);
+ PRINT_RESULT(APP_CONTROL_ERROR_NONE, nRet, "app_control_create", AppControlGetError(nRet));
+
+ nRet = app_control_set_operation(hAppControl, APP_CONTROL_OPERATION_DEFAULT);
+ PRINT_RESULT_CLEANUP(APP_CONTROL_ERROR_NONE, nRet, "app_control_set_operation", AppControlGetError(nRet), app_control_destroy(hAppControl));
+
+ nRet = app_control_set_app_id(hAppControl, pszPackage);
+ PRINT_RESULT_CLEANUP(APP_CONTROL_ERROR_NONE, nRet, "app_control_set_app_id", AppControlGetError(nRet), app_control_destroy(hAppControl));
+
+ int nAlarmID = -1;
+ int nDelay = 60;//sample 1 min
+ nRet = alarm_schedule_after_delay(hAppControl, nDelay,nDelay, &nAlarmID);
+ PRINT_RESULT_CLEANUP(ALARM_ERROR_NONE, nRet, "alarm_schedule_once_after_delay", AlarmGetError(nRet), app_control_destroy(hAppControl));
+
+ if ( nAlarmID < 0 )
+ {
+ FPRINTF("[Line : %d][%s] alarm_schedule_once_after_delay returned invalid alarm id = %d\\n", __LINE__, API_NAMESPACE, nAlarmID);
+ app_control_destroy(hAppControl);
+ return 1;
+ }
+
+ int nGetPeriod = 0;
+ //Target API
+ nRet = alarm_get_scheduled_period(nAlarmID, &nGetPeriod);
+ PRINT_RESULT_CLEANUP(ALARM_ERROR_NONE, nRet, "alarm_get_scheduled_period", AlarmGetError(nRet), alarm_cancel(nAlarmID);app_control_destroy(hAppControl));
+
+ if ( nGetPeriod <= 0 )
+ {
+ FPRINTF("[Line : %d][%s] alarm_get_scheduled_period value returned invalid value = %d\\n", __LINE__, API_NAMESPACE, nGetPeriod);
+ alarm_cancel(nAlarmID);
+ app_control_destroy(hAppControl);
+ return 1;
+ }
+
+ nRet = alarm_cancel(nAlarmID);
+ PRINT_RESULT_CLEANUP(ALARM_ERROR_NONE, nRet, "alarm_cancel", AlarmGetError(nRet), app_control_destroy(hAppControl));
+
+ nRet = app_control_destroy(hAppControl);
+ PRINT_RESULT(APP_CONTROL_ERROR_NONE, nRet, "app_control_destroy", AppControlGetError(nRet));
+
+ return 0;
+}
+
+//& type: auto
+//& purpose: Call alarm_get_scheduled_date to get the scheduled date of the registered alarms.
+/**
+* @testcase ITc_alarm_get_scheduled_date_p
+* @since_tizen 2.3
+* @author SRID(satyajit.a)
+* @reviewer SRID(gupta.sanjay)
+* @type auto
+* @description Call alarm_get_scheduled_date to get the scheduled date of the registered alarms.
+* @scenario registered the alarm\n
+* call alarm_get_scheduled_date\n
+* check the value received
+* @apicovered app_control_create, app_control_destroy, app_control_set_operation, app_control_set_app_id, alarm_get_scheduled_date, alarm_schedule_with_recurrence_week_flag, alarm_cancel
+* @passcase When alarm_get_scheduled_date is successful and returns proper value
+* @failcase If target API fails or doesn't return correct value.
+* @precondition None
+* @postcondition None
+*/
+int ITc_alarm_get_scheduled_date_p(void)
+{
+ START_TEST;
+
+ app_control_h hAppControl;
+ char* pszPackage = TEST_TESTAPPLICATION_APPID;
+
+ int nRet = app_control_create(&hAppControl);
+ PRINT_RESULT(APP_CONTROL_ERROR_NONE, nRet, "app_control_create", AlarmGetError(nRet));
+
+ nRet = app_control_set_operation(hAppControl, APP_CONTROL_OPERATION_DEFAULT);
+ PRINT_RESULT_CLEANUP(APP_CONTROL_ERROR_NONE, nRet, "app_control_set_operation", AppControlGetError(nRet), app_control_destroy(hAppControl));
+
+ nRet = app_control_set_app_id(hAppControl, pszPackage);
+ PRINT_RESULT_CLEANUP(APP_CONTROL_ERROR_NONE, nRet, "app_control_set_app_id", AppControlGetError(nRet), app_control_destroy(hAppControl));
+
+ int nAlarmID = -1;
+ struct tm stDate;
+ alarm_get_current_time(&stDate);
+ stDate.tm_sec = 30;//set sec value to 30 sec
+ int nWeekday = ALARM_WEEK_FLAG_SUNDAY;
+ nRet = alarm_schedule_with_recurrence_week_flag(hAppControl, &stDate, nWeekday, &nAlarmID);
+ PRINT_RESULT_CLEANUP(ALARM_ERROR_NONE, nRet, "alarm_schedule_with_recurrence_week_flag", AlarmGetError(nRet), app_control_destroy(hAppControl));
+
+ if ( nAlarmID < 0 )
+ {
+ FPRINTF("[Line : %d][%s] alarm_schedule_with_recurrence_week_flag returned invalid alarm id = %d\\n", __LINE__, API_NAMESPACE, nAlarmID);
+ app_control_destroy(hAppControl);
+ return 1;
+ }
+
+ struct tm stGetDate;
+
+ //Target API
+ nRet = alarm_get_scheduled_date(nAlarmID, &stGetDate);
+ PRINT_RESULT_CLEANUP(ALARM_ERROR_NONE, nRet, "alarm_get_scheduled_date", AlarmGetError(nRet), alarm_cancel(nAlarmID);app_control_destroy(hAppControl));
+
+ if ( stGetDate.tm_sec != stDate.tm_sec )
+ {
+ FPRINTF("[Line : %d][%s] alarm_get_scheduled_date value mismatch, set second value = %d, received second value = %d\\n", __LINE__, API_NAMESPACE, stDate.tm_sec, stGetDate.tm_sec);
+ alarm_cancel(nAlarmID);
+ app_control_destroy(hAppControl);
+ return 1;
+ }
+
+ nRet = alarm_cancel(nAlarmID);
+ PRINT_RESULT_CLEANUP(ALARM_ERROR_NONE, nRet, "alarm_cancel", AlarmGetError(nRet), app_control_destroy(hAppControl));
+
+ nRet = app_control_destroy(hAppControl);
+ PRINT_RESULT(APP_CONTROL_ERROR_NONE, nRet, "app_control_destroy", AppControlGetError(nRet));
+
+ return 0;
+}
+
+//& type: auto
+//& purpose: Call alarm_get_scheduled_recurrence_week_flag to get the scheduled recurrence_week_flag of the registered alarms.
+/**
+* @testcase ITc_alarm_get_scheduled_recurrence_week_flag_p
+* @since_tizen 2.3
+* @author SRID(satyajit.a)
+* @reviewer SRID(gupta.sanjay)
+* @type auto
+* @description Call alarm_get_scheduled_recurrence_week_flag to get the scheduled recurrence_week_flag of the registered alarms.
+* @scenario registered the alarm\n
+* call alarm_get_scheduled_recurrence_week_flag\n
+* check the value received
+* @apicovered app_control_create, app_control_set_operation, app_control_set_app_id, alarm_get_scheduled_recurrence_week_flag, alarm_schedule_with_recurrence_week_flag, alarm_cancel, app_control_destroy
+* @passcase When alarm_get_scheduled_recurrence_week_flag is successful and returns proper value
+* @failcase If target API fails or doesn't return correct value.
+* @precondition None
+* @postcondition None
+*/
+int ITc_alarm_get_scheduled_recurrence_week_flag_p(void)
+{
+ START_TEST;
+
+ app_control_h hAppControl;
+ char* pszPackage = TEST_TESTAPPLICATION_APPID;
+
+ int nRet = app_control_create(&hAppControl);
+ PRINT_RESULT(APP_CONTROL_ERROR_NONE, nRet, "app_control_create", AlarmGetError(nRet));
+
+ nRet = app_control_set_operation(hAppControl, APP_CONTROL_OPERATION_DEFAULT);
+ PRINT_RESULT_CLEANUP(ALARM_ERROR_NONE, nRet, "app_control_set_operation", AlarmGetError(nRet), app_control_destroy(hAppControl));
+
+ nRet = app_control_set_app_id(hAppControl, pszPackage);
+ PRINT_RESULT_CLEANUP(APP_CONTROL_ERROR_NONE, nRet, "app_control_set_app_id", AppControlGetError(nRet), app_control_destroy(hAppControl));
+
+ int nAlarmID = -1;
+ struct tm stDate;
+ alarm_get_current_time(&stDate);
+ stDate.tm_sec = 30;//set sec value to 30 sec
+ int nWeekday = ALARM_WEEK_FLAG_SUNDAY;
+
+ nRet = alarm_schedule_with_recurrence_week_flag(hAppControl, &stDate, nWeekday, &nAlarmID);
+ PRINT_RESULT_CLEANUP(ALARM_ERROR_NONE, nRet, "alarm_schedule_with_recurrence_week_flag", AlarmGetError(nRet), app_control_destroy(hAppControl));
+
+ if ( nAlarmID < 0 )
+ {
+ FPRINTF("[Line : %d][%s] alarm_schedule_with_recurrence_week_flag returned invalid alarm id = %d\\n", __LINE__, API_NAMESPACE, nAlarmID);
+ app_control_destroy(hAppControl);
+ return 1;
+ }
+
+ int nGetWeekday;
+
+ //Target API
+ nRet = alarm_get_scheduled_recurrence_week_flag(nAlarmID, &nGetWeekday);
+ PRINT_RESULT_CLEANUP(ALARM_ERROR_NONE, nRet, "alarm_get_scheduled_recurrence_week_flag", AlarmGetError(nRet), alarm_cancel(nAlarmID);app_control_destroy(hAppControl));
+
+ if ( nWeekday != nGetWeekday )
+ {
+ FPRINTF("[Line : %d][%s] alarm_get_scheduled_recurrence_week_flag value mismatch, set value = %d, received value = %d\\n", __LINE__, API_NAMESPACE, nWeekday, nGetWeekday);
+ alarm_cancel(nAlarmID);
+ app_control_destroy(hAppControl);
+ return 1;
+ }
+
+ nRet = alarm_cancel(nAlarmID);
+ PRINT_RESULT_CLEANUP(ALARM_ERROR_NONE, nRet, "alarm_cancel", AlarmGetError(nRet), app_control_destroy(hAppControl));
+
+ nRet = app_control_destroy(hAppControl);
+ PRINT_RESULT(APP_CONTROL_ERROR_NONE, nRet, "app_control_destroy", AppControlGetError(nRet));
+
+ return 0;
+}
+
+//& type: auto
+//& purpose: Set Alarm after Delay and cancel the alarm.
+/**
+* @testcase ITc_alarm_cancel_p
+* @since_tizen 2.3
+* @author SRID(satyajit.a)
+* @reviewer SRID(gupta.sanjay)
+* @type auto
+* @description Set Alarm after delay and cancel the alarm.
+* @scenario Create AppControl\n
+* Set Alarm after Delay\n
+* cancel Alarm ID\n
+* Destroy AppControl
+* @apicovered app_control_create, app_control_destroy, alarm_schedule_once_after_delay, alarm_cancel, app_control_set_operation, app_control_set_app_id
+* @passcase When alarm_cancel is successful and behave properly.
+* @failcase If target API fails or not behaved properly.
+* @precondition None
+* @postcondition None
+*/
+int ITc_alarm_cancel_p(void)
+{
+ START_TEST;
+
+ app_control_h hAppControl;
+ char* pszPackage = TEST_TESTAPPLICATION_APPID;
+
+ int nRet = app_control_create(&hAppControl);
+ PRINT_RESULT(APP_CONTROL_ERROR_NONE, nRet, "app_control_create", AlarmGetError(nRet));
+
+ nRet = app_control_set_operation(hAppControl, APP_CONTROL_OPERATION_DEFAULT);
+ PRINT_RESULT_CLEANUP(APP_CONTROL_ERROR_NONE, nRet, "app_control_set_operation", AppControlGetError(nRet), app_control_destroy(hAppControl));
+
+ nRet = app_control_set_app_id(hAppControl, pszPackage);
+ PRINT_RESULT_CLEANUP(APP_CONTROL_ERROR_NONE, nRet, "app_control_set_app_id", AppControlGetError(nRet), app_control_destroy(hAppControl));
+
+ int nAlarmID = -1;
+ int nDelay = 60;//sample 1 min
+ nRet = alarm_schedule_once_after_delay(hAppControl, nDelay, &nAlarmID);
+ PRINT_RESULT_CLEANUP(ALARM_ERROR_NONE, nRet, "alarm_schedule_once_after_delay", AlarmGetError(nRet), app_control_destroy(hAppControl));
+
+ if ( nAlarmID < 0 )
+ {
+ FPRINTF("[Line : %d][%s] alarm_schedule_once_after_delay returned invalid alarm id = %d\\n", __LINE__, API_NAMESPACE, nAlarmID);
+ return 1;
+ }
+
+ //Target API
+ nRet = alarm_cancel(nAlarmID);
+ PRINT_RESULT_CLEANUP(ALARM_ERROR_NONE, nRet, "alarm_cancel", AlarmGetError(nRet), app_control_destroy(hAppControl));
+
+ nRet = app_control_destroy(hAppControl);
+ PRINT_RESULT(APP_CONTROL_ERROR_NONE, nRet, "app_control_destroy", AppControlGetError(nRet));
+
+ return 0;
+}
+
+//& type: auto
+//& purpose: Set few Alarms after Delay and cancel_all the alarm.
+/**
+* @testcase ITc_alarm_cancel_all_p
+* @since_tizen 2.3
+* @author SRID(satyajit.a)
+* @reviewer SRID(gupta.sanjay)
+* @type auto
+* @description Set few Alarms after delay and cancel all the alarms.
+* @scenario Create AppControl\n
+* Set Alarm after Delay\n
+* Cancel all alarms\n
+* Destroy AppControl
+* @apicovered app_control_create, app_control_destroy, alarm_schedule_once_after_delay, alarm_cancel_all, app_control_set_operation, app_control_set_app_id,
+* @passcase When alarm_cancel_all is successful and behave properly.
+* @failcase If target API fails or not behaved properly.
+* @precondition None
+* @postcondition None
+*/
+int ITc_alarm_cancel_all_p(void)
+{
+ START_TEST;
+
+ app_control_h hAppControl;
+ char* pszPackage = TEST_TESTAPPLICATION_APPID;
+
+ int nRet = app_control_create(&hAppControl);
+ PRINT_RESULT(APP_CONTROL_ERROR_NONE, nRet, "app_control_create", AlarmGetError(nRet));
+
+ nRet = app_control_set_operation(hAppControl, APP_CONTROL_OPERATION_DEFAULT);
+ PRINT_RESULT_CLEANUP(APP_CONTROL_ERROR_NONE, nRet, "app_control_set_operation", AppControlGetError(nRet), app_control_destroy(hAppControl));
+
+ nRet = app_control_set_app_id(hAppControl, pszPackage);
+ PRINT_RESULT_CLEANUP(APP_CONTROL_ERROR_NONE, nRet, "app_control_set_app_id", AppControlGetError(nRet), app_control_destroy(hAppControl));
+
+ int nAlarmID1 = -1;
+ int nAlarmID2 = -1;
+ int nDelay = 60;//sample 1 min
+ nRet = alarm_schedule_once_after_delay(hAppControl, nDelay, &nAlarmID1);
+ PRINT_RESULT_CLEANUP(ALARM_ERROR_NONE, nRet, "alarm_schedule_once_after_delay", AlarmGetError(nRet), app_control_destroy(hAppControl));
+
+ if ( nAlarmID1 < 0 )
+ {
+ FPRINTF("[Line : %d][%s] alarm_schedule_once_after_delay failed with alarm id = %d\\n", __LINE__, API_NAMESPACE, nAlarmID1);
+ app_control_destroy(hAppControl);
+ return 1;
+ }
+
+ nRet = alarm_schedule_once_after_delay(hAppControl, nDelay + 60, &nAlarmID2);//set after 60 sec from first alarm
+ PRINT_RESULT_CLEANUP(ALARM_ERROR_NONE, nRet, "alarm_schedule_once_after_delay", AlarmGetError(nRet), app_control_destroy(hAppControl));
+ if ( nAlarmID2 < 0 )
+ {
+ FPRINTF("[Line : %d][%s] alarm_schedule_once_after_delay failed with alarm id = %d\\n", __LINE__, API_NAMESPACE, nAlarmID2);
+ app_control_destroy(hAppControl);
+ alarm_cancel_all();
+ return 1;
+ }
+
+ //Target API
+ nRet = alarm_cancel_all();
+ PRINT_RESULT_CLEANUP(APP_CONTROL_ERROR_NONE, nRet, "alarm_cancel_all", AlarmGetError(nRet), app_control_destroy(hAppControl));
+
+ nRet = app_control_destroy(hAppControl);
+ PRINT_RESULT(APP_CONTROL_ERROR_NONE, nRet, "app_control_destroy", AppControlGetError(nRet));
+
+ return 0;
+}
+
+//& type: auto
+//& purpose: Get current time.
+/**
+* @testcase ITc_alarm_get_current_time_p
+* @since_tizen 2.3
+* @author SRID(satyajit.a)
+* @reviewer SRID(gupta.sanjay)
+* @type auto
+* @description Get current time
+* @scenario Get current time\n
+* validate the time
+* @apicovered alarm_get_current_time
+* @passcase When alarm_get_current_time is successful and and returns correct value.
+* @failcase If target API fails or returns incorrect value.
+* @precondition None
+* @postcondition None
+*/
+int ITc_alarm_get_current_time_p(void)
+{
+ START_TEST;
+
+ struct tm stdate;
+
+ //Target API
+ int nRet = alarm_get_current_time(&stdate);
+ PRINT_RESULT(ALARM_ERROR_NONE, nRet, "alarm_get_current_time", AlarmGetError(nRet));
+
+ if(stdate.tm_sec < 0)
+ {
+ FPRINTF("[Line : %d][%s] alarm_get_current_time returned invalid time\\n", __LINE__, API_NAMESPACE);
+ return 1;
+ }
+
+ return 0;
+}
+
+//& type: auto
+//& purpose:Sets and Gets global flag in the alarm.
+/**
+* @testcase ITc_alarm_set_get_global_p
+* @since_tizen 3.0
+* @author SRID(nibha.sharma)
+* @reviewer SRID(a.pandia1)
+* @type auto
+* @description Get current time
+* @scenario Get current time\n
+* @apicovered alarm_get_current_time
+* @passcase When alarm_get_current_time is successful and and returns correct value.
+* @failcase If target API fails or returns incorrect value.
+* @precondition None
+* @postcondition None
+*/
+int ITc_alarm_set_get_global_p(void)
+{
+ START_TEST;
+
+ bool bSetGlobal = true;
+ bool bGetGlobal ;
+ app_control_h hAppControl;
+ char *pszPackage = "org.tizen.globalapp";
+
+ int nRet = app_control_create(&hAppControl);
+ PRINT_RESULT(APP_CONTROL_ERROR_NONE, nRet, "app_control_create", AppControlGetError(nRet));
+
+ nRet = app_control_set_operation(hAppControl, APP_CONTROL_OPERATION_DEFAULT);
+ PRINT_RESULT_CLEANUP(APP_CONTROL_ERROR_NONE, nRet, "app_control_set_operation", AppControlGetError(nRet), app_control_destroy(hAppControl));
+
+ nRet = app_control_set_app_id(hAppControl, pszPackage);
+ PRINT_RESULT_CLEANUP(APP_CONTROL_ERROR_NONE, nRet, "app_control_set_app_id", AppControlGetError(nRet), app_control_destroy(hAppControl));
+
+ int nAlarmID;
+ int nDelay = 1;
+ nRet = alarm_schedule_after_delay(hAppControl, nDelay,nDelay, &nAlarmID);
+ PRINT_RESULT_CLEANUP(ALARM_ERROR_NONE, nRet, "alarm_schedule_once_after_delay", AlarmGetError(nRet), app_control_destroy(hAppControl));
+
+ if ( nAlarmID < 0 )
+ {
+ FPRINTF("[Line : %d][%s] alarm_schedule_once_after_delay returned invalid alarm id = %d\\n", __LINE__, API_NAMESPACE, nAlarmID);
+ app_control_destroy(hAppControl);
+ return 1;
+ }
+
+ nRet = alarm_set_global(nAlarmID, bSetGlobal);
+ PRINT_RESULT_CLEANUP(ALARM_ERROR_NONE, nRet, "alarm_set_global", AlarmGetError(nRet), alarm_cancel(nAlarmID);app_control_destroy(hAppControl));
+
+ nRet = alarm_get_global(nAlarmID, &bGetGlobal);
+ PRINT_RESULT_CLEANUP(ALARM_ERROR_NONE, nRet, "alarm_get_global", AlarmGetError(nRet), alarm_cancel(nAlarmID);app_control_destroy(hAppControl));
+
+ if(bSetGlobal != bGetGlobal)
+ {
+ FPRINTF("[Line : %d][%s] value mismatch\\n", __LINE__, API_NAMESPACE);
+ alarm_cancel(nAlarmID);
+ app_control_destroy(hAppControl);
+ return 1;
+ }
+
+ nRet = alarm_cancel(nAlarmID);
+ PRINT_RESULT_CLEANUP(ALARM_ERROR_NONE, nRet, "alarm_cancel", AlarmGetError(nRet), app_control_destroy(hAppControl));
+
+ nRet = app_control_destroy(hAppControl);
+ PRINT_RESULT_NORETURN(APP_CONTROL_ERROR_NONE, nRet, "app_control_destroy", AppControlGetError(nRet));
+
+ return 0;
+}
+/** @} */
+/** @} */
--- /dev/null
+#!/bin/bash
+#
+# Copyright (c) 2016 Samsung Electronics Co., Ltd.
+#
+# Licensed under the Apache License, Version 2.0 (the License);
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http:#www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+
+# extract TCT configuration directory from TCT_CONFIG_FILE (/tmp/TCT_CONFIG)
+APP_DIR=/usr/apps
+TCT_CONFIG_FILE=/tmp/TCT_CONFIG
+PKG_NAME=$1
+MODE=$2
+
+if [ $PKG_NAME == "" ] || [ $MODE == "" ]; then
+ echo ""
+ echo "****************FATAL ERROR : post-inst.sh***************************"
+ echo "PackageName/Mode is not supplied with post-inst.sh"
+ echo "Necessary Resource Files if any can not be processed"
+ echo "********************************************************************"
+ echo ""
+ return;
+fi
+
+if [ ! -f $TCT_CONFIG_FILE ];then
+ echo ""
+ echo "****************FATAL ERROR : $PKG_NAME/post-inst.sh***************************"
+ echo "$TCT_CONFIG_FILE is not Found : Can Not Read TCT Configuration Directory"
+ echo "$PKG_NAME : Necessary Resource Files if any can not be processed"
+ echo "********************************************************************"
+ echo ""
+ return;
+fi
+DEVICE_SUITE_TARGET_30=`cat $TCT_CONFIG_FILE | grep DEVICE_SUITE_TARGET_30 | cut -f 2- -d '='`
+if [ $DEVICE_SUITE_TARGET_30 == "" ]; then
+ echo ""
+ echo "****************FATAL ERROR : $PKG_NAME/post-inst.sh***************************"
+ echo "'DEVICE_SUITE_TARGET_30' key-value pair is not Found"
+ echo "$PKG_NAME : Necessary Resource Files if any can not be processed"
+ echo "********************************************************************"
+ echo ""
+ return;
+fi
+DEVICE_USER_30=`cat $TCT_CONFIG_FILE | grep DEVICE_USER_30 | cut -f 2- -d '='`
+if [ $DEVICE_USER_30 == "" ]; then
+ echo ""
+ echo "****************FATAL ERROR : $PKG_NAME/post-inst.sh***************************"
+ echo "'DEVICE_USER_30' key-value pair is not Found"
+ echo "$PKG_NAME : Necessary Resource Files if any can not be processed"
+ echo "********************************************************************"
+ echo ""
+ return;
+fi
+DEVICE_STORAGE_30=`cat $TCT_CONFIG_FILE | grep DEVICE_STORAGE_30 | cut -f 2- -d '='`
+if [ $DEVICE_STORAGE_30 == "" ]; then
+ echo ""
+ echo "****************FATAL ERROR : $PKG_NAME/post-inst.sh***************************"
+ echo "'DEVICE_STORAGE_30' key-value pair is not Found"
+ echo "$PKG_NAME : Necessary Resource Files if any can not be processed"
+ echo "********************************************************************"
+ echo ""
+ return;
+fi
+
+
+if [ $MODE == "inst" ]; then
+ echo "Installing pre-requisites for the package $PKG_NAME"
+ chown -R owner:users $APP_DIR/$PKG_NAME/data
+ chown -R owner:users $APP_DIR/$PKG_NAME/res
+ echo "Installing the pre-requisites for the package $PKG_NAME ======> Completed"
+else
+ echo "Un-installing the pre-requisites for the package $PKG_NAME"
+ echo "Un-installing the pre-requisites for the package $PKG_NAME ======> Completed"
+fi
--- /dev/null
+<?xml version="1.0" encoding="UTF-8"?>
+<res xmlns="http://tizen.org/ns/rm">
+ <group-layout folder="layout">
+ <node folder="layout/tv" screen-large="true"/>
+ </group-layout>
+ <group-image folder="image">
+ <node folder="image/high" screen-dpi-range="from 200 to 400"/>
+ <node folder="image/high_ko" screen-dpi-range="from 200 to 400" language="ko_KR"/>
+ </group-image>
+ <group-sound folder="sound">
+ <node folder="sound/ko" language="ko_KR"/>
+ </group-sound>
+</res>
+
--- /dev/null
+//
+// Copyright (c) 2014 Samsung Electronics Co., Ltd.
+//
+// Licensed under the Apache License, Version 2.0 (the License);
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+//
+#include <stdio.h>
+#include <string.h>
+#include "tct_common.h"
+
+#ifdef MOBILE //Starts MOBILE
+#include "tct-alarm-native_mobile.h"
+#endif //MOBILE //End MOBILE
+
+#ifdef WEARABLE //Starts WEARABLE
+#include "tct-alarm-native_wearable.h"
+#endif //WEARABLE //End WEARABLE
+
+#ifdef TV //Starts TV
+#include "tct-alarm-native_tv.h"
+#endif //TV //End TV
+
+#ifdef COMMON_IOT //Starts COMMON_IOT
+#include "tct-alarm-native_common_iot.h"
+#endif //COMMON_IOT //End COMMON_IOT
+
+
+#include <malloc.h>
+#include <unistd.h>
+#include <sys/types.h>
+#include <sys/stat.h>
+#include <sys/wait.h>
+#include <glib.h>
+#include <stdbool.h>
+
+#include <app.h>
+#include <dlog.h>
+
+#include <sys/socket.h>
+#include <netinet/in.h>
+#include <arpa/inet.h>
+#include <errno.h>
+
+#include <Elementary.h>
+
+typedef struct appdata {
+ Evas_Object *win;
+ Evas_Object *conform;
+ Evas_Object *label;
+} appdata_s;
+
+static bool app_create(void *data)
+{
+ return true;
+}
+
+static void app_control(app_control_h app_control, void *data)
+{
+ char* pszGetTCName = NULL;
+ int i=0, result=0, nRet=0;
+ nRet = app_control_get_extra_data(app_control, "testcase_name", &pszGetTCName);
+ if(nRet != APP_CONTROL_ERROR_NONE)
+ {
+ dlog_print(DLOG_ERROR, "NativeTCT", "[%s:%d] app_control_get_extra_data returns error = %d", __FUNCTION__, __LINE__, nRet);
+ PRINT_UTC_LOG("\\n[%s][Line : %d]Unable to fetch test case name: app_control_get_extra_data API call fails\\n", __FILE__, __LINE__);
+ PRINT_TC_RESULT("%d",1);
+ FREE_MEMORY_TC(pszGetTCName);
+ return;
+ }
+
+ dlog_print(DLOG_INFO, "NativeTCT", "[%s:%d] Executing TC Name = %s", __FUNCTION__, __LINE__, pszGetTCName);
+ for ( i = 0; tc_array[i].name; i++ )
+ {
+ if ( 0 == strncmp(pszGetTCName, tc_array[i].name, strlen(pszGetTCName)) )
+ {
+ if ( tc_array[i].startup )
+ {
+ dlog_print(DLOG_INFO, "NativeTCT", "%s : Start up", pszGetTCName);
+ tc_array[i].startup();
+ }
+
+ dlog_print(DLOG_INFO, "NativeTCT", "%s : Body", pszGetTCName);
+ result = tc_array[i].function();
+ dlog_print(DLOG_INFO, "NativeTCT", "%s returns value = %d", pszGetTCName, result);
+
+ if ( tc_array[i].cleanup )
+ {
+ dlog_print(DLOG_INFO, "NativeTCT", "%s : Clean up", pszGetTCName);
+ tc_array[i].cleanup();
+ }
+
+ PRINT_TC_RESULT("%d",result);
+ FREE_MEMORY_TC(pszGetTCName);
+ return;
+ }
+ }
+
+ dlog_print(DLOG_ERROR, "NativeTCT", "[%s:%d] Unable to execute %s : Unknown Test Case Name", __FUNCTION__, __LINE__, pszGetTCName);
+ PRINT_UTC_LOG("\\n[%s][Line : %d]Unable to execute %s : Unknown Test Case Name\\n", __FILE__, __LINE__, pszGetTCName);
+ PRINT_TC_RESULT("%d",1);
+ FREE_MEMORY_TC(pszGetTCName);
+ return;
+}
+
+static void app_terminate(void *data)
+{
+ dlog_print(DLOG_INFO, "NativeTCT", "[%s:%d] Application Package is now Terminating", __FUNCTION__, __LINE__);
+}
+
+int main(int argc, char *argv[])
+{
+ int ret = 0;
+ appdata_s ad = {0,};
+
+ ui_app_lifecycle_callback_s event_callback = {0,};
+ event_callback.create = app_create;
+ event_callback.terminate = app_terminate;
+ event_callback.app_control = app_control;
+
+ //setting gcda file location for coverage
+ setenv("GCOV_PREFIX","/tmp",1);
+ dlog_print(DLOG_INFO, "NativeTCT", "[%s:%d] Coverage *.gcda File location set to /tmp/home/abuild/rpmbuild/BUILD/ ", __FUNCTION__, __LINE__);
+
+ dlog_print(DLOG_INFO, "NativeTCT", "[%s:%d] Application Main Function is Invoked", __FUNCTION__, __LINE__);
+ ret = ui_app_main(argc, argv, &event_callback, &ad);
+ if (ret != APP_ERROR_NONE)
+ {
+ dlog_print(DLOG_ERROR, "NativeTCT", "Application ui_app_main call gets failed. err = %d", ret);
+ PRINT_UTC_LOG("\\n[%s][Line : %d]Application ui_app_main call gets failed. err = %d\\n", __FILE__, __LINE__, ret);
+ PRINT_TC_RESULT("%d",1);
+ return ret;
+ }
+
+ dlog_print(DLOG_INFO, "NativeTCT", "[%s:%d] Application Package is Terminated", __FUNCTION__, __LINE__);
+ return ret;
+}
--- /dev/null
+//
+// Copyright (c) 2014 Samsung Electronics Co., Ltd.
+//
+// Licensed under the Apache License, Version 2.0 (the License);
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+//
+#ifndef __TCT_APPLICATION_NATIVE_H__
+#define __TCT_APPLICATION_NATIVE_H__
+
+#include "testcase.h"
+#include "tct_common.h"
+
+extern void ITs_alarm_startup(void);
+extern void ITs_alarm_cleanup(void);
+
+extern int ITc_alarm_schedule_once_after_delay_p(void);
+extern int ITc_alarm_schedule_once_at_date_p(void);
+extern int ITc_alarm_schedule_with_recurrence_week_flag_p(void);
+extern int ITc_alarm_foreach_registered_alarm_p(void);
+extern int ITc_alarm_get_app_control_p(void);
+extern int ITc_alarm_get_scheduled_period_p(void);
+extern int ITc_alarm_get_scheduled_date_p(void);
+extern int ITc_alarm_get_scheduled_recurrence_week_flag_p(void);
+extern int ITc_alarm_cancel_p(void);
+extern int ITc_alarm_cancel_all_p(void);
+extern int ITc_alarm_get_current_time_p(void);
+extern int ITc_alarm_set_get_global_p(void);
+
+testcase tc_array[] = {
+ {"ITc_alarm_schedule_once_after_delay_p", ITc_alarm_schedule_once_after_delay_p, ITs_alarm_startup, ITs_alarm_cleanup},
+ {"ITc_alarm_schedule_once_at_date_p", ITc_alarm_schedule_once_at_date_p, ITs_alarm_startup, ITs_alarm_cleanup},
+ {"ITc_alarm_schedule_with_recurrence_week_flag_p", ITc_alarm_schedule_with_recurrence_week_flag_p, ITs_alarm_startup, ITs_alarm_cleanup},
+ {"ITc_alarm_foreach_registered_alarm_p", ITc_alarm_foreach_registered_alarm_p, ITs_alarm_startup, ITs_alarm_cleanup},
+ {"ITc_alarm_get_app_control_p", ITc_alarm_get_app_control_p, ITs_alarm_startup, ITs_alarm_cleanup},
+ {"ITc_alarm_get_scheduled_period_p", ITc_alarm_get_scheduled_period_p, ITs_alarm_startup, ITs_alarm_cleanup},
+ {"ITc_alarm_get_scheduled_date_p", ITc_alarm_get_scheduled_date_p, ITs_alarm_startup, ITs_alarm_cleanup},
+ {"ITc_alarm_get_scheduled_recurrence_week_flag_p", ITc_alarm_get_scheduled_recurrence_week_flag_p, ITs_alarm_startup, ITs_alarm_cleanup},
+ {"ITc_alarm_cancel_p", ITc_alarm_cancel_p, ITs_alarm_startup, ITs_alarm_cleanup},
+ {"ITc_alarm_cancel_all_p", ITc_alarm_cancel_all_p, ITs_alarm_startup, ITs_alarm_cleanup},
+ {"ITc_alarm_get_current_time_p", ITc_alarm_get_current_time_p, ITs_alarm_startup, ITs_alarm_cleanup},
+ {"ITc_alarm_set_get_global_p", ITc_alarm_set_get_global_p, ITs_alarm_startup, ITs_alarm_cleanup},
+ {NULL, NULL}
+};
+
+#endif // __TCT_APPLICATION_NATIVE_H__
--- /dev/null
+//
+// Copyright (c) 2014 Samsung Electronics Co., Ltd.
+//
+// Licensed under the Apache License, Version 2.0 (the License);
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+//
+#ifndef __TCT_APPLICATION_NATIVE_H__
+#define __TCT_APPLICATION_NATIVE_H__
+
+#include "testcase.h"
+#include "tct_common.h"
+
+extern void ITs_alarm_startup(void);
+extern void ITs_alarm_cleanup(void);
+
+extern int ITc_alarm_schedule_once_after_delay_p(void);
+extern int ITc_alarm_schedule_once_at_date_p(void);
+extern int ITc_alarm_schedule_with_recurrence_week_flag_p(void);
+extern int ITc_alarm_foreach_registered_alarm_p(void);
+extern int ITc_alarm_get_app_control_p(void);
+extern int ITc_alarm_get_scheduled_period_p(void);
+extern int ITc_alarm_get_scheduled_date_p(void);
+extern int ITc_alarm_get_scheduled_recurrence_week_flag_p(void);
+extern int ITc_alarm_cancel_p(void);
+extern int ITc_alarm_cancel_all_p(void);
+extern int ITc_alarm_get_current_time_p(void);
+extern int ITc_alarm_set_get_global_p(void);
+
+testcase tc_array[] = {
+ {"ITc_alarm_schedule_once_after_delay_p", ITc_alarm_schedule_once_after_delay_p, ITs_alarm_startup, ITs_alarm_cleanup},
+ {"ITc_alarm_schedule_once_at_date_p", ITc_alarm_schedule_once_at_date_p, ITs_alarm_startup, ITs_alarm_cleanup},
+ {"ITc_alarm_schedule_with_recurrence_week_flag_p", ITc_alarm_schedule_with_recurrence_week_flag_p, ITs_alarm_startup, ITs_alarm_cleanup},
+ {"ITc_alarm_foreach_registered_alarm_p", ITc_alarm_foreach_registered_alarm_p, ITs_alarm_startup, ITs_alarm_cleanup},
+ {"ITc_alarm_get_app_control_p", ITc_alarm_get_app_control_p, ITs_alarm_startup, ITs_alarm_cleanup},
+ {"ITc_alarm_get_scheduled_period_p", ITc_alarm_get_scheduled_period_p, ITs_alarm_startup, ITs_alarm_cleanup},
+ {"ITc_alarm_get_scheduled_date_p", ITc_alarm_get_scheduled_date_p, ITs_alarm_startup, ITs_alarm_cleanup},
+ {"ITc_alarm_get_scheduled_recurrence_week_flag_p", ITc_alarm_get_scheduled_recurrence_week_flag_p, ITs_alarm_startup, ITs_alarm_cleanup},
+ {"ITc_alarm_cancel_p", ITc_alarm_cancel_p, ITs_alarm_startup, ITs_alarm_cleanup},
+ {"ITc_alarm_cancel_all_p", ITc_alarm_cancel_all_p, ITs_alarm_startup, ITs_alarm_cleanup},
+ {"ITc_alarm_get_current_time_p", ITc_alarm_get_current_time_p, ITs_alarm_startup, ITs_alarm_cleanup},
+ {"ITc_alarm_set_get_global_p", ITc_alarm_set_get_global_p, ITs_alarm_startup, ITs_alarm_cleanup},
+ {NULL, NULL}
+};
+
+#endif // __TCT_APPLICATION_NATIVE_H__
--- /dev/null
+//
+// Copyright (c) 2014 Samsung Electronics Co., Ltd.
+//
+// Licensed under the Apache License, Version 2.0 (the License);
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+//
+#ifndef __TCT_APPLICATION_NATIVE_H__
+#define __TCT_APPLICATION_NATIVE_H__
+
+#include "testcase.h"
+#include "tct_common.h"
+
+extern void ITs_alarm_startup(void);
+extern void ITs_alarm_cleanup(void);
+
+extern int ITc_alarm_schedule_once_after_delay_p(void);
+extern int ITc_alarm_schedule_once_at_date_p(void);
+extern int ITc_alarm_schedule_with_recurrence_week_flag_p(void);
+extern int ITc_alarm_foreach_registered_alarm_p(void);
+extern int ITc_alarm_get_app_control_p(void);
+extern int ITc_alarm_get_scheduled_period_p(void);
+extern int ITc_alarm_get_scheduled_date_p(void);
+extern int ITc_alarm_get_scheduled_recurrence_week_flag_p(void);
+extern int ITc_alarm_cancel_p(void);
+extern int ITc_alarm_cancel_all_p(void);
+extern int ITc_alarm_get_current_time_p(void);
+extern int ITc_alarm_set_get_global_p(void);
+
+testcase tc_array[] = {
+ {"ITc_alarm_schedule_once_after_delay_p", ITc_alarm_schedule_once_after_delay_p, ITs_alarm_startup, ITs_alarm_cleanup},
+ {"ITc_alarm_schedule_once_at_date_p", ITc_alarm_schedule_once_at_date_p, ITs_alarm_startup, ITs_alarm_cleanup},
+ {"ITc_alarm_schedule_with_recurrence_week_flag_p", ITc_alarm_schedule_with_recurrence_week_flag_p, ITs_alarm_startup, ITs_alarm_cleanup},
+ {"ITc_alarm_foreach_registered_alarm_p", ITc_alarm_foreach_registered_alarm_p, ITs_alarm_startup, ITs_alarm_cleanup},
+ {"ITc_alarm_get_app_control_p", ITc_alarm_get_app_control_p, ITs_alarm_startup, ITs_alarm_cleanup},
+ {"ITc_alarm_get_scheduled_period_p", ITc_alarm_get_scheduled_period_p, ITs_alarm_startup, ITs_alarm_cleanup},
+ {"ITc_alarm_get_scheduled_date_p", ITc_alarm_get_scheduled_date_p, ITs_alarm_startup, ITs_alarm_cleanup},
+ {"ITc_alarm_get_scheduled_recurrence_week_flag_p", ITc_alarm_get_scheduled_recurrence_week_flag_p, ITs_alarm_startup, ITs_alarm_cleanup},
+ {"ITc_alarm_cancel_p", ITc_alarm_cancel_p, ITs_alarm_startup, ITs_alarm_cleanup},
+ {"ITc_alarm_cancel_all_p", ITc_alarm_cancel_all_p, ITs_alarm_startup, ITs_alarm_cleanup},
+ {"ITc_alarm_get_current_time_p", ITc_alarm_get_current_time_p, ITs_alarm_startup, ITs_alarm_cleanup},
+ {"ITc_alarm_set_get_global_p", ITc_alarm_set_get_global_p, ITs_alarm_startup, ITs_alarm_cleanup},
+ {NULL, NULL}
+};
+
+#endif // __TCT_APPLICATION_NATIVE_H__
--- /dev/null
+//
+// Copyright (c) 2014 Samsung Electronics Co., Ltd.
+//
+// Licensed under the Apache License, Version 2.0 (the License);
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+//
+#ifndef __TCT_APPLICATION_NATIVE_H__
+#define __TCT_APPLICATION_NATIVE_H__
+
+#include "testcase.h"
+#include "tct_common.h"
+
+extern void ITs_alarm_startup(void);
+extern void ITs_alarm_cleanup(void);
+
+extern int ITc_alarm_schedule_once_after_delay_p(void);
+extern int ITc_alarm_schedule_once_at_date_p(void);
+extern int ITc_alarm_schedule_with_recurrence_week_flag_p(void);
+extern int ITc_alarm_foreach_registered_alarm_p(void);
+extern int ITc_alarm_get_app_control_p(void);
+extern int ITc_alarm_get_scheduled_period_p(void);
+extern int ITc_alarm_get_scheduled_date_p(void);
+extern int ITc_alarm_get_scheduled_recurrence_week_flag_p(void);
+extern int ITc_alarm_cancel_p(void);
+extern int ITc_alarm_cancel_all_p(void);
+extern int ITc_alarm_get_current_time_p(void);
+extern int ITc_alarm_set_get_global_p(void);
+
+testcase tc_array[] = {
+ {"ITc_alarm_schedule_once_after_delay_p", ITc_alarm_schedule_once_after_delay_p, ITs_alarm_startup, ITs_alarm_cleanup},
+ {"ITc_alarm_schedule_once_at_date_p", ITc_alarm_schedule_once_at_date_p, ITs_alarm_startup, ITs_alarm_cleanup},
+ {"ITc_alarm_schedule_with_recurrence_week_flag_p", ITc_alarm_schedule_with_recurrence_week_flag_p, ITs_alarm_startup, ITs_alarm_cleanup},
+ {"ITc_alarm_foreach_registered_alarm_p", ITc_alarm_foreach_registered_alarm_p, ITs_alarm_startup, ITs_alarm_cleanup},
+ {"ITc_alarm_get_app_control_p", ITc_alarm_get_app_control_p, ITs_alarm_startup, ITs_alarm_cleanup},
+ {"ITc_alarm_get_scheduled_period_p", ITc_alarm_get_scheduled_period_p, ITs_alarm_startup, ITs_alarm_cleanup},
+ {"ITc_alarm_get_scheduled_date_p", ITc_alarm_get_scheduled_date_p, ITs_alarm_startup, ITs_alarm_cleanup},
+ {"ITc_alarm_get_scheduled_recurrence_week_flag_p", ITc_alarm_get_scheduled_recurrence_week_flag_p, ITs_alarm_startup, ITs_alarm_cleanup},
+ {"ITc_alarm_cancel_p", ITc_alarm_cancel_p, ITs_alarm_startup, ITs_alarm_cleanup},
+ {"ITc_alarm_cancel_all_p", ITc_alarm_cancel_all_p, ITs_alarm_startup, ITs_alarm_cleanup},
+ {"ITc_alarm_get_current_time_p", ITc_alarm_get_current_time_p, ITs_alarm_startup, ITs_alarm_cleanup},
+ {"ITc_alarm_set_get_global_p", ITc_alarm_set_get_global_p, ITs_alarm_startup, ITs_alarm_cleanup},
+ {NULL, NULL}
+};
+
+#endif // __TCT_APPLICATION_NATIVE_H__