×

Discussion Board

Results 1 to 7 of 7
  1. #1
    Registered User
    Join Date
    Oct 2010
    Location
    Arendal, Norway
    Posts
    28

    How (if possible) could list available bluetooth devices?

    I just want to make a small and nifty python app for my N900 that every 5 mins checks the bluetooth and if it can find a device named "Larsey-PC" prints out "Larsey-PC in range.".

    Could this be done (and how)? Its a smaller part of a project im working on, i want my N900 to do stuff when it comes in range of different devices that broadcasts a bluetooth signal.

    Im also thinking of using the IR sensor on the N900, anyone have any links?

    EDIT: after a little googling i found another lib: python-bluetooth!

    installation was:

    Code:
    sudu gainroot
    apt-get install python-bluetooth
    after that you could write yourself a nice little 6-liners:

    Code:
    import bluetooth
    
    nearby_devices = bluetooth.discover_devices()
    
    for nearby_device in nearby_devices:
      print bluetooth.lookup_name( nearby_device )
    *note: ur bluetooth must be turned on or u could run code from http://wiki.maemo.org/Phone_control#Enable
    Last edited by Larsey; 2010-10-14 at 11:28.
    Doing stuff on my Nokia N900...

  2. #2
    Registered User
    Join Date
    Oct 2010
    Location
    Arendal, Norway
    Posts
    28

    Re: How (if possible) could list available bluetooth devices?

    I found http://code.google.com/p/bluez-python/ and a good example to discover devices... but here comes a pretty newb question: how do I install bluez lib? i get the "ImportError: No module named bluez" because i have not installed it (and dont know how to)
    Doing stuff on my Nokia N900...

  3. #3
    Super Contributor
    Join Date
    Oct 2008
    Location
    INDIA
    Posts
    2,326

    Re: How (if possible) could list available bluetooth devices?

    See this for N900 and bluetooth in Python : http://blogs.nokia.com/pushn900/2010...-code-example/

    How to install python-bluez is explained there.

    Best regards,

  4. #4
    Registered User
    Join Date
    Oct 2010
    Location
    Arendal, Norway
    Posts
    28

    Re: How (if possible) could list available bluetooth devices?

    Follow up question (to anyone), what is the difference between the libs python-bluez and python-bluetooth?
    Doing stuff on my Nokia N900...

  5. #5
    Registered User
    Join Date
    May 2010
    Posts
    2

    Re: How (if possible) could list available bluetooth devices?

    Hi!
    I'd need some help with pys60 and bluetooth. I'd like to control a Lego Mindstorms NXT via bluetooth using direct commands. That means that i have to transfer some numbers(codes) via bluetooth and then the robot does it's work. I was trying the socket(AF_BT, SOCK_STREAM) function and also the lightblue.socket() function, but they don't accept numbers as argument. If i convert the numbers to string first, it changes them to their unicode (or ascii, i don't know exactly) code, so the robot does nothing. I tried to send those strings whose character code is exactly what i want to transfer, but there are characters (like NULL) that i can't write down. There must be a way to transfer numbers somehow. Somebody please help me, i'm new in pys60.
    Thank You!
    Attila

  6. #6
    Registered User
    Join Date
    May 2010
    Posts
    2

    Re: How (if possible) could list available bluetooth devices?

    by the time i managed to resolve it: chr(code)

  7. #7
    Registered User
    Join Date
    Oct 2010
    Location
    Arendal, Norway
    Posts
    28

    Re: How (if possible) could list available bluetooth devices?

    Thank you for trashing my thread... how rude of you!
    Doing stuff on my Nokia N900...

Similar Threads

  1. List of Bluetooth devices and saving it using FileConnection
    By eian@nokia in forum Mobile Java General
    Replies: 7
    Last Post: 2010-08-03, 11:09
  2. Replies: 4
    Last Post: 2009-08-21, 11:30
  3. [Moved] bluetooth application for nokia bluetooth capable devices
    By cutescar2nis in forum Bluetooth Technology
    Replies: 2
    Last Post: 2008-08-05, 09:23
  4. List devices module socket
    By akus in forum Python
    Replies: 0
    Last Post: 2008-01-24, 13:00
  5. List of devices
    By RogerJFX in forum Mobile Java General
    Replies: 4
    Last Post: 2005-08-30, 13:02

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •