Feeds

Punch out your own code on a Greenphone

We get keyed up about Trolltech's Qtopia

High performance access to file storage

Trolltech's Qtopia is a commonly used mobile Linux. It's used in a large number of different devices – from Sony's mylo communicator, to Motorola and Panasonic's Linux phones. While you might not have come across it in the Carphone Warehouse, it's a common platform in one of the biggest mobile markets going – China.

But how do you develop for a phone platform that's not widely available over here? And how do you develop applications that link deep into a phone's operating system – and even change the behaviour of that OS? You could work with a phone virtual machine (after all, Microsoft's phone simulators are actually custom versions of Virtual PC). Trolltech is offering another approach – the Greenphone, a phone designed for developers along with a development platform that makes it easy to work with all aspects of the hardware.

Picture of the Greenphone.

The Greenphone hardware compares favourably with most consumer devices, and it's built around a 312MHz XScale processor, with 64MB of RAM and 128 MB of Flash (there's also a Mini-SD card slot for up to 512MB of extra storage). Unlike most phone format devices, there's a QVGA touch screen, so you can develop applications that work on keypad-less devices. Connectivity is through a GPRS modem and USB. While there's Bluetooth and a 1.3 Mpixel camera, there's no WiFi. The device costs $695, with development packages adding at least $195 to the cost.

Open the box and you'll find a CD with the SDK (alternatively you can download it from www.qtopia.net). You shouldn't compare the Greenphone to your everyday mobile SDK. This one lets you work with the phone kernel, as well as the applications – and then deploy it to actual hardware.

However, it's not a true open phone; it's an open development platform for what may end up as closed devices. That may seem a contradiction in terms, but when you're developing applications that need deep integration with a phone's hardware it's actually a key requirement.

Trolltech have made a smart move with the Greenphone's SDK. Instead of configuring various packages for a selection of operating systems (and then having to support them), they've made a smart decision: virtualising a development platform. What Trolltech has ended up delivering is a pre-configured Debian Linux environment. This has been filled with development tools and documentation, and then turned into a VMware image. There's no need for Trolltech to distribute VMware, the free VMware player is widely available.

Shows the Qtopia development environment.

Once you've installed the Trolltech image from the bundled CD-ROM (or from the qtopia.net web site), you can start developing code straight away. The SDK contains all the compilers you'll need, along with source code and plenty of documentation. The amount of code you'll get depends on the version you've chosen – the Community edition only contains the code for the applications, you'll need to Professional edition for the full platform source. If you've worked with QT, you'll find Qtopia a very familiar environment. It's made easier with plenty of online documentation and a design tool for building UI components. There's even a set of tools for managing internationalisation (something that's increasingly important for mobile application development).

Building applications is easy enough, and the bundled sample code gives you enough of a jump-start. Applications are developed in C++ and the Qtopia variant of QT. Application development begins in Trolltech's own Designer. Start by opening a new project, and then creating its UI using the Designer. Trolltech provide most of the controls you'll need for most classes of phone application. You'll need to drag and drop components onto the design surface, and Qtopia will make sure they're displayed correctly on the Greenphone. Once you've built the UI, all you need to do is wire up the UI to your business logic. The SDK comes with the KDevelop IDE, so you can use this to write your code. If you've worked with QT, you'll find Qtopia development familiar – using its SIGNAL and SLOT to link controls to functions. We used this to write a simple Hello World-style application that took information from a form and displayed it using a LCD-style display font. We connected a pushButton control to code that handled both form content and display:

Connect(pushButton, SIGNAL(clicked()), this, SLOT(showValue()));

The showValue() function takes information out of a line edit control and displays it on the LCD control. We can do this with a mix of QT components and C++:

QString value_str = lineEdit->text();
Float value = value_str.toFLoat();
lcdNumber->display(amount);

Compilation is slightly different from standard C++. You'll need to make sure that you set up the appropriate Qtopia environment variables, and use the qtopiamake command before running a standard make. Qtopia certainly makes it easier to deliver C++ mobile applications, handling complex user interface issues while giving its control components a relatively simple API. Developers used to Eclipse or Visual Studio may find it hard to get to grips with the Greenphone SDK – building and deploying an application takes two separate development tools and a command line...

Shows a Hello World application.

The Greenphone SDK can be connected to the Greenphone using a USB connection. There's no need to worry about Windows or Linux drivers – the SDK handles communications for you, though you'll need to turn on USB Ethernet networking on the Greenphone before making a connection. The SDK's command line tools handle packaging and installing your applications on the Greenphone, ready for use. This is not a consumer phone, it's a tool for platform developers and developers who need access to phone hardware. If you're building Linux Bluetooth applications that use a phone's camera, then this is an ideal device for making sure all the various components of your application work together in the constrained environment of a mobile device. It'll be interesting to see how the Greenphone competes and compares with the recently released OpenMoko developer hardware.®

High performance access to file storage

More from The Register

next story
Windows 8.1, which you probably haven't upgraded to yet, ALREADY OBSOLETE
Pre-Update versions of new Windows version will no longer support patches
Android engineer: We DIDN'T copy Apple OR follow Samsung's orders
Veep testifies for Samsung during Apple patent trial
OpenSSL Heartbleed: Bloody nose for open-source bleeding hearts
Bloke behind the cockup says not enough people are helping crucial crypto project
Microsoft lobs pre-release Windows Phone 8.1 at devs who dare
App makers can load it before anyone else, but if they do they're stuck with it
Half of Twitter's 'active users' are SILENT STALKERS
Nearly 50% have NEVER tweeted a word
Windows XP still has 27 per cent market share on its deathbed
Windows 7 making some gains on XP Death Day
Internet-of-stuff startup dumps NoSQL for ... SQL?
NoSQL taste great at first but lacks proper nutrients, says startup cloud whiz
US taxman blows Win XP deadline, must now spend millions on custom support
Gov't IT likened to 'a Model T with a lot of things on top of it'
prev story

Whitepapers

Mainstay ROI - Does application security pay?
In this whitepaper learn how you and your enterprise might benefit from better software security.
Five 3D headsets to be won!
We were so impressed by the Durovis Dive headset we’ve asked the company to give some away to Reg readers.
3 Big data security analytics techniques
Applying these Big Data security analytics techniques can help you make your business safer by detecting attacks early, before significant damage is done.
The benefits of software based PBX
Why you should break free from your proprietary PBX and how to leverage your existing server hardware.
Mobile application security study
Download this report to see the alarming realities regarding the sheer number of applications vulnerable to attack, as well as the most common and easily addressable vulnerability errors.