From: Junghyun Yeon Date: Mon, 4 Apr 2016 00:01:55 +0000 (+0900) Subject: implement functions to used by capi-package-manager X-Git-Tag: submit/tizen/20160406.013051^0 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=181ab6d8752719e486ef06d80c3d0099dae2a5b3;p=platform%2Fcore%2Fappfw%2Fslp-pkgmgr.git implement functions to used by capi-package-manager when unset event cb Change-Id: I3589e878537a04b9bbea41f995f7e631e3a81002 Signed-off-by: Junghyun Yeon --- diff --git a/client/include/package-manager.h b/client/include/package-manager.h index 47d5a9f..77fcc27 100644 --- a/client/include/package-manager.h +++ b/client/include/package-manager.h @@ -659,6 +659,19 @@ int pkgmgr_client_listen_status(pkgmgr_client *pc, pkgmgr_handler event_cb, int pkgmgr_client_listen_app_status(pkgmgr_client *pc, pkgmgr_app_handler event_cb, void *data); +/** + * @brief This API request to stop listen the pkgmgr's broadcasting + * + * This API is for package-manager client application.\n + * + * @param[in] pc pkgmgr_client + * @return 0 if success, error code(<0) if fail\n + * @retval PKGMGR_R_OK success + * @retval PKGMGR_R_EINVAL invalid argument + * @retval PKGMGR_R_ERROR internal error +*/ +int pkgmgr_client_remove_listen_status(pkgmgr_client *pc); + /** * @brief This API broadcasts pkgmgr's status * diff --git a/client/src/pkgmgr.c b/client/src/pkgmgr.c index 503c8ad..fbe262c 100644 --- a/client/src/pkgmgr.c +++ b/client/src/pkgmgr.c @@ -289,6 +289,21 @@ static req_cb_info *__find_op_cbinfo(pkgmgr_client_t *pc, const char *req_key) return NULL; } +static int __remove_stat_cbinfo(pkgmgr_client_t *pc) +{ + listen_cb_info *info = pc->info.listening.lhead; + listen_cb_info *next = NULL; + + while (info != NULL) { + next = info->next; + free(info); + info = next; + } + + pc->info.listening.lhead = NULL; + return 0; +} + static void __add_app_stat_cbinfo(pkgmgr_client_t *pc, int request_id, pkgmgr_app_handler event_cb, void *data) { @@ -1682,6 +1697,22 @@ API int pkgmgr_client_listen_app_status(pkgmgr_client *pc, pkgmgr_app_handler ev return req_id; } +API int pkgmgr_client_remove_listen_status(pkgmgr_client *pc) +{ + int ret = -1; + + retvm_if(pc == NULL, PKGMGR_R_EINVAL, "package manager client pc is NULL"); + pkgmgr_client_t *mpc = (pkgmgr_client_t *) pc; + + ret = __remove_stat_cbinfo(mpc); + if (ret != 0) { + ERR("failed to remove status callback"); + return PKGMGR_R_ERROR; + } + + return PKGMGR_R_OK; +} + API int pkgmgr_client_broadcast_status(pkgmgr_client *pc, const char *pkg_type, const char *pkgid, const char *key, const char *val)