aboutsummaryrefslogtreecommitdiffstats
path: root/attrib/manager.c
diff options
context:
space:
mode:
authorClaudio Takahasi <claudio.takahasi@openbossa.org>2010-11-24 00:30:43 -0200
committerJohan Hedberg <johan.hedberg@nokia.com>2010-11-29 19:18:33 +0200
commitd49c4e8457a3169f32c9b7466516b2d2e83b0f6c (patch)
tree9d79d856d420cfa5bd29eebf8ad9eaf276bcd168 /attrib/manager.c
parent04e0628c444223b4b1c7dfa408ad8afbc763d4aa (diff)
downloadbluez-d49c4e8457a3169f32c9b7466516b2d2e83b0f6c.tar.gz
bluez-d49c4e8457a3169f32c9b7466516b2d2e83b0f6c.tar.xz
bluez-d49c4e8457a3169f32c9b7466516b2d2e83b0f6c.zip
Implement primary service search when creating a device
Discover primary services implemented inside the device entity to allow proper integration of attribute plugin. Implements a single entry point to the attribute plugin no matter the transport(BR/EDR or LE), the device probe callback is called for both types. Add a new function to discover all primary services without additional calls to fetch the remaining primary services, sub-procedure iterations is handled inside this function. The next action are: clean the attribute client removing implicity service and characteristics discovery, issue the Discover Primary Service based on the remote properties and fetch the characteristic on demand.
Diffstat (limited to 'attrib/manager.c')
-rw-r--r--attrib/manager.c27
1 files changed, 9 insertions, 18 deletions
diff --git a/attrib/manager.c b/attrib/manager.c
index 9bd1774f..9b06c8ca 100644
--- a/attrib/manager.c
+++ b/attrib/manager.c
@@ -45,26 +45,17 @@ static int client_probe(struct btd_device *device, GSList *uuids)
{
const sdp_record_t *rec;
sdp_list_t *list;
- int psm;
-
- /*
- * Entry point for BR/EDR GATT probe. LE scanning and primary service
- * search will be handled temporaly inside the gatt plugin. For the
- * final solution all LE operations should be moved to the "core",
- * otherwise it will not be possible serialize/schedule BR/EDR device
- * discovery and LE scanning.
- */
+ int psm = -1;
rec = btd_device_get_record(device, GATT_UUID);
- if (!rec)
- return -1;
-
- if (sdp_get_access_protos(rec, &list) < 0)
- return -1;
-
- psm = sdp_get_proto_port(list, L2CAP_UUID);
- if (psm < 0)
- return -1;
+ if (rec) {
+ if (sdp_get_access_protos(rec, &list) < 0)
+ return -1;
+
+ psm = sdp_get_proto_port(list, L2CAP_UUID);
+ if (psm < 0)
+ return -1;
+ }
return attrib_client_register(device, psm);
}