+static void __bt_poweroff_event_filter(GDBusConnection *connection,
+ const gchar *sender_name, const gchar *object_path,
+ const gchar *interface_name, const gchar *signal_name,
+ GVariant *parameters, gpointer user_data)
+{
+ int state = 0;
+
+ g_variant_get(parameters, "(i)", &state);
+
+ if (state != BT_DEVICED_POWEROFF_SIGNAL_POWEROFF &&
+ state != BT_DEVICED_POWEROFF_SIGNAL_REBOOT) {
+ BT_DBG("Not interested event : %d", state);
+ return;
+ }
+
+ if (_bt_adapter_get_status() == BT_ACTIVATING) {
+ BT_INFO("Just update VCONFKEY_BT_STATUS in Power off");
+ if (vconf_set_int(VCONFKEY_BT_STATUS, VCONFKEY_BT_STATUS_ON))
+ BT_ERR("Set VCONFKEY_BT_STATUS failed");
+ } else {
+ __bt_set_in_poweroff();
+ }
+}
+
+void _bt_service_register_poweroff_event(void)
+{
+ if (poweroff_subscribe_id)
+ return;
+
+ poweroff_subscribe_id = g_dbus_connection_signal_subscribe(
+ _bt_gdbus_get_system_gconn(), NULL,
+ BT_DEVICED_POWEROFF_INTERFACE,
+ BT_DEVICED_POWEROFF_SIGNAL,
+ BT_DEVICED_POWEROFF_OBJECT_PATH,
+ NULL, 0, __bt_poweroff_event_filter, NULL, NULL);
+}
+
+void _bt_service_unregister_poweroff_event(void)
+{
+ if (poweroff_subscribe_id == 0)
+ return;
+
+ g_dbus_connection_signal_unsubscribe(_bt_gdbus_get_system_gconn(),
+ poweroff_subscribe_id);
+ poweroff_subscribe_id = 0;
+}
+