struct descriptor {
char *uuid;
+ char *path;
uint8_t *value;
int vlen;
};
desc->vlen = vlen;
g_dbus_pending_property_success(id);
+
+ g_dbus_emit_property_changed(connection, desc->path,
+ GATT_DESCRIPTOR_IFACE, "Value");
+
}
static const GDBusPropertyTable desc_properties[] = {
g_free(desc->uuid);
g_free(desc->value);
+ g_free(desc->path);
g_free(desc);
}
struct characteristic *chr;
struct descriptor *desc;
static int id = 1;
- char *desc_path;
- gboolean ret = TRUE;
chr = g_new0(struct characteristic, 1);
chr->uuid = g_strdup(chr_uuid);
desc = g_new0(struct descriptor, 1);
desc->uuid = g_strdup(desc_uuid);
+ desc->path = g_strdup_printf("%s/descriptor%d", chr->path, id++);
- desc_path = g_strdup_printf("%s/descriptor%d", chr->path, id++);
- if (!g_dbus_register_interface(connection, desc_path,
+ if (!g_dbus_register_interface(connection, desc->path,
GATT_DESCRIPTOR_IFACE,
NULL, NULL, desc_properties,
desc, desc_iface_destroy)) {
GATT_CHR_IFACE);
desc_iface_destroy(desc);
- ret = FALSE;
+ return FALSE;
}
- g_free(desc_path);
-
- return ret;
+ return TRUE;
}
static char *register_service(const char *uuid)