INSTALL(FILES ${CMAKE_CURRENT_SOURCE_DIR}/alarmmgr_log_dump.sh DESTINATION ${SYSCONF_INSTALL_DIR}/dump.d/module.d/)
ENDIF(_APPFW_FEATURE_ALARM_MANAGER_MODULE_LOG)
INSTALL(FILES ${CMAKE_CURRENT_SOURCE_DIR}/alarm-service.conf DESTINATION ${SYSCONF_INSTALL_DIR}/dbus-1/system.d/)
+
+CONFIGURE_FILE(org.tizen.alarm.manager.service.in org.tizen.alarm.manager.service @ONLY)
+INSTALL(FILES ${CMAKE_CURRENT_SOURCE_DIR}/org.tizen.alarm.manager.service DESTINATION ${SHARE_INSTALL_PREFIX}/dbus-1/system-services/)
int dur = entry->requested_interval;
int from, to;
- if (!(alarm->alarm_type & ALARM_TYPE_PERIOD) || entry->method == CUT_OFF)
+ if (dur == 0 || !(alarm->alarm_type & ALARM_TYPE_PERIOD) || entry->method == CUT_OFF)
return false;
ts_tm.tm_hour = alarm->start.hour;
{
GPollFD *gpollfd = (GPollFD *) user_data;
uint64_t exp;
+ time_t current_time;
+
if (gpollfd == NULL) {
ALARM_MGR_EXCEPTION_PRINT("gpollfd is NULL");
return false;
_alarm_schedule();
+ /*
+ * Previous alarm can be expired late as tolerance of RTC.
+ * In this case, Expire alarms forcibly if real duetime is same to current time.
+ */
+ time(¤t_time);
+ if (alarm_context.c_due_time == current_time) {
+ ALARM_MGR_LOG_PRINT("Expire alarms forcibly when duetime is same to current time(%d).", current_time)
+ __alarm_expired();
+ _alarm_schedule();
+ }
+
__rtc_set();
ALARM_MGR_LOG_PRINT("Unlock the display from LCD OFF");
g_dbus_connection_flush_sync(alarm_context.connection, NULL, NULL);
g_object_unref(msg);
- g_object_unref(reply);
+ if (reply)
+ g_object_unref(reply);
return ret;
}
g_dbus_connection_flush_sync(alarm_context.connection, NULL, NULL);
g_object_unref(msg);
- g_object_unref(reply);
+ if (reply)
+ g_object_unref(reply);
return ret;
}
src = g_source_new(&funcs, sizeof(GSource));
gpollfd = (GPollFD *) g_malloc(sizeof(GPollFD));
+ if (gpollfd == NULL) {
+ ALARM_MGR_EXCEPTION_PRINT("Out of memory\n");
+ exit(1);
+ }
gpollfd->events = POLLIN;
gpollfd->fd = fd;
--- /dev/null
+[D-BUS Service]
+Name=org.tizen.alarm.manager
+Exec=/bin/false
+SystemdService=alarm-server.service
+User=root
%attr(0755,root,root) %{_bindir}/alarm-server
%attr(0644,root,root) %{_unitdir}/alarm-server.service
%{_unitdir}/multi-user.target.wants/alarm-server.service
+%attr(0644,root,root) %{_datadir}/dbus-1/system-services/org.tizen.alarm.manager.service
%license LICENSE
%config %{_sysconfdir}/dbus-1/system.d/alarm-service.conf
%if 0%{?appfw_feature_alarm_manager_module_log}
After=system-server.service
[Service]
+BusName=org.tizen.alarm.manager
+Type=dbus
ExecStart=/usr/bin/alarm-server
TimeoutStopSec=3s
Restart=always
return true;
}
+bool _send_alarm_set_time(alarm_context_t context, int new_time, int *error_code)
+{
+ GError *error = NULL;
+ int return_code = 0;
+
+ if (!alarm_manager_call_alarm_set_time_sync((AlarmManager *)context.proxy, new_time, &return_code, NULL, &error)) {
+ /*g_dbus_proxy_call_sync error */
+ /*error_code should be set */
+ ALARM_MGR_EXCEPTION_PRINT("alarm_manager_call_alarm_set_time_sync() failed by dbus. return_code[%d]", return_code);
+ if (error) {
+ ALARM_MGR_EXCEPTION_PRINT("dbus error message: %s", error->message);
+ g_error_free(error);
+ }
+ if (error_code) {
+ *error_code = ERR_ALARM_SYSTEM_FAIL;
+ }
+ return false;
+ }
+
+ if (return_code != ALARMMGR_RESULT_SUCCESS) {
+ if (error_code) {
+ *error_code = return_code;
+ }
+ return false;
+ }
+
+ return true;
+}
+
+
bool _send_alarm_set_time_with_propagation_delay(alarm_context_t context, unsigned int new_sec, unsigned int new_nsec, unsigned int req_sec, unsigned int req_nsec, int *error_code)
{
GError *error = NULL;
int error_code;
int ret;
alarm_cb_info_t *info;
- alarm_info_t alarm;
ret = __sub_init();
if (ret < 0)
EXPORT_API int alarmmgr_set_systime(int new_time)
{
int error_code;
- struct timespec req_time = {0,};
ALARM_MGR_LOG_PRINT("[alarm-lib]:alarmmgr_set_systime(%d) is called.", new_time);
if (__sub_init() < 0) {
return ERR_ALARM_SYSTEM_FAIL;
}
- clock_gettime(CLOCK_REALTIME, &req_time);
- if (!_send_alarm_set_time_with_propagation_delay(alarm_context, new_time, 0, req_time.tv_sec, req_time.tv_nsec, &error_code)) {
- ALARM_MGR_EXCEPTION_PRINT("Failed to set time with propagation delay. error: %d", error_code);
+ if (!_send_alarm_set_time(alarm_context, new_time, &error_code)) {
+ ALARM_MGR_EXCEPTION_PRINT("Failed to set time. error: %d", error_code);
return error_code;
}