diff options
author | Seungha Son <seungha.son@samsung.com> | 2017-08-03 13:20:58 +0900 |
---|---|---|
committer | Seungha Son <seungha.son@samsung.com> | 2017-08-03 15:51:29 +0900 |
commit | fd658b3734033663687088613d29c69c80e00501 (patch) | |
tree | a10896edacc4126eb1ad2e0eb8ce65cb3c0c5d96 /include | |
parent | aefca08c2befade03e8a3153ac54feff31cb9bf9 (diff) | |
download | badge-fd658b3734033663687088613d29c69c80e00501.tar.gz badge-fd658b3734033663687088613d29c69c80e00501.tar.bz2 badge-fd658b3734033663687088613d29c69c80e00501.zip |
Add badge feature
Signed-off-by: Seungha Son <seungha.son@samsung.com>
Change-Id: I7910a4f183aeaa1f511ff1368584ff428e6aceea
Diffstat (limited to 'include')
-rwxr-xr-x | include/badge.h | 10 | ||||
-rwxr-xr-x | include/badge_error.h | 1 | ||||
-rwxr-xr-x | include/badge_internal.h | 9 | ||||
-rw-r--r-- | include/badge_private.h | 43 |
4 files changed, 61 insertions, 2 deletions
diff --git a/include/badge.h b/include/badge.h index 1cd6a29..7137d1f 100755 --- a/include/badge.h +++ b/include/badge.h @@ -51,6 +51,7 @@ extern "C" { * @retval BADGE_ERROR_PERMISSION_DENIED The application does not have the privilege to call this method * @retval BADGE_ERROR_IO_ERROR Error from I/O * @retval BADGE_ERROR_SERVICE_NOT_READY Service is not ready + * @retval BADGE_ERROR_NOT_SUPPORTED Not supported * @see #badge_error_e * @par Sample code: * @code @@ -82,6 +83,7 @@ int badge_new(const char *writable_app_id) TIZEN_DEPRECATED_API; * @retval #BADGE_ERROR_IO_ERROR Error from I/O * @retval #BADGE_ERROR_SERVICE_NOT_READY Service is not ready * @retval #BADGE_ERROR_INVALID_PACKAGE The caller application is not signed with the certificate of the badge_app_id + * @retval BADGE_ERROR_NOT_SUPPORTED Not supported * @see #badge_error_e * @par Sample code: * @code @@ -111,6 +113,7 @@ int badge_add(const char *badge_app_id); * @retval BADGE_ERROR_PERMISSION_DENIED The application does not have the privilege to call this method * @retval BADGE_ERROR_IO_ERROR Error from I/O * @retval BADGE_ERROR_SERVICE_NOT_READY Service is not ready + * @retval BADGE_ERROR_NOT_SUPPORTED Not supported * @see #badge_error_e * @par Sample code: * @code @@ -141,6 +144,7 @@ int badge_remove(const char *app_id); * @retval BADGE_ERROR_PERMISSION_DENIED The application does not have the privilege to call this method * @retval BADGE_ERROR_IO_ERROR Error from I/O * @retval BADGE_ERROR_SERVICE_NOT_READY Service is not ready + * @retval BADGE_ERROR_NOT_SUPPORTED Not supported * @see #badge_error_e * @see badge_new() * @par Sample code: @@ -173,6 +177,7 @@ int badge_set_count(const char *app_id, unsigned int count); * @retval BADGE_ERROR_FROM_DB Error from DB * @retval BADGE_ERROR_ALREADY_EXIST Already exist * @retval BADGE_ERROR_OUT_OF_MEMORY Out of memory + * @retval BADGE_ERROR_NOT_SUPPORTED Not supported * @see #badge_error_e * @see badge_new() * @see badge_set_count() @@ -206,6 +211,7 @@ int badge_get_count(const char *app_id, unsigned int *count); * @retval BADGE_ERROR_PERMISSION_DENIED The application does not have the privilege to call this method * @retval BADGE_ERROR_IO_ERROR Error from I/O * @retval BADGE_ERROR_SERVICE_NOT_READY Service is not ready + * @retval BADGE_ERROR_NOT_SUPPORTED Not supported * @see #badge_error_e * @see badge_new() * @par Sample code: @@ -239,6 +245,7 @@ int badge_set_display(const char *app_id, unsigned int is_display); * @retval BADGE_ERROR_NOT_EXIST Not exist * @retval BADGE_ERROR_SERVICE_NOT_READY Service is not ready * @retval BADGE_ERROR_OUT_OF_MEMORY Out of memory + * @retval BADGE_ERROR_NOT_SUPPORTED Not supported * @see #badge_error_e * @see badge_new() * @see badge_set_count() @@ -285,6 +292,7 @@ typedef bool (*badge_foreach_cb)(const char *app_id, unsigned int count, void *u * @retval BADGE_ERROR_FROM_DB Error form DB * @retval BADGE_ERROR_OUT_OF_MEMORY Out of memory * @retval BADGE_ERROR_NOT_EXIST Not exist + * @retval BADGE_ERROR_NOT_SUPPORTED Not supported * @see #badge_error_e * @see badge_foreach_cb() */ @@ -328,6 +336,7 @@ typedef void (*badge_change_cb)(unsigned int action, const char *app_id, * @retval BADGE_ERROR_INVALID_PARAMETER Invalid parameter * @retval BADGE_ERROR_PERMISSION_DENIED The application does not have the privilege to call this method * @retval BADGE_ERROR_OUT_OF_MEMORY Out of memory + * @retval BADGE_ERROR_NOT_SUPPORTED Not supported * @see #badge_error_e * @see badge_new() * @see badge_remove() @@ -346,6 +355,7 @@ int badge_register_changed_cb(badge_change_cb callback, void *user_data); * @retval BADGE_ERROR_INVALID_PARAMETER Invalid parameter * @retval BADGE_ERROR_PERMISSION_DENIED The application does not have the privilege to call this method * @retval BADGE_ERROR_NOT_EXIST Not exist + * @retval BADGE_ERROR_NOT_SUPPORTED Not supported * @see #badge_error_e * @see badge_register_changed_cb() */ diff --git a/include/badge_error.h b/include/badge_error.h index 7651756..c1dac61 100755 --- a/include/badge_error.h +++ b/include/badge_error.h @@ -44,6 +44,7 @@ typedef enum _badge_error_e { BADGE_ERROR_OUT_OF_MEMORY = TIZEN_ERROR_OUT_OF_MEMORY, /**< Out of memory */ BADGE_ERROR_PERMISSION_DENIED = TIZEN_ERROR_PERMISSION_DENIED, /**< Permission denied */ BADGE_ERROR_IO_ERROR = TIZEN_ERROR_IO_ERROR, /**< Error from I/O */ + BADGE_ERROR_NOT_SUPPORTED = TIZEN_ERROR_NOT_SUPPORTED, /**< Not supported (Since 4.0) */ BADGE_ERROR_FROM_DB = TIZEN_ERROR_BADGE | 0x01, /**< Error from DB */ BADGE_ERROR_ALREADY_EXIST = TIZEN_ERROR_BADGE | 0x02, /**< Already exist */ BADGE_ERROR_FROM_DBUS = TIZEN_ERROR_BADGE | 0x03, /**< Error from DBus */ diff --git a/include/badge_internal.h b/include/badge_internal.h index 64e55f0..a0fe5ba 100755 --- a/include/badge_internal.h +++ b/include/badge_internal.h @@ -56,8 +56,9 @@ typedef struct badge_info { * @privilege %http://tizen.org/privilege/notification * @remarks The specific error code can be obtained using the get_last_result() method. Error codes are described in Exception section. * @return 1 if badge service is ready, other value if badge service isn't ready - * @exception BADGE_ERROR_NONE Success - * @exception BADGE_ERROR_SERVICE_NOT_READY Service is not ready + * @retval BADGE_ERROR_NONE Success + * @retval BADGE_ERROR_SERVICE_NOT_READY Service is not ready + * @retval BADGE_ERROR_NOT_SUPPORTED Not supported */ int badge_is_service_ready(void); @@ -73,6 +74,7 @@ int badge_is_service_ready(void); * @retval BADGE_ERROR_NONE Success * @retval BADGE_ERROR_PERMISSION_DENIED The application does not have the privilege to call this method * @retval BADGE_ERROR_OUT_OF_MEMORY Out of memory + * @retval BADGE_ERROR_NOT_SUPPORTED Not supported * @see #badge_error_e * @see badge_is_service_ready() */ @@ -90,6 +92,7 @@ int badge_add_deferred_task( * @retval BADGE_ERROR_NONE Success * @retval BADGE_ERROR_INVALID_PARAMETER Invalid parameter * @retval BADGE_ERROR_PERMISSION_DENIED The application does not have the privilege to call this method + * @retval BADGE_ERROR_NOT_SUPPORTED Not supported * @see #badge_error_e * @see badge_is_service_ready() */ @@ -112,6 +115,7 @@ int badge_del_deferred_task( * @retval BADGE_ERROR_OUT_OF_MEMORY Out of memory * @retval BADGE_ERROR_NOT_EXIST Not exist * @retval BADGE_ERROR_SERVICE_NOT_READY Service is not ready + * @retval BADGE_ERROR_NOT_SUPPORTED Not supported * @see #badge_error_e * @see badge_new() * @see badge_remove() @@ -174,6 +178,7 @@ void badge_changed_cb_call(unsigned int action, const char *pkgname, * @param[in] pkgname The name of the designated package * @param[in] writable_pkg The name of package which is authorized to change the badge * @return #BADGE_ERROR_NONE if success, other value if failure + * @retval BADGE_ERROR_NOT_SUPPORTED Not supported * @see #badge_error_e * @par Sample code: * @code diff --git a/include/badge_private.h b/include/badge_private.h new file mode 100644 index 0000000..c26cca1 --- /dev/null +++ b/include/badge_private.h @@ -0,0 +1,43 @@ +/* + * 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 __BADGE_PRIVATE_H__ +#define __BADGE_PRIVATE_H__ + +#include <system_info.h> + +#ifdef __cplusplus +extern "C" { +#endif /* __cplusplus */ + +#define BADGE_FEATURE "http://tizen.org/feature/badge" +#define CHECK_BADGE_FEATURE() \ + do { \ + bool is_supported = false; \ + if (!system_info_get_platform_bool(BADGE_FEATURE, &is_supported)) { \ + if (is_supported == false) { \ + LOGE("[%s] feature is disabled", BADGE_FEATURE); \ + return BADGE_ERROR_NOT_SUPPORTED; \ + } \ + } \ + } while (0) + +#ifdef __cplusplus +} +#endif /* __cplusplus */ + +#endif /* __BADGE_PRIVATE_H__ */ |