Discussion Board

Results 1 to 3 of 3
  1. #1
    Registered User Ghal_Maraz's Avatar
    Join Date
    Nov 2010
    Posts
    11
    hi,

    i am trying to read out data from the magnetometer with qt mobility framework on my 5800.
    but when i access the reading an error occurs. in the simulator everything works fine.
    here my code:

    In the constructor:

    Code:
    magnetometerSensor = new QMagnetometer(this);
    magnetometerSensor->start();

    In a timer triggered method:

    Code:
    QMagnetometerReading *magReading = magnetometerSensor->reading();
    qreal xMag = magReading->x();
    qreal yMag = magReading->y();
    qreal zMag = magReading->z();

    The error:

    Process 13708, thread 13709 stopped at 0x791bd860: A data abort exception has occurred.

    It occurs in this line;

    Code:
    qreal xMag = magReading->x();

    i am using qt 4.6.3 and qt mobility 1.0.0. The same error occurs when i'm using QCompass instead of QMagnetometer.

    thanks and best regards,
    ghal maraz

  2. #2
    Registered User miksuh's Avatar
    Join Date
    Nov 2007
    Location
    Espoo, Finland
    Posts
    25
    Unfortunately Nokia 5800 XPressMusic has no magnetometer (compass), so you can't use that feature on that phone.

    Before trying to use a sensor, your application should check validity of sensor which tells if the sensor is available or not. So your application should be changed to something like this:

    Code:
    QMagnetometer *magnetometerSensor = new QMagnetometer(this);
    
    if (magnetometerSensor->isAvailable())
    {
        ...
        magnetometerSensor->start();
        ...
    }
    You can also check availability of other hardware features. You can do that by using QtMobility's System Information API. Eg. if you want to check if GPS is available then you can check it this way:

    Code:
    QSystemInfo info;
    if (info.hasFeatureSupported(QSystemInfo::LocationFeature))
    {
        ...
    }
    Last edited by miksuh; 2010-12-19 at 20:24.

  3. #3
    Registered User Ghal_Maraz's Avatar
    Join Date
    Nov 2010
    Posts
    11
    Oh, thanks. I had in mind there was a magnetometer on the 5800, but i didn't check.

Similar Threads

  1. Magnetometer data
    By torsak1 in forum General Development Questions
    Replies: 13
    Last Post: 2012-06-12, 19:01
  2. Error for reading Data from socket
    By rati2010 in forum Symbian C++
    Replies: 10
    Last Post: 2008-07-31, 12:12
  3. Read error after reading data from socket
    By abhinav_kalra in forum Symbian C++
    Replies: 2
    Last Post: 2008-05-18, 13:45
  4. 5140i magnetometer compass
    By aBrage in forum Mobile Web Site Development
    Replies: 0
    Last Post: 2006-03-22, 16:31
  5. Bluetooth-data reading Error
    By future_proof in forum Mobile Java General
    Replies: 0
    Last Post: 2004-11-04, 10:38

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Nokia Developer aims to help you create apps and publish them so you can connect with users around the world.

京ICP备05048969号  © Copyright Nokia 2013 All rights reserved