diff options
author | Mikel Astiz <mikel.astiz@bmw-carit.de> | 2013-04-26 08:17:15 +0200 |
---|---|---|
committer | Johan Hedberg <johan.hedberg@intel.com> | 2013-04-26 10:29:36 +0300 |
commit | d6254b41132baa8797f79e55446939495dc3f514 (patch) | |
tree | 93313b8d587613cfa70ee53473f6535de2701bdf /profiles/thermometer | |
parent | 266635500b47329d5365b8f84565e1ea9324972c (diff) | |
download | bluez-d6254b41132baa8797f79e55446939495dc3f514.tar.gz |
profile: Use btd_service for probing profiles
Change the profile probe mechanism in order to pass the btd_service
instance representing the remote service. This object is bound to a
btd_profile and a btd_device, thus replacing the previous parameters.
The probe callback is allowed to hold a reference to the btd_service
by means of btd_service_ref(), which should be unreferenced during
removal.
Keeping such a reference of the btd_service allows supporting multiple
instances of the same UUID, since the reference can serve as a handle
during the interactions between the profile implementation and the core.
Diffstat (limited to 'profiles/thermometer')
-rw-r--r-- | profiles/thermometer/thermometer.c | 10 |
1 files changed, 6 insertions, 4 deletions
diff --git a/profiles/thermometer/thermometer.c b/profiles/thermometer/thermometer.c index ae8ccb2f8..3757b2524 100644 --- a/profiles/thermometer/thermometer.c +++ b/profiles/thermometer/thermometer.c @@ -35,6 +35,7 @@ #include "adapter.h" #include "device.h" #include "profile.h" +#include "service.h" #include "error.h" #include "log.h" #include "attrib/gattrib.h" @@ -1280,9 +1281,9 @@ static void thermometer_adapter_unregister(struct btd_adapter *adapter) THERMOMETER_MANAGER_INTERFACE); } -static int thermometer_device_probe(struct btd_profile *p, - struct btd_device *device) +static int thermometer_device_probe(struct btd_service *service) { + struct btd_device *device = btd_service_get_device(service); struct gatt_primary *tattr; tattr = btd_device_get_primary(device, HEALTH_THERMOMETER_UUID); @@ -1292,9 +1293,10 @@ static int thermometer_device_probe(struct btd_profile *p, return thermometer_register(device, tattr); } -static void thermometer_device_remove(struct btd_profile *p, - struct btd_device *device) +static void thermometer_device_remove(struct btd_service *service) { + struct btd_device *device = btd_service_get_device(service); + thermometer_unregister(device); } |