BT_DBG("-");
}
+void _bt_rfcomm_client_disconnect_all(void)
+{
+ GSList *client;
+ GSList *conn;
+
+ BT_INFO_C("### Disconnect all RFCOMM client connections");
+
+ for (client = rfcomm_clients; client; ) {
+ rfcomm_cb_data_t *info = client->data;
+
+ for (conn = info->rfcomm_conns; conn; conn = conn->next) {
+ rfcomm_conn_info_t *conn_info = conn->data;
+
+ if (conn_info == NULL)
+ continue;
+
+ if (conn_info->watch_id == 0 || conn_info->disconnected)
+ continue;
+
+ close(conn_info->fd);
+ conn_info->disconnected = TRUE;
+
+ _bt_disconnect_profile(conn_info->bt_addr, info->uuid,
+ NULL,NULL);
+
+ }
+
+ client = client->next;
+ __rfcomm_client_disconnect(info);
+ }
+
+ return;
+}
#endif
int new_connection(const char *path, int fd, bluetooth_device_address_t *addr)
BT_INFO("conn_info %s", conn_info->bt_addr);
_bt_disconnect_profile(conn_info->bt_addr, info->uuid, NULL, NULL);
- /*
- * ToDo : If idle_id is not zero, it means disconnect request is
- * going on. Such a case, in-progress error should be returned.
- */
if (info->idle_id == 0)
info->idle_id = g_idle_add(__rfcomm_client_disconnect, info);
g_free(info);
}
-void _bt_rfcomm_server_free_all()
+void _bt_rfcomm_server_free_all(void)
{
BT_DBG("Free all the servers");
g_slist_free_full(rfcomm_nodes, (GDestroyNotify)free_rfcomm_info);
rfcomm_nodes = NULL;
}
+
+void _bt_rfcomm_server_disconnect_all(void)
+{
+ GSList *server;
+ GSList *conn;
+ char addr[20];
+
+ BT_INFO("### Disconnect all RFCOMM server connections");
+
+ for (server = rfcomm_nodes; server; ) {
+ rfcomm_info_t *info = server->data;
+
+ for (conn = info->rfcomm_conns; conn; conn = conn->next) {
+ rfcomm_conn_t *conn_info = conn->data;
+
+ if (conn_info == NULL)
+ continue;
+
+ if (conn_info->watch_id == 0 || conn_info->disconnected)
+ continue;
+
+ close(conn_info->fd);
+ conn_info->disconnected = TRUE;
+
+ _bt_convert_addr_type_to_string(addr,
+ conn_info->addr.addr);
+ _bt_disconnect_profile(addr, info->uuid, NULL,NULL);
+ }
+
+ server = server->next;
+ __rfcomm_server_disconnect(info);
+ }
+
+ return;
+}
#endif
BT_EXPORT_API int bluetooth_rfcomm_create_socket(const char *uuid)
char *device_address);
#ifdef RFCOMM_DIRECT
-void _bt_rfcomm_server_free_all();
+void _bt_rfcomm_server_free_all(void);
+
+void _bt_rfcomm_server_disconnect_all(void);
+
+void _bt_rfcomm_client_disconnect_all(void);
gboolean _check_uuid_path(char *path, char *uuid);
#endif
void _bluetooth_hid_free_hid_info(void);
+
#ifdef __cplusplus
}
#endif /* __cplusplus */