Camera Problem on Symbain^3



  • Hi all,
    I'd like to know if some of you know how can I use camera into a Qt app, if should be possible I'd like to have the standard nokia camera to capture photo.
    I cannot use Beta API because i must put my app on ovi.
    Thanks.



  • use Symbian C++ in Qt



  • Hi,

    See the docs for the camera-related classes in the Multimedia module of Qt Mobility 1.1.0.
    http://doc.qt.nokia.com/qtmobility-1.1/multimedia.html#camera-support

    The API and implementation has been finalised I believe (it's not beta) but I don't know whether the smart installer supports it yet (which would impact availability on Ovi Store, I think).

    Cheers,
    Chris.



  • QtMobility 1.1.0 is not accepted in to Ovi Store. Probably won't be until next year when Qt4.7.2 is allowed.
    So you'll have to take the advice of Alexander here and make do with Symbian C++.

    However, if you don't mind waiting until next year the Camera API will be much easier and quicker (although sort of defeats the point when you need to wait ;) ).

    By the way, I think they may be replacing SmartInstaller or at least changing the process because I got a notification through Ovi Publisher that you will no longer require the statement that says the application may require up to 13MB of additional downloads (Qt Installer).



  • Don't know if this solution is legal (GPL, LGPL), but it should work.

    Take files qcamera.cpp and qcamera.h from the qtmobility 1.1 for symbian source and include them into your project.



  • From what I've understood I must use Symbian c++ in Qt, but now the prblem is that I'm not able to do, what I'd like to know is:

    1- how to start standard nokia camera
    2- how can i catch photo

    Thanks for your support.



  • [quote author="qwertyuiopearendil" date="1291366923"]From what I've understood I must use Symbian c++ in Qt, but now the prblem is that I'm not able to do, what I'd like to know is:

    1- how to start standard nokia camera
    2- how can i catch photo

    Thanks for your support.[/quote]

    Refer "this":http://wiki.forum.nokia.com/index.php/Camera_Application_Engine_API link for achieving the above in symbian.



  • But the link that you've posted talk about S60, can i use it even if I'm developping to symbian^3?



  • There shouldn't be a difference. Try it out on a S^3 device.



  • [quote author="qwertyuiopearendil" date="1291394527"]But the link that you've posted talk about S60, can i use it even if I'm developping to symbian^3?[/quote]

    As mentioned above - it should most probably work with Symbian^3 if the plugin is available.



  • Yes and better develop the complete app in Symbian than Qt as you need to put it on Ovi. You will have to develop the engine in native Symbian and if you develop the ui part also in Symbian instead of Qt - probably your app will support wider range of devices.



  • [quote author="tamhanna" date="1291440958"]The Qt has the most benefits if you later want to port to Maemo or desktop at some point in the future...[/quote]

    But then again you Qt mobility is mainly for mobile devices and these API's won't be supported on Desktop right. And N900 being the only maemo device with Qt updates the target audience is very few. Maybe once meego comes in the scenario might change.



  • [quote author="QtK" date="1291441234"]
    But then again you Qt mobility is mainly for mobile devices and these API's won't be supported on Desktop right. [/quote]

    Read the first post from here: https://developer.qt.nokia.com/forums/viewthread/1732/
    It says "but also provide useful application functionality across desktop platforms."



  • It's quite useful and a time saver. I don't see the problem. SmartInstaller will install the latest on the users system.



  • It wouldn't update your app if you didn't use SI either. What's the point?

    If you mean your app will be built on an older Qt, that's fine. Qt will be backwards compatible with your app anyway. You can update it in your own time.



  • Well Qt Mobility obviously has a very useful API set and is very quick to code with. Better to use the wheel than reinvent it. And it does link in well with Qt. SmartInstaller means that you don't need to worry about whether the user has it on their system or not. So, it's win/win.
    What would you use instead?

    The only problem (with regards to topic) is that the QtMobility the user wants isn't allowed to be deployed in Ovi, yet.



  • No, we've been over this. Write once, it will always work. You don't need to update your code because new Qt versions come out.



  • Oh I guess Nokia weren't talking about QtMobility. I got it confused when Nokia mentioned that all Qt4.6.3 apps will work in future.

    Well just keep updating your apps if they ever break ;) I'm sure Nokia won't break it intentionally.



  • [quote author="xsacha" date="1291446040"]Oh I guess Nokia weren't talking about QtMobility. I got it confused when Nokia mentioned that all Qt4.6.3 apps will work in future.

    Well just keep updating your apps if they ever break ;) I'm sure Nokia won't break it intentionally.[/quote]

    But these days decisions made by Nokia confuses developers a lot. You cannot say if they will stick to one plan. Especially, the way the roadmap is being changed.



  • I will still use it especially for camera, regardless. I prefer coding a little a lot rather than a lot a little.



  • You don't get Qt apps signed. Nokia signs it for you. It's completely free. (Exception being when it requires too much capability).

    I submit unsigned app on Ovi Publish, mark it as 'unsigned' and Nokia does the rest. Hopefully this is what you meant.

    [quote author="tamhanna" date="1291449010"] This is a question of taste.[/quote]
    Only if they break compatibility. If they didn't, it would be a no-brainer. Code a little, little.



  • Well both of you are right. Just to add the app which nokia signs cannot be distributed via any other channel. It can be distributed only via Ovi. Thats the catch for free ovi signing.



  • I didn't say you can't sign it yourself. I'm saying that's the way you're meant to submit apps on Ovi and that's the way I do it. It fits in with QtCreator, it's the easiest and of course free.
    If your app needs more than basic capabilities, then you'll need to pay to sign of course.

    Nokia gives you free UID3's by the way. In allotments of five unless you require more.

    My route is 0 euros a pop.



  • How about just use that UID3 in the first place?
    I don't understand. You have to stick with an old UID3 so you have to pay to sign it?



  • This is for Qt apps.
    This is the first time Qt apps have been allowed on the Ovi Store.

    So no apps from 2008, no old UIDs.

    I fail to see your point.



  • Not 2008 :P Time between SmartInstaller existance and free signing is a very short time window.
    Unlucky if you missed out, but it's a one-off break from UID. And it affects only a handful of apps.
    It also saves 20 euro (per pop as you say) for each future update.

    Anyway you can create a topic about it if you want. Going off-topic.



  • Well I think you're in the minority, so I stand by my free signing of Qt apps with Nokia UIDs.

    Going back on-topic:
    So, for you, updating your projects for each QtMobility update may prove expensive but it doesn't really affect the rest of us. Especially considering these are new apps we are talking about.
    So I'll happily go with QtMobility to use such APIs as Camera and update when it is required.



  • Please correct me if I'm wrong but all the APIs in QtMobility 1.1 are stated to be final (API Maturity Level -FINAL). So any app using QtMobility 1.1 should run with future mobility packages, as the API is final. "Mobility Doc":http://doc.qt.nokia.com/qtmobility-1.1/



  • Well that is true kkrzewniak.

    But there's a lot of important functionality in QtMobility 1.1 that resides in the 'labs' -- this of course is not final and will change soon.

    Examples:

    • Gestures (pinch-zoom, swipe and so on) Plugin
    • Folder List Plugin
    • Particles Plugin

    Fortunately for the OP, Camera shouldn't change much.
    The APIs defined as 'FINAL' may still be extended (but still backwards compatible).



  • Yes and that is my point exactly! Stop whining that QtMobility so bad, just stick to the parts You know to be final.



  • I don't know why tam hates QtMobility so much. My only guess is he has created his own custom libraries to deal with camera and so on and hates that it has all been replaced by 3 lines of code :P.


  • Moderators

    tamhanna: Have fun limiting your apps to the Symbian ecosystem then.

    Seriously: Qt is meant to make it easy to cover all (Nokia) phones, not just Symbian. You are giving up on Meego before it is even out! And there even are community ports of Qt to android and iphone... who knows, maybe those will become official someday...


  • Moderators

    tamhanna: Most linux distributions are moving away from HAL... I do not know whether it will be in meego or not:-)



  • I don't think his 'hal' header is actually related to HAL, that's just how you handle these libraries right tam? I knew you spent time on custom libraries! :P It's ok to move on to QtMobility you know. Even if it seems you've wasted time making your hal.h.

    I don't think Meego will use HAL though. Will it even use X11? I think Nokia wanted Wayland?



  • OK, I'm not sure why you call it HAL :P I always call that stuff 'defines.h' or 'constants.h' or similar.

    This doesn't show your solution for QtMobility. What do you use?

    Do you have anything that could help the OP, for example, with his Camera API? Or you just write this in Symbian C++?



  • Hi All,
    to be able to use camera in my app i've decided to use CCamera class and MCameraObserver2, below yuo'll find all my class code:

    @
    //MainWindow.h
    #ifndef MAINWINDOW_H
    #define MAINWINDOW_H

    #include <QMainWindow>
    #include <ecam.h>

    namespace Ui {
    class MainWindow;
    }

    class MainWindow : public QMainWindow, public MCameraObserver2
    {
    Q_OBJECT

    public:
    explicit MainWindow(QWidget *parent = 0);

    //Derived from MCameraObserver2
    

    public:
    void HandleEvent(const TECAMEvent &);
    void ImageBufferReady(MCameraBuffer &, TInt);
    void VideoBufferReady(MCameraBuffer &, TInt);
    void ViewFinderReady(MCameraBuffer &, TInt);

    ~MainWindow();
    

    private:
    Ui::MainWindow *ui;
    bool iCameraOn;

    private slots:
    void on_pushButton_clicked();

    public:
    CCamera *iCamera;
    TCameraInfo iCameraInfo;

    };

    #endif // MAINWINDOW_H

    @

    @
    //MainWindow.cpp
    #include <ecam.h>

    //----------------
    //To remove
    #include <QDebug>
    //----------------

    #include "MainWindow.h"
    #include "ui_MainWindow.h"

    MainWindow::MainWindow(QWidget *parent) : QMainWindow(parent), ui(new Ui::MainWindow)
    {
    ui->setupUi(this);
    iCamera=0;
    QWidget::setWindowFlags(windowFlags() | Qt::WindowSoftkeysVisibleHint);
    setWindowFlags(Qt::WindowSoftkeysVisibleHint); //To be ablet to see down soft keys
    iCameraOn=false;
    }

    MainWindow::~MainWindow()
    {
    qDebug()<<"Delete MainWindow";
    if (iCamera!=0)
    {
    iCamera->Release();
    delete iCamera;
    iCamera=0;
    }
    delete ui;
    }

    void MainWindow::on_pushButton_clicked()
    {
    //Activate Camera
    // iCamera=CCamera::New2L(*this,CCamera::CamerasAvailable(),(TInt) 50);

    TInt a_TInt_NoOfCameraAvailable=CCamera::CamerasAvailable();
    int a_int_NoOfCameraAvailable=(int) a_TInt_NoOfCameraAvailable;
    qDebug()<<"CamerasAvailable return value: "<<a_int_NoOfCameraAvailable;
    if (a_int_NoOfCameraAvailable>0)
    {
        if (iCamera==NULL)
        {
            qDebug()<<"00 - Building iCamera and reserve it";
            iCamera=CCamera::New2L(*this,0,0);
            iCamera->Reserve();
        }
    }
    

    }

    void MainWindow::HandleEvent(const TECAMEvent & aEvent)
    {
    QString aString="I'm in HandleEvent";
    qDebug()<<aString;

    switch (aEvent.iEventType.iUid)
    {
    case 270499131:
        {
            //Reserve Complete
            qDebug()<<"01 - Reserve Complete start power on";
            if (iCameraOn==false)
            {
                qDebug()<<"MainWindow::HandleEvent iCamera->PowerOn();";
                iCamera->PowerOn();
                iCameraOn=true;
            }
            break;
        }
    case 270499132:
        {
            //PowerOn Complete
            qDebug()<<"02 - Power On complete";
            iCameraInfo;
            iCamera->CameraInfo(iCameraInfo);
            iCamera->PrepareImageCaptureL(CCamera::EFormatJpeg,0,TRect(0,0,360,640));
            break;
        }
    default:
        {
            qDebug()<<"aEvent= "<<(int)aEvent.iEventType.iUid;
            break;
        }
    }
    

    }

    void MainWindow::ImageBufferReady(MCameraBuffer & aCameraBuffer, TInt)
    {
    QString aString="I'm in ImageBufferReady";
    qDebug()<<aString;
    }

    void MainWindow::VideoBufferReady(MCameraBuffer &aCameraBuffer, TInt)
    {
    QString aString="I'm in VideoBufferReady";
    qDebug()<<aString;
    }

    void MainWindow::ViewFinderReady(MCameraBuffer &aCameraBuffer, TInt)
    {
    QString aString="I'm in ViewFinderReady";
    qDebug()<<aString;
    }

    @

    But when i run program console said: 'CActiveScheduler::RunIfReady() returned error: -5'

    Could you please le tme know where i'm wronging.

    Thanks.


Log in to reply
 

Looks like your connection to Qt Forum was lost, please wait while we try to reconnect.