×

Discussion Board

Results 1 to 8 of 8
  1. #1
    Registered User
    Join Date
    Sep 2011
    Posts
    4

    Question QSystemDeviceInfo batterylevel() not changed

    Hi,
    Using QSystemDeviceInfo can not get battery level correctly.

    QSystemDeviceInfo *dev_info;
    dev_info = new QSystemDeviceInfo(this);

    int battery=dev_info->batteryLevel();
    QString qStr = QString::number(battery);
    qDebug()<<"Battery Level"<< qStr;

    using this code get initial batterylevel and even after batterylevel change and call above funtion it get the same reading.. but when application restart it correctly updated

    i try this using signal but it also given the same result.
    connect(deviceInfo, SIGNAL(batteryLevelChanged(int)),
    this, SLOT(batterylevel(int)));

    any solution?? how i get the correct battery level from the device

    Thank you...

  2. #2
    Super Contributor
    Join Date
    Oct 2008
    Location
    INDIA
    Posts
    2,326

    Re: QSystemDeviceInfo batterylevel() not changed

    Compare you r code with this code : QSystemDeviceInfo

    regards,
    rahul

  3. #3
    Registered User
    Join Date
    Sep 2011
    Posts
    4

    Re: QSystemDeviceInfo batterylevel() not changed

    Thanks for the replay, i was implements my code according to that example but problem remaining. it only updeted and correct value display after application restart. otherwise value doesn't changed. (in qt emulator my code work fine and when changed battery level it updated accordingly) any suggestion..

    Thank you..

  4. #4
    Super Contributor
    Join Date
    Oct 2008
    Location
    INDIA
    Posts
    2,326

    Re: QSystemDeviceInfo batterylevel() not changed

    It means whenever you start application at that time it will get the percentage value of the battery for first time and display it.

    For change persantage value continuasly, you can use loop , so that code run continuasly after some time interval.

  5. #5
    Nokia Developer Champion
    Join Date
    Oct 2007
    Location
    જુનાગઢ - India
    Posts
    3,034

    Re: QSystemDeviceInfo batterylevel() not changed

    Usually signal "batteryLevelChanged()" would get emitted whenever there is change in battery level. Using any loops are not advisable, since it eat your cpu/processing power.

    If you are not getting any signal in "batteryLevelChanged()" and feel like it's bug, then you can report it here.

  6. #6
    Super Contributor
    Join Date
    Mar 2008
    Posts
    1,481

    Re: QSystemDeviceInfo batterylevel() not changed

    there is a bug report already filed for this
    https://bugreports.qt.nokia.com/browse/QTMOBILITY-1954

  7. #7
    Registered User
    Join Date
    Sep 2011
    Posts
    4

    Re: QSystemDeviceInfo batterylevel() not changed

    Thank you
    I used
    deviceInfo= new QSystemDeviceInfo(this);
    connect(deviceInfo, SIGNAL(batteryLevelChanged(int)),this, SLOT(batterylevel(int)));

    in the batteryLevelChanged(int) need to emit this signal whenever it change the batterylevel. in my case it never emit during the application running (worked fine in emulator only device does not work this)

  8. #8
    Super Contributor
    Join Date
    Mar 2008
    Posts
    1,481

    Re: QSystemDeviceInfo batterylevel() not changed

    Hi,
    I got additional info about it, understood that it will not be fixed in Belle but will be fixed in next release after Belle, whatever the name.

Similar Threads

  1. Issue with including "Qsystemdeviceinfo" in batterylevel tutorial
    By Cannabis2011 in forum [Archived] Beginning Qt
    Replies: 2
    Last Post: 2011-07-05, 18:25
  2. Any Any WorkArround to Get batteryLevel in series40 in j2me
    By neerajj50@gmail.com in forum Mobile Java General
    Replies: 2
    Last Post: 2011-02-23, 19:43
  3. Linking issues with QSystemDeviceInfo
    By shrenik_shah in forum [Archived] Qt Mobility Project
    Replies: 0
    Last Post: 2010-11-24, 05:58
  4. BatteryIndicator example - undefined reference to QSystemDeviceInfo
    By lukasd in forum [Archived] Qt Mobility Project
    Replies: 3
    Last Post: 2010-11-09, 20:13
  5. BatteryLevel-CTelephony class
    By kiran10182 in forum Symbian
    Replies: 7
    Last Post: 2006-04-27, 22:51

Posting Permissions

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