Add feature key and new Error Type for watch application 51/143751/9
authorSukHyung, Kang <shine.kang@samsung.com>
Fri, 11 Aug 2017 06:39:54 +0000 (15:39 +0900)
committerSukHyung, Kang <shine.kang@samsung.com>
Mon, 25 Sep 2017 06:27:16 +0000 (15:27 +0900)
 - Add for feature key

Change-Id: I53770418e964d31738348068a2d5e7677d19e415
Signed-off-by: SukHyung, Kang <shine.kang@samsung.com>
CMakeLists.txt
doc/appcore-watch_doc.h
include/watch_app.h
include/watch_app_efl.h
include/watch_app_extension.h
packaging/appcore-watch.spec
src/watch_app_main.c
src/watch_app_private.h

index a3651e0..a5fe6e7 100644 (file)
@@ -41,6 +41,7 @@ pkg_check_modules(pkg_watch REQUIRED
                appcore-common
                appcore-efl
                pkgmgr-info
+               capi-system-info
                )
 FOREACH(flag ${pkg_watch_CFLAGS})
        SET(EXTRA_CFLAGS_watch "${EXTRA_CFLAGS_watch} ${flag}")
index aefa625..8e30c2f 100755 (executable)
  * - Registering callbacks for basic system events.
  * - Time related utility APIs for watch applications.
  *
+ * @section CAPI_WATCH_APP_MODULE_FEATURE Related Features
+ * This API is related with the following features:
+ * - http://tizen.org/feature/watch_app
+ * It is recommended to design feature related codes in your application for reliability.
+ * You can check if a device supports the related features for this API by using @ref CAPI_SYSTEM_SYSTEM_INFO_MODULE, thereby controlling the procedure of your application.
+ * To ensure your application is only running on the device with specific features, please define the features in your manifest file using the manifest editor in the SDK.
+ * More details on featuring your application can be found from <a href="https://developer.tizen.org/development/tizen-studio/native-tools/configuring-your-app/manifest-text-editor#feature"><b>Feature Element</b>.</a>
+ *
  * @subsection CAPI_WATCH_APP_MODULE_STATE_CHANGE_EVENT Registering Callbacks for Application State Change Events
  * The state change events for Tizen watch application is similar to the Tizen UI applications. See the @ref CAPI_APPLICATION_MODULE.
  * In Tizen watch application, an ambient changed event is added to support ambient mode. Time tick related events are also added to provide an exact time tick for the watch application.
index 026ff76..5edc1e7 100755 (executable)
@@ -184,6 +184,7 @@ typedef struct {
  * @retval #APP_ERROR_NONE Successful
  * @retval #APP_ERROR_INVALID_PARAMETER Invalid parameter
  * @retval #APP_ERROR_OUT_OF_MEMORY Out of memory
+ * @retval #APP_ERROR_NOT_SUPPORTED Not supported
  * @see app_event_type_e
  * @see app_event_cb
  * @see watch_app_remove_event_handler
@@ -199,6 +200,7 @@ int watch_app_add_event_handler(app_event_handler_h *handler, app_event_type_e e
  *         otherwise a negative error value
  * @retval #APP_ERROR_NONE Successful
  * @retval #APP_ERROR_INVALID_PARAMETER Invalid parameter
+ * @retval #APP_ERROR_NOT_SUPPORTED Not supported
  * @see watch_app_add_event_handler
  */
 int watch_app_remove_event_handler(app_event_handler_h event_handler);
@@ -218,6 +220,7 @@ int watch_app_remove_event_handler(app_event_handler_h event_handler);
  * @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
+ * @retval #APP_ERROR_NOT_SUPPORTED Not supported
  * @see watch_app_main()
  * @see watch_app_create_cb()
  * @see watch_app_control_cb()
@@ -264,6 +267,7 @@ typedef enum {
  *         otherwise a negative error value
  * @retval #APP_ERROR_NONE Successful
  * @retval #APP_ERROR_INVALID_PARAMETER Invalid Parameter
+ * @retval #APP_ERROR_NOT_SUPPORTED Not supported
  * @see watch_app_time_tick_resolution_e
  * @see watch_app_get_time_tick_frequency()
  */
@@ -278,6 +282,7 @@ int watch_app_set_time_tick_frequency(int ticks, watch_app_time_tick_resolution_
            otherwise a negative error value
  * @retval #APP_ERROR_NONE Successful
  * @retval #APP_ERROR_INVALID_PARAMETER Invalid Parameter
+ * @retval #APP_ERROR_NOT_SUPPORTED Not supported
  * @see watch_app_time_tick_resolution_e
  * @see watch_app_set_time_tick_frequency()
  */
@@ -357,6 +362,7 @@ typedef enum {
  *         otherwise a negative error value
  * @retval #APP_ERROR_NONE Successful
  * @retval #APP_ERROR_INVALID_PARAMETER Invalid Parameter
+ * @retval #APP_ERROR_NOT_SUPPORTED Not supported
  * @see watch_app_ambient_tick_cb()
  */
 int watch_app_set_ambient_tick_type(watch_app_ambient_tick_type_e type);
@@ -369,6 +375,7 @@ int watch_app_set_ambient_tick_type(watch_app_ambient_tick_type_e type);
  *         otherwise a negative error value
  * @retval #APP_ERROR_NONE Successful
  * @retval #APP_ERROR_INVALID_PARAMETER Invalid Parameter
+ * @retval #APP_ERROR_NOT_SUPPORTED Not supported
  * @see watch_app_ambient_tick_cb()
  * @see watch_app_set_ambient_tick_type()
  */
@@ -384,6 +391,7 @@ int watch_app_get_ambient_tick_type(watch_app_ambient_tick_type_e *type);
  * @retval #APP_ERROR_NONE Successful
  * @retval #APP_ERROR_INVALID_PARAMETER Invalid Parameter
  * @retval #APP_ERROR_OUT_OF_MEMORY Out of Memory
+ * @retval #APP_ERROR_NOT_SUPPORTED Not supported
  */
 int watch_time_get_current_time(watch_time_h *watch_time);
 
@@ -396,6 +404,7 @@ int watch_time_get_current_time(watch_time_h *watch_time);
  *         otherwise a negative error value
  * @retval #APP_ERROR_NONE Successful
  * @retval #APP_ERROR_INVALID_PARAMETER Invalid Parameter
+ * @retval #APP_ERROR_NOT_SUPPORTED Not supported
  */
 int watch_time_delete(watch_time_h watch_time);
 
@@ -409,6 +418,7 @@ int watch_time_delete(watch_time_h watch_time);
  *         otherwise a negative error value
  * @retval #APP_ERROR_NONE Successful
  * @retval #APP_ERROR_INVALID_PARAMETER Invalid Parameter
+ * @retval #APP_ERROR_NOT_SUPPORTED Not supported
  */
 int watch_time_get_year(watch_time_h watch_time, int *year);
 
@@ -422,6 +432,7 @@ int watch_time_get_year(watch_time_h watch_time, int *year);
  *         otherwise a negative error value
  * @retval #APP_ERROR_NONE Successful
  * @retval #APP_ERROR_INVALID_PARAMETER Invalid Parameter
+ * @retval #APP_ERROR_NOT_SUPPORTED Not supported
  */
 int watch_time_get_month(watch_time_h watch_time, int *month);
 
@@ -435,6 +446,7 @@ int watch_time_get_month(watch_time_h watch_time, int *month);
  *         otherwise a negative error value
  * @retval #APP_ERROR_NONE Successful
  * @retval #APP_ERROR_INVALID_PARAMETER Invalid Parameter
+ * @retval #APP_ERROR_NOT_SUPPORTED Not supported
  */
 int watch_time_get_day(watch_time_h watch_time, int *day);
 
@@ -448,6 +460,7 @@ int watch_time_get_day(watch_time_h watch_time, int *day);
  *         otherwise a negative error value
  * @retval #APP_ERROR_NONE Successful
  * @retval #APP_ERROR_INVALID_PARAMETER Invalid Parameter
+ * @retval #APP_ERROR_NOT_SUPPORTED Not supported
  */
 int watch_time_get_day_of_week(watch_time_h watch_time, int *day_of_week);
 
@@ -461,6 +474,7 @@ int watch_time_get_day_of_week(watch_time_h watch_time, int *day_of_week);
  *         otherwise a negative error value
  * @retval #APP_ERROR_NONE Successful
  * @retval #APP_ERROR_INVALID_PARAMETER Invalid Parameter
+ * @retval #APP_ERROR_NOT_SUPPORTED Not supported
  */
 int watch_time_get_hour(watch_time_h watch_time, int *hour);
 
@@ -474,6 +488,7 @@ int watch_time_get_hour(watch_time_h watch_time, int *hour);
  *         otherwise a negative error value
  * @retval #APP_ERROR_NONE Successful
  * @retval #APP_ERROR_INVALID_PARAMETER Invalid Parameter
+ * @retval #APP_ERROR_NOT_SUPPORTED Not supported
  */
 int watch_time_get_hour24(watch_time_h watch_time, int *hour24);
 
@@ -487,6 +502,7 @@ int watch_time_get_hour24(watch_time_h watch_time, int *hour24);
  *         otherwise a negative error value
  * @retval #APP_ERROR_NONE Successful
  * @retval #APP_ERROR_INVALID_PARAMETER Invalid Parameter
+ * @retval #APP_ERROR_NOT_SUPPORTED Not supported
  */
 int watch_time_get_minute(watch_time_h watch_time, int *minute);
 
@@ -500,6 +516,7 @@ int watch_time_get_minute(watch_time_h watch_time, int *minute);
  *         otherwise a negative error value
  * @retval #APP_ERROR_NONE Successful
  * @retval #APP_ERROR_INVALID_PARAMETER Invalid Parameter
+ * @retval #APP_ERROR_NOT_SUPPORTED Not supported
  */
 int watch_time_get_second(watch_time_h watch_time, int *second);
 
@@ -513,6 +530,7 @@ int watch_time_get_second(watch_time_h watch_time, int *second);
  *         otherwise a negative error value
  * @retval #APP_ERROR_NONE Successful
  * @retval #APP_ERROR_INVALID_PARAMETER Invalid Parameter
+ * @retval #APP_ERROR_NOT_SUPPORTED Not supported
  */
 int watch_time_get_millisecond(watch_time_h watch_time, int *millisecond);
 
@@ -526,6 +544,7 @@ int watch_time_get_millisecond(watch_time_h watch_time, int *millisecond);
  *         otherwise a negative error value
  * @retval #APP_ERROR_NONE Successful
  * @retval #APP_ERROR_INVALID_PARAMETER Invalid Parameter
+ * @retval #APP_ERROR_NOT_SUPPORTED Not supported
  */
 int watch_time_get_utc_time(watch_time_h watch_time, struct tm *utc_time);
 
@@ -539,6 +558,7 @@ int watch_time_get_utc_time(watch_time_h watch_time, struct tm *utc_time);
  *         otherwise a negative error value
  * @retval #APP_ERROR_NONE Successful
  * @retval #APP_ERROR_INVALID_PARAMETER Invalid Parameter
+ * @retval #APP_ERROR_NOT_SUPPORTED Not supported
  */
 int watch_time_get_utc_timestamp(watch_time_h watch_time, time_t *utc_timestamp);
 
@@ -553,6 +573,7 @@ int watch_time_get_utc_timestamp(watch_time_h watch_time, time_t *utc_timestamp)
  *         otherwise a negative error value
  * @retval #APP_ERROR_NONE Successful
  * @retval #APP_ERROR_INVALID_PARAMETER Invalid Parameter
+ * @retval #APP_ERROR_NOT_SUPPORTED Not supported
  */
 int watch_time_get_time_zone(watch_time_h watch_time, char **time_zone_id);
 
@@ -566,6 +587,7 @@ int watch_time_get_time_zone(watch_time_h watch_time, char **time_zone_id);
  * @return 0 on success, otherwise a negative error value
  * @retval #APP_ERROR_NONE Successful
  * @retval #APP_ERROR_INVALID_PARAMETER Invalid Parameter
+ * @retval #APP_ERROR_NOT_SUPPORTED Not supported
  */
 int watch_time_get_dst_status(watch_time_h watch_time, bool *status);
 
index d97f06c..7e7702c 100644 (file)
@@ -39,6 +39,7 @@ extern "C" {
  * @retval #APP_ERROR_OUT_OF_MEMORY Out of memory
  * @retval #APP_ERROR_INVALID_CONTEXT Watch app is not initialized properly
  * @retval #APP_ERROR_NONE Successful
+ * @retval #APP_ERROR_NOT_SUPPORTED Not supported
  */
 int watch_app_get_elm_win(Evas_Object **win);
 
index 3fcf8d6..6881269 100755 (executable)
@@ -33,6 +33,7 @@ extern "C" {
  * @return 0 on success, otherwise a negative error value
  * @retval #APP_ERROR_INVALID_PARAMETER Invalid Parameter
  * @retval #APP_ERROR_NONE Successful
+ * @retval #APP_ERROR_NOT_SUPPORTED Not supported
  */
 int watch_time_get_daylight_time_status(watch_time_h watch_time, bool *daylight);
 
index ba9e335..7bc7d2b 100644 (file)
@@ -23,6 +23,7 @@ BuildRequires:        pkgconfig(glib-2.0)
 BuildRequires: pkgconfig(gio-2.0)
 BuildRequires: pkgconfig(screen_connector_provider)
 BuildRequires: pkgconfig(pkgmgr-info)
+BuildRequires: pkgconfig(capi-system-info)
 BuildRequires:  cmake
 Requires: amd-mod-watch
 
index e6ce778..3d2e11e 100755 (executable)
@@ -830,6 +830,8 @@ EXPORT_API int watch_app_main(int argc, char **argv,
        appcore_efl_base_ops ops = appcore_efl_base_get_default_ops();
        char *viewer_visibility_str = NULL;
 
+       CHECK_WATCH_APP_FEATURE();
+
        /* override methods */
        ops.ui_base.base.create = __on_create;
        ops.ui_base.base.control = __on_control;
@@ -941,6 +943,8 @@ EXPORT_API int watch_app_add_event_handler(app_event_handler_h *event_handler,
 {
        app_event_handler_h handler;
 
+       CHECK_WATCH_APP_FEATURE();
+
        if (event_handler == NULL || callback == NULL)
                return watch_app_error(APP_ERROR_INVALID_PARAMETER,
                                __FUNCTION__, NULL);
@@ -970,6 +974,8 @@ EXPORT_API int watch_app_remove_event_handler(app_event_handler_h event_handler)
        int ret;
        app_event_type_e type;
 
+       CHECK_WATCH_APP_FEATURE();
+
        if (event_handler == NULL)
                return watch_app_error(APP_ERROR_INVALID_PARAMETER,
                                __FUNCTION__, NULL);
@@ -993,6 +999,8 @@ EXPORT_API int watch_time_get_current_time(watch_time_h *watch_time)
 {
        struct _watch_time_s *time_info;
 
+       CHECK_WATCH_APP_FEATURE();
+
        if (watch_time == NULL)
                return watch_app_error(APP_ERROR_INVALID_PARAMETER,
                                __FUNCTION__, NULL);
@@ -1011,6 +1019,8 @@ EXPORT_API int watch_time_get_current_time(watch_time_h *watch_time)
 
 EXPORT_API int watch_time_delete(watch_time_h watch_time)
 {
+       CHECK_WATCH_APP_FEATURE();
+
        if (watch_time == NULL)
                return watch_app_error(APP_ERROR_INVALID_PARAMETER,
                                __FUNCTION__, NULL);
@@ -1025,6 +1035,8 @@ EXPORT_API int watch_time_delete(watch_time_h watch_time)
 
 EXPORT_API int watch_time_get_year(watch_time_h watch_time, int *year)
 {
+       CHECK_WATCH_APP_FEATURE();
+
        if (watch_time == NULL)
                return watch_app_error(APP_ERROR_INVALID_PARAMETER,
                                __FUNCTION__, NULL);
@@ -1035,6 +1047,8 @@ EXPORT_API int watch_time_get_year(watch_time_h watch_time, int *year)
 
 EXPORT_API int watch_time_get_month(watch_time_h watch_time, int *month)
 {
+       CHECK_WATCH_APP_FEATURE();
+
        if (watch_time == NULL)
                return watch_app_error(APP_ERROR_INVALID_PARAMETER,
                                __FUNCTION__, NULL);
@@ -1045,6 +1059,8 @@ EXPORT_API int watch_time_get_month(watch_time_h watch_time, int *month)
 
 EXPORT_API int watch_time_get_day(watch_time_h watch_time, int *day)
 {
+       CHECK_WATCH_APP_FEATURE();
+
        if (watch_time == NULL)
                return watch_app_error(APP_ERROR_INVALID_PARAMETER,
                                __FUNCTION__, NULL);
@@ -1056,6 +1072,8 @@ EXPORT_API int watch_time_get_day(watch_time_h watch_time, int *day)
 EXPORT_API int watch_time_get_day_of_week(watch_time_h watch_time,
                int *day_of_week)
 {
+       CHECK_WATCH_APP_FEATURE();
+
        if (watch_time == NULL)
                return watch_app_error(APP_ERROR_INVALID_PARAMETER,
                                __FUNCTION__, NULL);
@@ -1066,6 +1084,8 @@ EXPORT_API int watch_time_get_day_of_week(watch_time_h watch_time,
 
 EXPORT_API int watch_time_get_hour(watch_time_h watch_time, int *hour)
 {
+       CHECK_WATCH_APP_FEATURE();
+
        if (watch_time == NULL)
                return watch_app_error(APP_ERROR_INVALID_PARAMETER,
                                __FUNCTION__, NULL);
@@ -1076,6 +1096,8 @@ EXPORT_API int watch_time_get_hour(watch_time_h watch_time, int *hour)
 
 EXPORT_API int watch_time_get_hour24(watch_time_h watch_time, int *hour24)
 {
+       CHECK_WATCH_APP_FEATURE();
+
        if (watch_time == NULL)
                return watch_app_error(APP_ERROR_INVALID_PARAMETER,
                                __FUNCTION__, NULL);
@@ -1086,6 +1108,8 @@ EXPORT_API int watch_time_get_hour24(watch_time_h watch_time, int *hour24)
 
 EXPORT_API int watch_time_get_minute(watch_time_h watch_time, int *minute)
 {
+       CHECK_WATCH_APP_FEATURE();
+
        if (watch_time == NULL)
                return watch_app_error(APP_ERROR_INVALID_PARAMETER,
                                __FUNCTION__, NULL);
@@ -1096,6 +1120,8 @@ EXPORT_API int watch_time_get_minute(watch_time_h watch_time, int *minute)
 
 EXPORT_API int watch_time_get_second(watch_time_h watch_time, int *second)
 {
+       CHECK_WATCH_APP_FEATURE();
+
        if (watch_time == NULL)
                return watch_app_error(APP_ERROR_INVALID_PARAMETER,
                                __FUNCTION__, NULL);
@@ -1107,6 +1133,8 @@ EXPORT_API int watch_time_get_second(watch_time_h watch_time, int *second)
 EXPORT_API int watch_time_get_millisecond(watch_time_h watch_time,
                int *millisecond)
 {
+       CHECK_WATCH_APP_FEATURE();
+
        if (watch_time == NULL)
                return watch_app_error(APP_ERROR_INVALID_PARAMETER,
                                __FUNCTION__, NULL);
@@ -1120,6 +1148,8 @@ EXPORT_API int watch_time_get_utc_time(watch_time_h watch_time,
 {
        time_t timestamp;
 
+       CHECK_WATCH_APP_FEATURE();
+
        if (watch_time == NULL || utc_time == NULL)
                return watch_app_error(APP_ERROR_INVALID_PARAMETER,
                                __FUNCTION__, NULL);
@@ -1134,6 +1164,8 @@ EXPORT_API int watch_time_get_utc_time(watch_time_h watch_time,
 EXPORT_API int watch_time_get_utc_timestamp(watch_time_h watch_time,
                time_t *utc_timestamp)
 {
+       CHECK_WATCH_APP_FEATURE();
+
        if (watch_time == NULL)
                return watch_app_error(APP_ERROR_INVALID_PARAMETER,
                                __FUNCTION__, NULL);
@@ -1146,6 +1178,8 @@ EXPORT_API int watch_time_get_utc_timestamp(watch_time_h watch_time,
 EXPORT_API int watch_time_get_time_zone(watch_time_h watch_time,
                char **time_zone_id)
 {
+       CHECK_WATCH_APP_FEATURE();
+
        if (watch_time == NULL || watch_time->timezone == NULL
                        || time_zone_id == NULL)
                return watch_app_error(APP_ERROR_INVALID_PARAMETER,
@@ -1158,6 +1192,8 @@ EXPORT_API int watch_time_get_time_zone(watch_time_h watch_time,
 
 EXPORT_API int watch_time_get_dst_status(watch_time_h watch_time, bool *status)
 {
+       CHECK_WATCH_APP_FEATURE();
+
        if (watch_time == NULL || status == NULL)
                return watch_app_error(APP_ERROR_INVALID_PARAMETER, __FUNCTION__, NULL);
 
@@ -1171,6 +1207,8 @@ EXPORT_API int watch_time_get_dst_status(watch_time_h watch_time, bool *status)
 
 EXPORT_API int watch_time_get_daylight_time_status(watch_time_h watch_time, bool *daylight)
 {
+       CHECK_WATCH_APP_FEATURE();
+
        return watch_time_get_dst_status(watch_time, daylight);
 }
 
@@ -1191,6 +1229,8 @@ EXPORT_API int watch_app_get_elm_win(Evas_Object **win)
        Ecore_Wl_Window *wl_win;
        char buffer[256];
 
+       CHECK_WATCH_APP_FEATURE();
+
        if (win == NULL)
                return watch_app_error(APP_ERROR_INVALID_PARAMETER,
                                __FUNCTION__, NULL);
@@ -1221,6 +1261,8 @@ EXPORT_API int watch_app_get_elm_win(Evas_Object **win)
 
 EXPORT_API int watch_app_set_ambient_tick_type(watch_app_ambient_tick_type_e type)
 {
+       CHECK_WATCH_APP_FEATURE();
+
        if (type < WATCH_APP_AMBIENT_TICK_NO_TICK || type > WATCH_APP_AMBIENT_TICK_EVERY_DAY)
                return APP_ERROR_INVALID_PARAMETER;
        return __set_ambient_tick_type(type);
@@ -1228,6 +1270,8 @@ EXPORT_API int watch_app_set_ambient_tick_type(watch_app_ambient_tick_type_e typ
 
 EXPORT_API int watch_app_get_ambient_tick_type(watch_app_ambient_tick_type_e *type)
 {
+       CHECK_WATCH_APP_FEATURE();
+
        if (type == NULL)
                return APP_ERROR_INVALID_PARAMETER;
        return __get_ambient_tick_type(type);
@@ -1235,6 +1279,8 @@ EXPORT_API int watch_app_get_ambient_tick_type(watch_app_ambient_tick_type_e *ty
 
 EXPORT_API int watch_app_set_time_tick_frequency(int ticks, watch_app_time_tick_resolution_e type)
 {
+       CHECK_WATCH_APP_FEATURE();
+
        if (type < WATCH_APP_TIME_TICKS_PER_SECOND || type > WATCH_APP_TIME_TICKS_PER_HOUR)
                return APP_ERROR_INVALID_PARAMETER;
        return __set_time_tick_frequency(ticks, type);
@@ -1242,6 +1288,8 @@ EXPORT_API int watch_app_set_time_tick_frequency(int ticks, watch_app_time_tick_
 
 EXPORT_API int watch_app_get_time_tick_frequency(int *ticks, watch_app_time_tick_resolution_e *type)
 {
+       CHECK_WATCH_APP_FEATURE();
+
        if (type == NULL || ticks == NULL)
                return APP_ERROR_INVALID_PARAMETER;
        return __get_time_tick_frequency(ticks, type);
index 0313f6e..05de80f 100755 (executable)
 
 #include <watch_app.h>
 #include <app_common.h>
+#include <system_info.h>
 
 #ifdef __cplusplus
 extern "C" {
 #endif
 
+#define WATCH_APP_FEATURE "http://tizen.org/feature/watch_app"
+#define CHECK_WATCH_APP_FEATURE() \
+        do { \
+                bool is_supported = false; \
+                if (!system_info_get_platform_bool(WATCH_APP_FEATURE, &is_supported)) { \
+                        if (is_supported == false) { \
+                                LOGE("[%s] feature is disabled", WATCH_APP_FEATURE); \
+                                return APP_ERROR_NOT_SUPPORTED; \
+                        } \
+                } \
+        } while (0)
+
 int watch_app_error(app_error_e error, const char *function,
                const char *description);