--- health/hdp.c | 45 +++++++++++++++++++++++++++++++++++++++++++++ 1 files changed, 45 insertions(+), 0 deletions(-) diff --git a/health/hdp.c b/health/hdp.c index cb05324..10621c4 100644 --- a/health/hdp.c +++ b/health/hdp.c @@ -88,6 +88,25 @@ static struct hdp_device *find_device(GSList *devices, struct btd_device *dev) return NULL; } +static struct hdp_link *find_health_link(struct hdp_adapter *adapter, + const char *link_path) +{ + struct hdp_instance *hdpi; + struct hdp_link *hdpl; + GSList *l, *ll; + + for (l = adapter->instances; l; l = l->next) { + hdpi = l->data; + for (ll = hdpi->hlink; ll; ll = ll->next) { + hdpl = ll->data; + if (!strcmp(hdpl->path, link_path)) + return hdpl; + } + } + + return NULL; +} + static int hdp_instance_idcmp(gconstpointer instance, gconstpointer p) { const struct hdp_instance *hdpi = instance; @@ -562,10 +581,36 @@ static DBusMessage *hdp_connect(DBusConnection *conn, "Error getting remote information"); } +static DBusMessage *hdp_disconnect(DBusConnection *conn, + DBusMessage *msg, void *user_data) +{ + struct hdp_device *device = user_data; + struct hdp_link *hlink; + const char *path; + const gboolean *del; + + if (!dbus_message_get_args(msg, NULL, DBUS_TYPE_OBJECT_PATH, &path, + DBUS_TYPE_BOOLEAN, &del, + DBUS_TYPE_INVALID)){ + return g_dbus_create_error(msg, + ERROR_INTERFACE ".InvalidArguments", + "Invalid arguments in method call"); + } + + hlink = find_health_link(device->hdp_adapter, path); + if (!hlink) + return g_dbus_create_error(msg, ERROR_INTERFACE ".HealthError", + "Health link does not found"); + + return g_dbus_create_error(msg, ERROR_INTERFACE ".HealthError", + "Not yet implemented"); +} + static GDBusMethodTable device_methods[] = { { "GetHealthInstances", "", "aa{sv}", get_health_instances, G_DBUS_METHOD_FLAG_ASYNC }, { "Connect", "uu", "o", hdp_connect, G_DBUS_METHOD_FLAG_ASYNC }, + { "Diconnect", "ob", "", hdp_disconnect }, { NULL } }; -- 1.6.3.3 -- To unsubscribe from this list: send the line "unsubscribe linux-bluetooth" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html