From: Hyunho Kang Date: Fri, 13 Oct 2017 10:51:28 +0000 (+0900) Subject: Add api for send widget status change request X-Git-Tag: accepted/tizen/4.0/unified/20171017.213347~1 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=refs%2Fchanges%2F27%2F155527%2F2;p=platform%2Fcore%2Fappfw%2Faul-1.git Add api for send widget status change request https://review.tizen.org/gerrit/#/c/155525/ (appcore-widget) https://review.tizen.org/gerrit/#/c/155526/ (amd) https://review.tizen.org/gerrit/#/c/155527/ (aul-1) Change-Id: I26f330ac8058513f4c9c68bb2d4beee9d8aa720a Signed-off-by: Hyunho Kang --- diff --git a/include/aul_cmd.h b/include/aul_cmd.h index f39bdf4..c6ff097 100644 --- a/include/aul_cmd.h +++ b/include/aul_cmd.h @@ -127,6 +127,7 @@ enum app_cmd { UPDATE_SCREEN_VIEWER_STATUS = 96, WIDGET_RUNNING_INFO = 97, JOB_STATUS_UPDATE = 98, + WIDGET_CHANGE_STATUS = 99, APP_CMD_MAX }; diff --git a/include/aul_widget.h b/include/aul_widget.h index 892d081..ec45fa1 100755 --- a/include/aul_widget.h +++ b/include/aul_widget.h @@ -128,6 +128,16 @@ int aul_widget_info_get_package_id(aul_widget_info_h info, char **package_id); */ int aul_widget_info_get_app_path(aul_widget_info_h info, char **app_path); +/** + * @par Description: + * Change app status. + * @param[in] widget_id The widget app id + * @param[in] status The widget app status + * @return @c 0 on success, + * otherwise a negative error value + */ +int aul_widget_instance_change_status(const char *widget_id, const char *status); + #ifdef __cplusplus } #endif diff --git a/src/widget.c b/src/widget.c index 18de67b..1b9a22a 100644 --- a/src/widget.c +++ b/src/widget.c @@ -506,3 +506,29 @@ API int aul_widget_info_get_app_path(aul_widget_info_h info, char **app_path) return AUL_R_OK; } + +API int aul_widget_instance_change_status(const char *widget_id, + const char *status) +{ + int ret; + bundle *kb; + + kb = bundle_create(); + if (kb == NULL) { + _E("out of memory"); + return AUL_R_ERROR; + } + + bundle_add_str(kb, AUL_K_STATUS, status); + bundle_add_str(kb, AUL_K_WIDGET_ID, widget_id); + ret = aul_sock_send_bundle(AUL_UTIL_PID, getuid(), + WIDGET_CHANGE_STATUS, kb, AUL_SOCK_ASYNC); + + bundle_free(kb); + if (ret < 0) { + _E("send error %d, %s", ret, status); + return aul_error_convert(ret); + } + + return AUL_R_OK; +}