Welcome!

Welcome to the official BlackBerry Support Community Forums.

This is your resource to discuss support topics with your peers, and learn from each other.

inside custom component

Native Development

Reply
BlackBerry Development Advisor
smcveigh
Posts: 668
Registered: ‎11-29-2011
My Device: developer

Re: Open playbook camera in Qt project

I don't know what "a main class" is.

 

If all you want to do is C++-ify the NativeCamera sample (eg. without Qt), then that will work fine.

I don't see your definition of the class though, so I have no way of knowing how you've defined the member functions.

 

New Developer
vladest
Posts: 88
Registered: ‎06-16-2012
My Device: N950/E7/N808/N9/X7/BB10 Alpha

Re: Open playbook camera in Qt project

I see no QApplication instance in main(), so dont think, Qt takes control over window or event

Qt/Symbian/Meego/BB10/Cascades developer
Contributor
somedeveloperguy
Posts: 34
Registered: ‎10-08-2012
My Device: developer

Re: Open playbook camera in Qt project

with a main class I mean the class containing the method

int main(int argc, char *argv[])

 @vladest:

that is true.

but my problem right now is that it won't take a picture, even though it is just running the same code but in a serparate class instead of the class main.cpp

 

and before i go and fix the link with Qt I want the camera to start and take pictures this way.

New Developer
vladest
Posts: 88
Registered: ‎06-16-2012
My Device: N950/E7/N808/N9/X7/BB10 Alpha

Re: Open playbook camera in Qt project

[ Edited ]

can you provide full project archived, I'll try to play around with it?

Qt/Symbian/Meego/BB10/Cascades developer
Contributor
somedeveloperguy
Posts: 34
Registered: ‎10-08-2012
My Device: developer

Re: Open playbook camera in Qt project

at the moment the code i posted in my first reply to this topic(message 3) is al the code i use except for camerastart.h

so here is the code of the .h file:

#ifndef CAMERASTART_H
#define CAMERASTART_H

#include <bps/event.h>

class cameraStart
{
public:
    cameraStart();
    void start();
private:
    int init_camera(camera_unit_t unit);
    void run_state_machine();
    void still_callback(camera_handle_t handle, camera_buffer_t* buf, void* arg);
    void shutter_callback(camera_handle_t handle, void* arg);
    void handle_event();
    void handle_photo_done_event(bps_event_t *event);
    void handle_navigator_event(bps_event_t *event);
    void handle_screen_event(bps_event_t *event);
};

#endif // CAMERASTART_H

 

 

New Developer
vladest
Posts: 88
Registered: ‎06-16-2012
My Device: N950/E7/N808/N9/X7/BB10 Alpha

Re: Open playbook camera in Qt project

what about .pro file?

Qt/Symbian/Meego/BB10/Cascades developer
New Developer
vladest
Posts: 88
Registered: ‎06-16-2012
My Device: N950/E7/N808/N9/X7/BB10 Alpha

Re: Open playbook camera in Qt project

and bar-descriptor.xml ?

Qt/Symbian/Meego/BB10/Cascades developer
Contributor
somedeveloperguy
Posts: 34
Registered: ‎10-08-2012
My Device: developer

Re: Open playbook camera in Qt project

sorry, forgot those because i dont change them to find the problem.

 

.pro

TEMPLATE = app

SOURCES += main.cpp \
    camerastart.cpp
HEADERS += camerastart.h

OTHER_FILES += bar-descriptor.xml

BB_NDK = D:/BlackBerry
INCLUDEPATH += $$BB_NDK/target/qnx6/usr/include
LIBS += -D:/BlackBerry/target/qnx6/armle-v7/usr/lib -lcamapi -lbps -lscreen

 bar-descriptor.xml:

<?xml version="1.0" encoding="utf-8" standalone="no"?>
<qnx xmlns="http://www.qnx.com/schemas/application/1.0">
    <id>ID</id>
    <name>testform</name>
    <versionNumber>1.1.0</versionNumber>
    <description>DESCRIPTION</description>

    <initialWindow>
        <systemChrome>none</systemChrome>
        <transparent>false</transparent>
        <autoOrients>true</autoOrients>
        <aspectRatio>landscape</aspectRatio>
    </initialWindow>

    <env var="QML_IMPORT_PATH" value="app/native/imports"/>
    <env var="QT_PLUGIN_PATH" value="app/native/plugins"/>
    <env var="LD_LIBRARY_PATH" value="app/native/lib"/>
    <arg>-platform</arg>
    <arg>blackberry</arg>

    <action system="true">run_native</action>
    <action>use_camera</action>
    <action>access_shared</action>
    <asset entry="true" path="testform" type="Qnx/Elf">testform</asset>

    <asset path="splashscreen.png">splashscreen.png</asset>
    <asset path="icon.png">icon.png</asset>

    <!-- These values will be replaced when deploying in Qt Creator -->
    <asset path="%QT_INSTALL_LIBS%">lib</asset>
    <asset path="%QT_INSTALL_PLUGINS%">plugins</asset>
    <asset path="%QT_INSTALL_IMPORTS%">imports</asset>

    <icon><image>icon.png</image></icon>
    <splashscreen>splashscreen.png</splashscreen>
</qnx>

 

maybe also usefull to know i am working in Qt creator

New Developer
vladest
Posts: 88
Registered: ‎06-16-2012
My Device: N950/E7/N808/N9/X7/BB10 Alpha

Re: Open playbook camera in Qt project

ok, quite easy:

just remember: callbacks should always be static!

 

#include<bps/event.h>
 
classcameraStart
{
public:
cameraStart();
voidstart();
private:
intinit_camera(camera_unit_tunit);
voidrun_state_machine();
staticvoidstill_callback(camera_handle_thandle,camera_buffer_t*buf,void*arg);
staticvoidshutter_callback(camera_handle_thandle,void*arg);
voidhandle_event();
voidhandle_photo_done_event(bps_event_t*event);
voidhandle_navigator_event(bps_event_t*event);
voidhandle_screen_event(bps_event_t*event);
};
 
#endif// CAMERASTART_H

Qt/Symbian/Meego/BB10/Cascades developer
New Developer
vladest
Posts: 88
Registered: ‎06-16-2012
My Device: N950/E7/N808/N9/X7/BB10 Alpha

Re: Open playbook camera in Qt project

sorry, for weird c'n'p:

#include <bps/event.h>

class cameraStart
{
public:
    cameraStart();
    void start();
private:
    int init_camera(camera_unit_t unit);
    void run_state_machine();
    static void still_callback(camera_handle_t handle, camera_buffer_t* buf, void* arg);
    static void shutter_callback(camera_handle_t handle, void* arg);
    void handle_event();
    void handle_photo_done_event(bps_event_t *event);
    void handle_navigator_event(bps_event_t *event);
    void handle_screen_event(bps_event_t *event);
};

#endif // CAMERASTART_H

 

Qt/Symbian/Meego/BB10/Cascades developer