From 397f35f5c5b990dcfd06d2573cfa700d2517eee7 Mon Sep 17 00:00:00 2001 From: Kim Kibum Date: Sun, 29 Apr 2012 16:59:38 +0900 Subject: [PATCH] upload tizen1.0 source --- TC/unit/utc_ApplicationFW_appsvc_is_defapp_func.c | 2 +- TC/unit/utc_ApplicationFW_appsvc_set_defapp_func.c | 4 +- .../utc_ApplicationFW_appsvc_unset_defapp_func.c | 2 +- debian/changelog | 14 ++----- include/appsvc.h | 38 +++++++++--------- include/appsvc_db.h | 2 + packaging/app-svc.spec | 45 ++++++++++------------ src/appsvc.c | 29 +++++++------- src/appsvc_db.c | 6 +-- test/appsvc_test.c | 27 ++++++------- 10 files changed, 75 insertions(+), 94 deletions(-) diff --git a/TC/unit/utc_ApplicationFW_appsvc_is_defapp_func.c b/TC/unit/utc_ApplicationFW_appsvc_is_defapp_func.c index b67734c..edf2674 100644 --- a/TC/unit/utc_ApplicationFW_appsvc_is_defapp_func.c +++ b/TC/unit/utc_ApplicationFW_appsvc_is_defapp_func.c @@ -63,7 +63,7 @@ static void utc_appsvc_is_defapp_func_01(void) { int ret = 0; ret = - appsvc_set_defapp("slp.appsvc.operation.abcd123", NULL, NULL, + appsvc_set_defapp("http://tizen.org/appsvc/operation/abcd123", NULL, NULL, "org.tizen.abcd123"); if (ret != APPSVC_RET_OK) { tet_infoline("Test initialization failed!!!"); diff --git a/TC/unit/utc_ApplicationFW_appsvc_set_defapp_func.c b/TC/unit/utc_ApplicationFW_appsvc_set_defapp_func.c index d7117c2..46921e1 100644 --- a/TC/unit/utc_ApplicationFW_appsvc_set_defapp_func.c +++ b/TC/unit/utc_ApplicationFW_appsvc_set_defapp_func.c @@ -63,7 +63,7 @@ static void utc_appsvc_set_defapp_func_01(void) { int ret = APPSVC_RET_OK; ret = - appsvc_set_defapp("slp.appsvc.operation.abcd12", NULL, NULL, + appsvc_set_defapp("http://tizen.org/appsvc/operation/abcd12", NULL, NULL, "org.tizen.abcd12"); if (ret == APPSVC_RET_OK) { tet_infoline("appsvc_set_defapp test PASS!"); @@ -82,7 +82,7 @@ static void utc_appsvc_set_defapp_func_01(void) static void utc_appsvc_set_defapp_func_02(void) { int ret = APPSVC_RET_OK; - ret = appsvc_set_defapp("slp.appsvc.operation.abcd", NULL, NULL, NULL); + ret = appsvc_set_defapp("http://tizen.org/appsvc/operation/abcd", NULL, NULL, NULL); if (ret == APPSVC_RET_EINVAL) { tet_infoline("appsvc_set_defapp test PASS!"); tet_printf("ret = %d", ret); diff --git a/TC/unit/utc_ApplicationFW_appsvc_unset_defapp_func.c b/TC/unit/utc_ApplicationFW_appsvc_unset_defapp_func.c index a95f5f7..6e20043 100755 --- a/TC/unit/utc_ApplicationFW_appsvc_unset_defapp_func.c +++ b/TC/unit/utc_ApplicationFW_appsvc_unset_defapp_func.c @@ -64,7 +64,7 @@ static void utc_appsvc_unset_defapp_func_01(void) { int ret = APPSVC_RET_OK; ret = - appsvc_set_defapp("slp.appsvc.operation.xyz", NULL, NULL, + appsvc_set_defapp("http://tizen.org/appsvc/operation/xyz", NULL, NULL, "org.tizen.xyz"); if (ret != APPSVC_RET_OK) { tet_result(TET_UNINITIATED); diff --git a/debian/changelog b/debian/changelog index 7dede2f..a498f0f 100755 --- a/debian/changelog +++ b/debian/changelog @@ -1,15 +1,7 @@ -app-svc (0.1.18-3) unstable; urgency=low - - * Updated Code - * Git: pkgs/a/app-svc - * Tag: app-svc_0.1.18-3 - - -- Sewook Park Sat, 25 Feb 2012 17:35:51 +0900 - -app-svc (0.1.18-2) unstable; urgency=low +app-svc (0.1.21) unstable; urgency=low * Initial release * Git: pkgs/a/app-svc - * Tag: app-svc_0.1.18-2 + * Tag: app-svc_0.1.21 - -- Jaeho lee Wed, 07 Dec 2011 14:02:52 +0900 + -- Jaeho Lee Tue, 20 Mar 2012 14:11:59 +0900 diff --git a/include/appsvc.h b/include/appsvc.h index a3bc249..8cc03fb 100755 --- a/include/appsvc.h +++ b/include/appsvc.h @@ -54,45 +54,45 @@ extern "C" { /** APP_SVC OPERATION TYPE*/ -#define APPSVC_OPERATION_DEFAULT "slp.appsvc.operation.DEFAULT" +#define APPSVC_OPERATION_DEFAULT "http://tizen.org/appsvc/operation/default" /** APP_SVC OPERATION TYPE*/ -#define APPSVC_OPERATION_EDIT "slp.appsvc.operation.EDIT" +#define APPSVC_OPERATION_EDIT "http://tizen.org/appsvc/operation/edit" /** APP_SVC OPERATION TYPE*/ -#define APPSVC_OPERATION_VIEW "slp.appsvc.operation.VIEW" +#define APPSVC_OPERATION_VIEW "http://tizen.org/appsvc/operation/view" /** APP_SVC OPERATION TYPE*/ -#define APPSVC_OPERATION_PICK "slp.appsvc.operation.PICK" +#define APPSVC_OPERATION_PICK "http://tizen.org/appsvc/operation/pick" /** APP_SVC OPERATION TYPE*/ -#define APPSVC_OPERATION_CREATE_CONTENT "slp.appsvc.operation.CREATE_CONTENT" +#define APPSVC_OPERATION_CREATE_CONTENT "http://tizen.org/appsvc/operation/create_content" /** APP_SVC OPERATION TYPE*/ -#define APPSVC_OPERATION_CALL "slp.appsvc.operation.CALL" +#define APPSVC_OPERATION_CALL "http://tizen.org/appsvc/operation/call" /** APP_SVC OPERATION TYPE*/ -#define APPSVC_OPERATION_SEND "slp.appsvc.operation.SEND" +#define APPSVC_OPERATION_SEND "http://tizen.org/appsvc/operation/send" /** APP_SVC OPERATION TYPE*/ -#define APPSVC_OPERATION_SEND_TEXT "slp.appsvc.operation.SEND_TEXT" +#define APPSVC_OPERATION_SEND_TEXT "http://tizen.org/appsvc/operation/send_text" /** APP_SVC OPERATION TYPE*/ -#define APPSVC_OPERATION_DIAL "slp.appsvc.operation.DIAL" +#define APPSVC_OPERATION_DIAL "http://tizen.org/appsvc/operation/dial" /** APP_SVC OPERATION TYPE*/ -#define APPSVC_OPERATION_SEARCH "slp.appsvc.operation.SEARCH" +#define APPSVC_OPERATION_SEARCH "http://tizen.org/appsvc/operation/search" /** APP_SVC OPERATION TYPE*/ -#define APPSVC_OPERATION_DOWNLOAD "slp.appsvc.operation.DOWNLOAD" +#define APPSVC_OPERATION_DOWNLOAD "http://tizen.org/appsvc/operation/download" /** APP_SVC DATA SUBJECT*/ -#define APPSVC_DATA_SUBJECT "slp.appsvc.data.SUBJECT" +#define APPSVC_DATA_SUBJECT "http://tizen.org/appsvc/data/subject" /** APP_SVC DATA TYPE*/ -#define APPSVC_DATA_TO "slp.appsvc.data.TO" +#define APPSVC_DATA_TO "http://tizen.org/appsvc/data/to" /** APP_SVC DATA TYPE*/ -#define APPSVC_DATA_CC "slp.appsvc.data.CC" +#define APPSVC_DATA_CC "http://tizen.org/appsvc/data/cc" /** APP_SVC DATA TYPE*/ -#define APPSVC_DATA_BCC "slp.appsvc.data.BCC" +#define APPSVC_DATA_BCC "http://tizen.org/appsvc/data/bcc" /** APP_SVC DATA TYPE*/ -#define APPSVC_DATA_TEXT "slp.appsvc.data.TEXT" +#define APPSVC_DATA_TEXT "http://tizen.org/appsvc/data/text" /** APP_SVC DATA TYPE*/ -#define APPSVC_DATA_TITLE "slp.appsvc.data.TITLE" +#define APPSVC_DATA_TITLE "http://tizen.org/appsvc/data/title" /** APP_SVC DATA TYPE*/ -#define APPSVC_DATA_SELECTED "slp.appsvc.data.SELECTED" +#define APPSVC_DATA_SELECTED "http://tizen.org/appsvc/data/selected" /** APP_SVC DATA TYPE*/ -#define APPSVC_DATA_KEYWORD "slp.appsvc.data.KEYWORD" +#define APPSVC_DATA_KEYWORD "http://tizen.org/appsvc/data/keyword" /** diff --git a/include/appsvc_db.h b/include/appsvc_db.h index d1dd899..711611c 100755 --- a/include/appsvc_db.h +++ b/include/appsvc_db.h @@ -36,6 +36,8 @@ extern "C" int _svc_db_add_app(const char *op, const char *mime_type, const char *uri, const char *pkg_name); int _svc_db_delete_with_pkgname(const char *pkg_name); char* _svc_db_get_app(const char *op, const char *mime_type, const char *uri); +int _svc_db_is_defapp(const char *pkg_name); + #ifdef __cplusplus } diff --git a/packaging/app-svc.spec b/packaging/app-svc.spec index d3eb089..96d3a62 100644 --- a/packaging/app-svc.spec +++ b/packaging/app-svc.spec @@ -1,9 +1,9 @@ Name: app-svc Summary: App svc -Version: 0.1.18 -Release: 1.1 +Version: 0.1.21 +Release: 2 Group: System/Libraries -License: SAMSUNG +License: Apache License, Version 2.0 Source0: %{name}-%{version}.tar.gz Requires(post): /sbin/ldconfig @@ -22,20 +22,16 @@ BuildRequires: pkgconfig(ail) BuildRequires: pkgconfig(xdgmime) BuildRequires: pkgconfig(aul) BuildRequires: pkgconfig(glib-2.0) + + %description App svc -%package -n libapp-svc -Summary: App svc Library -Group: Development/Libraries -%description -n libapp-svc -App svc (developement files) - -%package -n libapp-svc-devel -Summary: App svc Library Development files +%package devel +Summary: App svc Group: Development/Libraries -Requires: libapp-svc = %{version}-%{release} -%description -n libapp-svc-devel +Requires: %{name} = %{version}-%{release} +%description devel App svc (developement files) %prep @@ -49,34 +45,35 @@ CFLAGS="$CFLAGS" LDFLAGS="$LDFLAGS" cmake . -DCMAKE_INSTALL_PREFIX=/usr make %{?jobs:-j%jobs} %install +rm -rf %{buildroot} %make_install -%post -n libapp-svc +%post + /sbin/ldconfig mkdir -p /opt/dbspace sqlite3 /opt/dbspace/.appsvc.db < /opt/share/appsvc_db.sql rm -rf /opt/share/appsvc_db.sql -chown root:5000 /opt/dbspace/.appsvc.db -chown root:5000 /opt/dbspace/.appsvc.db-journal +chown 0:5000 /opt/dbspace/.appsvc.db +chown 0:5000 /opt/dbspace/.appsvc.db-journal chmod 664 /opt/dbspace/.appsvc.db chmod 664 /opt/dbspace/.appsvc.db-journal -%postun -n libapp-svc -p /sbin/ldconfig -rm -f /opt/dbspace/.appsvc.db -rm -f /opt/dbspace/.appsvc.db-journal - +%postun -p /sbin/ldconfig %files +%defattr(-,root,root,-) +/opt/share/appsvc_db.sql /usr/bin/appsvc_test - -%files -n libapp-svc -%config(missingok) /opt/share/appsvc_db.sql /usr/lib/libappsvc.so.0 /usr/lib/libappsvc.so.0.1.0 -%files -n libapp-svc-devel +%files devel +%defattr(-,root,root,-) /usr/lib/pkgconfig/appsvc.pc /usr/lib/libappsvc.so /usr/include/appsvc/appsvc.h + + diff --git a/src/appsvc.c b/src/appsvc.c index 0adcdca..432f250 100755 --- a/src/appsvc.c +++ b/src/appsvc.c @@ -62,10 +62,13 @@ typedef struct _appsvc_resolve_info_t{ int mime_set; }appsvc_resolve_info_t; +extern int aul_launch_app_with_result(const char *pkgname, bundle *kb, + void (*cbfunc) (bundle *, int, void *), + void *data); + static appsvc_cb_info_t *__create_rescb(int request_code, appsvc_res_fn cbfunc, void *data); static void __remove_rescb(appsvc_cb_info_t *info); -static void __bundle_iterate(const char *key, const char *val, void *data); static int __set_bundle(bundle *b, const char *key, const char *value); static void __aul_cb(bundle *b, int is_cancel, void *data); static int __svc_iter_func(const char* pkg_name, void *data); @@ -99,15 +102,11 @@ static void __remove_rescb(appsvc_cb_info_t *info) if(info) free(info); } -static void __bundle_iterate(const char *key, const char *val, void *data) -{ - static int i=0; - _D("%d %s %s", i++, key, val); -} - static int __set_bundle(bundle *b, const char *key, const char *value) { - char *val = bundle_get_val(b, key); + const char *val = NULL; + + val = bundle_get_val(b, key); if(val){ if( bundle_del(b, key) != 0 ){ return APPSVC_RET_ERROR; @@ -155,7 +154,7 @@ static int __set_bundle_array(bundle *b, const char *key, const char **value, in static void __aul_cb(bundle *b, int is_cancel, void *data) { - char *val; + const char *val = NULL; appsvc_cb_info_t* cb_info; int res; @@ -220,10 +219,10 @@ static int __get_resolve_info(bundle *b, appsvc_resolve_info_t *info) char *tmp2 = NULL; char *strtok_buf = NULL; - info->op = appsvc_get_operation(b); - info->uri = appsvc_get_uri(b); - info->origin_mime = info->mime = appsvc_get_mime(b); - info->pkgname = appsvc_get_pkgname(b); + info->op = (char *)appsvc_get_operation(b); + info->uri = (char *)appsvc_get_uri(b); + info->origin_mime = info->mime = (char *)appsvc_get_mime(b); + info->pkgname = (char *)appsvc_get_pkgname(b); if(info->uri) { if(strncmp(info->uri,"/",1) == 0){ @@ -338,7 +337,7 @@ static int __get_list_with_condition(char *op, char *scheme, char *mime, GSList if (ail_ret != AIL_ERROR_OK) return APPSVC_RET_ERROR; - snprintf(svc_filter, MAX_FILTER_STR_SIZE-1, "%s:%s:%s", op, scheme, mime); + snprintf(svc_filter, MAX_FILTER_STR_SIZE-1, "%s|%s|%s", op, scheme, mime); _D("svc_filter : %s",svc_filter); ail_ret = ail_filter_add_str(filter, AIL_PROP_X_SLP_SVC_STR, svc_filter); @@ -426,8 +425,6 @@ SLPAPI int appsvc_run_service(bundle *b, int request_code, appsvc_res_fn cbfunc, int pkg_count = 0; int ret = -1; - int mime_set = 0; - GSList *pkg_list = NULL; GSList *iter = NULL; char *list_item; diff --git a/src/appsvc_db.c b/src/appsvc_db.c index d56ca16..3edcbdb 100755 --- a/src/appsvc_db.c +++ b/src/appsvc_db.c @@ -78,7 +78,6 @@ static int __fini(void) int _svc_db_add_app(const char *op, const char *mime_type, const char *uri, const char *pkg_name) { - int ret = -1; char m[BUF_MAX_LEN]; char u[BUF_MAX_LEN]; char query[BUF_MAX_LEN]; @@ -142,7 +141,6 @@ int _svc_db_delete_with_pkgname(const char *pkg_name) int _svc_db_is_defapp(const char *pkg_name) { char query[BUF_MAX_LEN]; - char* error_message = NULL; sqlite3_stmt *stmt; int cnt = 0; int ret = -1; @@ -178,11 +176,9 @@ int _svc_db_is_defapp(const char *pkg_name) char* _svc_db_get_app(const char *op, const char *mime_type, const char *uri) { - char* res = NULL; char m[BUF_MAX_LEN]; char u[BUF_MAX_LEN]; char query[BUF_MAX_LEN]; - char* error_message = NULL; sqlite3_stmt* stmt; int ret; char* pkgname; @@ -225,7 +221,7 @@ char* _svc_db_get_app(const char *op, const char *mime_type, const char *uri) } pkgname = malloc(BUF_MAX_LEN); - strncpy(pkgname, sqlite3_column_text(stmt, 0),BUF_MAX_LEN-1); + strncpy(pkgname, (const char *)sqlite3_column_text(stmt, 0),BUF_MAX_LEN-1); //pkgname = (char*) sqlite3_column_text(stmt, 0); _D("pkgname : %s\n",pkgname); diff --git a/test/appsvc_test.c b/test/appsvc_test.c index bad6c65..7f8733f 100755 --- a/test/appsvc_test.c +++ b/test/appsvc_test.c @@ -42,7 +42,7 @@ typedef struct _test_func_t{ char* usage; }test_func_t; -__set_bundle_from_args(bundle * kb) +void __set_bundle_from_args(bundle * kb) { int opt; char *op = NULL; @@ -50,7 +50,6 @@ __set_bundle_from_args(bundle * kb) char *uri = NULL; char *package = NULL; char* key = NULL; - char* val = NULL; char* val_array[128]; while( (opt = getopt(gargc,gargv,"d:o:m:u:p:")) != -1){ @@ -75,14 +74,17 @@ __set_bundle_from_args(bundle * kb) if(optarg){ int i = 0; key = strtok(optarg,","); - while(val_array[i] = strtok(NULL,",")) + while(1) { + val_array[i] = strtok(NULL,","); + if(val_array[i] == NULL) + break; i++; } if(i==1) appsvc_add_data(kb, key, val_array[0]); else if(i>1) - appsvc_add_data_array(kb, key, val_array, i); + appsvc_add_data_array(kb, key, (const char **)val_array, i); } break; } @@ -108,7 +110,6 @@ __set_bundle_from_args(bundle * kb) int run_svc() { - static int num=0; int ret; bundle *kb=NULL; kb = bundle_create(); @@ -150,11 +151,13 @@ static void prt_recvd_bundle(const char *key, const int type, const bundle_keyva size_t *array_item_size; char *val; - size_t *size; + size_t size; int i; - if(bundle_keyval_type_is_array(kv) > 0) { - bundle_keyval_get_array_val(kv, &array_val, &array_len, &array_item_size); + if(bundle_keyval_type_is_array((bundle_keyval_t *)kv) > 0) { + bundle_keyval_get_array_val((bundle_keyval_t *)kv, + (void ***)&array_val, (unsigned int *)&array_len, + &array_item_size); for (i=0;i