×

Discussion Board

Results 1 to 5 of 5
  1. #1
    Registered User
    Join Date
    Nov 2010
    Posts
    11

    access to sensors on s60 with qt mobility

    hi,

    i got some experience with qt, but i am new to symbian programming.
    i am writing a first small application so access some sensor. i started
    with the QAmbientLightSensor. In the simulator everything runs fine,
    but on the device (5800 XM) the light level is always undefined.

    My Code:
    Configuration in the .pro-file:
    CONFIG += mobility
    MOBILITY += sensors
    Setup an check the sensor in the MainWindow-Constructor:
    ambientLightSensor = new QAmbientLightSensor;
    if (!ambientLightSensor->connectToBackend())
    warning("Warning: Could not connect to backend.");
    if (!ambientLightSensor->start())
    warning("Warning: Could not start sensor.");
    if (!ambientLightSensor->isActive())
    warning("Warning: sensor is not active.");
    Read in a private slot:
    QAmbientLightReading::LightLevel lightLevel = ambientLightSensor->reading()->lightLevel();
    I am using Qt 4.7.0, Qt Mobility 1.02 and the remote compiler.

    Can anybody tell me what i am doing wrong? Are there missing configurations (perhaps target.capabilites)?

    Best regards
    ghal maraz

  2. #2
    Nokia Developer Moderator
    Join Date
    Sep 2004
    Location
    Tampere, Finland
    Posts
    11,359

    Re: access to sensors on s60 with qt mobility

    Quote Originally Posted by Ghal_Maraz View Post
    Can anybody tell me what i am doing wrong? Are there missing configurations (perhaps target.capabilites)?
    ReadDeviceData is indeed a capability requirement so add it to your project.
    -- Lucian

    If you are not yet a DVLUP member it is time to correct that mistake :) Click here to join: http://www.dvlup.com/lucian/Invite

  3. #3
    Registered User
    Join Date
    Nov 2010
    Posts
    11

    Re: access to sensors on s60 with qt mobility

    Oh, sorry. I forgot to quote that. Because i dont know which capabilites
    are for which access exactly i included all i could find:

    symbian {
    TARGET.CAPABILITY = Location \
    NetworkServices \
    LocalServices \
    ReadUserData \
    WriteUserData \
    UserEnvironment \
    ReadDeviceData \
    WriteDeviceData
    }

  4. #4
    Registered User
    Join Date
    Nov 2010
    Posts
    11

    Re: access to sensors on s60 with qt mobility

    No ideas? Does the application needs to be Symbian-signed or something like that?
    Does anybody now where i can get an example or demo project with the same issue
    (reading the ambient light level)?

    best regards

  5. #5
    Registered User
    Join Date
    Nov 2010
    Posts
    11

    Re: access to sensors on s60 with qt mobility

    i hate if i am searching for errors and find an unresolved thread.
    i finally found my error.

    i replaced
    QAmbientLightReading::LightLevel lightLevel = ambientLightSensor->reading()->lightLevel();
    with
    QAmbientLightReading *reading = ambientLightSensor->reading();
    QAmbientLightReading::LightLevel lightLevel = reading->lightLevel();
    and now it works.

    best regards
    ghal maraz

Similar Threads

  1. Qt Mobility and video frame access
    By jtyrkko in forum [Archived] Qt Mobility Project
    Replies: 1
    Last Post: 2010-08-21, 10:33
  2. Qt Simulator and sensors
    By mainguet in forum [Archived] Qt SDKs and Tools
    Replies: 5
    Last Post: 2010-07-19, 09:09
  3. Replies: 3
    Last Post: 2010-06-30, 01:17
  4. How to run a Qt Mobility app on the S60 emulator
    By ceefour in forum [Archived] Qt Mobility Project
    Replies: 4
    Last Post: 2010-01-27, 07:06
  5. S60 Qt Kinetic using sensors
    By jhautaka in forum Symbian User Interface
    Replies: 0
    Last Post: 2008-11-17, 12:25

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
×