From: Luiz Augusto von Dentz <luiz.dentz@gmail.com>
To: linux-bluetooth@vger.kernel.org
Subject: [PATCH BlueZ 3/5] Add simple-player test script
Date: Tue, 4 Oct 2011 01:01:16 +0300 [thread overview]
Message-ID: <1317679278-19471-3-git-send-email-luiz.dentz@gmail.com> (raw)
In-Reply-To: <1317679278-19471-1-git-send-email-luiz.dentz@gmail.com>
From: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>
---
test/simple-player | 56 ++++++++++++++++++++++++++++++++++++++++++++++++++++
1 files changed, 56 insertions(+), 0 deletions(-)
create mode 100755 test/simple-player
diff --git a/test/simple-player b/test/simple-player
new file mode 100755
index 0000000..f483897
--- /dev/null
+++ b/test/simple-player
@@ -0,0 +1,56 @@
+#!/usr/bin/python
+
+import sys
+import dbus
+import dbus.service
+import dbus.mainloop.glib
+import gobject
+
+class Player(dbus.service.Object):
+ @dbus.service.method("org.bluez.MediaPlayer",
+ in_signature="sv", out_signature="")
+ def SetProperty(self, key, value):
+ print "SetProperty (%s, %s)" % (key, value)
+ return
+
+if __name__ == '__main__':
+ dbus.mainloop.glib.DBusGMainLoop(set_as_default=True)
+
+ bus = dbus.SystemBus()
+ manager = dbus.Interface(bus.get_object("org.bluez", "/"),
+ "org.bluez.Manager")
+
+ if len(sys.argv) > 1:
+ path = manager.FindAdapter(sys.argv[1])
+ else:
+ path = manager.DefaultAdapter()
+
+ media = dbus.Interface(bus.get_object("org.bluez", path),
+ "org.bluez.Media")
+
+ path = "/test/player"
+ player = Player(bus, path)
+ mainloop = gobject.MainLoop()
+
+ properties = dbus.Dictionary({ "Equalizer" : "off",
+ "Repeat" : "off",
+ "Shuffle" : "off",
+ "Scan" : "off",
+ "Status" : "playing",
+ "Position" : dbus.UInt32(0) })
+
+ print properties
+
+ metadata = dbus.Dictionary({ "Title" : "Title",
+ "Artist" : "Artist",
+ "Album" : "Album",
+ "Genre" : "Genre",
+ "NumberOfTracks" : dbus.UInt32(10),
+ "Number" : dbus.UInt32(1),
+ "Duration" : dbus.UInt32(10000) })
+
+ print metadata
+
+ media.RegisterPlayer(path, properties, metadata)
+
+ mainloop.run()
--
1.7.6.4
next prev parent reply other threads:[~2011-10-03 22:01 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-10-03 22:01 [PATCH BlueZ 1/5] Fix not being able to register pdu handlers Luiz Augusto von Dentz
2011-10-03 22:01 ` [PATCH BlueZ 2/5] AVRCP: move MediaPlayer to adapter object Luiz Augusto von Dentz
2011-10-04 0:32 ` Lucas De Marchi
2011-10-03 22:01 ` Luiz Augusto von Dentz [this message]
2011-10-03 22:01 ` [PATCH BlueZ 4/5] Remove MediaPlayer interface from control-api.txt Luiz Augusto von Dentz
2011-10-03 22:01 ` [PATCH BlueZ 5/5] Remove test-media-player Luiz Augusto von Dentz
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=1317679278-19471-3-git-send-email-luiz.dentz@gmail.com \
--to=luiz.dentz@gmail.com \
--cc=linux-bluetooth@vger.kernel.org \
/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;
as well as URLs for NNTP newsgroup(s).