public inbox for linux-bluetooth@vger.kernel.org
 help / color / mirror / Atom feed
From: Henry Owens <owens.henry@googlemail.com>
To: linux-bluetooth@vger.kernel.org
Subject: Bluetooth SPP on Nokia N900 (Maemo 5)
Date: Tue, 2 Mar 2010 16:26:51 +0000	[thread overview]
Message-ID: <aa6ee971003020826m7e6db9b2jd5b9456a1aa1d368@mail.gmail.com> (raw)

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.

             reply	other threads:[~2010-03-02 16:26 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-03-02 16:26 Henry Owens [this message]
2010-03-02 17:14 ` Bluetooth SPP on Nokia N900 (Maemo 5) Vinicius Gomes
2010-03-05 10:52   ` Henry Owens

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=aa6ee971003020826m7e6db9b2jd5b9456a1aa1d368@mail.gmail.com \
    --to=owens.henry@googlemail.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