ba2str(&addr->bdaddr, dst);
+#ifdef TIZEN_FEATURE_BLUEZ_MODIFY
+ DBG("hci%u new LTK for %s type %u enc_size %u central %d",
+ adapter->dev_id, dst, ev->key.type, ev->key.enc_size, ev->key.central);
+#else
DBG("hci%u new LTK for %s type %u enc_size %u",
adapter->dev_id, dst, ev->key.type, ev->key.enc_size);
+#endif
device = btd_adapter_get_device(adapter, &addr->bdaddr, addr->type);
if (!device) {
guint retry_timer;
struct timespec attempt_start_time;
long last_attempt_duration_ms;
-#ifdef TIZEN_FEATURE_BLUEZ_MODIFY
- GIOChannel *io;
-#endif
};
typedef enum {
bool pending_conn_update;
bool le_connectable;
struct l2cap_le_conn_info *conn_info;
+ GIOChannel *bonding_io;
#endif
};
void device_set_le_bonding_io(struct btd_device *device, GIOChannel *io)
{
if (device->bonding) {
- device->bonding->io = io;
+ device->bonding_io = io;
+ }
+}
+
+void device_close_le_bonding_io(struct btd_device *device)
+{
+ if (!device->bonding_io)
+ return;
+
+ if (device->bonding) {
+ DBG("LE bonding process is still ongoing");
+ return;
}
+
+ if (!device->gatt_connected) {
+ DBG("GATT connection process is still ongoing");
+ return;
+ }
+
+ DBG("shutdown LE bonding-io after LE bonding completed");
+ g_io_channel_shutdown(device->bonding_io, FALSE, NULL);
+ device->bonding_io = NULL;
}
#endif
if (!bonding)
return;
-#ifdef TIZEN_FEATURE_BLUEZ_MODIFY
- if (bonding->io) {
- DBG("shutdown LE bonding-io after LE bonding completed");
- g_io_channel_shutdown(bonding->io, FALSE, NULL);
- }
-#endif
-
if (bonding->listener_id)
g_dbus_remove_watch(dbus_conn, bonding->listener_id);
if (bonding->retry_timer)
g_source_remove(bonding->retry_timer);
- if (bonding->device)
+ if (bonding->device) {
bonding->device->bonding = NULL;
+#ifdef TIZEN_FEATURE_BLUEZ_MODIFY
+ device_close_le_bonding_io(bonding->device);
+#endif
+ }
g_free(bonding);
}
bool btd_device_get_svc_changed_indication(struct btd_device *dev);
void device_set_accept_io(const struct btd_device *device, GIOChannel *io);
void device_set_le_bonding_io(struct btd_device *device, GIOChannel *io);
+void device_close_le_bonding_io(struct btd_device *device);
#ifdef TIZEN_FEATURE_BLUEZ_BATTERY_WATCH
void device_change_pkt_type(gpointer data, gpointer user_data);
#endif /* TIZEN_FEATURE_BLUEZ_BATTERY_WATCH */