diff options
author | Luiz Augusto von Dentz <luiz.von.dentz@intel.com> | 2019-01-28 20:52:23 +0200 |
---|---|---|
committer | Luiz Augusto von Dentz <luiz.von.dentz@intel.com> | 2019-01-31 14:10:51 +0200 |
commit | 918f6f932ba8d944786bede7069666361ce28482 (patch) | |
tree | dba4538782850b00c004289642cb4f9cf3cd1269 /src/gatt-database.c | |
parent | ae63206ff840f9cb9300ed951433fad0ff165f49 (diff) | |
download | bluez-918f6f932ba8d944786bede7069666361ce28482.tar.gz |
client: Enable setting attribute handles
This emulates application setting their attribute handles.
Diffstat (limited to 'src/gatt-database.c')
-rw-r--r-- | src/gatt-database.c | 24 |
1 files changed, 19 insertions, 5 deletions
diff --git a/src/gatt-database.c b/src/gatt-database.c index b159786ea..cca70c947 100644 --- a/src/gatt-database.c +++ b/src/gatt-database.c @@ -1843,17 +1843,16 @@ static bool parse_handle(GDBusProxy *proxy, uint16_t *handle) { DBusMessageIter iter; + *handle = 0; + /* Handle property is optional */ - if (!g_dbus_proxy_get_property(proxy, "Handle", &iter)) { - *handle = 0; + if (!g_dbus_proxy_get_property(proxy, "Handle", &iter)) return true; - } - if (dbus_message_iter_get_arg_type(&iter) != DBUS_TYPE_UINT16) return false; - dbus_message_iter_get_basic(&iter, &handle); + dbus_message_iter_get_basic(&iter, handle); return true; } @@ -2634,6 +2633,7 @@ static bool database_add_desc(struct external_service *service, { uint16_t handle; bt_uuid_t uuid; + char str[MAX_LEN_UUID_STR]; if (!parse_handle(desc->proxy, &handle)) { error("Failed to read \"Handle\" property of descriptor"); @@ -2662,6 +2662,10 @@ static bool database_add_desc(struct external_service *service, write_handle(desc->proxy, handle); } + bt_uuid_to_string(&uuid, str, sizeof(str)); + + DBG("handle 0x%04x UUID %s", handle, str); + return true; } @@ -2795,6 +2799,7 @@ static bool database_add_chrc(struct external_service *service, { uint16_t handle; bt_uuid_t uuid; + char str[MAX_LEN_UUID_STR]; const struct queue_entry *entry; if (!parse_handle(chrc->proxy, &handle)) { @@ -2832,6 +2837,10 @@ static bool database_add_chrc(struct external_service *service, write_handle(chrc->proxy, handle); } + bt_uuid_to_string(&uuid, str, sizeof(str)); + + DBG("handle 0x%04x UUID %s", handle, str); + /* Handle the descriptors that belong to this characteristic. */ for (entry = queue_get_entries(service->descs); entry; entry = entry->next) { @@ -2863,6 +2872,7 @@ static bool database_add_service(struct external_service *service) bool primary; uint16_t handle; const struct queue_entry *entry; + char str[MAX_LEN_UUID_STR]; if (!parse_uuid(service->proxy, &uuid)) { error("Failed to read \"UUID\" property of service"); @@ -2895,6 +2905,10 @@ static bool database_add_service(struct external_service *service) write_handle(service->proxy, handle); } + bt_uuid_to_string(&uuid, str, sizeof(str)); + + DBG("handle 0x%04x UUID %s", handle, str); + database_add_includes(service); entry = queue_get_entries(service->chrcs); |