summaryrefslogtreecommitdiffstats
path: root/hcid
diff options
context:
space:
mode:
authorClaudio Takahasi <claudio.takahasi@openbossa.org>2008-03-10 14:20:50 +0000
committerClaudio Takahasi <claudio.takahasi@openbossa.org>2008-03-10 14:20:50 +0000
commitea00a446dbacead62040dd2bd7e663774c205c04 (patch)
tree08f24f974723748e5a63b68329193f43d8d9d24d /hcid
parent4e6726e8029f20be3e08b44760c56fc7a419090b (diff)
added new function to convert uuid to string(uuid128)
Diffstat (limited to 'hcid')
-rw-r--r--hcid/adapter.c9
-rw-r--r--hcid/device.c6
-rw-r--r--hcid/device.h4
3 files changed, 10 insertions, 9 deletions
diff --git a/hcid/adapter.c b/hcid/adapter.c
index 754c7b1f..77d0b0f8 100644
--- a/hcid/adapter.c
+++ b/hcid/adapter.c
@@ -3178,9 +3178,10 @@ static DBusHandlerResult list_devices(DBusConnection *conn,
static void discover_services_cb(gpointer user_data, sdp_list_t *recs, int err)
{
- sdp_list_t *uuids, *seq, *next, *svcclass;
+ sdp_list_t *seq, *next, *svcclass;
struct adapter *adapter = user_data;
DBusMessage *reply;
+ GSList *uuids;
const char *path;
if (err < 0) {
@@ -3199,9 +3200,9 @@ static void discover_services_cb(gpointer user_data, sdp_list_t *recs, int err)
svcclass = NULL;
if (sdp_get_service_classes(rec, &svcclass) == 0) {
/* Extract the first element and skip the remainning */
- uuid_t *u = malloc(sizeof(uuid_t));
- memcpy(u, svcclass->data, sizeof(uuid_t));
- uuids = sdp_list_append(uuids, u);
+ gchar *uuid_str = bt_uuid2string(svcclass->data);
+ if (uuid_str)
+ uuids = g_slist_append(uuids, uuid_str);
sdp_list_free(svcclass, free);
}
diff --git a/hcid/device.c b/hcid/device.c
index b16a8189..538ce853 100644
--- a/hcid/device.c
+++ b/hcid/device.c
@@ -749,8 +749,8 @@ void device_foreach(GFunc func, gpointer user_data)
static void device_free(struct device *device)
{
- sdp_list_free(device->uuids, (sdp_free_func_t) free);
- g_free(device->address);
+ g_slist_foreach(device->uuids, (GFunc) g_free, NULL);
+ g_slist_free(device->uuids);
g_free(device->path);
g_free(device);
}
@@ -885,7 +885,7 @@ static DBusSignalVTable device_signals[] = {
};
const char *device_create(struct adapter *adapter,
- const char *address, sdp_list_t *uuids)
+ const char *address, GSList *uuids)
{
struct device *device;
diff --git a/hcid/device.h b/hcid/device.h
index 91ac8a7b..cdb68a50 100644
--- a/hcid/device.h
+++ b/hcid/device.h
@@ -26,12 +26,12 @@ struct device {
char *address;
char *path;
struct adapter *adapter;
- sdp_list_t *uuids;
+ GSList *uuids;
};
gboolean device_init(DBusConnection *conn);
void device_cleanup(void);
void device_foreach(GFunc func, gpointer user_data);
const char *device_create(struct adapter *adapter,
- const char *address, sdp_list_t *uuids);
+ const char *address, GSList *uuids);
void device_remove(const char *path);