SET(INC_DIR include)
INCLUDE_DIRECTORIES(${INC_DIR})
-SET(requires "dlog bundle appcore-common appcore-efl aul ail appsvc notification elementary capi-base-common alarm-service sqlite3")
-SET(pc_requires "capi-base-common")
+SET(requires "dlog bundle appcore-common appcore-efl aul elementary capi-base-common vconf-internal-keys")
+SET(pc_requires "capi-base-common capi-appfw-app-control capi-appfw-app-common")
INCLUDE(FindPkgConfig)
pkg_check_modules(${fw_name} REQUIRED ${requires})
ADD_DEFINITIONS("-DPREFIX=\"${CMAKE_INSTALL_PREFIX}\"")
ADD_DEFINITIONS("-DSLP_DEBUG")
-SET(CMAKE_EXE_LINKER_FLAGS "-Wl,--as-needed -Wl,--rpath=/usr/lib")
+IF(_APPFW_FEATURE_PROCESS_POOL)
+ ADD_DEFINITIONS("-D_APPFW_FEATURE_PROCESS_POOL")
+ENDIF(_APPFW_FEATURE_PROCESS_POOL)
+
+SET(CMAKE_EXE_LINKER_FLAGS "-Wl,--as-needed -Wl,--rpath=/usr/lib -Wl,--no-undefined")
aux_source_directory(src SOURCES)
ADD_LIBRARY(${fw_name} SHARED ${SOURCES})
-TARGET_LINK_LIBRARIES(${fw_name} ${${fw_name}_LDFLAGS})
+ADD_SUBDIRECTORY(app_control)
+ADD_SUBDIRECTORY(app_common)
+ADD_SUBDIRECTORY(alarm)
+ADD_SUBDIRECTORY(preference)
+
+TARGET_LINK_LIBRARIES(${fw_name} capi-appfw-app-control capi-appfw-app-common ${${fw_name}_LDFLAGS})
SET_TARGET_PROPERTIES(${fw_name}
PROPERTIES
SET(PC_LDFLAGS -l${fw_name})
CONFIGURE_FILE(
- capi-appfw-application.pc.in
+ capi-appfw-module.pc.in
${CMAKE_CURRENT_SOURCE_DIR}/${fw_name}.pc
@ONLY
)
/testcase/utc_app
-/testcase/utc_storage
/testcase/utc_service
/testcase/utc_i18n
/testcase/utc_preference
/testcase/utc_alarm
-/testcase/utc_ui_notification
* 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.
+ * limitations under the License.
*/
static void utc_alarm_get_scheduled_recurrence_week_flag_negative(void);
static void utc_alarm_get_current_time_positive(void);
static void utc_alarm_get_current_time_negative(void);
-static void utc_alarm_get_service_positive(void);
-static void utc_alarm_get_service_negative(void);
+static void utc_alarm_get_app_control_positive(void);
+static void utc_alarm_get_app_control_negative(void);
{ utc_alarm_get_scheduled_recurrence_week_flag_negative, 2 },
{ utc_alarm_get_current_time_positive, 1 },
{ utc_alarm_get_current_time_negative, 2 },
- { utc_alarm_get_service_positive, 1 },
- { utc_alarm_get_service_negative, 2 },
+ { utc_alarm_get_app_control_positive, 1 },
+ { utc_alarm_get_app_control_negative, 2 },
{ NULL, 0 },
};
}
dts_message("utc_alarm_foreach_registered_alarm_positive", "registered id = %d callback id = %d", alarm, tid);
-
+
return true;
}
{
time_t current_time;
struct tm current_tm;
- service_h service;
+ app_control_h app_control;
int tid;
GMainLoop *loop;
int ret = ALARM_ERROR_NONE;
- service_create(&service);
- service_set_operation(service, SERVICE_OPERATION_DEFAULT);
- service_set_package(service, "com.samsung.memo");
-
+ app_control_create(&app_control);
+ app_control_set_operation(app_control, SERVICE_OPERATION_DEFAULT);
+ app_control_set_package(app_control, "org.tizen.memo");
+
loop = g_main_loop_new(NULL, FALSE);
- g_timeout_add(5000,timeout , loop);
-
- ret = alarm_schedule_after_delay(service, 1, 1, &tid);
-
+ g_timeout_add(5000,timeout , loop);
+
+ ret = alarm_schedule_after_delay(app_control, 1, 1, &tid);
+
g_main_loop_run(loop);
-
+
if(ret == ALARM_ERROR_NONE)
{
dts_pass("utc_alarm_schedule_after_delay_positive", "passed");
{
dts_fail("utc_alarm_schedule_after_delay_positive", "failed");
}
-
- service_destory(service);
+
+ app_control_destory(app_control);
alarm_cancel_all();
}
{
time_t current_time;
struct tm current_tm;
- service_h service;
+ app_control_h app_control;
int ret = ALARM_ERROR_NONE;
int tid;
GMainLoop *loop;
- service_create(&service);
- service_set_package(service, "com.samsung.memo");
- service_set_operation(service, SERVICE_OPERATION_DEFAULT);
-
- ret = alarm_schedule_after_delay(service, 1, 1, NULL);
+ app_control_create(&app_control);
+ app_control_set_package(app_control, "org.tizen.memo");
+ app_control_set_operation(app_control, SERVICE_OPERATION_DEFAULT);
+
+ ret = alarm_schedule_after_delay(app_control, 1, 1, NULL);
g_main_loop_run(loop);
{
dts_pass("utc_alarm_schedule_after_delay_negative", "passed");
}
-
- service_destory(service);
+
+ app_control_destory(app_control);
alarm_cancel_all();
}
{
time_t current_time;
struct tm current_tm;
- service_h service;
+ app_control_h app_control;
int ret = ALARM_ERROR_NONE;
int tid;
GMainLoop *loop;
- service_create(&service);
- service_set_package(service, "com.samsung.memo");
- service_set_operation(service, SERVICE_OPERATION_DEFAULT);
+ app_control_create(&app_control);
+ app_control_set_package(app_control, "org.tizen.memo");
+ app_control_set_operation(app_control, SERVICE_OPERATION_DEFAULT);
loop = g_main_loop_new(NULL, FALSE);
g_timeout_add(5000,timeout , loop);
-
- ret = alarm_schedule_after_delay(service, 1, 1, &tid);
+
+ ret = alarm_schedule_after_delay(app_control, 1, 1, &tid);
ret = alarm_cancel(tid);
g_main_loop_run(loop);
-
+
if(ret == ALARM_ERROR_NONE)
{
dts_pass("utc_alarm_cancel_positive", "passed");
{
dts_fail("utc_alarm_cancel_positive", "passed");
}
-
- service_destory(service);
+
+ app_control_destory(app_control);
alarm_cancel_all();
}
static void utc_alarm_cancel_negative(void)
{
int ret = ALARM_ERROR_NONE;
-
+
ret = alarm_cancel(NULL);
if(ret == ALARM_ERROR_NONE)
{
int ret = ALARM_ERROR_NONE;
time_t current_time;
struct tm current_tm;
- service_h service;
+ app_control_h app_control;
int tid;
GMainLoop *loop;
loop = g_main_loop_new(NULL, FALSE);
g_timeout_add(1000,timeout , loop);
-
- service_create(&service);
- service_set_package(service, "com.samsung.memo");
- service_set_operation(service, SERVICE_OPERATION_DEFAULT);
- alarm_schedule_after_delay(service, 1, 5, &tid);
-
+
+ app_control_create(&app_control);
+ app_control_set_package(app_control, "org.tizen.memo");
+ app_control_set_operation(app_control, SERVICE_OPERATION_DEFAULT);
+ alarm_schedule_after_delay(app_control, 1, 5, &tid);
+
ret = alarm_foreach_registered_alarm(foreach_alarm_cb,NULL);
g_main_loop_run(loop);
{
dts_pass("utc_alarm_foreach_registered_alarm_positive" , "passed");
}
-
- service_destory(service);
+
+ app_control_destory(app_control);
alarm_cancel_all();
}
static void utc_alarm_foreach_registered_alarm_negative(void)
{
int ret = ALARM_ERROR_NONE;
-
+
// do i need to call alarm_init??
ret = alarm_foreach_registered_alarm(NULL,NULL);
static void utc_alarm_get_scheduled_date_positive(void)
{
struct tm date;
- service_h service;
+ app_control_h app_control;
int ret = ALARM_ERROR_NONE;
int tid;
GMainLoop *loop;
loop = g_main_loop_new(NULL, FALSE);
g_timeout_add(5000,timeout , loop);
- service_create(&service);
- service_set_package(service, "com.samsung.memo");
- service_set_operation(service, SERVICE_OPERATION_DEFAULT);
- alarm_schedule_after_delay(service, 1, 5, &tid);
+ app_control_create(&app_control);
+ app_control_set_package(app_control, "org.tizen.memo");
+ app_control_set_operation(app_control, SERVICE_OPERATION_DEFAULT);
+ alarm_schedule_after_delay(app_control, 1, 5, &tid);
ret = alarm_get_scheduled_date(tid, &date);
{
dts_fail("utc_alarm_get_date_positive", "failed");
}
-
- service_destory(service);
+
+ app_control_destory(app_control);
alarm_cancel_all();
}
{
struct tm date;
int ret = ALARM_ERROR_NONE;
-
+
ret = alarm_get_scheduled_date(NULL, &date);
if(ret == ALARM_ERROR_NONE)
{
time_t current_time;
struct tm current_tm;
- service_h service;
+ app_control_h app_control;
int ret = ALARM_ERROR_NONE;
int period = 0;
int tid;
loop = g_main_loop_new(NULL, FALSE);
g_timeout_add(1000,timeout , loop);
- service_create(&service);
- service_set_package(service, "com.samsung.memo");
- service_set_operation(service, SERVICE_OPERATION_DEFAULT);
- alarm_schedule_after_delay(service, 1, 1, &tid);
+ app_control_create(&app_control);
+ app_control_set_package(app_control, "org.tizen.memo");
+ app_control_set_operation(app_control, SERVICE_OPERATION_DEFAULT);
+ alarm_schedule_after_delay(app_control, 1, 1, &tid);
ret = alarm_get_scheduled_period(tid, &period);
dts_fail("utc_alarm_get_scheduled_period_positive", "failed");
}
- service_destory(service);
+ app_control_destory(app_control);
alarm_cancel_all();
}
time_t current_time;
struct tm date;
time_t now;
- service_h service;
+ app_control_h app_control;
int tid;
GMainLoop *loop;
time(&now);
localtime_r(&now, &date);
-
+
date.tm_sec += 3;
- service_create(&service);
- service_set_package(service, "com.samsung.memo");
- service_set_operation(service, SERVICE_OPERATION_DEFAULT);
+ app_control_create(&app_control);
+ app_control_set_package(app_control, "org.tizen.memo");
+ app_control_set_operation(app_control, SERVICE_OPERATION_DEFAULT);
- ret = alarm_schedule_at_date(service, &date, 2, &tid);
+ ret = alarm_schedule_at_date(app_control, &date, 2, &tid);
g_main_loop_run(loop);
if(ret == ALARM_ERROR_NONE)
{
dts_pass("utc_alarm_schedule_at_date_positive", "passed");
-
+
}
else
{
dts_fail("utc_alarm_schedule_at_date_positive", "failed");
}
- service_destory(service);
+ app_control_destory(app_control);
alarm_cancel_all();
}
time_t current_time;
struct tm current_tm;
int ret = ALARM_ERROR_NONE;
- service_h service;
-
- service_create(&service);
- service_set_package(service, "com.samsung.memo");
- service_set_operation(service, SERVICE_OPERATION_DEFAULT);
- ret = alarm_schedule_at_date(service, NULL, 1, &tid);
+ app_control_h app_control;
+
+ app_control_create(&app_control);
+ app_control_set_package(app_control, "org.tizen.memo");
+ app_control_set_operation(app_control, SERVICE_OPERATION_DEFAULT);
+ ret = alarm_schedule_at_date(app_control, NULL, 1, &tid);
if(ret == ALARM_ERROR_NONE)
{
dts_pass("utc_alarm_schedule_at_date_negative", "passed");
}
- service_destory(service);
+ app_control_destory(app_control);
alarm_cancel_all();
}
time_t current_time;
struct tm date;
time_t now;
- service_h service;
+ app_control_h app_control;
int tid;
GMainLoop *loop;
time(&now);
localtime_r(&now, &date);
date.tm_sec += 3;
- service_create(&service);
- service_set_package(service, "com.samsung.memo");
- service_set_operation(service, SERVICE_OPERATION_DEFAULT);
+ app_control_create(&app_control);
+ app_control_set_package(app_control, "org.tizen.memo");
+ app_control_set_operation(app_control, SERVICE_OPERATION_DEFAULT);
- alarm_schedule_with_recurrence_week_flag(service, &date, ALARM_WEEK_FLAG_MONDAY, &tid);
+ alarm_schedule_with_recurrence_week_flag(app_control, &date, ALARM_WEEK_FLAG_MONDAY, &tid);
g_main_loop_run(loop);
dts_fail("utc_alarm_schedule_with_recurrence_week_flag_positive", "failed");
}
- service_destory(service);
+ app_control_destory(app_control);
alarm_cancel_all();
}
time_t current_time;
struct tm date;
time_t now;
- service_h service;
+ app_control_h app_control;
int tid;
GMainLoop *loop;
int week_flag = 0;
time(&now);
localtime_r(&now, &date);
date.tm_sec += 3;
- service_create(&service);
- service_set_package(service, "com.samsung.memo");
- service_set_operation(service, SERVICE_OPERATION_DEFAULT);
+ app_control_create(&app_control);
+ app_control_set_package(app_control, "org.tizen.memo");
+ app_control_set_operation(app_control, SERVICE_OPERATION_DEFAULT);
- alarm_schedule_with_recurrence_week_flag(service, &date, ALARM_WEEK_FLAG_MONDAY, &tid);
+ alarm_schedule_with_recurrence_week_flag(app_control, &date, ALARM_WEEK_FLAG_MONDAY, &tid);
alarm_get_scheduled_recurrence_week_flag(tid, &week_flag);
-
+
if(ret != ALARM_ERROR_NONE)
{
dts_fail("utc_alarm_get_scheduled_recurrence_week_flag_positive", "failed");
{
dts_fail("utc_alarm_get_scheduled_recurrence_week_flag_positive", "failed");
}
- service_destory(service);
+ app_control_destory(app_control);
alarm_cancel_all();
}
{
struct tm date;
int ret = ALARM_ERROR_NONE;
-
+
ret = alarm_get_current_time(&date);
if(ret == ALARM_ERROR_NONE)
{
}
}
-static void utc_alarm_get_service_positive(void)
+static void utc_alarm_get_app_control_positive(void)
{
time_t current_time;
struct tm current_tm;
- service_h service;
- service_h service_return;
+ app_control_h app_control;
+ app_control_h app_control_return;
int ret = ALARM_ERROR_NONE;
int tid;
loop = g_main_loop_new(NULL, FALSE);
g_timeout_add(1000,timeout , loop);
- service_create(&service);
- service_set_package(service, "com.samsung.memo");
- service_set_operation(service, SERVICE_OPERATION_DEFAULT);
- alarm_schedule_after_delay(service, 3, 0, &tid);
+ app_control_create(&app_control);
+ app_control_set_package(app_control, "org.tizen.memo");
+ app_control_set_operation(app_control, SERVICE_OPERATION_DEFAULT);
+ alarm_schedule_after_delay(app_control, 3, 0, &tid);
- ret = alarm_get_service(tid, &service_return);
+ ret = alarm_get_app_control(tid, &app_control_return);
g_main_loop_run(loop);
if(ret != ALARM_ERROR_NONE)
{
- dts_fail("utc_alarm_get_service_positive", "failed");
+ dts_fail("utc_alarm_get_app_control_positive", "failed");
}
-
- ret = service_get_package(service_return, &package);
-
+
+ ret = app_control_get_package(app_control_return, &package);
+
if(ret != SERVICE_ERROR_NONE)
{
- dts_fail("utc_alarm_get_service_positive", "failed");
+ dts_fail("utc_alarm_get_app_control_positive", "failed");
}
- if(!strcmp(package, "com.samsung.memo"))
+ if(!strcmp(package, "org.tizen.memo"))
{
- dts_pass("utc_alarm_get_service_positive", "passed");
+ dts_pass("utc_alarm_get_app_control_positive", "passed");
}
else
{
- dts_fail("utc_alarm_get_service_positive", "failed");
+ dts_fail("utc_alarm_get_app_control_positive", "failed");
}
-
+
if(package != NULL)
{
free(package);
}
- service_destory(service);
- service_destory(service_return);
+ app_control_destory(app_control);
+ app_control_destory(app_control_return);
alarm_cancel_all();
}
-static void utc_alarm_get_service_negative(void)
+static void utc_alarm_get_app_control_negative(void)
{
int ret = ALARM_ERROR_NONE;
- ret = alarm_get_service(NULL,NULL);
+ ret = alarm_get_app_control(NULL,NULL);
if(ret == ALARM_ERROR_NONE)
{
- dts_fail("utc_alarm_get_service_negative", "failed");
+ dts_fail("utc_alarm_get_app_control_negative", "failed");
}
else
{
- dts_pass("utc_alarm_get_service_negative", "passed");
+ dts_pass("utc_alarm_get_app_control_negative", "passed");
}
}
* 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.
+ * limitations under the License.
*/
void (*tet_startup)(void) = startup;
void (*tet_cleanup)(void) = cleanup;
+static main_loop_flag = 0;
static void utc_app_get_package_negative1(void);
static void utc_app_get_package_negative2(void);
static void utc_app_get_name_negative1(void);
static void utc_app_get_name_negative2(void);
+static void utc_app_get_id_negative1(void);
+static void utc_app_get_id_negative2(void);
static void utc_app_get_version_negative1(void);
static void utc_app_get_version_negative2(void);
static void utc_app_get_resource_negative1(void);
static void utc_app_get_device_orientation_positive(void);
static void utc_app_set_reclaiming_system_cache_on_pause_positive1(void);
static void utc_app_set_reclaiming_system_cache_on_pause_positive2(void);
+static void utc_app_efl_main_negative1(void);
+static void utc_app_efl_main_negative2(void);
+static void utc_app_efl_exit_negative(void);
struct tet_testlist tet_testlist[] = {
{ utc_app_get_package_negative1, 1 },
{ utc_app_get_package_negative2, 1 },
{ utc_app_get_name_negative1, 1 },
{ utc_app_get_name_negative2, 1 },
+ { utc_app_get_id_negative1, 1 },
+ { utc_app_get_id_negative2, 1 },
{ utc_app_get_version_negative1, 1 },
{ utc_app_get_version_negative2, 1 },
{ utc_app_get_resource_negative1, 1 },
{ utc_app_get_device_orientation_positive, 1 },
{ utc_app_set_reclaiming_system_cache_on_pause_positive1, 1 },
{ utc_app_set_reclaiming_system_cache_on_pause_positive2, 1 },
+ { utc_app_efl_main_negative1, 1},
+ { utc_app_efl_main_negative2, 1},
+ { utc_app_efl_exit_negative, 1},
{ NULL, 0 },
};
dts_pass(API_NAME, "passed");
}
+static void utc_app_get_id_negative1(void)
+{
+ const char *API_NAME = __FUNCTION__;
+ int ret = APP_ERROR_NONE;
+ char *id = NULL;
+
+ ret = app_get_id(&id);
+
+ dts_message(API_NAME, "ret(%d), id(%s)", ret, id);
+
+ if(ret == APP_ERROR_NONE)
+ {
+ dts_fail(API_NAME, "failed");
+ }
+ else
+ {
+ dts_pass(API_NAME, "passed");
+ }
+}
+
+static void utc_app_get_id_negative2(void)
+{
+ const char *API_NAME = __FUNCTION__;
+ int ret = APP_ERROR_NONE;
+
+ ret = app_get_id(NULL);
+
+ dts_message(API_NAME, "ret(%d)", ret);
+
+ if(ret == APP_ERROR_NONE)
+ {
+ dts_fail(API_NAME, "failed");
+ }
+ else
+ {
+ dts_pass(API_NAME, "passed");
+ }
+}
+
+static bool _app_create(void *user_data)
+{
+ main_loop_flag = 1;
+ return true;
+}
+
+static void _app_pause(void *user_data)
+{
+}
+
+static void _app_resume(void *user_data)
+{
+}
+
+static void _app_terminate(void *user_data)
+{
+ main_loop_flag = 0;
+}
+
+static void _app_control(app_control_h app_control, void *user_data)
+{
+}
+
+static void utc_app_efl_main_negative1(void)
+{
+ const char *API_NAME = __FUNCTION__;
+ app_event_callback_s event_callback = {0,};
+ int argc = 3;
+ char *argv[4] = {"package", "appid", "exec", NULL};
+ int ret = APP_ERROR_NONE;
+ event_callback.create = _app_create;
+ event_callback.app_control = _app_control;
+ event_callback.terminate = _app_terminate;
+ event_callback.pause = _app_pause;
+ event_callback.resume = _app_resume;
+
+ ret = app_efl_main(&argc, &argv, &event_callback, NULL);
+
+ dts_message(API_NAME, "ret(%d)", ret);
+
+ if(ret != APP_ERROR_NONE)
+ {
+ dts_pass(API_NAME, "passed");
+ }
+ else
+ {
+ app_efl_exit();
+ dts_fail(API_NAME, "failed");
+ }
+}
+
+static void utc_app_efl_main_negative2(void)
+{
+ const char *API_NAME = __FUNCTION__;
+ int ret = APP_ERROR_NONE;
+
+ ret = app_efl_main(NULL, NULL, NULL, NULL);
+
+ dts_message(API_NAME, "ret(%d)", ret);
+
+ if(ret == APP_ERROR_NONE)
+ {
+ app_efl_exit();
+ dts_fail(API_NAME, "failed");
+ }
+ else
+ {
+ dts_pass(API_NAME, "passed");
+ }
+}
+
+static void utc_app_efl_exit_negative(void)
+{
+ const char *API_NAME = __FUNCTION__;
+ app_event_callback_s event_callback = {0,};
+ int argc = 3;
+ char *argv[4] = {"package", "appid", "exec", NULL};
+ int ret = APP_ERROR_NONE;
+ event_callback.create = _app_create;
+ event_callback.app_control = _app_control;
+ event_callback.terminate = _app_terminate;
+ event_callback.pause = _app_pause;
+ event_callback.resume = _app_resume;
+
+ ret = app_efl_main(&argc, &argv, &event_callback, NULL);
+
+ dts_message(API_NAME, "ret(%d)", ret);
+
+ app_efl_exit();
+ dts_pass(API_NAME, "passed");
+}
+
* 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.
+ * limitations under the License.
*/
void (*tet_startup)(void) = startup;
void (*tet_cleanup)(void) = cleanup;
-static void utc_service_create_positive(void);
-static void utc_service_create_negative(void);
-
-static void utc_service_destroy_positive(void);
-static void utc_service_destroy_negative(void);
-
-static void utc_service_set_operation_positive1(void);
-static void utc_service_set_operation_positive2(void);
-static void utc_service_set_operation_negative(void);
-
-static void utc_service_get_operation_positive(void);
-static void utc_service_get_operation_negative1(void);
-static void utc_service_get_operation_negative2(void);
-static void utc_service_get_operation_negative3(void);
-
-static void utc_service_set_uri_positive1(void);
-static void utc_service_set_uri_positive2(void);
-static void utc_service_set_uri_negative(void);
-
-static void utc_service_get_uri_positive(void);
-static void utc_service_get_uri_negative1(void);
-static void utc_service_get_uri_negative2(void);
-static void utc_service_get_uri_negative3(void);
-
-static void utc_service_set_mime_positive1(void);
-static void utc_service_set_mime_positive2(void);
-static void utc_service_set_mime_negative(void);
-
-static void utc_service_get_mime_positive(void);
-static void utc_service_get_mime_negative1(void);
-static void utc_service_get_mime_negative2(void);
-static void utc_service_get_mime_negative3(void);
-
-static void utc_service_set_package_positive(void);
-static void utc_service_set_package_negative1(void);
-static void utc_service_set_package_negative2(void);
-
-static void utc_service_get_package_positive(void);
-static void utc_service_get_package_negative1(void);
-static void utc_service_get_package_negative2(void);
-static void utc_service_get_package_negative3(void);
-
-static void utc_service_add_extra_data_positive(void);
-static void utc_service_add_extra_data_negative1(void);
-static void utc_service_add_extra_data_negative2(void);
-
-static void utc_service_remove_extra_data_positive(void);
-static void utc_service_remove_extra_data_negative1(void);
-static void utc_service_remove_extra_data_negative2(void);
-static void utc_service_remove_extra_data_negative3(void);
-
-static void utc_service_get_extra_data_positive(void);
-static void utc_service_get_extra_data_negative1(void);
-static void utc_service_get_extra_data_negative2(void);
-static void utc_service_get_extra_data_negative3(void);
-static void utc_service_get_extra_data_negative4(void);
-
-static void utc_service_foreach_extra_data_positive(void);
-static void utc_service_foreach_extra_data_negative1(void);
-static void utc_service_foreach_extra_data_negative2(void);
-
-static void utc_service_clone_positive(void);
-static void utc_service_clone_negative1(void);
-static void utc_service_clone_negative2(void);
-
-static void utc_service_send_launch_request_positive1(void);
-static void utc_service_send_launch_request_positive2(void);
-static void utc_service_send_launch_request_positive3(void);
-static void utc_service_send_launch_request_negative1(void);
-static void utc_service_send_launch_request_negative2(void);
-
-static void utc_service_reply_to_launch_request_negative1(void);
-static void utc_service_reply_to_launch_request_negative2(void);
-
-static void utc_service_foreach_app_matched_positive(void);
-static void utc_service_foreach_app_matched_negative1(void);
-static void utc_service_foreach_app_matched_negative2(void);
-
-static void utc_service_add_extra_data_array_positive(void);
-static void utc_service_add_extra_data_array_negative1(void);
-static void utc_service_add_extra_data_array_negative2(void);
-static void utc_service_add_extra_data_array_negative3(void);
-
-static void utc_service_get_extra_data_array_positive(void);
-static void utc_service_get_extra_data_array_negative1(void);
-static void utc_service_get_extra_data_array_negative2(void);
-static void utc_service_get_extra_data_array_negative3(void);
-static void utc_service_get_extra_data_array_negative4(void);
-static void utc_service_get_extra_data_array_negative5(void);
-
-static void utc_service_is_extra_data_array_positive(void);
-static void utc_service_is_extra_data_array_negative1(void);
-static void utc_service_is_extra_data_array_negative2(void);
-static void utc_service_is_extra_data_array_negative3(void);
-static void utc_service_is_extra_data_array_negative4(void);
-
-
-static void utc_service_is_reply_requested_positive1(void);
-static void utc_service_is_reply_requested_negative1(void);
-static void utc_service_is_reply_requested_negative2(void);
-static void utc_service_is_reply_requested_negative3(void);
-
-static void utc_service_get_caller_positive1(void);
-static void utc_service_get_caller_negative1(void);
-static void utc_service_get_caller_negative2(void);
-static void utc_service_get_caller_negative3(void);
+static void utc_app_control_create_positive(void);
+static void utc_app_control_create_negative(void);
+
+static void utc_app_control_destroy_positive(void);
+static void utc_app_control_destroy_negative(void);
+
+static void utc_app_control_set_operation_positive1(void);
+static void utc_app_control_set_operation_positive2(void);
+static void utc_app_control_set_operation_negative(void);
+
+static void utc_app_control_get_operation_positive(void);
+static void utc_app_control_get_operation_negative1(void);
+static void utc_app_control_get_operation_negative2(void);
+static void utc_app_control_get_operation_negative3(void);
+
+static void utc_app_control_set_uri_positive1(void);
+static void utc_app_control_set_uri_positive2(void);
+static void utc_app_control_set_uri_negative(void);
+
+static void utc_app_control_get_uri_positive(void);
+static void utc_app_control_get_uri_negative1(void);
+static void utc_app_control_get_uri_negative2(void);
+static void utc_app_control_get_uri_negative3(void);
+
+static void utc_app_control_set_mime_positive1(void);
+static void utc_app_control_set_mime_positive2(void);
+static void utc_app_control_set_mime_negative(void);
+
+static void utc_app_control_get_mime_positive(void);
+static void utc_app_control_get_mime_negative1(void);
+static void utc_app_control_get_mime_negative2(void);
+static void utc_app_control_get_mime_negative3(void);
+
+static void utc_app_control_set_package_positive(void);
+static void utc_app_control_set_package_negative1(void);
+static void utc_app_control_set_package_negative2(void);
+
+static void utc_app_control_get_package_positive(void);
+static void utc_app_control_get_package_negative1(void);
+static void utc_app_control_get_package_negative2(void);
+static void utc_app_control_get_package_negative3(void);
+
+static void utc_app_control_set_app_id_positive(void);
+static void utc_app_control_set_app_id_negative1(void);
+static void utc_app_control_set_app_id_negative2(void);
+
+static void utc_app_control_get_app_id_positive(void);
+static void utc_app_control_get_app_id_negative1(void);
+static void utc_app_control_get_app_id_negative2(void);
+static void utc_app_control_get_app_id_negative3(void);
+
+static void utc_app_control_set_category_positive(void);
+static void utc_app_control_set_category_negative1(void);
+static void utc_app_control_set_category_negative2(void);
+
+static void utc_app_control_get_category_positive(void);
+static void utc_app_control_get_category_negative1(void);
+static void utc_app_control_get_category_negative2(void);
+static void utc_app_control_get_category_negative3(void);
+
+static void utc_app_control_set_window_positive(void);
+static void utc_app_control_set_window_negative1(void);
+static void utc_app_control_set_window_negative2(void);
+
+static void utc_app_control_get_window_positive(void);
+static void utc_app_control_get_window_negative1(void);
+static void utc_app_control_get_window_negative2(void);
+static void utc_app_control_get_window_negative3(void);
+
+static void utc_app_control_add_extra_data_positive(void);
+static void utc_app_control_add_extra_data_negative1(void);
+static void utc_app_control_add_extra_data_negative2(void);
+
+static void utc_app_control_remove_extra_data_positive(void);
+static void utc_app_control_remove_extra_data_negative1(void);
+static void utc_app_control_remove_extra_data_negative2(void);
+static void utc_app_control_remove_extra_data_negative3(void);
+
+static void utc_app_control_get_extra_data_positive(void);
+static void utc_app_control_get_extra_data_negative1(void);
+static void utc_app_control_get_extra_data_negative2(void);
+static void utc_app_control_get_extra_data_negative3(void);
+static void utc_app_control_get_extra_data_negative4(void);
+
+static void utc_app_control_foreach_extra_data_positive(void);
+static void utc_app_control_foreach_extra_data_negative1(void);
+static void utc_app_control_foreach_extra_data_negative2(void);
+
+static void utc_app_control_clone_positive(void);
+static void utc_app_control_clone_negative1(void);
+static void utc_app_control_clone_negative2(void);
+
+static void utc_app_control_send_launch_request_positive1(void);
+static void utc_app_control_send_launch_request_positive2(void);
+static void utc_app_control_send_launch_request_positive3(void);
+static void utc_app_control_send_launch_request_negative1(void);
+static void utc_app_control_send_launch_request_negative2(void);
+
+static void utc_app_control_reply_to_launch_request_negative1(void);
+static void utc_app_control_reply_to_launch_request_negative2(void);
+
+static void utc_app_control_foreach_app_matched_positive(void);
+static void utc_app_control_foreach_app_matched_negative1(void);
+static void utc_app_control_foreach_app_matched_negative2(void);
+
+static void utc_app_control_add_extra_data_array_positive(void);
+static void utc_app_control_add_extra_data_array_negative1(void);
+static void utc_app_control_add_extra_data_array_negative2(void);
+static void utc_app_control_add_extra_data_array_negative3(void);
+
+static void utc_app_control_get_extra_data_array_positive(void);
+static void utc_app_control_get_extra_data_array_negative1(void);
+static void utc_app_control_get_extra_data_array_negative2(void);
+static void utc_app_control_get_extra_data_array_negative3(void);
+static void utc_app_control_get_extra_data_array_negative4(void);
+static void utc_app_control_get_extra_data_array_negative5(void);
+
+static void utc_app_control_is_extra_data_array_positive(void);
+static void utc_app_control_is_extra_data_array_negative1(void);
+static void utc_app_control_is_extra_data_array_negative2(void);
+static void utc_app_control_is_extra_data_array_negative3(void);
+static void utc_app_control_is_extra_data_array_negative4(void);
+
+
+static void utc_app_control_is_reply_requested_positive1(void);
+static void utc_app_control_is_reply_requested_negative1(void);
+static void utc_app_control_is_reply_requested_negative2(void);
+static void utc_app_control_is_reply_requested_negative3(void);
+
+static void utc_app_control_get_caller_positive1(void);
+static void utc_app_control_get_caller_negative1(void);
+static void utc_app_control_get_caller_negative2(void);
+static void utc_app_control_get_caller_negative3(void);
+
+static void utc_app_control_to_bundle_positive1(void);
+static void utc_app_control_to_bundle_negative1(void);
+static void utc_app_control_to_bundle_negative2(void);
+static void utc_app_control_to_bundle_negative3(void);
struct tet_testlist tet_testlist[] = {
- { utc_service_create_positive, 1 },
- { utc_service_create_negative, 1 },
- { utc_service_destroy_positive, 1 },
- { utc_service_destroy_negative, 1 },
- { utc_service_set_operation_positive1, 1 },
- { utc_service_set_operation_positive2, 1 },
- { utc_service_set_operation_negative, 1 },
- { utc_service_get_operation_positive, 1 },
- { utc_service_get_operation_negative1, 1 },
- { utc_service_get_operation_negative2, 1 },
- { utc_service_get_operation_negative3, 1 },
- { utc_service_set_uri_positive1, 1 },
- { utc_service_set_uri_positive2, 1 },
- { utc_service_set_uri_negative, 1 },
- { utc_service_get_uri_positive, 1 },
- { utc_service_get_uri_negative1, 1 },
- { utc_service_get_uri_negative2, 1 },
- { utc_service_get_uri_negative3, 1 },
- { utc_service_set_mime_positive1, 1 },
- { utc_service_set_mime_positive2, 1 },
- { utc_service_set_mime_negative, 1 },
- { utc_service_get_mime_positive, 1 },
- { utc_service_get_mime_negative1, 1 },
- { utc_service_get_mime_negative2, 1 },
- { utc_service_get_mime_negative3, 1 },
- { utc_service_set_package_positive, 1 },
- { utc_service_set_package_negative1, 1 },
- { utc_service_set_package_negative2, 1 },
- { utc_service_get_package_positive, 1 },
- { utc_service_get_package_negative1, 1 },
- { utc_service_get_package_negative2, 1 },
- { utc_service_get_package_negative3, 1 },
- { utc_service_add_extra_data_positive, 1 },
- { utc_service_add_extra_data_negative1, 1 },
- { utc_service_add_extra_data_negative2, 1 },
- { utc_service_remove_extra_data_positive, 1 },
- { utc_service_remove_extra_data_negative1, 1 },
- { utc_service_remove_extra_data_negative2, 1 },
- { utc_service_remove_extra_data_negative3, 1 },
- { utc_service_get_extra_data_positive, 1 },
- { utc_service_get_extra_data_negative1, 1 },
- { utc_service_get_extra_data_negative2, 1 },
- { utc_service_get_extra_data_negative3, 1 },
- { utc_service_get_extra_data_negative4, 1 },
- { utc_service_foreach_extra_data_positive, 1 },
- { utc_service_foreach_extra_data_negative1, 1 },
- { utc_service_foreach_extra_data_negative2, 1 },
- { utc_service_clone_positive, 1 },
- { utc_service_clone_negative1, 1 },
- { utc_service_clone_negative2, 1 },
- { utc_service_send_launch_request_positive1, 1 },
- { utc_service_send_launch_request_positive2, 1 },
- { utc_service_send_launch_request_positive3, 1 },
- { utc_service_send_launch_request_negative1, 1 },
- { utc_service_send_launch_request_negative2, 1 },
- { utc_service_reply_to_launch_request_negative1, 1 },
- { utc_service_reply_to_launch_request_negative2, 1 },
- { utc_service_foreach_app_matched_positive, 1 },
- { utc_service_foreach_app_matched_negative1, 1 },
- { utc_service_foreach_app_matched_negative2, 1 },
- { utc_service_add_extra_data_array_positive, 1 },
- { utc_service_add_extra_data_array_negative1, 1 },
- { utc_service_add_extra_data_array_negative2, 1 },
- { utc_service_add_extra_data_array_negative3, 1 },
- { utc_service_get_extra_data_array_positive, 1 },
- { utc_service_get_extra_data_array_negative1, 1 },
- { utc_service_get_extra_data_array_negative2, 1 },
- { utc_service_get_extra_data_array_negative3, 1 },
- { utc_service_get_extra_data_array_negative4, 1 },
- { utc_service_get_extra_data_array_negative5, 1 },
- { utc_service_is_extra_data_array_positive, 1 },
- { utc_service_is_extra_data_array_negative1, 1 },
- { utc_service_is_extra_data_array_negative2, 1 },
- { utc_service_is_extra_data_array_negative3, 1 },
- { utc_service_is_extra_data_array_negative4, 1 },
- { utc_service_is_reply_requested_positive1, 1 },
- { utc_service_is_reply_requested_negative1, 1 },
- { utc_service_is_reply_requested_negative2, 1 },
- { utc_service_is_reply_requested_negative3, 1 },
- { utc_service_get_caller_positive1, 1 },
- { utc_service_get_caller_negative1, 1 },
- { utc_service_get_caller_negative2, 1 },
- { utc_service_get_caller_negative3, 1 },
+ { utc_app_control_create_positive, 1 },
+ { utc_app_control_create_negative, 1 },
+ { utc_app_control_destroy_positive, 1 },
+ { utc_app_control_destroy_negative, 1 },
+ { utc_app_control_set_operation_positive1, 1 },
+ { utc_app_control_set_operation_positive2, 1 },
+ { utc_app_control_set_operation_negative, 1 },
+ { utc_app_control_get_operation_positive, 1 },
+ { utc_app_control_get_operation_negative1, 1 },
+ { utc_app_control_get_operation_negative2, 1 },
+ { utc_app_control_get_operation_negative3, 1 },
+ { utc_app_control_set_uri_positive1, 1 },
+ { utc_app_control_set_uri_positive2, 1 },
+ { utc_app_control_set_uri_negative, 1 },
+ { utc_app_control_get_uri_positive, 1 },
+ { utc_app_control_get_uri_negative1, 1 },
+ { utc_app_control_get_uri_negative2, 1 },
+ { utc_app_control_get_uri_negative3, 1 },
+ { utc_app_control_set_mime_positive1, 1 },
+ { utc_app_control_set_mime_positive2, 1 },
+ { utc_app_control_set_mime_negative, 1 },
+ { utc_app_control_get_mime_positive, 1 },
+ { utc_app_control_get_mime_negative1, 1 },
+ { utc_app_control_get_mime_negative2, 1 },
+ { utc_app_control_get_mime_negative3, 1 },
+ { utc_app_control_set_package_positive, 1 },
+ { utc_app_control_set_package_negative1, 1 },
+ { utc_app_control_set_package_negative2, 1 },
+ { utc_app_control_get_package_positive, 1 },
+ { utc_app_control_get_package_negative1, 1 },
+ { utc_app_control_get_package_negative2, 1 },
+ { utc_app_control_get_package_negative3, 1 },
+ { utc_app_control_set_app_id_positive, 1 },
+ { utc_app_control_set_app_id_negative1, 1 },
+ { utc_app_control_set_app_id_negative2, 1 },
+ { utc_app_control_get_app_id_positive, 1 },
+ { utc_app_control_get_app_id_negative1, 1 },
+ { utc_app_control_get_app_id_negative2, 1 },
+ { utc_app_control_get_app_id_negative3, 1 },
+ { utc_app_control_set_category_positive, 1 },
+ { utc_app_control_set_category_negative1, 1 },
+ { utc_app_control_set_category_negative2, 1 },
+ { utc_app_control_get_category_positive, 1 },
+ { utc_app_control_get_category_negative1, 1 },
+ { utc_app_control_get_category_negative2, 1 },
+ { utc_app_control_get_category_negative3, 1 },
+ { utc_app_control_set_window_positive, 1 },
+ { utc_app_control_set_window_negative1, 1 },
+ { utc_app_control_set_window_negative2, 1 },
+ { utc_app_control_get_window_positive, 1 },
+ { utc_app_control_get_window_negative1, 1 },
+ { utc_app_control_get_window_negative2, 1 },
+ { utc_app_control_get_window_negative3, 1 },
+ { utc_app_control_add_extra_data_positive, 1 },
+ { utc_app_control_add_extra_data_negative1, 1 },
+ { utc_app_control_add_extra_data_negative2, 1 },
+ { utc_app_control_remove_extra_data_positive, 1 },
+ { utc_app_control_remove_extra_data_negative1, 1 },
+ { utc_app_control_remove_extra_data_negative2, 1 },
+ { utc_app_control_remove_extra_data_negative3, 1 },
+ { utc_app_control_get_extra_data_positive, 1 },
+ { utc_app_control_get_extra_data_negative1, 1 },
+ { utc_app_control_get_extra_data_negative2, 1 },
+ { utc_app_control_get_extra_data_negative3, 1 },
+ { utc_app_control_get_extra_data_negative4, 1 },
+ { utc_app_control_foreach_extra_data_positive, 1 },
+ { utc_app_control_foreach_extra_data_negative1, 1 },
+ { utc_app_control_foreach_extra_data_negative2, 1 },
+ { utc_app_control_clone_positive, 1 },
+ { utc_app_control_clone_negative1, 1 },
+ { utc_app_control_clone_negative2, 1 },
+ { utc_app_control_send_launch_request_positive1, 1 },
+ { utc_app_control_send_launch_request_positive2, 1 },
+ { utc_app_control_send_launch_request_positive3, 1 },
+ { utc_app_control_send_launch_request_negative1, 1 },
+ { utc_app_control_send_launch_request_negative2, 1 },
+ { utc_app_control_reply_to_launch_request_negative1, 1 },
+ { utc_app_control_reply_to_launch_request_negative2, 1 },
+ { utc_app_control_foreach_app_matched_positive, 1 },
+ { utc_app_control_foreach_app_matched_negative1, 1 },
+ { utc_app_control_foreach_app_matched_negative2, 1 },
+ { utc_app_control_add_extra_data_array_positive, 1 },
+ { utc_app_control_add_extra_data_array_negative1, 1 },
+ { utc_app_control_add_extra_data_array_negative2, 1 },
+ { utc_app_control_add_extra_data_array_negative3, 1 },
+ { utc_app_control_get_extra_data_array_positive, 1 },
+ { utc_app_control_get_extra_data_array_negative1, 1 },
+ { utc_app_control_get_extra_data_array_negative2, 1 },
+ { utc_app_control_get_extra_data_array_negative3, 1 },
+ { utc_app_control_get_extra_data_array_negative4, 1 },
+ { utc_app_control_get_extra_data_array_negative5, 1 },
+ { utc_app_control_is_extra_data_array_positive, 1 },
+ { utc_app_control_is_extra_data_array_negative1, 1 },
+ { utc_app_control_is_extra_data_array_negative2, 1 },
+ { utc_app_control_is_extra_data_array_negative3, 1 },
+ { utc_app_control_is_extra_data_array_negative4, 1 },
+ { utc_app_control_is_reply_requested_positive1, 1 },
+ { utc_app_control_is_reply_requested_negative1, 1 },
+ { utc_app_control_is_reply_requested_negative2, 1 },
+ { utc_app_control_is_reply_requested_negative3, 1 },
+ { utc_app_control_get_caller_positive1, 1 },
+ { utc_app_control_get_caller_negative1, 1 },
+ { utc_app_control_get_caller_negative2, 1 },
+ { utc_app_control_get_caller_negative3, 1 },
+ { utc_app_control_to_bundle_positive1, 1 },
+ { utc_app_control_to_bundle_negative1, 1 },
+ { utc_app_control_to_bundle_negative2, 1 },
+ { utc_app_control_to_bundle_negative3, 1 },
{ NULL, 0 },
};
}
-static void utc_service_create_positive(void)
+static void utc_app_control_create_positive(void)
{
const char *API_NAME = __FUNCTION__;
int ret = SERVICE_ERROR_NONE;
- service_h service;
+ app_control_h app_control;
- ret = service_create(&service);
+ ret = app_control_create(&app_control);
dts_message(API_NAME, "ret(%d)", ret);
}
}
-static void utc_service_create_negative(void)
+static void utc_app_control_create_negative(void)
{
const char *API_NAME = __FUNCTION__;
int ret = SERVICE_ERROR_NONE;
- ret = service_create(NULL);
+ ret = app_control_create(NULL);
dts_message(API_NAME, "ret(%d)", ret);
}
-static void utc_service_destroy_positive(void)
+static void utc_app_control_destroy_positive(void)
{
const char *API_NAME = __FUNCTION__;
int ret = SERVICE_ERROR_NONE;
- service_h service;
+ app_control_h app_control;
- service_create(&service);
+ app_control_create(&app_control);
+
+ ret = app_control_destroy(app_control);
- ret = service_destroy(service);
-
dts_message(API_NAME, "ret(%d)", ret);
if(ret == SERVICE_ERROR_NONE)
}
-static void utc_service_destroy_negative(void)
+static void utc_app_control_destroy_negative(void)
{
const char *API_NAME = __FUNCTION__;
int ret = SERVICE_ERROR_NONE;
- ret = service_destroy(NULL);
-
+ ret = app_control_destroy(NULL);
+
dts_message(API_NAME, "ret(%d)", ret);
if(ret != SERVICE_ERROR_NONE)
}
-static void utc_service_set_operation_positive1(void)
+static void utc_app_control_set_operation_positive1(void)
{
const char *API_NAME = __FUNCTION__;
int ret = SERVICE_ERROR_NONE;
const char *input_value = "INPUT_VALUE";
- service_h service;
+ app_control_h app_control;
- service_create(&service);
+ app_control_create(&app_control);
- ret = service_set_operation(service, input_value);
+ ret = app_control_set_operation(app_control, input_value);
dts_message(API_NAME, "ret(%d)", ret);
dts_fail(API_NAME, "failed");
}
- service_destroy(service);
+ app_control_destroy(app_control);
}
-static void utc_service_set_operation_positive2(void)
+static void utc_app_control_set_operation_positive2(void)
{
const char *API_NAME = __FUNCTION__;
int ret = SERVICE_ERROR_NONE;
- service_h service;
+ app_control_h app_control;
- service_create(&service);
+ app_control_create(&app_control);
- ret = service_set_operation(service, NULL);
+ ret = app_control_set_operation(app_control, NULL);
if(ret == SERVICE_ERROR_NONE)
{
dts_fail(API_NAME, "failed");
}
- service_destroy(service);
+ app_control_destroy(app_control);
}
-static void utc_service_set_operation_negative(void)
+static void utc_app_control_set_operation_negative(void)
{
const char *API_NAME = __FUNCTION__;
int ret = SERVICE_ERROR_NONE;
const char *input_value = "INPUT_VALUE";
- ret = service_set_operation(NULL, input_value);
+ ret = app_control_set_operation(NULL, input_value);
if(ret != SERVICE_ERROR_NONE)
{
-static void utc_service_get_operation_positive(void)
+static void utc_app_control_get_operation_positive(void)
{
const char *API_NAME = __FUNCTION__;
int ret = SERVICE_ERROR_NONE;
const char *input_value = "INPUT_VALUE";
char *output_value;
- service_h service;
+ app_control_h app_control;
- service_create(&service);
+ app_control_create(&app_control);
- service_set_operation(service, input_value);
+ app_control_set_operation(app_control, input_value);
- ret = service_get_operation(service, &output_value);
+ ret = app_control_get_operation(app_control, &output_value);
if(ret == SERVICE_ERROR_NONE)
{
dts_fail(API_NAME, "failed");
}
- service_destroy(service);
+ app_control_destroy(app_control);
}
-static void utc_service_get_operation_negative1(void)
+static void utc_app_control_get_operation_negative1(void)
{
const char *API_NAME = __FUNCTION__;
int ret = SERVICE_ERROR_NONE;
char *output_value;
- ret = service_get_operation(NULL, &output_value);
+ ret = app_control_get_operation(NULL, &output_value);
if(ret != SERVICE_ERROR_NONE)
{
}
}
-static void utc_service_get_operation_negative2(void)
+static void utc_app_control_get_operation_negative2(void)
{
const char *API_NAME = __FUNCTION__;
int ret = SERVICE_ERROR_NONE;
- service_h service;
+ app_control_h app_control;
- service_create(&service);
+ app_control_create(&app_control);
- ret = service_get_operation(service, NULL);
+ ret = app_control_get_operation(app_control, NULL);
if(ret != SERVICE_ERROR_NONE)
{
dts_fail(API_NAME, "failed");
}
- service_destroy(service);
+ app_control_destroy(app_control);
}
-static void utc_service_get_operation_negative3(void)
+static void utc_app_control_get_operation_negative3(void)
{
const char *API_NAME = __FUNCTION__;
int ret = SERVICE_ERROR_NONE;
char *output_value;
- service_h service;
+ app_control_h app_control;
- service_create(&service);
+ app_control_create(&app_control);
- ret = service_get_operation(service, &output_value);
+ ret = app_control_get_operation(app_control, &output_value);
if(ret == SERVICE_ERROR_NONE && output_value == NULL)
{
dts_fail(API_NAME, "failed");
}
- service_destroy(service);
+ app_control_destroy(app_control);
}
-static void utc_service_set_uri_positive1(void)
+static void utc_app_control_set_uri_positive1(void)
{
const char *API_NAME = __FUNCTION__;
int ret = SERVICE_ERROR_NONE;
const char *input_value = "INPUT_VALUE";
- service_h service;
+ app_control_h app_control;
- service_create(&service);
+ app_control_create(&app_control);
+
+ ret = app_control_set_uri(app_control, input_value);
- ret = service_set_uri(service, input_value);
-
if(ret == SERVICE_ERROR_NONE)
{
dts_pass(API_NAME, "passed");
dts_fail(API_NAME, "failed");
}
- service_destroy(service);
+ app_control_destroy(app_control);
}
-static void utc_service_set_uri_positive2(void)
+static void utc_app_control_set_uri_positive2(void)
{
const char *API_NAME = __FUNCTION__;
int ret = SERVICE_ERROR_NONE;
- service_h service;
+ app_control_h app_control;
- service_create(&service);
+ app_control_create(&app_control);
- ret = service_set_uri(service, NULL);
+ ret = app_control_set_uri(app_control, NULL);
if(ret == SERVICE_ERROR_NONE)
{
dts_fail(API_NAME, "failed");
}
- service_destroy(service);
+ app_control_destroy(app_control);
}
-static void utc_service_set_uri_negative(void)
+static void utc_app_control_set_uri_negative(void)
{
const char *API_NAME = __FUNCTION__;
int ret = SERVICE_ERROR_NONE;
const char *input_value = "INPUT_VALUE";
- ret = service_get_uri(NULL, input_value);
+ ret = app_control_get_uri(NULL, input_value);
if(ret != SERVICE_ERROR_NONE)
{
}
}
-static void utc_service_get_uri_positive(void)
+static void utc_app_control_get_uri_positive(void)
{
const char *API_NAME = __FUNCTION__;
int ret = SERVICE_ERROR_NONE;
const char *input_value = "INPUT_VALUE";
char *output_value;
- service_h service;
+ app_control_h app_control;
- service_create(&service);
+ app_control_create(&app_control);
- service_set_uri(service, input_value);
+ app_control_set_uri(app_control, input_value);
- service_get_uri(service, &output_value);
+ app_control_get_uri(app_control, &output_value);
if(ret == SERVICE_ERROR_NONE)
{
dts_fail(API_NAME, "failed");
}
- service_destroy(service);
+ app_control_destroy(app_control);
}
-static void utc_service_get_uri_negative1(void)
+static void utc_app_control_get_uri_negative1(void)
{
const char *API_NAME = __FUNCTION__;
int ret = SERVICE_ERROR_NONE;
char *output_value;
- service_h service;
+ app_control_h app_control;
- service_create(&service);
+ app_control_create(&app_control);
- ret = service_get_uri(service, &output_value);
+ ret = app_control_get_uri(app_control, &output_value);
if(ret == SERVICE_ERROR_NONE && output_value == NULL)
{
dts_fail(API_NAME, "failed");
}
- service_destroy(service);
+ app_control_destroy(app_control);
}
-static void utc_service_get_uri_negative2(void)
+static void utc_app_control_get_uri_negative2(void)
{
const char *API_NAME = __FUNCTION__;
int ret = SERVICE_ERROR_NONE;
char *output_value;
- ret = service_get_uri(NULL, &output_value);
+ ret = app_control_get_uri(NULL, &output_value);
if(ret != SERVICE_ERROR_NONE)
{
}
-static void utc_service_get_uri_negative3(void)
+static void utc_app_control_get_uri_negative3(void)
{
const char *API_NAME = __FUNCTION__;
int ret = SERVICE_ERROR_NONE;
- service_h service;
+ app_control_h app_control;
- service_create(&service);
+ app_control_create(&app_control);
- ret = service_get_uri(service, NULL);
+ ret = app_control_get_uri(app_control, NULL);
if(ret != SERVICE_ERROR_NONE)
{
dts_fail(API_NAME, "failed");
}
- service_destroy(service);
+ app_control_destroy(app_control);
}
-static void utc_service_set_mime_positive1(void)
+static void utc_app_control_set_mime_positive1(void)
{
const char *API_NAME = __FUNCTION__;
int ret = SERVICE_ERROR_NONE;
const char *input_value = "INPUT_VALUE";
- service_h service;
+ app_control_h app_control;
- service_create(&service);
+ app_control_create(&app_control);
- ret = service_set_mime(service, input_value);
+ ret = app_control_set_mime(app_control, input_value);
if(ret == SERVICE_ERROR_NONE)
{
- dts_pass(API_NAME, "passed");
+ dts_pass(API_NAME, "passed");
}
else
{
dts_fail(API_NAME, "failed");
}
- service_destroy(service);
+ app_control_destroy(app_control);
}
-static void utc_service_set_mime_positive2(void)
+static void utc_app_control_set_mime_positive2(void)
{
const char *API_NAME = __FUNCTION__;
int ret = SERVICE_ERROR_NONE;
- service_h service;
+ app_control_h app_control;
- service_create(&service);
+ app_control_create(&app_control);
- ret = service_set_mime(service, NULL);
+ ret = app_control_set_mime(app_control, NULL);
if(ret == SERVICE_ERROR_NONE)
{
dts_fail(API_NAME, "failed");
}
- service_destroy(service);
+ app_control_destroy(app_control);
}
-static void utc_service_set_mime_negative(void)
+static void utc_app_control_set_mime_negative(void)
{
const char *API_NAME = __FUNCTION__;
int ret = SERVICE_ERROR_NONE;
const char *input_value = "INPUT_VALUE";
- ret = service_set_mime(NULL, input_value);
+ ret = app_control_set_mime(NULL, input_value);
if(ret != SERVICE_ERROR_NONE)
{
}
}
-static void utc_service_get_mime_positive(void)
+static void utc_app_control_get_mime_positive(void)
{
const char *API_NAME = __FUNCTION__;
int ret = SERVICE_ERROR_NONE;
const char *input_value = "INPUT_VALUE";
char *output_value;
- service_h service;
+ app_control_h app_control;
- service_create(&service);
+ app_control_create(&app_control);
- service_set_mime(service, input_value);
+ app_control_set_mime(app_control, input_value);
- ret = service_get_mime(service, &output_value);
+ ret = app_control_get_mime(app_control, &output_value);
if(ret == SERVICE_ERROR_NONE)
{
dts_fail(API_NAME, "failed");
}
- service_destroy(service);
+ app_control_destroy(app_control);
}
-static void utc_service_get_mime_negative1(void)
+static void utc_app_control_get_mime_negative1(void)
{
const char *API_NAME = __FUNCTION__;
int ret = SERVICE_ERROR_NONE;
char *output_value;
- service_h service;
+ app_control_h app_control;
- service_create(&service);
+ app_control_create(&app_control);
- ret = service_get_mime(service, &output_value);
+ ret = app_control_get_mime(app_control, &output_value);
if(ret == SERVICE_ERROR_NONE && output_value == NULL)
{
dts_fail(API_NAME, "failed");
}
- service_destroy(service);
+ app_control_destroy(app_control);
}
-static void utc_service_get_mime_negative2(void)
+static void utc_app_control_get_mime_negative2(void)
{
const char *API_NAME = __FUNCTION__;
int ret = SERVICE_ERROR_NONE;
char *output_value;
- ret = service_get_mime(NULL, &output_value);
+ ret = app_control_get_mime(NULL, &output_value);
if(ret != SERVICE_ERROR_NONE)
{
}
}
-static void utc_service_get_mime_negative3(void)
+static void utc_app_control_get_mime_negative3(void)
{
const char *API_NAME = __FUNCTION__;
int ret = SERVICE_ERROR_NONE;
- service_h service;
+ app_control_h app_control;
- service_create(&service);
+ app_control_create(&app_control);
- ret = service_get_mime(service, NULL);
+ ret = app_control_get_mime(app_control, NULL);
if(ret != SERVICE_ERROR_NONE)
{
dts_fail(API_NAME, "failed");
}
- service_destroy(service);
+ app_control_destroy(app_control);
}
-static void utc_service_set_package_positive(void)
+static void utc_app_control_set_package_positive(void)
{
const char *API_NAME = __FUNCTION__;
int ret = SERVICE_ERROR_NONE;
const char *input_value = "INPUT_VALUE";
- service_h service;
+ app_control_h app_control;
- service_create(&service);
+ app_control_create(&app_control);
+
+ ret = app_control_set_package(app_control, input_value);
- ret = service_set_package(service, input_value);
-
if(ret == SERVICE_ERROR_NONE)
{
dts_pass(API_NAME, "passed");
dts_fail(API_NAME, "failed");
}
- service_destroy(service);
+ app_control_destroy(app_control);
+}
+
+static void utc_app_control_set_package_negative1(void)
+{
+ const char *API_NAME = __FUNCTION__;
+ int ret = SERVICE_ERROR_NONE;
+ const char *input_value = "INPUT_VALUE";
+
+ ret = app_control_set_package(NULL, input_value);
+
+ if(ret != SERVICE_ERROR_NONE)
+ {
+ dts_pass(API_NAME, "passed");
+ }
+ else
+ {
+ dts_fail(API_NAME, "failed");
+ }
+}
+
+static void utc_app_control_set_package_negative2(void)
+{
+ const char *API_NAME = __FUNCTION__;
+ int ret = SERVICE_ERROR_NONE;
+
+ ret = app_control_set_package(NULL, NULL);
+
+ if(ret != SERVICE_ERROR_NONE)
+ {
+ dts_pass(API_NAME, "passed");
+ }
+ else
+ {
+ dts_fail(API_NAME, "failed");
+ }
}
-static void utc_service_set_package_negative1(void)
+static void utc_app_control_get_package_positive(void)
{
const char *API_NAME = __FUNCTION__;
int ret = SERVICE_ERROR_NONE;
+ const char *input_value = "INPUT_VALUE";
char *output_value;
- ret = service_get_package(NULL, &output_value);
+ app_control_h app_control;
+
+ app_control_create(&app_control);
+
+ app_control_set_package(app_control, input_value);
+
+ ret = app_control_get_package(app_control, &output_value);
+
+ if(ret == SERVICE_ERROR_NONE)
+ {
+ if(!strcmp(input_value, output_value))
+ {
+ dts_pass(API_NAME, "passed");
+ }
+ else
+ {
+ dts_fail(API_NAME, "failed");
+ }
+ }
+ else
+ {
+ dts_fail(API_NAME, "failed");
+ }
+
+ app_control_destroy(app_control);
+}
+
+static void utc_app_control_get_package_negative1(void)
+{
+ const char *API_NAME = __FUNCTION__;
+ int ret = SERVICE_ERROR_NONE;
+ char *output_value;
+
+ app_control_h app_control;
+
+ app_control_create(&app_control);
+
+ ret = app_control_get_package(app_control, &output_value);
+
+ if(ret == SERVICE_ERROR_NONE && output_value == NULL)
+ {
+ dts_pass(API_NAME, "passed");
+ }
+ else
+ {
+ dts_fail(API_NAME, "failed");
+ }
+
+ app_control_destroy(app_control);
+}
+
+static void utc_app_control_get_package_negative2(void)
+{
+ const char *API_NAME = __FUNCTION__;
+ int ret = SERVICE_ERROR_NONE;
+ char *output_value;
+
+ ret = app_control_get_package(NULL, &output_value);
if(ret != SERVICE_ERROR_NONE)
{
}
}
-static void utc_service_set_package_negative2(void)
+static void utc_app_control_get_package_negative3(void)
{
const char *API_NAME = __FUNCTION__;
int ret = SERVICE_ERROR_NONE;
- service_h service;
+ app_control_h app_control;
- service_create(&service);
+ app_control_create(&app_control);
- ret = service_get_package(service, NULL);
+ ret = app_control_get_package(app_control, NULL);
if(ret != SERVICE_ERROR_NONE)
{
dts_fail(API_NAME, "failed");
}
- service_destroy(service);
+ app_control_destroy(app_control);
}
-static void utc_service_get_package_positive(void)
+static void utc_app_control_set_app_id_positive(void)
+{
+ const char *API_NAME = __FUNCTION__;
+ int ret = SERVICE_ERROR_NONE;
+ const char *input_value = "INPUT_VALUE";
+
+ app_control_h app_control;
+
+ app_control_create(&app_control);
+
+ ret = app_control_set_app_id(app_control, input_value);
+
+ if(ret == SERVICE_ERROR_NONE)
+ {
+ dts_pass(API_NAME, "passed");
+ }
+ else
+ {
+ dts_fail(API_NAME, "failed");
+ }
+
+ app_control_destroy(app_control);
+}
+
+static void utc_app_control_set_app_id_negative1(void)
+{
+ const char *API_NAME = __FUNCTION__;
+ int ret = SERVICE_ERROR_NONE;
+
+ ret = app_control_set_app_id(NULL, NULL);
+
+ if(ret != SERVICE_ERROR_NONE)
+ {
+ dts_pass(API_NAME, "passed");
+ }
+ else
+ {
+ dts_fail(API_NAME, "failed");
+ }
+}
+
+static void utc_app_control_set_app_id_negative2(void)
+{
+ const char *API_NAME = __FUNCTION__;
+ int ret = SERVICE_ERROR_NONE;
+ const char *input_value = "INPUT_VALUE";
+
+ ret = app_control_set_app_id(NULL, input_value);
+
+ if(ret != SERVICE_ERROR_NONE)
+ {
+ dts_pass(API_NAME, "passed");
+ }
+ else
+ {
+ dts_fail(API_NAME, "failed");
+ }
+}
+
+static void utc_app_control_get_app_id_positive(void)
{
const char *API_NAME = __FUNCTION__;
int ret = SERVICE_ERROR_NONE;
const char *input_value = "INPUT_VALUE";
char *output_value;
- service_h service;
+ app_control_h app_control;
- service_create(&service);
+ app_control_create(&app_control);
- service_set_package(service, input_value);
+ app_control_set_app_id(app_control, input_value);
- ret = service_get_package(service, &output_value);
+ ret = app_control_get_app_id(app_control, &output_value);
if(ret == SERVICE_ERROR_NONE)
{
dts_fail(API_NAME, "failed");
}
- service_destroy(service);
+ app_control_destroy(app_control);
}
-static void utc_service_get_package_negative1(void)
+static void utc_app_control_get_app_id_negative1(void)
{
const char *API_NAME = __FUNCTION__;
int ret = SERVICE_ERROR_NONE;
char *output_value;
- service_h service;
+ app_control_h app_control;
- service_create(&service);
+ app_control_create(&app_control);
- ret = service_get_package(service, &output_value);
+ ret = app_control_get_app_id(app_control, &output_value);
if(ret == SERVICE_ERROR_NONE && output_value == NULL)
{
dts_fail(API_NAME, "failed");
}
- service_destroy(service);
+ app_control_destroy(app_control);
}
-static void utc_service_get_package_negative2(void)
+static void utc_app_control_get_app_id_negative2(void)
{
const char *API_NAME = __FUNCTION__;
int ret = SERVICE_ERROR_NONE;
char *output_value;
- ret = service_get_package(NULL, &output_value);
+ ret = app_control_get_app_id(NULL, &output_value);
if(ret != SERVICE_ERROR_NONE)
{
}
}
-static void utc_service_get_package_negative3(void)
+static void utc_app_control_get_app_id_negative3(void)
{
const char *API_NAME = __FUNCTION__;
int ret = SERVICE_ERROR_NONE;
- service_h service;
+ app_control_h app_control;
+
+ app_control_create(&app_control);
+
+ ret = app_control_get_app_id(app_control, NULL);
+
+ if(ret != SERVICE_ERROR_NONE)
+ {
+ dts_pass(API_NAME, "passed");
+ }
+ else
+ {
+ dts_fail(API_NAME, "failed");
+ }
+
+ app_control_destroy(app_control);
+}
+
+static void utc_app_control_set_category_positive(void)
+{
+ const char *API_NAME = __FUNCTION__;
+ int ret = SERVICE_ERROR_NONE;
+ const char *input_value = "INPUT_VALUE";
+
+ app_control_h app_control;
+
+ app_control_create(&app_control);
+
+ ret = app_control_set_category(app_control, input_value);
+
+ if(ret == SERVICE_ERROR_NONE)
+ {
+ dts_pass(API_NAME, "passed");
+ }
+ else
+ {
+ dts_fail(API_NAME, "failed");
+ }
+
+ app_control_destroy(app_control);
+}
+
+static void utc_app_control_set_category_negative1(void)
+{
+ const char *API_NAME = __FUNCTION__;
+ int ret = SERVICE_ERROR_NONE;
+
+ ret = app_control_set_category(NULL, NULL);
+
+ if(ret != SERVICE_ERROR_NONE)
+ {
+ dts_pass(API_NAME, "passed");
+ }
+ else
+ {
+ dts_fail(API_NAME, "failed");
+ }
+}
- service_create(&service);
+static void utc_app_control_set_category_negative2(void)
+{
+ const char *API_NAME = __FUNCTION__;
+ int ret = SERVICE_ERROR_NONE;
+ const char *input_value = "INPUT_VALUE";
- ret = service_get_package(service, NULL);
+ ret = app_control_set_category(NULL, input_value);
if(ret != SERVICE_ERROR_NONE)
{
{
dts_fail(API_NAME, "failed");
}
+}
- service_destroy(service);
+static void utc_app_control_get_category_positive(void)
+{
+ const char *API_NAME = __FUNCTION__;
+ int ret = SERVICE_ERROR_NONE;
+ const char *input_value = "INPUT_VALUE";
+ char *output_value;
+
+ app_control_h app_control;
+
+ app_control_create(&app_control);
+
+ app_control_set_category(app_control, input_value);
+
+ ret = app_control_get_category(app_control, &output_value);
+
+ if(ret == SERVICE_ERROR_NONE)
+ {
+ if(!strcmp(input_value, output_value))
+ {
+ dts_pass(API_NAME, "passed");
+ }
+ else
+ {
+ dts_fail(API_NAME, "failed");
+ }
+ }
+ else
+ {
+ dts_fail(API_NAME, "failed");
+ }
+
+ app_control_destroy(app_control);
}
-static void utc_service_add_extra_data_positive(void)
+static void utc_app_control_get_category_negative1(void)
+{
+ const char *API_NAME = __FUNCTION__;
+ int ret = SERVICE_ERROR_NONE;
+ char *output_value;
+
+ app_control_h app_control;
+
+ app_control_create(&app_control);
+
+ ret = app_control_get_category(app_control, &output_value);
+
+ if(ret == SERVICE_ERROR_NONE && output_value == NULL)
+ {
+ dts_pass(API_NAME, "passed");
+ }
+ else
+ {
+ dts_fail(API_NAME, "failed");
+ }
+
+ app_control_destroy(app_control);
+}
+
+static void utc_app_control_get_category_negative2(void)
+{
+ const char *API_NAME = __FUNCTION__;
+ int ret = SERVICE_ERROR_NONE;
+ char *output_value;
+
+ ret = app_control_get_category(NULL, &output_value);
+
+ if(ret != SERVICE_ERROR_NONE)
+ {
+ dts_pass(API_NAME, "passed");
+ }
+ else
+ {
+ dts_fail(API_NAME, "failed");
+ }
+}
+
+static void utc_app_control_get_category_negative3(void)
+{
+ const char *API_NAME = __FUNCTION__;
+ int ret = SERVICE_ERROR_NONE;
+
+ app_control_h app_control;
+
+ app_control_create(&app_control);
+
+ ret = app_control_get_category(app_control, NULL);
+
+ if(ret != SERVICE_ERROR_NONE)
+ {
+ dts_pass(API_NAME, "passed");
+ }
+ else
+ {
+ dts_fail(API_NAME, "failed");
+ }
+
+ app_control_destroy(app_control);
+}
+
+static void utc_app_control_set_window_positive(void)
+{
+ const char *API_NAME = __FUNCTION__;
+ int ret = SERVICE_ERROR_NONE;
+ unsigned int wid = 5;
+ app_control_h app_control;
+
+ app_control_create(&app_control);
+
+ ret = app_control_set_window(app_control, wid);
+
+ if(ret == SERVICE_ERROR_NONE)
+ {
+ dts_pass(API_NAME, "passed");
+ }
+ else
+ {
+ dts_fail(API_NAME, "failed");
+ }
+
+ app_control_destroy(app_control);
+}
+
+static void utc_app_control_set_window_negative1(void)
+{
+ const char *API_NAME = __FUNCTION__;
+ int ret = SERVICE_ERROR_NONE;
+
+ ret = app_control_set_window(NULL, -1);
+
+ if(ret != SERVICE_ERROR_NONE)
+ {
+ dts_pass(API_NAME, "passed");
+ }
+ else
+ {
+ dts_fail(API_NAME, "failed");
+ }
+}
+
+static void utc_app_control_set_window_negative2(void)
+{
+ const char *API_NAME = __FUNCTION__;
+ int ret = SERVICE_ERROR_NONE;
+ unsigned int wid = 5;
+
+ ret = app_control_set_window(NULL, wid);
+
+ if(ret != SERVICE_ERROR_NONE)
+ {
+ dts_pass(API_NAME, "passed");
+ }
+ else
+ {
+ dts_fail(API_NAME, "failed");
+ }
+}
+
+static void utc_app_control_get_window_positive(void)
+{
+ const char *API_NAME = __FUNCTION__;
+ int ret = SERVICE_ERROR_NONE;
+ unsigned int wid = 5;
+ int output_value = 0;
+
+ app_control_h app_control;
+
+ app_control_create(&app_control);
+
+ app_control_set_window(app_control, wid);
+
+ ret = app_control_get_window(app_control, &output_value);
+
+ if(ret == SERVICE_ERROR_NONE)
+ {
+ if(wid == output_value)
+ {
+ dts_pass(API_NAME, "passed");
+ }
+ else
+ {
+ dts_fail(API_NAME, "failed");
+ }
+ }
+ else
+ {
+ dts_fail(API_NAME, "failed");
+ }
+
+ app_control_destroy(app_control);
+}
+
+static void utc_app_control_get_window_negative1(void)
+{
+ const char *API_NAME = __FUNCTION__;
+ int ret = SERVICE_ERROR_NONE;
+ int output_value = 0;
+
+ app_control_h app_control;
+
+ app_control_create(&app_control);
+
+ ret = app_control_get_window(app_control, &output_value);
+
+ if(ret == SERVICE_ERROR_NONE)
+ {
+ dts_pass(API_NAME, "passed");
+ }
+ else
+ {
+ dts_fail(API_NAME, "failed");
+ }
+}
+
+static void utc_app_control_get_window_negative2(void)
+{
+ const char *API_NAME = __FUNCTION__;
+ int ret = SERVICE_ERROR_NONE;
+ int output_value = 0;
+
+ ret = app_control_get_window(NULL, &output_value);
+
+ if(ret != SERVICE_ERROR_NONE)
+ {
+ dts_pass(API_NAME, "passed");
+ }
+ else
+ {
+ dts_fail(API_NAME, "failed");
+ }
+}
+
+static void utc_app_control_get_window_negative3(void)
+{
+ const char *API_NAME = __FUNCTION__;
+ int ret = SERVICE_ERROR_NONE;
+
+ app_control_h app_control;
+
+ app_control_create(&app_control);
+
+ ret = app_control_get_window(app_control, NULL);
+
+ if(ret != SERVICE_ERROR_NONE)
+ {
+ dts_pass(API_NAME, "passed");
+ }
+ else
+ {
+ dts_fail(API_NAME, "failed");
+ }
+
+ app_control_destroy(app_control);
+}
+
+static void utc_app_control_add_extra_data_positive(void)
{
const char *API_NAME = __FUNCTION__;
int ret = SERVICE_ERROR_NONE;
char *key = "EXTRA_KEY";
char *value = "EXTRA_VALUE";
- service_h service;
+ app_control_h app_control;
- service_create(&service);
+ app_control_create(&app_control);
- ret = service_add_extra_data(service, key, value);
+ ret = app_control_add_extra_data(app_control, key, value);
if(ret == SERVICE_ERROR_NONE)
{
dts_fail(API_NAME, "failed");
}
- service_destroy(service);
+ app_control_destroy(app_control);
}
-static void utc_service_add_extra_data_negative1(void)
+static void utc_app_control_add_extra_data_negative1(void)
{
const char *API_NAME = __FUNCTION__;
int passed = 0;
char *key = "EXTRA_KEY";
char *value = "EXTRA_VALUE";
- service_h service;
+ app_control_h app_control;
- service_create(&service);
+ app_control_create(&app_control);
// key : unll
- ret = service_add_extra_data(service, NULL, value);
+ ret = app_control_add_extra_data(app_control, NULL, value);
if(ret != SERVICE_ERROR_NONE)
{
}
// key : zero-length
- ret = service_add_extra_data(service, "", value);
+ ret = app_control_add_extra_data(app_control, "", value);
if(ret != SERVICE_ERROR_NONE)
{
}
// value : null
- ret = service_add_extra_data(service, key, NULL);
+ ret = app_control_add_extra_data(app_control, key, NULL);
if(ret != SERVICE_ERROR_NONE)
{
}
// value : zero-length
- ret = service_add_extra_data(service, key, "");
+ ret = app_control_add_extra_data(app_control, key, "");
if(ret != SERVICE_ERROR_NONE)
{
dts_fail(API_NAME, "failed");
}
- service_destroy(service);
+ app_control_destroy(app_control);
}
-static void utc_service_add_extra_data_negative2(void)
+static void utc_app_control_add_extra_data_negative2(void)
{
const char *API_NAME = __FUNCTION__;
int ret = SERVICE_ERROR_NONE;
char *key = "EXTRA_KEY";
char *value = "EXTRA_VALUE";
- ret = service_add_extra_data(NULL, key, value);
+ ret = app_control_add_extra_data(NULL, key, value);
if(ret != SERVICE_ERROR_NONE)
{
}
}
-static void utc_service_remove_extra_data_positive(void)
+static void utc_app_control_remove_extra_data_positive(void)
{
const char *API_NAME = __FUNCTION__;
int ret = SERVICE_ERROR_NONE;
char *key = "EXTRA_KEY";
char *value = "EXTRA_VALUE";
- service_h service;
+ app_control_h app_control;
- service_create(&service);
+ app_control_create(&app_control);
- service_add_extra_data(service, key, value);
+ app_control_add_extra_data(app_control, key, value);
- ret = service_remove_extra_data(service, key);
+ ret = app_control_remove_extra_data(app_control, key);
if(ret == SERVICE_ERROR_NONE)
{
dts_fail(API_NAME, "failed");
}
- service_destroy(service);
+ app_control_destroy(app_control);
}
-static void utc_service_remove_extra_data_negative1(void)
+static void utc_app_control_remove_extra_data_negative1(void)
{
const char *API_NAME = __FUNCTION__;
int ret = SERVICE_ERROR_NONE;
char *key = "EXTRA_KEY";
- service_h service;
+ app_control_h app_control;
- service_create(&service);
+ app_control_create(&app_control);
- ret = service_remove_extra_data(service, key);
+ ret = app_control_remove_extra_data(app_control, key);
if(ret != SERVICE_ERROR_NONE)
{
dts_fail(API_NAME, "failed");
}
- service_destroy(service);
+ app_control_destroy(app_control);
}
-static void utc_service_remove_extra_data_negative2(void)
+static void utc_app_control_remove_extra_data_negative2(void)
{
const char *API_NAME = __FUNCTION__;
int ret = SERVICE_ERROR_NONE;
char *key = "EXTRA_KEY";
- ret = service_remove_extra_data(NULL, key);
+ ret = app_control_remove_extra_data(NULL, key);
if(ret != SERVICE_ERROR_NONE)
{
}
}
-static void utc_service_remove_extra_data_negative3(void)
+static void utc_app_control_remove_extra_data_negative3(void)
{
const char *API_NAME = __FUNCTION__;
int ret = SERVICE_ERROR_NONE;
- service_h service;
+ app_control_h app_control;
- service_create(&service);
+ app_control_create(&app_control);
- ret = service_remove_extra_data(service, NULL);
+ ret = app_control_remove_extra_data(app_control, NULL);
if(ret != SERVICE_ERROR_NONE)
{
dts_fail(API_NAME, "failed");
}
- service_destroy(service);
+ app_control_destroy(app_control);
}
-static void utc_service_get_extra_data_positive(void)
+static void utc_app_control_get_extra_data_positive(void)
{
const char *API_NAME = __FUNCTION__;
int ret = SERVICE_ERROR_NONE;
char *value = "EXTRA_VALUE";
char *ret_value;
- service_h service;
+ app_control_h app_control;
- service_create(&service);
+ app_control_create(&app_control);
- service_add_extra_data(service, key, value);
+ app_control_add_extra_data(app_control, key, value);
- ret = service_get_extra_data(service, key, &ret_value);
+ ret = app_control_get_extra_data(app_control, key, &ret_value);
if(ret == SERVICE_ERROR_NONE && !strcmp(ret_value, value))
{
dts_fail(API_NAME, "failed");
}
- service_destroy(service);
+ app_control_destroy(app_control);
}
-static void utc_service_get_extra_data_negative1(void)
+static void utc_app_control_get_extra_data_negative1(void)
{
const char *API_NAME = __FUNCTION__;
int ret = SERVICE_ERROR_NONE;
char *key = "EXTRA_KEY";
char *ret_value;
- service_h service;
+ app_control_h app_control;
- service_create(&service);
+ app_control_create(&app_control);
- ret = service_get_extra_data(service, key, &ret_value);
+ ret = app_control_get_extra_data(app_control, key, &ret_value);
if(ret != SERVICE_ERROR_NONE)
{
dts_fail(API_NAME, "failed");
}
- service_destroy(service);
+ app_control_destroy(app_control);
}
-static void utc_service_get_extra_data_negative2(void)
+static void utc_app_control_get_extra_data_negative2(void)
{
const char *API_NAME = __FUNCTION__;
int ret = SERVICE_ERROR_NONE;
char *key = "EXTRA_KEY";
char *ret_value;
- ret = service_get_extra_data(NULL, key, &ret_value);
+ ret = app_control_get_extra_data(NULL, key, &ret_value);
if(ret != SERVICE_ERROR_NONE)
{
}
-static void utc_service_get_extra_data_negative3(void)
+static void utc_app_control_get_extra_data_negative3(void)
{
const char *API_NAME = __FUNCTION__;
int ret = SERVICE_ERROR_NONE;
char *ret_value;
- service_h service;
+ app_control_h app_control;
- service_create(&service);
+ app_control_create(&app_control);
- ret = service_get_extra_data(service, NULL, &ret_value);
+ ret = app_control_get_extra_data(app_control, NULL, &ret_value);
if(ret != SERVICE_ERROR_NONE)
{
dts_fail(API_NAME, "failed");
}
- service_destroy(service);
+ app_control_destroy(app_control);
}
-static void utc_service_get_extra_data_negative4(void)
+static void utc_app_control_get_extra_data_negative4(void)
{
const char *API_NAME = __FUNCTION__;
int ret = SERVICE_ERROR_NONE;
char *key = "EXTRA_KEY";
- service_h service;
+ app_control_h app_control;
- service_create(&service);
+ app_control_create(&app_control);
- ret = service_get_extra_data(service, key, NULL);
+ ret = app_control_get_extra_data(app_control, key, NULL);
if(ret != SERVICE_ERROR_NONE)
{
dts_fail(API_NAME, "failed");
}
- service_destroy(service);
+ app_control_destroy(app_control);
}
#define NUM_EXTRA_DATA 32
-bool service_extra_data(service_h service, const char *key, void *user_data)
+bool app_control_extra_data(app_control_h app_control, const char *key, void *user_data)
{
bool *passed = (bool*)user_data;
char *value;
- service_get_extra_data(service, key, &value);
+ app_control_get_extra_data(app_control, key, &value);
if (!strcmp(key, value))
{
return true;
}
-static void utc_service_foreach_extra_data_positive(void)
+static void utc_app_control_foreach_extra_data_positive(void)
{
const char *API_NAME = __FUNCTION__;
int ret = SERVICE_ERROR_NONE;
int num_passed = 0;
char buf[32] = {0, };
- service_h service;
+ app_control_h app_control;
- service_create(&service);
+ app_control_create(&app_control);
for (i=0; i<NUM_EXTRA_DATA; i++)
{
snprintf(buf, sizeof(buf), "%d", i);
- service_add_extra_data(service, buf, buf);
+ app_control_add_extra_data(app_control, buf, buf);
}
- ret = service_foreach_extra_data(service, service_extra_data, &passed);
+ ret = app_control_foreach_extra_data(app_control, app_control_extra_data, &passed);
for (i=0; i<NUM_EXTRA_DATA; i++)
{
dts_fail(API_NAME, "failed");
}
- service_destroy(service);
+ app_control_destroy(app_control);
}
-static void utc_service_foreach_extra_data_negative1(void)
+static void utc_app_control_foreach_extra_data_negative1(void)
{
const char *API_NAME = __FUNCTION__;
int ret = SERVICE_ERROR_NONE;
- service_h service;
+ app_control_h app_control;
- service_create(&service);
+ app_control_create(&app_control);
- ret = service_foreach_extra_data(service, NULL, NULL);
+ ret = app_control_foreach_extra_data(app_control, NULL, NULL);
if(ret != SERVICE_ERROR_NONE)
{
dts_fail(API_NAME, "failed");
}
- service_destroy(service);
+ app_control_destroy(app_control);
}
-static void utc_service_foreach_extra_data_negative2(void)
+static void utc_app_control_foreach_extra_data_negative2(void)
{
const char *API_NAME = __FUNCTION__;
int ret = SERVICE_ERROR_NONE;
- ret = service_foreach_extra_data(NULL, service_extra_data, NULL);
+ ret = app_control_foreach_extra_data(NULL, app_control_extra_data, NULL);
if(ret != SERVICE_ERROR_NONE)
{
}
}
-static void utc_service_clone_positive(void)
+static void utc_app_control_clone_positive(void)
{
const char *API_NAME = __FUNCTION__;
int ret = SERVICE_ERROR_NONE;
char *package_clone;
char *extra_key = "EXTRA_KEY";
-
+
char *extra_value = "EXTRA_VALUE";
char *extra_value_clone;
- service_h service;
- service_h service_cloned;
+ app_control_h app_control;
+ app_control_h app_control_cloned;
- service_create(&service);
- service_set_operation(service, operation);
- service_set_uri(service, uri);
- service_set_mime(service, mime);
- service_set_package(service, package);
- service_add_extra_data(service, extra_key, extra_value);
+ app_control_create(&app_control);
+ app_control_set_operation(app_control, operation);
+ app_control_set_uri(app_control, uri);
+ app_control_set_mime(app_control, mime);
+ app_control_set_package(app_control, package);
+ app_control_add_extra_data(app_control, extra_key, extra_value);
- ret = service_clone(&service_cloned, service);
+ ret = app_control_clone(&app_control_cloned, app_control);
- service_get_operation(service_cloned, &operation_clone);
- service_get_uri(service_cloned, &uri_clone);
- service_get_mime(service_cloned, &mime_clone);
- service_get_package(service_cloned, &package_clone);
- service_get_extra_data(service_cloned, extra_key, &extra_value_clone);
+ app_control_get_operation(app_control_cloned, &operation_clone);
+ app_control_get_uri(app_control_cloned, &uri_clone);
+ app_control_get_mime(app_control_cloned, &mime_clone);
+ app_control_get_package(app_control_cloned, &package_clone);
+ app_control_get_extra_data(app_control_cloned, extra_key, &extra_value_clone);
if(ret == SERVICE_ERROR_NONE
dts_fail(API_NAME, "failed");
}
- service_destroy(service);
- service_destroy(service_cloned);
+ app_control_destroy(app_control);
+ app_control_destroy(app_control_cloned);
}
-static void utc_service_clone_negative1(void)
+static void utc_app_control_clone_negative1(void)
{
const char *API_NAME = __FUNCTION__;
int ret = SERVICE_ERROR_NONE;
- service_h service_cloned;
+ app_control_h app_control_cloned;
- ret = service_clone(&service_cloned, NULL);
+ ret = app_control_clone(&app_control_cloned, NULL);
if(ret != SERVICE_ERROR_NONE)
{
}
}
-static void utc_service_clone_negative2(void)
+static void utc_app_control_clone_negative2(void)
{
const char *API_NAME = __FUNCTION__;
int ret = SERVICE_ERROR_NONE;
- service_h service;
+ app_control_h app_control;
- service_create(&service);
+ app_control_create(&app_control);
- ret = service_clone(NULL, service);
+ ret = app_control_clone(NULL, app_control);
if(ret != SERVICE_ERROR_NONE)
{
}
-void dts_service_reply_cb(service_h request, service_h reply, service_result_e result, void *user_data)
+void dts_app_control_reply_cb(app_control_h request, app_control_h reply, app_control_result_e result, void *user_data)
{
}
-static void utc_service_send_launch_request_positive1(void)
+static void utc_app_control_send_launch_request_positive1(void)
{
const char *API_NAME = __FUNCTION__;
int ret = SERVICE_ERROR_NONE;
- service_h service;
+ app_control_h app_control;
- service_create(&service);
+ app_control_create(&app_control);
- service_set_operation(service, SERVICE_OPERATION_DEFAULT);
+ app_control_set_operation(app_control, SERVICE_OPERATION_DEFAULT);
- service_set_package(service, "com.samsung.calculator");
+ app_control_set_package(app_control, "org.tizen.calculator");
// explicit launch without reply callback
- ret = service_send_launch_request(service, NULL, NULL);
+ ret = app_control_send_launch_request(app_control, NULL, NULL);
if(ret == SERVICE_ERROR_NONE)
{
dts_fail(API_NAME, "failed");
}
- service_destroy(service);
+ app_control_destroy(app_control);
}
-static void utc_service_send_launch_request_positive2(void)
+static void utc_app_control_send_launch_request_positive2(void)
{
const char *API_NAME = __FUNCTION__;
int ret = SERVICE_ERROR_NONE;
- service_h service;
+ app_control_h app_control;
- service_create(&service);
+ app_control_create(&app_control);
- service_set_operation(service, SERVICE_OPERATION_DEFAULT);
+ app_control_set_operation(app_control, SERVICE_OPERATION_DEFAULT);
- service_set_package(service, "com.samsung.calculator");
+ app_control_set_package(app_control, "org.tizen.calculator");
// explicit launch with reply callback
- ret = service_send_launch_request(service, dts_service_reply_cb, NULL);
+ ret = app_control_send_launch_request(app_control, dts_app_control_reply_cb, NULL);
if(ret == SERVICE_ERROR_NONE)
{
dts_fail(API_NAME, "failed");
}
- service_destroy(service);
+ app_control_destroy(app_control);
}
-static void utc_service_send_launch_request_positive3(void)
+static void utc_app_control_send_launch_request_positive3(void)
{
const char *API_NAME = __FUNCTION__;
int ret = SERVICE_ERROR_NONE;
- service_h service;
+ app_control_h app_control;
- service_create(&service);
+ app_control_create(&app_control);
- service_set_operation(service, SERVICE_OPERATION_VIEW);
+ app_control_set_operation(app_control, SERVICE_OPERATION_VIEW);
- service_set_mime(service, "type/custom");
+ app_control_set_mime(app_control, "type/custom");
- ret = service_send_launch_request(service, dts_service_reply_cb, NULL);
+ ret = app_control_send_launch_request(app_control, dts_app_control_reply_cb, NULL);
if(ret == SERVICE_ERROR_APP_NOT_FOUND)
{
dts_fail(API_NAME, "failed");
}
- service_destroy(service);
+ app_control_destroy(app_control);
}
-static void utc_service_send_launch_request_negative1(void)
+static void utc_app_control_send_launch_request_negative1(void)
{
const char *API_NAME = __FUNCTION__;
int ret = SERVICE_ERROR_NONE;
- ret = service_send_launch_request(NULL, NULL, NULL);
+ ret = app_control_send_launch_request(NULL, NULL, NULL);
if(ret != SERVICE_ERROR_NONE)
{
}
}
-static void utc_service_send_launch_request_negative2(void)
+static void utc_app_control_send_launch_request_negative2(void)
{
const char *API_NAME = __FUNCTION__;
int ret = SERVICE_ERROR_NONE;
- service_h service;
+ app_control_h app_control;
- service_create(&service);
+ app_control_create(&app_control);
- service_set_operation(service, SERVICE_OPERATION_DEFAULT);
+ app_control_set_operation(app_control, SERVICE_OPERATION_DEFAULT);
- ret = service_send_launch_request(service, NULL, NULL);
+ ret = app_control_send_launch_request(app_control, NULL, NULL);
if(ret == SERVICE_ERROR_APP_NOT_FOUND)
{
{
dts_fail(API_NAME, "failed");
}
-
- service_destroy(service);
+
+ app_control_destroy(app_control);
}
-static void utc_service_reply_to_launch_request_negative1(void)
+static void utc_app_control_reply_to_launch_request_negative1(void)
{
const char *API_NAME = __FUNCTION__;
int ret = SERVICE_ERROR_NONE;
- service_h request;
+ app_control_h request;
- service_create(&request);
+ app_control_create(&request);
- ret = service_reply_to_launch_request(NULL, request, SERVICE_RESULT_CANCELED);
+ ret = app_control_reply_to_launch_request(NULL, request, SERVICE_RESULT_CANCELED);
if(ret != SERVICE_ERROR_NONE)
{
}
}
-static void utc_service_reply_to_launch_request_negative2(void)
+static void utc_app_control_reply_to_launch_request_negative2(void)
{
const char *API_NAME = __FUNCTION__;
int ret = SERVICE_ERROR_NONE;
- service_h service;
+ app_control_h app_control;
- service_create(&service);
+ app_control_create(&app_control);
- ret = service_reply_to_launch_request(service, NULL, SERVICE_RESULT_CANCELED);
+ ret = app_control_reply_to_launch_request(app_control, NULL, SERVICE_RESULT_CANCELED);
if(ret != SERVICE_ERROR_NONE)
{
dts_fail(API_NAME, "failed");
}
- service_destroy(service);
+ app_control_destroy(app_control);
}
-bool dts_service_app_matched_cb(service_h service, const char *package, void *user_data)
+bool dts_app_control_app_matched_cb(app_control_h app_control, const char *package, void *user_data)
{
return true;
}
-static void utc_service_foreach_app_matched_positive(void)
+static void utc_app_control_foreach_app_matched_positive(void)
{
const char *API_NAME = __FUNCTION__;
int ret = SERVICE_ERROR_NONE;
- service_h service;
+ app_control_h app_control;
- service_create(&service);
+ app_control_create(&app_control);
- service_set_operation(service, SERVICE_OPERATION_VIEW);
+ app_control_set_operation(app_control, SERVICE_OPERATION_VIEW);
- ret = service_foreach_app_matched(service, dts_service_app_matched_cb, NULL);
+ ret = app_control_foreach_app_matched(app_control, dts_app_control_app_matched_cb, NULL);
if(ret == SERVICE_ERROR_NONE)
{
dts_fail(API_NAME, "failed");
}
- service_destroy(service);
+ app_control_destroy(app_control);
}
-static void utc_service_foreach_app_matched_negative1(void)
+static void utc_app_control_foreach_app_matched_negative1(void)
{
const char *API_NAME = __FUNCTION__;
int ret = SERVICE_ERROR_NONE;
- ret = service_foreach_app_matched(NULL, dts_service_app_matched_cb, NULL);
+ ret = app_control_foreach_app_matched(NULL, dts_app_control_app_matched_cb, NULL);
if(ret != SERVICE_ERROR_NONE)
{
}
}
-static void utc_service_foreach_app_matched_negative2(void)
+static void utc_app_control_foreach_app_matched_negative2(void)
{
const char *API_NAME = __FUNCTION__;
int ret = SERVICE_ERROR_NONE;
- service_h service;
+ app_control_h app_control;
- service_create(&service);
+ app_control_create(&app_control);
- ret = service_foreach_app_matched(service, NULL, NULL);
+ ret = app_control_foreach_app_matched(app_control, NULL, NULL);
if(ret != SERVICE_ERROR_NONE)
{
dts_fail(API_NAME, "failed");
}
- service_destroy(service);
+ app_control_destroy(app_control);
}
-static void utc_service_add_extra_data_array_positive(void)
+static void utc_app_control_add_extra_data_array_positive(void)
{
const char *API_NAME = __FUNCTION__;
int ret = SERVICE_ERROR_NONE;
const char* array_value[] = {"array_value1", "array_value2", "array_value3", "array_value4"};
int array_length = 4;
- service_h service;
+ app_control_h app_control;
- service_create(&service);
+ app_control_create(&app_control);
- ret = service_add_extra_data_array(service, array_key, array_value, array_length);
+ ret = app_control_add_extra_data_array(app_control, array_key, array_value, array_length);
if(ret == SERVICE_ERROR_NONE)
{
dts_fail(API_NAME, "failed");
}
- service_destroy(service);
+ app_control_destroy(app_control);
}
-static void utc_service_add_extra_data_array_negative1(void)
+static void utc_app_control_add_extra_data_array_negative1(void)
{
const char *API_NAME = __FUNCTION__;
int ret = SERVICE_ERROR_NONE;
const char* array_value[] = {"array_value1", "array_value2", "array_value3", "array_value4"};
- service_h service;
+ app_control_h app_control;
- service_create(&service);
+ app_control_create(&app_control);
- ret = service_add_extra_data_array(service, NULL, array_value, 4);
+ ret = app_control_add_extra_data_array(app_control, NULL, array_value, 4);
if(ret != SERVICE_ERROR_NONE)
{
dts_fail(API_NAME, "failed");
}
- service_destroy(service);
+ app_control_destroy(app_control);
}
-static void utc_service_add_extra_data_array_negative2(void)
+static void utc_app_control_add_extra_data_array_negative2(void)
{
const char *API_NAME = __FUNCTION__;
int ret = SERVICE_ERROR_NONE;
const char *array_key = "array_key";
- service_h service;
+ app_control_h app_control;
- service_create(&service);
+ app_control_create(&app_control);
- ret = service_add_extra_data_array(service, array_key, NULL, 4);
+ ret = app_control_add_extra_data_array(app_control, array_key, NULL, 4);
if(ret != SERVICE_ERROR_NONE)
{
dts_fail(API_NAME, "failed");
}
- service_destroy(service);
+ app_control_destroy(app_control);
}
-static void utc_service_add_extra_data_array_negative3(void)
+static void utc_app_control_add_extra_data_array_negative3(void)
{
const char *API_NAME = __FUNCTION__;
int ret = SERVICE_ERROR_NONE;
const char *array_key = "array_key";
const char* array_value[] = {"array_value1", "array_value2", "array_value3", "array_value4"};
- service_h service;
+ app_control_h app_control;
- service_create(&service);
+ app_control_create(&app_control);
- ret = service_add_extra_data_array(service, array_key, array_value, -1);
+ ret = app_control_add_extra_data_array(app_control, array_key, array_value, -1);
if(ret != SERVICE_ERROR_NONE)
{
dts_fail(API_NAME, "failed");
}
- service_destroy(service);
+ app_control_destroy(app_control);
}
-static void utc_service_get_extra_data_array_positive(void)
+static void utc_app_control_get_extra_data_array_positive(void)
{
const char *API_NAME = __FUNCTION__;
int ret = SERVICE_ERROR_NONE;
char** array_value_out;
int array_length_out;
- service_h service;
+ app_control_h app_control;
- service_create(&service);
+ app_control_create(&app_control);
- service_add_extra_data_array(service, array_key, array_value, array_length);
+ app_control_add_extra_data_array(app_control, array_key, array_value, array_length);
- ret = service_get_extra_data_array(service, array_key, &array_value_out, &array_length_out);
+ ret = app_control_get_extra_data_array(app_control, array_key, &array_value_out, &array_length_out);
if(ret == SERVICE_ERROR_NONE && array_length_out == array_length)
{
dts_fail(API_NAME, "failed");
}
- service_destroy(service);
+ app_control_destroy(app_control);
}
-static void utc_service_get_extra_data_array_negative1(void)
+static void utc_app_control_get_extra_data_array_negative1(void)
{
const char *API_NAME = __FUNCTION__;
int ret = SERVICE_ERROR_NONE;
char** array_value_out;
int array_length_out;
- service_h service;
+ app_control_h app_control;
- service_create(&service);
+ app_control_create(&app_control);
- ret = service_get_extra_data_array(service, array_key, &array_value_out, &array_length_out);
+ ret = app_control_get_extra_data_array(app_control, array_key, &array_value_out, &array_length_out);
if(ret != SERVICE_ERROR_NONE)
{
dts_fail(API_NAME, "failed");
}
- service_destroy(service);
+ app_control_destroy(app_control);
}
-static void utc_service_get_extra_data_array_negative2(void)
+static void utc_app_control_get_extra_data_array_negative2(void)
{
const char *API_NAME = __FUNCTION__;
int ret = SERVICE_ERROR_NONE;
char** array_value_out;
int array_length_out;
- service_h service;
+ app_control_h app_control;
- service_create(&service);
+ app_control_create(&app_control);
- service_add_extra_data_array(service, array_key, array_value, array_length);
+ app_control_add_extra_data_array(app_control, array_key, array_value, array_length);
- ret = service_get_extra_data_array(NULL, array_key, &array_value_out, &array_length_out);
+ ret = app_control_get_extra_data_array(NULL, array_key, &array_value_out, &array_length_out);
if(ret != SERVICE_ERROR_NONE)
{
dts_fail(API_NAME, "failed");
}
- service_destroy(service);
+ app_control_destroy(app_control);
}
-static void utc_service_get_extra_data_array_negative3(void)
+static void utc_app_control_get_extra_data_array_negative3(void)
{
const char *API_NAME = __FUNCTION__;
int ret = SERVICE_ERROR_NONE;
char** array_value_out;
int array_length_out;
- service_h service;
+ app_control_h app_control;
- service_create(&service);
+ app_control_create(&app_control);
- service_add_extra_data_array(service, array_key, array_value, array_length);
+ app_control_add_extra_data_array(app_control, array_key, array_value, array_length);
- ret = service_get_extra_data_array(service, NULL, &array_value_out, &array_length_out);
+ ret = app_control_get_extra_data_array(app_control, NULL, &array_value_out, &array_length_out);
if(ret != SERVICE_ERROR_NONE)
{
dts_fail(API_NAME, "failed");
}
- service_destroy(service);
+ app_control_destroy(app_control);
}
-static void utc_service_get_extra_data_array_negative4(void)
+static void utc_app_control_get_extra_data_array_negative4(void)
{
const char *API_NAME = __FUNCTION__;
int ret = SERVICE_ERROR_NONE;
int array_length = 4;
int array_length_out;
- service_h service;
+ app_control_h app_control;
- service_create(&service);
+ app_control_create(&app_control);
- service_add_extra_data_array(service, array_key, array_value, array_length);
+ app_control_add_extra_data_array(app_control, array_key, array_value, array_length);
- ret = service_get_extra_data_array(service, array_key, NULL, &array_length_out);
+ ret = app_control_get_extra_data_array(app_control, array_key, NULL, &array_length_out);
if(ret != SERVICE_ERROR_NONE)
{
dts_fail(API_NAME, "failed");
}
- service_destroy(service);
+ app_control_destroy(app_control);
}
-static void utc_service_get_extra_data_array_negative5(void)
+static void utc_app_control_get_extra_data_array_negative5(void)
{
const char *API_NAME = __FUNCTION__;
int ret = SERVICE_ERROR_NONE;
int array_length = 4;
char** array_value_out;
- service_h service;
+ app_control_h app_control;
- service_create(&service);
+ app_control_create(&app_control);
- service_add_extra_data_array(service, array_key, array_value, array_length);
+ app_control_add_extra_data_array(app_control, array_key, array_value, array_length);
- ret = service_get_extra_data_array(service, array_key, &array_value_out, NULL);
+ ret = app_control_get_extra_data_array(app_control, array_key, &array_value_out, NULL);
if(ret != SERVICE_ERROR_NONE)
{
}
-static void utc_service_is_extra_data_array_positive(void)
+static void utc_app_control_is_extra_data_array_positive(void)
{
const char *API_NAME = __FUNCTION__;
int ret = SERVICE_ERROR_NONE;
int array_length = 4;
bool is_array;
- service_h service;
+ app_control_h app_control;
- service_create(&service);
+ app_control_create(&app_control);
- service_add_extra_data_array(service, array_key, array_value, array_length);
+ app_control_add_extra_data_array(app_control, array_key, array_value, array_length);
- ret = service_is_extra_data_array(service, array_key, &is_array);
+ ret = app_control_is_extra_data_array(app_control, array_key, &is_array);
if(ret == SERVICE_ERROR_NONE && is_array == true)
{
dts_fail(API_NAME, "failed");
}
- service_destroy(service);
+ app_control_destroy(app_control);
}
-static void utc_service_is_extra_data_array_negative1(void)
+static void utc_app_control_is_extra_data_array_negative1(void)
{
const char *API_NAME = __FUNCTION__;
int ret = SERVICE_ERROR_NONE;
bool is_array;
- service_h service;
+ app_control_h app_control;
- service_create(&service);
+ app_control_create(&app_control);
- ret = service_is_extra_data_array(service, key, &is_array);
+ ret = app_control_is_extra_data_array(app_control, key, &is_array);
if(ret == SERVICE_ERROR_NONE && is_array == false)
{
dts_fail(API_NAME, "failed");
}
- service_destroy(service);
+ app_control_destroy(app_control);
}
-static void utc_service_is_extra_data_array_negative2(void)
+static void utc_app_control_is_extra_data_array_negative2(void)
{
const char *API_NAME = __FUNCTION__;
int ret = SERVICE_ERROR_NONE;
bool is_array;
- service_h service;
+ app_control_h app_control;
- service_create(&service);
+ app_control_create(&app_control);
- ret = service_is_extra_data_array(NULL, key, &is_array);
+ ret = app_control_is_extra_data_array(NULL, key, &is_array);
if(ret != SERVICE_ERROR_NONE)
{
dts_fail(API_NAME, "failed");
}
- service_destroy(service);
+ app_control_destroy(app_control);
}
-static void utc_service_is_extra_data_array_negative3(void)
+static void utc_app_control_is_extra_data_array_negative3(void)
{
const char *API_NAME = __FUNCTION__;
int ret = SERVICE_ERROR_NONE;
bool is_array;
- service_h service;
+ app_control_h app_control;
- service_create(&service);
+ app_control_create(&app_control);
- ret = service_is_extra_data_array(service, NULL, &is_array);
+ ret = app_control_is_extra_data_array(app_control, NULL, &is_array);
if(ret != SERVICE_ERROR_NONE)
{
dts_fail(API_NAME, "failed");
}
- service_destroy(service);
+ app_control_destroy(app_control);
}
-static void utc_service_is_extra_data_array_negative4(void)
+static void utc_app_control_is_extra_data_array_negative4(void)
{
const char *API_NAME = __FUNCTION__;
int ret = SERVICE_ERROR_NONE;
const char *key = "key";
- service_h service;
+ app_control_h app_control;
- service_create(&service);
+ app_control_create(&app_control);
- ret = service_is_extra_data_array(service, key, NULL);
+ ret = app_control_is_extra_data_array(app_control, key, NULL);
if(ret != SERVICE_ERROR_NONE)
{
dts_fail(API_NAME, "failed");
}
- service_destroy(service);
+ app_control_destroy(app_control);
}
-static void utc_service_is_reply_requested_positive1(void)
+static void utc_app_control_is_reply_requested_positive1(void)
{
const char *API_NAME = __FUNCTION__;
int ret = SERVICE_ERROR_NONE;
- service_h service;
+ app_control_h app_control;
bool requested;
- service_create(&service);
+ app_control_create(&app_control);
- ret = service_is_reply_requested(service, &requested);
+ ret = app_control_is_reply_requested(app_control, &requested);
if(ret != SERVICE_ERROR_NONE)
{
dts_fail(API_NAME, "failed");
}
- service_destroy(service);
+ app_control_destroy(app_control);
}
-static void utc_service_is_reply_requested_negative1(void)
+static void utc_app_control_is_reply_requested_negative1(void)
{
const char *API_NAME = __FUNCTION__;
int ret = SERVICE_ERROR_NONE;
- service_h service;
+ app_control_h app_control;
- service_create(&service);
+ app_control_create(&app_control);
- ret = service_is_reply_requested(service, NULL);
+ ret = app_control_is_reply_requested(app_control, NULL);
if(ret != SERVICE_ERROR_NONE)
{
dts_fail(API_NAME, "failed");
}
- service_destroy(service);
+ app_control_destroy(app_control);
}
-static void utc_service_is_reply_requested_negative2(void)
+static void utc_app_control_is_reply_requested_negative2(void)
{
const char *API_NAME = __FUNCTION__;
int ret = SERVICE_ERROR_NONE;
bool requsted = false;
- ret = service_is_reply_requested(NULL, &requsted);
+ ret = app_control_is_reply_requested(NULL, &requsted);
if(ret != SERVICE_ERROR_NONE)
{
}
}
-static void utc_service_is_reply_requested_negative3(void)
+static void utc_app_control_is_reply_requested_negative3(void)
{
const char *API_NAME = __FUNCTION__;
int ret = SERVICE_ERROR_NONE;
- ret = service_is_reply_requested(NULL, NULL);
+ ret = app_control_is_reply_requested(NULL, NULL);
if(ret != SERVICE_ERROR_NONE)
{
}
-static void utc_service_get_caller_positive1(void)
+static void utc_app_control_get_caller_positive1(void)
{
const char *API_NAME = __FUNCTION__;
int ret = SERVICE_ERROR_NONE;
- service_h service;
+ app_control_h app_control;
char *caller;
- service_create(&service);
+ app_control_create(&app_control);
- ret = service_get_caller(service, &caller);
+ ret = app_control_get_caller(app_control, &caller);
if(ret != SERVICE_ERROR_NONE)
{
dts_fail(API_NAME, "failed");
}
- service_destroy(service);
+ app_control_destroy(app_control);
}
-static void utc_service_get_caller_negative1(void)
+static void utc_app_control_get_caller_negative1(void)
{
const char *API_NAME = __FUNCTION__;
int ret = SERVICE_ERROR_NONE;
- service_h service;
+ app_control_h app_control;
- service_create(&service);
+ app_control_create(&app_control);
- ret = service_get_caller(service, NULL);
+ ret = app_control_get_caller(app_control, NULL);
if(ret != SERVICE_ERROR_NONE)
{
dts_fail(API_NAME, "failed");
}
- service_destroy(service);
+ app_control_destroy(app_control);
}
-static void utc_service_get_caller_negative2(void)
+static void utc_app_control_get_caller_negative2(void)
{
const char *API_NAME = __FUNCTION__;
int ret = SERVICE_ERROR_NONE;
char *caller = NULL;
- ret = service_get_caller(NULL, &caller);
+ ret = app_control_get_caller(NULL, &caller);
+
+ if(ret != SERVICE_ERROR_NONE)
+ {
+ dts_pass(API_NAME, "passed");
+ }
+ else
+ {
+ dts_fail(API_NAME, "failed");
+ }
+}
+
+static void utc_app_control_get_caller_negative3(void)
+{
+ const char *API_NAME = __FUNCTION__;
+ int ret = SERVICE_ERROR_NONE;
+
+ ret = app_control_get_caller(NULL, NULL);
if(ret != SERVICE_ERROR_NONE)
{
}
}
-static void utc_service_get_caller_negative3(void)
+static void utc_app_control_to_bundle_positive1(void)
{
const char *API_NAME = __FUNCTION__;
int ret = SERVICE_ERROR_NONE;
+ app_control_h app_control;
+ bundle *data;
+ const char *input_value = "INPUT_VALUE";
- ret = service_get_caller(NULL, NULL);
+ app_control_create(&app_control);
+
+ ret = app_control_set_package(app_control, input_value);
+
+ ret = app_control_to_bundle(app_control, &data);
+
+ if(ret == SERVICE_ERROR_NONE)
+ {
+ dts_pass(API_NAME, "passed");
+ }
+ else
+ {
+ dts_fail(API_NAME, "failed");
+ }
+
+ app_control_destroy(app_control);
+}
+
+
+static void utc_app_control_to_bundle_negative1(void)
+{
+ const char *API_NAME = __FUNCTION__;
+ int ret = SERVICE_ERROR_NONE;
+
+ app_control_h app_control;
+
+ app_control_create(&app_control);
+
+ ret = app_control_to_bundle(app_control, NULL);
if(ret != SERVICE_ERROR_NONE)
{
{
dts_fail(API_NAME, "failed");
}
+
+ app_control_destroy(app_control);
}
+
+static void utc_app_control_to_bundle_negative2(void)
+{
+ const char *API_NAME = __FUNCTION__;
+ int ret = SERVICE_ERROR_NONE;
+
+ bundle *data = NULL;
+
+ ret = app_control_to_bundle(NULL, &data);
+
+ if(ret != SERVICE_ERROR_NONE)
+ {
+ dts_pass(API_NAME, "passed");
+ }
+ else
+ {
+ dts_fail(API_NAME, "failed");
+ }
+}
+
+static void utc_app_control_to_bundle_negative3(void)
+{
+ const char *API_NAME = __FUNCTION__;
+ int ret = SERVICE_ERROR_NONE;
+
+ ret = app_control_to_bundle(NULL, NULL);
+
+ if(ret != SERVICE_ERROR_NONE)
+ {
+ dts_pass(API_NAME, "passed");
+ }
+ else
+ {
+ dts_fail(API_NAME, "failed");
+ }
+}
+++ /dev/null
-/*
- * Copyright (c) 2011 Samsung Electronics Co., Ltd All Rights Reserved
- *
- * 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 <tet_api.h>
-#include <app.h>
-
-
-static void startup(void);
-static void cleanup(void);
-
-void (*tet_startup)(void) = startup;
-void (*tet_cleanup)(void) = cleanup;
-
-static void utc_storage_foreach_device_supported_positive(void);
-static void utc_storage_foreach_device_supported_negative(void);
-static void utc_storage_get_root_directory_positive(void);
-static void utc_storage_get_root_directory_negative1(void);
-static void utc_storage_get_root_directory_negative2(void);
-static void utc_storage_get_type_positive(void);
-static void utc_storage_get_type_negative1(void);
-static void utc_storage_get_type_negative2(void);
-static void utc_storage_get_state_positive(void);
-static void utc_storage_get_state_negative1(void);
-static void utc_storage_get_state_negative2(void);
-static void utc_storage_get_total_space_positive(void);
-static void utc_storage_get_total_space_negative1(void);
-static void utc_storage_get_total_space_negative2(void);
-static void utc_storage_get_available_space_positive(void);
-static void utc_storage_get_available_space_negative1(void);
-static void utc_storage_get_available_space_negative2(void);
-
-static void utc_storage_set_state_changed_cb_positive(void);
-static void utc_storage_set_state_changed_cb_negative1(void);
-static void utc_storage_set_state_changed_cb_negative2(void);
-
-static void utc_storage_unset_state_changed_cb_positive(void);
-static void utc_storage_unset_state_changed_cb_negative(void);
-
-struct tet_testlist tet_testlist[] = {
- {utc_storage_foreach_device_supported_positive, 1},
- {utc_storage_foreach_device_supported_negative, 2},
- {utc_storage_get_root_directory_positive, 1},
- {utc_storage_get_root_directory_negative1, 2},
- {utc_storage_get_root_directory_negative2, 2},
- {utc_storage_get_type_positive, 1},
- {utc_storage_get_type_negative1, 2},
- {utc_storage_get_type_negative2, 2},
- {utc_storage_get_state_positive, 1},
- {utc_storage_get_state_negative1, 2},
- {utc_storage_get_state_negative2, 2},
- {utc_storage_get_total_space_positive, 1},
- {utc_storage_get_total_space_negative1, 2},
- {utc_storage_get_total_space_negative2, 2},
- {utc_storage_get_available_space_positive, 1},
- {utc_storage_get_available_space_negative1, 2},
- {utc_storage_get_available_space_negative2, 2},
- {utc_storage_set_state_changed_cb_positive, 1},
- {utc_storage_set_state_changed_cb_negative1, 2},
- {utc_storage_set_state_changed_cb_negative2, 2},
- {utc_storage_unset_state_changed_cb_positive, 1},
- {utc_storage_unset_state_changed_cb_negative, 2},
- {NULL, 0},
-};
-
-static int internal_storage_id;
-
-bool get_internal_storage(int storage, storage_type_e type, storage_state_e state, const char *path, void *user_data)
-{
- if (type == STORAGE_TYPE_INTERNAL) {
- internal_storage_id = storage;
- return false;
- }
-
- return true;
-}
-
-static void startup(void)
-{
- storage_foreach_device_supported(get_internal_storage, NULL);
-}
-
-
-static void cleanup(void)
-{
- /* end of TC */
-
-}
-
-bool get_storage_device(int storage, storage_type_e type, storage_state_e state,
- const char *path, void *user_data)
-{
- return true;
-}
-
-static void utc_storage_foreach_device_supported_positive(void)
-{
- int err;
-
- err = storage_foreach_device_supported(get_storage_device, NULL);
-
- if (err == STORAGE_ERROR_NONE) {
- dts_pass("utc_storage_foreach_device_supported_positive", "passed");
- } else {
- dts_fail("utc_storage_foreach_device_supported_positive", "failed");
- }
-
-}
-
-static void utc_storage_foreach_device_supported_negative(void)
-{
- int err;
-
- err = storage_foreach_device_supported(NULL, NULL);
-
- if (err == STORAGE_ERROR_INVALID_PARAMETER) {
- dts_pass("utc_storage_foreach_device_supported_positive", "passed");
- } else {
- dts_fail("utc_storage_foreach_device_supported_positive", "failed");
- }
-}
-
-static void utc_storage_get_root_directory_positive(void)
-{
- int err;
- char* path;
- err = storage_get_root_directory(internal_storage_id, &path);
-
- if ((err == STORAGE_ERROR_NONE) && (path != NULL)) {
- dts_pass("utc_storage_get_root_directory_positive", "passed");
- } else {
- dts_fail("utc_storage_get_root_directory_positive", "failed");
- }
-}
-
-static void utc_storage_get_root_directory_negative1(void)
-{
- int err;
- char* path;
- err = storage_get_root_directory(10, &path);
-
- if (err == STORAGE_ERROR_NOT_SUPPORTED) {
- dts_pass("utc_storage_get_root_directory_negative1", "passed");
- } else {
- dts_fail("utc_storage_get_root_directory_negative1", "failed");
- }
-}
-
-static void utc_storage_get_root_directory_negative2(void)
-{
- int err;
-
- err = storage_get_root_directory(internal_storage_id, NULL);
-
- if (err == STORAGE_ERROR_INVALID_PARAMETER) {
- dts_pass("utc_storage_get_root_directory_negative2", "passed");
- } else {
- dts_fail("utc_storage_get_root_directory_negative2", "failed");
- }
-}
-
-static void utc_storage_get_type_positive(void)
-{
- int err;
- storage_type_e type;
-
- err = storage_get_type(internal_storage_id, &type);
-
- if ((err == STORAGE_ERROR_NONE) && (type == STORAGE_TYPE_INTERNAL)) {
- dts_pass("utc_storage_get_type_positive", "passed");
- } else {
- dts_fail("utc_storage_get_type_positive", "failed");
- }
-}
-
-static void utc_storage_get_type_negative1(void)
-{
- int err;
- storage_type_e type;
- err = storage_get_type(10, &type);
-
- if (err == STORAGE_ERROR_NOT_SUPPORTED) {
- dts_pass("utc_storage_get_type_negative1", "passed");
- } else {
- dts_fail("utc_storage_get_type_negative1", "failed");
- }
-}
-
-static void utc_storage_get_type_negative2(void)
-{
- int err;
- err = storage_get_type(internal_storage_id, NULL);
-
- if (err == STORAGE_ERROR_INVALID_PARAMETER) {
- dts_pass("utc_storage_get_type_negative2", "passed");
- } else {
- dts_fail("utc_storage_get_type_negative2", "failed");
- }
-}
-
-
-static void utc_storage_get_state_positive(void)
-{
- int err;
- storage_state_e state;
-
- err = storage_get_state(internal_storage_id, &state);
-
- if ((err == STORAGE_ERROR_NONE) && (state == STORAGE_STATE_MOUNTED)) {
- dts_pass("utc_storage_get_state_positive", "passed");
- } else {
- dts_fail("utc_storage_get_state_positive", "failed");
- }
-}
-
-static void utc_storage_get_state_negative1(void)
-{
- int err;
- storage_state_e state;
- err = storage_get_state(10, &state);
-
- if (err == STORAGE_ERROR_NOT_SUPPORTED) {
- dts_pass("utc_storage_get_state_negative1", "passed");
- } else {
- dts_fail("utc_storage_get_state_negative1", "failed");
- }
-}
-
-static void utc_storage_get_state_negative2(void)
-{
- int err;
- err = storage_get_state(internal_storage_id, NULL);
-
- if (err == STORAGE_ERROR_INVALID_PARAMETER) {
- dts_pass("utc_storage_get_state_negative2", "passed");
- } else {
- dts_fail("utc_storage_get_state_negative2", "failed");
- }
-}
-
-
-static void utc_storage_get_total_space_positive(void)
-{
- int err;
- unsigned long long size;
-
- err = storage_get_total_space(internal_storage_id, &size);
-
- if (err == STORAGE_ERROR_NONE) {
- dts_pass("utc_storage_get_total_space_positive", "passed");
- } else {
- dts_fail("utc_storage_get_total_space_positive", "failed");
- }
-}
-
-static void utc_storage_get_total_space_negative1(void)
-{
- int err;
- unsigned long long size;
- err = storage_get_total_space(10, &size);
-
- if (err == STORAGE_ERROR_NOT_SUPPORTED) {
- dts_pass("utc_storage_get_total_space_negative1", "passed");
- } else {
- dts_fail("utc_storage_get_total_space_negative1", "failed");
- }
-}
-
-static void utc_storage_get_total_space_negative2(void)
-{
- int err;
- err = storage_get_total_space(internal_storage_id, NULL);
-
- if (err == STORAGE_ERROR_INVALID_PARAMETER) {
- dts_pass("utc_storage_get_total_space_negative2", "passed");
- } else {
- dts_fail("utc_storage_get_total_space_negative2", "failed");
- }
-}
-
-
-static void utc_storage_get_available_space_positive(void)
-{
- int err;
- unsigned long long size;
-
- err = storage_get_available_space(internal_storage_id, &size);
-
- if (err == STORAGE_ERROR_NONE) {
- dts_pass("utc_storage_get_available_space_positive", "passed");
- } else {
- dts_fail("utc_storage_get_available_space_positive", "failed");
- }
-}
-
-static void utc_storage_get_available_space_negative1(void)
-{
- int err;
- unsigned long long size;
- err = storage_get_available_space(10, &size);
-
- if (err == STORAGE_ERROR_NOT_SUPPORTED) {
- dts_pass("utc_storage_get_available_space_negative1", "passed");
- } else {
- dts_fail("utc_storage_get_available_space_negative1", "failed");
- }
-}
-
-static void utc_storage_get_available_space_negative2(void)
-{
- int err;
- err = storage_get_available_space(internal_storage_id, NULL);
-
- if (err == STORAGE_ERROR_INVALID_PARAMETER) {
- dts_pass("utc_storage_get_available_space_negative2", "passed");
- } else {
- dts_fail("utc_storage_get_available_space_negative2", "failed");
- }
-}
-
-static void dts_storage_state_changed_cb(int storage, storage_state_e state, void *user_data)
-{
-
-}
-
-static void utc_storage_set_state_changed_cb_positive(void)
-{
- int err;
-
- err = storage_set_state_changed_cb(0, dts_storage_state_changed_cb, NULL);
-
- if (err == STORAGE_ERROR_NONE) {
- dts_pass("utc_storage_set_state_changed_cb_positive", "passed");
- } else {
- dts_fail("utc_storage_set_state_changed_cb_positive", "failed");
- }
-}
-
-static void utc_storage_set_state_changed_cb_negative1(void)
-{
- int err;
-
- err = storage_set_state_changed_cb(-1, dts_storage_state_changed_cb, NULL);
-
- if (err == STORAGE_ERROR_NOT_SUPPORTED) {
- dts_pass("utc_storage_set_state_changed_cb_negative1", "passed");
- } else {
- dts_fail("utc_storage_set_state_changed_cb_negative1", "failed");
- }
-}
-
-static void utc_storage_set_state_changed_cb_negative2(void)
-{
- int err;
-
- err = storage_set_state_changed_cb(0, NULL, NULL);
-
- if (err == STORAGE_ERROR_INVALID_PARAMETER) {
- dts_pass("utc_storage_set_state_changed_cb_negative2", "passed");
- } else {
- dts_fail("utc_storage_set_state_changed_cb_negative2", "failed");
- }
-}
-
-static void utc_storage_unset_state_changed_cb_positive(void)
-{
- int err;
-
- storage_set_state_changed_cb(0, dts_storage_state_changed_cb, NULL);
-
- err = storage_unset_state_changed_cb(0);
-
- if (err == STORAGE_ERROR_NONE) {
- dts_pass("utc_storage_unset_state_changed_cb_positive", "passed");
- } else {
- dts_fail("utc_storage_unset_state_changed_cb_positive", "failed");
- }
-}
-
-static void utc_storage_unset_state_changed_cb_negative(void)
-{
- int err;
-
- err = storage_unset_state_changed_cb(-1);
-
- if (err == STORAGE_ERROR_NOT_SUPPORTED) {
- dts_pass("utc_storage_unset_state_changed_cb_negative", "passed");
- } else {
- dts_fail("utc_storage_unset_state_changed_cb_negative", "failed");
- }
-}
-
+++ /dev/null
-/*
- * Copyright (c) 2011 Samsung Electronics Co., Ltd All Rights Reserved
- *
- * 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 <tet_api.h>
-#include <app.h>
-
-
-static void startup(void);
-static void cleanup(void);
-
-void (*tet_startup)(void) = startup;
-void (*tet_cleanup)(void) = cleanup;
-
-static void utc_notification_create_positive(void);
-static void utc_notification_create_negative(void);
-
-static void utc_notification_create_ongoing_positive(void);
-static void utc_notification_create_ongoing_negative(void);
-
-static void utc_notification_destroy_positive(void);
-static void utc_notification_destroy_negative(void);
-
-static void utc_notification_is_ongoing_positive1(void);
-static void utc_notification_is_ongoing_positive2(void);
-static void utc_notification_is_ongoing_negative1(void);
-static void utc_notification_is_ongoing_negative2(void);
-
-static void utc_notification_set_icon_positive1(void);
-static void utc_notification_set_icon_positive2(void);
-static void utc_notification_set_icon_negative1(void);
-
-static void utc_notification_get_icon_positive(void);
-static void utc_notification_get_icon_negative1(void);
-static void utc_notification_get_icon_negative2(void);
-
-static void utc_notification_set_time_positive1(void);
-static void utc_notification_set_time_positive2(void);
-static void utc_notification_set_time_negative1(void);
-
-static void utc_notification_get_time_positive(void);
-static void utc_notification_get_time_negative1(void);
-static void utc_notification_get_time_negative2(void);
-
-static void utc_notification_set_title_positive1(void);
-static void utc_notification_set_title_positive2(void);
-static void utc_notification_set_title_negative1(void);
-
-static void utc_notification_get_title_positive(void);
-static void utc_notification_get_title_negative1(void);
-static void utc_notification_get_title_negative2(void);
-
-static void utc_notification_set_content_positive1(void);
-static void utc_notification_set_content_positive2(void);
-static void utc_notification_set_content_negative1(void);
-
-static void utc_notification_get_content_positive(void);
-static void utc_notification_get_content_negative1(void);
-static void utc_notification_get_content_negative2(void);
-
-static void utc_notification_set_service_positive1(void);
-static void utc_notification_set_service_positive2(void);
-static void utc_notification_set_service_negative1(void);
-
-static void utc_notification_get_service_positive(void);
-static void utc_notification_get_service_negative1(void);
-static void utc_notification_get_service_negative2(void);
-
-static void utc_notification_set_sound_positive1(void);
-static void utc_notification_set_sound_positive2(void);
-static void utc_notification_set_sound_negative1(void);
-
-static void utc_notification_get_sound_positive(void);
-static void utc_notification_get_sound_negative1(void);
-static void utc_notification_get_sound_negative2(void);
-
-static void utc_notification_set_vibration_positive1(void);
-static void utc_notification_set_vibration_positive2(void);
-static void utc_notification_set_vibration_negative1(void);
-
-static void utc_notification_get_vibration_positive(void);
-static void utc_notification_get_vibration_negative1(void);
-static void utc_notification_get_vibration_negative2(void);
-
-static void utc_notification_post_negative1(void);
-
-static void utc_notification_cancel_negative1(void);
-
-static void utc_notification_cancel_all_positive(void);
-
-static void utc_notification_cancel_all_by_type_positive1(void);
-static void utc_notification_cancel_all_by_type_positive2(void);
-
-static void utc_notification_update_negative1(void);
-
-static void utc_notification_update_progress_negative1(void);
-
-static void utc_notification_foreach_notification_posted_positive1(void);
-static void utc_notification_foreach_notification_posted_positive2(void);
-static void utc_notification_foreach_notification_posted_negative1(void);
-static void utc_notification_foreach_notification_posted_negative2(void);
-
-static void utc_notification_clone_positive1(void);
-static void utc_notification_clone_positive2(void);
-static void utc_notification_clone_positive3(void);
-static void utc_notification_clone_positive4(void);
-static void utc_notification_clone_negative1(void);
-static void utc_notification_clone_negative2(void);
-
-struct tet_testlist tet_testlist[] = {
- {utc_notification_create_positive, 1},
- {utc_notification_create_negative, 1},
- {utc_notification_create_ongoing_positive, 1},
- {utc_notification_create_ongoing_negative, 1},
- {utc_notification_destroy_positive, 1},
- {utc_notification_destroy_negative, 1},
- {utc_notification_is_ongoing_positive1, 1},
- {utc_notification_is_ongoing_positive2, 1},
- {utc_notification_is_ongoing_negative1, 1},
- {utc_notification_is_ongoing_negative2, 1},
- {utc_notification_set_icon_positive1, 1},
- {utc_notification_set_icon_positive2, 1},
- {utc_notification_set_icon_negative1, 1},
- {utc_notification_get_icon_positive, 1},
- {utc_notification_get_icon_negative1, 1},
- {utc_notification_get_icon_negative2, 1},
- {utc_notification_set_time_positive1, 1},
- {utc_notification_set_time_positive2, 1},
- {utc_notification_set_time_negative1, 1},
- {utc_notification_get_time_positive, 1},
- {utc_notification_get_time_negative1, 1},
- {utc_notification_get_time_negative2, 1},
- {utc_notification_set_title_positive1, 1},
- {utc_notification_set_title_positive2, 1},
- {utc_notification_set_title_negative1, 1},
- {utc_notification_get_title_positive, 1},
- {utc_notification_get_title_negative1, 1},
- {utc_notification_get_title_negative2, 1},
- {utc_notification_set_content_positive1, 1},
- {utc_notification_set_content_positive2, 1},
- {utc_notification_set_content_negative1, 1},
- {utc_notification_get_content_positive, 1},
- {utc_notification_get_content_negative1, 1},
- {utc_notification_get_content_negative2, 1},
- {utc_notification_set_service_positive1, 1},
- {utc_notification_set_service_positive2, 1},
- {utc_notification_set_service_negative1, 1},
- {utc_notification_get_service_positive, 1},
- {utc_notification_get_service_negative1, 1},
- {utc_notification_get_service_negative2, 1},
- {utc_notification_set_sound_positive1, 1},
- {utc_notification_set_sound_positive2, 1},
- {utc_notification_set_sound_negative1, 1},
- {utc_notification_get_sound_positive, 1},
- {utc_notification_get_sound_negative1, 1},
- {utc_notification_get_sound_negative2, 1},
- {utc_notification_set_vibration_positive1, 1},
- {utc_notification_set_vibration_positive2, 1},
- {utc_notification_set_vibration_negative1, 1},
- {utc_notification_get_vibration_positive, 1},
- {utc_notification_get_vibration_negative1, 1},
- {utc_notification_get_vibration_negative2, 1},
- {utc_notification_post_negative1, 1},
- {utc_notification_cancel_negative1, 1},
- {utc_notification_cancel_all_positive, 1},
- {utc_notification_cancel_all_by_type_positive1, 1},
- {utc_notification_cancel_all_by_type_positive2, 1},
- {utc_notification_update_negative1, 1},
- {utc_notification_update_progress_negative1, 1},
- {utc_notification_foreach_notification_posted_positive1, 1},
- {utc_notification_foreach_notification_posted_positive2, 1},
- {utc_notification_foreach_notification_posted_negative1, 1},
- {utc_notification_foreach_notification_posted_negative2, 1},
- {utc_notification_clone_positive1, 1},
- {utc_notification_clone_positive2, 1},
- {utc_notification_clone_positive3, 1},
- {utc_notification_clone_positive4, 1},
- {utc_notification_clone_negative1, 1},
- {utc_notification_clone_negative2, 1},
- {NULL, 0},
-};
-
-static void startup(void)
-{
-
-}
-
-
-static void cleanup(void)
-{
- /* end of TC */
-}
-
-static void utc_notification_create_positive(void)
-{
- const char *API_NAME = __FUNCTION__;
- int retcode = UI_NOTIFICATION_ERROR_NONE;
-
- ui_notification_h notification;
-
- retcode = ui_notification_create(false, ¬ification);
-
- if (retcode == UI_NOTIFICATION_ERROR_NONE) {
- dts_pass(API_NAME, "passed");
- } else {
- dts_fail(API_NAME, "failed");
- }
-}
-
-static void utc_notification_create_negative(void)
-{
- const char *API_NAME = __FUNCTION__;
- int retcode = UI_NOTIFICATION_ERROR_NONE;
-
- retcode = ui_notification_create(false, NULL);
-
- if (retcode != UI_NOTIFICATION_ERROR_NONE) {
- dts_pass(API_NAME, "passed");
- } else {
- dts_fail(API_NAME, "failed");
- }
-}
-
-static void utc_notification_create_ongoing_positive(void)
-{
- const char *API_NAME = __FUNCTION__;
- int retcode = UI_NOTIFICATION_ERROR_NONE;
-
- ui_notification_h notification;
-
- retcode = ui_notification_create(true, ¬ification);
-
- if (retcode == UI_NOTIFICATION_ERROR_NONE) {
- dts_pass(API_NAME, "passed");
- } else {
- dts_fail(API_NAME, "failed");
- }
-}
-
-static void utc_notification_create_ongoing_negative(void)
-{
- const char *API_NAME = __FUNCTION__;
- int retcode = UI_NOTIFICATION_ERROR_NONE;
-
- retcode = ui_notification_create(true, NULL);
-
- if (retcode != UI_NOTIFICATION_ERROR_NONE) {
- dts_pass(API_NAME, "passed");
- } else {
- dts_fail(API_NAME, "failed");
- }
-}
-
-static void utc_notification_destroy_positive(void)
-{
- const char *API_NAME = __FUNCTION__;
- int retcode = UI_NOTIFICATION_ERROR_NONE;
-
- ui_notification_h notification;
-
- ui_notification_create(true, ¬ification);
-
- retcode = ui_notification_destroy(notification);
-
- if (retcode == UI_NOTIFICATION_ERROR_NONE) {
- dts_pass(API_NAME, "passed");
- } else {
- dts_fail(API_NAME, "failed");
- }
-}
-
-static void utc_notification_destroy_negative(void)
-{
- const char *API_NAME = __FUNCTION__;
- int retcode = UI_NOTIFICATION_ERROR_NONE;
-
- retcode = ui_notification_destroy(NULL);
-
- if (retcode != UI_NOTIFICATION_ERROR_NONE) {
- dts_pass(API_NAME, "passed");
- } else {
- dts_fail(API_NAME, "failed");
- }
-}
-
-static void utc_notification_is_ongoing_positive1()
-{
- const char *API_NAME = __FUNCTION__;
- int retcode = UI_NOTIFICATION_ERROR_NONE;
-
- ui_notification_h notification;
- bool value = false;
-
- ui_notification_create(true, ¬ification);
-
- retcode = ui_notification_is_ongoing(notification, &value);
-
- if (retcode == UI_NOTIFICATION_ERROR_NONE && value == true) {
- dts_pass(API_NAME, "passed");
- } else {
- dts_fail(API_NAME, "failed");
- }
-}
-
-static void utc_notification_is_ongoing_positive2()
-{
- const char *API_NAME = __FUNCTION__;
- int retcode = UI_NOTIFICATION_ERROR_NONE;
-
- ui_notification_h notification;
- bool value = false;
-
- ui_notification_create(false, ¬ification);
-
- retcode = ui_notification_is_ongoing(notification, &value);
-
- if (retcode == UI_NOTIFICATION_ERROR_NONE && value == false) {
- dts_pass(API_NAME, "passed");
- } else {
- dts_fail(API_NAME, "failed");
- }
-}
-
-static void utc_notification_is_ongoing_negative1()
-{
- const char *API_NAME = __FUNCTION__;
- int retcode = UI_NOTIFICATION_ERROR_NONE;
-
- ui_notification_h notification;
-
- ui_notification_create(true, ¬ification);
-
- retcode = ui_notification_is_ongoing(notification, NULL);
-
- if (retcode == UI_NOTIFICATION_ERROR_INVALID_PARAMETER) {
- dts_pass(API_NAME, "passed");
- } else {
- dts_fail(API_NAME, "failed");
- }
-}
-
-static void utc_notification_is_ongoing_negative2()
-{
- const char *API_NAME = __FUNCTION__;
- int retcode = UI_NOTIFICATION_ERROR_NONE;
-
- ui_notification_h notification;
- bool value;
-
- retcode = ui_notification_is_ongoing(NULL, &value);
-
- if (retcode == UI_NOTIFICATION_ERROR_INVALID_PARAMETER) {
- dts_pass(API_NAME, "passed");
- } else {
- dts_fail(API_NAME, "failed");
- }
-}
-
-static void utc_notification_set_icon_positive1(void)
-{
- const char *API_NAME = __FUNCTION__;
- int retcode = UI_NOTIFICATION_ERROR_NONE;
-
- ui_notification_h notification;
-
- ui_notification_create(false, ¬ification);
-
- retcode = ui_notification_set_icon(notification, "ICON");
-
- if (retcode == UI_NOTIFICATION_ERROR_NONE) {
- dts_pass(API_NAME, "passed");
- } else {
- dts_fail(API_NAME, "failed");
- }
-}
-
-static void utc_notification_set_icon_positive2(void)
-{
- const char *API_NAME = __FUNCTION__;
- int retcode = UI_NOTIFICATION_ERROR_NONE;
-
- ui_notification_h notification;
-
- ui_notification_create(false, ¬ification);
-
- ui_notification_set_icon(notification, "ICON");
-
- retcode = ui_notification_set_icon(notification, NULL);
-
- if (retcode == UI_NOTIFICATION_ERROR_NONE) {
- dts_pass(API_NAME, "passed");
- } else {
- dts_fail(API_NAME, "failed");
- }
-}
-
-static void utc_notification_set_icon_negative1(void)
-{
- const char *API_NAME = __FUNCTION__;
- int retcode = UI_NOTIFICATION_ERROR_NONE;
-
- retcode = ui_notification_set_icon(NULL, "ICON");
-
- if (retcode == UI_NOTIFICATION_ERROR_INVALID_PARAMETER) {
- dts_pass(API_NAME, "passed");
- } else {
- dts_fail(API_NAME, "failed");
- }
-}
-
-static void utc_notification_get_icon_positive(void)
-{
- const char *API_NAME = __FUNCTION__;
- int retcode = UI_NOTIFICATION_ERROR_NONE;
-
- ui_notification_h notification;
- char *value;
-
- ui_notification_create(false, ¬ification);
-
- ui_notification_set_icon(notification, "ICON");
-
- retcode = ui_notification_get_icon(notification, &value);
-
- if (retcode == UI_NOTIFICATION_ERROR_NONE) {
- dts_pass(API_NAME, "passed");
- } else {
- dts_fail(API_NAME, "failed");
- }
-}
-
-static void utc_notification_get_icon_negative1(void)
-{
- const char *API_NAME = __FUNCTION__;
- int retcode = UI_NOTIFICATION_ERROR_NONE;
-
- char *value;
-
- retcode = ui_notification_get_icon(NULL, &value);
-
- if (retcode == UI_NOTIFICATION_ERROR_INVALID_PARAMETER) {
- dts_pass(API_NAME, "passed");
- } else {
- dts_fail(API_NAME, "failed");
- }
-}
-
-static void utc_notification_get_icon_negative2(void)
-{
- const char *API_NAME = __FUNCTION__;
- int retcode = UI_NOTIFICATION_ERROR_NONE;
-
- ui_notification_h notification;
-
- ui_notification_create(false, ¬ification);
-
- ui_notification_set_icon(notification, "ICON");
-
- retcode = ui_notification_get_icon(notification, NULL);
-
- if (retcode == UI_NOTIFICATION_ERROR_INVALID_PARAMETER) {
- dts_pass(API_NAME, "passed");
- } else {
- dts_fail(API_NAME, "failed");
- }
-}
-
-static void utc_notification_set_time_positive1(void)
-{
- const char *API_NAME = __FUNCTION__;
- int retcode = UI_NOTIFICATION_ERROR_NONE;
-
- ui_notification_h notification;
- time_t t;
- struct tm tm_t;
-
- ui_notification_create(false, ¬ification);
-
- time(&t);
- localtime_r(&t, &tm_t);
-
- retcode = ui_notification_set_time(notification, &tm_t);
-
- if (retcode == UI_NOTIFICATION_ERROR_NONE) {
- dts_pass(API_NAME, "passed");
- } else {
- dts_fail(API_NAME, "failed");
- }
-}
-
-static void utc_notification_set_time_positive2(void)
-{
- const char *API_NAME = __FUNCTION__;
- int retcode = UI_NOTIFICATION_ERROR_NONE;
-
- ui_notification_h notification;
- time_t t;
- struct tm tm_t;
-
- ui_notification_create(false, ¬ification);
-
- time(&t);
- localtime_r(&t, &tm_t);
-
- ui_notification_set_time(notification, &tm_t);
-
- retcode = ui_notification_set_time(notification, NULL);
-
- if (retcode == UI_NOTIFICATION_ERROR_NONE) {
- dts_pass(API_NAME, "passed");
- } else {
- dts_fail(API_NAME, "failed");
- }
-}
-
-static void utc_notification_set_time_negative1(void)
-{
- const char *API_NAME = __FUNCTION__;
- int retcode = UI_NOTIFICATION_ERROR_NONE;
-
- time_t t;
- struct tm tm_t;
-
- time(&t);
- localtime_r(&t, &tm_t);
-
- retcode = ui_notification_set_time(NULL, NULL);
-
- if (retcode == UI_NOTIFICATION_ERROR_INVALID_PARAMETER) {
- dts_pass(API_NAME, "passed");
- } else {
- dts_fail(API_NAME, "failed");
- }
-}
-
-static void utc_notification_get_time_positive(void)
-{
- const char *API_NAME = __FUNCTION__;
- int retcode = UI_NOTIFICATION_ERROR_NONE;
-
- ui_notification_h notification;
- time_t t;
- struct tm tm_t;
- struct tm *value;
-
- ui_notification_create(false, ¬ification);
-
- time(&t);
- localtime_r(&t, &tm_t);
-
- ui_notification_set_time(notification, &tm_t);
-
- retcode = ui_notification_get_time(notification, &value);
-
- if (retcode == UI_NOTIFICATION_ERROR_NONE) {
- dts_pass(API_NAME, "passed");
- } else {
- dts_fail(API_NAME, "failed");
- }
-}
-
-static void utc_notification_get_time_negative1(void)
-{
- const char *API_NAME = __FUNCTION__;
- int retcode = UI_NOTIFICATION_ERROR_NONE;
-
- struct tm *value;
-
- retcode = ui_notification_get_time(NULL, &value);
-
- if (retcode == UI_NOTIFICATION_ERROR_INVALID_PARAMETER) {
- dts_pass(API_NAME, "passed");
- } else {
- dts_fail(API_NAME, "failed");
- }
-}
-
-static void utc_notification_get_time_negative2(void)
-{
- const char *API_NAME = __FUNCTION__;
- int retcode = UI_NOTIFICATION_ERROR_NONE;
-
- ui_notification_h notification;
- time_t t;
- struct tm tm_t;
-
- ui_notification_create(false, ¬ification);
-
- time(&t);
- localtime_r(&t, &tm_t);
-
- ui_notification_set_time(notification, &tm_t);
-
- retcode = ui_notification_get_time(notification, NULL);
-
- if (retcode == UI_NOTIFICATION_ERROR_INVALID_PARAMETER) {
- dts_pass(API_NAME, "passed");
- } else {
- dts_fail(API_NAME, "failed");
- }
-}
-
-static void utc_notification_set_title_positive1(void)
-{
- const char *API_NAME = __FUNCTION__;
- int retcode = UI_NOTIFICATION_ERROR_NONE;
-
- ui_notification_h notification;
-
- ui_notification_create(false, ¬ification);
-
- retcode = ui_notification_set_title(notification, "TITLE");
-
- if (retcode == UI_NOTIFICATION_ERROR_NONE) {
- dts_pass(API_NAME, "passed");
- } else {
- dts_fail(API_NAME, "failed");
- }
-}
-
-static void utc_notification_set_title_positive2(void)
-{
- const char *API_NAME = __FUNCTION__;
- int retcode = UI_NOTIFICATION_ERROR_NONE;
-
- ui_notification_h notification;
-
- ui_notification_create(false, ¬ification);
-
- ui_notification_set_title(notification, "TITLE");
-
- retcode = ui_notification_set_title(notification, NULL);
-
- if (retcode == UI_NOTIFICATION_ERROR_NONE) {
- dts_pass(API_NAME, "passed");
- } else {
- dts_fail(API_NAME, "failed");
- }
-}
-
-static void utc_notification_set_title_negative1(void)
-{
- const char *API_NAME = __FUNCTION__;
- int retcode = UI_NOTIFICATION_ERROR_NONE;
-
- retcode = ui_notification_set_title(NULL, "TITLE");
-
- if (retcode == UI_NOTIFICATION_ERROR_INVALID_PARAMETER) {
- dts_pass(API_NAME, "passed");
- } else {
- dts_fail(API_NAME, "failed");
- }
-}
-
-static void utc_notification_get_title_positive(void)
-{
- const char *API_NAME = __FUNCTION__;
- int retcode = UI_NOTIFICATION_ERROR_NONE;
-
- ui_notification_h notification;
- char *value;
-
- ui_notification_create(false, ¬ification);
-
- ui_notification_set_title(notification, "TITLE");
-
- retcode = ui_notification_get_title(notification, &value);
-
- if (retcode == UI_NOTIFICATION_ERROR_NONE) {
- dts_pass(API_NAME, "passed");
- } else {
- dts_fail(API_NAME, "failed");
- }
-}
-
-static void utc_notification_get_title_negative1(void)
-{
- const char *API_NAME = __FUNCTION__;
- int retcode = UI_NOTIFICATION_ERROR_NONE;
-
- char *value;
-
- retcode = ui_notification_get_title(NULL, &value);
-
- if (retcode == UI_NOTIFICATION_ERROR_INVALID_PARAMETER) {
- dts_pass(API_NAME, "passed");
- } else {
- dts_fail(API_NAME, "failed");
- }
-}
-
-static void utc_notification_get_title_negative2(void)
-{
- const char *API_NAME = __FUNCTION__;
- int retcode = UI_NOTIFICATION_ERROR_NONE;
-
- ui_notification_h notification;
-
- ui_notification_create(false, ¬ification);
-
- ui_notification_set_title(notification, "TITLE");
-
- retcode = ui_notification_get_title(notification, NULL);
-
- if (retcode == UI_NOTIFICATION_ERROR_INVALID_PARAMETER) {
- dts_pass(API_NAME, "passed");
- } else {
- dts_fail(API_NAME, "failed");
- }
-}
-
-static void utc_notification_set_content_positive1(void)
-{
- const char *API_NAME = __FUNCTION__;
- int retcode = UI_NOTIFICATION_ERROR_NONE;
-
- ui_notification_h notification;
-
- ui_notification_create(false, ¬ification);
-
- retcode = ui_notification_set_content(notification, "CONTENT");
-
- if (retcode == UI_NOTIFICATION_ERROR_NONE) {
- dts_pass(API_NAME, "passed");
- } else {
- dts_fail(API_NAME, "failed");
- }
-}
-
-static void utc_notification_set_content_positive2(void)
-{
- const char *API_NAME = __FUNCTION__;
- int retcode = UI_NOTIFICATION_ERROR_NONE;
-
- ui_notification_h notification;
-
- ui_notification_create(false, ¬ification);
-
- ui_notification_set_content(notification, "CONTENT");
-
- retcode = ui_notification_set_content(notification, NULL);
-
- if (retcode == UI_NOTIFICATION_ERROR_NONE) {
- dts_pass(API_NAME, "passed");
- } else {
- dts_fail(API_NAME, "failed");
- }
-}
-
-static void utc_notification_set_content_negative1(void)
-{
- const char *API_NAME = __FUNCTION__;
- int retcode = UI_NOTIFICATION_ERROR_NONE;
-
- retcode = ui_notification_set_content(NULL, "CONTENT");
-
- if (retcode == UI_NOTIFICATION_ERROR_INVALID_PARAMETER) {
- dts_pass(API_NAME, "passed");
- } else {
- dts_fail(API_NAME, "failed");
- }
-}
-
-static void utc_notification_get_content_positive(void)
-{
- const char *API_NAME = __FUNCTION__;
- int retcode = UI_NOTIFICATION_ERROR_NONE;
-
- ui_notification_h notification;
- char *value;
-
- ui_notification_create(false, ¬ification);
-
- ui_notification_set_content(notification, "CONTENT");
-
- retcode = ui_notification_get_content(notification, &value);
-
- if (retcode == UI_NOTIFICATION_ERROR_NONE) {
- dts_pass(API_NAME, "passed");
- } else {
- dts_fail(API_NAME, "failed");
- }
-}
-
-static void utc_notification_get_content_negative1(void)
-{
- const char *API_NAME = __FUNCTION__;
- int retcode = UI_NOTIFICATION_ERROR_NONE;
-
- char *value;
-
- retcode = ui_notification_get_content(NULL, &value);
-
- if (retcode == UI_NOTIFICATION_ERROR_INVALID_PARAMETER) {
- dts_pass(API_NAME, "passed");
- } else {
- dts_fail(API_NAME, "failed");
- }
-}
-
-static void utc_notification_get_content_negative2(void)
-{
- const char *API_NAME = __FUNCTION__;
- int retcode = UI_NOTIFICATION_ERROR_NONE;
-
- ui_notification_h notification;
-
- ui_notification_create(false, ¬ification);
-
- ui_notification_set_content(notification, "CONTENT");
-
- retcode = ui_notification_get_content(notification, NULL);
-
- if (retcode == UI_NOTIFICATION_ERROR_INVALID_PARAMETER) {
- dts_pass(API_NAME, "passed");
- } else {
- dts_fail(API_NAME, "failed");
- }
-}
-
-static void utc_notification_set_service_positive1(void)
-{
- const char *API_NAME = __FUNCTION__;
- int retcode = UI_NOTIFICATION_ERROR_NONE;
-
- ui_notification_h notification;
- service_h service;
-
- ui_notification_create(false, ¬ification);
-
- service_create(&service);
-
- retcode = ui_notification_set_service(notification, service);
-
- if (retcode == UI_NOTIFICATION_ERROR_NONE) {
- dts_pass(API_NAME, "passed");
- } else {
- dts_fail(API_NAME, "failed");
- }
-}
-
-static void utc_notification_set_service_positive2(void)
-{
- const char *API_NAME = __FUNCTION__;
- int retcode = UI_NOTIFICATION_ERROR_NONE;
-
- ui_notification_h notification;
- service_h service;
-
- ui_notification_create(false, ¬ification);
-
- service_create(&service);
-
- ui_notification_set_service(notification, service);
-
- retcode = ui_notification_set_service(notification, NULL);
-
- if (retcode == UI_NOTIFICATION_ERROR_NONE) {
- dts_pass(API_NAME, "passed");
- } else {
- dts_fail(API_NAME, "failed");
- }
-}
-
-static void utc_notification_set_service_negative1(void)
-{
- const char *API_NAME = __FUNCTION__;
- int retcode = UI_NOTIFICATION_ERROR_NONE;
-
- service_h service;
- service_create(&service);
-
- retcode = ui_notification_set_service(NULL, service);
-
- if (retcode == UI_NOTIFICATION_ERROR_INVALID_PARAMETER) {
- dts_pass(API_NAME, "passed");
- } else {
- dts_fail(API_NAME, "failed");
- }
-}
-
-static void utc_notification_get_service_positive(void)
-{
- const char *API_NAME = __FUNCTION__;
- int retcode = UI_NOTIFICATION_ERROR_NONE;
-
- ui_notification_h notification;
- service_h service;
- service_h value;
-
- ui_notification_create(false, ¬ification);
-
- service_create(&service);
-
- ui_notification_set_service(notification, service);
-
- retcode = ui_notification_get_service(notification, &value);
-
- if (retcode == UI_NOTIFICATION_ERROR_NONE) {
- dts_pass(API_NAME, "passed");
- } else {
- dts_fail(API_NAME, "failed");
- }
-}
-
-static void utc_notification_get_service_negative1(void)
-{
- const char *API_NAME = __FUNCTION__;
- int retcode = UI_NOTIFICATION_ERROR_NONE;
-
- service_h value;
-
- retcode = ui_notification_get_service(NULL, &value);
-
- if (retcode == UI_NOTIFICATION_ERROR_INVALID_PARAMETER) {
- dts_pass(API_NAME, "passed");
- } else {
- dts_fail(API_NAME, "failed");
- }
-}
-
-static void utc_notification_get_service_negative2(void)
-{
- const char *API_NAME = __FUNCTION__;
- int retcode = UI_NOTIFICATION_ERROR_NONE;
-
- ui_notification_h notification;
- service_h service;
-
- ui_notification_create(false, ¬ification);
-
- service_create(&service);
-
- ui_notification_set_service(notification, service);
-
- retcode = ui_notification_get_service(notification, NULL);
-
- if (retcode == UI_NOTIFICATION_ERROR_INVALID_PARAMETER) {
- dts_pass(API_NAME, "passed");
- } else {
- dts_fail(API_NAME, "failed");
- }
-}
-
-static void utc_notification_set_sound_positive1(void)
-{
- const char *API_NAME = __FUNCTION__;
- int retcode = UI_NOTIFICATION_ERROR_NONE;
-
- ui_notification_h notification;
-
- ui_notification_create(false, ¬ification);
-
- retcode = ui_notification_set_sound(notification, "/usr/share/svi/sound/operation/new_chat.wav");
-
- if (retcode == UI_NOTIFICATION_ERROR_NONE) {
- dts_pass(API_NAME, "passed");
- } else {
- dts_fail(API_NAME, "failed");
- }
-}
-
-static void utc_notification_set_sound_positive2(void)
-{
- const char *API_NAME = __FUNCTION__;
- int retcode = UI_NOTIFICATION_ERROR_NONE;
-
- ui_notification_h notification;
-
- ui_notification_create(false, ¬ification);
-
- ui_notification_set_sound(notification, "/usr/share/svi/sound/operation/new_chat.wav");
-
- retcode = ui_notification_set_sound(notification, NULL);
-
- if (retcode == UI_NOTIFICATION_ERROR_NONE) {
- dts_pass(API_NAME, "passed");
- } else {
- dts_fail(API_NAME, "failed");
- }
-}
-
-static void utc_notification_set_sound_negative1(void)
-{
- const char *API_NAME = __FUNCTION__;
- int retcode = UI_NOTIFICATION_ERROR_NONE;
-
- retcode = ui_notification_set_sound(NULL, "/usr/share/svi/sound/operation/new_chat.wav");
-
- if (retcode == UI_NOTIFICATION_ERROR_INVALID_PARAMETER) {
- dts_pass(API_NAME, "passed");
- } else {
- dts_fail(API_NAME, "failed");
- }
-}
-
-static void utc_notification_get_sound_positive(void)
-{
- const char *API_NAME = __FUNCTION__;
- int retcode = UI_NOTIFICATION_ERROR_NONE;
-
- ui_notification_h notification;
- char *value;
-
- ui_notification_create(false, ¬ification);
-
- ui_notification_set_sound(notification, "/usr/share/svi/sound/operation/new_chat.wav");
-
- retcode = ui_notification_get_sound(notification, &value);
-
- if (retcode == UI_NOTIFICATION_ERROR_NONE) {
- dts_pass(API_NAME, "passed");
- } else {
- dts_fail(API_NAME, "failed");
- }
-}
-
-static void utc_notification_get_sound_negative1(void)
-{
- const char *API_NAME = __FUNCTION__;
- int retcode = UI_NOTIFICATION_ERROR_NONE;
-
- char *value;
-
- retcode = ui_notification_get_sound(NULL, &value);
-
- if (retcode == UI_NOTIFICATION_ERROR_INVALID_PARAMETER) {
- dts_pass(API_NAME, "passed");
- } else {
- dts_fail(API_NAME, "failed");
- }
-}
-
-static void utc_notification_get_sound_negative2(void)
-{
- const char *API_NAME = __FUNCTION__;
- int retcode = UI_NOTIFICATION_ERROR_NONE;
-
- ui_notification_h notification;
-
- ui_notification_create(false, ¬ification);
-
- ui_notification_set_sound(notification, "/usr/share/svi/sound/operation/new_chat.wav");
-
- retcode = ui_notification_get_sound(notification, NULL);
-
- if (retcode == UI_NOTIFICATION_ERROR_INVALID_PARAMETER) {
- dts_pass(API_NAME, "passed");
- } else {
- dts_fail(API_NAME, "failed");
- }
-}
-
-static void utc_notification_set_vibration_positive1(void)
-{
- const char *API_NAME = __FUNCTION__;
- int retcode = UI_NOTIFICATION_ERROR_NONE;
-
- ui_notification_h notification;
-
- ui_notification_create(false, ¬ification);
-
- retcode = ui_notification_set_vibration(notification, true);
-
- if (retcode == UI_NOTIFICATION_ERROR_NONE) {
- dts_pass(API_NAME, "passed");
- } else {
- dts_fail(API_NAME, "failed");
- }
-}
-
-static void utc_notification_set_vibration_positive2(void)
-{
- const char *API_NAME = __FUNCTION__;
- int retcode = UI_NOTIFICATION_ERROR_NONE;
-
- ui_notification_h notification;
-
- ui_notification_create(false, ¬ification);
-
- ui_notification_set_vibration(notification, true);
-
- retcode = ui_notification_set_vibration(notification, false);
-
- if (retcode == UI_NOTIFICATION_ERROR_NONE) {
- dts_pass(API_NAME, "passed");
- } else {
- dts_fail(API_NAME, "failed");
- }
-}
-
-static void utc_notification_set_vibration_negative1(void)
-{
- const char *API_NAME = __FUNCTION__;
- int retcode = UI_NOTIFICATION_ERROR_NONE;
-
- retcode = ui_notification_set_vibration(NULL, false);
-
- if (retcode == UI_NOTIFICATION_ERROR_INVALID_PARAMETER) {
- dts_pass(API_NAME, "passed");
- } else {
- dts_fail(API_NAME, "failed");
- }
-}
-
-static void utc_notification_get_vibration_positive(void)
-{
- const char *API_NAME = __FUNCTION__;
- int retcode = UI_NOTIFICATION_ERROR_NONE;
-
- ui_notification_h notification;
- bool value;
-
- ui_notification_create(false, ¬ification);
-
- ui_notification_set_vibration(notification, true);
-
- retcode = ui_notification_get_vibration(notification, &value);
-
- if (retcode == UI_NOTIFICATION_ERROR_NONE) {
- dts_pass(API_NAME, "passed");
- } else {
- dts_fail(API_NAME, "failed");
- }
-}
-
-static void utc_notification_get_vibration_negative1(void)
-{
- const char *API_NAME = __FUNCTION__;
- int retcode = UI_NOTIFICATION_ERROR_NONE;
-
- bool value;
-
- retcode = ui_notification_get_vibration(NULL, &value);
-
- if (retcode == UI_NOTIFICATION_ERROR_INVALID_PARAMETER) {
- dts_pass(API_NAME, "passed");
- } else {
- dts_fail(API_NAME, "failed");
- }
-}
-
-static void utc_notification_get_vibration_negative2(void)
-{
- const char *API_NAME = __FUNCTION__;
- int retcode = UI_NOTIFICATION_ERROR_NONE;
-
- ui_notification_h notification;
-
- ui_notification_create(false, ¬ification);
-
- ui_notification_set_vibration(notification, true);
-
- retcode = ui_notification_get_vibration(notification, NULL);
-
- if (retcode == UI_NOTIFICATION_ERROR_INVALID_PARAMETER) {
- dts_pass(API_NAME, "passed");
- } else {
- dts_fail(API_NAME, "failed");
- }
-}
-
-static void utc_notification_post_negative1(void)
-{
- const const char *API_NAME = __FUNCTION__;
- int retcode = UI_NOTIFICATION_ERROR_NONE;
-
- retcode = ui_notification_post(NULL);
-
- if (retcode == UI_NOTIFICATION_ERROR_INVALID_PARAMETER) {
- dts_pass(API_NAME, "passed");
- } else {
- dts_fail(API_NAME, "failed");
- }
-}
-
-static void utc_notification_cancel_negative1(void)
-{
- const const char *API_NAME = __FUNCTION__;
- int retcode = UI_NOTIFICATION_ERROR_NONE;
-
- retcode = ui_notification_cancel(NULL);
-
- if (retcode == UI_NOTIFICATION_ERROR_INVALID_PARAMETER) {
- dts_pass(API_NAME, "passed");
- } else {
- dts_fail(API_NAME, "failed");
- }
-}
-
-static void utc_notification_cancel_all_positive(void)
-{
- const const char *API_NAME = __FUNCTION__;
-
- ui_notification_cancel_all();
-
- dts_pass(API_NAME, "passed");
-}
-
-static void utc_notification_cancel_all_by_type_positive1(void)
-{
- const const char *API_NAME = __FUNCTION__;
-
- ui_notification_cancel_all_by_type(false);
-
- dts_pass(API_NAME, "passed");
-}
-
-static void utc_notification_cancel_all_by_type_positive2(void)
-{
- const const char *API_NAME = __FUNCTION__;
-
- ui_notification_cancel_all_by_type(true);
-
- dts_pass(API_NAME, "passed");
-}
-
-static void utc_notification_update_negative1(void)
-{
- const const char *API_NAME = __FUNCTION__;
- int retcode = UI_NOTIFICATION_ERROR_NONE;
-
- retcode = ui_notification_update(NULL);
-
- if (retcode == UI_NOTIFICATION_ERROR_INVALID_PARAMETER) {
- dts_pass(API_NAME, "passed");
- } else {
- dts_fail(API_NAME, "failed");
- }
-}
-
-static void utc_notification_update_progress_negative1(void)
-{
- const const char *API_NAME = __FUNCTION__;
- int retcode = UI_NOTIFICATION_ERROR_NONE;
-
- retcode = ui_notification_update_progress(NULL, UI_NOTIFICATION_PROGRESS_TYPE_PERCENTAGE, 0);
-
- if (retcode == UI_NOTIFICATION_ERROR_INVALID_PARAMETER) {
- dts_pass(API_NAME, "passed");
- } else {
- dts_fail(API_NAME, "failed");
- }
-}
-
-static bool utc_ui_notification_cb(ui_notification_h notification, void *user_data)
-{
- return true;
-}
-
-static void utc_notification_foreach_notification_posted_positive1(void)
-{
- const char *API_NAME = __FUNCTION__;
- int retcode = UI_NOTIFICATION_ERROR_NONE;
-
- retcode = ui_notification_foreach_notification_posted(true, utc_ui_notification_cb, NULL);
-
- if (retcode == UI_NOTIFICATION_ERROR_NONE) {
- dts_pass(API_NAME, "passed");
- } else {
- dts_fail(API_NAME, "failed");
- }
-}
-
-static void utc_notification_foreach_notification_posted_positive2(void)
-{
- const char *API_NAME = __FUNCTION__;
- int retcode = UI_NOTIFICATION_ERROR_NONE;
-
- retcode = ui_notification_foreach_notification_posted(false, utc_ui_notification_cb, NULL);
-
- if (retcode == UI_NOTIFICATION_ERROR_NONE) {
- dts_pass(API_NAME, "passed");
- } else {
- dts_fail(API_NAME, "failed");
- }
-}
-
-static void utc_notification_foreach_notification_posted_negative1(void)
-{
- const const char *API_NAME = __FUNCTION__;
- int retcode = UI_NOTIFICATION_ERROR_NONE;
-
- retcode = ui_notification_foreach_notification_posted(true, NULL, NULL);
-
- if (retcode == UI_NOTIFICATION_ERROR_INVALID_PARAMETER) {
- dts_pass(API_NAME, "passed");
- } else {
- dts_fail(API_NAME, "failed");
- }
-}
-
-static void utc_notification_foreach_notification_posted_negative2(void)
-{
- const const char *API_NAME = __FUNCTION__;
- int retcode = UI_NOTIFICATION_ERROR_NONE;
-
- retcode = ui_notification_foreach_notification_posted(true, NULL, NULL);
-
- if (retcode == UI_NOTIFICATION_ERROR_INVALID_PARAMETER) {
- dts_pass(API_NAME, "passed");
- } else {
- dts_fail(API_NAME, "failed");
- }
-}
-
-static void utc_notification_clone_positive1(void)
-{
- const char *API_NAME = __FUNCTION__;
- int retcode = UI_NOTIFICATION_ERROR_NONE;
-
- ui_notification_h notification;
- ui_notification_h clone;
-
- ui_notification_create(true, ¬ification);
-
- retcode = ui_notification_clone(&clone, notification);
-
- if (retcode == UI_NOTIFICATION_ERROR_NONE) {
- dts_pass(API_NAME, "passed");
- } else {
- dts_fail(API_NAME, "failed");
- }
-}
-
-static void utc_notification_clone_positive2(void)
-{
- const char *API_NAME = __FUNCTION__;
- int retcode = UI_NOTIFICATION_ERROR_NONE;
-
- ui_notification_h notification;
- ui_notification_h clone;
-
- ui_notification_create(false, ¬ification);
-
- retcode = ui_notification_clone(&clone, notification);
-
- if (retcode == UI_NOTIFICATION_ERROR_NONE) {
- dts_pass(API_NAME, "passed");
- } else {
- dts_fail(API_NAME, "failed");
- }
-}
-
-static void utc_notification_clone_positive3(void)
-{
- const char *API_NAME = __FUNCTION__;
- int retcode = UI_NOTIFICATION_ERROR_NONE;
-
- ui_notification_h notification;
- ui_notification_h clone;
- bool ongoing = true;
- bool ongoing_clone = false;
- char *title = "TITLE";
- char *content = "CONTENT";
- char *icon = "ICON_PATH";
- char *title_clone = NULL;
- char *content_clone = NULL;
- char *icon_clone = NULL;
- int equal = 0;
-
- ui_notification_create(ongoing, ¬ification);
-
- ui_notification_set_title(notification, title);
- ui_notification_set_content(notification, content);
- ui_notification_set_icon(notification, icon);
-
- retcode = ui_notification_clone(&clone, notification);
-
- if (!ui_notification_is_ongoing(clone, &ongoing_clone))
- {
- if (ongoing == ongoing_clone)
- {
- equal++;
- }
- }
-
- if (!ui_notification_get_title(clone, &title_clone))
- {
- if (!strcmp(title, title_clone))
- {
- equal++;
- }
- }
-
- if (!ui_notification_get_content(clone, &content_clone))
- {
- if (!strcmp(content, content_clone))
- {
- equal++;
- }
- }
-
- if (!ui_notification_get_icon(clone, &icon_clone))
- {
- if (!strcmp(icon, icon_clone))
- {
- equal++;
- }
- }
-
- if (retcode == UI_NOTIFICATION_ERROR_NONE && equal == 4) {
- dts_pass(API_NAME, "passed");
- } else {
- dts_fail(API_NAME, "failed");
- }
-}
-
-static void utc_notification_clone_positive4(void)
-{
- const char *API_NAME = __FUNCTION__;
- int retcode = UI_NOTIFICATION_ERROR_NONE;
-
- ui_notification_h notification;
- ui_notification_h clone;
- bool ongoing = false;
- bool ongoing_clone = false;
- char *title = "TITLE";
- char *content = "CONTENT";
- char *icon = "ICON_PATH";
- char *title_clone = NULL;
- char *content_clone = NULL;
- char *icon_clone = NULL;
- int equal = 0;
-
- ui_notification_create(ongoing, ¬ification);
-
- ui_notification_set_title(notification, title);
- ui_notification_set_content(notification, content);
- ui_notification_set_icon(notification, icon);
-
- retcode = ui_notification_clone(&clone, notification);
-
- if (!ui_notification_is_ongoing(clone, &ongoing_clone))
- {
- if (ongoing == ongoing_clone)
- {
- equal++;
- }
- }
-
- if (!ui_notification_get_title(clone, &title_clone))
- {
- if (!strcmp(title, title_clone))
- {
- equal++;
- }
- }
-
- if (!ui_notification_get_content(clone, &content_clone))
- {
- if (!strcmp(content, content_clone))
- {
- equal++;
- }
- }
-
- if (!ui_notification_get_icon(clone, &icon_clone))
- {
- if (!strcmp(icon, icon_clone))
- {
- equal++;
- }
- }
-
- if (retcode == UI_NOTIFICATION_ERROR_NONE && equal == 4) {
- dts_pass(API_NAME, "passed");
- } else {
- dts_fail(API_NAME, "failed");
- }
-
-}
-
-static void utc_notification_clone_negative1(void)
-{
- const const char *API_NAME = __FUNCTION__;
- int retcode = UI_NOTIFICATION_ERROR_NONE;
-
- ui_notification_h notification;
- ui_notification_create(true, ¬ification);
-
- retcode = ui_notification_clone(NULL, notification);
-
- if (retcode == UI_NOTIFICATION_ERROR_INVALID_PARAMETER) {
- dts_pass(API_NAME, "passed");
- } else {
- dts_fail(API_NAME, "failed");
- }
-}
-
-static void utc_notification_clone_negative2(void)
-{
- const const char *API_NAME = __FUNCTION__;
- int retcode = UI_NOTIFICATION_ERROR_NONE;
-
- ui_notification_h clone;
-
- retcode = ui_notification_clone(&clone, NULL);
-
- if (retcode == UI_NOTIFICATION_ERROR_INVALID_PARAMETER) {
- dts_pass(API_NAME, "passed");
- } else {
- dts_fail(API_NAME, "failed");
- }
-}
--- /dev/null
+CMAKE_MINIMUM_REQUIRED(VERSION 2.6)
+SET(fw_name "capi-appfw-alarm")
+
+PROJECT(${fw_name})
+
+SET(CMAKE_INSTALL_PREFIX /usr)
+SET(PREFIX ${CMAKE_INSTALL_PREFIX})
+
+SET(INC_DIR ${CMAKE_SOURCE_DIR}/include)
+INCLUDE_DIRECTORIES(${INC_DIR})
+
+SET(requires "dlog bundle alarm-service capi-base-common")
+SET(pc_requires "capi-base-common capi-appfw-app-control")
+
+INCLUDE(FindPkgConfig)
+pkg_check_modules(${fw_name} REQUIRED ${requires})
+FOREACH(flag ${${fw_name}_CFLAGS})
+ SET(EXTRA_CFLAGS "${EXTRA_CFLAGS} ${flag}")
+ENDFOREACH(flag)
+
+SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${EXTRA_CFLAGS} -fPIC -Wall -Werror")
+SET(CMAKE_C_FLAGS_DEBUG "-O0 -g")
+
+IF("${ARCH}" STREQUAL "arm")
+ ADD_DEFINITIONS("-DTARGET")
+ENDIF("${ARCH}" STREQUAL "arm")
+
+ADD_DEFINITIONS("-DPREFIX=\"${CMAKE_INSTALL_PREFIX}\"")
+ADD_DEFINITIONS("-DSLP_DEBUG")
+
+SET(CMAKE_EXE_LINKER_FLAGS "-Wl,--as-needed -Wl,--rpath=/usr/lib")
+
+add_library(${fw_name} SHARED
+ alarm.c
+ )
+
+TARGET_LINK_LIBRARIES(${fw_name} capi-appfw-app-control ${${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
+ FILES_MATCHING
+ PATTERN "*_private.h" EXCLUDE
+ PATTERN "${INC_DIR}/*.h"
+ )
+
+SET(PC_NAME ${fw_name})
+SET(PC_REQUIRED ${pc_requires})
+SET(PC_LDFLAGS -l${fw_name})
+
+CONFIGURE_FILE(
+ ${CMAKE_SOURCE_DIR}/capi-appfw-module.pc.in
+ ${CMAKE_SOURCE_DIR}/${fw_name}.pc
+ @ONLY
+)
+INSTALL(FILES ${CMAKE_SOURCE_DIR}/${fw_name}.pc DESTINATION lib/pkgconfig)
+
+
* 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.
+ * limitations under the License.
*/
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-#include <unistd.h>
#include <time.h>
-#include <aul.h>
#include <alarm.h>
#include <dlog.h>
-#include <app_private.h>
#include <app_alarm.h>
-#include <app_service_private.h>
+#include <app_control_internal.h>
#ifdef LOG_TAG
#undef LOG_TAG
#endif
-#define LOG_TAG "CAPI_APPFW_APPLICATION_ALARM"
+#define LOG_TAG "CAPI_APPFW_ALARM"
typedef struct {
alarm_registered_alarm_cb cb;
LOGE("[%s] INVALID_DATE(0x%08x)", function, ALARM_ERROR_INVALID_DATE);
return ALARM_ERROR_INVALID_DATE;
break;
-
+
case ERR_ALARM_NO_SERVICE_NAME:
LOGE("[%s] INVALID_PARAMETER(0x%08x)", function, ALARM_ERROR_INVALID_PARAMETER);
return ALARM_ERROR_INVALID_PARAMETER;
case ALARMMGR_RESULT_SUCCESS:
return ALARM_ERROR_NONE;
break;
-
+
default:
- return ALARM_ERROR_INVALID_PARAMETER;
+ return ALARM_ERROR_INVALID_PARAMETER;
}
-
}
int alarm_get_scheduled_date(int alarm_id, struct tm* date)
{
LOGE("INVALID_PARAMETER(0x%08x)", ALARM_ERROR_INVALID_PARAMETER);
return ALARM_ERROR_INVALID_PARAMETER;
- }
+ }
result = alarmmgr_get_next_duetime(alarm_id, &due_time);
if (result != ALARMMGR_RESULT_SUCCESS)
{
return convert_error_code_to_alarm(__FUNCTION__, result);
}
-
+
localtime_r(&due_time, date);
return ALARM_ERROR_NONE;
-
}
int alarm_get_scheduled_period(int alarm_id, int* period)
LOGE("INVALID_PARAMETER(0x%08x)", ALARM_ERROR_INVALID_PARAMETER);
return ALARM_ERROR_INVALID_PARAMETER;
}
-
+
entry = alarmmgr_create_alarm();
result = alarmmgr_get_info(alarm_id, entry);
if (entry != NULL)
{
alarmmgr_free_alarm(entry);
- }
+ }
return convert_error_code_to_alarm(__FUNCTION__, result);
}
-
+
result = alarmmgr_get_repeat_mode(entry, &mode, &value);
if (result != ALARMMGR_RESULT_SUCCESS)
{
if (entry != NULL)
{
alarmmgr_free_alarm(entry);
- }
+ }
return convert_error_code_to_alarm(__FUNCTION__, result);
}
if (entry != NULL)
{
alarmmgr_free_alarm(entry);
- }
+ }
return convert_error_code_to_alarm(__FUNCTION__, result);
}
-
+
(*period) = value;
return ALARM_ERROR_NONE;
-
}
-int alarm_schedule_after_delay(service_h service, int delay, int period, int *alarm_id)
+int alarm_schedule_after_delay(app_control_h app_control, int delay, int period, int *alarm_id)
{
bundle *bundle_data;
int result = 0;
- if (service == NULL)
+ if (app_control == NULL)
{
LOGE("INVALID_PARAMETER(0x%08x)", ALARM_ERROR_INVALID_PARAMETER);
return ALARM_ERROR_INVALID_PARAMETER;
}
- if (service_to_bundle(service, &bundle_data) != SERVICE_ERROR_NONE)
+ if (app_control_to_bundle(app_control, &bundle_data) != APP_CONTROL_ERROR_NONE)
{
LOGE("INVALID_PARAMETER(0x%08x)", ALARM_ERROR_INVALID_PARAMETER);
return ALARM_ERROR_INVALID_PARAMETER;
}
result = alarmmgr_add_alarm_appsvc(ALARM_TYPE_DEFAULT, delay, period, bundle_data, alarm_id);
-
+
return convert_error_code_to_alarm(__FUNCTION__, result);
}
-int alarm_schedule_at_date(service_h service, struct tm *date, int period_in_second, int *alarm_id)
+int alarm_schedule_at_date(app_control_h app_control, struct tm *date, int period_in_second, int *alarm_id)
{
alarm_date_t internal_time;
alarm_entry_t* alarm_info;
bundle *bundle_data;
int result;
- if (service == NULL || date == NULL)
+ if (app_control == NULL || date == NULL)
{
LOGE("INVALID_PARAMETER(0x%08x)", ALARM_ERROR_INVALID_PARAMETER);
return ALARM_ERROR_INVALID_PARAMETER;
}
- if (service_to_bundle(service, &bundle_data) != SERVICE_ERROR_NONE)
+ if (app_control_to_bundle(app_control, &bundle_data) != APP_CONTROL_ERROR_NONE)
{
LOGE("INVALID_PARAMETER(0x%08x)", ALARM_ERROR_INVALID_PARAMETER);
return ALARM_ERROR_INVALID_PARAMETER;
}
-
+
alarm_info = alarmmgr_create_alarm();
internal_time.year = date->tm_year + 1900;
alarmmgr_free_alarm(alarm_info);
return convert_error_code_to_alarm(__FUNCTION__, result);
}
-
if (period_in_second > 0)
{
alarmmgr_free_alarm(alarm_info);
return convert_error_code_to_alarm(__FUNCTION__, result);
}
-
+
result = alarmmgr_set_type(alarm_info, ALARM_TYPE_DEFAULT);
-
+
if (result < 0)
{
alarmmgr_free_alarm(alarm_info);
{
alarmmgr_free_alarm(alarm_info);
return convert_error_code_to_alarm(__FUNCTION__, result);
- }
+ }
alarmmgr_free_alarm(alarm_info);
return ALARM_ERROR_NONE;
};
result = alarmmgr_enum_alarm_ids(alarm_registered_alarm_cb_broker, &foreach_cb_context);
-
+
return convert_error_code_to_alarm(__FUNCTION__, result);
}
}
-int alarm_schedule_with_recurrence_week_flag(service_h service, struct tm *date, int week_flag,int *alarm_id)
+int alarm_schedule_with_recurrence_week_flag(app_control_h app_control, struct tm *date, int week_flag,int *alarm_id)
{
alarm_date_t internal_time;
alarm_entry_t* alarm_info;
bundle *bundle_data;
int result;
- if (service == NULL || date == NULL)
+ if (app_control == NULL || date == NULL)
{
LOGE("INVALID_PARAMETER(0x%08x)", ALARM_ERROR_INVALID_PARAMETER);
return ALARM_ERROR_INVALID_PARAMETER;
}
- if (service_to_bundle(service, &bundle_data) != SERVICE_ERROR_NONE)
+ if (app_control_to_bundle(app_control, &bundle_data) != APP_CONTROL_ERROR_NONE)
{
LOGE("INVALID_PARAMETER(0x%08x)", ALARM_ERROR_INVALID_PARAMETER);
return ALARM_ERROR_INVALID_PARAMETER;
{
result = alarmmgr_set_repeat_mode(alarm_info, ALARM_REPEAT_MODE_WEEKLY, week_flag);
}
-
+
if (result < 0)
{
alarmmgr_free_alarm(alarm_info);
return convert_error_code_to_alarm(__FUNCTION__, result);
}
-
+
result = alarmmgr_set_type(alarm_info, ALARM_TYPE_DEFAULT);
-
+
if (result < 0)
{
alarmmgr_free_alarm(alarm_info);
alarm_entry_t *entry = NULL;
alarm_repeat_mode_t mode;
int value;
-
+
if(week_flag == NULL)
{
LOGE("INVALID_PARAMETER(0x%08x)", ALARM_ERROR_INVALID_PARAMETER);
if (entry != NULL)
{
alarmmgr_free_alarm(entry);
- }
+ }
return convert_error_code_to_alarm(__FUNCTION__, result);
}
-
+
result = alarmmgr_get_repeat_mode(entry, &mode, &value);
if(mode != ALARM_REPEAT_MODE_WEEKLY)
}
return ALARM_ERROR_INVALID_PARAMETER;
}
-
+
if(result != ALARMMGR_RESULT_SUCCESS)
{
if (entry != NULL)
if (entry != NULL)
{
alarmmgr_free_alarm(entry);
- }
+ }
return convert_error_code_to_alarm(__FUNCTION__, result);
}
-
+
(*week_flag) = value;
-
+
return ALARM_ERROR_NONE;
}
-int alarm_get_service(int alarm_id, service_h *service)
+int alarm_get_app_control(int alarm_id, app_control_h *app_control)
{
bundle *b = NULL;
int error_code = 0;
{
return ALARM_ERROR_INVALID_PARAMETER;
}
-
- error_code = service_create_request(b, service);
- if(error_code != SERVICE_ERROR_NONE)
+ error_code = app_control_create_request(b, app_control);
+
+ if(error_code != APP_CONTROL_ERROR_NONE)
{
return ALARM_ERROR_OUT_OF_MEMORY;
}
bundle_free(b);
return ALARM_ERROR_NONE;
-
}
+
--- /dev/null
+CMAKE_MINIMUM_REQUIRED(VERSION 2.6)
+SET(fw_name "capi-appfw-app-common")
+
+PROJECT(${fw_name})
+
+SET(CMAKE_INSTALL_PREFIX /usr)
+SET(PREFIX ${CMAKE_INSTALL_PREFIX})
+
+SET(INC_DIR ${CMAKE_SOURCE_DIR}/include)
+INCLUDE_DIRECTORIES(${INC_DIR})
+
+SET(requires "dlog aul ail capi-base-common")
+SET(pc_requires "capi-base-common")
+
+INCLUDE(FindPkgConfig)
+pkg_check_modules(${fw_name} REQUIRED ${requires})
+FOREACH(flag ${${fw_name}_CFLAGS})
+ SET(EXTRA_CFLAGS "${EXTRA_CFLAGS} ${flag}")
+ENDFOREACH(flag)
+
+SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${EXTRA_CFLAGS} -fPIC -Wall -Werror")
+SET(CMAKE_C_FLAGS_DEBUG "-O0 -g")
+
+IF("${ARCH}" STREQUAL "arm")
+ ADD_DEFINITIONS("-DTARGET")
+ENDIF("${ARCH}" STREQUAL "arm")
+
+ADD_DEFINITIONS("-DPREFIX=\"${CMAKE_INSTALL_PREFIX}\"")
+ADD_DEFINITIONS("-DSLP_DEBUG")
+
+SET(CMAKE_EXE_LINKER_FLAGS "-Wl,--as-needed -Wl,--rpath=/usr/lib")
+
+add_library(${fw_name} SHARED
+ app_package.c
+ app_path.c
+ app_error.c
+ app_finalizer.c
+ app_event.c
+ )
+
+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
+ FILES_MATCHING
+ PATTERN "*_private.h" EXCLUDE
+ PATTERN "${INC_DIR}/*.h"
+ )
+
+SET(PC_NAME ${fw_name})
+SET(PC_REQUIRED ${pc_requires})
+SET(PC_LDFLAGS -l${fw_name})
+
+CONFIGURE_FILE(
+ ${CMAKE_SOURCE_DIR}/capi-appfw-module.pc.in
+ ${CMAKE_SOURCE_DIR}/${fw_name}.pc
+ @ONLY
+)
+INSTALL(FILES ${CMAKE_SOURCE_DIR}/${fw_name}.pc DESTINATION lib/pkgconfig)
+
+
* 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.
+ * limitations under the License.
*/
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-#include <libintl.h>
-
#include <dlog.h>
-#include <app_private.h>
+#include <app.h>
#ifdef LOG_TAG
#undef LOG_TAG
{
if (description)
{
- LOGE("[%s] %s(0x%08x) : %s", function, app_error_to_string(error), error, description);
+ LOGE("[%s] %s(0x%08x) : %s", function, app_error_to_string(error), error, description);
}
else
{
- LOGE("[%s] %s(0x%08x)", function, app_error_to_string(error), error);
+ LOGE("[%s] %s(0x%08x)", function, app_error_to_string(error), error);
}
return error;
--- /dev/null
+/*
+ * Copyright (c) 2011 Samsung Electronics Co., Ltd All Rights Reserved
+ *
+ * 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 <string.h>
+
+#include <vconf-internal-keys.h>
+#include <app_common.h>
+#include <app_internal.h>
+
+app_device_orientation_e app_convert_appcore_rm(enum appcore_rm rm)
+{
+ app_device_orientation_e dev_orientation;
+
+ switch (rm)
+ {
+ case APPCORE_RM_PORTRAIT_NORMAL:
+ dev_orientation = APP_DEVICE_ORIENTATION_0;
+ break;
+
+ case APPCORE_RM_PORTRAIT_REVERSE:
+ dev_orientation = APP_DEVICE_ORIENTATION_180;
+ break;
+
+ case APPCORE_RM_LANDSCAPE_NORMAL:
+ dev_orientation = APP_DEVICE_ORIENTATION_270;
+ break;
+
+ case APPCORE_RM_LANDSCAPE_REVERSE:
+ dev_orientation = APP_DEVICE_ORIENTATION_90;
+ break;
+
+ default:
+ dev_orientation = APP_DEVICE_ORIENTATION_0;
+ break;
+ }
+
+ return dev_orientation;
+}
+
+static int _app_convert_low_memory(void *val)
+{
+ switch (*(int *)val) {
+ case VCONFKEY_SYSMAN_LOW_MEMORY_NORMAL:
+ return APP_EVENT_LOW_MEMORY_NORMAL;
+ case VCONFKEY_SYSMAN_LOW_MEMORY_SOFT_WARNING:
+ return APP_EVENT_LOW_MEMORY_SOFT_WARNING;
+ case VCONFKEY_SYSMAN_LOW_MEMORY_HARD_WARNING:
+ return APP_EVENT_LOW_MEMORY_HARD_WARNING;
+ default:
+ return -1;
+ }
+}
+
+static int _app_convert_low_battery(void *val)
+{
+ switch (*(int *)val) {
+ case VCONFKEY_SYSMAN_BAT_POWER_OFF:
+ return APP_EVENT_LOW_BATTERY_POWER_OFF;
+ case VCONFKEY_SYSMAN_BAT_CRITICAL_LOW:
+ return APP_EVENT_LOW_BATTERY_CRITICAL_LOW;
+ default:
+ return -1;
+ }
+}
+
+int app_event_get_low_memory_status(app_event_info_h event_info, app_event_low_memory_status_e *status)
+{
+ int ret;
+
+ if (event_info == NULL || status == NULL)
+ return app_error(APP_ERROR_INVALID_PARAMETER, __FUNCTION__, "null parameter");
+
+ if (event_info->type != APP_EVENT_LOW_MEMORY)
+ return app_error(APP_ERROR_INVALID_PARAMETER, __FUNCTION__, "event type mismatching");
+
+ ret = _app_convert_low_memory(event_info->value);
+ if (ret < 0)
+ return app_error(APP_ERROR_INVALID_CONTEXT, __FUNCTION__, "invalid event info");
+
+ *status = ret;
+
+ return APP_ERROR_NONE;
+}
+
+int app_event_get_low_battery_status(app_event_info_h event_info, app_event_low_battery_status_e *status)
+{
+ int ret;
+
+ if (event_info == NULL || status == NULL)
+ return app_error(APP_ERROR_INVALID_PARAMETER, __FUNCTION__, "null parameter");
+
+ if (event_info->type != APP_EVENT_LOW_BATTERY)
+ return app_error(APP_ERROR_INVALID_PARAMETER, __FUNCTION__, "event type mismatching");
+
+ ret = _app_convert_low_battery(event_info->value);
+ if (ret < 0)
+ return app_error(APP_ERROR_INVALID_CONTEXT, __FUNCTION__, "invalid event info");
+
+ *status = ret;
+
+ return APP_ERROR_NONE;
+}
+
+int app_event_get_language(app_event_info_h event_info, char **lang)
+{
+ if (event_info == NULL || lang == NULL)
+ return app_error(APP_ERROR_INVALID_PARAMETER, __FUNCTION__, "null parameter");
+
+ if (event_info->type != APP_EVENT_LANGUAGE_CHANGED)
+ return app_error(APP_ERROR_INVALID_CONTEXT, __FUNCTION__, "event type mismatching");
+
+ *lang = strdup(event_info->value);
+
+ return APP_ERROR_NONE;
+}
+
+int app_event_get_region_format(app_event_info_h event_info, char **region)
+{
+ if (event_info == NULL || region == NULL)
+ return app_error(APP_ERROR_INVALID_PARAMETER, __FUNCTION__, "null parameter");
+
+ if (event_info->type != APP_EVENT_REGION_FORMAT_CHANGED)
+ return app_error(APP_ERROR_INVALID_CONTEXT, __FUNCTION__, "event type mismatching");
+
+ *region = strdup(event_info->value);
+
+ return APP_ERROR_NONE;
+}
+
+int app_event_get_device_orientation(app_event_info_h event_info, app_device_orientation_e *orientation)
+{
+ if (event_info == NULL || orientation == NULL)
+ return app_error(APP_ERROR_INVALID_PARAMETER, __FUNCTION__, "null parameter");
+
+ if (event_info->type != APP_EVENT_DEVICE_ORIENTATION_CHANGED)
+ return app_error(APP_ERROR_INVALID_CONTEXT, __FUNCTION__, "event type mismatching");
+
+ *orientation = app_convert_appcore_rm(*(enum appcore_rm *)(event_info->value));
+
+ return APP_ERROR_NONE;
+}
+
* 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.
+ * limitations under the License.
*/
-#include <stdio.h>
#include <stdlib.h>
-#include <string.h>
-#include <libintl.h>
-#include <app_private.h>
+#include <app_internal.h>
typedef struct _app_finalizer_s_ {
app_finalizer_cb callback;
{
finalizer_tail = finalizer_tail->next;
}
-
+
finalizer_tail->next = finalizer_new;
return APP_ERROR_NONE;
}
finalizer_node = finalizer_node->next;
- }
+ }
return APP_ERROR_INVALID_PARAMETER;
}
* 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.
+ * limitations under the License.
*/
-#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
#include <string.h>
-#include <sys/types.h>
-#include <sys/stat.h>
-#include <fcntl.h>
-#include <bundle.h>
-#include <appcore-common.h>
#include <aul.h>
#include <ail.h>
-#include <dlog.h>
-#include <app_private.h>
-#include <app_service_private.h>
+#include <app_internal.h>
#ifdef LOG_TAG
#undef LOG_TAG
{
return app_error(APP_ERROR_INVALID_CONTEXT, __FUNCTION__, "failed to get app-info");
}
-
+
if (ail_appinfo_get_str(appinfo, property, &appinfo_value) != 0)
{
ail_destroy_appinfo(appinfo);
}
*value = appinfo_value_dup;
-
+
return APP_ERROR_NONE;
}
free(package);
}
- return retval;
+ return retval;
}
--- /dev/null
+/*
+ * Copyright (c) 2014 Samsung Electronics Co., Ltd All Rights Reserved
+ *
+ * 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 <string.h>
+#include <aul.h>
+
+char *app_get_data_path(void)
+{
+ const char *buf = aul_get_app_data_path();
+ return buf != NULL ? strdup(buf) : NULL;
+}
+
+char *app_get_cache_path(void)
+{
+ const char *buf = aul_get_app_cache_path();
+ return buf != NULL ? strdup(buf) : NULL;
+}
+
+char *app_get_resource_path(void)
+{
+ const char *buf = aul_get_app_resource_path();
+ return buf != NULL ? strdup(buf) : NULL;
+}
+
+char *app_get_shared_data_path(void)
+{
+ const char *buf = aul_get_app_shared_data_path();
+ return buf != NULL ? strdup(buf) : NULL;
+}
+
+char *app_get_shared_resource_path(void)
+{
+ const char *buf = aul_get_app_shared_resource_path();
+ return buf != NULL ? strdup(buf) : NULL;
+}
+
+char *app_get_shared_trusted_path(void)
+{
+ const char *buf = aul_get_app_shared_trusted_path();
+ return buf != NULL ? strdup(buf) : NULL;
+}
+
+char *app_get_external_data_path(void)
+{
+ const char *buf = aul_get_app_external_data_path();
+ return buf != NULL ? strdup(buf) : NULL;
+}
+
+char *app_get_external_cache_path(void)
+{
+ const char *buf = aul_get_app_external_cache_path();
+ return buf != NULL ? strdup(buf) : NULL;
+}
+
+char *app_get_external_shared_data_path(void)
+{
+ const char *buf = aul_get_app_external_shared_data_path();
+ return buf != NULL ? strdup(buf) : NULL;
+}
--- /dev/null
+CMAKE_MINIMUM_REQUIRED(VERSION 2.6)
+SET(fw_name "capi-appfw-app-control")
+
+PROJECT(${fw_name})
+
+SET(CMAKE_INSTALL_PREFIX /usr)
+SET(PREFIX ${CMAKE_INSTALL_PREFIX})
+
+SET(INC_DIR ${CMAKE_SOURCE_DIR}/include)
+INCLUDE_DIRECTORIES(${INC_DIR})
+
+SET(requires "dlog bundle aul appsvc capi-base-common capi-security-privilege-manager pkgmgr-info")
+SET(pc_requires "capi-base-common")
+
+INCLUDE(FindPkgConfig)
+pkg_check_modules(${fw_name} REQUIRED ${requires})
+FOREACH(flag ${${fw_name}_CFLAGS})
+ SET(EXTRA_CFLAGS "${EXTRA_CFLAGS} ${flag}")
+ENDFOREACH(flag)
+
+SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${EXTRA_CFLAGS} -fPIC -Wall -Werror")
+SET(CMAKE_C_FLAGS_DEBUG "-O0 -g")
+
+IF("${ARCH}" STREQUAL "arm")
+ ADD_DEFINITIONS("-DTARGET")
+ENDIF("${ARCH}" STREQUAL "arm")
+
+ADD_DEFINITIONS("-DPREFIX=\"${CMAKE_INSTALL_PREFIX}\"")
+ADD_DEFINITIONS("-DSLP_DEBUG")
+
+SET(CMAKE_EXE_LINKER_FLAGS "-Wl,--as-needed -Wl,--rpath=/usr/lib")
+
+add_library(${fw_name} SHARED
+ app_control.c
+ )
+
+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
+ FILES_MATCHING
+ PATTERN "*_private.h" EXCLUDE
+ PATTERN "${INC_DIR}/*.h"
+ )
+
+SET(PC_NAME ${fw_name})
+SET(PC_REQUIRED ${pc_requires})
+SET(PC_LDFLAGS -l${fw_name})
+
+CONFIGURE_FILE(
+ ${CMAKE_SOURCE_DIR}/capi-appfw-module.pc.in
+ ${CMAKE_SOURCE_DIR}/${fw_name}.pc
+ @ONLY
+)
+INSTALL(FILES ${CMAKE_SOURCE_DIR}/${fw_name}.pc DESTINATION lib/pkgconfig)
+
+
--- /dev/null
+/*
+ * Copyright (c) 2011 Samsung Electronics Co., Ltd All Rights Reserved
+ *
+ * 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 <stdlib.h>
+#include <unistd.h>
+#include <string.h>
+#include <errno.h>
+
+#include <bundle.h>
+#include <aul.h>
+#include <appsvc.h>
+#include <dlog.h>
+
+#include <app_control.h>
+#include <pkgmgr-info.h>
+
+#include <privilege_checker.h>
+
+#ifdef LOG_TAG
+#undef LOG_TAG
+#endif
+
+#define LOG_TAG "CAPI_APPFW_APP_CONTROL"
+
+#ifndef TIZEN_PATH_MAX
+#define TIZEN_PATH_MAX 1024
+#endif
+
+#define BUNDLE_KEY_PREFIX_AUL "__AUL_"
+#define BUNDLE_KEY_PREFIX_SERVICE "__APP_SVC_"
+
+#define BUNDLE_KEY_OPERATION "__APP_SVC_OP_TYPE__"
+#define BUNDLE_KEY_URI "__APP_SVC_URI__"
+#define BUNDLE_KEY_MIME "__APP_SVC_MIME_TYPE__"
+#define BUNDLE_KEY_DATA "__APP_SVC_DATA__"
+#define BUNDLE_KEY_PACKAGE "__APP_SVC_PKG_NAME__"
+#define BUNDLE_KEY_WINDOW "__APP_SVC_K_WIN_ID__"
+#define BUNDLE_KEY_CATEGORY "__APP_SVC_CATEGORY__"
+
+typedef enum {
+ APP_CONTROL_TYPE_REQUEST,
+ APP_CONTROL_TYPE_EVENT,
+ APP_CONTROL_TYPE_REPLY,
+} app_control_type_e;
+
+struct app_control_s {
+ int id;
+ app_control_type_e type;
+ bundle *data;
+ int launch_pid;
+};
+
+typedef struct app_control_request_context_s {
+ app_control_h app_control;
+ app_control_reply_cb reply_cb;
+ void *user_data;
+} *app_control_request_context_h;
+
+extern int appsvc_allow_transient_app(bundle *b, unsigned int id);
+extern int appsvc_request_transient_app(bundle *b, unsigned int callee_id, appsvc_host_res_fn cbfunc, void *data);
+
+static int app_control_create_reply(bundle *data, struct app_control_s **app_control);
+
+static const char* app_control_error_to_string(app_control_error_e error)
+{
+ switch (error)
+ {
+ case APP_CONTROL_ERROR_NONE:
+ return "NONE";
+
+ case APP_CONTROL_ERROR_INVALID_PARAMETER:
+ return "INVALID_PARAMETER";
+
+ case APP_CONTROL_ERROR_OUT_OF_MEMORY:
+ return "OUT_OF_MEMORY";
+
+ case APP_CONTROL_ERROR_APP_NOT_FOUND:
+ return "APP_NOT_FOUND";
+
+ case APP_CONTROL_ERROR_KEY_NOT_FOUND:
+ return "KEY_NOT_FOUND";
+
+ case APP_CONTROL_ERROR_KEY_REJECTED:
+ return "KEY_REJECTED";
+
+ case APP_CONTROL_ERROR_INVALID_DATA_TYPE:
+ return "INVALID_DATA_TYPE";
+
+ case APP_CONTROL_ERROR_LAUNCH_REJECTED:
+ return "LAUNCH_REJECTED";
+
+ case APP_CONTROL_ERROR_PERMISSION_DENIED:
+ return "PERMISSION_DENIED";
+
+ case APP_CONTROL_ERROR_LAUNCH_FAILED:
+ return "LAUNCH_FAILED";
+
+ case APP_CONTROL_ERROR_TIMED_OUT:
+ return "TIMED_OUT";
+
+ default :
+ return "UNKNOWN";
+ }
+}
+
+int app_control_error(app_control_error_e error, const char* function, const char *description)
+{
+ if (description)
+ {
+ LOGE("[%s] %s(0x%08x) : %s", function, app_control_error_to_string(error), error, description);
+ }
+ else
+ {
+ if(error == APP_CONTROL_ERROR_KEY_NOT_FOUND)
+ LOGW("[%s] %s(0x%08x)", function, app_control_error_to_string(error), error);
+ else
+ LOGE("[%s] %s(0x%08x)", function, app_control_error_to_string(error), error);
+ }
+
+ return error;
+}
+
+static int app_control_validate_extra_data(const char *data)
+{
+ if (data == NULL || data[0] == '\0')
+ {
+ return APP_CONTROL_ERROR_INVALID_PARAMETER;
+ }
+
+ return APP_CONTROL_ERROR_NONE;
+}
+
+static int app_control_validate(app_control_h app_control)
+{
+ if (app_control == NULL || app_control->data == NULL)
+ {
+ return APP_CONTROL_ERROR_INVALID_PARAMETER;
+ }
+
+ return APP_CONTROL_ERROR_NONE;
+}
+
+static int app_control_new_id()
+{
+ static int sid = 0;
+ return sid++;
+}
+
+int app_control_validate_internal_key(const char *key)
+{
+ if (strncmp(BUNDLE_KEY_PREFIX_AUL, key, strlen(BUNDLE_KEY_PREFIX_AUL)) == 0)
+ {
+ return -1;
+ }
+
+ if (strncmp(BUNDLE_KEY_PREFIX_SERVICE, key, strlen(BUNDLE_KEY_PREFIX_SERVICE)) == 0)
+ {
+ return -1;
+ }
+
+ return 0;
+}
+
+static void app_control_request_result_broker(bundle *appsvc_bundle, int appsvc_request_code, appsvc_result_val appsvc_result, void *appsvc_data)
+{
+ app_control_request_context_h request_context;
+ app_control_h request;
+ app_control_h reply = NULL;
+ app_control_result_e result;
+ void *user_data;
+ app_control_reply_cb reply_cb;
+
+ if (appsvc_data == NULL)
+ {
+ app_control_error(APP_CONTROL_ERROR_INVALID_PARAMETER, __FUNCTION__, "invalid app_control reply");
+ return;
+ }
+
+ if (app_control_create_reply(appsvc_bundle, &reply) != 0)
+ {
+ app_control_error(APP_CONTROL_ERROR_INVALID_PARAMETER, __FUNCTION__, "failed to create app_control reply");
+ return;
+ }
+
+ request_context = appsvc_data;
+ request = request_context->app_control;
+
+ switch (appsvc_result)
+ {
+ case APPSVC_RES_OK:
+ result = APP_CONTROL_RESULT_SUCCEEDED;
+ break;
+
+ case APPSVC_RES_NOT_OK:
+ result = APP_CONTROL_RESULT_FAILED;
+ break;
+
+ case APPSVC_RES_CANCEL:
+ result = APP_CONTROL_RESULT_CANCELED;
+ break;
+
+ default:
+ result = APP_CONTROL_RESULT_CANCELED;
+ break;
+ }
+
+ user_data = request_context->user_data;
+ reply_cb = request_context->reply_cb;
+
+ if (reply_cb != NULL)
+ {
+ reply_cb(request, reply, result, user_data);
+ }
+ else
+ {
+ app_control_error(APP_CONTROL_ERROR_INVALID_PARAMETER, __FUNCTION__, "invalid callback ");
+ }
+
+ app_control_destroy(reply);
+
+ if (request_context->app_control != NULL)
+ {
+ app_control_destroy(request_context->app_control);
+ }
+
+ free(request_context);
+}
+
+int app_control_create_request(bundle *data, app_control_h *app_control)
+{
+ struct app_control_s *app_control_request;
+
+ if (app_control == NULL)
+ {
+ return app_control_error(APP_CONTROL_ERROR_INVALID_PARAMETER, __FUNCTION__, NULL);
+ }
+
+ app_control_request = malloc(sizeof(struct app_control_s));
+
+ if (app_control_request == NULL)
+ {
+ return app_control_error(APP_CONTROL_ERROR_OUT_OF_MEMORY, __FUNCTION__, "failed to create a app_control handle");
+ }
+
+ app_control_request->type = APP_CONTROL_TYPE_REQUEST;
+
+ if (data != NULL)
+ {
+ app_control_request->data = bundle_dup(data);
+ }
+ else
+ {
+ app_control_request->data = bundle_create();
+ }
+
+ if (app_control_request->data == NULL)
+ {
+ free(app_control_request);
+ return app_control_error(APP_CONTROL_ERROR_OUT_OF_MEMORY, __FUNCTION__, "failed to create a bundle");
+ }
+
+ app_control_request->id = app_control_new_id();
+ app_control_request->launch_pid = -1;
+
+ *app_control = app_control_request;
+
+ return APP_CONTROL_ERROR_NONE;
+}
+
+int app_control_create(app_control_h *app_control)
+{
+ return app_control_create_request(NULL, app_control);
+}
+
+int app_control_create_event(bundle *data, struct app_control_s **app_control)
+{
+ struct app_control_s *app_control_event;
+
+ const char *operation;
+
+ if (data == NULL || app_control == NULL)
+ {
+ return app_control_error(APP_CONTROL_ERROR_INVALID_PARAMETER, __FUNCTION__, NULL);
+ }
+
+ app_control_event = malloc(sizeof(struct app_control_s));
+
+ if (app_control_event == NULL)
+ {
+ return app_control_error(APP_CONTROL_ERROR_OUT_OF_MEMORY, __FUNCTION__, "failed to create a app_control handle");
+ }
+
+ app_control_event->type = APP_CONTROL_TYPE_EVENT;
+ app_control_event->data = bundle_dup(data);
+ app_control_event->id = app_control_new_id();
+
+ operation = appsvc_get_operation(app_control_event->data);
+
+ if (operation == NULL)
+ {
+ appsvc_set_operation(app_control_event->data, APP_CONTROL_OPERATION_DEFAULT);
+ }
+
+ *app_control = app_control_event;
+
+ return APP_CONTROL_ERROR_NONE;
+}
+
+static int app_control_create_reply(bundle *data, struct app_control_s **app_control)
+{
+ struct app_control_s *app_control_reply;
+
+ if (data == NULL || app_control == NULL)
+ {
+ return app_control_error(APP_CONTROL_ERROR_INVALID_PARAMETER, __FUNCTION__, NULL);
+ }
+
+ app_control_reply = malloc(sizeof(struct app_control_s));
+
+ if (app_control_reply == NULL)
+ {
+ return app_control_error(APP_CONTROL_ERROR_OUT_OF_MEMORY, __FUNCTION__, "failed to create a app_control handle");
+ }
+
+ app_control_reply->type = APP_CONTROL_TYPE_REPLY;
+ app_control_reply->data = bundle_dup(data);
+ app_control_reply->id = app_control_new_id();
+
+ *app_control = app_control_reply;
+
+ return APP_CONTROL_ERROR_NONE;
+}
+
+int app_control_destroy(app_control_h app_control)
+{
+ if (app_control_validate(app_control))
+ {
+ return app_control_error(APP_CONTROL_ERROR_INVALID_PARAMETER, __FUNCTION__, NULL);
+ }
+
+ if(app_control->type == APP_CONTROL_TYPE_REQUEST && app_control->launch_pid > 0)
+ {
+ aul_remove_caller_cb(app_control->launch_pid);
+ }
+
+ bundle_free(app_control->data);
+ app_control->data = NULL;
+ free(app_control);
+
+ return APP_CONTROL_ERROR_NONE;
+}
+
+int app_control_to_bundle(app_control_h app_control, bundle **data)
+{
+ if (app_control_validate(app_control) || data == NULL)
+ {
+ return app_control_error(APP_CONTROL_ERROR_INVALID_PARAMETER, __FUNCTION__, NULL);
+ }
+
+ *data = app_control->data;
+
+ return APP_CONTROL_ERROR_NONE;
+}
+
+int app_control_set_operation(app_control_h app_control, const char *operation)
+{
+ if (app_control_validate(app_control))
+ {
+ return app_control_error(APP_CONTROL_ERROR_INVALID_PARAMETER, __FUNCTION__, NULL);
+ }
+
+ if (operation != NULL)
+ {
+ if (appsvc_set_operation(app_control->data, operation) != 0)
+ {
+ return app_control_error(APP_CONTROL_ERROR_INVALID_PARAMETER, __FUNCTION__, "invalid operation");
+ }
+ }
+ else
+ {
+ bundle_del(app_control->data, BUNDLE_KEY_OPERATION);
+ }
+
+ return APP_CONTROL_ERROR_NONE;
+}
+
+int app_control_get_operation(app_control_h app_control, char **operation)
+{
+ const char *operation_value;
+
+ if (app_control_validate(app_control) || operation == NULL)
+ {
+ return app_control_error(APP_CONTROL_ERROR_INVALID_PARAMETER, __FUNCTION__, NULL);
+ }
+
+ operation_value = appsvc_get_operation(app_control->data);
+
+ if (operation_value != NULL)
+ {
+ *operation = strdup(operation_value);
+ }
+ else
+ {
+ *operation = NULL;
+ }
+
+ return APP_CONTROL_ERROR_NONE;
+}
+
+
+int app_control_set_uri(app_control_h app_control, const char *uri)
+{
+ if (app_control_validate(app_control))
+ {
+ return app_control_error(APP_CONTROL_ERROR_INVALID_PARAMETER, __FUNCTION__, NULL);
+ }
+
+ if (uri != NULL)
+ {
+ if (appsvc_set_uri(app_control->data, uri) != 0)
+ {
+ return app_control_error(APP_CONTROL_ERROR_INVALID_PARAMETER, __FUNCTION__, "invalid URI");
+ }
+ }
+ else
+ {
+ bundle_del(app_control->data, BUNDLE_KEY_URI);
+ }
+
+ return APP_CONTROL_ERROR_NONE;
+}
+
+
+int app_control_get_uri(app_control_h app_control, char **uri)
+{
+ const char *uri_value;
+
+ if (app_control_validate(app_control) || uri == NULL)
+ {
+ return app_control_error(APP_CONTROL_ERROR_INVALID_PARAMETER, __FUNCTION__, NULL);
+ }
+
+ uri_value = appsvc_get_uri(app_control->data);
+
+ if (uri_value != NULL)
+ {
+ *uri = strdup(uri_value);
+ }
+ else
+ {
+ *uri = NULL;
+ }
+
+ return APP_CONTROL_ERROR_NONE;
+}
+
+
+int app_control_set_mime(app_control_h app_control, const char *mime)
+{
+ if (app_control_validate(app_control))
+ {
+ return app_control_error(APP_CONTROL_ERROR_INVALID_PARAMETER, __FUNCTION__, NULL);
+ }
+
+ if (mime != NULL)
+ {
+ if (appsvc_set_mime(app_control->data, mime) != 0)
+ {
+ return app_control_error(APP_CONTROL_ERROR_INVALID_PARAMETER, __FUNCTION__, "invalid MIME type");
+ }
+ }
+ else
+ {
+ bundle_del(app_control->data, BUNDLE_KEY_MIME);
+ }
+
+ return APP_CONTROL_ERROR_NONE;
+}
+
+
+int app_control_get_mime(app_control_h app_control, char **mime)
+{
+ const char *mime_value;
+
+ if (app_control_validate(app_control) || mime == NULL)
+ {
+ return app_control_error(APP_CONTROL_ERROR_INVALID_PARAMETER, __FUNCTION__, NULL);
+ }
+
+ mime_value = appsvc_get_mime(app_control->data);
+
+ if (mime_value != NULL)
+ {
+ *mime = strdup(mime_value);
+ }
+ else
+ {
+ *mime = NULL;
+ }
+
+ return APP_CONTROL_ERROR_NONE;
+}
+
+
+int app_control_set_category(app_control_h app_control, const char *category)
+{
+ if (app_control_validate(app_control))
+ {
+ return app_control_error(APP_CONTROL_ERROR_INVALID_PARAMETER, __FUNCTION__, NULL);
+ }
+
+ if (category != NULL)
+ {
+ if (appsvc_set_category(app_control->data, category) != 0)
+ {
+ return app_control_error(APP_CONTROL_ERROR_INVALID_PARAMETER, __FUNCTION__, "invalid Category");
+ }
+ }
+ else
+ {
+ bundle_del(app_control->data, BUNDLE_KEY_CATEGORY);
+ }
+
+ return APP_CONTROL_ERROR_NONE;
+}
+
+
+int app_control_get_category(app_control_h app_control, char **category)
+{
+ const char *category_value;
+
+ if (app_control_validate(app_control) || category == NULL)
+ {
+ return app_control_error(APP_CONTROL_ERROR_INVALID_PARAMETER, __FUNCTION__, NULL);
+ }
+
+ category_value = appsvc_get_category(app_control->data);
+
+ if (category_value != NULL)
+ {
+ *category = strdup(category_value);
+ }
+ else
+ {
+ *category = NULL;
+ }
+
+ return APP_CONTROL_ERROR_NONE;
+}
+
+
+int app_control_set_package(app_control_h app_control, const char *package)
+{
+ // TODO: this function must be deprecated
+ return app_control_set_app_id(app_control, package);
+}
+
+int app_control_get_package(app_control_h app_control, char **package)
+{
+ // TODO: this function must be deprecated
+ return app_control_get_app_id(app_control, package);
+}
+
+
+int app_control_set_app_id(app_control_h app_control, const char *app_id)
+{
+ if (app_control_validate(app_control))
+ {
+ return app_control_error(APP_CONTROL_ERROR_INVALID_PARAMETER, __FUNCTION__, NULL);
+ }
+
+ if (app_id != NULL)
+ {
+ if (appsvc_set_appid(app_control->data, app_id) != 0)
+ {
+ return app_control_error(APP_CONTROL_ERROR_INVALID_PARAMETER, __FUNCTION__, "invalid application ID");
+ }
+ }
+ else
+ {
+ bundle_del(app_control->data, BUNDLE_KEY_PACKAGE);
+ }
+
+ return APP_CONTROL_ERROR_NONE;
+}
+
+
+int app_control_get_app_id(app_control_h app_control, char **app_id)
+{
+ const char *app_id_value;
+
+ if (app_control_validate(app_control) || app_id == NULL)
+ {
+ return app_control_error(APP_CONTROL_ERROR_INVALID_PARAMETER, __FUNCTION__, NULL);
+ }
+
+ app_id_value = appsvc_get_appid(app_control->data);
+
+ if (app_id_value != NULL)
+ {
+ *app_id = strdup(app_id_value);
+ }
+ else
+ {
+ *app_id = NULL;
+ }
+
+ return APP_CONTROL_ERROR_NONE;
+}
+
+int app_control_set_window(app_control_h app_control, unsigned int id)
+{
+ if (app_control_validate(app_control))
+ {
+ return app_control_error(APP_CONTROL_ERROR_INVALID_PARAMETER, __FUNCTION__, NULL);
+ }
+
+ if (id > 0)
+ {
+ if (appsvc_allow_transient_app(app_control->data, id) != 0)
+ {
+ return app_control_error(APP_CONTROL_ERROR_INVALID_PARAMETER, __FUNCTION__, "invalid id");
+ }
+ }
+ else
+ {
+ bundle_del(app_control->data, BUNDLE_KEY_WINDOW);
+ }
+
+ return APP_CONTROL_ERROR_NONE;
+}
+
+int app_control_get_window(app_control_h app_control, unsigned int *id)
+{
+ const char *window_id;
+
+ if (app_control_validate(app_control) || id == NULL)
+ {
+ return app_control_error(APP_CONTROL_ERROR_INVALID_PARAMETER, __FUNCTION__, NULL);
+ }
+
+ window_id = bundle_get_val(app_control->data, BUNDLE_KEY_WINDOW);
+
+ if (window_id != NULL)
+ {
+ *id = atoi(window_id);
+ }
+ else
+ {
+ *id = 0;
+ }
+
+ return APP_CONTROL_ERROR_NONE;
+}
+
+int app_control_clone(app_control_h *clone, app_control_h app_control)
+{
+ app_control_h app_control_clone;
+
+ if (app_control_validate(app_control) || clone == NULL)
+ {
+ return app_control_error(APP_CONTROL_ERROR_INVALID_PARAMETER, __FUNCTION__, NULL);
+ }
+
+ app_control_clone = malloc(sizeof(struct app_control_s));
+
+ if (app_control_clone == NULL)
+ {
+ return app_control_error(APP_CONTROL_ERROR_OUT_OF_MEMORY, __FUNCTION__, "failed to create a app_control handle");
+ }
+
+ app_control_clone->id = app_control_new_id();
+ app_control_clone->type = app_control->type;
+ app_control_clone->data = bundle_dup(app_control->data);
+
+ *clone = app_control_clone;
+
+ return APP_CONTROL_ERROR_NONE;
+}
+
+static void update_launch_pid(int launched_pid, void *data)
+{
+ app_control_h app_control;
+
+ if(data == NULL)
+ return;
+
+ app_control = data;
+
+ app_control->launch_pid = launched_pid;
+}
+
+int app_control_send_launch_request(app_control_h app_control, app_control_reply_cb callback, void *user_data)
+{
+ const char *operation;
+
+ bool implicit_default_operation = false;
+ int launch_pid;
+
+ app_control_request_context_h request_context = NULL;
+
+ if (app_control_validate(app_control))
+ {
+ return app_control_error(APP_CONTROL_ERROR_INVALID_PARAMETER, __FUNCTION__, NULL);
+ }
+
+ operation = appsvc_get_operation(app_control->data);
+ if (operation == NULL)
+ {
+ implicit_default_operation = true;
+ operation = APP_CONTROL_OPERATION_DEFAULT;
+ }
+
+ // Check the privilege for call operation
+ if (!strcmp(operation, APP_CONTROL_OPERATION_CALL))
+ {
+ int ret;
+ char app_id[256];
+ char *pkg_id;
+ pkgmgrinfo_appinfo_h app_info;
+
+ ret = aul_app_get_appid_bypid(getpid(), app_id, sizeof(app_id));
+ if (ret != AUL_R_OK)
+ {
+ return app_control_error(APP_CONTROL_ERROR_INVALID_PARAMETER, __FUNCTION__, "Failed to get the app_id of the current application");
+ }
+
+ ret = pkgmgrinfo_appinfo_get_appinfo(app_id, &app_info);
+ if (ret != PMINFO_R_OK)
+ {
+ return app_control_error(APP_CONTROL_ERROR_INVALID_PARAMETER, __FUNCTION__, "Failed to get app_info of the current application");
+ }
+
+ ret = pkgmgrinfo_appinfo_get_pkgname(app_info, &pkg_id);
+ if (ret != PMINFO_R_OK)
+ {
+ pkgmgrinfo_appinfo_destroy_appinfo(app_info);
+ return app_control_error(APP_CONTROL_ERROR_INVALID_PARAMETER, __FUNCTION__, "Failed to get pkg_id of the current application");
+ }
+
+ ret = privilege_checker_check_package_privilege(pkg_id, "http://tizen.org/privilege/call");
+ pkgmgrinfo_appinfo_destroy_appinfo(app_info);
+ if (ret != PRIV_CHECKER_ERR_NONE)
+ {
+ if (ret == PRIV_CHECKER_ERR_INVALID_PRIVILEGE)
+ {
+ return app_control_error(APP_CONTROL_ERROR_PERMISSION_DENIED, __FUNCTION__, "no privilege for Call operation");
+ }
+ else
+ {
+ return app_control_error(APP_CONTROL_ERROR_LAUNCH_REJECTED, __FUNCTION__, NULL);
+ }
+ }
+ }
+
+ // operation : default
+ if (!strcmp(operation, APP_CONTROL_OPERATION_DEFAULT))
+ {
+ const char *appid = appsvc_get_appid(app_control->data);
+ if (appid == NULL)
+ {
+ return app_control_error(APP_CONTROL_ERROR_APP_NOT_FOUND, __FUNCTION__, "package must be specified if the operation is default value");
+ }
+ }
+
+ if (callback != NULL)
+ {
+ app_control_h request_clone = NULL;
+
+ request_context = calloc(1, sizeof(struct app_control_request_context_s));
+
+ if (request_context == NULL)
+ {
+ return app_control_error(APP_CONTROL_ERROR_OUT_OF_MEMORY, __FUNCTION__, NULL);
+ }
+
+ request_context->reply_cb = callback;
+
+ if (app_control_clone(&request_clone, app_control) != APP_CONTROL_ERROR_NONE)
+ {
+ free(request_context);
+ return app_control_error(APP_CONTROL_ERROR_INVALID_PARAMETER, __FUNCTION__, "failed to clone the app_control request handle");
+ }
+
+ request_context->app_control = request_clone;
+ request_context->user_data = user_data;
+ }
+
+ if (implicit_default_operation == true)
+ {
+ appsvc_set_operation(app_control->data, APP_CONTROL_OPERATION_DEFAULT);
+ }
+
+ launch_pid = appsvc_run_service(app_control->data, app_control->id, callback ? app_control_request_result_broker : NULL, request_context);
+
+ if (implicit_default_operation == true)
+ {
+ bundle_del(app_control->data, BUNDLE_KEY_OPERATION);
+ }
+
+ if (launch_pid < 0)
+ {
+ if (launch_pid == APPSVC_RET_ENOMATCH)
+ {
+ return app_control_error(APP_CONTROL_ERROR_APP_NOT_FOUND, __FUNCTION__, NULL);
+ }
+ else if (launch_pid == APPSVC_RET_EILLACC)
+ {
+ return app_control_error(APP_CONTROL_ERROR_PERMISSION_DENIED, __FUNCTION__, NULL);
+ }
+ else if (launch_pid == APPSVC_RET_EINVAL)
+ {
+ return app_control_error(APP_CONTROL_ERROR_INVALID_PARAMETER, __FUNCTION__, NULL);
+ }
+ else
+ {
+ return app_control_error(APP_CONTROL_ERROR_LAUNCH_REJECTED, __FUNCTION__, NULL);
+ }
+ }
+
+ app_control->launch_pid = launch_pid;
+
+ aul_add_caller_cb(launch_pid, update_launch_pid, app_control);
+
+ return APP_CONTROL_ERROR_NONE;
+}
+
+
+int app_control_send_terminate_request(app_control_h app_control)
+{
+ if (app_control_validate(app_control))
+ {
+ return app_control_error(APP_CONTROL_ERROR_INVALID_PARAMETER, __FUNCTION__, NULL);
+ }
+
+ if(app_control->type != APP_CONTROL_TYPE_REQUEST || app_control->launch_pid < 0)
+ {
+ return app_control_error(APP_CONTROL_ERROR_INVALID_PARAMETER, __FUNCTION__, NULL);
+ }
+
+ appsvc_subapp_terminate_request_pid(app_control->launch_pid);
+
+ return APP_CONTROL_ERROR_NONE;
+}
+
+static bool app_control_copy_reply_data_cb(app_control_h app_control, const char *key, void *user_data)
+{
+ bundle *reply_data = user_data;
+ char *value = NULL;
+ char **value_array = NULL;
+ int value_array_length = 0;
+ int value_array_index = 0;
+
+ if (reply_data == NULL)
+ {
+ app_control_error(APP_CONTROL_ERROR_INVALID_PARAMETER, __FUNCTION__, NULL);
+ return false;
+ }
+
+ if (appsvc_data_is_array(app_control->data, key))
+ {
+ app_control_get_extra_data_array(app_control, key, &value_array, &value_array_length);
+ appsvc_add_data_array(reply_data, key, (const char**)value_array, value_array_length);
+
+ for (value_array_index=0; value_array_index < value_array_length; value_array_index++)
+ {
+ free(value_array[value_array_index]);
+ }
+
+ free(value_array);
+ }
+ else
+ {
+ app_control_get_extra_data(app_control, key, &value);
+ appsvc_add_data(reply_data, key, value);
+ free(value);
+ }
+
+ return true;
+}
+
+int app_control_reply_to_launch_request(app_control_h reply, app_control_h request, app_control_result_e result)
+{
+ bundle *reply_data;
+ int appsvc_result;
+ int ret = 0;
+
+ if (app_control_validate(reply) || app_control_validate(request))
+ {
+ return app_control_error(APP_CONTROL_ERROR_INVALID_PARAMETER, __FUNCTION__, NULL);
+ }
+
+ if (appsvc_create_result_bundle(request->data, &reply_data) != 0)
+ {
+ return app_control_error(APP_CONTROL_ERROR_INVALID_PARAMETER, __FUNCTION__, "failed to create a result bundle");
+ }
+
+ app_control_foreach_extra_data(reply, app_control_copy_reply_data_cb, reply_data);
+
+ switch (result)
+ {
+ case APP_CONTROL_RESULT_SUCCEEDED:
+ appsvc_result = APPSVC_RES_OK;
+ break;
+
+ case APP_CONTROL_RESULT_FAILED:
+ appsvc_result = APPSVC_RES_NOT_OK;
+ break;
+
+ case APP_CONTROL_RESULT_CANCELED:
+ appsvc_result = APPSVC_RES_CANCEL;
+ break;
+
+ default:
+ appsvc_result = APPSVC_RES_CANCEL;
+ break;
+ }
+
+ ret = appsvc_send_result(reply_data, appsvc_result);
+ if (ret < 0)
+ {
+ if (ret == APPSVC_RET_EINVAL)
+ {
+ return app_control_error(APP_CONTROL_ERROR_INVALID_PARAMETER, __FUNCTION__, NULL);
+ }
+ else
+ {
+ return app_control_error(APP_CONTROL_ERROR_LAUNCH_REJECTED, __FUNCTION__, NULL);
+ }
+ }
+
+ return APP_CONTROL_ERROR_NONE;
+}
+
+
+int app_control_add_extra_data(app_control_h app_control, const char *key, const char *value)
+{
+ if (app_control_validate(app_control) || app_control_validate_extra_data(key) || app_control_validate_extra_data(value))
+ {
+ return app_control_error(APP_CONTROL_ERROR_INVALID_PARAMETER, __FUNCTION__, NULL);
+ }
+
+ if (app_control_validate_internal_key(key))
+ {
+ return app_control_error(APP_CONTROL_ERROR_KEY_REJECTED, __FUNCTION__, "the given key is reserved as internal use");
+ }
+
+ if (appsvc_get_data(app_control->data, key) != NULL)
+ {
+ // overwrite any existing value
+ bundle_del(app_control->data, key);
+ }
+
+ if (appsvc_add_data(app_control->data, key, value) != 0)
+ {
+ return app_control_error(APP_CONTROL_ERROR_KEY_REJECTED, __FUNCTION__, "failed to add data to the appsvc handle");
+ }
+
+ return APP_CONTROL_ERROR_NONE;
+}
+
+
+int app_control_add_extra_data_array(app_control_h app_control, const char *key, const char* value[], int length)
+{
+ if (app_control_validate(app_control) || app_control_validate_extra_data(key))
+ {
+ return app_control_error(APP_CONTROL_ERROR_INVALID_PARAMETER, __FUNCTION__, NULL);
+ }
+
+ if (value == NULL || length <= 0)
+ {
+ return app_control_error(APP_CONTROL_ERROR_INVALID_PARAMETER, __FUNCTION__, "invalid array");
+ }
+
+ if (app_control_validate_internal_key(key))
+ {
+ return app_control_error(APP_CONTROL_ERROR_KEY_REJECTED, __FUNCTION__, "the given key is reserved as internal use");
+ }
+
+ if (appsvc_get_data_array(app_control->data, key, NULL) != NULL)
+ {
+ // overwrite any existing value
+ bundle_del(app_control->data,key);
+ }
+
+ if (appsvc_add_data_array(app_control->data, key, value, length) != 0)
+ {
+ return app_control_error(APP_CONTROL_ERROR_KEY_REJECTED, __FUNCTION__, "failed to add array data to the appsvc handle");
+ }
+
+ return APP_CONTROL_ERROR_NONE;
+}
+
+
+int app_control_remove_extra_data(app_control_h app_control, const char *key)
+{
+ if (app_control_validate(app_control) || app_control_validate_extra_data(key))
+ {
+ return app_control_error(APP_CONTROL_ERROR_INVALID_PARAMETER, __FUNCTION__, NULL);
+ }
+
+ if (app_control_validate_internal_key(key))
+ {
+ return app_control_error(APP_CONTROL_ERROR_KEY_REJECTED, __FUNCTION__, "the given key is reserved as internal use");
+ }
+
+ if (bundle_del(app_control->data, key))
+ {
+ return app_control_error(APP_CONTROL_ERROR_KEY_NOT_FOUND, __FUNCTION__, NULL);
+ }
+
+ return APP_CONTROL_ERROR_NONE;
+}
+
+
+int app_control_get_extra_data(app_control_h app_control, const char *key, char **value)
+{
+ const char *data_value;
+
+ if (app_control_validate(app_control) || app_control_validate_extra_data(key) || value == NULL)
+ {
+ return app_control_error(APP_CONTROL_ERROR_INVALID_PARAMETER, __FUNCTION__, NULL);
+ }
+
+
+ if (app_control_validate_internal_key(key))
+ {
+ return app_control_error(APP_CONTROL_ERROR_KEY_REJECTED, __FUNCTION__, "the given key is reserved as internal use");
+ }
+
+ data_value = appsvc_get_data(app_control->data, key);
+
+ if (data_value == NULL)
+ {
+ if (errno == ENOTSUP)
+ {
+ return app_control_error(APP_CONTROL_ERROR_INVALID_DATA_TYPE, __FUNCTION__, NULL);
+ }
+ else
+ {
+ return app_control_error(APP_CONTROL_ERROR_KEY_NOT_FOUND, __FUNCTION__, NULL);
+ }
+ }
+
+ *value = strdup(data_value);
+
+ return APP_CONTROL_ERROR_NONE;
+}
+
+
+int app_control_get_extra_data_array(app_control_h app_control, const char *key, char ***value, int *length)
+{
+ const char **array_data;
+ int array_data_length;
+ char **array_data_clone;
+ int i;
+
+ if (app_control_validate(app_control) || app_control_validate_extra_data(key))
+ {
+ return app_control_error(APP_CONTROL_ERROR_INVALID_PARAMETER, __FUNCTION__, NULL);
+ }
+
+ if (value == NULL || length == 0)
+ {
+ return app_control_error(APP_CONTROL_ERROR_INVALID_PARAMETER, __FUNCTION__, NULL);
+ }
+
+ if (app_control_validate_internal_key(key))
+ {
+ return app_control_error(APP_CONTROL_ERROR_KEY_REJECTED, __FUNCTION__, "the given key is reserved as internal use");
+ }
+
+ array_data = appsvc_get_data_array(app_control->data, key, &array_data_length);
+
+ if (array_data == NULL)
+ {
+ if (errno == ENOTSUP)
+ {
+ return app_control_error(APP_CONTROL_ERROR_INVALID_DATA_TYPE, __FUNCTION__, NULL);
+ }
+ else
+ {
+ return app_control_error(APP_CONTROL_ERROR_KEY_NOT_FOUND, __FUNCTION__, NULL);
+ }
+ }
+
+ array_data_clone = calloc(array_data_length, sizeof(char*));
+
+ if (array_data_clone == NULL)
+ {
+ return app_control_error(APP_CONTROL_ERROR_OUT_OF_MEMORY, __FUNCTION__, NULL);
+ }
+
+ for (i=0; i<array_data_length; i++)
+ {
+ if (array_data[i] != NULL)
+ {
+ array_data_clone[i] = strdup(array_data[i]);
+ }
+ }
+
+ *value = array_data_clone;
+ *length = array_data_length;
+
+ return APP_CONTROL_ERROR_NONE;
+}
+
+
+int app_control_is_extra_data_array(app_control_h app_control, const char *key, bool *array)
+{
+ if (app_control_validate(app_control) || app_control_validate_extra_data(key) || array == NULL)
+ {
+ return app_control_error(APP_CONTROL_ERROR_INVALID_PARAMETER, __FUNCTION__, NULL);
+ }
+
+ if (app_control_validate_internal_key(key))
+ {
+ return app_control_error(APP_CONTROL_ERROR_KEY_REJECTED, __FUNCTION__, "the given key is reserved as internal use");
+\r }
+
+ if (!appsvc_data_is_array(app_control->data, key))
+ {
+ *array = false;
+ }
+ else
+ {
+ *array = true;
+ }
+
+ return APP_CONTROL_ERROR_NONE;
+}
+
+
+typedef struct {
+ app_control_h app_control;
+ app_control_extra_data_cb callback;
+ void* user_data;
+ bool foreach_break;
+} foreach_context_extra_data_t;
+
+static void app_control_cb_broker_bundle_iterator(const char *key, const int type, const bundle_keyval_t *kv, void *user_data)
+{
+ foreach_context_extra_data_t* foreach_context = NULL;
+ app_control_extra_data_cb extra_data_cb;
+
+ if (key == NULL || !(type == BUNDLE_TYPE_STR || type == BUNDLE_TYPE_STR_ARRAY))
+ {
+ return;
+ }
+
+ foreach_context = (foreach_context_extra_data_t*)user_data;
+
+ if (foreach_context->foreach_break == true)
+ {
+ return;
+ }
+
+ if (app_control_validate_internal_key(key))
+ {
+ return;
+ }
+
+ extra_data_cb = foreach_context->callback;
+
+ if (extra_data_cb != NULL)
+ {
+ bool stop_foreach = false;
+
+ stop_foreach = !extra_data_cb(foreach_context->app_control, key, foreach_context->user_data);
+
+ foreach_context->foreach_break = stop_foreach;
+ }
+
+}
+
+
+int app_control_foreach_extra_data(app_control_h app_control, app_control_extra_data_cb callback, void *user_data)
+{
+ foreach_context_extra_data_t foreach_context = {
+ .app_control = app_control,
+ .callback = callback,
+ .user_data = user_data,
+ .foreach_break = false
+ };
+
+ if (app_control_validate(app_control) || callback == NULL)
+ {
+ return app_control_error(APP_CONTROL_ERROR_INVALID_PARAMETER, __FUNCTION__, NULL);
+ }
+
+ bundle_foreach(app_control->data, app_control_cb_broker_bundle_iterator, &foreach_context);
+
+ return APP_CONTROL_ERROR_NONE;
+}
+
+typedef struct {
+ app_control_h app_control;
+ app_control_app_matched_cb callback;
+ void* user_data;
+ bool foreach_break;
+} foreach_context_launchable_app_t;
+
+int app_control_cb_broker_foreach_app_matched(const char *package, void *data)
+{
+ foreach_context_launchable_app_t *foreach_context;
+ app_control_app_matched_cb app_matched_cb;
+
+ if (package == NULL || data == NULL)
+ {
+ app_control_error(APP_CONTROL_ERROR_INVALID_PARAMETER, __FUNCTION__, NULL);
+ return -1;
+ }
+
+ foreach_context = (foreach_context_launchable_app_t*)data;
+
+ if (foreach_context->foreach_break == true)
+ {
+ return -1;
+ }
+
+ app_matched_cb = foreach_context->callback;
+
+ if (app_matched_cb != NULL)
+ {
+ bool stop_foreach = false;
+
+ stop_foreach = !app_matched_cb(foreach_context->app_control, package, foreach_context->user_data);
+
+ foreach_context->foreach_break = stop_foreach;
+ }
+
+ return 0;
+}
+
+int app_control_foreach_app_matched(app_control_h app_control, app_control_app_matched_cb callback, void *user_data)
+{
+ foreach_context_launchable_app_t foreach_context = {
+ .app_control = app_control,
+ .callback = callback,
+ .user_data = user_data,
+ .foreach_break = false
+ };
+
+ if (app_control_validate(app_control) || callback == NULL)
+ {
+ return app_control_error(APP_CONTROL_ERROR_INVALID_PARAMETER, __FUNCTION__, NULL);
+ }
+
+ appsvc_get_list(app_control->data, app_control_cb_broker_foreach_app_matched, &foreach_context);
+
+ return APP_CONTROL_ERROR_NONE;
+}
+
+
+int app_control_get_caller(app_control_h app_control, char **package)
+{
+ const char *bundle_value;
+ char *package_dup;
+
+ if (app_control_validate(app_control) || package == NULL)
+ {
+ return app_control_error(APP_CONTROL_ERROR_INVALID_PARAMETER, __FUNCTION__, NULL);
+ }
+
+ if (app_control->type != APP_CONTROL_TYPE_EVENT)
+ {
+ return app_control_error(APP_CONTROL_ERROR_INVALID_PARAMETER, __FUNCTION__, "invalid app_control handle type");
+ }
+
+ bundle_value = bundle_get_val(app_control->data, AUL_K_CALLER_APPID);
+ if (bundle_value == NULL)
+ {
+ return app_control_error(APP_CONTROL_ERROR_INVALID_PARAMETER, __FUNCTION__, "failed to retrieve the appid of the caller");
+ }
+
+ package_dup = strdup(bundle_value);
+
+ if (package_dup == NULL)
+ {
+ return app_control_error(APP_CONTROL_ERROR_OUT_OF_MEMORY, __FUNCTION__, NULL);
+ }
+
+ *package = package_dup;
+
+ return APP_CONTROL_ERROR_NONE;
+}
+
+
+int app_control_is_reply_requested(app_control_h app_control, bool *requested)
+{
+ const char *bundle_value;
+
+ if (app_control_validate(app_control) || requested == NULL)
+ {
+ return app_control_error(APP_CONTROL_ERROR_INVALID_PARAMETER, __FUNCTION__, NULL);
+ }
+
+ if (app_control->type != APP_CONTROL_TYPE_EVENT)
+ {
+ return app_control_error(APP_CONTROL_ERROR_INVALID_PARAMETER, __FUNCTION__, "invalid app_control handle type");
+ }
+
+ bundle_value = bundle_get_val(app_control->data, AUL_K_WAIT_RESULT);
+
+ if (bundle_value != NULL)
+ {
+ *requested = true;
+ }
+ else
+ {
+ *requested = false;
+ }
+
+ return APP_CONTROL_ERROR_NONE;
+}
+
+int app_control_import_from_bundle(app_control_h app_control, bundle *data)
+{
+ bundle *data_dup = NULL;
+
+ if (app_control_validate(app_control) || data == NULL)
+ {
+ return app_control_error(APP_CONTROL_ERROR_INVALID_PARAMETER, __FUNCTION__, NULL);
+ }
+
+ data_dup = bundle_dup(data);
+
+ if (data_dup == NULL)
+ {
+ return app_control_error(APP_CONTROL_ERROR_INVALID_PARAMETER, __FUNCTION__, "failed to duplicate the bundle");
+ }
+
+ if (app_control->data != NULL)
+ {
+ bundle_free(app_control->data);
+ }
+
+ app_control->data = data_dup;
+
+ return APP_CONTROL_ERROR_NONE;
+}
+
+int app_control_export_as_bundle(app_control_h app_control, bundle **data)
+{
+ bundle *data_dup = NULL;
+
+ if (app_control_validate(app_control) || data == NULL)
+ {
+ return app_control_error(APP_CONTROL_ERROR_INVALID_PARAMETER, __FUNCTION__, NULL);
+ }
+
+ data_dup = bundle_dup(app_control->data);
+
+ if (data_dup == NULL)
+ {
+ return app_control_error(APP_CONTROL_ERROR_INVALID_PARAMETER, __FUNCTION__, "failed to duplicate the bundle");
+ }
+
+ *data = data_dup;
+
+ return APP_CONTROL_ERROR_NONE;
+}
+
+
+int app_control_request_transient_app(app_control_h app_control, unsigned int callee_id, app_control_host_res_fn cbfunc, void *data)
+{
+ int ret;
+
+ if (app_control_validate(app_control))
+ {
+ return app_control_error(APP_CONTROL_ERROR_INVALID_PARAMETER, __FUNCTION__, NULL);
+ }
+
+ ret = appsvc_request_transient_app(app_control->data, callee_id, (appsvc_host_res_fn)cbfunc, data);
+
+ if (ret < 0)
+ {
+ return app_control_error(APP_CONTROL_ERROR_INVALID_PARAMETER, __FUNCTION__, NULL);
+ }
+
+ return APP_CONTROL_ERROR_NONE;
+}
+
Name: @PC_NAME@
Description: @PACKAGE_DESCRIPTION@
Version: @VERSION@
-Requires: @PC_REQUIRED@
+Requires: @PC_REQUIRED@
Libs: -L${libdir} @PC_LDFLAGS@
Cflags: -I${includedir}
Section: libs
Priority: extra
Maintainer: Woongsuk Cho <ws77.cho@samsung.com>, junghyuk park <junghyuk.park@samsung.com>
-Build-Depends: debhelper (>= 5), dlog-dev, libbundle-dev, libappcore-common-dev, libappcore-efl-dev, libaul-1-dev, libail-0-dev, libappsvc-dev, libnotification-dev, libelm-dev, capi-base-common-dev, libalarm-dev, libsqlite3-dev
+Build-Depends: debhelper (>= 5), dlog-dev, libbundle-dev, libappcore-common-dev, libappcore-efl-dev, libaul-1-dev, libail-0-dev, libappsvc-dev, lbelm-dev, capi-base-common-dev, libalarm-dev, libsqlite3-dev
Package: capi-appfw-application
Architecture: any
--- /dev/null
+/*
+ * Copyright (c) 2011 Samsung Electronics Co., Ltd All Rights Reserved
+ *
+ * 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 __TIZEN_APPFW_ALARM_DOC_H__
+#define __TIZEN_APPFW_ALARM_DOC_H__
+
+ /**
+ * @ingroup CAPI_APPLICATION_MODULE
+ * @defgroup CAPI_ALARM_MODULE Alarm
+ * @brief The @ref CAPI_ALARM_MODULE API allows setting an "alarm clock" for the delivery of a notification at some point in the future.
+ *
+ * @section CAPI_ALARM_MODULE_HEADER Required Header
+ * \#include <app_alarm.h>
+ *
+ * @section CAPI_ALARM_MODULE_OVERVIEW Overview
+ * Mobile devices typically give constant access to information from various sources. Some of this information is best delivered
+ * through alarms - the most obvious case is a calendar scheduling application which lets you know when a meeting is about to start.
+ * Alarms are certainly better than actively waiting in a loop. They are also better than putting an interface to sleep because they do not
+ * block your main UI thread. Use of alarms helps build smooth user experiences and implements unattended data synchronization tasks.
+ * If an application is installed after setting the alarm, your alarm is cancelled automatically.\n
+ *
+ * There are 3 ways to set an alarm.
+ * <table>
+ * <tr>
+ * <th>FUNCTION</th>
+ * <th>DESCRIPTION </th>
+ * </tr>
+ * <tr>
+ * <td>alarm_schedule_after_delay()</td>
+ * <td>Sets an alarm to be triggered at specific time(can repeat in seconds)</td>
+ * </tr>
+ * <tr>
+ * <td>alarm_schedule_at_date()</td>
+ * <td>Sets an alarm to be triggered after specific delay(can repeat in seconds)</td>
+ * </tr>
+ * <tr>
+ * <td>alarm_schedule_with_recurrence_week_flag()</td>
+ * <td>Sets an alarm to be triggered at specific time with recurrent days of the week(can repeat on days of the week)</td>
+ * </tr>
+ * </table>
+ * \n
+ *
+ */
+
+#endif /* __TIZEN_APPFW_ALARM_DOC_H__ */
--- /dev/null
+/*
+ * Copyright (c) 2014 Samsung Electronics Co., Ltd All Rights Reserved
+ *
+ * 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 __TIZEN_APPFW_APP_COMMON_DOC_H__
+#define __TIZEN_APPFW_APP_COMMON_DOC_H__
+
+ /**
+ * @ingroup CAPI_APPLICATION_MODULE
+ * @defgroup CAPI_APP_COMMON_MODULE App Common
+ * @brief The @ref CAPI_APP_COMMON_MODULE API provides functions to getting information about the application.
+ *
+ * @addtogroup CAPI_APP_COMMON_MODULE
+ *
+ * @section CAPI_APP_COMMON_MODULE_HEADER Required Header
+ * \#include <app_common.h>
+ *
+ * @section CAPI_APP_COMMON_MODULE_OVERVIEW Overview
+ *
+ * The App common API provides common apis that can be used at UI application and Service application.
+ * This API provides interfaces for getting information about the application.
+ *
+ * @subsection CAPI_APPLICATION_MODULE_PACKAGE Application Package
+ * The Tizen native application consists of structured directories to manage the application executable file, library files, resource files, and data.
+ * When you build the application, the Tizen SDK packages those as an application package for distribution.
+ *
+ * @image html capi_appfw_application_package.png "Application package"
+ *
+ * <table>
+ * <tr>
+ * <th>Directories</th>
+ * <th>Description</th>
+ * </tr>
+ * <tr>
+ * <td><package id></td>
+ * <td>The fully qualified name of an application (such as org.tizen.calculator).</td>
+ * </tr>
+ * <tr>
+ * <td>bin</td>
+ * <td>The executable file of the application.</td>
+ * </tr>
+ * <tr>
+ * <td>lib</td>
+ * <td>The application library files</td>
+ * </tr>
+ * <tr>
+ * <td>res</td>
+ * <td>The root directory in which all resource files are located.\n
+ * The application cannot write and modify any resource files</td>
+ * </tr>
+ * <tr>
+ * <td>data</td>
+ * <td>The root directory in which an application's private data is located.\n
+ * The application can read and write its own data files in the application's data directory.</td>
+ * </tr>
+ * <tr>
+ * <td>shared/</td>
+ * <td>The shared directory for sharing with other applications.</td>
+ * </tr>
+ * </table>
+ *
+ * @subsection CAPI_APPLICATION_MODULE_GET_INFORMATION Getting Information About the Application
+ * The API provides functions for obtaining an application's package name and absolute path to specified resources
+ * like Image, Sound, Video, UI layout (EDJ), and so on.
+ * It also provides functions to :
+ * - Get the current orientation of the device
+ * - Get the Internal/External root folders which are shared among all applications
+ *
+ */
+
+#endif /* __TIZEN_APPFW_APP_COMMON_DOC_H__ */
--- /dev/null
+/*
+ * Copyright (c) 2011 Samsung Electronics Co., Ltd All Rights Reserved
+ *
+ * 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 __TIZEN_APPFW_APP_CONTROL_DOC_H__
+#define __TIZEN_APPFW_APP_CONTROL_DOC_H__
+
+ /**
+ * @ingroup CAPI_APPLICATION_MODULE
+ * @defgroup CAPI_APP_CONTROL_MODULE App Control
+ * @brief The @ref CAPI_APP_CONTROL_MODULE API provides functions to launch other applications.
+ *
+ * @section CAPI_APP_CONTROL_MODULE_HEADER Required Header
+ * \#include <app_control.h>
+ *
+ * @section CAPI_APP_CONTROLMODULE_OVERVIEW Overview
+ * <a href="../org.tizen.mobile.native.appprogramming/html/guide/app/platform_appcontrol.htm">Platform Application Controls</a>
+ */
+
+#endif /* __TIZEN_APPFW_APP_CONTROL_DOC_H__ */
--- /dev/null
+/*
+ * Copyright (c) 2011 Samsung Electronics Co., Ltd All Rights Reserved
+ *
+ * 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 __TIZEN_APPFW_APP_DOC_H__
+#define __TIZEN_APPFW_APP_DOC_H__
+
+/**
+* @ingroup CAPI_APPLICATION_FRAMEWORK
+* @defgroup CAPI_APPLICATION_MODULE Application
+*
+* @addtogroup CAPI_APPLICATION_MODULE
+*
+* @brief The @ref CAPI_APPLICATION_MODULE API provides functions to manage the main event loop, the application's state change events, basic system events,
+* and get information about the application.
+*
+*
+* @section CAPI_APPLICATION_MODULE_HEADER Required Header
+* \#include <app.h>
+*
+* @section CAPI_APPLICATION_MODULE_OVERVIEW Overview
+*
+* The Application API handles an application state change or system events and provides mechanisms that launch other applications.
+*
+* The Tizen native application is similar to a conventional Linux application, but has some additional features optimized for mobile
+* devices, which may have constraints such as relatively small screen sizes and lack of system resources compared to a larger system.
+* For example, for power management reasons, the application may wish to take actions to reduce usage when it finds out that it had its display window
+* covered over by another application's window. State change events are delivered so that this is possible.
+*
+* The Application API provides interfaces for the following three categories:
+* - Starting or exiting the main event loop (mandatory for every Tizen native application)
+* - Registering callbacks for application state change events
+* - Registering callbacks for basic system events
+*
+* @subsection CAPI_APPLICATION_MODULE_EVENT_LOOP Event Loop
+* For an application to operate successfully, it must receive events from the platform.
+* For this, it needs to start the main event loop - this is mandatory for all Tizen native applications.
+* The ui_app_main() function is used to start the event loop.
+* Before calling this function, you should set up the #ui_app_lifecycle_callback_s structure which is passed to the function (see the following sections).
+*
+* @subsection CAPI_APPLICATION_MODULE_STATE_CHANGE_EVENT Registering Callbacks for Application State Change Events
+* The application state change events include the following:
+* <p>
+* <table>
+* <tr>
+* <th> State </th>
+* <th> Description </th>
+* </tr>
+* <tr>
+* <td> app_create_cb() </td>
+* <td>Hook to take necessary actions before the main event loop starts.
+* Your UI generation code should be placed here so that you do not miss any events from your application UI.
+* </td>
+* </tr>
+* <tr>
+* <td> app_pause_cb() </td>
+* <td> Hook to take necessary actions when an application becomes invisible.
+* For example, you might wish to release memory resources so other applications can use these resources.
+* It is important not to starve the application in front, which is interacting with the user.
+* </td>
+* </tr>
+* <tr>
+* <td> app_resume_cb() </td>
+* <td> Hook to take necessary actions when an application becomes visible.
+* If anything is relinquished in app_pause_cb() but is necessary to resume
+* the application, it must be re-allocated here.
+* </td>
+* </tr>
+* <tr>
+* <td> app_terminate_cb() </td>
+* <td> Hook to take necessary actions when your application is terminating.
+* Your application should release all resources, especially any
+* allocations and shared resources must be freed here so other running applications can fully use these shared resources.
+* </td>
+* </tr>
+* <tr>
+* <td> app_control_cb() </td>
+* <td> Hook to take necessary actions when your application called by another application.
+* When the application gets launch request, this callback function is called.
+* The application can get information about what is to be performed by using App Control API from app_control handle.
+* </td>
+* </tr>
+* </table>
+*
+* For further explanation of application state changes, see the @ref CAPI_APPLICATION_MODULE_STATES_TRANSITIONS section.
+*
+* @subsection CAPI_APPLICATION_MODULE_SYSTEM_EVENT Registering Callbacks for System Events
+* The system event callbacks can be registered using ui_app_add_event_handler(). Multiple system event callbacks can be registered.
+* The basic system event includes the following:
+* <p>
+* <table>
+* <tr>
+* <th> System event types </th>
+* <th> Description </th>
+* </tr>
+* <tr>
+* <td> APP_EVENT_LOW_MEMORY </td>
+* <td> The system memory is running low.
+* Recommended actions are as follows:
+* - Action 1. Save data in main memory to persistent memory/storage
+* to avoid data loss in case the Tizen platform Low Memory Killer kills your application to get more free memory.
+* The explanation of how Low Memory Killer behaves is here(link), but basically if the low memory notice does not lead to enough
+* memory being freed, something will be killed. Release cached data in main memory to secure more free memory.
+* </td>
+* </tr>
+* <tr>
+* <td> APP_EVENT_LOW_BATTERY </td>
+* <td> The battery power is running low.
+* Recommended actions are as follows:
+* - Action 1. Save data in main memory to persistent memory/storage to avoid sudden loss of data in case power goes off completely.
+* - Action 2. Stop heavy CPU consumption or power consumption activities to save remaining power.
+* </td>
+* </tr>
+* <tr>
+* <td> APP_EVENT_DEVICE_ORIENT </td>
+* <td> The orientation of device is changed.
+* Recommended action is as follows: change display orientation to match display orientation
+* </td>
+* </tr>
+* <tr>
+* <td> APP_EVANG_LANGUAGE_CHANGED </td>
+* <td> The language setting is changed.
+* Recommended action: refresh the display into the new language
+* </td>
+* </tr>
+* <tr>
+* <td> APP_EVENT_REGION_FORMAT_CHANGED </td>
+* <td> The region format setting changed.
+* Region change means a different time zone; the application UI may need to update the time to reflect the time zone change.
+* </td>
+* </tr>
+* </table>
+*
+* @subsection CAPI_APPLICATION_MODULE_STATES_TRANSITIONS The Application States and Transitions
+* The Tizen native application can be in one of the several different states. Typically, the application is launched by the user from the Launcher, or by
+* another application. As the application is starting, app_create_cb() is executed, and then app_resume_cb() is invoked. Next, the main event loop starts. The application now normally
+* becomes the front-most window, with focus. When the application loses the front-most/focus status, the app_pause_cb() callback is invoked. There
+* are many scenarios for your application to go into the pause state, which means your application is not terminated, but is running in the background:
+* - A new application is launched from the request of your application
+* - The user requests to go to the home screen
+* - A system event occurs and it causes a resident application with higher priority (e.g. a phone call is received) to become active, and hides
+* your application temporarily
+* - An alarm went off for another application so it now becomes the top-most window and hides your application
+*
+* When your application becomes visible again, the app_resume_cb() callback is invoked. Some possible scenarios for your application to become visible are:
+* - Another application requests your application to run (perhaps the Task Navigator which shows all running applications and lets
+* the user select any app to run)
+* - All applications on top of your application in the window stack finish
+* - An alarm is going off for your application so it becomes the top-most window and hides other applications
+*
+* When your application starts exiting, the app_pause_cb() callback is invoked if the application is visible, and then the app_terminate_cb() callback is invoked. Possible scenarios to start termination of your application are:
+* - Your application itself requests to exit by calling ui_app_exit() to terminate the event loop
+* - The Low Memory Killer is killing your application in a low memory situation.
+*
+* Note that a service application doesn't have UI, so the service application doesn't have Paused state.
+*
+* Application state changes are managed by the underlying framework.
+* Refer to the following state diagram to see the possible transitions:
+* @image html capi_appfw_application_states.png "Application states"
+* <p>
+* <table>
+* <tr>
+* <th> State </th>
+* <th> Description </th>
+* </tr>
+* <tr>
+* <td> READY </td>
+* <td> The application is launched. </td>
+* </tr>
+* <tr>
+* <td> CREATED </td>
+* <td> The application starts the main loop. </td>
+* </tr>
+* <tr>
+* <td> RUNNING </td>
+* <td> The application is running and visible to the user. </td>
+* </tr>
+* <tr>
+* <td> PAUSED </td>
+* <td> The application is running but invisible to the user. </td>
+* </tr>
+* <tr>
+* <td> TERMINATED </td>
+* <td> The application is terminated </td>
+* </tr>
+* </table>
+*
+* The Application API defines five states with their corresponding transition handlers.
+* The state transition is notified through the state transition callback function,
+* whether the application is created, is running, is paused, is resumed, or is terminated.
+* And the application has to perform a specific task that is appropriate to those state changes.
+*
+* @image html capi_appfw_application_lifecycle.png "General application lifecycle"
+*
+* @subsection CAPI_APPLICATION_MODULE_HOW_TO_START How to start the Tizen native application
+* An application can be launched by the user from the Launcher or by another application.
+*
+* Regardless of how an application is launched, the Application Framework starts an application by creating a new process and calls
+* the entry point of the application. Like a conventional Linux application, the main function of its application is the entry point.
+* In the Tizen application, the main task is to hand over control to the Application Framework by calling the ui_app_main() function.
+* @code
+* bool app_create(void *user_data)
+* {
+* // Hook to take necessary actions before the main event loop starts
+* // Initialize UI resources and application's data
+* // If this function returns @c true, the main loop of the application starts
+* // If this function returns @c false, the application is terminated
+* return true;
+* }
+*
+* void app_control(app_control_h app_control, void *user_data)
+* {
+* // Handle the launch request
+* }
+*
+* void app_pause(void *user_data)
+* {
+* // Take necessary actions when the application becomes invisible
+* }
+*
+* void app_resume(void *user_data)
+* {
+* // Take necessary actions when the application becomes visible.
+* }
+*
+* void app_terminate(void *user_data)
+* {
+* // Release all resources
+* }
+*
+* int main(int argc, char *argv[])
+* {
+* struct appdata ad;
+*
+* ui_app_lifecycle_callback_s event_callback = {0,};
+*
+* event_callback.create = app_create;
+* event_callback.terminate = app_terminate;
+* event_callback.pause = app_pause;
+* event_callback.resume = app_resume;
+* event_callback.app_control = app_control;
+*
+* memset(&ad, 0x0, sizeof(struct appdata));
+*
+* return ui_app_main(argc, argv, &event_callback, &ad);
+* }
+* @endcode
+*
+* The ui_app_main() function initializes the application and then starts the main loop.
+*
+* The ui_app_main() function takes four parameters and uses them to initialize the application.
+* The @a argc and @a argv parameters contain the values from the Application Framework, so that you should never have to change the values.
+* The third parameter is a state transition handler that is responsible for managing the state
+* transitions that the application goes through while it is running. The fourth parameter is the application data to be passed to each state handler.
+*
+* When ui_app_main() is first invoked, the application moves from the ready state to the created state.
+* The application has to initialize itself.
+*
+* During this transition, the Application Framework calls the application's app_create_cb() state transition callback function just
+* before the application enters the main loop. Within the registered app_create_cb() callback function, you should initialize the
+* application's resources and create the main window.
+*
+* If the app_create_cb() callback function returns @c false, the application moves to the terminated state.\n
+* If the app_create_cb() callback function returns @c true, the application enters the main loop.
+*
+* @subsection CAPI_APPLICATION_MODULE_LAUNCH_OPTIONS Handling the launch options
+* The Application Framework calls the application's app_control_cb() callback function just after the application enters the main loop.
+* This callback function is passed to the app_control containing the reason due to which the application is launched.
+* For example, the application might be launched to open a file to handle the request that has been sent by another application.
+* In all of these cases, the application is responsible for checking the contents of the app_control and responding appropriately. The contents
+* of the app_control can be empty in situations where the application is launched by the user from the Launcher.
+*
+* @code
+* static void app_control(app_control_h app_control, void *user_data)
+* {
+* struct appdata *ad = (struct appdata *)user_data;
+* char *operation;
+* char *uri;
+* char *mime_type;
+*
+* app_control_get_operation(app_control, operation);
+*
+* if (!strcmp(operation, SERVICE_OPERATION_VIEW))
+* {
+* app_control_get_uri(app_control, &uri);
+* app_control_get_mime(app_control, &mime_type);
+*
+* if (uri && !strcmp(mime_type, "image/jpg"))
+* {
+* display_image_file(ad, uri); // display a specific image file
+* }
+* }
+*
+* if (ad->win)
+* elm_win_activate(ad->win);
+*
+* }
+* @endcode
+*
+*/
+
+#endif /* __TIZEN_APPFW_APP_DOC_H__ */
--- /dev/null
+/*
+ * Copyright (c) 2011 Samsung Electronics Co., Ltd All Rights Reserved
+ *
+ * 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 __TIZEN_APPFW_I18N_DOC_H__
+#define __TIZEN_APPFW_I18N_DOC_H__
+
+
+ /**
+ * @ingroup CAPI_APPLICATION_MODULE
+ * @defgroup CAPI_I18N_MODULE Internationalization
+ * @brief The Internationalization API provides functions to write multilingual applications through GNU gettext.
+ *
+ * @section CAPI_I18_MODULE_HEADER Required Header
+ * \#include <app.h>
+ *
+ * @section CAPI_I18N_MODULE_OVERVIEW Overview
+ * The @ref CAPI_I18N_MODULE API provides functions to write multilingual applications through GNU gettext.
+ * <p>
+ * Tizen provides all the features of the GNU gettext library through the Internationalization API
+ * and allows you to manage message catalogs from SDK.
+ * <p>
+ * The Internationalization API consists of i18n_get_text() for message translation
+ * and macros to use i18n_get_text() in an easy to use form.
+ * These macros allow you to mark strings for translation in source codes,
+ * which are replaced with the translated strings at runtime.
+ * <p>
+ */
+
+
+
+#endif /* __TIZEN_APPFW_I18N_DOC_H__ */
--- /dev/null
+/*
+ * Copyright (c) 2011 Samsung Electronics Co., Ltd All Rights Reserved
+ *
+ * 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 __TIZEN_APPFW_PREFERENCE_DOC_H__
+#define __TIZEN_APPFW_PREFERENCE_DOC_H__
+
+ /**
+ * @ingroup CAPI_APPLICATION_MODULE
+ * @defgroup CAPI_PREFERENCE_MODULE Preference
+ * @brief The @ref CAPI_PREFERENCE_MODULE API provides functions to store and retrieve small pieces of data, used for application preferences.
+ *
+ * @addtogroup CAPI_PREFERENCE_MODULE
+ *
+ * @section CAPI_PREFERENCE_MODULE_HEADER Required Header
+ * \#include <app_preference.h>
+ *
+ * @section CAPI_PREFERENCE_MODULE_OVERVIEW Overview
+ *
+ * The Preference API provides a mechanism that saves data items in the form of key/value pairs for this application, and later retrieves them.
+ * A typical usecase would be for an application preference screen where the user can pick some values for some options. The Preference API
+ * has pairs of functions, one to set such a pair, another to retrieve the stored value given in the key. Keys are always text strings, but
+ * there are functions for each of the possible value types: integer, double, string, and boolean. There is also a function to clear all of the preferences.
+ *
+ * The @ref CAPI_PREFERENCE_MODULE API provides a way to register a callback to get notified when a value for a particular key changes. It is useful to know
+ * when the display should be updated or some behavior is altered as a result.
+ *
+ * There is an iterator function which steps through all the data pairs, invoking a callback for each one.
+ */
+
+#endif /* __TIZEN_APPFW_PREFERENCE_DOC_H__ */
* 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.
+ * limitations under the License.
*/
#ifndef __TIZEN_APPFW_APP_H__
#define __TIZEN_APPFW_APP_H__
-#include <tizen.h>
-#include <app_service.h>
-#include <app_alarm.h>
-#include <app_preference.h>
-#include <app_storage.h>
+#include <app_control.h>
+#include <app_common.h>
#include <app_i18n.h>
-#include <app_ui_notification.h>
+#include <app_types.h>
#ifdef __cplusplus
extern "C" {
#endif
/**
- * @addtogroup CAPI_APPLICATION_MODULE
- * @{
+ * @file app.h
*/
-
-/**
- * @brief Enumerations of error code for Application.
- */
-typedef enum
-{
- APP_ERROR_NONE = TIZEN_ERROR_NONE, /**< Successful */
- APP_ERROR_INVALID_PARAMETER = TIZEN_ERROR_INVALID_PARAMETER, /**< Invalid parameter */
- APP_ERROR_OUT_OF_MEMORY = TIZEN_ERROR_OUT_OF_MEMORY, /**< Out of memory */
- APP_ERROR_INVALID_CONTEXT = TIZEN_ERROR_NOT_PERMITTED, /**< Invalid application context */
- APP_ERROR_NO_SUCH_FILE = TIZEN_ERROR_NO_SUCH_FILE, /**< No such file or directory */
- APP_ERROR_ALREADY_RUNNING = TIZEN_ERROR_ALREADY_IN_PROGRESS, /**< Application is already running */
-} app_error_e;
-
-
/**
- * @brief Enumerations of the device orientation.
+ * @addtogroup CAPI_APPLICATION_MODULE
+ * @{
*/
-typedef enum
-{
- APP_DEVICE_ORIENTATION_0 = 0, /**< The device is oriented in natural position */
- APP_DEVICE_ORIENTATION_90 = 90, /**< The device's left side is at the top */
- APP_DEVICE_ORIENTATION_180 = 180, /**< The device is upside down */
- APP_DEVICE_ORIENTATION_270 = 270, /**<The device's right side is to the top */
-} app_device_orientation_e;
/**
- * @brief Called at the start of the application.
- *
- * @details The callback function is called before the main loop of application starts.
- * In this callback you can initialize application resources like window creation, data structure, etc.
- * After this callback function returns @c true, the main loop starts up and app_service_cb() is subsequently called.
- * If this callback function returns @c false, the main loop doesn't start and app_terminate_cb() is subsequently called.
- *
- * @param[in] user_data The user data passed from the callback registration function
- * @return @c true on success, otherwise @c false
- * @pre app_efl_main() will invoke this callback function.
- * @see app_efl_main()
- * @see #app_event_callback_s
+ * @brief Called when the application starts.
+ *
+ * @details The callback function is called before the main loop of the application starts.
+ * In this callback, you can initialize application resources like window creation, data structure, and so on.
+ * After this callback function returns @c true, the main loop starts up and app_control_cb() is subsequently called.
+ * If this callback function returns @c false, the main loop doesn't start and app_terminate_cb() is subsequently called.
+ *
+ * @since_tizen 2.3
+ * @param[in] user_data The user data passed from the callback registration function
+ * @return @c true on success,
+ * otherwise @c false
+ * @pre ui_app_main() will invoke this callback function.
+ * @see ui_app_main()
+ * @see #ui_app_lifecycle_callback_s
*/
typedef bool (*app_create_cb) (void *user_data);
/**
- * @brief Called when the application is completely obscured by another application and becomes invisible.
+ * @brief Called when the application is completely obscured by another application and becomes invisible.
*
- * @details The application is not terminated and still running in paused state.
+ * @details The application is not terminated and still running in the paused state.
*
- * @param[in] user_data The user data passed from the callback registration function
- * @see app_efl_main()
- * @see #app_event_callback_s
+ * @since_tizen 2.3
+ * @param[in] user_data The user data passed from the callback registration function
+ * @see ui_app_main()
+ * @see #ui_app_lifecycle_callback_s
*/
typedef void (*app_pause_cb) (void *user_data);
/**
- * @brief Called when the application becomes visible.
+ * @brief Called when the application becomes visible.
*
- * @remarks This callback function is not called when the application moved from created state to running state.
+ * @since_tizen 2.3
+ * @remarks This callback function is not called when the application moves from the created state to the running state.
*
- * @param[in] user_data The user data passed from the callback registration function
- * @see app_efl_main()
- * @see #app_event_callback_s
+ * @param[in] user_data The user data passed from the callback registration function
+ * @see ui_app_main()
+ * @see #ui_app_lifecycle_callback_s
*/
typedef void (*app_resume_cb) (void *user_data);
/**
- * @brief Called once after the main loop of application exits.
+ * @brief Called when the application's main loop exits.
* @details You should release the application's resources in this function.
*
- * @param[in] user_data The user data passed from the callback registration function
- * @see app_efl_main()
- * @see #app_event_callback_s
+ * @since_tizen 2.3
+ * @param[in] user_data The user data passed from the callback registration function
+ * @see ui_app_main()
+ * @see #ui_app_lifecycle_callback_s
*/
typedef void (*app_terminate_cb) (void *user_data);
/**
- * @brief Called when other application send the launch request to the application.
- *
- * @details When the application is launched, this callback function is called after the main loop of application starts up.
- * The passed service handle describes the launch request and contains the information about why the application is launched.
- * If the launch request is sent to the application on running or pause state,
- * this callback function can be called again to notify that the application is asked to be launched.
- *
- * The application could be explicitly launched by the user from the application launcher or be launched to perform the specific operation by other application.
- * The application is responsible for handling the each launch request and responding appropriately.
- * Using the Service API, the application can get the information what has to perform.
- * If the application is launched from the application launcher or explicitly launched by other application,
- * the passed service handle may include only the default operation (#SERVICE_OPERATION_DEFAULT) without any data
- * For more information, see The @ref CAPI_SERVICE_MODULE API description.
- *
- * @param[in] service The handle to the service
- * @param[in] user_data The user data passed from the callback registration function
- * @see app_efl_main()
- * @see #app_event_callback_s
- * @see @ref CAPI_SERVICE_MODULE API
+ * @brief Called when another application sends a launch request to the application.
+ *
+ * @details When the application is launched, this callback function is called after the main loop of the application starts up.
+ * The passed app_control handle describes the launch request and contains the information about why the application is launched.
+ * If the launch request is sent to the application in the running or pause state,
+ * this callback function can be called again to notify that the application has been asked to launch.
+ *
+ * The application could be explicitly launched by the user from the application launcher or be launched to perform the specific operation by another application.
+ * The application is responsible for handling each launch request and responding appropriately.
+ * Using the App Control API, the application can get information about what is to be performed.
+ * If the application is launched from the application launcher or explicitly launched by another application,
+ * the passed app_control handle may include only the default operation (#APP_CONTROL_OPERATION_DEFAULT) without any data.
+ * For more information, see The @ref CAPI_APP_CONTROL_MODULE API description.
+ *
+ * @since_tizen 2.3
+ * @param[in] app_control The handle to the app_control
+ * @param[in] user_data The user data passed from the callback registration function
+ * @see ui_app_main()
+ * @see #ui_app_lifecycle_callback_s
+ * @see @ref CAPI_APP_CONTROL_MODULE API
*/
-typedef void (*app_service_cb) (service_h service, void *user_data);
+typedef void (*app_control_cb) (app_control_h app_control, void *user_data);
/**
- * @brief Called when the system memory is running low.
+ * @internal
+ * @brief Called when the system memory is running low.
*
- * @details
- * When low memory event is dispatched, the application should immediately save state and release resources to save as much memory as possible. \n
- * If enough memory is not reclaimed during low memory conditions, the system will terminate some of the applications to reclaim the memory.
+ * @details When a low memory event is dispatched, the application should immediately save state and release resources to save as much memory as possible. \n
+ * If enough memory is not reclaimed during low memory conditions, the system will terminate some of the applications to reclaim the memory.
*
- * @param[in] user_data The user data passed from the callback registration function
- * @see app_efl_main()
+ * @since_tizen 2.3
+ * @param[in] user_data The user data passed from the callback registration function
+ * @see app_main()
* @see #app_event_callback_s
*/
typedef void (*app_low_memory_cb) (void *user_data);
/**
- * @brief Called when the battery power is running low.
+ * @internal
+ * @brief Called when the battery power is running low.
* @details When the battery level falls below 5%, it is called.
*
- * @param[in] user_data The user data passed from the callback registration function
- * @see app_efl_main()
+ * @since_tizen 2.3
+ * @param[in] user_data The user data passed from the callback registration function
+ * @see app_main()
* @see #app_event_callback_s
*/
typedef void (*app_low_battery_cb) (void *user_data);
/**
- * @brief Called when the orientation of device changes.
+ * @internal
+ * @brief Called when the orientation of the device changes.
*
- * @param[in] orientation The orientation of device
- * @param[in] user_data The user data passed from the callback registration function
- * @see app_efl_main()
+ * @since_tizen 2.3
+ * @param[in] orientation The orientation of the device
+ * @param[in] user_data The user data passed from the callback registration function
+ * @see app_main()
* @see #app_event_callback_s
*/
typedef void (*app_device_orientation_cb) (app_device_orientation_e orientation, void *user_data);
/**
- * @brief Called when language setting changes.
+ * @internal
+ * @brief Called when language setting changes.
*
- * @param [in] user_data The user data passed from the callback registration function
- * @see app_efl_main()
+ * @since_tizen 2.3
+ * @param[in] user_data The user data passed from the callback registration function
+ * @see app_main()
* @see #app_event_callback_s
*/
typedef void (*app_language_changed_cb) (void *user_data);
/**
- * @brief Called when region format setting changes.
+ * @internal
+ * @brief Called when region format setting changes.
*
- * @param [in] user_data The user data passed from the callback registration function
- * @see app_efl_main()
+ * @since_tizen 2.3
+ * @param[in] user_data The user data passed from the callback registration function
+ * @see app_main()
* @see #app_event_callback_s
*/
typedef void (*app_region_format_changed_cb) (void *user_data);
/**
- * @brief The structure type to contain the set of callback functions for handling application events.
- * @details It is one of the input parameters of the app_efl_main() function.
+ * @internal
+ * @brief The structure type containing the set of callback functions for handling application events.
+ * @details It is one of the input parameters of the app_main() function.
*
- * @see app_efl_main()
+ * @since_tizen 2.3
+ * @see app_main()
* @see app_create_cb()
* @see app_pause_cb()
* @see app_resume_cb()
* @see app_terminate_cb()
- * @see app_service_cb()
+ * @see app_control_cb()
* @see app_low_memory_cb()
* @see app_low_battery_cb()
* @see app_device_orientation_cb()
typedef struct
{
app_create_cb create; /**< This callback function is called at the start of the application. */
- app_terminate_cb terminate; /**< This callback function is called once after the main loop of application exits. */
+ app_terminate_cb terminate; /**< This callback function is called once after the main loop of the application exits. */
app_pause_cb pause; /**< This callback function is called each time the application is completely obscured by another application and becomes invisible to the user. */
app_resume_cb resume; /**< This callback function is called each time the application becomes visible to the user. */
- app_service_cb service; /**< This callback function is called when other application send the launch request to the application. */
+ app_control_cb app_control; /**< This callback function is called when another application sends the launch request to the application. */
app_low_memory_cb low_memory; /**< The registered callback function is called when the system runs low on memory. */
- app_low_battery_cb low_battery; /**< The registered callback function is called when battery is low. */
- app_device_orientation_cb device_orientation; /**< The registered callback function is called when the orientation of device changes */
+ app_low_battery_cb low_battery; /**< The registered callback function is called when the battery is low. */
+ app_device_orientation_cb device_orientation; /**< The registered callback function is called when the orientation of the device changes */
app_language_changed_cb language_changed; /**< The registered callback function is called when language setting changes. */
- app_region_format_changed_cb region_format_changed; /**< The registered callback function is called when region format setting is changes. */
+ app_region_format_changed_cb region_format_changed; /**< The registered callback function is called when region format setting changes. */
} app_event_callback_s;
/**
- * @brief Runs the main loop of application until app_efl_exit() is called
+ * @brief The structure type containing the set of callback functions for handling application lifecycle events.
+ * @details It is one of the input parameters of the ui_app_main() function.
+ *
+ * @since_tizen 2.3
+ * @see ui_app_main()
+ * @see app_create_cb()
+ * @see app_pause_cb()
+ * @see app_resume_cb()
+ * @see app_terminate_cb()
+ * @see app_control_cb()
+ */
+typedef struct
+{
+ app_create_cb create; /**< This callback function is called at the start of the application. */
+ app_terminate_cb terminate; /**< This callback function is called once after the main loop of the application exits. */
+ app_pause_cb pause; /**< This callback function is called each time the application is completely obscured by another application and becomes invisible to the user. */
+ app_resume_cb resume; /**< This callback function is called each time the application becomes visible to the user. */
+ app_control_cb app_control; /**< This callback function is called when another application sends the launch request to the application. */
+} ui_app_lifecycle_callback_s;
+
+
+/**
+ * @internal
+ * @brief Runs the application's main loop until app_exit() is called.
*
* @details This function is the main entry point of the Tizen application.
- * The app_create_cb() callback function is called to initialize the application before the main loop of application starts up.
- * After the app_create_cb() callback function returns true, the main loop starts up and the app_service_cb() callback function is subsequently called.
- * If the app_create_cb() callback function returns false, the main loop doesn't start up and app_terminate_cb() callback function is called
+ * The app_create_cb() callback function is called to initialize the application before the main loop of application starts up.
+ * After the app_create_cb() callback function returns true, the main loop starts up and the app_control_cb() callback function is subsequently called.
+ * If the app_create_cb() callback function returns false, the main loop doesn't start up and app_terminate_cb() callback function is called.
*
- * @param [in] argc The argument count
- * @param [in] argv The argument vector
- * @param [in] callback The set of callback functions to handle application events
- * @param [in] user_data The user data to be passed to the callback functions
+ * @since_tizen 2.3
+ * @param[in] argc The argument count
+ * @param[in] argv The argument vector
+ * @param[in] callback The set of callback functions to handle application events
+ * @param[in] user_data The user data to be passed to the callback functions
*
- * @return 0 on success, otherwise a negative error value.
+ * @return 0 on success, otherwise a negative error value
* @retval #APP_ERROR_NONE Successful
* @retval #APP_ERROR_INVALID_PARAMETER Invalid parameter
- * @retval #APP_ERROR_INVALID_CONTEXT The application is illegally launched, not launched by the launch system.
+ * @retval #APP_ERROR_INVALID_CONTEXT The application is illegally launched, not launched by the launch system
* @retval #APP_ERROR_ALREADY_RUNNING The main loop already starts
*
* @see app_create_cb()
* @see app_terminate_cb()
* @see app_pause_cb()
* @see app_resume_cb()
- * @see app_service_cb()
+ * @see app_control_cb()
+ * @see app_low_memory_cb()
+ * @see app_low_battery_cb()
+ * @see app_device_orientation_cb()
+ * @see app_language_changed_cb()
+ * @see app_region_format_changed_cb()
+ * @see app_exit()
+ * @see #app_event_callback_s
+ */
+int app_main(int argc, char **argv, app_event_callback_s *callback, void *user_data);
+
+
+/**
+ * @internal
+ * @brief Runs the application's main loop until app_efl_exit() is called.
+ *
+ * @details This function is the main entry point of the Tizen application.
+ * The app_create_cb() callback function is called to initialize the application before the main loop of the application starts up.
+ * After the app_create_cb() callback function returns @c true, the main loop starts up and the app_control_cb() callback function is subsequently called.
+ * If the app_create_cb() callback function returns @c false, the main loop doesn't start up and the app_terminate_cb() callback function is called.
+ *
+ * @since_tizen 2.3
+ * @param[in] argc The argument count
+ * @param[in] argv The argument vector
+ * @param[in] callback The set of callback functions to handle application events
+ * @param[in] user_data The user data to be passed to the callback functions
+ *
+ * @return @c 0 on success,
+ * otherwise a negative error value
+ * @retval #APP_ERROR_NONE Successful
+ * @retval #APP_ERROR_INVALID_PARAMETER Invalid parameter
+ * @retval #APP_ERROR_INVALID_CONTEXT The application is illegally launched, not launched by the launch system
+ * @retval #APP_ERROR_ALREADY_RUNNING The main loop has already started
+ *
+ * @see app_create_cb()
+ * @see app_terminate_cb()
+ * @see app_pause_cb()
+ * @see app_resume_cb()
+ * @see app_control_cb()
* @see app_low_memory_cb()
* @see app_low_battery_cb()
* @see app_device_orientation_cb()
/**
+ * @internal
* @brief Exits the main loop of application.
*
- * @details The main loop of application stops and app_terminate_cb() is invoked
+ * @details The main loop of application stops and app_terminate_cb() is invoked.
+ * @since_tizen 2.3
+ * @see app_main()
+ * @see app_terminate_cb()
+ */
+void app_exit(void);
+
+
+/**
+ * @internal
+ * @brief Exits the main loop of the application.
+ *
+ * @details The main loop of the application stops and app_terminate_cb() is invoked.
+ * @since_tizen 2.3
* @see app_efl_main()
- * @see app_terminate_cb()
+ * @see app_terminate_cb()
*/
void app_efl_exit(void);
/**
- * @brief Gets the name of the application package.
- *
- * @remarks @a package must be released with free() by you.
- *
- * @param [out] package The name of the application package
- *
- * @return 0 on success, otherwise a negative error value.
+ * @brief Gets the current device orientation.
*
- * @retval #APP_ERROR_NONE Successful
- * @retval #APP_ERROR_INVALID_PARAMETER Invalid parameter
- * @retval #APP_ERROR_INVALID_CONTEXT The application is illegally launched, not launched by the launch system.
- * @retval #APP_ERROR_OUT_OF_MEMORY Out of memory
+ * @since_tizen 2.3
+ * @return The current device orientation
*/
-int app_get_package(char **package);
+app_device_orientation_e app_get_device_orientation(void);
/**
- * @brief Gets the ID of the application.
- *
- * @remarks @a ID must be released with free() by you.
+ * @internal
+ * @brief Sets whether reclaiming system cache is enabled in the pause state.
*
- * @param [out] id The ID of the application
+ * @details If reclaiming system cache is enabled, the system caches are released as possible when the application's state changes to the pause state.
*
- * @return 0 on success, otherwise a negative error value.
+ * @since_tizen 2.3
+ * @remarks Reclaiming system cache is enabled by default.
*
- * @retval #APP_ERROR_NONE Successful
- * @retval #APP_ERROR_INVALID_PARAMETER Invalid parameter
- * @retval #APP_ERROR_INVALID_CONTEXT The application is illegally launched, not launched by the launch system.
- * @retval #APP_ERROR_OUT_OF_MEMORY Out of memory
+ * @param[in] enable If @c true reclaiming system cache is enabled,
+ * otherwise @c false
*/
-int app_get_id(char **id);
-
+void app_set_reclaiming_system_cache_on_pause(bool enable);
/**
- * @brief Gets the localized name of the application.
- *
- * @remarks @a name must be released with free() by you.
+ * @internal
+ * @brief Gets the preinitialized window object.
*
- * @param [out] name The name of the application
+ * @since_tizen 2.3
+ * @remarks This API only supports BASIC type window.
*
- * @return 0 on success, otherwise a negative error value.
+ * @param[in] win_name The name to be set for the preinitialized window
*
- * @retval #APP_ERROR_NONE Successful
- * @retval #APP_ERROR_INVALID_PARAMETER Invalid parameter
- * @retval #APP_ERROR_INVALID_CONTEXT The application is illegally launched, not launched by the launch system.
- * @retval #APP_ERROR_OUT_OF_MEMORY Out of memory
+ * @return A @a window object on success,
+ * otherwise @c NULL
*/
-int app_get_name(char **name);
-
+void* app_get_preinitialized_window(const char* win_name);
/**
- * @brief Gets the version of the application package.
- *
- * @remarks @a version must be released with free() by you.
+ * @internal
+ * @brief Gets the preinitialized background object added to the preinitialized window.
*
- * @param [out] version The version of the application
+ * @since_tizen 2.3
+ * @remarks This API should be called after calling app_get_preinitizlized_window().
*
- * @return 0 on success, otherwise a negative error value.
- *
- * @retval #APP_ERROR_NONE Successful
- * @retval #APP_ERROR_INVALID_PARAMETER Invalid parameter
- * @retval #APP_ERROR_INVALID_CONTEXT The application is illegally launched, not launched by the launch system.
- * @retval #APP_ERROR_OUT_OF_MEMORY Out of memory
+ * @return A @a background object on success,
+ * otherwise @c NULL
*/
-int app_get_version(char **version);
-
+void* app_get_preinitialized_background(void);
/**
- * @brief Gets the absolute path to the resource included in application package
- *
- * @details The application cannot write and modify any resource files.
+ * @internal
+ * @brief Gets the preinitialized conformant widget added to the preinitialized window.
*
- * @remarks This function stores the absolute path into the @a buffer at most one less than @a size bytes
- * and a null character is appended in @a buffer after the path stored.
+ * @since_tizen 2.3
+ * @remarks This API should be called after calling app_get_preinitizlized_window().
*
- * @param [in] resource The resource's path relative to the resource directory of the application package (e.g. edje/app.edj or images/background.png)
- * @param [in] buffer The pre-allocated buffer where the absolute path to the resource is stored.
- * @param [in] size The size of @a buffer in bytes
- * @return @a buffer on success, otherwise NULL.
+ * @return A conformant object on success,
+ * otherwise @c NULL
*/
-char* app_get_resource(const char *resource, char *buffer, int size);
+void* app_get_preinitialized_conformant(void);
/**
- * @brief Gets the absolute path to the application's data directory.
+ * @brief Runs the application's main loop until ui_app_exit() is called.
*
- * @details An application can read and write its own data files in the application's data directory.
- *
- * @remarks This function stores the absolute path into the @a buffer at most one less than @a size bytes
- * and a null character is appended in @a buffer after the path stored.
+ * @details This function is the main entry point of the Tizen application.
+ * The app_create_cb() callback function is called to initialize the application before the main loop of application starts up.
+ * After the app_create_cb() callback function returns true, the main loop starts up and the app_control_cb() callback function is subsequently called.
+ * If the app_create_cb() callback function returns false, the main loop doesn't start up and app_terminate_cb() callback function is called.
+ * This main loop supports event handling for the Ecore Main Loop.
+ *
+ * @since_tizen 2.3
+ * @param[in] argc The argument count
+ * @param[in] argv The argument vector
+ * @param[in] callback The set of callback functions to handle application lifecycle events
+ * @param[in] user_data The user data to be passed to the callback functions
+ *
+ * @return 0 on success, otherwise a negative error value
+ * @retval #APP_ERROR_NONE Successful
+ * @retval #APP_ERROR_INVALID_PARAMETER Invalid parameter
+ * @retval #APP_ERROR_INVALID_CONTEXT The application is illegally launched, not launched by the launch system
+ * @retval #APP_ERROR_ALREADY_RUNNING The main loop already starts
*
- * @param [in] buffer The pre-allocated buffer where the absolute path to the application data directory
- * @param [in] size The size of @a buffer in bytes
- * @return @a buffer on success, otherwise NULL.
+ * @see app_create_cb()
+ * @see app_terminate_cb()
+ * @see app_pause_cb()
+ * @see app_resume_cb()
+ * @see app_control_cb()
+ * @see ui_app_exit()
+ * @see #ui_app_lifecycle_callback_s
*/
-char* app_get_data_directory(char *buffer, int size);
+int ui_app_main(int argc, char **argv, ui_app_lifecycle_callback_s *callback, void *user_data);
/**
- * @brief Gets the current device orientation.
+ * @brief Exits the main loop of application.
*
- * @return The current device orientation
+ * @details The main loop of application stops and app_terminate_cb() is invoked.
+ * @since_tizen 2.3
+ *
+ * @see ui_app_main()
+ * @see app_terminate_cb()
*/
-app_device_orientation_e app_get_device_orientation(void);
+void ui_app_exit(void);
/**
- * @brief Sets whether reclaiming system cache is enabled in the pause state.
+ * @brief Adds the system event handler
*
- * @details If the reclaiming system cache is enabled, the system caches are released as possible when the application's state changes to the pause state.
+ * @since_tizen 2.3
+ * @param[out] event_handler The event handler
+ * @param[in] event_type The system event type
+ * @param[in] callback The callback function
+ * @param[in] user_data The user data to be passed to the callback functions
*
- * @remarks The reclaiming system cache is enabled by default
+ * @return 0 on success, otherwise a negative error value
+ * @retval #APP_ERROR_NONE Successful
+ * @retval #APP_ERROR_INVALID_PARAMETER Invalid parameter
+ * @retval #APP_ERROR_OUT_OF_MEMORY Out of memory
*
- * @param [in] enable whether reclaiming system cache is enabled
+ * @see app_event_type_e
+ * @see app_event_cb
+ * @see ui_app_remove_event_handler
*/
-void app_set_reclaiming_system_cache_on_pause(bool enable);
+int ui_app_add_event_handler(app_event_handler_h *event_handler, app_event_type_e event_type, app_event_cb callback, void *user_data);
+
/**
- * @brief Gets the preinitialized window object.
+ * @brief Removes registered event handler
+ *
+ * @since_tizen 2.3
+ * @param[in] event_handler The event handler
+ *
+ * @return 0 on success, otherwise a negative error value
+ * @retval #APP_ERROR_NONE Successful
+ * @retval #APP_ERROR_INVALID_PARAMETER Invalid parameter
*
- * @return @a window object on success, otherwise NULL.
+ * @see ui_app_add_event_handler
*/
-void* app_get_preinitizlized_window(void);
+int ui_app_remove_event_handler(app_event_handler_h event_handler);
/**
* @}
* 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.
+ * limitations under the License.
*/
#include <tizen.h>
#include <time.h>
-#include <app_service.h>
+#include <app_control.h>
#ifdef __cplusplus
extern "C" {
#endif
/**
+ * @file app_alarm.h
+ */
+
+/**
* @addtogroup CAPI_ALARM_MODULE
* @{
*/
/**
- * @brief Service extra data : the id of the alarm registered
+ * @brief Definition to app_control extra data : the ID of the alarm registered.
+ * @since_tizen 2.3
*/
-#define SERVICE_DATA_ALARM_ID "http://tizen.org/appcontrol/data/alarm_id"
+#define APP_CONTROL_DATA_ALARM_ID "http://tizen.org/appcontrol/data/alarm_id"
/**
- * @brief Enumerations of error codes for the alarm
+ * @brief Enumeration for Alarm Error.
+ * @since_tizen 2.3
*/
typedef enum
{
ALARM_ERROR_NONE = TIZEN_ERROR_NONE, /**< Successful */
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_INVALID_TIME = TIZEN_ERROR_APPLICATION | 0x05, /**< Invalid time */
+ ALARM_ERROR_INVALID_DATE = TIZEN_ERROR_APPLICATION | 0x06, /**< Invalid date */
+ ALARM_ERROR_CONNECTION_FAIL = TIZEN_ERROR_APPLICATION | 0x07, /**< The alarm service connection failed */
ALARM_ERROR_OUT_OF_MEMORY = TIZEN_ERROR_OUT_OF_MEMORY, /**< Out of memory */
ALARM_ERROR_PERMISSION_DENIED = TIZEN_ERROR_PERMISSION_DENIED /**< Permission denied */
} alarm_error_e;
/**
- * @brief Enumerations of the days of the week.
+ * @brief Enumeration for Alarm Week Flag, the days of the week.
+ * @since_tizen 2.3
*/
typedef enum
{
} alarm_week_flag_e;
/**
- * @brief Called once for each scheduled alarm to get the alarm ID.
+ * @brief Called once for each scheduled alarm to get the alarm ID.
*
- * @param[in] alarm_id The alarm ID returned when the alarm is scheduled
- * @param[in] user_data The user data passed from the foreach function
- * @return @c true to continue with the next iteration of the loop, \n @c false to break out of the loop.
- * @pre alarm_foreach_registered_alarm() will invoke this callback to get all registered alarm IDs.
+ * @since_tizen 2.3
+ * @param[in] alarm_id The alarm ID returned when the alarm is scheduled
+ * @param[in] user_data The user data passed from the foreach function
+ * @return @c true to continue with the next iteration of the loop,
+ * otherwise @c false to break out of the loop
+ * @pre alarm_foreach_registered_alarm() will invoke this callback to get all the registered alarm IDs.
* @see alarm_foreach_registered_alarm()
*/
typedef bool (*alarm_registered_alarm_cb)(int alarm_id, void *user_data);
/**
- * @brief Sets an alarm to be triggered after specific time.
+ * @brief Sets an alarm to be triggered after a specific time.
* @details The alarm will first go off @a delay seconds later and then will go off every certain amount of time defined using @a period seconds.
- * If @a period is bigger than 0, the alarm will be scheduled after the @a period time.
- * If @a period is set to 0, the alarm will go off just once without repetition.
- * To cancel the alarm, call alarm_cancel() with @alarm_id
+ * If @a period is bigger than @c 0, the alarm will be scheduled after the @a period time.
+ * If @a period is set to @c 0, the alarm will go off just once without repetition.
+ * To cancel the alarm, call alarm_cancel() with @a alarm_id.
+ * @since_tizen 2.3
+ * @privlevel public
+ * @privilege %http://tizen.org/privilege/alarm.set
+ * @remarks If the application is uninstalled after setting an alarm, the alarm is cancelled automatically.
*
- * @remarks If application is uninstalled after setting an alarm, the alarm is canceled automatically.
- *
- * @param[in] service The destination service to perform specific work when the alarm is triggered.
- * @param[in] delay The amount of time before first execution(in second)
- * @param[in] period The amount of time between subsequent alarms(in second)
- * @param[out] alarm_id The alarm ID uniquely identifies an alarm
- * @return 0 on success, otherwise a negative error value.
+ * @param[in] app_control The destination app_control to perform a specific task when the alarm is triggered
+ * @param[in] delay The amount of time before the first execution (in seconds)
+ * @param[in] period The amount of time between subsequent alarms (in seconds)
+ * @param[out] alarm_id The alarm ID that uniquely identifies an alarm
+ * @return @c 0 on success,
+ * otherwise a negative error value
* @retval #ALARM_ERROR_NONE Successful
* @retval #ALARM_ERROR_INVALID_PARAMETER Invalid parameter
* @retval #ALARM_ERROR_INVALID_TIME Triggered time is invalid
* @retval #ALARM_ERROR_CONNECTION_FAIL Failed to connect to an alarm server
+ * @retval #ALARM_ERROR_PERMISSION_DENIED Permission denied
* @see alarm_cancel()
* @see alarm_cancel_all()
* @see alarm_get_scheduled_date()
* @see alarm_get_scheduled_period()
*/
-int alarm_schedule_after_delay(service_h service, int delay, int period, int *alarm_id);
+int alarm_schedule_after_delay(app_control_h app_control, int delay, int period, int *alarm_id);
/**
- * @brief Sets an alarm to be triggered at a specific time.
- * @details
- * The @a date describes the time of first occurrence.
- * If @a period is bigger than 0, the alarm will be scheduled after the @a period time.
- * If @a period is set to 0, the alarm will go off just once without repetition.
- * To cancel the alarm, call alarm_cancel() with alarm id
+ * @brief Sets an alarm to be triggered at a specific time.
+ * @details The @a date describes the time of the first occurrence.
+ * If @a period is bigger than @c 0, the alarm will be scheduled after the @a period time.
+ * If @a period is set to @c 0, the alarm will go off just once without repetition.
+ * To cancel the alarm, call alarm_cancel() with @a alarm_id.
+ * @since_tizen 2.3
+ * @privlevel public
+ * @privilege %http://tizen.org/privilege/alarm.set
+ * @remarks If application is uninstalled after setting an alarm, the alarm is cancelled automatically.
*
- * @remarks If application is uninstalled after setting an alarm, the alarm is canceled automatically.
- *
- * @param[in] service The destination service to perform specific work when the alarm is triggered
+ * @param[in] app_control The destination app_control to perform specific work when the alarm is triggered
* @param[in] date The first active alarm time
* @param[in] period The amount of time between subsequent alarms(in second)
- * @param[out] alarm_id The alarm ID uniquely identifies an alarm
- * @return 0 on success, otherwise a negative error value.
+ * @param[out] alarm_id The alarm ID that uniquely identifies an alarm
+ * @return @c 0 on success,
+ * otherwise a negative error value
* @retval #ALARM_ERROR_NONE Successful
* @retval #ALARM_ERROR_INVALID_PARAMETER Invalid parameter
* @retval #ALARM_ERROR_INVALID_DATE Triggered date is invalid
* @retval #ALARM_ERROR_CONNECTION_FAIL Failed to connect to an alarm server
+ * @retval #ALARM_ERROR_PERMISSION_DENIED Permission denied
* @see alarm_cancel()
* @see alarm_cancel_all()
* @see alarm_get_scheduled_date()
* @see alarm_get_scheduled_period()
*/
-int alarm_schedule_at_date(service_h service, struct tm *date, int period, int *alarm_id);
+int alarm_schedule_at_date(app_control_h app_control, struct tm *date, int period, int *alarm_id);
/**
- * @brief Sets an alarm to be triggered at a specific time with recurrence repeat.
- * @details
- * The @a date describes the time of first occurrence.
- * @a week_flag is the repeat value of days of the week. If @a week_flag is #ALARM_WEEK_FLAG_TUESDAY, the alarm will repeat at every Tuesday specific time.
- * To cancel the alarm, call alarm_cancel() with the @alarm_id
- * @remarks If application is uninstalled after setting an alarm, the alarm is canceled automatically.
+ * @brief Sets an alarm to be triggered periodically, starting at a specific time.
+ * @details The @a date describes the time of the first occurrence.
+ * @a week_flag is the repeat value of the days of the week.
+ * If @a week_flag is #ALARM_WEEK_FLAG_TUESDAY, the alarm will repeat every Tuesday at a specific time.
+ * To cancel the alarm, call alarm_cancel() with @a alarm_id.
+ * @since_tizen 2.3
+ * @privlevel public
+ * @privilege %http://tizen.org/privilege/alarm.set
+ * @remarks If the application is uninstalled after setting an alarm, the alarm is cancelled automatically.
*
- * @param[in] service The destination service to perform specific work when the alarm is triggered.
- * @param[in] date The first active alarm time
- * @param[in] week_flag The day of the week, @a week_flag may be a combination of days, like #ALARM_WEEK_FLAG_TUESDAY | #ALARM_WEEK_FLAG_FRIDAY.
- * @param[out] alarm_id The alarm ID uniquely identifies an alarm
- * @return 0 on success, otherwise a negative error value.
- * @retval #ALARM_ERROR_NONE Successful
- * @retval #ALARM_ERROR_INVALID_PARAMETER Invalid parameter
- * @retval #ALARM_ERROR_INVALID_DATE Triggered date is invalid
- * @retval #ALARM_ERROR_CONNECTION_FAIL Failed to connect to an alarm server
+ * @param[in] app_control The destination app_control to perform specific work when the alarm is triggered
+ * @param[in] date The first active alarm time
+ * @param[in] week_flag The day of the week, @a week_flag may be a combination of days, like #ALARM_WEEK_FLAG_TUESDAY | #ALARM_WEEK_FLAG_FRIDAY
+ * @param[out] alarm_id The alarm ID that uniquely identifies an alarm
+ * @return @c 0 on success,
+ * otherwise a negative error value
+ * @retval #ALARM_ERROR_NONE Successful
+ * @retval #ALARM_ERROR_INVALID_PARAMETER Invalid parameter
+ * @retval #ALARM_ERROR_INVALID_DATE Triggered date is invalid
+ * @retval #ALARM_ERROR_CONNECTION_FAIL Failed to connect to an alarm server
+ * @retval #ALARM_ERROR_PERMISSION_DENIED Permission denied
* @see alarm_cancel()
* @see alarm_cancel_all()
* @see alarm_get_scheduled_recurrence_week_flag()
- * @see alarm_get_scheduled_recurrence_week_flag()
* @see alarm_get_scheduled_date()
* @see #alarm_week_flag_e
*/
-int alarm_schedule_with_recurrence_week_flag(service_h service, struct tm *date, int week_flag,int *alarm_id);
+int alarm_schedule_with_recurrence_week_flag(app_control_h app_control, struct tm *date, int week_flag,int *alarm_id);
/**
* @brief Gets the recurrence days of the week.
- * @remarks If the given @a alarm_id is not obtained by using the alarm_schedule_with_recurrence_week_flag() function,
- * an error (error code #ALARM_ERROR_INVALID_PARAMETER) will occur because this alarm is scheduled with no recurrence.
- * @param[in] alarm_id The alarm ID returned when the alarm is scheduled
- * @param[out] week_flag The recurrence days of the week, @a week_flag may be a combination of days, like #ALARM_WEEK_FLAG_TUESDAY | #ALARM_WEEK_FLAG_FRIDAY.
- * @return 0 on success, otherwise a negative error value.
- * @retval #ALARM_ERROR_NONE Successful
- * @retval #ALARM_ERROR_INVALID_PARAMETER Invalid parameter
+ * @since_tizen 2.3
+ * @privlevel public
+ * @privilege %http://tizen.org/privilege/alarm.get
+ * @remarks If the given @a alarm_id is not obtained by using the alarm_schedule_with_recurrence_week_flag() function,
+ * an error (error code #ALARM_ERROR_INVALID_PARAMETER) will occur because this alarm is scheduled with no recurrence.
+ * @param[in] alarm_id The alarm ID returned when the alarm is scheduled
+ * @param[out] week_flag The recurrence days of the week, @a week_flag may be a combination of days, like #ALARM_WEEK_FLAG_TUESDAY | #ALARM_WEEK_FLAG_FRIDAY
+ * @return @c 0 on success,
+ * otherwise a negative error value
+ * @retval #ALARM_ERROR_NONE Successful
+ * @retval #ALARM_ERROR_INVALID_PARAMETER Invalid parameter
+ * @retval #ALARM_ERROR_PERMISSION_DENIED Permission denied
* @see alarm_schedule_with_recurrence_week_flag()
* @see #alarm_week_flag_e
*/
/**
- * @brief Cancels the alarm with the specific alarm ID.
- * @param[in] alarm_id The alarm ID that will be canceled
- * @return 0 on success, otherwise a negative error value.
- * @retval #ALARM_ERROR_NONE Successful
- * @retval #ALARM_ERROR_CONNECTION_FAIL Failed to connect to an alarm server
+ * @brief Cancels the alarm with the specific alarm ID.
+ * @since_tizen 2.3
+ * @privlevel public
+ * @privilege %http://tizen.org/privilege/alarm.set
+ * @param[in] alarm_id The alarm ID that is cancelled
+ * @return @c 0 on success,
+ * otherwise a negative error value
+ * @retval #ALARM_ERROR_NONE Successful
+ * @retval #ALARM_ERROR_CONNECTION_FAIL Failed to connect to an alarm server
+ * @retval #ALARM_ERROR_PERMISSION_DENIED Permission denied
* @see alarm_schedule_at_date()
* @see alarm_schedule_after_delay()
* @see alarm_schedule_with_recurrence_week_flag()
/**
- * @brief Cancels all alarms scheduled.
- *
- * @return 0 on success, otherwise a negative error value.
+ * @brief Cancels all scheduled alarms that are registered by the application that calls this API.
+ * @since_tizen 2.3
+ * @privlevel public
+ * @privilege %http://tizen.org/privilege/alarm.set
+ * @return @c 0 on success,
+ * otherwise a negative error value
* @retval #ALARM_ERROR_NONE Successful
* @retval #ALARM_ERROR_CONNECTION_FAIL Failed to connect to an alarm server
+ * @retval #ALARM_ERROR_PERMISSION_DENIED Permission denied
* @see alarm_schedule_at_date()
* @see alarm_schedule_after_delay()
* @see alarm_schedule_with_recurrence_week_flag()
/**
- * @brief Retrieves the IDs of all registered alarms by invoking callback once for each scheduled alarm.
- *
- * @param[in] callback The callback function to invoke
- * @param[in] user_data The user data to be passed to the callback function
- * @return 0 on success, otherwise a negative error value.
- * @retval #ALARM_ERROR_NONE Successful
- * @retval #ALARM_ERROR_INVALID_PARAMETER Invalid parameter
- * @retval #ALARM_ERROR_CONNECTION_FAIL Failed to connect to an alarm server
- * @post This function invokes alarm_registered_alarm_cb() repeatedly for each registered alarm.
+ * @brief Retrieves the IDs of all registered alarms by invoking a callback once for each scheduled alarm.
+ * @since_tizen 2.3
+ * @privlevel public
+ * @privilege %http://tizen.org/privilege/alarm.get
+ * @param[in] callback The callback function to invoke
+ * @param[in] user_data The user data to be passed to the callback function
+ * @return @c 0 on success,
+ * otherwise a negative error value
+ * @retval #ALARM_ERROR_NONE Successful
+ * @retval #ALARM_ERROR_INVALID_PARAMETER Invalid parameter
+ * @retval #ALARM_ERROR_CONNECTION_FAIL Failed to connect to an alarm server
+ * @retval #ALARM_ERROR_PERMISSION_DENIED Permission denied
+ * @post This function invokes alarm_registered_alarm_cb() repeatedly for each registered alarm.
* @see alarm_registered_alarm_cb()
*/
int alarm_foreach_registered_alarm(alarm_registered_alarm_cb callback, void *user_data);
/**
- * @brief Gets the scheduled time from the given alarm ID in C standard time struct.
- *
- * @param[in] alarm_id The alarm ID returned when the alarm is scheduled
- * @param[out] date The time value of next alarm event
- * @return 0 on success, otherwise a negative error value.
- * @retval #ALARM_ERROR_NONE Successful
- * @retval #ALARM_ERROR_INVALID_PARAMETER Invalid parameter
- * @retval #ALARM_ERROR_CONNECTION_FAIL Failed to connect to an alarm server
+ * @brief Gets the scheduled time from the given alarm ID in C standard time struct.
+ * @since_tizen 2.3
+ * @privlevel public
+ * @privilege %http://tizen.org/privilege/alarm.get
+ * @param[in] alarm_id The alarm ID returned when the alarm is scheduled
+ * @param[out] date The time value of the next alarm event
+ * @return @c 0 on success,
+ * otherwise a negative error value
+ * @retval #ALARM_ERROR_NONE Successful
+ * @retval #ALARM_ERROR_INVALID_PARAMETER Invalid parameter
+ * @retval #ALARM_ERROR_CONNECTION_FAIL Failed to connect to an alarm server
+ * @retval #ALARM_ERROR_PERMISSION_DENIED Permission denied
* @see alarm_schedule_at_date()
* @see alarm_schedule_after_delay()
* @see alarm_schedule_with_recurrence_week_flag()
/**
- * @brief Gets the period of time between the recurrent alarms.
- * @remarks If the given @a alarm_id is not obtained by using the alarm_get_scheduled_date() or alarm_schedule_after_delay() function,
- * an error (error code #ALARM_ERROR_INVALID_PARAMETER) will occur.
- * @param[in] alarm_id The alarm ID returned when the alarm is scheduled
- * @param[out] period The period of time between recurrent alarms in seconds
- * @return 0 on success, otherwise a negative error value.
- * @retval #ALARM_ERROR_NONE Successful
- * @retval #ALARM_ERROR_INVALID_PARAMETER Invalid parameter
- * @retval #ALARM_ERROR_CONNECTION_FAIL Failed to connect to an alarm server
+ * @brief Gets the period of time between the recurrent alarms.
+ * @since_tizen 2.3
+ * @privlevel public
+ * @privilege %http://tizen.org/privilege/alarm.get
+ * @remarks If the given @a alarm_id is not obtained by using the alarm_get_scheduled_date() or alarm_schedule_after_delay() function,
+ * an error (error code #ALARM_ERROR_INVALID_PARAMETER) will occur.
+ * @param[in] alarm_id The alarm ID returned when the alarm is scheduled
+ * @param[out] period The period of time between recurrent alarms in seconds
+ * @return @c 0 on success,
+ * otherwise a negative error value
+ * @retval #ALARM_ERROR_NONE Successful
+ * @retval #ALARM_ERROR_INVALID_PARAMETER Invalid parameter
+ * @retval #ALARM_ERROR_CONNECTION_FAIL Failed to connect to an alarm server
+ * @retval #ALARM_ERROR_PERMISSION_DENIED Permission denied
* @see alarm_schedule_at_date()
* @see alarm_schedule_after_delay()
* @see alarm_schedule_with_recurrence_week_flag()
/**
- * @brief Gets the current system time using C standard time struct.
- *
+ * @brief Gets the current system time using C standard time struct.
+ * @since_tizen 2.3
* @param[out] date The current system time
- * @return 0 on success, otherwise a negative error value.
- * @retval #ALARM_ERROR_NONE Successful
- * @retval #ALARM_ERROR_INVALID_PARAMETER Invalid parameter
+ * @return @c 0 on success,
+ * otherwise a negative error value
+ * @retval #ALARM_ERROR_NONE Successful
+ * @retval #ALARM_ERROR_INVALID_PARAMETER Invalid parameter
+ * @retval #ALARM_ERROR_PERMISSION_DENIED Permission denied
*/
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.
+ * @brief Gets the app_control to be invoked when the the alarm is triggered.
+ * @since_tizen 2.3
+ * @privlevel public
+ * @privilege %http://tizen.org/privilege/alarm.get
+ * @remarks The @a app_control must be released using app_control_destroy().
+ * @param[in] alarm_id The alarm ID uniquely identifies an alarm
+ * @param[out] app_control The app_control handle to launch when the alarm is triggered
+ * @return @c 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
+ * @retval #ALARM_ERROR_PERMISSION_DENIED Permission denied
* @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);
+int alarm_get_app_control(int alarm_id, app_control_h *app_control);
/**
* @}
--- /dev/null
+/*
+ * Copyright (c) 2014 Samsung Electronics Co., Ltd All Rights Reserved
+ *
+ * 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 __TIZEN_APPFW_APP_COMMON_H__
+#define __TIZEN_APPFW_APP_COMMON_H__
+
+#include <app_types.h>
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/**
+ * @file app_common.h
+ */
+
+/**
+ * @addtogroup CAPI_APP_COMMON_MODULE
+ * @{
+ */
+
+
+/**
+ * @brief Enumeration for system events
+ * @since_tizen 2.3
+ */
+typedef enum
+{
+ APP_EVENT_LOW_MEMORY, /**< The low memory event */
+ APP_EVENT_LOW_BATTERY, /**< The low battery event */
+ APP_EVENT_LANGUAGE_CHANGED, /**< The system language changed event */
+ APP_EVENT_DEVICE_ORIENTATION_CHANGED, /**< The device orientation changed event */
+ APP_EVENT_REGION_FORMAT_CHANGED, /**< The region format changed event */
+} app_event_type_e;
+
+
+/**
+ * @brief Enumeration for device orientation.
+ * @since_tizen 2.3
+ */
+typedef enum
+{
+ APP_DEVICE_ORIENTATION_0 = 0, /**< The device is oriented in a natural position */
+ APP_DEVICE_ORIENTATION_90 = 90, /**< The device's left side is at the top */
+ APP_DEVICE_ORIENTATION_180 = 180, /**< The device is upside down */
+ APP_DEVICE_ORIENTATION_270 = 270, /**< The device's right side is at the top */
+} app_device_orientation_e;
+
+
+/**
+ * @brief Enumeration for low memory status.
+ * @since_tizen 2.3
+ */
+typedef enum
+{
+ APP_EVENT_LOW_MEMORY_NORMAL = 0x01, /**< Normal status */
+ APP_EVENT_LOW_MEMORY_SOFT_WARNING = 0x02, /**< Soft warning status */
+ APP_EVENT_LOW_MEMORY_HARD_WARNING = 0x04, /**< Hard warning status */
+} app_event_low_memory_status_e;
+
+
+/**
+ * @brief Enumeration for battery status.
+ * @since_tizen 2.3
+ */
+typedef enum
+{
+ APP_EVENT_LOW_BATTERY_POWER_OFF = 1, /**< The battery status is under 1% */
+ APP_EVENT_LOW_BATTERY_CRITICAL_LOW, /**< The battery status is under 5% */
+} app_event_low_battery_status_e;
+
+
+/**
+ * @brief The event handler that returned from add event handler function
+ *
+ * @since_tizen 2.3
+ * @see app_event_type_e
+ * @see app_add_event_handler
+ * @see app_remove_event_handler
+ * @see app_event_info_h
+ */
+typedef struct app_event_handler* app_event_handler_h;
+
+
+/**
+ * @brief The system event information
+ *
+ * @since_tizen 2.3
+ * @see app_event_get_low_memory_status
+ * @see app_event_get_low_battery_status
+ * @see app_event_get_language
+ * @see app_event_get_region_format
+ * @see app_event_get_device_orientation
+ */
+typedef struct app_event_info* app_event_info_h;
+
+
+/**
+ * @brief The system event callback function
+ *
+ * @since_tizen 2.3
+ * @param[in] event_info The system event information
+ * @param[in] user_data The user data passed from the add event handler function
+ *
+ * @see app_add_event_handler
+ * @see app_event_info_h
+ */
+typedef void (*app_event_cb)(app_event_info_h event_info, void *user_data);
+
+
+/**
+ * @brief Gets the low memory status from given event info
+ *
+ * @since_tizen 2.3
+ * @param[in] event_info The system event info
+ * @param[out] status The low memory status
+ *
+ * @return 0 on success, otherwise a negative error value
+ * @retval #APP_ERROR_NONE Successful
+ * @retval #APP_ERROR_INVALID_PARAMETER Invalid parameter
+ * @retval #APP_ERROR_INVALID_CONTEXT Invalid event context
+ *
+ * @see app_event_info_h
+ * @see app_event_low_memory_status_e
+ */
+int app_event_get_low_memory_status(app_event_info_h event_info, app_event_low_memory_status_e *status);
+
+
+/**
+ * @brief Gets the low battery status from given event info
+ *
+ * @since_tizen 2.3
+ * @param[in] event_info The system event info
+ * @param[out] status The low battery status
+ *
+ * @return 0 on success, otherwise a negative error value
+ * @retval #APP_ERROR_NONE Successful
+ * @retval #APP_ERROR_INVALID_PARAMETER Invalid parameter
+ * @retval #APP_ERROR_INVALID_CONTEXT Invalid event context
+ *
+ * @see app_event_info_h
+ * @see app_event_low_battery_status_e
+ */
+int app_event_get_low_battery_status(app_event_info_h event_info, app_event_low_battery_status_e *status);
+
+
+/**
+ * @brief Gets the language from given event info
+ *
+ * @since_tizen 2.3
+ * @remarks @a lang must be released using free()
+ * @param[in] event_info The system event info
+ * @param[out] lang The language changed
+ *
+ * @return 0 on success, otherwise a negative error value
+ * @retval #APP_ERROR_NONE Successful
+ * @retval #APP_ERROR_INVALID_PARAMETER Invalid parameter
+ * @retval #APP_ERROR_INVALID_CONTEXT Invalid event context
+ *
+ * @see app_event_info_h
+ */
+int app_event_get_language(app_event_info_h event_info, char **lang);
+
+
+/**
+ * @brief Gets the region format from given event info
+ *
+ * @since_tizen 2.3
+ * @remarks @a region must be released using free()
+ * @param[in] event_info The system event info
+ * @param[out] region The region format changed
+ *
+ * @return 0 on success, otherwise a negative error value
+ * @retval #APP_ERROR_NONE Successful
+ * @retval #APP_ERROR_INVALID_PARAMETER Invalid parameter
+ * @retval #APP_ERROR_INVALID_CONTEXT Invalid event context
+ *
+ * @see app_event_info_h
+ */
+int app_event_get_region_format(app_event_info_h event_info, char **region);
+
+
+/**
+ * @brief Gets the device orientation from given event info
+ *
+ * @since_tizen 2.3
+ * @param[in] event_info The system event info
+ * @param[out] orientation The device orientation changed
+ *
+ * @return 0 on success, otherwise a negative error value
+ * @retval #APP_ERROR_NONE Successful
+ * @retval #APP_ERROR_INVALID_PARAMETER Invalid parameter
+ * @retval #APP_ERROR_INVALID_CONTEXT Invalid event context
+ *
+ * @see app_event_info_h
+ * @see app_device_orientation_e
+ */
+int app_event_get_device_orientation(app_event_info_h event_info, app_device_orientation_e *orientation);
+
+
+/**
+ * @brief Gets the ID of the application.
+ *
+ * @since_tizen 2.3
+ * @remarks @a id must be released using free().
+ *
+ * @param[out] id The ID of the application
+ *
+ * @return @c 0 on success,
+ * otherwise a negative error value
+ *
+ * @retval #APP_ERROR_NONE Successful
+ * @retval #APP_ERROR_INVALID_PARAMETER Invalid parameter
+ * @retval #APP_ERROR_INVALID_CONTEXT The application is illegally launched, not launched by the launch system
+ * @retval #APP_ERROR_OUT_OF_MEMORY Out of memory
+ */
+int app_get_id(char **id);
+
+
+/**
+ * @brief Gets the localized name of the application.
+ *
+ * @since_tizen 2.3
+ * @remarks @a name must be released using free().
+ *
+ * @param[out] name The name of the application
+ *
+ * @return @c 0 on success,
+ * otherwise a negative error value
+ *
+ * @retval #APP_ERROR_NONE Successful
+ * @retval #APP_ERROR_INVALID_PARAMETER Invalid parameter
+ * @retval #APP_ERROR_INVALID_CONTEXT The application is illegally launched, not launched by the launch system
+ * @retval #APP_ERROR_OUT_OF_MEMORY Out of memory
+ */
+int app_get_name(char **name);
+
+
+/**
+ * @brief Gets the version of the application package.
+ *
+ * @since_tizen 2.3
+ * @remarks @a version must be released using free().
+ *
+ * @param[out] version The version of the application
+ *
+ * @return @c 0 on success,
+ * otherwise a negative error value
+ *
+ * @retval #APP_ERROR_NONE Successful
+ * @retval #APP_ERROR_INVALID_PARAMETER Invalid parameter
+ * @retval #APP_ERROR_INVALID_CONTEXT The application is illegally launched, not launched by the launch system
+ * @retval #APP_ERROR_OUT_OF_MEMORY Out of memory
+ */
+int app_get_version(char **version);
+
+
+/**
+ * @brief Gets the absolute path to the application's data directory which is used to store private
+ * data of the application.
+ * @details An application can read and write its own files in the application's data directory.
+ * @since_tizen 2.3
+ * @remarks The returned path should be released.
+ *
+ * @return The absolute path to the application's data directory, @n
+ * otherwise a null pointer if the memory is insufficient
+ */
+char *app_get_data_path(void);
+
+
+/**
+ * @brief Gets the absolute path to the application's cache directory which is used to store
+ * temporary data of the application.
+ * @details An application can read and write its own files in the application's cache directory.
+ * @since_tizen 2.3
+ * @remarks The returned path should be released. @n
+ * The files stored in the application's cache directory can be removed by Setting
+ * application or platform while the application is running.
+ *
+ * @return The absolute path to the application's cache directory, @n
+ * otherwise a null pointer if the memory is insufficient
+ */
+char *app_get_cache_path(void);
+
+
+/**
+ * @brief Gets the absolute path to the application resource directory. The resource files
+ * are delivered with the application package.
+ * @details An application can only read its own files in the application's resource directory.
+ * @since_tizen 2.3
+ * @remarks The returned path should be released.
+ *
+ * @return The absolute path to the application's resource directory, @n
+ * otherwise a null pointer if the memory is insufficient
+ */
+char *app_get_resource_path(void);
+
+
+/**
+ * @brief Gets the absolute path to the application's shared data directory which is used to share
+ * data with other applications.
+ * @details An application can read and write its own files in the application's shared data
+ * directory and others can only read the files.
+ * @since_tizen 2.3
+ * @remarks The returned path should be released.
+ *
+ * @return The absolute path to the application's shared data directory, @n
+ * otherwise a null pointer if the memory is insufficient
+ */
+char *app_get_shared_data_path(void);
+
+
+/**
+ * @brief Gets the absolute path to the application's shared resource directory which is used to
+ * share resources with other applications.
+ * @details An application can read its own files in the application's shared resource directory
+ * and others can only read the files.
+ * @since_tizen 2.3
+ * @remarks The returned path should be released.
+ *
+ * @return The absolute path to the application's shared resource directory, @n
+ * otherwise a null pointer if the memory is insufficient
+ */
+char *app_get_shared_resource_path(void);
+
+
+/**
+ * @brief Gets the absolute path to the application's shared trusted directory which is used to share data
+ * with a family of trusted applications.
+ * @details An application can read and write its own files in the application's shared trusted directory
+ * and the family applications signed with the same certificate can read and write the files in the
+ * shared trusted directory.
+ * @since_tizen 2.3
+ * @remarks The returned path should be released.
+ *
+ * @return The absolute path to the application's shared trusted directory, @n
+ * otherwise a null pointer if the memory is insufficient
+ */
+char *app_get_shared_trusted_path(void);
+
+
+/**
+ * @brief Gets the absolute path to the application's external data directory which is used to
+ * store data of the application.
+ * @details An application can read and write its own files in the application's external data
+ * directory.
+ * @since_tizen 2.3
+ * @remarks The returned path should be released. @n
+ * The important files stored in the application's external data directory should be
+ * encrypted because they can be exported via the external sdcard.
+ *
+ * @return The absolute path to the application's external data directory, @n
+ * otherwise a null pointer if the memory is insufficient
+ */
+char *app_get_external_data_path(void);
+
+
+/**
+ * @brief Gets the absolute path to the application's external cache directory which is used to
+ * store temporary data of the application.
+ * @details An application can read and write its own files in the application's external cache
+ * directory.
+ * @since_tizen 2.3
+ * @remarks The returned path should be released. @n
+ * The files stored in the application's external cache directory can be removed by
+ * Setting application while the application is running. @n
+ * The important files stored in the application's external cache directory should be
+ * encrypted because they can be exported via the external sdcard.
+ *
+ * @return The absolute path to the application's external cache directory, @n
+ * otherwise a null pointer if the memory is insufficient
+ */
+char *app_get_external_cache_path(void);
+
+
+/**
+ * @brief Gets the absolute path to the application's external shared data directory which is
+ * used to share data with other applications.
+ * @details An application can read and write its own files in the application's external shared
+ * data directory and others can only read the files.
+ * @since_tizen 2.3
+ * @remarks The specified @a path should be released.
+ *
+ * @return The absolute path to the application's external shared data directory, @n
+ * otherwise a null pointer if the memory is insufficient
+ */
+char *app_get_external_shared_data_path(void);
+
+/**
+ * @}
+ */
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* __TIZEN_APPFW_APP_H__ */
--- /dev/null
+/*
+ * Copyright (c) 2014 Samsung Electronics Co., Ltd All Rights Reserved
+ *
+ * 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 __TIZEN_APPFW_APP_CONTROL_H__
+#define __TIZEN_APPFW_APP_CONTROL_H__
+
+#include <tizen.h>
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/**
+ * @file app_control.h
+ */
+
+/**
+ * @addtogroup CAPI_APP_CONTROL_MODULE
+ * @{
+ */
+
+
+typedef struct _bundle_t bundle;
+
+
+/**
+ * @brief App Control handle.
+ * @since_tizen 2.3
+ */
+typedef struct app_control_s* app_control_h;
+
+
+/**
+ * @brief Enumeration for App Control Error.
+ * @since_tizen 2.3
+ */
+typedef enum
+{
+ APP_CONTROL_ERROR_NONE = TIZEN_ERROR_NONE, /**< Successful */
+ APP_CONTROL_ERROR_INVALID_PARAMETER = TIZEN_ERROR_INVALID_PARAMETER, /**< Invalid parameter */
+ APP_CONTROL_ERROR_OUT_OF_MEMORY = TIZEN_ERROR_OUT_OF_MEMORY, /**< Out of memory */
+ APP_CONTROL_ERROR_APP_NOT_FOUND = TIZEN_ERROR_APPLICATION | 0x21, /**< The application is not found */
+ APP_CONTROL_ERROR_KEY_NOT_FOUND = TIZEN_ERROR_KEY_NOT_AVAILABLE, /**< Specified key is not found */
+ APP_CONTROL_ERROR_KEY_REJECTED = TIZEN_ERROR_KEY_REJECTED, /**< Key is not available */
+ APP_CONTROL_ERROR_INVALID_DATA_TYPE = TIZEN_ERROR_APPLICATION | 0x22, /**< Invalid data type */
+ APP_CONTROL_ERROR_LAUNCH_REJECTED = TIZEN_ERROR_APPLICATION | 0x23, /**< The application cannot be launched now*/
+ APP_CONTROL_ERROR_PERMISSION_DENIED = TIZEN_ERROR_PERMISSION_DENIED, /**< Permission denied */
+ APP_CONTROL_ERROR_LAUNCH_FAILED = TIZEN_ERROR_APPLICATION | 0x24, /**< Internal launch error */
+ APP_CONTROL_ERROR_TIMED_OUT = TIZEN_ERROR_TIMED_OUT /**< Time out */
+} app_control_error_e;
+
+
+/**
+ * @brief Enumeration for App Control Result.
+ * @since_tizen 2.3
+ */
+typedef enum
+{
+ APP_CONTROL_RESULT_SUCCEEDED = 0, /**< Operation succeeded */
+ APP_CONTROL_RESULT_FAILED = -1, /**< Operation failed by the callee */
+ APP_CONTROL_RESULT_CANCELED = -2, /**< Operation canceled by the framework */
+} app_control_result_e;
+
+
+/**
+ * @brief Definition for the app_control operation: main operation for an explicit launch.
+ * @since_tizen 2.3
+ */
+#define APP_CONTROL_OPERATION_MAIN "http://tizen.org/appcontrol/operation/main"
+
+
+/**
+ * @brief Definition for the app_control operation: default operation for an explicit launch.
+ * @since_tizen 2.3
+ */
+#define APP_CONTROL_OPERATION_DEFAULT "http://tizen.org/appcontrol/operation/default"
+
+
+/**
+ * @brief Definition for the app_control operation: provides an explicit editable access to the given data.
+ * @since_tizen 2.3
+ */
+#define APP_CONTROL_OPERATION_EDIT "http://tizen.org/appcontrol/operation/edit"
+
+
+/**
+ * @brief Definition for the app_control operation: displays the data.
+ * @since_tizen 2.3
+ */
+#define APP_CONTROL_OPERATION_VIEW "http://tizen.org/appcontrol/operation/view"
+
+
+/**
+ * @brief Definition for the app_control operation: picks an item from the data, returning what is selected.
+ * @since_tizen 2.3
+ */
+#define APP_CONTROL_OPERATION_PICK "http://tizen.org/appcontrol/operation/pick"
+
+
+/**
+ * @brief Definition for the app_control operation: creates content, returning what is created.
+ * @since_tizen 2.3
+ */
+#define APP_CONTROL_OPERATION_CREATE_CONTENT "http://tizen.org/appcontrol/operation/create_content"
+
+
+/**
+ * @brief Definition for the app_control operation: performs a call to someone specified by the data.
+ * @since_tizen 2.3
+ * @privlevel public
+ * @privilege %http://tizen.org/privilege/call
+ * @remarks When you request this operation, you must declare this privilege.
+ */
+#define APP_CONTROL_OPERATION_CALL "http://tizen.org/appcontrol/operation/call"
+
+
+/**
+ * @brief Definition for the app_control operation: delivers some data to someone else.
+ * @since_tizen 2.3
+ */
+#define APP_CONTROL_OPERATION_SEND "http://tizen.org/appcontrol/operation/send"
+
+
+/**
+ * @brief Definition for the app_control operation: delivers text data to someone else.
+ * @since_tizen 2.3
+ */
+#define APP_CONTROL_OPERATION_SEND_TEXT "http://tizen.org/appcontrol/operation/send_text"
+
+
+/**
+ * @brief Definition for the app_control operation: shares an item with someone else.
+ * @since_tizen 2.3
+ */
+#define APP_CONTROL_OPERATION_SHARE "http://tizen.org/appcontrol/operation/share"
+
+
+/**
+ * @brief Definition for the app_control operation: shares multiple items with someone else.
+ * @since_tizen 2.3
+ */
+#define APP_CONTROL_OPERATION_MULTI_SHARE "http://tizen.org/appcontrol/operation/multi_share"
+
+
+/**
+ * @brief Definition for the app_control operation: shares text data with someone else.
+ * @since_tizen 2.3
+ */
+#define APP_CONTROL_OPERATION_SHARE_TEXT "http://tizen.org/appcontrol/operation/share_text"
+
+
+/**
+ * @brief Definition for the app_control operation: dials a number as specified by the data.
+ * @since_tizen 2.3
+ */
+#define APP_CONTROL_OPERATION_DIAL "http://tizen.org/appcontrol/operation/dial"
+
+
+/**
+ * @brief Definition for the app_control operation: performs a search.
+ * @since_tizen 2.3
+ */
+#define APP_CONTROL_OPERATION_SEARCH "http://tizen.org/appcontrol/operation/search"
+
+
+/**
+ * @brief Definition for the app_control operation: downloads an item.
+ * @since_tizen 2.3
+ */
+#define APP_CONTROL_OPERATION_DOWNLOAD "http://tizen.org/appcontrol/operation/download"
+
+
+/**
+ * @brief Definition for the app_control operation: prints content.
+ * @since_tizen 2.3
+ */
+#define APP_CONTROL_OPERATION_PRINT "http://tizen.org/appcontrol/operation/print"
+
+/**
+ * @brief Definition for the app_control operation: composes.
+ * @since_tizen 2.3
+ */
+#define APP_CONTROL_OPERATION_COMPOSE "http://tizen.org/appcontrol/operation/compose"
+
+/**
+ * @brief Definition for app_control optional data: the subject of a message.
+ * @since_tizen 2.3
+ */
+#define APP_CONTROL_DATA_SUBJECT "http://tizen.org/appcontrol/data/subject"
+
+
+/**
+ * @brief Definition for app_control optional data: e-mail addresses.
+ * @since_tizen 2.3
+ */
+#define APP_CONTROL_DATA_TO "http://tizen.org/appcontrol/data/to"
+
+
+/**
+ * @brief Definition for app_control optional data: e-mail addresses that should be carbon copied.
+ * @since_tizen 2.3
+ */
+#define APP_CONTROL_DATA_CC "http://tizen.org/appcontrol/data/cc"
+
+
+/**
+ * @brief Definition for app_control optional data: e-mail addresses that should be blind carbon copied.
+ * @since_tizen 2.3
+ */
+#define APP_CONTROL_DATA_BCC "http://tizen.org/appcontrol/data/bcc"
+
+
+/**
+ * @brief Definition for app_control optional data: the content of the data is associated with #APP_CONTROL_OPERATION_SEND.
+ * @since_tizen 2.3
+ */
+#define APP_CONTROL_DATA_TEXT "http://tizen.org/appcontrol/data/text"
+
+
+/**
+ * @brief Definition for app_control optional data: the title of the data.
+ * @since_tizen 2.3
+ */
+#define APP_CONTROL_DATA_TITLE "http://tizen.org/appcontrol/data/title"
+
+
+/**
+ * @brief Definition for app_control optional data: the path of a selected item.
+ * @since_tizen 2.3
+ */
+#define APP_CONTROL_DATA_SELECTED "http://tizen.org/appcontrol/data/selected"
+
+
+/**
+ * @brief Definition for app_control optional data: multiple item path to deliver.
+ * @since_tizen 2.3
+ */
+#define APP_CONTROL_DATA_PATH "http://tizen.org/appcontrol/data/path"
+
+
+/**
+ * @brief Definition for app_control optional data: the selection type.
+ * @since_tizen 2.3
+ */
+#define APP_CONTROL_DATA_SELECTION_MODE "http://tizen.org/appcontrol/data/selection_mode"
+
+
+/**
+ * @brief Called when the reply of the launch request is delivered.
+ *
+ * @since_tizen 2.3
+ *
+ * @remarks The @a request and @a reply must not be deallocated by the application.
+ *
+ * @param[in] request The app_control handle of the launch request that has been sent
+ * @param[in] reply The app_control handle in which the results of the callee are contained
+ * @param[in] result The result code of the launch request
+ * @param[in] user_data The user data passed from the callback registration function
+ * @pre When the callee replies to the launch request, this callback will be invoked.
+ * @see app_control_send_launch_request()
+ * @see app_control_reply_to_launch_request()
+ */
+typedef void (*app_control_reply_cb) (app_control_h request, app_control_h reply, app_control_result_e result, void *user_data);
+
+
+/**
+ * @brief Called to retrieve the extra data contained in the app_control.
+ *
+ * @since_tizen 2.3
+ *
+ * @remarks The @a key must not be deallocated by the application.
+ *
+ * @param[in] app_control The app_control handle
+ * @param[in] key The key of the value contained in the app_control
+ * @param[in] user_data The user data passed from the foreach function
+ * @return @c true to continue with the next iteration of the loop,
+ * otherwise @c false to break out of the loop
+ * @pre app_control_foreach_extra_data() will invoke this callback.
+ * @see app_control_foreach_extra_data()
+ */
+typedef bool (*app_control_extra_data_cb)(app_control_h app_control, const char *key, void *user_data);
+
+
+/**
+ * @brief Called once for each matched application that can be launched to handle the given app_control request.
+ *
+ * @since_tizen 2.3
+ * @param[in] app_control The app_control handle
+ * @param[in] package The package name of the application that can handle the launch request of the given app_control
+ * @param[in] user_data The user data passed from the foreach function
+ * @return @c true to continue with the next iteration of the loop,
+ * otherwise @c false to break out of the loop
+ * @pre app_control_foreach_app_matched() will invoke this callback.
+ * @see app_control_foreach_app_matched()
+ */
+typedef bool (*app_control_app_matched_cb)(app_control_h app_control, const char *appid, void *user_data);
+
+
+typedef int (*app_control_host_res_fn)(void *data);
+
+/**
+ * @brief Creates an app_control handle.
+ *
+ * @since_tizen 2.3
+ * @remarks The @a app_control must be released using app_control_destroy().
+ * @param[out] app_control The app_control handle to be newly created on success
+ * @return @c 0 on success,
+ * otherwise a negative error value
+ * @retval #APP_CONTROL_ERROR_NONE Successful
+ * @retval #APP_CONTROL_ERROR_INVALID_PARAMETER Invalid parameter
+ * @retval #APP_CONTROL_ERROR_OUT_OF_MEMORY Out of memory
+ * @see app_control_destroy()
+ */
+int app_control_create(app_control_h *app_control);
+
+
+/**
+ * @brief Destroys the app_control handle and releases all its resources.
+ *
+ * @since_tizen 2.3
+ * @param[in] app_control The app_control handle
+ * @return @c 0 on success,
+ * otherwise a negative error value
+ * @retval #APP_CONTROL_ERROR_NONE Successful
+ * @retval #APP_CONTROL_ERROR_INVALID_PARAMETER Invalid parameter
+ * @retval #APP_CONTROL_ERROR_OUT_OF_MEMORY Out of memory
+ * @see app_control_create()
+ */
+int app_control_destroy(app_control_h app_control);
+
+
+/**
+ * @internal
+ * @brief Converts the app_control handle to bundle data.
+ *
+ * @since_tizen 2.3
+ * @param[in] app_control The app_control handle
+ * @param[out] data The bundle data on success
+ * @return @c 0 on success,
+ * otherwise a negative error value
+ * @retval #APP_CONTROL_ERROR_NONE Successful
+ * @retval #APP_CONTROL_ERROR_INVALID_PARAMETER Invalid parameter
+ */
+int app_control_to_bundle(app_control_h app_control, bundle **data);
+
+/**
+ * @brief Sets the operation to be performed.
+ *
+ * @details The @a operation is the mandatory information for the launch request.
+ * If the operation is not specified, #APP_CONTROL_OPERATION_DEFAULT is used for the launch request.
+ * If the operation is #APP_CONTROL_OPERATION_DEFAULT, the package information is mandatory to explicitly launch the application.
+ * @since_tizen 2.3
+ * @param[in] app_control The app_control handle
+ * @param[in] operation The operation to be performed (if the @a operation is @c NULL, it clears the previous value)
+ * @return @c 0 on success,
+ * otherwise a negative error value
+ * @retval #APP_CONTROL_ERROR_NONE Successful
+ * @retval #APP_CONTROL_ERROR_INVALID_PARAMETER Invalid parameter
+ * @see app_control_get_operation()
+ * @see APP_CONTROL_OPERATION_DEFAULT
+ * @see APP_CONTROL_OPERATION_EDIT
+ * @see APP_CONTROL_OPERATION_VIEW
+ * @see APP_CONTROL_OPERATION_PICK
+ * @see APP_CONTROL_OPERATION_CREATE_CONTENT
+ * @see APP_CONTROL_OPERATION_CALL
+ * @see APP_CONTROL_OPERATION_SEND
+ * @see APP_CONTROL_OPERATION_SEND_TEXT
+ * @see APP_CONTROL_OPERATION_DIAL
+ * @see APP_CONTROL_OPERATION_SEARCH
+ */
+int app_control_set_operation(app_control_h app_control, const char *operation);
+
+
+/**
+ * @brief Gets the operation to be performed.
+ *
+ * @since_tizen 2.3
+ * @remarks The @a operation must be released using free().
+ * @param[in] app_control The app_control handle
+ * @param[out] operation The operation to be performed
+ * @return @c 0 on success,
+ * otherwise a negative error value
+ * @retval #APP_CONTROL_ERROR_NONE Successful
+ * @retval #APP_CONTROL_ERROR_INVALID_PARAMETER Invalid parameter
+ * @retval #APP_CONTROL_ERROR_OUT_OF_MEMORY Out of memory
+ * @see app_control_set_operation()
+ */
+int app_control_get_operation(app_control_h app_control, char **operation);
+
+
+/**
+ * @brief Sets the URI of the data.
+ *
+ * @since_tizen 2.3
+ * @param[in] app_control The app_control handle
+ * @param[in] uri The URI of the data this app_control is operating on (if the @a uri is @c NULL, it clears the previous value)
+ * @return @c 0 on success,
+ * otherwise a negative error value
+ * @retval #APP_CONTROL_ERROR_NONE Successful
+ * @retval #APP_CONTROL_ERROR_INVALID_PARAMETER Invalid parameter
+ * @see app_control_get_uri()
+ */
+int app_control_set_uri(app_control_h app_control, const char *uri);
+
+
+/**
+ * @brief Gets the URI of the data.
+ *
+ * @since_tizen 2.3
+ * @remarks The @a uri must be released using free().
+ * @param[in] app_control The app_control handle
+ * @param[out] uri The URI of the data this app_control is operating on
+ * @return @c 0 on success,
+ * otherwise a negative error value
+ * @retval #APP_CONTROL_ERROR_NONE Successful
+ * @retval #APP_CONTROL_ERROR_INVALID_PARAMETER Invalid parameter
+ * @retval #APP_CONTROL_ERROR_OUT_OF_MEMORY Out of memory
+ * @see app_control_set_uri()
+ */
+int app_control_get_uri(app_control_h app_control, char **uri);
+
+
+/**
+ * @brief Sets the explicit MIME type of the data.
+ *
+ * @since_tizen 2.3
+ * @param[in] app_control The app_control handle
+ * @param[in] mime The explicit MIME type of the data this app_control is operating on (if the @a mime is @c NULL, it clears the previous value)
+ * @return @c 0 on success,
+ * otherwise a negative error value
+ * @retval #APP_CONTROL_ERROR_NONE Successful
+ * @retval #APP_CONTROL_ERROR_INVALID_PARAMETER Invalid parameter
+ * @see app_control_get_mime()
+ */
+int app_control_set_mime(app_control_h app_control, const char *mime);
+
+
+/**
+ * @brief Gets the explicit MIME type of the data.
+ *
+ * @since_tizen 2.3
+ * @remarks The @a uri must be released using free().
+ * @param[in] app_control The app_control handle
+ * @param[out] mime The explicit MIME type of the data this app_control is operating on
+ * @return @c 0 on success,
+ * otherwise a negative error value
+ * @retval #APP_CONTROL_ERROR_NONE Successful
+ * @retval #APP_CONTROL_ERROR_INVALID_PARAMETER Invalid parameter
+ * @retval #APP_CONTROL_ERROR_OUT_OF_MEMORY Out of memory
+ * @see app_control_set_mime()
+ */
+int app_control_get_mime(app_control_h app_control, char **mime);
+
+
+/**
+ * @brief Sets the explicit category.
+ *
+ * @since_tizen 2.3
+ * @param[in] app_control The app_control handle
+ * @param[in] category The explicit category (if the @a category is @c NULL, it clears the previous value)
+ * @return @c 0 on success,
+ * otherwise a negative error value
+ * @retval #APP_CONTROL_ERROR_NONE Successful
+ * @retval #APP_CONTROL_ERROR_INVALID_PARAMETER Invalid parameter
+ * @see app_control_get_category()
+ */
+int app_control_set_category(app_control_h app_control, const char *category);
+
+
+/**
+ * @brief Gets the explicit category.
+ *
+ * @since_tizen 2.3
+ * @remarks The @a category must be released using free().
+ * @param[in] app_control The app_control handle
+ * @param[out] category The explicit category
+ * @return @c 0 on success,
+ * otherwise a negative error value
+ * @retval #APP_CONTROL_ERROR_NONE Successful
+ * @retval #APP_CONTROL_ERROR_INVALID_PARAMETER Invalid parameter
+ * @retval #APP_CONTROL_ERROR_OUT_OF_MEMORY Out of memory
+ * @see app_control_set_category()
+ */
+int app_control_get_category(app_control_h app_control, char **category);
+
+
+/**
+ * @brief Sets the ID of the application to explicitly launch.
+ *
+ * @since_tizen 2.3
+ * @param[in] app_control The app_control handle
+ * @param[in] app_id The ID of the application to explicitly launch (if the @a app_id is @c NULL, it clears the previous value)
+ * @return @c 0 on success,
+ * otherwise a negative error value
+ * @retval #APP_CONTROL_ERROR_NONE Successful
+ * @retval #APP_CONTROL_ERROR_INVALID_PARAMETER Invalid parameter
+ * @retval #APP_CONTROL_ERROR_OUT_OF_MEMORY Out of memory
+ * @see app_control_get_app_id()
+ */
+int app_control_set_app_id(app_control_h app_control, const char *app_id);
+
+
+/**
+ * @brief Gets the ID of the application to explicitly launch.
+ *
+ * @since_tizen 2.3
+ * @remarks The @a app_id must be released with free().
+ * @param[in] app_control The app_control handle
+ * @param[out] app_id The ID of the application to explicitly launch
+ * @return @c 0 on success,
+ * otherwise a negative error value
+ * @retval #APP_CONTROL_ERROR_NONE Successful
+ * @retval #APP_CONTROL_ERROR_INVALID_PARAMETER Invalid parameter
+ * @retval #APP_CONTROL_ERROR_OUT_OF_MEMORY Out of memory
+ * @see app_control_set_app_id()
+ */
+int app_control_get_app_id(app_control_h app_control, char **app_id);
+
+/**
+ * @internal
+ * @brief Sets the window ID of the application.
+ *
+ * @since_tizen 2.3
+ * @param[in] app_control The app_control handle
+ * @param[in] id The window ID of the caller application (if the @a id is not positive, it clears the previous value)
+ * @return @c 0 on success,
+ * otherwise a negative error value
+ * @retval #APP_CONTROL_ERROR_NONE Successful
+ * @retval #APP_CONTROL_ERROR_INVALID_PARAMETER Invalid parameter
+ * @retval #APP_CONTROL_ERROR_OUT_OF_MEMORY Out of memory
+ * @see app_control_get_window()
+ */
+int app_control_set_window(app_control_h app_control, unsigned int id);
+
+
+/**
+ * @internal
+ * @brief Gets the window ID of the application.
+ *
+ * @since_tizen 2.3
+ * @param[in] app_control The app_control handle
+ * @param[out] id The window ID of the caller application
+ * @return @c 0 on success,
+ * otherwise a negative error value
+ * @retval #APP_CONTROL_ERROR_NONE Successful
+ * @retval #APP_CONTROL_ERROR_INVALID_PARAMETER Invalid parameter
+ * @retval #APP_CONTROL_ERROR_OUT_OF_MEMORY Out of memory
+ * @see app_control_set_app_id()
+*/
+int app_control_get_window(app_control_h app_control, unsigned int *id);
+
+
+/**
+ * @brief Adds extra data to the app_control.
+ *
+ * @since_tizen 2.3
+ * @remarks The function replaces any existing value for the given key.
+ * @remarks The function returns #APP_CONTROL_ERROR_INVALID_PARAMETER if @a key or @a value is a zero-length string.
+ * @remarks The function returns #APP_CONTROL_ERROR_KEY_REJECTED if the application tries to use the same key with system-defined key.
+ * @param[in] app_control The app_control handle
+ * @param[in] key The name of the extra data
+ * @param[in] value The value associated with the given key
+ * @return @c 0 on success,
+ * otherwise a negative error value
+ * @retval #APP_CONTROL_ERROR_NONE Successful
+ * @retval #APP_CONTROL_ERROR_INVALID_PARAMETER Invalid parameter
+ * @retval #APP_CONTROL_ERROR_KEY_REJECTED Key not available
+ * @see app_control_add_extra_data_array()
+ * @see app_control_remove_extra_data()
+ * @see app_control_get_extra_data()
+ */
+int app_control_add_extra_data(app_control_h app_control, const char *key, const char *value);
+
+
+/**
+ * @brief Adds the extra data array to the app_control.
+ *
+ * @since_tizen 2.3
+ * @remarks The function replaces any existing value for the given key.
+ * @remarks The function returns #APP_CONTROL_ERROR_INVALID_PARAMETER if @a key is a zero-length string.
+ * @remarks The function returns #APP_CONTROL_ERROR_KEY_REJECTED if the application tries to use the same key with system-defined key.
+ * @param[in] app_control The app_control handle
+ * @param[in] key The name of the extra data
+ * @param[in] value The array value associated with the given key
+ * @param[in] length The length of the array
+ * @return @c 0 on success,
+ * otherwise a negative error value
+ * @retval #APP_CONTROL_ERROR_NONE Successful
+ * @retval #APP_CONTROL_ERROR_INVALID_PARAMETER Invalid parameter
+ * @retval #APP_CONTROL_ERROR_KEY_REJECTED Key not available
+ * @see app_control_add_extra_data()
+ * @see app_control_remove_extra_data()
+ * @see app_control_get_extra_data()
+ */
+int app_control_add_extra_data_array(app_control_h app_control, const char *key, const char* value[], int length);
+
+
+/**
+ * @brief Removes the extra data from the app_control.
+ *
+ * @since_tizen 2.3
+ * @param[in] app_control The app_control handle
+ * @param[in] key The name of the extra data
+ * @return @c 0 on success,
+ * otherwise a negative error value
+ * @retval #APP_CONTROL_ERROR_NONE Successful
+ * @retval #APP_CONTROL_ERROR_INVALID_PARAMETER Invalid parameter
+ * @retval #APP_CONTROL_ERROR_KEY_NOT_FOUND Specified key not found
+ * @see app_control_add_extra_data()
+ * @see app_control_add_extra_data_array()
+ * @see app_control_get_extra_data()
+ */
+int app_control_remove_extra_data(app_control_h app_control, const char *key);
+
+
+/**
+ * @brief Gets the extra data from the app_control.
+ *
+ * @since_tizen 2.3
+ * @remarks The @a value must be released using free().
+ * @remarks The function returns #APP_CONTROL_ERROR_INVALID_DATA_TYPE if @a value is of array data type.
+ * @param[in] app_control The app_control handle
+ * @param[in] key The name of the extra data
+ * @param[out] value The value associated with the given key
+ * @return @c 0 on success,
+ * otherwise a negative error value
+ * @retval #APP_CONTROL_ERROR_NONE Successful
+ * @retval #APP_CONTROL_ERROR_INVALID_PARAMETER Invalid parameter
+ * @retval #APP_CONTROL_ERROR_KEY_NOT_FOUND Specified key not found
+ * @retval #APP_CONTROL_ERROR_OUT_OF_MEMORY Out of memory
+ * @retval #APP_CONTROL_ERROR_INVALID_DATA_TYPE Invalid data type
+ * @see app_control_add_extra_data()
+ * @see app_control_add_extra_data_array()
+ * @see app_control_get_extra_data()
+ * @see app_control_remove_extra_data()
+ * @see app_control_foreach_extra_data()
+ */
+int app_control_get_extra_data(app_control_h app_control, const char *key, char **value);
+
+
+/**
+ * @brief Gets the extra data array from the app_control.
+ *
+ * @since_tizen 2.3
+ * @remarks The @a value must be released using free().
+ * @remarks The function returns #APP_CONTROL_ERROR_INVALID_DATA_TYPE if @a value is not of array data type.
+ * @param[in] app_control The app_control handle
+ * @param[in] key The name of the extra data
+ * @param[out] value The array value associated with the given key
+ * @param[out] length The length of the array
+ * @return @c 0 on success,
+ * otherwise a negative error value
+ * @retval #APP_CONTROL_ERROR_NONE Successful
+ * @retval #APP_CONTROL_ERROR_INVALID_PARAMETER Invalid parameter
+ * @retval #APP_CONTROL_ERROR_KEY_NOT_FOUND Specified key not found
+ * @retval #APP_CONTROL_ERROR_OUT_OF_MEMORY Out of memory
+ * @retval #APP_CONTROL_ERROR_INVALID_DATA_TYPE Invalid data type
+ * @see app_control_add_extra_data()
+ * @see app_control_add_extra_data_array()
+ * @see app_control_remove_extra_data()
+ * @see app_control_foreach_extra_data()
+ */
+int app_control_get_extra_data_array(app_control_h app_control, const char *key, char ***value, int *length);
+
+
+/**
+ * @brief Checks whether the extra data associated with the given @a key is of array data type.
+ *
+ * @since_tizen 2.3
+ * @param[in] app_control The app_control handle
+ * @param[in] key The name of the extra data
+ * @param[out] array If @c true the extra data is of array data type,
+ * otherwise @c false
+ * @return @c 0 on success,
+ * otherwise a negative error value
+ * @retval #APP_CONTROL_ERROR_NONE Successful
+ * @retval #APP_CONTROL_ERROR_INVALID_PARAMETER Invalid parameter
+ * @see app_control_add_extra_data()
+ * @see app_control_add_extra_data_array()
+ * @see app_control_remove_extra_data()
+ * @see app_control_foreach_extra_data()
+ */
+int app_control_is_extra_data_array(app_control_h app_control, const char *key, bool *array);
+
+
+/**
+ * @brief Retrieves all extra data contained in app_control.
+ * @details This function calls app_control_extra_data_cb() once for each key-value pair for extra data contained in app_control. \n
+ * If the app_control_extra_data_cb() callback function returns @c false, then iteration will be finished.
+ *
+ * @since_tizen 2.3
+ * @param[in] app_control The app_control handle
+ * @param[in] callback The iteration callback function
+ * @param[in] user_data The user data to be passed to the callback function
+ * @return @c 0 on success,
+ * otherwise a negative error value
+ * @retval #APP_CONTROL_ERROR_NONE Successful
+ * @retval #APP_CONTROL_ERROR_INVALID_PARAMETER Invalid parameter
+ * @post This function invokes app_control_extra_data_cb().
+ * @see app_control_extra_data_cb()
+ */
+int app_control_foreach_extra_data(app_control_h app_control, app_control_extra_data_cb callback, void *user_data);
+
+
+/**
+ * @brief Retrieves all applications that can be launched to handle the given app_control request.
+ *
+ * @since_tizen 2.3
+ * @param[in] app_control The app_control handle
+ * @param[in] callback The iteration callback function
+ * @param[in] user_data The user data to be passed to the callback function
+ * @return @c 0 on success,
+ * otherwise a negative error value
+ * @retval #APP_CONTROL_ERROR_NONE Success
+ * @retval #APP_CONTROL_ERROR_INVALID_PARAMETER Invalid parameter
+ * @post This function invokes app_control_app_matched_cb().
+ * @see app_control_app_matched_cb()
+ */
+int app_control_foreach_app_matched(app_control_h app_control, app_control_app_matched_cb callback, void *user_data);
+
+
+/**
+ * @brief Sends the launch request.
+ *
+ * @details The operation is mandatory information for the launch request. \n
+ * If the operation is not specified, #APP_CONTROL_OPERATION_DEFAULT is used by default.
+ * If the operation is #APP_CONTROL_OPERATION_DEFAULT, the application ID is mandatory to explicitly launch the application.
+ * @since_tizen 2.3
+ * @privlevel public
+ * @privilege %http://tizen.org/privilege/appmanager.launch
+ * @param[in] app_control The app_control handle
+ * @param[in] callback The callback function to be called when the reply is delivered
+ * @param[in] user_data The user data to be passed to the callback function
+ * @return @c 0 on success,
+ * otherwise a negative error value
+ * @retval #APP_CONTROL_ERROR_NONE Successful
+ * @retval #APP_CONTROL_ERROR_INVALID_PARAMETER Invalid parameter
+ * @retval #APP_CONTROL_ERROR_OUT_OF_MEMORY Out of memory
+ * @retval #APP_CONTROL_ERROR_APP_NOT_FOUND The application to run the given launch request is not found
+ * @retval #APP_CONTROL_ERROR_LAUNCH_REJECTED The application cannot be launched in current context
+ * @retval #APP_CONTROL_ERROR_LAUNCH_FAILED Failed to launch the application
+ * @retval #APP_CONTROL_ERROR_TIMED_OUT Failed due to timeout. The application that handles @a app_control may be busy
+ * @retval #APP_CONTROL_ERROR_PERMISSION_DENIED Permission denied
+ * @post If the launch request is sent for the result, the result will come back through app_control_reply_cb() from the callee application.
+ * @see app_control_reply_to_launch_request()
+ * @see app_control_reply_cb()
+ */
+int app_control_send_launch_request(app_control_h app_control, app_control_reply_cb callback, void *user_data);
+
+
+/**
+ * @brief Sends the terminate request to the application that is launched by app_control. This API is only effective for some applications that are provided by default for handling platform default app_controls. You are not allowed to terminate other general applications using this API.
+ *
+ * @since_tizen 2.3
+ * @param[in] app_control The app_control handle
+ * @return @c 0 on success,
+ * otherwise a negative error value
+ * @retval #APP_CONTROL_ERROR_NONE Successful
+ * @retval #APP_CONTROL_ERROR_INVALID_PARAMETER Invalid parameter
+ * @retval #APP_CONTROL_ERROR_PERMISSION_DENIED Permission denied
+ * @see app_control_send_launch_request()
+ */
+int app_control_send_terminate_request(app_control_h app_control);
+
+
+/**
+ * @brief Replies to the launch request sent by the caller.
+ * @details If the caller application sent the launch request to receive the result, the callee application can return the result back to the caller.
+ *
+ * @since_tizen 2.3
+ * @param[in] reply The app_control handle in which the results of the callee are contained
+ * @param[in] request The app_control handle sent by the caller
+ * @param[in] result The result code of the launch request
+ * @return @c 0 on success,
+ * otherwise a negative error value
+ * @retval #APP_CONTROL_ERROR_NONE Successful
+ * @retval #APP_CONTROL_ERROR_INVALID_PARAMETER Invalid parameter
+ * @retval #APP_CONTROL_ERROR_OUT_OF_MEMORY Out of memory
+ * @see app_control_send_launch_request()
+ */
+int app_control_reply_to_launch_request(app_control_h reply, app_control_h request, app_control_result_e result);
+
+
+/**
+ * @brief Creates and returns a copy of the given app_control handle.
+ *
+ * @since_tizen 2.3
+ * @remarks A newly created app_control should be destroyed by calling app_control_destroy() if it is no longer needed.
+ *
+ * @param[out] clone If successful, a newly created app_control handle will be returned
+ * @param[in] app_control The app_control handle
+ * @return @c 0 on success,
+ * otherwise a negative error value
+ * @retval #APP_CONTROL_ERROR_NONE Successful
+ * @retval #APP_CONTROL_ERROR_INVALID_PARAMETER Invalid parameter
+ * @retval #APP_CONTROL_ERROR_OUT_OF_MEMORY Out of memory
+ * @see app_control_destroy()
+ */
+int app_control_clone(app_control_h *clone, app_control_h app_control);
+
+
+/**
+ * @brief Gets the application ID of the caller from the launch request.
+ *
+ * @since_tizen 2.3
+ * @remarks The @a app_control must be the launch request from app_control_cb().
+ * @remarks This function returns #APP_CONTROL_ERROR_INVALID_PARAMETER if the given app_control is not the launch request.
+ * @remarks The @a id must be released using free().
+ * @param[in] app_control The app_control handle from app_control_cb()
+ * @param[out] id The application ID of the caller
+ * @return @a 0 on success,
+ * otherwise a negative error value
+ * @retval #APP_CONTROL_ERROR_NONE Successful
+ * @retval #APP_CONTROL_ERROR_INVALID_PARAMETER Invalid parameter
+ * @retval #APP_CONTROL_ERROR_OUT_OF_MEMORY Out of memory
+ */
+int app_control_get_caller(app_control_h app_control, char **id);
+
+
+/**
+ * @brief Checks whether the caller is requesting a reply from the launch request.
+ *
+ * @since_tizen 2.3
+ * @remarks The @a app_control must be the launch request from app_control_cb().
+ * @remarks This function returns #APP_CONTROL_ERROR_INVALID_PARAMETER if the given app_control is not the launch request.
+ * @param[in] app_control The app_control handle from app_control_cb()
+ * @param[out] requested If @c true a reply is requested by the caller,
+ * otherwise @c false
+ * @return @c 0 on success,
+ * otherwise a negative error value
+ * @retval #APP_CONTROL_ERROR_NONE Successful
+ * @retval #APP_CONTROL_ERROR_INVALID_PARAMETER Invalid parameter
+ * @retval #APP_CONTROL_ERROR_OUT_OF_MEMORY Out of memory
+ */
+int app_control_is_reply_requested(app_control_h app_control, bool *requested);
+
+/**
+ * @internal
+ * @brief Requests the specified callee window to be transient for the caller window.
+ *
+ * @since_tizen 2.3
+ * @remarks The @a callee_id window is transient for the top-level caller window and should be handled accordingly.
+ * @param[in] app_control The app_control handle
+ * @param[in] callee_id The callee window ID
+ * @param[in] cbfunc The callback function to be called when the transient is requested
+ * @param[in] data A data pointer to pass to the callback function
+ * @return @c 0 on success,
+ * otherwise a negative error value.
+ * @retval #APP_CONTROL_ERROR_NONE Successful
+ * @retval #APP_CONTROL_ERROR_INVALID_PARAMETER Invalid parameter
+ */
+int app_control_request_transient_app(app_control_h app_control, unsigned int callee_id, app_control_host_res_fn cbfunc, void *data);
+
+/**
+ * @}
+ */
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* __TIZEN_APPFW_APP_CONTROL_H__ */
--- /dev/null
+/*
+ * Copyright (c) 2014 Samsung Electronics Co., Ltd All Rights Reserved
+ *
+ * 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 __TIZEN_APPFW_APP_CONTROL_INTERNAL_H__
+#define __TIZEN_APPFW_APP_CONTROL_INTERNAL_H__
+
+#include <bundle.h>
+
+#include <app_control.h>
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/**
+ * @file app_control_internal.h
+ */
+
+/**
+ * @addtogroup CAPI_APP_CONTROL_MODULE
+ * @{
+ */
+
+/**
+ * @brief Replaces all data in the app_control with the bundle
+ *
+ * @remarks This function clears all data in the app_control and adds all key-value pairs in the bundle into the app_control
+ * @param [in] app_control The app_control handle
+ * @param [in] data The bundle handle
+ * @return 0 on success, otherwise a negative error value.
+ * @retval #APP_CONTROL_ERROR_NONE Successful
+ * @retval #APP_CONTROL_ERROR_INVALID_PARAMETER Invalid parameter
+ * @see app_control_export_as_bundle()
+ * @code
+ *
+ * #include <bundle.h>
+ * #include <app_control.h>
+ *
+ * app_control_h app_control = NULL;
+ * app_control_create(&app_control);
+ * app_control_import_from_bundle(app_control, b);
+ *
+ * @endcode
+ *
+ */
+int app_control_import_from_bundle(app_control_h app_control, bundle *data);
+
+/**
+ * @brief Returns a new bundle containing all data contained int the app_control
+ *
+ * @remarks The @a data must be released with bundle_free() by you.
+ * @param [in] app_control The app_control handle
+ * @param [out] data The bundle handle
+ * @return 0 on success, otherwise a negative error value.
+ * @retval #APP_CONTROL_ERROR_NONE Successful
+ * @retval #APP_CONTROL_ERROR_INVALID_PARAMETER Invalid parameter
+ * @see app_control_import_from_bundle()
+ * @code
+ *
+ * #include <bundle.h>
+ * #include <app_control.h>
+ *
+ * bundle* b = NULL;
+ * app_control_export_as_bundle(app_control, &b);
+ *
+ * @endcode
+ */
+int app_control_export_as_bundle(app_control_h app_control, bundle **data);
+
+int app_control_create_request(bundle *data, app_control_h *app_control);
+
+int app_control_create_event(bundle *data, app_control_h *app_control);
+
+/**
+ * @}
+ */
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* __TIZEN_APPFW_APP_CONTROL_INTERNAL_H__ */
* 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.
+ * limitations under the License.
*/
{
#endif
+/**
+ * @file app_i18n.h
+ */
+
/**
* @addtogroup CAPI_I18N_MODULE
* @{
*/
/**
- * @brief Marks a string for translation, gets replaced with the translated string at runtime.
- * @param [in] msg The string to be translated.
+ * @brief Definition to mark a string for translation, which is replaced with the translated string at runtime.
+ * @param[in] msg The string to be translated
*/
#ifndef _
#define _(msg) i18n_get_text(msg)
/**
* @brief Gets the localized translation for the specified string.
*
- * @details If a translation was not found in the localization file(.po file), @a message is returned.
+ * @details If a translation is not found in the localization file(.po file), @a message is returned.
*
- * @remarks Do not free returned value
+ * @since_tizen 2.3
+ * @remarks Do not free the returned value.
*
- * @param [in] message The string to be translated
- * @return The localized translation for the given @a message on success, otherwise the given @a message.
+ * @param[in] message The string to be translated
+ * @return The localized translation for the given @a message on success,
+ * otherwise the given @a message
*/
char* i18n_get_text(const char *message);
* 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.
+ * limitations under the License.
*/
-#ifndef __TIZEN_APPFW_APP_PRIVATE_H__
-#define __TIZEN_APPFW_APP_PRIVATE_H__
-
-#include <appcore-common.h>
-
-// GNU gettext macro is already defined at appcore-common.h
-#ifdef _
-#undef _
-#endif
-
-#include <app.h>
+#ifndef __TIZEN_APPFW_APP_INTERNAL_H__
+#define __TIZEN_APPFW_APP_INTERNAL_H__
#ifdef __cplusplus
extern "C" {
#endif
+#include <app.h>
+#include <appcore-common.h>
+
#define TIZEN_PATH_MAX 1024
#define PATH_FMT_APP_ROOT "/opt/usr/apps"
#define PATH_FMT_RO_RES_DIR PATH_FMT_RO_APP_ROOT "/%s/res"
#define PATH_FMT_RO_LOCALE_DIR PATH_FMT_RO_RES_DIR "/locale"
+struct app_event_handler {
+ app_event_type_e type;
+ app_event_cb cb;
+ void *data;
+};
+
+struct app_event_info {
+ app_event_type_e type;
+ void *value;
+};
+
+app_device_orientation_e app_convert_appcore_rm(enum appcore_rm rm);
+
typedef void (*app_finalizer_cb) (void *data);
int app_error(app_error_e error, const char* function, const char *description);
void app_finalizer_execute(void);
+int app_get_package(char **package);
+
#ifdef __cplusplus
}
#endif
-#endif /* __TIZEN_APPFW_APP_PRIVATE_H__ */
+#endif /* __TIZEN_APPFW_APP_INTERNAL_H__ */
* 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.
+ * limitations under the License.
*/
#endif
/**
- * @addtogroup CAPI_PREFERENCE_MODULE
+ * @file app_preference.h
+ */
+
+/**
+ * @addtogroup CAPI_PREFERENCE_MODULE
* @{
*/
/**
- * @brief Enumerations of error code for Preference.
+ * @brief Enumeration for Preference Error.
+ * @since_tizen 2.3
*/
typedef enum
{
PREFERENCE_ERROR_NONE = TIZEN_ERROR_NONE, /**< Successful */
PREFERENCE_ERROR_INVALID_PARAMETER = TIZEN_ERROR_INVALID_PARAMETER, /**< Invalid parameter */
PREFERENCE_ERROR_OUT_OF_MEMORY = TIZEN_ERROR_OUT_OF_MEMORY, /**< Out of memory */
- PREFERENCE_ERROR_NO_KEY = TIZEN_ERROR_KEY_NOT_AVAILABLE, /**< Required key not available */
+ PREFERENCE_ERROR_NO_KEY = TIZEN_ERROR_APPLICATION | 0x30, /**< Required key not available */
PREFERENCE_ERROR_IO_ERROR = TIZEN_ERROR_IO_ERROR , /**< Internal I/O Error */
} preference_error_e;
/**
- * @brief Called when the given key's value in the preference changes.
+ * @brief Called when the given key's value in the preference changes.
*
- * @details When the @a key is added or removed, this callback function is skipped. (only update can be handled)
+ * @details When the @a key is added or removed, this callback function is skipped(only update can be handled).
*
- * @param [in] key The name of the key in the preference
- * @param [in] user_data The user data passed from the callback registration function
- * @pre This function is invoked when the value of the key is overwritten after you register this callback using preference_set_changed_cb()
+ * @since_tizen 2.3
+ * @param[in] key The name of the key in the preference
+ * @param[in] user_data The user data passed from the callback registration function
+ * @pre This function is invoked when the value of the key is overwritten after you register this callback using preference_set_changed_cb().
* @see preference_set_changed_cb()
* @see preference_unset_changed_cb()
* @see preference_set_boolean()
/**
-* @brief Called to get key string once for each key-value pair in the preference.
-*
-* @remarks You should not free @a key returned by this function.
-*
-* @param [in] key The key of the value added to the preference
-* @param [in] value The value associated with the key
-* @param [in] user_data The user data passed from the foreach function
-* @return @c true to continue with the next iteration of the loop, \n @c false to break out of the loop.
-* @pre preference_foreach_item() will invoke this callback function.
-* @see preference_foreach_item()
-*/
+ * @brief Called to get key string, once for each key-value pair in the preference.
+ *
+ * @since_tizen 2.3
+ * @remarks You should not free the @a key returned by this function.
+ *
+ * @param[in] key The key of the value added to the preference
+ * @param[in] value The value associated with the key
+ * @param[in] user_data The user data passed from the foreach function
+ * @return @c true to continue with the next iteration of the loop,
+ * otherwise @c false to break out of the loop
+ * @pre preference_foreach_item() will invoke this callback function.
+ * @see preference_foreach_item()
+ */
typedef bool (*preference_item_cb)(const char *key, void *user_data);
/**
* @brief Sets an integer value in the preference.
*
- * @param [in] key The name of the key to modify
- * @param [in] value The new @c int value for the given key
- * @return 0 on success, otherwise a negative error value.
+ * @since_tizen 2.3
+ * @param[in] key The name of the key to modify
+ * @param[in] value The new @c int value for the given key
+ * @return @c 0 on success,
+ * otherwise a negative error value
* @retval #PREFERENCE_ERROR_NONE Successful
* @retval #PREFERENCE_ERROR_INVALID_PARAMETER Invalid parameter
* @retval #PREFERENCE_ERROR_IO_ERROR Internal I/O Error
* @see preference_get_int()
- *
*/
int preference_set_int(const char *key, int value);
/**
- * @brief Gets a integer value from the preference.
+ * @brief Gets an integer value from the preference.
*
- * @param [in] key The name of the key to retrieve
- * @param [out] value The @c int value for the given key
- * @return 0 on success, otherwise a negative error value.
- * @retval #PREFERENCE_ERROR_NONE Successful
+ * @since_tizen 2.3
+ * @param[in] key The name of the key to retrieve
+ * @param[out] value The @c int value for the given key
+ * @return @c 0 on success,
+ * otherwise a negative error value
+ * @retval #PREFERENCE_ERROR_NONE Successful
* @retval #PREFERENCE_ERROR_INVALID_PARAMETER Invalid parameter
* @retval #PREFERENCE_ERROR_NO_KEY Required key not available
* @retval #PREFERENCE_ERROR_IO_ERROR Internal I/O Error
/**
* @brief Sets a double value in the preference.
*
- * @param [in] key The name of the key to modify
- * @param [in] value The new @c double value associated with given key
- * @return 0 on success, otherwise a negative error value.
+ * @since_tizen 2.3
+ * @param[in] key The name of the key to modify
+ * @param[in] value The new @c double value associated with the given key
+ * @return @c 0 on success,
+ * otherwise a negative error value
* @retval #PREFERENCE_ERROR_NONE Successful
* @retval #PREFERENCE_ERROR_INVALID_PARAMETER Invalid parameter
* @retval #PREFERENCE_ERROR_IO_ERROR Internal I/O Error
* @see preference_get_double()
- *
*/
int preference_set_double(const char *key, double value);
/**
* @brief Gets a double value from the preference.
*
- * @param [in] key The name of the key to retrieve
- * @param [out] value The @c double value associated with given key
- * @return 0 on success, otherwise a negative error value.
+ * @since_tizen 2.3
+ * @param[in] key The name of the key to retrieve
+ * @param[out] value The @c double value associated with the given key
+ * @return @c 0 on success,
+ * otherwise a negative error value
* @retval #PREFERENCE_ERROR_NONE Successful
* @retval #PREFERENCE_ERROR_INVALID_PARAMETER Invalid parameter
* @retval #PREFERENCE_ERROR_NO_KEY Required key not available
* @retval #PREFERENCE_ERROR_IO_ERROR Internal I/O Error
* @see preference_set_double()
- *
*/
int preference_get_double(const char *key, double *value);
* @brief Sets a string value in the preference.
*
* @details It makes a deep copy of the added string value.
- *
- * @param [in] key The name of the key to modify
- * @param [in] value The new @c string value associated with given key
- * @return 0 on success, otherwise a negative error value.
+ *
+ * @since_tizen 2.3
+ * @param[in] key The name of the key to modify
+ * @param[in] value The new @c string value associated with the given key
+ * @return @c 0 on success,
+ * otherwise a negative error value
* @retval #PREFERENCE_ERROR_NONE Successful
* @retval #PREFERENCE_ERROR_INVALID_PARAMETER Invalid parameter
* @retval #PREFERENCE_ERROR_IO_ERROR Internal I/O Error
* @see preference_get_string()
- *
*/
int preference_set_string(const char *key, const char *value);
/**
* @brief Gets a string value from the preference.
*
- * @remarks @a value must be released with free() by you.
- * @param [in] key The name of the key to retrieve
- * @param [out] value The @c string value associated with given key
- * @return 0 on success, otherwise a negative error value.
- * @retval #PREFERENCE_ERROR_NONE Successful
+ * @since_tizen 2.3
+ * @remarks @a value must be released using free().
+ * @param[in] key The name of the key to retrieve
+ * @param[out] value The @c string value associated with the given key
+ * @return @c 0 on success,
+ * otherwise a negative error value
+ * @retval #PREFERENCE_ERROR_NONE Successful
* @retval #PREFERENCE_ERROR_INVALID_PARAMETER Invalid parameter
* @retval #PREFERENCE_ERROR_OUT_OF_MEMORY Out of memory
* @retval #PREFERENCE_ERROR_NO_KEY Required key not available
/**
* @brief Sets a boolean value in the preference.
*
- * @param [in] key The name of the key to modify
- * @param [in] value The new boolean @c value associated with given key
- * @return 0 on success, otherwise a negative error value.
+ * @since_tizen 2.3
+ * @param[in] key The name of the key to modify
+ * @param[in] value The new @c boolean value associated with the given key
+ * @return @c 0 on success,
+ * otherwise a negative error value
* @retval #PREFERENCE_ERROR_NONE Successful
* @retval #PREFERENCE_ERROR_INVALID_PARAMETER Invalid parameter
- * @retval #PREFERENCE_ERROR_IO_ERROR Internal I/O Error
+ * @retval #PREFERENCE_ERROR_IO_ERROR Internal I/O Error
* @see preference_get_boolean()
*/
int preference_set_boolean(const char *key, bool value);
/**
* @brief Gets a boolean value from the preference.
*
- * @param [in] key The name of the key to retrieve
- * @param [out] value The boolean @c value associated with given key
- * @return 0 on success, otherwise a negative error value.
+ * @since_tizen 2.3
+ * @param[in] key The name of the key to retrieve
+ * @param[out] value The @c boolean value associated with the given key
+ * @return @c 0 on success,
+ * otherwise a negative error value
* @retval #PREFERENCE_ERROR_NONE Successful
* @retval #PREFERENCE_ERROR_INVALID_PARAMETER Invalid parameter
* @retval #PREFERENCE_ERROR_NO_KEY Required key not available
/**
* @brief Removes any value with the given @a key from the preference.
*
- * @param [in] key The name of the key to remove
- * @return 0 on success, otherwise a negative error value.
+ * @since_tizen 2.3
+ * @param[in] key The name of the key to remove
+ * @return @c 0 on success,
+ * otherwise a negative error value
* @retval #PREFERENCE_ERROR_NONE Successful
- * @retval #PREFERENCE_ERROR_INVALID_PARAMETER Invalid parameter
+ * @retval #PREFERENCE_ERROR_INVALID_PARAMETER Invalid parameter
* @retval #PREFERENCE_ERROR_IO_ERROR Internal I/O Error
- *
*/
int preference_remove(const char *key);
/**
- * @brief Checks whether if the given @a key exists in the preference.
+ * @brief Checks whether the given @a key exists in the preference.
*
- * @param [in] key The name of the key to check
- * @param [out] existing @c true if the @a key exists in the preference, otherwise @c false
- * @return 0 on success, otherwise a negative error value.
+ * @since_tizen 2.3
+ * @param[in] key The name of the key to check
+ * @param[out] existing If @c true the @a key exists in the preference,
+ * otherwise @c false
+ * @return @c 0 on success,
+ * otherwise a negative error value
* @retval #PREFERENCE_ERROR_NONE Successful
* @retval #PREFERENCE_ERROR_INVALID_PARAMETER Invalid parameter
* @retval #PREFERENCE_ERROR_IO_ERROR Internal I/O Error
/**
* @brief Removes all key-value pairs from the preference.
*
- * @return 0 on success, otherwise a negative error value.
+ * @since_tizen 2.3
+ * @return @c 0 on success,
+ * otherwise a negative error value
* @retval #PREFERENCE_ERROR_NONE Successful
* @retval #PREFERENCE_ERROR_IO_ERROR Internal I/O Error
* @see preference_remove()
/**
* @brief Registers a callback function to be invoked when value of the given key in the preference changes.
*
- * @param [in] key The name of the key to monitor
- * @param [in] callback The callback function to register
- * @param [in] user_data The user data to be passed to the callback function
- * @return 0 on success, otherwise a negative error value.
+ * @since_tizen 2.3
+ * @param[in] key The name of the key to monitor
+ * @param[in] callback The callback function to register
+ * @param[in] user_data The user data to be passed to the callback function
+ * @return @c 0 on success,
+ * otherwise a negative error value
* @retval #PREFERENCE_ERROR_NONE Successful
* @retval #PREFERENCE_ERROR_INVALID_PARAMETER Invalid parameter
* @retval #PREFERENCE_ERROR_OUT_OF_MEMORY Out of memory
/**
* @brief Unregisters the callback function.
*
- * @param [in] key The name of the key to monitor
- * @return 0 on success, otherwise a negative error value.
+ * @since_tizen 2.3
+ * @param[in] key The name of the key to monitor
+ * @return @c 0 on success,
+ * otherwise a negative error value
* @retval #PREFERENCE_ERROR_NONE Successful
* @retval #PREFERENCE_ERROR_INVALID_PARAMETER Invalid parameter
* @retval #PREFERENCE_ERROR_IO_ERROR Internal I/O Error
/**
* @brief Retrieves all key-value pairs in the preference by invoking the callback function.
*
- * @param [in] callback The callback function to get key value once for each key-value pair in the preference
- * @param [in] user_data The user data to be passed to the callback function
- * @return 0 on success, otherwise a negative error value.
+ * @since_tizen 2.3
+ * @param[in] callback The callback function to get key value once for each key-value pair in the preference
+ * @param[in] user_data The user data to be passed to the callback function
+ * @return @c 0 on success,
+ * otherwise a negative error value
* @retval #PREFERENCE_ERROR_NONE Successful
* @retval #PREFERENCE_ERROR_INVALID_PARAMETER Invalid parameter
* @retval #PREFERENCE_ERROR_IO_ERROR Internal I/O Error
* 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.
+ * limitations under the License.
*/
-#ifndef __TIZEN_APPFW_PREFERENCE_PRIVATE_H__
-#define __TIZEN_APPFW_PREFERENCE_PRIVATE_H__
+#ifndef __TIZEN_APPFW_PREFERENCE_INTERNAL_H__
+#define __TIZEN_APPFW_PREFERENCE_INTERNAL_H__
#ifdef __cplusplus
extern "C" {
}
#endif
-#endif /* __TIZEN_APPFW_PREFERENCE_PRIVATE_H__ */
+#endif /* __TIZEN_APPFW_PREFERENCE_INTERNAL_H__ */
+++ /dev/null
-/*
- * Copyright (c) 2011 Samsung Electronics Co., Ltd All Rights Reserved
- *
- * 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 __TIZEN_APPFW_SERVICE_H__
-#define __TIZEN_APPFW_SERVICE_H__
-
-#include <sys/types.h>
-#include <tizen.h>
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-/**
- * @addtogroup CAPI_SERVICE_MODULE
- * @{
- */
-
-
-typedef struct _bundle_t bundle;
-
-
-/**
- * @brief Service handle.
- */
-typedef struct service_s *service_h;
-
-
-/**
- * @brief Enumerations of error code for Service.
- */
-typedef enum
-{
- SERVICE_ERROR_NONE = TIZEN_ERROR_NONE, /**< Successful */
- SERVICE_ERROR_INVALID_PARAMETER = TIZEN_ERROR_INVALID_PARAMETER, /**< Invalid parameter */
- SERVICE_ERROR_OUT_OF_MEMORY = TIZEN_ERROR_OUT_OF_MEMORY, /**< Out of memory */
- SERVICE_ERROR_APP_NOT_FOUND = TIZEN_ERROR_APPLICATION_CLASS | 0x21, /**< The application was not found */
- SERVICE_ERROR_KEY_NOT_FOUND = TIZEN_ERROR_KEY_NOT_AVAILABLE, /**< Specified key not found */
- SERVICE_ERROR_KEY_REJECTED = TIZEN_ERROR_KEY_REJECTED, /**< Not available key */
- SERVICE_ERROR_INVALID_DATA_TYPE = TIZEN_ERROR_APPLICATION_CLASS | 0x22, /**< Invalid data type */
- SERVICE_ERROR_LAUNCH_REJECTED = TIZEN_ERROR_UNKNOWN, /**< Internal launch error*/
- SERVICE_ERROR_PERMISSION_DENIED = TIZEN_ERROR_PERMISSION_DENIED /**< Permission denied */
-} service_error_e;
-
-
-/**
- * @brief Enumeration of service result.
- */
-typedef enum
-{
- SERVICE_RESULT_SUCCEEDED = 0, /**< Operation succeeded */
- SERVICE_RESULT_FAILED = -1, /**< Operation failed by the callee */
- SERVICE_RESULT_CANCELED = -2, /**< Operation canceled by the framework */
-} service_result_e;
-
-
-/**
- * @brief Service operation : default operation for explicit launch
- */
-#define SERVICE_OPERATION_DEFAULT "http://tizen.org/appcontrol/operation/default"
-
-
-/**
- * @brief Service operation : provide explicit editable access to the given data.
- */
-#define SERVICE_OPERATION_EDIT "http://tizen.org/appcontrol/operation/edit"
-
-
-/**
- * @brief Service operation : display the data.
- */
-#define SERVICE_OPERATION_VIEW "http://tizen.org/appcontrol/operation/view"
-
-
-/**
- * @brief Service operation : pick an item from the data, returning what was selected.
- */
-#define SERVICE_OPERATION_PICK "http://tizen.org/appcontrol/operation/pick"
-
-
-/**
- * @brief Service operation : create a content, returning what was created.
- */
-#define SERVICE_OPERATION_CREATE_CONTENT "http://tizen.org/appcontrol/operation/create_content"
-
-
-/**
- * @brief Service operation : perform a call to someone specified by the data.
- */
-#define SERVICE_OPERATION_CALL "http://tizen.org/appcontrol/operation/call"
-
-
-/**
- * @brief Service operation : deliver some data to someone else.
- */
-#define SERVICE_OPERATION_SEND "http://tizen.org/appcontrol/operation/send"
-
-
-/**
- * @brief Service operation : deliver text data to someone else.
- */
-#define SERVICE_OPERATION_SEND_TEXT "http://tizen.org/appcontrol/operation/send_text"
-
-
-/**
- * @brief Service operation : share a item to someone else.
- */
-#define SERVICE_OPERATION_SHARE "http://tizen.org/appcontrol/operation/share"
-
-
-/**
- * @brief Service operation : share multiple items to someone else.
- */
-#define SERVICE_OPERATION_MULTI_SHARE "http://tizen.org/appcontrol/operation/multi_share"
-
-
-/**
- * @brief Service operation : share text data to someone else.
- */
-#define SERVICE_OPERATION_SHARE_TEXT "http://tizen.org/appcontrol/operation/share_text"
-
-
-/**
- * @brief Service operation : dial a number as specified by the data.
- */
-#define SERVICE_OPERATION_DIAL "http://tizen.org/appcontrol/operation/dial"
-
-
-/**
- * @brief Service operation : perform a search.
- */
-#define SERVICE_OPERATION_SEARCH "http://tizen.org/appcontrol/operation/search"
-
-
-/**
- * @brief Service operation : download a item.
- */
-#define SERVICE_OPERATION_DOWNLOAD "http://tizen.org/appcontrol/operation/download"
-
-
-/**
- * @brief Service operation : print content.
- */
-#define SERVICE_OPERATION_PRINT "http://tizen.org/appcontrol/operation/print"
-
-/**
- * @brief Service operation : compose.
- */
-#define SERVICE_OPERATION_COMPOSE "http://tizen.org/appcontrol/operation/compose"
-
-/**
- * @brief Service optional data : the subject of a message.
- */
-#define SERVICE_DATA_SUBJECT "http://tizen.org/appcontrol/data/subject"
-
-
-/**
- * @brief Service optional data : e-mail addresses.
- */
-#define SERVICE_DATA_TO "http://tizen.org/appcontrol/data/to"
-
-
-/**
- * @brief Service optional data : e-mail addresses that should be carbon copied.
- */
-#define SERVICE_DATA_CC "http://tizen.org/appcontrol/data/cc"
-
-
-/**
- * @brief Service optional data : e-mail addresses that should be blind carbon copied.
- */
-#define SERVICE_DATA_BCC "http://tizen.org/appcontrol/data/bcc"
-
-
-/**
- * @brief Service optional data : the content of the data is associated with #SERVICE_OPERATION_SEND.
- */
-#define SERVICE_DATA_TEXT "http://tizen.org/appcontrol/data/text"
-
-
-/**
- * @brief Service optional data : the title of the data
- */
-#define SERVICE_DATA_TITLE "http://tizen.org/appcontrol/data/title"
-
-
-/**
- * @brief Service optional data : the path of selected item.
- */
-#define SERVICE_DATA_SELECTED "http://tizen.org/appcontrol/data/selected"
-
-
-/**
- * @brief Service optional data : multiple item path to deliver.
- */
-#define SERVICE_DATA_PATH "http://tizen.org/appcontrol/data/path"
-
-
-/**
- * @brief Called when the reply of the launch request is delivered.
- *
- * @remarks The @a request and @a reply must not be deallocated by an application.
- *
- * @param [in] request The service handle of the launch request that has sent
- * @param [in] reply The service handle in which the results of the callee are contained
- * @param [in] result The result code of the launch request
- * @param [in] user_data The user data passed from the callback registration function
- * @pre When the callee replies to the launch request, this callback will be invoked.
- * @see service_send_launch_request()
- * @see service_reply_to_launch_request()
- */
-typedef void (*service_reply_cb) (service_h request, service_h reply, service_result_e result, void *user_data);
-
-
-/**
-* @brief Called to retrieve the extra data that are contained in the service
-*
-* @remarks The @a key must not be deallocated by an application.
-*
-* @param[in] service The service handle
-* @param[in] key The key of the value contained in the service
-* @param[in] user_data The user data passed from the foreach function
-* @return @c true to continue with the next iteration of the loop, \n @c false to break out of the loop.
-* @pre service_foreach_extra_data() will invoke this callback.
-* @see service_foreach_extra_data()
-*/
-typedef bool (*service_extra_data_cb)(service_h service, const char *key, void *user_data);
-
-
-/**
-* @brief Called once for each matched application that can be launched to handle the given service request.
-*
-* @param [in] service The service handle
-* @param [in] package The package name of the application that can handle the launch request of the given service.
-* @param [in] user_data The user data passed from the foreach function
-* @return @c true to continue with the next iteration of the loop, \n @c false to break out of the loop.
-* @pre service_foreach_app_matched() will invoke this callback.
-* @see service_foreach_app_matched()
-*/
-typedef bool (*service_app_matched_cb)(service_h service, const char *appid, void *user_data);
-
-
-typedef int (*service_host_res_fn)(void *data);
-
-/**
- * @brief Creates a service handle.
- *
- * @remarks The @a service must be released with service_destroy() by you.
- * @param [out] service A service handle to be newly created on success
- * @return 0 on success, otherwise a negative error value.
- * @retval #SERVICE_ERROR_NONE Successful
- * @retval #SERVICE_ERROR_INVALID_PARAMETER Invalid parameter
- * @retval #SERVICE_ERROR_OUT_OF_MEMORY Out of memory
- * @see service_destroy()
- */
-int service_create(service_h *service);
-
-
-/**
- * @brief Destroys the service handle and releases all its resources.
- *
- * @param [in] service The service handle
- * @return 0 on success, otherwise a negative error value.
- * @retval #SERVICE_ERROR_NONE Successful
- * @retval #SERVICE_ERROR_INVALID_PARAMETER Invalid parameter
- * @retval #SERVICE_ERROR_OUT_OF_MEMORY Out of memory
- * @see service_create()
- */
-int service_destroy(service_h service);
-
-
-/**
- * @brief Converts the service handle to bundle data.
- *
- * @param [in] service The service handle
- * @param [out] data a bundle data on success
- * @return 0 on success, otherwise a negative error value.
- * @retval #SERVICE_ERROR_NONE Successful
- * @retval #SERVICE_ERROR_INVALID_PARAMETER Invalid parameter
- */
-int service_to_bundle(service_h service, bundle **data);
-
-/**
- * @brief Sets the operation to be performed.
- *
- * @details The @a operation is the mandatory information for the launch request.
- * If the operation is not specified, #SERVICE_OPERATION_DEFAULT is used for the launch request.
- * If the operation is #SERVICE_OPERATION_DEFAULT, the package information is mandatory to explicitly launch the application
- * @param [in] service The service handle
- * @param [in] operation The operation to be performed \n
- * If the @a operation is NULL, it clears the previous value.
- * @return 0 on success, otherwise a negative error value.
- * @retval #SERVICE_ERROR_NONE Successful
- * @retval #SERVICE_ERROR_INVALID_PARAMETER Invalid parameter
- * @see service_get_operation()
- * @see SERVICE_OPERATION_DEFAULT
- * @see SERVICE_OPERATION_EDIT
- * @see SERVICE_OPERATION_VIEW
- * @see SERVICE_OPERATION_PICK
- * @see SERVICE_OPERATION_CREATE_CONTENT
- * @see SERVICE_OPERATION_CALL
- * @see SERVICE_OPERATION_SEND
- * @see SERVICE_OPERATION_SEND_TEXT
- * @see SERVICE_OPERATION_DIAL
- * @see SERVICE_OPERATION_SEARCH
- */
-int service_set_operation(service_h service, const char *operation);
-
-
-/**
- * @brief Gets the operation to be performed.
- *
- * @remarks The @a operation must be released with free() by you.
- * @param [in] service The service handle
- * @param [out] operation The operation to be performed
- * @return 0 on success, otherwise a negative error value.
- * @retval #SERVICE_ERROR_NONE Successful
- * @retval #SERVICE_ERROR_INVALID_PARAMETER Invalid parameter
- * @retval #SERVICE_ERROR_OUT_OF_MEMORY Out of memory
- * @see service_set_operation()
- */
-int service_get_operation(service_h service, char **operation);
-
-
-/**
- * @brief Sets the URI of the data.
- *
- * @param [in] service The service handle
- * @param [in] uri The URI of the data this service is operating on \n
- * If the @a uri is NULL, it clears the previous value.
- * @return 0 on success, otherwise a negative error value.
- * @retval #SERVICE_ERROR_NONE Successful
- * @retval #SERVICE_ERROR_INVALID_PARAMETER Invalid parameter
- * @see service_get_uri()
- */
-int service_set_uri(service_h service, const char *uri);
-
-
-/**
- * @brief Gets the URI of the data.
- *
- * @remarks The @a uri must be released with free() by you.
- * @param [in] service The service handle
- * @param [out] uri The URI of the data this service is operating on
- * @return 0 on success, otherwise a negative error value.
- * @retval #SERVICE_ERROR_NONE Successful
- * @retval #SERVICE_ERROR_INVALID_PARAMETER Invalid parameter
- * @retval #SERVICE_ERROR_OUT_OF_MEMORY Out of memory
- * @see service_set_uri()
- */
-int service_get_uri(service_h service, char **uri);
-
-
-/**
- * @brief Sets the explicit MIME type of the data
- *
- * @param [in] service The service handle
- * @param [in] mime the explicit MIME type of the data this service is operating on \n
- * If the @a mime is NULL, it clears the previous value.
- * @return 0 on success, otherwise a negative error value.
- * @retval #SERVICE_ERROR_NONE Successful
- * @retval #SERVICE_ERROR_INVALID_PARAMETER Invalid parameter
- * @see service_get_mime()
- */
-int service_set_mime(service_h service, const char *mime);
-
-
-/**
- * @brief Gets the explicit MIME type of the data.
- *
- * @remarks The @a uri must be released with free() by you.
- * @param [in] service The service handle
- * @param [out] mime The explicit MIME type of the data this service is operating on
- * @return 0 on success, otherwise a negative error value.
- * @retval #SERVICE_ERROR_NONE Successful
- * @retval #SERVICE_ERROR_INVALID_PARAMETER Invalid parameter
- * @retval #SERVICE_ERROR_OUT_OF_MEMORY Out of memory
- * @see service_set_mime()
- */
-int service_get_mime(service_h service, char **mime);
-
-
-/**
- * @brief Sets the explicit category
- *
- * @param [in] service The service handle
- * @param [in] category the explicit category
- * If the @a category is NULL, it clears the previous value.
- * @return 0 on success, otherwise a negative error value.
- * @retval #SERVICE_ERROR_NONE Successful
- * @retval #SERVICE_ERROR_INVALID_PARAMETER Invalid parameter
- * @see service_get_category()
- */
-int service_set_category(service_h service, const char *category);
-
-
-/**
- * @brief Gets the explicit category
- *
- * @remarks The @a category must be released with free() by you.
- * @param [in] service The service handle
- * @param [out] category The explicit category
- * @return 0 on success, otherwise a negative error value.
- * @retval #SERVICE_ERROR_NONE Successful
- * @retval #SERVICE_ERROR_INVALID_PARAMETER Invalid parameter
- * @retval #SERVICE_ERROR_OUT_OF_MEMORY Out of memory
- * @see service_set_category()
- */
-int service_get_category(service_h service, char **category);
-
-
-/**
- * @brief Sets the package name of the application to explicitly launch
- *
- * @remark This function is @b deprecated. Use service_set_app_id() instead.
- * @param [in] service The service handle
- * @param [in] package The package name of the application to explicitly launch \n
- * If the @a package is NULL, it clears the previous value.
- * @return 0 on success, otherwise a negative error value.
- * @retval #SERVICE_ERROR_NONE Successful
- * @retval #SERVICE_ERROR_INVALID_PARAMETER Invalid parameter
- * @retval #SERVICE_ERROR_OUT_OF_MEMORY Out of memory
- * @see service_get_package()
- */
-/* Deprecated API */
-int service_set_package(service_h service, const char *package); // __attribute__((deprecated));
-
-
-/**
- * @brief Gets the package name of the application to explicitly launch
- *
- * @remark This function is @b deprecated. Use service_get_app_id() instead.
- * @remarks The @a package must be released with free() by you.
- * @param [in] service The service handle
- * @param [out] package The package name of the application to explicitly launch
- * @return 0 on success, otherwise a negative error value.
- * @retval #SERVICE_ERROR_NONE Successful
- * @retval #SERVICE_ERROR_INVALID_PARAMETER Invalid parameter
- * @retval #SERVICE_ERROR_OUT_OF_MEMORY Out of memory
- * @see service_set_package()
- */
-/* Deprecated API */
-int service_get_package(service_h service, char **package); // __attribute__((deprecated));
-
-
-/**
- * @brief Sets the ID of the application to explicitly launch
- *
- * @param [in] service The service handle
- * @param [in] app_id The ID of the application to explicitly launch \n
- * If the @a app_id is NULL, it clears the previous value.
- * @return 0 on success, otherwise a negative error value.
- * @retval #SERVICE_ERROR_NONE Successful
- * @retval #SERVICE_ERROR_INVALID_PARAMETER Invalid parameter
- * @retval #SERVICE_ERROR_OUT_OF_MEMORY Out of memory
- * @see service_get_app_id()
- */
-int service_set_app_id(service_h service, const char *app_id);
-
-
-/**
- * @brief Gets the ID of the application to explicitly launch
- *
- * @remarks The @a app_id must be released with free() by you.
- * @param [in] service The service handle
- * @param [out] app_id The ID of the application to explicitly launch
- * @return 0 on success, otherwise a negative error value.
- * @retval #SERVICE_ERROR_NONE Successful
- * @retval #SERVICE_ERROR_INVALID_PARAMETER Invalid parameter
- * @retval #SERVICE_ERROR_OUT_OF_MEMORY Out of memory
- * @see service_set_app_id()
- */
-int service_get_app_id(service_h service, char **app_id);
-
-/**
- * @brief Sets the window id of the application
- *
- * @param [in] service The service handle
- * @param [in] id the window id of caller application \n
- * If the @a id is not positive, it clears the previous value.
- * @return 0 on success, otherwise a negative error value.
- * @retval #SERVICE_ERROR_NONE Successful
- * @retval #SERVICE_ERROR_INVALID_PARAMETER Invalid parameter
- * @retval #SERVICE_ERROR_OUT_OF_MEMORY Out of memory
- * @see service_get_window()
- */
-int service_set_window(service_h service, unsigned int id);
-
-
-/**
-* @brief Gets the window id of the application
-*
-* @param [in] service The service handle
-* @param [out] id The window id of caller application
-* @return 0 on success, otherwise a negative error value.
-* @retval #SERVICE_ERROR_NONE Successful
-* @retval #SERVICE_ERROR_INVALID_PARAMETER Invalid parameter
-* @retval #SERVICE_ERROR_OUT_OF_MEMORY Out of memory
-* @see service_set_app_id()
-*/
-int service_get_window(service_h service, unsigned int *id);
-
-
-/**
- * @brief Adds the extra data to the service.
- *
- * @remarks The function replaces any existing value for the given key.
- * @remarks The function returns #SERVICE_ERROR_INVALID_PARAMETER if key or value is zero-length string.
- * @remarks The function returns #SERVICE_ERROR_KEY_REJECTED if the application tries to use same key with system-defined key
- * @param [in] service The service handle
- * @param [in] key The name of the extra data
- * @param [in] value The value associated with given key
- * @return 0 on success, otherwise a negative error value.
- * @retval #SERVICE_ERROR_NONE Successful
- * @retval #SERVICE_ERROR_INVALID_PARAMETER Invalid parameter
- * @retval #SERVICE_ERROR_KEY_REJECTED Not available key
- * @see service_add_extra_data_array()
- * @see service_remove_extra_data()
- * @see service_get_extra_data()
- */
-int service_add_extra_data(service_h service, const char *key, const char *value);
-
-
-/**
- * @brief Adds the extra data array to the service.
- *
- * @remarks The function replaces any existing value for the given key.
- * @remarks The function returns #SERVICE_ERROR_INVALID_PARAMETER if key is zero-length string.
- * @remarks The function returns #SERVICE_ERROR_KEY_REJECTED if the application tries to use same key with system-defined key
- * @param [in] service The service handle
- * @param [in] key The name of the extra data
- * @param [in] value The array value associated with given key
- * @param [in] length The length of the array
- * @return 0 on success, otherwise a negative error value.
- * @retval #SERVICE_ERROR_NONE Successful
- * @retval #SERVICE_ERROR_INVALID_PARAMETER Invalid parameter
- * @retval #SERVICE_ERROR_KEY_REJECTED Not available key
- * @see service_add_extra_data()
- * @see service_remove_extra_data()
- * @see service_get_extra_data()
- */
-int service_add_extra_data_array(service_h service, const char *key, const char* value[], int length);
-
-
-/**
- * @brief Removes the extra data from the service.
- *
- * @param [in] service The service handle
- * @param [in] key The name of the extra data
- * @return 0 on success, otherwise a negative error value.
- * @retval #SERVICE_ERROR_NONE Successful
- * @retval #SERVICE_ERROR_INVALID_PARAMETER Invalid parameter
- * @retval #SERVICE_ERROR_KEY_NOT_FOUND Specified key not found
- * @see service_add_extra_data()
- * @see service_add_extra_data_array()
- * @see service_get_extra_data()
- */
-int service_remove_extra_data(service_h service, const char *key);
-
-
-/**
- * @brief Gets the extra data from the service.
- *
- * @remarks The @a value must be released with free() by you.
- * @remarks The function returns #SERVICE_ERROR_INVALID_DATA_TYPE if the value is array data type.
- * @param [in] service The service handle
- * @param [int] key The name of the extra data
- * @param [out] value The value associated with given key
- * @return 0 on success, otherwise a negative error value.
- * @retval #SERVICE_ERROR_NONE Successful
- * @retval #SERVICE_ERROR_INVALID_PARAMETER Invalid parameter
- * @retval #SERVICE_ERROR_KEY_NOT_FOUND Specified key not found
- * @retval #SERVICE_ERROR_OUT_OF_MEMORY Out of memory
- * @retval #SERVICE_ERROR_INVALID_DATA_TYPE Invalid data type
- * @see service_add_extra_data()
- * @see service_add_extra_data_array()
- * @see service_get_extra_data()
- * @see service_remove_extra_data()
- * @see service_foreach_extra_data()
- */
-int service_get_extra_data(service_h service, const char *key, char **value);
-
-
-/**
- * @brief Gets the extra data array from the service.
- *
- * @remarks The @a value must be released with free() by you.
- * @remarks The function returns #SERVICE_ERROR_INVALID_DATA_TYPE if the value is not array data type.
- * @param [in] service The service handle
- * @param [int] key The name of the extra data
- * @param [out] value The array value associated with given key
- * @param [out] length The length of the array
- * @return 0 on success, otherwise a negative error value.
- * @retval #SERVICE_ERROR_NONE Successful
- * @retval #SERVICE_ERROR_INVALID_PARAMETER Invalid parameter
- * @retval #SERVICE_ERROR_KEY_NOT_FOUND Specified key not found
- * @retval #SERVICE_ERROR_OUT_OF_MEMORY Out of memory
- * @retval #SERVICE_ERROR_INVALID_DATA_TYPE Invalid data type
- * @see service_add_extra_data()
- * @see service_add_extra_data_array()
- * @see service_remove_extra_data()
- * @see service_foreach_extra_data()
- */
-int service_get_extra_data_array(service_h service, const char *key, char ***value, int *length);
-
-
-/**
- * @brief Checks whether if the extra data associated with given @a key is array data type.
- *
- * @param [in] service The service handle
- * @param [int] key The name of the extra data
- * @param [out] array @c True if the extra data is array data type, otherwise @c false
- * @return 0 on success, otherwise a negative error value.
- * @retval #SERVICE_ERROR_NONE Successful
- * @retval #SERVICE_ERROR_INVALID_PARAMETER Invalid parameter
- * @see service_add_extra_data()
- * @see service_add_extra_data_array()
- * @see service_remove_extra_data()
- * @see service_foreach_extra_data()
- */
-int service_is_extra_data_array(service_h service, const char *key, bool *array);
-
-
-/**
- * @brief Retrieves all extra data contained in service.
- * @details This function calls service_extra_data_cb() once for each key-value pair for extra data contained in service. \n
- * If service_extra_data_cb() callback function returns false, then iteration will be finished.
- *
- * @param [in] service The service handle
- * @param [in] callback The iteration callback function
- * @param [in] user_data The user data to be passed to the callback function
- * @return 0 on success, otherwise a negative error value.
- * @retval #SERVICE_ERROR_NONE Successful
- * @retval #SERVICE_ERROR_INVALID_PARAMETER Invalid parameter
- * @post This function invokes service_extra_data_cb().
- * @see service_extra_data_cb()
- */
-int service_foreach_extra_data(service_h service, service_extra_data_cb callback, void *user_data);
-
-
-/**
- * @brief Retrieves all applications that can be launched to handle the given service request.
- *
- * @param [in] service The service handle
- * @param [in] callback The iteration callback function
- * @param [in] user_data The user data to be passed to the callback function
- * @return 0 on success, otherwise a negative error value.
- * @retval #SERVICE_ERROR_NONE Success
- * @retval #SERVICE_ERROR_INVALID_PARAMETER Invalid parameter
- * @post This function invokes service_app_matched_cb().
- * @see service_app_matched_cb()
- */
-int service_foreach_app_matched(service_h service, service_app_matched_cb callback, void *user_data);
-
-
-/**
- * @brief Sends the launch request.
- *
- * @details The operation is mandatory information for the launch request. \n
- * If the operation is not specified, #SERVICE_OPERATION_DEFAULT is used by default.
- * If the operation is #SERVICE_OPERATION_DEFAULT, the application ID is mandatory to explicitly launch the application
- * @param [in] service The service handle
- * @param [in] callback The callback function to be called when the reply is delivered
- * @param [in] user_data The user data to be passed to the callback function
- * @return 0 on success, otherwise a negative error value.
- * @retval #SERVICE_ERROR_NONE Successful
- * @retval #SERVICE_ERROR_INVALID_PARAMETER Invalid parameter
- * @retval #SERVICE_ERROR_OUT_OF_MEMORY Out of memory
- * @retval #SERVICE_ERROR_APP_NOT_FOUND The application was not found to run the given launch request
- * @retval #SERVICE_ERROR_LAUNCH_REJECTED The application launch is rejected due to timeout, continuous launch request while launching and application hang
- * @post If the launch request is sent for the result, the result will come back through service_reply_cb() from the callee application
- * @see service_reply_to_launch_request()
- * @see service_reply_cb()
- */
-int service_send_launch_request(service_h service, service_reply_cb callback, void *user_data);
-
-
-/**
- * @brief Replies to the launch request that the caller sent
- * @details If the caller application sent the launch request to receive the result, the callee application can return the result back to the caller.
- *
- * @param [in] reply The service handle in which the results of the callee are contained
- * @param [in] request The service handle that the caller sent
- * @param [in] result The result code of the launch request
- * @return 0 on success, otherwise a negative error value.
- * @retval #SERVICE_ERROR_NONE Successful
- * @retval #SERVICE_ERROR_INVALID_PARAMETER Invalid parameter
- * @retval #SERVICE_ERROR_OUT_OF_MEMORY Out of memory
- * @see service_send_launch_request()
- */
-int service_reply_to_launch_request(service_h reply, service_h request, service_result_e result);
-
-
-/**
- * @brief Creates and returns a copy of the given service handle.
- *
- * @remarks A newly created service should be destroyed by calling service_destroy() if it is no longer needed.
- *
- * @param [out] clone If successful, a newly created service handle will be returned.
- * @param [in] service The service handle
- * @return 0 on success, otherwise a negative error value.
- * @retval #SERVICE_ERROR_NONE Successful
- * @retval #SERVICE_ERROR_INVALID_PARAMETER Invalid parameter
- * @retval #SERVICE_ERROR_OUT_OF_MEMORY Out of memory
- * @see service_destroy()
- */
-int service_clone(service_h *clone, service_h service);
-
-
-/**
- * @brief Gets the application ID of the caller from the launch request
- *
- * @remarks The @a service must be the launch reqeust from app_service_cb().
- * @remarks This function returns #SERVICE_ERROR_INVALID_PARAMETER if the given service is not the launch request.
- * @remarks The @a id must be released with free() by you.
- * @param [in] service The service handle from app_service_cb()
- * @param [out] id The application ID of the caller
- * @return 0 on success, otherwise a negative error value.
- * @retval #SERVICE_ERROR_NONE Successful
- * @retval #SERVICE_ERROR_INVALID_PARAMETER Invalid parameter
- * @retval #SERVICE_ERROR_OUT_OF_MEMORY Out of memory
- */
-int service_get_caller(service_h service, char **id);
-
-
-/**
- * @brief Check whether the caller is requesting a reply from the launch reqeust
- *
- * @remarks The @a service must be the launch reqeust from app_service_cb().
- * @remarks This function returns #SERVICE_ERROR_INVALID_PARAMETER if the given service is not the launch request.
- * @param [in] service The service handle from app_service_cb()
- * @param [out] requested whether a reply is requested by the caller
- * @return 0 on success, otherwise a negative error value.
- * @retval #SERVICE_ERROR_NONE Successful
- * @retval #SERVICE_ERROR_INVALID_PARAMETER Invalid parameter
- * @retval #SERVICE_ERROR_OUT_OF_MEMORY Out of memory
- */
-int service_is_reply_requested(service_h service, bool *requested);
-
-
-int service_request_transient_app(service_h service, unsigned int callee_id, service_host_res_fn cbfunc, void *data);
-
-/**
- * @}
- */
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif /* __TIZEN_APPFW_SERVICE_H__ */
+++ /dev/null
-/*
- * Copyright (c) 2011 Samsung Electronics Co., Ltd All Rights Reserved
- *
- * 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 __TIZEN_APPFW_SERVICE_PRIVATE_H__
-#define __TIZEN_APPFW_SERVICE_PRIVATE_H__
-
-#include <bundle.h>
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-int service_create_request(bundle *data, service_h *service);
-
-int service_create_event(bundle *data, service_h *service);
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif /* __TIZEN_APPFW_SERVICE_PRIVATE_H__ */
+++ /dev/null
-/*
- * Copyright (c) 2011 Samsung Electronics Co., Ltd All Rights Reserved
- *
- * 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 __TIZEN_APPFW_STORAGE_H__
-#define __TIZEN_APPFW_STORAGE_H__
-
-#include <tizen.h>
-
-#ifdef __cplusplus
-extern "C"
-{
-#endif
-
- /**
- * @addtogroup CAPI_STORAGE_MODULE
- * @{
- */
-
-
-/**
- * @brief Enumerations of error code for Storage.
- */
-typedef enum
-{
- STORAGE_ERROR_NONE = TIZEN_ERROR_NONE, /**< Successful */
- STORAGE_ERROR_INVALID_PARAMETER = TIZEN_ERROR_INVALID_PARAMETER, /**< Invalid parameter */
- STORAGE_ERROR_OUT_OF_MEMORY = TIZEN_ERROR_OUT_OF_MEMORY, /**< Out of memory */
- STORAGE_ERROR_NOT_SUPPORTED = TIZEN_ERROR_NO_SUCH_DEVICE /**< Not supported storage */
-} storage_error_e;
-
-
-/**
- * @brief Enumerations of the storage type.
- */
-typedef enum
-{
- STORAGE_TYPE_INTERNAL, /**< Internal device storage (built-in storage in a device, non-removable) */
- STORAGE_TYPE_EXTERNAL, /**< External storage */
-} storage_type_e;
-
-
-/**
- * @brief Enumerations of the state of storage device.
- */
-typedef enum
-{
- STORAGE_STATE_UNMOUNTABLE = -2, /**< Storage is present but cannot be mounted. Typically it happens if the file system of the storage is corrupted. */
- STORAGE_STATE_REMOVED = -1, /**< Storage is not present. */
- STORAGE_STATE_MOUNTED = 0, /**< Storage is present and mounted with read/write access. */
- STORAGE_STATE_MOUNTED_READ_ONLY = 1, /**< Storage is present and mounted with read only access. */
-} storage_state_e;
-
-
-/**
-* @brief Called to get information once for each supported storage.
-*
-* @param [in] storage The unique storage ID
-* @param [in] type The type of the storage
-* @param [in] state The current state of the storage
-* @param [in] path The absolute path to the root directory of the @a storage
-* @param [in] user_data The user data passed from the foreach function
-* @return @c true to continue with the next iteration of the loop, \n @c false to break out of the loop.
-* @pre storage_foreach_device_supported() will invoke this callback function.
-* @see storage_foreach_device_supported()
-*/
-typedef bool (*storage_device_supported_cb)(int storage, storage_type_e type, storage_state_e state, const char *path, void *user_data);
-
-
-/**
-* @brief Called when the state of storage changes
-*
-* @param [in] storage The unique storage ID
-* @param [in] state The current state of the storage
-* @param [in] user_data The user data passed from the foreach function
-* @pre storage_set_state_changed_cb() will invoke this callback function.
-* @see storage_set_state_changed_cb()
-* @see storage_unset_state_changed_cb()
-*/
-typedef void (*storage_state_changed_cb)(int storage, storage_state_e state, void *user_data);
-
-
-/**
- * @brief Retrieves all storage in device.
- * @details This function invokes the callback function once for each @a storage in device. \n
- * If storage_device_supported_cb() returns @c false, then iteration will be finished.
- *
- * @param [in] callback The iteration callback function
- * @param [in] user_data The user data to be passed to the callback function
- * @return 0 on success, otherwise a negative error value.
- * @retval #STORAGE_ERROR_NONE Successful
- * @retval #STORAGE_ERROR_INVALID_PARAMETER Invalid parameter
- * @post This function invokes storage_device_supported_cb() repeatedly for each supported device.
- * @see storage_device_supported_cb()
- */
-int storage_foreach_device_supported(storage_device_supported_cb callback, void *user_data);
-
-
-/**
- * @brief Gets the absolute path to the root directory of the given @a storage.
- * @details
- * Files saved on the internal/external storage are readable or writeable by all applications.
- * When an application is uninstalled, the files written by that application are not removed from the internal/external storage.
- *
- * @remarks @a path must be released with free() by you.
- *
- * @param[in] storage The storage device
- * @param[out] path The absolute path to the storage directory
- * @return 0 on success, otherwise a negative error value.
- * @retval #STORAGE_ERROR_NONE Successful
- * @retval #STORAGE_ERROR_INVALID_PARAMETER Invalid parameter
- * @retval #STORAGE_ERROR_OUT_OF_MEMORY Out of memory
- * @retval #STORAGE_ERROR_NOT_SUPPORTED Not supported storage
- * @see storage_get_state()
- */
-int storage_get_root_directory(int storage, char **path);
-
-
-/**
- * @brief Gets the type of the given @a storage.
- *
- * @param[in] storage The storage device
- * @param[out] type The type of the storage
- * @return 0 on success, otherwise a negative error value.
- * @retval #STORAGE_ERROR_NONE Successful
- * @retval #STORAGE_ERROR_INVALID_PARAMETER Invalid parameter
- * @retval #STORAGE_ERROR_NOT_SUPPORTED Not supported storage
- */
-int storage_get_type(int storage, storage_type_e *type);
-
-
-/**
- * @brief Gets the current state of the given @a storage.
- *
- * @param[in] storage The storage device
- * @param[out] state The current state of the storage,
- * @return 0 on success, otherwise a negative error value.
- * @retval #STORAGE_ERROR_NONE Successful
- * @retval #STORAGE_ERROR_INVALID_PARAMETER Invalid parameter
- * @retval #STORAGE_ERROR_NOT_SUPPORTED Not supported storage
- * @see storage_get_root_directory()
- * @see storage_get_total_space()
- * @see storage_get_available_space()
- */
-int storage_get_state(int storage, storage_state_e *state);
-
-
-/**
- * @brief Registers a callback function to be invoked when the state of the storage changes.
- *
- * @param[in] storage The storage device
- * @param[in] callback The callback function to register
- * @param[in] user_data The user data to be passed to the callback function
- * @return 0 on success, otherwise a negative error value.
- * @retval #STORAGE_ERROR_NONE Successful
- * @retval #STORAGE_ERROR_INVALID_PARAMETER Invalid parameter
- * @retval #STORAGE_ERROR_NOT_SUPPORTED Not supported storage
- * @post storage_state_changed_cb() will be invoked if the state of registered storage changes.
- * @see storage_state_changed_cb()
- * @see storage_unset_state_changed_cb()
- */
-int storage_set_state_changed_cb(int storage, storage_state_changed_cb callback, void *user_data);
-
-
-/**
- * @brief Unregisters the callback function.
- *
- * @param [in] storage The storage device to monitor
- * @return 0 on success, otherwise a negative error value.
- * @retval #STORAGE_ERROR_NONE Successful
- * @retval #STORAGE_ERROR_NOT_SUPPORTED Not supported storage
- * @see storage_state_changed_cb()
- * @see storage_set_state_changed_cb()
- */
-int storage_unset_state_changed_cb(int storage);
-
-/**
- * @brief Gets the total space of the given @a storage in bytes.
- *
- * @param[in] storage The storage device
- * @param[out] bytes The total space size of the storage (bytes)
- * @return 0 on success, otherwise a negative error value
- * @retval #STORAGE_ERROR_NONE Successful
- * @retval #STORAGE_ERROR_INVALID_PARAMETER Invalid parameter
- * @retval #STORAGE_ERROR_NOT_SUPPORTED Not supported storage
- * @see storage_get_state()
- * @see storage_get_available_space()
- */
-int storage_get_total_space(int storage, unsigned long long *bytes);
-
-/**
- * @brief Gets the available space size of the given @a storage in bytes.
- *
- * @param[in] storage The storage device
- * @param[out] bytes The available space size of the storage (bytes)
- * @return 0 on success, otherwise a negative error value.
- * @retval #STORAGE_ERROR_NONE Successful
- * @retval #STORAGE_ERROR_INVALID_PARAMETER Invalid parameter
- * @retval #STORAGE_ERROR_NOT_SUPPORTED Not supported storage
-
- * @see storage_get_state()
- * @see storage_get_total_space()
- */
-int storage_get_available_space(int storage, unsigned long long *bytes);
-
-/**
- * @}
- */
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif /* __TIZEN_APPFW_STORAGE_H__ */
+++ /dev/null
-/*
- * Copyright (c) 2011 Samsung Electronics Co., Ltd All Rights Reserved
- *
- * 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 __TIZEN_APPFW_STORAGE_PRIVATE_H__
-#define __TIZEN_APPFW_STORAGE_PRIVATE_H__
-
-#include <tizen.h>
-
-#ifdef __cplusplus
-extern "C"
-{
-#endif
-
-typedef int (*storage_dev_get_state)(void);
-typedef int (*storage_dev_set_state_cb)(void *data);
-typedef void (*storage_dev_unset_state_cb)(void);
-typedef int (*storage_dev_get_space)(unsigned long long *total, unsigned long long *available);
-
-typedef struct storage_device_s
-{
- storage_type_e type;
- char *path;
- storage_dev_get_state get_state;
- storage_dev_set_state_cb set_state_cb;
- storage_dev_unset_state_cb unset_state_cb;
- storage_dev_get_space get_space;
-} *storage_device_h;
-
-typedef struct storage_info_s
-{
- int id;
- storage_device_h device;
- storage_state_e state;
- storage_state_changed_cb state_cb;
- void *state_cb_data;
-} *storage_info_h;
-
-void storage_dispatch_state_event(storage_state_e state, void* data);
-
-int storage_statfs(const char *directory, unsigned long long *total, unsigned long long *available);
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif /* __TIZEN_APPFW_STORAGE_PRIVATE_H__ */
--- /dev/null
+/*
+ * Copyright (c) 2011 Samsung Electronics Co., Ltd All Rights Reserved
+ *
+ * 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 __TIZEN_APPFW_APP_TYPES_H__
+#define __TIZEN_APPFW_APP_TYPES_H__
+
+#include <tizen.h>
+
+/**
+ * @file app_types.h
+ */
+
+/**
+ * @addtogroup CAPI_APPLICATION_MODULE
+ * @{
+ */
+
+/**
+ * @brief Enumeration for application error.
+ * @since_tizen 2.3
+ */
+
+typedef enum
+{
+ APP_ERROR_NONE = TIZEN_ERROR_NONE, /**< Successful */
+ APP_ERROR_INVALID_PARAMETER = TIZEN_ERROR_INVALID_PARAMETER, /**< Invalid parameter */
+ APP_ERROR_OUT_OF_MEMORY = TIZEN_ERROR_OUT_OF_MEMORY, /**< Out of memory */
+ APP_ERROR_INVALID_CONTEXT = TIZEN_ERROR_APPLICATION | 0x01, /**< Invalid application context */
+ APP_ERROR_NO_SUCH_FILE = TIZEN_ERROR_NO_SUCH_FILE, /**< No such file or directory */
+ APP_ERROR_ALREADY_RUNNING = TIZEN_ERROR_ALREADY_IN_PROGRESS, /**< Application is already running */
+} app_error_e;
+
+/**
+ * @}
+ */
+
+#endif /* __TIZEN_APPFW_APP_TYPES_H__ */
+++ /dev/null
-/*
- * Copyright (c) 2011 Samsung Electronics Co., Ltd All Rights Reserved
- *
- * 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 __TIZEN_APPFW_UI_NOTIFICATION_H__
-#define __TIZEN_APPFW_UI_NOTIFICATION_H__
-
-#include <tizen.h>
-#include <time.h>
-#include <app_service.h>
-
-#ifdef __cplusplus
-extern "C"
-{
-#endif
-
- /**
- * @addtogroup CAPI_UI_NOTIFICATION_MODULE
- * @{
- */
-
-/**
- * @brief Notification handle.
- */
-typedef struct ui_notification_s *ui_notification_h;
-
-/**
- * @brief Enumerations of error code for notification.
- */
-typedef enum {
- UI_NOTIFICATION_ERROR_NONE = TIZEN_ERROR_NONE, /**< Successful */
- UI_NOTIFICATION_ERROR_INVALID_PARAMETER = TIZEN_ERROR_INVALID_PARAMETER, /**< Invalid parameter */
- UI_NOTIFICATION_ERROR_OUT_OF_MEMORY = TIZEN_ERROR_OUT_OF_MEMORY, /**< Out of memory */
- UI_NOTIFICATION_ERROR_DB_FAILED = TIZEN_ERROR_APPLICATION_CLASS | 0x31, /**< DB operation failed */
- UI_NOTIFICATION_ERROR_NO_SUCH_FILE = TIZEN_ERROR_NO_SUCH_FILE, /**< No such file */
- UI_NOTIFICATION_ERROR_INVALID_STATE = TIZEN_ERROR_APPLICATION_CLASS | 0x32, /**< Invalid state */
-} ui_notification_error_e;
-
-/**
- * @brief Enumeration of progress type for ongoing notification
- */
-typedef enum {
- UI_NOTIFICATION_PROGRESS_TYPE_SIZE, /**< Size in bytes */
- UI_NOTIFICATION_PROGRESS_TYPE_PERCENTAGE, /**< Percentage (between 0.0 and 1.0) */
-} ui_notification_progress_type_e;
-
-/**
-* @brief Called to retrieve the notifications posted.
-* @remarks You should not free @a notification returned by this function.
-* @param[in] notification The notification handle
-* @param[in] user_data The user data passed from the foreach function
-* @return @c true to continue with the next iteration of the loop, \n @c false to break out of the loop.
-* @pre ui_notification_foreach_notification_posted() will invoke this callback.
-* @see ui_notification_foreach_notification_posted()
-* @see ui_notification_clone()
-*/
-typedef bool (*ui_notification_cb)(ui_notification_h notification, void *user_data);
-
-/**
- * @brief Creates a notification handle.
- * @remarks The @a notification must be released with ui_notification_destroy() by you.
- * @param[in] ongoing A boolean value that sets whether this is an ongoing notification.
- * @param[out] notification A UI notification handle to be newly created on success
- * @return 0 on success, otherwise a negative error value.
- * @retval #UI_NOTIFICATION_ERROR_NONE Successful
- * @retval #UI_NOTIFICATION_ERROR_INVALID_PARAMETER Invalid parameter
- * @retval #UI_NOTIFICATION_ERROR_OUT_OF_MEMORY Out of memory
- * @see ui_notification_destroy()
- */
-int ui_notification_create(bool ongoing, ui_notification_h *notification);
-
-/**
- * @brief Destroys the notification handle and releases all its resources.
- * @param[in] notification The notification handle
- * @return 0 on success, otherwise a negative error value.
- * @retval #UI_NOTIFICATION_ERROR_NONE Successful
- * @retval #UI_NOTIFICATION_ERROR_INVALID_PARAMETER Invalid parameter
- * @see ui_notification_create()
- */
-int ui_notification_destroy(ui_notification_h notification);
-
-/**
- * @brief Gets the identifier of the notification unique within the application
- * @remarks The system assigns an unique identifier to the notification when it is posted. \n
- * This function returns #UI_NOTIFICATION_ERROR_INVALID_STATE if the notification was not posted.
- * @param[in] notification The notification handle
- * @param[out] id The identifier for the notification unique within the application.
- * @return 0 on success, otherwise a negative error value.
- * @retval #UI_NOTIFICATION_ERROR_NONE Successful
- * @retval #UI_NOTIFICATION_ERROR_INVALID_PARAMETER Invalid parameter
- * @retval #UI_NOTIFICATION_ERROR_OUT_OF_MEMORY Out of memory
- * @retval #UI_NOTIFICATION_ERROR_INVALID_STATE The notification was not posted.
- * @see ui_notification_post()
- */
-int ui_notification_get_id(ui_notification_h notification, int *id);
-
-/**
- * @brief Checks whether the notification is ongoing or not
- * @param[in] notification The notification handle
- * @param[out] ongoing A boolean value that sets whether this is an ongoing notification.
- * @return 0 on success, otherwise a negative error value.
- * @retval #UI_NOTIFICATION_ERROR_NONE Successful
- * @retval #UI_NOTIFICATION_ERROR_INVALID_PARAMETER Invalid parameter
- * @see ui_notification_create()
- */
-int ui_notification_is_ongoing(ui_notification_h notification, bool *ongoing);
-
-/**
- * @brief Sets the full path of the icon image to display in the notification.
- * @remarks The @a path should be the absolute path. If the icon is not set, the icon of the application will be displayed. \n
- * This function should be called before posting or updating the notification (see ui_notification_post(), ui_notification_update()).
- * @param[in] notification The notification handle
- * @param[in] path The absolute path to the specified icon \n
- * If the @a path is NULL, it clears the previous value.
- * @return 0 on success, otherwise a negative error value.
- * @retval #UI_NOTIFICATION_ERROR_NONE Successful
- * @retval #UI_NOTIFICATION_ERROR_INVALID_PARAMETER Invalid parameter
- * @retval #UI_NOTIFICATION_ERROR_OUT_OF_MEMORY Out of memory
- * @see ui_notification_get_icon()
- */
-int ui_notification_set_icon(ui_notification_h notification, const char *path);
-
-/**
- * @brief Gets the absolute path to the icon to display in the notification.
- * @remarks The @a path must be released with free() by you.
- * @param[in] notification The notification handle
- * @param[out] path The absolute path to the icon
- * @return 0 on success, otherwise a negative error value.
- * @retval #UI_NOTIFICATION_ERROR_NONE Successful
- * @retval #UI_NOTIFICATION_ERROR_INVALID_PARAMETER Invalid parameter
- * @retval #UI_NOTIFICATION_ERROR_OUT_OF_MEMORY Out of memory
- * @see ui_notification_set_icon()
- */
-int ui_notification_get_icon(ui_notification_h notification, char **path);
-
-/**
- * @brief Sets the time that the notification occurred.
- * @remarks This function should be called before posting or updating the notification (see ui_notification_post(), ui_notification_update()).
- * @param[in] notification The notification handle
- * @param[in] time The time that the notification occurred \n
- * If the @a time is NULL, it clears the previous value.
- * @return 0 on success, otherwise a negative error value.
- * @retval #UI_NOTIFICATION_ERROR_NONE Successful
- * @retval #UI_NOTIFICATION_ERROR_INVALID_PARAMETER Invalid parameter
- * @retval #UI_NOTIFICATION_ERROR_OUT_OF_MEMORY Out of memory
- * @see ui_notification_get_time()
- */
-int ui_notification_set_time(ui_notification_h notification, struct tm *time);
-
-/**
- * @brief Gets the time that the notification occured.
- * @param[in] notification The notification handle
- * @param[out] time The time that the notification occured
- * @return 0 on success, otherwise a negative error value.
- * @retval #UI_NOTIFICATION_ERROR_NONE Successful
- * @retval #UI_NOTIFICATION_ERROR_INVALID_PARAMETER Invalid parameter
- * @retval #UI_NOTIFICATION_ERROR_OUT_OF_MEMORY Out of memory
- * @see ui_notification_set_time()
- */
-int ui_notification_get_time(ui_notification_h notification, struct tm **time);
-
-/**
- * @brief Sets the title to display in the notification.
- * @remarks If the title is not set, the name of the application will be displayed. \n
- * This function should be called before posting or updating the notification (see ui_notification_post(), ui_notification_update()).
- * @param[in] notification The notification handle
- * @param[in] title The title to display in the notification \n
- * If the @a title is NULL, it clears the previous value.
- * @return 0 on success, otherwise a negative error value.
- * @retval #UI_NOTIFICATION_ERROR_NONE Successful
- * @retval #UI_NOTIFICATION_ERROR_INVALID_PARAMETER Invalid parameter
- * @retval #UI_NOTIFICATION_ERROR_OUT_OF_MEMORY Out of memory
- * @see ui_notification_get_title()
- */
-int ui_notification_set_title(ui_notification_h notification, const char *title);
-
-/**
- * @brief Gets the title to display in the notification.
- * @remarks The @a title must be released with free() by you.
- * @param[in] notification The notification handle
- * @param[out] title The title to display in the notification
- * @return 0 on success, otherwise a negative error value.
- * @retval #UI_NOTIFICATION_ERROR_NONE Successful
- * @retval #UI_NOTIFICATION_ERROR_INVALID_PARAMETER Invalid parameter
- * @retval #UI_NOTIFICATION_ERROR_OUT_OF_MEMORY Out of memory
- * @see ui_notification_set_title()
- */
-int ui_notification_get_title(ui_notification_h notification, char **title);
-
-/**
- * @brief Sets the content to display in the notification
- * @remarks This function should be called before posting or updating the notification (see ui_notification_post(), ui_notification_update()).
- * @param[in] notification The notification handle
- * @param[in] content The content to display in the notification \n
- * If the @a content is NULL, it clears the previous value.
- * @return 0 on success, otherwise a negative error value.
- * @retval #UI_NOTIFICATION_ERROR_NONE Successful
- * @retval #UI_NOTIFICATION_ERROR_INVALID_PARAMETER Invalid parameter
- * @retval #UI_NOTIFICATION_ERROR_OUT_OF_MEMORY Out of memory
- * @see ui_notification_get_content()
- */
-int ui_notification_set_content(ui_notification_h notification, const char *content);
-
-/**
- * @brief Gets the content to display in the notification
- * @remarks The @a content must be released with free() by you.
- * @param[in] notification The notification handle
- * @param[out] content The content to display in the notification
- * @return 0 on success, otherwise a negative error value.
- * @retval #UI_NOTIFICATION_ERROR_NONE Successful
- * @retval #UI_NOTIFICATION_ERROR_INVALID_PARAMETER Invalid parameter
- * @retval #UI_NOTIFICATION_ERROR_OUT_OF_MEMORY Out of memory
- * @see ui_notification_set_content()
- */
-int ui_notification_get_content(ui_notification_h notification, char **content);
-
-/**
- * @brief Sets the path of sound file to play when the notification is shown.
- * @remarks The @a path should be the absolute path. \n
- * The sound file is only supported wave file format. \n
- * This function should be called before posting or updating the notification (see ui_notification_post(), ui_notification_update()).
- * @param[in] notification The notification handle
- * @param[in] path The path of sound file to play when the notification is shown \n
- * If the @a path is NULL, it clears the previous value.
- * @return 0 on success, otherwise a negative error value.
- * @retval #UI_NOTIFICATION_ERROR_NONE Successful
- * @retval #UI_NOTIFICATION_ERROR_INVALID_PARAMETER Invalid parameter
- * @retval #UI_NOTIFICATION_ERROR_OUT_OF_MEMORY Out of memory
- * @see ui_notification_get_sound()
- */
-int ui_notification_set_sound(ui_notification_h notification, const char *path);
-
-/**
- * @brief Gets the path of sound file to play when the notification is shown.
- * @remarks The @a path must be released with free() by you.
- * @param[in] notification The notification handle
- * @param[out] path The path of sound file to play when the notification is shown \n
- * @return 0 on success, otherwise a negative error value.
- * @retval #UI_NOTIFICATION_ERROR_NONE Successful
- * @retval #UI_NOTIFICATION_ERROR_INVALID_PARAMETER Invalid parameter
- * @retval #UI_NOTIFICATION_ERROR_OUT_OF_MEMORY Out of memory
- * @see ui_notification_set_sound()
- */
-int ui_notification_get_sound(ui_notification_h notification, char **path);
-
-/**
- * @brief Sets whether to use vibration when the notification is shown.
- * @remarks This function should be called before posting or updating the notification (see ui_notification_post(), ui_notification_update()).
- * @param[in] notification The notification handle
- * @param[in] value A boolean value that sets whether to use vibration.
- * @return 0 on success, otherwise a negative error value.
- * @retval #UI_NOTIFICATION_ERROR_NONE Successful
- * @retval #UI_NOTIFICATION_ERROR_INVALID_PARAMETER Invalid parameter
- * @retval #UI_NOTIFICATION_ERROR_OUT_OF_MEMORY Out of memory
- * @see ui_notification_get_vibration()
- */
-int ui_notification_set_vibration(ui_notification_h notification, bool value);
-
-/**
- * @brief Gets whether to use vibration when the notification is shown.
- * @param[in] notification The notification handle
- * @param[out] value A boolean value that sets whether to use vibration.
- * @return 0 on success, otherwise a negative error value.
- * @retval #UI_NOTIFICATION_ERROR_NONE Successful
- * @retval #UI_NOTIFICATION_ERROR_INVALID_PARAMETER Invalid parameter
- * @retval #UI_NOTIFICATION_ERROR_OUT_OF_MEMORY Out of memory
- * @see ui_notification_set_vibration()
- */
-int ui_notification_get_vibration(ui_notification_h notification, bool *value);
-
-/**
- * @brief Sets the service to launch when the notification is selected from the notification tray.
- * @details When the notification is selected from the notification tray, the application which is described by the specified service is launched. \n
- * If you want to launch the current application, use the explicit launch of the @ref CAPI_SERVICE_MODULE API
- * @remarks If the service is not set, the selected notification will be cleared from both the notification tray and the status bar without any action. \n
- * This function should be called before posting or updating the notification (see ui_notification_post(), ui_notification_update()).
- * @param[in] notification The notification handle
- * @param[in] service The service handle to launch when the notification is selected \n
- * If the @a service is NULL, it clears the previous value.
- * @return 0 on success, otherwise a negative error value.
- * @retval #UI_NOTIFICATION_ERROR_NONE Successful
- * @retval #UI_NOTIFICATION_ERROR_INVALID_PARAMETER Invalid parameter
- * @retval #UI_NOTIFICATION_ERROR_OUT_OF_MEMORY Out of memory
- * @see ui_notification_get_service()
- * @see service_create()
- */
-int ui_notification_set_service(ui_notification_h notification, service_h service);
-
-/**
- * @brief Gets the service to launch when the notification is selected from the notification tray
- * @remarks The @a service must be released with service_destroy() by you.
- * @param[in] notification The notification handle
- * @param[out] service The service handle to launch when the notification is selected
- * @return 0 on success, otherwise a negative error value.
- * @retval #UI_NOTIFICATION_ERROR_NONE Successful
- * @retval #UI_NOTIFICATION_ERROR_INVALID_PARAMETER Invalid parameter
- * @retval #UI_NOTIFICATION_ERROR_OUT_OF_MEMORY Out of memory
- * @see ui_notification_set_service()
- */
-int ui_notification_get_service(ui_notification_h notification, service_h *service);
-
-/**
- * @brief Posts the notification to display in the notification tray and the status bar
- * @param[in] notification The notification handle
- * @return 0 on success, otherwise a negative error value.
- * @retval #UI_NOTIFICATION_ERROR_NONE Successful
- * @retval #UI_NOTIFICATION_ERROR_INVALID_PARAMETER Invalid parameter
- * @retval #UI_NOTIFICATION_ERROR_DB_FAILED DB failed
- * @retval #UI_NOTIFICATION_ERROR_NO_SUCH_FILE DB No such icon file
- * @retval #UI_NOTIFICATION_ERROR_INVALID_STATE The notification was already posted
- * @post The posted notification can be canceled or updated.
- * @see ui_notification_cancel()
- * @see ui_notification_cancel_all()
- * @see ui_notification_update()
- * @see ui_notification_update_progress()
- * @see ui_notification_foreach_notification_posted()
- */
-int ui_notification_post(ui_notification_h notification);
-
-/**
- * @brief Cancels the previously posted notification.
- * @details The previously posted notification is removed from the notification tray and the status bar.
- * @remarks The canceled @a notification is not be released automatically, must be released with ui_notification_destroy() by you.
- * @param[in] notification The notification handle
- * @return 0 on success, otherwise a negative error value.
- * @retval #UI_NOTIFICATION_ERROR_NONE Successful
- * @retval #UI_NOTIFICATION_ERROR_INVALID_PARAMETER Invalid parameter
- * @retval #UI_NOTIFICATION_ERROR_INVALID_STATE The notification was not posted or the notification was either cleared or canceled.
- * @pre The notification must be posted before canceling it.
- * @see ui_notification_post()
- * @see ui_notification_cancel_all()
- */
-int ui_notification_cancel(ui_notification_h notification);
-
-/**
- * @brief Cancels all previously posted notifications by the current application.
- * @details All previously posted notifications are removed from the notification tray and the status bar.
- * @remarks The notifications posted by other applications are not canceled from the notification tray and the status bar.
- * @see ui_notification_post()
- * @see ui_notification_cancel()
- */
-void ui_notification_cancel_all(void);
-
-/**
- * @brief Cancels selected type of previously posted notifications by the current application.
- * @details Selected type of previously posted notifications are removed from the notification tray and the status bar.
- * @remarks The notifications posted by other applications are not cancelled from the notification tray and the status bar.
- * @param[in] ongoing A boolean value that indicates whether the notification type is ongoing to cancel.
- * @see ui_notification_post()
- * @see ui_notification_cancel()
- * @see ui_notification_cancel_all()
- */
-void ui_notification_cancel_all_by_type(bool ongoing);
-
-/**
- * @brief Cancels selected type of previously posted notifications by the given application.
- * @details Selected type of previously posted notifications are removed from the notification tray and the status bar.
- * @remark This function is @b deprecated. Use app_manager_app_context_cb() instead.
- * @param[in] package The package name of the application to calcel the posted notifications.
- * @param[in] ongoing A boolean value that indicates whether the notification type is ongoing to cancel.
- * @see ui_notification_post()
- * @see ui_notification_cancel()
- * @see ui_notification_cancel_all()
- */
-void ui_notification_cancel_all_by_package(const char *package, bool ongoing);
-
-/**
- * @brief Cancels selected type of previously posted notifications by the given application ID.
- * @details Selected type of previously posted notifications are removed from the notification tray and the status bar.
- * @param[in] id The ID of the application to calcel the posted notifications.
- * @param[in] ongoing A boolean value that indicates whether the notification type is ongoing to cancel.
- * @return 0 on success, otherwise a negative error value.
- * @retval #UI_NOTIFICATION_ERROR_NONE Successful
- * @retval #UI_NOTIFICATION_ERROR_INVALID_PARAMETER Invalid parameter
- * @see ui_notification_post()
- * @see ui_notification_cancel()
- * @see ui_notification_cancel_all()
- */
-int ui_notification_cancel_all_by_app_id(const char *app_id, bool ongoing);
-
-/**
- * @brief Updates the notification posted.
- * @remarks You cannot update the notification which was cleared or canceled.
- * @param[in] notification The notification handle
- * @return 0 on success, otherwise a negative error value.
- * @retval #UI_NOTIFICATION_ERROR_NONE Successful
- * @retval #UI_NOTIFICATION_ERROR_INVALID_PARAMETER Invalid parameter
- * @retval #UI_NOTIFICATION_ERROR_DB_FAILED DB failed
- * @retval #UI_NOTIFICATION_ERROR_NO_SUCH_FILE DB No such icon file
- * @retval #UI_NOTIFICATION_ERROR_INVALID_STATE The notification was not posted or the notification was either cleared or canceled.
- * @pre The notification must be posted before updating it.
- * @see ui_notification_post()
- * @see ui_notification_update_progress()
- */
-int ui_notification_update(ui_notification_h notification);
-
-/**
- * @brief Updates the progress to the specified value
- * @remarks You cannot update the notification which was cleared or canceled.
- * @param[in] notification The notification handle \n
- * It must be ongoing notification. \n
- * If not, #UI_NOTIFICATION_ERROR_INVALID_PARAMETER will occur
- * @param[in] type The progress type
- * @param[in] value The value of the progress \n
- * The @a value must be greater than or equal to zero. \n
- * if @a type is #UI_NOTIFICATION_PROGRESS_TYPE_SIZE, it must be in bytes. \n
- * If @a type is #UI_NOTIFICATION_PROGRESS_TYPE_PERCENTAGE, It must be a floating-point value between 0.0 and 1.0.
- * @return 0 on success, otherwise a negative error value.
- * @retval #UI_NOTIFICATION_ERROR_NONE Successful
- * @retval #UI_NOTIFICATION_ERROR_INVALID_PARAMETER Invalid parameter
- * @retval #UI_NOTIFICATION_ERROR_INVALID_STATE The notification was not posted or the notification was canceled.
- * @pre The notification must be posted before updating the progress to the specified value
- * @see ui_notification_create()
- * @see ui_notification_post()
- * @see ui_notification_update()
- * @see #ui_notification_progress_type_e
- */
-int ui_notification_update_progress(ui_notification_h notification, ui_notification_progress_type_e type, double value);
-
-/**
- * @brief Retrieves all posted notifications.
- * @details This function calls ui_notification_cb() once for each notification which was posted and is being shown. \n
- * If ui_notification_cb() callback function returns false, then iteration will be finished.
- *
- * @param [in] ongoing A boolean value that sets whether the type is an ongoing notification.
- * @param [in] callback The iteration callback function
- * @param [in] user_data The user data to be passed to the callback function
- * @return 0 on success, otherwise a negative error value.
- * @retval #UI_NOTIFICATION_ERROR_NONE Successful
- * @retval #UI_NOTIFICATION_ERROR_INVALID_PARAMETER Invalid parameter
- * @post This function invokes ui_notification_cb().
- * @see ui_notification_cb()
- */
-int ui_notification_foreach_notification_posted(bool ongoing, ui_notification_cb callback, void *user_data);
-
-/**
- * @brief Creates and returns a copy of the given notification handle.
- *
- * @remarks A newly created notification handle should be destroyed by calling ui_notification_destroy() if it is no longer needed.
- *
- * @param [out] clone If successful, a newly created notification handle will be returned.
- * @param [in] service The notification handle
- * @return 0 on success, otherwise a negative error value.
- * @retval #UI_NOTIFICATION_ERROR_NONE Successful
- * @retval #UI_NOTIFICATION_ERROR_INVALID_PARAMETER Invalid parameter
- * @retval #UI_NOTIFICATION_ERROR_OUT_OF_MEMORY Out of memory
- * @see ui_notification_create()
- * @see ui_notification_destroy()
- */
-int ui_notification_clone(ui_notification_h *clone, ui_notification_h notification);
-
-
-/**
- * @}
- */
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif /* __TIZEN_APPFW_UI_NOTIFICATION_H__ */
-#sbs-git:slp/api/application capi-appfw-application 0.1.0 56d9b8e057f022f0e7fdb1853587158452e7ae1b
Name: capi-appfw-application
Summary: An Application library in SLP C API
-Version: 0.1.6
+Version: 0.3.1.0
Release: 1
-VCS: magnolia/framework/api/application#capi-appfw-application_0.1.0-53-20-g4359a4ce7206e0e16621da84f22312c45b6489ce
-Group: TO_BE/FILLED_IN
-License: TO BE FILLED IN
+Group: Application Framework/Libraries
+License: Apache-2.0
Source0: %{name}-%{version}.tar.gz
BuildRequires: cmake
BuildRequires: pkgconfig(dlog)
BuildRequires: pkgconfig(aul)
BuildRequires: pkgconfig(ail)
BuildRequires: pkgconfig(appsvc)
-BuildRequires: pkgconfig(notification)
BuildRequires: pkgconfig(elementary)
BuildRequires: pkgconfig(alarm-service)
BuildRequires: pkgconfig(capi-base-common)
BuildRequires: pkgconfig(sqlite3)
+BuildRequires: pkgconfig(capi-security-privilege-manager)
+BuildRequires: pkgconfig(pkgmgr-info)
+BuildRequires: pkgconfig(vconf-internal-keys)
-
-Requires(post): /sbin/ldconfig
+Requires(post): /sbin/ldconfig
Requires(postun): /sbin/ldconfig
+%define feature_appfw_process_pool 1
+
%description
An Application library in SLP C API
%setup -q
%build
-MAJORVER=`echo %{version} | awk 'BEGIN {FS="."}{print $1}'`
-cmake . -DCMAKE_INSTALL_PREFIX=/usr -DFULLVER=%{version} -DMAJORVER=${MAJORVER}
+%if 0%{?feature_appfw_process_pool}
+ _APPFW_FEATURE_PROCESS_POOL=ON
+%endif
+MAJORVER=`echo %{version} | awk 'BEGIN {FS="."}{print $1}'`
+cmake . -DCMAKE_INSTALL_PREFIX=/usr -DFULLVER=%{version} -DMAJORVER=${MAJORVER} \
+ -D_APPFW_FEATURE_PROCESS_POOL:BOOL=${_APPFW_FEATURE_PROCESS_POOL}
make %{?jobs:-j%jobs}
%files
%{_libdir}/libcapi-appfw-application.so.*
+%{_libdir}/libcapi-appfw-app-control.so.*
+%{_libdir}/libcapi-appfw-app-common.so.*
+%{_libdir}/libcapi-appfw-alarm.so.*
+%{_libdir}/libcapi-appfw-preference.so.*
%manifest capi-appfw-application.manifest
/usr/share/license/%{name}
%{_includedir}/appfw/*.h
%{_libdir}/pkgconfig/*.pc
%{_libdir}/libcapi-appfw-application.so
-
-
+%{_libdir}/libcapi-appfw-app-control.so
+%{_libdir}/libcapi-appfw-app-common.so
+%{_libdir}/libcapi-appfw-alarm.so
+%{_libdir}/libcapi-appfw-preference.so
--- /dev/null
+CMAKE_MINIMUM_REQUIRED(VERSION 2.6)
+SET(fw_name "capi-appfw-preference")
+
+PROJECT(${fw_name})
+
+SET(CMAKE_INSTALL_PREFIX /usr)
+SET(PREFIX ${CMAKE_INSTALL_PREFIX})
+
+SET(INC_DIR ${CMAKE_SOURCE_DIR}/include)
+INCLUDE_DIRECTORIES(${INC_DIR})
+
+SET(requires "dlog capi-base-common sqlite3")
+SET(pc_requires "capi-base-common capi-appfw-app-common")
+
+INCLUDE(FindPkgConfig)
+pkg_check_modules(${fw_name} REQUIRED ${requires})
+FOREACH(flag ${${fw_name}_CFLAGS})
+ SET(EXTRA_CFLAGS "${EXTRA_CFLAGS} ${flag}")
+ENDFOREACH(flag)
+
+SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${EXTRA_CFLAGS} -fPIC -Wall -Werror")
+SET(CMAKE_C_FLAGS_DEBUG "-O0 -g")
+
+IF("${ARCH}" STREQUAL "arm")
+ ADD_DEFINITIONS("-DTARGET")
+ENDIF("${ARCH}" STREQUAL "arm")
+
+ADD_DEFINITIONS("-DPREFIX=\"${CMAKE_INSTALL_PREFIX}\"")
+ADD_DEFINITIONS("-DSLP_DEBUG")
+
+SET(CMAKE_EXE_LINKER_FLAGS "-Wl,--as-needed -Wl,--rpath=/usr/lib")
+
+add_library(${fw_name} SHARED
+ preference.c
+ )
+
+TARGET_LINK_LIBRARIES(${fw_name} capi-appfw-app-common ${${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
+ FILES_MATCHING
+ PATTERN "*_private.h" EXCLUDE
+ PATTERN "${INC_DIR}/*.h"
+ )
+
+SET(PC_NAME ${fw_name})
+SET(PC_REQUIRED ${pc_requires})
+SET(PC_LDFLAGS -l${fw_name})
+
+CONFIGURE_FILE(
+ ${CMAKE_SOURCE_DIR}/capi-appfw-module.pc.in
+ ${CMAKE_SOURCE_DIR}/${fw_name}.pc
+ @ONLY
+)
+INSTALL(FILES ${CMAKE_SOURCE_DIR}/${fw_name}.pc DESTINATION lib/pkgconfig)
+
+
#include <string.h>
#include <sqlite3.h>
-#include <app_private.h>
+#include <dlog.h>
+#include <app_common.h>
+#include <app_internal.h>
#include <app_preference.h>
-#include <app_preference_private.h>
-
-#include <dlog.h>
+#include <app_preference_internal.h>
#ifdef LOG_TAG
#undef LOG_TAG
#endif
-#define LOG_TAG "CAPI_APPFW_APPLICATION_PREFERENCE"
+#define LOG_TAG "CAPI_APPFW_PREFERENCE"
#define DBG_MODE (1)
static sqlite3 *pref_db = NULL;
}
}
+static int _busy_handler(void *pData, int count)
+{
+ if(5 - count > 0) {
+ LOGD("Busy Handler Called! : PID(%d) / CNT(%d)\n", getpid(), count+1);
+ usleep((count+1)*100000);
+ return 1;
+ } else {
+ LOGD("Busy Handler will be returned SQLITE_BUSY error : PID(%d) \n", getpid());
+ return 0;
+ }
+}
+
static int _initialize(void)
{
- char data_path[TIZEN_PATH_MAX] = {0, };
+ char *data_path = NULL;
char db_path[TIZEN_PATH_MAX] = {0, };
int ret;
char *errmsg;
- if (app_get_data_directory(data_path, sizeof(data_path)) == NULL)
+ if ((data_path = app_get_data_path()) == NULL)
{
LOGE("IO_ERROR(0x%08x) : fail to get data directory", PREFERENCE_ERROR_IO_ERROR);
return PREFERENCE_ERROR_IO_ERROR;
}
snprintf(db_path, sizeof(db_path), "%s/%s", data_path, PREF_DB_NAME);
+ free(data_path);
ret = sqlite3_open(db_path, &pref_db);
if (ret != SQLITE_OK)
return PREFERENCE_ERROR_IO_ERROR;
}
+ ret = sqlite3_busy_handler(pref_db, _busy_handler, NULL);
+ if (ret != SQLITE_OK) {
+ LOGW("IO_ERROR(0x%08x) : fail to register busy handler(%s)\n", PREFERENCE_ERROR_IO_ERROR, sqlite3_errmsg(pref_db));
+ }
+
ret = sqlite3_exec(pref_db, "CREATE TABLE IF NOT EXISTS pref ( pref_key TEXT PRIMARY KEY, pref_type TEXT, pref_data TEXT)",
NULL, NULL, &errmsg);
if (ret != SQLITE_OK)
return PREFERENCE_ERROR_NONE;
}
-//static int _write_data(const char *key, preference_type_e type, const char *data)
static int _write_data(const char *key, const char *type, const char *data)
{
int ret;
- char *buf;
- char *errmsg;
+ char *buf = NULL;
bool exist = false;
+ sqlite3_stmt *stmt;
if (key == NULL || key[0] == '\0' || data == NULL)
{
// to use sqlite3_update_hook, we have to use INSERT/UPDATE operation instead of REPLACE operation
if (exist)
{
- buf = sqlite3_mprintf("UPDATE %s SET %s='%s', %s='%s' WHERE %s='%s';",
- PREF_TBL_NAME, PREF_F_TYPE_NAME, type, PREF_F_DATA_NAME, data, PREF_F_KEY_NAME, key);
+ buf = sqlite3_mprintf("UPDATE %s SET %s=?, %s=? WHERE %s=?;",
+ PREF_TBL_NAME, PREF_F_TYPE_NAME, PREF_F_DATA_NAME, PREF_F_KEY_NAME);
}
else
{
- buf = sqlite3_mprintf("INSERT INTO %s (%s, %s, %s) values (%Q, %Q, %Q);",
- PREF_TBL_NAME, PREF_F_KEY_NAME, PREF_F_TYPE_NAME, PREF_F_DATA_NAME, key, type, data);
+ buf = sqlite3_mprintf("INSERT INTO %s (%s, %s, %s) values (?, ?, ?);",
+ PREF_TBL_NAME, PREF_F_KEY_NAME, PREF_F_TYPE_NAME, PREF_F_DATA_NAME);
}
if (buf == NULL)
return PREFERENCE_ERROR_IO_ERROR;
}
- ret = sqlite3_exec(pref_db, buf, NULL, NULL, &errmsg);
- sqlite3_free(buf);
- if (ret != SQLITE_OK)
+ ret = sqlite3_prepare(pref_db, buf, strlen(buf), &stmt, NULL);
+ if (ret != SQLITE_OK) {
+ LOGE("IO_ERROR(0x%08x) : fail to prepare query (%d/%s)",
+ PREFERENCE_ERROR_IO_ERROR,
+ sqlite3_extended_errcode(pref_db),
+ sqlite3_errmsg(pref_db));
+ return PREFERENCE_ERROR_IO_ERROR;
+ }
+
+ if(exist)
{
- LOGE("IO_ERROR(0x%08x): fail to write data(%s)", PREFERENCE_ERROR_IO_ERROR, errmsg);
- sqlite3_free(errmsg);
+ ret = sqlite3_bind_text(stmt, 1, type, strlen(type), SQLITE_STATIC);
+ if(ret != SQLITE_OK) {
+ LOGE("IO_ERROR(0x%08x) : fail to bind(1) query (%d/%s)",
+ PREFERENCE_ERROR_IO_ERROR,
+ sqlite3_extended_errcode(pref_db),
+ sqlite3_errmsg(pref_db));
+ sqlite3_finalize(stmt);
+ return PREFERENCE_ERROR_IO_ERROR;
+ }
+ ret = sqlite3_bind_text(stmt, 2, data, strlen(data), SQLITE_STATIC);
+ if(ret != SQLITE_OK) {
+ LOGE("IO_ERROR(0x%08x) : fail to bind(2) query (%d/%s)",
+ PREFERENCE_ERROR_IO_ERROR,
+ sqlite3_extended_errcode(pref_db),
+ sqlite3_errmsg(pref_db));
+ sqlite3_finalize(stmt);
+ return PREFERENCE_ERROR_IO_ERROR;
+ }
+ ret = sqlite3_bind_text(stmt, 3, key, strlen(key), SQLITE_STATIC);
+ if(ret != SQLITE_OK) {
+ LOGE("IO_ERROR(0x%08x) : fail to bind(3) query (%d/%s)",
+ PREFERENCE_ERROR_IO_ERROR,
+ sqlite3_extended_errcode(pref_db),
+ sqlite3_errmsg(pref_db));
+ sqlite3_finalize(stmt);
+ return PREFERENCE_ERROR_IO_ERROR;
+ }
+ }
+ else
+ {
+ ret = sqlite3_bind_text(stmt, 1, key, strlen(key), SQLITE_STATIC);
+ if(ret != SQLITE_OK) {
+ LOGE("IO_ERROR(0x%08x) : fail to bind(1) query (%d/%s)",
+ PREFERENCE_ERROR_IO_ERROR,
+ sqlite3_extended_errcode(pref_db),
+ sqlite3_errmsg(pref_db));
+ sqlite3_finalize(stmt);
+ return PREFERENCE_ERROR_IO_ERROR;
+ }
+ ret = sqlite3_bind_text(stmt, 2, type, strlen(type), SQLITE_STATIC);
+ if(ret != SQLITE_OK) {
+ LOGE("IO_ERROR(0x%08x) : fail to bind(2) query (%d/%s)",
+ PREFERENCE_ERROR_IO_ERROR,
+ sqlite3_extended_errcode(pref_db),
+ sqlite3_errmsg(pref_db));
+ sqlite3_finalize(stmt);
+ return PREFERENCE_ERROR_IO_ERROR;
+ }
+ ret = sqlite3_bind_text(stmt, 3, data, strlen(data), SQLITE_STATIC);
+ if(ret != SQLITE_OK) {
+ LOGE("IO_ERROR(0x%08x) : fail to bind(3) query (%d/%s)",
+ PREFERENCE_ERROR_IO_ERROR,
+ sqlite3_extended_errcode(pref_db),
+ sqlite3_errmsg(pref_db));
+ sqlite3_finalize(stmt);
+ return PREFERENCE_ERROR_IO_ERROR;
+ }
+ }
+
+ ret = sqlite3_step(stmt);
+ if (ret != SQLITE_DONE) {
+ LOGE("IO_ERROR(0x%08x): fail to write data(%d/%s)",
+ PREFERENCE_ERROR_IO_ERROR,
+ sqlite3_extended_errcode(pref_db),
+ sqlite3_errmsg(pref_db));
+ sqlite3_finalize(stmt);
return PREFERENCE_ERROR_IO_ERROR;
}
+ sqlite3_finalize(stmt);
+ if(buf) {
+ sqlite3_free(buf);
+ buf = NULL;
+ }
+
return PREFERENCE_ERROR_NONE;
}
char data[BUF_LEN];
int ret;
+ if (value == NULL) {
+ LOGE("INVALID_PARAMETER(0x%08x)", PREFERENCE_ERROR_INVALID_PARAMETER);
+ return PREFERENCE_ERROR_INVALID_PARAMETER;
+ }
+
ret = _read_data(key, type, data);
if (ret == PREFERENCE_ERROR_NONE)
{
int ret;
+ if (value == NULL) {
+ LOGE("INVALID_PARAMETER(0x%08x)", PREFERENCE_ERROR_INVALID_PARAMETER);
+ return PREFERENCE_ERROR_INVALID_PARAMETER;
+ }
+
ret = _read_data(key, type, data);
if (ret == PREFERENCE_ERROR_NONE)
{
int ret;
+ if (value == NULL) {
+ LOGE("INVALID_PARAMETER(0x%08x)", PREFERENCE_ERROR_INVALID_PARAMETER);
+ return PREFERENCE_ERROR_INVALID_PARAMETER;
+ }
+
ret = _read_data(key, type, data);
if (ret == PREFERENCE_ERROR_NONE)
{
LOGE("OUT_OF_MEMORY(0x%08x)", PREFERENCE_ERROR_OUT_OF_MEMORY);
return PREFERENCE_ERROR_OUT_OF_MEMORY;
}
+
+ if (head != NULL)
+ head->prev = tmp_node;
tmp_node->cb = cb;
tmp_node->user_data = user_data;
tmp_node->prev = NULL;
{
int ret;
char *buf;
- char *errmsg;
bool exist;
+ sqlite3_stmt *stmt;
ret = preference_is_existing(key, &exist);
if (ret != PREFERENCE_ERROR_NONE)
if (!exist)
{
- return PREFERENCE_ERROR_NONE;
+ return PREFERENCE_ERROR_NO_KEY;
}
/* insert data or update data if data already exist */
- buf = sqlite3_mprintf("DELETE FROM %s WHERE %s = '%s';",
+ buf = sqlite3_mprintf("DELETE FROM %s WHERE %s = ?",
PREF_TBL_NAME, PREF_F_KEY_NAME, key);
-
if (buf == NULL)
{
LOGE("IO_ERROR(0x%08x) : fail to create query string", PREFERENCE_ERROR_IO_ERROR);
return PREFERENCE_ERROR_IO_ERROR;
}
- ret = sqlite3_exec(pref_db, buf, NULL, NULL, &errmsg);
- sqlite3_free(buf);
- if (ret != SQLITE_OK)
- {
- LOGE("IO_ERROR(0x%08x) : fail to delete data (%s)", PREFERENCE_ERROR_IO_ERROR, errmsg);
- sqlite3_free(errmsg);
+ ret = sqlite3_prepare(pref_db, buf, strlen(buf), &stmt, NULL);
+ if (ret != SQLITE_OK) {
+ LOGE("IO_ERROR(0x%08x) : fail to prepare query (%d/%s)",
+ PREFERENCE_ERROR_IO_ERROR,
+ sqlite3_extended_errcode(pref_db),
+ sqlite3_errmsg(pref_db));
+ return PREFERENCE_ERROR_IO_ERROR;
+ }
+
+ ret = sqlite3_bind_text(stmt, 1, key, strlen(key), SQLITE_STATIC);
+ if(ret != SQLITE_OK) {
+ LOGE("IO_ERROR(0x%08x) : fail to bind(1) query (%d/%s)",
+ PREFERENCE_ERROR_IO_ERROR,
+ sqlite3_extended_errcode(pref_db),
+ sqlite3_errmsg(pref_db));
+ sqlite3_finalize(stmt);
+ return PREFERENCE_ERROR_IO_ERROR;
+ }
+
+ ret = sqlite3_step(stmt);
+ if (ret != SQLITE_DONE) {
+ LOGE("IO_ERROR(0x%08x): fail to delete data(%d/%s)",
+ PREFERENCE_ERROR_IO_ERROR,
+ sqlite3_extended_errcode(pref_db),
+ sqlite3_errmsg(pref_db));
+ sqlite3_finalize(stmt);
return PREFERENCE_ERROR_IO_ERROR;
}
+ sqlite3_finalize(stmt);
+ if(buf) {
+ sqlite3_free(buf);
+ buf = NULL;
+ }
+
// if exist, remove changed cb
_remove_node(key);
int preference_unset_changed_cb(const char *key)
{
- if (pref_db == NULL)
+ int ret;
+ bool exist;
+
+ ret = preference_is_existing(key, &exist);
+ if (ret != PREFERENCE_ERROR_NONE)
{
- if (_initialize() != PREFERENCE_ERROR_NONE)
- {
- return PREFERENCE_ERROR_IO_ERROR;
- }
+ return ret;
+ }
+
+ if (!exist)
+ {
+ LOGE("NO_KEY(0x%08x) : fail to find given key(%s)", PREFERENCE_ERROR_NO_KEY, key);
+ return PREFERENCE_ERROR_NO_KEY;
}
return _remove_node(key);
char *errmsg;
int i;
+ if (callback == NULL)
+ {
+ LOGE("INVALID_PARAMETER(0x%08x)", PREFERENCE_ERROR_INVALID_PARAMETER);
+ return PREFERENCE_ERROR_INVALID_PARAMETER;
+ }
+
if (pref_db == NULL)
{
if (_initialize() != PREFERENCE_ERROR_NONE)
}
}
- if (callback == NULL)
- {
- LOGE("INVALID_PARAMETER(0x%08x)", PREFERENCE_ERROR_INVALID_PARAMETER);
- return PREFERENCE_ERROR_INVALID_PARAMETER;
- }
-
buf = sqlite3_mprintf("SELECT %s FROM %s;", PREF_F_KEY_NAME, PREF_TBL_NAME);
if (buf == NULL)
{
* 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.
+ * limitations under the License.
*/
-#include <stdio.h>
-#include <stdlib.h>
-#include <unistd.h>
-#include <string.h>
-#include <sys/types.h>
-#include <sys/stat.h>
-#include <fcntl.h>
-
-#include <bundle.h>
-#include <appcore-common.h>
-#include <aul.h>
-#include <dlog.h>
-#include <vconf.h>
-
-#include <app_private.h>
-#include <app_service_private.h>
-
-#ifdef LOG_TAG
-#undef LOG_TAG
-#endif
-
-#define LOG_TAG "CAPI_APPFW_APPLICATION"
-
-app_device_orientation_e app_convert_appcore_rm(enum appcore_rm rm)
-{
- app_device_orientation_e dev_orientation;
-
- switch (rm)
- {
- case APPCORE_RM_PORTRAIT_NORMAL:
- dev_orientation = APP_DEVICE_ORIENTATION_0;
- break;
-
- case APPCORE_RM_PORTRAIT_REVERSE:
- dev_orientation = APP_DEVICE_ORIENTATION_180;
- break;
-
- case APPCORE_RM_LANDSCAPE_NORMAL:
- dev_orientation = APP_DEVICE_ORIENTATION_270;
- break;
-
- case APPCORE_RM_LANDSCAPE_REVERSE:
- dev_orientation = APP_DEVICE_ORIENTATION_90;
- break;
-
- default:
- dev_orientation = APP_DEVICE_ORIENTATION_0;
- break;
- }
-
- return dev_orientation;
-}
+#include <app_internal.h>
app_device_orientation_e app_get_device_orientation(void)
{
* 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.
+ * limitations under the License.
*/
-#include <stdio.h>
#include <stdlib.h>
-#include <unistd.h>
-#include <string.h>
-#include <sys/types.h>
-#include <sys/stat.h>
-#include <fcntl.h>
#include <bundle.h>
#include <appcore-common.h>
#include <appcore-efl.h>
-#include <aul.h>
#include <dlog.h>
+#include <vconf-internal-keys.h>
#include <Elementary.h>
+#include <Eina.h>
-#include <app_private.h>
-#include <app_service_private.h>
+#include <app_common.h>
+#include <app_control_internal.h>
+#include <app_internal.h>
#ifdef LOG_TAG
#undef LOG_TAG
static int app_appcore_terminate(void *data);
static int app_appcore_reset(bundle *appcore_bundle, void *data);
-static int app_appcore_low_memory(void *data);
-static int app_appcore_low_battery(void *data);
-static int app_appcore_rotation_event(enum appcore_rm rm, void *data);
-static int app_appcore_lang_changed(void *data);
-static int app_appcore_region_changed(void *data);
+static int app_appcore_low_memory(void *event, void *data);
+static int app_appcore_low_battery(void *event, void *data);
+static int app_appcore_rotation_event(void *event, enum appcore_rm rm, void *data);
+static int app_appcore_lang_changed(void *event, void *data);
+static int app_appcore_region_changed(void *event, void *data);
static void app_set_appcore_event_cb(app_context_h app_context);
static void app_unset_appcore_event_cb(void);
+int app_main(int argc, char **argv, app_event_callback_s *callback, void *user_data)
+{
+ return app_efl_main(&argc, &argv, callback, user_data);
+}
int app_efl_main(int *argc, char ***argv, app_event_callback_s *callback, void *user_data)
{
{
return app_error(APP_ERROR_INVALID_CONTEXT, __FUNCTION__, "failed to get the package");
}
-
+
if (app_get_package_app_name(app_context.package, &(app_context.app_name)) != APP_ERROR_NONE)
{
+ free(app_context.package);
return app_error(APP_ERROR_INVALID_CONTEXT, __FUNCTION__, "failed to get the package's app name");
}
app_context.state = APP_STATE_CREATING;
+ LOGI("app_efl_main");
appcore_efl_main(app_context.app_name, argc, argv, &appcore_context);
free(app_context.package);
return APP_ERROR_NONE;
}
+void app_exit(void)
+{
+ app_efl_exit();
+}
void app_efl_exit(void)
{
+ LOGI("app_efl_exit");
elm_exit();
}
int app_appcore_create(void *data)
{
+ LOGI("app_appcore_create");
app_context_h app_context = data;
app_create_cb create_cb;
- char locale_dir[TIZEN_PATH_MAX] = {0, };
if (app_context == NULL)
{
app_set_appcore_event_cb(app_context);
- snprintf(locale_dir, TIZEN_PATH_MAX, PATH_FMT_LOCALE_DIR, app_context->package);
- if (access(locale_dir, R_OK) != 0) {
- snprintf(locale_dir, TIZEN_PATH_MAX, PATH_FMT_RO_LOCALE_DIR, app_context->package);
- }
- appcore_set_i18n(app_context->app_name, locale_dir);
-
create_cb = app_context->callback->create;
if (create_cb == NULL || create_cb(app_context->data) == false)
int app_appcore_terminate(void *data)
{
+ LOGI("app_appcore_terminate");
app_context_h app_context = data;
app_terminate_cb terminate_cb;
terminate_cb(app_context->data);
}
- app_unset_appcore_event_cb();
+ app_unset_appcore_event_cb();
app_finalizer_execute();
int app_appcore_pause(void *data)
{
+ LOGI("app_appcore_pause");
app_context_h app_context = data;
app_pause_cb pause_cb;
int app_appcore_resume(void *data)
{
+ LOGI("app_appcore_resume");
app_context_h app_context = data;
app_resume_cb resume_cb;
int app_appcore_reset(bundle *appcore_bundle, void *data)
{
+ LOGI("app_appcore_reset");
app_context_h app_context = data;
- app_service_cb service_cb;
- service_h service;
+ app_control_cb callback;
+ app_control_h app_control;
if (app_context == NULL)
{
return app_error(APP_ERROR_INVALID_CONTEXT, __FUNCTION__, NULL);
}
- if (service_create_event(appcore_bundle, &service) != APP_ERROR_NONE)
+ if (app_control_create_event(appcore_bundle, &app_control) != APP_ERROR_NONE)
{
- return app_error(APP_ERROR_INVALID_PARAMETER, __FUNCTION__, "failed to create a service handle from the bundle");
+ return app_error(APP_ERROR_INVALID_PARAMETER, __FUNCTION__, "failed to create a app_control handle from the bundle");
}
- service_cb = app_context->callback->service;
+ callback = app_context->callback->app_control;
- if (service_cb != NULL)
+ if (callback != NULL)
{
- service_cb(service, app_context->data);
+ callback(app_control, app_context->data);
}
- service_destroy(service);
+ app_control_destroy(app_control);
return APP_ERROR_NONE;
}
-
-int app_appcore_low_memory(void *data)
+int app_appcore_low_memory(void *event_info, void *data)
{
+ LOGI("app_appcore_low_memory");
+
app_context_h app_context = data;
app_low_memory_cb low_memory_cb;
return APP_ERROR_NONE;
}
-int app_appcore_low_battery(void *data)
+int app_appcore_low_battery(void *event_info, void *data)
{
app_context_h app_context = data;
app_low_battery_cb low_battery_cb;
+ LOGI("app_appcore_low_battery");
+
if (app_context == NULL)
{
return app_error(APP_ERROR_INVALID_CONTEXT, __FUNCTION__, NULL);
if (low_battery_cb != NULL)
{
+ LOGI("app_appcore_low_memory: app_appcore_low_memory_cb() is called");
low_battery_cb(app_context->data);
}
return APP_ERROR_NONE;
}
-int app_appcore_rotation_event(enum appcore_rm rm, void *data)
+int app_appcore_rotation_event(void *event_info, enum appcore_rm rm, void *data)
{
+ LOGI("app_appcore_rotation_event");
app_context_h app_context = data;
app_device_orientation_cb device_orientation_cb;
return APP_ERROR_NONE;
}
-int app_appcore_lang_changed(void *data)
+int app_appcore_lang_changed(void *event_info, void *data)
{
+ LOGI("app_appcore_lang_changed");
app_context_h app_context = data;
app_language_changed_cb lang_changed_cb;
return APP_ERROR_NONE;
}
-int app_appcore_region_changed(void *data)
+int app_appcore_region_changed(void *event_info, void *data)
{
+ LOGI("app_appcore_region_changed");
app_context_h app_context = data;
app_region_format_changed_cb region_changed_cb;
appcore_set_event_callback(APPCORE_EVENT_LANG_CHANGE, NULL, NULL);
appcore_set_event_callback(APPCORE_EVENT_REGION_CHANGE, NULL, NULL);
}
+
+#define UI_APP_EVENT_MAX 5
+static Eina_List *handler_list[UI_APP_EVENT_MAX] = {NULL, };
+static int _initialized = 0;
+
+struct ui_app_context {
+ char *package;
+ char *app_name;
+ app_state_e state;
+ ui_app_lifecycle_callback_s *callback;
+ void *data;
+};
+
+static void _free_handler_list(void)
+{
+ int i;
+ app_event_handler_h handler;
+
+ for (i = 0; i < UI_APP_EVENT_MAX; i++) {
+ EINA_LIST_FREE(handler_list[i], handler)
+ free(handler);
+ }
+
+ eina_shutdown();
+}
+
+static int _ui_app_appcore_low_memory(void *event_info, void *data)
+{
+ Eina_List *l;
+ app_event_handler_h handler;
+ struct app_event_info event;
+
+ LOGI("_app_appcore_low_memory");
+
+ event.type = APP_EVENT_LOW_MEMORY;
+ event.value = event_info;
+
+ EINA_LIST_FOREACH(handler_list[APP_EVENT_LOW_MEMORY], l, handler) {
+ handler->cb(&event, handler->data);
+ }
+
+ return APP_ERROR_NONE;
+}
+
+static int _ui_app_appcore_low_battery(void *event_info, void *data)
+{
+ Eina_List *l;
+ app_event_handler_h handler;
+ struct app_event_info event;
+
+ LOGI("_ui_app_appcore_low_battery");
+
+ event.type = APP_EVENT_LOW_BATTERY;
+ event.value = event_info;
+
+ EINA_LIST_FOREACH(handler_list[APP_EVENT_LOW_BATTERY], l, handler) {
+ handler->cb(&event, handler->data);
+ }
+
+ return APP_ERROR_NONE;
+}
+
+static int _ui_app_appcore_rotation_event(void *event_info, enum appcore_rm rm, void *data)
+{
+ Eina_List *l;
+ app_event_handler_h handler;
+ struct app_event_info event;
+
+ LOGI("_ui_app_appcore_rotation_event");
+
+ event.type = APP_EVENT_DEVICE_ORIENTATION_CHANGED;
+ event.value = event_info;
+
+ EINA_LIST_FOREACH(handler_list[APP_EVENT_DEVICE_ORIENTATION_CHANGED], l, handler) {
+ handler->cb(&event, handler->data);
+ }
+
+ return APP_ERROR_NONE;
+}
+
+static int _ui_app_appcore_lang_changed(void *event_info, void *data)
+{
+ Eina_List *l;
+ app_event_handler_h handler;
+ struct app_event_info event;
+
+ LOGI("_ui_app_appcore_lang_changed");
+
+ event.type = APP_EVENT_LANGUAGE_CHANGED;
+ event.value = event_info;
+
+ EINA_LIST_FOREACH(handler_list[APP_EVENT_LANGUAGE_CHANGED], l, handler) {
+ handler->cb(&event, handler->data);
+ }
+
+ return APP_ERROR_NONE;
+}
+
+static int _ui_app_appcore_region_changed(void *event_info, void *data)
+{
+ Eina_List *l;
+ app_event_handler_h handler;
+ struct app_event_info event;
+
+ if (event_info == NULL) {
+ LOGI("receive empty event, ignore it");
+ return APP_ERROR_NONE;
+ }
+
+ LOGI("_ui_app_appcore_region_changed");
+
+ event.type = APP_EVENT_REGION_FORMAT_CHANGED;
+ event.value = event_info;
+
+ EINA_LIST_FOREACH(handler_list[APP_EVENT_REGION_FORMAT_CHANGED], l, handler) {
+ handler->cb(&event, handler->data);
+ }
+
+ return APP_ERROR_NONE;
+}
+
+
+static void _ui_app_set_appcore_event_cb(void)
+{
+ appcore_set_event_callback(APPCORE_EVENT_LOW_MEMORY, _ui_app_appcore_low_memory, NULL);
+ appcore_set_event_callback(APPCORE_EVENT_LOW_BATTERY, _ui_app_appcore_low_battery, NULL);
+ appcore_set_rotation_cb(_ui_app_appcore_rotation_event, NULL);
+ appcore_set_event_callback(APPCORE_EVENT_LANG_CHANGE, _ui_app_appcore_lang_changed, NULL);
+ appcore_set_event_callback(APPCORE_EVENT_REGION_CHANGE, _ui_app_appcore_region_changed, NULL);
+}
+
+static void _ui_app_unset_appcore_event_cb(void)
+{
+ appcore_set_event_callback(APPCORE_EVENT_LOW_MEMORY, NULL, NULL);
+ appcore_set_event_callback(APPCORE_EVENT_LOW_BATTERY, NULL, NULL);
+ appcore_unset_rotation_cb();
+ appcore_set_event_callback(APPCORE_EVENT_LANG_CHANGE, NULL, NULL);
+ appcore_set_event_callback(APPCORE_EVENT_REGION_CHANGE, NULL, NULL);
+}
+
+static int _ui_app_appcore_create(void *data)
+{
+ LOGI("app_appcore_create");
+ struct ui_app_context *app_context = data;
+ app_create_cb create_cb;
+
+ if (app_context == NULL)
+ return app_error(APP_ERROR_INVALID_CONTEXT, __FUNCTION__, NULL);
+
+ _ui_app_set_appcore_event_cb();
+
+ create_cb = app_context->callback->create;
+
+ if (create_cb == NULL || create_cb(app_context->data) == false)
+ return app_error(APP_ERROR_INVALID_CONTEXT, __FUNCTION__, "app_create_cb() returns false");
+
+ app_context->state = APP_STATE_RUNNING;
+
+ return APP_ERROR_NONE;
+}
+
+static int _ui_app_appcore_terminate(void *data)
+{
+ LOGI("app_appcore_terminate");
+ struct ui_app_context *app_context = data;
+ app_terminate_cb terminate_cb;
+
+ if (app_context == NULL)
+ return app_error(APP_ERROR_INVALID_CONTEXT, __FUNCTION__, NULL);
+
+ terminate_cb = app_context->callback->terminate;
+
+ if (terminate_cb != NULL)
+ terminate_cb(app_context->data);
+
+ _ui_app_unset_appcore_event_cb();
+
+ app_finalizer_execute();
+
+ if (_initialized) {
+ _free_handler_list();
+ _initialized = 0;
+ }
+
+ return APP_ERROR_NONE;
+}
+
+static int _ui_app_appcore_pause(void *data)
+{
+ LOGI("app_appcore_pause");
+ struct ui_app_context *app_context = data;
+ app_pause_cb pause_cb;
+
+ if (app_context == NULL)
+ return app_error(APP_ERROR_INVALID_CONTEXT, __FUNCTION__, NULL);
+
+ pause_cb = app_context->callback->pause;
+
+ if (pause_cb != NULL)
+ pause_cb(app_context->data);
+
+ return APP_ERROR_NONE;
+}
+
+static int _ui_app_appcore_resume(void *data)
+{
+ LOGI("app_appcore_resume");
+ struct ui_app_context *app_context = data;
+ app_resume_cb resume_cb;
+
+ if (app_context == NULL)
+ return app_error(APP_ERROR_INVALID_CONTEXT, __FUNCTION__, NULL);
+
+ resume_cb = app_context->callback->resume;
+
+ if (resume_cb != NULL)
+ resume_cb(app_context->data);
+
+ return APP_ERROR_NONE;
+}
+
+
+static int _ui_app_appcore_reset(bundle *appcore_bundle, void *data)
+{
+ LOGI("app_appcore_reset");
+ struct ui_app_context *app_context = data;
+ app_control_cb callback;
+ app_control_h app_control;
+
+ if (app_context == NULL)
+ return app_error(APP_ERROR_INVALID_CONTEXT, __FUNCTION__, NULL);
+
+ if (app_control_create_event(appcore_bundle, &app_control) != APP_ERROR_NONE)
+ return app_error(APP_ERROR_INVALID_PARAMETER, __FUNCTION__, "failed to create a app_control handle from the bundle");
+
+ callback = app_context->callback->app_control;
+
+ if (callback != NULL)
+ callback(app_control, app_context->data);
+
+ app_control_destroy(app_control);
+
+ return APP_ERROR_NONE;
+}
+
+int ui_app_main(int argc, char **argv, ui_app_lifecycle_callback_s *callback, void *user_data)
+{
+ struct ui_app_context app_context = {
+ .package = NULL,
+ .app_name = NULL,
+ .state = APP_STATE_NOT_RUNNING,
+ .callback = callback,
+ .data = user_data
+ };
+
+ struct appcore_ops appcore_context = {
+ .data = &app_context,
+ .create = _ui_app_appcore_create,
+ .terminate = _ui_app_appcore_terminate,
+ .pause = _ui_app_appcore_pause,
+ .resume = _ui_app_appcore_resume,
+ .reset = _ui_app_appcore_reset,
+ };
+
+ if (argc < 1 || argv == NULL || callback == NULL)
+ return app_error(APP_ERROR_INVALID_PARAMETER, __FUNCTION__, NULL);
+
+ if (callback->create == NULL)
+ return app_error(APP_ERROR_INVALID_PARAMETER, __FUNCTION__, "app_create_cb() callback must be registered");
+
+ if (app_context.state != APP_STATE_NOT_RUNNING)
+ return app_error(APP_ERROR_ALREADY_RUNNING, __FUNCTION__, NULL);
+
+ if (app_get_id(&(app_context.package)) != APP_ERROR_NONE)
+ return app_error(APP_ERROR_INVALID_CONTEXT, __FUNCTION__, "failed to get the package");
+
+ if (app_get_package_app_name(app_context.package, &(app_context.app_name)) != APP_ERROR_NONE) {
+ free(app_context.package);
+ return app_error(APP_ERROR_INVALID_CONTEXT, __FUNCTION__, "failed to get the package's app name");
+ }
+
+ app_context.state = APP_STATE_CREATING;
+
+ LOGI("app_efl_main");
+ appcore_efl_main(app_context.app_name, &argc, &argv, &appcore_context);
+
+ free(app_context.package);
+ free(app_context.app_name);
+
+ return APP_ERROR_NONE;
+}
+
+void ui_app_exit(void)
+{
+ app_efl_exit();
+}
+
+int ui_app_add_event_handler(app_event_handler_h *event_handler, app_event_type_e event_type, app_event_cb callback, void *user_data)
+{
+ app_event_handler_h handler;
+ Eina_List *l_itr;
+
+ if (!_initialized) {
+ eina_init();
+ _initialized = 1;
+ }
+
+ if (event_handler == NULL || callback == NULL)
+ return app_error(APP_ERROR_INVALID_PARAMETER, __FUNCTION__, "null parameter");
+
+ if (event_type < APP_EVENT_LOW_MEMORY || event_type > APP_EVENT_REGION_FORMAT_CHANGED)
+ return app_error(APP_ERROR_INVALID_PARAMETER, __FUNCTION__, "invalid event type");
+
+ EINA_LIST_FOREACH(handler_list[event_type], l_itr, handler) {
+ if (handler->cb == callback)
+ return app_error(APP_ERROR_INVALID_PARAMETER, __FUNCTION__, "already registered");
+ }
+
+ handler = calloc(1, sizeof(struct app_event_handler));
+ if (!handler)
+ return app_error(APP_ERROR_OUT_OF_MEMORY, __FUNCTION__, "failed to create handler");
+
+ handler->type = event_type;
+ handler->cb = callback;
+ handler->data = user_data;
+ handler_list[event_type] = eina_list_append(handler_list[event_type], handler);
+
+ *event_handler = handler;
+
+ return APP_ERROR_NONE;
+}
+
+int ui_app_remove_event_handler(app_event_handler_h event_handler)
+{
+ app_event_handler_h handler;
+ app_event_type_e type;
+ Eina_List *l_itr;
+ Eina_List *l_next;
+
+ if (event_handler == NULL)
+ return app_error(APP_ERROR_INVALID_PARAMETER, __FUNCTION__, "handler is null");
+
+ if (!_initialized) {
+ LOGI("handler list is not initialized");
+ return APP_ERROR_NONE;
+ }
+
+ type = event_handler->type;
+ if (type < APP_EVENT_LOW_MEMORY || type > APP_EVENT_REGION_FORMAT_CHANGED)
+ return app_error(APP_ERROR_INVALID_PARAMETER, __FUNCTION__, "invalid handler");
+
+ EINA_LIST_FOREACH_SAFE(handler_list[type], l_itr, l_next, handler) {
+ if (handler == event_handler) {
+ free(handler);
+ handler_list[type] = eina_list_remove_list(handler_list[type], l_itr);
+ return APP_ERROR_NONE;
+ }
+ }
+
+ return app_error(APP_ERROR_INVALID_PARAMETER, __FUNCTION__, "cannot find such handler");
+}
* 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.
+ * limitations under the License.
*/
-#include <stdio.h>
-#include <stdlib.h>
-#include <unistd.h>
-#include <string.h>
-#include <sys/types.h>
-#include <sys/stat.h>
-#include <fcntl.h>
-
-#include <bundle.h>
-#include <appcore-common.h>
#include <appcore-efl.h>
#include <aul.h>
-#include <dlog.h>
-#include <ail.h>
-#include <Elementary.h>
-
-#include <app_private.h>
-#include <app_service_private.h>
-
-#ifdef LOG_TAG
-#undef LOG_TAG
-#endif
-
-#define LOG_TAG "CAPI_APPFW_APPLICATION"
-
-static const char *INSTALLED_PATH = "/opt/usr/apps";
-static const char *RO_INSTALLED_PATH = "/usr/apps";
-static const char *RES_DIRECTORY_NAME = "res";
-static const char *DATA_DIRECTORY_NAME = "data";
-
-static char * app_get_root_directory(char *buffer, int size)
-{
- char *appid = NULL;
- char root_directory[TIZEN_PATH_MAX] = {0, };
- char bin_directory[TIZEN_PATH_MAX] = {0, };
- ail_appinfo_h ail_app_info;
- char *pkgid;
-
- if (app_get_id(&appid) != APP_ERROR_NONE)
- {
- app_error(APP_ERROR_INVALID_CONTEXT, __FUNCTION__, "failed to get the appid");
- return NULL;
- }
-
- if (ail_get_appinfo(appid, &ail_app_info) != AIL_ERROR_OK)
- {
- app_error(APP_ERROR_INVALID_CONTEXT, __FUNCTION__, "failed to get the appinfo");
- free(appid);
- return NULL;
- }
-
- if (ail_appinfo_get_str(ail_app_info, AIL_PROP_X_SLP_PKGID_STR, &pkgid) != AIL_ERROR_OK)
- {
- app_error(APP_ERROR_INVALID_CONTEXT, __FUNCTION__, "failed to get the pkgid");
- free(appid);
- ail_destroy_appinfo(ail_app_info);
- return NULL;
- }
-
- if(pkgid)
- {
- free(appid);
- appid = strdup(pkgid);
- }
-
- ail_destroy_appinfo(ail_app_info);
-
- snprintf(root_directory, sizeof(root_directory), "%s/%s", INSTALLED_PATH, appid);
- snprintf(bin_directory, sizeof(bin_directory), "%s/bin", root_directory);
-
- if (access(bin_directory, R_OK) != 0) {
- snprintf(root_directory, sizeof(root_directory), "%s/%s", RO_INSTALLED_PATH, appid);
- }
-
- free(appid);
- if (size < strlen(root_directory)+1)
- {
- app_error(APP_ERROR_INVALID_PARAMETER, __FUNCTION__, "the buffer is not big enough");
- return NULL;
- }
-
- snprintf(buffer, size, "%s", root_directory);
-
- return buffer;
-}
-
-static char* app_get_resource_directory(char *buffer, int size)
-{
- char root_directory[TIZEN_PATH_MAX] = {0, };
- char resource_directory[TIZEN_PATH_MAX] = {0, };
-
- if (app_get_root_directory(root_directory, sizeof(root_directory)) == NULL)
- {
- app_error(APP_ERROR_INVALID_CONTEXT, __FUNCTION__, "failed to get the root directory of the application");
- return NULL;
- }
-
- snprintf(resource_directory, sizeof(resource_directory), "%s/%s", root_directory, RES_DIRECTORY_NAME);
-
- if (size < strlen(resource_directory) +1)
- {
- app_error(APP_ERROR_INVALID_PARAMETER, __FUNCTION__, "the buffer is not big enough");
- return NULL;
- }
-
- snprintf(buffer, size, "%s", resource_directory);
-
- return buffer;
-}
-
-char* app_get_data_directory(char *buffer, int size)
+void app_set_reclaiming_system_cache_on_pause(bool enable)
{
- static char data_directory[TIZEN_PATH_MAX] = {0, };
- static int data_directory_length = 0;
- ail_appinfo_h ail_app_info;
- char *pkgid;
-
- if (data_directory[0] == '\0')
- {
- char *root_directory = NULL;
- char *appid = NULL;
-
- root_directory = calloc(1, TIZEN_PATH_MAX);
-
- if (root_directory == NULL)
- {
- app_error(APP_ERROR_OUT_OF_MEMORY, __FUNCTION__, NULL);
- return NULL;
- }
-
- if (app_get_id(&appid) != APP_ERROR_NONE)
- {
- app_error(APP_ERROR_INVALID_CONTEXT, __FUNCTION__, "failed to get the package");
- free(root_directory);
- return NULL;
- }
-
- if (ail_get_appinfo(appid, &ail_app_info) != AIL_ERROR_OK)
- {
- app_error(APP_ERROR_INVALID_CONTEXT, __FUNCTION__, "failed to get the package");
- free(root_directory);
- free(appid);
- return NULL;
- }
-
- if (ail_appinfo_get_str(ail_app_info, AIL_PROP_X_SLP_PKGID_STR, &pkgid) != AIL_ERROR_OK)
- {
- app_error(APP_ERROR_INVALID_CONTEXT, __FUNCTION__, "failed to get the package");
- free(root_directory);
- free(appid);
- ail_destroy_appinfo(ail_app_info);
- return NULL;
- }
-
- if(pkgid)
- {
- free(appid);
- appid = strdup(pkgid);
- }
-
- ail_destroy_appinfo(ail_app_info);
-
- snprintf(root_directory, TIZEN_PATH_MAX, "%s/%s", INSTALLED_PATH, appid);
-
- free(appid);
-
- snprintf(data_directory, sizeof(data_directory), "%s/%s", root_directory, DATA_DIRECTORY_NAME);
-
- data_directory_length = strlen(data_directory);
-
- free(root_directory);
- }
-
- if (size < data_directory_length+1)
- {
- app_error(APP_ERROR_INVALID_PARAMETER, __FUNCTION__, "the buffer is not big enough");
- return NULL;
- }
-
- snprintf(buffer, size, "%s", data_directory);
-
- return buffer;
+ appcore_set_system_resource_reclaiming(enable);
}
-char* app_get_resource(const char *resource, char *buffer, int size)
+//#ifdef _APPFW_FEATURE_PROCESS_POOL
+void* app_get_preinitialized_window(const char *win_name)
{
- static char resource_directory[TIZEN_PATH_MAX] = {0, };
- static int resource_directory_length = 0;
-
- int resource_path_length = 0;
-
- if (resource == NULL)
- {
- app_error(APP_ERROR_INVALID_PARAMETER, __FUNCTION__, NULL);
- return NULL;
- }
-
- if (buffer == NULL || size <= 0)
- {
- app_error(APP_ERROR_INVALID_PARAMETER, __FUNCTION__, NULL);
- return NULL;
- }
-
- if (resource_directory[0] == '\0')
- {
- if (app_get_resource_directory(resource_directory, sizeof(resource_directory)) == NULL)
- {
- app_error(APP_ERROR_INVALID_CONTEXT, __FUNCTION__, "failed to get the path to the resource directory");
- return NULL;
- }
-
- resource_directory_length = strlen(resource_directory);
- }
-
- resource_path_length = resource_directory_length + strlen("/") + strlen(resource);
-
- if (size < resource_path_length+1)
- {
- app_error(APP_ERROR_INVALID_PARAMETER, __FUNCTION__, "the buffer is not big enough");
- return NULL;
- }
-
- snprintf(buffer, size, "%s/%s", resource_directory, resource);
-
- return buffer;
+#ifdef _APPFW_FEATURE_PROCESS_POOL
+ appcore_set_preinit_window_name(win_name);
+ return aul_get_preinit_window(win_name);
+#else
+ return NULL;
+#endif
}
-
-void app_set_reclaiming_system_cache_on_pause(bool enable)
+void* app_get_preinitialized_background(void)
{
- appcore_set_system_resource_reclaiming(enable);
+#ifdef _APPFW_FEATURE_PROCESS_POOL
+ return aul_get_preinit_background();
+#else
+ return NULL;
+#endif
}
-void* app_get_preinitizlized_window(void)
+void* app_get_preinitialized_conformant(void)
{
- Evas_Object* win = (Evas_Object*)aul_get_preinit_window();
-
- return win;
+#ifdef _APPFW_FEATURE_PROCESS_POOL
+ return aul_get_preinit_conformant();
+#else
+ return NULL;
+#endif
}
+//#endif
*/
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
#include <libintl.h>
-#include <app_i18n.h>
-
char* i18n_get_text(const char *message)
{
return gettext(message);
+++ /dev/null
-/*
- * Copyright (c) 2011 Samsung Electronics Co., Ltd All Rights Reserved
- *
- * 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 <stdlib.h>
-#include <unistd.h>
-#include <string.h>
-#include <errno.h>
-
-#include <bundle.h>
-#include <aul.h>
-#include <appsvc.h>
-#include <dlog.h>
-
-#include <app_service.h>
-#include <app_service_private.h>
-
-#ifdef LOG_TAG
-#undef LOG_TAG
-#endif
-
-#define LOG_TAG "CAPI_APPFW_APPLICATION_SERVICE"
-
-#ifndef TIZEN_PATH_MAX
-#define TIZEN_PATH_MAX 1024
-#endif
-
-#define BUNDLE_KEY_PREFIX_AUL "__AUL_"
-#define BUNDLE_KEY_PREFIX_SERVICE "__APP_SVC_"
-
-#define BUNDLE_KEY_OPERATION "__APP_SVC_OP_TYPE__"
-#define BUNDLE_KEY_URI "__APP_SVC_URI__"
-#define BUNDLE_KEY_MIME "__APP_SVC_MIME_TYPE__"
-#define BUNDLE_KEY_DATA "__APP_SVC_DATA__"
-#define BUNDLE_KEY_PACKAGE "__APP_SVC_PKG_NAME__"
-#define BUNDLE_KEY_WINDOW "__APP_SVC_K_WIN_ID__"
-
-
-typedef enum {
- SERVICE_TYPE_REQUEST,
- SERVICE_TYPE_EVENT,
- SERVICE_TYPE_REPLY,
-} service_type_e;
-
-struct service_s {
- int id;
- service_type_e type;
- bundle *data;
- int launch_pid;
-};
-
-typedef struct service_request_context_s {
- service_h service;
- service_reply_cb reply_cb;
- void *user_data;
-} *service_request_context_h;
-
-extern int appsvc_allow_transient_app(bundle *b, unsigned int id);
-extern int appsvc_request_transient_app(bundle *b, unsigned int callee_id, appsvc_host_res_fn cbfunc, void *data);
-
-static int service_create_reply(bundle *data, struct service_s **service);
-
-static const char* service_error_to_string(service_error_e error)
-{
- switch (error)
- {
- case SERVICE_ERROR_NONE:
- return "NONE";
-
- case SERVICE_ERROR_INVALID_PARAMETER:
- return "INVALID_PARAMETER";
-
- case SERVICE_ERROR_OUT_OF_MEMORY:
- return "OUT_OF_MEMORY";
-
- case SERVICE_ERROR_APP_NOT_FOUND:
- return "APP_NOT_FOUND";
-
- case SERVICE_ERROR_KEY_NOT_FOUND:
- return "KEY_NOT_FOUND";
-
- case SERVICE_ERROR_KEY_REJECTED:
- return "KEY_REJECTED";
-
- case SERVICE_ERROR_INVALID_DATA_TYPE:
- return "INVALID_DATA_TYPE";
-
- case SERVICE_ERROR_LAUNCH_REJECTED:
- return "LAUNCH_REJECTED";
-
- default :
- return "UNKNOWN";
- }
-}
-
-int service_error(service_error_e error, const char* function, const char *description)
-{
- if (description)
- {
- LOGE("[%s] %s(0x%08x) : %s", function, service_error_to_string(error), error, description);
- }
- else
- {
- if(error == SERVICE_ERROR_KEY_NOT_FOUND)
- LOGW("[%s] %s(0x%08x)", function, service_error_to_string(error), error);
- else
- LOGE("[%s] %s(0x%08x)", function, service_error_to_string(error), error);
- }
-
- return error;
-}
-
-static int service_validate_extra_data(const char *data)
-{
- if (data == NULL || data[0] == '\0')
- {
- return SERVICE_ERROR_INVALID_PARAMETER;
- }
-
- return SERVICE_ERROR_NONE;
-}
-
-static int service_valiate_service(service_h service)
-{
- if (service == NULL || service->data == NULL)
- {
- return SERVICE_ERROR_INVALID_PARAMETER;
- }
-
- return SERVICE_ERROR_NONE;
-}
-
-static int service_new_id()
-{
- static int sid = 0;
- return sid++;
-}
-
-int service_validate_internal_key(const char *key)
-{
- if (strncmp(BUNDLE_KEY_PREFIX_AUL, key, strlen(BUNDLE_KEY_PREFIX_AUL)) == 0)
- {
- return -1;
- }
-
- if (strncmp(BUNDLE_KEY_PREFIX_SERVICE, key, strlen(BUNDLE_KEY_PREFIX_SERVICE)) == 0)
- {
- return -1;
- }
-
- return 0;
-}
-
-static void service_request_result_broker(bundle *appsvc_bundle, int appsvc_request_code, appsvc_result_val appsvc_result, void *appsvc_data)
-{
- service_request_context_h request_context;
- service_h request;
- service_h reply = NULL;
- service_result_e result;
- void *user_data;
- service_reply_cb reply_cb;
-
- if (appsvc_data == NULL)
- {
- service_error(SERVICE_ERROR_INVALID_PARAMETER, __FUNCTION__, "invalid service reply");
- return;
- }
-
- if (service_create_reply(appsvc_bundle, &reply) != 0)
- {
- service_error(SERVICE_ERROR_INVALID_PARAMETER, __FUNCTION__, "failed to create service reply");
- return;
- }
-
- request_context = appsvc_data;
- request = request_context->service;
-
- switch (appsvc_result)
- {
- case APPSVC_RES_OK:
- result = SERVICE_RESULT_SUCCEEDED;
- break;
-
- case APPSVC_RES_NOT_OK:
- result = SERVICE_RESULT_FAILED;
- break;
-
- case APPSVC_RES_CANCEL:
- result = SERVICE_RESULT_CANCELED;
- break;
-
- default:
- result = SERVICE_RESULT_CANCELED;
- break;
- }
-
- user_data = request_context->user_data;
- reply_cb = request_context->reply_cb;
-
- if (reply_cb != NULL)
- {
- reply_cb(request, reply, result, user_data);
- }
- else
- {
- service_error(SERVICE_ERROR_INVALID_PARAMETER, __FUNCTION__, "invalid callback ");
- }
-
- service_destroy(reply);
-
- if (request_context->service != NULL)
- {
- service_destroy(request_context->service);
- }
-
- free(request_context);
-}
-
-
-int service_create(service_h *service)
-{
- return service_create_request(NULL, service);
-}
-
-int service_create_request(bundle *data, service_h *service)
-{
- struct service_s *service_request;
-
- if (service == NULL)
- {
- return service_error(SERVICE_ERROR_INVALID_PARAMETER, __FUNCTION__, NULL);
- }
-
- service_request = malloc(sizeof(struct service_s));
-
- if (service_request == NULL)
- {
- return service_error(SERVICE_ERROR_OUT_OF_MEMORY, __FUNCTION__, "failed to create a service handle");
- }
-
- service_request->type = SERVICE_TYPE_REQUEST;
-
- if (data != NULL)
- {
- service_request->data = bundle_dup(data);
- }
- else
- {
- service_request->data = bundle_create();
- }
-
- if (service_request->data == NULL)
- {
- free(service_request);
- return service_error(SERVICE_ERROR_OUT_OF_MEMORY, __FUNCTION__, "failed to create a bundle");
- }
-
- service_request->id = service_new_id();
- service_request->launch_pid = -1;
-
- *service = service_request;
-
- return SERVICE_ERROR_NONE;
-}
-
-int service_create_event(bundle *data, struct service_s **service)
-{
- struct service_s *service_event;
-
- const char *operation;
-
- if (data == NULL || service == NULL)
- {
- return service_error(SERVICE_ERROR_INVALID_PARAMETER, __FUNCTION__, NULL);
- }
-
- service_event = malloc(sizeof(struct service_s));
-
- if (service_event == NULL)
- {
- return service_error(SERVICE_ERROR_OUT_OF_MEMORY, __FUNCTION__, "failed to create a service handle");
- }
-
- service_event->type = SERVICE_TYPE_EVENT;
- service_event->data = bundle_dup(data);
- service_event->id = service_new_id();
-
- operation = appsvc_get_operation(service_event->data);
-
- if (operation == NULL)
- {
- appsvc_set_operation(service_event->data, SERVICE_OPERATION_DEFAULT);
- }
-
- *service = service_event;
-
- return SERVICE_ERROR_NONE;
-}
-
-static int service_create_reply(bundle *data, struct service_s **service)
-{
- struct service_s *service_reply;
-
- if (data == NULL || service == NULL)
- {
- return service_error(SERVICE_ERROR_INVALID_PARAMETER, __FUNCTION__, NULL);
- }
-
- service_reply = malloc(sizeof(struct service_s));
-
- if (service_reply == NULL)
- {
- return service_error(SERVICE_ERROR_OUT_OF_MEMORY, __FUNCTION__, "failed to create a service handle");
- }
-
- service_reply->type = SERVICE_TYPE_REPLY;
- service_reply->data = bundle_dup(data);
- service_reply->id = service_new_id();
-
- *service = service_reply;
-
- return SERVICE_ERROR_NONE;
-}
-
-int service_destroy(service_h service)
-{
- if (service_valiate_service(service))
- {
- return service_error(SERVICE_ERROR_INVALID_PARAMETER, __FUNCTION__, NULL);
- }
-
- bundle_free(service->data);
- service->data = NULL;
- free(service);
-
- return SERVICE_ERROR_NONE;
-}
-
-int service_to_bundle(service_h service, bundle **data)
-{
- if (service_valiate_service(service) || data == NULL)
- {
- return service_error(SERVICE_ERROR_INVALID_PARAMETER, __FUNCTION__, NULL);
- }
-
- *data = service->data;
-
- return SERVICE_ERROR_NONE;
-}
-
-int service_set_operation(service_h service, const char *operation)
-{
- if (service_valiate_service(service))
- {
- return service_error(SERVICE_ERROR_INVALID_PARAMETER, __FUNCTION__, NULL);
- }
-
- if (operation != NULL)
- {
- if (appsvc_set_operation(service->data, operation) != 0)
- {
- return service_error(SERVICE_ERROR_INVALID_PARAMETER, __FUNCTION__, "invalid operation");
- }
- }
- else
- {
- bundle_del(service->data, BUNDLE_KEY_OPERATION);
- }
-
- return SERVICE_ERROR_NONE;
-}
-
-int service_get_operation(service_h service, char **operation)
-{
- const char *operation_value;
-
- if (service_valiate_service(service) || operation == NULL)
- {
- return service_error(SERVICE_ERROR_INVALID_PARAMETER, __FUNCTION__, NULL);
- }
-
- operation_value = appsvc_get_operation(service->data);
-
- if (operation_value != NULL)
- {
- *operation = strdup(operation_value);
- }
- else
- {
- *operation = NULL;
- }
-
- return SERVICE_ERROR_NONE;
-}
-
-
-int service_set_uri(service_h service, const char *uri)
-{
- if (service_valiate_service(service))
- {
- return service_error(SERVICE_ERROR_INVALID_PARAMETER, __FUNCTION__, NULL);
- }
-
- if (uri != NULL)
- {
- if (appsvc_set_uri(service->data, uri) != 0)
- {
- return service_error(SERVICE_ERROR_INVALID_PARAMETER, __FUNCTION__, "invalid URI");
- }
- }
- else
- {
- bundle_del(service->data, BUNDLE_KEY_URI);
- }
-
- return SERVICE_ERROR_NONE;
-}
-
-
-int service_get_uri(service_h service, char **uri)
-{
- const char *uri_value;
-
- if (service_valiate_service(service) || uri == NULL)
- {
- return service_error(SERVICE_ERROR_INVALID_PARAMETER, __FUNCTION__, NULL);
- }
-
- uri_value = appsvc_get_uri(service->data);
-
- if (uri_value != NULL)
- {
- *uri = strdup(uri_value);
- }
- else
- {
- *uri = NULL;
- }
-
- return SERVICE_ERROR_NONE;
-}
-
-
-int service_set_mime(service_h service, const char *mime)
-{
- if (service_valiate_service(service))
- {
- return service_error(SERVICE_ERROR_INVALID_PARAMETER, __FUNCTION__, NULL);
- }
-
- if (mime != NULL)
- {
- if (appsvc_set_mime(service->data, mime) != 0)
- {
- return service_error(SERVICE_ERROR_INVALID_PARAMETER, __FUNCTION__, "invalid MIME type");
- }
- }
- else
- {
- bundle_del(service->data, BUNDLE_KEY_MIME);
- }
-
- return SERVICE_ERROR_NONE;
-}
-
-
-int service_get_mime(service_h service, char **mime)
-{
- const char *mime_value;
-
- if (service_valiate_service(service) || mime == NULL)
- {
- return service_error(SERVICE_ERROR_INVALID_PARAMETER, __FUNCTION__, NULL);
- }
-
- mime_value = appsvc_get_mime(service->data);
-
- if (mime_value != NULL)
- {
- *mime = strdup(mime_value);
- }
- else
- {
- *mime = NULL;
- }
-
- return SERVICE_ERROR_NONE;
-}
-
-
-int service_set_category(service_h service, const char *category)
-{
- if (service_valiate_service(service))
- {
- return service_error(SERVICE_ERROR_INVALID_PARAMETER, __FUNCTION__, NULL);
- }
-
- if (category != NULL)
- {
- if (appsvc_set_category(service->data, category) != 0)
- {
- return service_error(SERVICE_ERROR_INVALID_PARAMETER, __FUNCTION__, "invalid MIME type");
- }
- }
- else
- {
- bundle_del(service->data, BUNDLE_KEY_MIME);
- }
-
- return SERVICE_ERROR_NONE;
-}
-
-
-int service_get_category(service_h service, char **category)
-{
- const char *category_value;
-
- if (service_valiate_service(service) || category == NULL)
- {
- return service_error(SERVICE_ERROR_INVALID_PARAMETER, __FUNCTION__, NULL);
- }
-
- category_value = appsvc_get_category(service->data);
-
- if (category_value != NULL)
- {
- *category = strdup(category_value);
- }
- else
- {
- *category = NULL;
- }
-
- return SERVICE_ERROR_NONE;
-}
-
-
-int service_set_package(service_h service, const char *package)
-{
- // TODO: this function must be deprecated
- return service_set_app_id(service, package);
-}
-
-int service_get_package(service_h service, char **package)
-{
- // TODO: this function must be deprecated
- return service_get_app_id(service, package);
-}
-
-
-int service_set_app_id(service_h service, const char *app_id)
-{
- if (service_valiate_service(service))
- {
- return service_error(SERVICE_ERROR_INVALID_PARAMETER, __FUNCTION__, NULL);
- }
-
- if (app_id != NULL)
- {
- if (appsvc_set_appid(service->data, app_id) != 0)
- {
- return service_error(SERVICE_ERROR_INVALID_PARAMETER, __FUNCTION__, "invalid application ID");
- }
- }
- else
- {
- bundle_del(service->data, BUNDLE_KEY_PACKAGE);
- }
-
- return SERVICE_ERROR_NONE;
-}
-
-
-int service_get_app_id(service_h service, char **app_id)
-{
- const char *app_id_value;
-
- if (service_valiate_service(service) || app_id == NULL)
- {
- return service_error(SERVICE_ERROR_INVALID_PARAMETER, __FUNCTION__, NULL);
- }
-
- app_id_value = appsvc_get_appid(service->data);
-
- if (app_id_value != NULL)
- {
- *app_id = strdup(app_id_value);
- }
- else
- {
- *app_id = NULL;
- }
-
- return SERVICE_ERROR_NONE;
-}
-
-int service_set_window(service_h service, unsigned int id)
-{
- if (service_valiate_service(service))
- {
- return service_error(SERVICE_ERROR_INVALID_PARAMETER, __FUNCTION__, NULL);
- }
-
- if (id > 0)
- {
- if (appsvc_allow_transient_app(service->data, id) != 0)
- {
- return service_error(SERVICE_ERROR_INVALID_PARAMETER, __FUNCTION__, "invalid id");
- }
- }
- else
- {
- bundle_del(service->data, BUNDLE_KEY_WINDOW);
- }
-
- return SERVICE_ERROR_NONE;
-}
-
-int service_get_window(service_h service, unsigned int *id)
-{
- const char *window_id;
-
- if (service_valiate_service(service) || id == NULL)
- {
- return service_error(SERVICE_ERROR_INVALID_PARAMETER, __FUNCTION__, NULL);
- }
-
- window_id = bundle_get_val(service->data, BUNDLE_KEY_WINDOW);
-
- if (window_id != NULL)
- {
- *id = atoi(window_id);
- }
- else
- {
- *id = 0;
- }
-
- return SERVICE_ERROR_NONE;
-}
-
-int service_clone(service_h *clone, service_h service)
-{
- service_h service_clone;
-
- if (service_valiate_service(service) || clone == NULL)
- {
- return service_error(SERVICE_ERROR_INVALID_PARAMETER, __FUNCTION__, NULL);
- }
-
- service_clone = malloc(sizeof(struct service_s));
-
- if (service_clone == NULL)
- {
- return service_error(SERVICE_ERROR_OUT_OF_MEMORY, __FUNCTION__, "failed to create a service handle");
- }
-
- service_clone->id = service_new_id();
- service_clone->type = service->type;
- service_clone->data = bundle_dup(service->data);
-
- *clone = service_clone;
-
- return SERVICE_ERROR_NONE;
-}
-
-
-int service_send_launch_request(service_h service, service_reply_cb callback, void *user_data)
-{
- const char *operation;
- const char *appid;
-
- bool implicit_default_operation = false;
- int launch_pid;
-
- service_request_context_h request_context = NULL;
-
- if (service_valiate_service(service))
- {
- return service_error(SERVICE_ERROR_INVALID_PARAMETER, __FUNCTION__, NULL);
- }
-
- operation = appsvc_get_operation(service->data);
-
- if (operation == NULL)
- {
- implicit_default_operation = true;
- operation = SERVICE_OPERATION_DEFAULT;
- }
-
- appid = appsvc_get_appid(service->data);
-
- // operation : default
- if (!strcmp(operation, SERVICE_OPERATION_DEFAULT))
- {
- if (appid == NULL)
- {
- return service_error(SERVICE_ERROR_APP_NOT_FOUND, __FUNCTION__, "package must be specified if the operation is default value");
- }
- }
-
- if (callback != NULL)
- {
- service_h request_clone = NULL;
-
- request_context = calloc(1, sizeof(struct service_request_context_s));
-
- if (request_context == NULL)
- {
- return service_error(SERVICE_ERROR_OUT_OF_MEMORY, __FUNCTION__, NULL);
- }
-
- request_context->reply_cb = callback;
-
- if (service_clone(&request_clone, service) != SERVICE_ERROR_NONE)
- {
- free(request_context);
- return service_error(SERVICE_ERROR_INVALID_PARAMETER, __FUNCTION__, "failed to clone the service request handle");
- }
-
- request_context->service = request_clone;
- request_context->user_data = user_data;
- }
-
- if (implicit_default_operation == true)
- {
- appsvc_set_operation(service->data, SERVICE_OPERATION_DEFAULT);
- }
-
- launch_pid = appsvc_run_service(service->data, service->id, callback ? service_request_result_broker : NULL, request_context);
-
- if (implicit_default_operation == true)
- {
- bundle_del(service->data, BUNDLE_KEY_OPERATION);
- }
-
- if (launch_pid < 0)
- {
- if (launch_pid == APPSVC_RET_ENOMATCH)
- {
- return service_error(SERVICE_ERROR_APP_NOT_FOUND, __FUNCTION__, NULL);
- }
- else if (launch_pid == APPSVC_RET_EILLACC)
- {
- return service_error(SERVICE_ERROR_PERMISSION_DENIED, __FUNCTION__, NULL);
- }
- else
- {
- return service_error(SERVICE_ERROR_LAUNCH_REJECTED, __FUNCTION__, NULL);
- }
- }
-
- service->launch_pid = launch_pid;
-
- return SERVICE_ERROR_NONE;
-}
-
-
-int service_send_terminate_request(service_h service)
-{
- if (service_valiate_service(service))
- {
- return service_error(SERVICE_ERROR_INVALID_PARAMETER, __FUNCTION__, NULL);
- }
-
- if(service->type != SERVICE_TYPE_REQUEST || service->launch_pid < 0)
- {
- return service_error(SERVICE_ERROR_INVALID_PARAMETER, __FUNCTION__, NULL);
- }
-
- appsvc_subapp_terminate_request_pid(service->launch_pid);
-
- return SERVICE_ERROR_NONE;
-}
-
-static bool service_copy_reply_data_cb(service_h service, const char *key, void *user_data)
-{
- bundle *reply_data = user_data;
- char *value = NULL;
- char **value_array = NULL;
- int value_array_length = 0;
- int value_array_index = 0;
-
- if (reply_data == NULL)
- {
- service_error(SERVICE_ERROR_INVALID_PARAMETER, __FUNCTION__, NULL);
- return false;
- }
-
- if (appsvc_data_is_array(service->data, key))
- {
- service_get_extra_data_array(service, key, &value_array, &value_array_length);
- appsvc_add_data_array(reply_data, key, (const char**)value_array, value_array_length);
-
- for (value_array_index=0; value_array_index < value_array_length; value_array_index++)
- {
- free(value_array[value_array_index]);
- }
-
- free(value_array);
- }
- else
- {
- service_get_extra_data(service, key, &value);
- appsvc_add_data(reply_data, key, value);
- free(value);
- }
-
- return true;
-}
-
-int service_reply_to_launch_request(service_h reply, service_h request, service_result_e result)
-{
- bundle *reply_data;
- int appsvc_result;
-
- if (service_valiate_service(reply) || service_valiate_service(request))
- {
- return service_error(SERVICE_ERROR_INVALID_PARAMETER, __FUNCTION__, NULL);
- }
-
- if (appsvc_create_result_bundle(request->data, &reply_data) != 0)
- {
- return service_error(SERVICE_ERROR_INVALID_PARAMETER, __FUNCTION__, "failed to create a result bundle");
- }
-
- service_foreach_extra_data(reply, service_copy_reply_data_cb, reply_data);
-
- switch (result)
- {
- case SERVICE_RESULT_SUCCEEDED:
- appsvc_result = APPSVC_RES_OK;
- break;
-
- case SERVICE_RESULT_FAILED:
- appsvc_result = APPSVC_RES_NOT_OK;
- break;
-
- case SERVICE_RESULT_CANCELED:
- appsvc_result = APPSVC_RES_CANCEL;
- break;
-
- default:
- appsvc_result = APPSVC_RES_CANCEL;
- break;
- }
-
- appsvc_send_result(reply_data, appsvc_result);
-
- return SERVICE_ERROR_NONE;
-}
-
-
-int service_add_extra_data(service_h service, const char *key, const char *value)
-{
- if (service_valiate_service(service) || service_validate_extra_data(key) || service_validate_extra_data(value))
- {
- return service_error(SERVICE_ERROR_INVALID_PARAMETER, __FUNCTION__, NULL);
- }
-
- if (service_validate_internal_key(key))
- {
- return service_error(SERVICE_ERROR_KEY_REJECTED, __FUNCTION__, "the given key is reserved as internal use");
- }
-
- if (appsvc_get_data(service->data, key) != NULL)
- {
- // overwrite any existing value
- bundle_del(service->data, key);
- }
-
- if (appsvc_add_data(service->data, key, value) != 0)
- {
- return service_error(SERVICE_ERROR_KEY_REJECTED, __FUNCTION__, "failed to add data to the appsvc handle");
- }
-
- return SERVICE_ERROR_NONE;
-}
-
-
-int service_add_extra_data_array(service_h service, const char *key, const char* value[], int length)
-{
- if (service_valiate_service(service) || service_validate_extra_data(key))
- {
- return service_error(SERVICE_ERROR_INVALID_PARAMETER, __FUNCTION__, NULL);
- }
-
- if (value == NULL || length <= 0)
- {
- return service_error(SERVICE_ERROR_INVALID_PARAMETER, __FUNCTION__, "invalid array");
- }
-
- if (service_validate_internal_key(key))
- {
- return service_error(SERVICE_ERROR_KEY_REJECTED, __FUNCTION__, "the given key is reserved as internal use");
- }
-
- if (appsvc_get_data_array(service->data, key, NULL) != NULL)
- {
- // overwrite any existing value
- bundle_del(service->data,key);
- }
-
- if (appsvc_add_data_array(service->data, key, value, length) != 0)
- {
- return service_error(SERVICE_ERROR_KEY_REJECTED, __FUNCTION__, "failed to add array data to the appsvc handle");
- }
-
- return SERVICE_ERROR_NONE;
-}
-
-
-int service_remove_extra_data(service_h service, const char *key)
-{
- if (service_valiate_service(service) || service_validate_extra_data(key))
- {
- return service_error(SERVICE_ERROR_INVALID_PARAMETER, __FUNCTION__, NULL);
- }
-
- if (service_validate_internal_key(key))
- {
- return service_error(SERVICE_ERROR_KEY_REJECTED, __FUNCTION__, "the given key is reserved as internal use");
- }
-
- if (bundle_del(service->data, key))
- {
- return service_error(SERVICE_ERROR_KEY_NOT_FOUND, __FUNCTION__, NULL);
- }
-
- return SERVICE_ERROR_NONE;
-}
-
-
-int service_get_extra_data(service_h service, const char *key, char **value)
-{
- const char *data_value;
-
- if (service_valiate_service(service) || service_validate_extra_data(key) || value == NULL)
- {
- return service_error(SERVICE_ERROR_INVALID_PARAMETER, __FUNCTION__, NULL);
- }
-
-
- if (service_validate_internal_key(key))
- {
- return service_error(SERVICE_ERROR_KEY_REJECTED, __FUNCTION__, "the given key is reserved as internal use");
- }
-
- data_value = appsvc_get_data(service->data, key);
-
- if (data_value == NULL)
- {
- if (errno == ENOTSUP)
- {
- return service_error(SERVICE_ERROR_INVALID_DATA_TYPE, __FUNCTION__, NULL);
- }
- else
- {
- return service_error(SERVICE_ERROR_KEY_NOT_FOUND, __FUNCTION__, NULL);
- }
- }
-
- *value = strdup(data_value);
-
- return SERVICE_ERROR_NONE;
-}
-
-
-int service_get_extra_data_array(service_h service, const char *key, char ***value, int *length)
-{
- const char **array_data;
- int array_data_length;
- char **array_data_clone;
- int i;
-
- if (service_valiate_service(service) || service_validate_extra_data(key))
- {
- return service_error(SERVICE_ERROR_INVALID_PARAMETER, __FUNCTION__, NULL);
- }
-
- if (value == NULL || length == 0)
- {
- return service_error(SERVICE_ERROR_INVALID_PARAMETER, __FUNCTION__, NULL);
- }
-
- if (service_validate_internal_key(key))
- {
- return service_error(SERVICE_ERROR_KEY_REJECTED, __FUNCTION__, "the given key is reserved as internal use");
- }
-
- array_data = appsvc_get_data_array(service->data, key, &array_data_length);
-
- if (array_data == NULL)
- {
- if (errno == ENOTSUP)
- {
- return service_error(SERVICE_ERROR_INVALID_DATA_TYPE, __FUNCTION__, NULL);
- }
- else
- {
- return service_error(SERVICE_ERROR_KEY_NOT_FOUND, __FUNCTION__, NULL);
- }
- }
-
- array_data_clone = calloc(array_data_length, sizeof(char*));
-
- if (array_data_clone == NULL)
- {
- return service_error(SERVICE_ERROR_OUT_OF_MEMORY, __FUNCTION__, NULL);
- }
-
- for (i=0; i<array_data_length; i++)
- {
- if (array_data[i] != NULL)
- {
- array_data_clone[i] = strdup(array_data[i]);
- }
- }
-
- *value = array_data_clone;
- *length = array_data_length;
-
- return SERVICE_ERROR_NONE;
-}
-
-
-int service_is_extra_data_array(service_h service, const char *key, bool *array)
-{
- if (service_valiate_service(service) || service_validate_extra_data(key) || array == NULL)
- {
- return service_error(SERVICE_ERROR_INVALID_PARAMETER, __FUNCTION__, NULL);
- }
-
- if (service_validate_internal_key(key))
- {
- return service_error(SERVICE_ERROR_KEY_REJECTED, __FUNCTION__, "the given key is reserved as internal use");
-\r }
-
- if (!appsvc_data_is_array(service->data, key))
- {
- *array = false;
- }
- else
- {
- *array = true;
- }
-
- return SERVICE_ERROR_NONE;
-}
-
-
-typedef struct {
- service_h service;
- service_extra_data_cb callback;
- void* user_data;
- bool foreach_break;
-} foreach_context_extra_data_t;
-
-static void service_cb_broker_bundle_iterator(const char *key, const int type, const bundle_keyval_t *kv, void *user_data)
-{
- foreach_context_extra_data_t* foreach_context = NULL;
- service_extra_data_cb extra_data_cb;
-
- if (key == NULL || !(type == BUNDLE_TYPE_STR || type == BUNDLE_TYPE_STR_ARRAY))
- {
- return;
- }
-
- foreach_context = (foreach_context_extra_data_t*)user_data;
-
- if (foreach_context->foreach_break == true)
- {
- return;
- }
-
- if (service_validate_internal_key(key))
- {
- return;
- }
-
- extra_data_cb = foreach_context->callback;
-
- if (extra_data_cb != NULL)
- {
- bool stop_foreach = false;
-
- stop_foreach = !extra_data_cb(foreach_context->service, key, foreach_context->user_data);
-
- foreach_context->foreach_break = stop_foreach;
- }
-
-}
-
-
-int service_foreach_extra_data(service_h service, service_extra_data_cb callback, void *user_data)
-{
- foreach_context_extra_data_t foreach_context = {
- .service = service,
- .callback = callback,
- .user_data = user_data,
- .foreach_break = false
- };
-
- if (service_valiate_service(service) || callback == NULL)
- {
- return service_error(SERVICE_ERROR_INVALID_PARAMETER, __FUNCTION__, NULL);
- }
-
- bundle_foreach(service->data, service_cb_broker_bundle_iterator, &foreach_context);
-
- return SERVICE_ERROR_NONE;
-}
-
-typedef struct {
- service_h service;
- service_app_matched_cb callback;
- void* user_data;
- bool foreach_break;
-} foreach_context_launchable_app_t;
-
-int service_cb_broker_foreach_app_matched(const char *package, void *data)
-{
- foreach_context_launchable_app_t *foreach_context;
- service_app_matched_cb app_matched_cb;
-
- if (package == NULL || data == NULL)
- {
- service_error(SERVICE_ERROR_INVALID_PARAMETER, __FUNCTION__, NULL);
- return -1;
- }
-
- foreach_context = (foreach_context_launchable_app_t*)data;
-
- if (foreach_context->foreach_break == true)
- {
- return -1;
- }
-
- app_matched_cb = foreach_context->callback;
-
- if (app_matched_cb != NULL)
- {
- bool stop_foreach = false;
-
- stop_foreach = !app_matched_cb(foreach_context->service, package, foreach_context->user_data);
-
- foreach_context->foreach_break = stop_foreach;
- }
-
- return 0;
-}
-
-int service_foreach_app_matched(service_h service, service_app_matched_cb callback, void *user_data)
-{
- foreach_context_launchable_app_t foreach_context = {
- .service = service,
- .callback = callback,
- .user_data = user_data,
- .foreach_break = false
- };
-
- if (service_valiate_service(service) || callback == NULL)
- {
- return service_error(SERVICE_ERROR_INVALID_PARAMETER, __FUNCTION__, NULL);
- }
-
- appsvc_get_list(service->data, service_cb_broker_foreach_app_matched, &foreach_context);
-
- return SERVICE_ERROR_NONE;
-}
-
-
-int service_get_caller(service_h service, char **package)
-{
- const char *bundle_value;
- char *package_dup;
-
- if (service_valiate_service(service) || package == NULL)
- {
- return service_error(SERVICE_ERROR_INVALID_PARAMETER, __FUNCTION__, NULL);
- }
-
- if (service->type != SERVICE_TYPE_EVENT)
- {
- return service_error(SERVICE_ERROR_INVALID_PARAMETER, __FUNCTION__, "invalid service handle type");
- }
-
- bundle_value = bundle_get_val(service->data, AUL_K_CALLER_APPID);
- if (bundle_value == NULL)
- {
- return service_error(SERVICE_ERROR_INVALID_PARAMETER, __FUNCTION__, "failed to retrieve the appid of the caller");
- }
-
- package_dup = strdup(bundle_value);
-
- if (package_dup == NULL)
- {
- return service_error(SERVICE_ERROR_OUT_OF_MEMORY, __FUNCTION__, NULL);
- }
-
- *package = package_dup;
-
- return SERVICE_ERROR_NONE;
-}
-
-
-int service_is_reply_requested(service_h service, bool *requested)
-{
- const char *bundle_value;
-
- if (service_valiate_service(service) || requested == NULL)
- {
- return service_error(SERVICE_ERROR_INVALID_PARAMETER, __FUNCTION__, NULL);
- }
-
- if (service->type != SERVICE_TYPE_EVENT)
- {
- return service_error(SERVICE_ERROR_INVALID_PARAMETER, __FUNCTION__, "invalid service handle type");
- }
-
- bundle_value = bundle_get_val(service->data, AUL_K_WAIT_RESULT);
-
- if (bundle_value != NULL)
- {
- *requested = true;
- }
- else
- {
- *requested = false;
- }
-
- return SERVICE_ERROR_NONE;
-}
-
-int service_import_from_bundle(service_h service, bundle *data)
-{
- bundle *data_dup = NULL;
-
- if (service_valiate_service(service) || data == NULL)
- {
- return service_error(SERVICE_ERROR_INVALID_PARAMETER, __FUNCTION__, NULL);
- }
-
- data_dup = bundle_dup(data);
-
- if (data_dup == NULL)
- {
- return service_error(SERVICE_ERROR_INVALID_PARAMETER, __FUNCTION__, "failed to duplicate the bundle");
- }
-
- if (service->data != NULL)
- {
- bundle_free(service->data);
- }
-
- service->data = data_dup;
-
- return SERVICE_ERROR_NONE;
-}
-
-int service_export_as_bundle(service_h service, bundle **data)
-{
- bundle *data_dup = NULL;
-
- if (service_valiate_service(service) || data == NULL)
- {
- return service_error(SERVICE_ERROR_INVALID_PARAMETER, __FUNCTION__, NULL);
- }
-
- data_dup = bundle_dup(service->data);
-
- if (data_dup == NULL)
- {
- return service_error(SERVICE_ERROR_INVALID_PARAMETER, __FUNCTION__, "failed to duplicate the bundle");
- }
-
- *data = data_dup;
-
- return SERVICE_ERROR_NONE;
-}
-
-
-int service_request_transient_app(service_h service, unsigned int callee_id, service_host_res_fn cbfunc, void *data)
-{
- int ret;
-
- if (service_valiate_service(service))
- {
- return service_error(SERVICE_ERROR_INVALID_PARAMETER, __FUNCTION__, NULL);
- }
-
- ret = appsvc_request_transient_app(service->data, callee_id, (appsvc_host_res_fn)cbfunc, data);
-
- if (ret < 0)
- {
- return service_error(SERVICE_ERROR_INVALID_PARAMETER, __FUNCTION__, NULL);
- }
-
- return SERVICE_ERROR_NONE;
-}
-
+++ /dev/null
-/*
- * Copyright (c) 2011 Samsung Electronics Co., Ltd All Rights Reserved
- *
- * 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 <stdlib.h>
-#include <string.h>
-#include <sys/vfs.h>
-
-#include <aul.h>
-#include <dlog.h>
-#include <vconf.h>
-
-#include <app_storage.h>
-#include <app_storage_private.h>
-
-#ifdef LOG_TAG
-#undef LOG_TAG
-#endif
-
-#define LOG_TAG "CAPI_APPFW_APPLICATION_STORAGE"
-
-static int storage_initialize();
-static int storage_register_device(storage_device_h device);
-static int storage_get_storage(int id, storage_info_h* storage_info);
-
-extern storage_device_h storage_internal_device();
-extern storage_device_h storage_sdcard_device();
-extern storage_device_h storage_usbhost_device();
-
-extern int storage_internal_get_state();
-extern int storage_sdcard_get_state();
-extern int storage_usbhost_get_state();
-
-#define STORAGE_MAX 3
-static struct storage_info_s storage_info_table[STORAGE_MAX];
-static int storage_num = 0;
-
-static int storage_register_device(storage_device_h device)
-{
- if (device == NULL)
- {
- return -1;
- }
-
- if (storage_num >= STORAGE_MAX)
- {
- LOGE("failed to register device : not enough device table");
- return -1;
- }
-
- storage_info_table[storage_num].id = storage_num;
- storage_info_table[storage_num].device = device;
- storage_info_table[storage_num].state = device->get_state();
- storage_info_table[storage_num].state_cb = NULL;
- storage_info_table[storage_num].state_cb_data = NULL;
-
- storage_num++;
-
- return 0;
-}
-
-static int storage_initialize()
-{
- storage_device_h dev_internal;
- storage_device_h dev_sdcard;
- storage_device_h dev_usbhost;
-
- dev_internal = storage_internal_device();
- storage_register_device(dev_internal);
-
- dev_sdcard = storage_sdcard_device();
- storage_register_device(dev_sdcard);
-
- dev_usbhost = storage_usbhost_device();
- storage_register_device(dev_usbhost);
-
- return 0;
-}
-
-static int storage_get_storage(int id, storage_info_h* storage_info)
-{
- int device_state = -1;
-
- if (storage_num < 1)
- {
- if (storage_initialize() != 0)
- {
- return STORAGE_ERROR_NOT_SUPPORTED;
- }
- }
-
- if (id < 0 || id >= storage_num)
- {
- return STORAGE_ERROR_NOT_SUPPORTED;
- }
-
- switch (id)
- {
- case 0:
- device_state = storage_internal_get_state();
- break;
- case 1:
- device_state = storage_sdcard_get_state();
- break;
- case 2:
- device_state = storage_usbhost_get_state();
- break;
- default:
- LOGE("Device statei is invalid");
- break;
- }
- storage_info_table[id].state = device_state;
- *storage_info = &(storage_info_table[id]);
-
- return STORAGE_ERROR_NONE;
-}
-
-int storage_foreach_device_supported(storage_device_supported_cb callback, void *user_data)
-{
- int storage_id = 0;
- storage_info_h storage_info = NULL;
- bool foreach_next = false;
-
- if (callback == NULL)
- {
- LOGE("INVALID_PARAMETER(0x%08x) : invalid callback", STORAGE_ERROR_INVALID_PARAMETER);
- return STORAGE_ERROR_INVALID_PARAMETER;
- }
-
- while (true)
- {
- if (storage_get_storage(storage_id, &storage_info) != 0)
- {
- break;
- }
-
- storage_id++;
-
- foreach_next = callback(storage_info->id, storage_info->device->type, storage_info->state, storage_info->device->path, user_data);
-
- if (foreach_next == false)
- {
- break;
- }
- }
-
- return STORAGE_ERROR_NONE;
-}
-
-
-int storage_get_root_directory(int storage, char **path)
-{
- storage_info_h storage_info;
-
- if (path == NULL)
- {
- LOGE("INVALID_PARAMETER(0x%08x) : invalid output param", STORAGE_ERROR_INVALID_PARAMETER);
- return STORAGE_ERROR_INVALID_PARAMETER;
- }
-
- if (storage_get_storage(storage, &storage_info) != 0)
- {
- LOGE("NOT_SUPPORTED(0x%08x) : storage(%d)", STORAGE_ERROR_NOT_SUPPORTED, storage);
- return STORAGE_ERROR_NOT_SUPPORTED;
- }
-
- *path = strdup(storage_info->device->path);
-
- return STORAGE_ERROR_NONE;
-}
-
-
-int storage_get_type(int storage, storage_type_e *type)
-{
- storage_info_h storage_info;
-
- if (type == NULL)
- {
- LOGE("INVALID_PARAMETER(0x%08x) : invalid output param", STORAGE_ERROR_INVALID_PARAMETER);
- return STORAGE_ERROR_INVALID_PARAMETER;
- }
-
- if (storage_get_storage(storage, &storage_info) != 0)
- {
- LOGE("NOT_SUPPORTED(0x%08x) : storage(%d)", STORAGE_ERROR_NOT_SUPPORTED, storage);
- return STORAGE_ERROR_NOT_SUPPORTED;
- }
-
- *type = storage_info->device->type;
-
- return STORAGE_ERROR_NONE;
-}
-
-
-int storage_get_state(int storage, storage_state_e *state)
-{
- storage_info_h storage_info;
- storage_dev_get_state get_state;
-
- if (state == NULL)
- {
- LOGE("INVALID_PARAMETER(0x%08x) : invalid output param", STORAGE_ERROR_INVALID_PARAMETER);
- return STORAGE_ERROR_INVALID_PARAMETER;
- }
-
- if (storage_get_storage(storage, &storage_info) != 0)
- {
- LOGE("NOT_SUPPORTED(0x%08x) : storage(%d)", STORAGE_ERROR_NOT_SUPPORTED, storage);
- return STORAGE_ERROR_NOT_SUPPORTED;
- }
-
- get_state = storage_info->device->get_state;
-
- if (get_state == NULL)
- {
- LOGE("NOT_SUPPORTED(0x%08x) : storage(%d)", STORAGE_ERROR_NOT_SUPPORTED, storage);
- return STORAGE_ERROR_NOT_SUPPORTED;
- }
-
- storage_info->state = get_state();
-
- *state = storage_info->state;
-
- return STORAGE_ERROR_NONE;
-}
-
-
-void storage_dispatch_state_event(storage_state_e state, void* data)
-{
- storage_info_h storage_info;
- storage_state_changed_cb state_cb;
-
- storage_info = data;
-
- if (storage_info == NULL)
- {
- LOGE("INVALID_PARAMETER(0x%08x) : invalid storage information", STORAGE_ERROR_INVALID_PARAMETER);
- return;
- }
-
- storage_info->state = state;
- state_cb = storage_info->state_cb;
-
- if (state_cb != NULL)
- {
- state_cb(storage_info->id, state, storage_info->state_cb_data);
- }
-}
-
-
-int storage_set_state_changed_cb(int storage, storage_state_changed_cb callback, void *user_data)
-{
- storage_info_h storage_info;
- storage_dev_set_state_cb set_state_cb;
-
- if (callback == NULL)
- {
- LOGE("INVALID_PARAMETER(0x%08x) : invalid callback", STORAGE_ERROR_INVALID_PARAMETER);
- return STORAGE_ERROR_INVALID_PARAMETER;
- }
-
- if (storage_get_storage(storage, &storage_info) != 0)
- {
- LOGE("NOT_SUPPORTED(0x%08x) : storage(%d)", STORAGE_ERROR_NOT_SUPPORTED, storage);
- return STORAGE_ERROR_NOT_SUPPORTED;
- }
-
- storage_info->state_cb = callback;
- storage_info->state_cb_data = user_data;
-
- set_state_cb = storage_info->device->set_state_cb;
-
- if (set_state_cb == NULL)
- {
- LOGE("NOT_SUPPORTED(0x%08x) : storage(%d)", STORAGE_ERROR_NOT_SUPPORTED, storage);
- return STORAGE_ERROR_NOT_SUPPORTED;
- }
-
- if (set_state_cb(storage_info) != 0)
- {
- LOGE("NOT_SUPPORTED(0x%08x) : storage(%d)", STORAGE_ERROR_NOT_SUPPORTED, storage);
- return STORAGE_ERROR_NOT_SUPPORTED;
- }
-
- return STORAGE_ERROR_NONE;
-}
-
-
-int storage_unset_state_changed_cb(int storage)
-{
- storage_info_h storage_info;
- storage_dev_unset_state_cb unset_state_cb;
-
- if (storage_get_storage(storage, &storage_info) != 0)
- {
- LOGE("NOT_SUPPORTED(0x%08x) : storage(%d)", STORAGE_ERROR_NOT_SUPPORTED, storage);
- return STORAGE_ERROR_NOT_SUPPORTED;
- }
-
- storage_info->state_cb = NULL;
- unset_state_cb = storage_info->device->unset_state_cb;
-
- if (unset_state_cb != NULL)
- {
- unset_state_cb();
- }
-
- return STORAGE_ERROR_NONE;
-}
-
-
-int storage_get_total_space(int storage, unsigned long long *bytes)
-{
- storage_info_h storage_info;
- storage_dev_get_space get_space;
-
- if (bytes == NULL)
- {
- LOGE("INVALID_PARAMETER(0x%08x) : invalid output param", STORAGE_ERROR_INVALID_PARAMETER);
- return STORAGE_ERROR_INVALID_PARAMETER;
- }
-
- if (storage_get_storage(storage, &storage_info) != 0)
- {
- LOGE("NOT_SUPPORTED(0x%08x) : storage(%d)", STORAGE_ERROR_NOT_SUPPORTED, storage);
- return STORAGE_ERROR_NOT_SUPPORTED;
- }
-
- get_space = storage_info->device->get_space;
-
- if (get_space == NULL)
- {
- LOGE("NOT_SUPPORTED(0x%08x) : storage(%d)", STORAGE_ERROR_NOT_SUPPORTED, storage);
- return STORAGE_ERROR_NOT_SUPPORTED;
- }
-
- if (get_space(bytes, NULL) != 0)
- {
- LOGE("NOT_SUPPORTED(0x%08x) : storage(%d)", STORAGE_ERROR_NOT_SUPPORTED, storage);
- return STORAGE_ERROR_NOT_SUPPORTED;
- }
-
- return STORAGE_ERROR_NONE;
-}
-
-int storage_get_available_space(int storage, unsigned long long *bytes)
-{
- storage_info_h storage_info;
- storage_dev_get_space get_space;
-
- if (bytes == NULL)
- {
- LOGE("INVALID_PARAMETER(0x%08x) : invalid output param", STORAGE_ERROR_INVALID_PARAMETER);
- return STORAGE_ERROR_INVALID_PARAMETER;
- }
-
- if (storage_get_storage(storage, &storage_info) != 0)
- {
- LOGE("NOT_SUPPORTED(0x%08x) : storage(%d)", STORAGE_ERROR_NOT_SUPPORTED, storage);
- return STORAGE_ERROR_NOT_SUPPORTED;
- }
-
- get_space = storage_info->device->get_space;
-
- if (get_space == NULL)
- {
- LOGE("NOT_SUPPORTED(0x%08x) : storage(%d)", STORAGE_ERROR_NOT_SUPPORTED, storage);
- return STORAGE_ERROR_NOT_SUPPORTED;
- }
-
- if (get_space(NULL, bytes) != 0)
- {
- LOGE("NOT_SUPPORTED(0x%08x) : storage(%d)", STORAGE_ERROR_NOT_SUPPORTED, storage);
- return STORAGE_ERROR_NOT_SUPPORTED;
- }
-
- return STORAGE_ERROR_NONE;
-}
-
-int storage_statfs(const char *directory, unsigned long long *total, unsigned long long *available)
-{
- struct statfs fs;
-
- if (statfs(directory, &fs) < 0)
- {
- LOGE("statfs returns error(%d) directory(%s)\n", errno, directory);
- return -1;
- }
-
- if (total != NULL)
- {
- *total = (unsigned long long)fs.f_bsize * (unsigned long long)fs.f_blocks;
- }
-
- if (available != NULL)
- {
- *available = (unsigned long long)fs.f_bsize * (unsigned long long)fs.f_bavail;
- }
-
- return 0;
-}
-
+++ /dev/null
-/*
- * Copyright (c) 2011 Samsung Electronics Co., Ltd All Rights Reserved
- *
- * 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 <stdlib.h>
-#include <string.h>
-#include <sys/vfs.h>
-
-#include <aul.h>
-#include <dlog.h>
-#include <vconf.h>
-
-#include <app_storage.h>
-#include <app_storage_private.h>
-
-#ifdef LOG_TAG
-#undef LOG_TAG
-#endif
-
-#define LOG_TAG "CAPI_APPFW_APPLICATION_STORAGE"
-
-#define INTERNAL_MEMORY_PATH "/opt/usr/media"
-
-int storage_internal_get_state()
-{
- return STORAGE_STATE_MOUNTED;
-}
-
-static int storage_internal_set_state_cb(void *data)
-{
- return 0;
-}
-
-static void storage_internal_unset_state_cb()
-{
- // empty function
-}
-
-int storage_internal_get_space(unsigned long long *total, unsigned long long *available)
-{
- return storage_statfs(INTERNAL_MEMORY_PATH, total, available);
-}
-
-storage_device_h storage_internal_device()
-{
- storage_device_h device;
-
- device = calloc(1, sizeof(struct storage_device_s));
-
- if (device == NULL)
- {
- LOGE("OUT_OF_MEMORY(0x%08x)", STORAGE_ERROR_OUT_OF_MEMORY);
- return NULL;
- }
-
- device->type = STORAGE_TYPE_INTERNAL;
- device->path = INTERNAL_MEMORY_PATH;
- device->get_state = storage_internal_get_state;
- device->set_state_cb = storage_internal_set_state_cb;
- device->unset_state_cb = storage_internal_unset_state_cb;
- device->get_space = storage_internal_get_space;
-
- return device;
-}
-
+++ /dev/null
-/*
- * Copyright (c) 2011 Samsung Electronics Co., Ltd All Rights Reserved
- *
- * 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 <stdlib.h>
-#include <string.h>
-#include <sys/vfs.h>
-
-#include <aul.h>
-#include <dlog.h>
-#include <vconf.h>
-
-#include <app_storage.h>
-#include <app_storage_private.h>
-
-#ifdef LOG_TAG
-#undef LOG_TAG
-#endif
-
-#define LOG_TAG "CAPI_APPFW_APPLICATION_STORAGE"
-
-#define SDCARD_PATH "/opt/storage/sdcard"
-
-int storage_sdcard_get_state()
-{
- int sdcard_state = 0;
-
- vconf_get_int(VCONFKEY_SYSMAN_MMC_STATUS, &sdcard_state);
-
- switch (sdcard_state)
- {
- case VCONFKEY_SYSMAN_MMC_REMOVED:
- return STORAGE_STATE_REMOVED;
-
- case VCONFKEY_SYSMAN_MMC_MOUNTED:
- return STORAGE_STATE_MOUNTED;
-
- case VCONFKEY_SYSMAN_MMC_INSERTED_NOT_MOUNTED:
- return STORAGE_STATE_UNMOUNTABLE;
-
- default:
- return STORAGE_STATE_REMOVED;
- }
-}
-
-static void storage_sdcard_state_cb_broker(keynode_t* key, void* data)
-{
- storage_state_e state;
- state = storage_sdcard_get_state();
-
- storage_dispatch_state_event(state, data);
-}
-
-static int storage_sdcard_set_state_cb(void *data)
-{
- vconf_notify_key_changed(VCONFKEY_SYSMAN_MMC_STATUS, storage_sdcard_state_cb_broker, data);
- return 0;
-}
-
-static void storage_sdcard_unset_state_cb()
-{
- vconf_ignore_key_changed(VCONFKEY_SYSMAN_MMC_STATUS, storage_sdcard_state_cb_broker);
-}
-
-static int storage_sdcard_get_space(unsigned long long *total, unsigned long long *available)
-{
- storage_state_e state;
- state = storage_sdcard_get_state();
-
- if (state < STORAGE_STATE_MOUNTED)
- {
- if (total != NULL)
- {
- *total = 0;
- }
-
- if (available != NULL)
- {
- *available = 0;
- }
-
- return 0;
- }
- else
- {
- return storage_statfs(SDCARD_PATH, total, available);
- }
-}
-
-storage_device_h storage_sdcard_device()
-{
- storage_device_h device;
-
- device = calloc(1, sizeof(struct storage_device_s));
-
- if (device == NULL)
- {
- LOGE("OUT_OF_MEMORY(0x%08x)", STORAGE_ERROR_OUT_OF_MEMORY);
- return NULL;
- }
-
- device->type = STORAGE_TYPE_EXTERNAL;
- device->path = SDCARD_PATH;
- device->get_state = storage_sdcard_get_state;
- device->set_state_cb = storage_sdcard_set_state_cb;
- device->unset_state_cb = storage_sdcard_unset_state_cb;
- device->get_space = storage_sdcard_get_space;
-
- return device;
-}
-
+++ /dev/null
-/*
- * Copyright (c) 2011 Samsung Electronics Co., Ltd All Rights Reserved
- *
- * 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 <stdlib.h>
-#include <string.h>
-#include <sys/vfs.h>
-
-#include <aul.h>
-#include <dlog.h>
-#include <vconf.h>
-
-#include <app_storage.h>
-#include <app_storage_private.h>
-
-#ifdef LOG_TAG
-#undef LOG_TAG
-#endif
-
-#define LOG_TAG "CAPI_APPFW_APPLICATION_STORAGE"
-
-#define USBHOST_PATH "/opt/storage/usb"
-
-int storage_usbhost_get_state()
-{
- int usbhost_state = 0;
-
- vconf_get_int(VCONFKEY_SYSMAN_USB_HOST_STATUS, &usbhost_state);
-
- switch (usbhost_state)
- {
- case VCONFKEY_SYSMAN_USB_HOST_DISCONNECTED:
- return STORAGE_STATE_REMOVED;
-
- case VCONFKEY_SYSMAN_USB_HOST_CONNECTED:
- return STORAGE_STATE_MOUNTED;
-
- default:
- return STORAGE_STATE_REMOVED;
- }
-}
-
-static void storage_usbhost_state_cb_broker(keynode_t* key, void* data)
-{
- storage_state_e state;
-
- state = storage_usbhost_get_state();
-
- storage_dispatch_state_event(state, data);
-}
-
-static int storage_usbhost_set_state_cb(void *data)
-{
- vconf_notify_key_changed(VCONFKEY_SYSMAN_USB_HOST_STATUS, storage_usbhost_state_cb_broker, data);
- return 0;
-}
-
-static void storage_usbhost_unset_state_cb()
-{
- vconf_ignore_key_changed(VCONFKEY_SYSMAN_USB_HOST_STATUS, storage_usbhost_state_cb_broker);
-}
-
-
-static int storage_usbhost_get_space(unsigned long long *total, unsigned long long *available)
-{
- storage_state_e state;
- state = storage_usbhost_get_state();
-
- if (state < STORAGE_STATE_MOUNTED)
- {
- if (total != NULL)
- {
- *total = 0;
- }
-
- if (available != NULL)
- {
- *available = 0;
- }
-
- return 0;
- }
- else
- {
- return storage_statfs(USBHOST_PATH, total, available);
- }
-}
-
-
-storage_device_h storage_usbhost_device()
-{
- storage_device_h device;
-
- device = calloc(1, sizeof(struct storage_device_s));
-
- if (device == NULL)
- {
- LOGE("OUT_OF_MEMORY(0x%08x)", STORAGE_ERROR_OUT_OF_MEMORY);
- return NULL;
- }
-
- device->type = STORAGE_TYPE_EXTERNAL;
- device->path = USBHOST_PATH;
- device->get_state = storage_usbhost_get_state;
- device->set_state_cb = storage_usbhost_set_state_cb;
- device->unset_state_cb = storage_usbhost_unset_state_cb;
- device->get_space = storage_usbhost_get_space;
-
- return device;
-}
-
+++ /dev/null
-/*
- * Copyright (c) 2011 Samsung Electronics Co., Ltd All Rights Reserved
- *
- * 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 <stdlib.h>
-#include <string.h>
-#include <stdarg.h>
-#include <sys/stat.h>
-#include <unistd.h>
-#include <fcntl.h>
-
-#include <dlog.h>
-#include <notification.h>
-
-#include <app.h>
-#include <app_service_private.h>
-
-#ifdef LOG_TAG
-#undef LOG_TAG
-#endif
-
-#define LOG_TAG "CAPI_APPFW_APPLICATION_UI_NOTIFICATION"
-
-struct ui_notification_s {
- notification_h raw_handle;
- bool ongoing;
- bool posted;
- bool removed;
- char *icon;
- struct tm *time;
- char *title;
- char *content;
- service_h service;
- char *sound;
- bool vibration;
-};
-
-static int ui_notification_error_handler(int error, const char *func, const char *on_error)
-{
- int retcode;
- char *error_msg;
-
- switch (error)
- {
- case NOTIFICATION_ERROR_NONE:
- retcode = UI_NOTIFICATION_ERROR_NONE;
- break;
-
- case NOTIFICATION_ERROR_INVALID_DATA:
- retcode = UI_NOTIFICATION_ERROR_INVALID_PARAMETER;
- error_msg = "INVALID_PARAMETER";
- break;
-
- case NOTIFICATION_ERROR_NO_MEMORY:
- retcode = UI_NOTIFICATION_ERROR_OUT_OF_MEMORY;
- error_msg = "OUT_OF_MEMORY";
- break;
-
- case NOTIFICATION_ERROR_FROM_DB:
- retcode = UI_NOTIFICATION_ERROR_DB_FAILED;
- error_msg = "DB_FAILED";
- break;
-
- case NOTIFICATION_ERROR_ALREADY_EXIST_ID:
- case NOTIFICATION_ERROR_NOT_EXIST_ID:
- retcode = UI_NOTIFICATION_ERROR_INVALID_STATE;
- error_msg = "INVALID_STATE";
- break;
-
- default:
- retcode = UI_NOTIFICATION_ERROR_INVALID_PARAMETER;
- error_msg = "INVALID_PARAMETER";
- }
-
- if (retcode != UI_NOTIFICATION_ERROR_NONE)
- {
- LOGE("[%s] %s(0x%08x) : %s", func, error_msg, retcode, on_error);
- }
-
- return retcode;
-}
-
-
-int ui_notification_create(bool ongoing, ui_notification_h *notification)
-{
- ui_notification_h notification_out;
-
- if (notification == NULL)
- {
- LOGE("INVALID_PARAMETER(0x%08x) : invalid output param", UI_NOTIFICATION_ERROR_INVALID_PARAMETER);
- return UI_NOTIFICATION_ERROR_INVALID_PARAMETER;
- }
-
- notification_out = (ui_notification_h)calloc(1, sizeof(struct ui_notification_s));
-
- if (notification_out == NULL)
- {
- LOGE("OUT_OF_MEMORY(0x%08x)", UI_NOTIFICATION_ERROR_OUT_OF_MEMORY);
- return UI_NOTIFICATION_ERROR_OUT_OF_MEMORY;
- }
-
- notification_out->raw_handle = NULL;
- notification_out->ongoing = ongoing;
- notification_out->posted = false;
- notification_out->removed = false;
- notification_out->icon = NULL;
- notification_out->time = NULL;
- notification_out->title = NULL;
- notification_out->content = NULL;
- notification_out->service = NULL;
- notification_out->sound = NULL;
- notification_out->vibration = false;
-
- *notification = notification_out;
-
- return UI_NOTIFICATION_ERROR_NONE;
-}
-
-static int ui_notification_construct(bool ongoing, notification_h raw_handle, ui_notification_h *notification)
-{
- int retcode;
- ui_notification_h notification_out;
- char *icon;
- time_t time;
- char *title;
- char *content;
- bundle *service_data;
- const char *sound = NULL;
- notification_sound_type_e sound_type;
- notification_vibration_type_e vib_type;
-
- if (notification == NULL)
- {
- LOGE("INVALID_PARAMETER(0x%08x) : invalid output param", UI_NOTIFICATION_ERROR_INVALID_PARAMETER);
- return UI_NOTIFICATION_ERROR_INVALID_PARAMETER;
- }
-
- notification_out = (ui_notification_h)calloc(1, sizeof(struct ui_notification_s));
-
- if (notification_out == NULL)
- {
- LOGE("OUT_OF_MEMORY(0x%08x)", UI_NOTIFICATION_ERROR_OUT_OF_MEMORY);
- return UI_NOTIFICATION_ERROR_OUT_OF_MEMORY;
- }
-
- retcode = ui_notification_error_handler(notification_clone(raw_handle, &(notification_out->raw_handle)),\
- __FUNCTION__, "failed to clone the notification handle");
-
- if (retcode != NOTIFICATION_ERROR_NONE)
- {
- free(notification_out);
- return retcode;
- }
-
- notification_out->ongoing = ongoing;
-
- notification_out->posted = true;
-
- notification_out->removed = false;
-
- if (!notification_get_image(raw_handle, NOTIFICATION_IMAGE_TYPE_ICON, &icon) && icon)
- {
- notification_out->icon = strdup(icon);
- }
-
- if (!notification_get_time(raw_handle, &time))
- {
- notification_out->time = malloc(sizeof(struct tm));
-
- if (notification_out->time == NULL)
- {
- ui_notification_destroy(notification_out);
- LOGE("OUT_OF_MEMORY(0x%08x)", UI_NOTIFICATION_ERROR_OUT_OF_MEMORY);
- return UI_NOTIFICATION_ERROR_OUT_OF_MEMORY;
- }
-
- localtime_r(&time, notification_out->time);
- }
-
- if (!notification_get_text(raw_handle, NOTIFICATION_TEXT_TYPE_TITLE, &title) && title)
- {
- notification_out->title = strdup(title);
- }
-
- if (!notification_get_text(raw_handle, NOTIFICATION_TEXT_TYPE_CONTENT, &content) && content)
- {
- notification_out->content = strdup(content);
- }
-
- if (!notification_get_sound(raw_handle, &sound_type, &sound) && sound)
- {
- notification_out->sound = strdup(sound);
- }
-
- if (!notification_get_vibration(raw_handle, &vib_type, NULL))
- {
- if (vib_type == NOTIFICATION_VIBRATION_TYPE_DEFAULT)
- {
- notification_out->vibration = true;
- }
- }
-
- if (!notification_get_execute_option(raw_handle, NOTIFICATION_EXECUTE_TYPE_SINGLE_LAUNCH, NULL, &service_data))
- {
- service_h service;
-
- if (!service_create_request(service_data, &service))
- {
- notification_out->service = service;
- }
- }
-
- *notification = notification_out;
-
- return UI_NOTIFICATION_ERROR_NONE;
-}
-
-int ui_notification_destroy(ui_notification_h notification)
-{
- if (notification == NULL)
- {
- LOGE("INVALID_PARAMETER(0x%08x) : invalid handle", UI_NOTIFICATION_ERROR_INVALID_PARAMETER);
- return UI_NOTIFICATION_ERROR_INVALID_PARAMETER;
- }
-
- if (notification->raw_handle)
- notification_free(notification->raw_handle);
-
- if (notification->icon)
- free(notification->icon);
-
- if (notification->time)
- free(notification->time);
-
- if (notification->title)
- free(notification->title);
-
- if (notification->content)
- free(notification->content);
-
- if (notification->sound)
- free(notification->sound);
-
- if (notification->service)
- service_destroy(notification->service);
-
- free(notification);
-
- return UI_NOTIFICATION_ERROR_NONE;
-}
-
-int ui_notification_get_id(ui_notification_h notification, int *id)
-{
- notification_h raw_handle = NULL;
-
- if (notification == NULL || id == NULL)
- {
- LOGE("INVALID_PARAMETER(0x%08x)", UI_NOTIFICATION_ERROR_INVALID_PARAMETER);
- return UI_NOTIFICATION_ERROR_INVALID_PARAMETER;
- }
- if (notification->raw_handle == NULL)
- {
- LOGE("INVALID_PARAMETER(0x%08x)", UI_NOTIFICATION_ERROR_INVALID_PARAMETER);
- return UI_NOTIFICATION_ERROR_INVALID_PARAMETER;
- }
-
- raw_handle = notification->raw_handle;
- if (notification_get_id(raw_handle, NULL, id) != NOTIFICATION_ERROR_NONE) {
- LOGE("INVALID_PARAMETER(0x%08x)", UI_NOTIFICATION_ERROR_INVALID_PARAMETER);
- return UI_NOTIFICATION_ERROR_INVALID_PARAMETER;
- }
-
- return UI_NOTIFICATION_ERROR_NONE;
-}
-
-int ui_notification_clone(ui_notification_h *clone, ui_notification_h notification)
-{
- ui_notification_h notification_out;
- int retcode;
-
- if (clone == NULL || notification == NULL)
- {
- LOGE("INVALID_PARAMETER(0x%08x)", UI_NOTIFICATION_ERROR_INVALID_PARAMETER);
- return UI_NOTIFICATION_ERROR_INVALID_PARAMETER;
- }
-
- notification_out = (ui_notification_h)calloc(1, sizeof(struct ui_notification_s));
-
- if (notification_out == NULL)
- {
- LOGE("OUT_OF_MEMORY(0x%08x)", UI_NOTIFICATION_ERROR_OUT_OF_MEMORY);
- return UI_NOTIFICATION_ERROR_OUT_OF_MEMORY;
- }
-
- if (notification->raw_handle != NULL)
- {
- retcode = notification_clone(notification->raw_handle, &(notification_out->raw_handle));
-
- if (retcode)
- {
- free(notification_out);
- return ui_notification_error_handler(retcode, __FUNCTION__, "failed to clone the handle");
- }
- }
-
- notification_out->ongoing = notification->ongoing;
-
- notification_out->posted = notification->posted;
-
- notification_out->removed = notification->removed;
-
- if (notification->icon)
- {
- notification_out->icon = strdup(notification->icon);
- }
-
- if (notification->time)
- {
- notification_out->time = malloc(sizeof(struct tm));
- if (notification_out->time != NULL)
- {
- memcpy(notification_out->time, notification->time, sizeof(struct tm));
- }
- }
-
- if (notification->title)
- {
- notification_out->title = strdup(notification->title);
- }
-
- if (notification->content)
- {
- notification_out->content = strdup(notification->content);
- }
-
- if (notification->sound)
- {
- notification_out->sound = strdup(notification->sound);
- }
-
- notification_out->vibration = notification->vibration;
-
- if (notification->service)
- {
- service_clone(&(notification_out->service), notification->service);
- }
-
- *clone = notification_out;
-
- return UI_NOTIFICATION_ERROR_NONE;
-}
-
-int ui_notification_is_ongoing(ui_notification_h notification, bool *ongoing)
-{
- if (notification == NULL || ongoing == NULL)
- {
- LOGE("INVALID_PARAMETER(0x%08x)", UI_NOTIFICATION_ERROR_INVALID_PARAMETER);
- return UI_NOTIFICATION_ERROR_INVALID_PARAMETER;
- }
-
- *ongoing = notification->ongoing;
-
- return UI_NOTIFICATION_ERROR_NONE;
-}
-
-int ui_notification_set_icon(ui_notification_h notification, const char *path)
-{
- char *path_dup = NULL;
-
- if (notification == NULL)
- {
- LOGE("INVALID_PARAMETER(0x%08x)", UI_NOTIFICATION_ERROR_INVALID_PARAMETER);
- return UI_NOTIFICATION_ERROR_INVALID_PARAMETER;
- }
-
- if (path != NULL)
- {
- path_dup = strdup(path);
-
- if (path_dup == NULL)
- {
- LOGE("OUT_OF_MEMORY(0x%08x)", UI_NOTIFICATION_ERROR_OUT_OF_MEMORY);
- return UI_NOTIFICATION_ERROR_OUT_OF_MEMORY;
- }
- }
-
- if (notification->icon != NULL)
- {
- free(notification->icon);
- }
-
- notification->icon = path_dup;
-
- return UI_NOTIFICATION_ERROR_NONE;
-}
-
-int ui_notification_get_icon(ui_notification_h notification, char **path)
-{
- char *path_dup = NULL;
-
- if (notification == NULL || path == NULL)
- {
- LOGE("INVALID_PARAMETER(0x%08x)", UI_NOTIFICATION_ERROR_INVALID_PARAMETER);
- return UI_NOTIFICATION_ERROR_INVALID_PARAMETER;
- }
-
- if (notification->icon != NULL)
- {
- path_dup = strdup(notification->icon);
-
- if (path_dup == NULL)
- {
- LOGE("OUT_OF_MEMORY(0x%08x)", UI_NOTIFICATION_ERROR_OUT_OF_MEMORY);
- return UI_NOTIFICATION_ERROR_OUT_OF_MEMORY;
- }
- }
-
- *path = path_dup;
-
- return UI_NOTIFICATION_ERROR_NONE;
-}
-
-int ui_notification_set_time(ui_notification_h notification, struct tm *time)
-{
- struct tm *time_dup = NULL;
-
- if (notification == NULL)
- {
- LOGE("INVALID_PARAMETER(0x%08x)", UI_NOTIFICATION_ERROR_INVALID_PARAMETER);
- return UI_NOTIFICATION_ERROR_INVALID_PARAMETER;
- }
-
- if (time != NULL)
- {
- time_dup = malloc(sizeof(struct tm));
-
- if (time_dup == NULL)
- {
- LOGE("OUT_OF_MEMORY(0x%08x)", UI_NOTIFICATION_ERROR_OUT_OF_MEMORY);
- return UI_NOTIFICATION_ERROR_OUT_OF_MEMORY;
- }
-
- memcpy(time_dup, time, sizeof(struct tm));
- }
-
- if (notification->time != NULL)
- {
- free(notification->time);
- }
-
- notification->time = time_dup;
-
- return UI_NOTIFICATION_ERROR_NONE;
-}
-
-int ui_notification_get_time(ui_notification_h notification, struct tm **time)
-{
- struct tm *time_dup = NULL;
-
- if (notification == NULL || time == NULL)
- {
- LOGE("INVALID_PARAMETER(0x%08x)", UI_NOTIFICATION_ERROR_INVALID_PARAMETER);
- return UI_NOTIFICATION_ERROR_INVALID_PARAMETER;
- }
-
- if (notification->time != NULL)
- {
- time_dup = malloc(sizeof(struct tm));
-
- if (time_dup == NULL)
- {
- LOGE("OUT_OF_MEMORY(0x%08x)", UI_NOTIFICATION_ERROR_OUT_OF_MEMORY);
- return UI_NOTIFICATION_ERROR_OUT_OF_MEMORY;
- }
-
- memcpy(time_dup, notification->time, sizeof(struct tm));
- }
-
- *time = time_dup;
-
- return UI_NOTIFICATION_ERROR_NONE;
-}
-
-int ui_notification_set_title(ui_notification_h notification, const char *title)
-{
- char *title_dup = NULL;
-
- if (notification == NULL)
- {
- LOGE("INVALID_PARAMETER(0x%08x)", UI_NOTIFICATION_ERROR_INVALID_PARAMETER);
- return UI_NOTIFICATION_ERROR_INVALID_PARAMETER;
- }
-
- if (title != NULL)
- {
- title_dup = strdup(title);
-
- if (title_dup == NULL)
- {
- LOGE("OUT_OF_MEMORY(0x%08x)", UI_NOTIFICATION_ERROR_OUT_OF_MEMORY);
- return UI_NOTIFICATION_ERROR_OUT_OF_MEMORY;
- }
- }
-
- if (notification->title != NULL)
- {
- free(notification->title);
- }
-
- notification->title = title_dup;
-
- return UI_NOTIFICATION_ERROR_NONE;
-}
-
-int ui_notification_get_title(ui_notification_h notification, char **title)
-{
- char *title_dup = NULL;
-
- if (notification == NULL || title == NULL)
- {
- LOGE("INVALID_PARAMETER(0x%08x)", UI_NOTIFICATION_ERROR_INVALID_PARAMETER);
- return UI_NOTIFICATION_ERROR_INVALID_PARAMETER;
- }
-
- if (notification->title != NULL)
- {
- title_dup = strdup(notification->title);
-
- if (title_dup == NULL)
- {
- LOGE("OUT_OF_MEMORY(0x%08x)", UI_NOTIFICATION_ERROR_OUT_OF_MEMORY);
- return UI_NOTIFICATION_ERROR_OUT_OF_MEMORY;
- }
- }
-
- *title = title_dup;
-
- return UI_NOTIFICATION_ERROR_NONE;
-}
-
-
-int ui_notification_set_content(ui_notification_h notification, const char *content)
-{
- char *content_dup = NULL;
-
- if (notification == NULL)
- {
- LOGE("INVALID_PARAMETER(0x%08x)", UI_NOTIFICATION_ERROR_INVALID_PARAMETER);
- return UI_NOTIFICATION_ERROR_INVALID_PARAMETER;
- }
-
- if (content != NULL)
- {
- content_dup = strdup(content);
-
- if (content_dup == NULL)
- {
- LOGE("OUT_OF_MEMORY(0x%08x)", UI_NOTIFICATION_ERROR_OUT_OF_MEMORY);
- return UI_NOTIFICATION_ERROR_OUT_OF_MEMORY;
- }
- }
-
- if (notification->content != NULL)
- {
- free(notification->content);
- }
-
- notification->content = content_dup;
-
- return UI_NOTIFICATION_ERROR_NONE;
-}
-
-int ui_notification_get_content(ui_notification_h notification, char **content)
-{
- char *content_dup = NULL;
-
- if (notification == NULL || content == NULL)
- {
- LOGE("INVALID_PARAMETER(0x%08x)", UI_NOTIFICATION_ERROR_INVALID_PARAMETER);
- return UI_NOTIFICATION_ERROR_INVALID_PARAMETER;
- }
-
- if (notification->content != NULL)
- {
- content_dup = strdup(notification->content);
-
- if (content_dup == NULL)
- {
- LOGE("OUT_OF_MEMORY(0x%08x)", UI_NOTIFICATION_ERROR_OUT_OF_MEMORY);
- return UI_NOTIFICATION_ERROR_OUT_OF_MEMORY;
- }
- }
-
- *content = content_dup;
-
- return UI_NOTIFICATION_ERROR_NONE;
-}
-
-
-int ui_notification_set_service(ui_notification_h notification, service_h service)
-{
- int retcode;
- service_h service_dup = NULL;
-
- if (notification == NULL)
- {
- LOGE("INVALID_PARAMETER(0x%08x)", UI_NOTIFICATION_ERROR_INVALID_PARAMETER);
- return UI_NOTIFICATION_ERROR_INVALID_PARAMETER;
- }
-
- if (service != NULL)
- {
- retcode = service_clone(&service_dup, service);
-
- if (retcode != SERVICE_ERROR_NONE)
- {
- if (retcode == SERVICE_ERROR_OUT_OF_MEMORY)
- {
- LOGE("OUT_OF_MEMORY(0x%08x)", UI_NOTIFICATION_ERROR_OUT_OF_MEMORY);
- return UI_NOTIFICATION_ERROR_OUT_OF_MEMORY;
- }
- else
- {
- LOGE("INVALID_PARAMETER(0x%08x) : invalid service handle", UI_NOTIFICATION_ERROR_INVALID_PARAMETER);
- return UI_NOTIFICATION_ERROR_INVALID_PARAMETER;
- }
- }
- }
-
- if (notification->service != NULL)
- {
- service_destroy(notification->service);
- }
-
- notification->service = service_dup;
-
- return UI_NOTIFICATION_ERROR_NONE;
-}
-
-int ui_notification_get_service(ui_notification_h notification, service_h *service)
-{
- int retcode;
- service_h service_dup = NULL;
-
- if (notification == NULL || service == NULL)
- {
- LOGE("INVALID_PARAMETER(0x%08x)", UI_NOTIFICATION_ERROR_INVALID_PARAMETER);
- return UI_NOTIFICATION_ERROR_INVALID_PARAMETER;
- }
-
- if (notification->service != NULL)
- {
- retcode = service_clone(&service_dup, notification->service);
-
- if (retcode != SERVICE_ERROR_NONE)
- {
- if (retcode == SERVICE_ERROR_OUT_OF_MEMORY)
- {
- LOGE("OUT_OF_MEMORY(0x%08x)", UI_NOTIFICATION_ERROR_OUT_OF_MEMORY);
- return UI_NOTIFICATION_ERROR_OUT_OF_MEMORY;
- }
- else
- {
- LOGE("INVALID_PARAMETER(0x%08x) : invalid service handle", UI_NOTIFICATION_ERROR_INVALID_PARAMETER);
- return UI_NOTIFICATION_ERROR_INVALID_PARAMETER;
- }
- }
- }
-
- *service = service_dup;
-
- return UI_NOTIFICATION_ERROR_NONE;
-}
-
-int ui_notification_set_sound(ui_notification_h notification, const char *path)
-{
- char *path_dup = NULL;
-
- if (notification == NULL)
- {
- LOGE("INVALID_PARAMETER(0x%08x)", UI_NOTIFICATION_ERROR_INVALID_PARAMETER);
- return UI_NOTIFICATION_ERROR_INVALID_PARAMETER;
- }
-
- if (path != NULL)
- {
- path_dup = strdup(path);
-
- if (path_dup == NULL)
- {
- LOGE("OUT_OF_MEMORY(0x%08x)", UI_NOTIFICATION_ERROR_OUT_OF_MEMORY);
- return UI_NOTIFICATION_ERROR_OUT_OF_MEMORY;
- }
- }
-
- if (notification->sound != NULL)
- {
- free(notification->sound);
- }
-
- notification->sound = path_dup;
-
- return UI_NOTIFICATION_ERROR_NONE;
-}
-
-int ui_notification_get_sound(ui_notification_h notification, char **path)
-{
- char *path_dup = NULL;
-
- if (notification == NULL || path == NULL)
- {
- LOGE("INVALID_PARAMETER(0x%08x)", UI_NOTIFICATION_ERROR_INVALID_PARAMETER);
- return UI_NOTIFICATION_ERROR_INVALID_PARAMETER;
- }
-
- if (notification->sound != NULL)
- {
- path_dup = strdup(notification->sound);
-
- if (path_dup == NULL)
- {
- LOGE("OUT_OF_MEMORY(0x%08x)", UI_NOTIFICATION_ERROR_OUT_OF_MEMORY);
- *path = NULL;
-
- return UI_NOTIFICATION_ERROR_OUT_OF_MEMORY;
- }
- }
-
- *path = path_dup;
-
- return UI_NOTIFICATION_ERROR_NONE;
-}
-
-int ui_notification_set_vibration(ui_notification_h notification, bool value)
-{
- if (notification == NULL)
- {
- LOGE("INVALID_PARAMETER(0x%08x)", UI_NOTIFICATION_ERROR_INVALID_PARAMETER);
- return UI_NOTIFICATION_ERROR_INVALID_PARAMETER;
- }
-
- notification->vibration = value;
-
- return UI_NOTIFICATION_ERROR_NONE;
-}
-
-int ui_notification_get_vibration(ui_notification_h notification, bool *value)
-{
- if (notification == NULL || value == NULL)
- {
- LOGE("INVALID_PARAMETER(0x%08x)", UI_NOTIFICATION_ERROR_INVALID_PARAMETER);
- return UI_NOTIFICATION_ERROR_INVALID_PARAMETER;
- }
-
- *value = notification->vibration;
-
- return UI_NOTIFICATION_ERROR_NONE;
-}
-
-static int ui_notification_build_attributes(ui_notification_h notification)
-{
- bundle *service_data;
-
- if (notification == NULL)
- {
- LOGE("INVALID_PARAMETER(0x%08x) : invalid handle", UI_NOTIFICATION_ERROR_INVALID_PARAMETER);
- return UI_NOTIFICATION_ERROR_INVALID_PARAMETER;
- }
-
- if (notification->icon != NULL)
- {
- struct stat st;
-
- if (stat(notification->icon, &st) < 0)
- {
- LOGE("NO_SUCH_FILE(0x%08x) : invalid icon", UI_NOTIFICATION_ERROR_NO_SUCH_FILE);
- return UI_NOTIFICATION_ERROR_NO_SUCH_FILE;
- }
-
- notification_set_image(notification->raw_handle, NOTIFICATION_IMAGE_TYPE_ICON, notification->icon);
- }
-
- if (notification->time != NULL)
- {
- notification_set_time(notification->raw_handle, mktime(notification->time));
- }
-
- if (notification->title != NULL)
- {
- notification_set_text(notification->raw_handle, NOTIFICATION_TEXT_TYPE_TITLE, notification->title, NULL, NOTIFICATION_VARIABLE_TYPE_NONE);
- }
-
- if (notification->content != NULL)
- {
- notification_set_text(notification->raw_handle, NOTIFICATION_TEXT_TYPE_CONTENT, notification->content, NULL, NOTIFICATION_VARIABLE_TYPE_NONE);
- }
-
- if (notification->service != NULL && service_to_bundle(notification->service, &service_data) == SERVICE_ERROR_NONE)
- {
- notification_set_property(notification->raw_handle, 0);
- notification_set_execute_option(notification->raw_handle, NOTIFICATION_EXECUTE_TYPE_SINGLE_LAUNCH, NULL, NULL, service_data);
- }
- else
- {
- notification_set_property(notification->raw_handle, NOTIFICATION_PROP_DISABLE_APP_LAUNCH);
- }
-
- if (notification->sound != NULL)
- {
- struct stat st;
-
- if (stat(notification->sound, &st) < 0)
- {
- LOGE("NO_SUCH_FILE(0x%08x) : invalid sound file", UI_NOTIFICATION_ERROR_NO_SUCH_FILE);
- return UI_NOTIFICATION_ERROR_NO_SUCH_FILE;
- }
- notification_set_sound(notification->raw_handle, NOTIFICATION_SOUND_TYPE_USER_DATA, notification->sound);
- }
-
- if (notification->vibration)
- {
- notification_set_vibration(notification->raw_handle, NOTIFICATION_VIBRATION_TYPE_DEFAULT, NULL);
- }
-
- return UI_NOTIFICATION_ERROR_NONE;
-}
-
-int ui_notification_post(ui_notification_h notification)
-{
- int retcode;
-
- if (notification == NULL)
- {
- LOGE("INVALID_PARAMETER(0x%08x)", UI_NOTIFICATION_ERROR_INVALID_PARAMETER);
- return UI_NOTIFICATION_ERROR_INVALID_PARAMETER;
- }
-
- if (notification->posted == true)
- {
- LOGE("INVALID_STATE(0x%08x) : the notification was already posted", UI_NOTIFICATION_ERROR_INVALID_STATE);
- return UI_NOTIFICATION_ERROR_INVALID_STATE;
- }
-
- if (notification->ongoing == true)
- {
- notification->raw_handle = notification_new(NOTIFICATION_TYPE_ONGOING, NOTIFICATION_GROUP_ID_DEFAULT, NOTIFICATION_PRIV_ID_NONE);
- }
- else
- {
- notification->raw_handle = notification_new(NOTIFICATION_TYPE_NOTI, NOTIFICATION_GROUP_ID_DEFAULT, NOTIFICATION_PRIV_ID_NONE);
- }
-
- if (notification->raw_handle == NULL)
- {
- LOGE("OUT_OF_MEMORY(0x%08x)", UI_NOTIFICATION_ERROR_OUT_OF_MEMORY);
- return UI_NOTIFICATION_ERROR_OUT_OF_MEMORY;
- }
-
- retcode = ui_notification_build_attributes(notification);
-
- if (retcode != UI_NOTIFICATION_ERROR_NONE)
- {
- return retcode;
- }
-
- retcode = ui_notification_error_handler(notification_insert(notification->raw_handle, NULL), __FUNCTION__, "failed to post a notification");
-
- if (retcode == UI_NOTIFICATION_ERROR_NONE)
- {
- notification->posted = true;
- }
-
- return retcode;
-}
-
-int ui_notification_update(ui_notification_h notification)
-{
- int retcode;
-
- if (notification == NULL)
- {
- LOGE("INVALID_PARAMETER(0x%08x)", UI_NOTIFICATION_ERROR_INVALID_PARAMETER);
- return UI_NOTIFICATION_ERROR_INVALID_PARAMETER;
- }
-
- if (notification->posted == false)
- {
- LOGE("INVALID_STATE(0x%08x) : the notification was not posted", UI_NOTIFICATION_ERROR_INVALID_STATE);
- return UI_NOTIFICATION_ERROR_INVALID_STATE;
- }
-
- if (notification->removed == true)
- {
- LOGE("INVALID_STATE(0x%08x) : the notification was canceled or cleared", UI_NOTIFICATION_ERROR_INVALID_STATE);
- return UI_NOTIFICATION_ERROR_INVALID_STATE;
- }
-
- retcode = ui_notification_build_attributes(notification);
-
- if (retcode != UI_NOTIFICATION_ERROR_NONE)
- {
- return retcode;
- }
-
- retcode = ui_notification_error_handler(notification_update(notification->raw_handle), __FUNCTION__, "failed to post a notification");
-
- if (retcode == UI_NOTIFICATION_ERROR_INVALID_STATE)
- {
- notification->removed = true;
- }
-
- return retcode;
-}
-
-int ui_notification_update_progress(ui_notification_h notification, ui_notification_progress_type_e type, double value)
-{
- int retcode;
-
- if (notification == NULL)
- {
- LOGE("INVALID_PARAMETER(0x%08x)", UI_NOTIFICATION_ERROR_INVALID_PARAMETER);
- return UI_NOTIFICATION_ERROR_INVALID_PARAMETER;
- }
-
- if (notification->raw_handle == NULL)
- {
- LOGE("INVALID_PARAMETER(0x%08x) : invalid handle", UI_NOTIFICATION_ERROR_INVALID_PARAMETER);
- return UI_NOTIFICATION_ERROR_INVALID_PARAMETER;
- }
-
- if (notification->posted == false)
- {
- LOGE("INVALID_STATE(0x%08x) : the notification was not posted", UI_NOTIFICATION_ERROR_INVALID_STATE);
- return UI_NOTIFICATION_ERROR_INVALID_STATE;
- }
-
- if (notification->removed == true)
- {
- LOGE("INVALID_STATE(0x%08x) : the notification was canceled or cleared", UI_NOTIFICATION_ERROR_INVALID_STATE);
- return UI_NOTIFICATION_ERROR_INVALID_STATE;
- }
-
- if (value < 0)
- {
- LOGE("INVALID_PARAMETER(0x%08x) : the value must be greater than or equal to zero.", UI_NOTIFICATION_ERROR_INVALID_PARAMETER);
- return UI_NOTIFICATION_ERROR_INVALID_PARAMETER;
- }
-
- switch (type)
- {
- case UI_NOTIFICATION_PROGRESS_TYPE_SIZE:
- retcode = ui_notification_error_handler(
- notification_update_size(notification->raw_handle, NOTIFICATION_PRIV_ID_NONE, value),
- __FUNCTION__, "failed to update the progress");
- break;
-
- case UI_NOTIFICATION_PROGRESS_TYPE_PERCENTAGE:
- retcode = ui_notification_error_handler(
- notification_update_progress(notification->raw_handle, NOTIFICATION_PRIV_ID_NONE, value),
- __FUNCTION__, "failed to update the progress");
- break;
-
- default:
- LOGE("INVALID_PARAMETER(0x%08x) : invalid progress type", UI_NOTIFICATION_ERROR_INVALID_PARAMETER);
- return UI_NOTIFICATION_ERROR_INVALID_PARAMETER;
- }
-
- if (retcode == UI_NOTIFICATION_ERROR_INVALID_STATE)
- {
- notification->removed = true;
- }
-
- return retcode;
-}
-
-int ui_notification_cancel(ui_notification_h notification)
-{
- int retcode;
-
- if (notification == NULL)
- {
- LOGE("INVALID_PARAMETER(0x%08x)", UI_NOTIFICATION_ERROR_INVALID_PARAMETER);
- return UI_NOTIFICATION_ERROR_INVALID_PARAMETER;
- }
-
- if (notification->raw_handle == NULL)
- {
- LOGE("INVALID_PARAMETER(0x%08x) : invalid handle", UI_NOTIFICATION_ERROR_INVALID_PARAMETER);
- return UI_NOTIFICATION_ERROR_INVALID_PARAMETER;
- }
-
- if (notification->posted == false)
- {
- LOGE("INVALID_STATE(0x%08x) : the notification was not posted", UI_NOTIFICATION_ERROR_INVALID_STATE);
- return UI_NOTIFICATION_ERROR_INVALID_STATE;
- }
-
- if (notification->removed == true)
- {
- LOGE("INVALID_STATE(0x%08x) : the notification was canceled or cleared", UI_NOTIFICATION_ERROR_INVALID_STATE);
- return UI_NOTIFICATION_ERROR_INVALID_STATE;
- }
-
- retcode = ui_notification_error_handler(notification_delete(notification->raw_handle), __FUNCTION__, "failed to cancel the notification");
-
- if (retcode == UI_NOTIFICATION_ERROR_NONE)
- {
- notification->removed = true;
- }
-
- return retcode;
-}
-
-void ui_notification_cancel_all(void)
-{
- notification_delete_all_by_type(NULL, NOTIFICATION_TYPE_NONE);
-}
-
-void ui_notification_cancel_all_by_type(bool ongoing)
-{
- notification_type_e type = NOTIFICATION_TYPE_NONE;
-
- if (ongoing)
- type = NOTIFICATION_TYPE_ONGOING;
- else
- type = NOTIFICATION_TYPE_NOTI;
-
- notification_delete_all_by_type(NULL, type);
-}
-
-void ui_notification_cancel_all_by_package(const char *package, bool ongoing)
-{
- notification_type_e type = NOTIFICATION_TYPE_NONE;
-
- if (ongoing)
- type = NOTIFICATION_TYPE_ONGOING;
- else
- type = NOTIFICATION_TYPE_NOTI;
-
- notification_delete_all_by_type(package, type);
-}
-
-int ui_notification_cancel_all_by_app_id(const char *app_id, bool ongoing)
-{
- notification_type_e type = NOTIFICATION_TYPE_NONE;
-
- if (app_id == NULL)
- {
- LOGE("INVALID_PARAMETER(0x%08x)", UI_NOTIFICATION_ERROR_INVALID_PARAMETER);
- return UI_NOTIFICATION_ERROR_INVALID_PARAMETER;
- }
-
- if (ongoing)
- type = NOTIFICATION_TYPE_ONGOING;
- else
- type = NOTIFICATION_TYPE_NOTI;
-
- notification_delete_all_by_type(app_id, type);
-
- return UI_NOTIFICATION_ERROR_NONE;
-}
-
-static bool ui_notification_package_equal(notification_h handle)
-{
- char *package = NULL;
- char *handle_package = NULL;
- char cmdline[512] = {0,};
- char buf[64] = {0,};
-
- if (notification_get_pkgname(handle, &handle_package))
- {
- return false;
- }
-
- if (app_get_package(&package))
- {
- int ret = 0;
- int fd = -1;
- int pid = getpid();
-
- snprintf(buf, sizeof(buf), "/proc/%d/cmdline", pid);
-
- fd = open(buf, O_RDONLY);
- if (fd < 0) {
- return false;
- }
-
- ret = read(fd, cmdline, sizeof(cmdline) - 1);
- if (ret <= 0) {
- close(fd);
- return false;
- }
-
- cmdline[ret] = 0;
- close(fd);
-
- if (strlen(cmdline) == strlen(handle_package))
- {
- if (!strncmp(cmdline, handle_package, strlen(cmdline)))
- {
- return true;
- }
- }
- }
- else
- {
- if (strlen(package) == strlen(handle_package))
- {
- if (!strncmp(package, handle_package, strlen(package)))
- {
- return true;
- }
- }
- }
-
- return false;
-}
-
-int ui_notification_foreach_notification_posted(bool ongoing, ui_notification_cb callback, void *user_data)
-{
- notification_list_h raw_handle_list;
- notification_h raw_handle;
- notification_type_e notification_type = ongoing ? NOTIFICATION_TYPE_ONGOING : NOTIFICATION_TYPE_NOTI;
- ui_notification_h notification = NULL;
- bool iterate_next = true;
-
- if (callback == NULL)
- {
- LOGE("INVALID_PARAMETER(0x%08x)", UI_NOTIFICATION_ERROR_INVALID_PARAMETER);
- return UI_NOTIFICATION_ERROR_INVALID_PARAMETER;
- }
-
- if (notification_get_grouping_list(notification_type, -1, &raw_handle_list))
- {
- LOGE("DB_FAILED(0x%08x) : failed to get a notification list", UI_NOTIFICATION_ERROR_DB_FAILED);
- return UI_NOTIFICATION_ERROR_DB_FAILED;
- }
-
- while (raw_handle_list != NULL)
- {
- raw_handle = notification_list_get_data(raw_handle_list);
-
- if (raw_handle != NULL && ui_notification_package_equal(raw_handle))
- {
- if (!ui_notification_construct(ongoing, raw_handle, ¬ification))
- {
- iterate_next = callback(notification, user_data);
-
- ui_notification_destroy(notification);
-
- if (iterate_next == false)
- {
- break;
- }
- }
- }
-
- raw_handle_list = notification_list_get_next(raw_handle_list);
- }
-
- notification_free_list(raw_handle_list);
-
- return UI_NOTIFICATION_ERROR_NONE;
-}
-