diff --git a/android/gatt.c b/android/gatt.c
index 6d29ccb..14fd164 100644
--- a/android/gatt.c
+++ b/android/gatt.c
static struct queue *gatt_apps = NULL;
static struct queue *gatt_devices = NULL;
-static struct queue *client_connections = NULL;
+static struct queue *app_connections = NULL;
static int32_t app_id = 1;
static struct connection *find_connection_by_id(int32_t conn_id)
{
- return queue_find(client_connections, match_connection_by_id,
+ return queue_find(app_connections, match_connection_by_id,
INT_TO_PTR(conn_id));
}
static void device_disconnect_clients(struct gatt_device *dev)
{
/* Notify disconnection to all clients */
- queue_foreach(client_connections, disconnect_notify_by_device, dev);
+ queue_foreach(app_connections, disconnect_notify_by_device, dev);
/* Remove all clients by given device's */
- queue_remove_all(client_connections, match_connection_by_device, dev,
+ queue_remove_all(app_connections, match_connection_by_device, dev,
destroy_connection);
}
reply:
data.dev = dev;
data.status = status;
- queue_foreach(client_connections, send_app_connect_notifications,
- &data);
+ queue_foreach(app_connections, send_app_connect_notifications, &data);
device_unref(dev);
/* Check if we should restart scan */
new_conn->app = app;
new_conn->id = last_conn_id++;
- if (!queue_push_head(client_connections, new_conn)) {
+ if (!queue_push_head(app_connections, new_conn)) {
error("gatt: Cannot push client on the client queue!?");
free(new_conn);
static void trigger_disconnection(struct connection *connection)
{
/* Notify client */
- if (queue_remove(client_connections, connection))
+ if (queue_remove(app_connections, connection))
send_app_disconnect_notify(connection, GATT_SUCCESS);
destroy_connection(connection);
struct connection *conn;
/* find every connection for client record and trigger disconnect */
- conn = queue_remove_if(client_connections, match_connection_by_app,
+ conn = queue_remove_if(app_connections, match_connection_by_app,
client);
while (conn) {
trigger_disconnection(conn);
- conn = queue_remove_if(client_connections,
+ conn = queue_remove_if(app_connections,
match_connection_by_app, client);
}
}
conn_match.device = dev;
conn_match.app = app;
- return queue_find(client_connections,
- match_connection_by_device_and_app,
- &conn_match);
+ return queue_find(app_connections, match_connection_by_device_and_app,
+ &conn_match);
}
static void handle_client_connect(const void *buf, uint16_t len)
conn_match.device = device;
conn_match.app = client;
- conn = queue_find(client_connections,
- match_connection_by_device_and_app,
- &conn_match);
+ conn = queue_find(app_connections, match_connection_by_device_and_app,
+ &conn_match);
if (!conn) {
conn = create_connection(device, client);
if (!conn) {
gatt_devices = queue_new();
gatt_apps = queue_new();
- client_connections = queue_new();
+ app_connections = queue_new();
listen_clients = queue_new();
if (!gatt_devices || !gatt_apps || !listen_clients ||
- !client_connections) {
+ !app_connections) {
error("gatt: Failed to allocate memory for queues");
queue_destroy(gatt_apps, NULL);
queue_destroy(gatt_devices, NULL);
gatt_devices = NULL;
- queue_destroy(client_connections, NULL);
- client_connections = NULL;
+ queue_destroy(app_connections, NULL);
+ app_connections = NULL;
queue_destroy(listen_clients, NULL);
listen_clients = NULL;
queue_destroy(gatt_apps, destroy_gatt_app);
gatt_apps = NULL;
- queue_destroy(client_connections, destroy_connection);
- client_connections = NULL;
+ queue_destroy(app_connections, destroy_connection);
+ app_connections = NULL;
queue_destroy(gatt_devices, destroy_device);
gatt_devices = NULL;