diff options
author | jongmyeong.ko <jongmyeong.ko@samsung.com> | 2014-10-29 10:35:08 +0900 |
---|---|---|
committer | jongmyeong.ko <jongmyeong.ko@samsung.com> | 2014-10-29 10:35:08 +0900 |
commit | 9a74462000fbaf906d4f82e181cc70792d926898 (patch) | |
tree | 4b825dc642cb6eb9a060e54bf8d69288fbee4904 | |
parent | 557468f2cbf7af856b07f3c0d55ecf475eededaf (diff) | |
download | shortcut-9a74462000fbaf906d4f82e181cc70792d926898.tar.gz shortcut-9a74462000fbaf906d4f82e181cc70792d926898.tar.bz2 shortcut-9a74462000fbaf906d4f82e181cc70792d926898.zip |
reset repo
Signed-off-by: jongmyeong.ko <jongmyeong.ko@samsung.com>
61 files changed, 0 insertions, 7009 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt deleted file mode 100644 index ea60a32..0000000 --- a/CMakeLists.txt +++ /dev/null @@ -1,6 +0,0 @@ -CMAKE_MINIMUM_REQUIRED(VERSION 2.6) - -set(CMAKE_SKIP_BUILD_RPATH true) - -ADD_SUBDIRECTORY("pkgmgr_shortcut") -ADD_SUBDIRECTORY("lib") diff --git a/TC/_export_env.sh b/TC/_export_env.sh deleted file mode 100644 index 7a317f8..0000000 --- a/TC/_export_env.sh +++ /dev/null @@ -1,10 +0,0 @@ -#!/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 deleted file mode 100644 index 3fd8e3f..0000000 --- a/TC/_export_target_env.sh +++ /dev/null @@ -1,9 +0,0 @@ -#!/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 deleted file mode 100755 index 72aad6c..0000000 --- a/TC/build.sh +++ /dev/null @@ -1,16 +0,0 @@ -#!/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 deleted file mode 100644 index 29743e0..0000000 --- a/TC/clean.sh +++ /dev/null @@ -1,11 +0,0 @@ -#!/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 deleted file mode 100644 index 3aebc04..0000000 --- a/TC/config +++ /dev/null @@ -1,3 +0,0 @@ -PKG_NAME=shortcut -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 deleted file mode 100755 index 5eb9510..0000000 --- a/TC/push.sh +++ /dev/null @@ -1,13 +0,0 @@ -#!/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/results/0001c/journal b/TC/results/0001c/journal deleted file mode 100644 index f5bb574..0000000 --- a/TC/results/0001c/journal +++ /dev/null @@ -1,26 +0,0 @@ -0|3.7-lite 04:05:41 20131227|User: root (0) TCC Start, Command line: /var/tmp/dts_fw/TETware/tetware-target/bin/tcc -c -p ./ -5|Linux nclinux 3.1.0-rc6 #5 SMP Sun Jan 20 00:39:54 KST 2013 armv7l|System Information -20|/var/tmp/dts_fw/./tetclean.cfg 2|Config Start -30||TET_OUTPUT_CAPTURE=True -30||TET_CLEAN_TOOL= make clean -30||TET_CLEAN_FILE= Makefile -30||TET_API_COMPLIANT=True -30||TET_PASS_TC_NAME=True -30||TET_VERSION=3.7-lite -40||Config End -300|0 /testcase/utc_livebox_service 04:05:41|Clean Start, scenario ref 1-0 -100|0|rm -f utc_livebox_service -100|0|make: Nothing to be done for `Makefile'. -100|0|cc -o utc_livebox_service utc_livebox_service.c -I. `pkg-config --cflags livebox glib-2.0` -I/var/tmp/dts_fw/TC/TETware/tetware-target/inc/tet3 -Wall `pkg-config --libs livebox glib-2.0` /var/tmp/dts_fw/TC/TETware/tetware-target/lib/tet3/tcm_s.o -L/var/tmp/dts_fw/TC/TETware/tetware-target/lib/tet3 -ltcm_s -L/var/tmp/dts_fw/TC/TETware/tetware-target/lib/tet3 -lapi_s -100|0|Package livebox was not found in the pkg-config search path. -100|0|Perhaps you should add the directory containing `livebox.pc' -100|0|to the PKG_CONFIG_PATH environment variable -100|0|No package 'livebox' found -100|0|Package livebox was not found in the pkg-config search path. -100|0|Perhaps you should add the directory containing `livebox.pc' -100|0|to the PKG_CONFIG_PATH environment variable -100|0|No package 'livebox' found -100|0|cc: error: /var/tmp/dts_fw/TC/TETware/tetware-target/lib/tet3/tcm_s.o: No such file or directory -100|0|make: *** [utc_livebox_service] Error 1 -320|0 2 04:05:42|Clean End, scenario ref 1-0 -900|04:05:42|TCC End diff --git a/TC/results/0004c/journal b/TC/results/0004c/journal deleted file mode 100644 index bc40ce8..0000000 --- a/TC/results/0004c/journal +++ /dev/null @@ -1,26 +0,0 @@ -0|3.7-lite 04:07:57 20131227|User: root (0) TCC Start, Command line: /var/tmp/dts_fw/TETware/tetware-target/bin/tcc -c -p ./ -5|Linux nclinux 3.1.0-rc6 #5 SMP Sun Jan 20 00:39:54 KST 2013 armv7l|System Information -20|/var/tmp/dts_fw/./tetclean.cfg 2|Config Start -30||TET_OUTPUT_CAPTURE=True -30||TET_CLEAN_TOOL= make clean -30||TET_CLEAN_FILE= Makefile -30||TET_API_COMPLIANT=True -30||TET_PASS_TC_NAME=True -30||TET_VERSION=3.7-lite -40||Config End -300|0 /testcase/utc_livebox_service 04:07:57|Clean Start, scenario ref 1-0 -100|0|rm -f utc_livebox_service -100|0|make: Nothing to be done for `Makefile'. -100|0|cc -o utc_livebox_service utc_livebox_service.c -I. `pkg-config --cflags livebox glib-2.0` -I/var/tmp/dts_fw/TC/TETware/tetware-target/inc/tet3 -Wall `pkg-config --libs livebox glib-2.0` /var/tmp/dts_fw/TC/TETware/tetware-target/lib/tet3/tcm_s.o -L/var/tmp/dts_fw/TC/TETware/tetware-target/lib/tet3 -ltcm_s -L/var/tmp/dts_fw/TC/TETware/tetware-target/lib/tet3 -lapi_s -100|0|Package livebox was not found in the pkg-config search path. -100|0|Perhaps you should add the directory containing `livebox.pc' -100|0|to the PKG_CONFIG_PATH environment variable -100|0|No package 'livebox' found -100|0|Package livebox was not found in the pkg-config search path. -100|0|Perhaps you should add the directory containing `livebox.pc' -100|0|to the PKG_CONFIG_PATH environment variable -100|0|No package 'livebox' found -100|0|cc: error: /var/tmp/dts_fw/TC/TETware/tetware-target/lib/tet3/tcm_s.o: No such file or directory -100|0|make: *** [utc_livebox_service] Error 1 -320|0 2 04:07:58|Clean End, scenario ref 1-0 -900|04:07:58|TCC End diff --git a/TC/results/0006c/journal b/TC/results/0006c/journal deleted file mode 100644 index 9684e35..0000000 --- a/TC/results/0006c/journal +++ /dev/null @@ -1,18 +0,0 @@ -0|3.7-lite 04:10:23 20131227|User: root (0) TCC Start, Command line: /var/tmp/dts_fw/TETware/tetware-target/bin/tcc -c -p ./ -5|Linux nclinux 3.1.0-rc6 #5 SMP Sun Jan 20 00:39:54 KST 2013 armv7l|System Information -20|/var/tmp/dts_fw/./tetclean.cfg 2|Config Start -30||TET_OUTPUT_CAPTURE=True -30||TET_CLEAN_TOOL= make clean -30||TET_CLEAN_FILE= Makefile -30||TET_API_COMPLIANT=True -30||TET_PASS_TC_NAME=True -30||TET_VERSION=3.7-lite -40||Config End -300|0 /testcase/utc_livebox_service 04:10:23|Clean Start, scenario ref 1-0 -100|0|rm -f utc_livebox_service -100|0|make: Nothing to be done for `Makefile'. -100|0|cc -o utc_livebox_service utc_livebox_service.c -I. `pkg-config --cflags livebox-service glib-2.0` -I/var/tmp/dts_fw/TC/TETware/tetware-target/inc/tet3 -Wall `pkg-config --libs livebox-service glib-2.0` /var/tmp/dts_fw/TC/TETware/tetware-target/lib/tet3/tcm_s.o -L/var/tmp/dts_fw/TC/TETware/tetware-target/lib/tet3 -ltcm_s -L/var/tmp/dts_fw/TC/TETware/tetware-target/lib/tet3 -lapi_s -100|0|cc: error: /var/tmp/dts_fw/TC/TETware/tetware-target/lib/tet3/tcm_s.o: No such file or directory -100|0|make: *** [utc_livebox_service] Error 1 -320|0 2 04:10:24|Clean End, scenario ref 1-0 -900|04:10:24|TCC End diff --git a/TC/results/0008c/journal b/TC/results/0008c/journal deleted file mode 100644 index 293043f..0000000 --- a/TC/results/0008c/journal +++ /dev/null @@ -1,21 +0,0 @@ -0|3.7-lite 04:12:13 20131227|User: root (0) TCC Start, Command line: /var/tmp/dts_fw/TETware/tetware-target/bin/tcc -c -p ./ -5|Linux nclinux 3.1.0-rc6 #5 SMP Sun Jan 20 00:39:54 KST 2013 armv7l|System Information -20|/var/tmp/dts_fw/./tetclean.cfg 2|Config Start -30||TET_OUTPUT_CAPTURE=True -30||TET_CLEAN_TOOL= make clean -30||TET_CLEAN_FILE= Makefile -30||TET_API_COMPLIANT=True -30||TET_PASS_TC_NAME=True -30||TET_VERSION=3.7-lite -40||Config End -300|0 /testcase/utc_livebox_service 04:12:13|Clean Start, scenario ref 1-0 -100|0|rm -f utc_livebox_service -100|0|make: Nothing to be done for `Makefile'. -100|0|cc -o utc_livebox_service utc_livebox_service.c -I. `pkg-config --cflags livebox-service glib-2.0` -I/var/tmp/dts_fw/TC/TETware/tetware-target/inc/tet3 -Wall `pkg-config --libs livebox-service glib-2.0` -100|0|utc_livebox_service.c:18:21: fatal error: tet_api.h: No such file or directory -100|0| #include <tet_api.h> -100|0| ^ -100|0|compilation terminated. -100|0|make: *** [utc_livebox_service] Error 1 -320|0 2 04:12:14|Clean End, scenario ref 1-0 -900|04:12:14|TCC End diff --git a/TC/results/build-tar-result-1388117141.html b/TC/results/build-tar-result-1388117141.html deleted file mode 100644 index 4785644..0000000 --- a/TC/results/build-tar-result-1388117141.html +++ /dev/null @@ -1,94 +0,0 @@ -<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN" - "http://www.w3.org/TR/REC-html40/loose.dtd"> -<html> -<head> -<title>TETware Test Run Report</title> -</head> -<body bgcolor="white"> -<p><table border="1" width="100%" cellpadding="3" cellspacing="0"> -<tr><td bgcolor="#ccccff" class="heading1"><center><h1> -TETware Test Run Report</h1></center></td></tr></table></p> -<p><table border="0" cellpadding="2" cellspacing="1"> -<tr> -<td align="left" class="noborder">TETware version:</td> -<td align="left" class="noborder">3.7-lite</td> -</tr> -<tr> -<td align="left" class="noborder">System Information:</td> -<td align="left" class="noborder">Linux nclinux 3.1.0-rc6 #5 SMP Sun Jan 20 00:39:54 KST 2013 armv7l</td> -</tr> -<tr> -<td align="left" class="noborder">Date of test run:</td> -<td align="left" class="noborder">2013-12-27</td> -</tr> -<tr> -<td align="left" class="noborder">Start time:</td> -<td align="left" class="noborder">04:05:42</td> -</tr> -</table></p> - -<hr> -<p><table border="1" cellpadding="3" cellspacing="0"> -<tr><td bgcolor="#ccccff" class="heading2"><font size="+2"><b> -Build mode summary</b></font></td></tr></table></p> -<p><table border="0" cellpadding="5" cellspacing="4"> -<tr> -<td align="center" bgcolor="#cccccc" class="neutral"><b>Result</b></td> -<td align="center" bgcolor="#cccccc" class="neutral"><b>Count</b></td> -</tr> -<tr> -<td align="left" bgcolor="#33cc33" class="success">Success</td> -<td align="right" bgcolor="#33cc33" class="success">0</td> -</tr> -<tr> -<td align="left" bgcolor="#ff5555" class="failure">Failure</td> -<td align="right" bgcolor="#ff5555" class="failure">1</td> -</tr> -<tr> -<td align="left" bgcolor="#cccccc" class="neutral"><b>Total</b></td> -<td align="right" bgcolor="#cccccc" class="neutral"><b>1</b></td> -</tr> -</table></p> -<p><table border="1" cellpadding="3" cellspacing="0"> -<tr><td bgcolor="#ccccff" class="heading2"><font size="+2"><b> -Execute mode summary</b></font></td></tr></table></p> -<p><table border="0" cellpadding="2" cellspacing="1"> -<tr> -<td align="left" class="noborder"><i>No results</i></td> -</tr> -</table></p> - -<hr> -<p><table border="1" cellpadding="3" cellspacing="0"> -<tr><td bgcolor="#ccccff" class="heading2"><font size="+2"><b> -Inline report</b></font></td></tr></table></p> -<h3>/testcase/utc_livebox_service [build]</h3> -<p><table border="0" cellpadding="5" cellspacing="4"> -<tr> -<td align="left" bgcolor="#cccccc" class="neutral"><b>Captured Output</b></td> -</tr> -<tr> -<td align="left" bgcolor="#cccccc" class="neutral"><ul> -<li>cc -o utc_livebox_service utc_livebox_service.c -I. `pkg-config --cflags livebox glib-2.0` -I/var/tmp/dts_fw/TC/TETware/tetware-target/inc/tet3 -Wall `pkg-config --libs livebox glib-2.0` /var/tmp/dts_fw/TC/TETware/tetware-target/lib/tet3/tcm_s.o -L/var/tmp/dts_fw/TC/TETware/tetware-target/lib/tet3 -ltcm_s -L/var/tmp/dts_fw/TC/TETware/tetware-target/lib/tet3 -lapi_s -<li>Package livebox was not found in the pkg-config search path. -<li>Perhaps you should add the directory containing `livebox.pc' -<li>to the PKG_CONFIG_PATH environment variable -<li>No package 'livebox' found -<li>cc: error: /var/tmp/dts_fw/TC/TETware/tetware-target/lib/tet3/tcm_s.o: No such file or directory -<li>make: *** [utc_livebox_service] Error 1 -</ul> -</td> -</tr> -</table></p> -<p><table border="0" cellpadding="5" cellspacing="4"> -<tr> -<td align="left" bgcolor="#cccccc" class="neutral"><b>Test Status</b></td> -</tr> -<tr> -<td align="left" bgcolor="#ff5555" class="failure">Failure (2)</td> -</tr> -</table></p> - -<hr> -</body> -</html> diff --git a/TC/results/build-tar-result-1388117141.journal b/TC/results/build-tar-result-1388117141.journal deleted file mode 100644 index cf1e19c..0000000 --- a/TC/results/build-tar-result-1388117141.journal +++ /dev/null @@ -1,24 +0,0 @@ -0|3.7-lite 04:05:42 20131227|User: root (0) TCC Start, Command line: /var/tmp/dts_fw/TETware/tetware-target/bin/tcc -b -j results/build-tar-result-1388117141.journal -p ./ -5|Linux nclinux 3.1.0-rc6 #5 SMP Sun Jan 20 00:39:54 KST 2013 armv7l|System Information -20|/var/tmp/dts_fw/./tetbuild.cfg 0|Config Start -30||TET_OUTPUT_CAPTURE=True -30||TET_BUILD_TOOL=make -30||TET_BUILD_FILE=-f Makefile -30||TET_API_COMPLIANT=True -30||TET_PASS_TC_NAME=True -30||TET_VERSION=3.7-lite -40||Config End -110|0 /testcase/utc_livebox_service 04:05:42|Build Start, scenario ref 1-0 -100|0|cc -o utc_livebox_service utc_livebox_service.c -I. `pkg-config --cflags livebox glib-2.0` -I/var/tmp/dts_fw/TC/TETware/tetware-target/inc/tet3 -Wall `pkg-config --libs livebox glib-2.0` /var/tmp/dts_fw/TC/TETware/tetware-target/lib/tet3/tcm_s.o -L/var/tmp/dts_fw/TC/TETware/tetware-target/lib/tet3 -ltcm_s -L/var/tmp/dts_fw/TC/TETware/tetware-target/lib/tet3 -lapi_s -100|0|Package livebox was not found in the pkg-config search path. -100|0|Perhaps you should add the directory containing `livebox.pc' -100|0|to the PKG_CONFIG_PATH environment variable -100|0|No package 'livebox' found -100|0|Package livebox was not found in the pkg-config search path. -100|0|Perhaps you should add the directory containing `livebox.pc' -100|0|to the PKG_CONFIG_PATH environment variable -100|0|No package 'livebox' found -100|0|cc: error: /var/tmp/dts_fw/TC/TETware/tetware-target/lib/tet3/tcm_s.o: No such file or directory -100|0|make: *** [utc_livebox_service] Error 1 -130|0 2 04:05:43|Build End, scenario ref 1-0 -900|04:05:43|TCC End diff --git a/TC/results/build-tar-result-1388117277.html b/TC/results/build-tar-result-1388117277.html deleted file mode 100644 index fd2a32f..0000000 --- a/TC/results/build-tar-result-1388117277.html +++ /dev/null @@ -1,94 +0,0 @@ -<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN" - "http://www.w3.org/TR/REC-html40/loose.dtd"> -<html> -<head> -<title>TETware Test Run Report</title> -</head> -<body bgcolor="white"> -<p><table border="1" width="100%" cellpadding="3" cellspacing="0"> -<tr><td bgcolor="#ccccff" class="heading1"><center><h1> -TETware Test Run Report</h1></center></td></tr></table></p> -<p><table border="0" cellpadding="2" cellspacing="1"> -<tr> -<td align="left" class="noborder">TETware version:</td> -<td align="left" class="noborder">3.7-lite</td> -</tr> -<tr> -<td align="left" class="noborder">System Information:</td> -<td align="left" class="noborder">Linux nclinux 3.1.0-rc6 #5 SMP Sun Jan 20 00:39:54 KST 2013 armv7l</td> -</tr> -<tr> -<td align="left" class="noborder">Date of test run:</td> -<td align="left" class="noborder">2013-12-27</td> -</tr> -<tr> -<td align="left" class="noborder">Start time:</td> -<td align="left" class="noborder">04:07:58</td> -</tr> -</table></p> - -<hr> -<p><table border="1" cellpadding="3" cellspacing="0"> -<tr><td bgcolor="#ccccff" class="heading2"><font size="+2"><b> -Build mode summary</b></font></td></tr></table></p> -<p><table border="0" cellpadding="5" cellspacing="4"> -<tr> -<td align="center" bgcolor="#cccccc" class="neutral"><b>Result</b></td> -<td align="center" bgcolor="#cccccc" class="neutral"><b>Count</b></td> -</tr> -<tr> -<td align="left" bgcolor="#33cc33" class="success">Success</td> -<td align="right" bgcolor="#33cc33" class="success">0</td> -</tr> -<tr> -<td align="left" bgcolor="#ff5555" class="failure">Failure</td> -<td align="right" bgcolor="#ff5555" class="failure">1</td> -</tr> -<tr> -<td align="left" bgcolor="#cccccc" class="neutral"><b>Total</b></td> -<td align="right" bgcolor="#cccccc" class="neutral"><b>1</b></td> -</tr> -</table></p> -<p><table border="1" cellpadding="3" cellspacing="0"> -<tr><td bgcolor="#ccccff" class="heading2"><font size="+2"><b> -Execute mode summary</b></font></td></tr></table></p> -<p><table border="0" cellpadding="2" cellspacing="1"> -<tr> -<td align="left" class="noborder"><i>No results</i></td> -</tr> -</table></p> - -<hr> -<p><table border="1" cellpadding="3" cellspacing="0"> -<tr><td bgcolor="#ccccff" class="heading2"><font size="+2"><b> -Inline report</b></font></td></tr></table></p> -<h3>/testcase/utc_livebox_service [build]</h3> -<p><table border="0" cellpadding="5" cellspacing="4"> -<tr> -<td align="left" bgcolor="#cccccc" class="neutral"><b>Captured Output</b></td> -</tr> -<tr> -<td align="left" bgcolor="#cccccc" class="neutral"><ul> -<li>cc -o utc_livebox_service utc_livebox_service.c -I. `pkg-config --cflags livebox glib-2.0` -I/var/tmp/dts_fw/TC/TETware/tetware-target/inc/tet3 -Wall `pkg-config --libs livebox glib-2.0` /var/tmp/dts_fw/TC/TETware/tetware-target/lib/tet3/tcm_s.o -L/var/tmp/dts_fw/TC/TETware/tetware-target/lib/tet3 -ltcm_s -L/var/tmp/dts_fw/TC/TETware/tetware-target/lib/tet3 -lapi_s -<li>Package livebox was not found in the pkg-config search path. -<li>Perhaps you should add the directory containing `livebox.pc' -<li>to the PKG_CONFIG_PATH environment variable -<li>No package 'livebox' found -<li>cc: error: /var/tmp/dts_fw/TC/TETware/tetware-target/lib/tet3/tcm_s.o: No such file or directory -<li>make: *** [utc_livebox_service] Error 1 -</ul> -</td> -</tr> -</table></p> -<p><table border="0" cellpadding="5" cellspacing="4"> -<tr> -<td align="left" bgcolor="#cccccc" class="neutral"><b>Test Status</b></td> -</tr> -<tr> -<td align="left" bgcolor="#ff5555" class="failure">Failure (2)</td> -</tr> -</table></p> - -<hr> -</body> -</html> diff --git a/TC/results/build-tar-result-1388117277.journal b/TC/results/build-tar-result-1388117277.journal deleted file mode 100644 index 74f41dd..0000000 --- a/TC/results/build-tar-result-1388117277.journal +++ /dev/null @@ -1,24 +0,0 @@ -0|3.7-lite 04:07:58 20131227|User: root (0) TCC Start, Command line: /var/tmp/dts_fw/TETware/tetware-target/bin/tcc -b -j results/build-tar-result-1388117277.journal -p ./ -5|Linux nclinux 3.1.0-rc6 #5 SMP Sun Jan 20 00:39:54 KST 2013 armv7l|System Information -20|/var/tmp/dts_fw/./tetbuild.cfg 0|Config Start -30||TET_OUTPUT_CAPTURE=True -30||TET_BUILD_TOOL=make -30||TET_BUILD_FILE=-f Makefile -30||TET_API_COMPLIANT=True -30||TET_PASS_TC_NAME=True -30||TET_VERSION=3.7-lite -40||Config End -110|0 /testcase/utc_livebox_service 04:07:58|Build Start, scenario ref 1-0 -100|0|cc -o utc_livebox_service utc_livebox_service.c -I. `pkg-config --cflags livebox glib-2.0` -I/var/tmp/dts_fw/TC/TETware/tetware-target/inc/tet3 -Wall `pkg-config --libs livebox glib-2.0` /var/tmp/dts_fw/TC/TETware/tetware-target/lib/tet3/tcm_s.o -L/var/tmp/dts_fw/TC/TETware/tetware-target/lib/tet3 -ltcm_s -L/var/tmp/dts_fw/TC/TETware/tetware-target/lib/tet3 -lapi_s -100|0|Package livebox was not found in the pkg-config search path. -100|0|Perhaps you should add the directory containing `livebox.pc' -100|0|to the PKG_CONFIG_PATH environment variable -100|0|No package 'livebox' found -100|0|Package livebox was not found in the pkg-config search path. -100|0|Perhaps you should add the directory containing `livebox.pc' -100|0|to the PKG_CONFIG_PATH environment variable -100|0|No package 'livebox' found -100|0|cc: error: /var/tmp/dts_fw/TC/TETware/tetware-target/lib/tet3/tcm_s.o: No such file or directory -100|0|make: *** [utc_livebox_service] Error 1 -130|0 2 04:07:59|Build End, scenario ref 1-0 -900|04:07:59|TCC End diff --git a/TC/results/build-tar-result-1388117423.html b/TC/results/build-tar-result-1388117423.html deleted file mode 100644 index 93e2c80..0000000 --- a/TC/results/build-tar-result-1388117423.html +++ /dev/null @@ -1,90 +0,0 @@ -<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN" - "http://www.w3.org/TR/REC-html40/loose.dtd"> -<html> -<head> -<title>TETware Test Run Report</title> -</head> -<body bgcolor="white"> -<p><table border="1" width="100%" cellpadding="3" cellspacing="0"> -<tr><td bgcolor="#ccccff" class="heading1"><center><h1> -TETware Test Run Report</h1></center></td></tr></table></p> -<p><table border="0" cellpadding="2" cellspacing="1"> -<tr> -<td align="left" class="noborder">TETware version:</td> -<td align="left" class="noborder">3.7-lite</td> -</tr> -<tr> -<td align="left" class="noborder">System Information:</td> -<td align="left" class="noborder">Linux nclinux 3.1.0-rc6 #5 SMP Sun Jan 20 00:39:54 KST 2013 armv7l</td> -</tr> -<tr> -<td align="left" class="noborder">Date of test run:</td> -<td align="left" class="noborder">2013-12-27</td> -</tr> -<tr> -<td align="left" class="noborder">Start time:</td> -<td align="left" class="noborder">04:10:24</td> -</tr> -</table></p> - -<hr> -<p><table border="1" cellpadding="3" cellspacing="0"> -<tr><td bgcolor="#ccccff" class="heading2"><font size="+2"><b> -Build mode summary</b></font></td></tr></table></p> -<p><table border="0" cellpadding="5" cellspacing="4"> -<tr> -<td align="center" bgcolor="#cccccc" class="neutral"><b>Result</b></td> -<td align="center" bgcolor="#cccccc" class="neutral"><b>Count</b></td> -</tr> -<tr> -<td align="left" bgcolor="#33cc33" class="success">Success</td> -<td align="right" bgcolor="#33cc33" class="success">0</td> -</tr> -<tr> -<td align="left" bgcolor="#ff5555" class="failure">Failure</td> -<td align="right" bgcolor="#ff5555" class="failure">1</td> -</tr> -<tr> -<td align="left" bgcolor="#cccccc" class="neutral"><b>Total</b></td> -<td align="right" bgcolor="#cccccc" class="neutral"><b>1</b></td> -</tr> -</table></p> -<p><table border="1" cellpadding="3" cellspacing="0"> -<tr><td bgcolor="#ccccff" class="heading2"><font size="+2"><b> -Execute mode summary</b></font></td></tr></table></p> -<p><table border="0" cellpadding="2" cellspacing="1"> -<tr> -<td align="left" class="noborder"><i>No results</i></td> -</tr> -</table></p> - -<hr> -<p><table border="1" cellpadding="3" cellspacing="0"> -<tr><td bgcolor="#ccccff" class="heading2"><font size="+2"><b> -Inline report</b></font></td></tr></table></p> -<h3>/testcase/utc_livebox_service [build]</h3> -<p><table border="0" cellpadding="5" cellspacing="4"> -<tr> -<td align="left" bgcolor="#cccccc" class="neutral"><b>Captured Output</b></td> -</tr> -<tr> -<td align="left" bgcolor="#cccccc" class="neutral"><ul> -<li>cc -o utc_livebox_service utc_livebox_service.c -I. `pkg-config --cflags livebox-service glib-2.0` -I/var/tmp/dts_fw/TC/TETware/tetware-target/inc/tet3 -Wall `pkg-config --libs livebox-service glib-2.0` /var/tmp/dts_fw/TC/TETware/tetware-target/lib/tet3/tcm_s.o -L/var/tmp/dts_fw/TC/TETware/tetware-target/lib/tet3 -ltcm_s -L/var/tmp/dts_fw/TC/TETware/tetware-target/lib/tet3 -lapi_s -<li>cc: error: /var/tmp/dts_fw/TC/TETware/tetware-target/lib/tet3/tcm_s.o: No such file or directory -<li>make: *** [utc_livebox_service] Error 1 -</ul> -</td> -</tr> -</table></p> -<p><table border="0" cellpadding="5" cellspacing="4"> -<tr> -<td align="left" bgcolor="#cccccc" class="neutral"><b>Test Status</b></td> -</tr> -<tr> -<td align="left" bgcolor="#ff5555" class="failure">Failure (2)</td> -</tr> -</table></p> - -<hr> -</body> -</html> diff --git a/TC/results/build-tar-result-1388117423.journal b/TC/results/build-tar-result-1388117423.journal deleted file mode 100644 index 06cf896..0000000 --- a/TC/results/build-tar-result-1388117423.journal +++ /dev/null @@ -1,16 +0,0 @@ -0|3.7-lite 04:10:24 20131227|User: root (0) TCC Start, Command line: /var/tmp/dts_fw/TETware/tetware-target/bin/tcc -b -j results/build-tar-result-1388117423.journal -p ./ -5|Linux nclinux 3.1.0-rc6 #5 SMP Sun Jan 20 00:39:54 KST 2013 armv7l|System Information -20|/var/tmp/dts_fw/./tetbuild.cfg 0|Config Start -30||TET_OUTPUT_CAPTURE=True -30||TET_BUILD_TOOL=make -30||TET_BUILD_FILE=-f Makefile -30||TET_API_COMPLIANT=True -30||TET_PASS_TC_NAME=True -30||TET_VERSION=3.7-lite -40||Config End -110|0 /testcase/utc_livebox_service 04:10:24|Build Start, scenario ref 1-0 -100|0|cc -o utc_livebox_service utc_livebox_service.c -I. `pkg-config --cflags livebox-service glib-2.0` -I/var/tmp/dts_fw/TC/TETware/tetware-target/inc/tet3 -Wall `pkg-config --libs livebox-service glib-2.0` /var/tmp/dts_fw/TC/TETware/tetware-target/lib/tet3/tcm_s.o -L/var/tmp/dts_fw/TC/TETware/tetware-target/lib/tet3 -ltcm_s -L/var/tmp/dts_fw/TC/TETware/tetware-target/lib/tet3 -lapi_s -100|0|cc: error: /var/tmp/dts_fw/TC/TETware/tetware-target/lib/tet3/tcm_s.o: No such file or directory -100|0|make: *** [utc_livebox_service] Error 1 -130|0 2 04:10:25|Build End, scenario ref 1-0 -900|04:10:25|TCC End diff --git a/TC/results/build-tar-result-1388117533.html b/TC/results/build-tar-result-1388117533.html deleted file mode 100644 index 39b0215..0000000 --- a/TC/results/build-tar-result-1388117533.html +++ /dev/null @@ -1,93 +0,0 @@ -<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN" - "http://www.w3.org/TR/REC-html40/loose.dtd"> -<html> -<head> -<title>TETware Test Run Report</title> -</head> -<body bgcolor="white"> -<p><table border="1" width="100%" cellpadding="3" cellspacing="0"> -<tr><td bgcolor="#ccccff" class="heading1"><center><h1> -TETware Test Run Report</h1></center></td></tr></table></p> -<p><table border="0" cellpadding="2" cellspacing="1"> -<tr> -<td align="left" class="noborder">TETware version:</td> -<td align="left" class="noborder">3.7-lite</td> -</tr> -<tr> -<td align="left" class="noborder">System Information:</td> -<td align="left" class="noborder">Linux nclinux 3.1.0-rc6 #5 SMP Sun Jan 20 00:39:54 KST 2013 armv7l</td> -</tr> -<tr> -<td align="left" class="noborder">Date of test run:</td> -<td align="left" class="noborder">2013-12-27</td> -</tr> -<tr> -<td align="left" class="noborder">Start time:</td> -<td align="left" class="noborder">04:12:14</td> -</tr> -</table></p> - -<hr> -<p><table border="1" cellpadding="3" cellspacing="0"> -<tr><td bgcolor="#ccccff" class="heading2"><font size="+2"><b> -Build mode summary</b></font></td></tr></table></p> -<p><table border="0" cellpadding="5" cellspacing="4"> -<tr> -<td align="center" bgcolor="#cccccc" class="neutral"><b>Result</b></td> -<td align="center" bgcolor="#cccccc" class="neutral"><b>Count</b></td> -</tr> -<tr> -<td align="left" bgcolor="#33cc33" class="success">Success</td> -<td align="right" bgcolor="#33cc33" class="success">0</td> -</tr> -<tr> -<td align="left" bgcolor="#ff5555" class="failure">Failure</td> -<td align="right" bgcolor="#ff5555" class="failure">1</td> -</tr> -<tr> -<td align="left" bgcolor="#cccccc" class="neutral"><b>Total</b></td> -<td align="right" bgcolor="#cccccc" class="neutral"><b>1</b></td> -</tr> -</table></p> -<p><table border="1" cellpadding="3" cellspacing="0"> -<tr><td bgcolor="#ccccff" class="heading2"><font size="+2"><b> -Execute mode summary</b></font></td></tr></table></p> -<p><table border="0" cellpadding="2" cellspacing="1"> -<tr> -<td align="left" class="noborder"><i>No results</i></td> -</tr> -</table></p> - -<hr> -<p><table border="1" cellpadding="3" cellspacing="0"> -<tr><td bgcolor="#ccccff" class="heading2"><font size="+2"><b> -Inline report</b></font></td></tr></table></p> -<h3>/testcase/utc_livebox_service [build]</h3> -<p><table border="0" cellpadding="5" cellspacing="4"> -<tr> -<td align="left" bgcolor="#cccccc" class="neutral"><b>Captured Output</b></td> -</tr> -<tr> -<td align="left" bgcolor="#cccccc" class="neutral"><ul> -<li>cc -o utc_livebox_service utc_livebox_service.c -I. `pkg-config --cflags livebox-service glib-2.0` -I/var/tmp/dts_fw/TC/TETware/tetware-target/inc/tet3 -Wall `pkg-config --libs livebox-service glib-2.0` -<li>utc_livebox_service.c:18:21: fatal error: tet_api.h: No such file or directory -<li> #include <tet_api.h> -<li> ^ -<li>compilation terminated. -<li>make: *** [utc_livebox_service] Error 1 -</ul> -</td> -</tr> -</table></p> -<p><table border="0" cellpadding="5" cellspacing="4"> -<tr> -<td align="left" bgcolor="#cccccc" class="neutral"><b>Test Status</b></td> -</tr> -<tr> -<td align="left" bgcolor="#ff5555" class="failure">Failure (2)</td> -</tr> -</table></p> - -<hr> -</body> -</html> diff --git a/TC/results/build-tar-result-1388117533.journal b/TC/results/build-tar-result-1388117533.journal deleted file mode 100644 index 64d38a7..0000000 --- a/TC/results/build-tar-result-1388117533.journal +++ /dev/null @@ -1,19 +0,0 @@ -0|3.7-lite 04:12:14 20131227|User: root (0) TCC Start, Command line: /var/tmp/dts_fw/TETware/tetware-target/bin/tcc -b -j results/build-tar-result-1388117533.journal -p ./ -5|Linux nclinux 3.1.0-rc6 #5 SMP Sun Jan 20 00:39:54 KST 2013 armv7l|System Information -20|/var/tmp/dts_fw/./tetbuild.cfg 0|Config Start -30||TET_OUTPUT_CAPTURE=True -30||TET_BUILD_TOOL=make -30||TET_BUILD_FILE=-f Makefile -30||TET_API_COMPLIANT=True -30||TET_PASS_TC_NAME=True -30||TET_VERSION=3.7-lite -40||Config End -110|0 /testcase/utc_livebox_service 04:12:14|Build Start, scenario ref 1-0 -100|0|cc -o utc_livebox_service utc_livebox_service.c -I. `pkg-config --cflags livebox-service glib-2.0` -I/var/tmp/dts_fw/TC/TETware/tetware-target/inc/tet3 -Wall `pkg-config --libs livebox-service glib-2.0` -100|0|utc_livebox_service.c:18:21: fatal error: tet_api.h: No such file or directory -100|0| #include <tet_api.h> -100|0| ^ -100|0|compilation terminated. -100|0|make: *** [utc_livebox_service] Error 1 -130|0 2 04:12:15|Build End, scenario ref 1-0 -900|04:12:15|TCC End diff --git a/TC/results/exec-tar-result-1388117150.html b/TC/results/exec-tar-result-1388117150.html deleted file mode 100644 index c33c2fe..0000000 --- a/TC/results/exec-tar-result-1388117150.html +++ /dev/null @@ -1,61 +0,0 @@ -<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN" - "http://www.w3.org/TR/REC-html40/loose.dtd"> -<html> -<head> -<title>TETware Test Run Report</title> -</head> -<body bgcolor="white"> -<p><table border="1" width="100%" cellpadding="3" cellspacing="0"> -<tr><td bgcolor="#ccccff" class="heading1"><center><h1> -TETware Test Run Report</h1></center></td></tr></table></p> -<p><table border="0" cellpadding="2" cellspacing="1"> -<tr> -<td align="left" class="noborder">TETware version:</td> -<td align="left" class="noborder">3.7-lite</td> -</tr> -<tr> -<td align="left" class="noborder">System Information:</td> -<td align="left" class="noborder">Linux nclinux 3.1.0-rc6 #5 SMP Sun Jan 20 00:39:54 KST 2013 armv7l</td> -</tr> -<tr> -<td align="left" class="noborder">Date of test run:</td> -<td align="left" class="noborder">2013-12-27</td> -</tr> -<tr> -<td align="left" class="noborder">Start time:</td> -<td align="left" class="noborder">04:05:50</td> -</tr> -</table></p> - -<hr> -<p><table border="1" cellpadding="3" cellspacing="0"> -<tr><td bgcolor="#ccccff" class="heading2"><font size="+2"><b> -Execute mode summary</b></font></td></tr></table></p> -<p><table border="0" cellpadding="2" cellspacing="1"> -<tr> -<td align="left" class="noborder"><i>No results</i></td> -</tr> -</table></p> - -<hr> -<p><table border="1" cellpadding="3" cellspacing="0"> -<tr><td bgcolor="#ccccff" class="heading2"><font size="+2"><b> -Inline report</b></font></td></tr></table></p> -<h3>/testcase/utc_livebox_service [execute]</h3> -<p><table border="0" cellpadding="5" cellspacing="4"> -<tr> -<td align="left" bgcolor="#cccccc" class="neutral"><b>Test Status</b></td> -</tr> -<tr> -<td align="left" bgcolor="#ff5555" class="failure">Failure (-1)</td> -</tr> -</table></p> -<h3>Scenario Information</h3> -<ul> -<li>[TCC] (exec.c, 131): can't exec /var/tmp/dts_fw/./tet_tmp_dir/23996aa/testcase/utc_livebox_service, reply code = ER_NOENT -<li>[TCC] (copysave.c, 405): can't change directory to /opt/home/livebox/TETware/tetware-target: No such file or directory -</ul> - -<hr> -</body> -</html> diff --git a/TC/results/exec-tar-result-1388117150.journal b/TC/results/exec-tar-result-1388117150.journal deleted file mode 100644 index a5d1845..0000000 --- a/TC/results/exec-tar-result-1388117150.journal +++ /dev/null @@ -1,15 +0,0 @@ -0|3.7-lite 04:05:50 20131227|User: root (0) TCC Start, Command line: /var/tmp/dts_fw/TETware/tetware-target/bin/tcc -e -j results/exec-tar-result-1388117150.journal -p ./ -5|Linux nclinux 3.1.0-rc6 #5 SMP Sun Jan 20 00:39:54 KST 2013 armv7l|System Information -20|/var/tmp/dts_fw/./tetexec.cfg 1|Config Start -30||TET_OUTPUT_CAPTURE=True -30||TET_EXEC_TOOL= -30||TET_EXEC_FILE= -30||TET_API_COMPLIANT=True -30||TET_PASS_TC_NAME=True -30||TET_VERSION=3.7-lite -40||Config End -10|0 /testcase/utc_livebox_service 04:05:50|TC Start, scenario ref 1-0 -50||(exec.c, 131): can't exec /var/tmp/dts_fw/./tet_tmp_dir/23996aa/testcase/utc_livebox_service, reply code = ER_NOENT -80|0 -1 04:05:50|TC End, scenario ref 1-0 -50||(copysave.c, 405): can't change directory to /opt/home/livebox/TETware/tetware-target: No such file or directory -900|04:05:50|TCC End diff --git a/TC/run.sh b/TC/run.sh deleted file mode 100755 index cec5778..0000000 --- a/TC/run.sh +++ /dev/null @@ -1,15 +0,0 @@ -#!/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 deleted file mode 100644 index 811d781..0000000 --- a/TC/testcase/Makefile +++ /dev/null @@ -1,26 +0,0 @@ -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/tet_captured b/TC/testcase/tet_captured deleted file mode 100644 index 55af6bb..0000000 --- a/TC/testcase/tet_captured +++ /dev/null @@ -1,6 +0,0 @@ -cc -o utc_livebox_service utc_livebox_service.c -I. `pkg-config --cflags livebox-service glib-2.0` -I/var/tmp/dts_fw/TC/TETware/tetware-target/inc/tet3 -Wall `pkg-config --libs livebox-service glib-2.0` -utc_livebox_service.c:18:21: fatal error: tet_api.h: No such file or directory - #include <tet_api.h> - ^ -compilation terminated. -make: *** [utc_livebox_service] Error 1 diff --git a/TC/testcase/tslist b/TC/testcase/tslist deleted file mode 100644 index 39522fe..0000000 --- a/TC/testcase/tslist +++ /dev/null @@ -1,2 +0,0 @@ -/testcase/utc_shortcut - diff --git a/TC/testcase/utc_shortcut.c b/TC/testcase/utc_shortcut.c deleted file mode 100644 index 654dc68..0000000 --- a/TC/testcase/utc_shortcut.c +++ /dev/null @@ -1,375 +0,0 @@ -/* - * 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 <tet_api.h> -#include <stdlib.h> - -#include <shortcut.h> - -#define MUSIC_APP "com.samsung.music-player" -#define MUSIC_LIVEBOX MUSIC_APP ".livebox" -#define MUSIC_EASYBOX "com.samsung.music-player.easymode.livebox" - -enum { - POSITIVE_TC_IDX = 0x01, - NEGATIVE_TC_IDX, -}; - -static struct test_info { - struct shortcut_icon *handle; -} s_info = { - .handle = NULL, -}; - -static void startup(void) -{ - /* start of TC */ - tet_printf("\n TC start"); -} - - -static void cleanup(void) -{ - /* end of TC */ - tet_printf("\n TC end"); -} - -void (*tet_startup)(void) = startup; -void (*tet_cleanup)(void) = cleanup; - -static void utc_shortcut_set_request_cb_n(void) -{ - /*! - * \note - * Unable to test negative case - */ - dts_pass("shortcut_set_request_cb", "pass negative test"); -} - -static int shortcut_request_cb(const char *appid, const char *name, int type, const char *content_info, const char *icon, int pid, double period, int allow_duplicate, void *data) -{ - if (appid) { - if (!strcmp(appid, "fail")) { - return SHORTCUT_ERROR_UNSUPPORTED; - } else if (!strcmp(appid, "success")) { - return SHORTCUT_SUCCESS; - } - } - - return SHORTCUT_SUCCESS; -} - -static void utc_shortcut_set_request_cb_p(void) -{ - int ret; - ret = shortcut_set_request_cb(shortcut_request_cb, NULL); - dts_check_eq("shortcut_set_request_cb", ret, SHORTCUT_SUCCESS, "success"); -} - -static int response_cb(int ret, int pid, void *data) -{ - if ((int)data == 1) { - dts_check_eq("add_to_home_shortcut", ret, SHORTCUT_ERROR_UNSUPPORTED, "success"); - } else if ((int)data == 2) { - dts_check_eq("add_to_home_shortcut", ret, SHORTCUT_SUCCESS, "success"); - } - - return 0; -} - -static void utc_add_to_home_shortcut_n(void) -{ - int ret; - ret = add_to_home_shortcut("fail", NULL, LAUNCH_BY_PACKAGE, NULL, NULL, 1, response_cb, (void *)1); - if (ret != SHORTCUT_SUCCESS) { - dts_check_eq("add_to_home_shortcut", ret, SHORTCUT_SUCCESS, "success"); - } -} - -static void utc_add_to_home_shortcut_p(void) -{ - int ret; - ret = add_to_home_shortcut("success", NULL, LAUNCH_BY_PACKAGE, NULL, NULL, 1, response_cb, (void *)2); - if (ret != SHORTCUT_SUCCESS) { - dts_check_eq("add_to_home_shortcut", ret, SHORTCUT_SUCCESS, "success"); - } -} - -static void utc_shortcut_get_list_n(void) -{ - /*! - * \note - * Unable to test negative case - */ - dts_pass("shortcut_get_list", "negative test"); -} - -static int shortcut_list_cb(const char *appid, const char *icon, const char *name, const char *extra_key, const char *extra_data, void *data) -{ - return 0; -} - -static void utc_shortcut_get_list_p(void) -{ - int ret; - ret = shortcut_get_list(NULL, shortcut_list_cb, NULL); - dts_check_ge("shortcut_get_list", ret, 0, "get_list"); -} - -static void utc_add_to_home_livebox_n(void) -{ - int ret; - ret = add_to_home_livebox("fail", NULL, LIVEBOX_TYPE_1x1, NULL, NULL, -1.0f, 1, response_cb, (void *)1); - if (ret != SHORTCUT_SUCCESS) { - dts_check_eq("add_to_home_livebox", ret, SHORTCUT_SUCCESS, "success"); - } -} - -static void utc_add_to_home_livebox_p(void) -{ - int ret; - ret = add_to_home_livebox("success", NULL, LIVEBOX_TYPE_1x1, NULL, NULL, -1.0f, 1, response_cb, (void *)2); - if (ret != SHORTCUT_SUCCESS) { - dts_check_eq("add_to_home_livebox", ret, SHORTCUT_SUCCESS, "success"); - } -} - -static void utc_add_to_home_remove_shortcut_n(void) -{ - int ret; - ret = add_to_home_remove_shortcut("fail", NULL, NULL, response_cb, (void *)1); - if (ret != SHORTCUT_SUCCESS) { - dts_check_eq("add_to_home_remove_shortcut", ret, SHORTCUT_ERROR_INVALID, "Invalid"); - } -} - -static void utc_add_to_home_remove_shortcut_p(void) -{ - int ret; - ret = add_to_home_remove_shortcut("success", NULL, NULL, response_cb, (void *)2); - if (ret != SHORTCUT_SUCCESS) { - dts_check_eq("add_to_home_remove_shortcut", ret, SHORTCUT_ERROR_INVALID, "Invalid"); - } -} - -static void utc_add_to_home_remove_livebox_n(void) -{ - int ret; - ret = add_to_home_remove_livebox("fail", NULL, response_cb, (void *)1); - if (ret != SHORTCUT_SUCCESS) { - dts_check_eq("add_to_home_remove_shortcut", ret, SHORTCUT_ERROR_INVALID, "Invalid"); - } -} - -static void utc_add_to_home_remove_livebox_p(void) -{ - int ret; - ret = add_to_home_remove_livebox("success", NULL, response_cb, (void *)2); - if (ret != SHORTCUT_SUCCESS) { - dts_check_eq("add_to_home_remove_shortcut", ret, SHORTCUT_ERROR_INVALID, "Invalid"); - } -} - -static void utc_shortcut_icon_service_init_n(void) -{ - /*! - * \note - * Unable to test negative case - */ - dts_pass("shortcut_icon_service_init", "negative test"); -} - -static int icon_service_cb(int status, void *data) -{ - dts_check_eq("shortcut_icon_service_init", status, SHORTCUT_SUCCESS); - return 0; -} - -static void utc_shortcut_icon_service_init_p(void) -{ - int ret; - - ret = shortcut_icon_service_init(icon_service_cb, NULL); - if (ret != SHORTCUT_SUCCESS) { - dts_check_eq("shortcut_icon_service_init", ret, SHORTCUT_SUCCESS); - } -} - -static void utc_shortcut_icon_service_fini_n(void) -{ - /*! - * \note - * Unable to test negative case - */ - dts_pass("shortcut_icon_service_fini", "negative test"); -} - -static void utc_shortcut_icon_service_fini_p(void) -{ - int ret; - ret = shortcut_icon_service_fini(); - dts_check_eq("shortcut_icon_service_fini", ret, SHORTCUT_SUCCESS, "success"); -} - -static void utc_shortcut_icon_request_create_n(void) -{ - dts_pass("shortcut_icon_request_create", "negative test"); -} - -static void utc_shortcut_icon_request_create_p(void) -{ - s_info.handle = shortcut_icon_request_create(); - dts_check_ne("shortcut_icon_request_create", s_info.handle, NULL, "success"); -} - -static void utc_shortcut_icon_request_set_info_n(void) -{ - int ret; - ret = shortcut_icon_request_set_info(NULL, NULL, NULL, NULL, NULL, NULL, NULL); - dts_check_ne("shortcut_icon_request_set_info", ret, SHORTCUT_ERROR_INVALID, "invalid handle"); -} - -static void utc_shortcut_icon_request_set_info_p(void) -{ - int ret; - - if (!s_info.handle) { - dts_pass("shortcut_icon_request_set_info", "handle is not initialized"); - return; - } - - ret = shortcut_icon_request_set_info(s_info.handle, NULL, SHORTCUT_ICON_TYPE_IMAGE, "icon,part", "/opt/usr/share/icon.png", NULL, NULL); - dts_check_ge("shortcut_icon_request_set_info", ret, 0, "set_info"); -} - -static void utc_shortcut_icon_request_send_n(void) -{ - int ret; - - ret = shortcut_icon_request_send(NULL, LIVEBOX_TYPE_1x1, NULL, NULL, NULL, NULL, NULL); - dts_check_eq("shortcut_icon_request_send", ret, SHORTCUT_ERROR_INVALID, "success"); -} - -static int result_cb(struct shortcut_icon *handle, int ret, void *data) -{ - return 0; -} - -static void utc_shortcut_icon_request_send_p(void) -{ - int ret; - - if (!s_info.handle) { - dts_pass("shortcut_icon_request_set_info", "handle is not initialized"); - return; - } - - ret = shortcut_icon_request_send(s_info.handle, LIVEBOX_TYPE_1x1, NULL, NULL, "/tmp/icon.png", result_cb, NULL); - dts_check_eq("shortcut_icon_request_send", ret, 0, "success"); -} - -static void utc_shortcut_icon_request_destroy_n(void) -{ - int ret; - - ret = shortcut_icon_request_destroy(NULL); - dts_check_eq("shortcut_icon_request_destroy", ret, SHORTCUT_ERROR_INVALID, "invalid"); -} - -static void utc_shortcut_icon_request_destroy_p(void) -{ - int ret; - - if (!s_info.handle) { - dts_pass("shortcut_icon_request_set_info", "handle is not initialized"); - return; - } - - ret = shortcut_icon_request_destroy(s_info.handle); - dts_check_eq("shortcut_icon_request_destroy", ret, SHORTCUT_SUCCESS, "Destroy"); - s_info.handle = NULL; -} - -static void utc_shortcut_icon_request_set_data_n(void) -{ - int ret; - ret = shortcut_icon_request_set_data(NULL, NULL); - dts_check_eq("shortcut_icon_request_set_data", ret, SHORTCUT_ERROR_INVALID, "invalid"); -} - -static void utc_shortcut_icon_request_set_data_p(void) -{ - int ret; - - if (!s_info.handle) { - dts_pass("shortcut_icon_request_set_data", "failed to set data"); - return; - } - - ret = shortcut_icon_request_set_data(s_info.handle, (void *)1); - dts_check_eq("shortcut_icon_request_set_data", ret, SHORTCUT_SUCCESS, "success"); -} - -static void utc_shortcut_icon_request_data_n(void) -{ - dts_pass("shortcut_icon_request_data", "get_data"); -} - -static void utc_shortcut_icon_request_data_p(void) -{ - void *data; - if (!s_info.handle) { - dts_pass("shortcut_icon_request_data", "invalid handle"); - return; - } - - data = shortcut_icon_request_data(s_info.handle); - dts_check_eq("shortcut_icon_request_data", data, (void *)1, "success"); -} - -struct tet_testlist tet_testlist[] = { - { utc_shortcut_set_request_cb_n, NEGATIVE_TC_IDX }, - { utc_shortcut_set_request_cb_p, POSITIVE_TC_IDX }, - { utc_add_to_home_shortcut_n, NEGATIVE_TC_IDX }, - { utc_add_to_home_shortcut_p, POSITIVE_TC_IDX }, - { utc_shortcut_get_list_n, NEGATIVE_TC_IDX }, - { utc_shortcut_get_list_p, POSITIVE_TC_IDX }, - { utc_add_to_home_livebox_n, NEGATIVE_TC_IDX }, - { utc_add_to_home_livebox_p, POSITIVE_TC_IDX }, - { utc_add_to_home_remove_shortcut_n, NEGATIVE_TC_IDX }, - { utc_add_to_home_remove_shortcut_p, POSITIVE_TC_IDX }, - { utc_add_to_home_remove_livebox_n, NEGATIVE_TC_IDX }, - { utc_add_to_home_remove_livebox_p, POSITIVE_TC_IDX }, - { utc_shortcut_icon_service_init_n, NEGATIVE_TC_IDX }, - { utc_shortcut_icon_service_init_p, POSITIVE_TC_IDX }, - { utc_shortcut_icon_request_create_n, NEGATIVE_TC_IDX }, - { utc_shortcut_icon_request_create_p, POSITIVE_TC_IDX }, - { utc_shortcut_icon_request_set_info_n, NEGATIVE_TC_IDX }, - { utc_shortcut_icon_request_set_info_p, POSITIVE_TC_IDX }, - { utc_shortcut_icon_request_send_n, NEGATIVE_TC_IDX }, - { utc_shortcut_icon_request_send_p, POSITIVE_TC_IDX }, - { utc_shortcut_icon_request_set_data_n, NEGATIVE_TC_IDX }, - { utc_shortcut_icon_request_set_data_p, POSITIVE_TC_IDX }, - { utc_shortcut_icon_request_data_n, NEGATIVE_TC_IDX }, - { utc_shortcut_icon_request_data_p, POSITIVE_TC_IDX }, - { utc_shortcut_icon_request_destroy_n, NEGATIVE_TC_IDX }, - { utc_shortcut_icon_request_destroy_p, POSITIVE_TC_IDX }, - { utc_shortcut_icon_service_fini_n, NEGATIVE_TC_IDX }, // Must be tested as the last TC - { utc_shortcut_icon_service_fini_p, POSITIVE_TC_IDX }, - { NULL, 0 }, -}; - diff --git a/TC/tet_scen b/TC/tet_scen deleted file mode 100644 index 03f029a..0000000 --- a/TC/tet_scen +++ /dev/null @@ -1,7 +0,0 @@ -all - ^TEST -##### Scenarios for TEST ##### - -# Test scenario -TEST - :include:/testcase/tslist diff --git a/TC/tet_tmp_dir/23996aa/testcase/Makefile b/TC/tet_tmp_dir/23996aa/testcase/Makefile deleted file mode 100644 index 811d781..0000000 --- a/TC/tet_tmp_dir/23996aa/testcase/Makefile +++ /dev/null @@ -1,26 +0,0 @@ -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/tet_tmp_dir/23996aa/testcase/tet_lock/23996aa b/TC/tet_tmp_dir/23996aa/testcase/tet_lock/23996aa deleted file mode 100644 index e69de29..0000000 --- a/TC/tet_tmp_dir/23996aa/testcase/tet_lock/23996aa +++ /dev/null diff --git a/TC/tet_tmp_dir/23996aa/testcase/tslist b/TC/tet_tmp_dir/23996aa/testcase/tslist deleted file mode 100644 index 6537934..0000000 --- a/TC/tet_tmp_dir/23996aa/testcase/tslist +++ /dev/null @@ -1,2 +0,0 @@ -/testcase/utc_livebox_service - diff --git a/TC/tet_tmp_dir/23996aa/testcase/utc_livebox_service.c b/TC/tet_tmp_dir/23996aa/testcase/utc_livebox_service.c deleted file mode 100644 index 75dbe49..0000000 --- a/TC/tet_tmp_dir/23996aa/testcase/utc_livebox_service.c +++ /dev/null @@ -1,732 +0,0 @@ -/* - * 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 <tet_api.h> -#include <stdlib.h> - -#include <livebox-service.h> -#include <livebox-errno.h> - -#define MUSIC_APP "com.samsung.music-player" -#define MUSIC_LIVEBOX MUSIC_APP ".livebox" -#define MUSIC_EASYBOX "com.samsung.music-player.easymode.livebox" - -enum { - POSITIVE_TC_IDX = 0x01, - NEGATIVE_TC_IDX, -}; - -static void startup(void) -{ - /* start of TC */ - tet_printf("\n TC start"); - - // Create DB file for testing -} - - -static void cleanup(void) -{ - /* end of TC */ - tet_printf("\n TC end"); - // Delete DB file for testing -} - -void (*tet_startup)(void) = startup; -void (*tet_cleanup)(void) = cleanup; - -static void utc_livebox_service_get_size_n(void) -{ - int ret; - int w; - int h; - - ret = livebox_service_get_size(LB_SIZE_TYPE_UNKNOWN, &w, &h); - dts_check_eq("livebox_service_get_size", ret, LB_STATUS_ERROR_INVALID, "invalid size should returns LB_STATUS_ERROR_INVALID\n"); -} - -static void utc_livebox_service_get_size_p(void) -{ - int ret; - int w; - int h; - ret = livebox_service_get_size(LB_SIZE_TYPE_1x1, &w, &h); - dts_check_eq("livebox_service_get_size", ret, LB_STATUS_SUCCESS, "valid size should returns LB_STATUS_SUCCES\n"); -} - -static void utc_livebox_service_size_type_n(void) -{ - int ret; - ret = livebox_service_size_type(1, 1); - dts_check_eq("livebox_service_size_type", ret, LB_SIZE_TYPE_UNKNOWN, "invalid size should returns LB_SIZE_TYPE_UNKNOWN\n"); -} - -static void utc_livebox_service_size_type_p(void) -{ - int ret; - int w; - int h; - int old; - - old = livebox_service_get_size(LB_SIZE_TYPE_1x1, &w, &h); - - ret = livebox_service_size_type(w, h); - dts_check_eq("livebox_service_size_type", ret, LB_SIZE_TYPE_1x1, "LB_SIZE_TYPE_1x1 should returns\n"); -} - -static void utc_livebox_service_mouse_event_n(void) -{ - int ret; - ret = livebox_service_mouse_event(NULL); - dts_check_eq("livebox_service_mouse_event", ret, 0, "Invalid package name returns 0\n"); -} - -static void utc_livebox_service_mouse_event_p(void) -{ - int ret; - ret = livebox_service_mouse_event(MUSIC_EASYBOX); - dts_check_eq("livebox_service_mouse_event", ret, 1, "music player returns 1\n"); -} - -static void utc_livebox_service_touch_effect_n(void) -{ - int ret; - ret = livebox_service_touch_effect(NULL, LB_SIZE_TYPE_1x1); - dts_check_eq("livebox_service_touch_effect", ret, 1, "Default touch effect is 1\n"); -} - -static void utc_livebox_service_touch_effect_p(void) -{ - int ret; - ret = livebox_service_touch_effect(MUSIC_LIVEBOX, LB_SIZE_TYPE_1x1); - dts_check_eq("livebox_service_touch_effect", ret, 1, "Default touch effect is 1\n"); -} - -static void utc_livebox_service_need_frame_n(void) -{ - int ret; - ret = livebox_service_need_frame(NULL, LB_SIZE_TYPE_1x1); - dts_check_eq("livebox_service_need_frame", ret, 0, "Default need_frame is 0\n"); -} - -static void utc_livebox_service_need_frame_p(void) -{ - int ret; - ret = livebox_service_need_frame(MUSIC_LIVEBOX, LB_SIZE_TYPE_1x1); - dts_check_eq("livebox_service_need_frame", ret, 0, "Default need_frame is 0\n"); -} - -static void utc_livebox_service_trigger_update_n(void) -{ - int ret; - ret = livebox_service_trigger_update(NULL, NULL, NULL, NULL, 0); - dts_check_eq("livebox_service_trigger_update", ret, LB_STATUS_ERROR_INVALID, "Invalid livebox\n"); -} - -static void utc_livebox_service_trigger_update_p(void) -{ - int ret; - ret = livebox_service_trigger_update(MUSIC_LIVEBOX, NULL, NULL, NULL, 0); - dts_check_eq("livebox_service_trigger_update", ret, LB_STATUS_SUCCESS, "Invalid livebox\n"); -} - -static void utc_livebox_service_trigger_update_with_content_n(void) -{ - int ret; - ret = livebox_service_trigger_update_with_content(NULL, NULL, NULL, NULL, NULL, 0); - dts_check_eq("livebox_service_trigger_update_with_content", ret, LB_STATUS_ERROR_INVALID, "Invalid livebox\n"); -} - -static void utc_livebox_service_trigger_update_with_content_p(void) -{ - int ret; - ret = livebox_service_trigger_update_with_content(MUSIC_LIVEBOX, NULL, NULL, NULL, NULL, 0); - dts_check_eq("livebox_service_trigger_update_with_content", ret, LB_STATUS_ERROR_INVALID, "Invalid livebox\n"); -} - -static void utc_livebox_service_change_period_n(void) -{ - int ret; - - ret = livebox_service_change_period(NULL, NULL, 0.0f); - dts_check_eq("livebox_service_change_period", ret, LB_STATUS_ERROR_INVALID, "Invalid livebox\n"); -} - -static void utc_livebox_service_change_period_p(void) -{ - int ret; - - ret = livebox_service_change_period(MUSIC_LIVEBOX, NULL, 1.0f); - dts_check_eq("livebox_service_change_period", ret, LB_STATUS_SUCCESS, "Invalid livebox\n"); -} - -static int get_pkglist_cb(const char *pkgid, const char *lbid, int is_prime, void *data) -{ -} - -static void utc_livebox_service_get_pkglist_n(void) -{ - int ret; - ret = livebox_service_get_pkglist(NULL, NULL); - dts_check_eq("livebox_service_get_pkglist", ret, LB_STATUS_ERROR_INVALID, "Invalid callback\n"); -} - -static void utc_livebox_service_get_pkglist_p(void) -{ - int ret; - ret = livebox_service_get_pkglist(get_pkglist_cb, NULL); - dts_check_eq("livebox_service_get_pkglist", ret, LB_STATUS_SUCCESS, "Valid callback\n"); -} - -static void utc_livebox_service_get_applist_n(void) -{ - int ret; - ret = livebox_service_get_applist(NULL, NULL, NULL); - dts_check_eq("livebox_service_get_applist", ret, LB_STATUS_ERROR_INVALID, "LB_STATUS_ERROR_INVALID\n"); -} - -static void app_list_cb(const char *lbid, const char *appid, void *data) -{ -} - -static void utc_livebox_service_get_applist_p(void) -{ - int ret; - - // Getting the UI-App list - ret = livebox_service_get_applist(MUSIC_LIVEBOX, app_list_cb, NULL); - dts_check_eq("livebox_service_get_applist", ret, LB_STATUS_SUCCESS, "LB_STATUS_ERROR_INVALID\n"); -} - -static void utc_livebox_service_mainappid_n(void) -{ - const char *appid; - appid = livebox_service_mainappid(NULL); - dts_check_eq("livebox_service_mainappid", appid, NULL, "\"NULL\" should be returned\n"); -} - -static void utc_livebox_service_mainappid_p(void) -{ - const char *appid; - appid = livebox_service_mainappid(MUSIC_LIVEBOX); - dts_check_str_eq("livebox_service_mainappid", appid, MUSIC_APP, "\"com.samsung.music-player\" should be returned\n"); -} - -static void utc_livebox_service_get_pkglist_by_pkgid_n(void) -{ - int ret; - ret = livebox_service_get_pkglist_by_pkgid(NULL, list_cb, NULL); - dts_check_eq("livebox_service_get_pkglist_by_pkgid", ret, LB_STATUS_ERROR_INVALID, "INVALID should be returned"); -} - -static void utc_livebox_service_get_pkglist_by_pkgid_p(void) -{ - int ret; - ret = livebox_service_get_pkglist_by_pkgid(MUSIC_APP, list_cb, NULL); - dts_check_ge("livebox_service_get_pkglist_by_pkgid", ret, 0, "greater than or equal to 0"); -} - -static void utc_livebox_service_pkgname_n(void) -{ - char *pkgname; - pkgname = livebox_service_pkgname(NULL); - dts_check_eq("livebox_service_pkgname", pkgname, NULL, "lbid is not exists"); -} - -static void utc_livebox_service_pkgname_p(void) -{ - char *pkgname; - pkgname = livebox_service_pkgname(MUSIC_APP); - dts_check_str_eq("livebox_service_pkgname", pkgname, MUSIC_LIVEBOX, "livebox music-player"); -} - -static void utc_livebox_service_is_primary_n(void) -{ - int ret; - ret = livebox_service_is_primary(NULL); - dts_check_str_eq("livebox_service_is_primary", ret, 0, "\"NULL\" is not primary(0)\n"); -} - -static void utc_livebox_service_is_primary_p(void) -{ - int ret; - ret = livebox_service_is_primary(MUSIC_LIVEBOX); - dts_check_str_eq("livebox_service_is_primary", ret, 1, "\"com.samsung.music-player\" is primary(1)\n"); -} - -static void utc_livebox_service_provider_name_n(void) -{ -//static char *livebox_service_provider_name(const char *lbid); - char *provider; - provider = livebox_service_provider_name(NULL); - dts_check_eq("livebox_service_provider_name", provider, NULL, "returns NULL"); -} - -static void utc_livebox_service_provider_name_p(void) -{ - char *provider; - provider = livebox_service_provider_name(MUSIC_LIVEBOX); - dts_check_str_eq("livebox_service_provider_name", provider, MUSIC_LIVEBOX, "inhouse livebox"); -} - -static void utc_livebox_service_setup_appid_n(void) -{ -//static char *livebox_service_setup_appid(const char *lbid); - char *setup; - setup = livebox_service_setup_appid(NULL); - dts_check_eq("livebox_service_setup_appid", setup, NULL, "setup is NULL"); -} - -static void utc_livebox_service_setup_appid_p(void) -{ - char *setup; - setup = livebox_service_setup_appid(MUSIC_LIVEBOX); - dts_check_eq("livebox_service_setup_appid", setup, MUSIC_LIVEBOX, "setup app"); -} - -static void utc_livebox_service_appid_n(void) -{ - char *appid; - appid = livebox_service_appid(NULL); - dts_check_eq("livebox_service_appid", appid, NULL, "appid is NULL"); -} - -static void utc_livebox_service_appid_p(void) -{ - char *appid; - appid = livebox_service_appid(MUSIC_LIVEBOX); - dts_check_str_eq("livebox_service_appid", appid, MUSIC_APP, "appid is com.samsung.music-player"); -} - -static void utc_livebox_service_i18n_name_n(void) -{ - char *name; - name = livebox_service_i18n_name(NULL, NULL); - dts_check_eq("livebox_service_i18n_name", name, NULL, "name is NULL"); -} - -static void utc_livebox_service_i18n_name_p(void) -{ - char *name; - name = livebox_service_i18n_name(MUSIC_LIVEBOX, NULL); - dts_check_ne("livebox_service_i18n_name", name, NULL, "name is not NULL"); -} - -static void utc_livebox_service_privew_n(void) -{ - char *preview; - preview = livebox_service_preview(MUSIC_LIVEBOX, LB_SIZE_TYPE_1x1); - dts_check_eq("livebox_service_preview", preview, NULL, "preview is NULL"); -} - -static void utc_livebox_service_preview_p(void) -{ - char *preview; - preview = livebox_service_preview(MUSIC_LIVEBOX, LB_SIZE_TYPE_1x1); - dts_check_ne("livebox_service_preview", preview, NULL, "preview is not NULL"); -} - -static void utc_livebox_service_content_n(void) -{ - char *content; - content = livebox_service_content(NULL); - dts_check_eq("livebox_service_content", content, NULL, "content is NULL"); -} - -static void utc_livebox_service_content_p(void) -{ - char *content; - content = livebox_service_content(MUSIC_LIVEBOX); - dts_check_ne("livebox_service_content", content, NULL, "content is not NULL"); -} - -static void utc_livebox_service_i18n_icon_p(void) -{ - char *icon; - - icon = livebox_service_i18n_icon(NULL, NULL); - dts_check_eq("livebox_service_i18n_icon", icon, NULL, "icon is NULL"); -} - -static void utc_livebox_service_i18n_icon_n(void) -{ - char *icon; - - icon = livebox_service_i18n_icon(MUSIC_LIVEBOX, NULL); - dts_check_ne("livebox_service_i18n_icon", icon, NULL, "icon is not NULL"); -} - -static void utc_livebox_service_libexec_p(void) -{ - char *libexec; - libexec = livebox_service_libexec(NULL); - dts_check_eq("livebox_service_libexec", libexec, NULL, "libexec is NULL"); -} - -static void utc_livebox_service_libexec_n(void) -{ - char *libexec; - libexec = livebox_service_libexec(MUSIC_LIVEBOX); - dts_check_ne("livebox_service_libexec", libexec, NULL, "libexec is not NULL"); -} - -static void utc_livebox_service_nodisplay_p(void) -{ - int ret; - ret = livebox_service_nodisplay(NULL); - dts_check_eq("livebox_service_nodisplay", ret, 0, "nodisplay is false"); -} - -static void utc_livebox_service_nodisplay_n(void) -{ - int ret; - ret = livebox_service_nodisplay(MUSIC_LIVEBOX); - dts_check_eq("livebox_service_nodisplay", ret, 0, "nodisplay is false"); -} - -static void utc_livebox_service_abi_p(void) -{ - char *abi; - abi = livebox_service_abi(NULL); - dts_check_eq("livebox_service_abi", abi, NULL, "abi is NULL"); -} - -static void utc_livebox_service_abi_n(void) -{ - char *abi; - abi = livebox_service_abi(MUSIC_LIVEBOX); - dts_check_ne("livebox_service_abi", abi, NULL, "abi is not NULL"); -} - -static void utc_livebox_service_is_enabled_n(void) -{ - /*! - * static int livebox_service_is_enabled(const char *lbid); - * - Not implemented - */ -} - -static void utc_livebox_service_is_enabled_p(void) -{ - /*! - * static int livebox_service_is_enabled(const char *lbid); - * - Not implemented - */ -} - -static void utc_livebox_service_lb_script_path_n(void) -{ - char *lb_path; - lb_path = livebox_service_lb_script_path(NULL); - dts_check_eq("livebox_service_lb_script_path", lb_path, NULL, "lb_path is NULL"); -} - -static void utc_livebox_service_lb_script_path_p(void) -{ - char *lb_path; - lb_path = livebox_service_lb_script_path(MUSIC_LIVEBOX); - dts_check_ne("livebox_service_lb_script_path", lb_path, NULL, "lb_path is NULL"); -} - -static void utc_livebox_service_lb_script_group_n(void) -{ - char *lb_group; - lb_group = livebox_service_lb_script_group(NULL); - dts_check_ne("livebox_service_lb_script_group", lb_group, NULL, "lb_group is NULL"); -} - -static void utc_livebox_service_lb_script_group_p(void) -{ - char *lb_group; - lb_group = livebox_service_lb_script_group(MUSIC_LIVEBOX); - dts_check_ne("livebox_service_lb_script_group", lb_group, NULL, "lb_group is NULL"); -} - -static void utc_livebox_service_pd_script_path_n(void) -{ - char *pd_script; - pd_script = livebox_service_pd_script_path(NULL); - dts_check_eq("livebox_service_pd_script_path", pd_script, NULL, "pd_script is NULL"); -} - -static void utc_livebox_service_pd_script_path_p(void) -{ - char *pd_script; - pd_script = livebox_service_pd_script_path(MUSIC_LIVEBOX); - dts_check_ne("livebox_service_pd_script_path", pd_script, NULL, "pd_script is NULL"); -} - -static void utc_livebox_service_pd_script_group_p(void) -{ - char *pd_group; - pd_group = livebox_service_pd_script_group(MUSIC_LIVEBOX); - dts_check_ne("livebox_service_pd_script_group", pd_group, NULL, "pd_script is NULL"); -} - -static void utc_livebox_service_pd_script_group_n(void) -{ - char *pd_group; - pd_group = livebox_service_pd_script_group(MUSIC_LIVEBOX); - dts_check_eq("livebox_service_pd_script_group", pd_group, NULL, "pd_script is NULL"); -} - -static void utc_livebox_service_get_supported_sizes_n(void) -{ - int cnt = NR_OF_SIZE_LIST; - int w[NR_OF_SIZE_LIST]; - int h[NR_OF_SIZE_LIST]; - int ret; - - ret = livebox_service_get_supported_sizes(NULL, &cnt, w, h); - dts_check_eq("livebox_service_get_supported_sizes", ret, LB_STATUS_ERROR_INVALID, "supported sizes is 0"); -} - -static void utc_livebox_service_get_supported_sizes_p(void) -{ - int cnt = NR_OF_SIZE_LIST; - int w[NR_OF_SIZE_LIST]; - int h[NR_OF_SIZE_LIST]; - int ret; - - ret = livebox_service_get_supported_sizes(MUSIC_LIVEBOX, &cnt, w, h); - dts_check_eq("livebox_service_get_supported_sizes", ret, 0, "supported sizes is 0"); -} - -static void utc_livebox_service_get_supported_size_types_n(void) -{ - int cnt = NR_OF_SIZE_LIST; - int sizes[NR_OF_SIZE_LIST]; - int ret; - - ret = livebox_service_get_supported_size_types(NULL, &cnt, sizes); - dts_check_eq("livebox_service_get_supported_sizes", ret, LB_STATUS_ERROR_INVALID, "supported sizes is 0"); -} - -static void utc_livebox_service_get_supported_size_types_p(void) -{ - int cnt = NR_OF_SIZE_LIST; - int sizes[NR_OF_SIZE_LIST]; - int ret; - - ret = livebox_service_get_supported_size_types(MUSIC_LIVEBOX, &cnt, sizes); - dts_check_eq("livebox_service_get_supported_sizes", ret, 0, "supported sizes is 0"); -} - -static int category_cb(const char *cluster, const char *category, void *data) -{ - return 0; -} - -static void utc_livebox_service_enumerate_category_list_n(void) -{ - int ret; - ret = livebox_service_enumerate_category_list(NULL, NULL, NULL); - dts_check_eq("livebox_service_enumerate_category_list", ret, LB_STATUS_ERROR_INVALID, "invalid argument"); -} - -static void utc_livebox_service_enumerate_category_list_p(void) -{ - int ret; - ret = livebox_service_enumerate_category_list("default", category_cb, NULL); - dts_check_eq("livebox_service_enumerate_category_list", ret, LB_STATUS_ERROR_INVALID, "invalid argument"); -} - -static void utc_livebox_service_enumerate_cluster_list_n(void) -{ -//static int livebox_service_enumerate_cluster_list(int (*cb)(const char *cluster, void *data), void *data); - int ret; - ret = livebox_service_enumerate_cluster_list(NULL, NULL); - dts_check_eq("livebox_service_enumerate_cluster_list", ret, LB_STATUS_ERROR_INVALID, "invalid argument"); -} - -static void utc_livebox_service_enumerate_cluster_list_p(void) -{ - int ret; - ret = livebox_service_enumerate_cluster_list(cluster_cb, NULL); - dts_check_ne("livebox_service_enumerate_cluster_list", ret, 0, "invalid argument"); -} - -static void utc_livebox_service_init_n(void) -{ - /*! - * \note - * Unable to test initialize function - */ -} - -static void utc_livebox_service_init_p(void) -{ - int ret; - - ret = livebox_service_init(); - dts_check_eq("livebox_service_init", ret, LB_STATUS_SUCCESS, "Success"); -} - -static void utc_livebox_service_fini_n(void) -{ - /*! - * \note - * Unable to test finalize function - */ -} - -static void utc_livebox_service_fini_p(void) -{ - int ret; - ret = livebox_service_fini(); - dts_check_eq("livebox_service_fini", ret, LB_STATUS_SUCCESS, "Success"); -} - -static void utc_livebox_service_pkglist_create_n(void) -{ - /*! - * \note - * Unable to test finalize function - */ -} - -static void utc_livebox_service_pkglist_create_p(void) -{ - struct pkglist_handle *handle; - - handle = livebox_service_pkglist_create(NULL, NULL); - dts_check_ne("livebox_service_pkglist_create", handle, NULL, "Success"); -} - -static void utc_livebox_service_get_pkglist_item_n(void) -{ - char *lbid; - char *pkgname; - int prime; - int ret; - - ret = livebox_service_get_pkglist_item(NULL, &lbid, &pkgname, &prime); - dts_check_eq("livebox_service_get_pkglist_item", ret, LB_STATUS_ERROR_INVALID, "Invalid"); -} - -static void utc_livebox_service_get_pkglist_item_p(void) -{ - struct pkglist_handle *handle; - char *lbid; - char *pkgname; - int prime; - int ret; - - handle = livebox_service_pkglist_create(NULL, NULL); - ret = livebox_service_get_pkglist_item(handle, &lbid, &pkgname, &prime); - dts_check_eq("livebox_service_get_pkglist_item", ret, LB_STATUS_SUCCESS, "Success"); -} - -static void utc_livebox_service_pkglist_destroy_n(void) -{ - int ret; - - ret = livebox_service_pkglist_destroy(NULL); - dts_check_eq("livebox_service_pkglist_destroy", ret, LB_STATUS_ERROR_INVALID, "Invalid"); -} - -static void utc_livebox_service_pkglist_destroy_p(void) -{ - struct pkglist_handle *handle; - int ret; - - handle = livebox_service_pkglist_create(NULL, NULL); - ret = livebox_service_pkglist_destroy(handle); - dts_check_eq("livebox_service_pkglist_destroy", ret, LB_STATUS_ERROR_INVALID, "Invalid"); -} - -struct tet_testlist tet_testlist[] = { - { utc_livebox_service_get_size_n, NEGATIVE_TC_IDX }, - { utc_livebox_service_get_size_p, POSITIVE_TC_IDX }, - { utc_livebox_service_size_type_n, NEGATIVE_TC_IDX }, - { utc_livebox_service_size_type_p, POSITIVE_TC_IDX }, - { utc_livebox_service_mouse_event_n, NEGATIVE_TC_IDX }, - { utc_livebox_service_mouse_event_p, POSITIVE_TC_IDX }, - { utc_livebox_service_touch_effect_n, NEGATIVE_TC_IDX }, - { utc_livebox_service_touch_effect_p, POSITIVE_TC_IDX }, - { utc_livebox_service_need_frame_n, NEGATIVE_TC_IDX }, - { utc_livebox_service_need_frame_p, POSITIVE_TC_IDX }, - { utc_livebox_service_trigger_update_n, NEGATIVE_TC_IDX }, - { utc_livebox_service_trigger_update_p, POSITIVE_TC_IDX }, - { utc_livebox_service_trigger_update_with_content_n, NEGATIVE_TC_IDX }, - { utc_livebox_service_trigger_update_with_content_p, POSITIVE_TC_IDX }, - { utc_livebox_service_change_period_n, NEGATIVE_TC_IDX }, - { utc_livebox_service_change_period_p, POSITIVE_TC_IDX }, - { utc_livebox_service_get_pkglist_n, NEGATIVE_TC_IDX }, - { utc_livebox_service_get_pkglist_p, POSITIVE_TC_IDX }, - { utc_livebox_service_get_applist_n, NEGATIVE_TC_IDX }, - { utc_livebox_service_get_applist_p, POSITIVE_TC_IDX }, - { utc_livebox_service_mainappid_n, NEGATIVE_TC_IDX }, - { utc_livebox_service_mainappid_p, POSITIVE_TC_IDX }, - { utc_livebox_service_get_pkglist_by_pkgid_n, NEGATIVE_TC_IDX }, - { utc_livebox_service_get_pkglist_by_pkgid_p, POSITIVE_TC_IDX }, - { utc_livebox_service_pkgname_n, NEGATIVE_TC_IDX }, - { utc_livebox_service_pkgname_p, POSITIVE_TC_IDX }, - { utc_livebox_service_is_primary_n, NEGATIVE_TC_IDX }, - { utc_livebox_service_is_primary_p, POSITIVE_TC_IDX }, - { utc_livebox_service_provider_name_n, NEGATIVE_TC_IDX }, - { utc_livebox_service_provider_name_p, POSITIVE_TC_IDX }, - { utc_livebox_service_setup_appid_n, NEGATIVE_TC_IDX }, - { utc_livebox_service_setup_appid_p, POSITIVE_TC_IDX }, - { utc_livebox_service_appid_n, NEGATIVE_TC_IDX }, - { utc_livebox_service_appid_p, POSITIVE_TC_IDX }, - { utc_livebox_service_i18n_name_n, NEGATIVE_TC_IDX }, - { utc_livebox_service_i18n_name_p, POSITIVE_TC_IDX }, - { utc_livebox_service_privew_n, NEGATIVE_TC_IDX }, - { utc_livebox_service_preview_p, POSITIVE_TC_IDX }, - { utc_livebox_service_content_n, NEGATIVE_TC_IDX }, - { utc_livebox_service_content_p, POSITIVE_TC_IDX }, - { utc_livebox_service_content_n, NEGATIVE_TC_IDX }, - { utc_livebox_service_i18n_icon_p, POSITIVE_TC_IDX }, - { utc_livebox_service_i18n_icon_n, NEGATIVE_TC_IDX }, - { utc_livebox_service_libexec_p, POSITIVE_TC_IDX }, - { utc_livebox_service_libexec_n, NEGATIVE_TC_IDX }, - { utc_livebox_service_nodisplay_p, POSITIVE_TC_IDX }, - { utc_livebox_service_nodisplay_n, NEGATIVE_TC_IDX }, - { utc_livebox_service_abi_p, POSITIVE_TC_IDX }, - { utc_livebox_service_abi_n, NEGATIVE_TC_IDX }, - { utc_livebox_service_is_enabled_n, NEGATIVE_TC_IDX }, - { utc_livebox_service_is_enabled_p, POSITIVE_TC_IDX }, - { utc_livebox_service_lb_script_path_n, NEGATIVE_TC_IDX }, - { utc_livebox_service_lb_script_path_p, POSITIVE_TC_IDX }, - { utc_livebox_service_lb_script_group_n, NEGATIVE_TC_IDX }, - { utc_livebox_service_lb_script_group_p, POSITIVE_TC_IDX }, - { utc_livebox_service_pd_script_path_n, NEGATIVE_TC_IDX }, - { utc_livebox_service_pd_script_path_p, POSITIVE_TC_IDX }, - { utc_livebox_service_pd_script_group_p, POSITIVE_TC_IDX }, - { utc_livebox_service_pd_script_group_n, NEGATIVE_TC_IDX }, - { utc_livebox_service_get_supported_sizes_n, NEGATIVE_TC_IDX }, - { utc_livebox_service_get_supported_sizes_p, POSITIVE_TC_IDX }, - { utc_livebox_service_get_supported_size_types_n, NEGATIVE_TC_IDX }, - { utc_livebox_service_get_supported_size_types_p, POSITIVE_TC_IDX }, - { utc_livebox_service_enumerate_category_list_n, NEGATIVE_TC_IDX }, - { utc_livebox_service_enumerate_category_list_p, POSITIVE_TC_IDX }, - { utc_livebox_service_enumerate_cluster_list_n, NEGATIVE_TC_IDX }, - { utc_livebox_service_enumerate_cluster_list_p, POSITIVE_TC_IDX }, - { utc_livebox_service_init_n, NEGATIVE_TC_IDX }, - { utc_livebox_service_init_p, POSITIVE_TC_IDX }, - { utc_livebox_service_fini_n, NEGATIVE_TC_IDX }, - { utc_livebox_service_fini_p, POSITIVE_TC_IDX }, - { utc_livebox_service_pkglist_create_n, NEGATIVE_TC_IDX }, - { utc_livebox_service_pkglist_create_p, POSITIVE_TC_IDX }, - { utc_livebox_service_get_pkglist_item_n, NEGATIVE_TC_IDX }, - { utc_livebox_service_get_pkglist_item_p, POSITIVE_TC_IDX }, - { utc_livebox_service_pkglist_destroy_n, NEGATIVE_TC_IDX }, - { utc_livebox_service_pkglist_destroy_p, POSITIVE_TC_IDX }, - { NULL, 0 }, -}; - diff --git a/TC/tetbuild.cfg b/TC/tetbuild.cfg deleted file mode 100644 index f7eda55..0000000 --- a/TC/tetbuild.cfg +++ /dev/null @@ -1,5 +0,0 @@ -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 deleted file mode 100644 index 02d7030..0000000 --- a/TC/tetclean.cfg +++ /dev/null @@ -1,5 +0,0 @@ -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 deleted file mode 100644 index ef3e452..0000000 --- a/TC/tetexec.cfg +++ /dev/null @@ -1,5 +0,0 @@ -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/doc/image/BuildShortcutList.png b/doc/image/BuildShortcutList.png Binary files differdeleted file mode 100644 index b40db50..0000000 --- a/doc/image/BuildShortcutList.png +++ /dev/null diff --git a/doc/image/JumpToApp.png b/doc/image/JumpToApp.png Binary files differdeleted file mode 100644 index 5a51d2b..0000000 --- a/doc/image/JumpToApp.png +++ /dev/null diff --git a/doc/image/ShortcutApp.png b/doc/image/ShortcutApp.png Binary files differdeleted file mode 100644 index a4cd97e..0000000 --- a/doc/image/ShortcutApp.png +++ /dev/null diff --git a/doc/image/ShortcutUG.png b/doc/image/ShortcutUG.png Binary files differdeleted file mode 100644 index 80b92ee..0000000 --- a/doc/image/ShortcutUG.png +++ /dev/null diff --git a/doc/shortcut_doc.h b/doc/shortcut_doc.h deleted file mode 100644 index 55b7c9a..0000000 --- a/doc/shortcut_doc.h +++ /dev/null @@ -1,235 +0,0 @@ -/* - * Copyright (c) 2000 - 2013 Samsung Electronics Co., Ltd. All rights reserved. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - */ - -#ifndef __SHORTCUT_DOC_H__ -#define __SHORTCUT_DOC_H__ - -/** - * @defgroup SHORTCUT_MODULE Shortcut - * @brief To enhance the Add to home feature. Two types of API set are supported. - * - One for the homescreen developers. - * - The others for the application developers who should implement the Add to home feature. - * @ingroup CORE_LIB_GROUP - * @section SHORTCUT_MODULE_HEADER Required Header - * \#include <shortcut.h> - * @section SHORTCUT_MODULE_OVERVIEW Overview -<H1>1. Shortcut</H1> -Tizen is supporting the "add shortcut or add to home" for various applications. -Developers may use the shortcut library (libshortcut) to implement features sending (applications) and receiving (possibly home screen) shortcuts. -If home screen implements the shortcut service using the library, the applications are good to go for adding their shortcuts to the home screen(, and vice versa.) - -<H1>2. How to add a new shortcut to the home screen</H1> -<H2>2.1 Add to home (From the app to home)</H2> - -The followings are two separate APIs to support "add to home" feature. - -\code -typedef int (*result_cb_t)(int ret, int pid, void *data) - -extern int add_to_home_shortcut(const char *pkgname, const char *name, int type, const char *content_info, const char *icon, result_cb_t result_cb, void *data) - -extern int add_to_home_livebox(const char *pkgname, const char *name, int type, const char *content, const char *icon, double period, result_cb_t result_cb, void *data) -\endcode - -Currently, our home screen can contain two different types of contents (that are pure shortcuts and liveboxes). - -To add a pure shortcut i.e., simply for launching an app, developers can use "add_to_home_shortcut" API to deliver their shortcuts to a home screen. - -If your application supports our livebox service and implments livebox type shortcut, then you can use "add_to_home_livebox" API to have a home screen add the livebox on its screen. - -<TABLE> -<TR><TH>Parameters</TH><TH>Comment</TH></TR> -<TR><TD>pkgname</TD><TD>Package name</TD></TR> -<TR><TD>name</TD><TD>Application name wich will be displayed on the screen</TD></TR> -<TR><TD>type</TD><TD>Basically it describes launching options whether to use a package name or URI. LAUNCH_BY_PACKAGE or LAUNCH_BY_URI</TD></TR> -<TR><TD>content</TD><TD> -Application data used for creating a pure shortcut or creating a livebox - - Shortcut - -1. if the type is Launch by package: None - -2. if the type is Launch by URI: put the URI in the content - - Livebox: any data necessary to create a livebox. Basically, it will passed to the livebox plug-in's create function. -</TD></TR> -<TR><TD>icon</TD><TD>Absolute path to the icon file, If you set this "NULL", the home screen will use the deafult icon file (but it is depends on the homescreen implementations)</TD></TR> -<TR><TD>period</TD><TD><Only for livebox> Update period. The period must be greater than 0.0f</TD></TR> -<TR><TD>result_cb</TD><TD>Result callback. The callback will be called after a shortcut or livebox has been added. Don't forget to check the return value.</TD></TR> -<TR><TD>data</TD><TD>Callback data</TD></TR> -</TABLE> - -<H3>2.1.1 Supported types</H3> -\snippet lib/include/shortcut.h Enumeration values for type of shortcuts - -<H2>2.2 Add shortcut (Home screen retrieves shortcuts from app)</H2> -"Add shortcut " service enables home screen to retrieve all shortcuts that applications promised to support and request an app to send their shortcuts to home directly, as opposed to "add to home". - -It is initiated by home screen as opposed to "add to home" which is initiated by an application."Add shortcut " service enables home screen to retrieve all shortcuts that applications promised to support and request an app to send their shortcuts to home directly, as opposed to "add to home". - -It is initiated by home screen as opposed to "add to home" which is initiated by an application. - -<H3>2.2.1 Build the shortcut list DB</H3> -\image html BuildShortcutList.png - -To recognize how many and what kinds of shortcuts have been registerred, each application who wants to support "add shortcut" service needs to install the XML file that defines "shortcut" information. -The following table describes the format and information necessary to define the shortcuts application can support. -Then, the information will be shown and used in home screen when a user selects "add shortcut" service. - -<TABLE> -<TH><TD>Syntax of the shortcut manifest file</TD></TH> -<TR><TD> -\code -<manifest xmlns="http://tizen.org/ns/packages" package="com.samsung.APP_PKGNAME"> -... - <shortcut-list> - <shortcut appid="com.samsung.myapp" extra_key="key_string" extra_data="data_string_for_key"> - <icon>/opt/share/icons/default/small/com.samsung.myapp-shortcut.png</icon> - <label>Default name</label> - <label xml:lang="en-us">Name en</label> - <label xml:lang="nl-nl">Name nl</label> - <label xml:lang="de-de">Name de</label> - <label xml:lang="zh-hk">Name hk</label> - <label xml:lang="zh-cn">Name cn</label> - <label xml:lang="ru-ru">Name ru</label> - <label xml:lang="zh-tw">Name tw</label> - <label xml:lang="ja-jp">Name jp</label> - <label xml:lang="es-es">Name es</label> - <label xml:lang="el-gr">Name gr</label> - <label xml:lang="it-it">Name it</label> - <label xml:lang="tr-tr">Name tr</label> - <label xml:lang="pt-pt">Name pt</label> - <label xml:lang="fr-fr">Name fr</label> - <label xml:lang="ko-kr">Name kr</label> - </shortcut> - <shortcut appid="com.samsung.myapp" extra_key="key_string" extra_data="data_string_for_key"> - <label>Default name</label> - </shortcut> - ... - <shortcut appid="com.samsung.myapp" extra_key="key_string" extra_data="data_string_for_key"> - <label>Default name</label> - <icon>/opt/share/icons/default/small/com.samsung.myapp2.png</icon> - </shortcut> - </shortcut-list> -... -</manifest> -\endcode -</TD></TR> -</TABLE> - -Install this XML file to /opt/share/packages/YOUR_PKGNAME.xml (Note: After manifest has been applied to the binary, simply copy the content to your manifest file.) -Shortcut listing application will list up these items on its screen and each item will be displayed using the string in label field. -When selected, it will launch the selected app using app service with "appid" and a bundle holding data in the pair of extra_key and extra-data fields. -Obviously, icon will be used to display visual information for given shortcut type.(that said the icon could be other than the application's default icon) - -<H3>2.2.2 Jump to the APP</H3> -\image html JumpToApp.png - -Shortcut listing application will launch your application using app-svc with package name and param attributes. -It will use the pkgname and param attrbute to launch your application. -Shortcut list view will launch your "[App] Shortcut list" using followed code. - -<TABLE> -<TH><TD>Launch your app from shortcut list viewer</TD></TH> -<TR><TD> -\code -service_h service; -service_create(&service); -service_set_package(service, APPID); /* <shortcut appid="APPID" ...> */ -service_add_extra_data(service, EXTRA_KEY, EXTRA_DATA); /* <shortcut extra_key="EXTRA_KEY" extra_data="EXTRA_DATA" ...> */ -ret = service_send_launch_request(service, NULL, NULL); -if (ret ...) { } -service_destroy(service); -\endcode -</TD></TR> -</TABLE> -When your app is launched, the app should send a selected item as a shortcut or livebox to the home screen using "add_to_home" series functions mentioned above. - -<H3>2.2.3 What each app has to do</H3> -You can implement your shortcut list view using App or UG. - -Who is going to handle the shortcut - -<UL> -<LI>Handled by App - <LI>App should prepare a shortcut-add view as guided</LI> -</LI> -<LI>Handeld by UG - <LI>UG should be launched as an app and provide the shortcut-add view</LI> -</LI> -</UL> - -In your shortcut list view, you just call the "add_to_home_shortcut" or "add_to_home_livebox" which are described in the section 2.1 - -<H4>2.2.3.1 Handled by App</H4> -\image html ShortcutApp.png -When your application is launched by the shortcut list application (displayed on the left most of above figure). -Your application should go back to the normal view when you receive the PAUSE event. -If you didn't change the view of your application, the user will see this shortcut list view again even if the user -launches your application from the app-tray(or homescreen). -So you have to change the view from the shortcut list to the normal(or previous) view when you get the PAUSE event. - -<H4>2.2.3.2 Handled by UG</H4> -\image html ShortcutUG.png -In this case, the Shortcut List application will launch your UG as a process. -When you receive PAUSE event, or need to change to other view (not in the same UG), you should destroy current UG. -If you didn't destroy it, it will be reside on the process list. and it will not be destroyed automatically. - -Currently, UG container process only supporting the multiple instance for a process. -So if the user tries to add a new shortcut again from the shortcut list application, your UG will be launched again if you didn't -terminate previous UG process (when you got PAUSE event). - -<H1>3. What the home screen should do</H1> -\code -typedef int (*request_cb_t)(const char *pkgname, const char *name, int type, const char *content_info, const char *icon, int pid, double period, void *data) -extern int shortcut_set_request_cb(request_cb_t request_cb, void *data) -\endcode - -<TABLE> -<TR><TH>Parameter</TH><TH>Comment</TH></TR> -<TR><TD>pkgname</TD><TD>Package name to be added</TD></TR> -<TR><TD>name</TD><TD>Application name to be displayed on the screen</TD></TR> -<TR><TD>type</TD><TD>LAUNCH_BY_PACKAGE or LAUNCH_BY_URI</TD></TR> -<TR><TD>content_info</TD><TD>Used for the livebox, or homescreen by itself if it required.</TD></TR> -<TR><TD>icon</TD><TD>Absolute path of the icon file. (If it is not exists, the homescreen can use the deafult icon file)</TD></TR> -<TR><TD>pid</TD><TD>Reuquestor's Process ID</TD></TR> -<TR><TD>period</TD><TD>Update period only for the livebox</TD></TR> -<TR><TD>data</TD><TD>Callback data</TD></TR> -</TABLE> - -<H1>4. To list up shortcuts registred in the device</H1> -<TABLE> -<TR><TH>shortcut-list viewer will launch your app by this way</TH></TR> -<TR><TD> -\code -int shortcut_get_list(const char *pkgname, int (*cb)(const char *pkgname, const char *icon, const char *name, const char *extra_key, const char *extra_data, void *data), void *data) -\endcode -</TD></TR> -</TABLE> - -If you specified the "pkgname", this API will only gathering the given Package's shortcut list. -If you set is to NULL, this API will gathering all shortcuts. -Every shortcut item will be passed via "cb" callback function. so it will be invoked N times if the number of registered shortcut item is N. -pkgname and name and param is described in the XML file of each application package. -It will returns the number of shortcut items, or return <0 as an error value. - --EIO : failed to access shortcut list DB -> 0 : Number of shortcut items (count of callback function calling) - * - */ - -#endif /* __SHORTCUT_DOC_H__ */ diff --git a/lib/CMakeLists.txt b/lib/CMakeLists.txt deleted file mode 100644 index a0e7761..0000000 --- a/lib/CMakeLists.txt +++ /dev/null @@ -1,51 +0,0 @@ -PROJECT(shortcut C) - -INCLUDE_DIRECTORIES(${CMAKE_SOURCE_DIR}/lib/include) - -SET(PREFIX ${CMAKE_INSTALL_PREFIX}) -SET(EXEC_PREFIX "\${prefix}") -SET(LIBDIR "\${exec_prefix}/lib") -SET(INCLUDEDIR "\${prefix}/include/${PROJECT_NAME}") -SET(VERSION_MAJOR 0) -SET(VERSION "${VERSION_MAJOR}.0.1") - -INCLUDE(FindPkgConfig) -pkg_check_modules(svc_pkgs REQUIRED - dlog - sqlite3 - libxml-2.0 - glib-2.0 - db-util - com-core - vconf -) - -FOREACH(flag ${svc_pkgs_CFLAGS}) - SET(EXTRA_CFLAGS "${EXTRA_CFLAGS} ${flag}") -ENDFOREACH(flag) - -SET(EXTRA_CFLAGS "${EXTRA_CFLAGS} -fvisibility=hidden -g -Wall -Werror") -SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${EXTRA_CFLAGS}") - -ADD_DEFINITIONS("-DPREFIX=\"${PREFIX}\"") -ADD_DEFINITIONS("-DLOG_TAG=\"SHORTCUT\"") -ADD_DEFINITIONS("-D_USE_ECORE_TIME_GET") - -ADD_LIBRARY(${PROJECT_NAME} SHARED - src/main.c - src/icon.c - src/dlist.c -) - -TARGET_LINK_LIBRARIES(${PROJECT_NAME} ${svc_pkgs_LDFLAGS}) - -CONFIGURE_FILE(${PROJECT_NAME}.pc.in ${PROJECT_NAME}.pc @ONLY) -SET_DIRECTORY_PROPERTIES(PROPERTIES ADDITIONAL_MAKE_CLEAN_FILES "${PROJECT_NAME}.pc") - -INSTALL(TARGETS ${PROJECT_NAME} DESTINATION lib) -INSTALL(FILES ${CMAKE_SOURCE_DIR}/lib/include/shortcut.h DESTINATION include/${PROJECT_NAME}) -INSTALL(FILES ${CMAKE_BINARY_DIR}/lib/${PROJECT_NAME}.pc DESTINATION lib/pkgconfig) -INSTALL(FILES ${CMAKE_SOURCE_DIR}/lib/LICENSE DESTINATION /usr/share/license RENAME "lib${PROJECT_NAME}") - -SET_TARGET_PROPERTIES(${PROJECT_NAME} PROPERTIES SOVERSION ${VERSION_MAJOR}) -SET_TARGET_PROPERTIES(${PROJECT_NAME} PROPERTIES VERSION ${VERSION}) diff --git a/lib/LICENSE b/lib/LICENSE deleted file mode 100644 index 3b739e3..0000000 --- a/lib/LICENSE +++ /dev/null @@ -1,204 +0,0 @@ -Copyright (c) 2000 - 2013 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/lib/include/dlist.h b/lib/include/dlist.h deleted file mode 100644 index cd1a421..0000000 --- a/lib/include/dlist.h +++ /dev/null @@ -1,43 +0,0 @@ -/* - * Copyright 2013 Samsung Electronics Co., Ltd - * - * Licensed under the Flora License, Version 1.1 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://floralicense.org/license/ - * - * 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. - */ - -#define dlist_remove_data(list, data) do { \ - struct dlist *l; \ - l = dlist_find_data(list, data); \ - list = dlist_remove(list, l); \ -} while (0) - -#define dlist_foreach(list, l, data) \ - for ((l) = (list); (l) && ((data) = dlist_data(l)); (l) = dlist_next(l)) - -#define dlist_foreach_safe(list, l, n, data) \ - for ((l) = (list), (n) = dlist_next(l); \ - (l) && ((data) = dlist_data(l)); \ - (l) = (n), (n) = dlist_next(l)) - -struct dlist; - -extern struct dlist *dlist_append(struct dlist *list, void *data); -extern struct dlist *dlist_prepend(struct dlist *list, void *data); -extern struct dlist *dlist_remove(struct dlist *list, struct dlist *l); -extern struct dlist *dlist_find_data(struct dlist *list, void *data); -extern void *dlist_data(struct dlist *l); -extern struct dlist *dlist_next(struct dlist *l); -extern struct dlist *dlist_prev(struct dlist *l); -extern int dlist_count(struct dlist *l); -extern struct dlist *dlist_nth(struct dlist *l, int nth); - -/* End of a file */ diff --git a/lib/include/shortcut.h b/lib/include/shortcut.h deleted file mode 100644 index 14241d3..0000000 --- a/lib/include/shortcut.h +++ /dev/null @@ -1,673 +0,0 @@ -/* - * Copyright (c) 2000 - 2013 Samsung Electronics Co., Ltd. All rights reserved. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * -*/ - -#ifndef __SHORTCUT_H__ -#define __SHORTCUT_H__ - -#ifdef __cplusplus -extern "C" { -#endif - -/** - * @addtogroup SHORTCUT_MODULE - * @{ - */ - -struct shortcut_icon; -/** - * @brief This function prototype is used to define a callback function for the add_to_home reqeust. - * The homescreen should define a callback as this type and implementing the service code - * for adding a new application shortcut. - * @param[in] appid Shortcut is added for this package. - * @param[in] name Name for created shortcut icon. - * @param[in] type 3 kinds of types are defined. - * @param[in] content_info Specific information for creating a new shortcut. - * @param[in] icon Absolute path of an icon file for this shortcut. - * @param[in] pid Process ID of who request add_to_home. - * @param[in] allow_duplicate 1 if shortcut can be duplicated or a shourtcut should be exists only one. - * @param[in] data Callback data. - * @return int Developer should returns the result of handling shortcut creation request. - * Returns 0, if succeed to handles the add_to_home request, or returns proper errno. - * @see shortcut_set_request_cb - * @pre None - * @post None - * @remarks None - */ -typedef int (*request_cb_t)(const char *appid, const char *name, int type, const char *content_info, const char *icon, int pid, double period, int allow_duplicate, void *data); - -/** - * @brief This function prototype is used to define for receiving the result of add_to_home. - * @param[in] ret Result value, it could be 0 if succeed to add a shortcut, or errno. - * @param[in] pid Process ID of who handles this add_to_home request. - * @param[in] data Callback data. - * @return int Returns 0, if there is no error or returns errno. - * @see add_to_home_shortcut() - * @pre None - * @post None - * @remarks None - */ -typedef int (*result_cb_t)(int ret, int pid, void *data); - -/** - * @brief After send a request to create a icon snapshot image, this callback will be called with its result. - * @param[in] handle Handle of requestor - * @param[in] ret status of request - * @param[in] data Callback data - * @return int result state of callback call - * @retval 0 If it is successfully completed - * @see shortcut_icon_request_send() - * @pre None - * @post None - * @remarks None - */ -typedef int (*icon_request_cb_t)(struct shortcut_icon *handle, int ret, void *data); - -/** - * @brief Basically, three types of shortcut is defined. - * Every homescreen developer should support these types of shortcut. - * Or returns proper errno to figure out why the application failed to add a shortcut. - * LAUNCH_BY_PACKAGE is used for adding a package itself as a shortcut - * LAUNCH_BY_URI is used for adding a shortcut for "uri" data. - */ -//! [Enumeration values for type of shortcuts] -enum shortcut_type { - /*!< Deprecated type */ - SHORTCUT_PACKAGE = 0x00000000, /*!< Launch the package using given pakcage name. */ - SHORTCUT_DATA = 0x00000001, /*!< Launch the related package with given data(content_info). */ - SHORTCUT_FILE = 0x00000002, /*!< Launch the related package with given filename(content_info). */ - - /*!< Use these */ - LAUNCH_BY_PACKAGE = 0x00000000, /*!< Launch the package using given pakcage name. */ - LAUNCH_BY_URI = 0x00000001, /*!< Launch the related package with given data(URI). */ - - SHORTCUT_REMOVE = 0x40000000, /*!< Remove a shortcut */ - LIVEBOX_REMOVE = 0x80000000, /*!< Remove a livebox */ - - LIVEBOX_TYPE_DEFAULT = 0x10000000, /*!< Type mask for default livebox */ - LIVEBOX_TYPE_EASY_DEFAULT = 0x30000000, /*!< Type mask for easy mode livebox */ - LIVEBOX_TYPE_1x1 = 0x10010000, /*!< 1x1 */ - LIVEBOX_TYPE_2x1 = 0x10020000, /*!< 2x1 */ - LIVEBOX_TYPE_2x2 = 0x10040000, /*!< 2x2 */ - LIVEBOX_TYPE_4x1 = 0x10080000, /*!< 4x1 */ - LIVEBOX_TYPE_4x2 = 0x10100000, /*!< 4x2 */ - LIVEBOX_TYPE_4x3 = 0x10200000, /*!< 4x3 */ - LIVEBOX_TYPE_4x4 = 0x10400000, /*!< 4x4 */ - LIVEBOX_TYPE_4x5 = 0x11000000, /*!< 4x5 */ - LIVEBOX_TYPE_4x6 = 0x12000000, /*!< 4x6 */ - LIVEBOX_TYPE_EASY_1x1 = 0x30010000, /*!< Easy mode 1x1 */ - LIVEBOX_TYPE_EASY_3x1 = 0x30020000, /*!< Easy mode 3x2 */ - LIVEBOX_TYPE_EASY_3x3 = 0x30040000, /*!< Easy mode 3x3 */ - LIVEBOX_TYPE_UNKNOWN = 0x1FFF0000 /*!< Error */ -}; -//! [Enumeration values for type of shortcuts] - -enum shortcut_response { - SHORTCUT_SUCCESS = 0x00000000, /*!< Successfully handled */ - SHORTCUT_ERROR = 0x80000000, /*!< MSB(1). Check this using SHORTCUT_STATUS_IS_ERROR macro */ - SHORTCUT_ERROR_NO_SPACE = SHORTCUT_ERROR | 0x0001, /*!< There is no space to add new shortcut */ - SHORTCUT_ERROR_EXIST = SHORTCUT_ERROR | 0x0002, /*!< Shortcut is already added */ - SHORTCUT_ERROR_FAULT = SHORTCUT_ERROR | 0x0004, /*!< Failed to add a shortcut. Unrecoverable error */ - SHORTCUT_ERROR_UNSUPPORTED = SHORTCUT_ERROR | 0x0008, /*!< Unsupported shortcut */ - SHORTCUT_ERROR_BUSY = SHORTCUT_ERROR | 0x0010, /*!< Receiver is busy, try again later */ - SHORTCUT_ERROR_INVALID = SHORTCUT_ERROR | 0x0020, /*!< Shortcut request is not valid, invalid parameter or invalid argument value */ - SHORTCUT_ERROR_COMM = SHORTCUT_ERROR | 0x0040, /*!< Connection is not estabilished. or there is a problem of communication */ - SHORTCUT_ERROR_MEMORY = SHORTCUT_ERROR | 0x0080, /*!< Memory is not enough to handle new request */ - SHORTCUT_ERROR_IO = SHORTCUT_ERROR | 0x0100, /*!< Unable to access file or DB. Check your resource files */ - SHORTCUT_ERROR_PERMISSION = SHORTCUT_ERROR | 0x0200, /*!< Has no permission to add a shortcut */ - - SHORTCUT_STATUS_CARED = 0x08000000 /*!< Shortcut status is already cared. check this using SHORTCUT_STATUS_IS_CARED macro */ -}; - -/*! - * \brief Macro function for checking the type - * \param[in] type Type of box - * \return bool - * \retval true(1) If it is a livebox - * \retval false(0) if it is not a livebox - * \see shortcut_type - * \pre None - * \post None - * \remarks None - */ -#define ADD_TO_HOME_IS_LIVEBOX(type) (!!((type) & 0x10000000)) - -/*! - * \brief Macro function for checking the request type - * \param[in] type Request type - * \return bool - * \retval true(1) Shortcut remove request - * \retval false(0) Not a remove request - * \see shortcut_type - * \pre None - * \post None - * \remarks None - */ -#define ADD_TO_HOME_IS_REMOVE_SHORTCUT(type) (!!((type) & SHORTCUT_REMOVE)) - -/*! - * \brief Macro function for checking the request type - * \param[in] type Request type - * \return bool - * \retval true(1) Livebox remove request - * \retval false(0) Not a remove request - * \see shortcut_type - * \pre None - * \post None - * \remarks None - */ -#define ADD_TO_HOME_IS_REMOVE_LIVEBOX(type) (!!((type) & LIVEBOX_REMOVE)) - -/*! - * \brief Macro function for checking the status of request - * \param[in] type Status - * \return bool - * \retval true(1) Error - * \retval false(0) Not an error - * \see shortcut_response - * \pre None - * \post None - * \remarks None - */ -#define SHORTCUT_STATUS_IS_ERROR(type) (!!((type) & SHORTCUT_ERROR)) - -/*! - * \brief Macro function for checking the status of request - * \param[in] type Status - * \return bool - * \retval true(1) Shortcut request is already handled by requestee (homescreen, viewer, ...) - * \retval false(0) Request result should be cared by requestor - * \see shortcut_response - * \pre None - * \post None - * \remarks None - */ -#define SHORTCUT_STATUS_IS_CARED(type) (!!((type) & SHORTCUT_STATUS_CARED)) - -/*! - * \brief Filtering the pure error code from given status - * \param[in] status status - * \return status code (error) - * \see shortcut_response - * \pre None - * \post None - * \remarks None - * - */ -#define SHORTCUT_ERROR_CODE(status) ((status) & ~SHORTCUT_STATUS_CARED) - -/** - * @fn int shortcut_set_request_cb(request_cb_t request_cb, void *data) - * - * @brief Homescreen should use this function to service the shortcut creating request. - * - * @par Sync (or) Async: - * This is an asynchronous API. - * - * @par Important Notes: - * - Should be used from the homescreen. - * - Should check the return value of this function - * - * @param[in] request_cb Callback function pointer which will be invoked when add_to_home is requested. - * @param[in] data Callback data to deliver to the callback function. - * - * @return Return Type (int) - * - 0 - callback function is successfully registered - * - < 0 - Failed to register the callback function for request. - * - * @see request_cb_t - * - * @pre - You have to prepare a callback function - * - * @post - If a request is sent from the application, the registered callback will be invoked. - * - * @remarks - None - * - * @par Prospective Clients: - * Homescreen - * - * @par Example - * @code - * #include <shortcut.h> - * - * static int request_cb(const char *appid, const char *name, int type, const char *content_info, const char *icon, int pid, void *data) - * { - * printf("Package name: %s\n", appid); - * printf("Name: %s\n", name); - * printf("Type: %d\n", type); - * printf("Content: %s\n", content_info); - * printf("Icon: %s\n", icon); - * printf("Requested from: %d\n", pid); - * printf("CBDATA: %p\n", data); - * return 0; // returns success. - * } - * - * static int app_create(void *data) - * { - * shortcut_set_request_cb(request_cb, NULL); - * return 0; - * } - * - * int main(int argc, char *argv[]) - * { - * appcore.... - * } - * - * @endcode - */ -extern int shortcut_set_request_cb(request_cb_t request_cb, void *data); - -/** - * @fn add_to_home_shortcut(const char *appid, const char *name, int type, const char *content_info, const char *icon, int allow_duplicate, result_cb_t result_cb, void *data) - * - * @brief The application, which supporting the add_to_home feature, should invoke this. - * - * @par Sync (or) Async: - * This is an asynchronous API. - * - * @par Important Notes: - * - Application must check the return value of this function. - * - Application must check the return status from the callback function - * - Application should set the callback function to get the result of this request. - * - * @param[in] appid Package name of owner of this shortcut. - * @param[in] name Name for created shortcut icon. - * @param[in] type Type of shortcuts (livebox or shortcut, and its size if it is for the livebox) - * @param[in] content_info Specific information for delivering to the viewer for creating a shortcut. - * @param[in] icon Absolute path of an icon file - * @param[in] allow_duplicate set 1 If accept the duplicated shortcut or 0 - * @param[in] result_cb Address of callback function which will be called when the result comes back from the viewer. - * @param[in] data Callback data which will be used in callback function - * - * @return Return Type (int) - * \retval 0 Succeed to send the request - * \retval SHORTCUT_ERROR_FAULT Unrecoverable error - * \retval SHORTCUT_ERROR_INVALID Shortcut request is not valid, invalid parameter or invalid argument value - * \retval SHORTCUT_ERROR_COMM Connection is not estabilished. or there is a problem of communication - * \retval SHORTCUT_ERROR_MEMORY Memory is not enough to handle new request - * \retval SHORTCUT_ERROR_IO Unable to access file or DB. Check your resource files - * \retval SHORTCUT_ERROR_PERMISSION Has no permission to add a shortcut - * - * @see result_cb_t - * - * @pre You have to prepare the callback function - * - * @post You have to check the return status from callback function which is passed by argument. - * - * @remarks - If a homescreen does not support this feature, you will get proper error code. - * - * @par Prospective Clients: - * Inhouse Apps. - * - * @par Example - * @code - * - * #include <stdio.h> - * #include <shortcut.h> - * - * static int result_cb(int ret, int pid, void *data) - * { - * if (ret < 0) - * printf("Failed to add a shortcut: %s\n", perror(ret)); - * - * printf("Processed by the %d\n", pid); - * return 0; - * } - * - * static int app_create(void *data) - * { - * add_to_home_shortcut("com.samsung.gallery", "With friends", - * LAUNCH_BY_URI, "gallery:0000-0000", - * "/opt/media/Pictures/Friends.jpg", 0, result_cb, NULL); - * return 0; - * } - * - * int main(int argc, char *argv[]) - * { - * appcore.... - * } - * - * @endcode - */ -extern int add_to_home_shortcut(const char *appid, const char *name, int type, const char *content_info, const char *icon, int allow_duplicate, result_cb_t result_cb, void *data); - -/** - * @fn shortcut_get_list(const char *appid, int (*cb)(const char *appid, const char *icon, const char *name, const char *extra_key, const char *extra_data, void *data), void *data) - * - * @brief Getting the installed shortcut view list - * - * @par Sync (or) Async: - * This is a synchronous API. - * - * @par Important Notes: - * - Application must check the return value of this function. - * - Application must check the return status from the callback function - * - Application should set the callback function to get the result of this request. - * - * @param[in] appid Package name - * @param[in] cb Callback function to get the shortcut item information - * @param[in] data Callback data which will be used in callback function - * - * @return Return Type (int) - * \retval Number of items (call count of callback function) - * \retval SHORTCUT_ERROR_FAULT Unrecoverable error - * \retval SHORTCUT_ERROR_IO Unable to access file or DB. Check your resource files - * - * @see result_cb_t - * - * @pre You have to prepare the callback function - * - * @post You have to check the return status from callback function which is passed by argument. - * - * @remarks - If a homescreen does not support this feature, you will get proper error code. - * - * @par Prospective Clients: - * Inhouse Apps. - * - * @par Example - * @code - * @endcode - */ -extern int shortcut_get_list(const char *appid, int (*cb)(const char *appid, const char *icon, const char *name, const char *extra_key, const char *extra_data, void *data), void *data); - -/** - * @fn add_to_home_livebox(const char *appid, const char *name, int type, const char *content, const char *icon, double period, int allow_duplicate, result_cb_t result_cb, void *data); - * - * @brief The application, which supporting the add_to_home feature, should invoke this. - * - * @par Sync (or) Async: - * This is an asynchronous API. - * - * @par Important Notes: - * - Application must check the return value of this function. - * - Application must check the return status from the callback function - * - Application should set the callback function to get the result of this request. - * - * @param[in] appid Package name of owner of this shortcut. - * @param[in] name Name for created shortcut icon. - * @param[in] type Type of shortcuts (livebox or shortcut, and its size if it is for the livebox) - * @param[in] content_info Specific information for delivering to the viewer for creating a shortcut. - * @param[in] icon Absolute path of an icon file - * @param[in] period Update period - * @param[in] allow_duplicate set 1 If accept the duplicated shortcut or 0 - * @param[in] result_cb Address of callback function which will be called when the result comes back from the viewer. - * @param[in] data Callback data which will be used in callback function - * - * @return Return Type (int) - * \retval 0 Succeed to send the request - * \retval SHORTCUT_ERROR_FAULT Unrecoverable error - * \retval SHORTCUT_ERROR_INVALID Shortcut request is not valid, invalid parameter or invalid argument value - * \retval SHORTCUT_ERROR_COMM Connection is not estabilished. or there is a problem of communication - * \retval SHORTCUT_ERROR_MEMORY Memory is not enough to handle new request - * \retval SHORTCUT_ERROR_IO Unable to access file or DB. Check your resource files - * \retval SHORTCUT_ERROR_PERMISSION Has no permission to add a shortcut - * - * @see result_cb_t - * - * @pre You have to prepare the callback function - * - * @post You have to check the return status from callback function which is passed by argument. - * - * @remarks - If a homescreen does not support this feature, you will get proper error code. - * - * @par Prospective Clients: - * Inhouse Apps. - * - * @par Example - * @code - * - * #include <stdio.h> - * #include <shortcut.h> - * - * static int result_cb(int ret, int pid, void *data) - * { - * if (ret < 0) - * printf("Failed to add a shortcut: %s\n", perror(ret)); - * - * printf("Processed by the %d\n", pid); - * return 0; - * } - * - * static int app_create(void *data) - * { - * add_to_home_livebox("com.samsung.gallery.livebox", "With friends", - * LAUNCH_BY_URI, "gallery:0000-0000", - * "/opt/media/Pictures/Friends.jpg", -1.0f, 0, result_cb, NULL); - * return 0; - * } - * - * int main(int argc, char *argv[]) - * { - * appcore.... - * } - * - * @endcode - */ -extern int add_to_home_livebox(const char *appid, const char *name, int type, const char *content, const char *icon, double period, int allow_duplicate, result_cb_t result_cb, void *data); - -extern int add_to_home_remove_shortcut(const char *appid, const char *name, const char *content_info, result_cb_t result_cb, void *data); - -extern int add_to_home_remove_livebox(const char *appid, const char *name, result_cb_t result_cb, void *data); - - - -/*! - * \note - * Example) - * - * \code - * static int init_cb(int status, void *data) - * { - * printf("Initializer returns: %d\n", status); - * if (status == 0) { - * printf("Succeed to initialize\n"); - * } else { - * printf("Failed to initialize: %d\n", status); - * } - * } - * - * int main(int argc, char *argv[]) - * { - * // Initialize the service request - * int ret; - * - * // After the init_cb is called, you can use below functions. - * struct shortcut_icon *handle; - * - * ret = shortcut_icon_init(init_cb, NULL); - * if (ret < 0) { - * ... - * - * // Create request for creating shortcut icon. - * handle = shortcut_icon_create(); - * if (!handle) { - * ... - * } - * - * // Send the request to the shortcut service - * ret = shortcut_icon_request_set_info(handle, NULL, SHORTCUT_ICON_TYPE_IMAGE, "icon, "/usr/share/.../icon.png", NULL, NULL); - * if (ret < 0) { - * ... - * } - * - * ret = shortcut_icon_request_set_info(handle, NULL, SHORTCUT_ICON_TYPE_TEXT, "text, "app icon", NULL, NULL); - * if (ret < 0) { - * ... - * } - * - * ret = shortcut_icon_request_send(handle, LB_SIZE_TYPE_1x1, NULL, NULL, "/opt/usr/apps/com.samsung.cluster-home/data/out.png", result_cb, NULL); - * if (ret < 0) { - * ... - * } - * - * ret = shortcut_icon_request_destroy(handle); - * if (ret < 0) { - * ... - * } - * - * // Don't finalize the icon service if you don't get result callbacks of all requests - * ret = shortcut_icon_fini(); - * if (ret < 0) { - * ... - * } - * - * return 0; - * } - * \endcode - */ - -#define DEFAULT_ICON_PART "icon" -#define DEFAULT_NAME_PART "name" -#define SHORTCUT_ICON_TYPE_IMAGE "image" -#define SHORTCUT_ICON_TYPE_TEXT "text" -#define SHORTCUT_ICON_TYPE_SCRIPT "script" - -/*! - * \brief Initialize the icon creation service - * \remarks N/A - * \details N/A - * \param[in] init_cb Initialized result will be delievered via this callback - * \param[in] data Callback data - * \pre N/A - * \post N/A - * \return int - * \retval SHORTCUT_ERROR_INVALID Already initialized - * \retval SHORTCUT_ERROR_SUCCESS Successfully initialized - * \see shortcut_icon_service_fini - */ -extern int shortcut_icon_service_init(int (*init_cb)(int status, void *data), void *data); - -/*! - * \brief Finalize the icon creation service - * \remarks N/A - * \details N/A - * \pre N/A - * \post N/A - * \return int - * \retval SHORTCUT_SUCCESS Successfully initialized - * \retval SHORTCUT_ERROR_INVALID icon service is not initialized - * \see shortcut_icon_service_init - */ -extern int shortcut_icon_service_fini(void); - -/*! - * \brief Create a request object to create a new icon image - * \remarks N/A - * \details N/A - * \pre N/A - * \post N/A - * \return struct shortcut_icon * - * \retval NULL If it fails to create a new handle - * \retval pointer Handle address - * \see shortcut_icon_request_destroy - */ -extern struct shortcut_icon *shortcut_icon_request_create(void); - -/*! - * \brief Set infomration for creating icon image - * \details N/A - * \remarks N/A - * \param[in] handle Request handle - * \param[in] id Target ID to be affected by this data - * \param[in] type SHORTCUT_ICON_TYPE_IMAGE, SHORTCUT_ICON_TYPE_TEXT, SHORTCUT_ICON_TYPE_SCRIPT can be used - * \param[in] part Target part to be affect by this data - * \param[in] data type == IMAGE ? Image file path : type == TEXT ? text string : type == SCRIPT ? script file path : N/A - * \param[in] option Image load option or group name of script file to be loaded - * \param[in] subid ID for script. this ID will be used as "id" - * \pre N/A - * \post N/A - * \return int - * \retval Index of data set - * \retval SHORTCUT_ERROR_INVALID Invalid handle - * \retval SHORTCUT_ERROR_MEMORY Out of memory - * \see shortcut_icon_request_create - */ -extern int shortcut_icon_request_set_info(struct shortcut_icon *handle, const char *id, const char *type, const char *part, const char *data, const char *option, const char *subid); - -/*! - * \brief Send request to create an icon image - * \remarks N/A - * \details N/A - * \param[in] handle Icon request handle - * \param[in] size_type Size type to be created - * \param[in] layout layout filename (edje filename) - * \param[in] group group name - * \param[in] outfile output image filename - * \param[in] result_cb Result callback - * \param[in] data Callback data - * \pre N/A - * \post N/A - * \return int - * \retval SHORTCUT_ERROR_INVALID Invalid parameters - * \retval SHORTCUT_ERROR_MEMORY Out of memory - * \retval SHORTCUT_ERROR_FAULT Failed to send a request - * \retval SHORTCUT_SUCCESS Successfully sent - * \see shortcut_icon_service_fini - */ -extern int shortcut_icon_request_send(struct shortcut_icon *handle, int size_type, const char *layout, const char *group, const char *outfile, icon_request_cb_t result_cb, void *data); - -/*! - * \brief Destroy handle of creating shortcut icon request - * \remarks N/A - * \details N/A - * \param[in] handle Shortcut request handle - * \pre N/A - * \post N/A - * \return int - * \retval SHORTCUT_ERROR_INVALID Invalid handle - * \retval SHORTCUT_SUCCESS Successfully destroyed - * \see shortcut_icon_service_fini - */ -extern int shortcut_icon_request_destroy(struct shortcut_icon *handle); - - -/*! - * \brief Set private data to the handle to carry it with a handle. - * \remarks N/A - * \details N/A - * \param[in] handle Handle to be used for carrying a data - * \param[in] data Private data - * \pre N/A - * \post N/A - * \return int - * \retval SHORTCUT_ERROR_INVALID Invalid handle - * \retval SHORTCUT_SUCCESS Successfully done - * \see shortcut_icon_service_fini - */ -extern int shortcut_icon_request_set_data(struct shortcut_icon *handle, void *data); - -/*! - * \brief Get the private data from handle - * \remarks N/A - * \details N/A - * \param[in] handle - * \pre N/A - * \post N/A - * \return int - * \retval NULL If there is no data - * \retval pointer data pointer - * \see shortcut_icon_request_set_data - */ -extern void *shortcut_icon_request_data(struct shortcut_icon *handle); - -#ifdef __cplusplus -} -#endif - -#endif -/* @} - * End of a file - */ diff --git a/lib/include/shortcut_internal.h b/lib/include/shortcut_internal.h deleted file mode 100644 index e3186f6..0000000 --- a/lib/include/shortcut_internal.h +++ /dev/null @@ -1,37 +0,0 @@ -/* - * Copyright (c) 2000 - 2013 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. - * -*/ - -#if !defined(FLOG) -#define DbgPrint(format, arg...) SECURE_LOGD(format, ##arg) -#define ErrPrint(format, arg...) SECURE_LOGE(format, ##arg) -#else -extern FILE *__file_log_fp; -#define DbgPrint(format, arg...) do { fprintf(__file_log_fp, "[LOG] [[32m%s/%s[0m:%d] " format, basename(__FILE__), __func__, __LINE__, ##arg); fflush(__file_log_fp); } while (0) - -#define ErrPrint(format, arg...) do { fprintf(__file_log_fp, "[ERR] [[32m%s/%s[0m:%d] " format, basename(__FILE__), __func__, __LINE__, ##arg); fflush(__file_log_fp); } while (0) -#endif - -#define EAPI __attribute__((visibility("default"))) - -#if !defined(VCONFKEY_MASTER_STARTED) -#define VCONFKEY_MASTER_STARTED "memory/data-provider-master/started" -#endif - -#define DEFAULT_ICON_LAYOUT "" -#define DEFAULT_ICON_GROUP "" - -/* End of a file */ diff --git a/lib/shortcut.pc.in b/lib/shortcut.pc.in deleted file mode 100644 index 8daf96d..0000000 --- a/lib/shortcut.pc.in +++ /dev/null @@ -1,10 +0,0 @@ -prefix=@PREFIX@ -exec_prefix=@EXEC_PREFIX@ -libdir=@LIBDIR@ -includedir=@INCLUDEDIR@ - -Name: shortcut -Description: shortcut server platform library -Version: @VERSION@ -Libs: -L${libdir} -lshortcut -Cflags: -I${includedir} diff --git a/lib/src/dlist.c b/lib/src/dlist.c deleted file mode 100644 index 3ae571b..0000000 --- a/lib/src/dlist.c +++ /dev/null @@ -1,189 +0,0 @@ -/* - * Copyright 2013 Samsung Electronics Co., Ltd - * - * Licensed under the Flora License, Version 1.1 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://floralicense.org/license/ - * - * 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 <assert.h> - -#include "dlist.h" - -/*! - * \brief - * This dlist is called Modified Doubly Linked List. - * - * Noramlly, The dobule linked list contains address of previous and next element. - * This dlist also contains them, but the tail element only contains prev address. - * - * The head element's prev pointer indicates the last element. - * But the last element's next pointer indicates NIL. - * - * So we can find the last element while crawling this DList - * But we have to remember the address of the head element. - */ - -struct dlist { - struct dlist *next; - struct dlist *prev; - void *data; -}; - -struct dlist *dlist_append(struct dlist *list, void *data) -{ - struct dlist *item; - - item = malloc(sizeof(*item)); - if (!item) { - return NULL; - } - - item->next = NULL; - item->data = data; - - if (!list) { - item->prev = item; - - list = item; - } else { - item->prev = list->prev; - item->prev->next = item; - list->prev = item; - } - - assert(!list->prev->next && "item NEXT"); - - return list; -} - -struct dlist *dlist_prepend(struct dlist *list, void *data) -{ - struct dlist *item; - - item = malloc(sizeof(*item)); - if (!item) { - return NULL; - } - - item->data = data; - - if (!list) { - item->prev = item; - item->next = NULL; - } else { - if (list->prev->next) { - list->prev->next = item; - } - - item->prev = list->prev; - item->next = list; - - list->prev = item; - - } - - return item; -} - -struct dlist *dlist_remove(struct dlist *list, struct dlist *l) -{ - if (!list || !l) { - return NULL; - } - - if (l == list) { - list = l->next; - } else { - l->prev->next = l->next; - } - - if (l->next) { - l->next->prev = l->prev; - } - /*! - * \note - * If the removed entry 'l' has no next element, it is the last element. - * In this case, check the existence of the list first, - * and if the list is not empty, update the 'prev' of the list (which is a head element of the list) - * - * If we didn't care about this, the head element(list) can indicates the invalid element. - */ - else if (list) { - list->prev = l->prev; - } - - free(l); - return list; -} - -struct dlist *dlist_find_data(struct dlist *list, void *data) -{ - struct dlist *l; - void *_data; - - dlist_foreach(list, l, _data) { - if (data == _data) { - return l; - } - } - - return NULL; -} - -void *dlist_data(struct dlist *l) -{ - return l ? l->data : NULL; -} - -struct dlist *dlist_next(struct dlist *l) -{ - return l ? l->next : NULL; -} - -struct dlist *dlist_prev(struct dlist *l) -{ - return l ? l->prev : NULL; -} - -int dlist_count(struct dlist *l) -{ - register int i; - struct dlist *n; - void *data; - - i = 0; - dlist_foreach(l, n, data) { - i++; - } - - return i; -} - -struct dlist *dlist_nth(struct dlist *l, int nth) -{ - register int i; - struct dlist *n; - - i = 0; - for (n = l; n; n = n->next) { - if (i == nth) { - return n; - } - i++; - } - - return NULL; -} - -/* End of a file */ diff --git a/lib/src/icon.c b/lib/src/icon.c deleted file mode 100644 index 8685f89..0000000 --- a/lib/src/icon.c +++ /dev/null @@ -1,814 +0,0 @@ -/* - * Copyright (c) 2000 - 2013 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 <errno.h> -#include <unistd.h> -#include <fcntl.h> -#include <string.h> -#include <sys/socket.h> -#include <sys/ioctl.h> -#include <libgen.h> -#include <sys/time.h> -#include <time.h> - -#include <dlog.h> -#include <glib.h> -#include <db-util.h> -#include <vconf.h> -#include <vconf-keys.h> - -#include <packet.h> -#include <com-core.h> -#include <com-core_packet.h> - -#include "shortcut_internal.h" -#include "shortcut.h" -#include "dlist.h" - - - -#define CREATED 0x00BEEF00 -#define DESTROYED 0x00DEAD00 - -static struct info { - int fd; - int (*init_cb)(int status, void *data); - void *cbdata; - int initialized; - - const char *utility_socket; - - struct dlist *pending_list; -#if defined(_USE_ECORE_TIME_GET) - clockid_t type; -#endif -} s_info = { - .fd = -1, - .init_cb = NULL, - .cbdata = NULL, - .initialized = 0, - - .utility_socket = "/tmp/.utility.service", - .pending_list = NULL, -#if defined(_USE_ECORE_TIME_GET) - .type = CLOCK_MONOTONIC, -#endif -}; - - - -struct request_item { - struct shortcut_icon *handle; - icon_request_cb_t result_cb; - void *data; -}; - - - -struct pending_item { - struct request_item *item; - struct packet *packet; -}; - - - -struct block { - unsigned int idx; - - char *type; - char *part; - char *data; - char *option; - char *id; - char *target_id; -}; - - - -struct shortcut_icon { - unsigned int state; - struct shortcut_desc *desc; - int refcnt; - void *data; -}; - - - -struct shortcut_desc { - int for_pd; - - unsigned int last_idx; - - struct dlist *block_list; -}; - - - -static inline void delete_block(struct block *block) -{ - DbgPrint("Release block: %p\n", block); - free(block->type); - free(block->part); - free(block->data); - free(block->option); - free(block->id); - free(block->target_id); - free(block); -} - - - -static inline int shortcut_icon_desc_close(struct shortcut_desc *handle) -{ - struct dlist *l; - struct dlist *n; - struct block *block; - - dlist_foreach_safe(handle->block_list, l, n, block) { - handle->block_list = dlist_remove(handle->block_list, l); - delete_block(block); - } - - free(handle); - return 0; -} - - - -static inline struct shortcut_icon *shortcut_icon_request_unref(struct shortcut_icon *handle) -{ - handle->refcnt--; - DbgPrint("Handle: refcnt[%d]\n", handle->refcnt); - - if (handle->refcnt == 0) { - handle->state = DESTROYED; - shortcut_icon_desc_close(handle->desc); - free(handle); - handle = NULL; - } - - return handle; -} - - - -static inline struct shortcut_icon *shortcut_icon_request_ref(struct shortcut_icon *handle) -{ - handle->refcnt++; - DbgPrint("Handle: refcnt[%d]\n", handle->refcnt); - return handle; -} - - - -static int disconnected_cb(int handle, void *data) -{ - if (s_info.fd != handle) { - return 0; - } - - ErrPrint("Disconnected\n"); - s_info.fd = -1; - s_info.init_cb = NULL; - s_info.cbdata = NULL; - s_info.initialized = 0; - return 0; -} - - - -static inline struct shortcut_desc *shortcut_icon_desc_open(void) -{ - struct shortcut_desc *handle; - - handle = calloc(1, sizeof(*handle)); - if (!handle) { - ErrPrint("Error: %s\n", strerror(errno)); - return NULL; - } - - return handle; -} - - - -static inline int shortcut_icon_desc_save(struct shortcut_desc *handle, const char *filename) -{ - struct dlist *l; - struct dlist *n; - struct block *block; - FILE *fp; - - if (!handle) { - return SHORTCUT_ERROR_INVALID; - } - - fp = fopen(filename, "w+t"); - if (!fp) { - ErrPrint("Error: %s\n", strerror(errno)); - return SHORTCUT_ERROR_IO; - } - - DbgPrint("Close and flush\n"); - dlist_foreach_safe(handle->block_list, l, n, block) { - DbgPrint("{\n"); - fprintf(fp, "{\n"); - if (block->type) { - fprintf(fp, "type=%s\n", block->type); - DbgPrint("type=%s\n", block->type); - } - - if (block->part) { - fprintf(fp, "part=%s\n", block->part); - DbgPrint("part=%s\n", block->part); - } - - if (block->data) { - fprintf(fp, "data=%s\n", block->data); - DbgPrint("data=%s\n", block->data); - } - - if (block->option) { - fprintf(fp, "option=%s\n", block->option); - DbgPrint("option=%s\n", block->option); - } - - if (block->id) { - fprintf(fp, "id=%s\n", block->id); - DbgPrint("id=%s\n", block->id); - } - - if (block->target_id) { - fprintf(fp, "target=%s\n", block->target_id); - DbgPrint("target=%s\n", block->target_id); - } - - fprintf(fp, "}\n"); - DbgPrint("}\n"); - } - - if (fclose(fp) != 0) { - ErrPrint("fclose: %s\n", strerror(errno)); - } - return SHORTCUT_SUCCESS; -} - - - -static inline struct block *find_block(struct shortcut_desc *handle, const char *id, const char *part) -{ - struct block *block; - struct dlist *l; - - dlist_foreach(handle->block_list, l, block) { - if (!strcmp(block->part, part) && (!id || !strcmp(block->id, id))) { - return block; - } - } - - return NULL; -} - - - -static inline int update_block(struct block *block, const char *data, const char *option) -{ - char *_data = NULL; - char *_option = NULL; - - if (data) { - _data = strdup(data); - if (!_data) { - ErrPrint("Heap: %s\n", strerror(errno)); - return SHORTCUT_ERROR_MEMORY; - } - } - - if (option) { - _option = strdup(option); - if (!_option) { - ErrPrint("Heap: %s\n", strerror(errno)); - return SHORTCUT_ERROR_MEMORY; - } - } - - free(block->data); - free(block->option); - - block->data = _data; - block->option = _option; - return 0; -} - - - -/*! - * \return idx - */ - - - -static inline int shortcut_icon_desc_add_block(struct shortcut_desc *handle, const char *id, const char *type, const char *part, const char *data, const char *option, const char *target_id) -{ - struct block *block; - - if (!handle || !type) { - return SHORTCUT_ERROR_INVALID; - } - - if (!part) { - part = ""; - } - - if (!data) { - data = ""; - } - - if (target_id) { - if (strcmp(type, SHORTCUT_ICON_TYPE_SCRIPT)) { - ErrPrint("target id only can be used for script type\n"); - return SHORTCUT_ERROR_INVALID; - } - } - - block = find_block(handle, id, part); - if (!block) { - block = calloc(1, sizeof(*block)); - if (!block) { - ErrPrint("Heap: %s\n", strerror(errno)); - return SHORTCUT_ERROR_MEMORY; - } - - block->type = strdup(type); - if (!block->type) { - ErrPrint("Heap: %s\n", strerror(errno)); - free(block); - return SHORTCUT_ERROR_MEMORY; - } - - block->part = strdup(part); - if (!block->part) { - ErrPrint("Heap: %s\n", strerror(errno)); - free(block->type); - free(block); - return SHORTCUT_ERROR_MEMORY; - } - - block->data = strdup(data); - if (!block->data) { - ErrPrint("Heap: %s\n", strerror(errno)); - free(block->type); - free(block->part); - free(block); - return SHORTCUT_ERROR_MEMORY; - } - - if (option) { - block->option = strdup(option); - if (!block->option) { - ErrPrint("Heap: %s\n", strerror(errno)); - free(block->data); - free(block->type); - free(block->part); - free(block); - return SHORTCUT_ERROR_MEMORY; - } - } - - if (id) { - block->id = strdup(id); - if (!block->id) { - ErrPrint("Heap: %s\n", strerror(errno)); - free(block->option); - free(block->data); - free(block->type); - free(block->part); - free(block); - return SHORTCUT_ERROR_MEMORY; - } - } - - if (target_id) { - block->target_id = strdup(target_id); - if (!block->target_id) { - ErrPrint("Heap: %s\n", strerror(errno)); - free(block->id); - free(block->option); - free(block->data); - free(block->type); - free(block->part); - free(block); - return SHORTCUT_ERROR_MEMORY; - } - } - - block->idx = handle->last_idx++; - handle->block_list = dlist_append(handle->block_list, block); - } else { - if (strcmp(block->type, type)) { - ErrPrint("type is not valid (%s, %s)\n", block->type, type); - return SHORTCUT_ERROR_INVALID; - } - - if ((block->target_id && !target_id) || (!block->target_id && target_id)) { - ErrPrint("type is not valid (%s, %s)\n", block->type, type); - return SHORTCUT_ERROR_INVALID; - } - - if (block->target_id && target_id && strcmp(block->target_id, target_id)) { - ErrPrint("type is not valid (%s, %s)\n", block->type, type); - return SHORTCUT_ERROR_INVALID; - } - - update_block(block, data, option); - } - - return block->idx; -} - - - -static int icon_request_cb(pid_t pid, int handle, const struct packet *packet, void *data) -{ - struct request_item *item = data; - int ret; - - if (!packet) { - ret = -EFAULT; - DbgPrint("Disconnected?\n"); - } else { - if (packet_get(packet, "i", &ret) != 1) { - DbgPrint("Invalid packet\n"); - ret = -EINVAL; - } - } - - if (item->result_cb) { - item->result_cb(item->handle, ret, item->data); - } - - (void)shortcut_icon_request_unref(item->handle); - free(item); - return 0; -} - - - -static inline int make_connection(void) -{ - int ret; - static struct method service_table[] = { - { - .cmd = NULL, - .handler = NULL, - }, - }; - - s_info.fd = com_core_packet_client_init(s_info.utility_socket, 0, service_table); - if (s_info.fd < 0) { - ret = SHORTCUT_ERROR_COMM; - - if (s_info.init_cb) { - s_info.init_cb(ret, s_info.cbdata); - } - } else { - struct dlist *l; - struct dlist *n; - struct pending_item *pend; - - if (s_info.init_cb) { - s_info.init_cb(SHORTCUT_SUCCESS, s_info.cbdata); - } - - dlist_foreach_safe(s_info.pending_list, l, n, pend) { - s_info.pending_list = dlist_remove(s_info.pending_list, l); - - ret = com_core_packet_async_send(s_info.fd, pend->packet, 0.0f, icon_request_cb, pend->item); - packet_destroy(pend->packet); - if (ret < 0) { - ErrPrint("ret: %d\n", ret); - if (pend->item->result_cb) { - pend->item->result_cb(pend->item->handle, ret, pend->item->data); - } - free(pend->item); - } - - free(pend); - } - - ret = SHORTCUT_SUCCESS; - } - - return ret; -} - - - -static void master_started_cb(keynode_t *node, void *user_data) -{ - int state = 0; - - if (vconf_get_bool(VCONFKEY_MASTER_STARTED, &state) < 0) { - ErrPrint("Unable to get \"%s\"\n", VCONFKEY_MASTER_STARTED); - } - - if (state == 1 && make_connection() == SHORTCUT_SUCCESS) { - (void)vconf_ignore_key_changed(VCONFKEY_MASTER_STARTED, master_started_cb); - } -} - - - -EAPI int shortcut_icon_service_init(int (*init_cb)(int status, void *data), void *data) -{ - int ret; - - if (s_info.fd >= 0) { - return SHORTCUT_ERROR_INVALID; - } - - if (s_info.initialized) { - s_info.initialized = 1; - com_core_add_event_callback(CONNECTOR_DISCONNECTED, disconnected_cb, NULL); - } - - s_info.init_cb = init_cb; - s_info.cbdata = data; - - ret = vconf_notify_key_changed(VCONFKEY_MASTER_STARTED, master_started_cb, NULL); - if (ret < 0) { - ErrPrint("Failed to add vconf for service state [%d]\n", ret); - } else { - DbgPrint("vconf is registered\n"); - } - - master_started_cb(NULL, NULL); - return SHORTCUT_SUCCESS; -} - - - -EAPI int shortcut_icon_service_fini(void) -{ - struct dlist *l; - struct dlist *n; - struct pending_item *pend; - - if (s_info.initialized) { - com_core_del_event_callback(CONNECTOR_DISCONNECTED, disconnected_cb, NULL); - s_info.initialized = 0; - } - - if (s_info.fd < 0) { - return SHORTCUT_ERROR_INVALID; - } - - com_core_packet_client_fini(s_info.fd); - s_info.init_cb = NULL; - s_info.cbdata = NULL; - s_info.fd = -1; - - dlist_foreach_safe(s_info.pending_list, l, n, pend) { - s_info.pending_list = dlist_remove(s_info.pending_list, l); - packet_unref(pend->packet); - if (pend->item->result_cb) { - pend->item->result_cb(pend->item->handle, SHORTCUT_ERROR_COMM, pend->item->data); - } - free(pend->item); - free(pend); - } - return SHORTCUT_SUCCESS; -} - - - -EAPI struct shortcut_icon *shortcut_icon_request_create(void) -{ - struct shortcut_icon *handle; - - handle = malloc(sizeof(*handle)); - if (!handle) { - ErrPrint("Heap: %s\n", strerror(errno)); - return NULL; - } - - handle->desc = shortcut_icon_desc_open(); - if (!handle->desc) { - ErrPrint("Uanble to open desc\n"); - free(handle); - return NULL; - } - - handle->state = CREATED; - handle->refcnt = 1; - return handle; -} - - -EAPI int shortcut_icon_request_set_data(struct shortcut_icon *handle, void *data) -{ - if (!handle || handle->state != CREATED) { - ErrPrint("Handle is not valid\n"); - return SHORTCUT_ERROR_INVALID; - } - - handle->data = data; - return SHORTCUT_SUCCESS; -} - - - -EAPI void *shortcut_icon_request_data(struct shortcut_icon *handle) -{ - if (!handle || handle->state != CREATED) { - ErrPrint("Handle is not valid\n"); - return NULL; - } - - return handle->data; -} - - - -EAPI int shortcut_icon_request_set_info(struct shortcut_icon *handle, const char *id, const char *type, const char *part, const char *data, const char *option, const char *subid) -{ - if (!handle || handle->state != CREATED) { - ErrPrint("Handle is not valid\n"); - return SHORTCUT_ERROR_INVALID; - } - - return shortcut_icon_desc_add_block(handle->desc, id, type, part, data, option, subid); -} - - - -EAPI int shortcut_icon_request_destroy(struct shortcut_icon *handle) -{ - if (!handle || handle->state != CREATED) { - ErrPrint("Handle is not valid\n"); - return SHORTCUT_ERROR_INVALID; - } - - (void)shortcut_icon_request_unref(handle); - return SHORTCUT_SUCCESS; -} - - - -EAPI int shortcut_icon_request_send(struct shortcut_icon *handle, int size_type, const char *layout, const char *group, const char *outfile, icon_request_cb_t result_cb, void *data) -{ - int ret; - struct packet *packet; - struct request_item *item; - char *filename; - int len; - - if (!handle || handle->state != CREATED) { - ErrPrint("Handle is not valid\n"); - return SHORTCUT_ERROR_INVALID; - } - - if (!layout) { - layout = DEFAULT_ICON_LAYOUT; - } - - if (!group) { - group = DEFAULT_ICON_GROUP; - } - - len = strlen(outfile) + strlen(".desc") + 1 + 30; /* 30 == strlen(tv.tv_sec) + strlen(tv.tv_usec) + 10 (reserved) */ - filename = malloc(len); - if (!filename) { - ErrPrint("Heap: %s\n", strerror(errno)); - return SHORTCUT_ERROR_MEMORY; - } - -#if defined(_USE_ECORE_TIME_GET) - struct timespec ts; - double tv; - do { - if (clock_gettime(s_info.type, &ts) == 0) { - tv = ts.tv_sec + ts.tv_nsec / 1000000000.0f; - break; - } - - ErrPrint("%d: %s\n", s_info.type, strerror(errno)); - if (s_info.type == CLOCK_MONOTONIC) { - s_info.type = CLOCK_REALTIME; - } else if (s_info.type == CLOCK_REALTIME) { - struct timeval _tv; - if (gettimeofday(&_tv, NULL) < 0) { - ErrPrint("gettimeofday: %s\n", strerror(errno)); - _tv.tv_sec = rand(); - _tv.tv_usec = rand(); - } - - tv = (double)_tv.tv_sec + (double)_tv.tv_usec / 1000000.0f; - break; - } - } while (1); - ret = snprintf(filename, len, "%s.%lf.desc", outfile, tv); -#else - struct timeval tv; - if (gettimeofday(&tv, NULL) != 0) { - ErrPrint("gettimeofday: %s\n", strerror(errno)); - tv.tv_sec = rand(); - tv.tv_usec = rand(); - } - - ret = snprintf(filename, len, "%s.%lu.%lu.desc", outfile, tv.tv_sec, tv.tv_usec); -#endif - if (ret < 0) { - ErrPrint("snprintf: %s\n", strerror(errno)); - goto out; - } - - ret = shortcut_icon_desc_save(handle->desc, filename); - if (ret < 0) { - goto out; - } - - item = malloc(sizeof(*item)); - if (!item) { - ErrPrint("Heap: %s\n", strerror(errno)); - if (unlink(filename) < 0) { - ErrPrint("Unlink: %s\n", strerror(errno)); - } - ret = SHORTCUT_ERROR_MEMORY; - goto out; - } - - item->result_cb = result_cb; - item->data = data; - item->handle = shortcut_icon_request_ref(handle); - - packet = packet_create("icon_create", "sssis", layout, group, filename, size_type, outfile); - if (!packet) { - ErrPrint("Failed to create a packet\n"); - if (unlink(filename) < 0) { - ErrPrint("Unlink: %s\n", strerror(errno)); - } - free(item); - (void)shortcut_icon_request_unref(handle); - ret = SHORTCUT_ERROR_FAULT; - goto out; - } - - if (s_info.fd >= 0 && !s_info.pending_list) { - ret = com_core_packet_async_send(s_info.fd, packet, 0.0f, icon_request_cb, item); - packet_destroy(packet); - if (ret < 0) { - ErrPrint("ret: %d\n", ret); - if (unlink(filename) < 0) { - ErrPrint("Unlink: %s\n", strerror(errno)); - } - free(item); - (void)shortcut_icon_request_unref(handle); - } - DbgPrint("Request is sent\n"); - } else { - struct pending_item *pend; - - pend = malloc(sizeof(*pend)); - if (!pend) { - ErrPrint("Heap: %s\n", strerror(errno)); - packet_destroy(packet); - free(item); - if (unlink(filename) < 0) { - ErrPrint("Unlink: %s\n", strerror(errno)); - } - (void)shortcut_icon_request_unref(handle); - ret = SHORTCUT_ERROR_MEMORY; - goto out; - } - - pend->packet = packet; - pend->item = item; - - s_info.pending_list = dlist_append(s_info.pending_list, pend); - DbgPrint("Request is pended\n"); - - ret = SHORTCUT_SUCCESS; - } - -out: - free(filename); - return ret; -} - -/* End of a file */ diff --git a/lib/src/main.c b/lib/src/main.c deleted file mode 100644 index 4261a39..0000000 --- a/lib/src/main.c +++ /dev/null @@ -1,874 +0,0 @@ -/* - * Copyright (c) 2000 - 2013 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 <stdlib.h> -#include <errno.h> -#include <unistd.h> -#include <fcntl.h> -#include <string.h> -#include <sys/socket.h> -#include <sys/ioctl.h> -#include <libgen.h> - -#include <dlog.h> -#include <glib.h> -#include <db-util.h> -#include <vconf.h> -#include <vconf-keys.h> - -#include <packet.h> -#include <com-core.h> -#include <com-core_packet.h> - -#include "shortcut.h" -#include "shortcut_internal.h" - -int errno; - -static struct info { - const char *dbfile; - sqlite3 *handle; - int server_fd; - 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 db_opened; - guint timer_id; -} s_info = { - .server_fd = -1, - .client_fd = -1, - .socket_file = "/tmp/.shortcut.service", - .dbfile = "/opt/dbspace/.shortcut_service.db", - .handle = NULL, - .initialized = 0, - .db_opened = 0, - .timer_id = 0, -}; - - -static inline int make_connection(void); - - -static struct packet *remove_shortcut_handler(pid_t pid, int handle, const struct packet *packet) -{ - const char *appid; - const char *name; - const char *content_info; - int ret; - int sender_pid; - - if (!packet) { - ErrPrint("Packet is NIL, maybe disconnected?\n"); - return NULL; - } - - if (packet_get(packet, "isss", &sender_pid, &appid, &name, &content_info) != 4) { - ErrPrint("Invalid apcket\n"); - return NULL; - } - - DbgPrint("appid[%s], name[%s], content_info[%s]\n", appid, name, content_info); - - if (s_info.server_cb.request_cb) { - ret = s_info.server_cb.request_cb(appid, name, SHORTCUT_REMOVE, content_info, NULL, sender_pid, -1.0f, 0, s_info.server_cb.data); - } else { - ret = SHORTCUT_ERROR_UNSUPPORTED; - } - - return packet_create_reply(packet, "i", ret); -} - - - -static struct packet *remove_livebox_handler(pid_t pid, int handle, const struct packet *packet) -{ - const char *appid; - const char *name; - int ret; - int sender_pid; - - if (!packet) { - ErrPrint("PAcket is NIL, maybe disconnected?\n"); - return NULL; - } - - if (packet_get(packet, "iss", &sender_pid, &appid, &name) != 3) { - ErrPrint("Invalid packet\n"); - return NULL; - } - - DbgPrint("appid[%s], name[%s]\n", appid, name); - - if (s_info.server_cb.request_cb) { - ret = s_info.server_cb.request_cb(appid, name, LIVEBOX_REMOVE, NULL, NULL, sender_pid, -1.0f, 0, s_info.server_cb.data); - } else { - ret = SHORTCUT_ERROR_UNSUPPORTED; - } - - return packet_create_reply(packet, "i", ret); -} - - - -static struct packet *add_shortcut_handler(pid_t pid, int handle, const struct packet *packet) -{ - const char *appid; - const char *name; - int type; - const char *content; - const char *icon; - int allow_duplicate; - int ret; - int sender_pid; - - if (!packet) { - return NULL; - } - - if (packet_get(packet, "ississi", &sender_pid, &appid, &name, &type, &content, &icon, &allow_duplicate) != 7) { - ErrPrint("Invalid packet\n"); - return NULL; - } - - DbgPrint("appid[%s], name[%s], type[0x%x], content[%s], icon[%s] allow_duplicate[%d]\n", appid, name, type, content, icon, allow_duplicate); - - if (s_info.server_cb.request_cb) { - ret = s_info.server_cb.request_cb(appid, name, type, content, icon, sender_pid, -1.0f, allow_duplicate, s_info.server_cb.data); - } else { - ret = SHORTCUT_ERROR_UNSUPPORTED; - } - - return packet_create_reply(packet, "i", ret); -} - - - -static struct packet *add_livebox_handler(pid_t pid, int handle, const struct packet *packet) -{ - const char *appid; - const char *name; - int type; - const char *content; - const char *icon; - double period; - int allow_duplicate; - int ret; - int sender_pid; - - if (!packet) { - return NULL; - } - - if (packet_get(packet, "ississdi", &sender_pid, &appid, &name, &type, &content, &icon, &period, &allow_duplicate) != 8) { - ErrPrint("Invalid packet\n"); - return NULL; - } - - DbgPrint("appid[%s], name[%s], type[0x%x], content[%s], icon[%s], period[%lf], allow_duplicate[%d]\n", appid, name, type, content, icon, period, allow_duplicate); - - if (s_info.server_cb.request_cb) { - ret = s_info.server_cb.request_cb(appid, name, type, content, icon, sender_pid, period, allow_duplicate, s_info.server_cb.data); - } else { - ret = 0; - } - - return packet_create_reply(packet, "i", ret); -} - - - -static void master_started_cb(keynode_t *node, void *user_data) -{ - int state = 0; - - if (vconf_get_bool(VCONFKEY_MASTER_STARTED, &state) < 0) { - ErrPrint("Unable to get \"%s\"\n", VCONFKEY_MASTER_STARTED); - } - - if (state == 1 && make_connection() == SHORTCUT_SUCCESS) { - (void)vconf_ignore_key_changed(VCONFKEY_MASTER_STARTED, master_started_cb); - } -} - - - -static gboolean timeout_cb(void *data) -{ - int ret; - - ret = vconf_notify_key_changed(VCONFKEY_MASTER_STARTED, master_started_cb, NULL); - if (ret < 0) { - ErrPrint("Failed to add vconf for service state [%d]\n", ret); - } else { - DbgPrint("vconf is registered\n"); - } - - master_started_cb(NULL, NULL); - - s_info.timer_id = 0; - return FALSE; -} - - - -static int disconnected_cb(int handle, void *data) -{ - if (s_info.client_fd == handle) { - s_info.client_fd = SHORTCUT_ERROR_INVALID; - return 0; - } - - if (s_info.server_fd == handle) { - if (!s_info.timer_id) { - s_info.server_fd = SHORTCUT_ERROR_INVALID; - s_info.timer_id = g_timeout_add(1000, timeout_cb, NULL); - if (!s_info.timer_id) { - ErrPrint("Unable to add timer\n"); - } - } - return 0; - } - - return 0; -} - - - -static inline int make_connection(void) -{ - int ret; - struct packet *packet; - static struct method service_table[] = { - { - .cmd = "add_shortcut", - .handler = add_shortcut_handler, - }, - { - .cmd = "add_livebox", - .handler = add_livebox_handler, - }, - { - .cmd = "rm_shortcut", - .handler = remove_shortcut_handler, - }, - { - .cmd = "rm_livebox", - .handler = remove_livebox_handler, - }, - { - .cmd = NULL, - .handler = NULL, - }, - }; - - if (s_info.initialized == 0) { - s_info.initialized = 1; - com_core_add_event_callback(CONNECTOR_DISCONNECTED, disconnected_cb, NULL); - } - - s_info.server_fd = com_core_packet_client_init(s_info.socket_file, 0, service_table); - if (s_info.server_fd < 0) { - ErrPrint("Failed to make a connection to the master\n"); - return SHORTCUT_ERROR_COMM; - } - - packet = packet_create_noack("service_register", ""); - if (!packet) { - ErrPrint("Failed to build a packet\n"); - return SHORTCUT_ERROR_FAULT; - } - - ret = com_core_packet_send_only(s_info.server_fd, packet); - DbgPrint("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 = -1; - ret = SHORTCUT_ERROR_COMM; - } else { - ret = SHORTCUT_SUCCESS; - } - - DbgPrint("Server FD: %d\n", s_info.server_fd); - return ret; -} - - - -EAPI int shortcut_set_request_cb(request_cb_t request_cb, void *data) -{ - s_info.server_cb.request_cb = request_cb; - s_info.server_cb.data = data; - - if (s_info.server_fd < 0) { - int ret; - - ret = vconf_notify_key_changed(VCONFKEY_MASTER_STARTED, master_started_cb, NULL); - if (ret < 0) { - ErrPrint("Failed to add vconf for service state [%d]\n", ret); - } else { - DbgPrint("vconf is registered\n"); - } - - master_started_cb(NULL, NULL); - } - - return SHORTCUT_SUCCESS; -} - - - -struct result_cb_item { - result_cb_t result_cb; - void *data; -}; - - - -static int shortcut_send_cb(pid_t pid, int handle, const struct packet *packet, void *data) -{ - struct result_cb_item *item = data; - int ret; - - if (!packet) { - ErrPrint("Packet is not valid\n"); - ret = SHORTCUT_ERROR_FAULT; - } else if (packet_get(packet, "i", &ret) != 1) { - ErrPrint("Packet is not valid\n"); - ret = SHORTCUT_ERROR_INVALID; - } - - if (item->result_cb) { - ret = item->result_cb(ret, pid, item->data); - } else { - ret = SHORTCUT_SUCCESS; - } - free(item); - return ret; -} - - - -EAPI int add_to_home_remove_shortcut(const char *appid, const char *name, const char *content_info, result_cb_t result_cb, void *data) -{ - struct packet *packet; - struct result_cb_item *item; - int ret; - - if (!appid || !name) { - ErrPrint("Invalid argument\n"); - return SHORTCUT_ERROR_INVALID; - } - - if (!s_info.initialized) { - s_info.initialized = 1; - com_core_add_event_callback(CONNECTOR_DISCONNECTED, disconnected_cb, NULL); - } - - if (s_info.client_fd < 0) { - static struct method service_table[] = { - { - .cmd = NULL, - .handler = NULL, - }, - }; - - s_info.client_fd = com_core_packet_client_init(s_info.socket_file, 0, service_table); - if (s_info.client_fd < 0) { - ErrPrint("Failed to make connection\n"); - return SHORTCUT_ERROR_COMM; - } - } - - item = malloc(sizeof(*item)); - if (!item) { - ErrPrint("Heap: %s\n", strerror(errno)); - return SHORTCUT_ERROR_MEMORY; - } - - item->result_cb = result_cb; - item->data = data; - - packet = packet_create("rm_shortcut", "isss", getpid(), appid, name, content_info); - if (!packet) { - ErrPrint("Failed to build a packet\n"); - free(item); - return SHORTCUT_ERROR_FAULT; - } - - ret = com_core_packet_async_send(s_info.client_fd, packet, 0.0f, shortcut_send_cb, item); - if (ret < 0) { - packet_destroy(packet); - free(item); - com_core_packet_client_fini(s_info.client_fd); - s_info.client_fd = SHORTCUT_ERROR_INVALID; - return SHORTCUT_ERROR_COMM; - } - - return SHORTCUT_SUCCESS; -} - - - -EAPI int add_to_home_remove_livebox(const char *appid, const char *name, result_cb_t result_cb, void *data) -{ - struct packet *packet; - struct result_cb_item *item; - int ret; - - if (!appid || !name) { - ErrPrint("Invalid argument\n"); - return SHORTCUT_ERROR_INVALID; - } - - if (!s_info.initialized) { - s_info.initialized = 1; - com_core_add_event_callback(CONNECTOR_DISCONNECTED, disconnected_cb, NULL); - } - - if (s_info.client_fd < 0) { - static struct method service_table[] = { - { - .cmd = NULL, - .handler = NULL, - }, - }; - - - s_info.client_fd = com_core_packet_client_init(s_info.socket_file, 0, service_table); - if (s_info.client_fd < 0) { - ErrPrint("Failed to make connection\n"); - return SHORTCUT_ERROR_COMM; - } - } - - item = malloc(sizeof(*item)); - if (!item) { - ErrPrint("Heap: %s\n", strerror(errno)); - return SHORTCUT_ERROR_MEMORY; - } - - item->result_cb = result_cb; - item->data = data; - - packet = packet_create("rm_livebox", "iss", getpid(), appid, name); - if (!packet) { - ErrPrint("Failed to build a packet\n"); - free(item); - return SHORTCUT_ERROR_FAULT; - } - - ret = com_core_packet_async_send(s_info.client_fd, packet, 0.0f, shortcut_send_cb, item); - if (ret < 0) { - packet_destroy(packet); - free(item); - com_core_packet_client_fini(s_info.client_fd); - s_info.client_fd = SHORTCUT_ERROR_INVALID; - return SHORTCUT_ERROR_COMM; - } - - return SHORTCUT_SUCCESS; -} - - - -EAPI int add_to_home_shortcut(const char *appid, const char *name, int type, const char *content, const char *icon, int allow_duplicate, result_cb_t result_cb, void *data) -{ - struct packet *packet; - struct result_cb_item *item; - int ret; - - if (ADD_TO_HOME_IS_LIVEBOX(type)) { - ErrPrint("Invalid type used for adding a shortcut\n"); - } - - if (!s_info.initialized) { - s_info.initialized = 1; - com_core_add_event_callback(CONNECTOR_DISCONNECTED, disconnected_cb, NULL); - } - - if (s_info.client_fd < 0) { - static struct method service_table[] = { - { - .cmd = NULL, - .handler = NULL, - }, - }; - - s_info.client_fd = com_core_packet_client_init(s_info.socket_file, 0, service_table); - if (s_info.client_fd < 0) { - ErrPrint("Failed to make connection\n"); - return SHORTCUT_ERROR_COMM; - } - } - - item = malloc(sizeof(*item)); - if (!item) { - ErrPrint("Heap: %s\n", strerror(errno)); - return SHORTCUT_ERROR_MEMORY; - } - - item->result_cb = result_cb; - item->data = data; - - if (!appid) { - appid = ""; - } - - if (!name) { - name = ""; - } - - if (!content) { - content = ""; - } - - if (!icon) { - icon = ""; - } - - packet = packet_create("add_shortcut", "ississi", getpid(), appid, name, type, content, icon, allow_duplicate); - if (!packet) { - ErrPrint("Failed to build a packet\n"); - free(item); - return SHORTCUT_ERROR_FAULT; - } - - ret = com_core_packet_async_send(s_info.client_fd, packet, 0.0f, shortcut_send_cb, item); - if (ret < 0) { - packet_destroy(packet); - free(item); - com_core_packet_client_fini(s_info.client_fd); - s_info.client_fd = SHORTCUT_ERROR_INVALID; - return SHORTCUT_ERROR_COMM; - } - - return SHORTCUT_SUCCESS; -} - - - -EAPI int add_to_home_livebox(const char *appid, const char *name, int type, const char *content, const char *icon, double period, int allow_duplicate, result_cb_t result_cb, void *data) -{ - struct packet *packet; - struct result_cb_item *item; - int ret; - - if (!ADD_TO_HOME_IS_LIVEBOX(type)) { - ErrPrint("Invalid type is used for adding a livebox\n"); - } - - if (!s_info.initialized) { - s_info.initialized = 1; - com_core_add_event_callback(CONNECTOR_DISCONNECTED, disconnected_cb, NULL); - } - - if (s_info.client_fd < 0) { - static struct method service_table[] = { - { - .cmd = NULL, - .handler = NULL, - }, - }; - - s_info.client_fd = com_core_packet_client_init(s_info.socket_file, 0, service_table); - if (s_info.client_fd < 0) { - return SHORTCUT_ERROR_COMM; - } - } - - item = malloc(sizeof(*item)); - if (!item) { - ErrPrint("Heap: %s\n", strerror(errno)); - return SHORTCUT_ERROR_MEMORY; - } - - item->result_cb = result_cb; - item->data = data; - - packet = packet_create("add_livebox", "ississdi", getpid(), appid, name, type, content, icon, period, allow_duplicate); - if (!packet) { - ErrPrint("Failed to build a packet\n"); - free(item); - return SHORTCUT_ERROR_FAULT; - } - - ret = com_core_packet_async_send(s_info.client_fd, packet, 0.0f, shortcut_send_cb, item); - if (ret < 0) { - packet_destroy(packet); - free(item); - com_core_packet_client_fini(s_info.client_fd); - s_info.client_fd = SHORTCUT_ERROR_INVALID; - return SHORTCUT_ERROR_COMM; - } - - return SHORTCUT_SUCCESS; -} - - -static inline int open_db(void) -{ - int ret; - - ret = db_util_open(s_info.dbfile, &s_info.handle, DB_UTIL_REGISTER_HOOK_METHOD); - if (ret != SQLITE_OK) { - DbgPrint("Failed to open a %s\n", s_info.dbfile); - return SHORTCUT_ERROR_IO; - } - - return SHORTCUT_SUCCESS; -} - - - -/*! - * \note this function will returns allocated(heap) string - */ -static inline int get_i18n_name(const char *lang, int id, char **name, char **icon) -{ - sqlite3_stmt *stmt; - static const char *query = "SELECT name, icon FROM shortcut_name WHERE id = ? AND lang = ? COLLATE NOCASE"; - const unsigned char *_name; - const unsigned char *_icon; - int ret = 0; - int status; - - status = sqlite3_prepare_v2(s_info.handle, query, -1, &stmt, NULL); - if (status != SQLITE_OK) { - ErrPrint("Failed to prepare stmt: %s\n", sqlite3_errmsg(s_info.handle)); - return -EFAULT; - } - - status = sqlite3_bind_int(stmt, 1, id); - if (status != SQLITE_OK) { - ErrPrint("Failed to bind id: %s\n", sqlite3_errmsg(s_info.handle)); - ret = -EFAULT; - goto out; - } - - status = sqlite3_bind_text(stmt, 2, lang, -1, SQLITE_TRANSIENT); - if (status != SQLITE_OK) { - ErrPrint("Failed to bind lang: %s\n", sqlite3_errmsg(s_info.handle)); - ret = -EFAULT; - goto out; - } - - DbgPrint("id: %d, lang: %s\n", id, lang); - if (SQLITE_ROW != sqlite3_step(stmt)) { - ErrPrint("Failed to do step: %s\n", sqlite3_errmsg(s_info.handle)); - ret = -ENOENT; - goto out; - } - - _name = sqlite3_column_text(stmt, 0); - if (name) { - if (_name && strlen((const char *)_name)) { - *name = strdup((const char *)_name); - if (!*name) { - ErrPrint("strdup: %s\n", strerror(errno)); - ret = -ENOMEM; - goto out; - } - } else { - *name = NULL; - } - } - - _icon = sqlite3_column_text(stmt, 1); - if (icon) { - if (_icon && strlen((const char *)_icon)) { - *icon = strdup((const char *)_icon); - if (!*icon) { - ErrPrint("strdup: %s\n", strerror(errno)); - ret = -ENOMEM; - if (name && *name) { - free(*name); - } - goto out; - } - } else { - *icon = NULL; - } - } - -out: - sqlite3_reset(stmt); - sqlite3_clear_bindings(stmt); - sqlite3_finalize(stmt); - return ret; -} - - - -static inline char *cur_locale(void) -{ - char *language; - language = vconf_get_str(VCONFKEY_LANGSET); - if (language) { - char *ptr; - - ptr = language; - while (*ptr) { - if (*ptr == '.') { - *ptr = '\0'; - break; - } - - if (*ptr == '_') { - *ptr = '-'; - } - - ptr++; - } - } else { - language = strdup("en-us"); - if (!language) { - ErrPrint("Heap: %s\n", strerror(errno)); - } - } - - return language; -} - - - -/*! - * \note READ ONLY DB - */ -EAPI int shortcut_get_list(const char *appid, int (*cb)(const char *appid, const char *icon, const char *name, const char *extra_key, const char *extra_data, void *data), void *data) -{ - sqlite3_stmt *stmt; - const char *query; - const unsigned char *name; - char *i18n_name = NULL; - char *i18n_icon = NULL; - const unsigned char *extra_data; - const unsigned char *extra_key; - const unsigned char *icon; - int id; - int ret; - int cnt; - char *language; - - if (!s_info.db_opened) { - s_info.db_opened = (open_db() == 0); - } - - if (!s_info.db_opened) { - ErrPrint("Failed to open a DB\n"); - return SHORTCUT_ERROR_IO; - } - - language = cur_locale(); - if (!language) { - ErrPrint("Locale is not valid\n"); - return SHORTCUT_ERROR_FAULT; - } - - if (appid) { - query = "SELECT id, appid, name, extra_key, extra_data, icon FROM shortcut_service WHERE appid = ?"; - ret = sqlite3_prepare_v2(s_info.handle, query, -1, &stmt, NULL); - if (ret != SQLITE_OK) { - ErrPrint("prepare: %s\n", sqlite3_errmsg(s_info.handle)); - free(language); - return SHORTCUT_ERROR_IO; - } - - ret = sqlite3_bind_text(stmt, 1, appid, -1, SQLITE_TRANSIENT); - if (ret != SQLITE_OK) { - ErrPrint("bind text: %s\n", sqlite3_errmsg(s_info.handle)); - sqlite3_finalize(stmt); - free(language); - return SHORTCUT_ERROR_IO; - } - } else { - query = "SELECT id, appid, name, extra_key, extra_data, icon FROM shortcut_service"; - ret = sqlite3_prepare_v2(s_info.handle, query, -1, &stmt, NULL); - if (ret != SQLITE_OK) { - ErrPrint("prepare: %s\n", sqlite3_errmsg(s_info.handle)); - free(language); - return SHORTCUT_ERROR_IO; - } - } - - cnt = 0; - while (SQLITE_ROW == sqlite3_step(stmt)) { - id = sqlite3_column_int(stmt, 0); - - appid = (const char *)sqlite3_column_text(stmt, 1); - if (!appid) { - LOGE("Failed to get package name\n"); - continue; - } - - name = sqlite3_column_text(stmt, 2); - if (!name) { - LOGE("Failed to get name\n"); - continue; - } - - extra_key = sqlite3_column_text(stmt, 3); - if (!extra_key) { - LOGE("Failed to get service\n"); - continue; - } - - extra_data = sqlite3_column_text(stmt, 4); - if (!extra_data) { - LOGE("Failed to get service\n"); - continue; - } - - icon = sqlite3_column_text(stmt, 5); - if (!icon) { - LOGE("Failed to get icon\n"); - continue; - } - - /*! - * \todo - * Implement the "GET LOCALE" code - */ - if (get_i18n_name(language, id, &i18n_name, &i18n_icon) < 0) { - /* Okay, we can't manage this. just use the fallback string */ - } - - cnt++; - if (cb(appid, (i18n_icon != NULL ? i18n_icon : (char *)icon), (i18n_name != NULL ? i18n_name : (char *)name), (char *)extra_key, (char *)extra_data, data) < 0) { - free(i18n_name); - break; - } - - free(i18n_name); - i18n_name = NULL; - - free(i18n_icon); - i18n_icon = NULL; - } - - sqlite3_reset(stmt); - sqlite3_clear_bindings(stmt); - sqlite3_finalize(stmt); - free(language); - return cnt; -} - -/* End of a file */ diff --git a/packaging/libshortcut.manifest b/packaging/libshortcut.manifest deleted file mode 100644 index f1055e7..0000000 --- a/packaging/libshortcut.manifest +++ /dev/null @@ -1,22 +0,0 @@ -<manifest> - <!-- Shortcut service --> - <define> - <domain name="shortcut-service" policy="restricted" /> - <provide> - <label name="shortcut-service::db" /> - </provide> - </define> - <request> - <domain name="_" /> - </request> - - <assign> - <!-- Executable file --> - <filesystem path="/usr/lib/libshortcut.so.0.0.1" label="_" /> - <filesystem path="/usr/etc/package-manager/parserlib/libshortcut-list.so" label="_" /> - - <!-- Database file --> - <filesystem path="/opt/dbspace/.shortcut_service.db" label="shortcut-service::db" /> - <filesystem path="/opt/dbspace/.shortcut_service.db-journal" label="shortcut-service::db" /> - </assign> -</manifest> diff --git a/packaging/libshortcut.spec b/packaging/libshortcut.spec deleted file mode 100644 index 864bafe..0000000 --- a/packaging/libshortcut.spec +++ /dev/null @@ -1,79 +0,0 @@ -Name: libshortcut -Summary: Shortcut add feature supporting library -Version: 0.6.12 -Release: 0 -VCS: magnolia/framework/appfw/shortcut#shortcut_0.3.20-37-g4af29465058bf4841fd5ee41f0d09594e88b8aa0 -Group: HomeTF/Framework -License: Apache -Source0: %{name}-%{version}.tar.gz -Source1001: %{name}.manifest - -Requires(post): /sbin/ldconfig -Requires(postun): /sbin/ldconfig - -BuildRequires: cmake, gettext-tools, coreutils -BuildRequires: pkgconfig(glib-2.0) -BuildRequires: pkgconfig(dlog) -BuildRequires: pkgconfig(db-util) -BuildRequires: pkgconfig(sqlite3) -BuildRequires: pkgconfig(com-core) -BuildRequires: pkgconfig(libxml-2.0) -BuildRequires: pkgconfig(vconf) - -%description -[Shortcut] AddToHome feature supporting library for menu/home screen developers. - -%package devel -Summary: AddToHome feature supporting library development files -Group: Development/Libraries -Requires: %{name} = %{version}-%{release} - -%description devel -[Shortcut] AddToHome feature supporting library for menu/home screen developers -(dev). - -%prep -%setup -q -cp %{SOURCE1001} . - -%build -%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 -%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 -cmake . -DCMAKE_INSTALL_PREFIX=%{_prefix} -make %{?jobs:-j%jobs} - -%install -rm -rf %{buildroot} -%make_install -mkdir -p %{buildroot}/opt/dbspace -touch %{buildroot}/opt/dbspace/.shortcut_service.db -touch %{buildroot}/opt/dbspace/.shortcut_service.db-journal - -%post - -%postun - -%files -n libshortcut -%manifest %{name}.manifest -%defattr(-,root,root,-) -%{_libdir}/*.so* -%{_prefix}/etc/package-manager/parserlib/* -%{_datarootdir}/license/* -%attr(640,root,app) /opt/dbspace/.shortcut_service.db -%attr(640,root,app) /opt/dbspace/.shortcut_service.db-journal - -%files devel -%manifest %{name}.manifest -%defattr(-,root,root,-) -%{_includedir}/shortcut/shortcut.h -%{_libdir}/pkgconfig/shortcut.pc - -# End of a file diff --git a/pkgmgr_shortcut/CMakeLists.txt b/pkgmgr_shortcut/CMakeLists.txt deleted file mode 100644 index 0a4abc7..0000000 --- a/pkgmgr_shortcut/CMakeLists.txt +++ /dev/null @@ -1,31 +0,0 @@ -PROJECT(shortcut-list C) - -INCLUDE_DIRECTORIES(${CMAKE_SOURCE_DIR}/pkgmgr_shortcut/include) - -INCLUDE(FindPkgConfig) -pkg_check_modules(bin_pkgs REQUIRED - dlog - sqlite3 - libxml-2.0 - db-util -) - -FOREACH(flag ${bin_pkgs_CFLAGS}) - SET(EXTRA_CFLAGS "${EXTRA_CFLAGS} ${flag}") -ENDFOREACH(flag) - -SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${EXTRA_CFLAGS} -g -Wall -Werror") - -ADD_DEFINITIONS("-DPREFIX=\"${PREFIX}\"") -ADD_DEFINITIONS("-DLOG_TAG=\"PKGMGR_SHORTCUT\"") - -ADD_LIBRARY(${PROJECT_NAME} SHARED - src/service_register.c - src/dlist.c -) - -TARGET_LINK_LIBRARIES(${PROJECT_NAME} ${bin_pkgs_LDFLAGS}) - -INSTALL(TARGETS ${PROJECT_NAME} DESTINATION "etc/package-manager/parserlib") - -# End of a file diff --git a/pkgmgr_shortcut/include/dlist.h b/pkgmgr_shortcut/include/dlist.h deleted file mode 100644 index 04283eb..0000000 --- a/pkgmgr_shortcut/include/dlist.h +++ /dev/null @@ -1,44 +0,0 @@ -/* - * Copyright (c) 2000 - 2013 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. - * -*/ - -#define dlist_remove_data(list, data) do { \ - struct dlist *l; \ - l = dlist_find_data(list, data); \ - list = dlist_remove(list, l); \ -} while (0) - -#define dlist_foreach(list, l, data) \ - for ((l) = (list); (l) && ((data) = dlist_data(l)); (l) = dlist_next(l)) - -#define dlist_foreach_safe(list, l, n, data) \ - for ((l) = (list), (n) = dlist_next(l); \ - (l) && ((data) = dlist_data(l)); \ - (l) = (n), (n) = dlist_next(l)) - -struct dlist; - -extern struct dlist *dlist_append(struct dlist *list, void *data); -extern struct dlist *dlist_prepend(struct dlist *list, void *data); -extern struct dlist *dlist_remove(struct dlist *list, struct dlist *l); -extern struct dlist *dlist_find_data(struct dlist *list, void *data); -extern void *dlist_data(struct dlist *l); -extern struct dlist *dlist_next(struct dlist *l); -extern struct dlist *dlist_prev(struct dlist *l); -extern int dlist_count(struct dlist *l); -extern struct dlist *dlist_nth(struct dlist *l, int nth); - -/* End of a file */ diff --git a/pkgmgr_shortcut/src/dlist.c b/pkgmgr_shortcut/src/dlist.c deleted file mode 100644 index 1764dfd..0000000 --- a/pkgmgr_shortcut/src/dlist.c +++ /dev/null @@ -1,189 +0,0 @@ -/* - * Copyright (c) 2000 - 2013 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 <assert.h> - -#include "dlist.h" - -/*! - * \brief - * This dlist is called Modified Doubly Linked List. - * - * Noramlly, The dobule linked list contains address of previous and next element. - * This dlist also contains them, but the tail element only contains prev address. - * - * The head element's prev pointer indicates the last element. - * But the last element's next pointer indicates NIL. - * - * So we can find the last element while crawling this DList - * But we have to remember the address of the head element. - */ - -struct dlist { - struct dlist *next; - struct dlist *prev; - void *data; -}; - -struct dlist *dlist_append(struct dlist *list, void *data) -{ - struct dlist *item; - - item = malloc(sizeof(*item)); - if (!item) { - return NULL; - } - - item->next = NULL; - item->data = data; - - if (!list) { - item->prev = item; - - list = item; - } else { - item->prev = list->prev; - item->prev->next = item; - list->prev = item; - } - - assert(!list->prev->next && "item NEXT"); - - return list; -} - -struct dlist *dlist_prepend(struct dlist *list, void *data) -{ - struct dlist *item; - - item = malloc(sizeof(*item)); - if (!item) { - return NULL; - } - - item->data = data; - - if (!list) { - item->prev = item; - item->next = NULL; - } else { - if (list->prev->next) { - list->prev->next = item; - } - - item->prev = list->prev; - item->next = list; - - list->prev = item; - - } - - return item; -} - -struct dlist *dlist_remove(struct dlist *list, struct dlist *l) -{ - if (!list || !l) - return NULL; - - if (l == list) { - list = l->next; - } else { - l->prev->next = l->next; - } - - if (l->next) { - l->next->prev = l->prev; - } - /*! - * \note - * If the removed entry 'l' has no next element, it is the last element. - * In this case, check the existence of the list first, - * and if the list is not empty, update the 'prev' of the list (which is a head element of the list) - * - * If we didn't care about this, the head element(list) can indicates the invalid element. - */ - else if (list) { - list->prev = l->prev; - } - - free(l); - return list; -} - -struct dlist *dlist_find_data(struct dlist *list, void *data) -{ - struct dlist *l; - void *_data; - - dlist_foreach(list, l, _data) { - if (data == _data) { - return l; - } - } - - return NULL; -} - -void *dlist_data(struct dlist *l) -{ - return l ? l->data : NULL; -} - -struct dlist *dlist_next(struct dlist *l) -{ - return l ? l->next : NULL; -} - -struct dlist *dlist_prev(struct dlist *l) -{ - return l ? l->prev : NULL; -} - -int dlist_count(struct dlist *l) -{ - register int i; - struct dlist *n; - void *data; - - i = 0; - dlist_foreach(l, n, data) { - i++; - } - - return i; -} - -struct dlist *dlist_nth(struct dlist *l, int nth) -{ - register int i; - struct dlist *n; - - i = 0; - for (n = l; n; n = n->next) { - if (i == nth) { - return n; - } - i++; - } - - return NULL; -} - -/* End of a file */ diff --git a/pkgmgr_shortcut/src/service_register.c b/pkgmgr_shortcut/src/service_register.c deleted file mode 100644 index c4c1a7f..0000000 --- a/pkgmgr_shortcut/src/service_register.c +++ /dev/null @@ -1,1244 +0,0 @@ -/* - * Copyright (c) 2000 - 2013 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 <errno.h> -#include <sys/types.h> -#include <sys/stat.h> -#include <unistd.h> -#include <libgen.h> -#include <string.h> - -#include <sqlite3.h> -#include <db-util.h> -#include <libxml/parser.h> -#include <libxml/tree.h> -#include <dlog.h> - -#include "dlist.h" - -#if !defined(FLOG) -#define DbgPrint(format, arg...) SECURE_LOGD("[[32m%s/%s[0m:%d] " format, basename(__FILE__), __func__, __LINE__, ##arg) -#define ErrPrint(format, arg...) SECURE_LOGE("[[32m%s/%s[0m:%d] " format, basename(__FILE__), __func__, __LINE__, ##arg) -#endif -/* End of a file */ - -/*! - * DB Table schema - * - * +----+-------+-------+------+---------+-----------+------------+ - * | id | pkgid | appid | Icon | Name | extra_key | extra_data | - * +----+-------+-------+------+---------+-----------+------------+ - * | id | - | - | - | - | - | - | - * +----+-------+-------+------+---------+-----------+------------+ - * - * +----+-------+------+------+------+ - * | fk | pkgid | lang | name | icon | - * +----+-------+------+------+------+ - * | id | - | - | | - | - * +----+-------+------+------+------+ - */ - -#if !defined(LIBXML_TREE_ENABLED) - #error "LIBXML is not supporting the tree" -#endif - -int errno; - -struct i18n_name { - xmlChar *icon; - xmlChar *name; - xmlChar *lang; -}; - -static struct { - const char *dbfile; - sqlite3 *handle; -} s_info = { - .dbfile = "/opt/dbspace/.shortcut_service.db", - .handle = NULL, -}; - -static inline int begin_transaction(void) -{ - sqlite3_stmt *stmt; - int ret; - - ret = sqlite3_prepare_v2(s_info.handle, "BEGIN TRANSACTION", -1, &stmt, NULL); - if (ret != SQLITE_OK) { - DbgPrint("Error: %s\n", sqlite3_errmsg(s_info.handle)); - return EXIT_FAILURE; - } - - if (sqlite3_step(stmt) != SQLITE_DONE) { - DbgPrint("Failed to do update (%s)\n", - sqlite3_errmsg(s_info.handle)); - sqlite3_finalize(stmt); - return EXIT_FAILURE; - } - - sqlite3_finalize(stmt); - return EXIT_SUCCESS; -} - -static inline int rollback_transaction(void) -{ - int ret; - sqlite3_stmt *stmt; - - ret = sqlite3_prepare_v2(s_info.handle, "ROLLBACK TRANSACTION", -1, &stmt, NULL); - if (ret != SQLITE_OK) { - DbgPrint("Error: %s\n", sqlite3_errmsg(s_info.handle)); - return EXIT_FAILURE; - } - - if (sqlite3_step(stmt) != SQLITE_DONE) { - DbgPrint("Failed to do update (%s)\n", - sqlite3_errmsg(s_info.handle)); - sqlite3_finalize(stmt); - return EXIT_FAILURE; - } - - sqlite3_finalize(stmt); - return EXIT_SUCCESS; -} - -static inline int commit_transaction(void) -{ - sqlite3_stmt *stmt; - int ret; - - ret = sqlite3_prepare_v2(s_info.handle, "COMMIT TRANSACTION", -1, &stmt, NULL); - if (ret != SQLITE_OK) { - DbgPrint("Error: %s\n", sqlite3_errmsg(s_info.handle)); - return EXIT_FAILURE; - } - - if (sqlite3_step(stmt) != SQLITE_DONE) { - DbgPrint("Failed to do update (%s)\n", - sqlite3_errmsg(s_info.handle)); - sqlite3_finalize(stmt); - return EXIT_FAILURE; - } - - sqlite3_finalize(stmt); - return EXIT_SUCCESS; -} - -static void db_create_version(void) -{ - static const char *ddl = "CREATE TABLE version (version INTEGER)"; - char *err; - - if (sqlite3_exec(s_info.handle, ddl, NULL, NULL, &err) != SQLITE_OK) { - ErrPrint("Failed to execute the DDL (%s)\n", err); - return; - } - - if (sqlite3_changes(s_info.handle) == 0) { - ErrPrint("No changes to DB\n"); - } -} - -static int set_version(int version) -{ - static const char *dml = "INSERT INTO version (version) VALUES (?)"; - sqlite3_stmt *stmt; - int ret; - - ret = sqlite3_prepare_v2(s_info.handle, dml, -1, &stmt, NULL); - if (ret != SQLITE_OK) { - ErrPrint("Failed to prepare the initial DML(%s)\n", sqlite3_errmsg(s_info.handle)); - return -EIO; - } - - if (sqlite3_bind_int(stmt, 1, version) != SQLITE_OK) { - ErrPrint("Failed to bind a id(%s)\n", sqlite3_errmsg(s_info.handle)); - ret = -EIO; - goto out; - } - - ret = sqlite3_step(stmt); - if (ret != SQLITE_DONE) { - ErrPrint("Failed to execute the DML for version: %d\n", ret); - ret = -EIO; - } else { - ret = 0; - } - -out: - sqlite3_reset(stmt); - sqlite3_clear_bindings(stmt); - sqlite3_finalize(stmt); - return ret; -} - -static int update_version(int version) -{ - static const char *dml = "UPDATE version SET version = ?"; - sqlite3_stmt *stmt; - int ret; - - ret = sqlite3_prepare_v2(s_info.handle, dml, -1, &stmt, NULL); - if (ret != SQLITE_OK) { - ErrPrint("Failed to prepare the initial DML(%s)\n", sqlite3_errmsg(s_info.handle)); - return -EIO; - } - - if (sqlite3_bind_int(stmt, 1, version) != SQLITE_OK) { - ErrPrint("Failed to bind a version: %s\n", sqlite3_errmsg(s_info.handle)); - ret = -EIO; - goto out; - } - - ret = sqlite3_step(stmt); - if (ret != SQLITE_DONE) { - ErrPrint("Failed to execute DML: %d\n", ret); - ret = -EIO; - } else { - ret = 0; - } - -out: - sqlite3_reset(stmt); - sqlite3_clear_bindings(stmt); - sqlite3_finalize(stmt); - return ret; -} - -static int get_version(void) -{ - static const char *dml = "SELECT version FROM version"; - sqlite3_stmt *stmt; - int ret; - - ret = sqlite3_prepare_v2(s_info.handle, dml, -1, &stmt, NULL); - if (ret != SQLITE_OK) { - return -ENOSYS; - } - - if (sqlite3_step(stmt) != SQLITE_ROW) { - ret = -ENOENT; - } else { - ret = sqlite3_column_int(stmt, 0); - } - - sqlite3_reset(stmt); - sqlite3_clear_bindings(stmt); - sqlite3_finalize(stmt); - return ret; -} - -static void db_create_table(void) -{ - char *err; - static const char *ddl = - "CREATE TABLE shortcut_service (" - "id INTEGER PRIMARY KEY AUTOINCREMENT, " - "pkgid TEXT, " - "appid TEXT, " - "icon TEXT, " - "name TEXT, " - "extra_key TEXT, " - "extra_data TEXT)"; - - if (sqlite3_exec(s_info.handle, ddl, NULL, NULL, &err) != SQLITE_OK) { - ErrPrint("Failed to execute the DDL (%s)\n", err); - return; - } - - if (sqlite3_changes(s_info.handle) == 0) { - ErrPrint("No changes to DB\n"); - } - - ddl = "CREATE TABLE shortcut_name (id INTEGER, pkgid TEXT, lang TEXT, name TEXT, icon TEXT)"; - if (sqlite3_exec(s_info.handle, ddl, NULL, NULL, &err) != SQLITE_OK) { - ErrPrint("Failed to execute the DDL (%s)\n", err); - return; - } - - if (sqlite3_changes(s_info.handle) == 0) { - ErrPrint("No changes to DB\n"); - } - - db_create_version(); -} - -static void alter_shortcut_icon(void) -{ - char *err; - static const char *ddl = "ALTER TABLE shortcut_name ADD icon TEXT"; - - if (sqlite3_exec(s_info.handle, ddl, NULL, NULL, &err) != SQLITE_OK) { - ErrPrint("Failed to execute the DDL (%s)\n", err); - return; - } - - if (sqlite3_changes(s_info.handle) == 0) { - ErrPrint("No changes to DB\n"); - } -} - -static void alter_shortcut_name(void) -{ - char *err; - static const char *ddl = "ALTER TABLE shortcut_name ADD pkgid TEXT"; - - if (sqlite3_exec(s_info.handle, ddl, NULL, NULL, &err) != SQLITE_OK) { - ErrPrint("Failed to execute the DDL (%s)\n", err); - return; - } - - if (sqlite3_changes(s_info.handle) == 0) { - ErrPrint("No changes to DB\n"); - } -} - -static void alter_shortcut_service(void) -{ - char *err; - static const char *ddl = "ALTER TABLE shortcut_service ADD pkgid TEXT"; - - if (sqlite3_exec(s_info.handle, ddl, NULL, NULL, &err) != SQLITE_OK) { - ErrPrint("Failed to execute the DDL (%s)\n", err); - return; - } - - if (sqlite3_changes(s_info.handle) == 0) { - ErrPrint("No changes to DB\n"); - } -} - -static int db_remove_by_pkgid(const char *pkgid) -{ - static const char *dml = "DELETE FROM shortcut_service WHERE pkgid = ?"; - sqlite3_stmt *stmt; - int ret; - - if (!pkgid) { - ErrPrint("Invalid argument\n"); - return -EINVAL; - } - - ret = sqlite3_prepare_v2(s_info.handle, dml, -1, &stmt, NULL); - if (ret != SQLITE_OK) { - ErrPrint("Failed to prepare the initial DML(%s)\n", sqlite3_errmsg(s_info.handle)); - return -EIO; - } - - ret = -EIO; - if (sqlite3_bind_text(stmt, 1, pkgid, -1, SQLITE_TRANSIENT) != SQLITE_OK) { - ErrPrint("Failed to bind a pkgid(%s)\n", sqlite3_errmsg(s_info.handle)); - goto out; - } - - ret = 0; - if (sqlite3_step(stmt) != SQLITE_DONE) { - ret = -EIO; - ErrPrint("Failed to execute the DML for %s\n", pkgid); - } else { - if (sqlite3_changes(s_info.handle) == 0) { - DbgPrint("No changed\n"); - } - } - -out: - sqlite3_reset(stmt); - sqlite3_clear_bindings(stmt); - sqlite3_finalize(stmt); - return ret; -} - -static void do_upgrade_db_schema(void) -{ - int version; - - version = get_version(); - - switch (version) { - case -ENOSYS: - db_create_version(); - /* Need to create version table */ - case -ENOENT: - if (set_version(1) < 0) { - ErrPrint("Failed to set version\n"); - } - /* Need to set version */ - alter_shortcut_name(); - alter_shortcut_service(); - case 1: - alter_shortcut_icon(); - if (update_version(2) < 0) { - ErrPrint("Failed to update version\n"); - } - case 2: - break; - default: - /* Need to update version */ - DbgPrint("Old version: %d\n", version); - if (update_version(2) < 0) { - ErrPrint("Failed to update version\n"); - } - - alter_shortcut_name(); - alter_shortcut_service(); - /* 2 */ - alter_shortcut_icon(); - break; - } -} - -static int db_remove_record(const char *pkgid, const char *appid, const char *key, const char *data) -{ - static const char *dml = "DELETE FROM shortcut_service WHERE appid = ? AND extra_key = ? AND extra_data = ? AND pkgid = ?"; - sqlite3_stmt *stmt; - int ret; - - if (!appid || !key || !data) { - ErrPrint("Invalid argument\n"); - return -EINVAL; - } - - ret = sqlite3_prepare_v2(s_info.handle, dml, -1, &stmt, NULL); - if (ret != SQLITE_OK) { - ErrPrint("Failed to prepare the initial DML(%s)\n", sqlite3_errmsg(s_info.handle)); - return -EIO; - } - - ret = -EIO; - if (sqlite3_bind_text(stmt, 1, appid, -1, SQLITE_TRANSIENT) != SQLITE_OK) { - ErrPrint("Failed to bind a appid(%s)\n", sqlite3_errmsg(s_info.handle)); - goto out; - } - - if (sqlite3_bind_text(stmt, 2, key, -1, SQLITE_TRANSIENT) != SQLITE_OK) { - ErrPrint("Failed to bind a key(%s)\n", sqlite3_errmsg(s_info.handle)); - goto out; - } - - if (sqlite3_bind_text(stmt, 3, data, -1, SQLITE_TRANSIENT) != SQLITE_OK) { - ErrPrint("Failed to bind a data(%s)\n", sqlite3_errmsg(s_info.handle)); - goto out; - } - - if (sqlite3_bind_text(stmt, 4, pkgid, -1, SQLITE_TRANSIENT) != SQLITE_OK) { - ErrPrint("Failed to bind a pkgid(%s)\n", sqlite3_errmsg(s_info.handle)); - goto out; - } - - ret = 0; - if (sqlite3_step(stmt) != SQLITE_DONE) { - ret = -EIO; - ErrPrint("Failed to execute the DML for %s - %s(%s)\n", appid, key, data); - } - - if (sqlite3_changes(s_info.handle) == 0) { - DbgPrint("No changes\n"); - } - -out: - sqlite3_reset(stmt); - sqlite3_clear_bindings(stmt); - sqlite3_finalize(stmt); - return ret; -} - -static int db_remove_name_by_pkgid(const char *pkgid) -{ - static const char *dml = "DELETE FROM shortcut_name WHERE pkgid = ?"; - sqlite3_stmt *stmt; - int ret; - - if (!pkgid) { - ErrPrint("Invalid id\n"); - return -EINVAL; - } - - ret = sqlite3_prepare_v2(s_info.handle, dml, -1, &stmt, NULL); - if (ret != SQLITE_OK) { - ErrPrint("Failed to prepare the initial DML(%s)\n", sqlite3_errmsg(s_info.handle)); - return -EIO; - } - - if (sqlite3_bind_text(stmt, 1, pkgid, -1, SQLITE_TRANSIENT) != SQLITE_OK) { - ErrPrint("Failed to bind pkgid(%s)\n", pkgid); - return -EIO; - } - - ret = 0; - if (sqlite3_step(stmt) != SQLITE_DONE) { - ret = -EIO; - ErrPrint("Failed to execute the DML for %s\n", pkgid); - goto out; - } - - if (sqlite3_changes(s_info.handle) == 0) { - DbgPrint("No chnages\n"); - } - -out: - sqlite3_reset(stmt); - sqlite3_clear_bindings(stmt); - sqlite3_finalize(stmt); - return ret; -} - -static int db_remove_name(int id) -{ - static const char *dml = "DELETE FROM shortcut_name WHERE id = ?"; - sqlite3_stmt *stmt; - int ret; - - if (id < 0) { - ErrPrint("Inavlid id\n"); - return -EINVAL; - } - - ret = sqlite3_prepare_v2(s_info.handle, dml, -1, &stmt, NULL); - if (ret != SQLITE_OK) { - ErrPrint("Failed to prepare the initial DML(%s)\n", sqlite3_errmsg(s_info.handle)); - return -EIO; - } - - if (sqlite3_bind_int(stmt, 1, id) != SQLITE_OK) { - ErrPrint("Failed to bind id(%d)\n", id); - ret = -EIO; - goto out; - } - - ret = 0; - if (sqlite3_step(stmt) != SQLITE_DONE) { - ret = -EIO; - ErrPrint("Failed to execute the DML for %d\n", id); - goto out; - } - - if (sqlite3_changes(s_info.handle) == 0) { - DbgPrint("No changes\n"); - } - -out: - sqlite3_reset(stmt); - sqlite3_clear_bindings(stmt); - sqlite3_finalize(stmt); - return ret; -} - -static int db_insert_record(const char *pkgid, const char *appid, const char *icon, const char *name, const char *key, const char *data) -{ - static const char *dml = "INSERT INTO shortcut_service (pkgid, appid, icon, name, extra_key, extra_data) VALUES (?, ?, ?, ?, ?, ?)"; - sqlite3_stmt *stmt; - int ret; - - if (!pkgid) { - ErrPrint("Failed to get pkgid\n"); - return -EINVAL; - } - - if (!appid) { - ErrPrint("Failed to get appid\n"); - return -EINVAL; - } - - if (!name) { - ErrPrint("Failed to get name\n"); - return -EINVAL; - } - - if (!key) { - ErrPrint("Failed to get key\n"); - return -EINVAL; - } - - if (!data) { - ErrPrint("Faield to get key\n"); - return -EINVAL; - } - - ret = sqlite3_prepare_v2(s_info.handle, dml, -1, &stmt, NULL); - if (ret != SQLITE_OK) { - ErrPrint("Failed to prepare the initial DML(%s)\n", sqlite3_errmsg(s_info.handle)); - return -EIO; - } - - ret = -EIO; - if (sqlite3_bind_text(stmt, 1, pkgid, -1, SQLITE_TRANSIENT) != SQLITE_OK) { - ErrPrint("Failed to bind a pkgid(%s)\n", sqlite3_errmsg(s_info.handle)); - goto out; - } - - if (sqlite3_bind_text(stmt, 2, appid, -1, SQLITE_TRANSIENT) != SQLITE_OK) { - ErrPrint("Failed to bind a appid(%s)\n", sqlite3_errmsg(s_info.handle)); - goto out; - } - - if (sqlite3_bind_text(stmt, 3, icon, -1, SQLITE_TRANSIENT) != SQLITE_OK) { - ErrPrint("Failed to bind a icon(%s)\n", sqlite3_errmsg(s_info.handle)); - goto out; - } - - if (sqlite3_bind_text(stmt, 4, name, -1, SQLITE_TRANSIENT) != SQLITE_OK) { - ErrPrint("Failed to bind a name(%s)\n", sqlite3_errmsg(s_info.handle)); - goto out; - } - - if (sqlite3_bind_text(stmt, 5, key, -1, SQLITE_TRANSIENT) != SQLITE_OK) { - ErrPrint("Failed to bind a service(%s)\n", sqlite3_errmsg(s_info.handle)); - goto out; - } - - if (sqlite3_bind_text(stmt, 6, data, -1, SQLITE_TRANSIENT) != SQLITE_OK) { - ErrPrint("Failed to bind a service(%s)\n", sqlite3_errmsg(s_info.handle)); - goto out; - } - - ret = 0; - if (sqlite3_step(stmt) != SQLITE_DONE) { - ErrPrint("Failed to execute the DML for %s - %s\n", appid, name); - ret = -EIO; - } - -out: - sqlite3_reset(stmt); - sqlite3_clear_bindings(stmt); - sqlite3_finalize(stmt); - return ret; -} - -static int db_insert_name(int id, const char *pkgid, const char *lang, const char *name, const char *icon) -{ - static const char *dml = "INSERT INTO shortcut_name (id, pkgid, lang, name, icon) VALUES (?, ?, ?, ?, ?)"; - sqlite3_stmt *stmt; - int ret; - - if (id < 0 || !lang) { - ErrPrint("Invalid parameters\n"); - return -EINVAL; - } - - ret = sqlite3_prepare_v2(s_info.handle, dml, -1, &stmt, NULL); - if (ret != SQLITE_OK) { - ErrPrint("Failed to prepare the initial DML(%s)\n", sqlite3_errmsg(s_info.handle)); - return -EIO; - } - - if (sqlite3_bind_int(stmt, 1, id) != SQLITE_OK) { - ErrPrint("Failed to bind a id(%s)\n", sqlite3_errmsg(s_info.handle)); - ret = -EIO; - goto out; - } - - if (sqlite3_bind_text(stmt, 2, pkgid, -1, SQLITE_TRANSIENT) != SQLITE_OK) { - ErrPrint("Failed to bind a pkgid(%s)\n", sqlite3_errmsg(s_info.handle)); - ret = -EIO; - goto out; - } - - if (sqlite3_bind_text(stmt, 3, lang, -1, SQLITE_TRANSIENT) != SQLITE_OK) { - ErrPrint("Failed to bind a id(%s)\n", sqlite3_errmsg(s_info.handle)); - ret = -EIO; - goto out; - } - - if (sqlite3_bind_text(stmt, 4, name, -1, SQLITE_TRANSIENT) != SQLITE_OK) { - ErrPrint("Failed to bind a id(%s)\n", sqlite3_errmsg(s_info.handle)); - ret = -EIO; - goto out; - } - - if (sqlite3_bind_text(stmt, 5, icon, -1, SQLITE_TRANSIENT) != SQLITE_OK) { - ErrPrint("Failed to bind a id(%s)\n", sqlite3_errmsg(s_info.handle)); - ret = -EIO; - goto out; - } - - ret = 0; - if (sqlite3_step(stmt) != SQLITE_DONE) { - ErrPrint("Failed to execute the DML for %d %s %s\n", id, lang, name); - ret = -EIO; - } - -out: - sqlite3_reset(stmt); - sqlite3_clear_bindings(stmt); - sqlite3_finalize(stmt); - return ret; -} - -static int db_get_id(const char *pkgid, const char *appid, const char *key, const char *data) -{ - static const char *dml = "SELECT id FROM shortcut_service WHERE pkgid = ? AND appid = ? AND extra_key = ? AND extra_data = ?"; - sqlite3_stmt *stmt; - int ret; - - if (!appid || !key || !data) { - ErrPrint("Invalid argument\n"); - return -EINVAL; - } - - ret = sqlite3_prepare_v2(s_info.handle, dml, -1, &stmt, NULL); - if (ret != SQLITE_OK) { - ErrPrint("Failed to prepare the initial DML(%s)\n", sqlite3_errmsg(s_info.handle)); - return -EIO; - } - - ret = -EIO; - if (sqlite3_bind_text(stmt, 1, pkgid, -1, SQLITE_TRANSIENT) != SQLITE_OK) { - ErrPrint("Failed to bind a pkgid(%s) - %s\n", pkgid, sqlite3_errmsg(s_info.handle)); - goto out; - } - - if (sqlite3_bind_text(stmt, 2, appid, -1, SQLITE_TRANSIENT) != SQLITE_OK) { - ErrPrint("Failed to bind a appid(%s) - %s\n", appid, sqlite3_errmsg(s_info.handle)); - goto out; - } - - if (sqlite3_bind_text(stmt, 3, key, -1, SQLITE_TRANSIENT) != SQLITE_OK) { - ErrPrint("Failed to bind a key(%s) - %s\n", key, sqlite3_errmsg(s_info.handle)); - goto out; - } - - if (sqlite3_bind_text(stmt, 4, data, -1, SQLITE_TRANSIENT) != SQLITE_OK) { - ErrPrint("Failed to bind a data(%s) - %s\n", data, sqlite3_errmsg(s_info.handle)); - goto out; - } - - if (sqlite3_step(stmt) != SQLITE_ROW) { - ErrPrint("Failed to execute the DML for %s - %s, %s\n", appid, key, data); - ret = -EIO; - goto out; - } - - ret = sqlite3_column_int(stmt, 0); - -out: - sqlite3_reset(stmt); - sqlite3_clear_bindings(stmt); - sqlite3_finalize(stmt); - return ret; -} - -static int db_init(void) -{ - int ret; - struct stat stat; - - ret = db_util_open(s_info.dbfile, &s_info.handle, DB_UTIL_REGISTER_HOOK_METHOD); - if (ret != SQLITE_OK) { - ErrPrint("Failed to open a DB\n"); - return -EIO; - } - - if (lstat(s_info.dbfile, &stat) < 0) { - ErrPrint("%s\n", strerror(errno)); - db_util_close(s_info.handle); - s_info.handle = NULL; - return -EIO; - } - - if (!S_ISREG(stat.st_mode)) { - ErrPrint("Invalid file\n"); - db_util_close(s_info.handle); - s_info.handle = NULL; - return -EINVAL; - } - - if (!stat.st_size) { - db_create_table(); - } - - return 0; -} - -static int db_fini(void) -{ - if (!s_info.handle) { - return 0; - } - - db_util_close(s_info.handle); - s_info.handle = NULL; - - return 0; -} - -static int do_uninstall(const char *appid) -{ - int ret; - - ret = db_remove_by_pkgid(appid); - if (ret < 0) { - ErrPrint("Failed to remove a record: %s\n", appid); - return ret; - } - - ret = db_remove_name_by_pkgid(appid); - if (ret < 0) { - ErrPrint("Failed to remove name records: %s\n", appid); - return ret; - } - - return 0; -} - -static inline struct i18n_name *find_i18n_name(struct dlist *i18n_list, xmlChar *lang) -{ - struct dlist *l; - struct i18n_name *i18n; - - dlist_foreach(i18n_list, l, i18n) { - if (!xmlStrcasecmp(i18n->lang, lang)) { - return i18n; - } - } - - return NULL; -} - -static inline struct i18n_name *create_i18n_name(xmlChar *lang, xmlChar *name, xmlChar *icon) -{ - struct i18n_name *i18n; - - i18n = malloc(sizeof(*i18n)); - if (!i18n) { - ErrPrint("Heap: %s\n", strerror(errno)); - return NULL; - } - - i18n->lang = lang; - i18n->name = name; - i18n->icon = icon; - - return i18n; -} - -static inline void destroy_i18n_name(struct i18n_name *i18n) -{ - xmlFree(i18n->lang); - xmlFree(i18n->name); - xmlFree(i18n->icon); - free(i18n); -} - -static int do_install(xmlDocPtr docPtr, const char *appid) -{ - xmlNodePtr node = NULL; - xmlNodePtr child = NULL; - xmlChar *key; - xmlChar *data; - xmlChar *name; - xmlChar *icon; - xmlChar *lang; - xmlChar *shortcut_appid; - xmlNodePtr root; - struct i18n_name *i18n; - struct dlist *i18n_list = NULL; - struct dlist *l; - struct dlist *n; - int id; - - root = xmlDocGetRootElement(docPtr); - if (!root) { - ErrPrint("Invalid node ptr\n"); - return -EINVAL; - } - - for (root = root->children; root; root = root->next) { - if (!xmlStrcasecmp(root->name, (const xmlChar *)"shortcut-list")) { - break; - } - } - - if (!root) { - ErrPrint("Root has no children\n"); - return -EINVAL; - } - - DbgPrint("AppID: %s\n", appid); - - root = root->children; /* Jump to children node */ - for (node = root; node; node = node->next) { - if (node->type == XML_ELEMENT_NODE) { - DbgPrint("Element %s\n", node->name); - } - - if (xmlStrcasecmp(node->name, (const xmlChar *)"shortcut")) { - continue; - } - - if (!xmlHasProp(node, (xmlChar *)"extra_key") || !xmlHasProp(node, (xmlChar *)"extra_data")) { - DbgPrint("Invalid element %s\n", node->name); - continue; - } - - key = xmlGetProp(node, (xmlChar *)"extra_key"); - data = xmlGetProp(node, (xmlChar *)"extra_data"); - shortcut_appid = xmlGetProp(node, (xmlChar *)"appid"); - - icon = NULL; - name = NULL; - for (child = node->children; child; child = child->next) { - if (!xmlStrcasecmp(child->name, (const xmlChar *)"icon")) { - lang = xmlNodeGetLang(child); - if (!lang) { - if (icon) { - DbgPrint("Default icon is duplicated\n"); - } else { - icon = xmlNodeGetContent(child); - DbgPrint("Default icon is %s\n", icon); - } - - continue; - } - - i18n = find_i18n_name(i18n_list, lang); - if (i18n) { - xmlFree(lang); - - if (i18n->icon) { - DbgPrint("%s is duplicated\n", i18n->icon); - continue; - } - - i18n->icon = xmlNodeGetContent(child); - } else { - i18n = create_i18n_name(lang, NULL, xmlNodeGetContent(child)); - if (!i18n) { - ErrPrint("Failed to create a new i18n_name\n"); - continue; - } - i18n_list = dlist_append(i18n_list, i18n); - } - - continue; - } - - if (!xmlStrcasecmp(child->name, (const xmlChar *)"label")) { - lang = xmlNodeGetLang(child); - if (!lang) { - if (name) { - DbgPrint("Default name is duplicated\n"); - } else { - name = xmlNodeGetContent(child); - DbgPrint("Default name is %s\n", name); - } - - continue; - } - - i18n = find_i18n_name(i18n_list, lang); - if (i18n) { - xmlFree(lang); - - if (i18n->name) { - DbgPrint("%s is duplicated\n", i18n->name); - continue; - } - - i18n->name = xmlNodeGetContent(child); - } else { - i18n = create_i18n_name(lang, xmlNodeGetContent(child), NULL); - if (!i18n) { - ErrPrint("Failed to create a new i18n_name\n"); - continue; - } - i18n_list = dlist_append(i18n_list, i18n); - } - - continue; - } - } - - DbgPrint("appid: %s\n", appid); - DbgPrint("shortcut appid: %s\n", shortcut_appid); - DbgPrint("key: %s\n", key); - DbgPrint("data: %s\n", data); - DbgPrint("icon: %s\n", icon); - DbgPrint("Default name: %s\n", name); - - if (!shortcut_appid) { - shortcut_appid = xmlStrdup((xmlChar *)appid); - DbgPrint("Use the default appid\n"); - } - - begin_transaction(); - if (db_insert_record(appid, (char *)shortcut_appid, (char *)icon, (char *)name, (char *)key, (char *)data) < 0) { - ErrPrint("Failed to insert a new record\n"); - rollback_transaction(); - - dlist_foreach_safe(i18n_list, l, n, i18n) { - i18n_list = dlist_remove(i18n_list, l); - destroy_i18n_name(i18n); - } - } else { - id = db_get_id((char *)appid, (char *)shortcut_appid, (char *)key, (char *)data); - if (id < 0) { - ErrPrint("Failed to insert a new record\n"); - rollback_transaction(); - - dlist_foreach_safe(i18n_list, l, n, i18n) { - i18n_list = dlist_remove(i18n_list, l); - destroy_i18n_name(i18n); - } - } else { - dlist_foreach_safe(i18n_list, l, n, i18n) { - i18n_list = dlist_remove(i18n_list, l); - if (db_insert_name(id, appid, (char *)i18n->lang, (char *)i18n->name, (char *)i18n->icon) < 0) { - ErrPrint("Failed to add i18n name: %s(%s)\n", i18n->name, i18n->lang); - } - destroy_i18n_name(i18n); - } - commit_transaction(); - } - } - - xmlFree(key); - xmlFree(data); - xmlFree(icon); - xmlFree(name); - xmlFree(shortcut_appid); - } - - return 0; -} - -int PKGMGR_PARSER_PLUGIN_PRE_UNINSTALL(const char *appid) -{ - if (!s_info.handle) { - if (db_init() < 0) { - return -EIO; - } - } - - do_upgrade_db_schema(); - return 0; -} - -int PKGMGR_PARSER_PLUGIN_POST_UNINSTALL(const char *appid) -{ - int ret; - - begin_transaction(); - ret = do_uninstall(appid); - if (ret < 0) { - rollback_transaction(); - return ret; - } - commit_transaction(); - - db_fini(); - return 0; -} - -int PKGMGR_PARSER_PLUGIN_UNINSTALL(xmlDocPtr docPtr, const char *_appid) -{ - xmlNodePtr node = NULL; - xmlChar *key; - xmlChar *data; - xmlChar *appid; - xmlNodePtr root; - int id; - - if (!docPtr) { - DbgPrint("Package manager doesn't support the docPtr (%s)\n", _appid); - return 0; - } - - root = xmlDocGetRootElement(docPtr); - if (!root) { - ErrPrint("Invalid node ptr\n"); - return -EINVAL; - } - - for (root = root->children; root; root = root->next) { - if (!xmlStrcasecmp(root->name, (const xmlChar *)"shortcut-list")) { - break; - } - } - - if (!root) { - ErrPrint("Root has no shortcut-list\n"); - return -EINVAL; - } - - DbgPrint("AppID: %s\n", _appid); - root = root->children; - for (node = root; node; node = node->next) { - if (node->type == XML_ELEMENT_NODE) { - DbgPrint("Element %s\n", node->name); - } - - if (xmlStrcasecmp(node->name, (const xmlChar *)"shortcut")) { - continue; - } - - if (!xmlHasProp(node, (xmlChar *)"extra_data") - || !xmlHasProp(node, (xmlChar *)"extra_key") - || !xmlHasProp(node, (xmlChar *)"appid")) - { - DbgPrint("Invalid element %s\n", node->name); - continue; - } - - appid = xmlGetProp(node, (xmlChar *)"appid"); - key = xmlGetProp(node, (xmlChar *)"extra_key"); - data = xmlGetProp(node, (xmlChar *)"extra_data"); - - DbgPrint("appid: %s\n", appid); - DbgPrint("key: %s\n", key); - DbgPrint("data: %s\n", data); - - id = db_get_id(NULL, (char *)appid, (char *)key, (char *)data); - if (id < 0) { - ErrPrint("No records found\n"); - xmlFree(appid); - xmlFree(key); - xmlFree(data); - continue; - } - - begin_transaction(); - if (db_remove_record(NULL, (char *)appid, (char *)key, (char *)data) < 0) { - ErrPrint("Failed to remove a record\n"); - rollback_transaction(); - xmlFree(appid); - xmlFree(key); - xmlFree(data); - continue; - } - - if (db_remove_name(id) < 0) { - ErrPrint("Failed to remove name records\n"); - rollback_transaction(); - xmlFree(appid); - xmlFree(key); - xmlFree(data); - continue; - } - commit_transaction(); - - xmlFree(appid); - xmlFree(key); - xmlFree(data); - - /*! - * \note - * if (node->children) - * DbgPrint("Skip this node's children\n"); - */ - } - - return 0; -} - -int PKGMGR_PARSER_PLUGIN_PRE_INSTALL(const char *appid) -{ - int ret; - - if (!s_info.handle) { - if (db_init() < 0) { - return -EIO; - } - } - - do_upgrade_db_schema(); - - begin_transaction(); - ret = do_uninstall(appid); - if (ret < 0) { - ErrPrint("Failed to remove record: %s\n", appid); - /* Keep going */ - } - commit_transaction(); - return 0; -} - -int PKGMGR_PARSER_PLUGIN_POST_INSTALL(const char *appid) -{ - db_fini(); - return 0; -} - -int PKGMGR_PARSER_PLUGIN_INSTALL(xmlDocPtr docPtr, const char *appid) -{ - return do_install(docPtr, appid); -} - -int PKGMGR_PARSER_PLUGIN_PRE_UPGRADE(const char *appid) -{ - int ret; - - if (!s_info.handle) { - if (db_init() < 0) { - return -EIO; - } - } - - do_upgrade_db_schema(); - - begin_transaction(); - ret = do_uninstall(appid); - if (ret < 0) { - ErrPrint("Failed to remove a record: %s\n", appid); - /* Keep going */ - } - commit_transaction(); - return 0; -} - -int PKGMGR_PARSER_PLUGIN_POST_UPGRADE(const char *appid) -{ - db_fini(); - return 0; -} - -int PKGMGR_PARSER_PLUGIN_UPGRADE(xmlDocPtr docPtr, const char *appid) -{ - /* So... ugly */ - return do_install(docPtr, appid); -} - -/* -int main(int argc, char *argv[]) -{ - xmlDoc *doc; - xmlNode *root; - - if (argc != 2) { - ErrPRint("Invalid argument: %s XML_FILENAME\n", argv[0]); - return -EINVAL; - } - - doc = xmlReadFile(argv[1], NULL, 0); - if (!doc) { - ErrPrint("Failed to parse %s\n", argv[1]); - return -EIO; - } - - root = xmlDocGetRootElement(doc); - - db_init(); - install_shortcut("", root); - db_fini(); - - xmlFreeDoc(doc); - xmlCleanupParser(); - return 0; -} -*/ - -/* End of a file */ diff --git a/sample.xml b/sample.xml deleted file mode 100644 index f3a6bc8..0000000 --- a/sample.xml +++ /dev/null @@ -1,62 +0,0 @@ -<?xml version="1.0" encoding="utf-8" ?> -<manifest xmlns="http://tizen.org/ns/packages" package="com.samsung.myapp" version="0.3.5" install-location="auto"> -<shortcut-list test="a"> - <shortcut appid="com.samsung.myapp" extra_key="key" extra_data="SERVICE INFORMATION 1"> - <icon>/opt/usr/apps/com.samsung.myapp/res/icon/myapp_shortcut01.png</icon> - <label>Default Name</label> - <label xml:lang="en-us">Name en</label> - <label xml:lang="nl-nl">Name nl</label> - <label xml:lang="de-de">Name de</label> - <label xml:lang="zh-hk">Name hk</label> - <label xml:lang="zh-cn">Name cn</label> - <label xml:lang="ru-ru">Name ru</label> - <label xml:lang="zh-tw">Name tw</label> - <label xml:lang="ja-jp">Name jp</label> - <label xml:lang="es-es">Name es</label> - <label xml:lang="el-gr">Name gr</label> - <label xml:lang="it-it">Name it</label> - <label xml:lang="tr-tr">Name tr</label> - <label xml:lang="pt-pt">Name pt</label> - <label xml:lang="fr-fr">Name fr</label> - <label xml:lang="kor-kr">Name kr</label> - </shortcut> - <shortcut appid="com.samsung.myapp-gadget" extra_key="key" extra_data="SERVICE INFORMATION 2"> - <icon>/opt/usr/apps/com.samsung.myapp/res/icon/gadget_shortcut01.png</icon> - <label>Default Name 02</label> - <label xml:lang="en-us">Name en</label> - <label xml:lang="nl-nl">Name nl</label> - <label xml:lang="de-de">Name de</label> - <label xml:lang="zh-hk">Name hk</label> - <label xml:lang="zh-cn">Name cn</label> - <label xml:lang="ru-ru">Name ru</label> - <label xml:lang="zh-tw">Name tw</label> - <label xml:lang="ja-jp">Name jp</label> - <label xml:lang="es-es">Name es</label> - <label xml:lang="el-gr">Name gr</label> - <label xml:lang="it-it">Name it</label> - <label xml:lang="tr-tr">Name tr</label> - <label xml:lang="pt-pt">Name pt</label> - <label xml:lang="fr-fr">Name fr</label> - <label xml:lang="kor-kr">Name kr</label> - </shortcut> - <shortcut appid="com.samsung.myapp" extra_key="key" extra_data="SERVICE INFORMATION 3"> - <icon>/opt/usr/apps/com.samsung.myapp/res/icon/mayapp_shortcut02.png</icon> - <label>Default Name 03</label> - <label xml:lang="en-us">Name en</label> - <label xml:lang="nl-nl">Name nl</label> - <label xml:lang="de-de">Name de</label> - <label xml:lang="zh-hk">Name hk</label> - <label xml:lang="zh-cn">Name cn</label> - <label xml:lang="ru-ru">Name ru</label> - <label xml:lang="zh-tw">Name tw</label> - <label xml:lang="ja-jp">Name jp</label> - <label xml:lang="es-es">Name es</label> - <label xml:lang="el-gr">Name gr</label> - <label xml:lang="it-it">Name it</label> - <label xml:lang="tr-tr">Name tr</label> - <label xml:lang="pt-pt">Name pt</label> - <label xml:lang="fr-fr">Name fr</label> - <label xml:lang="kor-kr">Name kr</label> - </shortcut> -</shortcut-list> -</manifest> diff --git a/test/Makefile b/test/Makefile deleted file mode 100644 index abe5c1b..0000000 --- a/test/Makefile +++ /dev/null @@ -1,4 +0,0 @@ -all: - @gcc homescreen.c -Wall -o homescreen `pkg-config ecore elementary shortcut --cflags --libs` - @gcc application.c -Wall -o application `pkg-config ecore elementary shortcut --cflags --libs` - @gcc shortcut.c -Wall -o shortcut `pkg-config ecore elementary shortcut --cflags --libs` diff --git a/test/application.c b/test/application.c deleted file mode 100644 index 6c1e5f3..0000000 --- a/test/application.c +++ /dev/null @@ -1,57 +0,0 @@ -/* - * Copyright (c) 2000 - 2013 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 <Elementary.h> -#include <shortcut.h> - -static int result_cb(int ret, int pid, void *data) -{ - printf("Client: Return %d (%d)\n", ret, pid); - //elm_exit(); - return 0; -} - -static Eina_Bool shortcut_add_cb(void *data) -{ - int ret; - - ret = add_to_home_shortcut("pkgname", "MyName", 0, "/usr/bin/true", "/opt/share/image/what.png", result_cb, NULL); - printf("Client: shortcut_add_to_home returns: %d\n", ret); - - ret = add_to_home_livebox("pkgname", "MyName", 0, "/usr/bin/true", "/opt/share/image/what.png", 1.0f, result_cb, NULL); - printf("Client: shortcut_add_to_home_with_period returns: %d\n", ret); - - return ECORE_CALLBACK_RENEW; -} - -int elm_main(int argc, char *argv[]) -{ - Ecore_Timer *timer; - - timer = ecore_timer_add(3.0f, shortcut_add_cb, NULL); - if (!timer) { - printf("Failed to add a timer\n"); - } - - elm_run(); - elm_shutdown(); - - return 0; -} - -ELM_MAIN() -/* End of a file */ diff --git a/test/homescreen.c b/test/homescreen.c deleted file mode 100644 index 0b6c5f7..0000000 --- a/test/homescreen.c +++ /dev/null @@ -1,40 +0,0 @@ -/* - * Copyright (c) 2000 - 2013 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 <Elementary.h> -#include <shortcut.h> - -int shortcut_request_cb(const char *pkgname, const char *name, int type, const char *exec, const char *icon, int pid, double period, void *data) -{ - printf("SERVER: name: %s, type: %d, exec: %s, icon: %s, pid: %d, data: %p, period: %lf\n", - name, type, exec, icon, pid, data, period); - return 0; -} - -int elm_main(int argc, char *argv[]) -{ - shortcut_set_request_cb(shortcut_request_cb, NULL); - - elm_run(); - elm_shutdown(); - - return 0; -} - -ELM_MAIN() -/* End of a file */ - diff --git a/test/icon.c b/test/icon.c deleted file mode 100644 index 3086729..0000000 --- a/test/icon.c +++ /dev/null @@ -1,91 +0,0 @@ -/* - * Copyright (c) 2000 - 2013 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 <Elementary.h> -#include <shortcut.h> - -static int result_cb(struct shortcut_icon *handle, int ret, void *data) -{ - printf("Client: Return %d (%p)\n", ret, handle); - return 0; -} - -static Eina_Bool test_main(void *data) -{ - struct shortcut_icon *handle; - static int idx = 0; - int ret; - char filename[256]; - int type; - - idx++; - - handle = shortcut_icon_request_create(); - if (!handle) { - printf("Failed to create a request\n"); - return ECORE_CALLBACK_RENEW; - } - - printf("Test: %d\n", idx); - ret = shortcut_icon_request_set_info(handle, NULL, SHORTCUT_ICON_TYPE_IMAGE, DEFAULT_ICON_PART, "/usr/share/icons/default/small/com.samsung.music-player.png", NULL, NULL); - printf("NAME set_info: %d\n", ret); - - snprintf(filename, sizeof(filename), "App Name %d", idx); - ret = shortcut_icon_request_set_info(handle, NULL, SHORTCUT_ICON_TYPE_TEXT, DEFAULT_NAME_PART, filename, NULL, NULL); - printf("TEXT set_info: %d\n", ret); - - snprintf(filename, sizeof(filename), "/opt/usr/share/live_magazine/always/out%d.png", idx); - - switch (idx % 7) { - case 0: type = LIVEBOX_TYPE_1x1; break; - case 1: type = LIVEBOX_TYPE_2x1; break; - case 2: type = LIVEBOX_TYPE_2x2; break; - case 3: type = LIVEBOX_TYPE_4x1; break; - case 4: type = LIVEBOX_TYPE_4x2; break; - case 5: type = LIVEBOX_TYPE_4x3; break; - case 6: type = LIVEBOX_TYPE_4x4; break; - default: type = LIVEBOX_TYPE_1x1; break; - } - - ret = shortcut_icon_request_send(handle, type, NULL, NULL, filename, result_cb, NULL); - printf("request: %d\n", ret); - - ret = shortcut_icon_request_destroy(handle); - printf("destroy: %d\n", ret); - return ECORE_CALLBACK_RENEW; -} - -static int initialized_cb(int status, void *data) -{ - printf("Hello initializer\n"); - return 0; -} - -int elm_main(int argc, char *argv[]) -{ - shortcut_icon_service_init(NULL, NULL); - - ecore_timer_add(5.0f, test_main, NULL); - - elm_run(); - shortcut_icon_service_fini(); - elm_shutdown(); - return 0; -} - -ELM_MAIN() -/* End of a file */ diff --git a/test/shortcut.c b/test/shortcut.c deleted file mode 100644 index eb8b5d6..0000000 --- a/test/shortcut.c +++ /dev/null @@ -1,41 +0,0 @@ -/* - * Copyright (c) 2000 - 2013 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 <Elementary.h> -#include <shortcut.h> - -static int shortcut_list_cb(const char *appid, const char *icon, const char *name, const char *extra_key, const char *extra_data, void *data) -{ - printf("appid[%s] icon[%s], name[%s] extra_key[%s], extra_ata[%s]\n", appid, icon, name, extra_key, extra_data); - return 0; -} - -int elm_main(int argc, char *argv[]) -{ - int ret; - ret = shortcut_get_list(NULL, shortcut_list_cb, NULL); - if (ret < 0) - printf("Error: %d\n", ret); - - elm_run(); - elm_shutdown(); - - return 0; -} - -ELM_MAIN() -/* End of a file */ diff --git a/test_db_builder.sh b/test_db_builder.sh deleted file mode 100755 index d4c4322..0000000 --- a/test_db_builder.sh +++ /dev/null @@ -1,80 +0,0 @@ -#!/bin/sh -#/* -# * Copyright (c) 2000 - 2013 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. -# * -#*/ - -DBFILE="/opt/dbspace/.shortcut_service.db" - -APPID=( -"com.samsung.facebook" -"com.samsung.facebook" -"com.samsung.facebook" -"com.samsung.facebook" -"com.samsung.facebook" -) - -ICON=( -"" -"" -"" -"" -"" -) - -NAME=( -"Friend's wall" -"Groups" -"Update status" -"Like by me" -"My wall" -) - -KEY=( -"livebox_shortcut_type" -"livebox_shortcut_type" -"livebox_shortcut_type" -"livebox_shortcut_type" -"livebox_shortcut_type" -) - -VALUE=( -"shortcut_friends" -"shortcut_groups" -"shortcut_post" -"shortcut_like" -"shortcut_me" -) - -CNT=0 -ERR=0 -MAX=5 - -sqlite3 $DBFILE "CREATE TABLE shortcut_service (id INTEGER PRIMARY KEY AUTOINCREMENT, appid TEXT, icon TEXT, name TEXT, extra_key TEXT, extra_data TEXT)" -sqlite3 $DBFILE "CREATE TABLE shortcut_name (id INTEGER, lang TEXT, name TEXT)" -while [ $CNT -lt $MAX ] -do - echo "Insert a new record ('${APPID[$CNT]}', '${ICON[$CNT]}', '${NAME[$CNT]}', \"${KEY[$CNT]}\", \"${VALUE[$CNT]}\")" - sqlite3 $DBFILE "INSERT INTO shortcut_service (appid, icon, name, extra_key, extra_data) VALUES ('${APPID[$CNT]}', '${ICON[$CNT]}', \"${NAME[$CNT]}\", \"${KEY[$CNT]}\", \"${VALUE[$CNT]}\")" 2>/dev/null - if [ $? -ne 0 ]; then - let ERR=$ERR+1 - fi - ID=`sqlite3 $DBFILE "SELECT id FROM shortcut_service WHERE appid = \"${APPID[$CNT]}\" AND extra_key = \"${KEY[$CNT]}\" AND extra_data = \"${VALUE[$CNT]}\""` - echo "Insert a name: \"${NAME[$CNT]}\"" - sqlite3 $DBFILE "INSERT INTO shortcut_name (id, lang, name) VALUES ('$ID', 'en-us', \"${NAME[CNT]}\")" - let CNT=$CNT+1 -done - -echo "Error/Total: $ERR/$CNT" |