Behind the Scenes: Headset Camera app for the N9

The logical step after the “Volume+ as Camera Button” app (Nokia Store link) for the N9 is another app that allows you to take photos while not touching your N9 at all. While time-triggered photos are fun, remote-triggered photos are.. erm.. “funner”? So what kind of remote “buttons” can we easily get on the N9? The remote control button on the headset is both “remote” and a “button”. Also, as seen in Panucci and gPodder versions since the N900, Bluetooth headset buttons can also be queried by applications. So what do we get by combining remote control and photo taking? The Headset Camera app (Nokia Store link) for the N9! Or – for the visual reader – this:

If you want to integrate such features into your own app, the code for querying the headset buttons is readily available in the gPodder source tree (src/gpodder/qmlui/helper.py):

import dbus
 
class MediaButtonsHandler(QtCore.QObject):
    def __init__(self):
        QtCore.QObject.__init__(self)
        headset_path = '/org/freedesktop/Hal/devices/computer_logicaldev_input_0'
        headset_path2 = '/org/freedesktop/Hal/devices/computer_logicaldev_input'
 
        system_bus = dbus.SystemBus()
        system_bus.add_signal_receiver(self.handle_button, 'Condition',
                'org.freedesktop.Hal.Device', None, headset_path)
        system_bus.add_signal_receiver(self.handle_button, 'Condition',
                'org.freedesktop.Hal.Device', None, headset_path2)
 
    def handle_button(self, signal, button):
        if signal == 'ButtonPressed':
            if button in ('play-cd', 'phone'):
                self.playPressed.emit()
            elif button == 'pause-cd':
                self.pausePressed.emit()
            elif button == 'previous-song':
                self.previousPressed.emit()
            elif button == 'next-song':
                self.nextPressed.emit()
 
    playPressed = QtCore.Signal()
    pausePressed = QtCore.Signal()
    previousPressed = QtCore.Signal()
    nextPressed = QtCore.Signal()

MediaButtonsHandler is already a QObject subclass, so you can easily expose an instance of this class to your QDeclarativeView rootContext() and connect to the signals in QML (such a “headset button handler” might actually be a good candidate for inclusion into nemo-qml-plugins in Sailfish OS and Nemo Mobile?). As it’s really just using the Python D-Bus bindings to get property changes from Hal devices, the code above should be easy (read: trivial) to port from Python to Qt/C++. Be aware that you need to connect to both …/computer_logicaldev_input_0 and …/computer_logicaldev_input, which can both exist if you have a cable headset and a Bluetooth headset connected at the same time.

You can get the Headset Camera App for the N9 in Nokia Store now, there is also a video on YouTube showing the app. Or start integrating headset button features into your own app or scripts by adapting the code above. One use case that comes to mind is using the previous/next buttons on a Bluetooth headset to control a photo slideshow on the N9 connected to TV-Out. Enjoy :)

Surveillance Camera (Featured Project)

Surveillance Camera  demonstrates how to use the Notification API for sending and receiving alert notifications on two different platforms.  This example is being created using two mobile applications. The Windows Phone application which sends push notification to the Qt Quick application in a Symbian device.

The Windows Phone application acts as a service to send alerts and Qt Quick application acts as receiver to receive alerts notification.  The Notification API adds a real time push notification service and acts as a camera alert system.  The Windows Phone application is the surveillance camera which  captures movement in the camera viewfinder  and sends alert  notification to the Qt Quick application.

The camera’s threshold of the Windows Phone application to send a notification can also be adjusted. The Qt Quick client starts automatically when alert notification is received.

To know more about real life use of Surveillance Camera please watch this video.

– Somnath Banik (on behalf of the Projects Moderation team)

PureView Imaging Competition update

We’ve just awarded our second PureView Imaging Competition 2012Q winner a fantastic new Nokia 808 PureView. The competition has already been a huge success with a particularly high quality and quantity of entries across a broad range of imaging topics.

Due to the extremely high quality of entries, we will be awarding an additional 2 Nokia 808 PureView devices in the final part of the competition – bringing the total to 5. The Nokia Event could be awarded to any of the phone winners.

We are also in the final stages of updating the Qt Camera Demo to support video recording (version 1.2). This should be released next week – but the source is already available here if you need it for your next competition entry! Note that the documentation and updated Camera Guide should come soon after.

Thank you to everyone who has contributed so far. We welcome any feedback you might have on the imaging apis or on this competition.

Further links:

Qt Camera Demo (Featured Project)

Qt Camera Demo iconQt ​Camera Demo is camera example application implemented using the Qt C++ Camera API. The app allows users to capture still images through the view finder and set almost all the important camera properties. The application also analyses the view finder image in real time and displays a histogram window. Lastly, the camera has a mode where over-exposed areas are marked in red in the view finder.

  

This project was created by Nokia Developer (lead by ​kratsan) and we hope you’ll learn a lot from this example about: using the Qt C++ Camera APIs, pixel manipulation techniques in real-time images and how to expose C++ components as reusable QML elements. The project is well documented and you can trust the code. As you can see from the ​tickets it is continuing to evolve and in its next ​milestone will also support video recording.

You can help us by suggesting improvements in the ​discussion boards and raising ​tickets for bugs. We’re also more than happy to take direct contributions from the community!

Wiki PureView Imaging Competition

Sharing your expertise and innovative use of the Qt or Symbian C++ Camera and Imaging APIs could win you a trip to a Nokia Event and the brilliant new Nokia 808 PureView smartphone, not to mention raise your CV to the next level, and get your skills noticed by the community. 

The Nokia 808 PureView has awesome capabilities for video and still image capture. It’s also the first phone to include support for audio recording without distortion, at audio levels beyond the capability of human hearing: so even in the harshest of environment you can capture CD-like audio
quality
.

With our new PureView Imaging Competition we are looking for how tos, tutorials, and code example articles that help the community write better and smarter imaging and camera software.

While we’re expecting to get many articles that explore the limits of what this phone can do, we also welcome articles that demonstrate code that can be useful on all Symbian (and most Qt) devices. The scope of what we consider imaging related is also very broad – we would certainly consider examples of photo sharing and image compression code and software for example.

To get you started we’ve created a Camera Guide and for how to use Qt to access camera functionality.

For more details and to enter, see PureView Imaging Competition 2012Q2.