Getting Started with the Trolltech Greenphone SDK
For an excellent example of a Linux program using GSM AT command codes, check out Gnokii—it's a great tool for learning about GSM modems, as you actually can watch each transaction with the data sent and received to execute commands to dial the phone, send SMS messages and so on. It works well with most modern phones that have a serial or USB data connector. By the time this article is printed, it might already be running natively on the Greenphone. For complete details, visit www.gnokii.org.
Loading the development environment is simple—run the installation program on Windows or Linux, respond affirmatively to the prompts, and within a minute you will have VMware and the SDK tools, application sources, documentation and binaries installed with an icon on your desktop to start things up.
This makes life really easy for reluctant developers using MS Windows to get into both embedded and desktop Linux and Qt application development.
At the time of this writing, developers using the x86 version of Macintosh OS X can use the Greenphone SDK under VMware Fusion, but they need to copy over the virtual machine's files from another installation; however, this may change by the time this article is published.
One technique for VM-based cross-platform development is to export your display from the Linux VM to your host machine running an X11 server. This might be the built-in X11 server running locally on your Linux host, Apple's optional add-on to OS X or even Cygwin on a Windows machine. I use screens rotated 90° to allow reading many more lines of code without scrolling, so this trick helps to leave the VM configurations as generic as possible. GUI performance typically is enhanced when the X server is run on the host machine due to the lowest level rendering being shoved off as far down the pipeline as possible—often at the display adapter's GPU. Using this method, it can almost make Windows and OS X feel like a Linux box.
Trolltech always ships its products with copious documentation and example code demonstrating all common features, and the Greenphone SDK is no exception. For starters, the “Developer Quickstart Guide” shows what needs to be done to build an application with a few one-liners.
First, we start the Qtopia emulator using the Qt Virtual Frame Buffer and a Greenphone skin by clicking on the runqvfb icon on our desktop. This is analogous to an X server for Qtopia, and it provides an exact pixel-for-pixel representation of the program running on the phone.
Then, we start the Qtopia phone environment by clicking the runqpe icon, which then connects to the qvfb process and displays its contents in its virtual screen.
We need to run a script to set our QPEVER and PATH environment variables and to define some functions for communicating to the phone. If building for the x86 version of Qtopia, we would use:
Otherwise, if building for the actual Greenphone itself, we would choose the cross-compile environment with:
Then, we change to our directories and build:
cd ~/projects/application qtopiamake -project && qtopiamake && make && gph -p -i
The qtopiamake program is Qtopia's version of the Qt qmake utility. It can generate a .PRO project file based on the contents of the current directory if given the -project parameter, but its most important job is to use the project file as the starting point to generate a Makefile based on the installed configuration of Qtopia and the type of build we want.
It might be worthwhile to point out that the commands depicted here are separated by a double ampersand (&&) to cause execution of the command string to stop at the first point where it meets an error. In this case, it would stop the shell from trying to execute or install a program that had failed to build.
Typically, we generate a new .PRO and Makefile only when we have new files to add to our project, but qtopiamake takes so little time to execute that it is common to see it run from a standard shell script every time.
- Smoothwall Express
- Machine Learning Everywhere
- Bash Shell Script: Building a Better March Madness Bracket
- Own Your DNS Data
- Simple Server Hardening
- From vs. to + for Microsoft and Linux
- The Weather Outside Is Frightful (Or Is It?)
- Understanding OpenStack's Success
- Understanding Firewalld in Multi-Zone Configurations
- Ensono M.O.