diff options
author | Seungha Son <seungha.son@samsung.com> | 2017-08-17 09:28:46 +0900 |
---|---|---|
committer | Seungha Son <seungha.son@samsung.com> | 2017-08-31 09:14:36 +0900 |
commit | 04e7b01d2f5a31d1ec0ceb2ce58201effdd0b29f (patch) | |
tree | 633b72f180c5e2947e0cb93b8664435726bd3289 | |
parent | 4c9f6554fc7c544facf71422a2b4116aac9718cd (diff) | |
download | minicontrol-04e7b01d2f5a31d1ec0ceb2ce58201effdd0b29f.tar.gz minicontrol-04e7b01d2f5a31d1ec0ceb2ce58201effdd0b29f.tar.bz2 minicontrol-04e7b01d2f5a31d1ec0ceb2ce58201effdd0b29f.zip |
Add minicontrol featuresubmit/tizen_4.0/20170904.030057accepted/tizen/4.0/unified/20170904.143846
Signed-off-by: Seungha Son <seungha.son@samsung.com>
Change-Id: I4df3905b370a8e6b6d8476883306ab1cb8046158
-rwxr-xr-x | CMakeLists.txt | 1 | ||||
-rw-r--r-- | doc/minicontrol_doc.h | 10 | ||||
-rw-r--r-- | include/minicontrol-private.h | 55 | ||||
-rwxr-xr-x | include/minicontrol-provider.h | 10 | ||||
-rwxr-xr-x | include/minicontrol-viewer.h | 11 | ||||
-rw-r--r-- | packaging/minicontrol.spec | 1 | ||||
-rwxr-xr-x | src/minicontrol-provider.c | 10 | ||||
-rwxr-xr-x | src/minicontrol-viewer.c | 14 |
8 files changed, 110 insertions, 2 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt index 46cc6e2..54279a9 100755 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -38,6 +38,7 @@ pkg_check_modules(pkgs REQUIRED bundle glib-2.0 gio-2.0 + capi-system-info ) FOREACH(flag ${pkgs_CFLAGS}) diff --git a/doc/minicontrol_doc.h b/doc/minicontrol_doc.h index 3817919..15c8eca 100644 --- a/doc/minicontrol_doc.h +++ b/doc/minicontrol_doc.h @@ -56,3 +56,13 @@ * @section MINICONTROL_VIEWER_MODULE_OVERVIEW Overview * It provides functions for displaying EFL socket window. */ + +/** + * @section CAPI_MINICONTROL_MODULE_FEATURE Related Features + * This API is related with the following features:\n + * - http://tizen.org/feature/minicontrol\n + * It is recommended to design feature related codes in your application for reliability.\n + * 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.\n + * 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.\n + * 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> + */ diff --git a/include/minicontrol-private.h b/include/minicontrol-private.h new file mode 100644 index 0000000..abf0579 --- /dev/null +++ b/include/minicontrol-private.h @@ -0,0 +1,55 @@ +/* + * Copyright (c) 2017 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 __MINICONTROL_PRIVATE_H__ +#define __MINICONTROL_PRIVATE_H__ + +#include <system_info.h> + +#ifdef __cplusplus +extern "C" { +#endif /* __cplusplus */ + +#define MINICONTROL_FEATURE "http://tizen.org/feature/minicontrol" +#define CHECK_MINICONTROL_FEATURE() \ + do { \ + bool is_supported = false; \ + if (!system_info_get_platform_bool(MINICONTROL_FEATURE, &is_supported)) { \ + if (is_supported == false) { \ + LOGE("[%s] feature is disabled", MINICONTROL_FEATURE); \ + return MINICONTROL_ERROR_NOT_SUPPORTED; \ + } \ + } \ + } while (0) + +#define CHECK_MINICONTROL_FEATURE_RET_NULL() \ + do { \ + bool is_supported = false; \ + if (!system_info_get_platform_bool(MINICONTROL_FEATURE, &is_supported)) { \ + if (is_supported == false) { \ + LOGE("[%s] feature is disabled", MINICONTROL_FEATURE); \ + set_last_result(MINICONTROL_ERROR_NOT_SUPPORTED); \ + return NULL; \ + } \ + } \ + } while (0) +#ifdef __cplusplus +} +#endif /* __cplusplus */ + +#endif /* __MINICONTROL_PRIVATE_H__ */ + diff --git a/include/minicontrol-provider.h b/include/minicontrol-provider.h index dba4e32..2ee2e37 100755 --- a/include/minicontrol-provider.h +++ b/include/minicontrol-provider.h @@ -53,12 +53,19 @@ typedef void (*minicontrol_event_cb)(minicontrol_viewer_event_e event_type, bund /** * @brief Creates a window for minicontrol. * @since_tizen 2.4 + * @remarks The specific error code can be obtained using the gat_last_result() method. Error codes are described in Exception section. * @param[in] name Name of minicontrol socket window * @param[in] target_viewer Target viewer for minicontrol. You can select multiple viewers by using bitwise OR operator * @param[in] callback A callback function for events originated by minicontrol viewer - * @return Evas object of socket window. @c NULL failed to create, get_last_result() will return reason of failure + * @return Evas object of minicontrol. NULL on error + * @exception #MINICONTROL_ERROR_NONE Success + * @exception #MINICONTROL_ERROR_INVALID_PARAMETER Invalid argument + * @exception #MINICONTROL_ERROR_ELM_FAILURE Some error occurred when creating a minicontrol window + * @exception #MINICONTROL_ERROR_OUT_OF_MEMORY Out of memory + * @exception #MINICONTROL_ERROR_NOT_SUPPORTED Not supported * @see #minicontrol_target_viewer_e * @see #minicontrol_event_cb + * @see get_last_result() */ Evas_Object *minicontrol_create_window(const char *name, minicontrol_target_viewer_e target_viewer, minicontrol_event_cb callback); @@ -72,6 +79,7 @@ Evas_Object *minicontrol_create_window(const char *name, minicontrol_target_view * @return #MINICONTROL_ERROR_NONE on success, * otherwise an error code on failure * @retval #MINICONTROL_ERROR_INVALID_PARAMETER Invalid argument + * @retval #MINICONTROL_ERROR_NOT_SUPPORTED Not supported * @see #minicontrol_provider_event_e * @see #minicontrol_create_window */ diff --git a/include/minicontrol-viewer.h b/include/minicontrol-viewer.h index 0599794..e8d1020 100755 --- a/include/minicontrol-viewer.h +++ b/include/minicontrol-viewer.h @@ -41,9 +41,15 @@ extern "C" { /** * @brief Adds minicontrol named as "minicontrol_name" to a given parent evas object and returns it. * @since_tizen 2.4 + * @remarks The specific error code can be obtained using the gat_last_result() method. Error codes are described in Exception section. * @param[in] parent Minicontrol object will be added to this parent evas object * @param[in] minicontrol_name Name of minicontrol - * @return Evas object of minicontrol. @c NULL failed to add, get_last_result() will return reason of failure + * @return Evas object of minicontrol. NULL on error + * @exception #MINICONTROL_ERROR_NONE Success + * @exception #MINICONTROL_ERROR_INVALID_PARAMETER Invalid argument + * @exception #MINICONTROL_ERROR_ELM_FAILURE Some error occurred when creating a minicontrol window + * @exception #MINICONTROL_ERROR_NOT_SUPPORTED Not supported + * @see get_last_result() */ Evas_Object *minicontrol_viewer_add(Evas_Object *parent, const char *minicontrol_name); @@ -56,6 +62,7 @@ Evas_Object *minicontrol_viewer_add(Evas_Object *parent, const char *minicontrol * @return #MINICONTROL_ERROR_NONE on success, * otherwise an error code on failure * @retval #MINICONTROL_ERROR_INVALID_PARAMETER Invalid argument + * @retval #MINICONTROL_ERROR_NOT_SUPPORTED Not supported * @see #minicontrol_viewer_event_e */ int minicontrol_viewer_send_event(const char *minicontrol_name, minicontrol_viewer_event_e event, bundle *event_arg); @@ -81,6 +88,7 @@ typedef void (*minicontrol_viewer_event_cb)(minicontrol_event_e event, const cha * @retval #MINICONTROL_ERROR_INVALID_PARAMETER Invalid argument * @retval #MINICONTROL_ERROR_IPC_FAILURE IPC failure * @retval #MINICONTROL_ERROR_OUT_OF_MEMORY Out of memory + * @retval #MINICONTROL_ERROR_NOT_SUPPORTED Not supported * @see #minicontrol_viewer_unset_event_cb * @see #minicontrol_viewer_event_cb */ @@ -91,6 +99,7 @@ int minicontrol_viewer_set_event_cb(minicontrol_viewer_event_cb callback, void * * @since_tizen 2.4 * @return #MINICONTROL_ERROR_NONE if success, * other value if failure + * @retval #MINICONTROL_ERROR_NOT_SUPPORTED Not supported * @see #minicontrol_viewer_set_event_cb */ int minicontrol_viewer_unset_event_cb(void); diff --git a/packaging/minicontrol.spec b/packaging/minicontrol.spec index 71c8fd1..02f1e94 100644 --- a/packaging/minicontrol.spec +++ b/packaging/minicontrol.spec @@ -12,6 +12,7 @@ BuildRequires: pkgconfig(evas) BuildRequires: pkgconfig(ecore-evas) BuildRequires: pkgconfig(dlog) BuildRequires: pkgconfig(bundle) +BuildRequires: pkgconfig(capi-system-info) BuildRequires: cmake Requires(post): /sbin/ldconfig requires(postun): /sbin/ldconfig diff --git a/src/minicontrol-provider.c b/src/minicontrol-provider.c index bf3e793..c0c8120 100755 --- a/src/minicontrol-provider.c +++ b/src/minicontrol-provider.c @@ -23,6 +23,7 @@ #include "minicontrol-provider.h" #include "minicontrol-provider-internal.h" #include "minicontrol-log.h" +#include "minicontrol-private.h" #define MINICTRL_PRIORITY_SUFFIX_TOP "__minicontrol_top" #define MINICTRL_PRIORITY_SUFFIX_LOW "__minicontrol_low" @@ -157,6 +158,8 @@ EXPORT_API Evas_Object *minicontrol_create_window(const char *name, char *name_inter; struct _minicontrol_provider *pd; + CHECK_MINICONTROL_FEATURE_RET_NULL(); + if (!name) { ERR("invalid parameter"); set_last_result(MINICONTROL_ERROR_INVALID_PARAMETER); @@ -230,6 +233,7 @@ EXPORT_API Evas_Object *minicontrol_create_window(const char *name, pd->event_callback = event_callback; INFO("new minicontrol created - %s", pd->name); + set_last_result(MINICONTROL_ERROR_NONE); return win; } @@ -239,6 +243,8 @@ EXPORT_API int minicontrol_send_event(Evas_Object *minicontrol, struct _minicontrol_provider *pd; int ret = MINICONTROL_ERROR_NONE; + CHECK_MINICONTROL_FEATURE(); + if (!minicontrol) { ERR("minicontrol is NULL, invaild parameter"); return MINICONTROL_ERROR_INVALID_PARAMETER; @@ -393,6 +399,8 @@ EXPORT_API Evas_Object *minicontrol_win_add(const char *name) char *name_inter = NULL; struct _minicontrol_provider *pd; + CHECK_MINICONTROL_FEATURE_RET_NULL(); + INFO("minicontrol_win_add [%s]", name); if (!name) { @@ -463,6 +471,8 @@ EXPORT_API int minicontrol_request(Evas_Object *minicontrol, struct _minicontrol_provider *pd; minicontrol_event_e event; + CHECK_MINICONTROL_FEATURE(); + if (!minicontrol) { ERR("minicontrol is NULL, invaild parameter"); return MINICONTROL_ERROR_INVALID_PARAMETER; diff --git a/src/minicontrol-viewer.c b/src/minicontrol-viewer.c index a3a5ed7..8183372 100755 --- a/src/minicontrol-viewer.c +++ b/src/minicontrol-viewer.c @@ -22,6 +22,7 @@ #include "minicontrol-viewer.h" #include "minicontrol-viewer-internal.h" #include "minicontrol-log.h" +#include "minicontrol-private.h" #define MINICTRL_PLUG_DATA_KEY "__minictrl_plug_name" @@ -38,6 +39,8 @@ EXPORT_API int minicontrol_viewer_send_event(const char *minicontrol_name, { int ret = MINICONTROL_ERROR_NONE; + CHECK_MINICONTROL_FEATURE(); + if (minicontrol_name == NULL) { ERR("appid is NULL, invaild parameter"); return MINICONTROL_ERROR_INVALID_PARAMETER; @@ -87,6 +90,8 @@ EXPORT_API int minicontrol_viewer_set_event_cb( minictrl_sig_handle *event_sh; struct _minicontrol_viewer *minicontrol_viewer_h; + CHECK_MINICONTROL_FEATURE(); + if (!callback) { ERR("MINICONTROL_ERROR_INVALID_PARAMETER"); return MINICONTROL_ERROR_INVALID_PARAMETER; @@ -129,6 +134,8 @@ EXPORT_API int minicontrol_viewer_set_event_cb( EXPORT_API int minicontrol_viewer_unset_event_cb(void) { + CHECK_MINICONTROL_FEATURE(); + if (!g_minicontrol_viewer_h) return MINICONTROL_ERROR_NONE; @@ -197,6 +204,8 @@ EXPORT_API Evas_Object *minicontrol_viewer_add(Evas_Object *parent, Evas_Object *plug_img = NULL; Ecore_Evas *ee = NULL; + CHECK_MINICONTROL_FEATURE_RET_NULL(); + if (parent == NULL || minicontrol_name == NULL) { ERR("invalid parameter"); set_last_result(MINICONTROL_ERROR_INVALID_PARAMETER); @@ -231,6 +240,7 @@ EXPORT_API Evas_Object *minicontrol_viewer_add(Evas_Object *parent, evas_object_event_callback_add(plug, EVAS_CALLBACK_DEL, _minictrl_plug_del, ee); + set_last_result(MINICONTROL_ERROR_NONE); return plug; } @@ -238,6 +248,8 @@ EXPORT_API Evas_Object *minicontrol_viewer_add(Evas_Object *parent, EXPORT_API Evas_Object *minicontrol_viewer_image_object_get( const Evas_Object *obj) { + CHECK_MINICONTROL_FEATURE_RET_NULL(); + return elm_plug_image_object_get(obj); } /* LCOV_EXCL_STOP */ @@ -250,6 +262,8 @@ EXPORT_API int minicontrol_viewer_request(const char *minicontrol_name, bundle *event_arg_bundle; char bundle_value_buffer[BUNDLE_BUFFER_LENGTH]; + CHECK_MINICONTROL_FEATURE(); + if (minicontrol_name == NULL) { ERR("appid is NULL, invaild parameter"); return MINICONTROL_ERROR_INVALID_PARAMETER; |