BT_INFO("GATT Server: Notification Enabled?? Handle: [%d] address [%s] Is Enabled [%d] result [%d]",
info.handle, address, info.notification, result);
+ if (info.notification == FALSE)
+ cleanup_gatt_acquire_fd(info.handle);
+
_bt_gatt_server_event_cb(BLUETOOTH_EVENT_GATT_SERVER_NOTIFICATION_STATE_CHANGED,
result, &info,
event_info->cb, event_info->user_data);
chr_info->write_fd = fd;
+ BT_INFO("setting up g_io channel");
channel = g_io_channel_unix_new(fd);
g_io_channel_set_encoding(channel, NULL, NULL);
g_io_channel_set_buffered(channel, FALSE);
dev_address.addr,
BLUETOOTH_ADDRESS_LENGTH);
info.handle = att_han;
+ info.notification = TRUE;
_bt_gatt_server_event_cb(BLUETOOTH_EVENT_GATT_SERVER_NOTIFICATION_STATE_CHANGED,
result, &info,
}
}
+
+void cleanup_gatt_acquire_fd(int handle)
+{
+ bluetooth_gatt_acquire_notify_info_t *chr_info = NULL;
+
+ BT_INFO("+");
+
+ chr_info = bluetooth_get_characteristic_info_from_path(handle);
+
+ if (chr_info != NULL) {
+ BT_INFO("GATT Server: acquire notification char info found");
+
+ if (chr_info->write_fd >= 0) {
+ BT_INFO("closing fd");
+ close(chr_info->write_fd);
+ }
+ }
+}