summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJunghyuk Park <junghyuk.park@samsung.com>2012-02-15 15:32:50 +0900
committerJunghyuk Park <junghyuk.park@samsung.com>2012-02-15 15:32:50 +0900
commitee07542903eb81430558392a2091f19167f15aca (patch)
tree2a6cc72d7885658e9a900473efa69d460cd480e1
parent7ba616c2640bab82e361cb6c2c28f0e69e57d229 (diff)
downloadapplication-ee07542903eb81430558392a2091f19167f15aca.tar.gz
application-ee07542903eb81430558392a2091f19167f15aca.tar.bz2
application-ee07542903eb81430558392a2091f19167f15aca.zip
- Added new functions to Alarm API
- Added version numbering
-rwxr-xr-xCMakeLists.txt7
-rwxr-xr-xdebian/changelog18
-rwxr-xr-xdebian/rules5
-rwxr-xr-xinclude/app_alarm.h19
-rwxr-xr-xsrc/alarm.c29
-rwxr-xr-xsrc/app_main.c178
-rwxr-xr-xsrc/ui_notification.c1
7 files changed, 115 insertions, 142 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 23f92f2..9609168 100755
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -34,6 +34,13 @@ ADD_LIBRARY(${fw_name} SHARED ${SOURCES})
TARGET_LINK_LIBRARIES(${fw_name} ${${fw_name}_LDFLAGS})
+SET_TARGET_PROPERTIES(${fw_name}
+ PROPERTIES
+ VERSION ${FULLVER}
+ SOVERSION ${MAJORVER}
+ CLEAN_DIRECT_OUTPUT 1
+)
+
INSTALL(TARGETS ${fw_name} DESTINATION lib)
INSTALL(
DIRECTORY ${INC_DIR}/ DESTINATION include/appfw
diff --git a/debian/changelog b/debian/changelog
index f7f9fcd..5258d7f 100755
--- a/debian/changelog
+++ b/debian/changelog
@@ -1,3 +1,21 @@
+capi-appfw-application (0.1.0-17) unstable; urgency=low
+
+ * Added version numbering
+ * Git: api/application
+ * Tag: capi-appfw-application_0.1.0-17
+
+ -- Junghyuk Park <junghyuk.park@samsung.com> Wed, 15 Feb 2012 10:43:30 +0900
+
+capi-appfw-application (0.1.0-16) unstable; urgency=low
+
+ * Refactoring code
+ * Add alarm_get_service() API
+ * Add ALARM_ERROR_OUT_OF_MEMORY error code
+ * Git: api/application
+ * Tag: capi-appfw-application_0.1.0-16
+
+ -- Junghyuk Park <junghyuk.park@samsung.com> Mon, 13 Feb 2012 11:52:20 +0300
+
capi-appfw-application (0.1.0-15) unstable; urgency=low
* Fixed invalid parameter
diff --git a/debian/rules b/debian/rules
index 7d6131a..9313173 100755
--- a/debian/rules
+++ b/debian/rules
@@ -10,10 +10,13 @@ endif
CMAKE_ROOT_DIR ?= $(CURDIR)
CMAKE_BUILD_DIR ?= $(CURDIR)/cmake_build_tmp
+FULLVER ?= $(shell dpkg-parsechangelog | grep Version: | cut -d ' ' -f 2 | cut -d '-' -f 1)
+MAJORVER ?= $(shell echo $(FULLVER) | cut -d '.' -f 1)
+
configure: configure-stamp
configure-stamp:
dh_testdir
- mkdir -p $(CMAKE_BUILD_DIR) && cd $(CMAKE_BUILD_DIR) && cmake ..
+ mkdir -p $(CMAKE_BUILD_DIR) && cd $(CMAKE_BUILD_DIR) && cmake .. -DFULLVER=${FULLVER} -DMAJORVER=${MAJORVER}
touch configure-stamp
diff --git a/include/app_alarm.h b/include/app_alarm.h
index 2002e93..ff200d9 100755
--- a/include/app_alarm.h
+++ b/include/app_alarm.h
@@ -45,7 +45,8 @@ typedef enum
ALARM_ERROR_INVALID_PARAMETER = TIZEN_ERROR_INVALID_PARAMETER, /**< Invalid parameter */
ALARM_ERROR_INVALID_TIME = TIZEN_ERROR_APPLICATION_CLASS | 0x05, /**< Invalid time */
ALARM_ERROR_INVALID_DATE = TIZEN_ERROR_APPLICATION_CLASS | 0x06, /**< Invalid date */
- ALARM_ERROR_CONNECTION_FAIL = TIZEN_ERROR_APPLICATION_CLASS | 0x07 /**< The alarm service connection failed */
+ ALARM_ERROR_CONNECTION_FAIL = TIZEN_ERROR_APPLICATION_CLASS | 0x07, /**< The alarm service connection failed */
+ ALARM_ERROR_OUT_OF_MEMORY = TIZEN_ERROR_OUT_OF_MEMORY /**< Out of memory */
} alarm_error_e;
@@ -255,6 +256,22 @@ int alarm_get_scheduled_period(int alarm_id, int *period);
*/
int alarm_get_current_time(struct tm *date);
+
+/**
+ * @brief Gets the service to be invoked when the the alarm is triggered
+ * @remarks The @a service must be released with service_destroy() by you.
+ * @param[in] alarm_id The alarm ID uniquely identifies an alarm
+ * @param[out] service The service handle to launch when the alarm is triggered
+ * @return 0 on success, otherwise a negative error value.
+ * @retval #ALARM_ERROR_NONE Successful
+ * @retval #ALARM_ERROR_INVALID_PARAMETER Invalid parameter
+ * @retval #ALARM_ERROR_OUT_OF_MEMORY Out of memory
+ * @see alarm_schedule_at_date()
+ * @see alarm_schedule_after_delay()
+ * @see alarm_schedule_with_recurrence_week_flag()
+ */
+int alarm_get_service(int alarm_id, service_h *service);
+
/**
* @}
*/
diff --git a/src/alarm.c b/src/alarm.c
index ea2b4d0..595e8a2 100755
--- a/src/alarm.c
+++ b/src/alarm.c
@@ -484,3 +484,32 @@ int alarm_get_scheduled_recurrence_week_flag(int alarm_id, int *week_flag)
return ALARM_ERROR_NONE;
}
+int alarm_get_service(int alarm_id, service_h *service)
+{
+ bundle *b = NULL;
+ int error_code = 0;
+
+ b = alarmmgr_get_alarm_appsvc_info(alarm_id, &error_code);
+
+ if(error_code != ALARMMGR_RESULT_SUCCESS)
+ {
+ return convert_error_code_to_alarm(__FUNCTION__, error_code);
+ }
+
+ if(b == NULL)
+ {
+ return ALARM_ERROR_INVALID_PARAMETER;
+ }
+
+ error_code = service_create_request(b, service);
+
+ if(error_code != SERVICE_ERROR_NONE)
+ {
+ return ALARM_ERROR_OUT_OF_MEMORY;
+ }
+
+ bundle_free(b);
+
+ return ALARM_ERROR_NONE;
+
+} \ No newline at end of file
diff --git a/src/app_main.c b/src/app_main.c
index dd715e1..84369d3 100755
--- a/src/app_main.c
+++ b/src/app_main.c
@@ -70,7 +70,7 @@ static int app_cb_broker_appcore_rotation_event(enum appcore_rm rm, void *data);
static int app_cb_broker_appcore_lang_changed(void *data);
static int app_cb_broker_appcore_region_changed(void *data);
-static void app_set_appcore_event_cb(app_context_h app_context);
+static void app_set_appcore_event_cb(void);
static void app_unset_appcore_event_cb(void);
static struct app_context_s app_context = {
@@ -117,7 +117,6 @@ int app_efl_main(int *argc, char ***argv, app_event_callback_s *callback, void *
char *package = NULL;;
char *project_name = NULL;
- // STEP 1 : input parameter
if (argc == NULL || argv == NULL || callback == NULL)
{
LOGE("[%s] INVALID_PARAMETER(0x%08x)", __FUNCTION__, APP_ERROR_INVALID_PARAMETER);
@@ -130,14 +129,12 @@ int app_efl_main(int *argc, char ***argv, app_event_callback_s *callback, void *
return APP_ERROR_INVALID_PARAMETER;
}
- // STEP 2 : app-state
if (app_context.state != APP_STATE_NOT_RUNNING)
{
LOGE("[%s] ALREADY_RUNNING(0x%08x)", __FUNCTION__, APP_ERROR_ALREADY_RUNNING);
return APP_ERROR_ALREADY_RUNNING;
}
- // STEP 3 : package. project_name
if (app_get_package(&package) != 0)
{
LOGE("[%s] INVALID_CONTEXT(0x%08x)", __FUNCTION__, APP_ERROR_INVALID_CONTEXT);
@@ -154,16 +151,12 @@ int app_efl_main(int *argc, char ***argv, app_event_callback_s *callback, void *
app_context.project_name = project_name;
- // STEP 4 : set app-context
app_context.state = APP_STATE_CREATING;
app_context.callbacks = callback;
app_context.user_data = user_data;
- app_context.appcore.data = &app_context;
- // STEP 5 : start appcore-main
appcore_efl_main(app_context.project_name, argc, argv, &(app_context.appcore));
- // STEP 6 : reset app-context
app_reset_app_context();
return APP_ERROR_NONE;
@@ -174,31 +167,31 @@ void app_efl_exit(void)
elm_exit();
}
-static void app_set_appcore_event_cb(app_context_h app_context)
+static void app_set_appcore_event_cb()
{
- if (app_context->callbacks->low_memory != NULL)
+ if (app_context.callbacks->low_memory != NULL)
{
- appcore_set_event_callback(APPCORE_EVENT_LOW_MEMORY, app_cb_broker_appcore_low_memory, app_context);
+ appcore_set_event_callback(APPCORE_EVENT_LOW_MEMORY, app_cb_broker_appcore_low_memory, NULL);
}
- if (app_context->callbacks->low_battery != NULL)
+ if (app_context.callbacks->low_battery != NULL)
{
- appcore_set_event_callback(APPCORE_EVENT_LOW_BATTERY, app_cb_broker_appcore_low_battery, app_context);
+ appcore_set_event_callback(APPCORE_EVENT_LOW_BATTERY, app_cb_broker_appcore_low_battery, NULL);
}
- if (app_context->callbacks->device_orientation != NULL)
+ if (app_context.callbacks->device_orientation != NULL)
{
- appcore_set_rotation_cb(app_cb_broker_appcore_rotation_event, app_context);
+ appcore_set_rotation_cb(app_cb_broker_appcore_rotation_event, NULL);
}
- if (app_context->callbacks->language_changed != NULL)
+ if (app_context.callbacks->language_changed != NULL)
{
- appcore_set_event_callback(APPCORE_EVENT_LANG_CHANGE, app_cb_broker_appcore_lang_changed, app_context);
+ appcore_set_event_callback(APPCORE_EVENT_LANG_CHANGE, app_cb_broker_appcore_lang_changed, NULL);
}
- if (app_context->callbacks->region_format_changed != NULL)
+ if (app_context.callbacks->region_format_changed != NULL)
{
- appcore_set_event_callback(APPCORE_EVENT_REGION_CHANGE, app_cb_broker_appcore_region_changed, app_context);
+ appcore_set_event_callback(APPCORE_EVENT_REGION_CHANGE, app_cb_broker_appcore_region_changed, NULL);
}
}
@@ -214,28 +207,19 @@ static void app_unset_appcore_event_cb(void)
int app_cb_broker_appcore_create(void *data)
{
- app_context_h app_context;
app_create_cb create_cb;
char locale_dir[TIZEN_PATH_MAX] = {0, };
- app_context = (app_context_h)data;
+ app_set_appcore_event_cb();
- if (app_context == NULL)
- {
- LOGE("[%s] invalid app-context", __FUNCTION__);
- return -1;
- }
-
- app_set_appcore_event_cb(app_context);
+ snprintf(locale_dir, TIZEN_PATH_MAX, PATH_FMT_LOCALE_DIR, app_context.package);
+ appcore_set_i18n(app_context.project_name, locale_dir);
- snprintf(locale_dir, TIZEN_PATH_MAX, PATH_FMT_LOCALE_DIR, app_context->package);
- appcore_set_i18n(app_context->project_name, locale_dir);
+ create_cb = app_context.callbacks->create;
- create_cb = app_context->callbacks->create;
-
- if (create_cb != NULL && create_cb(app_context->user_data) == true)
+ if (create_cb != NULL && create_cb(app_context.user_data) == true)
{
- app_context->state = APP_STATE_RUNNING;
+ app_context.state = APP_STATE_RUNNING;
return 0;
}
@@ -244,41 +228,29 @@ int app_cb_broker_appcore_create(void *data)
int app_cb_broker_appcore_terminate(void *data)
{
- app_context_h app_context;
app_terminate_cb terminate_cb;
int i;
- app_context = (app_context_h)data;
-
- if (app_context == NULL)
- {
- LOGE("[%s] invalid app-context", __FUNCTION__);
- return -1;
- }
-
- // STEP 1 : user event-callback
- terminate_cb = app_context->callbacks->terminate;
+ terminate_cb = app_context.callbacks->terminate;
if (terminate_cb != NULL)
{
- terminate_cb(app_context->user_data);
+ terminate_cb(app_context.user_data);
}
- // STEP 2 : appcore event-callback
app_unset_appcore_event_cb();
- // STEP 3 : terminate task
for (i=0; i<TERMINATE_TASK_MAX; i++)
{
- if (app_context->terminate_task[i].cb != NULL)
+ if (app_context.terminate_task[i].cb != NULL)
{
app_terminate_task_cb task_cb;
- task_cb = app_context->terminate_task[i].cb;
+ task_cb = app_context.terminate_task[i].cb;
if (task_cb != NULL)
{
- task_cb(app_context->terminate_task[i].data);
+ task_cb(app_context.terminate_task[i].data);
}
}
}
@@ -288,22 +260,13 @@ int app_cb_broker_appcore_terminate(void *data)
int app_cb_broker_appcore_pause(void *data)
{
- app_context_h app_context;
app_pause_cb pause_cb;
- app_context = (app_context_h)data;
-
- if (app_context == NULL)
- {
- LOGE("[%s] invalid app-context", __FUNCTION__);
- return -1;
- }
-
- pause_cb = app_context->callbacks->pause;
+ pause_cb = app_context.callbacks->pause;
if (pause_cb != NULL)
{
- pause_cb(app_context->user_data);
+ pause_cb(app_context.user_data);
}
return 0;
@@ -311,22 +274,13 @@ int app_cb_broker_appcore_pause(void *data)
int app_cb_broker_appcore_resume(void *data)
{
- app_context_h app_context;
app_resume_cb resume_cb;
- app_context = (app_context_h)data;
-
- if (app_context == NULL)
- {
- LOGE("[%s] invalid app-context", __FUNCTION__);
- return -1;
- }
-
- resume_cb = app_context->callbacks->resume;
+ resume_cb = app_context.callbacks->resume;
if (resume_cb != NULL)
{
- resume_cb(app_context->user_data);
+ resume_cb(app_context.user_data);
}
return 0;
@@ -335,29 +289,20 @@ int app_cb_broker_appcore_resume(void *data)
int app_cb_broker_appcore_reset(bundle *appcore_bundle, void *data)
{
- app_context_h app_context;
app_service_cb service_cb;
service_h service;
- app_context = (app_context_h)data;
-
- if (app_context == NULL)
- {
- LOGE("[%s] invalid app-context", __FUNCTION__);
- return -1;
- }
-
if (service_create_event(appcore_bundle, &service) != 0)
{
LOGE("[%s] fail to create service handle from bundle", __FUNCTION__);
return -1;
}
- service_cb = app_context->callbacks->service;
+ service_cb = app_context.callbacks->service;
if (service_cb != NULL)
{
- service_cb(service, app_context->user_data);
+ service_cb(service, app_context.user_data);
}
service_destroy(service);
@@ -368,22 +313,13 @@ int app_cb_broker_appcore_reset(bundle *appcore_bundle, void *data)
int app_cb_broker_appcore_low_memory(void *data)
{
- app_context_h app_context;
app_low_memory_cb low_memory_cb;
- app_context = (app_context_h)data;
-
- if (app_context == NULL)
- {
- LOGE("[%s] invalid app-context", __FUNCTION__);
- return -1;
- }
-
- low_memory_cb = app_context->callbacks->low_memory;
+ low_memory_cb = app_context.callbacks->low_memory;
if (low_memory_cb != NULL)
{
- low_memory_cb(app_context->user_data);
+ low_memory_cb(app_context.user_data);
}
return 0;
@@ -391,22 +327,13 @@ int app_cb_broker_appcore_low_memory(void *data)
int app_cb_broker_appcore_low_battery(void *data)
{
- app_context_h app_context;
app_low_battery_cb low_battery_cb;
- app_context = (app_context_h)data;
-
- if (app_context == NULL)
- {
- LOGE("[%s] invalid app-context", __FUNCTION__);
- return -1;
- }
-
- low_battery_cb = app_context->callbacks->low_battery;
+ low_battery_cb = app_context.callbacks->low_battery;
if (low_battery_cb != NULL)
{
- low_battery_cb(app_context->user_data);
+ low_battery_cb(app_context.user_data);
}
return 0;
@@ -414,18 +341,9 @@ int app_cb_broker_appcore_low_battery(void *data)
int app_cb_broker_appcore_rotation_event(enum appcore_rm rm, void *data)
{
- app_context_h app_context;
app_device_orientation_cb device_orientation_cb;
- app_context = (app_context_h)data;
-
- if (app_context == NULL)
- {
- LOGE("[%s] invalid app-context", __FUNCTION__);
- return -1;
- }
-
- device_orientation_cb = app_context->callbacks->device_orientation;
+ device_orientation_cb = app_context.callbacks->device_orientation;
if (device_orientation_cb != NULL)
{
@@ -433,7 +351,7 @@ int app_cb_broker_appcore_rotation_event(enum appcore_rm rm, void *data)
dev_orientation = app_convert_appcore_rm(rm);
- device_orientation_cb(dev_orientation, app_context->user_data);
+ device_orientation_cb(dev_orientation, app_context.user_data);
}
return 0;
@@ -441,22 +359,13 @@ int app_cb_broker_appcore_rotation_event(enum appcore_rm rm, void *data)
int app_cb_broker_appcore_lang_changed(void *data)
{
- app_context_h app_context;
app_language_changed_cb lang_changed_cb;
- app_context = (app_context_h)data;
-
- if (app_context == NULL)
- {
- LOGE("[%s] invalid app-context", __FUNCTION__);
- return -1;
- }
-
- lang_changed_cb = app_context->callbacks->language_changed;
+ lang_changed_cb = app_context.callbacks->language_changed;
if (lang_changed_cb != NULL)
{
- lang_changed_cb(app_context->user_data);
+ lang_changed_cb(app_context.user_data);
}
return 0;
@@ -464,22 +373,13 @@ int app_cb_broker_appcore_lang_changed(void *data)
int app_cb_broker_appcore_region_changed(void *data)
{
- app_context_h app_context;
app_region_format_changed_cb region_changed_cb;
- app_context = (app_context_h)data;
-
- if (app_context == NULL)
- {
- LOGE("[%s] invalid app-context", __FUNCTION__);
- return -1;
- }
-
- region_changed_cb = app_context->callbacks->region_format_changed;
+ region_changed_cb = app_context.callbacks->region_format_changed;
if (region_changed_cb != NULL)
{
- region_changed_cb(app_context->user_data);
+ region_changed_cb(app_context.user_data);
}
return 0;
diff --git a/src/ui_notification.c b/src/ui_notification.c
index 0129eb8..2b54902 100755
--- a/src/ui_notification.c
+++ b/src/ui_notification.c
@@ -689,7 +689,6 @@ int ui_notification_post(ui_notification_h notification)
return UI_NOTIFICATION_ERROR_INVALID_STATE;
}
- // STEP 1: notification handle
if (notification->ongoing == true)
{
notification->raw_handle = notification_new(NOTIFICATION_TYPE_ONGOING, NOTIFICATION_GROUP_ID_DEFAULT, NOTIFICATION_PRIV_ID_NONE);