power: apply modified dbus spec 73/200573/5 submit/tizen/20190305.100545
authorsanghyeok.oh <sanghyeok.oh@samsung.com>
Wed, 27 Feb 2019 02:40:19 +0000 (11:40 +0900)
committersanghyeok.oh <sanghyeok.oh@samsung.com>
Tue, 5 Mar 2019 07:27:27 +0000 (16:27 +0900)
Change-Id: I8dc2d9a78f757d2c187dea2e0747075d4ae90cca
Signed-off-by: sanghyeok.oh <sanghyeok.oh@samsung.com>
src/battery/battery-mobile.c
src/battery/battery-wearable.c
src/common/popup-common.h
src/cooldown/cooldown-wearable.c
src/overheat/overheat.c
src/powerkey/powerkey-mobile.c
src/powerkey/powerkey-tv.c
src/powerkey/powerkey-wearable.c

index 646df45a6c7cc2081f9735e119c3361ffa16b45a..625bebc67e5cb06abfba5d34f05366e189c278f0 100644 (file)
 */
 #include "popup-common.h"
 
-#define DEVICED_PATH_SYSNOTI        "/Org/Tizen/System/DeviceD/SysNoti"
-#define DEVICED_INTERFACE_SYSNOTI   "org.tizen.system.deviced.SysNoti"
-#define SIGNAL_CHARGEERR_RESPONSE   "ChargeErrResponse"
-
-#define SYSTEMD_STOP_POWER_OFF 4
-#define DEVICED_BUS_NAME        "org.tizen.system.deviced"
-#define REBOOT_OBJECT_PATH     "/Org/Tizen/System/DeviceD/Reboot"
-#define REBOOT_INTERFACE_NAME  DEVICED_BUS_NAME".reboot"
-#define REBOOT_METHOD            "reboot"
-#define REBOOT_OPERATION_OFF     "poweroff"
-
 static const struct popup_ops lowbattery_poweroff_ops;
 static const struct popup_ops charge_error_low_ops;
 static const struct popup_ops charge_error_high_ops;
@@ -144,8 +133,7 @@ static void lowbattery_terminate(const struct popup_ops *ops)
 static void poweroff_clicked(const struct popup_ops *ops)
 {
        static int bPowerOff = 0;
-       char *param[2];
-       char data[8];
+       char *param[1];
        int ret;
 
        if (bPowerOff == 1)
@@ -154,14 +142,12 @@ static void poweroff_clicked(const struct popup_ops *ops)
 
        unload_simple_popup(ops);
 
-       param[0] = REBOOT_OPERATION_OFF;
-       snprintf(data, sizeof(data), "0");
-       param[1] = data;
+       param[0] = POWEROFF_OPERATION_OFF;
        ret = popup_dbus_method_sync(DEVICED_BUS_NAME,
-                       REBOOT_OBJECT_PATH,
-                       REBOOT_INTERFACE_NAME,
-                       REBOOT_METHOD,
-                       "si", param);
+                       POWEROFF_OBJECT_PATH,
+                       POWEROFF_INTERFACE_NAME,
+                       POWEROFF_METHOD,
+                       "s", param);
        if (ret < 0)
                _E("Failed to request poweroff to deviced: %d", ret);
 
index 75df76854aa4ff915d930c0b7db23eeddd87ead2..fc0f2095b3dfcbe157dfbb1793e3cd7c0c7d4503 100644 (file)
@@ -19,8 +19,6 @@
 
 #include "popup-common.h"
 
-#define DEVICED_PATH_SYSNOTI        "/Org/Tizen/System/DeviceD/SysNoti"
-#define DEVICED_INTERFACE_SYSNOTI   "org.tizen.system.deviced.SysNoti"
 #define SIGNAL_CHARGEERR_RESPONSE   "ChargeErrResponse"
 
 static const struct popup_ops lowbattery_poweroff_ops;
@@ -28,13 +26,6 @@ static const struct popup_ops charge_error_low_ops;
 static const struct popup_ops charge_error_high_ops;
 static const struct popup_ops battery_disconnected_ops;
 
-#define DEVICED_BUS_NAME        "org.tizen.system.deviced"
-#define REBOOT_OBJECT_PATH     "/Org/Tizen/System/DeviceD/Reboot"
-#define REBOOT_INTERFACE_NAME  DEVICED_BUS_NAME".reboot"
-
-#define REBOOT_METHOD            "reboot"
-#define REBOOT_OPERATION_OFF     "poweroff"
-
 static int lowbattery_launch(bundle *b, const struct popup_ops *ops);
 
 static int remove_other_lowbattery_popups(const struct popup_ops *ops)
@@ -141,8 +132,7 @@ static void lowbattery_terminate(const struct popup_ops *ops)
 static void poweroff_clicked(const struct popup_ops *ops)
 {
        static int bPowerOff = 0;
-       char *param[2];
-       char data[8];
+       char *param[1];
        int ret;
 
        if (bPowerOff == 1)
@@ -151,14 +141,12 @@ static void poweroff_clicked(const struct popup_ops *ops)
 
        unload_simple_popup(ops);
 
-       param[0] = REBOOT_OPERATION_OFF;
-       snprintf(data, sizeof(data), "0");
-       param[1] = data;
+       param[0] = POWEROFF_OPERATION_OFF;
        ret = popup_dbus_method_sync(DEVICED_BUS_NAME,
-                       REBOOT_OBJECT_PATH,
-                       REBOOT_INTERFACE_NAME,
-                       REBOOT_METHOD,
-                       "si", param);
+                       POWEROFF_OBJECT_PATH,
+                       POWEROFF_INTERFACE_NAME,
+                       POWEROFF_METHOD,
+                       "s", param);
        if (ret < 0)
                _E("Failed to request poweroff to deviced: %d", ret);
 }
index bd936216b8666226f63bd48bbcc4ebe9287e6891..2dbca2f08acb28091e49c36e731964cba317c705 100644 (file)
@@ -121,4 +121,19 @@ void notify_feedback(long pattern); /* using thread */
 
 void change_display_state(void); /* using thread */
 void event_back_key_up(void *data, Evas_Object *obj, void *event_info);
+
+/* deviced */
+#define DEVICED_PATH_SYSNOTI        "/Org/Tizen/System/DeviceD/SysNoti"
+#define DEVICED_INTERFACE_SYSNOTI   "org.tizen.system.deviced.SysNoti"
+#define SIGNAL_CHARGEERR_RESPONSE   "ChargeErrResponse"
+
+#define SYSTEMD_STOP_POWER_OFF 4
+#define DEVICED_BUS_NAME        "org.tizen.system.deviced"
+#define POWEROFF_OBJECT_PATH     "/Org/Tizen/System/DeviceD/PowerOff"
+#define POWEROFF_INTERFACE_NAME  DEVICED_BUS_NAME".PowerOff"
+#define POWEROFF_METHOD            "Poweroff"
+
+#define POWEROFF_OPERATION_OFF     "poweroff"
+#define POWEROFF_OPERATION_RESTART     "reboot"
+
 #endif /* __POPUP_COMMON_H__ */
index 82815f6ebb6251e17e3e7bbde1c60f82bc54867e..d4692d675e3a2a906d06c429012cb6e60045eb49 100644 (file)
 
 #define SYSTEMD_STOP_POWER_OFF 4
 
-#define DEVICED_PATH_SYSNOTI      "/Org/Tizen/System/DeviceD/SysNoti"
-#define DEVICED_INTERFACE_SYSNOTI "org.tizen.system.deviced.SysNoti"
 #define SIGNAL_COOL_DOWN_RESPONSE "CoolDownResponse"
 #define SIGNAL_COOL_DOWN_CHANGED  "CoolDownChanged"
 #define COOL_DOWN_RELEASE         "Release"
 
-#define DEVICED_BUS_NAME        "org.tizen.system.deviced"
-#define REBOOT_OBJECT_PATH     "/Org/Tizen/System/DeviceD/Reboot"
-#define REBOOT_INTERFACE_NAME  DEVICED_BUS_NAME".reboot"
-
-#define REBOOT_METHOD            "reboot"
-#define REBOOT_OPERATION_OFF     "poweroff"
-
 #define TIMEOUT_POWEROFF 10 /* seconds */
 #define TIMEOUT_BEEP_40  40 /* seconds */
 #define TIMEOUT_BEEP_5   5 /* seconds */
@@ -194,22 +185,19 @@ static void cooldown_send_warning_signal(const struct popup_ops *ops)
 
 static void cooldown_poweroff(const struct popup_ops *ops)
 {
-       char *param[2];
-       char data[8];
+       char *param[1];
        int ret;
 
        _I("Poweroff is selected.");
        unload_simple_popup(ops);
 
-       param[0] = REBOOT_OPERATION_OFF;
-       snprintf(data, sizeof(data), "0");
-       param[1] = data;
+       param[0] = POWEROFF_OPERATION_OFF;
 
        ret = popup_dbus_method_sync(DEVICED_BUS_NAME,
-                       REBOOT_OBJECT_PATH,
-                       REBOOT_INTERFACE_NAME,
-                       REBOOT_METHOD,
-                       "si", param);
+                       POWEROFF_OBJECT_PATH,
+                       POWEROFF_INTERFACE_NAME,
+                       POWEROFF_METHOD,
+                       "s", param);
 
        if (ret < 0)
                _E("Failed to request poweroff to deviced: %d", ret);
index b712c96c43997386488692ad769ddbbaa636edfe..bbb1c692ff20327e4b986d645cc39561cbe1ca99 100644 (file)
 #define BUF_MAX 512
 #define SYSTEMD_STOP_POWER_OFF 4
 
-#define DEVICED_BUS_NAME        "org.tizen.system.deviced"
-#define REBOOT_OBJECT_PATH     "/Org/Tizen/System/DeviceD/Reboot"
-#define REBOOT_INTERFACE_NAME  DEVICED_BUS_NAME".reboot"
-
-#define REBOOT_METHOD            "reboot"
-#define REBOOT_OPERATION_OFF     "poweroff"
-
 /* Overheat Timer*/
 #define OVERHEAT_BUS_NAME              "org.tizen.system.popup"
 #define OVERHEAT_OBJECT_PATH           "/Org/Tizen/System/Popup"
@@ -133,8 +126,7 @@ static void register_handlers(const struct popup_ops *ops)
 static void overheat_poweroff(const struct popup_ops *ops)
 {
        static int bPowerOff = 0;
-       char *param[2];
-       char data[8];
+       char *param[1];
        int ret;
 
        if (bPowerOff == 1)
@@ -143,14 +135,12 @@ static void overheat_poweroff(const struct popup_ops *ops)
 
        unload_simple_popup(ops);
 
-       param[0] = REBOOT_OPERATION_OFF;
-       snprintf(data, sizeof(data), "0");
-       param[1] = data;
+       param[0] = POWEROFF_OPERATION_OFF;
        ret = popup_dbus_method_sync(DEVICED_BUS_NAME,
-                       REBOOT_OBJECT_PATH,
-                       REBOOT_INTERFACE_NAME,
-                       REBOOT_METHOD,
-                       "si", param);
+                       POWEROFF_OBJECT_PATH,
+                       POWEROFF_INTERFACE_NAME,
+                       POWEROFF_METHOD,
+                       "s", param);
        if (ret < 0)
                _E("Failed to request poweroff to deviced: %d", ret);
 }
index 455000a60592b673e782a5634a7a71576b8d4b8b..44e413249df533cf3f929b7959c1c002b579bab2 100644 (file)
 
 #define SYSTEMD_STOP_POWER_OFF 4
 
-#define DEVICED_BUS_NAME        "org.tizen.system.deviced"
-#define REBOOT_OBJECT_PATH     "/Org/Tizen/System/DeviceD/Reboot"
-#define REBOOT_INTERFACE_NAME  DEVICED_BUS_NAME".reboot"
-
-#define REBOOT_METHOD            "reboot"
-#define REBOOT_OPERATION_OFF     "poweroff"
-#define REBOOT_OPERATION_RESTART     "reboot"
 #define TIMEOUT_POWEROFF 5 /* seconds */
 
 #define POWEROFF_KEY   "XF86PowerOff"
@@ -74,8 +67,7 @@ static void restart_terminate(const struct popup_ops *ops)
 static void restart_clicked(const struct popup_ops *ops)
 {
        static int bReset = 0;
-       char *param[2];
-       char data[8];
+       char *param[1];
        int ret;
 
        if (bReset == 1) return;
@@ -83,15 +75,13 @@ static void restart_clicked(const struct popup_ops *ops)
 
        unload_simple_popup(ops);
 
-       param[0] = REBOOT_OPERATION_RESTART;
-       snprintf(data, sizeof(data), "0");
-       param[1] = data;
+       param[0] = POWEROFF_OPERATION_RESTART;
 
        ret = popup_dbus_method_sync(DEVICED_BUS_NAME,
-                       REBOOT_OBJECT_PATH,
-                       REBOOT_INTERFACE_NAME,
-                       REBOOT_METHOD,
-                       "si", param);
+                       POWEROFF_OBJECT_PATH,
+                       POWEROFF_INTERFACE_NAME,
+                       POWEROFF_METHOD,
+                       "s", param);
 
        if (ret < 0) _E("Failed to request restart to deviced: %d", ret);
 }
@@ -316,7 +306,6 @@ static void poweroff_clicked(const struct popup_ops *ops)
 {
        static int bPowerOff = 0;
        char *param[2];
-       char data[8];
        int ret;
 
        if (bPowerOff == 1) return;
@@ -324,14 +313,12 @@ static void poweroff_clicked(const struct popup_ops *ops)
 
        unload_simple_popup(ops);
 
-       param[0] = REBOOT_OPERATION_OFF;
-       snprintf(data, sizeof(data), "0");
-       param[1] = data;
+       param[0] = POWEROFF_OPERATION_OFF;
        ret = popup_dbus_method_sync(DEVICED_BUS_NAME,
-                       REBOOT_OBJECT_PATH,
-                       REBOOT_INTERFACE_NAME,
-                       REBOOT_METHOD,
-                       "si", param);
+                       POWEROFF_OBJECT_PATH,
+                       POWEROFF_INTERFACE_NAME,
+                       POWEROFF_METHOD,
+                       "s", param);
        if (ret < 0) _E("Failed to request poweroff to deviced: %d", ret);
 }
 
index 6e31c29f917d7fe3c13f3e17bcd460f0bc3a8e94..047dee227b9fc91b7a94416f009d2e00c7359829 100644 (file)
 
 #define SYSTEMD_STOP_POWER_OFF 4
 
-#define DEVICED_BUS_NAME        "org.tizen.system.deviced"
-#define REBOOT_OBJECT_PATH     "/Org/Tizen/System/DeviceD/Reboot"
-#define REBOOT_INTERFACE_NAME  DEVICED_BUS_NAME".reboot"
-
-#define REBOOT_METHOD            "reboot"
-#define REBOOT_OPERATION_OFF     "poweroff"
-#define REBOOT_OPERATION_RESTART     "reboot"
 #define TIMEOUT_POWEROFF 5 /* seconds */
 
 #define POWEROFF_KEY   "XF86PowerOff"
@@ -106,7 +99,6 @@ static void poweroff_clicked(const struct popup_ops *ops)
 {
        static int bPowerOff = 0;
        char *param[2];
-       char data[8];
        int ret;
 
        if (bPowerOff == 1) return;
@@ -114,14 +106,12 @@ static void poweroff_clicked(const struct popup_ops *ops)
 
        unload_simple_popup(ops);
 
-       param[0] = REBOOT_OPERATION_OFF;
-       snprintf(data, sizeof(data), "0");
-       param[1] = data;
+       param[0] = POWEROFF_OPERATION_OFF;
        ret = popup_dbus_method_sync(DEVICED_BUS_NAME,
-                       REBOOT_OBJECT_PATH,
-                       REBOOT_INTERFACE_NAME,
-                       REBOOT_METHOD,
-                       "si", param);
+                       POWEROFF_OBJECT_PATH,
+                       POWEROFF_INTERFACE_NAME,
+                       POWEROFF_METHOD,
+                       "s", param);
        if (ret < 0) _E("Failed to request poweroff to deviced: %d", ret);
 }
 
index 13013b944a2d04e6dbaa263a4407baeda7b5c570..663c5f3c4fbdf75941637a044d74ed1c101fb73a 100644 (file)
 
 #define SYSTEMD_STOP_POWER_OFF 4
 
-#define DEVICED_BUS_NAME        "org.tizen.system.deviced"
-#define REBOOT_OBJECT_PATH     "/Org/Tizen/System/DeviceD/Reboot"
-#define REBOOT_INTERFACE_NAME  DEVICED_BUS_NAME".reboot"
-
-#define REBOOT_METHOD            "reboot"
-#define REBOOT_OPERATION_OFF     "poweroff"
 #define TIMEOUT_POWEROFF 5 /* seconds */
 #define TELEPHONY_PATH "tizen.org/feature/network.telephony"
 
@@ -242,7 +236,6 @@ static void poweroff_clicked(const struct popup_ops *ops)
 {
        static int bPowerOff = 0;
        char *param[2];
-       char data[8];
        int ret;
 
        if (bPowerOff == 1) return;
@@ -251,14 +244,12 @@ static void poweroff_clicked(const struct popup_ops *ops)
        unload_simple_popup(ops);
        terminate_if_no_popup();
 
-       param[0] = REBOOT_OPERATION_OFF;
-       snprintf(data, sizeof(data), "0");
-       param[1] = data;
+       param[0] = POWEROFF_OPERATION_OFF;
        ret = popup_dbus_method_sync(DEVICED_BUS_NAME,
-                       REBOOT_OBJECT_PATH,
-                       REBOOT_INTERFACE_NAME,
-                       REBOOT_METHOD,
-                       "si", param);
+                       POWEROFF_OBJECT_PATH,
+                       POWEROFF_INTERFACE_NAME,
+                       POWEROFF_METHOD,
+                       "s", param);
        if (ret < 0) _E("Failed to request poweroff to deviced: %d", ret);
 }