<html>
<head>
<style>
P
{
margin:0px;
padding:0px
}
body
{
FONT-SIZE: 10pt;
FONT-FAMILY:Tahoma
}
</style>
</head>
<body>Thanks for that Simon, Greatly appreciate the help,<BR>
<BR>
Have you done much work with the bluez dbus stuff at all?<BR>
<BR>
I'm still a little lost as to how your solution fits into my script, would you mind taking a look at this code? basically 'result2' is the byte array that is returned.<BR>
<BR><FONT size=1>
#!/usr/bin/python<BR>
import dbus<BR>
import array<BR>
bus = dbus.SystemBus()<BR>
obj = bus.get_object('org.bluez', '/org/bluez')<BR>
obj = bus.get_object('org.bluez', '/org/bluez/hci0')<BR>
adapter = dbus.Interface(obj, 'org.bluez.Adapter')<BR>
# Search For Obex Push Protocol<BR>
print('Start Scan...')<BR>
result = adapter.GetRemoteServiceHandles('00:17:B0:A0:E7:09', 'opp')<BR>
result2 = adapter.GetRemoteServiceRecord('00:17:B0:A0:E7:09', result[0])<BR>
print('Done Scanning.')<BR>
</FONT> <BR>
How would i integrate your suggested solution into this?<BR>
<BR>
Thanks again Simon, *buys him a beer.<BR>
<BR>
Rob<BR><BR><BR>
<HR id=stopSpelling>
<BR>
> Date: Fri, 20 Apr 2007 15:12:09 +0100<BR>> From: simon.mcvittie@collabora.co.uk<BR>> To: dbus@lists.freedesktop.org<BR>> Subject: Re: Array{byte}<BR>> <BR>> -----BEGIN PGP SIGNED MESSAGE-----<BR>> Hash: SHA1<BR>> <BR>> On Fri, 20 Apr 2007 at 10:39:04 +0000, Robert Rawlins wrote:<BR>> > I've got a function from the dbus bluez api that returns a byte array but i'm a little lost as to how I can extract any useful information from it :-D I'm new to both dbus and python but picking thing up quite nicely.<BR>> <BR>> If you're willing to depend on dbus-python >= 0.80 (recommended):<BR>> <BR>> >>> bytearray = bluez_object.MyMethod(byte_arrays=True)<BR>> >>> bytearray<BR>> dbus.ByteArray('\x01\x02\x03')<BR>> >>> issubclass(dbus.ByteArray, str)<BR>> True<BR>> <BR>> See http://dbus.freedesktop.org/doc/dbus-python/doc/tutorial.html#return-values-and-the-byte-arrays-and-utf8-strings-options for details.<BR>> <BR>> If you badly need to be backwards compatible:<BR>> <BR>> >>> list_of_bytes = bluez_object.MyMethod()<BR>> >>> list_of_bytes<BR>> dbus.Array([dbus.Byte(1), dbus.Byte(2), dbus.Byte(3)], signature='y')<BR>> >>> stringified = ''.join(map(chr, list_of_bytes))<BR>> >>> stringified<BR>> '\x01\x02\x03'<BR>> -----BEGIN PGP SIGNATURE-----<BR>> Version: GnuPG v1.4.6 (GNU/Linux)<BR>> Comment: OpenPGP key: http://www.pseudorandom.co.uk/2003/contact/ or pgp.net<BR>> <BR>> iD8DBQFGKMo5WSc8zVUw7HYRAo82AJ9Qms1WahNm/xAKMFtSpmvM1U04KwCgkMx1<BR>> ORIaqAc6TwzLSwWq+l0wHjY=<BR>> =eV2a<BR>> -----END PGP SIGNATURE-----<BR>> _______________________________________________<BR>> dbus mailing list<BR>> dbus@lists.freedesktop.org<BR>> http://lists.freedesktop.org/mailman/listinfo/dbus<BR><BR><br /><hr />Be one of the first to try Windows Live Mail. <a href='http://ideas.live.co.uk/ProgramPage.aspx?versionId=5d21c51a-b161-4314-9b0e-4911fb2b2e6d&pageId=0' target='_new'>Windows Live Mail.</a></body>
</html>