bluetooth: Use transport array instead of hashmap for devices

Devices will have zero or one transports per profile, and besides the
typical lookup is also profile-based. Therefore, replace the old hashmap
(which used the transport path as key) with a simple array which holds
a transport pointer per profile.
This commit is contained in:
Mikel Astiz 2012-12-06 10:35:19 +01:00 committed by Tanu Kaskinen
parent 51d28e6331
commit faaf8cd39e
2 changed files with 20 additions and 15 deletions

View file

@ -63,6 +63,8 @@ enum profile {
PROFILE_OFF
};
#define PA_BLUETOOTH_PROFILE_COUNT PROFILE_OFF
/* Hook data: pa_bluetooth_transport pointer. */
typedef enum pa_bluetooth_transport_hook {
PA_BLUETOOTH_TRANSPORT_HOOK_NREC_CHANGED, /* Call data: NULL. */
@ -108,7 +110,7 @@ struct pa_bluetooth_device {
/* Device information */
char *name;
char *path;
pa_hashmap *transports;
pa_bluetooth_transport *transports[PA_BLUETOOTH_PROFILE_COUNT];
int paired;
char *alias;
PA_LLIST_HEAD(pa_bluetooth_uuid, uuids);