Choosing a GUI Library for Your Embedded Device
Listing 1. A for (ever) Loop in Nano-X>
for (;;) {
GrGetNextEvent(&event);
switch (event.type) {
case GR_EVENT_TYPE_EXPOSURE:
GrText(w, gc, 10, 30, text, -1, GR_TFASCII);
break;
case GR_EVENT_TYPE_BUTTON_DOWN:
text="hej verden";
GrText(w, gc, 10, 30, text, -1, GR_TFASCII);
break;
case GR_EVENT_TYPE_CLOSE_REQ:
GrClose();
exit(0);
}
}The documentation for Nano-X is a bit lacking. There are some great documents out there; however, the links from the Web page are not updated, and many of them are dead. I used Google to find the most useful documentation. One also can use the Nano-X source and the mailing lists. The mailing list is very active, and Greg Haerr is right there, giving quick responses to questions.
A make doc in the sources will make some doc on the API using Doxygen, but not all functions are documented. I had to look directly in the source a few times.
Nano-X does win by miles when it comes to size. However, Qtopia is far ahead when it comes to polished graphics and nice, well-structured programming. Don't get me wrong, this is not entirely a C vs. C++ issue. You can do nice programming using C and Nano-X, but it does require more skill and discipline from the programmer. Hard-core C programmers will often crank out muddy C++ code with Qtopia, so C++ doesn't always translate into good practices—it all depends on your existing skills, time and willingness to learn.
Regarding speed, I did not see much difference, except in my scrolling graph. Using Qtopia, the graph was jittery, because I did not find a way actually to scroll the bitmap, so I had to redraw the complete graph for each step. The graph turned out nicely in Nano-X, using a bitmap copy to make the scrolling, and then just drawing the new part of the graph. Given more time and trial and error, it is likely that you could scroll more efficiently in Qtopia too—probably by sub-classing the right object. But given the current documentation, I did not find a way to do it.
Table 1 is a summary table for the two versions of the PMMD that I made, PMMD-QT and PMMD-NX. Installation includes compiling of the libraries. Code size is taken from the documentation.
Table 1. Summary Table
| PMMD-QT | PMMD-NX | |
|---|---|---|
| GUI | Qtopia from Trolltech (GPL version) | Nano-X |
| Programming Language | C++ | C |
| Time spent learning to use the library | Approx. one week (three days for the installation and two days to learn the API) | Approx. one week (three days for the installation and two days to learn the API) |
| Development time for GUI and heartbeat monitor graph | Approx. two to four days | Approx. five to seven days |
| Code size of library | Compressed: 1.1 - 3.2MB | <100K |
| Documentation | API: really good; installation: needs work | API: usable; installation: needs work |
| License | GPL license and commercial license. The GPL version is free to download; the commercial version must be purchased. | MPL license with possibility for closed source drivers and applications. Nano-X is free to download. |
Widgets
Widgets in graphical user interfaces (GUIs) are the notion for a single component of the GUI like a button, a clock or a text input field.
Wikipedia on widgets: en.wikipedia.org/wiki/Widget_%28computing%29
Linux Framebuffer
The Linux framebuffer (fbdev, en.wikipedia.org/wiki/Linux_framebuffer) is a graphic hardware-independent abstraction layer to show graphics on a console without relying on system-specific libraries, such as SVGALib or the X Window System.
The Linux framebuffer device is inherited from old display hardware (en.wikipedia.org/wiki/Framebuffer) where the picture to be displayed was pulled by hardware from a memory region.
Resources for this article: /article/9460.
Martin Hansen works at the Danish company Center for Software Innovation (CSI, www.cfsi.dk). CSI provides knowledge in embedded development to companies, both through advisory and by giving “Technology Injections”. Martin is the company expert on embedded Linux. He has been using Linux for more than ten years and has worked with embedded Linux for the last two years. He has a practical education in electronics and a Bachelor's degree in computer science.
Realizing the promise of Apache® Hadoop® requires the effective deployment of compute, memory, storage and networking to achieve optimal results. With its flexibility and multitude of options, it is easy to over or under provision the server infrastructure, resulting in poor performance and high TCO. Join us for an in depth, technical discussion with industry experts from leading Hadoop and server companies who will provide insights into the key considerations for designing and deploying an optimal Hadoop cluster.
Sponsored by AMD
Built-in forensics, incident response, and security with Red Hat Enterprise Linux 6
Every security policy provides guidance and requirements for ensuring adequate protection of information and data, as well as high-level technical and administrative security requirements for a system in a given environment. Traditionally, providing security for a system focuses on the confidentiality of the information on it. However, protecting the data integrity and system and data availability is just as important. For example, when processing United States intelligence information, there are three attributes that require protection: confidentiality, integrity, and availability.
Learn more about catching the bad guy in this free white paper.
Sponsored by DLT Solutions
| Designing Electronics with Linux | May 22, 2013 |
| Dynamic DNS—an Object Lesson in Problem Solving | May 21, 2013 |
| Using Salt Stack and Vagrant for Drupal Development | May 20, 2013 |
| Making Linux and Android Get Along (It's Not as Hard as It Sounds) | May 16, 2013 |
| Drupal Is a Framework: Why Everyone Needs to Understand This | May 15, 2013 |
| Home, My Backup Data Center | May 13, 2013 |
- Designing Electronics with Linux
- Making Linux and Android Get Along (It's Not as Hard as It Sounds)
- Dynamic DNS—an Object Lesson in Problem Solving
- New Products
- Using Salt Stack and Vagrant for Drupal Development
- Validate an E-Mail Address with PHP, the Right Way
- Build a Skype Server for Your Home Phone System
- Tech Tip: Really Simple HTTP Server with Python
- Why Python?
- A Topic for Discussion - Open Source Feature-Richness?
- Not free anymore
3 hours 4 min ago - Great
6 hours 52 min ago - Reply to comment | Linux Journal
7 hours 10 sec ago - Understanding the Linux Kernel
9 hours 14 min ago - General
11 hours 44 min ago - Kernel Problem
21 hours 47 min ago - BASH script to log IPs on public web server
1 day 2 hours ago - DynDNS
1 day 5 hours ago - Reply to comment | Linux Journal
1 day 6 hours ago - All the articles you talked
1 day 8 hours ago





Comments
Library for heartbeat graphic
Nice article! I'm working right now in some projects with Qt Embedded and it's been good so far, but I'm curious about what specific library did you use to graph the heartbeat with Qtopia.
The only thing I've found that can make anything like this is a library called QWT which is not included in the Qt package.
Thanks!
Has anyone an example code
Has anyone an example code for a graph that is updated continiously?
using Nano-X
Using Nano-X is a real headache. Documentation is not good. Though we have no better solution for uClinux we are using in our project (another option is Framebuffer, he-he).
E.g. it's quite unobvious how to setup a regional-specific font.
You have to look into the sources all the time.
Linux, frame buffer, embedded
This is a nice start article for business and technical people also. This provides the first feel of the technology and the information.
Nano-X
Nano-X is indeed very small and basic but this is exactly why I think it's so worthwhile using it.
Many things can be implemented using simpler means and one has no difficulty looking directly at the Nano-X source code to get a grasp on how things are done there; an insight can be easily gained. I think this gives a developer more freedom of choice how to get things implemented in his own way - at least to some extend.
Also, another advantage arises in my opinion from the conceptual closeness of Nano-X to X. Nano-X might have nothing to do with X11 in any way, however, porting applications that use Xlib by design is very much feasible.
Although it is true that Nano-X lacks widgets to be natively used, there is an extension called TinyWidgets that builds on top of the Nano-X library. In addition to providing most of the elements of a modern graphical user interface it does also come with a graphical designer which I have found helpful so far for my work with Nano-X.
Cheers,
Sören
Correction
A good effort indeed !
May i note that Qtopia is NOT the embedded version of QT.
Qt library comes in many flavors, mainly for Desktop(development purpose) called Qt/X11 and Embedded(OSrc version for embedded systems) called Qt/Emb. Qt library makes use of the Frame buffer and Input devices.
Now comes Qtopia. It is more of a server (Palmtop-Environment UI for embedded systems) than a library, which runs _above_ the Qt/Emb(or Qt/X11 with Virtual Framebuffer on a development PC). In a way, Qtopia is itself an application making use of the underslying Qt library.
When you write applications for the final GUI, you usually use Qtopia headers and libraries(which in turn makes use of functions in Qt library).
By the way, i wonder why was OPIE(Open Palmtop Integrated Environment) not worth comparing in this study?
.
which Nano-X?
I found two on a web search:
http://www.microwindows.org/
http://embedded.centurysoftware.com/docs/nx/index.html
you're clearly writing about the first one, but what's up with the second one??
RE: which Nano-X?
It's the same. centurysoftware is run by Greg Haerr, who is also the main force behind Nano-x, the Nano-X SDK mentioned in your second link is pretty much outdated and abandoned.
Qtopia more then a GUI
Very good article, but I think you should mention that Qtopia Core is more then a GUI, it is an application framework. with a complete set of classes for things such as:
Session Management
Does your application need to save and restore settings, Qtopia hs this built in
Sockets:
Does your app need to talk to a server. or maybe be a server. QSockets(UDP & TCP) and QTcpServer are nifty classes for doing this.
Threads:
Do you need to do a heavy process outside the GUI thread, QThreads will aid here, and most classes in Qtopia are now thread safe
Database:
Qt comes with SQLite built in, and of course can talk to almost all major databases
Data Serialization
If you send data to and from other devices QT will take care of little endian/ big endian. All objects are easy to serialize with QDataStream
International
Do you need to support more then one language. Qtopia comes with a tool called Linguist which allows you to add multi language support without additional programing. It also supports Asian charactor sets as well as manages right to left languages in every GUI widget
Pixmap Management
Need to use something like a cancel pixmap in more then one location. Qtopia apps will cache pixmaps so they get stored once no matter how many places you use them. QImage and QPixmaps work hand in hand so images can be scaled on depending how they are to be used.
Interprocess Communication
QDbus makes it very easy for apps to talk to other Qtopia apps.
Themes
Want to have multiple looks for your display, perhaps a daytime display and a night time display. QTheme makes this very easy to do
Focus on the GUI
I could have mentioned a lot of things, but as i was writing an article and not a book I had a limit on space, and then some things is left out.
nice sales pitch
nice to see trolltech salesmen trolling :)
don't forget to mention - the commercial embedded license for QT is ridiculously expensive.
wxWidgets is a viable route for a commercial product - LGPL.
scrolling a widget
"In Qtopia, I simply made a class, connected some signals and slots, and puff, the magic happened."
:) As for the scolling I check out the scroll function in QWidget. It is probably what you are looking for.
http://doc.trolltech.com/4.2/qwidget.html#scroll-2
Available browsers on these two GUI systems
It's nice to compare the these two windowing system on embedded systems. But IMO there are two major parts are missed in this article: software ported on these two systems and what kind of browser these two GUI systems support respectively. For example, besides Mozilla based browsers, is there a browser can run on Nano-X with Javascript capability?
Maybe You think of internet
Maybe You think of internet tablets like the Nokia 770. But most of my customers do not have the need for a browser, they need a GUI specific for their device most often with no desktop.
And yes i would have liked to dive into the software availiable on the two platforms. And I would also have liked to research more on the add on libraries, that You can put on top of Nano-x to give you the buttons, textpads a.s.o. that you have in QTopia, but I had to set the limit somewhere or I would still be writing on the article.
Regards Martin