diff options
author | Sung-jae Park <nicesj.park@samsung.com> | 2015-04-24 15:36:07 +0900 |
---|---|---|
committer | Sung-jae Park <nicesj.park@samsung.com> | 2015-04-24 16:44:57 +0900 |
commit | d762ad7cba7cd500bb21dbf96894152553a9ea2d (patch) | |
tree | aff401b52f081a82ae62a9998bd82015589e0c04 | |
parent | c4c7965a8ae36e3940ec8223e5f8eee80e7005e2 (diff) | |
download | widget-service-d762ad7cba7cd500bb21dbf96894152553a9ea2d.tar.gz widget-service-d762ad7cba7cd500bb21dbf96894152553a9ea2d.tar.bz2 widget-service-d762ad7cba7cd500bb21dbf96894152553a9ea2d.zip |
Replace string type content info with bundle type.
[model] Redwood,Kiran,B3(Wearable)
[binary_type] AP
[customer] Docomo/Orange/ATT/Open
[issue#] N/A
[problem]
[cause]
[solution]
[team] HomeTF
[request]
[horizontal_expansion]
Change-Id: I46b924e547e2876d21a0341f783278a56023ecaf
-rw-r--r-- | CMakeLists.txt | 1 | ||||
-rwxr-xr-x | include/widget_service.h | 10 | ||||
-rwxr-xr-x | packaging/libwidget_service.spec | 1 | ||||
-rw-r--r-- | src/widget_monitor.c | 10 | ||||
-rw-r--r-- | src/widget_service.c | 13 | ||||
-rw-r--r-- | widget_service.pc.in | 1 |
6 files changed, 26 insertions, 10 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt index 60eeac6..9864891 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -25,6 +25,7 @@ pkg_check_modules(pkgs REQUIRED pkgmgr-info vconf icu-uc + bundle ) IF (X11_SUPPORT) diff --git a/include/widget_service.h b/include/widget_service.h index ac37405..f64e814 100755 --- a/include/widget_service.h +++ b/include/widget_service.h @@ -18,6 +18,7 @@ #define __WIDGET_SERVICE_H #include <tizen_type.h> +#include <bundle.h> #ifdef __cplusplus extern "C" { @@ -244,7 +245,7 @@ extern int widget_service_get_need_of_frame(const char *widget_id, widget_size_t * @since_tizen 2.3.1 * @param[in] widget_id appid of widget application * @param[in] instance_id Set @c NULL if you don't know what the Id is. Then every instance of given pkgname will be triggered its update event - * @param[in] content New content information, Default @c NULL + * @param[in] b bundle data will be passed to the widget application via widget_update handler, default is @c NULL * @param[in] force 1 if you want to update your widget even if the provider is paused or 0. 0 is default * @privlevel public * @privilege %http://tizen.org/privilege/widget.provider @@ -257,7 +258,7 @@ extern int widget_service_get_need_of_frame(const char *widget_id, widget_size_t * @retval #WIDGET_ERROR_NONE Successfully requested * @see widget_service_trigger_update() */ -extern int widget_service_trigger_update(const char *widget_id, const char *instance_id, const char *content, int force); +extern int widget_service_trigger_update(const char *widget_id, const char *instance_id, bundle *b, int force); /** * @brief Changes the update period of given widget instance. @@ -567,13 +568,14 @@ extern int widget_service_unset_lifecycle_event_cb(const char *widget_id, void * * @brief Gets content of the widget instance * @since_tizen 2.3.1 * @param[in] widget_instance_id widget instance id - * @param[out] content content information of the given widget instance + * @param[out] b bundle(content) data of the given widget instance, it should be released by caller. * @return 0 on success, otherwise a negative error value * @retval #WIDGET_ERROR_IO_ERROR Failed to access DB * @retval #WIDGET_ERROR_INVALID_PARAMETER Invalid argument * @retval #WIDGET_ERROR_PERMISSION_DENIED Permission denied + * @post caller should have to release the bundle */ -extern int widget_service_get_content_of_widget_instance(const char *widget_id, const char *widget_instance_id, char **content); +extern int widget_service_get_content_of_widget_instance(const char *widget_id, const char *widget_instance_id, bundle **b); /** * @} */ diff --git a/packaging/libwidget_service.spec b/packaging/libwidget_service.spec index bd0a3e9..322dc24 100755 --- a/packaging/libwidget_service.spec +++ b/packaging/libwidget_service.spec @@ -19,6 +19,7 @@ BuildRequires: pkgconfig(pkgmgr) BuildRequires: pkgconfig(pkgmgr-info) BuildRequires: pkgconfig(vconf) BuildRequires: pkgconfig(icu-uc) +BuildRequires: pkgconfig(bundle) BuildRequires: model-build-features %if %{with wayland} diff --git a/src/widget_monitor.c b/src/widget_monitor.c index 307493a..d638ae4 100644 --- a/src/widget_monitor.c +++ b/src/widget_monitor.c @@ -277,7 +277,7 @@ EAPI int widget_service_unset_lifecycle_event_cb(const char *widget_id, void **u return WIDGET_ERROR_NOT_EXIST; } -EAPI int widget_service_get_content_of_widget_instance(const char *widget_id, const char *widget_instance_id, char **content) +EAPI int widget_service_get_content_of_widget_instance(const char *widget_id, const char *widget_instance_id, bundle **b) { struct packet *packet; struct packet *result; @@ -286,7 +286,7 @@ EAPI int widget_service_get_content_of_widget_instance(const char *widget_id, co const char *_content; int ret; - if (!widget_instance_id || !content) { + if (!widget_instance_id || !b) { ErrPrint("Invalid argument\n"); return WIDGET_ERROR_INVALID_PARAMETER; } @@ -311,9 +311,9 @@ EAPI int widget_service_get_content_of_widget_instance(const char *widget_id, co ErrPrint("Failed to parse a result packet\n"); ret = WIDGET_ERROR_INVALID_PARAMETER; } else if (ret == WIDGET_ERROR_NONE) { - *content = strdup(_content); - if (!*content) { - ErrPrint("strdup: %s [%d]\n", _content, errno); + *b = bundle_decode((bundle_raw *)_content, strlen(_content)); + if (!*b) { + ErrPrint("bundle_decode: %s\n", _content); } } else { ErrPrint("ret: %d\n", ret); diff --git a/src/widget_service.c b/src/widget_service.c index 469d184..7f72136 100644 --- a/src/widget_service.c +++ b/src/widget_service.c @@ -34,6 +34,7 @@ #include <vconf.h> #include <vconf-keys.h> #include <unicode/uloc.h> +#include <bundle.h> #include "widget_errno.h" #include "dlist.h" @@ -605,13 +606,15 @@ EAPI int widget_service_get_instance_count(const char *pkgname, const char *clus return ret; } -EAPI int widget_service_trigger_update(const char *widget_id, const char *id, const char *content, int force) +EAPI int widget_service_trigger_update(const char *widget_id, const char *id, bundle *b, int force) { struct packet *packet; struct packet *result; unsigned int cmd = CMD_SERVICE_UPDATE; char *uri; int ret; + char *content = NULL; + int content_len = 0; if (!widget_id) { ErrPrint("Invalid argument\n"); @@ -632,7 +635,15 @@ EAPI int widget_service_trigger_update(const char *widget_id, const char *id, co uri = NULL; } + if (b) { + ret = bundle_encode(b, (bundle_raw **)&content, &content_len); + if (ret != BUNDLE_ERROR_NONE) { + ErrPrint("Unable to encode bundle: %d\n", ret); + } + } + packet = packet_create((const char *)&cmd, "sssssi", widget_id, uri, "user,created", "default", content, force); + free(content); /*! * \note * "free" function accepts NULL diff --git a/widget_service.pc.in b/widget_service.pc.in index 581e4f9..c8273d5 100644 --- a/widget_service.pc.in +++ b/widget_service.pc.in @@ -6,6 +6,7 @@ includedir=@INCLUDEDIR@ Name: widget_service Description: widget service library Version: @VERSION@ +Requires: bundle Libs: -L${libdir} -lwidget_service Cflags: -I${includedir} cppflags: -I${includedir} |