linux-bluetooth.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] android/gatt: Client connection handling refactor
@ 2014-04-23 12:26 Jakub Tyszkowski
  2014-04-23 12:26 ` [PATCH] android/gatt: Refactor client connection handling Jakub Tyszkowski
  0 siblings, 1 reply; 4+ messages in thread
From: Jakub Tyszkowski @ 2014-04-23 12:26 UTC (permalink / raw)
  To: linux-bluetooth; +Cc: Jakub Tyszkowski

This is rather big connection handling refactor but each of those little
changes, significantly change connection handling logic. For the reason of not
rewriting it again and again for every change made, single patch was done.
Multiple, connection specific device lists were replaced with one, while
devices store their connection state instead. Client list in each device were
replaced with single, global list, storing (connection_id, client*, device*)
tuples. This seams to be more natural and easier to pass required data to
other functions as most actions are performed by specific clients on specific
device or connection.

Storing such connection describing triplets allows search for the rest
of those three entities, knowing one of them, i.e. when client unregisters
(disconnect all devices connected to client), device disconnects
(notify all clients about disconnection) or specific client disconnects from
single device.

As connection id was previously assigned to and accessed from device,
and now device is accessed from connection record, having unique
connection_id, quite a lot of logic had to be changed, including
notification handling. This change was needed as Android uses
connection_id to identify particular client<->device and not the physical
adapter<->device connection, which is irrelevant on HAL API level.

Changes in compare to RFC:
 * notification destroy invalid read fixed by freeing notifcations
 	before connection are freed
 * renamed device state enum values
 * renamed free_connection to destroy_connection
 * do device's connection reference counting only in create/destroy
 	connection functions for better reference tracking and use
 	destroy_connection on profile cleanup
 * remove double client and device searches in connect handler and move
 	new device creation from connection search helper to connect handler
 * proper connect notifications with GATT_FAILURE are now send on
 	disconnecting devices in connection_pending and connectable states
 * on removal of device in connectable/connection_pending, state check
 	if scan should be stopped was added

Jakub Tyszkowski (1):
  android/gatt: Refactor client connection handling

 android/gatt.c | 957 +++++++++++++++++++++++++++++----------------------------
 1 file changed, 495 insertions(+), 462 deletions(-)

--
1.9.1


^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2014-04-24 10:57 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-04-23 12:26 [PATCH] android/gatt: Client connection handling refactor Jakub Tyszkowski
2014-04-23 12:26 ` [PATCH] android/gatt: Refactor client connection handling Jakub Tyszkowski
2014-04-23 17:35   ` Andrzej Kaczmarek
2014-04-24 10:57     ` Tyszkowski Jakub

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).