Summer Grab Bag

Jeff Tranter


Jeff Tranter is a Qt Consulting Manager at ICS. Jeff oversees the architectural and high-level design of software systems for clients. Jeff’s leadership organizes global teams of developers on desktop and embedded applications.

By Jeff Tranter | Wednesday, August 13, 2014

It's summertime here in the Northern hemisphere, and many people are on vacation (I just got back from a week off, myself). Despite that, we are very busy at ICS with consulting projects and preparing for the upcoming Qt Developer Days (1) conferences to be held in Berlin and San Francisco this year. Given the lack of time, this blog post is going to be a grab bag of updates to earlier blog posts, with lots of links to more information.

The Raspberry Pi (2) continues to be very popular, both as a platform for education as well as embedded computing. To better support the embedded market, the Raspberry Pi Foundation now offers the Compute Module (3), a Raspberry Pi in a more flexible form factor intended for industrial applications. Most recently, we saw the launch of the Model B+ (4) , which offers a number of new features and improvements while remaining software compatible with the original Raspberry Pi model B. A model A+ is expected later this year. In a recent webcast about the Model B+, it was mentioned that an official Raspberry Pi LCD display and touchscreen is in the works. While there are already many third party displays, it will be good to see an official one.

In a blog post last November, we described how to build Qt 5 with Wayland on the Raspberry Pi (5). Unfortunately, the latest version of QtWayland (6) no longer builds with the older version of Wayland in the Raspbian Linux distribution. There are plans to support Wayland as the standard display server on the Raspberry Pi in the future via the new Maynard Desktop (7), so I am confident that this will all work out of the box before too long (and should further improve graphics performance on the Raspberry Pi).

We've posted here several times about the Yocto embedded framework (8). The Qt 5 recipes for Yocto (9) have seen significant development effort recently. The KDE Frameworks 5 (10) is also being set up to build on Yocto (11), so these useful add-ons to Qt can be used on embedded platforms as well as desktop.

I posted a while back about the Qt X11 Extras module (12). Since then, Mac Extras (13) and Win Extras (14) modules have officially become part of Qt releases, and most recently an Android Extras (15) module as well.

The success of the Raspberry Pi has attracted the attention of other hardware vendors, including Intel and even Microsoft (16). Many are ARM-based but some are also x86 compatible. There are even some Raspberry Pi clones, and boards that combine a Linux-based board with an Arduino compatible controller. The list of boards (17)on the market (18) is large and growing every day. This is all good news for embedded developers and people wanting to learn embedded development.

As a follow-up to Qt Multimedia with QML (19), a new feature in Qt 5.3.0 is the QCameraInfo (20) class. This C++ class (there is no corresponding QML element yet) allows you to get information about the available cameras on a system. Here is the source code for a small but complete example program.

#include <QCamera>
#include <QCameraInfo>
#include <QDebug>
#include <QList>

int main()
{
    qDebug() << "Available cameras:";
    QList<QCameraInfo> cameras = QCameraInfo::availableCameras();
    foreach (const QCameraInfo &cameraInfo, cameras) {
        qDebug() << "  Device name:" << cameraInfo.deviceName();
        qDebug() << "  Description:" << cameraInfo.description();
        qDebug() << "  Orientation:" << cameraInfo.orientation() << "degrees rotation";
        switch (cameraInfo.position()) {
        case QCamera::UnspecifiedPosition:
            qDebug() << "  Position: unknown";
            break;
        case QCamera::BackFace:
            qDebug() << "  Position: back";
            break;
        case QCamera::FrontFace:
            qDebug() << "  Position: front";
            break;
        }
    }
    qDebug() << "Default camera:";
    if (QCameraInfo::defaultCamera().isNull()) {
        qDebug() << "  none";
    } else {
        qDebug() << "  " << QCameraInfo::defaultCamera().deviceName();
    }
    return 0;
}

The class is supported on multiple platforms including Android. Here is the output on a Linux laptop:

Available cameras:
  Device name: "/dev/video0"
  Description: "Laptop_Integrated_Webcam_E4HD"
  Orientation: 0 degrees rotation
  Position: unknown
Default camera:
  "/dev/video0"

Here is the output on an Android Nexus 7 tablet:

Available cameras:
  EGL 1.4 QUALCOMM Build: I0404c4692afb8623f95c43aeb6d5e13ed4b30ddbDate: 11/06/13
  Device name: "back"
  Description: "Rear-facing camera"
  Orientation: 270 degrees rotation
  Position: back
  Device name: "front"
  Description: "Front-facing camera"
  Orientation: 90 degrees rotation
  Position: front
Default camera:
  "back"

That's all for this time. Have a good summer, and if you get the opportunity to take any vacation, enjoy yourself.

References

  1. Qt Developer Days web site, accessed August 1, 2014, www.qtdeveloperdays.com
  2. Raspberry Pi project web site, accessed August 1, 2014, www.raspberrypi.org
  3. Raspberry Pi Compute Module, accessed August 1, 2014, www.raspberrypi.org/product/compute-module-development-kit
  4. Raspberry Pi Model B+, accessed August 1, 2014, www.raspberrypi.org/product/model-b-plus>
  5. Building Qt and Wayland on Raspberry Pi, accessed August 1, 2014, www.ics.com/blog/building-qt-and-qtwayland-raspberry-pi
  6. QtWayland Project, accessed August 1, 2014qt-project.org/wiki/QtWayland
  7. Preview the Upcoming Maynard Desktop, accessed August 1, 2014www.raspberrypi.org/preview-the-upcoming-maynard-desktop/
  8. Yocto Project web site, accessed August 1, 2014, www.yoctoproject.org
  9. Qt 5 Yocto Recipes, accessed August 1, 2014, github.com/meta-qt5/meta-qt5.git
  10. KDE Frameworks 5 API Documentation, accessed August 1, 2014, api.kde.org/frameworks-api/frameworks5-apidocs/
  11. KF5 in Yocto, blog post, accessed August 1, 2014, www.thelins.se/johan/blog/2014/07/kf5-in-yocto/
  12. QtX11Extras Module, accessed August 1, 2014, qt-project.org/doc/qt-5/qtx11extras-index.html
  13. QtMacExtras Module, accessed August 1, 2014, qt-project.org/doc/qt-5/qtmacextras-index.html
  14. QtWinExtras Module, accessed August 1, 2014, qt-project.org/doc/qt-5/qtwinextras-index.html
  15. QtAndroidExtras Module, accessed August 1, 2014, qt-project.org/doc/qt-5/qtandroidextras-index.html
  16. Microsoft's Sharks Cove, PC World article, accessed August 1, 2014, www.pcworld.com/article/2459200/meet-microsofts-sharks-cove-a-raspberry-pi-style-mini-pc-running-windows-8-1.html
  17. List of 39 Low Cost Linux-Friendly Boards and Products, accessed August 1, 2014, www.cnx-software.com/2012/06/26/list-of-39-low-cost-linux-friendly-boards-and-products/
  18. Top 10 Open Source Linux Boards Under $200, accessed August 1, 2014, www.linux.com/news/embedded-mobile/mobile-linux/732197-top-10-open-source-linux-boards-under-200
  19. Qt 5 multimedia Qml Elements, blog post, accessed August 1, 2014, www.ics.com/blog/qt-5-multimedia-qml-elements
  20. QCameraInfo Class API Documentation, accessed August 1, 2014, qt-project.org/doc/qt-5/qcamerainfo.html


Have a question or add to the conversation: Log in Register