Archive for June, 2006

Python for Series 60

Sunday, June 11th, 2006

To give myself a break from my studies, I’ve been exploring writing code for my mobile phone. I bought a Series 60 phone at Christmas from a high-street store planning to learn how to program it. Instead I ended up wasting most of the holidays dealing with Carphone Warehouse’s appalling customer service.

(It’s a long story. In brief, the salesman lied to me and sold me the phone on a tariff that was unusable with the handset meaning I couldn’t get network access on it. His manager, an unhelpful thug, refused to accept the return of the phone. It took close to 40 hours of phone calls, letters, emails and visits to stores to cancel the contract and get my money back. The experience left a very bitter taste in my mouth. I will never use Carphone Warehouse again.)

I’ve only scratched the surface of developing C++ apps for Symbian so far but while searching for a way to read GSM cell info (according to the forum posts it looks as if the API is restricted to registered developers who pay) I found that it was simplicity itself to get this data using Python for Series 60.

Learning Python is (yet another) thing on my todo list and after installing it on the phone and trying out a few sample scripts from the web I’m eager to do so.

Although it’s easy to code on your pc and send the finished script to your phone via bluetooth, there is also a way to code directly on the phone from your machine by using the bluetooth console that is included with Nokia’s python installer.

Assuming you have bluetooth up and running already on your Debian box:

$ sdptool add --channel=2 SP
Serial Port service registered
$ rfcomm listen /dev/rfcomm0 2
Waiting for connection on channel 2

Now start python on the phone and select bluetooth console from the options.

Connection from 00:16:4E:CD:09:06 to /dev/rfcomm0
Press CTRL-C for hangup

In a new terminal on the machine start minicom with the following flags

$minicom -s -m

then choose “Serial Port Setup” and set the Serial Device to “/dev/rfcomm0″ and you’re ready to run.

Test with:

import appuifw
appuifw.note(u'Hello world!', 'info')

You should get a “Hello world!” info box popping up on your phone screen.

Now for something more interesting, print the gsm location details of your nearest cell (see how simple this is):

import location
print(location.gsm_location())

Finally to send a text message (replacing 0000000000 below with the real destination number) :

import messaging
messaging.sms_send("0000000000", u"Hello there")

I can see Python coming in very handy for creating rapid prototypes of applications and/or simple applications for private use only. Although I find the low level details you need to know for C++ development fascinating, there’s something undeniably satisfying about being able to write an application that does something powerful in only two or three lines of code.

Brother HL-2030 Printer on Debian

Tuesday, June 6th, 2006

Just bought a new mono laser printer, the Brother HL-2030 and setting it up on Debian was simplicity itself thanks to excellent driver support.

Hop over to the Brother Linux Driver Homepage and follow the appropriate links to download the LPR and CUPS wrapper drivers.

As the FAQ warns, you’ll need a temporary symlink to get the CUPS wrapper to install:

$ dpkg -i brhl2030lpr_1.1.2-3_i386.deb
$ ln -s /etc/init.d/cupsys /etc/init.d/cups
$ dpkg -i cupswrapperhl2030_1.0.0-1_i386.deb
$ rm /etc/init.d/cups

and you’re done.

The drivers are GPL too. No closed source binaries here. Well done Brother! It’s a great printer too and very reasonably priced.

Inform 7 Released

Sunday, June 4th, 2006

Inform 7 has been released, a new version of the langugage used to write Infocom-style text-based adventure games (am I showing my age?). Whereas Inform 6 resembled an OO language, version 7 resembles structured English.

In place of traditional computer programming, the design is built by writing natural English-language sentences:

  1. Martha is a woman in the Vineyard.
  2. The cask is either customs sealed, liable to tax or stolen goods.
  3. The prevailing wind is a direction that varies.
  4. The Old Ice House overlooks the Garden.
  5. A container is bursting if the total weight of things in it is greater than its breaking strain.

Although the exams are over, I still have my project to complete so I probably won’t touch this for a few months but I’m looking forward to exploring it.