Feeds

Punch out your own code on a Greenphone

We get keyed up about Trolltech's Qtopia

Boost IT visibility and business value

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.®

Boost IT visibility and business value

More from The Register

next story
KDE releases ice-cream coloured Plasma 5 just in time for summer
Melty but refreshing - popular rival to Mint's Cinnamon's still a work in progress
Leaked Windows Phone 8.1 Update specs tease details of Nokia's next mobes
New screen sizes, dual SIMs, voice over LTE, and more
Secure microkernel that uses maths to be 'bug free' goes open source
Hacker-repelling, drone-protecting code will soon be yours to tweak as you see fit
Mozilla keeps its Beard, hopes anti-gay marriage troubles are now over
Plenty on new CEO's todo list – starting with Firefox's slipping grasp
Apple: We'll unleash OS X Yosemite beta on the MASSES on 24 July
Starting today, regular fanbois will be guinea pigs, it tells Reg
Another day, another Firefox: Version 31 is upon us ALREADY
Web devs, Mozilla really wants you to like this one
Cloudy CoreOS Linux distro declares itself production-ready
Lightweight, container-happy Linux gets first Stable release
prev story

Whitepapers

Implementing global e-invoicing with guaranteed legal certainty
Explaining the role local tax compliance plays in successful supply chain management and e-business and how leading global brands are addressing this.
Consolidation: The Foundation for IT Business Transformation
In this whitepaper learn how effective consolidation of IT and business resources can enable multiple, meaningful business benefits.
Backing up Big Data
Solving backup challenges and “protect everything from everywhere,” as we move into the era of big data management and the adoption of BYOD.
Boost IT visibility and business value
How building a great service catalog relieves pressure points and demonstrates the value of IT service management.
Why and how to choose the right cloud vendor
The benefits of cloud-based storage in your processes. Eliminate onsite, disk-based backup and archiving in favor of cloud-based data protection.