summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSung-jae Park <nicesj.park@samsung.com>2015-05-11 20:59:29 +0900
committerSung-jae Park <nicesj.park@samsung.com>2015-05-11 20:59:36 +0900
commit7f9fe28115744c02b0bdbd277e23f60bf090af23 (patch)
tree7340e30b66f8edab809324f602b1c04914864eb1
parentcca2cd0f70d58eebd47677b915b1f8ca5d1a5a64 (diff)
parent7261148866f1cdcbebcc3dfd41284720a1b6b059 (diff)
downloadnotification-7f9fe28115744c02b0bdbd277e23f60bf090af23.tar.gz
notification-7f9fe28115744c02b0bdbd277e23f60bf090af23.tar.bz2
notification-7f9fe28115744c02b0bdbd277e23f60bf090af23.zip
Merge branch 'tizen_2.3' of ssh://168.219.209.56:29418/apps/home/notification into tizen
Change-Id: I26ce038f7acd8d038c19cef18fd0f1b93138bbb0
-rw-r--r--AUTHORS4
-rw-r--r--CMakeLists.txt99
-rw-r--r--LICENSE204
-rw-r--r--TC/_export_env.sh10
-rw-r--r--TC/_export_target_env.sh9
-rw-r--r--TC/build.sh16
-rw-r--r--TC/clean.sh11
-rw-r--r--TC/config3
-rw-r--r--TC/push.sh13
-rw-r--r--TC/run.sh15
-rw-r--r--TC/testcase/Makefile26
-rw-r--r--TC/testcase/tslist4
-rw-r--r--TC/testcase/utc_notification.c2369
-rw-r--r--TC/testcase/utc_notification_list.c441
-rw-r--r--TC/testcase/utc_notification_setting.c114
-rw-r--r--TC/testcase/utc_notification_status.c131
-rw-r--r--TC/tet_scen7
-rw-r--r--TC/tetbuild.cfg5
-rw-r--r--TC/tetclean.cfg5
-rw-r--r--TC/tetexec.cfg5
-rw-r--r--debian/changelog183
-rw-r--r--debian/compat1
-rw-r--r--debian/control27
-rw-r--r--debian/libnotification-0.install.in1
-rw-r--r--debian/libnotification-0.postinst.in92
-rw-r--r--debian/libnotification-dev.install.in2
-rw-r--r--debian/rules116
-rw-r--r--doc/notification_doc.h61
-rw-r--r--include/notification.h1567
-rw-r--r--include/notification_db.h53
-rw-r--r--include/notification_debug.h79
-rw-r--r--include/notification_error.h57
-rw-r--r--include/notification_group.h57
-rw-r--r--include/notification_internal.h642
-rw-r--r--include/notification_ipc.h64
-rw-r--r--include/notification_list.h281
-rw-r--r--include/notification_noti.h70
-rw-r--r--include/notification_ongoing.h36
-rw-r--r--include/notification_private.h84
-rw-r--r--include/notification_setting.h39
-rw-r--r--include/notification_setting_service.h37
-rw-r--r--include/notification_status.h96
-rw-r--r--include/notification_type.h385
-rw-r--r--notification-service.pc.in11
-rw-r--r--notification.manifest16
-rw-r--r--notification.pc.in11
-rw-r--r--packaging/notification.spec203
-rw-r--r--src/notification.c3126
-rw-r--r--src/notification_db.c134
-rw-r--r--src/notification_group.c202
-rw-r--r--src/notification_ipc.c1496
-rw-r--r--src/notification_list.c227
-rw-r--r--src/notification_noti.c1939
-rw-r--r--src/notification_ongoing.c175
-rw-r--r--src/notification_permission.c65
-rw-r--r--src/notification_setting.c343
-rw-r--r--src/notification_status.c193
-rw-r--r--test-app/CMakeLists.txt44
-rw-r--r--test-app/main.c406
59 files changed, 16112 insertions, 0 deletions
diff --git a/AUTHORS b/AUTHORS
new file mode 100644
index 0000000..fa6ae31
--- /dev/null
+++ b/AUTHORS
@@ -0,0 +1,4 @@
+Seungtaek Chung <seungtaek.chung@samsung.com>
+Mi-Ju Lee <miju52.lee@samsung.com>
+Xi zhichan <zhichan.xi@samsung.com>
+
diff --git a/CMakeLists.txt b/CMakeLists.txt
new file mode 100644
index 0000000..53ec145
--- /dev/null
+++ b/CMakeLists.txt
@@ -0,0 +1,99 @@
+CMAKE_MINIMUM_REQUIRED(VERSION 2.6)
+PROJECT(notification C)
+
+SET(PREFIX ${CMAKE_INSTALL_PREFIX})
+SET(EXEC_PREFIX "\${prefix}")
+SET(LIBDIR "\${prefix}/lib")
+SET(INCLUDEDIR "\${prefix}/include/${PROJECT_NAME}")
+SET(ICONDIR "${PREFIX}/share/${PROJECT_NAME}")
+SET(RESDIR "${PREFIX}/share/${PROJECT_NAME}")
+SET(DBDIR "/opt/dbspace")
+SET(IMGDIR "${RESDIR}/images")
+SET(DBFILE ".notification.db")
+SET(MAJOR_VER 0)
+SET(VERSION ${MAJOR_VER}.1.0)
+
+ADD_SUBDIRECTORY(test-app)
+
+SET(SRCS
+ ./src/notification.c
+ ./src/notification_noti.c
+ ./src/notification_ongoing.c
+ ./src/notification_group.c
+ ./src/notification_db.c
+ ./src/notification_list.c
+ ./src/notification_status.c
+ ./src/notification_ipc.c
+ ./src/notification_setting.c)
+SET(HEADERS-DEVEL
+ ./include/notification.h
+ ./include/notification_internal.h
+ ./include/notification_error.h
+ ./include/notification_type.h
+ ./include/notification_list.h
+ ./include/notification_status.h)
+
+SET(HEADERS-SERVICE-DEVEL
+ ./include/notification_ipc.h
+ ./include/notification_noti.h
+ ./include/notification_setting_service.h)
+
+INCLUDE_DIRECTORIES(${CMAKE_SOURCE_DIR}/include)
+
+INCLUDE(FindPkgConfig)
+pkg_check_modules(pkgs REQUIRED
+ sqlite3
+ db-util
+ vconf
+ bundle
+ dlog
+ ail
+ aul
+ appsvc
+ dbus-1
+ dbus-glib-1
+ com-core
+ capi-appfw-application
+ capi-appfw-package-manager
+ edbus
+ elementary
+ ecore
+ eina
+)
+
+FOREACH(flag ${pkgs_CFLAGS})
+ SET(EXTRA_CFLAGS "${EXTRA_CFLAGS} ${flag}")
+ENDFOREACH(flag)
+
+SET(EXTRA_CFLAGS "${EXTRA_CFLAGS} -fvisibility=hidden -g -Wall")
+SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${EXTRA_CFLAGS}")
+
+SET(CMAKE_SKIP_BUILD_RPATH TRUE)
+
+ADD_DEFINITIONS("-DPREFIX=\"${PREFIX}\"")
+ADD_DEFINITIONS("-DICONDIR=\"${ICONDIR}\"")
+ADD_DEFINITIONS("-DDBDIR=\"${DBDIR}\"")
+ADD_DEFINITIONS("-DDBFILE=\"${DBFILE}\"")
+ADD_DEFINITIONS("-DIMGDIR=\"${IMGDIR}\"")
+
+ADD_LIBRARY(${PROJECT_NAME} SHARED ${SRCS})
+SET_TARGET_PROPERTIES(${PROJECT_NAME} PROPERTIES SOVERSION ${MAJOR_VER})
+SET_TARGET_PROPERTIES(${PROJECT_NAME} PROPERTIES VERSION ${VERSION})
+TARGET_LINK_LIBRARIES(${PROJECT_NAME} ${pkgs_LDFLAGS})
+
+CONFIGURE_FILE(${PROJECT_NAME}.pc.in ${PROJECT_NAME}.pc @ONLY)
+INSTALL(TARGETS ${PROJECT_NAME} DESTINATION lib COMPONENT RuntimeLibraries)
+INSTALL(FILES ${CMAKE_BINARY_DIR}/${PROJECT_NAME}.pc DESTINATION lib/pkgconfig)
+
+INSTALL(DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/data/images/ DESTINATION ${IMGDIR} FILES_MATCHING PATTERN "*.png")
+
+FOREACH(hfile ${HEADERS-DEVEL})
+ INSTALL(FILES ${CMAKE_SOURCE_DIR}/${hfile} DESTINATION include/${PROJECT_NAME})
+ENDFOREACH(hfile)
+
+CONFIGURE_FILE(${PROJECT_NAME}-service.pc.in ${PROJECT_NAME}-service.pc @ONLY)
+INSTALL(FILES ${CMAKE_BINARY_DIR}/${PROJECT_NAME}-service.pc DESTINATION lib/pkgconfig)
+
+FOREACH(hfile ${HEADERS-SERVICE-DEVEL})
+ INSTALL(FILES ${CMAKE_SOURCE_DIR}/${hfile} DESTINATION include/${PROJECT_NAME}/service)
+ENDFOREACH(hfile)
diff --git a/LICENSE b/LICENSE
new file mode 100644
index 0000000..a06208b
--- /dev/null
+++ b/LICENSE
@@ -0,0 +1,204 @@
+Copyright (c) 2000 - 2011 Samsung Electronics Co., Ltd. All rights reserved.
+
+ Apache License
+ Version 2.0, January 2004
+ http://www.apache.org/licenses/
+
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
+
+ 1. Definitions.
+
+ "License" shall mean the terms and conditions for use, reproduction,
+ and distribution as defined by Sections 1 through 9 of this document.
+
+ "Licensor" shall mean the copyright owner or entity authorized by
+ the copyright owner that is granting the License.
+
+ "Legal Entity" shall mean the union of the acting entity and all
+ other entities that control, are controlled by, or are under common
+ control with that entity. For the purposes of this definition,
+ "control" means (i) the power, direct or indirect, to cause the
+ direction or management of such entity, whether by contract or
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
+ outstanding shares, or (iii) beneficial ownership of such entity.
+
+ "You" (or "Your") shall mean an individual or Legal Entity
+ exercising permissions granted by this License.
+
+ "Source" form shall mean the preferred form for making modifications,
+ including but not limited to software source code, documentation
+ source, and configuration files.
+
+ "Object" form shall mean any form resulting from mechanical
+ transformation or translation of a Source form, including but
+ not limited to compiled object code, generated documentation,
+ and conversions to other media types.
+
+ "Work" shall mean the work of authorship, whether in Source or
+ Object form, made available under the License, as indicated by a
+ copyright notice that is included in or attached to the work
+ (an example is provided in the Appendix below).
+
+ "Derivative Works" shall mean any work, whether in Source or Object
+ form, that is based on (or derived from) the Work and for which the
+ editorial revisions, annotations, elaborations, or other modifications
+ represent, as a whole, an original work of authorship. For the purposes
+ of this License, Derivative Works shall not include works that remain
+ separable from, or merely link (or bind by name) to the interfaces of,
+ the Work and Derivative Works thereof.
+
+ "Contribution" shall mean any work of authorship, including
+ the original version of the Work and any modifications or additions
+ to that Work or Derivative Works thereof, that is intentionally
+ submitted to Licensor for inclusion in the Work by the copyright owner
+ or by an individual or Legal Entity authorized to submit on behalf of
+ the copyright owner. For the purposes of this definition, "submitted"
+ means any form of electronic, verbal, or written communication sent
+ to the Licensor or its representatives, including but not limited to
+ communication on electronic mailing lists, source code control systems,
+ and issue tracking systems that are managed by, or on behalf of, the
+ Licensor for the purpose of discussing and improving the Work, but
+ excluding communication that is conspicuously marked or otherwise
+ designated in writing by the copyright owner as "Not a Contribution."
+
+ "Contributor" shall mean Licensor and any individual or Legal Entity
+ on behalf of whom a Contribution has been received by Licensor and
+ subsequently incorporated within the Work.
+
+ 2. Grant of Copyright License. Subject to the terms and conditions of
+ this License, each Contributor hereby grants to You a perpetual,
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+ copyright license to reproduce, prepare Derivative Works of,
+ publicly display, publicly perform, sublicense, and distribute the
+ Work and such Derivative Works in Source or Object form.
+
+ 3. Grant of Patent License. Subject to the terms and conditions of
+ this License, each Contributor hereby grants to You a perpetual,
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+ (except as stated in this section) patent license to make, have made,
+ use, offer to sell, sell, import, and otherwise transfer the Work,
+ where such license applies only to those patent claims licensable
+ by such Contributor that are necessarily infringed by their
+ Contribution(s) alone or by combination of their Contribution(s)
+ with the Work to which such Contribution(s) was submitted. If You
+ institute patent litigation against any entity (including a
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
+ or a Contribution incorporated within the Work constitutes direct
+ or contributory patent infringement, then any patent licenses
+ granted to You under this License for that Work shall terminate
+ as of the date such litigation is filed.
+
+ 4. Redistribution. You may reproduce and distribute copies of the
+ Work or Derivative Works thereof in any medium, with or without
+ modifications, and in Source or Object form, provided that You
+ meet the following conditions:
+
+ (a) You must give any other recipients of the Work or
+ Derivative Works a copy of this License; and
+
+ (b) You must cause any modified files to carry prominent notices
+ stating that You changed the files; and
+
+ (c) You must retain, in the Source form of any Derivative Works
+ that You distribute, all copyright, patent, trademark, and
+ attribution notices from the Source form of the Work,
+ excluding those notices that do not pertain to any part of
+ the Derivative Works; and
+
+ (d) If the Work includes a "NOTICE" text file as part of its
+ distribution, then any Derivative Works that You distribute must
+ include a readable copy of the attribution notices contained
+ within such NOTICE file, excluding those notices that do not
+ pertain to any part of the Derivative Works, in at least one
+ of the following places: within a NOTICE text file distributed
+ as part of the Derivative Works; within the Source form or
+ documentation, if provided along with the Derivative Works; or,
+ within a display generated by the Derivative Works, if and
+ wherever such third-party notices normally appear. The contents
+ of the NOTICE file are for informational purposes only and
+ do not modify the License. You may add Your own attribution
+ notices within Derivative Works that You distribute, alongside
+ or as an addendum to the NOTICE text from the Work, provided
+ that such additional attribution notices cannot be construed
+ as modifying the License.
+
+ You may add Your own copyright statement to Your modifications and
+ may provide additional or different license terms and conditions
+ for use, reproduction, or distribution of Your modifications, or
+ for any such Derivative Works as a whole, provided Your use,
+ reproduction, and distribution of the Work otherwise complies with
+ the conditions stated in this License.
+
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
+ any Contribution intentionally submitted for inclusion in the Work
+ by You to the Licensor shall be under the terms and conditions of
+ this License, without any additional terms or conditions.
+ Notwithstanding the above, nothing herein shall supersede or modify
+ the terms of any separate license agreement you may have executed
+ with Licensor regarding such Contributions.
+
+ 6. Trademarks. This License does not grant permission to use the trade
+ names, trademarks, service marks, or product names of the Licensor,
+ except as required for reasonable and customary use in describing the
+ origin of the Work and reproducing the content of the NOTICE file.
+
+ 7. Disclaimer of Warranty. Unless required by applicable law or
+ agreed to in writing, Licensor provides the Work (and each
+ Contributor provides its Contributions) on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
+ implied, including, without limitation, any warranties or conditions
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
+ PARTICULAR PURPOSE. You are solely responsible for determining the
+ appropriateness of using or redistributing the Work and assume any
+ risks associated with Your exercise of permissions under this License.
+
+ 8. Limitation of Liability. In no event and under no legal theory,
+ whether in tort (including negligence), contract, or otherwise,
+ unless required by applicable law (such as deliberate and grossly
+ negligent acts) or agreed to in writing, shall any Contributor be
+ liable to You for damages, including any direct, indirect, special,
+ incidental, or consequential damages of any character arising as a
+ result of this License or out of the use or inability to use the
+ Work (including but not limited to damages for loss of goodwill,
+ work stoppage, computer failure or malfunction, or any and all
+ other commercial damages or losses), even if such Contributor
+ has been advised of the possibility of such damages.
+
+ 9. Accepting Warranty or Additional Liability. While redistributing
+ the Work or Derivative Works thereof, You may choose to offer,
+ and charge a fee for, acceptance of support, warranty, indemnity,
+ or other liability obligations and/or rights consistent with this
+ License. However, in accepting such obligations, You may act only
+ on Your own behalf and on Your sole responsibility, not on behalf
+ of any other Contributor, and only if You agree to indemnify,
+ defend, and hold each Contributor harmless for any liability
+ incurred by, or claims asserted against, such Contributor by reason
+ of your accepting any such warranty or additional liability.
+
+ END OF TERMS AND CONDITIONS
+
+ APPENDIX: How to apply the Apache License to your work.
+
+ To apply the Apache License to your work, attach the following
+ boilerplate notice, with the fields enclosed by brackets "[]"
+ replaced with your own identifying information. (Don't include
+ the brackets!) The text should be enclosed in the appropriate
+ comment syntax for the file format. We also recommend that a
+ file or class name and description of purpose be included on the
+ same "printed page" as the copyright notice for easier
+ identification within third-party archives.
+
+ Copyright [yyyy] [name of copyright owner]
+
+ 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.
+
diff --git a/TC/_export_env.sh b/TC/_export_env.sh
new file mode 100644
index 0000000..7a317f8
--- /dev/null
+++ b/TC/_export_env.sh
@@ -0,0 +1,10 @@
+#!/bin/sh
+
+source ./config
+
+export TET_INSTALL_PATH=$TET_INSTALL_HOST_PATH # tetware root path
+#export TET_TARGET_PATH=$TET_INSTALL_PATH/tetware-simulator # tetware target path
+export TET_TARGET_PATH=$TET_INSTALL_PATH/tetware-target # tetware target path
+export PATH=$TET_TARGET_PATH/bin:$PATH
+export LD_LIBRARY_PATH=$TET_TARGET_PATH/lib/tet3:$LD_LIBRARY_PATH
+export TET_ROOT=$TET_TARGET_PATH
diff --git a/TC/_export_target_env.sh b/TC/_export_target_env.sh
new file mode 100644
index 0000000..5e005cf
--- /dev/null
+++ b/TC/_export_target_env.sh
@@ -0,0 +1,9 @@
+#!/bin/sh
+. ./config
+
+export TET_INSTALL_PATH=$TET_INSTALL_TARGET_PATH # path to path
+#export TET_TARGET_PATH=$TET_INSTALL_PATH/tetware-simulator
+export TET_TARGET_PATH=$TET_INSTALL_PATH/tetware-target
+export PATH=$TET_TARGET_PATH/bin:$PATH
+export LD_LIBRARY_PATH=$TET_TARGET_PATH/lib/tet3:$LD_LIBRARY_PATH
+export TET_ROOT=$TET_TARGET_PATH
diff --git a/TC/build.sh b/TC/build.sh
new file mode 100644
index 0000000..72aad6c
--- /dev/null
+++ b/TC/build.sh
@@ -0,0 +1,16 @@
+#!/bin/sh
+
+. ./_export_env.sh # setting environment variables
+
+export TET_SUITE_ROOT=`pwd`
+FILE_NAME_EXTENSION=`date +%s`
+
+RESULT_DIR=results
+HTML_RESULT=$RESULT_DIR/build-tar-result-$FILE_NAME_EXTENSION.html
+JOURNAL_RESULT=$RESULT_DIR/build-tar-result-$FILE_NAME_EXTENSION.journal
+
+mkdir -p $RESULT_DIR
+
+tcc -c -p ./
+tcc -b -j $JOURNAL_RESULT -p ./
+grw -c 7 -f chtml -o $HTML_RESULT $JOURNAL_RESULT
diff --git a/TC/clean.sh b/TC/clean.sh
new file mode 100644
index 0000000..29743e0
--- /dev/null
+++ b/TC/clean.sh
@@ -0,0 +1,11 @@
+#!/bin/sh
+
+. ./_export_env.sh # setting environment variables
+
+export TET_SUITE_ROOT=`pwd`
+RESULT_DIR=results
+
+tcc -c -p ./ # executing tcc, with clean option (-c)
+rm -r $RESULT_DIR
+rm -r tet_tmp_dir
+rm testcase/tet_captured
diff --git a/TC/config b/TC/config
new file mode 100644
index 0000000..e3b6f33
--- /dev/null
+++ b/TC/config
@@ -0,0 +1,3 @@
+PKG_NAME=notification
+TET_INSTALL_HOST_PATH=/var/tmp/dts_fw/TC/TETware
+TET_INSTALL_TARGET_PATH=/opt/home/$PKG_NAME/TETware
diff --git a/TC/push.sh b/TC/push.sh
new file mode 100644
index 0000000..5eb9510
--- /dev/null
+++ b/TC/push.sh
@@ -0,0 +1,13 @@
+#!/bin/sh
+
+. ./config
+
+TC_PATH=/opt/home/$PKG_NAME
+
+echo $TC_PATH
+
+sdb shell "mkdir -p $TC_PATH"
+
+sdb push . $TC_PATH
+
+
diff --git a/TC/run.sh b/TC/run.sh
new file mode 100644
index 0000000..cec5778
--- /dev/null
+++ b/TC/run.sh
@@ -0,0 +1,15 @@
+#!/bin/sh
+
+source ./_export_target_env.sh
+
+export TET_SUITE_ROOT=`pwd`
+FILE_NAME_EXTENSION=`date +%s`
+
+RESULT_DIR=results
+HTML_RESULT=$RESULT_DIR/exec-tar-result-$FILE_NAME_EXTENSION.html
+JOURNAL_RESULT=$RESULT_DIR/exec-tar-result-$FILE_NAME_EXTENSION.journal
+
+mkdir -p $RESULT_DIR
+
+tcc -e -j $JOURNAL_RESULT -p ./
+grw -c 7 -f chtml -o $HTML_RESULT $JOURNAL_RESULT
diff --git a/TC/testcase/Makefile b/TC/testcase/Makefile
new file mode 100644
index 0000000..2f5ca3d
--- /dev/null
+++ b/TC/testcase/Makefile
@@ -0,0 +1,26 @@
+include ../config
+
+CC ?= gcc
+
+C_FILES = $(shell ls *.c)
+
+PKGS = $(PKG_NAME)
+PKGS += glib-2.0
+LDFLAGS = `pkg-config --libs $(PKGS)`
+LDFLAGS += $(TET_ROOT)/lib/tet3/tcm_s.o
+LDFLAGS += -L$(TET_ROOT)/lib/tet3 -ltcm_s
+LDFLAGS += -L$(TET_ROOT)/lib/tet3 -lapi_s
+
+CFLAGS = -I. `pkg-config --cflags $(PKGS)`
+CFLAGS += -I$(TET_ROOT)/inc/tet3
+CFLAGS += -Wall
+
+TCS := $(shell ls -1 *.c | cut -d. -f1)
+
+all: $(TCS)
+
+%: %.c
+ $(CC) -o $@ $< $(CFLAGS) $(LDFLAGS)
+
+clean:
+ rm -f $(TCS)
diff --git a/TC/testcase/tslist b/TC/testcase/tslist
new file mode 100644
index 0000000..90e5298
--- /dev/null
+++ b/TC/testcase/tslist
@@ -0,0 +1,4 @@
+/testcase/utc_notification
+/testcase/utc_notification_list
+/testcase/utc_notification_setting
+/testcase/utc_notification_status \ No newline at end of file
diff --git a/TC/testcase/utc_notification.c b/TC/testcase/utc_notification.c
new file mode 100644
index 0000000..527a11f
--- /dev/null
+++ b/TC/testcase/utc_notification.c
@@ -0,0 +1,2369 @@
+/*
+ * 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 <unistd.h>
+#include <fcntl.h>
+#include <libintl.h>
+#include <tet_api.h>
+#include <notification.h>
+
+#define TEST_PKG "org.tizen.tetware"
+
+enum {
+ POSITIVE_TC_IDX = 0x01,
+ NEGATIVE_TC_IDX,
+};
+
+static void startup(void);
+static void cleanup(void);
+
+static void utc_notification_create_1_n(void);
+static void utc_notification_create_2_n(void);
+static void utc_notification_create_1_p(void);
+static void utc_notification_create_2_p(void);
+static void utc_notification_set_image_n(void);
+static void utc_notification_set_image_p(void);
+static void utc_notification_get_image_n(void);
+static void utc_notification_get_image_p(void);
+static void utc_notification_set_time_n(void);
+static void utc_notification_set_time_p(void);
+static void utc_notification_get_time_n(void);
+static void utc_notification_get_time_p(void);
+static void utc_notification_get_insert_time_n(void);
+static void utc_notification_get_insert_time_p(void);
+static void utc_notification_set_text_n(void);
+static void utc_notification_set_text_p(void);
+static void utc_notification_get_text_n(void);
+static void utc_notification_get_text_p(void);
+static void utc_notification_set_text_domain_n(void);
+static void utc_notification_set_text_domain_p(void);
+static void utc_notification_get_text_domain_n(void);
+static void utc_notification_get_text_domain_p(void);
+static void utc_notification_set_time_to_text_n(void);
+static void utc_notification_set_time_to_text_p(void);
+static void utc_notification_get_time_from_text_n(void);
+static void utc_notification_get_time_from_text_p(void);
+static void utc_notification_set_sound_n(void);
+static void utc_notification_set_sound_p(void);
+static void utc_notification_get_sound_n(void);
+static void utc_notification_get_sound_p(void);
+static void utc_notification_set_vibration_n(void);
+static void utc_notification_set_vibration_p(void);
+static void utc_notification_get_vibration_n(void);
+static void utc_notification_get_vibration_p(void);
+static void utc_notification_set_led_n(void);
+static void utc_notification_set_led_p(void);
+static void utc_notification_get_led_n(void);
+static void utc_notification_get_led_p(void);
+static void utc_notification_set_led_time_period_n(void);
+static void utc_notification_set_led_time_period_p(void);
+static void utc_notification_get_led_time_period_n(void);
+static void utc_notification_get_led_time_period_p(void);
+static void utc_notification_set_application_n(void);
+static void utc_notification_set_application_p(void);
+static void utc_notification_get_application_n(void);
+static void utc_notification_get_application_p(void);
+static void utc_notification_set_launch_option_n(void);
+static void utc_notification_set_launch_option_p(void);
+static void utc_notification_get_launch_option_n(void);
+static void utc_notification_get_launch_option_p(void);
+static void utc_notification_set_execute_option_n(void);
+static void utc_notification_set_execute_option_p(void);
+static void utc_notification_get_execute_option_n(void);
+static void utc_notification_get_execute_option_p(void);
+static void utc_notification_set_property_n(void);
+static void utc_notification_set_property_p(void);
+static void utc_notification_get_property_n(void);
+static void utc_notification_get_property_p(void);
+static void utc_notification_set_display_applist_n(void);
+static void utc_notification_set_display_applist_p(void);
+static void utc_notification_get_display_applist_n(void);
+static void utc_notification_get_display_applist_p(void);
+static void utc_notification_set_size_n(void);
+static void utc_notification_set_size_p(void);
+static void utc_notification_get_size_n(void);
+static void utc_notification_get_size_p(void);
+static void utc_notification_set_progress_n(void);
+static void utc_notification_set_progress_p(void);
+static void utc_notification_get_progress_n(void);
+static void utc_notification_get_progress_p(void);
+static void utc_notification_set_pkgname_n(void);
+static void utc_notification_set_pkgname_p(void);
+static void utc_notification_get_pkgname_n(void);
+static void utc_notification_get_pkgname_p(void);
+static void utc_notification_set_layout_n(void);
+static void utc_notification_set_layout_p(void);
+static void utc_notification_get_layout_n(void);
+static void utc_notification_get_layout_p(void);
+static void utc_notification_get_id_n(void);
+static void utc_notification_get_id_p(void);
+static void utc_notification_get_type_n(void);
+static void utc_notification_get_type_p(void);
+static void utc_notification_insert_n(void);
+static void utc_notification_insert_p(void);
+static void utc_notification_clear_n(void);
+static void utc_notification_clear_p(void);
+static void utc_notification_update_n(void);
+static void utc_notification_update_p(void);
+static void utc_notification_delete_all_by_type_n(void);
+static void utc_notification_delete_all_by_type_p(void);
+static void utc_notification_delete_by_priv_id_n(void);
+static void utc_notification_delete_by_priv_id_p(void);
+static void utc_notification_delete_n(void);
+static void utc_notification_delete_p(void);
+static void utc_notification_update_progress_n(void);
+static void utc_notification_update_progress_p(void);
+static void utc_notification_update_size_n(void);
+static void utc_notification_update_size_p(void);
+static void utc_notification_update_content_n(void);
+static void utc_notification_update_content_p(void);
+static void utc_notification_new_1_n(void);
+static void utc_notification_new_2_n(void);
+static void utc_notification_new_1_p(void);
+static void utc_notification_new_2_p(void);
+static void utc_notification_load_n(void);
+static void utc_notification_load_p(void);
+static void utc_notification_clone_n(void);
+static void utc_notification_clone_p(void);
+static void utc_notification_free_n(void);
+static void utc_notification_free_p(void);
+static void utc_notification_resister_changed_cb_n(void);
+static void utc_notification_resister_changed_cb_p(void);
+static void utc_notification_unresister_changed_cb_n(void);
+static void utc_notification_unresister_changed_cb_p(void);
+static void utc_notification_register_detailed_changed_cb_n(void);
+static void utc_notification_register_detailed_changed_cb_p(void);
+static void utc_notification_unregister_detailed_changed_cb_n(void);
+static void utc_notification_unregister_detailed_changed_cb_p(void);
+static void utc_notification_get_count_n(void);
+static void utc_notification_get_count_p(void);
+static void utc_notification_get_list_n(void);
+static void utc_notification_get_list_p(void);
+static void utc_notification_get_grouping_list_n(void);
+static void utc_notification_get_grouping_list_p(void);
+static void utc_notification_get_detail_list_n(void);
+static void utc_notification_get_detail_list_p(void);
+static void utc_notification_free_list_n(void);
+static void utc_notification_free_list_p(void);
+static void utc_notification_op_get_data_n(void);
+static void utc_notification_op_get_data_p(void);
+static void utc_notification_is_service_ready_p(void);
+static void utc_notification_add_deferred_task_n(void);
+static void utc_notification_add_deferred_task_p(void);
+static void utc_notification_del_deferred_task_n(void);
+static void utc_notification_del_deferred_task_p(void);
+
+void (*tet_startup)(void) = startup;
+void (*tet_cleanup)(void) = cleanup;
+
+struct tet_testlist tet_testlist[] = {
+ {utc_notification_create_1_n, NEGATIVE_TC_IDX},
+ {utc_notification_create_2_n, NEGATIVE_TC_IDX},
+ {utc_notification_create_1_p, POSITIVE_TC_IDX},
+ {utc_notification_create_2_p, POSITIVE_TC_IDX},
+ {utc_notification_set_image_n, NEGATIVE_TC_IDX},
+ {utc_notification_set_image_p, POSITIVE_TC_IDX},
+ {utc_notification_get_image_n, NEGATIVE_TC_IDX},
+ {utc_notification_get_image_p, POSITIVE_TC_IDX},
+ {utc_notification_set_time_n, NEGATIVE_TC_IDX},
+ {utc_notification_set_time_p, POSITIVE_TC_IDX},
+ {utc_notification_get_time_n, NEGATIVE_TC_IDX},
+ {utc_notification_get_time_p, POSITIVE_TC_IDX},
+ {utc_notification_get_insert_time_n, NEGATIVE_TC_IDX},
+ {utc_notification_get_insert_time_p, POSITIVE_TC_IDX},
+ {utc_notification_set_text_n, NEGATIVE_TC_IDX},
+ {utc_notification_set_text_p, POSITIVE_TC_IDX},
+ {utc_notification_get_text_n, NEGATIVE_TC_IDX},
+ {utc_notification_get_text_p, POSITIVE_TC_IDX},
+ {utc_notification_set_text_domain_n, NEGATIVE_TC_IDX},
+ {utc_notification_set_text_domain_p, POSITIVE_TC_IDX},
+ {utc_notification_get_text_domain_n, NEGATIVE_TC_IDX},
+ {utc_notification_get_text_domain_p, POSITIVE_TC_IDX},
+ {utc_notification_set_time_to_text_n, NEGATIVE_TC_IDX},
+ {utc_notification_set_time_to_text_p, POSITIVE_TC_IDX},
+ {utc_notification_get_time_from_text_n, NEGATIVE_TC_IDX},
+ {utc_notification_get_time_from_text_p, POSITIVE_TC_IDX},
+ {utc_notification_set_sound_n, NEGATIVE_TC_IDX},
+ {utc_notification_set_sound_p, POSITIVE_TC_IDX},
+ {utc_notification_get_sound_n, NEGATIVE_TC_IDX},
+ {utc_notification_get_sound_p, POSITIVE_TC_IDX},
+ {utc_notification_set_vibration_n, NEGATIVE_TC_IDX},
+ {utc_notification_set_vibration_p, POSITIVE_TC_IDX},
+ {utc_notification_get_vibration_n, NEGATIVE_TC_IDX},
+ {utc_notification_get_vibration_p, POSITIVE_TC_IDX},
+ {utc_notification_set_led_n, NEGATIVE_TC_IDX},
+ {utc_notification_set_led_p, POSITIVE_TC_IDX},
+ {utc_notification_get_led_n, NEGATIVE_TC_IDX},
+ {utc_notification_get_led_p, POSITIVE_TC_IDX},
+ {utc_notification_set_led_time_period_n, NEGATIVE_TC_IDX},
+ {utc_notification_set_led_time_period_p, POSITIVE_TC_IDX},
+ {utc_notification_get_led_time_period_n, NEGATIVE_TC_IDX},
+ {utc_notification_get_led_time_period_p, POSITIVE_TC_IDX},
+ {utc_notification_set_application_n, NEGATIVE_TC_IDX},
+ {utc_notification_set_application_p, POSITIVE_TC_IDX},
+ {utc_notification_get_application_n, NEGATIVE_TC_IDX},
+ {utc_notification_get_application_p, POSITIVE_TC_IDX},
+ {utc_notification_set_launch_option_n, NEGATIVE_TC_IDX},
+ {utc_notification_set_launch_option_p, POSITIVE_TC_IDX},
+ {utc_notification_get_launch_option_n, NEGATIVE_TC_IDX},
+ {utc_notification_get_launch_option_p, POSITIVE_TC_IDX},
+ {utc_notification_set_execute_option_n, NEGATIVE_TC_IDX},
+ {utc_notification_set_execute_option_p, POSITIVE_TC_IDX},
+ {utc_notification_get_execute_option_n, NEGATIVE_TC_IDX},
+ {utc_notification_get_execute_option_p, POSITIVE_TC_IDX},
+ {utc_notification_set_property_n, NEGATIVE_TC_IDX},
+ {utc_notification_set_property_p, POSITIVE_TC_IDX},
+ {utc_notification_get_property_n, NEGATIVE_TC_IDX},
+ {utc_notification_get_property_p, POSITIVE_TC_IDX},
+ {utc_notification_set_display_applist_n, NEGATIVE_TC_IDX},
+ {utc_notification_set_display_applist_p, POSITIVE_TC_IDX},
+ {utc_notification_get_display_applist_n, NEGATIVE_TC_IDX},
+ {utc_notification_get_display_applist_p, POSITIVE_TC_IDX},
+ {utc_notification_set_size_n, NEGATIVE_TC_IDX},
+ {utc_notification_set_size_p, POSITIVE_TC_IDX},
+ {utc_notification_get_size_n, NEGATIVE_TC_IDX},
+ {utc_notification_get_size_p, POSITIVE_TC_IDX},
+ {utc_notification_set_progress_n, NEGATIVE_TC_IDX},
+ {utc_notification_set_progress_p, POSITIVE_TC_IDX},
+ {utc_notification_get_progress_n, NEGATIVE_TC_IDX},
+ {utc_notification_get_progress_p, POSITIVE_TC_IDX},
+ {utc_notification_set_pkgname_n, NEGATIVE_TC_IDX},
+ {utc_notification_set_pkgname_p, POSITIVE_TC_IDX},
+ {utc_notification_get_pkgname_n, NEGATIVE_TC_IDX},
+ {utc_notification_get_pkgname_p, POSITIVE_TC_IDX},
+ {utc_notification_set_layout_n, NEGATIVE_TC_IDX},
+ {utc_notification_set_layout_p, POSITIVE_TC_IDX},
+ {utc_notification_get_layout_n, NEGATIVE_TC_IDX},
+ {utc_notification_get_layout_p, POSITIVE_TC_IDX},
+ {utc_notification_get_id_n, NEGATIVE_TC_IDX},
+ {utc_notification_get_id_p, POSITIVE_TC_IDX},
+ {utc_notification_get_type_n, NEGATIVE_TC_IDX},
+ {utc_notification_get_type_p, POSITIVE_TC_IDX},
+ {utc_notification_insert_n, NEGATIVE_TC_IDX},
+ {utc_notification_insert_p, POSITIVE_TC_IDX},
+ {utc_notification_clear_n, NEGATIVE_TC_IDX},
+ {utc_notification_clear_p, POSITIVE_TC_IDX},
+ {utc_notification_update_n, NEGATIVE_TC_IDX},
+ {utc_notification_update_p, POSITIVE_TC_IDX},
+ {utc_notification_delete_all_by_type_n, NEGATIVE_TC_IDX},
+ {utc_notification_delete_all_by_type_p, POSITIVE_TC_IDX},
+ {utc_notification_delete_by_priv_id_n, NEGATIVE_TC_IDX},
+ {utc_notification_delete_by_priv_id_p, POSITIVE_TC_IDX},
+ {utc_notification_delete_n, NEGATIVE_TC_IDX},
+ {utc_notification_delete_p, POSITIVE_TC_IDX},
+ {utc_notification_update_progress_n, NEGATIVE_TC_IDX},
+ {utc_notification_update_progress_p, POSITIVE_TC_IDX},
+ {utc_notification_update_size_n, NEGATIVE_TC_IDX},
+ {utc_notification_update_size_p, POSITIVE_TC_IDX},
+ {utc_notification_update_content_n, NEGATIVE_TC_IDX},
+ {utc_notification_update_content_p, POSITIVE_TC_IDX},
+ {utc_notification_new_1_n, NEGATIVE_TC_IDX},
+ {utc_notification_new_2_n, NEGATIVE_TC_IDX},
+ {utc_notification_new_1_p, POSITIVE_TC_IDX},
+ {utc_notification_new_2_p, POSITIVE_TC_IDX},
+ {utc_notification_load_n, NEGATIVE_TC_IDX},
+ {utc_notification_load_p, POSITIVE_TC_IDX},
+ {utc_notification_clone_n, NEGATIVE_TC_IDX},
+ {utc_notification_clone_p, POSITIVE_TC_IDX},
+ {utc_notification_free_n, NEGATIVE_TC_IDX},
+ {utc_notification_free_p, POSITIVE_TC_IDX},
+ {utc_notification_resister_changed_cb_n, NEGATIVE_TC_IDX},
+ {utc_notification_resister_changed_cb_p, POSITIVE_TC_IDX},
+ {utc_notification_unresister_changed_cb_n, NEGATIVE_TC_IDX},
+ {utc_notification_unresister_changed_cb_p, POSITIVE_TC_IDX},
+ {utc_notification_register_detailed_changed_cb_n, NEGATIVE_TC_IDX},
+ {utc_notification_register_detailed_changed_cb_p, POSITIVE_TC_IDX},
+ {utc_notification_unregister_detailed_changed_cb_n, NEGATIVE_TC_IDX},
+ {utc_notification_unregister_detailed_changed_cb_p, POSITIVE_TC_IDX},
+ {utc_notification_get_count_n, NEGATIVE_TC_IDX},
+ {utc_notification_get_count_p, POSITIVE_TC_IDX},
+ {utc_notification_get_list_n, NEGATIVE_TC_IDX},
+ {utc_notification_get_list_p, POSITIVE_TC_IDX},
+ {utc_notification_get_grouping_list_n, NEGATIVE_TC_IDX},
+ {utc_notification_get_grouping_list_p, POSITIVE_TC_IDX},
+ {utc_notification_get_detail_list_n, NEGATIVE_TC_IDX},
+ {utc_notification_get_detail_list_p, POSITIVE_TC_IDX},
+ {utc_notification_free_list_n, NEGATIVE_TC_IDX},
+ {utc_notification_free_list_p, POSITIVE_TC_IDX},
+ {utc_notification_op_get_data_n, NEGATIVE_TC_IDX},
+ {utc_notification_op_get_data_p, POSITIVE_TC_IDX},
+ {utc_notification_is_service_ready_p, POSITIVE_TC_IDX},
+ {utc_notification_add_deferred_task_n, NEGATIVE_TC_IDX},
+ {utc_notification_add_deferred_task_p, POSITIVE_TC_IDX},
+ {utc_notification_del_deferred_task_n, NEGATIVE_TC_IDX},
+ {utc_notification_del_deferred_task_p, POSITIVE_TC_IDX},
+ { NULL, 0 },
+};
+
+static void startup(void)
+{
+ /* start of TC */
+ notification_clear(NOTIFICATION_TYPE_NONE);
+ tet_printf("\n TC start");
+}
+
+
+static void cleanup(void)
+{
+ /* end of TC */
+ tet_printf("\n TC end");
+}
+
+static void _changed_cb(void *data, notification_type_e type)
+{
+}
+
+static void _detailed_changed_cb(void *data, notification_type_e type, notification_op *op_list, int num_op)
+{
+}
+
+static void _deffered_job_cb(void *data)
+{
+}
+
+/**
+ * @brief Negative test case of notification_create()
+ */
+static void utc_notification_create_1_n(void)
+{
+ notification_h notification = NULL;
+ /*Invalid parameter test*/
+ notification = notification_create(NOTIFICATION_TYPE_NONE);
+ dts_check_eq("notification_create", notification, NULL,
+ "Must return NULL in case of invalid parameter");
+}
+
+/**
+ * @brief Negative test case of notification_create()
+ */
+static void utc_notification_create_2_n(void)
+{
+ notification_h notification = NULL;
+ /*Invalid parameter test*/
+ notification = notification_create(NOTIFICATION_TYPE_MAX);
+ dts_check_eq("notification_create", notification, NULL,
+ "Must return NULL in case of invalid parameter");
+}
+
+/**
+ * @brief Positive test case of notification_create()
+ */
+static void utc_notification_create_1_p(void)
+{
+ notification_h notification = NULL;
+
+ /*Invalid parameter test*/
+ notification = notification_create(NOTIFICATION_TYPE_NOTI);
+ dts_check_ne("notification_create", notification, NULL,
+ "Must return NOTIFICATION_ERROR_INVALID_DATA in case of invalid parameter");
+}
+
+/**
+ * @brief Positive test case of notification_create()
+ */
+static void utc_notification_create_2_p(void)
+{
+ notification_h notification = NULL;
+
+ /*Invalid parameter test*/
+ notification = notification_create(NOTIFICATION_TYPE_ONGOING);
+ dts_check_ne("notification_create", notification, NULL,
+ "Must return NOTIFICATION_ERROR_INVALID_DATA in case of invalid parameter");
+}
+
+/**
+ * @brief Negative test case of notification_set_image()
+ */
+static void utc_notification_set_image_n(void)
+{
+ int ret = 0;
+
+ ret = notification_set_image(NULL, NOTIFICATION_IMAGE_TYPE_ICON, NULL);
+
+ dts_check_eq("notification_set_image", ret, NOTIFICATION_ERROR_INVALID_DATA,
+ "Must return NOTIFICATION_ERROR_INVALID_DATA in case of invalid parameter");
+}
+
+/**
+ * @brief Positive test case of notification_set_image()
+ */
+static void utc_notification_set_image_p(void)
+{
+ int ret = 0;
+ notification_h notification = NULL;
+
+ /*Invalid parameter test*/
+ notification = notification_create(NOTIFICATION_TYPE_NOTI);
+ ret = notification_set_image(notification, NOTIFICATION_IMAGE_TYPE_ICON, "test.png");
+
+ dts_check_eq("notification_set_image", ret, NOTIFICATION_ERROR_NONE,
+ "Must return NOTIFICATION_ERROR_NONE in case of valid parameter");
+}
+
+/**
+ * @brief Negative test case of notification_get_image()
+ */
+static void utc_notification_get_image_n(void)
+{
+ int ret = 0;
+
+ ret = notification_get_image(NULL, NOTIFICATION_IMAGE_TYPE_ICON, NULL);
+
+ dts_check_eq("notification_get_image", ret, NOTIFICATION_ERROR_INVALID_DATA,
+ "Must return NOTIFICATION_ERROR_INVALID_DATA in case of invalid parameter");
+}
+
+/**
+ * @brief Positive test case of notification_get_image()
+ */
+static void utc_notification_get_image_p(void)
+{
+ int ret = 0;
+ notification_h notification = NULL;
+ char *image = NULL;
+
+ /*Invalid parameter test*/
+ notification = notification_create(NOTIFICATION_TYPE_NOTI);
+ ret = notification_get_image(notification, NOTIFICATION_IMAGE_TYPE_ICON, &image);
+
+ dts_check_eq("notification_get_image", ret, NOTIFICATION_ERROR_NONE,
+ "Must return NOTIFICATION_ERROR_NONE in case of valid parameter");
+}
+
+/**
+ * @brief Negative test case of notification_set_time()
+ */
+static void utc_notification_set_time_n(void)
+{
+ int ret = 0;
+
+ ret = notification_set_time(NULL, 0);
+
+ dts_check_eq("notification_set_time", ret, NOTIFICATION_ERROR_INVALID_DATA,
+ "Must return NOTIFICATION_ERROR_INVALID_DATA in case of invalid parameter");
+}
+
+/**
+ * @brief Positive test case of notification_set_time()
+ */
+static void utc_notification_set_time_p(void)
+{
+ int ret = 0;
+ notification_h notification = NULL;
+
+ /*Invalid parameter test*/
+ notification = notification_create(NOTIFICATION_TYPE_NOTI);
+ ret = notification_set_time(notification, 0xFFFFFFF);
+
+ dts_check_eq("notification_set_time", ret, NOTIFICATION_ERROR_NONE,
+ "Must return NOTIFICATION_ERROR_NONE in case of valid parameter");
+}
+
+/**
+ * @brief Negative test case of notification_get_time()
+ */
+static void utc_notification_get_time_n(void)
+{
+ int ret = 0;
+
+ ret = notification_get_time(NULL, NULL);
+
+ dts_check_eq("notification_get_time", ret, NOTIFICATION_ERROR_INVALID_DATA,
+ "Must return NOTIFICATION_ERROR_INVALID_DATA in case of invalid parameter");
+}
+
+/**
+ * @brief Positive test case of notification_get_time()
+ */
+static void utc_notification_get_time_p(void)
+{
+ int ret = 0;
+ notification_h notification = NULL;
+ time_t t = 0;
+
+ /*Invalid parameter test*/
+ notification = notification_create(NOTIFICATION_TYPE_NOTI);
+ ret = notification_get_time(notification, &t);
+
+ dts_check_eq("notification_get_time", ret, NOTIFICATION_ERROR_NONE,
+ "Must return NOTIFICATION_ERROR_NONE in case of valid parameter");
+}
+
+/**
+ * @brief Negative test case of notification_get_insert_time()
+ */
+static void utc_notification_get_insert_time_n(void)
+{
+ int ret = 0;
+
+ ret = notification_get_insert_time(NULL, NULL);
+
+ dts_check_eq("notification_get_insert_time", ret, NOTIFICATION_ERROR_INVALID_DATA,
+ "Must return NOTIFICATION_ERROR_INVALID_DATA in case of invalid parameter");
+}
+
+/**
+ * @brief Positive test case of notification_get_insert_time()
+ */
+static void utc_notification_get_insert_time_p(void)
+{
+ int ret = 0;
+ notification_h notification = NULL;
+ time_t t = 0;
+
+ /*Invalid parameter test*/
+ notification = notification_create(NOTIFICATION_TYPE_NOTI);
+ ret = notification_get_insert_time(notification, &t);
+
+ dts_check_eq("notification_get_insert_time", ret, NOTIFICATION_ERROR_NONE,
+ "Must return NOTIFICATION_ERROR_NONE in case of valid parameter");
+}
+
+/**
+ * @brief Negative test case of notification_set_text()
+ */
+static void utc_notification_set_text_n(void)
+{
+ int ret = 0;
+
+ ret = notification_set_text(NULL, NOTIFICATION_TEXT_TYPE_NONE, NULL, NULL, NOTIFICATION_VARIABLE_TYPE_NONE);
+
+ dts_check_eq("notification_set_text", ret, NOTIFICATION_ERROR_INVALID_DATA,
+ "Must return NOTIFICATION_ERROR_INVALID_DATA in case of invalid parameter");
+}
+
+/**
+ * @brief Positive test case of notification_set_text()
+ */
+static void utc_notification_set_text_p(void)
+{
+ int ret = 0;
+ notification_h notification = NULL;
+
+ /*Invalid parameter test*/
+ notification = notification_create(NOTIFICATION_TYPE_NOTI);
+ ret = notification_set_text(notification, NOTIFICATION_TEXT_TYPE_TITLE, "test", NULL, NOTIFICATION_VARIABLE_TYPE_NONE);
+
+ dts_check_eq("notification_set_text", ret, NOTIFICATION_ERROR_NONE,
+ "Must return NOTIFICATION_ERROR_NONE in case of valid parameter");
+}
+
+/**
+ * @brief Negative test case of notification_get_text()
+ */
+static void utc_notification_get_text_n(void)
+{
+ int ret = 0;
+
+ ret = notification_get_text(NULL, NOTIFICATION_TEXT_TYPE_TITLE, NULL);
+
+ dts_check_eq("notification_get_text", ret, NOTIFICATION_ERROR_INVALID_DATA,
+ "Must return NOTIFICATION_ERROR_INVALID_DATA in case of invalid parameter");
+}
+
+/**
+ * @brief Positive test case of notification_get_text()
+ */
+static void utc_notification_get_text_p(void)
+{
+ int ret = 0;
+ notification_h notification = NULL;
+ char *value = NULL;
+
+ /*Invalid parameter test*/
+ notification = notification_create(NOTIFICATION_TYPE_NOTI);
+ ret = notification_get_text(notification, NOTIFICATION_TEXT_TYPE_TITLE, &value);
+
+ dts_check_eq("notification_get_text", ret, NOTIFICATION_ERROR_NONE,
+ "Must return NOTIFICATION_ERROR_NONE in case of valid parameter");
+}
+
+/**
+ * @brief Negative test case of notification_set_text_domain()
+ */
+static void utc_notification_set_text_domain_n(void)
+{
+ int ret = 0;
+
+ ret = notification_set_text_domain(NULL, NULL, NULL);
+
+ dts_check_eq("notification_set_text_domain", ret, NOTIFICATION_ERROR_INVALID_DATA,
+ "Must return NOTIFICATION_ERROR_INVALID_DATA in case of invalid parameter");
+}
+
+/**
+ * @brief Positive test case of notification_set_text_domain()
+ */
+static void utc_notification_set_text_domain_p(void)
+{
+ int ret = 0;
+ notification_h notification = NULL;
+
+ /*Invalid parameter test*/
+ notification = notification_create(NOTIFICATION_TYPE_NOTI);
+ ret = notification_set_text_domain(notification, "domain", "domain.po");
+
+ dts_check_eq("notification_set_text_domain", ret, NOTIFICATION_ERROR_NONE,
+ "Must return NOTIFICATION_ERROR_NONE in case of valid parameter");
+}
+
+/**
+ * @brief Negative test case of notification_get_text_domain()
+ */
+static void utc_notification_get_text_domain_n(void)
+{
+ int ret = 0;
+
+ ret = notification_get_text_domain(NULL, NULL, NULL);
+
+ dts_check_eq("notification_get_text_domain", ret, NOTIFICATION_ERROR_INVALID_DATA,
+ "Must return NOTIFICATION_ERROR_INVALID_DATA in case of invalid parameter");
+}
+
+/**
+ * @brief Positive test case of notification_get_text_domain()
+ */
+static void utc_notification_get_text_domain_p(void)
+{
+ int ret = 0;
+ notification_h notification = NULL;
+ char *value1 = NULL;
+ char *value2 = NULL;
+
+ /*Invalid parameter test*/
+ notification = notification_create(NOTIFICATION_TYPE_NOTI);
+ ret = notification_get_text_domain(notification, &value1, &value2);
+
+ dts_check_eq("notification_get_text_domain", ret, NOTIFICATION_ERROR_NONE,
+ "Must return NOTIFICATION_ERROR_NONE in case of valid parameter");
+}
+
+/**
+ * @brief Negative test case of notification_set_time_to_text()
+ */
+static void utc_notification_set_time_to_text_n(void)
+{
+ int ret = 0;
+
+ ret = notification_set_time_to_text(NULL, NOTIFICATION_TEXT_TYPE_NONE, 0);
+
+ dts_check_eq("notification_set_time_to_text", ret, NOTIFICATION_ERROR_INVALID_DATA,
+ "Must return NOTIFICATION_ERROR_INVALID_DATA in case of invalid parameter");
+}
+
+/**
+ * @brief Positive test case of notification_set_time_to_text()
+ */
+static void utc_notification_set_time_to_text_p(void)
+{
+ int ret = 0;
+ notification_h notification = NULL;
+
+ /*Invalid parameter test*/
+ notification = notification_create(NOTIFICATION_TYPE_NOTI);
+ ret = notification_set_time_to_text(notification, NOTIFICATION_TEXT_TYPE_TITLE, time(NULL));
+
+ dts_check_eq("notification_set_time_to_text", ret, NOTIFICATION_ERROR_NONE,
+ "Must return NOTIFICATION_ERROR_NONE in case of valid parameter");
+}
+
+/**
+ * @brief Negative test case of notification_get_time_from_text()
+ */
+static void utc_notification_get_time_from_text_n(void)
+{
+ int ret = 0;
+
+ ret = notification_get_time_from_text(NULL, NOTIFICATION_TEXT_TYPE_TITLE, NULL);
+
+ dts_check_eq("notification_get_time_from_text", ret, NOTIFICATION_ERROR_INVALID_DATA,
+ "Must return NOTIFICATION_ERROR_INVALID_DATA in case of invalid parameter");
+}
+
+/**
+ * @brief Positive test case of notification_get_time_from_text()
+ */
+static void utc_notification_get_time_from_text_p(void)
+{
+ int ret = 0;
+ notification_h notification = NULL;
+ time_t t = 0;
+
+ /*Invalid parameter test*/
+ notification = notification_create(NOTIFICATION_TYPE_NOTI);
+ notification_set_time_to_text(notification, NOTIFICATION_TEXT_TYPE_TITLE, time(NULL));
+ ret = notification_get_time_from_text(notification, NOTIFICATION_TEXT_TYPE_TITLE, &t);
+
+ dts_check_eq("notification_get_time_from_text", ret, NOTIFICATION_ERROR_NONE,
+ "Must return NOTIFICATION_ERROR_NONE in case of valid parameter");
+}
+
+/**
+ * @brief Negative test case of notification_set_sound()
+ */
+static void utc_notification_set_sound_n(void)
+{
+ int ret = 0;
+
+ ret = notification_set_sound(NULL, NOTIFICATION_SOUND_TYPE_MAX, NULL);
+
+ dts_check_eq("notification_set_sound", ret, NOTIFICATION_ERROR_INVALID_DATA,
+ "Must return NOTIFICATION_ERROR_INVALID_DATA in case of invalid parameter");
+}
+
+/**
+ * @brief Positive test case of notification_set_sound()
+ */
+static void utc_notification_set_sound_p(void)
+{
+ int ret = 0;
+ notification_h notification = NULL;
+
+ /*Invalid parameter test*/
+ notification = notification_create(NOTIFICATION_TYPE_NOTI);
+ ret = notification_set_sound(notification, NOTIFICATION_SOUND_TYPE_DEFAULT, "path");
+
+ dts_check_eq("notification_set_sound", ret, NOTIFICATION_ERROR_NONE,
+ "Must return NOTIFICATION_ERROR_NONE in case of valid parameter");
+}
+
+/**
+ * @brief Negative test case of notification_get_sound()
+ */
+static void utc_notification_get_sound_n(void)
+{
+ int ret = 0;
+
+ ret = notification_get_sound(NULL, NULL, NULL);
+
+ dts_check_eq("notification_get_sound", ret, NOTIFICATION_ERROR_INVALID_DATA,
+ "Must return NOTIFICATION_ERROR_INVALID_DATA in case of invalid parameter");
+}
+
+/**
+ * @brief Positive test case of notification_get_sound()
+ */
+static void utc_notification_get_sound_p(void)
+{
+ int ret = 0;
+ notification_h notification = NULL;
+ notification_sound_type_e type;
+ const char *value = NULL;
+
+ /*Invalid parameter test*/
+ notification = notification_create(NOTIFICATION_TYPE_NOTI);
+ ret = notification_get_sound(notification, &type, &value);
+
+ dts_check_eq("notification_get_sound", ret, NOTIFICATION_ERROR_NONE,
+ "Must return NOTIFICATION_ERROR_NONE in case of valid parameter");
+}
+
+/**
+ * @brief Negative test case of notification_set_vibration()
+ */
+static void utc_notification_set_vibration_n(void)
+{
+ int ret = 0;
+
+ ret = notification_set_vibration(NULL, NOTIFICATION_VIBRATION_TYPE_MAX, NULL);
+
+ dts_check_eq("notification_set_vibration", ret, NOTIFICATION_ERROR_INVALID_DATA,
+ "Must return NOTIFICATION_ERROR_INVALID_DATA in case of invalid parameter");
+}
+
+/**
+ * @brief Positive test case of notification_set_vibration()
+ */
+static void utc_notification_set_vibration_p(void)
+{
+ int ret = 0;
+ notification_h notification = NULL;
+
+ /*Invalid parameter test*/
+ notification = notification_create(NOTIFICATION_TYPE_NOTI);
+ ret = notification_set_vibration(notification, NOTIFICATION_VIBRATION_TYPE_DEFAULT, "path");
+
+ dts_check_eq("notification_set_vibration", ret, NOTIFICATION_ERROR_NONE,
+ "Must return NOTIFICATION_ERROR_NONE in case of valid parameter");
+}
+
+/**
+ * @brief Negative test case of notification_get_vibration()
+ */
+static void utc_notification_get_vibration_n(void)
+{
+ int ret = 0;
+
+ ret = notification_get_vibration(NULL, NULL, NULL);
+
+ dts_check_eq("notification_get_vibration", ret, NOTIFICATION_ERROR_INVALID_DATA,
+ "Must return NOTIFICATION_ERROR_INVALID_DATA in case of invalid parameter");
+}
+
+/**
+ * @brief Positive test case of notification_get_vibration()
+ */
+static void utc_notification_get_vibration_p(void)
+{
+ int ret = 0;
+ notification_h notification = NULL;
+ notification_vibration_type_e type;
+ const char *value = NULL;
+
+ /*Invalid parameter test*/
+ notification = notification_create(NOTIFICATION_TYPE_NOTI);
+ ret = notification_get_vibration(notification, &type, &value);
+
+ dts_check_eq("notification_get_vibration", ret, NOTIFICATION_ERROR_NONE,
+ "Must return NOTIFICATION_ERROR_NONE in case of valid parameter");
+}
+
+/**
+ * @brief Negative test case of notification_set_led()
+ */
+static void utc_notification_set_led_n(void)
+{
+ int ret = 0;
+
+ ret = notification_set_led(NULL, NOTIFICATION_LED_OP_MAX, 0);
+
+ dts_check_eq("notification_set_led", ret, NOTIFICATION_ERROR_INVALID_DATA,
+ "Must return NOTIFICATION_ERROR_INVALID_DATA in case of invalid parameter");
+}
+
+/**
+ * @brief Positive test case of notification_set_led()
+ */
+static void utc_notification_set_led_p(void)
+{
+ int ret = 0;
+ notification_h notification = NULL;
+
+ /*Invalid parameter test*/
+ notification = notification_create(NOTIFICATION_TYPE_NOTI);
+ ret = notification_set_led(notification, NOTIFICATION_LED_OP_ON, 0);
+
+ dts_check_eq("notification_set_led", ret, NOTIFICATION_ERROR_NONE,
+ "Must return NOTIFICATION_ERROR_NONE in case of valid parameter");
+}
+
+/**
+ * @brief Negative test case of notification_get_led()
+ */
+static void utc_notification_get_led_n(void)
+{
+ int ret = 0;
+
+ ret = notification_get_led(NULL, NULL, NULL);
+
+ dts_check_eq("notification_get_led", ret, NOTIFICATION_ERROR_INVALID_DATA,
+ "Must return NOTIFICATION_ERROR_INVALID_DATA in case of invalid parameter");
+}
+
+/**
+ * @brief Positive test case of notification_get_led()
+ */
+static void utc_notification_get_led_p(void)
+{
+ int ret = 0;
+ notification_h notification = NULL;
+ notification_led_op_e type;
+ int value = 0;
+
+ /*Invalid parameter test*/
+ notification = notification_create(NOTIFICATION_TYPE_NOTI);
+ ret = notification_get_led(notification, &type, &value);
+
+ dts_check_eq("notification_get_led", ret, NOTIFICATION_ERROR_NONE,
+ "Must return NOTIFICATION_ERROR_NONE in case of valid parameter");
+}
+
+/**
+ * @brief Negative test case of notification_set_led_time_period()
+ */
+static void utc_notification_set_led_time_period_n(void)
+{
+ int ret = 0;
+
+ ret = notification_set_led_time_period(NULL, 0, 0);
+
+ dts_check_eq("notification_set_led_time_period", ret, NOTIFICATION_ERROR_INVALID_DATA,
+ "Must return NOTIFICATION_ERROR_INVALID_DATA in case of invalid parameter");
+}
+
+/**
+ * @brief Positive test case of notification_set_led_time_period()
+ */
+static void utc_notification_set_led_time_period_p(void)
+{
+ int ret = 0;
+ notification_h notification = NULL;
+
+ /*Invalid parameter test*/
+ notification = notification_create(NOTIFICATION_TYPE_NOTI);
+ ret = notification_set_led_time_period(notification, 10, 10);
+
+ dts_check_eq("notification_set_led_time_period", ret, NOTIFICATION_ERROR_NONE,
+ "Must return NOTIFICATION_ERROR_NONE in case of valid parameter");
+}
+
+/**
+ * @brief Negative test case of notification_get_led_time_period()
+ */
+static void utc_notification_get_led_time_period_n(void)
+{
+ int ret = 0;
+
+ ret = notification_get_led_time_period(NULL, NULL, NULL);
+
+ dts_check_eq("notification_get_led_time_period", ret, NOTIFICATION_ERROR_INVALID_DATA,
+ "Must return NOTIFICATION_ERROR_INVALID_DATA in case of invalid parameter");
+}
+
+/**
+ * @brief Positive test case of notification_get_led_time_period()
+ */
+static void utc_notification_get_led_time_period_p(void)
+{
+ int ret = 0;
+ notification_h notification = NULL;
+ int value1 = 0;
+ int value2 = 0;
+
+ /*Invalid parameter test*/
+ notification = notification_create(NOTIFICATION_TYPE_NOTI);
+ ret = notification_get_led_time_period(notification, &value1, &value2);
+
+ dts_check_eq("notification_get_led_time_period", ret, NOTIFICATION_ERROR_NONE,
+ "Must return NOTIFICATION_ERROR_NONE in case of valid parameter");
+}
+
+/**
+ * @brief Negative test case of notification_set_application()
+ */
+static void utc_notification_set_application_n(void)
+{
+ int ret = 0;
+
+ ret = notification_set_application(NULL, NULL);
+
+ dts_check_eq("notification_set_application", ret, NOTIFICATION_ERROR_INVALID_DATA,
+ "Must return NOTIFICATION_ERROR_INVALID_DATA in case of invalid parameter");
+}
+
+/**
+ * @brief Positive test case of notification_set_application()
+ */
+static void utc_notification_set_application_p(void)
+{
+ int ret = 0;
+ notification_h notification = NULL;
+
+ /*Invalid parameter test*/
+ notification = notification_create(NOTIFICATION_TYPE_NOTI);
+ ret = notification_set_application(notification, "org.tizen.quickpanel");
+
+ dts_check_eq("notification_set_application", ret, NOTIFICATION_ERROR_NONE,
+ "Must return NOTIFICATION_ERROR_NONE in case of valid parameter");
+}
+
+/**
+ * @brief Negative test case of notification_get_application()
+ */
+static void utc_notification_get_application_n(void)
+{
+ int ret = 0;
+
+ ret = notification_get_application(NULL, NULL);
+
+ dts_check_eq("notification_get_application", ret, NOTIFICATION_ERROR_INVALID_DATA,
+ "Must return NOTIFICATION_ERROR_INVALID_DATA in case of invalid parameter");
+}
+
+/**
+ * @brief Positive test case of notification_get_application()
+ */
+static void utc_notification_get_application_p(void)
+{
+ int ret = 0;
+ notification_h notification = NULL;
+ char *value = NULL;
+
+ /*Invalid parameter test*/
+ notification = notification_create(NOTIFICATION_TYPE_NOTI);
+ ret = notification_get_application(notification, &value);
+
+ dts_check_eq("notification_get_application", ret, NOTIFICATION_ERROR_NONE,
+ "Must return NOTIFICATION_ERROR_NONE in case of valid parameter");
+}
+
+/**
+ * @brief Negative test case of notification_set_launch()
+ */
+static void utc_notification_set_launch_option_n(void)
+{
+ int ret = 0;
+
+ ret = notification_set_launch_option(NULL, NOTIFICATION_LAUNCH_OPTION_APP_CONTROL, NULL);
+
+ dts_check_eq("notification_set_launch_option", ret, NOTIFICATION_ERROR_INVALID_DATA,
+ "Must return NOTIFICATION_ERROR_INVALID_DATA in case of invalid parameter");
+}
+
+/**
+ * @brief Positive test case of notification_set_launch_option()
+ */
+static void utc_notification_set_launch_option_p(void)
+{
+ int ret = 0;
+ notification_h notification = NULL;
+ app_control_h app_control = NULL;
+ bundle *b = NULL;
+
+ app_control_create(&app_control);
+ app_control_set_app_id(app_control, "org.tizen.app");
+ /*Invalid parameter test*/
+ notification = notification_create(NOTIFICATION_TYPE_NOTI);
+ ret = notification_set_launch_option(notification, NOTIFICATION_LAUNCH_OPTION_APP_CONTROL, app_control);
+ app_control_destroy(app_control);
+
+ dts_check_eq("notification_set_launch_option", ret, NOTIFICATION_ERROR_NONE,
+ "Must return NOTIFICATION_ERROR_NONE in case of valid parameter");
+}
+
+/**
+ * @brief Negative test case of notification_get_launch_option()
+ */
+static void utc_notification_get_launch_option_n(void)
+{
+ int ret = 0;
+ app_control_h app_control = NULL;
+
+ ret = notification_get_launch_option(NULL, NOTIFICATION_LAUNCH_OPTION_APP_CONTROL, NULL);
+
+ dts_check_eq("notification_get_launch_option", ret, NOTIFICATION_ERROR_INVALID_DATA,
+ "Must return NOTIFICATION_ERROR_INVALID_DATA in case of invalid parameter");
+}
+
+/**
+ * @brief Positive test case of notification_get_launch_option()
+ */
+static void utc_notification_get_launch_option_p(void)
+{
+ int ret = 0;
+ notification_h notification = NULL;
+ app_control_h app_control = NULL;
+
+ app_control_create(&app_control);
+ app_control_set_app_id(app_control, "org.tizen.app");
+ notification = notification_create(NOTIFICATION_TYPE_NOTI);
+ ret = notification_set_launch_option(notification, NOTIFICATION_LAUNCH_OPTION_APP_CONTROL, app_control);
+ app_control_destroy(app_control);
+ app_control = NULL;
+
+ ret = notification_get_launch_option(notification, NOTIFICATION_LAUNCH_OPTION_APP_CONTROL, &app_control);
+ notification_free(notification);
+
+ dts_check_eq("notification_get_launch_option", ret, NOTIFICATION_ERROR_NONE,
+ "Must return NOTIFICATION_ERROR_NONE in case of valid parameter");
+}
+
+/**
+ * @brief Negative test case of notification_set_execute_option()
+ */
+static void utc_notification_set_execute_option_n(void)
+{
+ int ret = 0;
+
+ ret = notification_set_execute_option(NULL, NOTIFICATION_EXECUTE_TYPE_NONE, NULL, NULL, NULL);
+
+ dts_check_eq("notification_set_execute_option", ret, NOTIFICATION_ERROR_INVALID_DATA,
+ "Must return NOTIFICATION_ERROR_INVALID_DATA in case of invalid parameter");
+}
+
+/**
+ * @brief Positive test case of notification_set_execute_option()
+ */
+static void utc_notification_set_execute_option_p(void)
+{
+ int ret = 0;
+ notification_h notification = NULL;
+ bundle *b = NULL;
+
+ b = bundle_create();
+ /*Invalid parameter test*/
+ notification = notification_create(NOTIFICATION_TYPE_NOTI);
+ ret = notification_set_execute_option(notification, NOTIFICATION_EXECUTE_TYPE_SINGLE_LAUNCH, NULL, NULL, b);
+
+ dts_check_eq("notification_set_execute_option", ret, NOTIFICATION_ERROR_NONE,
+ "Must return NOTIFICATION_ERROR_NONE in case of valid parameter");
+}
+
+/**
+ * @brief Negative test case of notification_get_execute_option()
+ */
+static void utc_notification_get_execute_option_n(void)
+{
+ int ret = 0;
+
+ ret = notification_get_execute_option(NULL, NOTIFICATION_EXECUTE_TYPE_NONE, NULL, NULL);
+
+ dts_check_eq("notification_get_execute_option", ret, NOTIFICATION_ERROR_INVALID_DATA,
+ "Must return NOTIFICATION_ERROR_INVALID_DATA in case of invalid parameter");
+}
+
+/**
+ * @brief Positive test case of notification_get_execute_option()
+ */
+static void utc_notification_get_execute_option_p(void)
+{
+ int ret = 0;
+ notification_h notification = NULL;
+ bundle *b = NULL;
+
+ /*Invalid parameter test*/
+ notification = notification_create(NOTIFICATION_TYPE_NOTI);
+ ret = notification_get_execute_option(notification, NOTIFICATION_EXECUTE_TYPE_SINGLE_LAUNCH, NULL, &b);
+
+ dts_check_eq("notification_get_execute_option", ret, NOTIFICATION_ERROR_NONE,
+ "Must return NOTIFICATION_ERROR_NONE in case of valid parameter");
+}
+
+/**
+ * @brief Negative test case of notification_set_property()
+ */
+static void utc_notification_set_property_n(void)
+{
+ int ret = 0;
+
+ ret = notification_set_property(NULL, 0);
+
+ dts_check_eq("notification_set_property", ret, NOTIFICATION_ERROR_INVALID_DATA,
+ "Must return NOTIFICATION_ERROR_INVALID_DATA in case of invalid parameter");
+}
+
+/**
+ * @brief Positive test case of notification_set_property()
+ */
+static void utc_notification_set_property_p(void)
+{
+ int ret = 0;
+ notification_h notification = NULL;
+
+ /*Invalid parameter test*/
+ notification = notification_create(NOTIFICATION_TYPE_NOTI);
+ ret = notification_set_property(notification, NOTIFICATION_PROP_DISABLE_AUTO_DELETE);
+
+ dts_check_eq("notification_set_property", ret, NOTIFICATION_ERROR_NONE,
+ "Must return NOTIFICATION_ERROR_NONE in case of valid parameter");
+}
+
+/**
+ * @brief Negative test case of notification_get_property()
+ */
+static void utc_notification_get_property_n(void)
+{
+ int ret = 0;
+
+ ret = notification_get_property(NULL, NULL);
+
+ dts_check_eq("notification_get_property", ret, NOTIFICATION_ERROR_INVALID_DATA,
+ "Must return NOTIFICATION_ERROR_INVALID_DATA in case of invalid parameter");
+}
+
+/**
+ * @brief Positive test case of notification_get_property()
+ */
+static void utc_notification_get_property_p(void)
+{
+ int ret = 0;
+ notification_h notification = NULL;
+ int value = 0;
+
+ /*Invalid parameter test*/
+ notification = notification_create(NOTIFICATION_TYPE_NOTI);
+ ret = notification_get_property(notification, &value);
+
+ dts_check_eq("notification_get_property", ret, NOTIFICATION_ERROR_NONE,
+ "Must return NOTIFICATION_ERROR_NONE in case of valid parameter");
+}
+
+/**
+ * @brief Negative test case of notification_set_display_applist()
+ */
+static void utc_notification_set_display_applist_n(void)
+{
+ int ret = 0;
+
+ ret = notification_set_display_applist(NULL, 0);
+
+ dts_check_eq("notification_set_display_applist", ret, NOTIFICATION_ERROR_INVALID_DATA,
+ "Must return NOTIFICATION_ERROR_INVALID_DATA in case of invalid parameter");
+}
+
+/**
+ * @brief Positive test case of notification_set_display_applist()
+ */
+static void utc_notification_set_display_applist_p(void)
+{
+ int ret = 0;
+ notification_h notification = NULL;
+
+ /*Invalid parameter test*/
+ notification = notification_create(NOTIFICATION_TYPE_NOTI);
+ ret = notification_set_display_applist(notification, NOTIFICATION_DISPLAY_APP_ALL);
+
+ dts_check_eq("notification_set_display_applist", ret, NOTIFICATION_ERROR_NONE,
+ "Must return NOTIFICATION_ERROR_NONE in case of valid parameter");
+}
+
+/**
+ * @brief Negative test case of notification_get_display_applist()
+ */
+static void utc_notification_get_display_applist_n(void)
+{
+ int ret = 0;
+
+ ret = notification_get_display_applist(NULL, NULL);
+
+ dts_check_eq("notification_get_display_applist", ret, NOTIFICATION_ERROR_INVALID_DATA,
+ "Must return NOTIFICATION_ERROR_INVALID_DATA in case of invalid parameter");
+}
+
+/**
+ * @brief Positive test case of notification_get_display_applist()
+ */
+static void utc_notification_get_display_applist_p(void)
+{
+ int ret = 0;
+ notification_h notification = NULL;
+ int value = 0;
+
+ /*Invalid parameter test*/
+ notification = notification_create(NOTIFICATION_TYPE_NOTI);
+ ret = notification_get_display_applist(notification, &value);
+
+ dts_check_eq("notification_get_display_applist", ret, NOTIFICATION_ERROR_NONE,
+ "Must return NOTIFICATION_ERROR_NONE in case of valid parameter");
+}
+
+/**
+ * @brief Negative test case of notification_set_size()
+ */
+static void utc_notification_set_size_n(void)
+{
+ int ret = 0;
+
+ ret = notification_set_size(NULL, 0.0);
+
+ dts_check_eq("notification_set_size", ret, NOTIFICATION_ERROR_INVALID_DATA,
+ "Must return NOTIFICATION_ERROR_INVALID_DATA in case of invalid parameter");
+}
+
+/**
+ * @brief Positive test case of notification_set_size()
+ */
+static void utc_notification_set_size_p(void)
+{
+ int ret = 0;
+ notification_h notification = NULL;
+
+ /*Invalid parameter test*/
+ notification = notification_create(NOTIFICATION_TYPE_NOTI);
+ ret = notification_set_size(notification, 0.5);
+
+ dts_check_eq("notification_set_size", ret, NOTIFICATION_ERROR_NONE,
+ "Must return NOTIFICATION_ERROR_NONE in case of valid parameter");
+}
+
+/**
+ * @brief Negative test case of notification_get_size()
+ */
+static void utc_notification_get_size_n(void)
+{
+ int ret = 0;
+
+ ret = notification_get_size(NULL, NULL);
+
+ dts_check_eq("notification_get_size", ret, NOTIFICATION_ERROR_INVALID_DATA,
+ "Must return NOTIFICATION_ERROR_INVALID_DATA in case of invalid parameter");
+}
+
+/**
+ * @brief Positive test case of notification_get_size()
+ */
+static void utc_notification_get_size_p(void)
+{
+ int ret = 0;
+ notification_h notification = NULL;
+ double value = 0.0;
+
+ /*Invalid parameter test*/
+ notification = notification_create(NOTIFICATION_TYPE_NOTI);
+ ret = notification_get_size(notification, &value);
+
+ dts_check_eq("notification_get_size", ret, NOTIFICATION_ERROR_NONE,
+ "Must return NOTIFICATION_ERROR_NONE in case of valid parameter");
+}
+
+/**
+ * @brief Negative test case of notification_set_progress()
+ */
+static void utc_notification_set_progress_n(void)
+{
+ int ret = 0;
+
+ ret = notification_set_progress(NULL, 0.0);
+
+ dts_check_eq("notification_set_progress", ret, NOTIFICATION_ERROR_INVALID_DATA,
+ "Must return NOTIFICATION_ERROR_INVALID_DATA in case of invalid parameter");
+}
+
+/**
+ * @brief Positive test case of notification_set_progress()
+ */
+static void utc_notification_set_progress_p(void)
+{
+ int ret = 0;
+ notification_h notification = NULL;
+
+ /*Invalid parameter test*/
+ notification = notification_create(NOTIFICATION_TYPE_NOTI);
+ ret = notification_set_progress(notification, 0.5);
+
+ dts_check_eq("notification_set_progress", ret, NOTIFICATION_ERROR_NONE,
+ "Must return NOTIFICATION_ERROR_NONE in case of valid parameter");
+}
+
+/**
+ * @brief Negative test case of notification_get_progress()
+ */
+static void utc_notification_get_progress_n(void)
+{
+ int ret = 0;
+
+ ret = notification_get_progress(NULL, NULL);
+
+ dts_check_eq("notification_get_progress", ret, NOTIFICATION_ERROR_INVALID_DATA,
+ "Must return NOTIFICATION_ERROR_INVALID_DATA in case of invalid parameter");
+}
+
+/**
+ * @brief Positive test case of notification_get_progress()
+ */
+static void utc_notification_get_progress_p(void)
+{
+ int ret = 0;
+ notification_h notification = NULL;
+ double value = 0.0;
+
+ /*Invalid parameter test*/
+ notification = notification_create(NOTIFICATION_TYPE_NOTI);
+ ret = notification_get_progress(notification, &value);
+
+ dts_check_eq("notification_get_progress", ret, NOTIFICATION_ERROR_NONE,
+ "Must return NOTIFICATION_ERROR_NONE in case of invalid parameter");
+}
+
+/**
+ * @brief Negative test case of notification_set_pkgname()
+ */
+static void utc_notification_set_pkgname_n(void)
+{
+ int ret = 0;
+
+ ret = notification_set_pkgname(NULL, NULL);
+
+ dts_check_eq("notification_set_pkgname", ret, NOTIFICATION_ERROR_INVALID_DATA,
+ "Must return NOTIFICATION_ERROR_INVALID_DATA in case of invalid parameter");
+}
+
+/**
+ * @brief Positive test case of notification_set_pkgname()
+ */
+static void utc_notification_set_pkgname_p(void)
+{
+ int ret = 0;
+ notification_h notification = NULL;
+
+ /*Invalid parameter test*/
+ notification = notification_create(NOTIFICATION_TYPE_NOTI);
+ ret = notification_set_pkgname(notification, "org.tizen.quickpanel");
+
+ dts_check_eq("notification_set_pkgname", ret, NOTIFICATION_ERROR_NONE,
+ "Must return NOTIFICATION_ERROR_NONE in case of valid parameter");
+}
+
+/**
+ * @brief Negative test case of notification_get_pkgname()
+ */
+static void utc_notification_get_pkgname_n(void)
+{
+ int ret = 0;
+
+ ret = notification_get_pkgname(NULL, NULL);
+
+ dts_check_eq("notification_get_pkgname", ret, NOTIFICATION_ERROR_INVALID_DATA,
+ "Must return NOTIFICATION_ERROR_INVALID_DATA in case of invalid parameter");
+}
+
+/**
+ * @brief Positive test case of notification_get_pkgname()
+ */
+static void utc_notification_get_pkgname_p(void)
+{
+ int ret = 0;
+ notification_h notification = NULL;
+ char *value = NULL;
+
+ /*Invalid parameter test*/
+ notification = notification_create(NOTIFICATION_TYPE_NOTI);
+ ret = notification_get_pkgname(notification, &value);
+
+ dts_check_eq("notification_get_pkgname", ret, NOTIFICATION_ERROR_NONE,
+ "Must return NOTIFICATION_ERROR_NONE in case of valid parameter");
+}
+
+/**
+ * @brief Negative test case of notification_set_layout()
+ */
+static void utc_notification_set_layout_n(void)
+{
+ int ret = 0;
+
+ ret = notification_set_layout(NULL, NOTIFICATION_LY_NONE);
+
+ dts_check_eq("notification_set_layout", ret, NOTIFICATION_ERROR_INVALID_DATA,
+ "Must return NOTIFICATION_ERROR_INVALID_DATA in case of invalid parameter");
+}
+
+/**
+ * @brief Positive test case of notification_set_layout()
+ */
+static void utc_notification_set_layout_p(void)
+{
+ int ret = 0;
+ notification_h notification = NULL;
+
+ /*Invalid parameter test*/
+ notification = notification_create(NOTIFICATION_TYPE_NOTI);
+ ret = notification_set_layout(notification, NOTIFICATION_LY_NOTI_EVENT_SINGLE);
+
+ dts_check_eq("notification_set_layout", ret, NOTIFICATION_ERROR_NONE,
+ "Must return NOTIFICATION_ERROR_NONE in case of valid parameter");
+}
+
+/**
+ * @brief Negative test case of notification_get_layout()
+ */
+static void utc_notification_get_layout_n(void)
+{
+ int ret = 0;
+
+ ret = notification_get_layout(NULL, NULL);
+
+ dts_check_eq("notification_get_layout", ret, NOTIFICATION_ERROR_INVALID_DATA,
+ "Must return NOTIFICATION_ERROR_INVALID_DATA in case of invalid parameter");
+}
+
+/**
+ * @brief Positive test case of notification_get_layout()
+ */
+static void utc_notification_get_layout_p(void)
+{
+ int ret = 0;
+ notification_h notification = NULL;
+ notification_ly_type_e type;
+
+ /*Invalid parameter test*/
+ notification = notification_create(NOTIFICATION_TYPE_NOTI);
+ ret = notification_get_layout(notification, &type);
+
+ dts_check_eq("notification_get_layout", ret, NOTIFICATION_ERROR_NONE,
+ "Must return NOTIFICATION_ERROR_NONE in case of valid parameter");
+}
+
+/**
+ * @brief Negative test case of notification_get_id()
+ */
+static void utc_notification_get_id_n(void)
+{
+ int ret = 0;
+
+ ret = notification_get_id(NULL, NULL, NULL);
+
+ dts_check_eq("notification_get_id", ret, NOTIFICATION_ERROR_INVALID_DATA,
+ "Must return NOTIFICATION_ERROR_INVALID_DATA in case of invalid parameter");
+}
+
+/**
+ * @brief Positive test case of notification_get_id()
+ */
+static void utc_notification_get_id_p(void)
+{
+ int ret = 0;
+ notification_h notification = NULL;
+ int value = 0;
+
+ /*Invalid parameter test*/
+ notification = notification_create(NOTIFICATION_TYPE_NOTI);
+ ret = notification_get_id(notification, NULL, &value);
+
+ dts_check_eq("notification_get_id", ret, NOTIFICATION_ERROR_NONE,
+ "Must return NOTIFICATION_ERROR_NONE in case of valid parameter");
+}
+
+/**
+ * @brief Negative test case of notification_get_type()
+ */
+static void utc_notification_get_type_n(void)
+{
+ int ret = 0;
+
+ ret = notification_get_type(NULL, NULL);
+
+ dts_check_eq("notification_get_type", ret, NOTIFICATION_ERROR_INVALID_DATA,
+ "Must return NOTIFICATION_ERROR_INVALID_DATA in case of invalid parameter");
+}
+
+/**
+ * @brief Positive test case of notification_get_type()
+ */
+static void utc_notification_get_type_p(void)
+{
+ int ret = 0;
+ notification_h notification = NULL;
+ notification_type_e type;
+
+ /*Invalid parameter test*/
+ notification = notification_create(NOTIFICATION_TYPE_NOTI);
+ ret = notification_get_type(notification, &type);
+
+ dts_check_eq("notification_get_type", ret, NOTIFICATION_ERROR_NONE,
+ "Must return NOTIFICATION_ERROR_NONE in case of valid parameter");
+}
+
+/**
+ * @brief Negative test case of notification_insert()
+ */
+static void utc_notification_insert_n(void)
+{
+ int ret = 0;
+ notification_h notification = NULL;
+
+ notification = notification_create(NOTIFICATION_TYPE_NOTI);
+ notification_set_pkgname(notification, TEST_PKG);
+ notification_set_text(notification, NOTIFICATION_TEXT_TYPE_TITLE, "test", NULL, NOTIFICATION_VARIABLE_TYPE_NONE);
+ ret = notification_insert(NULL, NULL);
+
+ dts_check_eq("notification_insert", ret, NOTIFICATION_ERROR_INVALID_DATA,
+ "Must return NOTIFICATION_ERROR_INVALID_DATA in case of invalid parameter");
+}
+
+/**
+ * @brief Positive test case of notification_insert()
+ */
+static void utc_notification_insert_p(void)
+{
+ int ret = 0;
+ notification_h notification = NULL;
+
+ notification = notification_create(NOTIFICATION_TYPE_NOTI);
+ notification_set_pkgname(notification, TEST_PKG);
+ notification_set_text(notification, NOTIFICATION_TEXT_TYPE_TITLE, "test", NULL, NOTIFICATION_VARIABLE_TYPE_NONE);
+ ret = notification_insert(notification, NULL);
+
+ dts_check_eq("notification_insert", ret, NOTIFICATION_ERROR_NONE,
+ "Must return NOTIFICATION_ERROR_NONE in case of invalid parameter");
+}
+
+/**
+ * @brief Negative test case of notification_clear()
+ */
+static void utc_notification_clear_n(void)
+{
+ int ret = 0;
+
+ ret = notification_clear(NOTIFICATION_TYPE_MAX);
+ dts_check_eq("notification_clear", ret, NOTIFICATION_ERROR_NONE,
+ "Must return NOTIFICATION_ERROR_NONE in case of invalid parameter");
+}
+
+/**
+ * @brief Positive test case of notification_clear()
+ */
+static void utc_notification_clear_p(void)
+{
+ int ret = 0;
+
+ ret = notification_clear(NOTIFICATION_TYPE_NOTI);
+ dts_check_eq("notification_clear", ret, NOTIFICATION_ERROR_NONE,
+ "Must return NOTIFICATION_ERROR_NONE in case of invalid parameter");
+}
+
+/**
+ * @brief Negative test case of notification_update()
+ */
+static void utc_notification_update_n(void)
+{
+ int ret = 0;
+ notification_h notification = NULL;
+
+ notification = notification_create(NOTIFICATION_TYPE_NOTI);
+ notification_set_pkgname(notification, TEST_PKG);
+ notification_set_text(notification, NOTIFICATION_TEXT_TYPE_TITLE, "test", NULL, NOTIFICATION_VARIABLE_TYPE_NONE);
+ notification_insert(notification, NULL);
+ notification_set_text(notification, NOTIFICATION_TEXT_TYPE_TITLE, "updated", NULL, NOTIFICATION_VARIABLE_TYPE_NONE);
+ ret = notification_update(NULL);
+
+ dts_check_eq("notification_update", ret, NOTIFICATION_ERROR_NONE,
+ "Must return NOTIFICATION_ERROR_NONE in case of invalid parameter");
+}
+
+/**
+ * @brief Positive test case of notification_update()
+ */
+static void utc_notification_update_p(void)
+{
+ int ret = 0;
+ notification_h notification = NULL;
+
+ notification = notification_create(NOTIFICATION_TYPE_NOTI);
+ notification_set_pkgname(notification, TEST_PKG);
+ notification_set_text(notification, NOTIFICATION_TEXT_TYPE_TITLE, "test", NULL, NOTIFICATION_VARIABLE_TYPE_NONE);
+ notification_insert(notification, NULL);
+ notification_set_text(notification, NOTIFICATION_TEXT_TYPE_TITLE, "updated", NULL, NOTIFICATION_VARIABLE_TYPE_NONE);
+ ret = notification_update(notification);
+
+ dts_check_eq("notification_update", ret, NOTIFICATION_ERROR_NONE,
+ "Must return NOTIFICATION_ERROR_NONE in case of invalid parameter");
+}
+
+/**
+ * @brief Negative test case of notification_delete_all_by_type()
+ */
+static void utc_notification_delete_all_by_type_n(void)
+{
+ int ret = 0;
+
+ ret = notification_delete_all_by_type(NULL, NOTIFICATION_TYPE_MAX);
+ dts_check_eq("notification_delete_all_by_type", ret, NOTIFICATION_ERROR_NONE,
+ "Must return NOTIFICATION_ERROR_NONE in case of invalid parameter");
+}
+
+/**
+ * @brief Positive test case of notification_delete_all_by_type()
+ */
+static void utc_notification_delete_all_by_type_p(void)
+{
+ int ret = 0;
+
+ ret = notification_delete_all_by_type(NULL, NOTIFICATION_TYPE_NOTI);
+ dts_check_eq("notification_delete_all_by_type", ret, NOTIFICATION_ERROR_NONE,
+ "Must return NOTIFICATION_ERROR_NONE in case of invalid parameter");
+}
+
+/**
+ * @brief Negative test case of notification_delete_by_priv_id()
+ */
+static void utc_notification_delete_by_priv_id_n(void)
+{
+ int ret = 0;
+ int priv_id = 0;
+ notification_h notification = NULL;
+
+ notification = notification_create(NOTIFICATION_TYPE_NOTI);
+ notification_set_pkgname(notification, TEST_PKG);
+ notification_set_text(notification, NOTIFICATION_TEXT_TYPE_TITLE, "privid_delete", NULL, NOTIFICATION_VARIABLE_TYPE_NONE);
+ notification_insert(notification, &priv_id);
+
+ ret = notification_delete_by_priv_id(TEST_PKG, NOTIFICATION_TYPE_NOTI, NOTIFICATION_PRIV_ID_NONE);
+ dts_check_eq("notification_delete_by_priv_id", ret, NOTIFICATION_ERROR_INVALID_DATA,
+ "Must return NOTIFICATION_ERROR_INVALID_DATA in case of invalid parameter");
+}
+
+/**
+ * @brief Positive test case of notification_delete_by_priv_id()
+ */
+static void utc_notification_delete_by_priv_id_p(void)
+{
+ int ret = 0;
+ int priv_id = 0;
+ notification_h notification = NULL;
+
+ notification = notification_create(NOTIFICATION_TYPE_NOTI);
+ notification_set_pkgname(notification, TEST_PKG);
+ notification_set_text(notification, NOTIFICATION_TEXT_TYPE_TITLE, "privid_delete", NULL, NOTIFICATION_VARIABLE_TYPE_NONE);
+ notification_insert(notification, &priv_id);
+
+ ret = notification_delete_by_priv_id(TEST_PKG, NOTIFICATION_TYPE_NOTI, priv_id);
+ dts_check_eq("notification_delete_by_priv_id", ret, NOTIFICATION_ERROR_NONE,
+ "Must return NOTIFICATION_ERROR_NONE in case of invalid parameter");
+}
+
+/**
+ * @brief Negative test case of notification_delete()
+ */
+static void utc_notification_delete_n(void)
+{
+ int ret = 0;
+ int priv_id = 0;
+ notification_h notification = NULL;
+
+ notification = notification_create(NOTIFICATION_TYPE_NOTI);
+ notification_set_pkgname(notification, TEST_PKG);
+ notification_set_text(notification, NOTIFICATION_TEXT_TYPE_TITLE, "privid_delete", NULL, NOTIFICATION_VARIABLE_TYPE_NONE);
+ notification_insert(notification, &priv_id);
+
+ ret = notification_delete(NULL);
+ dts_check_eq("notification_delete", ret, NOTIFICATION_ERROR_INVALID_DATA,
+ "Must return NOTIFICATION_ERROR_INVALID_DATA in case of invalid parameter");
+}
+
+/**
+ * @brief Positive test case of notification_delete()
+ */
+static void utc_notification_delete_p(void)
+{
+ int ret = 0;
+ int priv_id = 0;
+ notification_h notification = NULL;
+
+ notification = notification_create(NOTIFICATION_TYPE_NOTI);
+ notification_set_pkgname(notification, TEST_PKG);
+ notification_set_text(notification, NOTIFICATION_TEXT_TYPE_TITLE, "privid_delete", NULL, NOTIFICATION_VARIABLE_TYPE_NONE);
+ notification_insert(notification, &priv_id);
+
+ ret = notification_delete(notification);
+ dts_check_eq("notification_delete", ret, NOTIFICATION_ERROR_NONE,
+ "Must return NOTIFICATION_ERROR_NONE in case of invalid parameter");
+}
+
+/**
+ * @brief Negative test case of notification_update_progress()
+ */
+static void utc_notification_update_progress_n(void)
+{
+ int ret = 0;
+ int priv_id = 0;
+ notification_h notification = NULL;
+
+ notification = notification_create(NOTIFICATION_TYPE_ONGOING);
+ notification_set_pkgname(notification, TEST_PKG);
+ notification_set_text(notification, NOTIFICATION_TEXT_TYPE_TITLE, "progress_test-N", NULL, NOTIFICATION_VARIABLE_TYPE_NONE);
+ notification_set_progress(notification, 0.1);
+ notification_insert(notification, &priv_id);
+
+ sleep(3);
+
+ ret = notification_update_progress(NULL, NOTIFICATION_PRIV_ID_NONE, 0.9);
+ dts_check_eq("notification_update_progress", ret, NOTIFICATION_ERROR_INVALID_DATA,
+ "Must return NOTIFICATION_ERROR_INVALID_DATA in case of invalid parameter");
+}
+
+/**
+ * @brief Positive test case of notification_update_progress()
+ */
+static void utc_notification_update_progress_p(void)
+{
+ int ret = 0;
+ int priv_id = 0;
+ notification_h notification = NULL;
+
+ notification = notification_create(NOTIFICATION_TYPE_ONGOING);
+ notification_set_pkgname(notification, TEST_PKG);
+ notification_set_text(notification, NOTIFICATION_TEXT_TYPE_TITLE, "progress_test-P", NULL, NOTIFICATION_VARIABLE_TYPE_NONE);
+ notification_set_progress(notification, 0.1);
+ notification_insert(notification, &priv_id);
+
+ sleep(3);
+
+ ret = notification_update_progress(notification, priv_id, 0.9);
+ dts_check_eq("notification_update_progress", ret, NOTIFICATION_ERROR_NONE,
+ "Must return NOTIFICATION_ERROR_NONE in case of invalid parameter");
+}
+
+/**
+ * @brief Negative test case of notification_update_size()
+ */
+static void utc_notification_update_size_n(void)
+{
+ int ret = 0;
+ int priv_id = 0;
+ notification_h notification = NULL;
+
+ notification = notification_create(NOTIFICATION_TYPE_ONGOING);
+ notification_set_pkgname(notification, TEST_PKG);
+ notification_set_text(notification, NOTIFICATION_TEXT_TYPE_TITLE, "size_test-N", NULL, NOTIFICATION_VARIABLE_TYPE_NONE);
+ notification_set_size(notification, 1000);
+ notification_insert(notification, &priv_id);
+
+ sleep(3);
+
+ ret = notification_update_size(NULL, NOTIFICATION_PRIV_ID_NONE, 10000000);
+ dts_check_eq("notification_update_size", ret, NOTIFICATION_ERROR_INVALID_DATA,
+ "Must return NOTIFICATION_ERROR_NONE in case of invalid parameter");
+}
+
+/**
+ * @brief Positive test case of notification_update_size()
+ */
+static void utc_notification_update_size_p(void)
+{
+ int ret = 0;
+ int priv_id = 0;
+ notification_h notification = NULL;
+
+ notification = notification_create(NOTIFICATION_TYPE_ONGOING);
+ notification_set_pkgname(notification, TEST_PKG);
+ notification_set_text(notification, NOTIFICATION_TEXT_TYPE_TITLE, "size_test-P", NULL, NOTIFICATION_VARIABLE_TYPE_NONE);
+ notification_set_size(notification, 1000);
+ notification_insert(notification, &priv_id);
+
+ sleep(3);
+
+ ret = notification_update_size(notification, priv_id, 10000000);
+ dts_check_eq("notification_update_size", ret, NOTIFICATION_ERROR_NONE,
+ "Must return NOTIFICATION_ERROR_NONE in case of invalid parameter");
+}
+
+/**
+ * @brief Negative test case of notification_update_content()
+ */
+static void utc_notification_update_content_n(void)
+{
+ int ret = 0;
+ int priv_id = 0;
+ notification_h notification = NULL;
+
+ notification = notification_create(NOTIFICATION_TYPE_ONGOING);
+ notification_set_pkgname(notification, TEST_PKG);
+ notification_set_text(notification, NOTIFICATION_TEXT_TYPE_CONTENT, "contents_test-N", NULL, NOTIFICATION_VARIABLE_TYPE_NONE);
+ notification_insert(notification, &priv_id);
+
+ sleep(3);
+
+ ret = notification_update_content(NULL, NOTIFICATION_PRIV_ID_NONE, NULL);
+ dts_check_eq("notification_update_content", ret, NOTIFICATION_ERROR_INVALID_DATA,
+ "Must return NOTIFICATION_ERROR_NONE in case of invalid parameter");
+}
+
+/**
+ * @brief Positive test case of notification_update_content()
+ */
+static void utc_notification_update_content_p(void)
+{
+ int ret = 0;
+ int priv_id = 0;
+ notification_h notification = NULL;
+
+ notification = notification_create(NOTIFICATION_TYPE_ONGOING);
+ notification_set_pkgname(notification, TEST_PKG);
+ notification_set_text(notification, NOTIFICATION_TEXT_TYPE_CONTENT, "contents_test-P", NULL, NOTIFICATION_VARIABLE_TYPE_NONE);
+ notification_insert(notification, &priv_id);
+
+ sleep(3);
+
+ ret = notification_update_content(notification, priv_id, "contents_test-P-done");
+ dts_check_eq("notification_update_content", ret, NOTIFICATION_ERROR_NONE,
+ "Must return NOTIFICATION_ERROR_NONE in case of invalid parameter");
+}
+
+/**
+ * @brief Negative test case of notification_new()
+ */
+static void utc_notification_new_1_n(void)
+{
+ notification_h notification = NULL;
+ /*Invalid parameter test*/
+ notification = notification_new(NOTIFICATION_TYPE_NONE, NOTIFICATION_GROUP_ID_NONE, NOTIFICATION_PRIV_ID_NONE);
+ dts_check_eq("notification_new", notification, NULL,
+ "Must return NULL in case of invalid parameter");
+}
+
+/**
+ * @brief Negative test case of notification_new()
+ */
+static void utc_notification_new_2_n(void)
+{
+ notification_h notification = NULL;
+ /*Invalid parameter test*/
+ notification = notification_new(NOTIFICATION_TYPE_MAX, NOTIFICATION_GROUP_ID_NONE, NOTIFICATION_PRIV_ID_NONE);
+ dts_check_eq("notification_new", notification, NULL,
+ "Must return NULL in case of invalid parameter");
+}
+
+/**
+ * @brief Positive test case of notification_new()
+ */
+static void utc_notification_new_1_p(void)
+{
+ notification_h notification = NULL;
+
+ /*Invalid parameter test*/
+ notification = notification_new(NOTIFICATION_TYPE_NOTI, NOTIFICATION_GROUP_ID_NONE, NOTIFICATION_PRIV_ID_NONE);
+ dts_check_ne("notification_new", notification, NULL,
+ "Must return NOTIFICATION_ERROR_INVALID_DATA in case of invalid parameter");
+}
+
+/**
+ * @brief Positive test case of notification_new()
+ */
+static void utc_notification_new_2_p(void)
+{
+ notification_h notification = NULL;
+
+ /*Invalid parameter test*/
+ notification = notification_new(NOTIFICATION_TYPE_ONGOING, NOTIFICATION_GROUP_ID_NONE, NOTIFICATION_PRIV_ID_NONE);
+ dts_check_ne("notification_new", notification, NULL,
+ "Must return NOTIFICATION_ERROR_INVALID_DATA in case of invalid parameter");
+}
+
+/**
+ * @brief Negative test case of notification_load()
+ */
+static void utc_notification_load_n(void)
+{
+ int priv_id = 0;
+ notification_h notification = NULL;
+
+ notification = notification_create(NOTIFICATION_TYPE_ONGOING);
+ notification_set_pkgname(notification, TEST_PKG);
+ notification_set_text(notification, NOTIFICATION_TEXT_TYPE_CONTENT, "contents_test-P", NULL, NOTIFICATION_VARIABLE_TYPE_NONE);
+ notification_insert(notification, &priv_id);
+
+ sleep(1);
+
+ /*Invalid parameter test*/
+ notification = notification_load(NULL, NOTIFICATION_PRIV_ID_NONE);
+ dts_check_eq("notification_load", notification, NULL,
+ "Must return NULL in case of invalid parameter");
+}
+
+/**
+ * @brief Positive test case of notification_load()
+ */
+static void utc_notification_load_p(void)
+{
+ int priv_id = 0;
+ notification_h notification = NULL;
+
+ notification = notification_create(NOTIFICATION_TYPE_ONGOING);
+ notification_set_pkgname(notification, TEST_PKG);
+ notification_set_text(notification, NOTIFICATION_TEXT_TYPE_CONTENT, "contents_test-P", NULL, NOTIFICATION_VARIABLE_TYPE_NONE);
+ notification_insert(notification, &priv_id);
+
+ sleep(1);
+
+ /*Invalid parameter test*/
+ notification = notification_load(TEST_PKG, priv_id);
+ dts_check_ne("notification_load", notification, NULL,
+ "Must return NOTIFICATION_ERROR_INVALID_DATA in case of invalid parameter");
+}
+
+/**
+ * @brief Negative test case of notification_clone()
+ */
+static void utc_notification_clone_n(void)
+{
+ int ret = 0;
+ notification_h notification = NULL;
+
+ notification = notification_create(NOTIFICATION_TYPE_ONGOING);
+ ret = notification_clone(NULL, NULL);
+
+ dts_check_eq("notification_update_content", ret, NOTIFICATION_ERROR_INVALID_DATA,
+ "Must return NOTIFICATION_ERROR_NONE in case of invalid parameter");
+}
+
+/**
+ * @brief Positive test case of notification_clone()
+ */
+static void utc_notification_clone_p(void)
+{
+ int ret = 0;
+ notification_h notification = NULL;
+ notification_h notification_cloned = NULL;
+
+ notification = notification_create(NOTIFICATION_TYPE_ONGOING);
+ ret = notification_clone(notification, &notification_cloned);
+
+ dts_check_eq("notification_update_content", ret, NOTIFICATION_ERROR_NONE,
+ "Must return NOTIFICATION_ERROR_NONE in case of invalid parameter");
+}
+
+/**
+ * @brief Negative test case of notification_free()
+ */
+static void utc_notification_free_n(void)
+{
+ int ret = 0;
+ notification_h notification = NULL;
+
+ notification = notification_create(NOTIFICATION_TYPE_ONGOING);
+ ret = notification_free(NULL);
+
+ dts_check_eq("notification_update_content", ret, NOTIFICATION_ERROR_INVALID_DATA,
+ "Must return NOTIFICATION_ERROR_NONE in case of invalid parameter");
+}
+
+/**
+ * @brief Positive test case of notification_free()
+ */
+static void utc_notification_free_p(void)
+{
+ int ret = 0;
+ notification_h notification = NULL;
+
+ notification = notification_create(NOTIFICATION_TYPE_ONGOING);
+ ret = notification_free(notification);
+
+ dts_check_eq("notification_update_content", ret, NOTIFICATION_ERROR_NONE,
+ "Must return NOTIFICATION_ERROR_NONE in case of invalid parameter");
+}
+
+/**
+ * @brief Negative test case of notification_resister_changed_cb()
+ */
+static void utc_notification_resister_changed_cb_n(void)
+{
+ int ret = 0;
+
+ ret = notification_resister_changed_cb(NULL, NULL);
+ dts_check_eq("notification_resister_changed_cb", ret, NOTIFICATION_ERROR_INVALID_DATA,
+ "Must return NOTIFICATION_ERROR_INVALID_DATA in case of invalid parameter");
+}
+
+/**
+ * @brief Positive test case of notification_resister_changed_cb()
+ */
+static void utc_notification_resister_changed_cb_p(void)
+{
+ int ret = 0;
+
+ ret = notification_resister_changed_cb(_changed_cb, NULL);
+ notification_unresister_changed_cb(_changed_cb);
+ dts_check_eq("notification_resister_changed_cb", ret, NOTIFICATION_ERROR_NONE,
+ "Must return NOTIFICATION_ERROR_NONE in case of invalid parameter");
+}
+
+/**
+ * @brief Negative test case of notification_unresister_changed_cb()
+ */
+static void utc_notification_unresister_changed_cb_n(void)
+{
+ int ret = 0;
+
+ ret = notification_unresister_changed_cb(NULL);
+ dts_check_eq("notification_unresister_changed_cb", ret, NOTIFICATION_ERROR_INVALID_DATA,
+ "Must return NOTIFICATION_ERROR_INVALID_DATA in case of invalid parameter");
+}
+
+/**
+ * @brief Positive test case of notification_unresister_changed_cb()
+ */
+static void utc_notification_unresister_changed_cb_p(void)
+{
+ int ret = 0;
+
+ notification_resister_changed_cb(_changed_cb, NULL);
+ ret = notification_unresister_changed_cb(_changed_cb);
+ dts_check_eq("notification_unresister_changed_cb", ret, NOTIFICATION_ERROR_NONE,
+ "Must return NOTIFICATION_ERROR_NONE in case of invalid parameter");
+}
+
+/**
+ * @brief Negative test case of notification_register_detailed_changed_cb()
+ */
+static void utc_notification_register_detailed_changed_cb_n(void)
+{
+ int ret = 0;
+
+ ret = notification_register_detailed_changed_cb(NULL, NULL);
+ dts_check_eq("notification_register_detailed_changed_cb", ret, NOTIFICATION_ERROR_INVALID_DATA,
+ "Must return NOTIFICATION_ERROR_INVALID_DATA in case of invalid parameter");
+}
+
+/**
+ * @brief Positive test case of notification_register_detailed_changed_cb()
+ */
+static void utc_notification_register_detailed_changed_cb_p(void)
+{
+ int ret = 0;
+
+ ret = notification_register_detailed_changed_cb(_detailed_changed_cb, NULL);
+ notification_unregister_detailed_changed_cb(_detailed_changed_cb, NULL);
+ dts_check_eq("notification_register_detailed_changed_cb", ret, NOTIFICATION_ERROR_NONE,
+ "Must return NOTIFICATION_ERROR_NONE in case of invalid parameter");
+}
+
+/**
+ * @brief Negative test case of notification_unregister_detailed_changed_cb()
+ */
+static void utc_notification_unregister_detailed_changed_cb_n(void)
+{
+ int ret = 0;
+
+ ret = notification_unregister_detailed_changed_cb(NULL, NULL);
+ dts_check_eq("notification_unregister_detailed_changed_cb", ret, NOTIFICATION_ERROR_INVALID_DATA,
+ "Must return NOTIFICATION_ERROR_INVALID_DATA in case of invalid parameter");
+}
+
+/**
+ * @brief Positive test case of notification_unregister_detailed_changed_cb()
+ */
+static void utc_notification_unregister_detailed_changed_cb_p(void)
+{
+ int ret = 0;
+
+ notification_register_detailed_changed_cb(_detailed_changed_cb, NULL);
+ ret = notification_unregister_detailed_changed_cb(_detailed_changed_cb, NULL);
+ dts_check_eq("notification_unregister_detailed_changed_cb", ret, NOTIFICATION_ERROR_NONE,
+ "Must return NOTIFICATION_ERROR_NONE in case of invalid parameter");
+}
+
+/**
+ * @brief Negative test case of notification_get_count()
+ */
+static void utc_notification_get_count_n(void)
+{
+ int ret = 0;
+
+ ret = notification_get_count(NOTIFICATION_TYPE_NONE, NULL,
+ NOTIFICATION_GROUP_ID_NONE, NOTIFICATION_PRIV_ID_NONE
+ ,NULL);
+ dts_check_eq("notification_get_count", ret, NOTIFICATION_ERROR_INVALID_DATA,
+ "Must return NOTIFICATION_ERROR_INVALID_DATA in case of invalid parameter");
+}
+
+/**
+ * @brief Positive test case of notification_get_count()
+ */
+static void utc_notification_get_count_p(void)
+{
+ int ret = 0;
+ int value = 0;
+
+ ret = notification_get_count(NOTIFICATION_TYPE_NONE, TEST_PKG,
+ NOTIFICATION_GROUP_ID_NONE, NOTIFICATION_PRIV_ID_NONE
+ , &value);
+ dts_check_eq("notification_get_count", ret, NOTIFICATION_ERROR_NONE,
+ "Must return NOTIFICATION_ERROR_NONE in case of invalid parameter");
+}
+
+/**
+ * @brief Negative test case of notification_get_list()
+ */
+static void utc_notification_get_list_n(void)
+{
+ int ret = 0;
+
+ ret = notification_get_list(NOTIFICATION_TYPE_NONE, -1, NULL);
+ dts_check_eq("notification_get_list", ret, NOTIFICATION_ERROR_INVALID_DATA,
+ "Must return NOTIFICATION_ERROR_INVALID_DATA in case of invalid parameter");
+}
+
+/**
+ * @brief Positive test case of notification_get_list()
+ */
+static void utc_notification_get_list_p(void)
+{
+ int ret = 0;
+ notification_list_h list;
+
+ ret = notification_get_list(NOTIFICATION_TYPE_NOTI, -1, &list);
+ dts_check_eq("notification_get_list", ret, NOTIFICATION_ERROR_NONE,
+ "Must return NOTIFICATION_ERROR_NONE in case of invalid parameter");
+}
+
+/**
+ * @brief Negative test case of notification_get_grouping_list()
+ */
+static void utc_notification_get_grouping_list_n(void)
+{
+ int ret = 0;
+
+ ret = notification_get_grouping_list(NOTIFICATION_TYPE_NONE, -1, NULL);
+ dts_check_eq("notification_get_grouping_list", ret, NOTIFICATION_ERROR_INVALID_DATA,
+ "Must return NOTIFICATION_ERROR_INVALID_DATA in case of invalid parameter");
+}
+
+/**
+ * @brief Positive test case of notification_get_grouping_list()
+ */
+static void utc_notification_get_grouping_list_p(void)
+{
+ int ret = 0;
+ notification_list_h list;
+
+ ret = notification_get_grouping_list(NOTIFICATION_TYPE_NOTI, -1, &list);
+ dts_check_eq("notification_get_grouping_list", ret, NOTIFICATION_ERROR_NONE,
+ "Must return NOTIFICATION_ERROR_NONE in case of invalid parameter");
+}
+
+/**
+ * @brief Negative test case of notification_get_detail_list()
+ */
+static void utc_notification_get_detail_list_n(void)
+{
+ int ret = 0;
+
+ ret = notification_get_detail_list(TEST_PKG,
+ NOTIFICATION_GROUP_ID_NONE,
+ NOTIFICATION_PRIV_ID_NONE,
+ -1, NULL);
+ dts_check_eq("notification_get_detail_list", ret, NOTIFICATION_ERROR_INVALID_DATA,
+ "Must return NOTIFICATION_ERROR_INVALID_DATA in case of invalid parameter");
+}
+
+/**
+ * @brief Positive test case of notification_get_detail_list()
+ */
+static void utc_notification_get_detail_list_p(void)
+{
+ int ret = 0;
+ notification_list_h list;
+
+ ret = notification_get_detail_list(TEST_PKG,
+ NOTIFICATION_GROUP_ID_NONE,
+ NOTIFICATION_PRIV_ID_NONE,
+ -1, &list);
+ dts_check_eq("notification_get_detail_list", ret, NOTIFICATION_ERROR_NONE,
+ "Must return NOTIFICATION_ERROR_NONE in case of invalid parameter");
+}
+
+/**
+ * @brief Negative test case of notification_free_list()
+ */
+static void utc_notification_free_list_n(void)
+{
+ int ret = 0;
+
+ ret = notification_free_list(NULL);
+ dts_check_eq("notification_free_list", ret, NOTIFICATION_ERROR_INVALID_DATA,
+ "Must return NOTIFICATION_ERROR_NONE in case of invalid parameter");
+}
+
+/**
+ * @brief Positive test case of notification_free_list()
+ */
+static void utc_notification_free_list_p(void)
+{
+ int ret = 0;
+ notification_list_h list;
+
+ ret = notification_get_detail_list(TEST_PKG,
+ NOTIFICATION_GROUP_ID_NONE,
+ NOTIFICATION_PRIV_ID_NONE,
+ -1, &list);
+
+ ret = notification_free_list(list);
+ dts_check_eq("notification_free_list", ret, NOTIFICATION_ERROR_NONE,
+ "Must return NOTIFICATION_ERROR_NONE in case of invalid parameter");
+}
+
+/**
+ * @brief Negative test case of notification_op_get_data()
+ */
+static void utc_notification_op_get_data_n(void)
+{
+ int ret = 0;
+
+ ret = notification_op_get_data(NULL, NOTIFICATION_OP_DATA_MIN, NULL);
+ dts_check_eq("notification_op_get_data", ret, NOTIFICATION_ERROR_INVALID_DATA,
+ "Must return NOTIFICATION_ERROR_INVALID_DATA in case of invalid parameter");
+}
+
+/**
+ * @brief Positive test case of notification_op_get_data()
+ */
+static void utc_notification_op_get_data_p(void)
+{
+ int ret = 0;
+ int value = 0;
+ notification_op noti_op;
+ noti_op.type = NOTIFICATION_OP_INSERT;
+ noti_op.priv_id = 1;
+
+ ret = notification_op_get_data(&noti_op, NOTIFICATION_OP_DATA_PRIV_ID, &value);
+ dts_check_eq("notification_op_get_data", ret, NOTIFICATION_ERROR_NONE,
+ "Must return NOTIFICATION_ERROR_NONE in case of invalid parameter");
+}
+
+/**
+ * @brief Positive test case of notification_is_service_ready()
+ */
+static void utc_notification_is_service_ready_p(void)
+{
+ int value = 0;
+
+ value = notification_is_service_ready();
+ dts_check_eq("notification_is_service_ready", value, 1,
+ "Must return 1 in case of invalid parameter");
+}
+
+/**
+ * @brief Negative test case of notification_add_deferred_task()
+ */
+static void utc_notification_add_deferred_task_n(void)
+{
+ int ret = 0;
+
+ ret = notification_add_deferred_task(NULL, NULL);
+ dts_check_eq("notification_add_deferred_task", ret, NOTIFICATION_ERROR_INVALID_DATA,
+ "Must return NOTIFICATION_ERROR_INVALID_DATA in case of invalid parameter");
+}
+
+/**
+ * @brief Positive test case of notification_add_deferred_task()
+ */
+static void utc_notification_add_deferred_task_p(void)
+{
+ int ret = 0;
+
+ ret = notification_add_deferred_task(_deffered_job_cb, NULL);
+ notification_del_deferred_task(_deffered_job_cb);
+ dts_check_eq("notification_add_deferred_task", ret, NOTIFICATION_ERROR_NONE,
+ "Must return NOTIFICATION_ERROR_NONE in case of invalid parameter");
+}
+
+/**
+ * @brief Negative test case of notification_del_deferred_task()
+ */
+static void utc_notification_del_deferred_task_n(void)
+{
+ int ret = 0;
+
+ ret = notification_del_deferred_task(NULL);
+ dts_check_eq("notification_del_deferred_task", ret, NOTIFICATION_ERROR_INVALID_DATA,
+ "Must return NOTIFICATION_ERROR_INVALID_DATA in case of invalid parameter");
+}
+
+/**
+ * @brief Positive test case of notification_del_deferred_task()
+ */
+static void utc_notification_del_deferred_task_p(void)
+{
+ int ret = 0;
+
+ ret = notification_add_deferred_task(_deffered_job_cb, NULL);
+ ret = notification_del_deferred_task(_deffered_job_cb);
+ dts_check_eq("notification_del_deferred_task", ret, NOTIFICATION_ERROR_NONE,
+ "Must return NOTIFICATION_ERROR_NONE in case of invalid parameter");
+}
diff --git a/TC/testcase/utc_notification_list.c b/TC/testcase/utc_notification_list.c
new file mode 100644
index 0000000..32ac3da
--- /dev/null
+++ b/TC/testcase/utc_notification_list.c
@@ -0,0 +1,441 @@
+/*
+ * 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 <unistd.h>
+#include <fcntl.h>
+#include <libintl.h>
+#include <tet_api.h>
+#include <notification.h>
+
+#define TEST_PKG "org.tizen.tetware"
+
+enum {
+ POSITIVE_TC_IDX = 0x01,
+ NEGATIVE_TC_IDX,
+};
+
+static void startup(void);
+static void cleanup(void);
+
+static void utc_notification_list_get_head_n(void);
+static void utc_notification_list_get_head_p(void);
+static void utc_notification_list_get_tail_n(void);
+static void utc_notification_list_get_tail_p(void);
+static void utc_notification_list_get_prev_n(void);
+static void utc_notification_list_get_prev_p(void);
+static void utc_notification_list_get_next_n(void);
+static void utc_notification_list_get_next_p(void);
+static void utc_notification_list_get_data_n(void);
+static void utc_notification_list_get_data_p(void);
+static void utc_notification_list_append_n(void);
+static void utc_notification_list_append_p(void);
+static void utc_notification_list_remove_n(void);
+static void utc_notification_list_remove_p(void);
+
+void (*tet_startup)(void) = startup;
+void (*tet_cleanup)(void) = cleanup;
+
+struct tet_testlist tet_testlist[] = {
+ {utc_notification_list_get_head_n, NEGATIVE_TC_IDX},
+ {utc_notification_list_get_head_p, POSITIVE_TC_IDX},
+ {utc_notification_list_get_tail_n, NEGATIVE_TC_IDX},
+ {utc_notification_list_get_tail_p, POSITIVE_TC_IDX},
+ {utc_notification_list_get_prev_n, NEGATIVE_TC_IDX},
+ {utc_notification_list_get_prev_p, POSITIVE_TC_IDX},
+ {utc_notification_list_get_next_n, NEGATIVE_TC_IDX},
+ {utc_notification_list_get_next_p, POSITIVE_TC_IDX},
+ {utc_notification_list_get_data_n, NEGATIVE_TC_IDX},
+ {utc_notification_list_get_data_p, POSITIVE_TC_IDX},
+ {utc_notification_list_append_n, NEGATIVE_TC_IDX},
+ {utc_notification_list_append_p, POSITIVE_TC_IDX},
+ {utc_notification_list_remove_n, NEGATIVE_TC_IDX},
+ {utc_notification_list_remove_p, POSITIVE_TC_IDX},
+ { NULL, 0 },
+};
+
+static void startup(void)
+{
+ /* start of TC */
+ notification_clear(NOTIFICATION_TYPE_NONE);
+ tet_printf("\n TC start");
+}
+
+
+static void cleanup(void)
+{
+ /* end of TC */
+ tet_printf("\n TC end");
+}
+
+/**
+ * @brief Negative test case of notification_list_get_head()
+ */
+static void utc_notification_list_get_head_n(void)
+{
+ notification_list_h list = NULL;
+ notification_list_h list_value = NULL;
+ notification_h notification_1 = NULL;
+ notification_h notification_2 = NULL;
+ notification_h notification_3 = NULL;
+ notification_h notification_4 = NULL;
+
+ notification_1 = notification_create(NOTIFICATION_TYPE_NOTI);
+ notification_2 = notification_create(NOTIFICATION_TYPE_NOTI);
+ notification_3 = notification_create(NOTIFICATION_TYPE_NOTI);
+ notification_4 = notification_create(NOTIFICATION_TYPE_NOTI);
+ list = notification_list_append(list, notification_1);
+ list = notification_list_append(list, notification_2);
+ list = notification_list_append(list, notification_3);
+ list = notification_list_append(list, notification_4);
+
+ list_value = notification_list_get_head(NULL);
+ dts_check_eq("notification_list_get_head", list_value, NULL,
+ "Must return NULL in case of invalid parameter");
+}
+
+/**
+ * @brief Positive test case of notification_list_get_head()
+ */
+static void utc_notification_list_get_head_p(void)
+{
+ notification_list_h list = NULL;
+ notification_list_h list_value = NULL;
+ notification_h notification_1 = NULL;
+ notification_h notification_2 = NULL;
+ notification_h notification_3 = NULL;
+ notification_h notification_4 = NULL;
+
+ notification_1 = notification_create(NOTIFICATION_TYPE_NOTI);
+ notification_2 = notification_create(NOTIFICATION_TYPE_NOTI);
+ notification_3 = notification_create(NOTIFICATION_TYPE_NOTI);
+ notification_4 = notification_create(NOTIFICATION_TYPE_NOTI);
+ list = notification_list_append(list, notification_1);
+ list = notification_list_append(list, notification_2);
+ list = notification_list_append(list, notification_3);
+ list = notification_list_append(list, notification_4);
+
+ /*Invalid parameter test*/
+ list_value = notification_list_get_head(list);
+ dts_check_ne("notification_list_get_head", list_value, NULL,
+ "Must return valid pointer in case of invalid parameter");
+}
+
+/**
+ * @brief Negative test case of notification_list_get_tail()
+ */
+static void utc_notification_list_get_tail_n(void)
+{
+ notification_list_h list = NULL;
+ notification_list_h list_value = NULL;
+ notification_h notification_1 = NULL;
+ notification_h notification_2 = NULL;
+ notification_h notification_3 = NULL;
+ notification_h notification_4 = NULL;
+
+ notification_1 = notification_create(NOTIFICATION_TYPE_NOTI);
+ notification_2 = notification_create(NOTIFICATION_TYPE_NOTI);
+ notification_3 = notification_create(NOTIFICATION_TYPE_NOTI);
+ notification_4 = notification_create(NOTIFICATION_TYPE_NOTI);
+ list = notification_list_append(list, notification_1);
+ list = notification_list_append(list, notification_2);
+ list = notification_list_append(list, notification_3);
+ list = notification_list_append(list, notification_4);
+
+ list_value = notification_list_get_tail(NULL);
+ dts_check_eq("notification_list_get_tail", list_value, NULL,
+ "Must return NULL in case of invalid parameter");
+}
+
+/**
+ * @brief Positive test case of notification_list_get_tail()
+ */
+static void utc_notification_list_get_tail_p(void)
+{
+ notification_list_h list = NULL;
+ notification_list_h list_value = NULL;
+ notification_h notification_1 = NULL;
+ notification_h notification_2 = NULL;
+ notification_h notification_3 = NULL;
+ notification_h notification_4 = NULL;
+
+ notification_1 = notification_create(NOTIFICATION_TYPE_NOTI);
+ notification_2 = notification_create(NOTIFICATION_TYPE_NOTI);
+ notification_3 = notification_create(NOTIFICATION_TYPE_NOTI);
+ notification_4 = notification_create(NOTIFICATION_TYPE_NOTI);
+ list = notification_list_append(list, notification_1);
+ list = notification_list_append(list, notification_2);
+ list = notification_list_append(list, notification_3);
+ list = notification_list_append(list, notification_4);
+
+ /*Invalid parameter test*/
+ list_value = notification_list_get_tail(list);
+ dts_check_ne("notification_list_get_tail", list_value, NULL,
+ "Must return valid pointer in case of invalid parameter");
+}
+
+/**
+ * @brief Negative test case of notification_list_get_prev()
+ */
+static void utc_notification_list_get_prev_n(void)
+{
+ notification_list_h list = NULL;
+ notification_list_h list_value = NULL;
+ notification_h notification_1 = NULL;
+ notification_h notification_2 = NULL;
+ notification_h notification_3 = NULL;
+ notification_h notification_4 = NULL;
+
+ notification_1 = notification_create(NOTIFICATION_TYPE_NOTI);
+ notification_2 = notification_create(NOTIFICATION_TYPE_NOTI);
+ notification_3 = notification_create(NOTIFICATION_TYPE_NOTI);
+ notification_4 = notification_create(NOTIFICATION_TYPE_NOTI);
+ list = notification_list_append(list, notification_1);
+ list = notification_list_append(list, notification_2);
+ list = notification_list_append(list, notification_3);
+ list = notification_list_append(list, notification_4);
+
+ list_value = notification_list_get_prev(NULL);
+ dts_check_eq("notification_list_get_prev", list_value, NULL,
+ "Must return NULL in case of invalid parameter");
+}
+
+/**
+ * @brief Positive test case of notification_list_get_prev()
+ */
+static void utc_notification_list_get_prev_p(void)
+{
+ notification_list_h list = NULL;
+ notification_list_h list_value = NULL;
+ notification_h notification_1 = NULL;
+ notification_h notification_2 = NULL;
+ notification_h notification_3 = NULL;
+ notification_h notification_4 = NULL;
+
+ notification_1 = notification_create(NOTIFICATION_TYPE_NOTI);
+ notification_2 = notification_create(NOTIFICATION_TYPE_NOTI);
+ notification_3 = notification_create(NOTIFICATION_TYPE_NOTI);
+ notification_4 = notification_create(NOTIFICATION_TYPE_NOTI);
+ list = notification_list_append(list, notification_1);
+ list = notification_list_append(list, notification_2);
+ list = notification_list_append(list, notification_3);
+ list = notification_list_append(list, notification_4);
+
+ /*Invalid parameter test*/
+ list = notification_list_get_tail(list);
+ list_value = notification_list_get_prev(list);
+ dts_check_ne("notification_list_get_prev", list_value, NULL,
+ "Must return valid pointer in case of invalid parameter");
+}
+
+/**
+ * @brief Negative test case of notification_list_get_next()
+ */
+static void utc_notification_list_get_next_n(void)
+{
+ notification_list_h list = NULL;
+ notification_list_h list_value = NULL;
+ notification_h notification_1 = NULL;
+ notification_h notification_2 = NULL;
+ notification_h notification_3 = NULL;
+ notification_h notification_4 = NULL;
+
+ notification_1 = notification_create(NOTIFICATION_TYPE_NOTI);
+ notification_2 = notification_create(NOTIFICATION_TYPE_NOTI);
+ notification_3 = notification_create(NOTIFICATION_TYPE_NOTI);
+ notification_4 = notification_create(NOTIFICATION_TYPE_NOTI);
+ list = notification_list_append(list, notification_1);
+ list = notification_list_append(list, notification_2);
+ list = notification_list_append(list, notification_3);
+ list = notification_list_append(list, notification_4);
+
+ list_value = notification_list_get_next(NULL);
+ dts_check_eq("notification_list_get_next", list_value, NULL,
+ "Must return NULL in case of invalid parameter");
+}
+
+/**
+ * @brief Positive test case of notification_list_get_next()
+ */
+static void utc_notification_list_get_next_p(void)
+{
+ notification_list_h list = NULL;
+ notification_list_h list_value = NULL;
+ notification_h notification_1 = NULL;
+ notification_h notification_2 = NULL;
+ notification_h notification_3 = NULL;
+ notification_h notification_4 = NULL;
+
+ notification_1 = notification_create(NOTIFICATION_TYPE_NOTI);
+ notification_2 = notification_create(NOTIFICATION_TYPE_NOTI);
+ notification_3 = notification_create(NOTIFICATION_TYPE_NOTI);
+ notification_4 = notification_create(NOTIFICATION_TYPE_NOTI);
+ list = notification_list_append(list, notification_1);
+ list = notification_list_append(list, notification_2);
+ list = notification_list_append(list, notification_3);
+ list = notification_list_append(list, notification_4);
+
+ /*Invalid parameter test*/
+ list = notification_list_get_head(list);
+ list_value = notification_list_get_next(list);
+ dts_check_ne("notification_list_get_next", list_value, NULL,
+ "Must return valid pointer in case of invalid parameter");
+}
+
+/**
+ * @brief Negative test case of notification_list_get_data()
+ */
+static void utc_notification_list_get_data_n(void)
+{
+ notification_list_h list = NULL;
+ notification_h value = NULL;
+ notification_h notification_1 = NULL;
+ notification_h notification_2 = NULL;
+ notification_h notification_3 = NULL;
+ notification_h notification_4 = NULL;
+
+ notification_1 = notification_create(NOTIFICATION_TYPE_NOTI);
+ notification_2 = notification_create(NOTIFICATION_TYPE_NOTI);
+ notification_3 = notification_create(NOTIFICATION_TYPE_NOTI);
+ notification_4 = notification_create(NOTIFICATION_TYPE_NOTI);
+ list = notification_list_append(list, notification_1);
+ list = notification_list_append(list, notification_2);
+ list = notification_list_append(list, notification_3);
+ list = notification_list_append(list, notification_4);
+
+ value = notification_list_get_data(NULL);
+ dts_check_eq("notification_list_get_data", value, NULL,
+ "Must return NULL in case of invalid parameter");
+}
+
+/**
+ * @brief Positive test case of notification_list_get_data()
+ */
+static void utc_notification_list_get_data_p(void)
+{
+ notification_list_h list = NULL;
+ notification_h value = NULL;
+ notification_h notification_1 = NULL;
+ notification_h notification_2 = NULL;
+ notification_h notification_3 = NULL;
+ notification_h notification_4 = NULL;
+
+ notification_1 = notification_create(NOTIFICATION_TYPE_NOTI);
+ notification_2 = notification_create(NOTIFICATION_TYPE_NOTI);
+ notification_3 = notification_create(NOTIFICATION_TYPE_NOTI);
+ notification_4 = notification_create(NOTIFICATION_TYPE_NOTI);
+ list = notification_list_append(list, notification_1);
+ list = notification_list_append(list, notification_2);
+ list = notification_list_append(list, notification_3);
+ list = notification_list_append(list, notification_4);
+
+ /*Invalid parameter test*/
+ value = notification_list_get_data(list);
+ dts_check_ne("notification_list_get_data", value, NULL,
+ "Must return valid pointer in case of invalid parameter");
+}
+
+/**
+ * @brief Negative test case of notification_list_append()
+ */
+static void utc_notification_list_append_n(void)
+{
+ notification_list_h list = NULL;
+ notification_h notification_1 = NULL;
+ notification_h notification_2 = NULL;
+ notification_h notification_3 = NULL;
+ notification_h notification_4 = NULL;
+
+ notification_1 = notification_create(NOTIFICATION_TYPE_NOTI);
+ notification_2 = notification_create(NOTIFICATION_TYPE_NOTI);
+ notification_3 = notification_create(NOTIFICATION_TYPE_NOTI);
+ notification_4 = notification_create(NOTIFICATION_TYPE_NOTI);
+ list = notification_list_append(list, NULL);
+ dts_check_eq("notification_list_append", list, NULL,
+ "Must return NULL in case of invalid parameter");
+}
+
+/**
+ * @brief Positive test case of notification_list_append()
+ */
+static void utc_notification_list_append_p(void)
+{
+ notification_list_h list = NULL;
+ notification_h notification_1 = NULL;
+ notification_h notification_2 = NULL;
+ notification_h notification_3 = NULL;
+ notification_h notification_4 = NULL;
+
+ notification_1 = notification_create(NOTIFICATION_TYPE_NOTI);
+ notification_2 = notification_create(NOTIFICATION_TYPE_NOTI);
+ notification_3 = notification_create(NOTIFICATION_TYPE_NOTI);
+ notification_4 = notification_create(NOTIFICATION_TYPE_NOTI);
+ list = notification_list_append(list, notification_1);
+ dts_check_ne("notification_list_append", list, NULL,
+ "Must return valid pointer in case of invalid parameter");
+}
+
+/**
+ * @brief Negative test case of notification_list_remove()
+ */
+static void utc_notification_list_remove_n(void)
+{
+ notification_list_h list = NULL;
+ notification_h notification_1 = NULL;
+ notification_h notification_2 = NULL;
+ notification_h notification_3 = NULL;
+ notification_h notification_4 = NULL;
+
+ notification_1 = notification_create(NOTIFICATION_TYPE_NOTI);
+ notification_2 = notification_create(NOTIFICATION_TYPE_NOTI);
+ notification_3 = notification_create(NOTIFICATION_TYPE_NOTI);
+ notification_4 = notification_create(NOTIFICATION_TYPE_NOTI);
+ list = notification_list_append(list, notification_1);
+ list = notification_list_append(list, notification_2);
+ list = notification_list_append(list, notification_3);
+ list = notification_list_append(list, notification_4);
+
+ list = notification_list_remove(NULL, NULL);
+ dts_check_eq("notification_list_remove", list, NULL,
+ "Must return NULL in case of invalid parameter");
+}
+
+/**
+ * @brief Positive test case of notification_list_remove()
+ */
+static void utc_notification_list_remove_p(void)
+{
+ notification_list_h list = NULL;
+ notification_h notification_1 = NULL;
+ notification_h notification_2 = NULL;
+ notification_h notification_3 = NULL;
+ notification_h notification_4 = NULL;
+
+ notification_1 = notification_create(NOTIFICATION_TYPE_NOTI);
+ notification_2 = notification_create(NOTIFICATION_TYPE_NOTI);
+ notification_3 = notification_create(NOTIFICATION_TYPE_NOTI);
+ notification_4 = notification_create(NOTIFICATION_TYPE_NOTI);
+ list = notification_list_append(list, notification_1);
+ list = notification_list_append(list, notification_2);
+ list = notification_list_append(list, notification_3);
+ list = notification_list_append(list, notification_4);
+
+ list = notification_list_remove(list, notification_1);
+ dts_check_ne("notification_list_remove", list, NULL,
+ "Must return valid pointer in case of invalid parameter");
+}
diff --git a/TC/testcase/utc_notification_setting.c b/TC/testcase/utc_notification_setting.c
new file mode 100644
index 0000000..8dc13db
--- /dev/null
+++ b/TC/testcase/utc_notification_setting.c
@@ -0,0 +1,114 @@
+/*
+ * 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 <unistd.h>
+#include <fcntl.h>
+#include <libintl.h>
+#include <tet_api.h>
+#include <notification.h>
+
+#define TEST_PKG "org.tizen.tetware"
+
+enum {
+ POSITIVE_TC_IDX = 0x01,
+ NEGATIVE_TC_IDX,
+};
+
+static void startup(void);
+static void cleanup(void);
+
+static void utc_notification_setting_property_set_n(void);
+static void utc_notification_setting_property_set_p(void);
+static void utc_notification_setting_property_get_n(void);
+static void utc_notification_setting_property_get_p(void);
+
+void (*tet_startup)(void) = startup;
+void (*tet_cleanup)(void) = cleanup;
+
+struct tet_testlist tet_testlist[] = {
+ {utc_notification_setting_property_set_n, NEGATIVE_TC_IDX},
+ {utc_notification_setting_property_set_p, POSITIVE_TC_IDX},
+ {utc_notification_setting_property_get_n, NEGATIVE_TC_IDX},
+ {utc_notification_setting_property_get_p, POSITIVE_TC_IDX},
+ { NULL, 0 },
+};
+
+static void startup(void)
+{
+ /* start of TC */
+ notification_clear(NOTIFICATION_TYPE_NONE);
+ tet_printf("\n TC start");
+}
+
+
+static void cleanup(void)
+{
+ /* end of TC */
+ tet_printf("\n TC end");
+}
+
+/**
+ * @brief Negative test case of notification_setting_property_set()
+ */
+static void utc_notification_setting_property_set_n(void)
+{
+ int ret;
+
+ ret = notification_setting_property_set(NULL, NULL, NULL);
+ dts_check_eq("notification_setting_property_set", ret, NOTIFICATION_ERROR_INVALID_DATA,
+ "Must return NOTIFICATION_ERROR_INVALID_DATA in case of invalid parameter");
+}
+
+/**
+ * @brief Positive test case of notification_setting_property_set()
+ */
+static void utc_notification_setting_property_set_p(void)
+{
+ int ret;
+
+ ret = notification_setting_property_set(TEST_PKG, "OPT_NOTIFICATION", "ON");
+ /*Invalid parameter test*/
+ dts_check_ne("notification_setting_property_set", ret, NOTIFICATION_ERROR_INVALID_DATA,
+ "Must return NOTIFICATION_ERROR_NONE in case of valid parameter");
+}
+
+/**
+ * @brief Negative test case of notification_setting_property_get()
+ */
+static void utc_notification_setting_property_get_n(void)
+{
+ int ret;
+
+ ret = notification_setting_property_get(NULL, NULL, NULL);
+ dts_check_eq("notification_setting_property_get", ret, NOTIFICATION_ERROR_INVALID_DATA,
+ "Must return NOTIFICATION_ERROR_INVALID_DATA in case of invalid parameter");
+}
+
+/**
+ * @brief Positive test case of notification_setting_property_get()
+ */
+static void utc_notification_setting_property_get_p(void)
+{
+ int ret;
+ char *value = NULL;
+
+ ret = notification_setting_property_get(TEST_PKG, "OPT_NOTIFICATION", &value);
+ dts_check_ne("notification_setting_property_get", ret, NOTIFICATION_ERROR_INVALID_DATA,
+ "Must return NOTIFICATION_ERROR_NONE in case of valid parameter");
+}
diff --git a/TC/testcase/utc_notification_status.c b/TC/testcase/utc_notification_status.c
new file mode 100644
index 0000000..0ff9a63
--- /dev/null
+++ b/TC/testcase/utc_notification_status.c
@@ -0,0 +1,131 @@
+/*
+ * 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 <unistd.h>
+#include <fcntl.h>
+#include <libintl.h>
+#include <tet_api.h>
+#include <notification.h>
+
+#define TEST_PKG "org.tizen.tetware"
+
+enum {
+ POSITIVE_TC_IDX = 0x01,
+ NEGATIVE_TC_IDX,
+};
+
+static void startup(void);
+static void cleanup(void);
+
+static void utc_notification_status_message_post_n(void);
+static void utc_notification_status_message_post_p(void);
+static void utc_notification_status_monitor_message_cb_set_n(void);
+static void utc_notification_status_monitor_message_cb_set_p(void);
+static void utc_notification_status_monitor_message_cb_unset_p(void);
+
+void (*tet_startup)(void) = startup;
+void (*tet_cleanup)(void) = cleanup;
+
+struct tet_testlist tet_testlist[] = {
+ {utc_notification_status_message_post_n, NEGATIVE_TC_IDX},
+ {utc_notification_status_message_post_p, POSITIVE_TC_IDX},
+ {utc_notification_status_monitor_message_cb_set_n, NEGATIVE_TC_IDX},
+ {utc_notification_status_monitor_message_cb_set_p, POSITIVE_TC_IDX},
+ {utc_notification_status_monitor_message_cb_unset_p, POSITIVE_TC_IDX},
+ { NULL, 0 },
+};
+
+static void startup(void)
+{
+ /* start of TC */
+ notification_clear(NOTIFICATION_TYPE_NONE);
+ tet_printf("\n TC start");
+}
+
+
+static void cleanup(void)
+{
+ /* end of TC */
+ tet_printf("\n TC end");
+}
+
+static void _message_callback(const char *message, void *data)
+{
+}
+
+/**
+ * @brief Negative test case of notification_status_message_post()
+ */
+static void utc_notification_status_message_post_n(void)
+{
+ int ret;
+
+ ret = notification_status_message_post(NULL);
+ dts_check_eq("notification_status_message_post", ret, NOTIFICATION_ERROR_INVALID_DATA,
+ "Must return NOTIFICATION_ERROR_INVALID_DATA in case of invalid parameter");
+}
+
+/**
+ * @brief Positive test case of notification_status_message_post()
+ */
+static void utc_notification_status_message_post_p(void)
+{
+ int ret;
+
+ ret = notification_status_message_post("TETWARE-P");
+ /*Invalid parameter test*/
+ dts_check_eq("notification_status_message_post", ret, NOTIFICATION_ERROR_NONE,
+ "Must return NOTIFICATION_ERROR_NONE in case of valid parameter");
+}
+
+/**
+ * @brief Negative test case of notification_status_monitor_message_cb_set()
+ */
+static void utc_notification_status_monitor_message_cb_set_n(void)
+{
+ int ret;
+
+ ret = notification_status_monitor_message_cb_set(NULL, NULL);
+ dts_check_eq("notification_status_message_post", ret, NOTIFICATION_ERROR_INVALID_DATA,
+ "Must return NOTIFICATION_ERROR_INVALID_DATA in case of invalid parameter");
+}
+
+/**
+ * @brief Positive test case of notification_status_monitor_message_cb_set()
+ */
+static void utc_notification_status_monitor_message_cb_set_p(void)
+{
+ int ret;
+
+ ret = notification_status_monitor_message_cb_set(_message_callback, NULL);
+ dts_check_eq("notification_status_monitor_message_cb_set", ret, NOTIFICATION_ERROR_NONE,
+ "Must return NOTIFICATION_ERROR_NONE in case of valid parameter");
+}
+
+/**
+ * @brief Positive test case of notification_status_monitor_message_cb_unset()
+ */
+static void utc_notification_status_monitor_message_cb_unset_p(void)
+{
+ int ret;
+
+ ret = notification_status_monitor_message_cb_unset();
+ dts_check_eq("notification_status_monitor_message_cb_unset", ret, NOTIFICATION_ERROR_NONE,
+ "Must return NOTIFICATION_ERROR_NONE in case of valid parameter");
+}
diff --git a/TC/tet_scen b/TC/tet_scen
new file mode 100644
index 0000000..03f029a
--- /dev/null
+++ b/TC/tet_scen
@@ -0,0 +1,7 @@
+all
+ ^TEST
+##### Scenarios for TEST #####
+
+# Test scenario
+TEST
+ :include:/testcase/tslist
diff --git a/TC/tetbuild.cfg b/TC/tetbuild.cfg
new file mode 100644
index 0000000..f7eda55
--- /dev/null
+++ b/TC/tetbuild.cfg
@@ -0,0 +1,5 @@
+TET_OUTPUT_CAPTURE=True # capture option for build operation checking
+TET_BUILD_TOOL=make # build with using make command
+TET_BUILD_FILE=-f Makefile # execution file (Makefile) for build
+TET_API_COMPLIANT=True # use TET API in Test Case ?
+TET_PASS_TC_NAME=True # report passed TC name in Journal file?
diff --git a/TC/tetclean.cfg b/TC/tetclean.cfg
new file mode 100644
index 0000000..2a0477a
--- /dev/null
+++ b/TC/tetclean.cfg
@@ -0,0 +1,5 @@
+TET_OUTPUT_CAPTURE=True # capture option
+TET_CLEAN_TOOL= make clean # clean tool
+TET_CLEAN_FILE= Makefile # file for clean
+TET_API_COMPLIANT=True # TET API useage
+TET_PASS_TC_NAME=True # showing name , passed TC
diff --git a/TC/tetexec.cfg b/TC/tetexec.cfg
new file mode 100644
index 0000000..ef3e452
--- /dev/null
+++ b/TC/tetexec.cfg
@@ -0,0 +1,5 @@
+TET_OUTPUT_CAPTURE=True # capturing execution or not
+TET_EXEC_TOOL= # ex) exec : execution tool set up/ Optional
+TET_EXEC_FILE= # ex) exectool : execution file/ Optional
+TET_API_COMPLIANT=True # Test case or Tool usesTET API?
+TET_PASS_TC_NAME=True # showing Passed TC name ?
diff --git a/debian/changelog b/debian/changelog
new file mode 100644
index 0000000..eb18b37
--- /dev/null
+++ b/debian/changelog
@@ -0,0 +1,183 @@
+libnotification (0.1.1-14) unstable; urgency=low
+
+ * remove VCONFKEY_SETAPPL_STATE_TICKER_NOTI_DISPLAY_CONTENT_BOOL
+ * Git: slp/pkgs/n/notification
+ * Tag: libnotification_0.1.1-14
+
+ -- Jeonghoon Park <jh1979.park@samsung.com> Tue, 17 Apr 2012 11:24:34 +0900
+
+libnotification (0.1.1-13) unstable; urgency=low
+
+ * add bundle package dependency for dev package
+ * Git: slp/pkgs/n/notification
+ * Tag: libnotification_0.1.1-13
+
+ -- Jeonghoon Park <jh1979.park@samsung.comp> Mon, 09 Apr 2012 16:34:18 +0900
+
+libnotification (0.1.1-12) unstable; urgency=low
+
+ * fix bugs on dbus connection (the applictions will exit if they unregisters their changed callback)
+ * Git: slp/pkgs/n/notification
+ * Tag: libnotification_0.1.1-12
+
+ -- Jeonghoon Park <jh1979.park@samsung.com> Tue, 20 Mar 2012 13:19:27 +0900
+
+libnotification (0.1.1-11) unstable; urgency=low
+
+ * fix pkgconfig file
+ * Git: slp/pkgs/n/notification
+ * Tag: libnotification_0.1.1-11
+
+ -- Jeonghoon Park <jh1979.park@samsung.com> Thu, 15 Mar 2012 23:48:41 +0900
+
+libnotification (0.1.1-10) unstable; urgency=low
+
+ * replace heynoti publish to dbus signal
+ * Git: slp/pkgs/n/notification
+ * Tag: libnotification_0.1.1-10
+
+ -- Jeonghoon Park <jh1979.park@samsung.com> Thu, 15 Mar 2012 19:57:19 +0900
+
+libnotification (0.1.1-9) unstable; urgency=low
+
+ * Add content update API
+ * Git: slp/pkgs/n/notification
+ * Tag: libnotification_0.1.1-9
+
+ -- Mi-Ju Lee <miju52.lee@samsung.com> Wed, 25 Jan 2012 21:32:38 +0900
+
+libnotification (0.1.1-8) unstable; urgency=low
+
+ * Remove deprecated API
+ * Git: slp/pkgs/n/notification
+ * Tag: libnotification_0.1.1-8
+
+ -- Mi-Ju Lee <miju52.lee@samsung.com> Thu, 12 Jan 2012 16:32:56 +0900
+
+libnotification (0.1.1-7) unstable; urgency=low
+
+ * Deprecate some of the unused API
+ * Git: slp/pkgs/n/notification
+ * Tag: libnotification_0.1.1-7
+
+ -- Mi-Ju Lee <miju52.lee@samsung.com> Wed, 04 Jan 2012 18:54:12 +0900
+
+libnotification (0.1.1-6) unstable; urgency=low
+
+ * Add Error type for update API
+ * Git: slp/pkgs/n/notification
+ * Tag: libnotification_0.1.1-6
+
+ -- Mi-Ju Lee <miju52.lee@samsung.com> Wed, 04 Jan 2012 15:47:28 +0900
+
+libnotification (0.1.1-5) unstable; urgency=low
+
+ * Add notification update function
+ * Git: slp/pkgs/n/notification
+ * Tag: libnotification_0.1.1-5
+
+ -- Mi-Ju Lee <miju52.lee@samsung.com> Mon, 26 Dec 2011 17:54:37 +0900
+
+libnotification (0.1.1-4) unstable; urgency=low
+
+ * Remove ip from changelog
+ * Git: slp/pkgs/n/notification
+ * Tag: libnotification_0.1.1-4
+
+ -- Mi-Ju Lee <miju52.lee@samsung.com> Mon, 19 Dec 2011 15:24:01 +0900
+
+libnotification (0.1.1-3) unstable; urgency=low
+
+ * Update boilerplate
+ * Git: slp-source.sec.samsung.net:slp/pkgs/n/notification
+ * Tag: libnotification_0.1.1-3
+
+ -- Mi-Ju Lee <miju52.lee@samsung.com> Tue, 06 Dec 2011 21:41:59 +0900
+
+libnotification (0.1.1-2) unstable; urgency=low
+
+ * Fix DB query to bind title key string
+ * Git: slp-source.sec.samsung.net:slp/pkgs/n/notification
+ * Tag: libnotification_0.1.1-2
+
+ -- Mi-Ju Lee <miju52.lee@samsung.com> Thu, 17 Nov 2011 11:11:48 +0900
+
+libnotification (0.1.1-1) unstable; urgency=low
+
+ * Update API(ver.0.1.1)
+ * Git: slp-source.sec.samsung.net:slp/pkgs/n/notification
+ * Tag: libnotification_0.1.1-1
+
+ -- Mi-Ju Lee <miju52.lee@samsung.com> Mon, 14 Nov 2011 18:10:11 +0900
+
+libnotification (0.1.0-9) unstable; urgency=low
+
+ * Apply Boilerplate
+ * Git: slp-source.sec.samsung.net:slp/pkgs/n/notification
+ * Tag: libnotification_0.1.0-9
+
+ -- Mi-Ju Lee <miju52.lee@samsung.com> Thu, 03 Nov 2011 17:29:12 +0900
+
+libnotification (0.1.0-8) unstable; urgency=low
+
+ * Add volatile property
+ * Git: slp-source.sec.samsung.net:slp/pkgs/n/notification
+ * Tag: libnotification_0.1.0-8
+
+ -- Mi-Ju Lee <miju52.lee@samsung.com> Thu, 20 Oct 2011 18:11:14 +0900
+
+libnotification (0.1.0-7) unstable; urgency=low
+
+ * Remove eina from pc file
+ * Git: slp-source.sec.samsung.net:slp/pkgs/n/notification
+ * Tag: libnotification_0.1.0-7
+
+ -- Mi-Ju Lee <miju52.lee@samsung.com> Tue, 18 Oct 2011 16:45:27 +0900
+
+libnotification (0.1.0-6) unstable; urgency=low
+
+ * Add API to select display app, Fix DB query error
+ * Git: slp-source.sec.samsung.net:slp/pkgs/n/notification
+ * Tag: libnotification_0.1.0-6
+
+ -- Mi-Ju Lee <miju52.lee@samsung.com> Mon, 17 Oct 2011 20:52:38 +0900
+
+libnotification (0.1.0-5) unstable; urgency=low
+
+ * Add New API for tigen UX, Merge noti and ongoing DB
+ * Git: slp-source.sec.samsung.net:slp/pkgs/n/notification
+ * Tag: libnotification_0.1.0-5
+
+ -- Mi-Ju Lee <miju52.lee@samsung.com> Mon, 10 Oct 2011 19:39:17 +0900
+
+libnotification (0.1.0-4) unstable; urgency=low
+
+ * Add caller pkgname set API
+ * Git: slp-source.sec.samsung.net:slp/pkgs/n/notification
+ * Tag: libnotification_0.1.0-4
+
+ -- Mi-Ju Lee <miju52.lee@samsung.com> Fri, 16 Sep 2011 13:16:18 +0900
+
+libnotification (0.1.0-3) unstable; urgency=low
+
+ * Fix prevent defect, bind query for insert error.
+ * Git: slp-source.sec.samsung.net:slp/pkgs/n/notification
+ * Tag: libnotification_0.1.0-3
+
+ -- Mi-Ju Lee <miju52.lee@samsung.com> Wed, 14 Sep 2011 22:30:35 +0900
+
+libnotification (0.1.0-2) unstable; urgency=low
+
+ * Add property for tickernoti, Remove content display option
+ * Git: slp-source.sec.samsung.net:slp/pkgs/n/notification
+ * Tag: libnotification_0.1.0-2
+
+ -- Mi-Ju Lee <miju52.lee@samsung.com> Wed, 07 Sep 2011 23:15:25 +0900
+
+libnotification (0.1.0-1) unstable; urgency=low
+
+ * Initial Release
+ * Git: slp-source.sec.samsung.net:slp/pkgs/n/notification
+ * Tag: libnotification_0.1.0-1
+
+ -- Mi-Ju Lee <miju52.lee@samsung.com> Tue, 30 Aug 2011 14:44:14 +0900
diff --git a/debian/compat b/debian/compat
new file mode 100644
index 0000000..7ed6ff8
--- /dev/null
+++ b/debian/compat
@@ -0,0 +1 @@
+5
diff --git a/debian/control b/debian/control
new file mode 100644
index 0000000..ebff257
--- /dev/null
+++ b/debian/control
@@ -0,0 +1,27 @@
+Source: libnotification
+Section: libs
+Priority: optional
+Maintainer: Jeonghoon Park <jh1979.park@samsung.com>, Youngjoo Park <yjoo93.park@samsung.com>
+Build-Depends: debhelper (>= 5), libsqlite3-dev, libslp-db-util-dev, libvconf-dev, libbundle-dev, libdbus-1-dev, dlog-dev, libail-0-dev, libaul-1-dev, libappsvc-dev, libdbus-glib-1-dev
+Standards-Version: 3.7.2
+
+Package: libnotification-dev
+Section: libdevel
+Architecture: any
+Depends: libnotification-0 (= ${Source-Version}), libbundle-dev
+Description: Notification library
+ This package contains devel content.
+
+Package: libnotification-0
+Section: libs
+Architecture: any
+Depends: ${shlibs:Depends}, ${misc:Depends}
+Description: Notification library
+ This package contains notification library.
+
+Package: libnotification-dbg
+Section: debug
+Architecture: any
+Depends: ${shlibs:Depends}, ${misc:Depends}, libnotification-0 (= ${Source-Version})
+Description: Notification library
+ This package is for debug
diff --git a/debian/libnotification-0.install.in b/debian/libnotification-0.install.in
new file mode 100644
index 0000000..bf766f0
--- /dev/null
+++ b/debian/libnotification-0.install.in
@@ -0,0 +1 @@
+@PREFIX@/lib/*.so*
diff --git a/debian/libnotification-0.postinst.in b/debian/libnotification-0.postinst.in
new file mode 100644
index 0000000..fcf05fb
--- /dev/null
+++ b/debian/libnotification-0.postinst.in
@@ -0,0 +1,92 @@
+#!/bin/sh
+
+
+if [ ! -d @DATADIR@/dbspace ]
+then
+ mkdir @DATADIR@/dbspace
+fi
+
+if [ ! -f @DATADIR@/dbspace/.notification.db ]
+then
+ sqlite3 @DATADIR@/dbspace/.notification.db 'PRAGMA journal_mode = PERSIST;
+ create table if not exists noti_list (
+ type INTEGER NOT NULL,
+ caller_pkgname TEXT NOT NULL,
+ launch_pkgname TEXT,
+ image_path TEXT,
+ group_id INTEGER default 0,
+ internal_group_id INTEGER default 0,
+ priv_id INTERGER NOT NULL,
+ title_key TEXT,
+ b_text TEXT,
+ b_key TEXT,
+ b_format_args TEXT,
+ num_format_args INTEGER default 0,
+ text_domain TEXT,
+ text_dir TEXT,
+ time INTEGER default 0,
+ insert_time INTEGER default 0,
+ args TEXT,
+ group_args TEXT,
+ b_execute_option TEXT,
+ b_service_responding TEXT,
+ b_service_single_launch TEXT,
+ b_service_multi_launch TEXT,
+ sound_type INTEGER default 0,
+ sound_path TEXT,
+ vibration_type INTEGER default 0,
+ vibration_path TEXT,
+ flags_for_property INTEGER default 0,
+ flag_simmode INTEGER default 0,
+ display_applist INTEGER,
+ progress_size DOUBLE default 0,
+ progress_percentage DOUBLE default 0,
+ rowid INTEGER PRIMARY KEY AUTOINCREMENT,
+ UNIQUE (caller_pkgname, priv_id)
+ );
+ create table if not exists noti_group_data (
+ caller_pkgname TEXT NOT NULL,
+ group_id INTEGER default 0,
+ badge INTEGER default 0,
+ title TEXT,
+ content TEXT,
+ loc_title TEXT,
+ loc_content TEXT,
+ count_display_title INTEGER,
+ count_display_content INTEGER,
+ rowid INTEGER PRIMARY KEY AUTOINCREMENT,
+ UNIQUE (caller_pkgname, group_id)
+ );
+ create table if not exists ongoing_list (
+ caller_pkgname TEXT NOT NULL,
+ launch_pkgname TEXT,
+ icon_path TEXT,
+ group_id INTEGER default 0,
+ internal_group_id INTEGER default 0,
+ priv_id INTERGER NOT NULL,
+ title TEXT,
+ content TEXT,
+ default_content TEXT,
+ loc_title TEXT,
+ loc_content TEXT,
+ loc_default_content TEXT,
+ text_domain TEXT,
+ text_dir TEXT,
+ args TEXT,
+ group_args TEXT,
+ flag INTEGER default 0,
+ progress_size DOUBLE default 0,
+ progress_percentage DOUBLE default 0,
+ rowid INTEGER PRIMARY KEY AUTOINCREMENT,
+ UNIQUE (caller_pkgname, priv_id)
+ );
+ '
+fi
+
+if [ ${USER} = "root" ]
+then
+ chown root:5000 @DATADIR@/dbspace/.notification.db
+ chown root:5000 @DATADIR@/dbspace/.notification.db-journal
+fi
+chmod 660 @DATADIR@/dbspace/.notification.db
+chmod 660 @DATADIR@/dbspace/.notification.db-journal
diff --git a/debian/libnotification-dev.install.in b/debian/libnotification-dev.install.in
new file mode 100644
index 0000000..0f2a4da
--- /dev/null
+++ b/debian/libnotification-dev.install.in
@@ -0,0 +1,2 @@
+@PREFIX@/include/*
+@PREFIX@/lib/pkgconfig/*.pc
diff --git a/debian/rules b/debian/rules
new file mode 100644
index 0000000..8cd299e
--- /dev/null
+++ b/debian/rules
@@ -0,0 +1,116 @@
+#!/usr/bin/make -f
+# -*- makefile -*-
+# Sample debian/rules that uses debhelper.
+# This file was originally written by Joey Hess and Craig Small.
+# As a special exception, when this file is copied by dh-make into a
+# dh-make output file, you may use that output file without restriction.
+# This special exception was added by Craig Small in version 0.37 of dh-make.
+
+# Uncomment this to turn on verbose mode.
+#export DH_VERBOSE=1
+
+CFLAGS ?= -Wall -g
+CXXFLAGS ?= -Wall -g
+LDFLAGS ?=
+PREFIX ?= /usr
+DATADIR ?= /opt
+
+ifneq (,$(findstring noopt,$(DEB_BUILD_OPTIONS)))
+ CFLAGS += -O0
+ CXXFLAGS += -O0
+else
+ CFLAGS += -O2
+ CXXFLAGS += -O2
+endif
+
+LDFLAGS += -Wl,--rpath=$(PREFIX)/lib -Wl,--as-needed
+
+CMAKE_BUILD_DIR ?= $(CURDIR)/cmake_build_tmp
+
+configure: configure-stamp
+configure-stamp:
+ dh_testdir
+ # Add here commands to configure the package.
+ mkdir -p $(CMAKE_BUILD_DIR) && cd $(CMAKE_BUILD_DIR) && \
+ CFLAGS="$(CFLAGS)" CXXFLAGS="$(CXXFLAGS)" LDFLAGS="$(LDFLAGS)" cmake .. -DCMAKE_INSTALL_PREFIX=$(PREFIX)
+
+ touch configure-stamp
+
+build: build-stamp
+
+build-stamp: configure-stamp
+ dh_testdir
+
+ # Add here commands to compile the package.
+ cd $(CMAKE_BUILD_DIR) && $(MAKE)
+
+ #docbook-to-man debian/wavplayer.sgml > wavplayer.1
+
+ for f in `find $(CURDIR)/debian/ -name "*.in"`; do \
+ cat $$f > $${f%.in}; \
+ sed -i -e "s#@PREFIX@#$(PREFIX)#g" $${f%.in}; \
+ sed -i -e "s#@DATADIR@#$(DATADIR)#g" $${f%.in}; \
+ done
+
+ touch $@
+
+clean:
+ dh_testdir
+ dh_testroot
+ rm -f build-stamp configure-stamp
+
+ rm -rf $(CMAKE_BUILD_DIR)
+
+ for f in `find $(CURDIR)/debian/ -name "*.in"`; do \
+ rm -f $${f%.in}; \
+ done
+
+ dh_clean
+
+install: build
+ dh_testdir
+ dh_testroot
+ dh_clean -k
+ dh_installdirs
+
+ # Add here commands to install the package into debian/wavplayer.
+ cd $(CMAKE_BUILD_DIR) && $(MAKE) DESTDIR=$(CURDIR)/debian/tmp install
+
+
+# Build architecture-independent files here.
+binary-indep: build install
+# We have nothing to do by default.
+
+# Build architecture-dependent files here.
+binary-arch: build install
+ dh_testdir
+ dh_testroot
+ dh_installchangelogs
+ dh_installdocs
+ dh_installexamples
+ dh_install --sourcedir=debian/tmp
+# dh_installmenu
+# dh_installdebconf
+# dh_installlogrotate
+# dh_installemacsen
+# dh_installpam
+# dh_installmime
+# dh_python
+# dh_installinit
+# dh_installcron
+# dh_installinfo
+ dh_installman
+ dh_link
+ dh_strip --dbg-package=libnotification-dbg
+ dh_compress
+ dh_fixperms
+# dh_perl
+ dh_makeshlibs
+ dh_installdeb
+ dh_shlibdeps
+ dh_gencontrol
+ dh_md5sums
+ dh_builddeb
+
+binary: binary-indep binary-arch
+.PHONY: build clean binary-indep binary-arch binary install configure
diff --git a/doc/notification_doc.h b/doc/notification_doc.h
new file mode 100644
index 0000000..2dac2af
--- /dev/null
+++ b/doc/notification_doc.h
@@ -0,0 +1,61 @@
+/*
+ * libnotification
+ *
+ * Copyright (c) 2000 - 2011 Samsung Electronics Co., Ltd. All rights reserved.
+ *
+ * Contact: Seungtaek Chung <seungtaek.chung@samsung.com>, Mi-Ju Lee <miju52.lee@samsung.com>, Xi Zhichan <zhichan.xi@samsung.com>
+ *
+ * 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.
+ *
+ */
+
+/**
+ *
+ * @defgroup NOTIFICATION_MODULE Notification
+ * @ingroup CAPI_APPLICATION_FRAMEWORK
+ * @brief Notification APIs
+ *
+ * @section NOTIFICATION_MODULE_HEADER Required Header
+ * \#include <notification.h>
+ * @section NOTIFICATION_MODULE_OVERVIEW Overview
+ * A notification is a message that is displayed on the notification area or the on-going area.
+ * It is created to notify information to the user through the application.
+ * This API provides functions for creating and inserting and updating notification.
+ *
+ */
+
+/**
+ * @internal
+ * @defgroup NOTIFICATION_LIST Notification List
+ * @ingroup NOTIFICATION_MODULE
+ * @brief linked list of notification data
+ *
+ * @section NOTIFICATION_LIST_MODULE_HEADER Required Header
+ * \#include <notification.h>
+ * @section NOTIFICATION_LIST_MODULE_OVERVIEW Overview
+ * It provides functions for handling notification list.
+ *
+ */
+
+/**
+ * @defgroup NOTIFICATION_STATUS Notification Status
+ * @ingroup NOTIFICATION_MODULE
+ * @brief APIs displaying plain text message on the indicator area
+ *
+ * @section NOTIFICATION_STATUS_MODULE_HEADER Required Header
+ * \#include <notification.h>
+ * @section NOTIFICATION_STATUS_MODULE_OVERVIEW Overview
+ * Notification status APIs
+ *
+ */
+
diff --git a/include/notification.h b/include/notification.h
new file mode 100644
index 0000000..a22b6e6
--- /dev/null
+++ b/include/notification.h
@@ -0,0 +1,1567 @@
+/*
+ * libnotification
+ *
+ * Copyright (c) 2000 - 2011 Samsung Electronics Co., Ltd. All rights reserved.
+ *
+ * Contact: Seungtaek Chung <seungtaek.chung@samsung.com>, Mi-Ju Lee <miju52.lee@samsung.com>, Xi Zhichan <zhichan.xi@samsung.com>
+ *
+ * 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 __NOTIFICATION_H__
+#define __NOTIFICATION_H__
+
+#include <time.h>
+#include <bundle.h>
+
+#include <notification_error.h>
+#include <notification_type.h>
+#include <notification_list.h>
+#include <notification_status.h>
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/**
+ * @file notification.h
+ * @brief This file contains the notification API.
+ */
+
+/**
+ * @addtogroup NOTIFICATION_MODULE
+ * @{
+ */
+
+/**
+ * @brief Sets an absolute path for an image file to display on the notification view.
+ * @since_tizen @if WEARABLE 2.3.1 @elseif MOBILE 2.3 @endif
+ * @param[in] noti The notification handle
+ * @param[in] type The notification image type
+ * @param[in] image_path The image file full path
+ * @return #NOTIFICATION_ERROR_NONE on success,
+ * otherwise any other value on failure
+ * @retval #NOTIFICATION_ERROR_NONE Success
+ * @retval #NOTIFICATION_ERROR_INVALID_PARAMETER Invalid parameter
+ * @pre Notification handle should be created by notification_create().
+ * @see #notification_image_type_e
+ * @see notification_create()
+ * @par Sample code:
+ * @code
+#include <notification.h>
+...
+{
+ notification_h noti = NULL;
+ int noti_err = NOTIFICATION_ERROR_NONE;
+
+ noti = notification_create(NOTIFICATION_TYPE_NOTI);
+ if(noti == NULL) {
+ return;
+ }
+
+ noti_err = notification_set_image(noti, NOTIFICATION_IMAGE_TYPE_ICON, APP_IMAGE_FULL_PATH);
+ if(noti_err != NOTIFICATION_ERROR_NONE) {
+ notification_free(noti);
+ return;
+ }
+}
+ * @endcode
+ */
+int notification_set_image(notification_h noti,
+ notification_image_type_e type,
+ const char *image_path);
+
+/**
+ * @brief Gets the absolute path of an image file.
+ * @since_tizen @if WEARABLE 2.3.1 @elseif MOBILE 2.3 @endif
+ * @remarks Do not free @a image_path. It will be freed when notification_free() is called.
+ * @param[in] noti Notification handle
+ * @param[in] type Notification image type
+ * @param[out] image_path image file full path
+ * @return NOTIFICATION_ERROR_NONE on success, other value on failure
+ * @retval NOTIFICATION_ERROR_NONE Success
+ * @retval NOTIFICATION_ERROR_INVALID_PARAMETER Invalid parameter
+ * @pre Notification handle should be created by notification_create().
+ * @see #notification_image_type_e
+ * @see notification_create()
+ * @par Sample code:
+ * @code
+ #include <notification.h>
+ ...
+ {
+ char *image_path = NULL;
+ int noti_err = NOTIFICATION_ERROR_NONE;
+
+ noti_err = notification_get_image(noti, NOTIFICATION_IMAGE_TYPE_ICON, &image_path);
+ if(noti_err != NOTIFICATION_ERROR_NONE) {
+ return;
+ }
+}
+ * @endcode
+ */
+int notification_get_image(notification_h noti,
+ notification_image_type_e type,
+ char **image_path);
+
+/**
+ * @brief Sets a timestamp.
+ * @details If input_time is @c 0, time information is taken from the current time.
+ * @since_tizen @if WEARABLE 2.3.1 @elseif MOBILE 2.3 @endif
+ * @param[in] noti The notification handle
+ * @param[in] input_time The input time
+ * @return #NOTIFICATION_ERROR_NONE on success,
+ * otherwise any other value on failure
+ * @retval #NOTIFICATION_ERROR_NONE Success
+ * @retval #NOTIFICATION_ERROR_INVALID_PARAMETER Invalid parameter
+ * @pre Notification handle should be created by notification_create().
+ * @see notification_create()
+ * @par Sample code:
+ * @code
+#include <notification.h>
+ ...
+ {
+ notification_h noti = NULL;
+ int noti_err = NOTIFICATION_ERROR_NONE;
+
+ noti = notification_create(NOTIFICATION_TYPE_NOTI);
+ if(noti == NULL) {
+ return;
+ }
+
+ noti_err = notification_set_time(noti, time(NULL));
+ if(noti_err != NOTIFICATION_ERROR_NONE) {
+ notification_free(noti);
+ return;
+ }
+ }
+ * @endcode
+ */
+int notification_set_time(notification_h noti,
+ time_t input_time);
+
+/**
+ * @brief Gets a timestamp.
+ * @details If ret_time is @c 0, time information is not set before.
+ * @since_tizen @if WEARABLE 2.3.1 @elseif MOBILE 2.3 @endif
+ * @param[in] noti The notification handle
+ * @param[out] ret_time The return time value
+ * @return #NOTIFICATION_ERROR_NONE on success,
+ * otherwise any other value on failure
+ * @retval #NOTIFICATION_ERROR_NONE Success
+ * @retval #NOTIFICATION_ERROR_INVALID_PARAMETER Invalid parameter
+ * @pre Notification handle should be created by notification_create().
+ * @see notification_create()
+ * @par Sample code:
+ * @code
+ #include <notification.h>
+ ...
+ {
+ time_t ret_time;
+ int noti_err = NOTIFICATION_ERROR_NONE;
+
+ noti_err = notification_get_time(noti, &ret_time);
+ if(noti_err != NOTIFICATION_ERROR_NONE) {
+ return;
+ }
+}
+ * @endcode
+ */
+int notification_get_time(notification_h noti,
+ time_t * ret_time);
+
+/**
+ * @brief Gets an insertion timestamp of the notification.
+ * @details If ret_time is @c 0, this notification data is not inserted before.
+ * @since_tizen @if WEARABLE 2.3.1 @elseif MOBILE 2.3 @endif
+ * @param[in] noti The notification handle
+ * @param[out] ret_time The return time value
+ * @return #NOTIFICATION_ERROR_NONE on success,
+ * otherwise any other value on failure
+ * @retval #NOTIFICATION_ERROR_NONE Success
+ * @retval #NOTIFICATION_ERROR_INVALID_PARAMETER Invalid parameter
+ * @par Sample code:
+ * @code
+ #include <notification.h>
+ ...
+ {
+ time_t ret_time;
+ int noti_err = NOTIFICATION_ERROR_NONE;
+
+ noti_err = notification_get_insert_time(noti, &ret_time);
+ if(noti_err != NOTIFICATION_ERROR_NONE) {
+ return;
+ }
+ }
+ * @endcode
+ */
+int notification_get_insert_time(notification_h noti,
+ time_t * ret_time);
+
+/**
+ * @brief Sets the text to display on the notification view.
+ * @details Sets title, content string. If the text is formatted data (only %d, %f, %s are supported), type - value pair should be set.
+ * If %d, the type #NOTIFICATION_VARIABLE_TYPE_INT and the value is an integer.
+ * If %f, the type #NOTIFICATION_VARIABLE_TYPE_DOUBLE and the value is a double.
+ * If %s, the type #NOTIFICATION_VARIABLE_TYPE_STRING and the value is a string.
+ * If the type is #NOTIFICATION_VARIABLE_TYPE_COUNT, notification count is displaying with text.
+ * If the value is #NOTIFICATION_COUNT_POS_LEFT, count is displayed at the left of the text.
+ * If the value is #NOTIFICATION_COUNT_POS_IN, count is displayed in the text when text has %d format.
+ * If the value is #NOTIFICATION_COUNT_POS_RIGHT, count is displayed at the right of the text.
+ * Variable parameters should be terminated #NOTIFICATION_VARIABLE_TYPE_NONE.
+ * @since_tizen @if WEARABLE 2.3.1 @elseif MOBILE 2.3 @endif
+ * @param[in] noti The notification handle
+ * @param[in] type The notification text type
+ * @param[in] text The basic text
+ * @param[in] key The text key for localization
+ * @param[in] args_type The variable parameter that type - value pair
+ * @return #NOTIFICATION_ERROR_NONE on success,
+ * otherwise any other value on failure
+ * @retval #NOTIFICATION_ERROR_NONE Success
+ * @retval #NOTIFICATION_ERROR_INVALID_PARAMETER Invalid parameter
+ * @pre notification handle should be created by notification_create().
+ * @par Sample code:
+ * @code
+#include <notification.h>
+...
+{
+ notification_h noti = NULL;
+ int noti_err = NOTIFICATION_ERROR_NONE;
+
+ noti = notification_create(NOTIFICATION_TYPE_NOTI);
+ if(noti == NULL) {
+ return;
+ }
+
+ noti_err = notification_set_text(noti, NOTIFICATION_TEXT_TYPE_TITLE, "I'm Title", "IDS_APP_BODY_IM_TITLE", NOTIFICATION_VARIABLE_TYPE_NONE);
+ if(noti_err != NOTIFICATION_ERROR_NONE) {
+ notification_free(noti);
+ return;
+ }
+}
+ * @endcode
+ */
+int notification_set_text(notification_h noti,
+ notification_text_type_e type,
+ const char *text,
+ const char *key,
+ int args_type, ...);
+
+/**
+ * @brief Gets the text from the notification handle.
+ * @since_tizen @if WEARABLE 2.3.1 @elseif MOBILE 2.3 @endif
+ * @param[in] noti The notification handle
+ * @param[in] type The notification text type
+ * @param[out] text The notification text
+ * @return #NOTIFICATION_ERROR_NONE on success,
+ * otherwise any other value on failure
+ * @retval #NOTIFICATION_ERROR_NONE Success
+ * @retval #NOTIFICATION_ERROR_INVALID_PARAMETER Invalid parameter
+ * @par Sample code:
+ * @code
+#include <notification.h>
+...
+{
+ notification_h noti = NULL;
+ int noti_err = NOTIFICATION_ERROR_NONE;
+ char *text = NULL;
+
+ noti_err = notification_get_text(noti, NOTIFICATION_TEXT_TYPE_TITLE, &text);
+ if(noti_err != NOTIFICATION_ERROR_NONE) {
+ return;
+ }
+}
+ * @endcode
+ */
+int notification_get_text(notification_h noti,
+ notification_text_type_e type,
+ char **text);
+
+/**
+ * @brief Sets the timestamp to display on the notification view.
+ * @details The timestamp will be converted to a formatted string and it will be displayed on the set text area.
+ * @since_tizen @if WEARABLE 2.3.1 @elseif MOBILE 2.3 @endif
+ * @param[in] noti The notification handle
+ * @param[in] type The notification text type
+ * @param[in] time The timestamp
+ * @return #NOTIFICATION_ERROR_NONE on success,
+ * otherwise any other value on failure
+ * @retval #NOTIFICATION_ERROR_NONE Success
+ * @retval #NOTIFICATION_ERROR_INVALID_PARAMETER Invalid parameter
+ * @pre Notification handle should be created by notification_create().
+ */
+int notification_set_time_to_text(notification_h noti, notification_text_type_e type,
+ time_t time);
+
+/**
+ * @brief Gets the timestamp from the notification handle.
+ * @since_tizen @if WEARABLE 2.3.1 @elseif MOBILE 2.3 @endif
+ * @param[in] noti The notification handle
+ * @param[in] type The notification text type
+ * @param[in] time The pointer of time stamp
+ * @return #NOTIFICATION_ERROR_NONE on success,
+ * otherwise any other value on failure
+ * @retval #NOTIFICATION_ERROR_NONE Success
+ * @retval #NOTIFICATION_ERROR_INVALID_PARAMETER Invalid parameter
+ * @pre Notification handle should be created by notification_create().
+ */
+int notification_get_time_from_text(notification_h noti, notification_text_type_e type,
+ time_t *time);
+
+/**
+ * @internal
+ * @brief Sets the text domain to localize the notification.
+ * @since_tizen @if WEARABLE 2.3.1 @elseif MOBILE 2.3 @endif
+ * @param[in] noti The notification handle
+ * @param[in] domain The text domain
+ * @param[in] dir The text dir
+ * @return #NOTIFICATION_ERROR_NONE on success,
+ * otherwise any other value on failure
+ * @retval #NOTIFICATION_ERROR_NONE Success
+ * @retval #NOTIFICATION_ERROR_INVALID_PARAMETER Invalid parameter
+ * @par Sample code:
+ * @code
+#include <notification.h>
+...
+{
+ notification_h noti = NULL;
+ int noti_err = NOTIFICATION_ERROR_NONE;
+
+ noti = notification_create(NOTIFICATION_TYPE_NOTI);
+ if(noti == NULL) {
+ return;
+ }
+
+ noti_err = notification_set_text_domain(noti, PACKAGE, LOCALEDIR);
+ if(noti_err != NOTIFICATION_ERROR_NONE) {
+ notification_free(noti);
+ return;
+ }
+}
+ * @endcode
+ */
+int notification_set_text_domain(notification_h noti,
+ const char *domain,
+ const char *dir);
+
+/**
+ * @internal
+ * @brief Gets the text domain from the notification handle.
+ * @since_tizen @if WEARABLE 2.3.1 @elseif MOBILE 2.3 @endif
+ * @remarks Do not free returned domain and dir. They are freed when notification_free() or notification_free_list() is called.
+ * @param[in] noti The notification handle
+ * @param[out] domain The domain
+ * @param[out] dir The locale dir
+ * @return #NOTIFICATION_ERROR_NONE on success,
+ * otherwise any other value on failure
+ * @retval #NOTIFICATION_ERROR_NONE Success
+ * @retval #NOTIFICATION_ERROR_INVALID_PARAMETER Invalid parameter
+ * @par Sample code:
+ * @code
+#include <notification.h>
+...
+{
+ notification_h noti = NULL;
+ int noti_err = NOTIFICATION_ERROR_NONE;
+ char *domain = NULL;
+ char *dir = NULL;
+
+ noti_err = notification_get_text_domain(noti, &domain, &dir);
+ if(noti_err != NOTIFICATION_ERROR_NONE) {
+ return;
+ }
+}
+ * @endcode
+ */
+int notification_get_text_domain(notification_h noti,
+ char **domain,
+ char **dir);
+
+/**
+ * @brief Sets the sound type for the notification.
+ * @since_tizen @if WEARABLE 2.3.1 @elseif MOBILE 2.3 @endif
+ * @param[in] noti The notification handle
+ * @param[in] type The notification sound type
+ * @param[in] path The user sound file path
+ * @return #NOTIFICATION_ERROR_NONE on success,
+ * otherwise any other value on failure
+ * @retval #NOTIFICATION_ERROR_NONE Success
+ * @retval #NOTIFICATION_ERROR_INVALID_PARAMETER Invalid parameter
+ * @par Sample code:
+ * @code
+#include <notification.h>
+...
+{
+ notification_h noti = NULL;
+ int noti_err = NOTIFICATION_ERROR_NONE;
+
+ noti_err = notification_set_sound(noti, NOTIFICATION_SOUND_TYPE_DEFAULT, NULL);
+ if(noti_err != NOTIFICATION_ERROR_NONE) {
+ return;
+ }
+}
+ * @endcode
+ */
+int notification_set_sound(notification_h noti,
+ notification_sound_type_e type,
+ const char *path);
+
+/**
+ * @brief Gets the sound type from the notification handle.
+ * @since_tizen @if WEARABLE 2.3.1 @elseif MOBILE 2.3 @endif
+ * @param[in] noti The notification handle
+ * @param[out] type The notification sound type
+ * @param[out] path The user sound file path
+ * @return #NOTIFICATION_ERROR_NONE on success,
+ * otherwise any other value on failure
+ * @retval #NOTIFICATION_ERROR_NONE Success
+ * @retval #NOTIFICATION_ERROR_INVALID_PARAMETER Invalid parameter
+ * @par Sample code:
+ * @code
+#include <notification.h>
+...
+{
+ notification_h noti = NULL;
+ int noti_err = NOTIFICATION_ERROR_NONE;
+ notification_sound_type_e type = NOTIFICATION_SOUND_TYPE_NONE;
+
+ noti_err = notification_get_sound(noti, &type, NULL);
+ if(noti_err != NOTIFICATION_ERROR_NONE) {
+ return;
+ }
+}
+ * @endcode
+ */
+int notification_get_sound(notification_h noti,
+ notification_sound_type_e *type,
+ const char **path);
+
+/**
+ * @brief Sets the vibration type for the notification.
+ * @since_tizen @if WEARABLE 2.3.1 @elseif MOBILE 2.3 @endif
+ * @param[in] noti The notification handle
+ * @param[in] type The notification vibration type
+ * @param[in] path The user vibration file path
+ * @return #NOTIFICATION_ERROR_NONE on success,
+ * otherwise any other value on failure
+ * @retval #NOTIFICATION_ERROR_NONE Success
+ * @retval #NOTIFICATION_ERROR_INVALID_PARAMETER Invalid parameter
+ * @par Sample code:
+ * @code
+#include <notification.h>
+...
+{
+ notification_h noti = NULL;
+ int noti_err = NOTIFICATION_ERROR_NONE;
+
+ noti_err = notification_set_vibration(noti, NOTIFICATION_VIBRATION_TYPE_DEFAULT, NULL);
+ if(noti_err != NOTIFICATION_ERROR_NONE) {
+ return;
+ }
+}
+ * @endcode
+ */
+int notification_set_vibration(notification_h noti,
+ notification_vibration_type_e type,
+ const char *path);
+
+/**
+ * @brief Gets the vibrate type from the notification handle.
+ * @since_tizen @if WEARABLE 2.3.1 @elseif MOBILE 2.3 @endif
+ * @param[in] noti The notification handle
+ * @param[out] type The notification sound type
+ * @param[out] path The user vibration file path
+ * @return #NOTIFICATION_ERROR_NONE on success,
+ * otherwise other value on failure
+ * @retval #NOTIFICATION_ERROR_NONE Success
+ * @retval #NOTIFICATION_ERROR_INVALID_PARAMETER Invalid parameter
+ * @par Sample code:
+ * @code
+#include <notification.h>
+...
+ {
+ notification_h noti = NULL;
+ int noti_err = NOTIFICATION_ERROR_NONE;
+ notification_vibration_type_e type = NOTIFICATION_VIBRATION_TYPE_NONE;
+
+ noti_err = notification_get_vibration(noti, &type, NULL);
+ if(noti_err != NOTIFICATION_ERROR_NONE) {
+ return;
+ }
+}
+ * @endcode
+ */
+int notification_get_vibration(notification_h noti,
+ notification_vibration_type_e *type,
+ const char **path);
+
+/**
+ * @brief Sets the LED displaying option.
+ * @since_tizen @if WEARABLE 2.3.1 @elseif MOBILE 2.3 @endif
+ * @param[in] noti The notification handle
+ * @param[in] operation The LED notification operation
+ * @param[in] led_argb The notification led color
+ * @return #NOTIFICATION_ERROR_NONE on success,
+ * otherwise other value on failure
+ * @retval #NOTIFICATION_ERROR_NONE Success
+ * @retval #NOTIFICATION_ERROR_INVALID_PARAMETER Invalid parameter
+ * @par Sample code:
+ * @code
+#include <notification.h>
+...
+{
+ notification_h noti = NULL;
+ int noti_err = NOTIFICATION_ERROR_NONE;
+
+ noti_err = notification_set_led(noti, NOTIFICATION_LED_TYPE_DEFAULT, NULL);
+ if(noti_err != NOTIFICATION_ERROR_NONE) {
+ return;
+ }
+}
+ * @endcode
+ */
+int notification_set_led(notification_h noti,
+ notification_led_op_e operation,
+ int led_argb);
+
+/**
+ * @brief Gets the LED displaying option from the notification handle.
+ * @since_tizen @if WEARABLE 2.3.1 @elseif MOBILE 2.3 @endif
+ * @param[in] noti The notification handle
+ * @param[out] operation The LED notification operation
+ * @param[out] led_argb The notification LED color
+ * @return #NOTIFICATION_ERROR_NONE on success,
+ * otherwise any other value on failure
+ * @retval #NOTIFICATION_ERROR_NONE Success
+ * @retval #NOTIFICATION_ERROR_INVALID_PARAMETER Invalid parameter
+ * @par Sample code:
+ * @code
+#include <notification.h>
+...
+ {
+ notification_h noti = NULL;
+ int noti_err = NOTIFICATION_ERROR_NONE;
+ notification_led_type_e type = NOTIFICATION_LED_TYPE_NONE;
+
+ noti_err = notification_get_led(noti, &type, NULL);
+ if(noti_err != NOTIFICATION_ERROR_NONE) {
+ return;
+ }
+}
+ * @endcode
+ */
+int notification_get_led(notification_h noti,
+ notification_led_op_e *operation,
+ int *led_argb);
+
+/**
+ * @brief Sets the time period of flashing the LED.
+ * @since_tizen @if WEARABLE 2.3.1 @elseif MOBILE 2.3 @endif
+ * @param[in] noti The notification handle
+ * @param[in] on_ms The time for turning on the LED
+ * @param[in] off_ms The time for turning off the LED
+ * @return #NOTIFICATION_ERROR_NONE on success,
+ * otherwise any other value on failure
+ * @retval #NOTIFICATION_ERROR_NONE Success
+ * @retval #NOTIFICATION_ERROR_INVALID_PARAMETER Invalid parameter
+ * @par Sample code:
+ * @code
+#include <notification.h>
+...
+{
+ notification_h noti = NULL;
+ int noti_err = NOTIFICATION_ERROR_NONE;
+
+ noti_err = notification_set_led_time_period(noti, 100, 100);
+ if(noti_err != NOTIFICATION_ERROR_NONE) {
+ return;
+ }
+}
+ * @endcode
+ */
+int notification_set_led_time_period(notification_h noti,
+ int on_ms, int off_ms);
+
+/**
+ * @brief Gets the time period of flashing the LED from the notification handle.
+ * @since_tizen @if WEARABLE 2.3.1 @elseif MOBILE 2.3 @endif
+ * @param[in] noti The notification handle
+ * @param[out] on_ms The time for turning on the LED
+ * @param[out] off_ms The time for turning on the LED
+ * @return #NOTIFICATION_ERROR_NONE on success,
+ * otherwise any other value on failure
+ * @retval #NOTIFICATION_ERROR_NONE Success
+ * @retval #NOTIFICATION_ERROR_INVALID_PARAMETER Invalid parameter
+ * @par Sample code:
+ * @code
+#include <notification.h>
+...
+ {
+ notification_h noti = NULL;
+ int noti_err = NOTIFICATION_ERROR_NONE;
+ int led_on_ms = 0;
+ int led_off_ms = 0;
+
+ noti_err = notification_get_led_time_period(noti, &led_on_ms, &led_off_ms);
+ if(noti_err != NOTIFICATION_ERROR_NONE) {
+ return;
+ }
+}
+ * @endcode
+ */
+int notification_get_led_time_period(notification_h noti,
+ int *on_ms, int *off_ms);
+
+/**
+ * @brief Sets the launch option for a notification.
+ * @details When notification data selected in display application, application launched by app_control_send_launch_request with app_control handle.
+ * @since_tizen @if WEARABLE 2.3.1 @elseif MOBILE 2.3 @endif
+ * @param[in] noti The notification handle
+ * @param[in] type Launching option type
+ * @param[in] option App Control handler
+ * @return #NOTIFICATION_ERROR_NONE on success,
+ * otherwise any other value on failure
+ * @retval #NOTIFICATION_ERROR_NONE Success
+ * @retval #NOTIFICATION_ERROR_INVALID_PARAMETER Invalid parameter
+ * @par Sample code:
+ * @code
+#include <notification.h>
+...
+{
+ notification_h noti = NULL;
+ app_control_h app_control = NULL;
+ int noti_err = NOTIFICATION_ERROR_NONE;
+
+ ...
+
+ app_control_create(&app_control);
+ app_control_set_app_id(app_control, "org.tizen.app");
+
+ ...
+
+ noti_err = notification_set_launch_option(noti, NOTIFICATION_LAUNCH_OPTION_APP_CONTROL, (void *)app_control);
+ if(noti_err != NOTIFICATION_ERROR_NONE) {
+ notification_free(noti);
+ return;
+ }
+
+ app_control_destroy(app_control);
+}
+ * @endcode
+ */
+int notification_set_launch_option(notification_h noti,
+ notification_launch_option_type type, void *option);
+
+/**
+ * @brief Gets the launch option from the notification handle.
+ * @since_tizen @if WEARABLE 2.3.1 @elseif MOBILE 2.3 @endif
+ * @remarks You must release @a app_control using app_control_destroy().
+ * @param[in] noti The notification handle
+ * @param[in] type Launching option type
+ * @param[out] option The pointer of App Control handler
+ * @return #NOTIFICATION_ERROR_NONE on success,
+ * otherwise any other value on failure
+ * @retval #NOTIFICATION_ERROR_NONE Success
+ * @retval #NOTIFICATION_ERROR_INVALID_PARAMETER Invalid parameter
+ * @par Sample code:
+ * @code
+#include <notification.h>
+...
+{
+ app_control_h app_control = NULL;
+ app_control_create(&app_control);
+
+ ...
+
+ noti_err = notification_get_launch_option(noti, NOTIFICATION_LAUNCH_OPTION_APP_CONTROL, (void *)&app_control);
+ if(noti_err != NOTIFICATION_ERROR_NONE) {
+ notification_free(noti);
+ return;
+ }
+}
+ * @endcode
+ */
+int notification_get_launch_option(notification_h noti,
+ notification_launch_option_type type, void *option);
+
+/**
+ * @brief Sets the property of the notification.
+ * @since_tizen @if WEARABLE 2.3.1 @elseif MOBILE 2.3 @endif
+ * @param[in] noti The notification handle
+ * @param[in] flags The property with | operation
+ * @return #NOTIFICATION_ERROR_NONE on success,
+ * otherwise any other value on failure
+ * @retval #NOTIFICATION_ERROR_NONE Success
+ * @retval #NOTIFICATION_ERROR_INVALID_PARAMETER Invalid input value
+ * @par Sample code:
+ * @code
+#include <notification.h>
+...
+{
+ notification_h noti = NULL;
+ int noti_err = NOTIFICATION_ERROR_NONE;
+ bundle *b = NULL;
+
+ noti = notification_create(NOTIFICATION_TYPE_NOTI);
+ if(noti == NULL) {
+ return;
+ }
+
+ noti_err = notification_set_property(noti, NOTIFICATION_PROP_DISPLAY_ONLY_SIMMODE | NOTIFICATION_PROP_DISABLE_APP_LAUNCH);
+ if(noti_err != NOTIFICATION_ERROR_NONE) {
+ notification_free(noti);
+ return;
+ }
+}
+ * @endcode
+ */
+int notification_set_property(notification_h noti,
+ int flags);
+
+/**
+ * @brief Gets the property of the notification from the notification handle.
+ * @since_tizen @if WEARABLE 2.3.1 @elseif MOBILE 2.3 @endif
+ * @param[in] noti The notification handle
+ * @param[out] flags The notification property
+ * @return #NOTIFICATION_ERROR_NONE on success,
+ * otherwise any other value on failure
+ * @retval #NOTIFICATION_ERROR_NONE Success
+ * @retval #NOTIFICATION_ERROR_INVALID_PARAMETER Invalid input value
+ * @par Sample code:
+ * @code
+#include <notification.h>
+...
+{
+ notification_h noti = NULL;
+ int noti_err = NOTIFICATION_ERROR_NONE;
+ int flags = 0;
+
+ noti_err = notification_get_property(noti, &flags);
+ if(noti_err != NOTIFICATION_ERROR_NONE) {
+ return;
+ }
+}
+ * @endcode
+ */
+int notification_get_property(notification_h noti,
+ int *flags);
+
+/**
+ * @brief Sets applications to display the notification.
+ * @details All display application is enable(NOTIFICATION_DISPLAY_APP_ALL) if you are not call this API.
+ * @since_tizen @if WEARABLE 2.3.1 @elseif MOBILE 2.3 @endif
+ * @param[in] noti The notification handle
+ * @param[in] applist The with | operation
+ * @return #NOTIFICATION_ERROR_NONE on success,
+ * otherwise any other value on failure
+ * @retval #NOTIFICATION_ERROR_NONE Success
+ * @retval #NOTIFICATION_ERROR_INVALID_PARAMETER Invalid input value
+ * @par Sample code:
+ * @code
+#include <notification.h>
+...
+{
+ notification_h noti = NULL;
+ int noti_err = NOTIFICATION_ERROR_NONE;
+ bundle *b = NULL;
+
+ noti = notification_create(NOTIFICATION_TYPE_NOTI);
+ if(noti == NULL) {
+ return;
+ }
+
+ noti_err = notification_set_display_applist(noti, NOTIFICATION_DISPLAY_APP_NOTIFICATION_TRAY | NOTIFICATION_DISPLAY_APP_TICKER);
+ if(noti_err != NOTIFICATION_ERROR_NONE) {
+ notification_free(noti);
+ return;
+ }
+}
+}
+ * @endcode
+ */
+int notification_set_display_applist(notification_h noti,
+ int applist);
+
+/**
+ * @brief Gets the application list displaying the notification from the notification handle.
+ * @since_tizen @if WEARABLE 2.3.1 @elseif MOBILE 2.3 @endif
+ * @param[in] noti The notification handle
+ * @param[out] applist The display application list
+ * @return #NOTIFICATION_ERROR_NONE on success,
+ * otherwise any other value on failure
+ * @retval #NOTIFICATION_ERROR_NONE Success
+ * @retval #NOTIFICATION_ERROR_INVALID_PARAMETER Invalid input value
+ * @par Sample code:
+ * @code
+#include <notification.h>
+...
+{
+ notification_h noti = NULL;
+ int noti_err = NOTIFICATION_ERROR_NONE;
+ int applist = 0;
+
+ noti_err = notification_get_display_applist(noti, &applist);
+ if(noti_err != NOTIFICATION_ERROR_NONE) {
+ return;
+ }
+}
+ * @endcode
+ */
+int notification_get_display_applist(notification_h noti,
+ int *applist);
+
+/**
+ * @brief Sets the initial size for the ongoing type.
+ * @details After notification_post() call, the size is not updated.
+ * @since_tizen @if WEARABLE 2.3.1 @elseif MOBILE 2.3 @endif
+ * @param[in] noti The notification handle
+ * @param[in] size The double type size
+ * @return #NOTIFICATION_ERROR_NONE on success,
+ * otherwise any other value on failure
+ * @retval #NOTIFICATION_ERROR_NONE Success
+ * @retval #NOTIFICATION_ERROR_INVALID_PARAMETER Invalid input value
+ * @par Sample code:
+ * @code
+#include <notification.h>
+...
+{
+ notification_h noti = NULL;
+ int noti_err = NOTIFICATION_ERROR_NONE;
+
+ noti = notification_create(NOTIFICATION_TYPE_NOTI);
+ if(noti == NULL) {
+ return;
+ }
+
+ noti_err = notification_set_size(noti, 0.0);
+ if(noti_err != NOTIFICATION_ERROR_NONE) {
+ notification_free(noti);
+ return;
+ }
+}
+ * @endcode
+ */
+int notification_set_size(notification_h noti,
+ double size);
+
+/**
+ * @brief Gets the progress size.
+ * @since_tizen @if WEARABLE 2.3.1 @elseif MOBILE 2.3 @endif
+ * @param[in] noti The notification handle
+ * @param[out] size The progress size
+ * @return #NOTIFICATION_ERROR_NONE on success,
+ * otherwise any other value on failure
+ * @retval #NOTIFICATION_ERROR_NONE Success
+ * @retval #NOTIFICATION_ERROR_INVALID_PARAMETER Invalid input value
+ * @par Sample code:
+ * @code
+#include <notification.h>
+...
+{
+ notification_h noti = NULL;
+ int noti_err = NOTIFICATION_ERROR_NONE;
+ double size = 0.0;
+
+ noti_err = notification_get_size(noti, &size);
+ if(noti_err != NOTIFICATION_ERROR_NONE) {
+ return;
+ }
+}
+ * @endcode
+ */
+int notification_get_size(notification_h noti,
+ double *size);
+
+/**
+ * @brief Sets the initial progress for the ongoing type.
+ * @details After the notification_post() call, the progress is not updated.
+ * @since_tizen @if WEARABLE 2.3.1 @elseif MOBILE 2.3 @endif
+ * @param[in] noti The notification handle
+ * @param[in] percentage The progress percentage
+ * @return #NOTIFICATION_ERROR_NONE on success,
+ * otherwise any other value on failure
+ * @retval #NOTIFICATION_ERROR_NONE Success
+ * @retval #NOTIFICATION_ERROR_INVALID_PARAMETER Invalid input value
+ * @par Sample code:
+ * @code
+#include <notification.h>
+...
+{
+ notification_h noti = NULL;
+ int noti_err = NOTIFICATION_ERROR_NONE;
+
+ noti = notification_create(NOTIFICATION_TYPE_NOTI);
+ if(noti == NULL) {
+ return;
+ }
+
+ noti_err = notification_set_progress(noti, 0.0);
+ if(noti_err != NOTIFICATION_ERROR_NONE) {
+ notification_free(noti);
+ return;
+ }
+}
+ * @endcode
+ */
+int notification_set_progress(notification_h noti,
+ double percentage);
+
+/**
+ * @brief Gets the progress from the notification handle.
+ * @since_tizen @if WEARABLE 2.3.1 @elseif MOBILE 2.3 @endif
+ * @remarks At the end of the operation, the progress should be @c 1.0.
+ * @param[in] noti The notification handle
+ * @param[out] percentage The progress percentage
+ * @return #NOTIFICATION_ERROR_NONE on success,
+ * otherwise any other value on failure
+ * @retval #NOTIFICATION_ERROR_NONE Success
+ * @retval #NOTIFICATION_ERROR_INVALID_PARAMETER Invalid input value
+ * @par Sample code:
+ * @code
+#include <notification.h>
+...
+{
+ notification_h noti = NULL;
+ int noti_err = NOTIFICATION_ERROR_NONE;
+ double percentage = 0.0;
+
+ noti_err = notification_get_progress(noti, &percentage);
+ if(noti_err != NOTIFICATION_ERROR_NONE) {
+ return;
+ }
+}
+ * @endcode
+ */
+int notification_get_progress(notification_h noti,
+ double *percentage);
+
+/**
+ * @brief Sets the layout of the notification view.
+ * @details Caller can set displaying layout of notification.
+ * @since_tizen @if WEARABLE 2.3.1 @elseif MOBILE 2.3 @endif
+ * @param[in] noti The notification handle
+ * @param[in] layout The type of layout
+ * @return #NOTIFICATION_ERROR_NONE on success,
+ * otherwise any other value on failure
+ * @retval #NOTIFICATION_ERROR_NONE Success
+ * @retval #NOTIFICATION_ERROR_INVALID_PARAMETER Invalid input value
+ * @see #notification_ly_type_e
+ */
+int notification_set_layout(notification_h noti,
+ notification_ly_type_e layout);
+
+/**
+ * @brief Gets the layout of the notification view from the notification handle.
+ * @since_tizen @if WEARABLE 2.3.1 @elseif MOBILE 2.3 @endif
+ * @param[in] noti The notification handle
+ * @param[out] layout The type of layout
+ * @return #NOTIFICATION_ERROR_NONE on success,
+ * otherwise any other value on failure
+ * @retval #NOTIFICATION_ERROR_NONE Success
+ * @retval #NOTIFICATION_ERROR_INVALID_PARAMETER Invalid input value
+ * @see #notification_ly_type_e
+ */
+int notification_get_layout(notification_h noti,
+ notification_ly_type_e *layout);
+
+/**
+ * @brief Gets the type of a notification.
+ * @since_tizen @if WEARABLE 2.3.1 @elseif MOBILE 2.3 @endif
+ * @param[in] noti The notification handle
+ * @param[out] type The notification type
+ * @return #NOTIFICATION_ERROR_NONE on success,
+ * otherwise any other value on failure
+ * @retval #NOTIFICATION_ERROR_NONE Success
+ * @retval #NOTIFICATION_ERROR_INVALID_PARAMETER Invalid parameter
+ * @par Sample code:
+ * @code
+#include <notification.h>
+...
+ {
+ int noti_err = NOTIFICATION_ERROR_NONE;
+ notification_type_e type;
+
+ noti_err = notification_get_type(noti, &type);
+ if(noti_err != NOTIFICATION_ERROR_NONE) {
+ return;
+ }
+}
+ * @endcode
+ */
+int notification_get_type(notification_h noti,
+ notification_type_e * type);
+
+/**
+ * @internal
+ * @brief Inserts a notification.
+ * @details The notification will be inserted to the database and then it will appear in the notification area.
+ * When notification_create() is called, if priv_id is #NOTIFICATION_PRIV_ID_NONE, priv_id returns the internally set priv_id.
+ * @since_tizen @if WEARABLE 2.3.1 @elseif MOBILE 2.3 @endif
+ * @privlevel public
+ * @privilege %http://tizen.org/privilege/notification
+ * @param[in] noti The notification handle
+ * @param[out] priv_id The private ID
+ * @return #NOTIFICATION_ERROR_NONE on success,
+ * otherwise any other value on failure
+ * @retval #NOTIFICATION_ERROR_NONE Success
+ * @retval #NOTIFICATION_ERROR_INVALID_PARAMETER Invalid parameter
+ * @retval NOTIFICATION_ERROR_PERMISSION_DENIED The application does not have the privilege to call this method
+ * @pre Notification handle should be created by notification_create().
+ * @post notification_free().
+ * @par Sample code:
+ * @code
+#include <notification.h>
+...
+ {
+ int noti_err = NOTIFICATION_ERROR_NONE;
+
+ noti_err = notification_insert(noti, NULL);
+ if(noti_err != NOTIFICATION_ERROR_NONE) {
+ return;
+ }
+}
+ * @endcode
+ */
+int notification_insert(notification_h noti,
+ int *priv_id);
+
+/**
+ * @brief Updates notification data.
+ * @details The updated notification will appear in the notification area.
+ * @since_tizen @if WEARABLE 2.3.1 @elseif MOBILE 2.3 @endif
+ * @privlevel public
+ * @privilege %http://tizen.org/privilege/notification
+ * @param[in] noti The notification handle that is created by notification_create()
+ * @return #NOTIFICATION_ERROR_NONE on success,
+ * otherwise any other value on failure
+ * @retval #NOTIFICATION_ERROR_NONE Success
+ * @retval #NOTIFICATION_ERROR_INVALID_PARAMETER Invalid input value
+ * @retval #NOTIFICATION_ERROR_NOT_EXIST_ID Priv ID does not exist
+ * @retval #NOTIFICATION_ERROR_PERMISSION_DENIED The application does not have the privilege to call this method
+ * @par Sample code:
+ * @code
+#include <notification.h>
+...
+ {
+ int noti_err = NOTIFICATION_ERROR_NONE;
+
+ noti_err = notification_update(NULL);
+ if(noti_err != NOTIFICATION_ERROR_NONE) {
+ return;
+ }
+}
+ * @endcode
+ */
+int notification_update(notification_h noti);
+
+/**
+ * @internal
+ * @brief Updates a notification, asynchronously.
+ * @details The updated notification will appear in the notification area.
+ * @since_tizen @if WEARABLE 2.3.1 @elseif MOBILE 2.3 @endif
+ * @privlevel public
+ * @privilege %http://tizen.org/privilege/notification
+ * @remarks This function updates the notification asynchronously.
+ * @param[in] noti The notification handle that is created by notification_create()
+ * @param[in] result_cb The callback called when an update completed
+ * @param[in] user_data The user data which you want to use in callback
+ * @return #NOTIFICATION_ERROR_NONE on success,
+ * otherwise any other value on failure
+ * @retval #NOTIFICATION_ERROR_NONE Success
+ * @retval #NOTIFICATION_ERROR_INVALID_PARAMETER Invalid input value
+ * @retval #NOTIFICATION_ERROR_NOT_EXIST_ID Priv ID does not exist
+ * @retval #NOTIFICATION_ERROR_PERMISSION_DENIED The application does not have the privilege to call this method
+ * @par Sample code:
+ * @code
+#include <notification.h>
+...
+ {
+ int noti_err = NOTIFICATION_ERROR_NONE;
+
+ noti_err = notification_update_async(NULL, result_cb, data);
+ if(noti_err != NOTIFICATION_ERROR_NONE) {
+ return;
+ }
+}
+ * @endcode
+ */
+int notification_update_async(notification_h noti,
+ void (*result_cb)(int priv_id, int result, void *data), void *user_data);
+
+/**
+ * @brief Deletes a notification with the given handle.
+ * @details notification_delete() removes notification data from database and notification_free() releases memory of notification data.
+ * @since_tizen @if WEARABLE 2.3.1 @elseif MOBILE 2.3 @endif
+ * @privlevel public
+ * @privilege %http://tizen.org/privilege/notification
+ * @param[in] noti The notification handle
+ * @return #NOTIFICATION_ERROR_NONE on success,
+ * otherwise any other value on failure
+ * @retval #NOTIFICATION_ERROR_NONE Success
+ * @retval #NOTIFICATION_ERROR_INVALID_PARAMETER Invalid input value
+ * @retval NOTIFICATION_ERROR_PERMISSION_DENIED The application does not have the privilege to call this method
+ * @par Sample code:
+ * @code
+#include <notification.h>
+...
+ {
+ notificaton_h noti = NULL;
+ int noti_err = NOTIFICATION_ERROR_NONE;
+
+ ...
+
+ noti_err = notification_delete(noti);
+ if(noti_err != NOTIFICATION_ERROR_NONE) {
+ return;
+ }
+
+}
+ * @endcode
+ */
+int notification_delete(notification_h noti);
+
+/**
+ * @brief Creates internal structure data and returns a notification handle.
+ * @details Available type is #NOTIFICATION_TYPE_NOTI and #NOTIFICATION_TYPE_ONGOING.
+ * #NOTIFICATION_TYPE_NOTI is remaining notification data even if device is restarted.
+ * #NOTIFICATION_TYPE_ONGOING can display progressive feather, but notification data is removed after device is restarted.
+ * @since_tizen @if WEARABLE 2.3.1 @elseif MOBILE 2.3 @endif
+ * @remarks The specific error code can be obtained using the get_last_result() method. Error codes are described in Exception section.
+ * @param[in] type The notification type
+ * @return Notification handle(notification_h) on success,
+ * otherwise @c NULL on failure
+ * @retval notification_h Success
+ * @retval NULL Failure
+ * @exception #NOTIFICATION_ERROR_NONE Success
+ * @exception #NOTIFICATION_ERROR_INVALID_PARAMETER Invalid input value
+ * @exception #NOTIFICATION_ERROR_OUT_OF_MEMORY Out of memory
+ * @see #notification_type_e
+ * @par Sample code:
+ * @code
+#include <notification.h>
+...
+{
+ notification_h noti = NULL;
+
+ noti = notification_create(NOTIFICATION_TYPE_NOTI);
+ if(noti == NULL) {
+ return;
+ }
+ ...
+}
+ * @endcode
+ */
+notification_h notification_create(notification_type_e type);
+
+/**
+ * @brief Creates a notification clone.
+ * @details Newly created notification handle is returned.
+ * @since_tizen @if WEARABLE 2.3.1 @elseif MOBILE 2.3 @endif
+ * @remarks This cloned notification handle should be freed using notification_free().
+ * @param[in] noti The notification handle
+ * @param[out] clone The newly created notification handle that has same with input @a noti
+ * @return #NOTIFICATION_ERROR_NONE if success,
+ * otherwise any other value if failure
+ * @retval #NOTIFICATION_ERROR_NONE Success
+ * @retval #NOTIFICATION_ERROR_INVALID_PARAMETER Invalid parameter
+ * @see #notification_type_e
+ * @par Sample code:
+ * @code
+#include <notification.h>
+...
+{
+ notification_h noti = notification_create(NOTIFICATION_TYPE_NOTI);
+ notification_h clone = NULL;
+
+ notification_clone(noti, &clone);
+ ...
+}
+ * @endcode
+ */
+int notification_clone(notification_h noti, notification_h *clone);
+
+/**
+ * @brief Frees the internal structure data of a notification handle.
+ * @details Internal data of a notification handle is released. Data of the inserted notification is not deleted.
+ * @since_tizen @if WEARABLE 2.3.1 @elseif MOBILE 2.3 @endif
+ * @param[in] noti The notification handle
+ * @return #NOTIFICATION_ERROR_NONE on success,
+ * otherwise any other value on failure
+ * @retval #NOTIFICATION_ERROR_NONE Success
+ * @retval #NOTIFICATION_ERROR_INVALID_PARAMETER Invalid parameter
+ * @pre Notification handle should be created by notification_create().
+ * @par Sample code:
+ * @code
+#include <notification.h>
+...
+{
+ notification_h noti = NULL;
+ int noti_err = NOTIFICATION_ERROR_NONE;
+
+ noti = notification_create(NOTIFICATION_TYPE_NOTI);
+ if(noti == NULL) {
+ return;
+ }
+ ...
+
+ noti_err = notification_free(noti);
+ if(noti_err != NOTIFICATION_ERROR_NONE) {
+ return;
+ }
+}
+ * @endcode
+ */
+int notification_free(notification_h noti);
+
+/**
+ * @}
+ */
+
+/**
+ * @internal
+ * @addtogroup NOTIFICATION_LIST
+ * @{
+ */
+
+/**
+ * @internal
+ * @brief Returns the notification list handle.
+ * @details If count is equal to @c -1, all notifications are returned.
+ * @since_tizen @if WEARABLE 2.3.1 @elseif MOBILE 2.3 @endif
+ * @privlevel public
+ * @privilege %http://tizen.org/privilege/notification
+ * @param[in] type The notification type
+ * @param[in] count The returned notification data number
+ * @param[out] #NOTIFICATION_ERROR_NONE on success, other value on failure
+ * @return #NOTIFICATION_ERROR_NONE on success,
+ * otherwise any other value on failure
+ * @retval #NOTIFICATION_ERROR_NONE Success
+ * @retval #NOTIFICATION_ERROR_INVALID_PARAMETER Invalid parameter
+ * @retval #NOTIFICATION_ERROR_PERMISSION_DENIED The application does not have the privilege to call this method
+ * @see #notification_list_h
+ * @par Sample code:
+ * @code
+#include <notification.h>
+...
+{
+ notification_list_h noti_list = NULL;
+ int noti_err = NOTIFICATION_ERROR_NONE;
+
+ noti_err = notification_get_list(NOTIFICATION_TYPE_NONE, -1, &noti_list);
+ if(noti_err != NOTIFICATION_ERROR_NONE) {
+ return;
+ }
+}
+ * @endcode
+ */
+int notification_get_list(notification_type_e type,
+ int count,
+ notification_list_h * list);
+
+/**
+ * @internal
+ * @brief Returns the notification detail list handle of grouping data.
+ * @details If count is equal to c -1, all notifications are returned.
+ * @since_tizen @if WEARABLE 2.3.1 @elseif MOBILE 2.3 @endif
+ * @privlevel public
+ * @privilege %http://tizen.org/privilege/notification
+ * @param[in] pkgname The caller application package name
+ * @param[in] group_id The group ID
+ * @param[in] priv_id The private ID
+ * @param[in] count The returned notification data number
+ * @param[out] list The notification list handle
+ * @return #NOTIFICATION_ERROR_NONE if success,
+ * other value if failure
+ * @retval #NOTIFICATION_ERROR_NONE Success
+ * @retval #NOTIFICATION_ERROR_INVALID_PARAMETER Invalid parameter
+ * @retval NOTIFICATION_ERROR_PERMISSION_DENIED The application does not have the privilege to call this method
+ * @see #notification_list_h
+ * @par Sample code:
+ * @code
+#include <notification.h>
+...
+{
+ notification_list_h noti_list = NULL;
+ int noti_err = NOTIFICATION_ERROR_NONE;
+
+ noti_err = notification_get_detail_list(pkgname, group_id, priv_id, -1, &noti_list);
+ if(noti_err != NOTIFICATION_ERROR_NONE) {
+ return;
+ }
+}
+ * @endcode
+ */
+int notification_get_detail_list(const char *pkgname,
+ int group_id,
+ int priv_id,
+ int count,
+ notification_list_h *list);
+
+/**
+ * @internal
+ * @brief Frees a notification list.
+ * @since_tizen @if WEARABLE 2.3.1 @elseif MOBILE 2.3 @endif
+ * @privlevel public
+ * @privilege %http://tizen.org/privilege/notification
+ * @param[in] list The notification list handle
+ * @return #NOTIFICATION_ERROR_NONE on success,
+ * otherwise any other value on failure
+ * @retval #NOTIFICATION_ERROR_NONE Success
+ * @retval #NOTIFICATION_ERROR_INVALID_PARAMETER Invalid parameter
+ * @retval NOTIFICATION_ERROR_PERMISSION_DENIED The application does not have the privilege to call this method
+ * @pre notification_get_grouping_list() or notification_get_detail_list().
+ * @see #notification_list_h
+ * @par Sample code:
+ * @code
+#include <notification.h>
+...
+{
+ notification_list_h noti_list = NULL;
+ int noti_err = NOTIFICATION_ERROR_NONE;
+
+ ...
+
+ noti_err = notification_free_list(noti_list);
+ if(noti_err != NOTIFICATION_ERROR_NONE) {
+ return;
+ }
+}
+ * @endcode
+ */
+int notification_free_list(notification_list_h list);
+
+/**
+ * @}
+ */
+
+/**
+ * @addtogroup NOTIFICATION_MODULE
+ * @{
+ */
+
+/**
+ * @internal
+ * @brief Registers a callback for all notification events.
+ * @details The registered callback could be called for all notification events.
+ * @since_tizen @if WEARABLE 2.3.1 @elseif MOBILE 2.3 @endif
+ * @privlevel public
+ * @privilege %http://tizen.org/privilege/notification
+ * @param[in] changed_cb The callback function
+ * @param[in] user_data The user data
+ * @return #NOTIFICATION_ERROR_NONE on success,
+ * otherwise any other value on failure
+ * @retval #NOTIFICATION_ERROR_NONE Success
+ * @retval #NOTIFICATION_ERROR_INVALID_PARAMETER Invalid parameter
+ * @retval #NOTIFICATION_ERROR_PERMISSION_DENIED The application does not have the privilege to call this method
+ * @see notification_unregister_detailed_changed_cb()
+ * @par Sample code:
+ * @code
+#include <notification.h>
+...
+{
+ noti_err = notification_register_detailed_changed_cb(app_changed_cb, user_data);
+ if(noti_err != NOTIFICATION_ERROR_NONE) {
+ return;
+ }
+}
+ * @endcode
+ */
+int notification_register_detailed_changed_cb(
+ void (*detailed_changed_cb)(void *data, notification_type_e type, notification_op *op_list, int num_op),
+ void *user_data);
+
+/**
+ * @internal
+ * @brief Unregisters a callback for all notification events.
+ * @since_tizen @if WEARABLE 2.3.1 @elseif MOBILE 2.3 @endif
+ * @privlevel public
+ * @privilege %http://tizen.org/privilege/notification
+ * @param[in] changed_cb The callback function
+ * @return #NOTIFICATION_ERROR_NONE on success,
+ * otherwise any other value on failure
+ * @retval #NOTIFICATION_ERROR_NONE Success
+ * @retval #NOTIFICATION_ERROR_INVALID_PARAMETER Invalid parameter
+ * @retval #NOTIFICATION_ERROR_PERMISSION_DENIED The application does not have the privilege to call this method
+ * @see notification_register_detailed_changed_cb()
+ * @par Sample code:
+ * @code
+#include <notification.h>
+...
+{
+ noti_err = notification_register_detailed_changed_cb(app_changed_cb, user_data);
+ if(noti_err != NOTIFICATION_ERROR_NONE) {
+ return;
+ }
+}
+ * @endcode
+ */
+int notification_unregister_detailed_changed_cb(
+ void (*detailed_changed_cb)(void *data, notification_type_e type, notification_op *op_list, int num_op),
+ void *user_data);
+
+/**
+ * @brief Sets the tag of the notification handle.
+ * @since_tizen @if WEARABLE 2.3.1 @elseif MOBILE 2.3 @endif
+ * @param[in] noti Notification handle
+ * @param[in] tag tag for loading notification handle
+ * @return #NOTIFICATION_ERROR_NONE on success, other value on failure
+ * @retval #NOTIFICATION_ERROR_NONE Success
+ * @retval #NOTIFICATION_ERROR_INVALID_PARAMETER Invalid parameter
+ * @retval #NOTIFICATION_ERROR_PERMISSION_DENIED The application does not have the privilege to call this method
+ * @see notification_get_tag()
+ * @par Sample code:
+ * @code
+#include <notification.h>
+...
+{
+ notification_h noti = NULL;
+ int noti_err = NOTIFICATION_ERROR_NONE;
+
+ noti = notification_create(NOTIFICATION_TYPE_NOTI);
+ if(noti == NULL) {
+ return;
+ }
+ ...
+
+ noti_err = notification_set_tag(noti, tag);
+ if(noti_err != NOTIFICATION_ERROR_NONE) {
+ return;
+ }
+}
+ * @endcode
+ */
+int notification_set_tag(notification_h noti, const char *tag);
+
+/**
+ * @brief Gets the tag of the notification handle.
+ * @since_tizen @if WEARABLE 2.3.1 @elseif MOBILE 2.3 @endif
+ * @param[in] noti Notification handle
+ * @param[out] tag tag for loading notification handle
+ * @return #NOTIFICATION_ERROR_NONE on success, other value on failure
+ * @retval #NOTIFICATION_ERROR_NONE Success
+ * @retval #NOTIFICATION_ERROR_INVALID_PARAMETER Invalid parameter
+ * @retval #NOTIFICATION_ERROR_PERMISSION_DENIED The application does not have the privilege to call this method
+ * @see notification_set_tag()
+ * @par Sample code:
+ * @code
+#include <notification.h>
+...
+{
+ int noti_err = NOTIFICATION_ERROR_NONE;
+ const char *tag = NULL;
+
+ ...
+
+ noti_err = notification_get_tag(noti, &tag);
+ if(noti_err != NOTIFICATION_ERROR_NONE) {
+ return;
+ }
+}
+ * @endcode
+ */
+int notification_get_tag(notification_h noti, const char **tag);
+
+/**
+ * @brief Loads a notification from the notification's database with the tag.
+ * @since_tizen @if WEARABLE 2.3.1 @elseif MOBILE 2.3 @endif
+ * @privlevel public
+ * @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.
+ * @param[in] tag tag for loading notification handle
+ * @return Notification handle(notification_h) on success, NULL on failure
+ * @retval notification_h Success
+ * @retval NULL Failure
+ * @exception #NOTIFICATION_ERROR_NONE Success
+ * @exception #NOTIFICATION_ERROR_INVALID_PARAMETER Invalid input value
+ * @exception #NOTIFICATION_ERROR_OUT_OF_MEMORY Out of memory
+ * @exception #NOTIFICATION_ERROR_PERMISSION_DENIED The application does not have the privilege to call this method
+ * @see #notification_type_e
+ * @par Sample code:
+ * @code
+#include <notification.h>
+...
+{
+ notification_h noti = NULL;
+
+ noti = notification_load_by_tag(tag);
+ if(noti == NULL) {
+ return;
+ }
+ ...
+}
+ * @endcode
+ */
+notification_h notification_load_by_tag(const char *tag);
+
+/**
+ * @brief Deletes all notifications of the given type.
+ * @since_tizen @if WEARABLE 2.3.1 @elseif MOBILE 2.3 @endif
+ * @privlevel public
+ * @privilege %http://tizen.org/privilege/notification
+ * @param[in] type Notification type
+ * @return #NOTIFICATION_ERROR_NONE if success, other value if failure
+ * @retval #NOTIFICATION_ERROR_NONE Success
+ * @retval #NOTIFICATION_ERROR_INVALID_PARAMETER Invalid input value
+ * @retval #NOTIFICATION_ERROR_PERMISSION_DENIED The application does not have the privilege to call this method
+ * @par Sample code:
+ * @code
+#include <notification.h>
+...
+ {
+ int noti_err = NOTIFICATION_ERROR_NONE;
+
+ noti_err = notification_delete_all(NOTIFICATION_TYPE_NOTI);
+ if(noti_err != NOTIFICATION_ERROR_NONE) {
+ return;
+ }
+}
+ * @endcode
+ */
+int notification_delete_all(notification_type_e type);
+
+/**
+ * @brief Posts a notification.
+ * @since_tizen @if WEARABLE 2.3.1 @elseif MOBILE 2.3 @endif
+ * @privlevel public
+ * @privilege %http://tizen.org/privilege/notification
+ * @param[in] noti Notification handle
+ * @return #NOTIFICATION_ERROR_NONE if success, other value if failure
+ * @retval #NOTIFICATION_ERROR_NONE Success
+ * @retval #NOTIFICATION_ERROR_INVALID_PARAMETER Invalid parameter
+ * @retval #NOTIFICATION_ERROR_PERMISSION_DENIED The application does not have the privilege to call this method
+ * @pre Notification handle should be created by notification_create().
+ * @post notification_free().
+ * @par Sample code:
+ * @code
+#include <notification.h>
+...
+ {
+ int noti_err = NOTIFICATION_ERROR_NONE;
+
+ noti_err = notification_post(noti);
+ if(noti_err != NOTIFICATION_ERROR_NONE) {
+ return;
+ }
+}
+ * @endcode
+ */
+int notification_post(notification_h noti);
+
+/**
+ * @}
+ */
+
+#ifdef __cplusplus
+}
+#endif
+#endif /* __NOTIFICATION_H__ */
diff --git a/include/notification_db.h b/include/notification_db.h
new file mode 100644
index 0000000..1e3482c
--- /dev/null
+++ b/include/notification_db.h
@@ -0,0 +1,53 @@
+/*
+ * libnotification
+ *
+ * Copyright (c) 2000 - 2011 Samsung Electronics Co., Ltd. All rights reserved.
+ *
+ * Contact: Seungtaek Chung <seungtaek.chung@samsung.com>, Mi-Ju Lee <miju52.lee@samsung.com>, Xi Zhichan <zhichan.xi@samsung.com>
+ *
+ * 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 __NOTIFICATION_DB_H__
+#define __NOTIFICATION_DB_H__
+
+#include <bundle.h>
+#include <sqlite3.h>
+
+#ifndef DBDIR
+#error "DBDIR not defined"
+#endif
+
+#ifndef DBFILE
+#error "DBFILE not defined"
+#endif
+
+#define DBPATH DBDIR"/"DBFILE
+
+#define NOTIFICATION_QUERY_MAX 4096
+
+#define NOTIFICATION_EMPTY_STR ""
+#define NOTIFICATION_CHECK_STR(p) ((p)?(p):NOTIFICATION_EMPTY_STR)
+
+sqlite3 *notification_db_open(const char *dbfile);
+
+int notification_db_close(sqlite3 ** db);
+
+int notification_db_exec(sqlite3 * db, const char *query, int *num_changes);
+
+char *notification_db_column_text(sqlite3_stmt * stmt, int col);
+
+bundle *notification_db_column_bundle(sqlite3_stmt * stmt, int col);
+
+#endif /* __NOTIFICATION_DB_H__ */
diff --git a/include/notification_debug.h b/include/notification_debug.h
new file mode 100644
index 0000000..e507471
--- /dev/null
+++ b/include/notification_debug.h
@@ -0,0 +1,79 @@
+/*
+ * libnotification
+ *
+ * Copyright (c) 2000 - 2011 Samsung Electronics Co., Ltd. All rights reserved.
+ *
+ * Contact: Seungtaek Chung <seungtaek.chung@samsung.com>, Mi-Ju Lee <miju52.lee@samsung.com>, Xi Zhichan <zhichan.xi@samsung.com>
+ *
+ * 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 __NOTIFICATION_DEBUG_H__
+#define __NOTIFICATION_DEBUG_H__
+
+#define LOG_TAG "NOTIFICATION"
+#include <dlog.h>
+
+#ifndef EXPORT_API
+#define EXPORT_API __attribute__ ((visibility("default")))
+#endif
+
+#ifndef _DLOG_H_
+#include <stdio.h>
+
+#define NOTIFICATION_DBG(fmt , args...) \
+ do{ \
+ printf("[D][%s : %d] "fmt"\n", __func__,__LINE__,##args ); \
+ } while(0)
+
+#define NOTIFICATION_INFO(fmt , args...) \
+ do{ \
+ printf("[I][%s : %d] "fmt"\n", __func__,__LINE__,##args ); \
+ } while(0)
+
+#define NOTIFICATION_WARN(fmt , args...) \
+ do{ \
+ printf("[W][%s : %d] "fmt"\n", __func__,__LINE__,##args ); \
+ } while(0)
+
+#define NOTIFICATION_ERR(fmt , args...) \
+ do{ \
+ printf("[E][%s : %d] "fmt"\n", __func__,__LINE__,##args ); \
+ } while(0)
+
+#else /* _DLOG_H_ */
+
+#define NOTIFICATION_DBG(fmt , args...) \
+ do{ \
+ SECURE_LOGD("[%s : %d] "fmt"\n",__func__,__LINE__,##args ); \
+ } while(0)
+
+#define NOTIFICATION_INFO(fmt , args...) \
+ do{ \
+ SECURE_LOGI("[%s : %d] "fmt"\n",__func__,__LINE__,##args ); \
+ } while(0)
+
+#define NOTIFICATION_WARN(fmt , args...) \
+ do{ \
+ SECURE_LOGW("[%s : %d] "fmt"\n",__func__,__LINE__,##args ); \
+ } while(0)
+
+#define NOTIFICATION_ERR(fmt , args...) \
+ do{ \
+ SECURE_LOGE("[%s : %d] "fmt"\n",__func__,__LINE__,##args ); \
+ } while(0)
+
+#endif /* _DLOG_H_ */
+
+#endif /* __NOTIFICATION_DEBUG_H__ */
diff --git a/include/notification_error.h b/include/notification_error.h
new file mode 100644
index 0000000..0616cc8
--- /dev/null
+++ b/include/notification_error.h
@@ -0,0 +1,57 @@
+/*
+ * libnotification
+ *
+ * Copyright (c) 2000 - 2011 Samsung Electronics Co., Ltd. All rights reserved.
+ *
+ * Contact: Seungtaek Chung <seungtaek.chung@samsung.com>, Mi-Ju Lee <miju52.lee@samsung.com>, Xi Zhichan <zhichan.xi@samsung.com>
+ *
+ * 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 __NOTIFICATION_ERROR_H__
+#define __NOTIFICATION_ERROR_H__
+
+#include <tizen.h>
+
+/**
+ * @file notification_error.h
+ */
+
+/**
+ * @addtogroup NOTIFICATION_MODULE
+ * @{
+ */
+
+/**
+ * @brief Enumeration for notification errors.
+ * @since_tizen @if WEARABLE 2.3.1 @elseif MOBILE 2.3 @endif
+ */
+typedef enum _notification_error {
+ NOTIFICATION_ERROR_NONE = TIZEN_ERROR_NONE, /**< Success */
+ NOTIFICATION_ERROR_INVALID_PARAMETER = TIZEN_ERROR_INVALID_PARAMETER, /**< Invalid parameter */
+ NOTIFICATION_ERROR_OUT_OF_MEMORY = TIZEN_ERROR_OUT_OF_MEMORY, /**< out of memory */
+ NOTIFICATION_ERROR_IO_ERROR= TIZEN_ERROR_IO_ERROR, /**< I/O error */
+ NOTIFICATION_ERROR_PERMISSION_DENIED = TIZEN_ERROR_PERMISSION_DENIED, /**< Permission denied */
+ NOTIFICATION_ERROR_FROM_DB = TIZEN_ERROR_NOTIFICATION | 0x01, /**< Error from DB query */
+ NOTIFICATION_ERROR_ALREADY_EXIST_ID = TIZEN_ERROR_NOTIFICATION | 0x02, /**< Already exist private ID */
+ NOTIFICATION_ERROR_FROM_DBUS = TIZEN_ERROR_NOTIFICATION | 0x03, /**< Error from DBus */
+ NOTIFICATION_ERROR_NOT_EXIST_ID = TIZEN_ERROR_NOTIFICATION | 0x04, /**< Not exist private ID */
+ NOTIFICATION_ERROR_SERVICE_NOT_READY = TIZEN_ERROR_NOTIFICATION | 0x05, /**< No reponse from notification service */
+} notification_error_e;
+
+/**
+ * @}
+ */
+
+#endif /* __NOTIFICATION_ERROR_H__ */
diff --git a/include/notification_group.h b/include/notification_group.h
new file mode 100644
index 0000000..2bff013
--- /dev/null
+++ b/include/notification_group.h
@@ -0,0 +1,57 @@
+/*
+ * libnotification
+ *
+ * Copyright (c) 2000 - 2011 Samsung Electronics Co., Ltd. All rights reserved.
+ *
+ * Contact: Seungtaek Chung <seungtaek.chung@samsung.com>, Mi-Ju Lee <miju52.lee@samsung.com>, Xi Zhichan <zhichan.xi@samsung.com>
+ *
+ * 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 __NOTIFICATION_GROUP_H__
+#define __NOTIFICATION_GROUP_H__
+
+#include <notification.h>
+
+NOTIFICATION_DEPRECATED_API int notification_group_set_title(const char *pkgname,
+ int group_id,
+ const char *title,
+ const char *loc_title,
+ notification_count_display_type_e count_display);
+
+NOTIFICATION_DEPRECATED_API int notification_group_get_title(const char *pkgname,
+ int group_id,
+ char **ret_title,
+ char **ret_loc_title,
+ notification_count_display_type_e *count_display);
+
+NOTIFICATION_DEPRECATED_API int notification_group_set_content(const char *pkgname,
+ int group_id,
+ const char *content,
+ const char *loc_content,
+ notification_count_display_type_e count_display);
+
+NOTIFICATION_DEPRECATED_API int notification_group_get_content(const char *pkgname,
+ int group_id,
+ char **ret_content,
+ char **ret_loc_content,
+ notification_count_display_type_e *count_display);
+
+NOTIFICATION_DEPRECATED_API int notification_group_set_badge(const char *pkgname,
+ int group_id, int count);
+
+NOTIFICATION_DEPRECATED_API int notification_group_get_badge(const char *pkgname,
+ int group_id, int *count);
+
+#endif /* __NOTIFICATION_GROUP_H__ */
diff --git a/include/notification_internal.h b/include/notification_internal.h
new file mode 100644
index 0000000..341e763
--- /dev/null
+++ b/include/notification_internal.h
@@ -0,0 +1,642 @@
+/*
+ * libnotification
+ *
+ * Copyright (c) 2000 - 2011 Samsung Electronics Co., Ltd. All rights reserved.
+ *
+ * Contact: Seungtaek Chung <seungtaek.chung@samsung.com>, Mi-Ju Lee <miju52.lee@samsung.com>, Xi Zhichan <zhichan.xi@samsung.com>
+ *
+ * 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 __NOTIFICATION_INTERNAL_H__
+#define __NOTIFICATION_INTERNAL_H__
+
+#include <notification_error.h>
+#include <notification_type.h>
+#include <notification_list.h>
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/**
+ * @addtogroup NOTIFICATION_INTERNAL
+ * @{
+ */
+
+/**
+ * @brief This function add deferred task. the registered task will be executed when notification service become ready
+ * @param[in] deferred_task_cb The callback function
+ * @param[in] user_data The user data to be passed to the callback function
+ * @return #NOTIFICATION_ERROR_NONE if success, other value if failure
+ * @see #notification_error_e
+ * @see notification_is_service_ready()
+ */
+int notification_add_deferred_task(
+ void (*deferred_task_cb)(void *data), void *user_data);
+
+/**
+ * @brief This function remove deferred task.
+ * @param[in] deferred_task_cb The callback function
+ * @return #NOTIFICATION_ERROR_NONE if success, other value if failure
+ * @see #notification_error_e
+ * @see notification_is_service_ready()
+ */
+int notification_del_deferred_task(
+ void (*deferred_task_cb)(void *data));
+
+/**
+ * @brief This function will be removed.
+ * @see notification_unresister_changed_cb()
+ */
+int
+notification_resister_changed_cb(
+ void (*changed_cb)(void *data, notification_type_e type),
+ void *user_data);
+
+/**
+ * @brief This function will be removed.
+ * @see notification_resister_changed_cb()
+ */
+int
+notification_unresister_changed_cb(
+ void (*changed_cb)(void *data, notification_type_e type));
+
+/**
+ * @brief Updates the progress of the inserted notification. This only works for the ongoing notification (NOTIFICATION_TYPE_ONGOING).
+ * @details The Notification view on the notification area could be updated.
+ * @param[in] noti Notification handle or NULL if priv_id is valid
+ * @param[in] priv_id Private ID
+ * @param[in] progress Percentage value of progressive data
+ * @return NOTIFICATION_ERROR_NONE on success, other value on failure
+ * @retval NOTIFICATION_ERROR_NONE Success
+ * @retval NOTIFICATION_ERROR_INVALID_PARAMETER Invalid input value
+ * @par Sample code:
+ * @code
+#include <notification.h>
+...
+ {
+ int noti_err = NOTIFICATION_ERROR_NONE;
+
+ noti_err = notification_update_progress(NULL, APP_NOTI_PRIV_ID, 0.6);
+ if(noti_err != NOTIFICATION_ERROR_NONE) {
+ return;
+ }
+}
+ * @endcode
+ */
+int notification_update_progress(notification_h noti,
+ int priv_id,
+ double progress);
+
+/**
+ * @brief Updates the size of inserted notification data. This only works for the ongoing notification (NOTIFICATION_TYPE_ONGOING).
+ * @details Notification view on notification area could be updated.
+ * @param[in] noti Notification handle or NULL if priv_id is valid
+ * @param[in] priv_id Private ID
+ * @param[in] size Bytes of progressive data
+ * @return NOTIFICATION_ERROR_NONE if success, other value if failure
+ * @retval NOTIFICATION_ERROR_NONE Success
+ * @retval NOTIFICATION_ERROR_INVALID_PARAMETER Invalid input value
+ * @par Sample code:
+ * @code
+#include <notification.h>
+...
+ {
+ int noti_err = NOTIFICATION_ERROR_NONE;
+
+ noti_err = notification_update_size(NULL, APP_NOTI_PRIV_ID, 3000000);
+ if(noti_err != NOTIFICATION_ERROR_NONE) {
+ return;
+ }
+}
+ * @endcode
+ */
+int notification_update_size(notification_h noti,
+ int priv_id, double size);
+
+/**
+ * @brief Updates the content of the inserted notification data. This is only for the ongoing notification (NOTIFICATION_TYPE_ONGOING).
+ * @details Notification view on notification area could be updated.
+ * @param[in] noti Notification handle or NULL if priv_id is valid
+ * @param[in] priv_id Private ID
+ * @param[in] content Text to update
+ * @return NOTIFICATION_ERROR_NONE on success, other value on failure
+ * @retval NOTIFICATION_ERROR_NONE Success
+ * @retval NOTIFICATION_ERROR_INVALID_PARAMETER Invalid input value
+ * @par Sample code:
+ * @code
+#include <notification.h>
+...
+ {
+ int noti_err = NOTIFICATION_ERROR_NONE;
+
+ noti_err = notification_update_content(NULL, APP_NOTI_PRIV_ID, "updated string");
+ if(noti_err != NOTIFICATION_ERROR_NONE) {
+ return;
+ }
+}
+ * @endcode
+ */
+int notification_update_content(notification_h noti,
+ int priv_id,
+ const char *content);
+
+/**
+ * @brief This function will be deprecated.
+ * @see notification_set_image()
+ *
+ */
+NOTIFICATION_DEPRECATED_API int notification_set_icon(notification_h noti,
+ const char *icon_path);
+
+/**
+ * @brief This function will be deprecated.
+ * @see notification_get_image()
+ *
+ */
+NOTIFICATION_DEPRECATED_API int notification_get_icon(notification_h noti,
+ char **icon_path);
+
+/**
+ * @brief This function will be deprecated.
+ * @see notification_set_text()
+ *
+ */
+NOTIFICATION_DEPRECATED_API int notification_set_title(notification_h noti,
+ const char *title,
+ const char *loc_title);
+
+/**
+ * @brief This function will be deprecated.
+ * @see notification_get_text()
+ *
+ */
+NOTIFICATION_DEPRECATED_API int notification_get_title(notification_h noti,
+ char **title,
+ char **loc_title);
+
+/**
+ * @brief This function will be deprecated.
+ * @see notification_set_text()
+ *
+ */
+NOTIFICATION_DEPRECATED_API int notification_set_content(notification_h noti,
+ const char *content,
+ const char *loc_content);
+
+/**
+ * @brief This function will be deprecated.
+ * @see notification_get_text()
+ *
+ */
+NOTIFICATION_DEPRECATED_API int notification_get_content(notification_h noti,
+ char **content,
+ char **loc_content);
+
+/**
+ * @brief This function will be removed.
+ * @see notification_set_execute_option()
+ *
+ */
+NOTIFICATION_DEPRECATED_API int notification_set_application(notification_h noti, const char *pkgname); /* Do not use this */
+
+/**
+ * @brief This function will be removed.
+ * @see notification_get_execute_option()
+ *
+ */
+NOTIFICATION_DEPRECATED_API int notification_get_application(notification_h noti, char **pkgname); /* Do not use this */
+
+/**
+ * @brief This function will be deprecated.
+ * @see notification_set_execute_option()
+ *
+ */
+NOTIFICATION_DEPRECATED_API int notification_set_args(notification_h noti, bundle * args, bundle * group_args); /* Do not use this */
+
+/**
+ * @brief This function will be deprecated.
+ * @see notification_get_execute_option()
+ *
+ */
+NOTIFICATION_DEPRECATED_API int notification_get_args(notification_h noti, bundle ** args, bundle ** group_args); /* Do not use this */
+
+/**
+ * @brief This function is deprecated.
+ * @see notification_get_grouping_list()
+ *
+ */
+NOTIFICATION_DEPRECATED_API int notification_get_grouping_list(notification_type_e type,
+ int count,
+ notification_list_h *list);
+
+/**
+ * @brief This function will be deprecated.
+ * @see notification_delete_by_priv_id()
+ *
+ */
+NOTIFICATION_DEPRECATED_API int notification_delete_group_by_group_id(const char *pkgname,
+ notification_type_e type,
+ int group_id);
+
+/**
+ * @brief This function will be deprecated.
+ * @see notification_delete_by_priv_id()
+ *
+ */
+NOTIFICATION_DEPRECATED_API int notification_delete_group_by_priv_id(const char *pkgname,
+ notification_type_e type,
+ int priv_id);
+/**
+ * @brief This function will be deprecated.
+ *
+ */
+NOTIFICATION_DEPRECATED_API int notification_get_count(notification_type_e type,
+ const char *pkgname,
+ int group_id, int priv_id,
+ int *count);
+
+/**
+ * @brief This function will be deprecated.
+ *
+ */
+NOTIFICATION_DEPRECATED_API int notifiation_clear(notification_type_e type);
+
+/**
+ * @internal
+ * @brief This function will be deprecated.
+ * @details Use only for the notification tray's clear button operation.
+ * @param[in] type Notification type
+ * @return NOTIFICATION_ERROR_NONE on success, other value on failure
+ * @retval NOTIFICATION_ERROR_NONE Success
+ * @retval NOTIFICATION_ERROR_INVALID_PARAMETER Invalid input value
+ * @see #notification_type_e
+ * @par Sample code:
+ * @code
+#include <notification.h>
+...
+ {
+ int noti_err = NOTIFICATION_ERROR_NONE;
+
+ noti_err = notification_clear(NOTIFICATION_TYPE_NOTI);
+ if(noti_err != NOTIFICATION_ERROR_NONE) {
+ return;
+ }
+}
+ * @endcode
+ */
+NOTIFICATION_DEPRECATED_API int notification_clear(notification_type_e type);
+
+/**
+ * @internal
+ * @brief This function will be deprecated.
+ * @return 1 on ready, other value on not ready
+ */
+NOTIFICATION_DEPRECATED_API int notification_is_service_ready(void);
+
+/**
+ * @internal
+ * @brief This function will be deprecated.
+ * @param[in] list Notification list handle
+ * @return NOTIFICATION_ERROR_NONE on success, other value on failure
+ * @retval NOTIFICATION_ERROR_NONE Success
+ * @retval NOTIFICATION_ERROR_INVALID_PARAMETER Invalid parameter
+ * @pre notification_get_grouping_list() or notification_get_detail_list().
+ * @see #notification_op
+ */
+NOTIFICATION_DEPRECATED_API int notification_op_get_data(notification_op *noti_op,
+ notification_op_data_type_e type,
+ void *data);
+
+/**
+ * @internal
+ * @brief This function will be deprecated.
+ * @details Caller_pkgname is set automatically when notification_new() is called. We do not recommend to use this API.
+ * @param[in] noti Notification handle
+ * @param[in] pkgname Caller package name
+ * @return NOTIFICATION_ERROR_NONE on success, other value on failure
+ * @retval NOTIFICATION_ERROR_NONE Success
+ * @retval NOTIFICATION_ERROR_INVALID_PARAMETER Invalid input value
+ * @par Sample code:
+ * @code
+#include <notification.h>
+...
+{
+ notification_h noti = NULL;
+ int noti_err = NOTIFICATION_ERROR_NONE;
+
+ noti = notification_new(NOTIFICATION_TYPE_NOTI, APP_GROUP_ID, NOTIFICATION_PRIV_ID_NONE);
+ if(noti == NULL) {
+ return;
+ }
+
+ noti_err = notification_set_pkgname(noti, "org.tizen.phone");
+ if(noti_err != NOTIFICATION_ERROR_NONE) {
+ notification_free(noti);
+ return;
+ }
+}
+ * @endcode
+ */
+NOTIFICATION_DEPRECATED_API int notification_set_pkgname(notification_h noti,
+ const char *pkgname);
+
+/**
+ * @internal
+ * @brief This function will be deprecated.
+ * @param[in] noti Notification handle
+ * @param[out] pkgname Caller package name
+ * @return NOTIFICATION_ERROR_NONE on success, other value on failure
+ * @retval NOTIFICATION_ERROR_NONE Success
+ * @retval NOTIFICATION_ERROR_INVALID_PARAMETER Invalid input value
+ * @par Sample code:
+ * @code
+#include <notification.h>
+...
+{
+ notification_h noti = NULL;
+ int noti_err = NOTIFICATION_ERROR_NONE;
+ char *pkgname = NULL;
+
+ noti_err = notification_get_pkgname(noti, &pkgname);
+ if(noti_err != NOTIFICATION_ERROR_NONE) {
+ return;
+ }
+}
+ * @endcode
+ */
+NOTIFICATION_DEPRECATED_API int notification_get_pkgname(notification_h noti,
+ char **pkgname);
+
+/**
+ * @internal
+ * @brief This function will be deprecated.
+ * @details If @a pkgname is NULL, caller_pkgname is set internally.
+ * @param[in] pkgname Caller application package name or NULL
+ * @param[in] type Notification type
+ * @return NOTIFICATION_ERROR_NONE if success, other value if failure
+ * @retval NOTIFICATION_ERROR_NONE Success
+ * @retval NOTIFICATION_ERROR_INVALID_PARAMETER Invalid input value
+ * @par Sample code:
+ * @code
+#include <notification.h>
+...
+ {
+ int noti_err = NOTIFICATION_ERROR_NONE;
+
+ noti_err = notification_delete_all_by_type(NULL, NOTIFICATION_TYPE_NOTI);
+ if(noti_err != NOTIFICATION_ERROR_NONE) {
+ return;
+ }
+}
+ * @endcode
+ */
+NOTIFICATION_DEPRECATED_API int notification_delete_all_by_type(const char *pkgname,
+ notification_type_e type);
+
+/**
+ * @internal
+ * @brief This function will be deprecated.
+ * @details If @a pkgname is NULL, caller_pkgname is set internally.
+ * @param[in] pkgname Caller application package name or NULL
+ * @param[in] type Notification type
+ * @param[in] priv_id Priv ID
+ * @return NOTIFICATION_ERROR_NONE if success, other value if failure
+ * @retval NOTIFICATION_ERROR_NONE Success
+ * @retval NOTIFICATION_ERROR_INVALID_PARAMETER Invalid input value
+ * @par Sample code:
+ * @code
+#include <notification.h>
+...
+ {
+ int noti_err = NOTIFICATION_ERROR_NONE;
+
+ noti_err = notification_delete_by_priv_id(NULL, NOTIFICATION_TYPE_NOTI, APP_PRIV_ID);
+ if(noti_err != NOTIFICATION_ERROR_NONE) {
+ return;
+ }
+}
+ * @endcode
+ */
+NOTIFICATION_DEPRECATED_API int notification_delete_by_priv_id(const char *pkgname,
+ notification_type_e type,
+ int priv_id);
+
+/**
+ * @internal
+ * @brief This function will be deprecated.
+ * @details When notification data selected in display application, application launched by appsvc_run_service with service_handle.
+ * @param[in] noti Notification handle
+ * @param[in] type Notification execute type
+ * @param[in] text Basic text for button
+ * @param[in] key Value for localized text
+ * @param[in] service_handle Appsvc bundle data
+ * @return NOTIFICATION_ERROR_NONE on success, other value on failure
+ * @retval NOTIFICATION_ERROR_NONE Success
+ * @retval NOTIFICATION_ERROR_INVALID_PARAMETER Invalid parameter
+ * @par Sample code:
+ * @code
+#include <notification.h>
+...
+{
+ notification_h noti = NULL;
+ int noti_err = NOTIFICATION_ERROR_NONE;
+ bundle *b = NULL;
+
+ ...
+
+ b = bundle_create();
+ appsvc_set_operation(b, APPSVC_OPERATION_VIEW);
+ appsvc_set_uri(b,"http://www.samsung.com");
+
+ noti_err = notification_set_execute_option(noti, NOTIFICATION_EXECUTE_TYPE_SINGLE_LAUNCH, NULL, NULL, b);
+ if(noti_err != NOTIFICATION_ERROR_NONE) {
+ notification_free(noti);
+ return;
+ }
+
+ bundle_free(b);
+}
+ * @endcode
+ */
+NOTIFICATION_DEPRECATED_API int notification_set_execute_option(notification_h noti,
+ notification_execute_type_e type,
+ const char *text,
+ const char *key,
+ bundle *service_handle);
+
+/**
+ * @internal
+ * @brief This function will be deprecated.
+ * @remarks ID is valid only after inserting the notification.
+ * @param[in] noti Notification handle
+ * @param[out] group_id Group ID
+ * @param[out] priv_id Private ID
+ * @return NOTIFICATION_ERROR_NONE on success, other value on failure
+ * @retval NOTIFICATION_ERROR_NONE Success
+ * @retval NOTIFICATION_ERROR_INVALID_PARAMETER Invalid parameter
+ * @par Sample code:
+ * @code
+#include <notification.h>
+ ...
+ {
+ int noti_err = NOTIFICATION_ERROR_NONE;
+ int group_id, priv_id;
+
+ noti_err = notification_get_id(noti, &group_id, &priv_id);
+ if(noti_err != NOTIFICATION_ERROR_NONE) {
+ return;
+ }
+ }
+ * @endcode
+ */
+NOTIFICATION_DEPRECATED_API int notification_get_id(notification_h noti,
+ int *group_id, int *priv_id);
+
+/**
+ * @internal
+ * @brief This function will be deprecated.
+ * @param[in] type Notification type
+ * @param[in] group_id Group ID
+ * @param[in] priv_id Priv ID
+ * @return Notification handle(#notification_h) on success, NULL on failure
+ * @retval #notification_h Success
+ * @retval NULL Failure
+ * @see #notification_type_e
+ * @see #notification_h
+ * @par Sample code:
+ * @code
+#include <notification.h>
+...
+{
+ notification_h noti = NULL;
+
+ noti = notification_load("org.tizen.app", priv_id);
+ if(noti == NULL) {
+ return;
+ }
+ ...
+}
+ * @endcode
+ */
+NOTIFICATION_DEPRECATED_API notification_h notification_load(char *pkgname,
+ int priv_id);
+
+/**
+ * @internal
+ * @brief This function will be deprecated.
+ * @details Available types are #NOTIFICATION_TYPE_NOTI and #NOTIFICATION_TYPE_ONGOING.
+ * #NOTIFICATION_TYPE_NOTI is remaining notification data even if device is restarted.
+ * #NOTIFICATION_TYPE_ONGOING can display progressive feather, but notification data is removed after device is restarted.
+ * If group_id is #NOTIFICATION_GROUP_ID_NONE, notification data is not grouped. #NOTIFICATION_GROUP_ID_DEFAULT,
+ * notification data is grouped with same title. Positive number ( > 0 ) is grouped with same number.
+ * If priv_id is #NOTIFICATION_PRIV_ID_NONE, priv_id is set internally and return it when notification_insert() call.
+ * Positive number and zero ( >= 0 ) is application set private ID. These ID should have be unique each application package.
+ * @param[in] type Notification type
+ * @param[in] group_id Group ID
+ * @param[in] priv_id Priv ID
+ * @return Notification handle(#notification_h) on success, NULL on failure
+ * @retval #notification_h Success
+ * @retval NULL Failure
+ * @see #notification_type_e
+ * @see #notification_h
+ * @par Sample code:
+ * @code
+#include <notification.h>
+...
+{
+ notification_h noti = NULL;
+
+ noti = notification_new(NOTIFICATION_TYPE_NOTI, APP_GROUP_ID, NOTIFICATION_PRIV_ID_NONE);
+ if(noti == NULL) {
+ return;
+ }
+ ...
+}
+ * @endcode
+ */
+NOTIFICATION_DEPRECATED_API notification_h notification_new(notification_type_e type, int group_id,
+ int priv_id);
+
+/**
+ * @internal
+ * @brief This function will be deprecated.
+ * @param[in] noti Notification handle
+ * @param[in] type Notification execute type
+ * @param[out] text Text for button
+ * @param[out] service_handle Appsvc bundle data
+ * @return NOTIFICATION_ERROR_NONE on success, other value on failure
+ * @retval NOTIFICATION_ERROR_NONE Success
+ * @retval NOTIFICATION_ERROR_INVALID_PARAMETER Invalid parameter
+ * @par Sample code:
+ * @code
+#include <notification.h>
+...
+{
+ notification_h noti = NULL;
+ int noti_err = NOTIFICATION_ERROR_NONE;
+ bundle *b = NULL;
+
+ ...
+
+ noti_err = notification_get_execute_option(noti, NOTIFICATION_EXECUTE_TYPE_SINGLE_LAUNCH, NULL, NULL, &b);
+ if(noti_err != NOTIFICATION_ERROR_NONE) {
+ notification_free(noti);
+ return;
+ }
+}
+ * @endcode
+ */
+NOTIFICATION_DEPRECATED_API int notification_get_execute_option(notification_h noti,
+ notification_execute_type_e type,
+ const char **text,
+ bundle **service_handle);
+
+/**
+ * @internal
+ * @brief This function sets notification property for designated package.
+ * @since_tizen @if WEARABLE 2.3.1 @elseif MOBILE 2.3 @endif
+ * @privlevel public
+ * @privilege http://tizen.org/privilege/core/notification
+ * @param[in] pkgname The name of designated package
+ * @param[in] property name
+ * @param[in] property value
+ * @return #NOTIFICATION_ERROR_NONE if success, other value if failure
+ * @see #notification_error_e
+ */
+int notification_setting_property_set(const char *pkgname, const char *property, const char *value);
+
+/**
+ * @internal
+ * @brief This function gets notification property for designated package.
+ * @since_tizen @if WEARABLE 2.3.1 @elseif MOBILE 2.3 @endif
+ * @privlevel public
+ * @privilege http://tizen.org/privilege/core/notification
+ * @param[in] pkgname The name of designated package
+ * @param[in] property name
+ * @param[in] pointer which can save the getting value
+ * @return #NOTIFICATION_ERROR_NONE if success, other value if failure
+ * @see #notification
+ */
+int notification_setting_property_get(const char *pkgname, const char *property, char **value);
+
+/**
+ * @}
+ */
+
+#ifdef __cplusplus
+}
+#endif
+#endif
diff --git a/include/notification_ipc.h b/include/notification_ipc.h
new file mode 100644
index 0000000..0eb7827
--- /dev/null
+++ b/include/notification_ipc.h
@@ -0,0 +1,64 @@
+/*
+ * libnotification
+ *
+ * Copyright (c) 2000 - 2011 Samsung Electronics Co., Ltd. All rights reserved.
+ *
+ * Contact: Seungtaek Chung <seungtaek.chung@samsung.com>, Mi-Ju Lee <miju52.lee@samsung.com>, Xi Zhichan <zhichan.xi@samsung.com>
+ *
+ * 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 __NOTIFICATION_IPC_H__
+#define __NOTIFICATION_IPC_H__
+
+#include <notification.h>
+
+#define NOTIFICATION_ADDR "/tmp/.notification.service"
+#define NOTIFICATION_DEL_PACKET_UNIT 10
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+struct packet;
+
+int notification_ipc_monitor_init(void);
+int notification_ipc_monitor_fini(void);
+
+int notification_ipc_make_noti_from_packet(notification_h noti, const struct packet *packet);
+struct packet *notification_ipc_make_packet_from_noti(notification_h noti, const char *command, int packet_type);
+struct packet *notification_ipc_make_reply_packet_from_noti(notification_h noti, struct packet *packet);
+
+
+int notification_ipc_request_insert(notification_h noti, int *priv_id);
+int notification_ipc_request_update(notification_h noti);
+int notification_ipc_request_update_async(notification_h noti,
+ void (*result_cb)(int priv_id, int result, void *data), void *user_data);
+int notification_ipc_request_refresh(void);
+int notification_ipc_request_delete_single(notification_type_e type, char *pkgname, int priv_id);
+int notification_ipc_request_delete_multiple(notification_type_e type, char *pkgname);
+
+int notification_ipc_is_master_ready(void);
+int notification_ipc_add_deffered_task(void (*deferred_task_cb)(void *data), void *user_data);
+int notification_ipc_del_deffered_task(void (*deferred_task_cb)(void *data));
+
+int notification_ipc_noti_setting_property_set(const char *pkgname, const char *property, const char *value);
+int notification_ipc_noti_setting_property_get(const char *pkgname, const char *property, char **value);
+
+int notification_ipc_request_load_noti_by_tag(notification_h noti, const char *pkgname, const char *tag);
+
+#ifdef __cplusplus
+}
+#endif
+#endif
diff --git a/include/notification_list.h b/include/notification_list.h
new file mode 100644
index 0000000..e174d6a
--- /dev/null
+++ b/include/notification_list.h
@@ -0,0 +1,281 @@
+/*
+ * libnotification
+ *
+ * Copyright (c) 2000 - 2011 Samsung Electronics Co., Ltd. All rights reserved.
+ *
+ * Contact: Seungtaek Chung <seungtaek.chung@samsung.com>, Mi-Ju Lee <miju52.lee@samsung.com>, Xi Zhichan <zhichan.xi@samsung.com>
+ *
+ * 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 __NOTIFICATION_LIST_H__
+#define __NOTIFICATION_LIST_H__
+
+#include <notification.h>
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/**
+ * @file notification_list.h
+ * @brief This file contains the notification list APIs.
+ */
+
+/**
+ * @internal
+ * @addtogroup NOTIFICATION_LIST
+ * @{
+ */
+
+/**
+ * @brief Notification list handle.
+ * @since_tizen @if WEARABLE 2.3.1 @elseif MOBILE 2.3 @endif
+ */
+typedef struct _notification_list *notification_list_h;
+
+/**
+ * @internal
+ * @brief Gets the head pointer of the notification list.
+ * @since_tizen @if WEARABLE 2.3.1 @elseif MOBILE 2.3 @endif
+ * @remarks The specific error code can be obtained using the get_last_result() method. Error codes are described in Exception section.
+ * @param[in] list Notification list handle
+ * @return Notification list handle on success, NULL on failure
+ * @retval #notification_list_h Success
+ * @retval NULL Failure
+ * @exception #NOTIFICATION_ERROR_NONE Success
+ * @exception #NOTIFICATION_ERROR_INVALID_PARAMETER Invalid input value
+ * @see #notification_list_h
+ * @par Sample code:
+ * @code
+#include <notification.h>
+...
+{
+ notification_list_h noti_list = NULL;
+ int noti_err = NOTIFICATION_ERROR_NONE;
+
+ noti_err = notification_get_grouping_list(NOTIFICATION_TYPE_NONE, -1, &noti_list);
+ if(noti_err != NOTIFICATION_ERROR_NONE) {
+ return;
+ }
+
+ noti_list = notification_list_get_head(noti_list);
+}
+ * @endcode
+ */
+notification_list_h notification_list_get_head(notification_list_h list);
+
+/**
+ * @internal
+ * @brief Gets the tail pointer to the notification list.
+ * @since_tizen @if WEARABLE 2.3.1 @elseif MOBILE 2.3 @endif
+ * @remarks The specific error code can be obtained using the get_last_result() method. Error codes are described in Exception section.
+ * @param[in] list Notification list handle
+ * @return Notification list handle on success, NULL on failure
+ * @retval #notification_list_h Success
+ * @retval NULL Failure
+ * @exception #NOTIFICATION_ERROR_NONE Success
+ * @exception #NOTIFICATION_ERROR_INVALID_PARAMETER Invalid input value
+ * @see #notification_list_h
+ * @par Sample code:
+ * @code
+#include <notification.h>
+...
+{
+ notification_list_h noti_list = NULL;
+ int noti_err = NOTIFICATION_ERROR_NONE;
+
+ noti_err = notification_get_grouping_list(NOTIFICATION_TYPE_NONE, -1, &noti_list);
+ if(noti_err != NOTIFICATION_ERROR_NONE) {
+ return;
+ }
+
+ noti_list = notification_list_get_tail(noti_list);
+}
+ * @endcode
+ */
+notification_list_h notification_list_get_tail(notification_list_h list);
+
+/**
+ * @internal
+ * @brief Gets the previous pointer of the current notification list.
+ * @since_tizen @if WEARABLE 2.3.1 @elseif MOBILE 2.3 @endif
+ * @remarks The specific error code can be obtained using the get_last_result() method. Error codes are described in Exception section.
+ * @param[in] list Notification list handle
+ * @return Notification list handle on success, NULL on failure
+ * @retval #notification_list_h Success
+ * @retval NULL Failure
+ * @exception #NOTIFICATION_ERROR_NONE Success
+ * @exception #NOTIFICATION_ERROR_INVALID_PARAMETER Invalid input value
+ * @see #notification_list_h
+ * @par Sample code:
+ * @code
+#include <notification.h>
+...
+{
+ notification_list_h noti_list = NULL;
+ int noti_err = NOTIFICATION_ERROR_NONE;
+
+ noti_err = notification_get_grouping_list(NOTIFICATION_TYPE_NONE, -1, &noti_list);
+ if(noti_err != NOTIFICATION_ERROR_NONE) {
+ return;
+ }
+
+ noti_list = notification_list_get_prev(noti_list);
+}
+ * @endcode
+ */
+notification_list_h notification_list_get_prev(notification_list_h list);
+
+/**
+ * @internal
+ * @brief Gets the next pointer of the current notification list.
+ * @since_tizen @if WEARABLE 2.3.1 @elseif MOBILE 2.3 @endif
+ * @remarks The specific error code can be obtained using the get_last_result() method. Error codes are described in Exception section.
+ * @param[in] list Notification list handle
+ * @return Notification list handle on success, NULL on failure
+ * @retval #notification_list_h Success
+ * @retval NULL Failure
+ * @exception #NOTIFICATION_ERROR_NONE Success
+ * @exception #NOTIFICATION_ERROR_INVALID_PARAMETER Invalid input value
+ * @see #notification_list_h
+ * @par Sample code:
+ * @code
+#include <notification.h>
+...
+{
+ notification_list_h noti_list = NULL;
+ int noti_err = NOTIFICATION_ERROR_NONE;
+
+ noti_err = notification_get_grouping_list(NOTIFICATION_TYPE_NONE, -1, &noti_list);
+ if(noti_err != NOTIFICATION_ERROR_NONE) {
+ return;
+ }
+
+ noti_list = notification_list_get_next(noti_list);
+}
+ * @endcode
+ */
+notification_list_h notification_list_get_next(notification_list_h list);
+
+/**
+ * @internal
+ * @brief Gets the notification handle that the list has.
+ * @since_tizen @if WEARABLE 2.3.1 @elseif MOBILE 2.3 @endif
+ * @remarks The specific error code can be obtained using the get_last_result() method. Error codes are described in Exception section.
+ * @param[in] list Notification list handle
+ * @return Notification handle on success, NULL on failure
+ * @retval #notification_h Success
+ * @retval NULL Failure
+ * @exception #NOTIFICATION_ERROR_NONE Success
+ * @exception #NOTIFICATION_ERROR_INVALID_PARAMETER Invalid input value
+ * @see #notification_list_h
+ * @see #notification_h
+ * @par Sample code:
+ * @code
+#include <notification.h>
+...
+{
+ notification_h noti = NULL;
+ notification_list_h noti_list = NULL;
+ int noti_err = NOTIFICATION_ERROR_NONE;
+
+ noti_err = notification_get_grouping_list(NOTIFICATION_TYPE_NONE, -1, &noti_list);
+ if(noti_err != NOTIFICATION_ERROR_NONE) {
+ return;
+ }
+
+ noti = notification_list_get_data(noti_list);
+}
+ * @endcode
+ */
+notification_h notification_list_get_data(notification_list_h list);
+
+/**
+ * @internal
+ * @brief Appends notification data to the notification list.
+ * @since_tizen @if WEARABLE 2.3.1 @elseif MOBILE 2.3 @endif
+ * @remarks The specific error code can be obtained using the get_last_result() method. Error codes are described in Exception section.
+ * @param[in] list Notification list handle
+ * @param[in] noti Notification handle
+ * @return Notification handle on success, NULL on failure
+ * @retval #notification_h Success
+ * @retval NULL Failure
+ * @exception #NOTIFICATION_ERROR_NONE Success
+ * @exception #NOTIFICATION_ERROR_INVALID_PARAMETER Invalid input value
+ * @exception #NOTIFICATION_ERROR_OUT_OF_MEMORY Out of memory
+ * @see #notification_list_h
+ * @see #notification_h
+ * @par Sample code:
+ * @code
+#include <notification.h>
+...
+{
+ notification_h noti = NULL;
+ notification_list_h noti_list = NULL;
+ int noti_err = NOTIFICATION_ERROR_NONE;
+
+ noti = notification_new(NOTIFICATION_TYPE_NOTI, NOTIFICATION_GROUP_ID_NONE, NOTIFICATION_PRIV_ID_NONE);
+ if(noti == NULL) {
+ return;
+ }
+
+ noti_list = notification_list_append(noti_list, noti);
+}
+ * @endcode
+ */
+notification_list_h notification_list_append(notification_list_h list,
+ notification_h noti);
+
+/**
+ * @internal
+ * @brief Removes notification data from the notification list.
+ * @since_tizen @if WEARABLE 2.3.1 @elseif MOBILE 2.3 @endif
+ * @remarks The specific error code can be obtained using the get_last_result() method. Error codes are described in Exception section.
+ * @param[in] list The notification list handle
+ * @param[in] noti The notification handle
+ * @return Notification handle on success,
+ * otherwise @c NULL on failure
+ * @retval #notification_h Success
+ * @retval NULL Failure
+ * @exception #NOTIFICATION_ERROR_NONE Success
+ * @exception #NOTIFICATION_ERROR_INVALID_PARAMETER Invalid input value
+ * @see #notification_list_h
+ * @see #notification_h
+ * @par Sample code:
+ * @code
+#include <notification.h>
+...
+{
+ notification_h noti = NULL;
+ notification_list_h noti_list = NULL;
+ int noti_err = NOTIFICATION_ERROR_NONE;
+
+ ...
+
+ noti_list = notification_list_remove(noti_list, noti);
+}
+ * @endcode
+ */
+notification_list_h notification_list_remove(notification_list_h list,
+ notification_h noti);
+
+/**
+ * @}
+ */
+
+#ifdef __cplusplus
+}
+#endif
+#endif /* __NOTIFICATION_LIST_H__ */
diff --git a/include/notification_noti.h b/include/notification_noti.h
new file mode 100644
index 0000000..733acff
--- /dev/null
+++ b/include/notification_noti.h
@@ -0,0 +1,70 @@
+/*
+ * libnotification
+ *
+ * Copyright (c) 2000 - 2011 Samsung Electronics Co., Ltd. All rights reserved.
+ *
+ * Contact: Seungtaek Chung <seungtaek.chung@samsung.com>, Mi-Ju Lee <miju52.lee@samsung.com>, Xi Zhichan <zhichan.xi@samsung.com>
+ *
+ * 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 __NOTIFICATION_NOTI_H__
+#define __NOTIFICATION_NOTI_H__
+
+#include <notification.h>
+
+#define TAG_TIME "TIME"
+#define TAG_TYPE_INVALID -1
+#define TAG_TYPE_TIME 1
+
+int notification_noti_set_tag(const char *tag, char *value, char *buf, int buf_len);
+
+char *notification_noti_strip_tag(const char *tagged_str);
+
+int notification_noti_get_tag_type(const char *tagged_str);
+
+int notification_noti_insert(notification_h noti);
+
+int notification_noti_update(notification_h noti);
+
+int notification_noti_delete_all(notification_type_e type, const char *pkgname, int *num_deleted, int **list_deleted_rowid);
+
+int notification_noti_delete_group_by_group_id(const char *pkgname,
+ int group_id, int *num_deleted, int **list_deleted_rowid);
+
+int notification_noti_delete_group_by_priv_id(const char *pkgname, int priv_id);
+
+int notification_noti_get_by_priv_id(notification_h noti, char *pkgname, int priv_id);
+int notification_noti_get_by_tag(notification_h noti, char *pkgname, char* tag);
+
+int notification_noti_delete_by_priv_id(const char *pkgname, int priv_id);
+int notification_noti_delete_by_priv_id_get_changes(const char *pkgname, int priv_id, int *num_changes);
+
+int notification_noti_get_count(notification_type_e type,
+ const char *pkgname,
+ int group_id, int priv_id,
+ int *count);
+
+int notification_noti_get_grouping_list(notification_type_e type,
+ int count,
+ notification_list_h *list);
+
+int notification_noti_get_detail_list(const char *pkgname,
+ int group_id,
+ int priv_id, int count,
+ notification_list_h *list);
+
+int notification_noti_check_tag(notification_h noti);
+
+#endif /* __NOTIFICATION_NOTI_H__ */
diff --git a/include/notification_ongoing.h b/include/notification_ongoing.h
new file mode 100644
index 0000000..5fb4141
--- /dev/null
+++ b/include/notification_ongoing.h
@@ -0,0 +1,36 @@
+/*
+ * libnotification
+ *
+ * Copyright (c) 2000 - 2011 Samsung Electronics Co., Ltd. All rights reserved.
+ *
+ * Contact: Seungtaek Chung <seungtaek.chung@samsung.com>, Mi-Ju Lee <miju52.lee@samsung.com>, Xi Zhichan <zhichan.xi@samsung.com>
+ *
+ * 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 __NOTIFICATION_ONGOING_H__
+#define __NOTIFICATION_ONGOING_H__
+
+#include <notification.h>
+int notification_ongoing_update_progress(const char *caller_pkgname,
+ int priv_id,
+ double progress);
+
+int notification_ongoing_update_size(const char *caller_pkgname,
+ int priv_id, double size);
+
+int notification_ongoing_update_content(const char *caller_pkgname,
+ int priv_id, const char *content);
+
+#endif /* __NOTIFICATION_ONGOING_H__ */
diff --git a/include/notification_private.h b/include/notification_private.h
new file mode 100644
index 0000000..a5c7cb0
--- /dev/null
+++ b/include/notification_private.h
@@ -0,0 +1,84 @@
+/*
+ * libnotification
+ *
+ * Copyright (c) 2000 - 2011 Samsung Electronics Co., Ltd. All rights reserved.
+ *
+ * Contact: Seungtaek Chung <seungtaek.chung@samsung.com>, Mi-Ju Lee <miju52.lee@samsung.com>, Xi Zhichan <zhichan.xi@samsung.com>
+ *
+ * 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 __NOTIFICATION_PRIVATE_H__
+#define __NOTIFICATION_PRIVATE_H__
+
+#ifndef EXPORT_API
+#define EXPORT_API __attribute__ ((visibility("default")))
+#endif
+
+struct _notification {
+ notification_type_e type;
+ notification_ly_type_e layout;
+
+ int group_id; /* Group ID */
+ int internal_group_id; /* Internal Group ID */
+ int priv_id; /* Private ID */
+
+ char *caller_pkgname; /* Caller App package name */
+ char *launch_pkgname; /* Launch App package name. It will be from appsvc_set_pkgname */
+ bundle *args; /* Will be removed. */
+ bundle *group_args; /* Will be removed. */
+
+ bundle *b_execute_option;
+ bundle *b_service_responding;
+ bundle *b_service_single_launch;
+ bundle *b_service_multi_launch;
+
+ char *domain; /* Text domain for localization */
+ char *dir; /* Text dir for localization */
+
+ bundle *b_text; /* basic text */
+ bundle *b_key; /* key for localized text */
+ bundle *b_format_args; /* args type and value for format string */
+ int num_format_args; /* number of format string args */
+
+ bundle *b_image_path; /* image path */
+
+ notification_sound_type_e sound_type;
+ char *sound_path;
+ notification_vibration_type_e vibration_type;
+ char *vibration_path;
+ notification_led_op_e led_operation;
+ int led_argb;
+ int led_on_ms;
+ int led_off_ms;
+
+ time_t time; /* time set by application */
+ time_t insert_time; /* insert time */
+
+ int flags_for_property; /* property NOTIFICATION_PROP_XXX */
+ int display_applist; /* display app list NOTIFICATION_DISPLAY_APP_XXX */
+
+ double progress_size; /* size of progress */
+ double progress_percentage; /* percentage of progress */
+
+ char *app_icon_path; /* Temporary stored app icon path from AIL */
+ char *app_name; /* Temporary stored app name from AIL */
+ char *temp_title;
+ char *temp_content;
+ char *tag;
+};
+
+void notification_call_changed_cb(notification_op *op_list, int op_num);
+
+#endif /* __NOTIFICATION_PRIVATE_H__ */
diff --git a/include/notification_setting.h b/include/notification_setting.h
new file mode 100644
index 0000000..6acc7bf
--- /dev/null
+++ b/include/notification_setting.h
@@ -0,0 +1,39 @@
+/*
+ * libnotification
+ *
+ * Copyright (c) 2000 - 2011 Samsung Electronics Co., Ltd. All rights reserved.
+ *
+ * Contact: Seungtaek Chung <seungtaek.chung@samsung.com>, Mi-Ju Lee <miju52.lee@samsung.com>, Xi Zhichan <zhichan.xi@samsung.com>
+ *
+ * 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 __NOTIFICATION_SETTING_H__
+#define __NOTIFICATION_SETTING_H__
+
+#include <notification.h>
+
+typedef struct _notification_setting_h notification_setting_h;
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+notification_error_e notification_setting_property_set(const char *pkgname, const char *property, const char *value);
+notification_error_e notification_setting_property_get(const char *pkgname, const char *property, char **value);
+
+#ifdef __cplusplus
+}
+#endif
+#endif /* __NOTIFICATION_SETTING_H__ */
diff --git a/include/notification_setting_service.h b/include/notification_setting_service.h
new file mode 100644
index 0000000..789d60e
--- /dev/null
+++ b/include/notification_setting_service.h
@@ -0,0 +1,37 @@
+/*
+ * libnotification
+ *
+ * Copyright (c) 2000 - 2011 Samsung Electronics Co., Ltd. All rights reserved.
+ *
+ * Contact: Seungtaek Chung <seungtaek.chung@samsung.com>, Mi-Ju Lee <miju52.lee@samsung.com>, Xi Zhichan <zhichan.xi@samsung.com>
+ *
+ * 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 __NOTIFICATION_SETTING_SERVICE_H__
+#define __NOTIFICATION_SETTING_SERVICE_H__
+
+#include <notification.h>
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+int notification_setting_db_set(const char *pkgname, const char *property, const char *value);
+int notification_setting_db_get(const char *pkgname, const char *property, char **value);
+
+#ifdef __cplusplus
+}
+#endif
+#endif /* __NOTIFICATION_SETTING_SERVICE_H__ */
diff --git a/include/notification_status.h b/include/notification_status.h
new file mode 100644
index 0000000..35b8e5b
--- /dev/null
+++ b/include/notification_status.h
@@ -0,0 +1,96 @@
+/*
+ * libnotification
+ *
+ * Copyright (c) 2000 - 2011 Samsung Electronics Co., Ltd. All rights reserved.
+ *
+ * Contact: Seungtaek Chung <seungtaek.chung@samsung.com>, Mi-Ju Lee <miju52.lee@samsung.com>, Xi Zhichan <zhichan.xi@samsung.com>
+ *
+ * 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 __NOTIFICATION_STATUS_DEF_H__
+#define __NOTIFICATION_STATUS_DEF_H__
+
+#ifdef __cplusplus
+extern "C" {
+#endif /* __cplusplus */
+
+/**
+ * @file notification_status.h
+ */
+
+/**
+ * @addtogroup NOTIFICATION_STATUS
+ * @{
+ */
+
+/**
+ * @internal
+ * @brief Called when a new message is posted.
+ * @since_tizen @if WEARABLE 2.3.1 @elseif MOBILE 2.3 @endif
+ * @param[in] message The message posted
+ * @param[in] data The user data
+ * @pre notification_status_monitor_message_cb_set() used to register this callback.
+ * @see notification_status_monitor_message_cb_set()
+*/
+typedef void (*notification_status_message_cb)(const char *message, void *data);
+
+/**
+ * @internal
+ * @brief Registers a callback to receive a message.
+ * @since_tizen @if WEARABLE 2.3.1 @elseif MOBILE 2.3 @endif
+ * @param[in] callback The callback function
+ * @param[in] data The user_data
+ * @return #NOTIFICATION_ERROR_NONE if success, other value if failure
+ * @retval #NOTIFICATION_ERROR_NONE Success
+ * @retval #NOTIFICATION_ERROR_INVALID_PARAMETER Invalid parameter
+ * @retval #NOTIFICATION_ERROR_FROM_DBUS Error from DBus
+ */
+int notification_status_monitor_message_cb_set(notification_status_message_cb callback, void *user_data);
+
+/**
+ * @internal
+ * @brief Unregisters a callback to receive a message.
+ * @since_tizen @if WEARABLE 2.3.1 @elseif MOBILE 2.3 @endif
+ * @param[in] callback The callback function
+ * @param[in] data The user_data
+ * @return #NOTIFICATION_ERROR_NONE if success, other value if failure
+ * @retval #NOTIFICATION_ERROR_NONE Success
+ */
+int notification_status_monitor_message_cb_unset(void);
+
+/**
+ * @brief Sends a string (message) to the notification status monitor.
+ * @since_tizen @if WEARABLE 2.3.1 @elseif MOBILE 2.3 @endif
+ * @privlevel public
+ * @privilege %http://tizen.org/privilege/notification
+ * @param[in] message The messages to be posted
+
+ * @return #NOTIFICATION_ERROR_NONE on success,
+ * otherwise any other value on failure
+ * @retval #NOTIFICATION_ERROR_INVALID_PARAMETER Invalid parameter
+ * @retval #NOTIFICATION_ERROR_FROM_DBUS Error from DBus
+ * @retval #NOTIFICATION_ERROR_PERMISSION_DENIED The application does not have the privilege to call this method
+ * @see #notification_error_e
+ */
+int notification_status_message_post(const char *message);
+
+/**
+ * @}
+ */
+
+#ifdef __cplusplus
+}
+#endif /* __cplusplus */
+#endif /* __NOTIFICATION_STATUS_DEF_H__ */
diff --git a/include/notification_type.h b/include/notification_type.h
new file mode 100644
index 0000000..9e3cba5
--- /dev/null
+++ b/include/notification_type.h
@@ -0,0 +1,385 @@
+/*
+ * libnotification
+ *
+ * Copyright (c) 2000 - 2011 Samsung Electronics Co., Ltd. All rights reserved.
+ *
+ * Contact: Seungtaek Chung <seungtaek.chung@samsung.com>, Mi-Ju Lee <miju52.lee@samsung.com>, Xi Zhichan <zhichan.xi@samsung.com>
+ *
+ * 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 __NOTIFICATION_TYPE_H__
+#define __NOTIFICATION_TYPE_H__
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#ifndef NOTIFICATION_DEPRECATED_API
+#if 0//__GNUC__
+#define NOTIFICATION_DEPRECATED_API __attribute__((deprecated))
+#else
+#define NOTIFICATION_DEPRECATED_API
+#endif
+#endif
+
+/**
+ * @file notification_type.h
+ * @brief This file contains type definitions and enumerations for Notification API.
+ */
+
+/**
+ * @addtogroup NOTIFICATION_MODULE
+ * @{
+ */
+
+/**
+ * @brief Enumeration for notification layout type.
+ * @since_tizen @if WEARABLE 2.3.1 @elseif MOBILE 2.3 @endif
+ */
+typedef enum _notification_ly_type {
+ NOTIFICATION_LY_NONE = 0,
+ /**< Default */
+ NOTIFICATION_LY_NOTI_EVENT_SINGLE,
+ /**< Layout for notification. Used to inform single event*/
+ NOTIFICATION_LY_NOTI_EVENT_MULTIPLE,
+ /**< Layout for notification. Used to inform multiple event*/
+ NOTIFICATION_LY_NOTI_THUMBNAIL,
+ /**< Layout for notification. Used to display images*/
+ NOTIFICATION_LY_ONGOING_EVENT,
+ /**< Layout for ongoing notification. Used to display text message*/
+ NOTIFICATION_LY_ONGOING_PROGRESS,
+ /**< Layout for ongoing notification. Used to display progress*/
+ NOTIFICATION_LY_MAX,
+ /**< TBD */
+} notification_ly_type_e;
+
+/**
+ * @brief Enumeration for notification lauch option type.
+ * @since_tizen @if WEARABLE 2.3.1 @elseif MOBILE 2.3 @endif
+ */
+typedef enum _notification_launch_option_type {
+ NOTIFICATION_LAUNCH_OPTION_APP_CONTROL = 1,
+ /**< launching with app control */
+} notification_launch_option_type;
+
+/**
+ * @brief Enumeration for notification sound type.
+ * @since_tizen @if WEARABLE 2.3.1 @elseif MOBILE 2.3 @endif
+ */
+typedef enum _notification_sound_type {
+ NOTIFICATION_SOUND_TYPE_NONE = -1,
+ /**< Default value. no sound */
+ NOTIFICATION_SOUND_TYPE_DEFAULT = 0,
+ /**< Default sound */
+ NOTIFICATION_SOUND_TYPE_USER_DATA,
+ /**< User sound data */
+ NOTIFICATION_SOUND_TYPE_MAX,
+ /**< Max flag */
+} notification_sound_type_e;
+
+/**
+ * @brief Enumeration for notification vibration type.
+ * @since_tizen @if WEARABLE 2.3.1 @elseif MOBILE 2.3 @endif
+ */
+typedef enum _notification_vibration_type {
+ NOTIFICATION_VIBRATION_TYPE_NONE = -1,
+ /**< Default value. No vibration */
+ NOTIFICATION_VIBRATION_TYPE_DEFAULT = 0,/**< Default vibrate pattern */
+ NOTIFICATION_VIBRATION_TYPE_USER_DATA,
+ /**< User vibration data */
+ NOTIFICATION_VIBRATION_TYPE_MAX,/**< Max flag */
+} notification_vibration_type_e;
+
+/**
+ * @brief Enumeration for notification LED operation.
+ * @since_tizen @if WEARABLE 2.3.1 @elseif MOBILE 2.3 @endif
+ */
+typedef enum _notification_led_op {
+ NOTIFICATION_LED_OP_OFF = -1,
+ /**< Default value. Disable the LED notification */
+ NOTIFICATION_LED_OP_ON = 0,/**< Turn on the LED with default color */
+ NOTIFICATION_LED_OP_ON_CUSTOM_COLOR,
+ /**< Turn on the LED with custom color */
+ NOTIFICATION_LED_OP_MAX,/**< Max flag */
+} notification_led_op_e;
+
+/**
+ * @brief This will be deprecated.
+ * @since_tizen @if WEARABLE 2.3.1 @elseif MOBILE 2.3 @endif
+ */
+typedef enum _notification_count_display_type {
+ NOTIFICATION_COUNT_DISPLAY_TYPE_NONE = -1, /**< None */
+ NOTIFICATION_COUNT_DISPLAY_TYPE_LEFT = 0, /**< The number is placed to left */
+ NOTIFICATION_COUNT_DISPLAY_TYPE_IN, /**< The number is placed to center */
+ NOTIFICATION_COUNT_DISPLAY_TYPE_RIGHT, /**< The number is placed to right */
+ NOTIFICATION_COUNT_DISPLAY_TYPE_MAX, /**< Max flag */
+} notification_count_display_type_e;
+
+/**
+ * @brief Enumeration for notification text type.
+ * @since_tizen @if WEARABLE 2.3.1 @elseif MOBILE 2.3 @endif
+ */
+typedef enum _notification_text_type {
+ NOTIFICATION_TEXT_TYPE_NONE = -1,
+ /**< NONE */
+ NOTIFICATION_TEXT_TYPE_TITLE = 0,
+ /**< Title */
+ NOTIFICATION_TEXT_TYPE_CONTENT,
+ /**< Content */
+ NOTIFICATION_TEXT_TYPE_CONTENT_FOR_DISPLAY_OPTION_IS_OFF,
+ /**< Content for content display option is off of the Settings */
+ NOTIFICATION_TEXT_TYPE_EVENT_COUNT,
+ /**< Text to display event count */
+ NOTIFICATION_TEXT_TYPE_INFO_1,
+ /**< Box contents 1 */
+ NOTIFICATION_TEXT_TYPE_INFO_SUB_1,
+ /**< Box contents 1-1 */
+ NOTIFICATION_TEXT_TYPE_INFO_2,
+ /**< Box contents 2 */
+ NOTIFICATION_TEXT_TYPE_INFO_SUB_2,
+ /**< Box contents 2-1 */
+ NOTIFICATION_TEXT_TYPE_INFO_3,
+ /**< Box contents 3 */
+ NOTIFICATION_TEXT_TYPE_INFO_SUB_3,
+ /**< Box contents 3-1 */
+ NOTIFICATION_TEXT_TYPE_GROUP_TITLE,
+ /**< Group title */
+ NOTIFICATION_TEXT_TYPE_GROUP_CONTENT,
+ /**< Group content */
+ NOTIFICATION_TEXT_TYPE_GROUP_CONTENT_FOR_DISPLAY_OPTION_IS_OFF,
+ /**< Group content for content display option is off of the Settings */
+ NOTIFICATION_TEXT_TYPE_MAX,
+ /**< Max flag */
+} notification_text_type_e;
+
+/**
+ * @brief Enumeration for image type.
+ * @since_tizen @if WEARABLE 2.3.1 @elseif MOBILE 2.3 @endif
+ */
+typedef enum _notification_image_type {
+ NOTIFICATION_IMAGE_TYPE_NONE = -1,
+ /**< NONE */
+ NOTIFICATION_IMAGE_TYPE_ICON = 0,
+ /**< Icon */
+ NOTIFICATION_IMAGE_TYPE_ICON_FOR_INDICATOR,
+ /**< Indicator icon */
+ NOTIFICATION_IMAGE_TYPE_ICON_FOR_LOCK,
+ /**< Lock screen icon */
+ NOTIFICATION_IMAGE_TYPE_THUMBNAIL,
+ /**< Thumbnail */
+ NOTIFICATION_IMAGE_TYPE_THUMBNAIL_FOR_LOCK,
+ /**< Lock screen thumbnail */
+ NOTIFICATION_IMAGE_TYPE_ICON_SUB,
+ /**< Icon */
+ NOTIFICATION_IMAGE_TYPE_BACKGROUND,
+ /**< image displayed on background */
+ NOTIFICATION_IMAGE_TYPE_LIST_1,
+ /**< Image for thumbnail list */
+ NOTIFICATION_IMAGE_TYPE_LIST_2,
+ /**< Image for thumbnail list */
+ NOTIFICATION_IMAGE_TYPE_LIST_3,
+ /**< Image for thumbnail list */
+ NOTIFICATION_IMAGE_TYPE_LIST_4,
+ /**< Image for thumbnail list */
+ NOTIFICATION_IMAGE_TYPE_LIST_5,
+ /**< Image for thumbnail list */
+ NOTIFICATION_IMAGE_TYPE_MAX,
+ /**< Max flag */
+} notification_image_type_e;
+
+/*typedef enum _notification_button_type {
+ NOTIFICATION_BUTTON_TYPE_NONE = -1,
+ NOTIFICATION_BUTTON_TYPE_RUN = 0,
+ NOTIFICATION_BUTTON_TYPE_VIEW,
+ NOTIFICATION_BUTTON_TYPE_DISMISS,
+ NOTIFICATION_BUTTON_TYPE_MAX,
+}notification_button_type_e;*/
+
+/**
+ * @brief Enumeration for application execution type.
+ * @since_tizen @if WEARABLE 2.3.1 @elseif MOBILE 2.3 @endif
+ */
+typedef enum _notification_execute_type {
+ NOTIFICATION_EXECUTE_TYPE_NONE = -1,
+ /**< No operation */
+ NOTIFICATION_EXECUTE_TYPE_RESPONDING = 0,
+ /**< Responding action*/
+ NOTIFICATION_EXECUTE_TYPE_SINGLE_LAUNCH,/**< Launching when notification data is single */
+ NOTIFICATION_EXECUTE_TYPE_MULTI_LAUNCH,
+ /**< Launching when notification data is grouping(multi) */
+ NOTIFICATION_EXECUTE_TYPE_MAX,
+ /**< Max flag */
+} notification_execute_type_e;
+
+/**
+ * @brief Enumeration for notification type.
+ * @since_tizen @if WEARABLE 2.3.1 @elseif MOBILE 2.3 @endif
+ */
+typedef enum _notification_type {
+ NOTIFICATION_TYPE_NONE = -1,
+ /**< None */
+ NOTIFICATION_TYPE_NOTI = 0,
+ /**< Notification type */
+ NOTIFICATION_TYPE_ONGOING,
+ /**< Ongoing type */
+ NOTIFICATION_TYPE_MAX,
+ /**< Max flag */
+} notification_type_e;
+
+/**
+ * @brief Enumeration for Group ID.
+ * @since_tizen @if WEARABLE 2.3.1 @elseif MOBILE 2.3 @endif
+ */
+enum _notification_group_id {
+ NOTIFICATION_GROUP_ID_NONE = -1,/**< Not Grouping */
+ NOTIFICATION_GROUP_ID_DEFAULT = 0,
+ /**< Notification that has same title is grouping */
+};
+
+/**
+ * @brief Enumeration for Private ID.
+ * @since_tizen @if WEARABLE 2.3.1 @elseif MOBILE 2.3 @endif
+ */
+enum _notification_priv_id {
+ NOTIFICATION_PRIV_ID_NONE = -1,
+ /**< Internally set priv_id */
+};
+
+/**
+ * @brief Enumeration for notification property.
+ * @since_tizen @if WEARABLE 2.3.1 @elseif MOBILE 2.3 @endif
+ */
+enum _notification_property {
+ NOTIFICATION_PROP_DISPLAY_ONLY_SIMMODE = 0x00000001,
+ /**< Display only SIM card inserted */
+ NOTIFICATION_PROP_DISABLE_APP_LAUNCH = 0x00000002,
+ /**< Disable application launch when it selected */
+ NOTIFICATION_PROP_DISABLE_AUTO_DELETE = 0x00000004,
+ /**< Disable auto delete when it selected */
+ NOTIFICATION_PROP_LAUNCH_UG = 0x00000008,
+ /**< Will be deprecated. Notification Tray should launch application using appsvc API */
+ NOTIFICATION_PROP_DISABLE_TICKERNOTI = 0x00000010,
+ /**< Will be deprecated. Use notification_set_display_applist API */
+ NOTIFICATION_PROP_PERMANENT_DISPLAY = 0x00000020,
+ /** < Will be deprecated. */
+ NOTIFICATION_PROP_DISABLE_UPDATE_ON_INSERT = 0x00000040,/**< Disable update when it inserted. */
+ NOTIFICATION_PROP_DISABLE_UPDATE_ON_DELETE = 0x00000080,/**< Disable update when it deleted. */
+ NOTIFICATION_PROP_VOLATILE_DISPLAY = 0x00000100,/**< Deleted when device is rebooted eventhough NOTIFICATION_TYPE_NOTI type */
+};
+
+/**
+ * @brief Enumeration for display application list.
+ * @since_tizen @if WEARABLE 2.3.1 @elseif MOBILE 2.3 @endif
+ */
+enum _notificaton_display_applist {
+ NOTIFICATION_DISPLAY_APP_NOTIFICATION_TRAY = 0x00000001,/**< Notification Tray(Quickpanel) */
+ NOTIFICATION_DISPLAY_APP_TICKER = 0x00000002,
+ /**< Ticker notification */
+ NOTIFICATION_DISPLAY_APP_LOCK = 0x00000004,
+ /**< Lock screen */
+ NOTIFICATION_DISPLAY_APP_INDICATOR = 0x00000008,/**< Indicator */
+ NOTIFICATION_DISPLAY_APP_ALL = 0xffffffff,
+ /**< All display application */
+};
+
+/**
+ * @brief Enumeration for notification operation code.
+ * @since_tizen @if WEARABLE 2.3.1 @elseif MOBILE 2.3 @endif
+ */
+typedef enum _notification_op_type {
+ NOTIFICATION_OP_NONE = 0, /**< Default */
+ NOTIFICATION_OP_INSERT = 1, /**< Notification inserted */
+ NOTIFICATION_OP_UPDATE, /**< Notification updated */
+ NOTIFICATION_OP_DELETE, /**< Notification deleted */
+ NOTIFICATION_OP_DELETE_ALL, /**< Notifications deleted */
+ NOTIFICATION_OP_REFRESH, /**< Deprecated */
+ NOTIFICATION_OP_SERVICE_READY, /**< Notification service is ready */
+} notification_op_type_e;
+
+/**
+ * @brief Enumeration for notification operation data code
+ * @since_tizen @if WEARABLE 2.3.1 @elseif MOBILE 2.3 @endif
+ */
+typedef enum _notification_op_data_type {
+ NOTIFICATION_OP_DATA_MIN = 0, /**< Default */
+ NOTIFICATION_OP_DATA_TYPE, /**< Operation type */
+ NOTIFICATION_OP_DATA_PRIV_ID, /**< Private ID */
+ NOTIFICATION_OP_DATA_NOTI, /**< Notification handler */
+ NOTIFICATION_OP_DATA_EXTRA_INFO_1, /**< Reserved */
+ NOTIFICATION_OP_DATA_EXTRA_INFO_2, /**< Reserved */
+ NOTIFICATION_OP_DATA_MAX, /**< Max flag */
+} notification_op_data_type_e;
+
+/**
+ * @brief Enumeration for notification count position in the text.
+ * @since_tizen @if WEARABLE 2.3.1 @elseif MOBILE 2.3 @endif
+ */
+typedef enum _notifcation_count_pos_type {
+ NOTIFICATION_COUNT_POS_NONE = -1,
+ /**< Count data is not displaying in the text */
+ NOTIFICATION_COUNT_POS_LEFT = 0,/**< Count data is displaying at the left of the text */
+ NOTIFICATION_COUNT_POS_IN,
+ /**< Count data is displaying in the text */
+ NOTIFICATION_COUNT_POS_RIGHT,
+ /**< Count data is displaying at the right of the text */
+ NOTIFICATION_COUNT_POS_MAX,
+ /**< Max flag */
+} notification_count_pos_type_e;
+
+/**
+ * @brief Enumeration for notification variable parameter type.
+ * @since_tizen @if WEARABLE 2.3.1 @elseif MOBILE 2.3 @endif
+ */
+typedef enum _notification_variable_type {
+ NOTIFICATION_VARIABLE_TYPE_NONE = -1,
+ /**< Variable parameter type is NONE */
+ NOTIFICATION_VARIABLE_TYPE_INT = 0,
+ /**< Variable parameter type is int */
+ NOTIFICATION_VARIABLE_TYPE_DOUBLE,
+ /**< Variable parameter type is double */
+ NOTIFICATION_VARIABLE_TYPE_STRING,
+ /**< Variable parameter type is string */
+ NOTIFICATION_VARIABLE_TYPE_COUNT,
+ /**< Variable parameter type is count */
+ NOTIFICATION_VARIABLE_TYPE_MAX,
+ /**< Max flag */
+} notification_variable_type_e;
+
+/**
+ * @brief Notification handle.
+ * @since_tizen @if WEARABLE 2.3.1 @elseif MOBILE 2.3 @endif
+ */
+typedef struct _notification *notification_h;
+
+/**
+ * @brief The structure for notification operation.
+ * @since_tizen @if WEARABLE 2.3.1 @elseif MOBILE 2.3 @endif
+ */
+typedef struct _notification_op {
+ notification_op_type_e type; /**< Notification operation type */
+ int priv_id; /**< private ID */
+ int extra_info_1; /**< Reserved */
+ int extra_info_2; /**< Reserved */
+ notification_h noti; /**< Notification handler */
+} notification_op;
+
+/**
+ * @}
+ */
+
+#ifdef __cplusplus
+}
+#endif
+#endif /* __NOTIFICATION_TYPE_H__ */
diff --git a/notification-service.pc.in b/notification-service.pc.in
new file mode 100644
index 0000000..2708490
--- /dev/null
+++ b/notification-service.pc.in
@@ -0,0 +1,11 @@
+prefix=@PREFIX@
+exec_prefix=@EXEC_PREFIX@
+libdir=@LIBDIR@
+includedir=@INCLUDEDIR@/service
+
+Name: notification
+Description: Notification Library
+Version: @VERSION@
+Requires: bundle
+Libs: -L${libdir} -lnotification
+Cflags: -I${includedir}
diff --git a/notification.manifest b/notification.manifest
new file mode 100644
index 0000000..061daab
--- /dev/null
+++ b/notification.manifest
@@ -0,0 +1,16 @@
+<manifest>
+ <define>
+ <domain name="notification"/>
+ <provide>
+ <label name="notification::db"/>
+ </provide>
+ </define>
+ <assign>
+ <filesystem path="/usr/lib/libnotification.so.0.1.0" label="_"/>
+ <filesystem path="/usr/lib/libnotification.so.0" label="_"/>
+ <filesystem path="/usr/lib/libnotification.so" label="_"/>
+ </assign>
+ <request>
+ <domain name="notification"/>
+ </request>
+</manifest>
diff --git a/notification.pc.in b/notification.pc.in
new file mode 100644
index 0000000..15e8662
--- /dev/null
+++ b/notification.pc.in
@@ -0,0 +1,11 @@
+prefix=@PREFIX@
+exec_prefix=@EXEC_PREFIX@
+libdir=@LIBDIR@
+includedir=@INCLUDEDIR@
+
+Name: notification
+Description: Notification Library
+Version: @VERSION@
+Requires: bundle capi-base-common
+Libs: -L${libdir} -lnotification
+Cflags: -I${includedir}
diff --git a/packaging/notification.spec b/packaging/notification.spec
new file mode 100644
index 0000000..1b8aa1a
--- /dev/null
+++ b/packaging/notification.spec
@@ -0,0 +1,203 @@
+Name: notification
+Summary: notification library
+Version: 0.2.25
+Release: 1
+Group: TBD
+License: Apache License, Version 2.0
+Source0: %{name}-%{version}.tar.gz
+BuildRequires: pkgconfig(sqlite3)
+BuildRequires: pkgconfig(db-util)
+BuildRequires: pkgconfig(vconf)
+BuildRequires: pkgconfig(bundle)
+BuildRequires: pkgconfig(dbus-1)
+BuildRequires: pkgconfig(dlog)
+BuildRequires: pkgconfig(ail)
+BuildRequires: pkgconfig(aul)
+BuildRequires: pkgconfig(appsvc)
+BuildRequires: pkgconfig(dbus-glib-1)
+BuildRequires: pkgconfig(com-core)
+BuildRequires: pkgconfig(capi-appfw-application)
+BuildRequires: pkgconfig(capi-appfw-package-manager)
+BuildRequires: pkgconfig(edbus)
+BuildRequires: pkgconfig(elementary)
+BuildRequires: pkgconfig(ecore)
+BuildRequires: pkgconfig(eina)
+
+BuildRequires: cmake
+Requires(post): /sbin/ldconfig
+Requires(post): /usr/bin/sqlite3
+requires(postun): /sbin/ldconfig
+
+%description
+Client/Server library for sending notifications.
+
+%prep
+%setup -q
+
+%package devel
+Summary: Notification library (devel)
+Group: Development/Libraries
+Requires: %{name} = %{version}-%{release}
+
+%description devel
+Development files needed to build software that needs to system a system notification.
+
+%package service-devel
+Summary: Notification library (service-devel)
+Group: Development/Libraries
+Requires: %{name} = %{version}-%{release}
+
+%description service-devel
+Development files needed to build notification service
+
+%build
+%if 0%{?tizen_build_binary_release_type_eng}
+export CFLAGS="$CFLAGS -DTIZEN_ENGINEER_MODE"
+export CXXFLAGS="$CXXFLAGS -DTIZEN_ENGINEER_MODE"
+export FFLAGS="$FFLAGS -DTIZEN_ENGINEER_MODE"
+%endif
+%if 0%{?sec_build_binary_debug_enable}
+export CFLAGS="$CFLAGS -DTIZEN_DEBUG_ENABLE"
+export CXXFLAGS="$CXXFLAGS -DTIZEN_DEBUG_ENABLE"
+export FFLAGS="$FFLAGS -DTIZEN_DEBUG_ENABLE"
+%endif
+export LDFLAGS+="-Wl,--rpath=%{_prefix}/lib -Wl,--as-needed"
+LDFLAGS="$LDFLAGS" cmake . -DCMAKE_INSTALL_PREFIX=%{_prefix}
+make %{?jobs:-j%jobs}
+
+%install
+rm -rf %{buildroot}
+%make_install
+
+mkdir -p %{buildroot}/usr/share/license
+cp -f LICENSE %{buildroot}/usr/share/license/%{name}
+
+%clean
+rm -rf %{buildroot}
+
+%post
+/sbin/ldconfig
+
+if [ ! -d /opt/dbspace ]
+then
+ mkdir /opt/dbspace
+fi
+
+if [ ! -f /opt/dbspace/.notification.db ]
+then
+ sqlite3 /opt/dbspace/.notification.db 'PRAGMA journal_mode = PERSIST;
+ create table if not exists noti_list (
+ type INTEGER NOT NULL,
+ layout INTEGER NOT NULL default 0,
+ caller_pkgname TEXT NOT NULL,
+ launch_pkgname TEXT,
+ image_path TEXT,
+ group_id INTEGER default 0,
+ internal_group_id INTEGER default 0,
+ priv_id INTERGER NOT NULL,
+ title_key TEXT,
+ b_text TEXT,
+ b_key TEXT,
+ tag TEXT,
+ b_format_args TEXT,
+ num_format_args INTEGER default 0,
+ text_domain TEXT,
+ text_dir TEXT,
+ time INTEGER default 0,
+ insert_time INTEGER default 0,
+ args TEXT,
+ group_args TEXT,
+ b_execute_option TEXT,
+ b_service_responding TEXT,
+ b_service_single_launch TEXT,
+ b_service_multi_launch TEXT,
+ sound_type INTEGER default 0,
+ sound_path TEXT,
+ vibration_type INTEGER default 0,
+ vibration_path TEXT,
+ led_operation INTEGER default 0,
+ led_argb INTEGER default 0,
+ led_on_ms INTEGER default -1,
+ led_off_ms INTEGER default -1,
+ flags_for_property INTEGER default 0,
+ flag_simmode INTEGER default 0,
+ display_applist INTEGER,
+ progress_size DOUBLE default 0,
+ progress_percentage DOUBLE default 0,
+ rowid INTEGER PRIMARY KEY AUTOINCREMENT,
+ UNIQUE (caller_pkgname, priv_id)
+ );
+ create table if not exists noti_group_data (
+ caller_pkgname TEXT NOT NULL,
+ group_id INTEGER default 0,
+ badge INTEGER default 0,
+ title TEXT,
+ content TEXT,
+ loc_title TEXT,
+ loc_content TEXT,
+ count_display_title INTEGER,
+ count_display_content INTEGER,
+ rowid INTEGER PRIMARY KEY AUTOINCREMENT,
+ UNIQUE (caller_pkgname, group_id)
+ );
+ create table if not exists ongoing_list (
+ caller_pkgname TEXT NOT NULL,
+ launch_pkgname TEXT,
+ icon_path TEXT,
+ group_id INTEGER default 0,
+ internal_group_id INTEGER default 0,
+ priv_id INTERGER NOT NULL,
+ title TEXT,
+ content TEXT,
+ default_content TEXT,
+ loc_title TEXT,
+ loc_content TEXT,
+ loc_default_content TEXT,
+ text_domain TEXT,
+ text_dir TEXT,
+ args TEXT,
+ group_args TEXT,
+ flag INTEGER default 0,
+ progress_size DOUBLE default 0,
+ progress_percentage DOUBLE default 0,
+ rowid INTEGER PRIMARY KEY AUTOINCREMENT,
+ UNIQUE (caller_pkgname, priv_id)
+ );
+ '
+fi
+
+chown :5000 /opt/dbspace/.notification.db
+chown :5000 /opt/dbspace/.notification.db-journal
+chmod 644 /opt/dbspace/.notification.db
+chmod 644 /opt/dbspace/.notification.db-journal
+if [ -f /usr/lib/rpm-plugins/msm.so ]
+then
+ chsmack -a 'notification::db' /opt/dbspace/.notification.db*
+fi
+SMACK_OPTION="-s system::vconf_misc"
+vconftool set -t string memory/private/libstatus/message "" -i -g 5000 -f $SMACK_OPTION
+
+%postun -p /sbin/ldconfig
+
+%files
+%manifest notification.manifest
+%defattr(-,root,root,-)
+%{_libdir}/libnotification.so*
+/usr/share/license/%{name}
+
+%files devel
+%defattr(-,root,root,-)
+%{_includedir}/notification/notification.h
+%{_includedir}/notification/notification_internal.h
+%{_includedir}/notification/notification_error.h
+%{_includedir}/notification/notification_type.h
+%{_includedir}/notification/notification_list.h
+%{_includedir}/notification/notification_status.h
+%{_libdir}/pkgconfig/notification.pc
+
+%files service-devel
+%defattr(-,root,root,-)
+%{_includedir}/notification/service/notification_ipc.h
+%{_includedir}/notification/service/notification_noti.h
+%{_includedir}/notification/service/notification_setting_service.h
+%{_libdir}/pkgconfig/notification-service.pc
diff --git a/src/notification.c b/src/notification.c
new file mode 100644
index 0000000..a903d7c
--- /dev/null
+++ b/src/notification.c
@@ -0,0 +1,3126 @@
+/*
+ * libnotification
+ *
+ * Copyright (c) 2000 - 2011 Samsung Electronics Co., Ltd. All rights reserved.
+ *
+ * Contact: Seungtaek Chung <seungtaek.chung@samsung.com>, Mi-Ju Lee <miju52.lee@samsung.com>, Xi Zhichan <zhichan.xi@samsung.com>
+ *
+ * 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 <unistd.h>
+#include <fcntl.h>
+#include <libintl.h>
+#include <dbus/dbus.h>
+#include <dbus/dbus-glib-lowlevel.h>
+
+#include <app.h>
+#include <app_control_internal.h>
+#include <aul.h>
+#include <ail.h>
+#include <appsvc.h>
+#include <tizen.h>
+#include <vconf-keys.h>
+#include <vconf.h>
+
+#include <notification.h>
+#include <notification_list.h>
+#include <notification_debug.h>
+#include <notification_private.h>
+#include <notification_noti.h>
+#include <notification_ongoing.h>
+#include <notification_group.h>
+#include <notification_ipc.h>
+#include <notification_internal.h>
+
+typedef struct _notification_cb_list notification_cb_list_s;
+
+typedef enum __notification_cb_type {
+ NOTIFICATION_CB_NORMAL = 1,
+ NOTIFICATION_CB_DETAILED,
+} _notification_cb_type_e;
+
+struct _notification_cb_list {
+ notification_cb_list_s *prev;
+ notification_cb_list_s *next;
+
+ _notification_cb_type_e cb_type;
+ void (*changed_cb) (void *data, notification_type_e type);
+ void (*detailed_changed_cb) (void *data, notification_type_e type, notification_op *op_list, int num_op);
+ void *data;
+};
+
+static notification_cb_list_s *g_notification_cb_list = NULL;
+
+static void (*posted_toast_message_cb) (void *data);
+
+#define NOTI_TEXT_RESULT_LEN 2048
+#define NOTI_PKGNAME_LEN 512
+
+static char *_notification_get_pkgname_by_pid(void)
+{
+ char pkgname[NOTI_PKGNAME_LEN + 1] = { 0, };
+ int pid = 0, ret = AUL_R_OK;
+ int fd;
+ char *dup_pkgname;
+
+ pid = getpid();
+
+ ret = aul_app_get_pkgname_bypid(pid, pkgname, sizeof(pkgname));
+ if (ret != AUL_R_OK) {
+ char buf[NOTI_PKGNAME_LEN + 1] = { 0, };
+
+ snprintf(buf, sizeof(buf), "/proc/%d/cmdline", pid);
+
+ fd = open(buf, O_RDONLY);
+ if (fd < 0) {
+ return NULL;
+ }
+
+ ret = read(fd, pkgname, sizeof(pkgname) - 1);
+ close(fd);
+
+ if (ret <= 0) {
+ return NULL;
+ }
+
+ pkgname[ret] = '\0';
+ /*!
+ * \NOTE
+ * "ret" is not able to be larger than "sizeof(pkgname) - 1",
+ * if the system is not going wrong.
+ */
+ } else {
+ if (strlen(pkgname) <= 0) {
+ return NULL;
+ }
+ }
+
+ dup_pkgname = strdup(pkgname);
+ if (!dup_pkgname)
+ NOTIFICATION_ERR("Heap: %d\n", errno);
+
+ return dup_pkgname;
+}
+
+static void _notification_get_text_domain(notification_h noti)
+{
+ if (noti->domain != NULL) {
+
+ }
+
+ if (noti->dir != NULL) {
+
+ }
+}
+
+EXPORT_API int notification_set_image(notification_h noti,
+ notification_image_type_e type,
+ const char *image_path)
+{
+ bundle *b = NULL;
+ char buf_key[32] = { 0, };
+ const char *ret_val = NULL;
+
+ /* Check noti and image_path are valid data */
+ if (noti == NULL || image_path == NULL) {
+ return NOTIFICATION_ERROR_INVALID_PARAMETER;
+ }
+
+ /* Check image type is valid type */
+ if (type <= NOTIFICATION_IMAGE_TYPE_NONE
+ || type >= NOTIFICATION_IMAGE_TYPE_MAX) {
+ return NOTIFICATION_ERROR_INVALID_PARAMETER;
+ }
+
+ /* Check image path bundle is exist */
+ if (noti->b_image_path) {
+ /* If image path bundle is exist, store local bundle value */
+ b = noti->b_image_path;
+
+ /* Set image type to key as char string type */
+ snprintf(buf_key, sizeof(buf_key), "%d", type);
+
+ /* Get value using key */
+ ret_val = bundle_get_val(b, buf_key);
+ if (ret_val != NULL) {
+ /* If key is exist, remove this value to store new image path */
+ bundle_del(b, buf_key);
+ }
+
+ /* Add new image path with type key */
+ bundle_add(b, buf_key, image_path);
+ } else {
+ /* If image path bundle is not exist, create new one */
+ b = bundle_create();
+
+ /* Set image type to key as char string type */
+ snprintf(buf_key, sizeof(buf_key), "%d", type);
+
+ /* Add new image path with type key */
+ bundle_add(b, buf_key, image_path);
+
+ /* Save to image path bundle */
+ noti->b_image_path = b;
+ }
+
+ return NOTIFICATION_ERROR_NONE;
+}
+
+EXPORT_API int notification_get_image(notification_h noti,
+ notification_image_type_e type,
+ char **image_path)
+{
+ bundle *b = NULL;
+ char buf_key[32] = { 0, };
+ const char *ret_val = NULL;
+
+ /* Check noti and image_path is valid data */
+ if (noti == NULL || image_path == NULL) {
+ return NOTIFICATION_ERROR_INVALID_PARAMETER;
+ }
+
+ /* Check image type is valid data */
+ if (type <= NOTIFICATION_IMAGE_TYPE_NONE
+ || type >= NOTIFICATION_IMAGE_TYPE_MAX) {
+ return NOTIFICATION_ERROR_INVALID_PARAMETER;
+ }
+
+ /* Check image path bundle exist */
+ if (noti->b_image_path) {
+ /* If image path bundle exist, store local bundle data */
+ b = noti->b_image_path;
+
+ /* Set image type to key as char string type */
+ snprintf(buf_key, sizeof(buf_key), "%d", type);
+
+ /* Get value of key */
+ ret_val = bundle_get_val(b, buf_key);
+
+ *image_path = (char *)ret_val;
+ } else {
+ /* If image path bundle does not exist, image path is NULL */
+ *image_path = NULL;
+ }
+
+ /* If image path is NULL and type is ICON, icon path set from AIL */
+ /* order : user icon -> launch_pkgname icon -> caller_pkgname icon -> service app icon */
+ if (*image_path == NULL && type == NOTIFICATION_IMAGE_TYPE_ICON) {
+ /* Check App icon path is already set */
+ if (noti->app_icon_path != NULL) {
+ /* image path will be app icon path */
+ *image_path = noti->app_icon_path;
+ } else {
+ *image_path = NULL;
+ }
+ }
+
+ return NOTIFICATION_ERROR_NONE;
+}
+
+EXPORT_API int notification_set_time(notification_h noti,
+ time_t input_time)
+{
+ /* Check noti is valid data */
+ if (noti == NULL) {
+ return NOTIFICATION_ERROR_INVALID_PARAMETER;
+ }
+
+ if (input_time == 0) {
+ /* If input time is 0, set current time */
+ noti->time = time(NULL);
+ } else {
+ /* save input time */
+ noti->time = input_time;
+ }
+
+ return NOTIFICATION_ERROR_NONE;
+}
+
+EXPORT_API int notification_get_time(notification_h noti,
+ time_t * ret_time)
+{
+ /* Check noti and time is valid data */
+ if (noti == NULL || ret_time == NULL) {
+ return NOTIFICATION_ERROR_INVALID_PARAMETER;
+ }
+
+ /* Set time infomation */
+ *ret_time = noti->time;
+
+ return NOTIFICATION_ERROR_NONE;
+}
+
+EXPORT_API int notification_get_insert_time(notification_h noti,
+ time_t * ret_time)
+{
+ /* Check noti and ret_time is valid data */
+ if (noti == NULL || ret_time == NULL) {
+ return NOTIFICATION_ERROR_INVALID_PARAMETER;
+ }
+
+ /* Set insert time information */
+ *ret_time = noti->insert_time;
+
+ return NOTIFICATION_ERROR_NONE;
+}
+
+EXPORT_API int notification_set_text(notification_h noti,
+ notification_text_type_e type,
+ const char *text,
+ const char *key,
+ int args_type, ...)
+{
+ bundle *b = NULL;
+ char buf_key[32] = { 0, };
+ char buf_val[1024] = { 0, };
+ const char *ret_val = NULL;
+ va_list var_args;
+ notification_variable_type_e var_type;
+ int num_args = 0;
+ int noti_err = NOTIFICATION_ERROR_NONE;
+ int var_value_int = 0;
+ double var_value_double = 0.0;
+ char *var_value_string = NULL;
+ notification_count_pos_type_e var_value_count =
+ NOTIFICATION_COUNT_POS_NONE;
+
+ /* Check noti is valid data */
+ if (noti == NULL) {
+ return NOTIFICATION_ERROR_INVALID_PARAMETER;
+ }
+
+ /* Check text type is valid type */
+ if (type <= NOTIFICATION_TEXT_TYPE_NONE
+ || type >= NOTIFICATION_TEXT_TYPE_MAX) {
+ return NOTIFICATION_ERROR_INVALID_PARAMETER;
+ }
+
+ /* Check text bundle exist */
+ if (text != NULL) {
+ if (noti->b_text != NULL) {
+ /* If text bundle exist, store local bundle data */
+ b = noti->b_text;
+
+ /* Make type to key as char string */
+ snprintf(buf_key, sizeof(buf_key), "%d", type);
+
+ /* Get value using type key */
+ ret_val = bundle_get_val(b, buf_key);
+ if (ret_val != NULL) {
+ /* If value exist, remove this to add new value */
+ bundle_del(b, buf_key);
+ }
+
+ snprintf(buf_val, sizeof(buf_val), "%s", text);
+
+ /* Add new text value */
+ bundle_add(b, buf_key, buf_val);
+ } else {
+ /* If text bundle does not exist, create new one */
+ b = bundle_create();
+
+ /* Make type to key as char string */
+ snprintf(buf_key, sizeof(buf_key), "%d", type);
+
+ snprintf(buf_val, sizeof(buf_val), "%s", text);
+
+ /* Add new text value */
+ bundle_add(b, buf_key, buf_val);
+
+ /* Save text bundle */
+ noti->b_text = b;
+ }
+ } else {
+ /* Reset if text is NULL */
+ if (noti->b_text != NULL) {
+ /* If text bundle exist, store local bundle data */
+ b = noti->b_text;
+
+ /* Make type to key as char string */
+ snprintf(buf_key, sizeof(buf_key), "%d", type);
+
+ /* Get value using type key */
+ ret_val = bundle_get_val(b, buf_key);
+ if (ret_val != NULL) {
+ /* If value exist, remove this */
+ bundle_del(b, buf_key);
+ }
+ }
+ }
+
+ /* Save key if key is valid data */
+ if (key != NULL) {
+ /* Check key bundle exist */
+ if (noti->b_key != NULL) {
+ /* If key bundle exist, store local bundle data */
+ b = noti->b_key;
+
+ /* Make type to key as char string */
+ snprintf(buf_key, sizeof(buf_key), "%d", type);
+
+ /* Get value using type key */
+ ret_val = bundle_get_val(b, buf_key);
+ if (ret_val != NULL) {
+ /* If value exist, remove this to add new value */
+ bundle_del(b, buf_key);
+ }
+
+ snprintf(buf_val, sizeof(buf_val), "%s", key);
+
+ /* Add new key value */
+ bundle_add(b, buf_key, buf_val);
+ } else {
+ /* If key bundle does not exist, create new one */
+ b = bundle_create();
+
+ /* Make type to key as char string */
+ snprintf(buf_key, sizeof(buf_key), "%d", type);
+
+ snprintf(buf_val, sizeof(buf_val), "%s", key);
+
+ /* Add new key value */
+ bundle_add(b, buf_key, buf_val);
+
+ /* Save key bundle */
+ noti->b_key = b;
+ }
+ } else {
+ /* Reset if key is NULL */
+ if (noti->b_key != NULL) {
+ /* If key bundle exist, store local bundle data */
+ b = noti->b_key;
+
+ /* Make type to key as char string */
+ snprintf(buf_key, sizeof(buf_key), "%d", type);
+
+ /* Get value using type key */
+ ret_val = bundle_get_val(b, buf_key);
+ if (ret_val != NULL) {
+ /* If value exist, remove this */
+ bundle_del(b, buf_key);
+ }
+ }
+ }
+
+ if (noti->b_format_args != NULL) {
+ b = noti->b_format_args;
+ } else {
+ b = bundle_create();
+ }
+
+ va_start(var_args, args_type);
+
+ var_type = args_type;
+ num_args = 0;
+
+ while (var_type != NOTIFICATION_VARIABLE_TYPE_NONE) {
+ /* Type */
+ snprintf(buf_key, sizeof(buf_key), "%dtype%d", type, num_args);
+ snprintf(buf_val, sizeof(buf_val), "%d", var_type);
+
+ ret_val = bundle_get_val(b, buf_key);
+ if (ret_val != NULL) {
+ bundle_del(b, buf_key);
+ }
+
+ bundle_add(b, buf_key, buf_val);
+
+ switch (var_type) {
+ case NOTIFICATION_VARIABLE_TYPE_INT:
+ var_value_int = va_arg(var_args, int);
+
+ /* Value */
+ snprintf(buf_key, sizeof(buf_key), "%dvalue%d", type,
+ num_args);
+ snprintf(buf_val, sizeof(buf_val), "%d", var_value_int);
+
+ ret_val = bundle_get_val(b, buf_key);
+ if (ret_val != NULL) {
+ bundle_del(b, buf_key);
+ }
+
+ bundle_add(b, buf_key, buf_val);
+ break;
+ case NOTIFICATION_VARIABLE_TYPE_DOUBLE:
+ var_value_double = va_arg(var_args, double);
+
+ /* Value */
+ snprintf(buf_key, sizeof(buf_key), "%dvalue%d", type,
+ num_args);
+ snprintf(buf_val, sizeof(buf_val), "%.2f",
+ var_value_double);
+
+ ret_val = bundle_get_val(b, buf_key);
+ if (ret_val != NULL) {
+ bundle_del(b, buf_key);
+ }
+
+ bundle_add(b, buf_key, buf_val);
+ break;
+ case NOTIFICATION_VARIABLE_TYPE_STRING:
+ var_value_string = va_arg(var_args, char *);
+
+ /* Value */
+ snprintf(buf_key, sizeof(buf_key), "%dvalue%d", type,
+ num_args);
+ snprintf(buf_val, sizeof(buf_val), "%s",
+ var_value_string);
+
+ ret_val = bundle_get_val(b, buf_key);
+ if (ret_val != NULL) {
+ bundle_del(b, buf_key);
+ }
+
+ bundle_add(b, buf_key, buf_val);
+ break;
+ case NOTIFICATION_VARIABLE_TYPE_COUNT:
+ var_value_count =
+ va_arg(var_args, notification_count_pos_type_e);
+
+ /* Value */
+ snprintf(buf_key, sizeof(buf_key), "%dvalue%d", type,
+ num_args);
+ snprintf(buf_val, sizeof(buf_val), "%d",
+ var_value_count);
+
+ ret_val = bundle_get_val(b, buf_key);
+ if (ret_val != NULL) {
+ bundle_del(b, buf_key);
+ }
+
+ bundle_add(b, buf_key, buf_val);
+ break;
+ default:
+ NOTIFICATION_ERR("Error. invalid variable type. : %d",
+ var_type);
+ noti_err = NOTIFICATION_ERROR_INVALID_PARAMETER;
+ break;
+ }
+
+ num_args++;
+ var_type = va_arg(var_args, notification_variable_type_e);
+ }
+ va_end(var_args);
+
+ if (noti_err == NOTIFICATION_ERROR_NONE) {
+ noti->num_format_args = num_args;
+ } else {
+ noti->num_format_args = 0;
+ }
+
+ snprintf(buf_key, sizeof(buf_key), "num%d", type);
+ snprintf(buf_val, sizeof(buf_val), "%d", noti->num_format_args);
+
+ ret_val = bundle_get_val(b, buf_key);
+ if (ret_val != NULL) {
+ bundle_del(b, buf_key);
+ }
+
+ bundle_add(b, buf_key, buf_val);
+
+ noti->b_format_args = b;
+
+ return noti_err;
+}
+
+EXPORT_API int notification_get_text(notification_h noti,
+ notification_text_type_e type,
+ char **text)
+{
+ bundle *b = NULL;
+ char buf_key[32] = { 0, };
+ const char *ret_val = NULL;
+ const char *get_str = NULL;
+ const char *get_check_type_str = NULL;
+ notification_text_type_e check_type = NOTIFICATION_TEXT_TYPE_NONE;
+ //int display_option_flag = 0;
+
+ char *temp_str = NULL;
+ char result_str[NOTI_TEXT_RESULT_LEN] = { 0, };
+ char buf_str[1024] = { 0, };
+ int num_args = 0;
+ notification_variable_type_e ret_var_type = 0;
+ int ret_variable_int = 0;
+ double ret_variable_double = 0.0;
+
+ /* Check noti is valid data */
+ if (noti == NULL || text == NULL) {
+ return NOTIFICATION_ERROR_INVALID_PARAMETER;
+ }
+
+ /* Check text type is valid type */
+ if (type <= NOTIFICATION_TEXT_TYPE_NONE
+ || type >= NOTIFICATION_TEXT_TYPE_MAX) {
+ return NOTIFICATION_ERROR_INVALID_PARAMETER;
+ }
+
+ /* Check key */
+ if (noti->b_key != NULL) {
+ b = noti->b_key;
+
+ /* Get text domain and dir */
+ //_notification_get_text_domain(noti);
+
+ snprintf(buf_key, sizeof(buf_key), "%d", type);
+
+ ret_val = bundle_get_val(b, buf_key);
+ if (ret_val != NULL && noti->domain != NULL
+ && noti->dir != NULL) {
+ /* Get application string */
+ bindtextdomain(noti->domain, noti->dir);
+
+ get_str = dgettext(noti->domain, ret_val);
+ } else if (ret_val != NULL) {
+ /* Get system string */
+ get_str = dgettext("sys_string", ret_val);
+ } else {
+ get_str = NULL;
+ }
+ }
+
+ if (get_str == NULL && noti->b_text != NULL) {
+ b = noti->b_text;
+ /* Get basic text */
+ snprintf(buf_key, sizeof(buf_key), "%d", type);
+
+ get_str = bundle_get_val(b, buf_key);
+ }
+
+ check_type = type;
+
+ /* Set display option is off type when option is off, type is noti */
+ /*if (get_str != NULL && display_option_flag == 1
+ && noti->type == NOTIFICATION_TYPE_NOTI) {
+ if (type == NOTIFICATION_TEXT_TYPE_CONTENT
+ || type == NOTIFICATION_TEXT_TYPE_GROUP_CONTENT) {
+ // Set check_type to option content string
+ if (type == NOTIFICATION_TEXT_TYPE_CONTENT) {
+ check_type =
+ NOTIFICATION_TEXT_TYPE_CONTENT_FOR_DISPLAY_OPTION_IS_OFF;
+ } else if (type == NOTIFICATION_TEXT_TYPE_GROUP_CONTENT) {
+ check_type =
+ NOTIFICATION_TEXT_TYPE_GROUP_CONTENT_FOR_DISPLAY_OPTION_IS_OFF;
+ }
+
+ // Check key
+ if (noti->b_key != NULL) {
+ b = noti->b_key;
+
+ // Get text domain and dir
+ _notification_get_text_domain(noti);
+
+ snprintf(buf_key, sizeof(buf_key), "%d",
+ check_type);
+
+ ret_val = bundle_get_val(b, buf_key);
+ if (ret_val != NULL && noti->domain != NULL
+ && noti->dir != NULL) {
+ // Get application string
+ bindtextdomain(noti->domain, noti->dir);
+
+ get_check_type_str =
+ dgettext(noti->domain, ret_val);
+ } else if (ret_val != NULL) {
+ // Get system string
+ get_check_type_str =
+ dgettext("sys_string", ret_val);
+ } else {
+ get_check_type_str = NULL;
+ }
+ }
+
+ if (get_check_type_str == NULL && noti->b_text != NULL) {
+ b = noti->b_text;
+ // Get basic text
+ snprintf(buf_key, sizeof(buf_key), "%d",
+ check_type);
+
+ get_check_type_str = bundle_get_val(b, buf_key);
+ }
+ }
+
+ if (get_check_type_str != NULL) {
+ // Replace option off type string
+ get_str = get_check_type_str;
+ } else {
+ // Set default string
+ get_str =
+ dgettext("sys_string", "IDS_COM_POP_MISSED_EVENT");
+ }
+ }*/
+
+ if (get_str != NULL) {
+ /* Get number format args */
+ b = noti->b_format_args;
+ noti->num_format_args = 0;
+
+ if (b != NULL) {
+ snprintf(buf_key, sizeof(buf_key), "num%d", check_type);
+ ret_val = bundle_get_val(b, buf_key);
+ if (ret_val != NULL) {
+ noti->num_format_args = atoi(ret_val);
+ }
+ }
+
+ if (noti->num_format_args == 0) {
+ *text = (char *)get_str;
+ } else {
+ /* Check first variable is count, LEFT pos */
+ snprintf(buf_key, sizeof(buf_key), "%dtype%d",
+ check_type, num_args);
+ ret_val = bundle_get_val(b, buf_key);
+ ret_var_type = atoi(ret_val);
+
+ if (ret_var_type == NOTIFICATION_VARIABLE_TYPE_COUNT) {
+ /* Get var Value */
+ snprintf(buf_key, sizeof(buf_key), "%dvalue%d",
+ check_type, num_args);
+ ret_val = bundle_get_val(b, buf_key);
+ ret_variable_int = atoi(ret_val);
+
+ if (ret_variable_int ==
+ NOTIFICATION_COUNT_POS_LEFT) {
+ notification_noti_get_count(noti->type,
+ noti->caller_pkgname,
+ noti->group_id,
+ noti->priv_id,
+ &ret_variable_int);
+ snprintf(buf_str, sizeof(buf_str),
+ "%d ", ret_variable_int);
+
+ int src_len = strlen(result_str);
+ int max_len = NOTI_TEXT_RESULT_LEN - src_len - 1;
+
+ strncat(result_str, buf_str,
+ max_len);
+
+ num_args++;
+ }
+
+ }
+
+ /* Check variable IN pos */
+ for (temp_str = (char *)get_str; *temp_str != '\0';
+ temp_str++) {
+ if (*temp_str != '%') {
+ strncat(result_str, temp_str, 1);
+ } else {
+ if (*(temp_str + 1) == '%') {
+ strncat(result_str, temp_str,
+ 1);
+ } else if (*(temp_str + 1) == 'd') {
+ /* Get var Type */
+ ret_variable_int = 0;
+
+ snprintf(buf_key,
+ sizeof(buf_key),
+ "%dtype%d", check_type,
+ num_args);
+ ret_val =
+ bundle_get_val(b, buf_key);
+ ret_var_type = atoi(ret_val);
+ if (ret_var_type ==
+ NOTIFICATION_VARIABLE_TYPE_COUNT)
+ {
+ /* Get notification count */
+ notification_noti_get_count
+ (noti->type,
+ noti->caller_pkgname,
+ noti->group_id,
+ noti->priv_id,
+ &ret_variable_int);
+ } else {
+ /* Get var Value */
+ snprintf(buf_key,
+ sizeof
+ (buf_key),
+ "%dvalue%d",
+ check_type,
+ num_args);
+ ret_val =
+ bundle_get_val(b,
+ buf_key);
+ ret_variable_int =
+ atoi(ret_val);
+ }
+
+ snprintf(buf_str,
+ sizeof(buf_str), "%d",
+ ret_variable_int);
+
+ int src_len = strlen(result_str);
+ int max_len = NOTI_TEXT_RESULT_LEN - src_len - 1;
+
+ strncat(result_str, buf_str,
+ max_len);
+
+ temp_str++;
+
+ num_args++;
+ } else if (*(temp_str + 1) == 's') {
+ /* Get var Value */
+ snprintf(buf_key,
+ sizeof(buf_key),
+ "%dvalue%d",
+ check_type, num_args);
+ ret_val =
+ bundle_get_val(b, buf_key);
+
+ snprintf(buf_str,
+ sizeof(buf_str), "%s",
+ ret_val);
+
+ int src_len = strlen(result_str);
+ int max_len = NOTI_TEXT_RESULT_LEN - src_len - 1;
+
+ strncat(result_str, buf_str,
+ max_len);
+
+ temp_str++;
+
+ num_args++;
+ } else if (*(temp_str + 1) == 'f') {
+ /* Get var Value */
+ snprintf(buf_key,
+ sizeof(buf_key),
+ "%dvalue%d",
+ check_type, num_args);
+ ret_val =
+ bundle_get_val(b, buf_key);
+ ret_variable_double =
+ atof(ret_val);
+
+ snprintf(buf_str,
+ sizeof(buf_str),
+ "%.2f",
+ ret_variable_double);
+
+ int src_len = strlen(result_str);
+ int max_len = NOTI_TEXT_RESULT_LEN - src_len - 1;
+
+ strncat(result_str, buf_str,
+ max_len);
+
+ temp_str++;
+
+ num_args++;
+ } else if (*(temp_str + 1) >= '1' && *(temp_str + 1) <= '9') {
+ if (*(temp_str + 3) == 'd') {
+ /* Get var Type */
+ ret_variable_int = 0;
+
+ snprintf(buf_key,
+ sizeof(buf_key),
+ "%dtype%d", check_type,
+ num_args + *(temp_str + 1) - 49);
+ ret_val =
+ bundle_get_val(b, buf_key);
+ ret_var_type = atoi(ret_val);
+ if (ret_var_type ==
+ NOTIFICATION_VARIABLE_TYPE_COUNT)
+ {
+ /* Get notification count */
+ notification_noti_get_count
+ (noti->type,
+ noti->caller_pkgname,
+ noti->group_id,
+ noti->priv_id,
+ &ret_variable_int);
+ } else {
+ /* Get var Value */
+ snprintf(buf_key,
+ sizeof
+ (buf_key),
+ "%dvalue%d",
+ check_type,
+ num_args + *(temp_str + 1) - 49);
+ ret_val =
+ bundle_get_val(b,
+ buf_key);
+ ret_variable_int =
+ atoi(ret_val);
+ }
+
+ snprintf(buf_str,
+ sizeof(buf_str), "%d",
+ ret_variable_int);
+
+ int src_len = strlen(result_str);
+ int max_len = NOTI_TEXT_RESULT_LEN - src_len - 1;
+
+ strncat(result_str, buf_str,
+ max_len);
+
+ temp_str += 3;
+ } else if (*(temp_str + 3) == 's') {
+ /* Get var Value */
+ snprintf(buf_key,
+ sizeof(buf_key),
+ "%dvalue%d",
+ check_type, num_args + *(temp_str + 1) - 49);
+ ret_val =
+ bundle_get_val(b, buf_key);
+
+ snprintf(buf_str,
+ sizeof(buf_str), "%s",
+ ret_val);
+
+ int src_len = strlen(result_str);
+ int max_len = NOTI_TEXT_RESULT_LEN - src_len - 1;
+
+ strncat(result_str, buf_str,
+ max_len);
+
+ temp_str += 3;
+ } else if (*(temp_str + 3) == 'f') {
+ /* Get var Value */
+ snprintf(buf_key,
+ sizeof(buf_key),
+ "%dvalue%d",
+ check_type, num_args + *(temp_str + 1) - 49);
+ ret_val =
+ bundle_get_val(b, buf_key);
+ ret_variable_double =
+ atof(ret_val);
+
+ snprintf(buf_str,
+ sizeof(buf_str),
+ "%.2f",
+ ret_variable_double);
+
+ int src_len = strlen(result_str);
+ int max_len = NOTI_TEXT_RESULT_LEN - src_len - 1;
+
+ strncat(result_str, buf_str,
+ max_len);
+
+ temp_str += 3;
+ }
+ }
+ }
+
+ }
+
+ /* Check last variable is count, LEFT pos */
+ if (num_args < noti->num_format_args) {
+ snprintf(buf_key, sizeof(buf_key), "%dtype%d",
+ check_type, num_args);
+ ret_val = bundle_get_val(b, buf_key);
+ ret_var_type = atoi(ret_val);
+ if (ret_var_type ==
+ NOTIFICATION_VARIABLE_TYPE_COUNT) {
+ /* Get var Value */
+ snprintf(buf_key, sizeof(buf_key),
+ "%dvalue%d", check_type,
+ num_args);
+ ret_val = bundle_get_val(b, buf_key);
+ ret_variable_int = atoi(ret_val);
+
+ if (ret_variable_int ==
+ NOTIFICATION_COUNT_POS_RIGHT) {
+ notification_noti_get_count
+ (noti->type,
+ noti->caller_pkgname,
+ noti->group_id,
+ noti->priv_id,
+ &ret_variable_int);
+ snprintf(buf_str,
+ sizeof(buf_str), " %d",
+ ret_variable_int);
+
+ int src_len = strlen(result_str);
+ int max_len = NOTI_TEXT_RESULT_LEN - src_len - 1;
+
+ strncat(result_str, buf_str,
+ max_len);
+
+ num_args++;
+ }
+
+ }
+ }
+
+ switch (check_type) {
+ case NOTIFICATION_TEXT_TYPE_TITLE:
+ case NOTIFICATION_TEXT_TYPE_GROUP_TITLE:
+ if (noti->temp_title != NULL)
+ free(noti->temp_title);
+
+ noti->temp_title = strdup(result_str);
+
+ *text = noti->temp_title;
+ break;
+ case NOTIFICATION_TEXT_TYPE_CONTENT:
+ case NOTIFICATION_TEXT_TYPE_CONTENT_FOR_DISPLAY_OPTION_IS_OFF:
+ case NOTIFICATION_TEXT_TYPE_GROUP_CONTENT:
+ case NOTIFICATION_TEXT_TYPE_GROUP_CONTENT_FOR_DISPLAY_OPTION_IS_OFF:
+ if (noti->temp_content !=
+ NULL)
+ free(noti->temp_content);
+
+ noti->temp_content = strdup(result_str);
+
+ *text = noti->temp_content;
+ break;
+ default:
+ break;
+ }
+
+ }
+
+ } else {
+ *text = NULL;
+ }
+
+ return NOTIFICATION_ERROR_NONE;
+}
+
+EXPORT_API int notification_set_text_domain(notification_h noti,
+ const char *domain,
+ const char *dir)
+{
+ /* check noti and domain is valid data */
+ if (noti == NULL || domain == NULL || dir == NULL) {
+ return NOTIFICATION_ERROR_INVALID_PARAMETER;
+ }
+
+ /* Check domain */
+ if (noti->domain) {
+ /* Remove previous domain */
+ free(noti->domain);
+ }
+ /* Copy domain */
+ noti->domain = strdup(domain);
+
+ /* Check locale dir */
+ if (noti->dir) {
+ /* Remove previous locale dir */
+ free(noti->dir);
+ }
+ /* Copy locale dir */
+ noti->dir = strdup(dir);
+
+ return NOTIFICATION_ERROR_NONE;
+}
+
+EXPORT_API int notification_get_text_domain(notification_h noti,
+ char **domain,
+ char **dir)
+{
+ /* Check noti is valid data */
+ if (noti == NULL) {
+ return NOTIFICATION_ERROR_INVALID_PARAMETER;
+ }
+
+ /* Get domain */
+ if (domain != NULL && noti->domain != NULL) {
+ *domain = noti->domain;
+ }
+
+ /* Get locale dir */
+ if (dir != NULL && noti->dir != NULL) {
+ *dir = noti->dir;
+ }
+
+ return NOTIFICATION_ERROR_NONE;
+}
+
+EXPORT_API int notification_set_time_to_text(notification_h noti, notification_text_type_e type,
+ time_t time)
+{
+ int ret = NOTIFICATION_ERROR_NONE;
+ char buf[256] = { 0, };
+ char buf_tag[512] = { 0, };
+
+ if (noti == NULL) {
+ return NOTIFICATION_ERROR_INVALID_PARAMETER;
+ }
+ if (time <= 0) {
+ return NOTIFICATION_ERROR_INVALID_PARAMETER;
+ }
+ if (type <= NOTIFICATION_TEXT_TYPE_NONE
+ || type >= NOTIFICATION_TEXT_TYPE_MAX) {
+ return NOTIFICATION_ERROR_INVALID_PARAMETER;
+ }
+
+
+ snprintf(buf, sizeof(buf), "%lu", time);
+ ret = notification_noti_set_tag(TAG_TIME, buf, buf_tag, sizeof(buf_tag));
+
+ if (ret != NOTIFICATION_ERROR_NONE) {
+ return ret;
+ }
+
+ return notification_set_text(noti, type, buf_tag, NULL, NOTIFICATION_VARIABLE_TYPE_NONE);
+}
+
+EXPORT_API int notification_get_time_from_text(notification_h noti, notification_text_type_e type,
+ time_t *time)
+{
+ int ret = NOTIFICATION_ERROR_NONE;
+
+ if (noti == NULL) {
+ return NOTIFICATION_ERROR_INVALID_PARAMETER;
+ }
+ if (time == NULL) {
+ return NOTIFICATION_ERROR_INVALID_PARAMETER;
+ }
+ if (type <= NOTIFICATION_TEXT_TYPE_NONE
+ || type >= NOTIFICATION_TEXT_TYPE_MAX) {
+ return NOTIFICATION_ERROR_INVALID_PARAMETER;
+ }
+
+ char *ret_text = NULL;
+ ret = notification_get_text(noti, type, &ret_text);
+
+ if (ret != NOTIFICATION_ERROR_NONE || ret_text == NULL) {
+ return NOTIFICATION_ERROR_INVALID_PARAMETER;
+ }
+
+ if (notification_noti_get_tag_type(ret_text) == TAG_TYPE_INVALID) {
+ return NOTIFICATION_ERROR_INVALID_PARAMETER;
+ }
+
+ char *tag_value = NULL;
+ tag_value = notification_noti_strip_tag(ret_text);
+ if (tag_value == NULL) {
+ return NOTIFICATION_ERROR_INVALID_PARAMETER;
+ }
+
+ *time = atol(tag_value);
+ free(tag_value);
+
+ return NOTIFICATION_ERROR_NONE;
+}
+
+EXPORT_API int notification_set_sound(notification_h noti,
+ notification_sound_type_e type,
+ const char *path)
+{
+ /* Check noti is valid data */
+ if (noti == NULL) {
+ return NOTIFICATION_ERROR_INVALID_PARAMETER;
+ }
+
+ /* Check type is valid */
+ if (type < NOTIFICATION_SOUND_TYPE_NONE
+ || type >= NOTIFICATION_SOUND_TYPE_MAX) {
+ return NOTIFICATION_ERROR_INVALID_PARAMETER;
+ }
+
+ /* Save sound type */
+ noti->sound_type = type;
+
+ /* Save sound path if user data type */
+ if (type == NOTIFICATION_SOUND_TYPE_USER_DATA && path != NULL) {
+ if (noti->sound_path != NULL) {
+ free(noti->sound_path);
+ }
+
+ noti->sound_path = strdup(path);
+ } else {
+ if (noti->sound_path != NULL) {
+ free(noti->sound_path);
+ noti->sound_path = NULL;
+ }
+ if (type == NOTIFICATION_SOUND_TYPE_USER_DATA) {
+ noti->sound_type = NOTIFICATION_SOUND_TYPE_DEFAULT;
+ return NOTIFICATION_ERROR_INVALID_PARAMETER;
+ }
+ }
+
+ return NOTIFICATION_ERROR_NONE;
+}
+
+EXPORT_API int notification_get_sound(notification_h noti,
+ notification_sound_type_e *type,
+ const char **path)
+{
+ /* check noti and type is valid data */
+ if (noti == NULL || type == NULL) {
+ return NOTIFICATION_ERROR_INVALID_PARAMETER;
+ }
+
+ /* Set sound type */
+ *type = noti->sound_type;
+
+ /* Set sound path if user data type */
+ if (noti->sound_type == NOTIFICATION_SOUND_TYPE_USER_DATA
+ && path != NULL) {
+ *path = noti->sound_path;
+ }
+
+ return NOTIFICATION_ERROR_NONE;
+}
+
+EXPORT_API int notification_set_vibration(notification_h noti,
+ notification_vibration_type_e type,
+ const char *path)
+{
+ /* Check noti is valid data */
+ if (noti == NULL) {
+ return NOTIFICATION_ERROR_INVALID_PARAMETER;
+ }
+
+ /* Check type is valid */
+ if (type < NOTIFICATION_VIBRATION_TYPE_NONE
+ || type >= NOTIFICATION_VIBRATION_TYPE_MAX) {
+ return NOTIFICATION_ERROR_INVALID_PARAMETER;
+ }
+
+ /* Save vibration type */
+ noti->vibration_type = type;
+
+ /* Save sound path if user data type */
+ if (type == NOTIFICATION_VIBRATION_TYPE_USER_DATA && path != NULL) {
+ if (noti->vibration_path != NULL) {
+ free(noti->vibration_path);
+ }
+
+ noti->vibration_path = strdup(path);
+ } else {
+ if (noti->vibration_path != NULL) {
+ free(noti->vibration_path);
+ noti->vibration_path = NULL;
+ }
+ if (type == NOTIFICATION_VIBRATION_TYPE_USER_DATA) {
+ noti->vibration_type = NOTIFICATION_VIBRATION_TYPE_DEFAULT;
+ return NOTIFICATION_ERROR_INVALID_PARAMETER;
+ }
+ }
+
+ return NOTIFICATION_ERROR_NONE;
+
+}
+
+EXPORT_API int notification_get_vibration(notification_h noti,
+ notification_vibration_type_e *type,
+ const char **path)
+{
+ /* check noti and type is valid data */
+ if (noti == NULL || type == NULL) {
+ return NOTIFICATION_ERROR_INVALID_PARAMETER;
+ }
+
+ /* Set vibration type */
+ *type = noti->vibration_type;
+
+ /* Set sound path if user data type */
+ if (noti->vibration_type == NOTIFICATION_VIBRATION_TYPE_USER_DATA
+ && path != NULL) {
+ *path = noti->vibration_path;
+ }
+
+ return NOTIFICATION_ERROR_NONE;
+}
+
+EXPORT_API int notification_set_led(notification_h noti,
+ notification_led_op_e operation,
+ int led_argb)
+{
+ /* Check noti is valid data */
+ if (noti == NULL) {
+ return NOTIFICATION_ERROR_INVALID_PARAMETER;
+ }
+
+ /* Check operation is valid */
+ if (operation < NOTIFICATION_LED_OP_OFF
+ || operation >= NOTIFICATION_LED_OP_MAX) {
+ return NOTIFICATION_ERROR_INVALID_PARAMETER;
+ }
+
+ /* Save led operation */
+ noti->led_operation = operation;
+
+ /* Save led argb if operation is turning on LED with custom color */
+ if (operation == NOTIFICATION_LED_OP_ON_CUSTOM_COLOR) {
+ noti->led_argb = led_argb;
+ }
+
+ return NOTIFICATION_ERROR_NONE;
+}
+
+EXPORT_API int notification_get_led(notification_h noti,
+ notification_led_op_e *operation,
+ int *led_argb)
+{
+ /* check noti and operation is valid data */
+ if (noti == NULL || operation == NULL) {
+ return NOTIFICATION_ERROR_INVALID_PARAMETER;
+ }
+
+ /* Set led operation */
+ *operation = noti->led_operation;
+
+ /* Save led argb if operation is turning on LED with custom color */
+ if (noti->led_operation == NOTIFICATION_LED_OP_ON_CUSTOM_COLOR
+ && led_argb != NULL) {
+ *led_argb = noti->led_argb;
+ }
+
+ return NOTIFICATION_ERROR_NONE;
+}
+
+EXPORT_API int notification_set_led_time_period(notification_h noti,
+ int on_ms, int off_ms)
+{
+ /* Check noti is valid data */
+ if (noti == NULL || on_ms < 0 || off_ms < 0) {
+ return NOTIFICATION_ERROR_INVALID_PARAMETER;
+ }
+
+ /* Save led operation */
+ noti->led_on_ms = on_ms;
+ noti->led_off_ms = off_ms;
+
+ return NOTIFICATION_ERROR_NONE;
+}
+
+EXPORT_API int notification_get_led_time_period(notification_h noti,
+ int *on_ms, int *off_ms)
+{
+ /* check noti and operation is valid data */
+ if (noti == NULL) {
+ return NOTIFICATION_ERROR_INVALID_PARAMETER;
+ }
+
+ if (on_ms)
+ *(on_ms) = noti->led_on_ms;
+ if (off_ms)
+ *(off_ms) = noti->led_off_ms;
+
+ return NOTIFICATION_ERROR_NONE;
+}
+
+EXPORT_API int notification_set_application(notification_h noti,
+ const char *pkgname)
+{
+ if (noti == NULL || pkgname == NULL) {
+ return NOTIFICATION_ERROR_INVALID_PARAMETER;
+ }
+
+ if (noti->launch_pkgname) {
+ free(noti->launch_pkgname);
+ }
+
+ noti->launch_pkgname = strdup(pkgname);
+
+ return NOTIFICATION_ERROR_NONE;
+}
+
+EXPORT_API int notification_get_application(notification_h noti,
+ char **pkgname)
+{
+ if (noti == NULL || pkgname == NULL) {
+ return NOTIFICATION_ERROR_INVALID_PARAMETER;
+ }
+
+ if (noti->launch_pkgname) {
+ *pkgname = noti->launch_pkgname;
+ } else {
+ *pkgname = noti->caller_pkgname;
+ }
+
+ return NOTIFICATION_ERROR_NONE;
+}
+
+EXPORT_API int notification_set_launch_option(notification_h noti,
+ notification_launch_option_type type, void *option)
+{
+ int ret = 0;
+ bundle *b = NULL;
+ app_control_h app_control = option;
+
+ if (noti == NULL) {
+ return NOTIFICATION_ERROR_INVALID_PARAMETER;
+ }
+ if (app_control == NULL) {
+ return NOTIFICATION_ERROR_INVALID_PARAMETER;
+ }
+ if (type != NOTIFICATION_LAUNCH_OPTION_APP_CONTROL) {
+ return NOTIFICATION_ERROR_INVALID_PARAMETER;
+ }
+
+ if ((ret = app_control_to_bundle(app_control, &b)) == APP_CONTROL_ERROR_NONE) {
+ return notification_set_execute_option(noti,
+ NOTIFICATION_EXECUTE_TYPE_SINGLE_LAUNCH,
+ NULL, NULL,
+ b);
+ } else {
+ NOTIFICATION_ERR("Failed to convert appcontrol to bundle:%d", ret);
+ return NOTIFICATION_ERROR_INVALID_PARAMETER;
+ }
+}
+
+EXPORT_API int notification_get_launch_option(notification_h noti,
+ notification_launch_option_type type, void *option)
+{
+ int ret = 0;
+ bundle *b = NULL;
+ app_control_h *app_control = (app_control_h *)option;
+ app_control_h app_control_new = NULL;
+
+ if (noti == NULL) {
+ return NOTIFICATION_ERROR_INVALID_PARAMETER;
+ }
+ if (app_control == NULL) {
+ return NOTIFICATION_ERROR_INVALID_PARAMETER;
+ }
+ if (type != NOTIFICATION_LAUNCH_OPTION_APP_CONTROL) {
+ return NOTIFICATION_ERROR_INVALID_PARAMETER;
+ }
+
+ ret = notification_get_execute_option(noti,
+ NOTIFICATION_EXECUTE_TYPE_SINGLE_LAUNCH,
+ NULL,
+ &b);
+ if (ret == NOTIFICATION_ERROR_NONE && b != NULL) {
+ ret = app_control_create(&app_control_new);
+ if (ret == APP_CONTROL_ERROR_NONE && app_control_new != NULL) {
+ ret = app_control_import_from_bundle(app_control_new, b);
+ if (ret == APP_CONTROL_ERROR_NONE) {
+ *app_control = app_control_new;
+ } else {
+ app_control_destroy(app_control_new);
+ NOTIFICATION_ERR("Failed to import app control from bundle:%d", ret);
+ return NOTIFICATION_ERROR_IO_ERROR;
+ }
+ } else {
+ NOTIFICATION_ERR("Failed to create app control:%d", ret);
+ return NOTIFICATION_ERROR_IO_ERROR;
+ }
+ } else {
+ NOTIFICATION_ERR("Failed to get execute option:%d", ret);
+ return ret;
+ }
+
+ return NOTIFICATION_ERROR_NONE;
+}
+
+EXPORT_API int notification_set_execute_option(notification_h noti,
+ notification_execute_type_e type,
+ const char *text,
+ const char *key,
+ bundle *service_handle)
+{
+ char buf_key[32] = { 0, };
+ const char *ret_val = NULL;
+ bundle *b = NULL;
+
+ if (noti == NULL) {
+ return NOTIFICATION_ERROR_INVALID_PARAMETER;
+ }
+
+ if (type <= NOTIFICATION_EXECUTE_TYPE_NONE
+ || type >= NOTIFICATION_EXECUTE_TYPE_MAX) {
+ return NOTIFICATION_ERROR_INVALID_PARAMETER;
+ }
+
+ /* Create execute option bundle if does not exist */
+ if (noti->b_execute_option == NULL) {
+ noti->b_execute_option = bundle_create();
+ }
+
+ b = noti->b_execute_option;
+
+ /* Save text */
+ if (text != NULL) {
+ /* Make text key */
+ snprintf(buf_key, sizeof(buf_key), "text%d", type);
+
+ /* Check text key exist */
+ ret_val = bundle_get_val(b, buf_key);
+ if (ret_val != NULL) {
+ /* Remove previous data */
+ bundle_del(b, buf_key);
+ }
+
+ /* Add text data */
+ bundle_add(b, buf_key, text);
+ }
+
+ /* Save key */
+ if (key != NULL) {
+ /* Make key key */
+ snprintf(buf_key, sizeof(buf_key), "key%d", type);
+
+ /* Check key key exist */
+ ret_val = bundle_get_val(b, buf_key);
+ if (ret_val != NULL) {
+ /* Remove previous data */
+ bundle_del(b, buf_key);
+ }
+
+ /* Add text data */
+ bundle_add(b, buf_key, key);
+ }
+
+ switch ((int)type) {
+ case NOTIFICATION_EXECUTE_TYPE_RESPONDING:
+ /* Remove previous data if exist */
+ if (noti->b_service_responding != NULL) {
+ bundle_free(noti->b_service_responding);
+ noti->b_service_responding = NULL;
+ }
+
+ /* Save service handle */
+ if (service_handle != NULL) {
+ noti->b_service_responding = bundle_dup(service_handle);
+ }
+ break;
+ case NOTIFICATION_EXECUTE_TYPE_SINGLE_LAUNCH:
+ /* Remove previous data if exist */
+ if (noti->b_service_single_launch != NULL) {
+ bundle_free(noti->b_service_single_launch);
+ noti->b_service_single_launch = NULL;
+ }
+
+ /* Save service handle */
+ if (service_handle != NULL) {
+ noti->b_service_single_launch =
+ bundle_dup(service_handle);
+ }
+ break;
+ case NOTIFICATION_EXECUTE_TYPE_MULTI_LAUNCH:
+ /* Remove previous data if exist */
+ if (noti->b_service_multi_launch != NULL) {
+ bundle_free(noti->b_service_multi_launch);
+ noti->b_service_multi_launch = NULL;
+ }
+
+ /* Save service handle */
+ if (service_handle != NULL) {
+ noti->b_service_multi_launch =
+ bundle_dup(service_handle);
+ }
+ break;
+ }
+
+ return NOTIFICATION_ERROR_NONE;
+}
+
+EXPORT_API int notification_get_execute_option(notification_h noti,
+ notification_execute_type_e type,
+ const char **text,
+ bundle **service_handle)
+{
+ char buf_key[32] = { 0, };
+ const char *ret_val = NULL;
+ char *get_str = NULL;
+ bundle *b = NULL;
+
+ if (noti == NULL) {
+ return NOTIFICATION_ERROR_INVALID_PARAMETER;
+ }
+
+ if (type <= NOTIFICATION_EXECUTE_TYPE_NONE
+ || type >= NOTIFICATION_EXECUTE_TYPE_MAX) {
+ return NOTIFICATION_ERROR_INVALID_PARAMETER;
+ }
+
+ switch (type) {
+ case NOTIFICATION_EXECUTE_TYPE_RESPONDING:
+ b = noti->b_service_responding;
+ break;
+ case NOTIFICATION_EXECUTE_TYPE_SINGLE_LAUNCH:
+ b = noti->b_service_single_launch;
+ break;
+ case NOTIFICATION_EXECUTE_TYPE_MULTI_LAUNCH:
+ b = noti->b_service_multi_launch;
+ default:
+ break;
+ }
+
+ if (b != NULL) {
+ // Return text
+ if (text != NULL) {
+ // Get text domain and dir
+ if (noti->domain == NULL || noti->dir == NULL) {
+ _notification_get_text_domain(noti);
+ }
+
+ /* Make key */
+ snprintf(buf_key, sizeof(buf_key), "key%d", type);
+
+ /* Check key key exist */
+ ret_val = bundle_get_val(b, buf_key);
+ if (ret_val != NULL && noti->domain != NULL
+ && noti->dir != NULL) {
+ /* Get application string */
+ bindtextdomain(noti->domain, noti->dir);
+
+ get_str = dgettext(noti->domain, ret_val);
+
+ *text = get_str;
+ } else if (ret_val != NULL) {
+ /* Get system string */
+ get_str = dgettext("sys_string", ret_val);
+
+ *text = get_str;
+ } else {
+ /* Get basic text */
+ snprintf(buf_key, sizeof(buf_key), "text%d",
+ type);
+
+ ret_val = bundle_get_val(b, buf_key);
+
+ *text = ret_val;
+ }
+ }
+ }
+
+ if (service_handle != NULL) {
+ *service_handle = b;
+ }
+
+ return NOTIFICATION_ERROR_NONE;
+}
+
+EXPORT_API int notification_set_property(notification_h noti,
+ int flags)
+{
+ /* Check noti is valid data */
+ if (noti == NULL) {
+ return NOTIFICATION_ERROR_INVALID_PARAMETER;
+ }
+
+ /* Set flags */
+ noti->flags_for_property = flags;
+
+ return NOTIFICATION_ERROR_NONE;
+}
+
+EXPORT_API int notification_get_property(notification_h noti,
+ int *flags)
+{
+ /* Check noti and flags are valid data */
+ if (noti == NULL || flags == NULL) {
+ return NOTIFICATION_ERROR_INVALID_PARAMETER;
+ }
+
+ /* Set flags */
+ *flags = noti->flags_for_property;
+
+ return NOTIFICATION_ERROR_NONE;
+}
+
+EXPORT_API int notification_set_display_applist(notification_h noti,
+ int applist)
+{
+ /* Check noti is valid data */
+ if (noti == NULL) {
+ return NOTIFICATION_ERROR_INVALID_PARAMETER;
+ }
+
+ /* Set app list */
+ noti->display_applist = applist;
+
+ return NOTIFICATION_ERROR_NONE;
+}
+
+EXPORT_API int notification_get_display_applist(notification_h noti,
+ int *applist)
+{
+ /* Check noti and applist are valid data */
+ if (noti == NULL || applist == NULL) {
+ return NOTIFICATION_ERROR_INVALID_PARAMETER;
+ }
+
+ /* Set app list */
+ *applist = noti->display_applist;
+
+ return NOTIFICATION_ERROR_NONE;
+}
+
+EXPORT_API int notification_set_size(notification_h noti,
+ double size)
+{
+ /* Check noti is valid data */
+ if (noti == NULL) {
+ return NOTIFICATION_ERROR_INVALID_PARAMETER;
+ }
+
+ /* Save progress size */
+ noti->progress_size = size;
+
+ return NOTIFICATION_ERROR_NONE;
+}
+
+EXPORT_API int notification_get_size(notification_h noti,
+ double *size)
+{
+ /* Check noti and size is valid data */
+ if (noti == NULL || size == NULL) {
+ return NOTIFICATION_ERROR_INVALID_PARAMETER;
+ }
+
+ /* Set progress size */
+ *size = noti->progress_size;
+
+ return NOTIFICATION_ERROR_NONE;
+}
+
+EXPORT_API int notification_set_progress(notification_h noti,
+ double percentage)
+{
+ /* Check noti is valid data */
+ if (noti == NULL) {
+ return NOTIFICATION_ERROR_INVALID_PARAMETER;
+ }
+
+ /* Save progress percentage */
+ noti->progress_percentage = percentage;
+
+ return NOTIFICATION_ERROR_NONE;
+}
+
+EXPORT_API int notification_get_progress(notification_h noti,
+ double *percentage)
+{
+ /* Check noti and percentage are valid data */
+ if (noti == NULL || percentage == NULL) {
+ return NOTIFICATION_ERROR_INVALID_PARAMETER;
+ }
+
+ /* Set progress percentage */
+ *percentage = noti->progress_percentage;
+
+ return NOTIFICATION_ERROR_NONE;
+}
+
+EXPORT_API int notification_set_pkgname(notification_h noti,
+ const char *pkgname)
+{
+ /* check noti and pkgname are valid data */
+ if (noti == NULL || pkgname == NULL) {
+ return NOTIFICATION_ERROR_INVALID_PARAMETER;
+ }
+
+ /* Remove previous caller pkgname */
+ if (noti->caller_pkgname) {
+ free(noti->caller_pkgname);
+ noti->caller_pkgname = NULL;
+ }
+
+ noti->caller_pkgname = strdup(pkgname);
+
+ return NOTIFICATION_ERROR_NONE;
+}
+
+EXPORT_API int notification_get_pkgname(notification_h noti,
+ char **pkgname)
+{
+ /* Check noti and pkgname are valid data */
+ if (noti == NULL || pkgname == NULL) {
+ return NOTIFICATION_ERROR_INVALID_PARAMETER;
+ }
+
+ /* Get caller pkgname */
+ if (noti->caller_pkgname) {
+ *pkgname = noti->caller_pkgname;
+ } else {
+ *pkgname = NULL;
+ }
+
+ return NOTIFICATION_ERROR_NONE;
+}
+
+EXPORT_API int notification_set_layout(notification_h noti,
+ notification_ly_type_e layout)
+{
+ /* check noti and pkgname are valid data */
+ if (noti == NULL || (layout < NOTIFICATION_LY_NONE || layout >= NOTIFICATION_LY_MAX)) {
+ return NOTIFICATION_ERROR_INVALID_PARAMETER;
+ }
+
+ noti->layout = layout;
+
+ return NOTIFICATION_ERROR_NONE;
+}
+
+EXPORT_API int notification_get_layout(notification_h noti,
+ notification_ly_type_e *layout)
+{
+ /* Check noti and pkgname are valid data */
+ if (noti == NULL || layout == NULL) {
+ return NOTIFICATION_ERROR_INVALID_PARAMETER;
+ }
+
+ *layout = noti->layout;
+
+ return NOTIFICATION_ERROR_NONE;
+}
+
+EXPORT_API int notification_get_id(notification_h noti,
+ int *group_id, int *priv_id)
+{
+ /* check noti is valid data */
+ if (noti == NULL) {
+ return NOTIFICATION_ERROR_INVALID_PARAMETER;
+ }
+
+ /* Check group_id is valid data */
+ if (group_id) {
+ /* Set group id */
+ if (noti->group_id < NOTIFICATION_GROUP_ID_NONE) {
+ *group_id = NOTIFICATION_GROUP_ID_NONE;
+ } else {
+ *group_id = noti->group_id;
+ }
+ }
+
+ /* Check priv_id is valid data */
+ if (priv_id) {
+ /* Set priv_id */
+ *priv_id = noti->priv_id;
+ }
+
+ return NOTIFICATION_ERROR_NONE;
+}
+
+EXPORT_API int notification_get_type(notification_h noti,
+ notification_type_e *type)
+{
+ /* Check noti and type is valid data */
+ if (noti == NULL || type == NULL) {
+ return NOTIFICATION_ERROR_INVALID_PARAMETER;
+ }
+
+ /* Set noti type */
+ *type = noti->type;
+
+ return NOTIFICATION_ERROR_NONE;
+}
+
+EXPORT_API int notification_post(notification_h noti)
+{
+ int ret = 0;
+ int id = 0;
+
+ /* Check noti is vaild data */
+ if (noti == NULL) {
+ return NOTIFICATION_ERROR_INVALID_PARAMETER;
+ }
+
+ /* Check noti type is valid type */
+ if (noti->type <= NOTIFICATION_TYPE_NONE
+ || noti->type >= NOTIFICATION_TYPE_MAX) {
+ return NOTIFICATION_ERROR_INVALID_PARAMETER;
+ }
+
+ /* Save insert time */
+ noti->insert_time = time(NULL);
+
+ ret = notification_ipc_request_insert(noti, &id);
+ if (ret != NOTIFICATION_ERROR_NONE) {
+ return ret;
+ }
+ noti->priv_id = id;
+ NOTIFICATION_DBG("from master:%d", id);
+
+ return NOTIFICATION_ERROR_NONE;
+}
+
+EXPORT_API int notification_insert(notification_h noti,
+ int *priv_id)
+{
+ int ret = 0;
+ int id = 0;
+
+ /* Check noti is vaild data */
+ if (noti == NULL) {
+ return NOTIFICATION_ERROR_INVALID_PARAMETER;
+ }
+
+ /* Check noti type is valid type */
+ if (noti->type <= NOTIFICATION_TYPE_NONE
+ || noti->type >= NOTIFICATION_TYPE_MAX) {
+ return NOTIFICATION_ERROR_INVALID_PARAMETER;
+ }
+
+ /* Save insert time */
+ noti->insert_time = time(NULL);
+ ret = notification_ipc_request_insert(noti, &id);
+ if (ret != NOTIFICATION_ERROR_NONE) {
+ return ret;
+ }
+ noti->priv_id = id;
+ NOTIFICATION_DBG("from master:%d", id);
+
+ /* If priv_id is valid data, set priv_id */
+ if (priv_id != NULL) {
+ *priv_id = noti->priv_id;
+ }
+
+ return NOTIFICATION_ERROR_NONE;
+}
+
+EXPORT_API int notification_update(notification_h noti)
+{
+ int ret = 0;
+
+ /* Check noti is valid data */
+ if (noti != NULL) {
+ /* Update insert time ? */
+ noti->insert_time = time(NULL);
+ ret = notification_ipc_request_update(noti);
+ } else {
+ notification_ipc_request_refresh();
+ return NOTIFICATION_ERROR_INVALID_PARAMETER;
+ }
+ return ret;
+}
+
+EXPORT_API int notification_update_async(notification_h noti,
+ void (*result_cb)(int priv_id, int result, void *data), void *user_data)
+{
+ int ret = 0;
+
+ if (noti == NULL) {
+ return NOTIFICATION_ERROR_INVALID_PARAMETER;
+ }
+
+ /* Update insert time ? */
+ noti->insert_time = time(NULL);
+ ret = notification_ipc_request_update_async(noti, result_cb, user_data);
+
+ return ret;
+}
+
+EXPORT_API int notifiation_clear(notification_type_e type)
+{
+ int ret = 0;
+
+ if (type <= NOTIFICATION_TYPE_NONE || type >= NOTIFICATION_TYPE_MAX) {
+ return NOTIFICATION_ERROR_INVALID_PARAMETER;
+ }
+
+ ret = notification_ipc_request_delete_multiple(type, NULL);
+
+ return ret;
+}
+
+EXPORT_API int notification_clear(notification_type_e type)
+{
+ int ret = 0;
+
+ if (type <= NOTIFICATION_TYPE_NONE || type >= NOTIFICATION_TYPE_MAX) {
+ return NOTIFICATION_ERROR_INVALID_PARAMETER;
+ }
+
+ ret = notification_ipc_request_delete_multiple(type, NULL);
+
+ return ret;
+}
+
+EXPORT_API int notification_delete_all(notification_type_e type)
+{
+ int ret = 0;
+ char *caller_pkgname = NULL;
+
+ if (type <= NOTIFICATION_TYPE_NONE || type >= NOTIFICATION_TYPE_MAX) {
+ return NOTIFICATION_ERROR_INVALID_PARAMETER;
+ }
+
+ caller_pkgname = _notification_get_pkgname_by_pid();
+
+ ret = notification_ipc_request_delete_multiple(type, caller_pkgname);
+
+ if (caller_pkgname) {
+ free(caller_pkgname);
+ }
+
+ return ret;
+}
+
+EXPORT_API int notification_delete_all_by_type(const char *pkgname,
+ notification_type_e type)
+{
+ int ret = 0;
+ char *caller_pkgname = NULL;
+
+ if (type <= NOTIFICATION_TYPE_NONE || type >= NOTIFICATION_TYPE_MAX) {
+ return NOTIFICATION_ERROR_INVALID_PARAMETER;
+ }
+
+ if (pkgname == NULL) {
+ caller_pkgname = _notification_get_pkgname_by_pid();
+ } else {
+ caller_pkgname = strdup(pkgname);
+ }
+
+ ret = notification_ipc_request_delete_multiple(type, caller_pkgname);
+
+ if (caller_pkgname) {
+ free(caller_pkgname);
+ }
+
+ return ret;
+}
+
+EXPORT_API int notification_delete_by_priv_id(const char *pkgname,
+ notification_type_e type,
+ int priv_id)
+{
+ int ret = 0;
+ char *caller_pkgname = NULL;
+
+ if (priv_id <= NOTIFICATION_PRIV_ID_NONE) {
+ return NOTIFICATION_ERROR_INVALID_PARAMETER;
+ }
+
+ if (pkgname == NULL) {
+ caller_pkgname = _notification_get_pkgname_by_pid();
+ } else {
+ caller_pkgname = strdup(pkgname);
+ }
+
+ ret = notification_ipc_request_delete_single(type, caller_pkgname, priv_id);
+
+ if (caller_pkgname) {
+ free(caller_pkgname);
+ }
+
+ return ret;
+}
+
+EXPORT_API int notification_delete(notification_h noti)
+{
+ int ret = 0;
+
+ if (noti == NULL) {
+ return NOTIFICATION_ERROR_INVALID_PARAMETER;
+ }
+
+ ret = notification_ipc_request_delete_single(NOTIFICATION_TYPE_NONE, noti->caller_pkgname, noti->priv_id);
+
+ return ret;
+}
+
+EXPORT_API int notification_update_progress(notification_h noti,
+ int priv_id,
+ double progress)
+{
+ char *caller_pkgname = NULL;
+ int input_priv_id = 0;
+ int ret = 0;
+ double input_progress = 0.0;
+
+ if (priv_id <= NOTIFICATION_PRIV_ID_NONE) {
+ if (noti == NULL) {
+ return NOTIFICATION_ERROR_INVALID_PARAMETER;
+ } else {
+ input_priv_id = noti->priv_id;
+ }
+ } else {
+ input_priv_id = priv_id;
+ }
+
+ if (noti == NULL) {
+ caller_pkgname = _notification_get_pkgname_by_pid();
+ } else {
+ caller_pkgname = strdup(noti->caller_pkgname);
+ }
+
+ if (progress < 0.0) {
+ input_progress = 0.0;
+ } else if (progress > 1.0) {
+ input_progress = 1.0;
+ } else {
+ input_progress = progress;
+ }
+
+ ret = notification_ongoing_update_progress(caller_pkgname, input_priv_id,
+ input_progress);
+
+ if (caller_pkgname) {
+ free(caller_pkgname);
+ }
+
+ return ret;
+}
+
+EXPORT_API int notification_update_size(notification_h noti,
+ int priv_id,
+ double size)
+{
+ char *caller_pkgname = NULL;
+ int input_priv_id = 0;
+ int ret = 0;
+ double input_size = 0.0;
+
+ if (priv_id <= NOTIFICATION_PRIV_ID_NONE) {
+ if (noti == NULL) {
+ return NOTIFICATION_ERROR_INVALID_PARAMETER;
+ } else {
+ input_priv_id = noti->priv_id;
+ }
+ } else {
+ input_priv_id = priv_id;
+ }
+
+ if (noti == NULL) {
+ caller_pkgname = _notification_get_pkgname_by_pid();
+ } else {
+ caller_pkgname = strdup(noti->caller_pkgname);
+ }
+
+ if (size < 0.0) {
+ input_size = 0.0;
+ } else {
+ input_size = size;
+ }
+
+ ret = notification_ongoing_update_size(caller_pkgname, input_priv_id,
+ input_size);
+
+ if (caller_pkgname) {
+ free(caller_pkgname);
+ }
+
+ return ret;
+}
+
+EXPORT_API int notification_update_content(notification_h noti,
+ int priv_id,
+ const char *content)
+{
+ char *caller_pkgname = NULL;
+ int input_priv_id = 0;
+ int ret = 0;
+
+ if (priv_id <= NOTIFICATION_PRIV_ID_NONE) {
+ if (noti == NULL) {
+ return NOTIFICATION_ERROR_INVALID_PARAMETER;
+ } else {
+ input_priv_id = noti->priv_id;
+ }
+ } else {
+ input_priv_id = priv_id;
+ }
+
+ if (noti == NULL) {
+ caller_pkgname = _notification_get_pkgname_by_pid();
+ } else {
+ caller_pkgname = strdup(noti->caller_pkgname);
+ }
+
+ ret = notification_ongoing_update_content(caller_pkgname, input_priv_id,
+ content);
+
+ if (caller_pkgname) {
+ free(caller_pkgname);
+ }
+
+ return ret;
+}
+
+static notification_h _notification_create(notification_type_e type)
+{
+ notification_h noti = NULL;
+
+ if (type <= NOTIFICATION_TYPE_NONE || type >= NOTIFICATION_TYPE_MAX) {
+ NOTIFICATION_ERR("INVALID TYPE : %d", type);
+ set_last_result(NOTIFICATION_ERROR_INVALID_PARAMETER);
+ return NULL;
+ }
+
+ noti = (notification_h) calloc(1, sizeof(struct _notification));
+ if (noti == NULL) {
+ NOTIFICATION_ERR("NO MEMORY : noti == NULL");
+ set_last_result(NOTIFICATION_ERROR_OUT_OF_MEMORY);
+ return NULL;
+ }
+
+ noti->type = type;
+
+ if (type == NOTIFICATION_TYPE_NOTI)
+ noti->layout = NOTIFICATION_LY_NOTI_EVENT_SINGLE;
+ else if (type == NOTIFICATION_TYPE_ONGOING)
+ noti->layout = NOTIFICATION_LY_ONGOING_PROGRESS;
+
+ noti->caller_pkgname = _notification_get_pkgname_by_pid();
+ noti->group_id = NOTIFICATION_GROUP_ID_NONE;
+ noti->priv_id = NOTIFICATION_PRIV_ID_NONE;
+ noti->sound_type = NOTIFICATION_SOUND_TYPE_NONE;
+ noti->vibration_type = NOTIFICATION_VIBRATION_TYPE_NONE;
+ noti->led_operation = NOTIFICATION_LED_OP_OFF;
+ noti->display_applist = NOTIFICATION_DISPLAY_APP_ALL;
+ /*!
+ * \NOTE
+ * Other fields are already initialized with ZERO.
+ */
+ set_last_result(NOTIFICATION_ERROR_NONE);
+ return noti;
+}
+
+EXPORT_API notification_h notification_new(notification_type_e type,
+ int group_id, int priv_id)
+{
+ return _notification_create(type);
+}
+
+EXPORT_API notification_h notification_create(notification_type_e type)
+{
+ return _notification_create(type);
+}
+
+EXPORT_API notification_h notification_load(char *pkgname,
+ int priv_id)
+{
+ int ret = 0;
+ notification_h noti = NULL;
+
+ noti = (notification_h) calloc(1, sizeof(struct _notification));
+ if (noti == NULL) {
+ NOTIFICATION_ERR("NO MEMORY : noti == NULL");
+ return NULL;
+ }
+
+ ret = notification_noti_get_by_priv_id(noti, pkgname, priv_id);
+ if (ret != NOTIFICATION_ERROR_NONE) {
+ notification_free(noti);
+ return NULL;
+ }
+
+ return noti;
+}
+
+EXPORT_API notification_h notification_load_by_tag(const char *tag)
+{
+ int ret = 0;
+ notification_h noti = NULL;
+ char *caller_pkgname = NULL;
+
+ if (tag == NULL) {
+ NOTIFICATION_ERR("Invalid parameter");
+ set_last_result(NOTIFICATION_ERROR_INVALID_PARAMETER);
+ return NULL;
+ }
+
+ caller_pkgname = _notification_get_pkgname_by_pid();
+ if (!caller_pkgname) {
+ NOTIFICATION_ERR("Failed to get a package name");
+ set_last_result(NOTIFICATION_ERROR_OUT_OF_MEMORY);
+
+ return NULL;
+ }
+
+ noti = (notification_h) calloc(1, sizeof(struct _notification));
+ if (noti == NULL) {
+ NOTIFICATION_ERR("Failed to alloc a new notification");
+ set_last_result(NOTIFICATION_ERROR_OUT_OF_MEMORY);
+ free(caller_pkgname);
+
+ return NULL;
+ }
+
+ ret = notification_ipc_request_load_noti_by_tag(noti, caller_pkgname, tag);
+
+ free(caller_pkgname);
+
+ set_last_result(ret);
+
+ if (ret != NOTIFICATION_ERROR_NONE) {
+ notification_free(noti);
+ return NULL;
+ }
+
+ return noti;
+}
+
+EXPORT_API int notification_clone(notification_h noti, notification_h *clone)
+{
+ notification_h new_noti = NULL;
+
+ if (noti == NULL || clone == NULL) {
+ NOTIFICATION_ERR("INVALID PARAMETER.");
+ return NOTIFICATION_ERROR_INVALID_PARAMETER;
+ }
+
+ new_noti = (notification_h) calloc(1, sizeof(struct _notification));
+ if (new_noti == NULL) {
+ NOTIFICATION_ERR("NO MEMORY : noti == NULL");
+ return NOTIFICATION_ERROR_OUT_OF_MEMORY;
+ }
+
+ new_noti->type = noti->type;
+ new_noti->layout = noti->layout;
+
+ new_noti->group_id = noti->group_id;
+ new_noti->internal_group_id = noti->internal_group_id;
+ new_noti->priv_id = noti->priv_id;
+
+ if(noti->caller_pkgname != NULL) {
+ new_noti->caller_pkgname = strdup(noti->caller_pkgname);
+ } else {
+ new_noti->caller_pkgname = _notification_get_pkgname_by_pid();
+ }
+ if(noti->launch_pkgname != NULL) {
+ new_noti->launch_pkgname = strdup(noti->launch_pkgname);
+ } else {
+ new_noti->launch_pkgname = NULL;
+ }
+
+ if(noti->args != NULL) {
+ new_noti->args = bundle_dup(noti->args);
+ } else {
+ new_noti->args = NULL;
+ }
+ if(noti->group_args != NULL) {
+ new_noti->group_args = bundle_dup(noti->group_args);
+ } else {
+ new_noti->group_args = NULL;
+ }
+
+ if(noti->b_execute_option != NULL) {
+ new_noti->b_execute_option = bundle_dup(noti->b_execute_option);
+ } else {
+ new_noti->b_execute_option = NULL;
+ }
+ if(noti->b_service_responding != NULL) {
+ new_noti->b_service_responding = bundle_dup(noti->b_service_responding);
+ } else {
+ new_noti->b_service_responding = NULL;
+ }
+ if(noti->b_service_single_launch != NULL) {
+ new_noti->b_service_single_launch = bundle_dup(noti->b_service_single_launch);
+ } else {
+ new_noti->b_service_single_launch = NULL;
+ }
+ if(noti->b_service_multi_launch != NULL) {
+ new_noti->b_service_multi_launch = bundle_dup(noti->b_service_multi_launch);
+ } else {
+ new_noti->b_service_multi_launch = NULL;
+ }
+
+ new_noti->sound_type = noti->sound_type;
+ if(noti->sound_path != NULL) {
+ new_noti->sound_path = strdup(noti->sound_path);
+ } else {
+ new_noti->sound_path = NULL;
+ }
+ new_noti->vibration_type = noti->vibration_type;
+ if(noti->vibration_path != NULL) {
+ new_noti->vibration_path = strdup(noti->vibration_path);
+ } else {
+ new_noti->vibration_path = NULL;
+ }
+ new_noti->led_operation = noti->led_operation;
+ new_noti->led_argb = noti->led_argb;
+ new_noti->led_on_ms = noti->led_on_ms;
+ new_noti->led_off_ms = noti->led_off_ms;
+
+ if(noti->domain != NULL) {
+ new_noti->domain = strdup(noti->domain);
+ } else {
+ new_noti->domain = NULL;
+ }
+ if(noti->dir != NULL) {
+ new_noti->dir = strdup(noti->dir);
+ } else {
+ new_noti->dir = NULL;
+ }
+
+ if(noti->b_text != NULL) {
+ new_noti->b_text = bundle_dup(noti->b_text);
+ } else {
+ new_noti->b_text = NULL;
+ }
+ if(noti->b_key != NULL) {
+ new_noti->b_key = bundle_dup(noti->b_key);
+ } else {
+ new_noti->b_key = NULL;
+ }
+ if(noti->b_format_args != NULL) {
+ new_noti->b_format_args = bundle_dup(noti->b_format_args);
+ } else {
+ new_noti->b_format_args = NULL;
+ }
+ new_noti->num_format_args = noti->num_format_args;
+
+ if(noti->b_image_path != NULL) {
+ new_noti->b_image_path = bundle_dup(noti->b_image_path);
+ } else {
+ new_noti->b_image_path = NULL;
+ }
+
+ new_noti->time = noti->time;
+ new_noti->insert_time = noti->insert_time;
+
+ new_noti->flags_for_property = noti->flags_for_property;
+ new_noti->display_applist = noti->display_applist;
+
+ new_noti->progress_size = noti->progress_size;
+ new_noti->progress_percentage = noti->progress_percentage;
+
+ new_noti->app_icon_path = NULL;
+ new_noti->app_name = NULL;
+ new_noti->temp_title = NULL;
+ new_noti->temp_content = NULL;
+
+ *clone = new_noti;
+
+ return NOTIFICATION_ERROR_NONE;
+}
+
+
+EXPORT_API int notification_free(notification_h noti)
+{
+ if (noti == NULL) {
+ return NOTIFICATION_ERROR_INVALID_PARAMETER;
+ }
+
+ if (noti->caller_pkgname) {
+ free(noti->caller_pkgname);
+ }
+ if (noti->launch_pkgname) {
+ free(noti->launch_pkgname);
+ }
+ if (noti->args) {
+ bundle_free(noti->args);
+ }
+ if (noti->group_args) {
+ bundle_free(noti->group_args);
+ }
+
+ if (noti->b_execute_option) {
+ bundle_free(noti->b_execute_option);
+ }
+ if (noti->b_service_responding) {
+ bundle_free(noti->b_service_responding);
+ }
+ if (noti->b_service_single_launch) {
+ bundle_free(noti->b_service_single_launch);
+ }
+ if (noti->b_service_multi_launch) {
+ bundle_free(noti->b_service_multi_launch);
+ }
+
+ if (noti->sound_path) {
+ free(noti->sound_path);
+ }
+ if (noti->vibration_path) {
+ free(noti->vibration_path);
+ }
+
+ if (noti->domain) {
+ free(noti->domain);
+ }
+ if (noti->dir) {
+ free(noti->dir);
+ }
+
+ if (noti->b_text) {
+ bundle_free(noti->b_text);
+ }
+ if (noti->b_key) {
+ bundle_free(noti->b_key);
+ }
+ if (noti->b_format_args) {
+ bundle_free(noti->b_format_args);
+ }
+
+ if (noti->b_image_path) {
+ bundle_free(noti->b_image_path);
+ }
+
+ if (noti->app_icon_path) {
+ free(noti->app_icon_path);
+ }
+ if (noti->app_name) {
+ free(noti->app_name);
+ }
+ if (noti->temp_title) {
+ free(noti->temp_title);
+ }
+ if (noti->temp_content) {
+ free(noti->temp_content);
+ }
+
+ if (noti->tag) {
+ free(noti->tag);
+ }
+
+ free(noti);
+
+ return NOTIFICATION_ERROR_NONE;
+}
+
+EXPORT_API int
+notification_resister_changed_cb(void (*changed_cb)
+ (void *data, notification_type_e type),
+ void *user_data)
+{
+ notification_cb_list_s *noti_cb_list_new = NULL;
+ notification_cb_list_s *noti_cb_list = NULL;
+
+ if (changed_cb == NULL) {
+ return NOTIFICATION_ERROR_INVALID_PARAMETER;
+ }
+ if (notification_ipc_monitor_init() != NOTIFICATION_ERROR_NONE) {
+ return NOTIFICATION_ERROR_IO_ERROR;
+ }
+
+ noti_cb_list_new =
+ (notification_cb_list_s *) malloc(sizeof(notification_cb_list_s));
+
+ noti_cb_list_new->next = NULL;
+ noti_cb_list_new->prev = NULL;
+
+ noti_cb_list_new->cb_type = NOTIFICATION_CB_NORMAL;
+ noti_cb_list_new->changed_cb = changed_cb;
+ noti_cb_list_new->detailed_changed_cb = NULL;
+ noti_cb_list_new->data = user_data;
+
+ if (g_notification_cb_list == NULL) {
+ g_notification_cb_list = noti_cb_list_new;
+ } else {
+ noti_cb_list = g_notification_cb_list;
+
+ while (noti_cb_list->next != NULL) {
+ noti_cb_list = noti_cb_list->next;
+ }
+
+ noti_cb_list->next = noti_cb_list_new;
+ noti_cb_list_new->prev = noti_cb_list;
+ }
+ return NOTIFICATION_ERROR_NONE;
+}
+
+EXPORT_API int
+notification_unresister_changed_cb(void (*changed_cb)
+ (void *data, notification_type_e type))
+{
+ notification_cb_list_s *noti_cb_list = NULL;
+ notification_cb_list_s *noti_cb_list_prev = NULL;
+ notification_cb_list_s *noti_cb_list_next = NULL;
+
+ noti_cb_list = g_notification_cb_list;
+
+ if (changed_cb == NULL) {
+ return NOTIFICATION_ERROR_INVALID_PARAMETER;
+ }
+ if (noti_cb_list == NULL) {
+ return NOTIFICATION_ERROR_INVALID_PARAMETER;
+ }
+
+ while (noti_cb_list->prev != NULL) {
+ noti_cb_list = noti_cb_list->prev;
+ }
+
+ do {
+ if (noti_cb_list->changed_cb == changed_cb) {
+ noti_cb_list_prev = noti_cb_list->prev;
+ noti_cb_list_next = noti_cb_list->next;
+
+ if (noti_cb_list_prev == NULL) {
+ g_notification_cb_list = noti_cb_list_next;
+ } else {
+ noti_cb_list_prev->next = noti_cb_list_next;
+ }
+
+ if (noti_cb_list_next == NULL) {
+ if (noti_cb_list_prev != NULL) {
+ noti_cb_list_prev->next = NULL;
+ }
+ } else {
+ noti_cb_list_next->prev = noti_cb_list_prev;
+ }
+
+ free(noti_cb_list);
+
+ if (g_notification_cb_list == NULL)
+ notification_ipc_monitor_fini();
+
+ return NOTIFICATION_ERROR_NONE;
+ }
+ noti_cb_list = noti_cb_list->next;
+ } while (noti_cb_list != NULL);
+
+ return NOTIFICATION_ERROR_INVALID_PARAMETER;
+}
+
+EXPORT_API int
+notification_register_detailed_changed_cb(
+ void (*detailed_changed_cb)(void *data, notification_type_e type, notification_op *op_list, int num_op),
+ void *user_data)
+{
+ notification_cb_list_s *noti_cb_list_new = NULL;
+ notification_cb_list_s *noti_cb_list = NULL;
+
+ if (detailed_changed_cb == NULL) {
+ return NOTIFICATION_ERROR_INVALID_PARAMETER;
+ }
+ if (notification_ipc_monitor_init() != NOTIFICATION_ERROR_NONE) {
+ return NOTIFICATION_ERROR_IO_ERROR;
+ }
+
+ noti_cb_list_new =
+ (notification_cb_list_s *) malloc(sizeof(notification_cb_list_s));
+
+ noti_cb_list_new->next = NULL;
+ noti_cb_list_new->prev = NULL;
+
+ noti_cb_list_new->cb_type = NOTIFICATION_CB_DETAILED;
+ noti_cb_list_new->changed_cb = NULL;
+ noti_cb_list_new->detailed_changed_cb = detailed_changed_cb;
+ noti_cb_list_new->data = user_data;
+
+ if (g_notification_cb_list == NULL) {
+ g_notification_cb_list = noti_cb_list_new;
+ } else {
+ noti_cb_list = g_notification_cb_list;
+
+ while (noti_cb_list->next != NULL) {
+ noti_cb_list = noti_cb_list->next;
+ }
+
+ noti_cb_list->next = noti_cb_list_new;
+ noti_cb_list_new->prev = noti_cb_list;
+ }
+ return NOTIFICATION_ERROR_NONE;
+}
+
+EXPORT_API int
+notification_unregister_detailed_changed_cb(
+ void (*detailed_changed_cb)(void *data, notification_type_e type, notification_op *op_list, int num_op),
+ void *user_data)
+{
+ notification_cb_list_s *noti_cb_list = NULL;
+ notification_cb_list_s *noti_cb_list_prev = NULL;
+ notification_cb_list_s *noti_cb_list_next = NULL;
+
+ noti_cb_list = g_notification_cb_list;
+
+ if (detailed_changed_cb == NULL) {
+ return NOTIFICATION_ERROR_INVALID_PARAMETER;
+ }
+ if (noti_cb_list == NULL) {
+ return NOTIFICATION_ERROR_INVALID_PARAMETER;
+ }
+
+ while (noti_cb_list->prev != NULL) {
+ noti_cb_list = noti_cb_list->prev;
+ }
+
+ do {
+ if (noti_cb_list->detailed_changed_cb == detailed_changed_cb) {
+ noti_cb_list_prev = noti_cb_list->prev;
+ noti_cb_list_next = noti_cb_list->next;
+
+ if (noti_cb_list_prev == NULL) {
+ g_notification_cb_list = noti_cb_list_next;
+ } else {
+ noti_cb_list_prev->next = noti_cb_list_next;
+ }
+
+ if (noti_cb_list_next == NULL) {
+ if (noti_cb_list_prev != NULL) {
+ noti_cb_list_prev->next = NULL;
+ }
+ } else {
+ noti_cb_list_next->prev = noti_cb_list_prev;
+ }
+
+ free(noti_cb_list);
+
+ if (g_notification_cb_list == NULL)
+ notification_ipc_monitor_fini();
+
+ return NOTIFICATION_ERROR_NONE;
+ }
+ noti_cb_list = noti_cb_list->next;
+ } while (noti_cb_list != NULL);
+
+ return NOTIFICATION_ERROR_INVALID_PARAMETER;
+}
+
+EXPORT_API int notification_get_count(notification_type_e type,
+ const char *pkgname,
+ int group_id,
+ int priv_id, int *count)
+{
+ int ret = 0;
+ int noti_count = 0;
+
+ if (count == NULL) {
+ return NOTIFICATION_ERROR_INVALID_PARAMETER;
+ }
+
+ ret =
+ notification_noti_get_count(type, pkgname, group_id, priv_id,
+ &noti_count);
+ if (ret != NOTIFICATION_ERROR_NONE) {
+ return ret;
+ }
+
+ *count = noti_count;
+
+ return NOTIFICATION_ERROR_NONE;
+}
+
+EXPORT_API int notification_get_list(notification_type_e type,
+ int count,
+ notification_list_h *list)
+{
+ notification_list_h get_list = NULL;
+ int ret = 0;
+
+ if (list == NULL) {
+ return NOTIFICATION_ERROR_INVALID_PARAMETER;
+ }
+
+ ret = notification_noti_get_grouping_list(type, count, &get_list);
+ if (ret != NOTIFICATION_ERROR_NONE) {
+ return ret;
+ }
+
+ *list = get_list;
+
+ return NOTIFICATION_ERROR_NONE;
+}
+
+EXPORT_API int
+notification_get_grouping_list(notification_type_e type, int count,
+ notification_list_h * list)
+{
+ notification_list_h get_list = NULL;
+ int ret = 0;
+
+ if (list == NULL) {
+ return NOTIFICATION_ERROR_INVALID_PARAMETER;
+ }
+
+ ret = notification_noti_get_grouping_list(type, count, &get_list);
+ if (ret != NOTIFICATION_ERROR_NONE) {
+ return ret;
+ }
+
+ *list = get_list;
+
+ return NOTIFICATION_ERROR_NONE;
+}
+
+EXPORT_API int notification_get_detail_list(const char *pkgname,
+ int group_id,
+ int priv_id,
+ int count,
+ notification_list_h *list)
+{
+ notification_list_h get_list = NULL;
+ int ret = 0;
+
+ if (list == NULL) {
+ return NOTIFICATION_ERROR_INVALID_PARAMETER;
+ }
+
+ ret =
+ notification_noti_get_detail_list(pkgname, group_id, priv_id, count,
+ &get_list);
+ if (ret != NOTIFICATION_ERROR_NONE) {
+ return ret;
+ }
+
+ *list = get_list;
+
+ return NOTIFICATION_ERROR_NONE;
+}
+
+EXPORT_API int notification_free_list(notification_list_h list)
+{
+ notification_list_h cur_list = NULL;
+ notification_h noti = NULL;
+
+ if (list == NULL) {
+ return NOTIFICATION_ERROR_INVALID_PARAMETER;
+ }
+
+ cur_list = notification_list_get_head(list);
+
+ while (cur_list != NULL) {
+ noti = notification_list_get_data(cur_list);
+ cur_list = notification_list_remove(cur_list, noti);
+
+ notification_free(noti);
+ }
+
+ return NOTIFICATION_ERROR_NONE;
+}
+
+EXPORT_API int notification_op_get_data(notification_op *noti_op, notification_op_data_type_e type,
+ void *data)
+{
+ if (noti_op == NULL || data == NULL) {
+ return NOTIFICATION_ERROR_INVALID_PARAMETER;
+ }
+
+ switch (type) {
+ case NOTIFICATION_OP_DATA_TYPE:
+ *((int*)data) = noti_op->type;
+ break;
+ case NOTIFICATION_OP_DATA_PRIV_ID:
+ *((int*)data) = noti_op->priv_id;
+ break;
+ case NOTIFICATION_OP_DATA_NOTI:
+ *((notification_h *)data) = noti_op->noti;
+ break;
+ case NOTIFICATION_OP_DATA_EXTRA_INFO_1:
+ *((int*)data) = noti_op->extra_info_1;
+ break;
+ case NOTIFICATION_OP_DATA_EXTRA_INFO_2:
+ *((int*)data) = noti_op->extra_info_2;
+ break;
+ default:
+ return NOTIFICATION_ERROR_INVALID_PARAMETER;
+ break;
+ }
+
+ return NOTIFICATION_ERROR_NONE;
+}
+
+void notification_call_changed_cb(notification_op *op_list, int op_num)
+{
+ notification_cb_list_s *noti_cb_list = NULL;
+ notification_type_e type = 0;
+
+ if (g_notification_cb_list == NULL) {
+ return;
+ }
+ noti_cb_list = g_notification_cb_list;
+
+ while (noti_cb_list->prev != NULL) {
+ noti_cb_list = noti_cb_list->prev;
+ }
+
+ if (op_list == NULL) {
+ NOTIFICATION_ERR("invalid data");
+ return ;
+ }
+
+ notification_get_type(op_list->noti, &type);
+
+ while (noti_cb_list != NULL) {
+ if (noti_cb_list->cb_type == NOTIFICATION_CB_NORMAL && noti_cb_list->changed_cb) {
+ noti_cb_list->changed_cb(noti_cb_list->data,
+ type);
+ }
+ if (noti_cb_list->cb_type == NOTIFICATION_CB_DETAILED && noti_cb_list->detailed_changed_cb) {
+ noti_cb_list->detailed_changed_cb(noti_cb_list->data,
+ type, op_list, op_num);
+ }
+
+ noti_cb_list = noti_cb_list->next;
+ }
+}
+
+EXPORT_API int notification_is_service_ready(void)
+{
+ return notification_ipc_is_master_ready();
+}
+
+EXPORT_API int
+notification_add_deferred_task(
+ void (*deferred_task_cb)(void *data), void *user_data)
+{
+ if (deferred_task_cb == NULL) {
+ return NOTIFICATION_ERROR_INVALID_PARAMETER;
+ }
+
+ return notification_ipc_add_deffered_task(deferred_task_cb, user_data);
+}
+
+EXPORT_API int
+notification_del_deferred_task(
+ void (*deferred_task_cb)(void *data))
+{
+ if (deferred_task_cb == NULL) {
+ return NOTIFICATION_ERROR_INVALID_PARAMETER;
+ }
+
+ return notification_ipc_del_deffered_task(deferred_task_cb);
+}
+
+/* notification_set_icon will be removed */
+EXPORT_API int notification_set_icon(notification_h noti,
+ const char *icon_path)
+{
+ int ret_err = NOTIFICATION_ERROR_NONE;
+
+ ret_err =
+ notification_set_image(noti, NOTIFICATION_IMAGE_TYPE_ICON,
+ icon_path);
+
+ return ret_err;
+}
+
+/* notification_get_icon will be removed */
+EXPORT_API int notification_get_icon(notification_h noti,
+ char **icon_path)
+{
+ int ret_err = NOTIFICATION_ERROR_NONE;
+ char *ret_image_path = NULL;
+
+ ret_err =
+ notification_get_image(noti, NOTIFICATION_IMAGE_TYPE_ICON,
+ &ret_image_path);
+
+ if (ret_err == NOTIFICATION_ERROR_NONE && icon_path != NULL) {
+ *icon_path = ret_image_path;
+
+ //NOTIFICATION_DBG("Get icon : %s", *icon_path);
+ }
+
+ return ret_err;
+}
+
+EXPORT_API int notification_set_title(notification_h noti,
+ const char *title,
+ const char *loc_title)
+{
+ int noti_err = NOTIFICATION_ERROR_NONE;
+
+ noti_err = notification_set_text(noti, NOTIFICATION_TEXT_TYPE_TITLE,
+ title, loc_title,
+ NOTIFICATION_VARIABLE_TYPE_NONE);
+
+ return noti_err;
+}
+
+EXPORT_API int notification_get_title(notification_h noti,
+ char **title,
+ char **loc_title)
+{
+ int noti_err = NOTIFICATION_ERROR_NONE;
+ char *ret_text = NULL;
+
+ noti_err =
+ notification_get_text(noti, NOTIFICATION_TEXT_TYPE_TITLE,
+ &ret_text);
+
+ if (title != NULL) {
+ *title = ret_text;
+ }
+
+ if (loc_title != NULL) {
+ *loc_title = NULL;
+ }
+
+ return noti_err;
+}
+
+EXPORT_API int notification_set_content(notification_h noti,
+ const char *content,
+ const char *loc_content)
+{
+ int noti_err = NOTIFICATION_ERROR_NONE;
+
+ noti_err = notification_set_text(noti, NOTIFICATION_TEXT_TYPE_CONTENT,
+ content, loc_content,
+ NOTIFICATION_VARIABLE_TYPE_NONE);
+
+ return noti_err;
+}
+
+EXPORT_API int notification_get_content(notification_h noti,
+ char **content,
+ char **loc_content)
+{
+ int noti_err = NOTIFICATION_ERROR_NONE;
+ char *ret_text = NULL;
+
+ noti_err =
+ notification_get_text(noti, NOTIFICATION_TEXT_TYPE_CONTENT,
+ &ret_text);
+
+ if (content != NULL) {
+ *content = ret_text;
+ }
+
+ if (loc_content != NULL) {
+ *loc_content = NULL;
+ }
+
+ return noti_err;
+
+#if 0
+ ret =
+ vconf_get_bool
+ (VCONFKEY_SETAPPL_STATE_TICKER_NOTI_DISPLAY_CONTENT_BOOL, &boolval);
+
+ if (ret == -1 || boolval == 0) {
+ if (content != NULL && noti->default_content != NULL) {
+ *content = noti->default_content;
+ }
+
+ if (loc_content != NULL && noti->loc_default_content != NULL) {
+ *loc_content = noti->loc_default_content;
+ }
+ }
+#endif
+}
+
+EXPORT_API int notification_set_args(notification_h noti,
+ bundle * args,
+ bundle * group_args)
+{
+ if (noti == NULL || args == NULL) {
+ return NOTIFICATION_ERROR_INVALID_PARAMETER;
+ }
+
+ if (noti->args) {
+ bundle_free(noti->args);
+ }
+
+ noti->args = bundle_dup(args);
+
+ if (noti->group_args) {
+ bundle_free(noti->group_args);
+ noti->group_args = NULL;
+ }
+
+ if (group_args != NULL) {
+ noti->group_args = bundle_dup(group_args);
+ }
+
+ return NOTIFICATION_ERROR_NONE;
+}
+
+EXPORT_API int notification_get_args(notification_h noti,
+ bundle ** args,
+ bundle ** group_args)
+{
+ if (noti == NULL || args == NULL) {
+ return NOTIFICATION_ERROR_INVALID_PARAMETER;
+ }
+
+ if (noti->args) {
+ *args = noti->args;
+ } else {
+ *args = NULL;
+ }
+
+ if (group_args != NULL && noti->group_args) {
+ *group_args = noti->group_args;
+ }
+
+ return NOTIFICATION_ERROR_NONE;
+}
+
+EXPORT_API int notification_delete_group_by_group_id(const char *pkgname,
+ notification_type_e type,
+ int group_id)
+{
+ int ret = 0;
+ char *caller_pkgname = NULL;
+
+ if (pkgname == NULL) {
+ caller_pkgname = _notification_get_pkgname_by_pid();
+ } else {
+ caller_pkgname = strdup(pkgname);
+ }
+
+ ret = notification_ipc_request_delete_multiple(type, caller_pkgname);
+ if (ret != NOTIFICATION_ERROR_NONE) {
+ if (caller_pkgname) {
+ free(caller_pkgname);
+ }
+ return ret;
+ }
+
+ if (caller_pkgname) {
+ free(caller_pkgname);
+ }
+ return NOTIFICATION_ERROR_NONE;
+}
+
+EXPORT_API int notification_delete_group_by_priv_id(const char *pkgname,
+ notification_type_e type,
+ int priv_id)
+{
+ int ret = 0;
+ char *caller_pkgname = NULL;
+
+ if (pkgname == NULL) {
+ caller_pkgname = _notification_get_pkgname_by_pid();
+ } else {
+ caller_pkgname = strdup(pkgname);
+ }
+
+ ret = notification_ipc_request_delete_single(type, caller_pkgname, priv_id);
+ if (ret != NOTIFICATION_ERROR_NONE) {
+ if (caller_pkgname) {
+ free(caller_pkgname);
+ }
+ return ret;
+ }
+
+ if (caller_pkgname) {
+ free(caller_pkgname);
+ }
+ return NOTIFICATION_ERROR_NONE;
+}
+
+EXPORT_API int notification_set_tag(notification_h noti, const char *tag)
+{
+ /* Check noti is valid data */
+ if (noti == NULL) {
+ return NOTIFICATION_ERROR_INVALID_PARAMETER;
+ }
+
+ if (tag != NULL) {
+ /* save input TAG */
+ if (noti->tag != NULL) {
+ free(noti->tag);
+ }
+ noti->tag = strdup(tag);
+ }
+
+ return NOTIFICATION_ERROR_NONE;
+
+}
+
+EXPORT_API int notification_get_tag(notification_h noti, const char **tag)
+{
+ /* Check noti is valid data */
+ if (noti == NULL) {
+ return NOTIFICATION_ERROR_INVALID_PARAMETER;
+ }
+
+ /* Set sound type */
+ *tag = noti->tag;
+ return NOTIFICATION_ERROR_NONE;
+}
+
+EXPORT_API int notification_register_toast_message(void (*posted_toast_cb) (void *data))
+{
+ if (notification_ipc_monitor_init() != NOTIFICATION_ERROR_NONE) {
+ return NOTIFICATION_ERROR_IO_ERROR;
+ }
+
+ posted_toast_message_cb = posted_toast_cb;
+
+ return NOTIFICATION_ERROR_NONE;
+}
+
+void notification_call_posted_toast_cb(const char *message)
+{
+ if (posted_toast_message_cb != NULL) {
+ posted_toast_message_cb(message);
+ }
+}
diff --git a/src/notification_db.c b/src/notification_db.c
new file mode 100644
index 0000000..6450641
--- /dev/null
+++ b/src/notification_db.c
@@ -0,0 +1,134 @@
+/*
+ * libnotification
+ *
+ * Copyright (c) 2000 - 2011 Samsung Electronics Co., Ltd. All rights reserved.
+ *
+ * Contact: Seungtaek Chung <seungtaek.chung@samsung.com>, Mi-Ju Lee <miju52.lee@samsung.com>, Xi Zhichan <zhichan.xi@samsung.com>
+ *
+ * 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 <errno.h>
+#include <unistd.h>
+#include <stdio.h>
+#include <string.h>
+
+#include <sqlite3.h>
+#include <db-util.h>
+#include <tizen.h>
+
+#include <notification_error.h>
+#include <notification_debug.h>
+#include <notification_db.h>
+
+sqlite3 * notification_db_open(const char *dbfile)
+{
+ int ret = 0;
+ sqlite3 *db =0;
+
+ ret = db_util_open(dbfile, &db, 0);
+ if (ret != SQLITE_OK) {
+ if (ret == SQLITE_PERM) {
+ set_last_result(NOTIFICATION_ERROR_PERMISSION_DENIED);
+ }
+ else {
+ set_last_result(NOTIFICATION_ERROR_FROM_DB);
+ }
+ return NULL;
+ }
+
+ return db;
+}
+
+int notification_db_close(sqlite3 ** db)
+{
+ int ret = 0;
+
+ if (db == NULL || *db == NULL) {
+ return NOTIFICATION_ERROR_INVALID_PARAMETER;
+ }
+
+ ret = db_util_close(*db);
+ if (ret != SQLITE_OK) {
+ NOTIFICATION_ERR("DB close error(%d)", ret);
+ return NOTIFICATION_ERROR_FROM_DB;
+ }
+
+ *db = NULL;
+
+ return NOTIFICATION_ERROR_NONE;
+}
+
+int notification_db_exec(sqlite3 * db, const char *query, int *num_changes)
+{
+ int ret = 0;
+ sqlite3_stmt *stmt = NULL;
+
+ if (db == NULL) {
+ return NOTIFICATION_ERROR_INVALID_PARAMETER;
+ }
+ if (query == NULL) {
+ return NOTIFICATION_ERROR_INVALID_PARAMETER;
+ }
+
+ ret = sqlite3_prepare_v2(db, query, strlen(query), &stmt, NULL);
+ if (ret != SQLITE_OK) {
+ NOTIFICATION_ERR("DB err(%d) : %s", ret,
+ sqlite3_errmsg(db));
+ return NOTIFICATION_ERROR_FROM_DB;
+ }
+
+ if (stmt != NULL) {
+ ret = sqlite3_step(stmt);
+ if (ret == SQLITE_OK || ret == SQLITE_DONE) {
+ if (num_changes != NULL) {
+ *num_changes = sqlite3_changes(db);
+ }
+ sqlite3_finalize(stmt);
+ } else {
+ NOTIFICATION_ERR("DB err(%d) : %s", ret,
+ sqlite3_errmsg(db));
+ sqlite3_finalize(stmt);
+ return NOTIFICATION_ERROR_FROM_DB;
+ }
+ } else {
+ return NOTIFICATION_ERROR_FROM_DB;
+ }
+
+ return NOTIFICATION_ERROR_NONE;
+}
+
+char *notification_db_column_text(sqlite3_stmt * stmt, int col)
+{
+ const unsigned char *col_text = NULL;
+
+ col_text = sqlite3_column_text(stmt, col);
+ if (col_text == NULL || col_text[0] == '\0') {
+ return NULL;
+ }
+
+ return strdup((char *)col_text);
+}
+
+bundle *notification_db_column_bundle(sqlite3_stmt * stmt, int col)
+{
+ const unsigned char *col_bundle = NULL;
+
+ col_bundle = sqlite3_column_text(stmt, col);
+ if (col_bundle == NULL || col_bundle[0] == '\0') {
+ return NULL;
+ }
+
+ return bundle_decode(col_bundle, strlen((char *)col_bundle));
+}
diff --git a/src/notification_group.c b/src/notification_group.c
new file mode 100644
index 0000000..439d9c8
--- /dev/null
+++ b/src/notification_group.c
@@ -0,0 +1,202 @@
+/*
+ * libnotification
+ *
+ * Copyright (c) 2000 - 2011 Samsung Electronics Co., Ltd. All rights reserved.
+ *
+ * Contact: Seungtaek Chung <seungtaek.chung@samsung.com>, Mi-Ju Lee <miju52.lee@samsung.com>, Xi Zhichan <zhichan.xi@samsung.com>
+ *
+ * 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 <notification_debug.h>
+#include <notification_group.h>
+#include <notification_db.h>
+
+static int _notification_group_check_data_inserted(const char *pkgname,
+ int group_id, sqlite3 * db)
+{
+ sqlite3_stmt *stmt = NULL;
+ char query[NOTIFICATION_QUERY_MAX] = { 0, };
+ int ret = NOTIFICATION_ERROR_NONE, result = 0;
+
+ snprintf(query, sizeof(query),
+ "select count(*) from noti_group_data where caller_pkgname = '%s' and group_id = %d",
+ pkgname, group_id);
+
+ ret = sqlite3_prepare(db, query, strlen(query), &stmt, NULL);
+ if (ret != SQLITE_OK) {
+ NOTIFICATION_ERR("Get count DB err(%d) : %s", ret,
+ sqlite3_errmsg(db));
+ return NOTIFICATION_ERROR_FROM_DB;
+ }
+
+ ret = sqlite3_step(stmt);
+ if (ret == SQLITE_ROW) {
+ result = sqlite3_column_int(stmt, 0);
+ } else {
+ result = 0;
+ }
+
+ NOTIFICATION_INFO("Check Data Inserted : query[%s], result : [%d]",
+ query, result);
+
+ sqlite3_finalize(stmt);
+
+ if (result > 0) {
+ return NOTIFICATION_ERROR_ALREADY_EXIST_ID;
+ }
+
+ return NOTIFICATION_ERROR_NONE;
+}
+
+int notification_group_set_badge(const char *pkgname,
+ int group_id, int count)
+{
+ sqlite3 *db;
+ sqlite3_stmt *stmt = NULL;
+ char query[NOTIFICATION_QUERY_MAX] = { 0, };
+ int ret = 0;
+ int result = NOTIFICATION_ERROR_NONE;
+
+ /* Open DB */
+ db = notification_db_open(DBPATH);
+ if (!db) {
+ return get_last_result();
+ }
+
+ /* Check pkgname & group_id */
+ ret = _notification_group_check_data_inserted(pkgname, group_id, db);
+
+ /* Make query */
+ if (ret == NOTIFICATION_ERROR_NONE) {
+ /* Insert if does not exist */
+ snprintf(query, sizeof(query), "insert into noti_group_data ("
+ "caller_pkgname, group_id, badge, content, loc_content) values ("
+ "'%s', %d, %d, '', '')", pkgname, group_id, count);
+
+ } else {
+ /* Update if exist */
+ snprintf(query, sizeof(query), "update noti_group_data "
+ "set badge = %d "
+ "where caller_pkgname = '%s' and group_id = %d",
+ count, pkgname, group_id);
+ }
+
+ ret = sqlite3_prepare_v2(db, query, -1, &stmt, NULL);
+ if (ret != SQLITE_OK) {
+ NOTIFICATION_ERR("Insert Query : %s", query);
+ NOTIFICATION_ERR("Insert DB error(%d) : %s", ret,
+ sqlite3_errmsg(db));
+ if (stmt) {
+ sqlite3_finalize(stmt);
+ }
+
+ if (db) {
+ notification_db_close(&db);
+ }
+ return NOTIFICATION_ERROR_FROM_DB;
+ }
+
+ ret = sqlite3_step(stmt);
+ if (ret == SQLITE_OK || ret == SQLITE_DONE) {
+ result = NOTIFICATION_ERROR_NONE;
+ } else {
+ result = NOTIFICATION_ERROR_FROM_DB;
+ }
+
+ if (stmt) {
+ sqlite3_finalize(stmt);
+ }
+
+ /* Close DB */
+ if (db) {
+ notification_db_close(&db);
+ }
+
+ return result;
+}
+
+int notification_group_get_badge(const char *pkgname,
+ int group_id, int *count)
+{
+ sqlite3 *db;
+ sqlite3_stmt *stmt = NULL;
+ char query[NOTIFICATION_QUERY_MAX] = { 0, };
+ int ret = 0;
+ int col = 0;
+
+ /* Open DB */
+ db = notification_db_open(DBPATH);
+ if (!db) {
+ return get_last_result();
+ }
+
+ /* Make query */
+ if (group_id == NOTIFICATION_GROUP_ID_NONE) {
+ /* Check Group id None is exist */
+ ret =
+ _notification_group_check_data_inserted(pkgname, group_id,
+ db);
+
+ if (ret == NOTIFICATION_ERROR_NONE) {
+ /* Get all of pkgname count if none group id is not exist */
+ snprintf(query, sizeof(query),
+ "select sum(badge) "
+ "from noti_group_data "
+ "where caller_pkgname = '%s'", pkgname);
+ } else {
+ /* Get none group id count */
+ snprintf(query, sizeof(query),
+ "select badge "
+ "from noti_group_data "
+ "where caller_pkgname = '%s' and group_id = %d",
+ pkgname, group_id);
+ }
+ } else {
+ snprintf(query, sizeof(query),
+ "select badge "
+ "from noti_group_data "
+ "where caller_pkgname = '%s' and group_id = %d",
+ pkgname, group_id);
+ }
+
+ NOTIFICATION_INFO("Get badge : query[%s]", query);
+
+ ret = sqlite3_prepare(db, query, strlen(query), &stmt, NULL);
+ if (ret != SQLITE_OK) {
+ NOTIFICATION_ERR("Select Query : %s", query);
+ NOTIFICATION_ERR("Select DB error(%d) : %s", ret,
+ sqlite3_errmsg(db));
+
+ return NOTIFICATION_ERROR_FROM_DB;
+ }
+
+ ret = sqlite3_step(stmt);
+ if (ret == SQLITE_ROW) {
+ *count = sqlite3_column_int(stmt, col++);
+ }
+
+ sqlite3_finalize(stmt);
+
+ // db close
+ if (db) {
+ notification_db_close(&db);
+ }
+
+ return NOTIFICATION_ERROR_NONE;
+}
diff --git a/src/notification_ipc.c b/src/notification_ipc.c
new file mode 100644
index 0000000..ac1391b
--- /dev/null
+++ b/src/notification_ipc.c
@@ -0,0 +1,1496 @@
+/*
+ * libnotification
+ *
+ * Copyright (c) 2000 - 2011 Samsung Electronics Co., Ltd. All rights reserved.
+ *
+ * Contact: Seungtaek Chung <seungtaek.chung@samsung.com>, Mi-Ju Lee <miju52.lee@samsung.com>, Xi Zhichan <zhichan.xi@samsung.com>
+ *
+ * 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 <string.h>
+#include <stdlib.h>
+#include <errno.h>
+
+#include <vconf.h>
+
+#include <packet.h>
+#include <com-core.h>
+#include <com-core_packet.h>
+
+#include <notification_ipc.h>
+#include <notification_db.h>
+#include <notification_type.h>
+#include <notification_private.h>
+#include <notification_debug.h>
+
+#define NOTIFICATION_IPC_TIMEOUT 0.0
+
+#if !defined(VCONFKEY_MASTER_STARTED)
+#define VCONFKEY_MASTER_STARTED "memory/data-provider-master/started"
+#endif
+
+static struct info {
+ int server_fd;
+ int server_cl_fd;
+ int server_cl_fd_ref_cnt;
+ int client_fd;
+ const char *socket_file;
+ struct {
+ int (*request_cb)(const char *appid, const char *name, int type, const char *content, const char *icon, pid_t pid, double period, int allow_duplicate, void *data);
+ void *data;
+ } server_cb;
+ int initialized;
+ int is_started_cb_set_svc;
+ int is_started_cb_set_task;
+} s_info = {
+ .server_fd = -1,
+ .server_cl_fd = -1,
+ .server_cl_fd_ref_cnt = 0,
+ .client_fd = -1,
+ .socket_file = NOTIFICATION_ADDR,
+ .initialized = 0,
+ .is_started_cb_set_svc = 0,
+ .is_started_cb_set_task = 0,
+};
+
+typedef struct _task_list task_list;
+struct _task_list {
+ task_list *prev;
+ task_list *next;
+
+ void (*task_cb) (void *data);
+ void *data;
+};
+
+typedef struct _result_cb_item {
+ void (*result_cb)(int priv_id, int result, void *data);
+ void *data;
+} result_cb_item;
+
+static task_list *g_task_list;
+
+static int notification_ipc_monitor_register(void);
+static int notification_ipc_monitor_deregister(void);
+static void _do_deffered_task(void);
+static void _master_started_cb_task(keynode_t *node, void *data);
+
+static inline char *_string_get(char *string)
+{
+ if (string == NULL) {
+ return NULL;
+ }
+ if (string[0] == '\0') {
+ return NULL;
+ }
+
+ return string;
+}
+
+/*!
+ * functions to check state of master
+ */
+static inline void _set_master_started_cb(vconf_callback_fn cb) {
+ int ret = -1;
+
+ ret = vconf_notify_key_changed(VCONFKEY_MASTER_STARTED,
+ cb, NULL);
+ if (ret != 0) {
+ NOTIFICATION_ERR("failed to notify key(%s) : %d",
+ VCONFKEY_MASTER_STARTED, ret);
+ }
+}
+
+static inline void _unset_master_started_cb(vconf_callback_fn cb) {
+ int ret = -1;
+
+ ret = vconf_ignore_key_changed(VCONFKEY_MASTER_STARTED,
+ cb);
+ if (ret != 0) {
+ NOTIFICATION_ERR("failed to notify key(%s) : %d",
+ VCONFKEY_MASTER_STARTED, ret);
+ }
+}
+
+int notification_ipc_is_master_ready(void)
+{
+ int ret = -1, is_master_started = 0;
+
+ ret = vconf_get_bool(VCONFKEY_MASTER_STARTED, &is_master_started);
+ if (ret == 0 && is_master_started == 1) {
+ NOTIFICATION_ERR("the master has been started");
+ } else {
+ is_master_started = 0;
+ NOTIFICATION_ERR("the master has been stopped");
+ }
+
+ return is_master_started;
+}
+
+int
+notification_ipc_add_deffered_task(
+ void (*deferred_task_cb)(void *data),
+ void *user_data)
+{
+ task_list *list = NULL;
+ task_list *list_new = NULL;
+
+ list_new =
+ (task_list *) malloc(sizeof(task_list));
+
+ if (list_new == NULL) {
+ return NOTIFICATION_ERROR_OUT_OF_MEMORY;
+ }
+
+ if (s_info.is_started_cb_set_task == 0) {
+ _set_master_started_cb(_master_started_cb_task);
+ s_info.is_started_cb_set_task = 1;
+ }
+
+ list_new->next = NULL;
+ list_new->prev = NULL;
+
+ list_new->task_cb = deferred_task_cb;
+ list_new->data = user_data;
+
+ if (g_task_list == NULL) {
+ g_task_list = list_new;
+ } else {
+ list = g_task_list;
+
+ while (list->next != NULL) {
+ list = list->next;
+ }
+
+ list->next = list_new;
+ list_new->prev = list;
+ }
+ return NOTIFICATION_ERROR_NONE;
+}
+
+int
+notification_ipc_del_deffered_task(
+ void (*deferred_task_cb)(void *data))
+{
+ task_list *list_del = NULL;
+ task_list *list_prev = NULL;
+ task_list *list_next = NULL;
+
+ list_del = g_task_list;
+
+ if (list_del == NULL) {
+ return NOTIFICATION_ERROR_INVALID_PARAMETER;
+ }
+
+ while (list_del->prev != NULL) {
+ list_del = list_del->prev;
+ }
+
+ do {
+ if (list_del->task_cb == deferred_task_cb) {
+ list_prev = list_del->prev;
+ list_next = list_del->next;
+
+ if (list_prev == NULL) {
+ g_task_list = list_next;
+ } else {
+ list_prev->next = list_next;
+ }
+
+ if (list_next == NULL) {
+ if (list_prev != NULL) {
+ list_prev->next = NULL;
+ }
+ } else {
+ list_next->prev = list_prev;
+ }
+
+ free(list_del);
+
+ if (g_task_list == NULL) {
+ if (s_info.is_started_cb_set_task == 1) {
+ _unset_master_started_cb(_master_started_cb_task);
+ s_info.is_started_cb_set_task = 0;
+ }
+ }
+
+ return NOTIFICATION_ERROR_NONE;
+ }
+ list_del = list_del->next;
+ } while (list_del != NULL);
+
+ return NOTIFICATION_ERROR_INVALID_PARAMETER;
+}
+
+static void _do_deffered_task(void) {
+ task_list *list_do = NULL;
+ task_list *list_temp = NULL;
+
+ if (g_task_list == NULL) {
+ return;
+ }
+
+ list_do = g_task_list;
+ g_task_list = NULL;
+ if (s_info.is_started_cb_set_task == 1) {
+ _unset_master_started_cb(_master_started_cb_task);
+ s_info.is_started_cb_set_task = 0;
+ }
+
+ while (list_do->prev != NULL) {
+ list_do = list_do->prev;
+ }
+
+ while (list_do != NULL) {
+ if (list_do->task_cb != NULL) {
+ list_do->task_cb(list_do->data);
+ NOTIFICATION_DBG("called:%p", list_do->task_cb);
+ }
+ list_temp = list_do->next;
+ free(list_do);
+ list_do = list_temp;
+ }
+}
+
+static void _master_started_cb_service(keynode_t *node,
+ void *data) {
+ int ret = NOTIFICATION_ERROR_NONE;
+
+ if (notification_ipc_is_master_ready()) {
+ NOTIFICATION_ERR("try to register a notification service");
+ ret = notification_ipc_monitor_deregister();
+ if (ret != NOTIFICATION_ERROR_NONE) {
+ NOTIFICATION_ERR("failed to unregister a monitor");
+ }
+ ret = notification_ipc_monitor_register();
+ if (ret != NOTIFICATION_ERROR_NONE) {
+ NOTIFICATION_ERR("failed to register a monitor");
+ }
+ } else {
+ NOTIFICATION_ERR("try to unregister a notification service");
+ ret = notification_ipc_monitor_deregister();
+ if (ret != NOTIFICATION_ERROR_NONE) {
+ NOTIFICATION_ERR("failed to deregister a monitor");
+ }
+ }
+}
+
+static void _master_started_cb_task(keynode_t *node,
+ void *data) {
+
+ if (notification_ipc_is_master_ready()) {
+ _do_deffered_task();
+ }
+}
+
+/*!
+ * functions to create operation list
+ */
+notification_op *notification_ipc_create_op(notification_op_type_e type, int num_op, int *list_priv_id, int num_priv_id, notification_h *noti_list)
+{
+ int i = 0;
+ notification_op *op_list = NULL;
+
+ if (num_op <= 0) {
+ return NULL;
+ }
+
+ op_list = (notification_op *)malloc(sizeof(notification_op) * num_op);
+ memset(op_list, 0x0, sizeof(notification_op) * num_op);
+
+ for (i = 0; i < num_op; i++) {
+ (op_list + i)->type = type;
+ if (list_priv_id != NULL) {
+ (op_list + i)->priv_id = *(list_priv_id + i);
+ }
+ if (noti_list != NULL) {
+ (op_list + i)->noti = *(noti_list + i);
+ }
+ }
+
+ return op_list;
+}
+
+/*!
+ * utility functions creating notification packet
+ */
+static inline char *_dup_string(const char *string)
+{
+ char *ret;
+
+ if (string == NULL) {
+ return NULL;
+ }
+ if (string[0] == '\0') {
+ return NULL;
+ }
+
+ ret = strdup(string);
+ if (!ret)
+ NOTIFICATION_ERR("Error: %d\n", errno);
+
+ return ret;
+}
+
+static inline bundle *_create_bundle_from_string(unsigned char *string)
+{
+ if (string == NULL) {
+ return NULL;
+ }
+ if (string[0] == '\0') {
+ return NULL;
+ }
+
+ return bundle_decode(string, strlen((char *)string));
+}
+
+/*!
+ * functions creating notification packet
+ */
+EXPORT_API int notification_ipc_make_noti_from_packet(notification_h noti, const struct packet *packet)
+{
+ int ret = 0;
+ int type;
+ int layout;
+ int group_id;
+ int internal_group_id;
+ int priv_id;
+ char *caller_pkgname = NULL;
+ char *launch_pkgname = NULL;
+ unsigned char *args = NULL;
+ unsigned char *group_args = NULL;
+ unsigned char *b_execute_option = NULL;
+ unsigned char *b_service_responding = NULL;
+ unsigned char *b_service_single_launch = NULL;
+ unsigned char *b_service_multi_launch = NULL;
+ char *domain = NULL;
+ char *dir = NULL;
+ unsigned char *b_text = NULL;
+ unsigned char *b_key = NULL;
+ unsigned char *b_format_args = NULL;
+ int num_format_args;
+ unsigned char *b_image_path = NULL;
+ int sound_type;
+ char *sound_path = NULL;
+ int vibration_type;
+ char *vibration_path = NULL;
+ int led_operation;
+ int led_argb;
+ int led_on_ms;
+ int led_off_ms;
+ time_t time;
+ time_t insert_time;
+ int flags_for_property;
+ int display_applist;
+ double progress_size;
+ double progress_percentage;
+ char *app_icon_path = NULL;
+ char *app_name = NULL;
+ char *temp_title = NULL;
+ char *temp_content = NULL;
+ char *tag = NULL;
+
+ if (noti == NULL) {
+ NOTIFICATION_ERR("invalid data");
+ return NOTIFICATION_ERROR_INVALID_PARAMETER;
+ }
+
+ ret = packet_get(packet,
+ "iiiiisssssssssssssisisisiiiiiiiiddsssss",
+ &type,
+ &layout,
+ &group_id,
+ &internal_group_id,
+ &priv_id,
+ &caller_pkgname,
+ &launch_pkgname,
+ &args,
+ &group_args,
+ &b_execute_option,
+ &b_service_responding,
+ &b_service_single_launch,
+ &b_service_multi_launch,
+ &domain,
+ &dir,
+ &b_text,
+ &b_key,
+ &b_format_args,
+ &num_format_args,
+ &b_image_path,
+ &sound_type,
+ &sound_path,
+ &vibration_type,
+ &vibration_path,
+ &led_operation,
+ &led_argb,
+ &led_on_ms,
+ &led_off_ms,
+ &time,
+ &insert_time,
+ &flags_for_property,
+ &display_applist,
+ &progress_size,
+ &progress_percentage,
+ &app_icon_path,
+ &app_name,
+ &temp_title,
+ &temp_content,
+ &tag);
+
+ if (ret != 39) {
+ NOTIFICATION_ERR("failed to create a noti from packet");
+ return NOTIFICATION_ERROR_INVALID_PARAMETER;
+ }
+
+ /*!
+ * This is already allocated from the notification_create function.
+ * Before reallocate string to here.
+ * We have to release old one first.
+ */
+ free(noti->caller_pkgname);
+ noti->caller_pkgname = _dup_string(caller_pkgname);
+ noti->launch_pkgname = _dup_string(launch_pkgname);
+ noti->args = _create_bundle_from_string(args);
+ noti->group_args = _create_bundle_from_string(group_args);
+ noti->b_execute_option = _create_bundle_from_string(b_execute_option);
+ noti->b_service_responding = _create_bundle_from_string(b_service_responding);
+ noti->b_service_single_launch = _create_bundle_from_string(b_service_single_launch);
+ noti->b_service_multi_launch = _create_bundle_from_string(b_service_multi_launch);
+ noti->domain = _dup_string(domain);
+ noti->dir = _dup_string(dir);
+ noti->b_text = _create_bundle_from_string(b_text);
+ noti->b_key = _create_bundle_from_string(b_key);
+ noti->b_format_args = _create_bundle_from_string(b_format_args);
+ noti->b_image_path = _create_bundle_from_string(b_image_path);
+ noti->sound_path = _dup_string(sound_path);
+ noti->vibration_path = _dup_string(vibration_path);
+ noti->app_icon_path = _dup_string(app_icon_path);
+ noti->app_name = _dup_string(app_name);
+ noti->temp_title = _dup_string(temp_title);
+ noti->temp_content = _dup_string(temp_content);
+
+ noti->type = type;
+ noti->layout = layout;
+ noti->group_id = group_id;
+ noti->internal_group_id = internal_group_id;
+ noti->priv_id = priv_id;
+ noti->num_format_args = num_format_args;
+ noti->sound_type = sound_type;
+ noti->vibration_type = vibration_type;
+ noti->led_operation = led_operation;
+ noti->led_argb = led_argb;
+ noti->led_on_ms = led_on_ms;
+ noti->led_off_ms = led_off_ms;
+ noti->time = time;
+ noti->insert_time = insert_time;
+ noti->flags_for_property = flags_for_property;
+ noti->display_applist = display_applist;
+ noti->progress_size = progress_size;
+ noti->progress_percentage = progress_percentage;
+ noti->tag = _dup_string(tag);
+
+ return NOTIFICATION_ERROR_NONE;
+}
+
+EXPORT_API struct packet *notification_ipc_make_packet_from_noti(notification_h noti, const char *command, int packet_type)
+{
+ int b_encode_len = 0;
+ struct packet *result = NULL;
+ char *args = NULL;
+ char *group_args = NULL;
+ char *b_image_path = NULL;
+ char *b_execute_option = NULL;
+ char *b_service_responding = NULL;
+ char *b_service_single_launch = NULL;
+ char *b_service_multi_launch = NULL;
+ char *b_text = NULL;
+ char *b_key = NULL;
+ char *b_format_args = NULL;
+ struct packet *(*func_to_create_packet)(const char *command, const char *fmt, ...);
+ const char *title_key = NULL;
+ char buf_key[32] = { 0, };
+
+ /* Decode bundle to insert DB */
+ if (noti->args) {
+ bundle_encode(noti->args, (bundle_raw **) & args, NULL);
+ }
+ if (noti->group_args) {
+ bundle_encode(noti->group_args, (bundle_raw **) & group_args,
+ &b_encode_len);
+ }
+
+ if (noti->b_execute_option) {
+ bundle_encode(noti->b_execute_option,
+ (bundle_raw **) & b_execute_option, &b_encode_len);
+ }
+ if (noti->b_service_responding) {
+ bundle_encode(noti->b_service_responding,
+ (bundle_raw **) & b_service_responding, &b_encode_len);
+ }
+ if (noti->b_service_single_launch) {
+ bundle_encode(noti->b_service_single_launch,
+ (bundle_raw **) & b_service_single_launch, &b_encode_len);
+ }
+ if (noti->b_service_multi_launch) {
+ bundle_encode(noti->b_service_multi_launch,
+ (bundle_raw **) & b_service_multi_launch, &b_encode_len);
+ }
+
+ if (noti->b_text) {
+ bundle_encode(noti->b_text, (bundle_raw **) & b_text, &b_encode_len);
+ }
+ if (noti->b_key) {
+ bundle_encode(noti->b_key, (bundle_raw **) & b_key, &b_encode_len);
+ }
+ if (noti->b_format_args) {
+ bundle_encode(noti->b_format_args,
+ (bundle_raw **) & b_format_args, &b_encode_len);
+ }
+
+ if (noti->b_image_path) {
+ bundle_encode(noti->b_image_path,
+ (bundle_raw **) & b_image_path, &b_encode_len);
+ }
+
+ if (noti->b_key != NULL) {
+ snprintf(buf_key, sizeof(buf_key), "%d",
+ NOTIFICATION_TEXT_TYPE_TITLE);
+
+ title_key = bundle_get_val(noti->b_key, buf_key);
+ }
+
+ if (title_key == NULL && noti->b_text != NULL) {
+ snprintf(buf_key, sizeof(buf_key), "%d",
+ NOTIFICATION_TEXT_TYPE_TITLE);
+
+ title_key = bundle_get_val(noti->b_text, buf_key);
+ }
+
+ if (title_key == NULL) {
+ title_key = noti->caller_pkgname;
+ }
+
+ if (packet_type == 1)
+ func_to_create_packet = packet_create;
+ else if (packet_type == 2)
+ func_to_create_packet = packet_create_noack;
+ else {
+ goto out;
+ }
+
+ result = func_to_create_packet(command,
+ "iiiiisssssssssssssisisisiiiiiiiiddsssss",
+ noti->type,
+ noti->layout,
+ noti->group_id,
+ noti->internal_group_id,
+ noti->priv_id,
+ NOTIFICATION_CHECK_STR(noti->caller_pkgname),
+ NOTIFICATION_CHECK_STR(noti->launch_pkgname),
+ NOTIFICATION_CHECK_STR(args),
+ NOTIFICATION_CHECK_STR(group_args),
+ NOTIFICATION_CHECK_STR(b_execute_option),
+ NOTIFICATION_CHECK_STR(b_service_responding),
+ NOTIFICATION_CHECK_STR(b_service_single_launch),
+ NOTIFICATION_CHECK_STR(b_service_multi_launch),
+ NOTIFICATION_CHECK_STR(noti->domain),
+ NOTIFICATION_CHECK_STR(noti->dir),
+ NOTIFICATION_CHECK_STR(b_text),
+ NOTIFICATION_CHECK_STR(b_key),
+ NOTIFICATION_CHECK_STR(b_format_args),
+ noti->num_format_args,
+ NOTIFICATION_CHECK_STR(b_image_path),
+ noti->sound_type,
+ NOTIFICATION_CHECK_STR(noti->sound_path),
+ noti->vibration_type,
+ NOTIFICATION_CHECK_STR(noti->vibration_path),
+ noti->led_operation,
+ noti->led_argb,
+ noti->led_on_ms,
+ noti->led_off_ms,
+ noti->time,
+ noti->insert_time,
+ noti->flags_for_property,
+ noti->display_applist,
+ noti->progress_size,
+ noti->progress_percentage,
+ NOTIFICATION_CHECK_STR(noti->app_icon_path),
+ NOTIFICATION_CHECK_STR(noti->app_name),
+ NOTIFICATION_CHECK_STR(noti->temp_title),
+ NOTIFICATION_CHECK_STR(noti->temp_content),
+ NOTIFICATION_CHECK_STR(noti->tag));
+
+out:
+ /* Free decoded data */
+ if (args) {
+ free(args);
+ }
+ if (group_args) {
+ free(group_args);
+ }
+
+ if (b_execute_option) {
+ free(b_execute_option);
+ }
+ if (b_service_responding) {
+ free(b_service_responding);
+ }
+ if (b_service_single_launch) {
+ free(b_service_single_launch);
+ }
+ if (b_service_multi_launch) {
+ free(b_service_multi_launch);
+ }
+
+ if (b_text) {
+ free(b_text);
+ }
+ if (b_key) {
+ free(b_key);
+ }
+ if (b_format_args) {
+ free(b_format_args);
+ }
+
+ if (b_image_path) {
+ free(b_image_path);
+ }
+
+ return result;
+}
+
+EXPORT_API struct packet *notification_ipc_make_reply_packet_from_noti(notification_h noti, struct packet *packet)
+{
+ int b_encode_len = 0;
+ struct packet *result = NULL;
+ char *args = NULL;
+ char *group_args = NULL;
+ char *b_image_path = NULL;
+ char *b_execute_option = NULL;
+ char *b_service_responding = NULL;
+ char *b_service_single_launch = NULL;
+ char *b_service_multi_launch = NULL;
+ char *b_text = NULL;
+ char *b_key = NULL;
+ char *b_format_args = NULL;
+ const char *title_key = NULL;
+ char buf_key[32] = { 0, };
+
+ /* Decode bundle to insert DB */
+ if (noti->args) {
+ bundle_encode(noti->args, (bundle_raw **) & args, &b_encode_len);
+ }
+ if (noti->group_args) {
+ bundle_encode(noti->group_args, (bundle_raw **) & group_args,
+ &b_encode_len);
+ }
+
+ if (noti->b_execute_option) {
+ bundle_encode(noti->b_execute_option,
+ (bundle_raw **) & b_execute_option, &b_encode_len);
+ }
+ if (noti->b_service_responding) {
+ bundle_encode(noti->b_service_responding,
+ (bundle_raw **) & b_service_responding, &b_encode_len);
+ }
+ if (noti->b_service_single_launch) {
+ bundle_encode(noti->b_service_single_launch,
+ (bundle_raw **) & b_service_single_launch, &b_encode_len);
+ }
+ if (noti->b_service_multi_launch) {
+ bundle_encode(noti->b_service_multi_launch,
+ (bundle_raw **) & b_service_multi_launch, &b_encode_len);
+ }
+
+ if (noti->b_text) {
+ bundle_encode(noti->b_text, (bundle_raw **) & b_text, &b_encode_len);
+ }
+ if (noti->b_key) {
+ bundle_encode(noti->b_key, (bundle_raw **) & b_key, &b_encode_len);
+ }
+ if (noti->b_format_args) {
+ bundle_encode(noti->b_format_args,
+ (bundle_raw **) & b_format_args, &b_encode_len);
+ }
+
+ if (noti->b_image_path) {
+ bundle_encode(noti->b_image_path,
+ (bundle_raw **) & b_image_path, &b_encode_len);
+ }
+
+ if (noti->b_key != NULL) {
+ snprintf(buf_key, sizeof(buf_key), "%d",
+ NOTIFICATION_TEXT_TYPE_TITLE);
+
+ title_key = bundle_get_val(noti->b_key, buf_key);
+ }
+
+ if (title_key == NULL && noti->b_text != NULL) {
+ snprintf(buf_key, sizeof(buf_key), "%d",
+ NOTIFICATION_TEXT_TYPE_TITLE);
+
+ title_key = bundle_get_val(noti->b_text, buf_key);
+ }
+
+ if (title_key == NULL) {
+ title_key = noti->caller_pkgname;
+ }
+
+ result = packet_create_reply(packet,
+ "iiiiisssssssssssssisisisiiiiiiiiddsssss",
+ noti->type,
+ noti->layout,
+ noti->group_id,
+ noti->internal_group_id,
+ noti->priv_id,
+ NOTIFICATION_CHECK_STR(noti->caller_pkgname),
+ NOTIFICATION_CHECK_STR(noti->launch_pkgname),
+ NOTIFICATION_CHECK_STR(args),
+ NOTIFICATION_CHECK_STR(group_args),
+ NOTIFICATION_CHECK_STR(b_execute_option),
+ NOTIFICATION_CHECK_STR(b_service_responding),
+ NOTIFICATION_CHECK_STR(b_service_single_launch),
+ NOTIFICATION_CHECK_STR(b_service_multi_launch),
+ NOTIFICATION_CHECK_STR(noti->domain),
+ NOTIFICATION_CHECK_STR(noti->dir),
+ NOTIFICATION_CHECK_STR(b_text),
+ NOTIFICATION_CHECK_STR(b_key),
+ NOTIFICATION_CHECK_STR(b_format_args),
+ noti->num_format_args,
+ NOTIFICATION_CHECK_STR(b_image_path),
+ noti->sound_type,
+ NOTIFICATION_CHECK_STR(noti->sound_path),
+ noti->vibration_type,
+ NOTIFICATION_CHECK_STR(noti->vibration_path),
+ noti->led_operation,
+ noti->led_argb,
+ noti->led_on_ms,
+ noti->led_off_ms,
+ noti->time,
+ noti->insert_time,
+ noti->flags_for_property,
+ noti->display_applist,
+ noti->progress_size,
+ noti->progress_percentage,
+ NOTIFICATION_CHECK_STR(noti->app_icon_path),
+ NOTIFICATION_CHECK_STR(noti->app_name),
+ NOTIFICATION_CHECK_STR(noti->temp_title),
+ NOTIFICATION_CHECK_STR(noti->temp_content),
+ NOTIFICATION_CHECK_STR(noti->tag));
+
+ /* Free decoded data */
+ if (args) {
+ free(args);
+ }
+ if (group_args) {
+ free(group_args);
+ }
+
+ if (b_execute_option) {
+ free(b_execute_option);
+ }
+ if (b_service_responding) {
+ free(b_service_responding);
+ }
+ if (b_service_single_launch) {
+ free(b_service_single_launch);
+ }
+ if (b_service_multi_launch) {
+ free(b_service_multi_launch);
+ }
+
+ if (b_text) {
+ free(b_text);
+ }
+ if (b_key) {
+ free(b_key);
+ }
+ if (b_format_args) {
+ free(b_format_args);
+ }
+
+ if (b_image_path) {
+ free(b_image_path);
+ }
+
+ return result;
+}
+
+/*!
+ * functions to handler services
+ */
+static struct packet *_handler_insert(pid_t pid, int handle, const struct packet *packet)
+{
+ notification_h noti = NULL;
+
+ if (!packet) {
+ NOTIFICATION_ERR("a packet is null");
+ return NULL;
+ }
+ noti = notification_create(NOTIFICATION_TYPE_NOTI);
+ if (!noti) {
+ NOTIFICATION_ERR("failed to create a notification");
+ return NULL;
+ }
+ notification_ipc_make_noti_from_packet(noti, packet);
+
+ if (noti->flags_for_property
+ & NOTIFICATION_PROP_DISABLE_UPDATE_ON_INSERT) {
+ /* Disable changed cb */
+ } else {
+ /* Enable changed cb */
+ notification_op *noti_op = notification_ipc_create_op(NOTIFICATION_OP_INSERT, 1, &(noti->priv_id), 1, &noti);
+ if (noti_op != NULL) {
+ notification_call_changed_cb(noti_op, 1);
+ free(noti_op);
+ }
+ }
+ notification_free(noti);
+
+ return NULL;
+}
+
+static struct packet *_handler_update(pid_t pid, int handle, const struct packet *packet)
+{
+ notification_h noti = NULL;
+
+ if (!packet) {
+ NOTIFICATION_ERR("a packet is null");
+ return NULL;
+ }
+
+ noti = notification_create(NOTIFICATION_TYPE_NOTI);
+ if (!noti) {
+ NOTIFICATION_ERR("failed to create a notification");
+ return NULL;
+ }
+
+ notification_ipc_make_noti_from_packet(noti, packet);
+
+ notification_op *noti_op = notification_ipc_create_op(NOTIFICATION_OP_UPDATE, 1, &(noti->priv_id), 1, &noti);
+ if (noti_op != NULL) {
+ notification_call_changed_cb(noti_op, 1);
+ free(noti_op);
+ }
+
+ notification_free(noti);
+
+ return NULL;
+}
+
+static struct packet *_handler_refresh(pid_t pid, int handle, const struct packet *packet)
+{
+ if (!packet) {
+ NOTIFICATION_ERR("a packet is null");
+ return NULL;
+ }
+ notification_op *noti_op = notification_ipc_create_op(NOTIFICATION_OP_REFRESH, 1, NULL, 0, NULL);
+ if (noti_op != NULL) {
+ notification_call_changed_cb(noti_op, 1);
+ free(noti_op);
+ }
+
+ return NULL;
+}
+
+static struct packet *_handler_delete_single(pid_t pid, int handle, const struct packet *packet)
+{
+ int num_deleted = 0;
+ int priv_id = NOTIFICATION_PRIV_ID_NONE;
+
+ if (!packet) {
+ NOTIFICATION_ERR("a packet is null");
+ return NULL;
+ }
+ if (packet_get(packet, "ii", &num_deleted, &priv_id) == 2) {
+ notification_op *noti_op = notification_ipc_create_op(NOTIFICATION_OP_DELETE, 1, &priv_id, 1, NULL);
+ if (noti_op != NULL) {
+ notification_call_changed_cb(noti_op, 1);
+ free(noti_op);
+ }
+ }
+
+ return NULL;
+}
+
+static struct packet *_handler_delete_multiple(pid_t pid, int handle, const struct packet *packet)
+{
+ int ret = 0;
+ int buf[10] = {0,};
+ int num_deleted = 0;
+
+ NOTIFICATION_ERR("delete_noti_multiple");
+
+ if (!packet) {
+ NOTIFICATION_ERR("a packet is null");
+ return NULL;
+ }
+ ret = packet_get(packet, "iiiiiiiiiii", &num_deleted,
+ &(buf[0]),
+ &(buf[1]),
+ &(buf[2]),
+ &(buf[3]),
+ &(buf[4]),
+ &(buf[5]),
+ &(buf[6]),
+ &(buf[7]),
+ &(buf[8]),
+ &(buf[9]));
+
+ NOTIFICATION_ERR("packet data count:%d", ret);
+ NOTIFICATION_ERR("packet data num deleted:%d", num_deleted);
+
+ int i = 0;
+ for (i = 0 ; i < 10 ; i++) {
+ NOTIFICATION_ERR("packet data[%d]:%d",i, buf[i]);
+ }
+
+ if (ret == 11) {
+ notification_op *noti_op = notification_ipc_create_op(
+ NOTIFICATION_OP_DELETE, num_deleted, buf, num_deleted, NULL);
+ if (noti_op != NULL) {
+ notification_call_changed_cb(noti_op, num_deleted);
+ free(noti_op);
+ }
+ }
+
+ return NULL;
+}
+
+static int _handler_service_register(pid_t pid, int handle, const struct packet *packet, void *data)
+{
+ int ret;
+
+ if (!packet) {
+ NOTIFICATION_ERR("Packet is not valid\n");
+ ret = NOTIFICATION_ERROR_INVALID_PARAMETER;
+ } else if (packet_get(packet, "i", &ret) != 1) {
+ NOTIFICATION_ERR("Packet is not valid\n");
+ ret = NOTIFICATION_ERROR_INVALID_PARAMETER;
+ } else {
+ if (ret == 0) {
+ notification_op *noti_op = notification_ipc_create_op(NOTIFICATION_OP_SERVICE_READY, 1, NULL, 1, NULL);
+ if (noti_op != NULL) {
+ notification_call_changed_cb(noti_op, 1);
+ free(noti_op);
+ }
+ }
+ }
+ return ret;
+}
+
+/*!
+ * functions to initialize and register a monitor
+ */
+static int notification_ipc_monitor_register(void)
+{
+ int ret;
+ struct packet *packet;
+ static struct method service_table[] = {
+ {
+ .cmd = "add_noti",
+ .handler = _handler_insert,
+ },
+ {
+ .cmd = "update_noti",
+ .handler = _handler_update,
+ },
+ {
+ .cmd = "refresh_noti",
+ .handler = _handler_refresh,
+ },
+ {
+ .cmd = "del_noti_single",
+ .handler = _handler_delete_single,
+ },
+ {
+ .cmd = "del_noti_multiple",
+ .handler = _handler_delete_multiple,
+ },
+ {
+ .cmd = NULL,
+ .handler = NULL,
+ },
+ };
+
+ if (s_info.initialized == 1) {
+ return NOTIFICATION_ERROR_NONE;
+ } else {
+ s_info.initialized = 1;
+ }
+
+ NOTIFICATION_ERR("register a service\n");
+
+ com_core_packet_use_thread(1);
+ s_info.server_fd = com_core_packet_client_init(s_info.socket_file, 0, service_table);
+ if (s_info.server_fd < 0) {
+ NOTIFICATION_ERR("Failed to make a connection to the master\n");
+ return NOTIFICATION_ERROR_IO_ERROR;
+ }
+
+ packet = packet_create("service_register", "");
+ if (!packet) {
+ NOTIFICATION_ERR("Failed to build a packet\n");
+ com_core_packet_client_fini(s_info.server_fd);
+ return NOTIFICATION_ERROR_IO_ERROR;
+ }
+
+ ret = com_core_packet_async_send(s_info.server_fd, packet, 1.0, _handler_service_register, NULL);
+ NOTIFICATION_DBG("Service register sent: %d\n", ret);
+ packet_destroy(packet);
+ if (ret != 0) {
+ com_core_packet_client_fini(s_info.server_fd);
+ s_info.server_fd = NOTIFICATION_ERROR_INVALID_PARAMETER;
+ ret = NOTIFICATION_ERROR_IO_ERROR;
+ } else {
+ ret = NOTIFICATION_ERROR_NONE;
+ }
+
+ NOTIFICATION_DBG("Server FD: %d\n", s_info.server_fd);
+ return ret;
+}
+
+int notification_ipc_monitor_deregister(void)
+{
+ if (s_info.initialized == 0) {
+ return NOTIFICATION_ERROR_NONE;
+ }
+
+ com_core_packet_client_fini(s_info.server_fd);
+ s_info.server_fd = NOTIFICATION_ERROR_INVALID_PARAMETER;
+
+ s_info.initialized = 0;
+
+ return NOTIFICATION_ERROR_NONE;
+}
+
+int notification_ipc_monitor_init(void)
+{
+ int ret = NOTIFICATION_ERROR_NONE;
+
+ if (notification_ipc_is_master_ready()) {
+ ret = notification_ipc_monitor_register();
+ }
+
+ if (s_info.is_started_cb_set_svc == 0) {
+ _set_master_started_cb(_master_started_cb_service);
+ s_info.is_started_cb_set_svc = 1;
+ }
+
+ return ret;
+}
+
+int notification_ipc_monitor_fini(void)
+{
+ int ret = NOTIFICATION_ERROR_NONE;
+
+ if (s_info.is_started_cb_set_svc == 1) {
+ _unset_master_started_cb(_master_started_cb_service);
+ s_info.is_started_cb_set_svc = 0;
+ }
+
+ ret = notification_ipc_monitor_deregister();
+
+ return ret;
+}
+
+/*!
+ * functions to request the service
+ */
+int notification_ipc_request_insert(notification_h noti, int *priv_id)
+{
+ int status = 0;
+ int id = NOTIFICATION_PRIV_ID_NONE;
+ struct packet *packet;
+ struct packet *result;
+
+ /* Initialize private ID */
+ noti->priv_id = NOTIFICATION_PRIV_ID_NONE;
+ noti->group_id = NOTIFICATION_GROUP_ID_NONE;
+ noti->internal_group_id = NOTIFICATION_GROUP_ID_NONE;
+
+ packet = notification_ipc_make_packet_from_noti(noti, "add_noti", 1);
+ result = com_core_packet_oneshot_send(NOTIFICATION_ADDR,
+ packet,
+ NOTIFICATION_IPC_TIMEOUT);
+ packet_destroy(packet);
+
+ if (result != NULL) {
+ if (packet_get(result, "ii", &status, &id) != 2) {
+ NOTIFICATION_ERR("Failed to get a result packet");
+ packet_unref(result);
+ return NOTIFICATION_ERROR_IO_ERROR;
+ }
+
+ if (status != NOTIFICATION_ERROR_NONE) {
+ packet_unref(result);
+ return status;
+ }
+ packet_unref(result);
+ } else {
+ NOTIFICATION_ERR("failed to receive answer(insert)");
+ if (notification_ipc_is_master_ready() == 1) {
+ return NOTIFICATION_ERROR_PERMISSION_DENIED;
+ }
+ else {
+ return NOTIFICATION_ERROR_SERVICE_NOT_READY;
+ }
+ }
+
+ if (priv_id != NULL) {
+ *priv_id = id;
+ }
+
+ return NOTIFICATION_ERROR_NONE;
+}
+
+int notification_ipc_request_delete_single(notification_type_e type, char *pkgname, int priv_id)
+{
+ int status = 0;
+ int id = NOTIFICATION_PRIV_ID_NONE;
+ struct packet *packet;
+ struct packet *result;
+
+ packet = packet_create("del_noti_single", "si", pkgname, priv_id);
+ result = com_core_packet_oneshot_send(NOTIFICATION_ADDR,
+ packet,
+ NOTIFICATION_IPC_TIMEOUT);
+ packet_destroy(packet);
+
+ if (result != NULL) {
+ if (packet_get(result, "ii", &status, &id) != 2) {
+ NOTIFICATION_ERR("Failed to get a result packet");
+ packet_unref(result);
+ return NOTIFICATION_ERROR_IO_ERROR;
+ }
+ packet_unref(result);
+ } else {
+ NOTIFICATION_ERR("failed to receive answer(delete)");
+ if (notification_ipc_is_master_ready() == 1) {
+ return NOTIFICATION_ERROR_PERMISSION_DENIED;
+ }
+ else {
+ return NOTIFICATION_ERROR_SERVICE_NOT_READY;
+ }
+ }
+
+ return status;
+}
+
+int notification_ipc_request_delete_multiple(notification_type_e type, char *pkgname)
+{
+ int status = 0;
+ int num_deleted = 0;
+ struct packet *packet;
+ struct packet *result;
+
+ packet = packet_create("del_noti_multiple", "si", pkgname, type);
+ result = com_core_packet_oneshot_send(NOTIFICATION_ADDR,
+ packet,
+ NOTIFICATION_IPC_TIMEOUT);
+ packet_destroy(packet);
+
+ if (result != NULL) {
+ if (packet_get(result, "ii", &status, &num_deleted) != 2) {
+ NOTIFICATION_ERR("Failed to get a result packet");
+ packet_unref(result);
+ return NOTIFICATION_ERROR_IO_ERROR;
+ }
+ NOTIFICATION_ERR("num deleted:%d", num_deleted);
+ packet_unref(result);
+ } else {
+ NOTIFICATION_ERR("failed to receive answer(delete multiple)");
+ if (notification_ipc_is_master_ready() == 1) {
+ return NOTIFICATION_ERROR_PERMISSION_DENIED;
+ }
+ else {
+ return NOTIFICATION_ERROR_SERVICE_NOT_READY;
+ }
+ }
+
+ return status;
+}
+
+int notification_ipc_request_update(notification_h noti)
+{
+ int status = 0;
+ int id = NOTIFICATION_PRIV_ID_NONE;
+ struct packet *packet;
+ struct packet *result;
+
+ packet = notification_ipc_make_packet_from_noti(noti, "update_noti", 1);
+ result = com_core_packet_oneshot_send(NOTIFICATION_ADDR,
+ packet,
+ NOTIFICATION_IPC_TIMEOUT);
+ packet_destroy(packet);
+
+ if (result != NULL) {
+ if (packet_get(result, "ii", &status, &id) != 2) {
+ NOTIFICATION_ERR("Failed to get a result packet");
+ packet_unref(result);
+ return NOTIFICATION_ERROR_IO_ERROR;
+ }
+ packet_unref(result);
+ } else {
+ NOTIFICATION_ERR("failed to receive answer(update)");
+ if (notification_ipc_is_master_ready() == 1) {
+ return NOTIFICATION_ERROR_PERMISSION_DENIED;
+ }
+ else {
+ return NOTIFICATION_ERROR_SERVICE_NOT_READY;
+ }
+ }
+
+ return status;
+}
+
+static int _notification_ipc_update_cb(pid_t pid, int handle, const struct packet *packet, void *data)
+{
+ int status = 0;
+ int id = NOTIFICATION_PRIV_ID_NONE;
+ result_cb_item *cb_item = (result_cb_item *)data;
+
+ if (cb_item == NULL) {
+ NOTIFICATION_ERR("Failed to get a callback item");
+ return NOTIFICATION_ERROR_INVALID_PARAMETER;
+ }
+ s_info.server_cl_fd_ref_cnt = (s_info.server_cl_fd_ref_cnt <= 1) ? 0 : s_info.server_cl_fd_ref_cnt - 1;
+ if (s_info.server_cl_fd_ref_cnt <= 0) {
+ NOTIFICATION_DBG("REFCNT: %d (fd: %d)", s_info.server_cl_fd_ref_cnt, s_info.server_cl_fd);
+ int fd_temp = s_info.server_cl_fd;
+ s_info.server_cl_fd = -1;
+ com_core_packet_client_fini(fd_temp);
+ NOTIFICATION_DBG("FD(%d) finalized", fd_temp);
+ }
+
+ if (packet != NULL) {
+ if (packet_get(packet, "ii", &status, &id) != 2) {
+ NOTIFICATION_ERR("Failed to get a result packet");
+ status = NOTIFICATION_ERROR_IO_ERROR;
+ }
+ }
+
+ if (cb_item->result_cb != NULL) {
+ cb_item->result_cb(id, status, cb_item->data);
+ }
+ free(cb_item);
+
+ return status;
+}
+
+int notification_ipc_request_update_async(notification_h noti,
+ void (*result_cb)(int priv_id, int result, void *data), void *user_data)
+{
+ int ret = NOTIFICATION_ERROR_NONE;
+ int ret_con = 0;
+ struct packet *packet = NULL;
+ result_cb_item *cb_item = NULL;
+
+ packet = notification_ipc_make_packet_from_noti(noti, "update_noti", 1);
+ if (packet == NULL) {
+ ret = NOTIFICATION_ERROR_INVALID_PARAMETER;
+ goto fail;
+ }
+
+ cb_item = calloc(1, sizeof(result_cb_item));
+ if (cb_item == NULL) {
+ ret = NOTIFICATION_ERROR_OUT_OF_MEMORY;
+ goto fail;
+ }
+
+ if (s_info.server_cl_fd < 0) {
+ com_core_packet_use_thread(1);
+ s_info.server_cl_fd = com_core_packet_client_init(s_info.socket_file, 0, NULL);
+ if (s_info.server_cl_fd < 0) {
+ NOTIFICATION_DBG("Failed to init client: %d", s_info.server_cl_fd);
+ if (notification_ipc_is_master_ready() == 1) {
+ ret = NOTIFICATION_ERROR_PERMISSION_DENIED;
+ }
+ else {
+ ret = NOTIFICATION_ERROR_SERVICE_NOT_READY;
+ }
+ goto fail;
+ }
+ s_info.server_cl_fd_ref_cnt = 1;
+ } else {
+ s_info.server_cl_fd_ref_cnt++;
+ }
+
+ cb_item->result_cb = result_cb;
+ cb_item->data = user_data;
+
+ NOTIFICATION_INFO("Connection count:%d, fd:%d", s_info.server_cl_fd_ref_cnt, s_info.server_cl_fd);
+
+ ret_con = com_core_packet_async_send(s_info.server_cl_fd, packet, 0.0f,
+ _notification_ipc_update_cb, cb_item);
+ if (ret_con < 0) {
+ NOTIFICATION_ERR("Failed to request update, %d\n", ret_con);
+ s_info.server_cl_fd_ref_cnt = (s_info.server_cl_fd_ref_cnt <= 1) ? 0 : s_info.server_cl_fd_ref_cnt - 1;
+ if (s_info.server_cl_fd_ref_cnt <= 0) {
+ int fd_temp = s_info.server_cl_fd;
+ s_info.server_cl_fd = -1;
+ com_core_packet_client_fini(fd_temp);
+ NOTIFICATION_INFO("FD(%d) finalized", fd_temp);
+ }
+ ret = NOTIFICATION_ERROR_IO_ERROR;
+ goto fail;
+ } else {
+ ret = NOTIFICATION_ERROR_NONE;
+ goto success;
+ }
+
+fail:
+ if (cb_item) free(cb_item);
+ NOTIFICATION_ERR("Err: %d\n", ret);
+
+success:
+ if (packet) packet_destroy(packet);
+
+ return ret;
+}
+
+int notification_ipc_request_refresh(void)
+{
+ int status = 0;
+ struct packet *packet;
+ struct packet *result;
+
+ packet = packet_create("refresh_noti", "i", NOTIFICATION_OP_REFRESH);
+ result = com_core_packet_oneshot_send(NOTIFICATION_ADDR,
+ packet,
+ NOTIFICATION_IPC_TIMEOUT);
+ packet_destroy(packet);
+
+ if (result != NULL) {
+ if (packet_get(result, "i", &status) != 1) {
+ NOTIFICATION_ERR("Failed to get a result packet");
+ packet_unref(result);
+ return NOTIFICATION_ERROR_IO_ERROR;
+ }
+ packet_unref(result);
+ } else {
+ NOTIFICATION_ERR("failed to receive answer(refresh)");
+ if (notification_ipc_is_master_ready() == 1) {
+ return NOTIFICATION_ERROR_PERMISSION_DENIED;
+ }
+ else {
+ return NOTIFICATION_ERROR_SERVICE_NOT_READY;
+ }
+ }
+
+ return status;
+}
+
+int notification_ipc_noti_setting_property_set(const char *pkgname, const char *property, const char *value)
+{
+ int status = 0;
+ int ret = 0;
+ struct packet *packet;
+ struct packet *result;
+
+ packet = packet_create("set_noti_property", "sss", pkgname, property, value);
+ result = com_core_packet_oneshot_send(NOTIFICATION_ADDR,
+ packet,
+ NOTIFICATION_IPC_TIMEOUT);
+ packet_destroy(packet);
+
+ if (result != NULL) {
+ if (packet_get(result, "ii", &status, &ret) != 2) {
+ NOTIFICATION_ERR("Failed to get a result packet");
+ packet_unref(result);
+ return NOTIFICATION_ERROR_IO_ERROR;
+ }
+ packet_unref(result);
+ } else {
+ NOTIFICATION_ERR("failed to receive answer(delete)");
+ if (notification_ipc_is_master_ready() == 1) {
+ return NOTIFICATION_ERROR_PERMISSION_DENIED;
+ }
+ else {
+ return NOTIFICATION_ERROR_SERVICE_NOT_READY;
+ }
+ }
+
+ return status;
+}
+
+int notification_ipc_noti_setting_property_get(const char *pkgname, const char *property, char **value)
+{
+ int status = 0;
+ char *ret = NULL;
+ struct packet *packet;
+ struct packet *result;
+
+ packet = packet_create("get_noti_property", "ss", pkgname, property);
+ result = com_core_packet_oneshot_send(NOTIFICATION_ADDR,
+ packet,
+ NOTIFICATION_IPC_TIMEOUT);
+ packet_destroy(packet);
+
+ if (result != NULL) {
+ if (packet_get(result, "is", &status, &ret) != 2) {
+ NOTIFICATION_ERR("Failed to get a result packet");
+ packet_unref(result);
+ return NOTIFICATION_ERROR_IO_ERROR;
+ }
+ if (status == NOTIFICATION_ERROR_NONE && ret != NULL) {
+ *value = strdup(ret);
+ }
+ packet_unref(result);
+ } else {
+ NOTIFICATION_ERR("failed to receive answer(delete)");
+ if (notification_ipc_is_master_ready() == 1) {
+ return NOTIFICATION_ERROR_PERMISSION_DENIED;
+ }
+ else {
+ return NOTIFICATION_ERROR_SERVICE_NOT_READY;
+ }
+ }
+
+ return status;
+}
+
+int notification_ipc_request_load_noti_by_tag(notification_h noti, const char *pkgname, const char *tag)
+{
+ struct packet *packet;
+ struct packet *result;
+
+ packet = packet_create("load_noti_by_tag", "ss", pkgname, tag);
+ result = com_core_packet_oneshot_send(NOTIFICATION_ADDR,
+ packet,
+ NOTIFICATION_IPC_TIMEOUT);
+ packet_destroy(packet);
+
+ if (result != NULL) {
+ if (notification_ipc_make_noti_from_packet(noti, result) != NOTIFICATION_ERROR_NONE) {
+ NOTIFICATION_ERR("Failed to get a result packet");
+ packet_unref(result);
+ return NOTIFICATION_ERROR_IO_ERROR;
+ }
+
+ packet_unref(result);
+ } else {
+ NOTIFICATION_ERR("failed to receive answer(load noti by tag)");
+ if (notification_ipc_is_master_ready() == 1) {
+ return NOTIFICATION_ERROR_PERMISSION_DENIED;
+ }
+ else {
+ return NOTIFICATION_ERROR_SERVICE_NOT_READY;
+ }
+ }
+
+ return NOTIFICATION_ERROR_NONE;
+}
+
diff --git a/src/notification_list.c b/src/notification_list.c
new file mode 100644
index 0000000..97d205a
--- /dev/null
+++ b/src/notification_list.c
@@ -0,0 +1,227 @@
+/*
+ * libnotification
+ *
+ * Copyright (c) 2000 - 2011 Samsung Electronics Co., Ltd. All rights reserved.
+ *
+ * Contact: Seungtaek Chung <seungtaek.chung@samsung.com>, Mi-Ju Lee <miju52.lee@samsung.com>, Xi Zhichan <zhichan.xi@samsung.com>
+ *
+ * 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 <tizen.h>
+
+#include <notification.h>
+#include <notification_list.h>
+#include <notification_debug.h>
+#include <notification_private.h>
+
+struct _notification_list {
+ notification_list_h prev;
+ notification_list_h next;
+
+ notification_h noti;
+};
+
+notification_list_h _notification_list_create(void)
+{
+ notification_list_h list = NULL;
+
+ list = (notification_list_h) malloc(sizeof(struct _notification_list));
+ if (list == NULL) {
+ NOTIFICATION_ERR("NO MEMORY");
+ return NULL;
+ }
+
+ list->prev = NULL;
+ list->next = NULL;
+
+ list->noti = NULL;
+
+ return list;
+}
+
+EXPORT_API notification_list_h notification_list_get_head(notification_list_h list)
+{
+ notification_list_h cur_list = NULL;
+
+ if (list == NULL) {
+ NOTIFICATION_ERR("INVALID DATA : list == NULL");
+ set_last_result(NOTIFICATION_ERROR_INVALID_PARAMETER);
+ return NULL;
+ }
+
+ cur_list = list;
+
+ while (cur_list->prev != NULL) {
+ cur_list = cur_list->prev;
+ }
+
+ set_last_result(NOTIFICATION_ERROR_NONE);
+ return cur_list;
+}
+
+EXPORT_API notification_list_h notification_list_get_tail(notification_list_h list)
+{
+ notification_list_h cur_list = NULL;
+
+ if (list == NULL) {
+ NOTIFICATION_ERR("INVALID DATA : list == NULL");
+ set_last_result(NOTIFICATION_ERROR_INVALID_PARAMETER);
+ return NULL;
+ }
+
+ cur_list = list;
+
+ while (cur_list->next != NULL) {
+ cur_list = cur_list->next;
+ }
+
+ set_last_result(NOTIFICATION_ERROR_NONE);
+ return cur_list;
+}
+
+EXPORT_API notification_list_h notification_list_get_prev(notification_list_h list)
+{
+ notification_list_h cur_list = NULL;
+
+ if (list == NULL) {
+ NOTIFICATION_ERR("INVALID DATA : list == NULL");
+ set_last_result(NOTIFICATION_ERROR_INVALID_PARAMETER);
+ return NULL;
+ }
+
+ cur_list = list;
+
+ set_last_result(NOTIFICATION_ERROR_NONE);
+ return cur_list->prev;
+}
+
+EXPORT_API notification_list_h notification_list_get_next(notification_list_h list)
+{
+ notification_list_h cur_list = NULL;
+
+ if (list == NULL) {
+ NOTIFICATION_ERR("INVALID DATA : list == NULL");
+ set_last_result(NOTIFICATION_ERROR_INVALID_PARAMETER);
+ return NULL;
+ }
+
+ cur_list = list;
+
+ set_last_result(NOTIFICATION_ERROR_NONE);
+ return cur_list->next;
+}
+
+EXPORT_API notification_h notification_list_get_data(notification_list_h list)
+{
+ notification_list_h cur_list = NULL;
+
+ if (list == NULL) {
+ NOTIFICATION_ERR("INVALID DATA : list == NULL");
+ set_last_result(NOTIFICATION_ERROR_INVALID_PARAMETER);
+ return NULL;
+ }
+
+ cur_list = list;
+
+ set_last_result(NOTIFICATION_ERROR_NONE);
+ return cur_list->noti;
+}
+
+EXPORT_API notification_list_h notification_list_append(notification_list_h list,
+ notification_h noti)
+{
+ notification_list_h new_list = NULL;
+ notification_list_h cur_list = NULL;
+
+ if (noti == NULL) {
+ NOTIFICATION_ERR("INVALID DATA : data == NULL");
+ set_last_result(NOTIFICATION_ERROR_INVALID_PARAMETER);
+ return NULL;
+ }
+
+ if (list != NULL) {
+ cur_list = notification_list_get_tail(list);
+
+ new_list = _notification_list_create();
+ if (new_list == NULL) {
+ NOTIFICATION_ERR("NO MEMORY");
+ set_last_result(NOTIFICATION_ERROR_OUT_OF_MEMORY);
+ return NULL;
+ }
+
+ cur_list->next = new_list;
+ new_list->prev = cur_list;
+
+ new_list->noti = noti;
+ } else {
+ cur_list = _notification_list_create();
+ if (cur_list == NULL) {
+ NOTIFICATION_ERR("NO MEMORY");
+ set_last_result(NOTIFICATION_ERROR_OUT_OF_MEMORY);
+ return NULL;
+ }
+
+ new_list = cur_list;
+ new_list->noti = noti;
+ }
+
+ set_last_result(NOTIFICATION_ERROR_NONE);
+ return new_list;
+}
+
+EXPORT_API notification_list_h notification_list_remove(notification_list_h list,
+ notification_h noti)
+{
+ notification_list_h cur_list = NULL;
+ notification_list_h prev_list = NULL;
+ notification_list_h next_list = NULL;
+
+ cur_list = notification_list_get_head(list);
+ while (cur_list != NULL) {
+ if (cur_list->noti == noti) {
+ //remove
+ prev_list = cur_list->prev;
+ next_list = cur_list->next;
+
+ if (next_list != NULL) {
+ if (prev_list != NULL) {
+ prev_list->next = next_list;
+ next_list->prev = prev_list;
+ } else {
+ next_list->prev = NULL;
+ }
+ } else {
+ if (prev_list != NULL) {
+ prev_list->next = NULL;
+ }
+ }
+
+ free(cur_list);
+ break;
+ }
+
+ cur_list = cur_list->next;
+ }
+
+ if (prev_list != NULL) {
+ return notification_list_get_head(prev_list);
+ } else if (next_list != NULL) {
+ return next_list;
+ }
+
+ return NULL;
+}
diff --git a/src/notification_noti.c b/src/notification_noti.c
new file mode 100644
index 0000000..84df045
--- /dev/null
+++ b/src/notification_noti.c
@@ -0,0 +1,1939 @@
+/*
+ * libnotification
+ *
+ * Copyright (c) 2000 - 2011 Samsung Electronics Co., Ltd. All rights reserved.
+ *
+ * Contact: Seungtaek Chung <seungtaek.chung@samsung.com>, Mi-Ju Lee <miju52.lee@samsung.com>, Xi Zhichan <zhichan.xi@samsung.com>
+ *
+ * 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 <string.h>
+#include <stdlib.h>
+
+#include <vconf.h>
+#include <Ecore.h>
+#include <Elementary.h>
+#include <Eina.h>
+
+#include <notification.h>
+#include <notification_db.h>
+#include <notification_noti.h>
+#include <notification_debug.h>
+#include <notification_private.h>
+
+#define NOTI_BURST_DELETE_UNIT 10
+static Eina_List *toast_list;
+static Eina_List *toast_popup;
+
+static void __free_and_set(void **target_ptr, void *new_ptr) {
+ if (target_ptr != NULL) {
+ if (*target_ptr != NULL) {
+ free(*target_ptr);
+ }
+ *target_ptr = new_ptr;
+ }
+}
+
+static int _notification_noti_bind_query_text(sqlite3_stmt * stmt, const char *name,
+ const char *str)
+{
+ int ret = 0;
+ int index = 0;
+
+ index = sqlite3_bind_parameter_index(stmt, name);
+ if (index == 0) {
+ NOTIFICATION_ERR("Insert : invalid column name");
+ return NOTIFICATION_ERROR_FROM_DB;
+ }
+
+ ret =
+ sqlite3_bind_text(stmt, index, NOTIFICATION_CHECK_STR(str), -1,
+ SQLITE_STATIC);
+ if (ret != SQLITE_OK) {
+ NOTIFICATION_ERR("Insert text : %s",
+ NOTIFICATION_CHECK_STR(str));
+ return NOTIFICATION_ERROR_FROM_DB;
+ }
+
+ return NOTIFICATION_ERROR_NONE;
+}
+
+static int _notification_noti_bind_query_double(sqlite3_stmt * stmt, const char *name,
+ double val)
+{
+ int ret = 0;
+ int index = 0;
+
+ index = sqlite3_bind_parameter_index(stmt, name);
+ if (index == 0) {
+ NOTIFICATION_ERR("Insert : invalid column name");
+ return NOTIFICATION_ERROR_FROM_DB;
+ }
+
+ ret = sqlite3_bind_double(stmt, index, val);
+ if (ret != SQLITE_OK) {
+ NOTIFICATION_ERR("Insert double : %f", val);
+ return NOTIFICATION_ERROR_FROM_DB;
+ }
+
+ return NOTIFICATION_ERROR_NONE;
+}
+
+static int _notification_noti_check_priv_id(notification_h noti, sqlite3 * db)
+{
+ int result = 0;
+ int ret = NOTIFICATION_ERROR_NONE;
+ char *query = NULL;
+ sqlite3_stmt *stmt = NULL;
+
+ /* Make query to check priv_id exist */
+ query = sqlite3_mprintf("SELECT count(*) FROM noti_list WHERE caller_pkgname = '%s' AND priv_id = %d",
+ noti->caller_pkgname, noti->priv_id);
+ if (query == NULL) {
+ ret = NOTIFICATION_ERROR_OUT_OF_MEMORY;
+ goto err;
+ }
+
+ ret = sqlite3_prepare(db, query, strlen(query), &stmt, NULL);
+ if (ret != SQLITE_OK) {
+ NOTIFICATION_ERR("Get count DB err(%d) : %s", ret,
+ sqlite3_errmsg(db));
+ ret = NOTIFICATION_ERROR_FROM_DB;
+ goto err;
+ }
+
+ ret = sqlite3_step(stmt);
+ if (ret == SQLITE_ROW) {
+ result = sqlite3_column_int(stmt, 0);
+ } else {
+ result = 0;
+ }
+
+ sqlite3_finalize(stmt);
+
+ /* If result > 0, there is priv_id in DB */
+ if (result > 0) {
+ ret = NOTIFICATION_ERROR_ALREADY_EXIST_ID;
+ }
+
+err:
+ if (query) {
+ sqlite3_free(query);
+ }
+
+ return ret;
+}
+
+static int _notification_noti_get_internal_group_id_by_priv_id(const char *pkgname,
+ int priv_id,
+ sqlite3 * db)
+{
+ char *query = NULL;
+ sqlite3_stmt *stmt = NULL;
+ int ret = NOTIFICATION_ERROR_NONE, result = 0;
+
+ query = sqlite3_mprintf("SELECT internal_group_id FROM noti_list WHERE caller_pkgname = '%s' AND priv_id = %d",
+ pkgname, priv_id);
+ if (query == NULL) {
+ ret = NOTIFICATION_ERROR_OUT_OF_MEMORY;
+ goto err;
+ }
+
+ ret = sqlite3_prepare(db, query, strlen(query), &stmt, NULL);
+ if (ret != SQLITE_OK) {
+ NOTIFICATION_ERR("Get count DB err(%d) : %s", ret,
+ sqlite3_errmsg(db));
+ ret = NOTIFICATION_ERROR_FROM_DB;
+ goto err;
+ }
+
+ ret = sqlite3_step(stmt);
+ if (ret == SQLITE_ROW) {
+ result = sqlite3_column_int(stmt, 0);
+ } else {
+ result = 0;
+ }
+
+err:
+ if (stmt) {
+ sqlite3_finalize(stmt);
+ }
+
+ if (query) {
+ sqlite3_free(query);
+ }
+
+ if (ret != NOTIFICATION_ERROR_NONE) {
+ NOTIFICATION_ERR("failed to internal group ID:%d", ret);
+ }
+
+ return result;
+}
+
+static int _insertion_query_create(notification_h noti, char **query)
+{
+ int b_encode_len = 0;
+ char *args = NULL;
+ char *group_args = NULL;
+ char *b_image_path = NULL;
+ char *b_execute_option = NULL;
+ char *b_service_responding = NULL;
+ char *b_service_single_launch = NULL;
+ char *b_service_multi_launch = NULL;
+ char *b_text = NULL;
+ char *b_key = NULL;
+ char *b_format_args = NULL;
+ int flag_simmode = 0;
+
+ if (query == NULL) {
+ return NOTIFICATION_ERROR_INVALID_PARAMETER;
+ }
+
+ /* Decode bundle to insert DB */
+ if (noti->args) {
+ bundle_encode(noti->args, (bundle_raw **) & args, &b_encode_len);
+ }
+ if (noti->group_args) {
+ bundle_encode(noti->group_args, (bundle_raw **) & group_args,
+ &b_encode_len);
+ }
+
+ if (noti->b_execute_option) {
+ bundle_encode(noti->b_execute_option,
+ (bundle_raw **) & b_execute_option, &b_encode_len);
+ }
+ if (noti->b_service_responding) {
+ bundle_encode(noti->b_service_responding,
+ (bundle_raw **) & b_service_responding, &b_encode_len);
+ }
+ if (noti->b_service_single_launch) {
+ bundle_encode(noti->b_service_single_launch,
+ (bundle_raw **) & b_service_single_launch, &b_encode_len);
+ }
+ if (noti->b_service_multi_launch) {
+ bundle_encode(noti->b_service_multi_launch,
+ (bundle_raw **) & b_service_multi_launch, &b_encode_len);
+ }
+
+ if (noti->b_text) {
+ bundle_encode(noti->b_text, (bundle_raw **) & b_text, &b_encode_len);
+ }
+ if (noti->b_key) {
+ bundle_encode(noti->b_key, (bundle_raw **) & b_key, &b_encode_len);
+ }
+ if (noti->b_format_args) {
+ bundle_encode(noti->b_format_args,
+ (bundle_raw **) & b_format_args, &b_encode_len);
+ }
+
+ if (noti->b_image_path) {
+ bundle_encode(noti->b_image_path,
+ (bundle_raw **) & b_image_path, &b_encode_len);
+ }
+
+ /* Check only simmode property is enable */
+ if (noti->flags_for_property & NOTIFICATION_PROP_DISPLAY_ONLY_SIMMODE) {
+ flag_simmode = 1;
+ }
+
+ /* Make query */
+ *query = sqlite3_mprintf("INSERT INTO noti_list ("
+ "type, "
+ "layout, "
+ "caller_pkgname, launch_pkgname, "
+ "image_path, "
+ "group_id, internal_group_id, priv_id, "
+ "title_key, "
+ "b_text, b_key, tag, b_format_args, num_format_args, "
+ "text_domain, text_dir, "
+ "time, insert_time, "
+ "args, group_args, "
+ "b_execute_option, "
+ "b_service_responding, b_service_single_launch, b_service_multi_launch, "
+ "sound_type, sound_path, vibration_type, vibration_path, led_operation, led_argb, led_on_ms, led_off_ms, "
+ "flags_for_property, flag_simmode, display_applist, "
+ "progress_size, progress_percentage) values ("
+ "%d, "
+ "%d, "
+ "'%s', '%s', "
+ "'%s', "
+ "%d, %d, %d, "
+ "$title_key, "
+ "'%s', '%s', $tag, '%s', %d, "
+ "'%s', '%s', "
+ "%d, %d, "
+ "'%s', '%s', "
+ "'%s', "
+ "'%s', '%s', '%s', "
+ "%d, '%s', %d, '%s', %d, %d, %d, %d,"
+ "%d, %d, %d, "
+ "$progress_size, $progress_percentage)",
+ noti->type,
+ noti->layout,
+ NOTIFICATION_CHECK_STR(noti->caller_pkgname),
+ NOTIFICATION_CHECK_STR(noti->launch_pkgname),
+ NOTIFICATION_CHECK_STR(b_image_path), noti->group_id,
+ noti->internal_group_id, noti->priv_id,
+ NOTIFICATION_CHECK_STR(b_text), NOTIFICATION_CHECK_STR(b_key),
+ NOTIFICATION_CHECK_STR(b_format_args), noti->num_format_args,
+ NOTIFICATION_CHECK_STR(noti->domain),
+ NOTIFICATION_CHECK_STR(noti->dir), (int)noti->time,
+ (int)noti->insert_time, NOTIFICATION_CHECK_STR(args),
+ NOTIFICATION_CHECK_STR(group_args),
+ NOTIFICATION_CHECK_STR(b_execute_option),
+ NOTIFICATION_CHECK_STR(b_service_responding),
+ NOTIFICATION_CHECK_STR(b_service_single_launch),
+ NOTIFICATION_CHECK_STR(b_service_multi_launch),
+ noti->sound_type, NOTIFICATION_CHECK_STR(noti->sound_path),
+ noti->vibration_type,
+ NOTIFICATION_CHECK_STR(noti->vibration_path),
+ noti->led_operation,
+ noti->led_argb,
+ noti->led_on_ms,
+ noti->led_off_ms,
+ noti->flags_for_property, flag_simmode, noti->display_applist);
+
+ /* Free decoded data */
+ if (args) {
+ free(args);
+ }
+ if (group_args) {
+ free(group_args);
+ }
+
+ if (b_execute_option) {
+ free(b_execute_option);
+ }
+ if (b_service_responding) {
+ free(b_service_responding);
+ }
+ if (b_service_single_launch) {
+ free(b_service_single_launch);
+ }
+ if (b_service_multi_launch) {
+ free(b_service_multi_launch);
+ }
+
+ if (b_text) {
+ free(b_text);
+ }
+ if (b_key) {
+ free(b_key);
+ }
+ if (b_format_args) {
+ free(b_format_args);
+ }
+
+ if (b_image_path) {
+ free(b_image_path);
+ }
+
+ if (*query == NULL) {
+ return NOTIFICATION_ERROR_OUT_OF_MEMORY;
+ }
+
+ return NOTIFICATION_ERROR_NONE;
+}
+
+
+static int _update_query_create(notification_h noti, char **query)
+{
+ int b_encode_len = 0;
+ char *args = NULL;
+ char *group_args = NULL;
+ char *b_image_path = NULL;
+ char *b_execute_option = NULL;
+ char *b_service_responding = NULL;
+ char *b_service_single_launch = NULL;
+ char *b_service_multi_launch = NULL;
+ char *b_text = NULL;
+ char *b_key = NULL;
+ char *b_format_args = NULL;
+ int flag_simmode = 0;
+
+ if (query == NULL) {
+ return NOTIFICATION_ERROR_INVALID_PARAMETER;
+ }
+
+ /* Decode bundle to update DB */
+ if (noti->args) {
+ bundle_encode(noti->args, (bundle_raw **) & args, &b_encode_len);
+ }
+ if (noti->group_args) {
+ bundle_encode(noti->group_args, (bundle_raw **) & group_args,
+ &b_encode_len);
+ }
+
+ if (noti->b_execute_option) {
+ bundle_encode(noti->b_execute_option,
+ (bundle_raw **) & b_execute_option, &b_encode_len);
+ }
+ if (noti->b_service_responding) {
+ bundle_encode(noti->b_service_responding,
+ (bundle_raw **) & b_service_responding, &b_encode_len);
+ }
+ if (noti->b_service_single_launch) {
+ bundle_encode(noti->b_service_single_launch,
+ (bundle_raw **) & b_service_single_launch, &b_encode_len);
+ }
+ if (noti->b_service_multi_launch) {
+ bundle_encode(noti->b_service_multi_launch,
+ (bundle_raw **) & b_service_multi_launch, &b_encode_len);
+ }
+
+ if (noti->b_text) {
+ bundle_encode(noti->b_text, (bundle_raw **) & b_text, &b_encode_len);
+ }
+ if (noti->b_key) {
+ bundle_encode(noti->b_key, (bundle_raw **) & b_key, &b_encode_len);
+ }
+ if (noti->b_format_args) {
+ bundle_encode(noti->b_format_args,
+ (bundle_raw **) & b_format_args, &b_encode_len);
+ }
+
+ if (noti->b_image_path) {
+ bundle_encode(noti->b_image_path,
+ (bundle_raw **) & b_image_path, &b_encode_len);
+ }
+
+ /* Check only simmode property is enable */
+ if (noti->flags_for_property & NOTIFICATION_PROP_DISPLAY_ONLY_SIMMODE) {
+ flag_simmode = 1;
+ }
+
+ /* Make query */
+ *query = sqlite3_mprintf("UPDATE noti_list SET "
+ "type = %d, "
+ "layout = %d, "
+ "launch_pkgname = '%s', "
+ "image_path = '%s', "
+ "b_text = '%s', b_key = '%s', tag = $tag, "
+ "b_format_args = '%s', num_format_args = %d, "
+ "text_domain = '%s', text_dir = '%s', "
+ "time = %d, insert_time = %d, "
+ "args = '%s', group_args = '%s', "
+ "b_execute_option = '%s', "
+ "b_service_responding = '%s', "
+ "b_service_single_launch = '%s', "
+ "b_service_multi_launch = '%s', "
+ "sound_type = %d, sound_path = '%s', "
+ "vibration_type = %d, vibration_path = '%s', "
+ "led_operation = %d, led_argb = %d, "
+ "led_on_ms = %d, led_off_ms = %d, "
+ "flags_for_property = %d, flag_simmode = %d, "
+ "display_applist = %d, "
+ "progress_size = $progress_size, progress_percentage = $progress_percentage "
+ "where priv_id = %d ",
+ noti->type,
+ noti->layout,
+ NOTIFICATION_CHECK_STR(noti->launch_pkgname),
+ NOTIFICATION_CHECK_STR(b_image_path),
+ NOTIFICATION_CHECK_STR(b_text), NOTIFICATION_CHECK_STR(b_key),
+ NOTIFICATION_CHECK_STR(b_format_args), noti->num_format_args,
+ NOTIFICATION_CHECK_STR(noti->domain),
+ NOTIFICATION_CHECK_STR(noti->dir),
+ (int)noti->time, (int)noti->insert_time,
+ NOTIFICATION_CHECK_STR(args), NOTIFICATION_CHECK_STR(group_args),
+ NOTIFICATION_CHECK_STR(b_execute_option),
+ NOTIFICATION_CHECK_STR(b_service_responding),
+ NOTIFICATION_CHECK_STR(b_service_single_launch),
+ NOTIFICATION_CHECK_STR(b_service_multi_launch),
+ noti->sound_type, NOTIFICATION_CHECK_STR(noti->sound_path),
+ noti->vibration_type,
+ NOTIFICATION_CHECK_STR(noti->vibration_path),
+ noti->led_operation,
+ noti->led_argb,
+ noti->led_on_ms,
+ noti->led_off_ms,
+ noti->flags_for_property, flag_simmode, noti->display_applist,
+ noti->priv_id);
+
+ /* Free decoded data */
+ if (args) {
+ free(args);
+ }
+ if (group_args) {
+ free(group_args);
+ }
+
+ if (b_execute_option) {
+ free(b_execute_option);
+ }
+ if (b_service_responding) {
+ free(b_service_responding);
+ }
+ if (b_service_single_launch) {
+ free(b_service_single_launch);
+ }
+ if (b_service_multi_launch) {
+ free(b_service_multi_launch);
+ }
+
+ if (b_text) {
+ free(b_text);
+ }
+ if (b_key) {
+ free(b_key);
+ }
+ if (b_format_args) {
+ free(b_format_args);
+ }
+
+ if (b_image_path) {
+ free(b_image_path);
+ }
+
+ if (*query == NULL) {
+ return NOTIFICATION_ERROR_OUT_OF_MEMORY;
+ }
+
+ return NOTIFICATION_ERROR_NONE;
+}
+
+static void _notification_noti_populate_from_stmt(sqlite3_stmt * stmt, notification_h noti) {
+ int col = 0;
+
+ if (stmt == NULL || noti == NULL) {
+ return ;
+ }
+
+ noti->type = sqlite3_column_int(stmt, col++);
+ noti->layout = sqlite3_column_int(stmt, col++);
+ __free_and_set((void **)&(noti->caller_pkgname), notification_db_column_text(stmt, col++));
+ __free_and_set((void **)&(noti->launch_pkgname), notification_db_column_text(stmt, col++));
+ noti->b_image_path = notification_db_column_bundle(stmt, col++);
+ noti->group_id = sqlite3_column_int(stmt, col++);
+ noti->internal_group_id = 0;
+ noti->priv_id = sqlite3_column_int(stmt, col++);
+ __free_and_set((void **)&(noti->tag), notification_db_column_text(stmt, col++));
+
+ noti->b_text = notification_db_column_bundle(stmt, col++);
+ noti->b_key = notification_db_column_bundle(stmt, col++);
+ noti->b_format_args = notification_db_column_bundle(stmt, col++);
+ noti->num_format_args = sqlite3_column_int(stmt, col++);
+
+ __free_and_set((void **)&(noti->domain), notification_db_column_text(stmt, col++));
+ __free_and_set((void **)&(noti->dir), notification_db_column_text(stmt, col++));
+ noti->time = sqlite3_column_int(stmt, col++);
+ noti->insert_time = sqlite3_column_int(stmt, col++);
+ noti->args = notification_db_column_bundle(stmt, col++);
+ noti->group_args = notification_db_column_bundle(stmt, col++);
+
+ noti->b_execute_option = notification_db_column_bundle(stmt, col++);
+ noti->b_service_responding = notification_db_column_bundle(stmt, col++);
+ noti->b_service_single_launch =
+ notification_db_column_bundle(stmt, col++);
+ noti->b_service_multi_launch =
+ notification_db_column_bundle(stmt, col++);
+
+ noti->sound_type = sqlite3_column_int(stmt, col++);
+ __free_and_set((void **)&(noti->sound_path), notification_db_column_text(stmt, col++));
+ noti->vibration_type = sqlite3_column_int(stmt, col++);
+ __free_and_set((void **)&(noti->vibration_path), notification_db_column_text(stmt, col++));
+ noti->led_operation = sqlite3_column_int(stmt, col++);
+ noti->led_argb = sqlite3_column_int(stmt, col++);
+ noti->led_on_ms = sqlite3_column_int(stmt, col++);
+ noti->led_off_ms = sqlite3_column_int(stmt, col++);
+
+ noti->flags_for_property = sqlite3_column_int(stmt, col++);
+ noti->display_applist = sqlite3_column_int(stmt, col++);
+ noti->progress_size = sqlite3_column_double(stmt, col++);
+ noti->progress_percentage = sqlite3_column_double(stmt, col++);
+
+ noti->app_icon_path = NULL;
+ noti->app_name = NULL;
+ noti->temp_title = NULL;
+ noti->temp_content = NULL;
+}
+
+static notification_h _notification_noti_get_item(sqlite3_stmt * stmt)
+{
+ notification_h noti = NULL;
+
+ noti = (notification_h) calloc(1, sizeof(struct _notification));
+ if (noti == NULL) {
+ return NULL;
+ }
+
+ _notification_noti_populate_from_stmt(stmt, noti);
+
+ return noti;
+}
+
+int notification_noti_set_tag(const char *tag, char *value, char *buf, int buf_len)
+{
+ int len_total = 0;
+
+ len_total += (strlen(tag) * 2) + 5 + strlen(value) + 1;
+
+ if (buf_len <= len_total)
+ return NOTIFICATION_ERROR_INVALID_PARAMETER;
+
+ snprintf(buf, buf_len, "<%s>%s</%s>", tag, value, tag);
+
+ return NOTIFICATION_ERROR_NONE;
+}
+
+char *notification_noti_strip_tag(const char *tagged_str)
+{
+ if (tagged_str == NULL)
+ return NULL;
+
+ int len_total = strlen(tagged_str);
+
+ if (len_total == 0)
+ return NULL;
+
+ char *b_f_e = strstr(tagged_str, ">");
+ char *b_e_s = strstr(tagged_str, "</");
+
+ if (b_f_e == NULL || b_e_s == NULL || (b_e_s - b_f_e - 1) <= 0)
+ return NULL;
+
+ return strndup(b_f_e + 1, b_e_s - b_f_e - 1);
+}
+
+int notification_noti_get_tag_type(const char *tagged_str)
+{
+ if (tagged_str == NULL)
+ return TAG_TYPE_INVALID;
+
+ if (strlen(tagged_str)== 0)
+ return TAG_TYPE_INVALID;
+
+ char *b_f_s = strstr(tagged_str, "<");
+ char *b_f_e = strstr(tagged_str, ">");
+
+ if (b_f_s == NULL || b_f_e == NULL || (b_f_e - b_f_s - 1) <= 0)
+ return TAG_TYPE_INVALID;
+
+ char *start = b_f_s + 1;
+ int len_tag = b_f_e - b_f_s - 1;
+
+ if (strncmp(start,TAG_TIME,len_tag) == 0) {
+ return TAG_TYPE_TIME;
+ }
+
+ return TAG_TYPE_INVALID;
+}
+
+static int _notification_noti_update_priv_id(sqlite3 * db, int rowid)
+{
+ int ret = NOTIFICATION_ERROR_NONE;
+ char *query = NULL;
+
+ if (db == NULL) {
+ ret = NOTIFICATION_ERROR_INVALID_PARAMETER;
+ goto err;
+ }
+
+ query = sqlite3_mprintf("UPDATE noti_list SET "
+ "priv_id = %d, internal_group_id = %d WHERE rowid = %d",
+ rowid, rowid, rowid);
+ if (query == NULL) {
+ ret = NOTIFICATION_ERROR_OUT_OF_MEMORY;
+ goto err;
+ }
+
+ ret = notification_db_exec(db, query, NULL);
+
+err:
+ if (query) {
+ sqlite3_free(query);
+ }
+
+ return ret;
+}
+
+EXPORT_API int notification_noti_insert(notification_h noti)
+{
+ int ret = 0;
+ sqlite3 *db = NULL;
+ sqlite3_stmt *stmt = NULL;
+ char *query = NULL;
+ char buf_key[32] = { 0, };
+ const char *title_key = NULL;
+
+ /* Open DB */
+ db = notification_db_open(DBPATH);
+ if (!db) {
+ return get_last_result();
+ }
+
+ /* Initialize private ID */
+ noti->priv_id = NOTIFICATION_PRIV_ID_NONE;
+ noti->group_id = NOTIFICATION_GROUP_ID_NONE;
+ noti->internal_group_id = NOTIFICATION_GROUP_ID_NONE;
+
+ /* make query */
+ ret = _insertion_query_create(noti, &query);
+ if (ret != NOTIFICATION_ERROR_NONE) {
+ goto err;
+ }
+
+ ret = sqlite3_prepare_v2(db, query, -1, &stmt, NULL);
+ if (ret != SQLITE_OK) {
+ NOTIFICATION_ERR("Insert Query : %s", query);
+ NOTIFICATION_ERR("Insert DB error(%d) : %s", ret,
+ sqlite3_errmsg(db));
+ ret = NOTIFICATION_ERROR_FROM_DB;
+ goto err;
+ }
+
+ /* Get title key */
+ if (noti->b_key != NULL) {
+ snprintf(buf_key, sizeof(buf_key), "%d",
+ NOTIFICATION_TEXT_TYPE_TITLE);
+
+ title_key = bundle_get_val(noti->b_key, buf_key);
+ }
+
+ if (title_key == NULL && noti->b_text != NULL) {
+ snprintf(buf_key, sizeof(buf_key), "%d",
+ NOTIFICATION_TEXT_TYPE_TITLE);
+
+ title_key = bundle_get_val(noti->b_text, buf_key);
+ }
+
+ if (title_key == NULL) {
+ title_key = noti->caller_pkgname;
+ }
+
+ /* Bind query */
+ ret = _notification_noti_bind_query_text(stmt, "$tag", noti->tag);
+ if (ret != NOTIFICATION_ERROR_NONE) {
+ NOTIFICATION_ERR("Bind error : %s", sqlite3_errmsg(db));
+ goto err;
+ }
+ ret = _notification_noti_bind_query_text(stmt, "$title_key", title_key);
+ if (ret != NOTIFICATION_ERROR_NONE) {
+ NOTIFICATION_ERR("Bind error : %s", sqlite3_errmsg(db));
+ goto err;
+ }
+ ret = _notification_noti_bind_query_double(stmt, "$progress_size",noti->progress_size);
+ if (ret != NOTIFICATION_ERROR_NONE) {
+ NOTIFICATION_ERR("Bind error : %s", sqlite3_errmsg(db));
+ if (stmt) {
+ sqlite3_finalize(stmt);
+ }
+ return ret;
+ }
+ ret = _notification_noti_bind_query_double(stmt, "$progress_percentage",noti->progress_percentage);
+ if (ret != NOTIFICATION_ERROR_NONE) {
+ NOTIFICATION_ERR("Bind error : %s", sqlite3_errmsg(db));
+ if (stmt) {
+ sqlite3_finalize(stmt);
+ }
+ return ret;
+ }
+
+ ret = sqlite3_step(stmt);
+ if (ret == SQLITE_OK || ret == SQLITE_DONE) {
+ noti->priv_id = (int)sqlite3_last_insert_rowid(db);
+ if (_notification_noti_update_priv_id(db, noti->priv_id) == 0) {
+ ret = NOTIFICATION_ERROR_NONE;
+ } else {
+ ret = NOTIFICATION_ERROR_FROM_DB;
+ }
+ } else {
+ ret = NOTIFICATION_ERROR_FROM_DB;
+ }
+err:
+ if (stmt) {
+ sqlite3_finalize(stmt);
+ }
+
+ /* Close DB */
+ if (db) {
+ notification_db_close(&db);
+ }
+
+ if (query) {
+ sqlite3_free(query);
+ }
+
+ return ret;
+}
+
+int notification_noti_get_by_priv_id(notification_h noti, char *pkgname, int priv_id)
+{
+ int ret = 0;
+ char *query = NULL;
+ sqlite3 *db = NULL;
+ sqlite3_stmt *stmt = NULL;
+
+ if (priv_id < 0 || noti == NULL) {
+ ret = NOTIFICATION_ERROR_INVALID_PARAMETER;
+ goto err;
+ }
+
+ /* Open DB */
+ db = notification_db_open(DBPATH);
+ if (!db) {
+ return get_last_result();
+ }
+
+ char *base_query = "select "
+ "type, layout, caller_pkgname, launch_pkgname, image_path, group_id, priv_id, "
+ "tag, b_text, b_key, b_format_args, num_format_args, "
+ "text_domain, text_dir, time, insert_time, args, group_args, "
+ "b_execute_option, b_service_responding, b_service_single_launch, b_service_multi_launch, "
+ "sound_type, sound_path, vibration_type, vibration_path, led_operation, led_argb, led_on_ms, led_off_ms, "
+ "flags_for_property, display_applist, progress_size, progress_percentage "
+ "from noti_list ";
+
+ if (pkgname != NULL) {
+ query = sqlite3_mprintf("%s where caller_pkgname = '%s' and priv_id = %d",
+ base_query ,pkgname, priv_id);
+ } else {
+ query = sqlite3_mprintf("%s where priv_id = %d", base_query, priv_id);
+ }
+ if (query == NULL) {
+ ret = NOTIFICATION_ERROR_OUT_OF_MEMORY;
+ goto err;
+ }
+
+ ret = sqlite3_prepare_v2(db, query, -1, &stmt, NULL);
+ if (ret != SQLITE_OK) {
+ NOTIFICATION_ERR("select Query : %s", query);
+ NOTIFICATION_ERR("select DB error(%d) : %s", ret,
+ sqlite3_errmsg(db));
+ ret = NOTIFICATION_ERROR_FROM_DB;
+ goto err;
+ }
+
+ ret = sqlite3_step(stmt);
+ if (ret == SQLITE_ROW) {
+ _notification_noti_populate_from_stmt(stmt, noti);
+ ret = NOTIFICATION_ERROR_NONE;
+ } else {
+ ret = NOTIFICATION_ERROR_FROM_DB;
+ }
+err:
+ if (query) {
+ sqlite3_free(query);
+ }
+
+ if (stmt) {
+ sqlite3_finalize(stmt);
+ }
+
+ /* Close DB */
+ if (db != NULL) {
+ notification_db_close(&db);
+ }
+
+ return ret;
+}
+
+EXPORT_API int notification_noti_get_by_tag(notification_h noti, char *pkgname, char* tag)
+{
+ int ret = 0;
+ char *query = NULL;
+ sqlite3 *db = NULL;
+ sqlite3_stmt *stmt = NULL;
+
+ if (tag == NULL || noti == NULL) {
+ ret = NOTIFICATION_ERROR_INVALID_PARAMETER;
+ goto err;
+ }
+
+ /* Open DB */
+ db = notification_db_open(DBPATH);
+ if (!db) {
+ return get_last_result();
+ }
+
+ if (pkgname != NULL) {
+ ret = sqlite3_prepare_v2(db, "select "
+ "type, layout, caller_pkgname, launch_pkgname, image_path, group_id, priv_id, "
+ "tag, b_text, b_key, b_format_args, num_format_args, "
+ "text_domain, text_dir, time, insert_time, args, group_args, "
+ "b_execute_option, b_service_responding, b_service_single_launch, b_service_multi_launch, "
+ "sound_type, sound_path, vibration_type, vibration_path, led_operation, led_argb, led_on_ms, led_off_ms, "
+ "flags_for_property, display_applist, progress_size, progress_percentage "
+ "from noti_list where caller_pkgname = ? and tag = ?", -1, &stmt, NULL);
+ if (ret != SQLITE_OK) {
+ NOTIFICATION_ERR("Error: %s\n", sqlite3_errmsg(db));
+ return NOTIFICATION_ERROR_OUT_OF_MEMORY;
+ }
+
+ ret = sqlite3_bind_text(stmt, 1, pkgname, -1, SQLITE_TRANSIENT);
+ if (ret != SQLITE_OK) {
+ NOTIFICATION_ERR("Error: %s\n", sqlite3_errmsg(db));
+ goto err;
+ }
+
+ ret = sqlite3_bind_text(stmt, 2, tag, -1, SQLITE_TRANSIENT);
+ if (ret != SQLITE_OK) {
+ NOTIFICATION_ERR("Error: %s\n", sqlite3_errmsg(db));
+ goto err;
+ }
+ } else {
+ ret = sqlite3_prepare_v2(db, "select "
+ "type, layout, caller_pkgname, launch_pkgname, image_path, group_id, priv_id, "
+ "tag, b_text, b_key, b_format_args, num_format_args, "
+ "text_domain, text_dir, time, insert_time, args, group_args, "
+ "b_execute_option, b_service_responding, b_service_single_launch, b_service_multi_launch, "
+ "sound_type, sound_path, vibration_type, vibration_path, led_operation, led_argb, led_on_ms, led_off_ms, "
+ "flags_for_property, display_applist, progress_size, progress_percentage "
+ "from noti_list where tag = ?", -1, &stmt, NULL);
+ if (ret != SQLITE_OK) {
+ NOTIFICATION_ERR("Error: %s\n", sqlite3_errmsg(db));
+ return NOTIFICATION_ERROR_OUT_OF_MEMORY;
+ }
+
+ ret = sqlite3_bind_text(stmt, 1, tag, -1, SQLITE_TRANSIENT);
+ if (ret != SQLITE_OK) {
+ NOTIFICATION_ERR("Error: %s\n", sqlite3_errmsg(db));
+ goto err;
+ }
+ }
+/*
+ char *base_query = "select "
+ "type, layout, caller_pkgname, launch_pkgname, image_path, group_id, priv_id, "
+ "tag, b_text, b_key, b_format_args, num_format_args, "
+ "text_domain, text_dir, time, insert_time, args, group_args, "
+ "b_execute_option, b_service_responding, b_service_single_launch, b_service_multi_launch, "
+ "sound_type, sound_path, vibration_type, vibration_path, led_operation, led_argb, led_on_ms, led_off_ms, "
+ "flags_for_property, display_applist, progress_size, progress_percentage "
+ "from noti_list ";
+
+ if (pkgname != NULL) {
+ query = sqlite3_mprintf("%s where caller_pkgname = '%s' and tag = '%s'",
+ base_query ,pkgname, tag);
+ } else {
+ query = sqlite3_mprintf("%s where tag = '%s'", base_query, tag);
+ }
+ if (query == NULL) {
+ ret = NOTIFICATION_ERROR_OUT_OF_MEMORY;
+ goto err;
+ }
+
+ ret = sqlite3_prepare_v2(db, query, -1, &stmt, NULL);
+ if (ret != SQLITE_OK) {
+ NOTIFICATION_ERR("select Query : %s", query);
+ NOTIFICATION_ERR("select DB error(%d) : %s", ret,
+ sqlite3_errmsg(db));
+ ret = NOTIFICATION_ERROR_FROM_DB;
+ goto err;
+ }
+*/
+ ret = sqlite3_step(stmt);
+ if (ret == SQLITE_ROW) {
+ _notification_noti_populate_from_stmt(stmt, noti);
+ ret = NOTIFICATION_ERROR_NONE;
+ } else {
+ ret = NOTIFICATION_ERROR_FROM_DB;
+ }
+err:
+ if (query) {
+ sqlite3_free(query);
+ }
+
+ if (stmt) {
+ sqlite3_finalize(stmt);
+ }
+
+ /* Close DB */
+ if (db != NULL) {
+ notification_db_close(&db);
+ }
+
+ return ret;
+}
+
+EXPORT_API int notification_noti_update(notification_h noti)
+{
+ int ret = 0;
+ sqlite3 *db;
+ sqlite3_stmt *stmt = NULL;
+ char *query = NULL;
+
+ /* Open DB */
+ db = notification_db_open(DBPATH);
+ if (!db) {
+ return get_last_result();
+ }
+
+ /* Check private ID is exist */
+ ret = _notification_noti_check_priv_id(noti, db);
+ if (ret != NOTIFICATION_ERROR_ALREADY_EXIST_ID) {
+ ret = NOTIFICATION_ERROR_NOT_EXIST_ID;
+ goto err;
+ }
+
+ /* make update query */
+ ret = _update_query_create(noti, &query);
+ if (ret != NOTIFICATION_ERROR_NONE) {
+ goto err;
+ }
+
+ ret = sqlite3_prepare_v2(db, query, -1, &stmt, NULL);
+ if (ret != SQLITE_OK) {
+ NOTIFICATION_ERR("Insert Query : %s", query);
+ NOTIFICATION_ERR("Insert DB error(%d) : %s", ret,
+ sqlite3_errmsg(db));
+ ret = NOTIFICATION_ERROR_FROM_DB;
+ goto err;
+ }
+
+ ret = _notification_noti_bind_query_text(stmt, "$tag", noti->tag);
+ if (ret != NOTIFICATION_ERROR_NONE) {
+ NOTIFICATION_ERR("Bind error : %s", sqlite3_errmsg(db));
+ goto err;
+ }
+ ret = _notification_noti_bind_query_double(stmt, "$progress_size",noti->progress_size);
+ if (ret != NOTIFICATION_ERROR_NONE) {
+ NOTIFICATION_ERR("Bind error : %s", sqlite3_errmsg(db));
+ goto err;
+ }
+ ret = _notification_noti_bind_query_double(stmt, "$progress_percentage",noti->progress_percentage);
+ if (ret != NOTIFICATION_ERROR_NONE) {
+ NOTIFICATION_ERR("Bind error : %s", sqlite3_errmsg(db));
+ goto err;
+ }
+
+ ret = sqlite3_step(stmt);
+ if (ret == SQLITE_OK || ret == SQLITE_DONE) {
+ ret = NOTIFICATION_ERROR_NONE;
+ } else {
+ ret = NOTIFICATION_ERROR_FROM_DB;
+ }
+err:
+ if (stmt) {
+ sqlite3_finalize(stmt);
+ }
+
+ /* Close DB */
+ if (db) {
+ notification_db_close(&db);
+ }
+
+ if (query) {
+ sqlite3_free(query);
+ }
+
+ return ret;
+}
+
+EXPORT_API int notification_noti_delete_all(notification_type_e type, const char *pkgname, int *num_deleted, int **list_deleted_rowid)
+{
+ int ret = NOTIFICATION_ERROR_NONE;
+ int ret_tmp = NOTIFICATION_ERROR_NONE;
+ int i = 0, data_cnt = 0;
+ sqlite3 *db = NULL;
+ sqlite3_stmt *stmt = NULL;
+ char buf[128] = { 0, };
+ char query[NOTIFICATION_QUERY_MAX] = { 0, };
+ char query_base[NOTIFICATION_QUERY_MAX] = { 0, };
+ char query_where[NOTIFICATION_QUERY_MAX] = { 0, };
+
+ /* Open DB */
+ db = notification_db_open(DBPATH);
+ if (!db) {
+ return get_last_result();
+ }
+
+ if (pkgname == NULL) {
+ if (type != NOTIFICATION_TYPE_NONE) {
+ snprintf(query_where, sizeof(query_where),
+ "where type = %d ", type);
+ }
+ } else {
+ if (type == NOTIFICATION_TYPE_NONE) {
+ snprintf(query_where, sizeof(query_where),
+ "where caller_pkgname = '%s' ", pkgname);
+ } else {
+ snprintf(query_where, sizeof(query_where),
+ "where caller_pkgname = '%s' and type = %d ",
+ pkgname, type);
+ }
+ }
+
+ if (num_deleted != NULL) {
+ *num_deleted = 0;
+ }
+ if (list_deleted_rowid != NULL) {
+ *list_deleted_rowid = NULL;
+ snprintf(query, sizeof(query),
+ "select priv_id from noti_list %s ", query_where);
+
+ ret = sqlite3_prepare(db, query, strlen(query), &stmt, NULL);
+ if (ret != SQLITE_OK) {
+ NOTIFICATION_ERR("Select Query : %s", query);
+ NOTIFICATION_ERR("Select DB error(%d) : %s", ret,
+ sqlite3_errmsg(db));
+
+ ret = NOTIFICATION_ERROR_FROM_DB;
+ goto err;
+ }
+
+ while(sqlite3_step(stmt) == SQLITE_ROW) {
+ if (data_cnt % 8 == 0) {
+ int *tmp;
+
+ tmp = (int *)realloc(*list_deleted_rowid, sizeof(int) * (data_cnt + 8 + 1));
+ if (tmp) {
+ *list_deleted_rowid = tmp;
+ } else {
+ NOTIFICATION_ERR("Heap: %d\n", errno);
+ /*!
+ * \TODO
+ * How can I handle this?
+ */
+ free(*list_deleted_rowid);
+ *list_deleted_rowid = NULL;
+ ret = NOTIFICATION_ERROR_OUT_OF_MEMORY;
+ goto err;
+ }
+ }
+ *((*list_deleted_rowid) + data_cnt) = sqlite3_column_int(stmt, 0);
+ data_cnt++;
+ }
+
+ if (stmt) {
+ sqlite3_finalize(stmt);
+ stmt = NULL;
+ }
+
+ if (data_cnt > 0) {
+ query_where[0] = '\0';
+ snprintf(query_base, sizeof(query_base) - 1, "delete from noti_list");
+ for (i = 0; i < data_cnt ; i++) {
+ if (i % NOTI_BURST_DELETE_UNIT == 0 && i != 0) {
+ snprintf(query, sizeof(query) - 1, "%s where priv_id in (%s)", query_base, query_where);
+ ret_tmp = notification_db_exec(db, query, NULL);
+ query_where[0] = '\0';
+ if (ret == NOTIFICATION_ERROR_NONE) {
+ ret = ret_tmp;
+ }
+ }
+ snprintf(buf, sizeof(buf) - 1, "%s%d", (i % NOTI_BURST_DELETE_UNIT == 0) ? "" : ",", *((*list_deleted_rowid) + i));
+ strncat(query_where, buf,sizeof(query_where) - strlen(query_where) - 1);
+ }
+ if ((i <= NOTI_BURST_DELETE_UNIT) || ((i % NOTI_BURST_DELETE_UNIT) > 0) ) {
+ snprintf(query, sizeof(query) - 1, "%s where priv_id in (%s)", query_base, query_where);
+ ret_tmp = notification_db_exec(db, query, NULL);
+ if (ret == NOTIFICATION_ERROR_NONE) {
+ ret = ret_tmp;
+ }
+ }
+ } else {
+ free(*list_deleted_rowid);
+ *list_deleted_rowid = NULL;
+ }
+
+ if (num_deleted != NULL) {
+ *num_deleted = data_cnt;
+ }
+ } else {
+ /* Make main query */
+ snprintf(query_base, sizeof(query_base), "delete from noti_list ");
+ snprintf(query, sizeof(query), "%s %s", query_base, query_where);
+
+ ret = notification_db_exec(db, query, NULL);
+
+ if (num_deleted != NULL) {
+ *num_deleted = sqlite3_changes(db);
+ }
+ }
+
+err:
+ if (stmt) {
+ sqlite3_finalize(stmt);
+ }
+ /* Close DB */
+ if (db) {
+ notification_db_close(&db);
+ }
+
+ return ret;
+}
+
+int notification_noti_delete_group_by_group_id(const char *pkgname,
+ int group_id, int *num_deleted, int **list_deleted_rowid)
+{
+ int ret = NOTIFICATION_ERROR_NONE;
+ int ret_tmp = NOTIFICATION_ERROR_NONE;
+ sqlite3 *db = NULL;
+ int i = 0, data_cnt = 0;
+ sqlite3_stmt *stmt = NULL;
+ char buf[128] = { 0, };
+ char query[NOTIFICATION_QUERY_MAX] = { 0, };
+ char query_base[NOTIFICATION_QUERY_MAX] = { 0, };
+ char query_where[NOTIFICATION_QUERY_MAX] = { 0, };
+
+ /* Check pkgname is valid */
+ if (pkgname == NULL) {
+ return NOTIFICATION_ERROR_INVALID_PARAMETER;
+ }
+
+ snprintf(query_where, sizeof(query_where),
+ "where caller_pkgname = '%s' and group_id = %d", pkgname, group_id);
+
+ /* Open DB */
+ db = notification_db_open(DBPATH);
+ if (!db) {
+ return get_last_result();
+ }
+
+ if (num_deleted != NULL) {
+ *num_deleted = 0;
+ }
+ if (list_deleted_rowid != NULL) {
+ *list_deleted_rowid = NULL;
+ snprintf(query, sizeof(query),
+ "select priv_id from noti_list %s ", query_where);
+
+ ret = sqlite3_prepare(db, query, strlen(query), &stmt, NULL);
+ if (ret != SQLITE_OK) {
+ NOTIFICATION_ERR("Select Query : %s", query);
+ NOTIFICATION_ERR("Select DB error(%d) : %s", ret,
+ sqlite3_errmsg(db));
+
+ ret = NOTIFICATION_ERROR_FROM_DB;
+ goto err;
+ }
+
+ while(sqlite3_step(stmt) == SQLITE_ROW) {
+ if (data_cnt % 8 == 0) {
+ int *tmp;
+ tmp = (int *)realloc(*list_deleted_rowid, sizeof(int) * (data_cnt + 8 + 1));
+ if (tmp) {
+ *list_deleted_rowid = tmp;
+ } else {
+ free(*list_deleted_rowid);
+ *list_deleted_rowid = NULL;
+ ret = NOTIFICATION_ERROR_OUT_OF_MEMORY;
+ goto err;
+ }
+ }
+ *((*list_deleted_rowid) + data_cnt) = sqlite3_column_int(stmt, 0);
+ data_cnt++;
+ }
+
+ if (stmt) {
+ sqlite3_finalize(stmt);
+ stmt = NULL;
+ }
+
+ if (data_cnt > 0) {
+ query_where[0] = '\0';
+ snprintf(query_base, sizeof(query_base) - 1, "delete from noti_list");
+ for (i = 0; i < data_cnt ; i++) {
+ if (i % NOTI_BURST_DELETE_UNIT == 0 && i != 0) {
+ snprintf(query, sizeof(query) - 1, "%s where priv_id in (%s)", query_base, query_where);
+ ret_tmp = notification_db_exec(db, query, NULL);
+ query_where[0] = '\0';
+ if (ret == NOTIFICATION_ERROR_NONE) {
+ ret = ret_tmp;
+ }
+ }
+ snprintf(buf, sizeof(buf) - 1, "%s%d", (i % NOTI_BURST_DELETE_UNIT == 0) ? "" : ",", *((*list_deleted_rowid) + i));
+ strncat(query_where, buf,sizeof(query_where) - strlen(query_where) - 1);
+ }
+ if ((i <= NOTI_BURST_DELETE_UNIT) || ((i % NOTI_BURST_DELETE_UNIT) > 0) ) {
+ snprintf(query, sizeof(query) - 1, "%s where priv_id in (%s)", query_base, query_where);
+ ret_tmp = notification_db_exec(db, query, NULL);
+ if (ret == NOTIFICATION_ERROR_NONE) {
+ ret = ret_tmp;
+ }
+ }
+ } else {
+ free(*list_deleted_rowid);
+ *list_deleted_rowid = NULL;
+ }
+
+ if (num_deleted != NULL) {
+ *num_deleted = data_cnt;
+ }
+ } else {
+ /* Make query */
+ snprintf(query, sizeof(query), "delete from noti_list %s", query_where);
+
+ /* execute DB */
+ ret = notification_db_exec(db, query, NULL);
+ }
+
+err:
+ if (stmt) {
+ sqlite3_finalize(stmt);
+ }
+ /* Close DB */
+ if (db) {
+ notification_db_close(&db);
+ }
+
+ return ret;
+}
+
+int notification_noti_delete_group_by_priv_id(const char *pkgname, int priv_id)
+{
+ sqlite3 *db = NULL;
+ char query[NOTIFICATION_QUERY_MAX] = { 0, };
+ int internal_group_id = 0;
+ int ret;
+
+ /* Check pkgname is valid */
+ if (pkgname == NULL) {
+ return NOTIFICATION_ERROR_INVALID_PARAMETER;
+ }
+
+ /* Open DB */
+ db = notification_db_open(DBPATH);
+ if (!db) {
+ return get_last_result();
+ }
+
+ /* Get internal group id using priv id */
+ internal_group_id =
+ _notification_noti_get_internal_group_id_by_priv_id(pkgname,
+ priv_id, db);
+
+ /* Make query */
+ snprintf(query, sizeof(query), "delete from noti_list "
+ "where caller_pkgname = '%s' and internal_group_id = %d",
+ pkgname, internal_group_id);
+
+ /* execute DB */
+ ret = notification_db_exec(db, query, NULL);
+
+ /* Close DB */
+ notification_db_close(&db);
+
+ return ret;
+}
+
+EXPORT_API int notification_noti_delete_by_priv_id(const char *pkgname, int priv_id)
+{
+ sqlite3 *db = NULL;
+ char query[NOTIFICATION_QUERY_MAX] = { 0, };
+ int ret;
+
+ /* Check pkgname is valid */
+ if (pkgname == NULL) {
+ return NOTIFICATION_ERROR_INVALID_PARAMETER;
+ }
+
+ /* Open DB */
+ db = notification_db_open(DBPATH);
+ if (!db) {
+ return get_last_result();
+ }
+
+ /* Make query */
+ snprintf(query, sizeof(query), "delete from noti_list "
+ "where caller_pkgname = '%s' and priv_id = %d", pkgname,
+ priv_id);
+
+ /* execute DB */
+ ret = notification_db_exec(db, query, NULL);
+
+ /* Close DB */
+ if (db) {
+ notification_db_close(&db);
+ }
+
+ return ret;
+}
+
+EXPORT_API int notification_noti_delete_by_priv_id_get_changes(const char *pkgname, int priv_id, int *num_changes)
+{
+ sqlite3 *db = NULL;
+ char query[NOTIFICATION_QUERY_MAX] = { 0, };
+ int ret;
+
+ /* Check pkgname is valid */
+ if (pkgname == NULL) {
+ return NOTIFICATION_ERROR_INVALID_PARAMETER;
+ }
+
+ /* Open DB */
+ db = notification_db_open(DBPATH);
+ if (!db) {
+ return get_last_result();
+ }
+
+ /* Make query */
+ snprintf(query, sizeof(query), "delete from noti_list "
+ "where caller_pkgname = '%s' and priv_id = %d", pkgname,
+ priv_id);
+
+ /* execute DB */
+ ret = notification_db_exec(db, query, num_changes);
+
+ if (num_changes != NULL) {
+ NOTIFICATION_DBG("deleted num:%d", *num_changes);
+ }
+
+ /* Close DB */
+ if (db) {
+ notification_db_close(&db);
+ }
+
+ return ret;
+}
+
+int notification_noti_get_count(notification_type_e type,
+ const char *pkgname,
+ int group_id, int priv_id,
+ int *count)
+{
+ sqlite3 *db = NULL;
+ sqlite3_stmt *stmt = NULL;
+ char query[NOTIFICATION_QUERY_MAX] = { 0, };
+ char query_base[NOTIFICATION_QUERY_MAX] = { 0, };
+ char query_where[NOTIFICATION_QUERY_MAX] = { 0, };
+ char query_where_more[NOTIFICATION_QUERY_MAX] = { 0, };
+
+ int ret = 0, get_count = 0, internal_group_id = 0;
+ int status = VCONFKEY_TELEPHONY_SIM_UNKNOWN;
+ int flag_where = 0;
+ int flag_where_more = 0;
+ int ret_vconf = 0;
+
+ /* Open DB */
+ db = notification_db_open(DBPATH);
+ if (!db) {
+ return get_last_result();
+ }
+
+ /* Check current sim status */
+ ret_vconf = vconf_get_int(VCONFKEY_TELEPHONY_SIM_SLOT, &status);
+
+ /* Make query */
+ snprintf(query_base, sizeof(query_base),
+ "select count(*) from noti_list ");
+
+ if (pkgname != NULL) {
+ if (group_id == NOTIFICATION_GROUP_ID_NONE) {
+ if (priv_id == NOTIFICATION_PRIV_ID_NONE) {
+ snprintf(query_where, sizeof(query_where),
+ "where caller_pkgname = '%s' ",
+ pkgname);
+ flag_where = 1;
+ } else {
+ internal_group_id =
+ _notification_noti_get_internal_group_id_by_priv_id
+ (pkgname, priv_id, db);
+ snprintf(query_where, sizeof(query_where),
+ "where caller_pkgname = '%s' and internal_group_id = %d ",
+ pkgname, internal_group_id);
+ flag_where = 1;
+ }
+ } else {
+ if (priv_id == NOTIFICATION_PRIV_ID_NONE) {
+ snprintf(query_where, sizeof(query_where),
+ "where caller_pkgname = '%s' and group_id = %d ",
+ pkgname, group_id);
+ flag_where = 1;
+ } else {
+ internal_group_id =
+ _notification_noti_get_internal_group_id_by_priv_id
+ (pkgname, priv_id, db);
+ snprintf(query_where, sizeof(query_where),
+ "where caller_pkgname = '%s' and internal_group_id = %d ",
+ pkgname, internal_group_id);
+ flag_where = 1;
+ }
+ }
+
+ }
+
+ if (ret_vconf == 0 && status == VCONFKEY_TELEPHONY_SIM_INSERTED) {
+ if (type != NOTIFICATION_TYPE_NONE) {
+ snprintf(query_where_more, sizeof(query_where_more),
+ "type = %d ", type);
+ flag_where_more = 1;
+ }
+ } else {
+ if (type != NOTIFICATION_TYPE_NONE) {
+ snprintf(query_where_more, sizeof(query_where_more),
+ "type = %d and flag_simmode = 0 ", type);
+ flag_where_more = 1;
+ } else {
+ snprintf(query_where_more, sizeof(query_where_more),
+ "flag_simmode = 0 ");
+ flag_where_more = 1;
+ }
+ }
+
+ if (flag_where == 1) {
+ if (flag_where_more == 1) {
+ snprintf(query, sizeof(query), "%s %s and %s",
+ query_base, query_where, query_where_more);
+ } else {
+ snprintf(query, sizeof(query), "%s %s", query_base,
+ query_where);
+ }
+
+ } else {
+ if (flag_where_more == 1) {
+ snprintf(query, sizeof(query), "%s where %s",
+ query_base, query_where_more);
+ } else {
+ snprintf(query, sizeof(query), "%s", query_base);
+ }
+ }
+
+ ret = sqlite3_prepare(db, query, strlen(query), &stmt, NULL);
+ if (ret != SQLITE_OK) {
+ NOTIFICATION_ERR("Select Query : %s", query);
+ NOTIFICATION_ERR("Select DB error(%d) : %s", ret,
+ sqlite3_errmsg(db));
+
+ ret = NOTIFICATION_ERROR_FROM_DB;
+ goto err;
+ }
+
+ ret = sqlite3_step(stmt);
+ if (ret == SQLITE_ROW) {
+ get_count = sqlite3_column_int(stmt, 0);
+ }
+
+ ret = NOTIFICATION_ERROR_NONE;
+
+err:
+ if (stmt) {
+ sqlite3_finalize(stmt);
+ }
+
+ /* Close DB */
+ if (db) {
+ notification_db_close(&db);
+ }
+
+ *count = get_count;
+
+ return ret;
+}
+
+int notification_noti_get_grouping_list(notification_type_e type,
+ int count,
+ notification_list_h *
+ list)
+{
+ sqlite3 *db = NULL;
+ sqlite3_stmt *stmt = NULL;
+ char query[NOTIFICATION_QUERY_MAX] = { 0, };
+ char query_base[NOTIFICATION_QUERY_MAX] = { 0, };
+ char query_where[NOTIFICATION_QUERY_MAX] = { 0, };
+
+ int ret = 0;
+ notification_list_h get_list = NULL;
+ notification_h noti = NULL;
+ int internal_count = 0;
+ int status;
+
+ /* Open DB */
+ db = notification_db_open(DBPATH);
+ if (!db) {
+ return get_last_result();
+ }
+
+ /* Check current sim status */
+ ret = vconf_get_int(VCONFKEY_TELEPHONY_SIM_SLOT, &status);
+
+ /* Make query */
+ snprintf(query_base, sizeof(query_base), "select "
+ "type, layout, caller_pkgname, launch_pkgname, image_path, group_id, priv_id, "
+ "tag, b_text, b_key, b_format_args, num_format_args, "
+ "text_domain, text_dir, time, insert_time, args, group_args, "
+ "b_execute_option, b_service_responding, b_service_single_launch, b_service_multi_launch, "
+ "sound_type, sound_path, vibration_type, vibration_path, led_operation, led_argb, led_on_ms, led_off_ms, "
+ "flags_for_property, display_applist, progress_size, progress_percentage "
+ "from noti_list ");
+
+ if (status == VCONFKEY_TELEPHONY_SIM_INSERTED) {
+ if (type != NOTIFICATION_TYPE_NONE) {
+ snprintf(query_where, sizeof(query_where),
+ "where type = %d ", type);
+ }
+ } else {
+ if (type != NOTIFICATION_TYPE_NONE) {
+ snprintf(query_where, sizeof(query_where),
+ "where type = %d and flag_simmode = 0 ", type);
+ } else {
+ snprintf(query_where, sizeof(query_where),
+ "where flag_simmode = 0 ");
+ }
+ }
+
+ snprintf(query, sizeof(query),
+ "%s %s "
+ "group by internal_group_id "
+ "order by rowid desc, time desc", query_base, query_where);
+
+ ret = sqlite3_prepare(db, query, strlen(query), &stmt, NULL);
+ if (ret != SQLITE_OK) {
+ NOTIFICATION_ERR("Select Query : %s", query);
+ NOTIFICATION_ERR("Select DB error(%d) : %s", ret,
+ sqlite3_errmsg(db));
+
+ ret = NOTIFICATION_ERROR_FROM_DB;
+ goto err;
+ }
+
+ while (sqlite3_step(stmt) == SQLITE_ROW) {
+ /* Make notification list */
+ noti = _notification_noti_get_item(stmt);
+ if (noti != NULL) {
+ internal_count++;
+
+ get_list = notification_list_append(get_list, noti);
+
+ if (count != -1 && internal_count >= count) {
+ NOTIFICATION_INFO
+ ("internal count %d >= count %d",
+ internal_count, count);
+ break;
+ }
+ }
+ }
+
+ ret = NOTIFICATION_ERROR_NONE;
+
+err:
+ if (stmt) {
+ sqlite3_finalize(stmt);
+ }
+
+ /* Close DB */
+ if (db) {
+ notification_db_close(&db);
+ }
+
+ if (get_list != NULL) {
+ *list = notification_list_get_head(get_list);
+ }
+
+ return ret;
+}
+
+int notification_noti_get_detail_list(const char *pkgname,
+ int group_id,
+ int priv_id, int count,
+ notification_list_h *list)
+{
+ sqlite3 *db = NULL;
+ sqlite3_stmt *stmt = NULL;
+ char query_base[NOTIFICATION_QUERY_MAX] = { 0, };
+ char query_where[NOTIFICATION_QUERY_MAX] = { 0, };
+
+ char query[NOTIFICATION_QUERY_MAX] = { 0, };
+ int ret = 0;
+ notification_list_h get_list = NULL;
+ notification_h noti = NULL;
+ int internal_count = 0;
+ int internal_group_id = 0;
+ int status = 0; /* If the vconf_get_int failed, the status will be the garbage value */
+
+ /* Open DB */
+ db = notification_db_open(DBPATH);
+ if (!db) {
+ return get_last_result();
+ }
+
+ /* Check current sim status */
+ ret = vconf_get_int(VCONFKEY_TELEPHONY_SIM_SLOT, &status);
+
+ /* Make query */
+ snprintf(query_base, sizeof(query_base), "select "
+ "type, layout, caller_pkgname, launch_pkgname, image_path, group_id, priv_id, "
+ "tag, b_text, b_key, b_format_args, num_format_args, "
+ "text_domain, text_dir, time, insert_time, args, group_args, "
+ "b_execute_option, b_service_responding, b_service_single_launch, b_service_multi_launch, "
+ "sound_type, sound_path, vibration_type, vibration_path, led_operation, led_argb, led_on_ms, led_off_ms, "
+ "flags_for_property, display_applist, progress_size, progress_percentage "
+ "from noti_list ");
+
+ if (priv_id == NOTIFICATION_PRIV_ID_NONE && group_id == NOTIFICATION_GROUP_ID_NONE) {
+ if (status == VCONFKEY_TELEPHONY_SIM_INSERTED) {
+ snprintf(query_where, sizeof(query_where),
+ "where caller_pkgname = '%s' ", pkgname);
+ } else {
+ snprintf(query_where, sizeof(query_where),
+ "where caller_pkgname = '%s' and flag_simmode = 0 ", pkgname);
+ }
+ } else {
+ internal_group_id =
+ _notification_noti_get_internal_group_id_by_priv_id(pkgname,
+ priv_id, db);
+
+ if (status == VCONFKEY_TELEPHONY_SIM_INSERTED) {
+ snprintf(query_where, sizeof(query_where),
+ "where caller_pkgname = '%s' and internal_group_id = %d ",
+ pkgname, internal_group_id);
+ } else {
+ snprintf(query_where, sizeof(query_where),
+ "where caller_pkgname = '%s' and internal_group_id = %d and flag_simmode = 0 ",
+ pkgname, internal_group_id);
+ }
+ }
+
+ snprintf(query, sizeof(query),
+ "%s %s "
+ "order by rowid desc, time desc", query_base, query_where);
+
+ ret = sqlite3_prepare(db, query, strlen(query), &stmt, NULL);
+ if (ret != SQLITE_OK) {
+ NOTIFICATION_ERR("Select Query : %s", query);
+ NOTIFICATION_ERR("Select DB error(%d) : %s", ret,
+ sqlite3_errmsg(db));
+
+ ret = NOTIFICATION_ERROR_FROM_DB;
+ goto err;
+ }
+
+ while (sqlite3_step(stmt) == SQLITE_ROW) {
+ /* Make notification list */
+ noti = _notification_noti_get_item(stmt);
+ if (noti != NULL) {
+ internal_count++;
+
+ get_list = notification_list_append(get_list, noti);
+
+ if (count != -1 && internal_count >= count) {
+ NOTIFICATION_INFO
+ ("internal count %d >= count %d",
+ internal_count, count);
+ break;
+ }
+ }
+ }
+
+ ret = NOTIFICATION_ERROR_NONE;
+
+err:
+ if (stmt) {
+ sqlite3_finalize(stmt);
+ }
+
+ /* Close DB */
+ if (db) {
+ notification_db_close(&db);
+ }
+
+ if (get_list != NULL) {
+ *list = notification_list_get_head(get_list);
+ }
+
+ return ret;
+}
+
+EXPORT_API int notification_noti_check_tag(notification_h noti)
+{
+ int result = 0;
+ int ret = NOTIFICATION_ERROR_NONE;
+ char *query = NULL;
+ sqlite3 *db;
+ sqlite3_stmt *stmt = NULL;
+
+ if (noti->tag == NULL) {
+ return NOTIFICATION_ERROR_NOT_EXIST_ID;
+ }
+
+ /* Open DB */
+ db = notification_db_open(DBPATH);
+ if (!db) {
+ return get_last_result();
+ }
+
+ ret = sqlite3_prepare_v2(db, "SELECT priv_id FROM noti_list WHERE caller_pkgname = ? and tag = ?", -1, &stmt, NULL);
+ if (ret != SQLITE_OK) {
+ NOTIFICATION_ERR("Error: %s\n", sqlite3_errmsg(db));
+ return NOTIFICATION_ERROR_OUT_OF_MEMORY;
+ }
+
+ ret = sqlite3_bind_text(stmt, 1, noti->caller_pkgname, -1, SQLITE_TRANSIENT);
+ if (ret != SQLITE_OK) {
+ NOTIFICATION_ERR("Error: %s\n", sqlite3_errmsg(db));
+ goto err;
+ }
+
+ ret = sqlite3_bind_text(stmt, 2, noti->tag, -1, SQLITE_TRANSIENT);
+ if (ret != SQLITE_OK) {
+ NOTIFICATION_ERR("Error: %s\n", sqlite3_errmsg(db));
+ goto err;
+ }
+
+/*
+ query = sqlite3_mprintf("select priv_id from noti_list where caller_pkgname = '%s' and tag = '%s'",
+ noti->caller_pkgname, noti->tag);
+ if (query == NULL) {
+ ret = NOTIFICATION_ERROR_OUT_OF_MEMORY;
+ goto err;
+ }
+
+ ret = sqlite3_prepare(db, query, strlen(query), &stmt, NULL);
+ if (ret != SQLITE_OK) {
+ NOTIFICATION_ERR("Get priv id DB err(%d) : %s", ret,
+ sqlite3_errmsg(db));
+ ret = NOTIFICATION_ERROR_FROM_DB;
+ goto err;
+ }
+*/
+ ret = sqlite3_step(stmt);
+ if (ret == SQLITE_ROW) {
+ result = sqlite3_column_int(stmt, 0);
+ } else {
+ result = 0;
+ }
+
+ sqlite3_finalize(stmt);
+
+ /* If result > 0, there is priv_id in DB */
+ if (result > 0) {
+ noti->priv_id = result;
+ ret = NOTIFICATION_ERROR_ALREADY_EXIST_ID;
+ } else {
+ ret = NOTIFICATION_ERROR_NOT_EXIST_ID;
+ }
+
+err:
+ if (query) {
+ sqlite3_free(query);
+ }
+
+ return ret;
+}
+
+static void
+popup_timeout_cb(void *data, Evas_Object *obj, void *event_info)
+{
+ Eina_List *list = NULL;
+ char *msg = NULL;
+ int count = 0;
+
+ evas_object_del(toast_popup);
+ toast_popup = NULL;
+ evas_object_del((Evas_Object *)data);
+
+ count = eina_list_count(toast_list);
+
+ if (count == 1){
+ msg = (char *)eina_list_data_get(toast_list);
+ free(msg);
+
+ eina_list_free(toast_list);
+ toast_list = NULL;
+ } else if (count > 1) {
+ msg = (char *)eina_list_data_get(toast_list);
+ toast_list = eina_list_remove(toast_list, msg);
+ free(msg);
+ _post_toast_message((char *)eina_list_data_get(toast_list));
+ }
+}
+
+int _post_toast_message(char *message)
+{
+ int let = 0;
+ Evas_Object *toast_window;
+ Evas *e;
+ Ecore_Evas *ee;
+ double scale = elm_config_scale_get();
+
+
+ toast_window = elm_win_add(NULL, "toast", ELM_WIN_BASIC);
+
+ elm_win_alpha_set(toast_window, EINA_TRUE);
+ elm_win_title_set(toast_window, "toast");
+
+ elm_win_indicator_mode_set(toast_window, ELM_WIN_INDICATOR_SHOW);
+ elm_win_indicator_type_set(toast_window,ELM_WIN_INDICATOR_TYPE_1);
+
+ //elm_win_autodel_set(toast_win, EINA_TRUE);
+ if (elm_win_wm_rotation_supported_get(toast_window)) {
+ int rots[4] = { 0, 90, 180, 270 };
+ elm_win_wm_rotation_available_rotations_set(toast_window, (const int*)(&rots), 4);
+ }
+
+ e = evas_object_evas_get(toast_window);
+ ee = ecore_evas_ecore_evas_get(e);
+ ecore_evas_name_class_set(ee, "TOAST_POPUP", "SYSTEM_POPUP");
+
+ evas_object_resize(toast_window, (480 * scale), (650 * scale));
+ ecore_x_window_shape_input_rectangle_set(elm_win_xwindow_get(toast_window), 0, 0, (480 * scale), (650 * scale));
+
+ toast_popup = elm_popup_add(toast_window);
+
+ elm_object_style_set(toast_popup, "toast");
+ evas_object_size_hint_weight_set(toast_popup, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
+
+ elm_object_part_text_set(toast_popup,"elm.text", message);
+
+ if (eina_list_count(toast_list) != 1) {
+ elm_popup_timeout_set(toast_popup, 1.0);
+ }
+ else {
+ elm_popup_timeout_set(toast_popup, 3.0);
+ }
+ evas_object_smart_callback_add(toast_popup, "timeout", popup_timeout_cb, (void *)toast_window);
+
+ elm_win_prop_focus_skip_set(toast_window, EINA_TRUE);
+
+ evas_object_show(toast_window);
+ evas_object_show(toast_popup);
+
+ return 0;
+}
+
+EXPORT_API int notification_noti_post_toast_message(const char *message)
+{
+ int let = 0;
+ char *msg = NULL;
+ int count = 0;
+
+ msg = (char *)calloc(strlen(message) + 1, sizeof(char));
+ strcpy(msg, message);
+
+/*
+ if (eina_list_count(toast_list) == 10) {
+ toast_list = eina_list_last(toast_list);
+ eina_list_data_set(toast_list, msg);
+ toast_list = eina_list_nth_list(toast_list, 0);
+ }
+ else {
+*/
+
+ count = eina_list_count(toast_list);
+ if (count == 0) {
+ toast_list = eina_list_append(toast_list, msg);
+ let = _post_toast_message(msg);
+ }
+ else if (count == 1) {
+ if (strcmp(msg, (char *)eina_list_nth(toast_list, count - 1)) == 0) {
+ elm_popup_timeout_set(toast_popup, 3.0);
+ }
+ else {
+ toast_list = eina_list_append(toast_list, msg);
+ elm_popup_timeout_set(toast_popup, 1.0);
+ }
+ }
+ else if (count >= 2) {
+ if (strcmp(msg, (char *)eina_list_nth(toast_list, count - 1)) == 0) {
+ free(msg);
+ return 0;
+ }
+ else {
+ toast_list = eina_list_append(toast_list, msg);
+ }
+ }
+
+ return 0;
+}
diff --git a/src/notification_ongoing.c b/src/notification_ongoing.c
new file mode 100644
index 0000000..f67665a
--- /dev/null
+++ b/src/notification_ongoing.c
@@ -0,0 +1,175 @@
+/*
+ * libnotification
+ *
+ * Copyright (c) 2000 - 2011 Samsung Electronics Co., Ltd. All rights reserved.
+ *
+ * Contact: Seungtaek Chung <seungtaek.chung@samsung.com>, Mi-Ju Lee <miju52.lee@samsung.com>, Xi Zhichan <zhichan.xi@samsung.com>
+ *
+ * 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 <string.h>
+#include <stdlib.h>
+
+#include <dbus/dbus.h>
+
+#include <notification_db.h>
+#include <notification_debug.h>
+#include <notification_ongoing.h>
+#include <notification_private.h>
+
+int notification_ongoing_update_progress(const char *caller_pkgname,
+ int priv_id,
+ double progress)
+{
+ DBusConnection *connection = NULL;
+ DBusMessage *signal = NULL;
+ DBusError err;
+ dbus_bool_t ret;
+
+ dbus_error_init(&err);
+ connection = dbus_bus_get(DBUS_BUS_SYSTEM, &err);
+ if (!connection) {
+ NOTIFICATION_ERR("Fail to dbus_bus_get");
+ return NOTIFICATION_ERROR_FROM_DBUS;
+ }
+
+ signal =
+ dbus_message_new_signal("/dbus/signal", "notification.ongoing",
+ "update_progress");
+ if (!signal) {
+ NOTIFICATION_ERR("Fail to dbus_message_new_signal");
+ return NOTIFICATION_ERROR_FROM_DBUS;
+ }
+
+ ret = dbus_message_append_args(signal,
+ DBUS_TYPE_STRING, &caller_pkgname,
+ DBUS_TYPE_INT32, &priv_id,
+ DBUS_TYPE_DOUBLE, &progress,
+ DBUS_TYPE_INVALID);
+
+ if (ret) {
+ ret = dbus_connection_send(connection, signal, NULL);
+ if (ret) {
+ dbus_connection_flush(connection);
+ }
+ }
+
+ dbus_message_unref(signal);
+
+ if (ret) {
+ return NOTIFICATION_ERROR_NONE;
+ }
+
+ return NOTIFICATION_ERROR_FROM_DBUS;
+}
+
+int notification_ongoing_update_size(const char *caller_pkgname,
+ int priv_id, double size)
+{
+ DBusConnection *connection = NULL;
+ DBusMessage *signal = NULL;
+ DBusError err;
+ dbus_bool_t ret;
+
+ dbus_error_init(&err);
+ connection = dbus_bus_get(DBUS_BUS_SYSTEM, &err);
+ if (!connection) {
+ NOTIFICATION_ERR("Fail to dbus_bus_get");
+ return NOTIFICATION_ERROR_FROM_DBUS;
+ }
+
+ signal =
+ dbus_message_new_signal("/dbus/signal", "notification.ongoing",
+ "update_size");
+ if (!signal) {
+ NOTIFICATION_ERR("Fail to dbus_message_new_signal");
+ return NOTIFICATION_ERROR_FROM_DBUS;
+ }
+
+ ret = dbus_message_append_args(signal,
+ DBUS_TYPE_STRING, &caller_pkgname,
+ DBUS_TYPE_INT32, &priv_id,
+ DBUS_TYPE_DOUBLE, &size,
+ DBUS_TYPE_INVALID);
+ if (ret) {
+ ret = dbus_connection_send(connection, signal, NULL);
+
+ if (ret) {
+ dbus_connection_flush(connection);
+ }
+ }
+
+ dbus_message_unref(signal);
+
+ if (ret) {
+ return NOTIFICATION_ERROR_NONE;
+ }
+
+ return NOTIFICATION_ERROR_FROM_DBUS;
+}
+
+int notification_ongoing_update_content(const char *caller_pkgname,
+ int priv_id, const char *content)
+{
+ DBusConnection *connection = NULL;
+ DBusMessage *signal = NULL;
+ DBusError err;
+ dbus_bool_t ret;
+
+ dbus_error_init(&err);
+ connection = dbus_bus_get(DBUS_BUS_SYSTEM, &err);
+ if (!connection) {
+ NOTIFICATION_ERR("Fail to dbus_bus_get");
+ return NOTIFICATION_ERROR_FROM_DBUS;
+ }
+
+ signal =
+ dbus_message_new_signal("/dbus/signal", "notification.ongoing",
+ "update_content");
+ if (!signal) {
+ NOTIFICATION_ERR("Fail to dbus_message_new_signal");
+ return NOTIFICATION_ERROR_FROM_DBUS;
+ }
+
+ if(content == NULL) {
+ ret = dbus_message_append_args(signal,
+ DBUS_TYPE_STRING, &caller_pkgname,
+ DBUS_TYPE_INT32, &priv_id,
+ DBUS_TYPE_INVALID);
+ } else {
+ ret = dbus_message_append_args(signal,
+ DBUS_TYPE_STRING, &caller_pkgname,
+ DBUS_TYPE_INT32, &priv_id,
+ DBUS_TYPE_STRING, &content,
+ DBUS_TYPE_INVALID);
+ }
+ if (ret) {
+ ret = dbus_connection_send(connection, signal, NULL);
+
+ if (ret) {
+ dbus_connection_flush(connection);
+ }
+ }
+
+ dbus_message_unref(signal);
+
+ if (ret) {
+ return NOTIFICATION_ERROR_NONE;
+ }
+
+ return NOTIFICATION_ERROR_FROM_DBUS;
+}
+
diff --git a/src/notification_permission.c b/src/notification_permission.c
new file mode 100644
index 0000000..c9de272
--- /dev/null
+++ b/src/notification_permission.c
@@ -0,0 +1,65 @@
+/*
+ * libnotification
+ *
+ * Copyright (c) 2000 - 2011 Samsung Electronics Co., Ltd. All rights reserved.
+ *
+ * Contact: Seungtaek Chung <seungtaek.chung@samsung.com>, Mi-Ju Lee <miju52.lee@samsung.com>, Xi Zhichan <zhichan.xi@samsung.com>
+ *
+ * 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 <string.h>
+#include <stdlib.h>
+#include <db-util.h>
+
+#include <notification.h>
+#include <notification_db.h>
+#include <notification_noti.h>
+#include <notification_debug.h>
+#include <notification_ipc.h>
+#include <notification_private.h>
+
+#define NOTIFICATION_DB_ACCESS_READ 0
+#define NOTIFICATION_DB_ACCESS_WRITE 1
+
+#if 0
+int notification_permission_check_by_pid(const char *noti_pkgname, int pid, int access) {
+ int ret = 0;
+ char pkgname[512 + 1] = { 0, };
+ bool preload = false;
+ package_manager_compare_result_type_e compare_result;
+
+ //get pkgname by pid
+ const char *pkgname = aul_app_get_pkgname_bypid(pid);
+ ret = aul_app_get_pkgname_bypid(pid, pkgname, sizeof(pkgname));
+ if (ret == AUL_R_OK) {
+ if (strcmp(pkgname, noti_pkgname) == 0) {
+ return NOTIFICATION_ERROR_NONE;
+ }
+
+ package_manager_is_preload_package_by_app_id(pkgname, &preload);
+ if (preload == true) {
+ return NOTIFICATION_ERROR_NONE;
+ }
+
+ package_manager_compare_package_cert_info(noti_pkgname, &compare_result);
+ if (compare_result == PACKAGE_MANAGER_COMPARE_MATCH ) {
+ return NOTIFICATION_ERROR_NONE;
+ }
+ }
+
+ return NOTIFICATION_ERROR_PERMISSION_DENIED;
+}
+#endif \ No newline at end of file
diff --git a/src/notification_setting.c b/src/notification_setting.c
new file mode 100644
index 0000000..6e532c0
--- /dev/null
+++ b/src/notification_setting.c
@@ -0,0 +1,343 @@
+/*
+ * libnotification
+ *
+ * Copyright (c) 2000 - 2011 Samsung Electronics Co., Ltd. All rights reserved.
+ *
+ * Contact: Seungtaek Chung <seungtaek.chung@samsung.com>, Mi-Ju Lee <miju52.lee@samsung.com>, Xi Zhichan <zhichan.xi@samsung.com>
+ *
+ * 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 <string.h>
+#include <stdlib.h>
+#include <db-util.h>
+
+#include <notification.h>
+#include <notification_db.h>
+#include <notification_noti.h>
+#include <notification_debug.h>
+#include <notification_ipc.h>
+#include <notification_private.h>
+
+#define NOTIFICATION_SETTING_DB "notification_setting"
+#define NOTIFICATION_SETTING_DB_PATH "/opt/usr/dbspace/.notification_parser.db"
+
+typedef struct _notification_setting_h notification_setting_h;
+
+struct _notification_setting_h {
+ char *appid;
+ char *notification;
+ char *sounds;
+ char *contents;
+ char *badge;
+ char *pkgid;
+};
+
+struct prop_table {
+ const char *property;
+ const char *column;
+ const char *default_value;
+};
+
+static struct prop_table g_prop_table[] = {
+ {
+ .property = "OPT_NOTIFICATION",
+ .column = "notification",
+ .default_value = "ON",
+ },
+ {
+ .property = "OPT_SOUNDS",
+ .column = "sounds",
+ .default_value = "ON",
+ },
+ {
+ .property = "OPT_CONTENTS",
+ .column = "contents",
+ .default_value = "ON",
+ },
+ {
+ .property = "OPT_BADGE",
+ .column = "badge",
+ .default_value = "ON",
+ },
+ {
+ .property = NULL,
+ .column = NULL,
+ .default_value = NULL,
+ }
+};
+
+static const char *_get_prop_column(const char *property)
+{
+ int i;
+
+ for (i = 0; g_prop_table[i].property; i++) {
+ if (strcmp(g_prop_table[i].property, property))
+ continue;
+
+ return g_prop_table[i].column;
+ }
+
+ return NULL;
+}
+
+#ifdef TBD
+static const char *_get_prop_default_value(const char *property)
+{
+ int i;
+
+ for (i = 0; g_prop_table[i].property; i++) {
+ if (strcmp(g_prop_table[i].property, property))
+ continue;
+
+ return g_prop_table[i].default_value;
+ }
+
+ return NULL;
+}
+#endif
+
+static int _is_record_exist(const char *pkgname, sqlite3 *db)
+{
+ sqlite3_stmt *stmt = NULL;
+ int count = 0;
+ int result = NOTIFICATION_ERROR_NONE;
+ char *sqlbuf = NULL;
+ int sqlret;
+
+ if (!pkgname)
+ return NOTIFICATION_ERROR_INVALID_PARAMETER;
+
+ if (!db)
+ return NOTIFICATION_ERROR_INVALID_PARAMETER;
+
+ sqlbuf = sqlite3_mprintf("SELECT count(*) FROM %s WHERE " \
+ "appid = %Q",
+ NOTIFICATION_SETTING_DB, pkgname);
+
+ if (!sqlbuf) {
+ NOTIFICATION_ERR("fail to alloc sql query");
+ return NOTIFICATION_ERROR_OUT_OF_MEMORY;
+ }
+
+ sqlret = sqlite3_prepare_v2(db, sqlbuf, -1, &stmt, NULL);
+ if (sqlret != SQLITE_OK) {
+ NOTIFICATION_ERR("DB err [%s]", sqlite3_errmsg(db));
+ NOTIFICATION_ERR("query[%s]", sqlbuf);
+ result = NOTIFICATION_ERROR_FROM_DB;
+ goto free_and_return;
+ }
+
+ sqlret = sqlite3_step(stmt);
+ if (sqlret == SQLITE_ROW)
+ count = sqlite3_column_int(stmt, 0);
+ else
+ count = 0;
+
+ if (count > 0)
+ result = NOTIFICATION_ERROR_ALREADY_EXIST_ID;
+ else
+ result = NOTIFICATION_ERROR_NOT_EXIST_ID;
+
+free_and_return:
+ if (sqlbuf)
+ sqlite3_free(sqlbuf);
+
+ if (stmt)
+ sqlite3_finalize(stmt);
+
+ return result;
+}
+
+EXPORT_API int notification_setting_db_set(const char *pkgname, const char *property, const char *value)
+{
+ int ret = NOTIFICATION_ERROR_NONE;
+ int result = NOTIFICATION_ERROR_NONE;
+ sqlite3 *db = NULL;
+ char *sqlbuf = NULL;
+ int sqlret;
+ const char *column = NULL;
+
+ if (!pkgname)
+ return NOTIFICATION_ERROR_INVALID_PARAMETER;
+
+ if (!property)
+ return NOTIFICATION_ERROR_INVALID_PARAMETER;
+
+ if (!value)
+ return NOTIFICATION_ERROR_INVALID_PARAMETER;
+
+ column = _get_prop_column(property);
+ if (!column)
+ return NOTIFICATION_ERROR_INVALID_PARAMETER;
+
+ sqlret = db_util_open(NOTIFICATION_SETTING_DB_PATH, &db, 0);
+ if (sqlret != SQLITE_OK || !db) {
+ NOTIFICATION_ERR("fail to db_util_open - [%d]", sqlret);
+ return NOTIFICATION_ERROR_FROM_DB;
+ }
+
+ ret = _is_record_exist(pkgname, db);
+ if (ret != NOTIFICATION_ERROR_ALREADY_EXIST_ID) {
+ result = ret;
+ goto return_close_db;
+ }
+
+ sqlbuf = sqlite3_mprintf("UPDATE %s SET %s = %Q " \
+ "WHERE appid = %Q",
+ NOTIFICATION_SETTING_DB, column, value, pkgname);
+ if (!sqlbuf) {
+ NOTIFICATION_ERR("fail to alloc query");
+ result = NOTIFICATION_ERROR_OUT_OF_MEMORY;
+ goto return_close_db;
+ }
+
+ result = notification_db_exec(db, sqlbuf, NULL);
+
+return_close_db:
+ if (sqlbuf)
+ sqlite3_free(sqlbuf);
+
+ sqlret = db_util_close(db);
+ if (sqlret != SQLITE_OK) {
+ NOTIFICATION_WARN("fail to db_util_close - [%d]", sqlret);
+ }
+
+ return result;
+}
+
+EXPORT_API int notification_setting_db_get(const char *pkgname, const char *property, char **value)
+{
+ int ret = NOTIFICATION_ERROR_NONE;
+ int result = NOTIFICATION_ERROR_NONE;
+ sqlite3 *db = NULL;
+ char *sqlbuf = NULL;
+ sqlite3_stmt *stmt = NULL;
+ int sqlret;
+ const char *column = NULL;
+
+ if (!pkgname)
+ return NOTIFICATION_ERROR_INVALID_PARAMETER;
+
+ if (!property)
+ return NOTIFICATION_ERROR_INVALID_PARAMETER;
+
+ if (!value)
+ return NOTIFICATION_ERROR_INVALID_PARAMETER;
+
+ column = _get_prop_column(property);
+ if (!column)
+ return NOTIFICATION_ERROR_INVALID_PARAMETER;
+
+ sqlret = db_util_open(NOTIFICATION_SETTING_DB_PATH, &db, 0);
+ if (sqlret != SQLITE_OK || !db) {
+ NOTIFICATION_ERR("fail to db_util_open - [%d]", sqlret);
+ return NOTIFICATION_ERROR_FROM_DB;
+ }
+
+ ret = _is_record_exist(pkgname, db);
+ if (ret != NOTIFICATION_ERROR_ALREADY_EXIST_ID) {
+ result = ret;
+ goto return_close_db;
+ }
+
+ sqlbuf = sqlite3_mprintf("SELECT %s FROM %s " \
+ "WHERE appid = %Q",
+ column, NOTIFICATION_SETTING_DB, pkgname);
+ if (!sqlbuf) {
+ NOTIFICATION_ERR("fail to alloc query");
+ result = NOTIFICATION_ERROR_OUT_OF_MEMORY;
+ goto return_close_db;
+ }
+
+ sqlret = sqlite3_prepare_v2(db, sqlbuf, -1, &stmt, NULL);
+ if (sqlret != SQLITE_OK) {
+ NOTIFICATION_ERR("fail to prepare %s - [%s]",
+ sqlbuf, sqlite3_errmsg(db));
+ result = NOTIFICATION_ERROR_FROM_DB;
+ goto return_close_db;
+ }
+
+ sqlret = sqlite3_step(stmt);
+ if (sqlret == SQLITE_ROW) {
+ int get_bytes = sqlite3_column_bytes(stmt, 0);
+ char *get_data = (char *)calloc(get_bytes + 1, sizeof(char));
+ if (get_data != NULL) {
+ memcpy(get_data, sqlite3_column_text(stmt, 0),
+ get_bytes * sizeof(char));
+ get_data[get_bytes] = '\0';
+ *value = get_data;
+ } else {
+ NOTIFICATION_ERR("fail to alloc query");
+ result = NOTIFICATION_ERROR_OUT_OF_MEMORY;
+ goto return_close_db;
+ }
+ }
+
+return_close_db:
+ if (sqlbuf)
+ sqlite3_free(sqlbuf);
+
+ if (stmt)
+ sqlite3_finalize(stmt);
+
+ sqlret = db_util_close(db);
+ if (sqlret != SQLITE_OK)
+ NOTIFICATION_WARN("fail to db_util_close - [%d]", sqlret);
+
+ return result;
+}
+
+EXPORT_API int notification_setting_property_set(const char *pkgname, const char *property, const char *value)
+{
+ int ret = 0;
+
+ if (!pkgname)
+ return NOTIFICATION_ERROR_INVALID_PARAMETER;
+
+ if (!property)
+ return NOTIFICATION_ERROR_INVALID_PARAMETER;
+
+ if (!value)
+ return NOTIFICATION_ERROR_INVALID_PARAMETER;
+
+ ret = notification_ipc_noti_setting_property_set(pkgname, property, value);
+ if (ret != NOTIFICATION_ERROR_NONE) {
+ return ret;
+ }
+
+ return NOTIFICATION_ERROR_NONE;
+}
+
+EXPORT_API int notification_setting_property_get(const char *pkgname, const char *property, char **value)
+{
+ int ret = 0;
+
+ if (!pkgname)
+ return NOTIFICATION_ERROR_INVALID_PARAMETER;
+
+ if (!property)
+ return NOTIFICATION_ERROR_INVALID_PARAMETER;
+
+ if (!value)
+ return NOTIFICATION_ERROR_INVALID_PARAMETER;
+
+ ret = notification_ipc_noti_setting_property_get(pkgname, property, value);
+ if (ret != NOTIFICATION_ERROR_NONE) {
+ return ret;
+ }
+
+ return NOTIFICATION_ERROR_NONE;
+}
diff --git a/src/notification_status.c b/src/notification_status.c
new file mode 100644
index 0000000..5071851
--- /dev/null
+++ b/src/notification_status.c
@@ -0,0 +1,193 @@
+/*
+ * libnotification
+ *
+ * Copyright (c) 2000 - 2011 Samsung Electronics Co., Ltd. All rights reserved.
+ *
+ * Contact: Seungtaek Chung <seungtaek.chung@samsung.com>, Mi-Ju Lee <miju52.lee@samsung.com>, Xi Zhichan <zhichan.xi@samsung.com>
+ *
+ * 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 <sys/types.h>
+#include <unistd.h>
+#include <stdio.h>
+#include <string.h>
+#include <errno.h>
+#include <vconf.h>
+#include <E_DBus.h>
+
+#include <notification.h>
+#include <notification_db.h>
+#include <notification_noti.h>
+#include <notification_debug.h>
+#include <notification_private.h>
+#include <notification_status.h>
+
+#define PATH_NAME "/Org/Tizen/System/Notification/Status_message"
+#define INTERFACE_NAME "org.tizen.system.notification.status_message"
+#define MEMBER_NAME "status_message"
+
+struct _message_cb_data {
+ notification_status_message_cb callback;
+ void *data;
+ E_DBus_Connection *dbus_connection;
+ E_DBus_Signal_Handler *dbus_hdlr;
+};
+
+static struct _message_cb_data md;
+
+static void __notification_status_message_dbus_callback(void *data, DBusMessage *msg)
+{
+ int ret = 0;
+ DBusError err;
+ char *message = NULL;
+
+ if(data==NULL||msg==NULL)
+ {
+ NOTIFICATION_ERR("message is NULL");
+ return;
+ }
+
+ dbus_error_init(&err);
+ ret = dbus_message_get_args(msg, &err,
+ DBUS_TYPE_STRING, &message,
+ DBUS_TYPE_INVALID);
+ if(ret == 0)
+ {
+ NOTIFICATION_ERR("dbus_message_get_args error");
+ return;
+ }
+
+ if (dbus_error_is_set(&err)) {
+ NOTIFICATION_ERR("Dbus err: %s", err.message);
+ dbus_error_free(&err);
+ return;
+ }
+ /*if (!md.callback)
+ return;
+
+ if (strlen(message) <= 0){
+ NOTIFICATION_ERR("message has only NULL");
+ return;
+ }
+
+ md.callback(message, md.data);*/
+
+ notification_noti_post_toast_message(message);
+}
+
+EXPORT_API
+int notification_status_message_post(const char *message)
+{
+ DBusConnection *connection = NULL;
+ DBusMessage *signal = NULL;
+ DBusError err;
+ dbus_bool_t ret;
+
+ if (!message) {
+ NOTIFICATION_ERR("message is NULL");
+ return NOTIFICATION_ERROR_INVALID_PARAMETER;
+ }
+
+ if (strlen(message) <= 0) {
+ NOTIFICATION_ERR("message has only NULL");
+ return NOTIFICATION_ERROR_INVALID_PARAMETER;
+ }
+
+ dbus_error_init(&err);
+ connection = dbus_bus_get(DBUS_BUS_SYSTEM, &err);
+ if (!connection) {
+ NOTIFICATION_ERR("Fail to dbus_bus_get");
+ return NOTIFICATION_ERROR_FROM_DBUS;
+ }
+
+ signal =
+ dbus_message_new_signal(PATH_NAME, INTERFACE_NAME,
+ MEMBER_NAME);
+ if (!signal) {
+ NOTIFICATION_ERR("Fail to dbus_message_new_signal");
+ return NOTIFICATION_ERROR_FROM_DBUS;
+ }
+
+ ret = dbus_message_append_args(signal,
+ DBUS_TYPE_STRING, &message,
+ DBUS_TYPE_INVALID);
+ if (ret) {
+ ret = dbus_connection_send(connection, signal, NULL);
+
+ if (ret) {
+ dbus_connection_flush(connection);
+ }
+ }
+
+ dbus_message_unref(signal);
+ dbus_connection_unref(connection);
+
+ return NOTIFICATION_ERROR_NONE;
+}
+
+EXPORT_API
+int notification_status_monitor_message_cb_set(notification_status_message_cb callback, void *user_data)
+{
+ if (!callback)
+ return NOTIFICATION_ERROR_INVALID_PARAMETER;
+ E_DBus_Connection *dbus_connection;
+ E_DBus_Signal_Handler *dbus_handler_size = NULL;
+
+ e_dbus_init();
+ dbus_connection = e_dbus_bus_get(DBUS_BUS_SYSTEM);
+ if (dbus_connection == NULL) {
+ NOTIFICATION_ERR("noti register : failed to get dbus bus");
+ return NOTIFICATION_ERROR_FROM_DBUS;
+ }
+ dbus_handler_size =
+ e_dbus_signal_handler_add(dbus_connection, NULL,
+ PATH_NAME,
+ INTERFACE_NAME, MEMBER_NAME,
+ __notification_status_message_dbus_callback,
+ user_data);
+ if (dbus_handler_size == NULL)
+ {
+ NOTIFICATION_ERR("fail to add size signal");
+ return NOTIFICATION_ERROR_FROM_DBUS;
+ }
+
+
+ md.callback = callback;
+ md.data = user_data;
+ md.dbus_connection = dbus_connection;
+ md.dbus_hdlr = dbus_handler_size;
+
+ return NOTIFICATION_ERROR_NONE;
+}
+
+EXPORT_API
+int notification_status_monitor_message_cb_unset(void)
+{
+ if (md.dbus_hdlr != NULL) {
+ e_dbus_signal_handler_del(md.dbus_connection,
+ md.dbus_hdlr);
+ md.dbus_hdlr = NULL;
+ }
+ if (md.dbus_connection != NULL) {
+ e_dbus_connection_close(md.dbus_connection);
+ md.dbus_connection = NULL;
+ e_dbus_shutdown();
+ }
+
+ md.callback = NULL;
+ md.data = NULL;
+
+ return NOTIFICATION_ERROR_NONE;
+}
diff --git a/test-app/CMakeLists.txt b/test-app/CMakeLists.txt
new file mode 100644
index 0000000..5d09def
--- /dev/null
+++ b/test-app/CMakeLists.txt
@@ -0,0 +1,44 @@
+CMAKE_MINIMUM_REQUIRED(VERSION 2.6)
+PROJECT(notification C)
+
+SET(CMAKE_SKIP_BUILD_RPATH TRUE)
+
+IF("${CMAKE_BUILD_TYPE}" STREQUAL "")
+ SET(CMAKE_BUILD_TYPE "Debug")
+ENDIF("${CMAKE_BUILD_TYPE}" STREQUAL "")
+
+MESSAGE("")
+MESSAGE(">>> current directory: ${CMAKE_CURRENT_SOURCE_DIR}")
+MESSAGE(">>> Build type: ${CMAKE_BUILD_TYPE}")
+
+SET(VISIBILITY "-DEXPORT_API=\"__attribute__((visibility(\\\"default\\\")))\"")
+SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${VISIBILITY} -fvisibility=hidden")
+SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wl,--gc-sections -fPIC")
+
+##########################################################
+# Define Test App
+##########################################################
+
+SET(TEST-APP-SRCS
+ ${CMAKE_SOURCE_DIR}/test-app/main.c
+)
+
+INCLUDE_DIRECTORIES(
+ ${CMAKE_SOURCE_DIR}/include
+)
+
+INCLUDE(FindPkgConfig)
+pkg_check_modules(test_app_pkgs REQUIRED glib-2.0 gthread-2.0 vconf appsvc capi-appfw-application)
+
+FOREACH(flag ${test_app_pkgs_CFLAGS})
+ SET(EXTRA_CFLAGS "${EXTRA_CFLAGS} ${flag}")
+ENDFOREACH(flag)
+
+SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${EXTRA_CFLAGS}")
+SET(CMAKE_EXE_LINKER_FLAGS "-Wl,--as-needed -pie ")
+
+ADD_EXECUTABLE(notification-test-app ${TEST-APP-SRCS})
+TARGET_LINK_LIBRARIES(notification-test-app ${test_app_pkgs_LDFLAGS} notification)
+
+# INSTALL(TARGETS notification-test-app DESTINATION bin)
+
diff --git a/test-app/main.c b/test-app/main.c
new file mode 100644
index 0000000..229219a
--- /dev/null
+++ b/test-app/main.c
@@ -0,0 +1,406 @@
+/*
+ * Test application for notification API
+ *
+ * Copyright (c) 2015 Samsung Electronics Co., Ltd. All rights reserved.
+ *
+ * Contact: Kyuho Jo <kyuho.jo@samsung.com>
+ *
+ * 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.
+ *
+ */
+
+
+
+/* common header */
+#include <stdio.h>
+#include <stdlib.h>
+#include <signal.h>
+#include <sys/time.h>
+#include <unistd.h>
+
+/* open header */
+#include <glib.h>
+
+/* notification header */
+#include <notification.h>
+#include <notification_status.h>
+
+/*-----------------------------------------------------------------------------------------*/
+/* types */
+typedef enum testapp_menu_type {
+ TESTAPP_MENU_TYPE_MAIN_MENU = 1,
+ TESTAPP_MENU_TYPE_BASIC_TEST_MENU = 2,
+} testapp_menu_type_e;
+
+/*-----------------------------------------------------------------------------------------*/
+/* function prototypes */
+static void testapp_system_signal_handler (int signal_number);
+void testapp_show_prompt (testapp_menu_type_e menu);
+
+/*-----------------------------------------------------------------------------------------*/
+/* implementation */
+void testapp_print (char *fmt, ...)
+{
+ va_list args = {0};
+ va_start(args, fmt);
+ vfprintf (stdout, fmt, args);
+ va_end (args);
+ fflush (stdout);
+}
+
+static gboolean testapp_initialize_testing ()
+{
+ struct timeval tv_1, tv_2;
+ int interval;
+
+ /* register signal handler */
+ if ( signal (SIGINT, testapp_system_signal_handler) == SIG_ERR ) {
+ testapp_print ("register signal handler fail\n");
+ return FALSE;
+ }
+
+ if ( signal (SIGQUIT, testapp_system_signal_handler) == SIG_ERR ) {
+ testapp_print ("register signal handler fail\n");
+ return FALSE;
+ }
+
+ if ( signal (SIGTSTP, testapp_system_signal_handler) == SIG_ERR ) {
+ testapp_print ("register signal handler fail\n");
+ return FALSE;
+ }
+
+ if ( signal (SIGTERM, testapp_system_signal_handler) == SIG_ERR ) {
+ testapp_print ("register signal handler fail\n");
+ return FALSE;
+ }
+
+
+ gettimeofday(&tv_1, NULL);
+
+ /* TODO : initializing notification */
+
+ gettimeofday(&tv_2, NULL);
+ interval = tv_2.tv_usec - tv_1.tv_usec;
+ testapp_print("\t Initializing Proceed time %d us\n",interval);
+
+
+ return TRUE;
+}
+
+static gboolean testapp_finalize_testing ()
+{
+ /* TODO : finalizing notification */
+
+ return TRUE;
+}
+
+static void testapp_system_signal_handler (int signal_number)
+{
+ testapp_print ("signal:%d\n", signal_number);
+ switch (signal_number) {
+ case SIGQUIT:
+ case SIGINT:
+ case SIGTSTP:
+ case SIGTERM:
+ testapp_finalize_testing();
+ break;
+
+ default:
+ testapp_print ("unhandled signal:%d\n", signal_number);
+ break;
+ }
+ exit(0);
+}
+
+
+
+
+void testapp_show_menu (testapp_menu_type_e menu)
+{
+ switch (menu) {
+ case TESTAPP_MENU_TYPE_MAIN_MENU:
+ testapp_print ("==========================================\n");
+ testapp_print (" Notification test application \n");
+ testapp_print ("==========================================\n");
+ testapp_print ("1. Basic Test\n");
+ testapp_print ("0. Exit \n");
+ testapp_print ("------------------------------------------\n");
+ break;
+ case TESTAPP_MENU_TYPE_BASIC_TEST_MENU:
+ testapp_print ("==========================================\n");
+ testapp_print (" Basic test menu \n");
+ testapp_print ("==========================================\n");
+ testapp_print (" 1. Post a simple notification\n");
+ testapp_print (" 2. Post simple notifications repeatedly\n");
+ testapp_print (" 3. Post a notification on indicator\n");
+ testapp_print (" 4. Post status status message\n");
+ testapp_print (" 5. Delete all notification\n");
+ testapp_print ("------------------------------------------\n");
+ break;
+ default:
+ break;
+ }
+}
+/* Common { ------------------------------------------------------------------*/
+
+static int testapp_add_a_notification()
+{
+ notification_h noti_handle = NULL;
+ int noti_err = NOTIFICATION_ERROR_NONE;
+
+ noti_handle = notification_create(NOTIFICATION_TYPE_NOTI);
+
+ if (noti_handle == NULL) {
+ testapp_print("notification_create failed");
+ goto FINISH_OFF;
+ }
+
+ noti_err = notification_set_text(noti_handle, NOTIFICATION_TEXT_TYPE_TITLE, "I'm Title", "TITLE", NOTIFICATION_VARIABLE_TYPE_NONE);
+ noti_err = notification_set_text(noti_handle, NOTIFICATION_TEXT_TYPE_CONTENT, "I'm Content", "CONTENT", NOTIFICATION_VARIABLE_TYPE_NONE);
+ noti_err = notification_set_text(noti_handle, NOTIFICATION_TEXT_TYPE_EVENT_COUNT, "3", "3", NOTIFICATION_VARIABLE_TYPE_NONE);
+ noti_err = notification_set_text(noti_handle, NOTIFICATION_TEXT_TYPE_INFO_1, "I'm Info 1", "INFO_1", NOTIFICATION_VARIABLE_TYPE_NONE);
+ noti_err = notification_set_text(noti_handle, NOTIFICATION_TEXT_TYPE_INFO_SUB_1, "I'm Info Sub 1", "INFO_SUB_1", NOTIFICATION_VARIABLE_TYPE_NONE);
+ noti_err = notification_set_text(noti_handle, NOTIFICATION_TEXT_TYPE_INFO_2, "I'm Info 2", "INFO_2", NOTIFICATION_VARIABLE_TYPE_NONE);
+ noti_err = notification_set_text(noti_handle, NOTIFICATION_TEXT_TYPE_INFO_SUB_2, "I'm Info Sub 2", "INFO_SUB_2", NOTIFICATION_VARIABLE_TYPE_NONE);
+ noti_err = notification_set_text(noti_handle, NOTIFICATION_TEXT_TYPE_INFO_3, "I'm Info 3", "INFO_3", NOTIFICATION_VARIABLE_TYPE_NONE);
+ noti_err = notification_set_text(noti_handle, NOTIFICATION_TEXT_TYPE_INFO_SUB_3, "I'm Info Sub 3", "INFO_SUB_3", NOTIFICATION_VARIABLE_TYPE_NONE);
+
+ noti_err = notification_post(noti_handle);
+
+ if (noti_err != NOTIFICATION_ERROR_NONE) {
+ testapp_print("notification_post failed[%d]", noti_err);
+ goto FINISH_OFF;
+ }
+
+FINISH_OFF:
+ if (noti_handle)
+ notification_free(noti_handle);
+
+ return noti_err;
+}
+
+/* Common } ------------------------------------------------------------------*/
+
+/* Basic Test { --------------------------------------------------------------*/
+static int testapp_test_post_notification()
+{
+ int err = NOTIFICATION_ERROR_NONE;
+
+ if ((err = testapp_add_a_notification()) != NOTIFICATION_ERROR_NONE) {
+ testapp_print("testapp_add_a_notification failed[%d]", err);
+ goto FINISH_OFF;
+ }
+
+
+FINISH_OFF:
+
+ return err;
+}
+
+static int testapp_test_post_notifications()
+{
+ int err = NOTIFICATION_ERROR_NONE;
+ int repeat_count = 0;
+ int i = 0;
+
+ testapp_print("Input count : ");
+
+ if (0 >= scanf("%d", &repeat_count))
+ testapp_print("Invalid input");
+
+ for (i = 0; i < repeat_count; i++) {
+ if ((err = testapp_add_a_notification()) != NOTIFICATION_ERROR_NONE) {
+ testapp_print("testapp_add_a_notification failed[%d]", err);
+ goto FINISH_OFF;
+ }
+ }
+
+
+FINISH_OFF:
+ return err;
+}
+
+static int testapp_test_post_notification_on_indicator()
+{
+ notification_h noti_handle = NULL;
+ int noti_err = NOTIFICATION_ERROR_NONE;
+
+ noti_handle = notification_create(NOTIFICATION_TYPE_NOTI);
+
+ if (noti_handle == NULL) {
+ testapp_print("notification_create failed");
+ goto FINISH_OFF;
+ }
+
+ noti_err = notification_set_text(noti_handle, NOTIFICATION_TEXT_TYPE_TITLE, "I'm Title", "TITLE", NOTIFICATION_VARIABLE_TYPE_NONE);
+ noti_err = notification_set_text(noti_handle, NOTIFICATION_TEXT_TYPE_CONTENT, "I'm Content", "CONTENT", NOTIFICATION_VARIABLE_TYPE_NONE);
+
+ noti_err = notification_set_display_applist(noti_handle, NOTIFICATION_DISPLAY_APP_INDICATOR);
+
+ if(noti_err != NOTIFICATION_ERROR_NONE) {
+ testapp_print("notification_set_display_applist failed[%d]", noti_err);
+ goto FINISH_OFF;
+ }
+
+ noti_err = notification_post(noti_handle);
+
+ if (noti_err != NOTIFICATION_ERROR_NONE) {
+ testapp_print("notification_post failed[%d]", noti_err);
+ goto FINISH_OFF;
+ }
+
+FINISH_OFF:
+ if (noti_handle)
+ notification_free(noti_handle);
+
+ return noti_err;
+}
+
+static int testapp_test_post_status_message()
+{
+ int noti_err = NOTIFICATION_ERROR_NONE;
+
+
+ noti_err = notification_status_message_post("This is only a test");
+
+ if(noti_err != NOTIFICATION_ERROR_NONE) {
+ testapp_print("notification_status_message_post failed[%d]", noti_err);
+ }
+
+ return noti_err;
+}
+
+static int testapp_test_delete_all_notifications()
+{
+ int noti_err = NOTIFICATION_ERROR_NONE;
+
+ noti_err = notification_delete_all(NOTIFICATION_TYPE_NOTI);
+
+ testapp_print("notification_delete_all returns[%d]", noti_err);
+
+ return noti_err;
+}
+
+static gboolean testapp_interpret_command_basic_test (int selected_number)
+{
+ gboolean go_to_loop = TRUE;
+
+ switch (selected_number) {
+ case 1:
+ testapp_test_post_notification();
+ break;
+
+ case 2:
+ testapp_test_post_notifications();
+ break;
+
+ case 3:
+ testapp_test_post_notification_on_indicator();
+ break;
+
+ case 4:
+ testapp_test_post_status_message();
+ break;
+
+ case 5:
+ testapp_test_delete_all_notifications();
+ break;
+
+ case 0:
+ go_to_loop = FALSE;
+ break;
+
+ default:
+ break;
+ }
+
+ return go_to_loop;
+
+}
+
+void testapp_notification_main ()
+{
+ gboolean go_to_loop = TRUE;
+ int menu_number = 0;
+
+ while (go_to_loop) {
+ testapp_show_menu (TESTAPP_MENU_TYPE_BASIC_TEST_MENU);
+ testapp_show_prompt (TESTAPP_MENU_TYPE_BASIC_TEST_MENU);
+
+ if (0 >= scanf("%d", &menu_number))
+ testapp_print("Invalid input");
+
+ go_to_loop = testapp_interpret_command_basic_test(menu_number);
+ }
+}
+/* Basic Test } ---------------------------------------------------------------*/
+
+
+/* Main { ---------------------------------------------------------------------*/
+static gboolean testapp_interpret_command (int menu_number)
+{
+ gboolean go_to_loop = TRUE;
+
+ switch (menu_number) {
+ case 1:
+ testapp_notification_main();
+ break;
+
+ case 0:
+ go_to_loop = FALSE;
+ break;
+
+ default:
+ break;
+ }
+
+ return go_to_loop;
+}
+
+void testapp_show_prompt (testapp_menu_type_e menu)
+{
+ switch (menu) {
+ case TESTAPP_MENU_TYPE_MAIN_MENU:
+ testapp_print ("[MAIN]# ");
+ break;
+
+ case TESTAPP_MENU_TYPE_BASIC_TEST_MENU:
+ testapp_print ("[BASIC_TEST]# ");
+ break;
+ }
+}
+
+int main (int argc, char *argv[])
+{
+ gboolean go_to_loop = TRUE;
+ int menu_number = 0;
+
+ if ( testapp_initialize_testing() == FALSE ) {
+ testapp_print ("Initializing failed.\n");
+ exit(0);
+ }
+
+ while (go_to_loop) {
+ testapp_show_menu (TESTAPP_MENU_TYPE_MAIN_MENU);
+ testapp_show_prompt (TESTAPP_MENU_TYPE_MAIN_MENU);
+ if (0 >= scanf ("%d", &menu_number))
+ testapp_print("Invalid input");
+ go_to_loop = testapp_interpret_command (menu_number);
+ }
+
+ testapp_finalize_testing();
+
+ exit(0);
+}
+/* Main } ---------------------------------------------------------------------*/
+