int psm;
guint auth_id;
char *auth_uuid;
+ guint conn_timer;
};
struct l2cap_le_profile_info {
}
#ifdef TIZEN_FEATURE_BLUEZ_MODIFY
- if (!req)
+ if (!req)
return;
/* If bdaddr_type is LE but req is for SDP, don't complete browse req. */
return FALSE;
}
+static gboolean handle_conn_fail(gpointer data)
+{
+ DBG("+");
+ struct l2cap_le_conn_info *conn = data;
+
+ conn->conn_timer = 0;
+ g_dbus_emit_signal(dbus_conn, conn->dev_path,
+ DEVICE_INTERFACE, "ConnectionFail",
+ DBUS_TYPE_STRING, &(conn->profile_info->path),
+ DBUS_TYPE_INVALID);
+ DBG("-");
+ return FALSE;
+}
+
static void l2cap_le_connect_cb(GIOChannel *chan, GError *gerr,
gpointer user_data)
{
int fd;
GError *io_err = NULL;
char addr[18];
+ int is_request_by_app = 0;
+
+ dev_path = conn->dev_path;
+
+ if (conn->conn_timer) {
+ DBG("Removing timer %d", conn->conn_timer);
+ is_request_by_app = 1;
+ g_source_remove(conn->conn_timer);
+ conn->conn_timer = 0;
+ }
if (!bt_io_get(chan, &io_err,
BT_IO_OPT_DEST, addr,
goto drop;
}
- dev_path = conn->dev_path;
-
dbus_message_iter_init_append(msg, &iter);
dbus_message_iter_append_basic(&iter, DBUS_TYPE_OBJECT_PATH, &dev_path);
if (io_err)
g_error_free(io_err);
+ if(is_request_by_app) {
+ error("Call Connection Failed Event");
+ handle_conn_fail((gpointer)conn);
+ }
+
info->conn = g_slist_remove(info->conn, conn);
l2cap_le_io_destroy(conn);
}
conn = g_malloc0(sizeof(struct l2cap_le_conn_info));
info->conn = g_slist_append(info->conn, conn);
+ info->role = BT_L2CAP_LE_CLIENT_ROLE;
+ conn->dev_path = dev_path;
+ conn->profile_info = info;
+
+ DBG("Add timer for 10 sec");
+ conn->conn_timer = g_timeout_add(10000, handle_conn_fail, conn);
+
conn->io = bt_io_connect(l2cap_le_connect_cb,
conn, NULL, &gerr,
BT_IO_OPT_SOURCE_BDADDR, src,
error("L2CAP_LE Connect failed : %s", gerr->message);
g_error_free(gerr);
_remove_l2cap_le_socket(info);
+ g_source_remove(conn->conn_timer);
+ conn->conn_timer = 0;
return -EIO;
}
- info->role = BT_L2CAP_LE_CLIENT_ROLE;
- conn->dev_path = dev_path;
- conn->profile_info = info;
conn->connected = false;
g_io_channel_set_close_on_unref(conn->io, FALSE);
GDBUS_ARGS({ "bdaddr_type", "y" }, { "reason", "y" },
{ "name", "s" })) },
{ GDBUS_SIGNAL("DeviceConnected", GDBUS_ARGS({ "bdaddr_type", "y"})) },
+ { GDBUS_SIGNAL("ConnectionFail", GDBUS_ARGS({ "path", "s" }))},
{ GDBUS_SIGNAL("ProfileStateChanged",
GDBUS_ARGS({ "profile", "s"}, {"state", "i"})) },
{ GDBUS_SIGNAL("AdvReport",