Appendix B. Bluetooth Console

Bluetooth console makes it possible to use the PyS60 interactively from your PC. Instead of the typical cycle of 'edit, upload, test', you can evaluate lines of code in real-time on the phone.

This approach is particularly useful for experimenting with the standard modules. You can try out different functions and parameter combinations without having to edit or upload any files. Since the lines are executed on the actual device, you gain a realistic understanding of how long various functions take to execute and how different UI elements look on the screen.

It is also a rapid way to debug custom modules by you and other third-party developers. You can upload a new module to the phone, import it into the Bluetooth console and start testing its functions one by one. If exceptions occur, they are much easier to parse on the large display of your PC than on the phone.

If you are interested in some hard-core hacking, note that you can automate testing by the Bluetooth console since, after all, the console is just receiving lines of text from the PC. Instead of you typing the lines, they could be generated by, say, a Python script running on your computer. This might open up new possibilities for rapid prototyping and automated testing.

If interacting with the PyS60 shell programmatically from your PC sounds useful to you, have a look at the following files that are included in the PyS60 source distribution: extras/examples/simplebtconsole.py and core/Lib/btconsole.py ...

Get Mobile Python: Rapid Prototyping of Applications on the Mobile Platform now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.