public inbox for linux-bluetooth@vger.kernel.org
 help / color / mirror / Atom feed
From: Tom Patzig <tpatzig@suse.de>
To: BlueZ development <bluez-devel@lists.sourceforge.net>
Subject: [Bluez-devel] ListTrust Method for org.bluez.Service
Date: Wed, 15 Aug 2007 21:34:07 +0200	[thread overview]
Message-ID: <46C3552F.8000505@suse.de> (raw)

[-- Attachment #1: Type: text/plain, Size: 864 bytes --]

Hi,

to not only get listed the global trusted devices, which also depends on 
your adapter (/var/lib/%mac/trusts), there is no method for the service 
interface to just list the trusted devices for this service 
(/var/lib/00::00::00::00::00::00/trusts).
Also, when you set trusts with the service interface to single services, 
then you won't see this trusts with the adapter ListTrusts.

I have written a method, according to the list_trusted method of the 
adapter interface.
So with this, u can do for example calls to only get the trusted input 
devices.
For the implemantation in the GUI frontend, it would be great to have 
this function within the next release.

What do you think?

-- 
--------------------------------------------
Tom Patzig <tpatzig@suse.de>
Novell /  SUSE
SUSE LINUX Products GmbH - Nürnberg - AG Nürnberg - HRB 16746 - GF: Markus Rex


[-- Attachment #2: service_listTrusted.diff --]
[-- Type: text/x-patch, Size: 1438 bytes --]

--- hcid/dbus-service.c
+++ hcid/dbus-service.c
@@ -566,6 +566,39 @@
 	return send_message_and_unref(conn, reply);
 }
 
+static DBusHandlerResult list_trusted(DBusConnection *conn,
+                                        DBusMessage *msg, void *data)
+{
+        struct service *service = data;
+        DBusMessage *reply;
+        GSList *trusts, *l;
+        char **addrs;
+        int len;
+
+        reply = dbus_message_new_method_return(msg);
+        if (!reply)
+                return DBUS_HANDLER_RESULT_NEED_MEMORY;
+        trusts = list_trusts(BDADDR_ANY, service->ident);
+
+        addrs = g_new(char *, g_slist_length(trusts));
+
+        for (l = trusts, len = 0; l; l = l->next, len++)
+                addrs[len] = l->data;
+
+        dbus_message_append_args(reply,
+                        DBUS_TYPE_ARRAY, DBUS_TYPE_STRING,
+                        &addrs, len,
+                        DBUS_TYPE_INVALID);
+
+        g_free(addrs);
+        g_slist_foreach(trusts, (GFunc) g_free, NULL);
+        g_slist_free(trusts);
+
+        return send_message_and_unref(conn, reply);
+
+
+}
+
 static DBusHandlerResult is_trusted(DBusConnection *conn,
 					DBusMessage *msg, void *data)
 {
@@ -639,6 +672,7 @@
 	{ "SetTrusted",		set_trusted,		"s",	""	},
 	{ "IsTrusted",		is_trusted,		"s",	"b"	},
 	{ "RemoveTrust",	remove_trust,		"s",	""	},
+	{ "ListTrust",		list_trusted,		"",	"as"	},
 	{ NULL, NULL, NULL, NULL }
 };
 

[-- Attachment #3: Type: text/plain, Size: 315 bytes --]

-------------------------------------------------------------------------
This SF.net email is sponsored by: Splunk Inc.
Still grepping through log files to find problems?  Stop.
Now Search log events and configuration files using AJAX and a browser.
Download your FREE copy of Splunk now >>  http://get.splunk.com/

[-- Attachment #4: Type: text/plain, Size: 164 bytes --]

_______________________________________________
Bluez-devel mailing list
Bluez-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/bluez-devel

                 reply	other threads:[~2007-08-15 19:34 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=46C3552F.8000505@suse.de \
    --to=tpatzig@suse.de \
    --cc=bluez-devel@lists.sourceforge.net \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox