mirror of
https://git.kernel.org/pub/scm/bluetooth/bluez.git
synced 2024-11-15 00:04:29 +08:00
client/gatt: Set handle before calling print functions
The print functions (print_service, print_chrc and print_desc) all print the handle, but the handle is never set in the struct object. This results in the handle always printing as 0x0000. Set the handle before calling the print function.
This commit is contained in:
parent
8274166382
commit
720e8ec976
@ -165,6 +165,7 @@ static void print_service_proxy(GDBusProxy *proxy, const char *description)
|
||||
DBusMessageIter iter;
|
||||
const char *uuid;
|
||||
dbus_bool_t primary;
|
||||
uint16_t handle;
|
||||
|
||||
if (g_dbus_proxy_get_property(proxy, "UUID", &iter) == FALSE)
|
||||
return;
|
||||
@ -176,10 +177,16 @@ static void print_service_proxy(GDBusProxy *proxy, const char *description)
|
||||
|
||||
dbus_message_iter_get_basic(&iter, &primary);
|
||||
|
||||
if (g_dbus_proxy_get_property(proxy, "Handle", &iter) == FALSE)
|
||||
return;
|
||||
|
||||
dbus_message_iter_get_basic(&iter, &handle);
|
||||
|
||||
memset(&service, 0, sizeof(service));
|
||||
service.path = (char *) g_dbus_proxy_get_path(proxy);
|
||||
service.uuid = (char *) uuid;
|
||||
service.primary = primary;
|
||||
service.handle = handle;
|
||||
|
||||
print_service(&service, description);
|
||||
}
|
||||
@ -253,15 +260,22 @@ static void print_characteristic(GDBusProxy *proxy, const char *description)
|
||||
struct chrc chrc;
|
||||
DBusMessageIter iter;
|
||||
const char *uuid;
|
||||
uint16_t handle;
|
||||
|
||||
if (g_dbus_proxy_get_property(proxy, "UUID", &iter) == FALSE)
|
||||
return;
|
||||
|
||||
dbus_message_iter_get_basic(&iter, &uuid);
|
||||
|
||||
if (g_dbus_proxy_get_property(proxy, "Handle", &iter) == FALSE)
|
||||
return;
|
||||
|
||||
dbus_message_iter_get_basic(&iter, &handle);
|
||||
|
||||
memset(&chrc, 0, sizeof(chrc));
|
||||
chrc.path = (char *) g_dbus_proxy_get_path(proxy);
|
||||
chrc.uuid = (char *) uuid;
|
||||
chrc.handle = handle;
|
||||
|
||||
print_chrc(&chrc, description);
|
||||
}
|
||||
@ -347,15 +361,22 @@ static void print_descriptor(GDBusProxy *proxy, const char *description)
|
||||
struct desc desc;
|
||||
DBusMessageIter iter;
|
||||
const char *uuid;
|
||||
uint16_t handle;
|
||||
|
||||
if (g_dbus_proxy_get_property(proxy, "UUID", &iter) == FALSE)
|
||||
return;
|
||||
|
||||
dbus_message_iter_get_basic(&iter, &uuid);
|
||||
|
||||
if (g_dbus_proxy_get_property(proxy, "Handle", &iter) == FALSE)
|
||||
return;
|
||||
|
||||
dbus_message_iter_get_basic(&iter, &handle);
|
||||
|
||||
memset(&desc, 0, sizeof(desc));
|
||||
desc.path = (char *) g_dbus_proxy_get_path(proxy);
|
||||
desc.uuid = (char *) uuid;
|
||||
desc.handle = handle;
|
||||
|
||||
print_desc(&desc, description);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user