From: Wook Song Date: Fri, 3 Mar 2017 03:48:25 +0000 (+0900) Subject: pmqos: Add callbacks for dbus messages X-Git-Tag: submit/tizen/20170328.004502~8 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=291e69d44546211de82d089fa239002e220c16e5;p=platform%2Fcore%2Fsystem%2Fpass.git pmqos: Add callbacks for dbus messages This patch adds the callback functions for dbus messages that start and stop the pmqos module. Change-Id: I6a9203a766469c49ff9b9b96eb594082057288d7 Signed-off-by: Wook Song Reviewed-by: Chanwoo Choi --- diff --git a/src/pmqos/pmqos.c b/src/pmqos/pmqos.c index 1ade574..6b7c2f1 100644 --- a/src/pmqos/pmqos.c +++ b/src/pmqos/pmqos.c @@ -51,6 +51,43 @@ static struct timespec unlock_timer_start_st; static struct timespec unlock_timer_end_st; static struct pmqos_cpu unlock_timer_owner = {"", 0}; +/****************************************************** + * PMQOS callback functions for Init/Exit * + * (Declarations) * + ******************************************************/ +static int pmqos_init_done(void *data, void *user_data); +static void pmqos_free(void); + +/****************************************************** + * PASS D-Bus interface * + ******************************************************/ +static DBusMessage* e_dbus_start_cb(E_DBus_Object *obj, DBusMessage* msg) +{ + DBusMessage *ret_dbus = NULL; + bool booting_done = true; + int ret; + + ret = pmqos_init_done(&booting_done, NULL); + if (ret < 0) { + _E("failed to initialize the daemon in dbus callback \ + for a start message\n"); + return ret_dbus; + } + + ret_dbus = dbus_message_new_method_return(msg); + return ret_dbus; +} + +static DBusMessage* e_dbus_stop_cb(E_DBus_Object *obj, DBusMessage* msg) +{ + DBusMessage *ret_dbus; + + pmqos_free(); + + ret_dbus = dbus_message_new_method_return(msg); + return ret_dbus; +} + int set_pmqos(const char *name, int val) { char scenario[100]; @@ -364,6 +401,12 @@ static int get_methods_from_conf(const char *path, struct edbus_method **edbus_m /* Add pmqos name as alphabetically */ static const struct edbus_method edbus_methods[] = { + { "start", NULL, NULL, e_dbus_start_cb }, + { "stop", NULL, NULL, e_dbus_stop_cb }, + /* + * TODO: The hard-coded scenario info is no longer required. Therefore, + * the following code will be removed. + */ { "AppLaunch", "i", "i", dbus_pmqos_handler }, { "AppLaunchHome", "i", "i", dbus_pmqos_handler }, { "BeautyShot", "i", "i", dbus_pmqos_handler },