/*
* popup-launcher
*
- * Copyright (c) 2013 Samsung Electronics Co., Ltd. All rights reserved.
+ * Copyright (c) 2016 Samsung Electronics Co., Ltd. All rights reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
static DBusMessage *powerkey_popup(E_DBus_Object *obj, DBusMessage *msg)
{
set_timer_to_terminate();
- return launch_powerkey_popup(obj, msg, POWERKEY_SYSPOPUP);
+ return launch_popup(obj, msg, POWERKEY_SYSPOPUP);
+}
+
+/* Overheat popup */
+static DBusMessage *overheat_popup(E_DBus_Object *obj, DBusMessage *msg)
+{
+ set_timer_to_terminate();
+ return launch_popup(obj, msg, OVERHEAT_SYSPOPUP);
}
/* Crash popup */
return launch_system_servant_app(obj, msg, args);
}
+/* Datausage */
+static DBusMessage *data_warning_noti_on(E_DBus_Object *obj, DBusMessage *msg)
+{
+ set_timer_to_terminate();
+ return activate_notification_no_param(obj, msg, DATAUSAGE_WARNING);
+}
+
+static DBusMessage *data_disabled_noti_on(E_DBus_Object *obj, DBusMessage *msg)
+{
+ set_timer_to_terminate();
+ return activate_notification_no_param(obj, msg, DATAUSAGE_DISABLED);
+}
+
/* Notification Off */
static DBusMessage *noti_off(E_DBus_Object *obj, DBusMessage *msg)
{
return deactivate_notification(obj, msg);
}
+/* SD Card */
+static DBusMessage *sdcard_noti(E_DBus_Object *obj, DBusMessage *msg)
+{
+ set_timer_to_terminate();
+ return activate_notification_single_param(obj, msg, SDCARD_DEVICE);
+}
+
/* LED */
static DBusMessage *led_torch_noti_on(E_DBus_Object *obj, DBusMessage *msg)
{
return activate_notification_single_param(obj, msg, USB_STORAGE);
}
+/* Cooldown notification */
+static DBusMessage *cooldown_noti_on(E_DBus_Object *obj, DBusMessage *msg)
+{
+ set_timer_to_terminate();
+ return activate_notification_no_param(obj, msg, TEMP_COOLDOWN);
+}
+
static DBusMessage *usb_storage_ro_noti_on(E_DBus_Object *obj, DBusMessage *msg)
{
set_timer_to_terminate();
return update_notification_double_param(obj, msg, USB_DEVICE);
}
+static DBusMessage *media_device_noti_on(E_DBus_Object *obj, DBusMessage *msg)
+{
+ set_timer_to_terminate();
+ return activate_notification_no_param(obj, msg, MEDIA_DEVICE);
+}
+
static const struct edbus_method
dbus_powerkey_methods[] = {
- { "PopupLaunch", NULL, "i", powerkey_popup },
+ { "PopupLaunch", "a{ss}", "i", powerkey_popup },
+ /* Add methods here */
+};
+
+static const struct edbus_method
+dbus_overheat_methods[] = {
+ { "PopupLaunch", "a{ss}", "i", overheat_popup },
/* Add methods here */
};
static const struct edbus_method
dbus_noti_methods[] = {
/* LED */
- { "LedTorchNotiOn" , NULL , "i" , led_torch_noti_on },
- { "LedTorhNotiOff" , "i" , "i" , noti_off },
+ { "LedTorchNotiOn" , NULL , "i" , led_torch_noti_on },
+ { "LedTorchNotiOff" , "i" , "i" , noti_off },
/* USB storage */
{ "UsbStorageNotiOn" , "s" , "i" , usb_storage_noti_on },
{ "UsbStorageRoNotiOn" , "s" , "i" , usb_storage_ro_noti_on },
- { "UsbStorageNotiOff" , "i" , "i" , noti_off },
- { "UsbDeviceNotiOn" , "ss" , "i" , usb_device_noti_on },
- { "UsbDeviceNotiUpdate" , "isss" , "i" , usb_device_noti_update },
- { "UsbDeviceNotiOff" , "i" , "i" , noti_off },
- /* Battery */
+ { "UsbStorageNotiOff" , "i" , "i" , noti_off },
+ { "UsbDeviceNotiOn" , "ss" , "i" , usb_device_noti_on },
+ { "UsbDeviceNotiUpdate" , "isss" , "i" , usb_device_noti_update },
+ { "UsbDeviceNotiOff" , "i" , "i" , noti_off },
+ /* usb connection */
+ { "MediaDeviceNotiOn" , NULL , "i" , media_device_noti_on },
+ { "MediaDeviceNotiOff" , "i" , "i" , noti_off },
+ /* Battery Event noti*/
{ "BatteryFullNotiOn" , NULL , "i" , battery_full_noti_on },
- { "BatteryFullNotiOff" , "i" , "i" , noti_off },
+ { "BatteryFullNotiOff" , "i" , "i" , noti_off },
{ "BatteryChargeNotiOn" , NULL , "i" , battery_charge_noti_on },
+ /* Temperature */
+ { "TempCooldownNotiOn" , NULL , "i" , cooldown_noti_on },
+ { "TempCooldownNotiOff" , "i" , "i" , noti_off },
+ /* SD Card */
+ { "SDcardNoti" , "s" , "i" , sdcard_noti },
+ /* Data Usage */
+ { "DataWarningNotiOn" , NULL , "i" , data_warning_noti_on },
+ { "DataWarningNotiOff" , "i" , "i" , noti_off },
+ { "DataDisabledNotiOn" , NULL , "i" , data_disabled_noti_on },
+ { "DataDisabledNotiOff" , "i" , "i" , noti_off },
/* Add notifications here */
};
static struct edbus_object
-edbus_objects[]= {
+edbus_objects[] = {
{ POPUP_PATH_SYSTEM , POPUP_IFACE_SYSTEM , NULL , NULL ,
- dbus_system_methods , ARRAY_SIZE(dbus_system_methods) },
- { POPUP_PATH_POWERKEY , POPUP_IFACE_POWERKEY , NULL , NULL ,
- dbus_powerkey_methods , ARRAY_SIZE(dbus_powerkey_methods) },
- { POPUP_PATH_NOTI , POPUP_IFACE_NOTI , NULL , NULL ,
- dbus_noti_methods , ARRAY_SIZE(dbus_noti_methods) },
- { POPUP_PATH_CRASH , POPUP_IFACE_CRASH , NULL , NULL ,
- dbus_crash_methods , ARRAY_SIZE(dbus_crash_methods) },
+ dbus_system_methods , ARRAY_SIZE(dbus_system_methods) },
+ { POPUP_PATH_POWERKEY , POPUP_IFACE_POWERKEY , NULL , NULL ,
+ dbus_powerkey_methods , ARRAY_SIZE(dbus_powerkey_methods) },
+ { POPUP_PATH_OVERHEAT , POPUP_IFACE_OVERHEAT , NULL , NULL ,
+ dbus_overheat_methods , ARRAY_SIZE(dbus_overheat_methods) },
+ { POPUP_PATH_NOTI , POPUP_IFACE_NOTI , NULL , NULL ,
+ dbus_noti_methods , ARRAY_SIZE(dbus_noti_methods) },
+ { POPUP_PATH_CRASH , POPUP_IFACE_CRASH , NULL , NULL ,
+ dbus_crash_methods , ARRAY_SIZE(dbus_crash_methods) },
/* Add new object & interface here*/
};
edbus_objects[i].methods[j].reply_signature,
edbus_objects[i].methods[j].func);
if (!ret) {
- _E("fail to add method %s!", edbus_objects[i].methods[j].member);
+ _E("Failed to add method(%s).", edbus_objects[i].methods[j].member);
return -ECONNREFUSED;
}
}
if (e_dbus_init())
break;
if (++retry == RETRY_MAX) {
- _E("fail to init edbus");
+ _E("Failed to init edbus.");
return -ECONNREFUSED;
}
} while (retry <= RETRY_MAX);
if (edbus_conn)
break;
if (++retry == RETRY_MAX) {
- _E("fail to get edbus");
+ _E("Failed to get edbus.");
ret = -ECONNREFUSED;
goto out1;
}
} while (retry <= RETRY_MAX);
- retry = 0;
- do {
- edbus_request_name = e_dbus_request_name(edbus_conn, BUS_NAME, 0, NULL, NULL);
- if (edbus_request_name)
- break;
- if (++retry == RETRY_MAX) {
- _E("fail to request edbus name");
- ret = -ECONNREFUSED;
- goto out2;
- }
- } while (retry <= RETRY_MAX);
-
for (i = 0; i < ARRAY_SIZE(edbus_objects); i++) {
edbus_objects[i].obj = e_dbus_object_add(edbus_conn, edbus_objects[i].path, NULL);
if (!(edbus_objects[i].obj)) {
- _E("fail to add edbus obj");
+ _E("Failed to add edbus obj.");
ret = -ECONNREFUSED;
goto out2;
}
edbus_objects[i].iface = e_dbus_interface_new(edbus_objects[i].interface);
if (!(edbus_objects[i].iface)) {
- _E("fail to add edbus interface");
+ _E("Failed to add edbus interface.");
ret = -ECONNREFUSED;
goto out2;
}
e_dbus_object_interface_attach(edbus_objects[i].obj, edbus_objects[i].iface);
}
+ retry = 0;
+ do {
+ edbus_request_name = e_dbus_request_name(edbus_conn, BUS_NAME, 0, NULL, NULL);
+ if (edbus_request_name)
+ break;
+ if (++retry == RETRY_MAX) {
+ _E("Failed to request edbus name.");
+ ret = -ECONNREFUSED;
+ goto out2;
+ }
+ } while (retry <= RETRY_MAX);
+
return 0;
out2:
return ret;
}
-int main (int argc, char *argv[])
+int main(int argc, char *argv[])
{
int ret;
if (ret < 0)
return ret;
- ret= init_methods();
+ ret = init_methods();
if (ret < 0)
return ret;