* When the alarm becoms sleeping mode, alarm timer is not expired.
* So using RTC, phone is awaken before alarm rings.
*/
-#define __WAKEUP_USING_RTC__
-#ifdef __WAKEUP_USING_RTC__
#include <errno.h>
#include <linux/rtc.h>
#include <sys/ioctl.h>
#include <fcntl.h>
-#define ALARM_RTC_WAKEUP 0
+#ifdef _APPFW_FEATURE_WAKEUP_USING_RTC
+static const char default_rtc[] = "/dev/rtc";
+static int gfd = -1;
+#endif /*__APPFW_FEATURE_WAKEUP_USING_RTC*/
#ifdef _APPFW_FEATURE_ALARM_MANAGER_MODULE_LOG
#define ALARMMGR_LOG_BUFFER_SIZE 10000
/* link path for timezone info */
#define TIMEZONE_INFO_LINK_PATH tzplatform_mkpath(TZ_SYS_ETC, "localtime")
-static const char default_rtc[] = "/dev/rtc";
-
-static int gfd = -1;
-
-#endif /*__WAKEUP_USING_RTC__*/
-
/* GDBus Declaration */
#define ALARM_MGR_DBUS_PATH "/org/tizen/alarm/manager"
#define ALARM_MGR_DBUS_NAME "org.tizen.alarm.manager"
static void __rtc_set()
{
-#ifdef __WAKEUP_USING_RTC__
+#ifdef _APPFW_FEATURE_WAKEUP_USING_RTC
const char *rtc = default_rtc;
struct tm due_tm;
#ifdef _APPFW_FEATURE_ALARM_MANAGER_MODULE_LOG
ALARM_MGR_EXCEPTION_PRINT("[alarm-server]alarm_context.c_due_time is"
"less than 10 sec. RTC alarm does not need to be set");
}
-#endif /* __WAKEUP_USING_RTC__ */
+#else
+ ALARM_MGR_LOG_PRINT("[alarm-server] RTC does not work.");
+#endif /* _APPFW_FEATURE_WAKEUP_USING_RTC */
return;
}
int __set_time(time_t _time)
{
+#ifdef _APPFW_FEATURE_WAKEUP_USING_RTC
/* Using /dev/alarm, this function changes both OS time and RTC. */
int ret = 0;
const char *rtc0 = default_rtc;
__save_module_log(log_tag, log_message);
#endif
-
+#else
+ ALARM_MGR_LOG_PRINT("[alarm-server] RTC does not work.");
+#endif /* _APPFW_FEATURE_WAKEUP_USING_RTC */
return 1;
}
int year, int mon, int day,
int hour, int min, int sec,
gpointer user_data) {
+ int return_code = ALARMMGR_RESULT_SUCCESS;
+#ifdef _APPFW_FEATURE_WAKEUP_USING_RTC
const char *rtc = default_rtc;
struct rtc_wkalrm rtc_wkalarm;
int retval = 0;
- int return_code = ALARMMGR_RESULT_SUCCESS;
struct tm tm, *alarm_tm = NULL;
#ifdef _APPFW_FEATURE_ALARM_MANAGER_MODULE_LOG
char log_tag[ALARMMGR_LOG_TAG_SIZE] = {0,};
snprintf(log_message, sizeof(log_message), "wakeup rtc time: %d, %s", (int)rtc_time, ctime(&rtc_time));
__save_module_log(log_tag, log_message);
#endif
+#else
+ ALARM_MGR_LOG_PRINT("[alarm-server] RTC does not work.");
+ return_code = ERR_ALARM_SYSTEM_FAIL;
+#endif /* _APPFW_FEATURE_WAKEUP_USING_RTC */
g_dbus_method_invocation_return_value(invoc, g_variant_new("(i)", return_code));
return true;
%description -n libalarm-devel
Alarm server libraries development package (devel)
+%define appfw_feature_wakeup_using_rtc 1
+
+%if "%{?profile}" == "tv"
+%define appfw_feature_wakeup_using_rtc 0
+%endif
%prep
%setup -q
%build
MAJORVER=`echo %{version} | awk 'BEGIN {FS="."}{print $1}'`
+%if 0%{?appfw_feature_wakeup_using_rtc}
+_APPFW_FEATURE_WAKEUP_USING_RTC=ON
+%endif
export CFLAGS="$CFLAGS -DTIZEN_DEBUG_ENABLE"
export CXXFLAGS="$CXXFLAGS -DTIZEN_DEBUG_ENABLE"
_APPFW_FEATURE_ALARM_MANAGER_MODULE_LOG=ON
%endif
-%cmake . -DOBS=1 -DFULLVER=%{version} -DMAJORVER=${MAJORVER} -D_APPFW_FEATURE_ALARM_MANAGER_MODULE_LOG:BOOL=${_APPFW_FEATURE_ALARM_MANAGER_MODULE_LOG}
+%cmake . -DOBS=1 \
+ -DFULLVER=%{version} \
+ -DMAJORVER=${MAJORVER} \
+ -D_APPFW_FEATURE_ALARM_MANAGER_MODULE_LOG:BOOL=${_APPFW_FEATURE_ALARM_MANAGER_MODULE_LOG} \
+ -D_APPFW_FEATURE_WAKEUP_USING_RTC:BOOL=${_APPFW_FEATURE_WAKEUP_USING_RTC}
make %{?jobs:-j%jobs}
ln -sf ../alarm_session_agent.socket %{buildroot}%{_unitdir_user}/sockets.target.wants/alarm-session-agent.socket
mkdir -p %{buildroot}%{_tmpfilesdir}
install -m 0644 %SOURCE4 %{buildroot}%{_tmpfilesdir}/alarm-agent.conf
+%if 0%{?appfw_feature_wakeup_using_rtc}
mkdir -p %{buildroot}%{_libdir}/udev/rules.d
install -m 0644 %SOURCE5 %{buildroot}%{_libdir}/udev/rules.d
+%endif
mkdir -p %{buildroot}%{upgrade_script_path}
cp -f scripts/108.alarmmgr_upgrade.sh %{buildroot}%{upgrade_script_path}
%license LICENSE
%config %{_sysconfdir}/dbus-1/system.d/alarm-service.conf
%{_tmpfilesdir}/alarm-agent.conf
+%if 0%{?appfw_feature_wakeup_using_rtc}
%{_libdir}/udev/rules.d/99-rtc.rules
+%endif
%if 0%{?appfw_feature_alarm_manager_module_log}
%attr(0755,root,root) %{_sysconfdir}/dump.d/module.d/alarmmgr_log_dump.sh
%endif