fix utc errors 88/62488/1 accepted/tizen/common/20160317.160657 accepted/tizen/ivi/20160317.115919 accepted/tizen/mobile/20160317.115828 accepted/tizen/tv/20160317.115843 accepted/tizen/wearable/20160317.115859 submit/tizen/20160317.042604
authorDaehyeon Jung <darrenh.jung@samsung.com>
Wed, 16 Mar 2016 09:55:43 +0000 (18:55 +0900)
committerDaehyeon Jung <darrenh.jung@samsung.com>
Wed, 16 Mar 2016 09:55:52 +0000 (18:55 +0900)
Change-Id: I05fea32682242dc0ddd538aac44723128d1d34e8
Signed-off-by: Daehyeon Jung <darrenh.jung@samsung.com>
include/widget_instance.h
src/widget_instance.c
src/widget_service.c

index ef885e1..7add9cb 100644 (file)
@@ -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,
index 0580411..b5436d6 100644 (file)
@@ -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)
index 91bb143..b7d9e5e 100644 (file)
@@ -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;