You Are Here:

Community: Developer Discussion Boards

#1 Old Bluetooth Name - 2008-05-06, 13:53

Join Date: Apr 2008
Posts: 16
bmichel's Avatar
bmichel
Offline
Registered User
This might seem quite obvious; but if it exists, the documentation doesn't clearly state it. Here goes:

How can I get in PyS60 the Bluetooth name and address of the mobile phone?
Reply With Quote

#2 Old Re: Bluetooth Name - 2008-05-06, 14:01

Join Date: Mar 2008
Posts: 127
jtullis
Offline
Regular Contributor
Take a look at the Miso module. Documentation here

local_bt_address()
Returns the local Bluetooth address.

Only works with Bluetooth enabled.

local_bt_name()
Returns the local Bluetooth name.

Only works with Bluetooth enabled.

Code:
import miso

print miso.local_bt_address()
print miso.local_bt_name()
Last edited by jtullis : 2008-05-06 at 14:07.
Reply With Quote

#3 Old Re: Bluetooth Name - 2008-05-06, 14:10

Join Date: Apr 2008
Posts: 16
bmichel's Avatar
bmichel
Offline
Registered User
Quote:
Originally Posted by jtullis View Post
Take a look at the Miso module. Documentation here

local_bt_address()
Returns the local Bluetooth address.

Only works with Bluetooth enabled.

local_bt_name()
Returns the local Bluetooth name.

Only works with Bluetooth enabled.

Code:
import miso

print miso.local_bt_address()
print miso.local_bt_name()
Works great. Thanks.

Here's one not-so-elegant solution to check if bt is connected:
Code:
def bt_connected():
  try:
    miso.local_bt_name()
  except:
    return False
  return True
Let me know if there's another way to do that.

Note: I wonder why such basic functions are not in the PyS60 native libraries.
Last edited by bmichel : 2008-05-06 at 14:49.
Reply With Quote

#4 Old Re: Bluetooth Name - 2008-05-06, 15:16

Join Date: Mar 2008
Posts: 127
jtullis
Offline
Regular Contributor
Yes, I was just about to suggest you use try/except. The Mobile Python book recommends it: "Especially when handling files, Bluetooth and network connections...exceptions are common" (p113)
Reply With Quote
Reply « Previous Thread | Next Thread »
Display Modes
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Rate This Thread
Rate This Thread:

Posting Rules

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

vB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Forum Jump
Similar Threads
Thread Thread Starter Forum Replies Last Post
How To Make The S60 Emulator See My USB Bluetooth Dongle ? Mo7ammed_01 Bluetooth Technology 9 2009-07-17 03:33
Q: How to use NCF 1.2 bluetooth with S60 3rd Edition for Symbian C++ MR jimgilmour1 Bluetooth Technology 35 2009-04-11 15:36
How To Make The S60 Emulator See My USB Bluetooth Dongle ? Mo7ammed_01 Symbian Tools & SDKs 1 2006-07-25 01:14
How To Make The S60 Emulator See My USB Bluetooth Dongle ? Mo7ammed_01 Symbian Networking & Messaging 1 2006-07-25 01:12
Nokia 7650 support Bluetooth audo? ovjo12 Bluetooth Technology 5 2003-07-17 19:50

Rate This

 
Bookmark this page: DeliciousDiggFacebookGoogleYahooStumbleUponRedditDiigoTechnocratiTwitter  Share this page Share this page Print this Page Print this page Invite a friend Invite a friend
京ICP备05048969号    Email Newsletters Press Terms & Conditions Privacy Policy Sitemap Contact Us © 2009 Nokia