Feeds

Punch out your own code on a Greenphone

We get keyed up about Trolltech's Qtopia

The Power of One Brief: Top reasons to choose HP BladeSystem

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

Securing Web Applications Made Simple and Scalable

More from The Register

next story
Apple fanbois SCREAM as update BRICKS their Macbook Airs
Ragegasm spills over as firmware upgrade kills machines
HIDDEN packet sniffer spy tech in MILLIONS of iPhones, iPads – expert
Don't panic though – Apple's backdoor is not wide open to all, guru tells us
Mozilla fixes CRITICAL security holes in Firefox, urges v31 upgrade
Misc memory hazards 'could be exploited' - and guess what, one's a Javascript vuln
NO MORE ALL CAPS and other pleasures of Visual Studio 14
Unpicking a packed preview that breaks down ASP.NET
Captain Kirk sets phaser to SLAUGHTER after trying new Facebook app
William Shatner less-than-impressed by Zuck's celebrity-only app
Cheer up, Nokia fans. It can start making mobes again in 18 months
The real winner of the Nokia sale is *drumroll* ... Nokia
EU dons gloves, pokes Google's deals with Android mobe makers
El Reg cops a squint at investigatory letters
Chrome browser has been DRAINING PC batteries for YEARS
Google is only now fixing ancient, energy-sapping bug
prev story

Whitepapers

Designing a Defense for Mobile Applications
Learn about the various considerations for defending mobile applications - from the application architecture itself to the myriad testing technologies.
How modern custom applications can spur business growth
Learn how to create, deploy and manage custom applications without consuming or expanding the need for scarce, expensive IT resources.
Reducing security risks from open source software
Follow a few strategies and your organization can gain the full benefits of open source and the cloud without compromising the security of your applications.
Boost IT visibility and business value
How building a great service catalog relieves pressure points and demonstrates the value of IT service management.
Consolidation: the foundation for IT and business transformation
In this whitepaper learn how effective consolidation of IT and business resources can enable multiple, meaningful business benefits.