From e2dcd6c131625c46ca8aba87a79e961e130c5d5a Mon Sep 17 00:00:00 2001 From: Hyunho Kang Date: Fri, 13 Oct 2017 19:51:28 +0900 Subject: [PATCH] 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 --- include/aul_cmd.h | 1 + include/aul_widget.h | 10 ++++++++++ src/widget.c | 26 ++++++++++++++++++++++++++ 3 files changed, 37 insertions(+) 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; +} -- 2.7.4