diff options
author | Daehyeon Jung <darrenh.jung@samsung.com> | 2016-03-16 18:55:43 +0900 |
---|---|---|
committer | Daehyeon Jung <darrenh.jung@samsung.com> | 2016-03-16 18:55:52 +0900 |
commit | 58d34a7388c3c5b5c116c54c28abda28f826e3bb (patch) | |
tree | 0e54a6e6e7e8fa238e4aff64dc1bda7e793017b7 | |
parent | 8ce4d428e0ed3ae0f8c5bdba99b82307d22dc2ab (diff) | |
download | widget-service-58d34a7388c3c5b5c116c54c28abda28f826e3bb.tar.gz widget-service-58d34a7388c3c5b5c116c54c28abda28f826e3bb.tar.bz2 widget-service-58d34a7388c3c5b5c116c54c28abda28f826e3bb.zip |
fix utc errorssubmit/tizen/20160317.042604accepted/tizen/wearable/20160317.115859accepted/tizen/tv/20160317.115843accepted/tizen/mobile/20160317.115828accepted/tizen/ivi/20160317.115919accepted/tizen/common/20160317.160657
Change-Id: I05fea32682242dc0ddd538aac44723128d1d34e8
Signed-off-by: Daehyeon Jung <darrenh.jung@samsung.com>
-rw-r--r-- | include/widget_instance.h | 1 | ||||
-rw-r--r-- | src/widget_instance.c | 58 | ||||
-rw-r--r-- | src/widget_service.c | 22 |
3 files changed, 65 insertions, 16 deletions
diff --git a/include/widget_instance.h b/include/widget_instance.h index ef885e1..7add9cb 100644 --- a/include/widget_instance.h +++ b/include/widget_instance.h @@ -35,6 +35,7 @@ extern "C" { #define WIDGET_K_WIDTH "__WIDGET_WIDTH__" #define WIDGET_K_HEIGHT "__WIDGET_HEIGHT__" #define WIDGET_K_REASON "__WIDGET_REASON__" +#define WIDGET_K_PERIOD "__WIDGET_PERIOD__" typedef enum widget_instance_event { WIDGET_INSTANCE_EVENT_CREATE = 0, diff --git a/src/widget_instance.c b/src/widget_instance.c index 0580411..b5436d6 100644 --- a/src/widget_instance.c +++ b/src/widget_instance.c @@ -845,12 +845,66 @@ EAPI int widget_instance_get_period(widget_instance_h instance, double *period) EAPI int widget_instance_change_period(widget_instance_h instance, double period) { - return 0; + int ret; + bundle *b; + + if (!instance) + return -1; + + b = bundle_create(); + if (!b) { + _E("out of memory"); + return -1; + } + + bundle_add_str(b, WIDGET_K_OPERATION, "period"); + bundle_add_byte(b, WIDGET_K_PERIOD, &period, sizeof(double)); + + ret = __send_aul_cmd(instance->widget_id, instance->id, b); + + bundle_free(b); + + if (ret > 0) { + if (instance->pid != ret) { + _E("instance %s(%d) has been launched with different pid."); + instance->pid = ret; + } + } + + return ret; } EAPI int widget_instance_trigger_update(widget_instance_h instance, bundle *b, int force) { - return 0; + int ret; + bundle *kb = b; + + if (!instance) + return -1; + + if (!kb) { + kb = bundle_create(); + if (!kb) { + _E("out of memory"); + return -1; + } + } + + bundle_add_str(kb, WIDGET_K_OPERATION, "update"); + + ret = __send_aul_cmd(instance->widget_id, instance->id, kb); + + if (!b) + bundle_free(kb); + + if (ret > 0) { + if (instance->pid != ret) { + _E("instance %s(%d) has been launched with different pid."); + instance->pid = ret; + } + } + + return ret; } EAPI widget_instance_h widget_instance_get_instance(const char *widget_id, const char *instance_id) diff --git a/src/widget_service.c b/src/widget_service.c index 91bb143..b7d9e5e 100644 --- a/src/widget_service.c +++ b/src/widget_service.c @@ -262,6 +262,9 @@ static int _get_widget_supported_sizes(const char *widget_id, int *cnt, EAPI int widget_service_change_period(const char *pkgname, const char *id, double period) { + widget_instance_h instance; + int ret; + if (!_is_widget_feature_enabled()) { _E("not supported"); return WIDGET_ERROR_NOT_SUPPORTED; @@ -272,9 +275,6 @@ EAPI int widget_service_change_period(const char *pkgname, const char *id, doubl return WIDGET_ERROR_INVALID_PARAMETER; } - widget_instance_h instance; - int ret; - instance = widget_instance_get_instance(pkgname, id); if (!instance) { @@ -291,19 +291,19 @@ EAPI int widget_service_change_period(const char *pkgname, const char *id, doubl EAPI int widget_service_trigger_update(const char *widget_id, const char *id, bundle *b, int force) { + widget_instance_h instance; + int ret; + if (!_is_widget_feature_enabled()) { _E("not supported"); return WIDGET_ERROR_NOT_SUPPORTED; } - if (!widget_id || !id || !b) { + if (!widget_id) { _E("invalid parameter"); return WIDGET_ERROR_INVALID_PARAMETER; } - widget_instance_h instance; - int ret; - instance = widget_instance_get_instance(widget_id, id); if (!instance) { _E("instance not exists or out of bound(package)"); @@ -1186,7 +1186,7 @@ EAPI int widget_service_set_lifecycle_event_cb(const char *widget_id, widget_lif return WIDGET_ERROR_NOT_SUPPORTED; } - if (widget_id == NULL || cb == NULL) { + if (cb == NULL) { _E("invalid parameter"); return WIDGET_ERROR_INVALID_PARAMETER; } @@ -1204,12 +1204,6 @@ EAPI int widget_service_unset_lifecycle_event_cb(const char *widget_id, void **u _E("not supported"); return WIDGET_ERROR_NOT_SUPPORTED; } - - if (widget_id == NULL) { - _E("invalid parameter"); - return WIDGET_ERROR_INVALID_PARAMETER; - } - /* TODO */ return ret; |