Punch out your own code on a Greenphone

We get keyed up about Trolltech's Qtopia


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


Other stories you might like

  • Prisons transcribe private phone calls with inmates using speech-to-text AI

    Plus: A drug designed by machine learning algorithms to treat liver disease reaches human clinical trials and more

    In brief Prisons around the US are installing AI speech-to-text models to automatically transcribe conversations with inmates during their phone calls.

    A series of contracts and emails from eight different states revealed how Verus, an AI application developed by LEO Technologies and based on a speech-to-text system offered by Amazon, was used to eavesdrop on prisoners’ phone calls.

    In a sales pitch, LEO’s CEO James Sexton told officials working for a jail in Cook County, Illinois, that one of its customers in Calhoun County, Alabama, uses the software to protect prisons from getting sued, according to an investigation by the Thomson Reuters Foundation.

    Continue reading
  • Battlefield 2042: Please don't be the death knell of the franchise, please don't be the death knell of the franchise

    Another terrible launch, but DICE is already working on improvements

    The RPG Greetings, traveller, and welcome back to The Register Plays Games, our monthly gaming column. Since the last edition on New World, we hit level cap and the "endgame". Around this time, item duping exploits became rife and every attempt Amazon Games made to fix it just broke something else. The post-level 60 "watermark" system for gear drops is also infuriating and tedious, but not something we were able to address in the column. So bear these things in mind if you were ever tempted. On that note, it's time to look at another newly released shit show – Battlefield 2042.

    I wanted to love Battlefield 2042, I really did. After the bum note of the first-person shooter (FPS) franchise's return to Second World War theatres with Battlefield V (2018), I stupidly assumed the next entry from EA-owned Swedish developer DICE would be a return to form. I was wrong.

    The multiplayer military FPS market is dominated by two forces: Activision's Call of Duty (COD) series and EA's Battlefield. Fans of each franchise are loyal to the point of zealotry with little crossover between player bases. Here's where I stand: COD jumped the shark with Modern Warfare 2 in 2009. It's flip-flopped from WW2 to present-day combat and back again, tried sci-fi, and even the Battle Royale trend with the free-to-play Call of Duty: Warzone (2020), which has been thoroughly ruined by hackers and developer inaction.

    Continue reading
  • American diplomats' iPhones reportedly compromised by NSO Group intrusion software

    Reuters claims nine State Department employees outside the US had their devices hacked

    The Apple iPhones of at least nine US State Department officials were compromised by an unidentified entity using NSO Group's Pegasus spyware, according to a report published Friday by Reuters.

    NSO Group in an email to The Register said it has blocked an unnamed customers' access to its system upon receiving an inquiry about the incident but has yet to confirm whether its software was involved.

    "Once the inquiry was received, and before any investigation under our compliance policy, we have decided to immediately terminate relevant customers’ access to the system, due to the severity of the allegations," an NSO spokesperson told The Register in an email. "To this point, we haven’t received any information nor the phone numbers, nor any indication that NSO’s tools were used in this case."

    Continue reading

Biting the hand that feeds IT © 1998–2021