Python programming with Symbian OS S60 and connecting Bluetooth Console




Requirement :
1. A mobile phone running Symbian S60 [ Mostly Nokia phones ]
2. A laptop having Bluetooth or desktop with the Bluetooth dongle attached and running fedora. [Windows will also do, but this discussion is not for windows]
Now python is my latest love. To install python in you symbian S60 phone (mostly Nokia phones) follow this link (choose the appropriate version of python according to your phone's os version). Nokia N70, N73 are mostly symbian s60 second edition feature pack 2. Anyway if you are confused about the version of Symbian OS in your Nokia phone follow these steps.

From Menu >> Tools >> Utilities >> About [Here you will find the OS version (Tested in my Nokia N76 might be a bit different in other models)]

Download two files from the above link :

1. Python for S60
2. Python script shell

Both the files are .SIS files and you can easily push the files to your mobile phone using obexftp.

If you don't know how to use obexftp (which I'll cover later) then from gnome you need to right click on the file and click on send to >> select send as Bluetooth >> Send (phone model).

Now you will receive the files as a text message. Install the files and now you are done installing python in your Nokia phone.

You can program python in your phone using the interactive console. Now this method is very much tiresome.
So all we need is a bluetooth console connection with our laptop so that we will write the program in our laptop but it will run in our phone.

For this we need to setup a serial port emulator in our Laptop.
We will use rfcomm for emulating serial port connection over bluetooth.

For this we use the following command:

mknod -m 76 rfcomm0 c 216 0

Now use the following commnd:

rfcomm listen /dev/rfcomm0 3
[And you will get the out put as following]
Waiting for connection on channel 3

At this point from the phone's python application select 'Bluetooth Console' and then select the Laptop to connect to.
Once you have selected that follow instructed steps and you are done with emulated bluetooth connection.
The following screen shot shows how the terminal will look after the connection is setup.



Now what you need is to setup minicom in fedora to bring up the python console to the laptop.
Before firing minicom we need some setup. So, run the following command:

minicom -s

And follow as given in the screen shots below ------->

1.

2.


Save and Exit.

Now run the following command:

minicom -o /dev/rfcomm0

Voila !! You are done and you get your phone's python console on your Laptop




Now test it using these python (Python for S60) codes:
>>> import appuifw
>>> appuifw.note(u"Hello Jibesh","info")

Happy Pythoning

Comments

Popular Posts