-#ifdef TIZEN_WEARABLE
-static void __bt_unbond_cb(DBusGProxy *proxy, DBusGProxyCall *call,
- gpointer user_data)
-{
- GError *err = NULL;
-
- dbus_g_proxy_end_call(proxy, call, &err, G_TYPE_INVALID);
- if (err != NULL) {
- BT_ERR("Error occured in RemoveBonding [%s]\n", err->message);
- g_error_free(err);
- return;
- }
-
- BT_INFO("Unbonding is done");
- return;
-}
-
-static gboolean __bt_unpair_device(void)
-{
- GArray *device_list;
- int no_of_device;
- int i;
-
- device_list = g_array_new(FALSE, FALSE, sizeof(gchar));
- if (device_list == NULL) {
- BT_ERR("g_array_new is failed");
- return FALSE;
- }
-
- if (_bt_get_bonded_devices(&device_list) != BLUETOOTH_ERROR_NONE) {
- BT_ERR("_bt_get_bonded_devices is failed");
- g_array_free(device_list, TRUE);
- return FALSE;
- }
-
- no_of_device = device_list->len / sizeof(bluetooth_device_info_t);
- for (i = 0; i < no_of_device; i++) {
- DBusGProxy *adapter_proxy;
- bluetooth_device_info_t info;
- char addr[BT_ADDRESS_STRING_SIZE] = { 0 };
- char *device_path = NULL;
-
- info = g_array_index(device_list, bluetooth_device_info_t, i);
- if (info.device_class.major_class ==
- BLUETOOTH_DEVICE_MAJOR_CLASS_AUDIO)
- continue;
-
- adapter_proxy = _bt_get_adapter_proxy();
- if (!adapter_proxy) {
- BT_ERR("adapter_proxy is NULL");
- g_array_free(device_list, TRUE);
- return FALSE;
- }
-
- _bt_convert_addr_type_to_string(addr, info.device_address.addr);
- device_path = _bt_get_device_object_path(addr);
- if (device_path == NULL) {
- BT_ERR("device_path is NULL");
- g_array_free(device_list, TRUE);
- return FALSE;
- }
-
- if (!dbus_g_proxy_begin_call(adapter_proxy, "UnpairDevice",
- (DBusGProxyCallNotify)__bt_unbond_cb,
- NULL, NULL,
- DBUS_TYPE_G_OBJECT_PATH, device_path,
- G_TYPE_INVALID)) {
- BT_ERR("RemoveBonding begin failed\n");
- g_array_free(device_list, TRUE);
- return FALSE;
- }
- BT_INFO("unbonding %s is requested", addr);
-
- g_array_free(device_list, TRUE);
- return TRUE;
- }
-
- g_array_free(device_list, TRUE);
- return FALSE;
-}
-
-static DBusHandlerResult __bt_popup_event_filter(DBusConnection *conn,
- DBusMessage *msg, void *data)
-{
- int response;
-
- BT_DBG("+");
-
- if (msg == NULL)
- return DBUS_HANDLER_RESULT_NOT_YET_HANDLED;
-
- if (!dbus_message_is_signal(msg, "User.Bluetooth.syspopup", "ResetResponse"))
- return DBUS_HANDLER_RESULT_NOT_YET_HANDLED;
-
- if (!dbus_message_get_args(msg, NULL,
- DBUS_TYPE_INT32, &response,
- DBUS_TYPE_INVALID)) {
- return DBUS_HANDLER_RESULT_NOT_YET_HANDLED;
- }
-
- BT_DBG("response = %d", response);
-
- BT_DBG("-");
- return DBUS_HANDLER_RESULT_HANDLED;
-}
-
-static void __bt_register_popup_event_signal(void)
-{
- DBusError dbus_error;
- DBusGConnection *gconn;
- DBusConnection *conn;
-
- BT_DBG("+\n");
-
- gconn = _bt_get_system_gconn();
- if (gconn == NULL)
- return;
-
- conn = dbus_g_connection_get_connection(gconn);
- if (conn == NULL)
- return;
-
- dbus_connection_add_filter(conn, __bt_popup_event_filter, NULL, NULL);
-
- dbus_error_init(&dbus_error);
- dbus_bus_add_match(conn,
- "type='signal',interface='User.Bluetooth.syspopup'"
- ",member='ResetResponse'", &dbus_error);
- if (dbus_error_is_set(&dbus_error)) {
- BT_ERR("Error: %s\n", dbus_error.message);
- dbus_error_free(&dbus_error);
- return;
- }
-
- BT_DBG("-\n");
- return;
-}
-
-static gboolean __is_reset_required(const gchar *address)
-{
- GArray *device_list;
- uint32_t no_of_device;
- uint32_t i;
- bluetooth_device_info_t info;
- gboolean is_required = FALSE;
-
- device_list = g_array_new(FALSE, FALSE, sizeof(gchar));
- if (device_list == NULL) {
- BT_ERR("g_array_new is failed");
- return FALSE;
- }
-
- if (_bt_get_bonded_devices(&device_list) != BLUETOOTH_ERROR_NONE) {
- BT_ERR("_bt_get_bonded_devices is failed");
- g_array_free(device_list, TRUE);
- return FALSE;
- }
-
- no_of_device = device_list->len / sizeof(bluetooth_device_info_t);
- for (i = 0; i < no_of_device; i++) {
- char addr[BT_ADDRESS_STRING_SIZE] = { 0 };
-
- info = g_array_index(device_list, bluetooth_device_info_t, i);
-
- _bt_convert_addr_type_to_string(addr, info.device_address.addr);
- if (g_strcmp0(address, addr) == 0) {
- BT_DBG("This device is already in paired list");
- is_required = FALSE;
- break;
- }
-
- if (info.device_class.major_class != BLUETOOTH_DEVICE_MAJOR_CLASS_AUDIO) {
- is_required = TRUE;
- break;
- }
- }
- g_array_free(device_list, TRUE);
-
- return is_required;
-}
-#endif
-