* [PATCH 0/1] Add capability option to simple-agent @ 2011-06-14 7:19 Dmitriy Paliy 2011-06-14 7:19 ` [PATCH] " Dmitriy Paliy 0 siblings, 1 reply; 4+ messages in thread From: Dmitriy Paliy @ 2011-06-14 7:19 UTC (permalink / raw) To: linux-bluetooth, luiz.dentz Hi, The patch adds capability option (-c, --capability) to simple-agent. There is one point of concern as 'optparse module is deprecated since version 2.7: The optparse module is deprecated and will not be developed further; development will continue with the argparse module.' Any comments regarding use of this module are appreciated. BR, Dmitriy ^ permalink raw reply [flat|nested] 4+ messages in thread
* [PATCH] Add capability option to simple-agent 2011-06-14 7:19 [PATCH 0/1] Add capability option to simple-agent Dmitriy Paliy @ 2011-06-14 7:19 ` Dmitriy Paliy 2011-06-15 12:48 ` Johan Hedberg 0 siblings, 1 reply; 4+ messages in thread From: Dmitriy Paliy @ 2011-06-14 7:19 UTC (permalink / raw) To: linux-bluetooth, luiz.dentz; +Cc: Dmitriy Paliy A new option is added to simple-agent facilitating use of "DisplayOnly", "DisplayYesNo", "KeyboardOnly" and "NoInputNoOutput" agent capabilities. --- test/simple-agent | 24 +++++++++++++++++------- 1 files changed, 17 insertions(+), 7 deletions(-) diff --git a/test/simple-agent b/test/simple-agent index f2cc3dd..8d65860 100755 --- a/test/simple-agent +++ b/test/simple-agent @@ -6,6 +6,7 @@ import sys import dbus import dbus.service import dbus.mainloop.glib +from optparse import OptionParser class Rejected(dbus.DBusException): _dbus_error_name = "org.bluez.Error.Rejected" @@ -88,8 +89,17 @@ if __name__ == '__main__': manager = dbus.Interface(bus.get_object("org.bluez", "/"), "org.bluez.Manager") - if len(sys.argv) > 1: - path = manager.FindAdapter(sys.argv[1]) + capability = "DisplayYesNo" + + parser = OptionParser() + parser.add_option("-c", "--capability", action="store", + type="string", dest="capability") + (options, args) = parser.parse_args() + if options.capability: + capability = options.capability + + if len(args) > 0: + path = manager.FindAdapter(args[0]) else: path = manager.DefaultAdapter() @@ -101,17 +111,17 @@ if __name__ == '__main__': mainloop = gobject.MainLoop() - if len(sys.argv) > 2: - if len(sys.argv) > 3: - device = adapter.FindDevice(sys.argv[2]) + if len(args) > 1: + if len(args) > 2: + device = adapter.FindDevice(args[1]) adapter.RemoveDevice(device) agent.set_exit_on_release(False) - adapter.CreatePairedDevice(sys.argv[2], path, "DisplayYesNo", + adapter.CreatePairedDevice(args[1], path, capability, reply_handler=create_device_reply, error_handler=create_device_error) else: - adapter.RegisterAgent(path, "DisplayYesNo") + adapter.RegisterAgent(path, capability) print "Agent registered" mainloop.run() -- 1.7.4.1 ^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: [PATCH] Add capability option to simple-agent 2011-06-14 7:19 ` [PATCH] " Dmitriy Paliy @ 2011-06-15 12:48 ` Johan Hedberg 2011-06-15 20:02 ` Dmitriy Paliy 0 siblings, 1 reply; 4+ messages in thread From: Johan Hedberg @ 2011-06-15 12:48 UTC (permalink / raw) To: Dmitriy Paliy; +Cc: linux-bluetooth, luiz.dentz Hi Dmitriy, On Tue, Jun 14, 2011, Dmitriy Paliy wrote: > A new option is added to simple-agent facilitating use of "DisplayOnly", > "DisplayYesNo", "KeyboardOnly" and "NoInputNoOutput" agent capabilities. > --- > test/simple-agent | 24 +++++++++++++++++------- > 1 files changed, 17 insertions(+), 7 deletions(-) Applied, thanks. I think you could also fix the mandatory adapter argument to be consistent with the rest of the test scripts so that "./simple-agent <addr>" is equivalent to "./simple-agent -i hci0 <addr>". And please look into this argparser thing to see if we can convert all our scripts to use it (one pre-requisite is that it's present in the python versions of latest mainstream distro releases). Johan ^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] Add capability option to simple-agent 2011-06-15 12:48 ` Johan Hedberg @ 2011-06-15 20:02 ` Dmitriy Paliy 0 siblings, 0 replies; 4+ messages in thread From: Dmitriy Paliy @ 2011-06-15 20:02 UTC (permalink / raw) To: Dmitriy Paliy, linux-bluetooth, luiz.dentz Hi Johan, On Wed, Jun 15, 2011 at 3:48 PM, Johan Hedberg <johan.hedberg@gmail.com> wrote: > Applied, thanks. I think you could also fix the mandatory adapter > argument to be consistent with the rest of the test scripts so that > "./simple-agent <addr>" is equivalent to "./simple-agent -i hci0 <addr>". > And please look into this argparser thing to see if we can convert all > our scripts to use it (one pre-requisite is that it's present in the > python versions of latest mainstream distro releases). Thanks, sounds wise. It looks to me that bonding types would be quite useful in simple-agent. However, how to fit those is not very clear yet. Any opinions would be appreciated. BR, Dmitriy ^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2011-06-15 20:02 UTC | newest] Thread overview: 4+ messages (download: mbox.gz follow: Atom feed -- links below jump to the message on this page -- 2011-06-14 7:19 [PATCH 0/1] Add capability option to simple-agent Dmitriy Paliy 2011-06-14 7:19 ` [PATCH] " Dmitriy Paliy 2011-06-15 12:48 ` Johan Hedberg 2011-06-15 20:02 ` Dmitriy Paliy
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox; as well as URLs for NNTP newsgroup(s).