>Selected Archives

Using the Python for Series 60 Bluetooth Console from OS X

[Note: This post was originally written for OS X 10.3, but now includes an "updated" section for OS X 10.4. The comments address the Bluetooth setting changes in OS X 10.5.]

The documentation shipping with Python for Series 60 doesn't cover using the Bluetooth Console with Mac OS X; However, connecting is possible using just pre-installed Apple software. Step one is to make sure your machine has already been paired with your phone, that Bluetooth is turned on, and that you're Mac is discoverable. Pairing is done using the "Bluetooth Setup Assistant" in /Applications/Utilities/; The other settings are done from the Bluetooth control panel in System Preferences. Next, fire up "Bluetooth Serial Utility" which is also hopefully in /Applications/Utilities/. Using the Serial Utility, you'll setup an incoming RS-232 port. Give it a name you'll remember. I ran into a little bit of trouble connecting when having multiple incoming ports like this, but I imagine it can be done. With just one port open, I had no trouble.

Once you create and name your new incoming Bluetooth port, you should have a matching device link at "/dev/tty.portname". From a Terminal (ie., /Applications/Utilities/ you can then use the command "screen /dev/tty.portname" to redirect that port to the terminal. With this part ready, you can now fire up on the phone and run the "Bluetooth console" script. Use the BTConsole application to search for available Bluetooth devices and choose your Mac from the list. The BTConsole application will likely dump some address and port discovery info to the screen, but eventually you should see a "Connected" message in your Mac Terminal window followed shortly there after by some directions and a Python prompt.

From the Mac, "Control-d" will exit the BTConsole and shut down the process on the phone. "Control-a Control-" (or "Control-a K") will shut down the 'screen' process.


[Update 2006-02-13] "Bluetooth Serial Utility" is no longer installed with new versions of OS X. To set this up on OS X 10.4.x, go to "System Preferences :: Bluetooth" and open the "Sharing" tab. From there, click the "Add Serial Port Service" button in the lower-left corner of the dialog box. A new service should appear in the text area above. From there, you can change the name to something memorable, like "bt_console". Make sure to change the "Type" from "Modem" to "RS-232", and be sure that the "On" checkbox is checked. If you're currently not listening for Bluetooth Series connections, you'll need to activate it with the "Start Serial Port" button. If your machine is already listening, the button will read "Stop Serial Port", which you won't want to click.

Also new since this post, the Bluetooth Console is now built-in to Python for S60. It's under the Options menu.