public inbox for linux-bluetooth@vger.kernel.org
 help / color / mirror / Atom feed
* Bluetooth SPP on Nokia N900 (Maemo 5)
@ 2010-03-02 16:26 Henry Owens
  2010-03-02 17:14 ` Vinicius Gomes
  0 siblings, 1 reply; 3+ messages in thread
From: Henry Owens @ 2010-03-02 16:26 UTC (permalink / raw)
  To: linux-bluetooth

Hi All,

My first mail to this list. I am currently trying to get a bluetooth
SPP connection going on my Nokia N900, but I'm having some
difficulties using the examples on the HOWTO Wiki.

Specifically, I get an error related to the ActivateService call in
the example - I have seen reference to this being obselete in Bluez
4.x, is this the problem in the example code?

If so, how could the code be rewritten to allow a connection (I have
no prior experience with BT programming, but am comfortable in
Python).

The code at the moment is:

import dbus
import time
import sys
bus = dbus.SystemBus()
bmgr = dbus.Interface(bus.get_object('org.bluez', '/org/bluez'),
'org.bluez.Manager')
bus_id = bmgr.ActivateService('serial')
serial = dbus.Interface(bus.get_object(bus_id, '/org/bluez/serial'),
'org.bluez.serial.Manager')
# Service connection, read the serial API to check the available patterns
if (len(sys.argv) < 2):
        print "Usage: %s <address> [service]" % (sys.argv[0])
        sys.exit(1)
address = sys.argv[1]
if (len(sys.argv) < 3):
        service = "spp"
else:
        service = sys.argv[2]
# Bind to the default local adapter
device = serial.ConnectService(address, service)
print "Connected %s to %s" % (device, address)
print "Press CTRL-C to disconnect"
try:
        time.sleep(1000)
        print "Terminating connection"
except:
        pass
serial.DisconnectService(device)


Regards,
Henry.

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2010-03-05 10:52 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-03-02 16:26 Bluetooth SPP on Nokia N900 (Maemo 5) Henry Owens
2010-03-02 17:14 ` Vinicius Gomes
2010-03-05 10:52   ` Henry Owens

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox