diff options
author | Luiz Augusto von Dentz <luiz.von.dentz@intel.com> | 2014-02-08 14:37:20 +0200 |
---|---|---|
committer | Luiz Augusto von Dentz <luiz.von.dentz@intel.com> | 2016-01-28 14:03:05 +0200 |
commit | c4e5fc38e4449990bc55b6d75974a4d5413f971c (patch) | |
tree | da291f6e872be7e7eeba02e0639104d9ea328f29 | |
parent | 5ec855c1b823c3f6ebfeb009398f82fe93210288 (diff) | |
download | bluez-c4e5fc38e4449990bc55b6d75974a4d5413f971c.tar.gz |
core/device: Add device_is_service_blocked
This adds device_is_service_blocked which can be used to check if a
service is currently blocked.
-rw-r--r-- | src/device.c | 28 | ||||
-rw-r--r-- | src/device.h | 1 |
2 files changed, 29 insertions, 0 deletions
diff --git a/src/device.c b/src/device.c index efae9fe06..582dc44af 100644 --- a/src/device.c +++ b/src/device.c @@ -690,6 +690,34 @@ gboolean device_is_trusted(struct btd_device *device) return device->trusted; } +bool device_is_service_blocked(struct btd_device *device, const char *uuid) +{ + GSList *l; + bool block = false; + + for (l = device->services; l; l = g_slist_next(l)) { + struct btd_service *service = l->data; + struct btd_profile *p = btd_service_get_profile(service); + const char *p_uuid; + + p_uuid = p->auth_uuid ? p->auth_uuid : p->local_uuid; + if (!p_uuid) + continue; + + if (strcasecmp(uuid, p_uuid)) + continue; + + if (!btd_service_is_blocked(service)) + return false; + + block = true; + } + + /* Every service matching is blocked + */ + return block; +} + static gboolean dev_property_get_address(const GDBusPropertyTable *property, DBusMessageIter *iter, void *data) { diff --git a/src/device.h b/src/device.h index 323a09f82..7793cd267 100644 --- a/src/device.h +++ b/src/device.h @@ -89,6 +89,7 @@ gboolean device_is_trusted(struct btd_device *device); void device_set_paired(struct btd_device *dev, uint8_t bdaddr_type); void device_set_unpaired(struct btd_device *dev, uint8_t bdaddr_type); void btd_device_set_temporary(struct btd_device *device, bool temporary); +bool device_is_service_blocked(struct btd_device *device, const char *uuid); void btd_device_set_trusted(struct btd_device *device, gboolean trusted); void device_set_bonded(struct btd_device *device, uint8_t bdaddr_type); void device_set_legacy(struct btd_device *device, bool legacy); |