qtnokiaqt-mobilitymeegomeego-harmattan

Meego 1.2 Harmattan and QCamera application


Is there any way to work with camera with QCamera class in Nokia N9 (Meego 1.2 Harmattan) or I should use another one?

Here's my problem: simple application that works fine on Nokia C6-01 (Symbian Anna) doesn't do anything useful on N9.

Here're code snipets:

testmobile.pro

<...>
CONFIG += mobility
MOBILITY += multimedia
LIBS += -lQtMultimediaKit
<...>

mainwindow.h

class MainWindow : public QWidget
{
    Q_OBJECT
    <...>
    private:
        QCamera* camera_;
        QGraphicsView *view;
        QGraphicsVideoItem *videoItem;
        QGraphicsScene *scene;
    <...>
}

mainwindow.cpp

MainWindow::MainWindow(QWidget *parent)
: QWidget(parent)
{
<...>
    camera_ = new QCamera;
    view = new QGraphicsView(this);
    scene = new QGraphicsScene(view);
    videoItem = new QGraphicsVideoItem;
    view->setScene(scene);
    scene->addItem(videoItem);

    QVBoxLayout *lay = new QVBoxLayout(this);
    lay->addWidget(view);
    this->setLayout(lay);
    view->show();
    camera_->setViewfinder(videoItem);

    camera_->start();
}

<...>

So after MainWindow object is constructed and shown we'll se a simple viewfinder on Nokia C6-01 and black screen on Nokia N9.

Any ideas?


Solution

  • I found solution! It was security problem. As I found - Meego has analogue of "capabilities" of Symbian. It's called AEGIS security tokens. So, to request a permission to work with camera (or any other) you should add your_application_name.agis file into the "qtc_packaging/debian_harmattan" folder of your project. In my case this file consisted of:

    <aegis>
        <request>
            <credential name="GRP::video"/>
            <credential name="GRP::pulse-access"/>
            <for path="/opt/testmobile/bin/testmobile"/>
       </request>
    </aegis>
    

    So permissons are defined in the "name" property of "credential" tag and "for path" tag defines package to perform these permissions with.

    More information can be found here