diff options
author | Jiwoong Im <jiwoong.im@samsung.com> | 2015-04-17 16:32:59 +0900 |
---|---|---|
committer | Jiwoong Im <jiwoong.im@samsung.com> | 2015-04-17 16:38:14 +0900 |
commit | 08b653c08d3eadbc4c82c60b46be2129d2cfabdd (patch) | |
tree | b33d21956d72c3578b2725a5bcb8a65f91a5f212 | |
parent | 45b15ab3deca183a070d6df98d0a15b94aa02b58 (diff) | |
download | application-08b653c08d3eadbc4c82c60b46be2129d2cfabdd.tar.gz application-08b653c08d3eadbc4c82c60b46be2129d2cfabdd.tar.bz2 application-08b653c08d3eadbc4c82c60b46be2129d2cfabdd.zip |
Separate app-control, alarm, preference, and common api.submit/tizen_mobile/20150512.053844submit/tizen_common/20150512.999999submit/tizen/20150511.021014accepted/tizen/tv/20150512.050437accepted/tizen/mobile/20150513.005730accepted/tizen/common/20150520.083759
JIRA ticket : TC-2497
- In tizen 2.3 release, capi-appfw-application package was separated by
function. (app-control, alarm, preference, app-common).
- To apply this change with no build break, temporarily add all separated
package to pc_requires in capi-appfw-application.pc file
Change-Id: Id92d5a9abbfd6ff478e0469da5596b4967444ca8
Signed-off-by: Jiwoong Im <jiwoong.im@samsung.com>
-rw-r--r-- | CMakeLists.txt | 11 | ||||
-rw-r--r-- | alarm/CMakeLists.txt | 65 | ||||
-rwxr-xr-x | alarm/alarm.c (renamed from src/alarm.c) | 0 | ||||
-rw-r--r-- | app_common/CMakeLists.txt | 69 | ||||
-rwxr-xr-x | app_common/app_error.c (renamed from src/app_error.c) | 0 | ||||
-rwxr-xr-x | app_common/app_event.c (renamed from src/app_event.c) | 2 | ||||
-rwxr-xr-x | app_common/app_finalizer.c (renamed from src/app_finalizer.c) | 0 | ||||
-rwxr-xr-x | app_common/app_package.c (renamed from src/app_package.c) | 0 | ||||
-rwxr-xr-x | app_common/app_path.c (renamed from src/app_path.c) | 0 | ||||
-rw-r--r-- | app_control/CMakeLists.txt | 65 | ||||
-rwxr-xr-x | app_control/app_control.c (renamed from src/app_control.c) | 0 | ||||
-rw-r--r--[-rwxr-xr-x] | capi-appfw-module.pc.in (renamed from capi-appfw-application.pc.in) | 4 | ||||
-rwxr-xr-x | include/app.h | 381 | ||||
-rw-r--r-- | include/app_common.h | 409 | ||||
-rwxr-xr-x | packaging/capi-appfw-application.spec | 10 | ||||
-rw-r--r-- | preference/CMakeLists.txt | 65 | ||||
-rwxr-xr-x | preference/preference.c (renamed from src/preference.c) | 0 |
17 files changed, 694 insertions, 387 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt index 2037196..c201a07 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -10,7 +10,7 @@ SET(INC_DIR include) INCLUDE_DIRECTORIES(${INC_DIR}) SET(requires "dlog bundle appcore-common appcore-efl aul ail appsvc elementary capi-base-common alarm-service sqlite3 libtzplatform-config") -SET(pc_requires "capi-base-common vconf-internal-keys") +SET(pc_requires "capi-base-common vconf-internal-keys capi-appfw-alarm capi-appfw-app-control capi-appfw-app-common capi-appfw-preference") INCLUDE(FindPkgConfig) pkg_check_modules(${fw_name} REQUIRED ${requires}) @@ -33,7 +33,12 @@ SET(CMAKE_EXE_LINKER_FLAGS "-Wl,--as-needed -Wl,--rpath=${LIB_INSTALL_DIR}") 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 capi-appfw-alarm capi-appfw-preference ${${fw_name}_LDFLAGS}) SET_TARGET_PROPERTIES(${fw_name} PROPERTIES @@ -55,7 +60,7 @@ SET(PC_REQUIRED ${pc_requires}) 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 ) diff --git a/alarm/CMakeLists.txt b/alarm/CMakeLists.txt new file mode 100644 index 0000000..f989184 --- /dev/null +++ b/alarm/CMakeLists.txt @@ -0,0 +1,65 @@ +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=${LIB_INSTALL_DIR}") + +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_DIR}) +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_INSTALL_DIR}/pkgconfig) + + diff --git a/src/alarm.c b/alarm/alarm.c index 374fd04..374fd04 100755 --- a/src/alarm.c +++ b/alarm/alarm.c diff --git a/app_common/CMakeLists.txt b/app_common/CMakeLists.txt new file mode 100644 index 0000000..3f65c0d --- /dev/null +++ b/app_common/CMakeLists.txt @@ -0,0 +1,69 @@ +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 appcore-common libtzplatform-config") +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 ") +SET(CMAKE_C_FLAGS_DEBUG "-O0 -g -Wall -Werror") + +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=${LIB_INSTALL_DIR}") + +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_DIR}) +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_INSTALL_DIR}/pkgconfig) + + diff --git a/src/app_error.c b/app_common/app_error.c index b3c8c0c..b3c8c0c 100755 --- a/src/app_error.c +++ b/app_common/app_error.c diff --git a/src/app_event.c b/app_common/app_event.c index b07645f..4a72e01 100755 --- a/src/app_event.c +++ b/app_common/app_event.c @@ -17,7 +17,7 @@ #include <string.h> #include <vconf-internal-keys.h> -#include <app.h> +#include <app_common.h> #include <app_private.h> app_device_orientation_e app_convert_appcore_rm(enum appcore_rm rm) diff --git a/src/app_finalizer.c b/app_common/app_finalizer.c index ae0b41c..ae0b41c 100755 --- a/src/app_finalizer.c +++ b/app_common/app_finalizer.c diff --git a/src/app_package.c b/app_common/app_package.c index 56893a1..56893a1 100755 --- a/src/app_package.c +++ b/app_common/app_package.c diff --git a/src/app_path.c b/app_common/app_path.c index 82b2a9b..82b2a9b 100755 --- a/src/app_path.c +++ b/app_common/app_path.c diff --git a/app_control/CMakeLists.txt b/app_control/CMakeLists.txt new file mode 100644 index 0000000..b0f2f1e --- /dev/null +++ b/app_control/CMakeLists.txt @@ -0,0 +1,65 @@ +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") +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=${LIB_INSTALL_DIR}") + +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_DIR}) +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_INSTALL_DIR}/pkgconfig) + + diff --git a/src/app_control.c b/app_control/app_control.c index 9603792..9603792 100755 --- a/src/app_control.c +++ b/app_control/app_control.c diff --git a/capi-appfw-application.pc.in b/capi-appfw-module.pc.in index d0ff7f2..f4504d4 100755..100644 --- a/capi-appfw-application.pc.in +++ b/capi-appfw-module.pc.in @@ -1,4 +1,3 @@ - # Package Information for pkg-config prefix=@PREFIX@ @@ -9,7 +8,6 @@ includedir=@INCLUDE_INSTALL_DIR@/appfw Name: @PC_NAME@ Description: @PACKAGE_DESCRIPTION@ Version: @VERSION@ -Requires: @PC_REQUIRED@ +Requires: @PC_REQUIRED@ Libs: -L${libdir} @PC_LDFLAGS@ Cflags: -I${includedir} - diff --git a/include/app.h b/include/app.h index f52cffa..c54b3e1 100755 --- a/include/app.h +++ b/include/app.h @@ -22,6 +22,7 @@ #include <app_service.h> #include <app_control.h> #include <app_alarm.h> +#include <app_common.h> #include <app_preference.h> #include <app_i18n.h> @@ -50,18 +51,6 @@ typedef enum /** - * @brief Enumerations of the device orientation. - */ -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. @@ -314,374 +303,6 @@ void app_efl_exit(void); /** - * @brief Enumeration for system events - */ -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 low memory status. - */ -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. - */ -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 - * - * @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 - * - * @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 - * - * @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 - * - * @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 - * - * @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 - * - * @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 - * - * @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 - * - * @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 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. - * - * @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_package(char **package); - - -/** - * @brief Gets the ID of the application. - * - * @remarks @a ID must be released with free() by you. - * - * @param [out] id The ID of the application - * - * @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 - */ -int app_get_id(char **id); - - -/** - * @brief Gets the localized name of the application. - * - * @remarks @a name must be released with free() by you. - * - * @param [out] name The name of the application - * - * @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 - */ -int app_get_name(char **name); - - -/** - * @brief Gets the version of the application package. - * - * @remarks @a version must be released with free() by you. - * - * @param [out] version The version of the application - * - * @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 - */ -int app_get_version(char **version); - - -/** - * @brief Gets the absolute path to the resource included in application package - * - * @details The application cannot write and modify any resource files. - * - * @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. - * - * @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. - */ -char* app_get_resource(const char *resource, char *buffer, int size); - - -/** - * @brief Gets the absolute path to the application's data directory. - * - * @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. - * - * @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. - */ -char* app_get_data_directory(char *buffer, int size); - - -/** - * @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. - * @remarks The returned path should be released. - * - * @return The absolute path to the application's data directory, @n - * else @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. - * @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 - * else @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. - * @remarks The returned path should be released. - * - * @return The absolute path to the application's resource directory, @n - * else @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. - * @remarks The returned path should be released. - * - * @return The absolute path to the application's shared data directory, @n - * else @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. - * @remarks The returned path should be released. - * - * @return The absolute path to the application's shared resource directory, @n - * else @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 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. - * @remarks The returned path should be released. - * - * @return The absolute path to the application's shared trusted directory, @n - * else @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. - * @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 - * else @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. - * @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 - * else @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. - * @remarks The specified @a path should be released. - * - * @return The absolute path to the application's external shared data directory, @n - * else @a null pointer if the memory is insufficient - */ -char *app_get_external_shared_data_path(void); - - -/** * @brief Gets the current device orientation. * * @return The current device orientation diff --git a/include/app_common.h b/include/app_common.h new file mode 100644 index 0000000..7bb505c --- /dev/null +++ b/include/app_common.h @@ -0,0 +1,409 @@ +/* + * 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__ + +#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__ */ diff --git a/packaging/capi-appfw-application.spec b/packaging/capi-appfw-application.spec index db4dbe5..6ca2112 100755 --- a/packaging/capi-appfw-application.spec +++ b/packaging/capi-appfw-application.spec @@ -54,6 +54,11 @@ cp LICENSE %{buildroot}%{_datadir}/license/%{name} %files %manifest %{name}.manifest %{_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.* + %{_datadir}/license/%{name} %files devel @@ -61,3 +66,8 @@ cp LICENSE %{buildroot}%{_datadir}/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 + diff --git a/preference/CMakeLists.txt b/preference/CMakeLists.txt new file mode 100644 index 0000000..73b2d4e --- /dev/null +++ b/preference/CMakeLists.txt @@ -0,0 +1,65 @@ +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=${LIB_INSTALL_DIR}") + +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_DIR}) +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_INSTALL_DIR}/pkgconfig) + + diff --git a/src/preference.c b/preference/preference.c index f9751c2..f9751c2 100755 --- a/src/preference.c +++ b/preference/preference.c |