×

Discussion Board

Page 1 of 2 12 LastLast
Results 1 to 15 of 25
  1. #1
    Registered User
    Join Date
    Aug 2009
    Posts
    15

    Question How to Enable Power Saving Mode

    Hello, I'm trying to enable "Power Saving Mode" in Qt, I found how to enable Power saving mode with Symbian^3 (Symbian C++ Code). So it tried to convert it to work in Qt C++ but I failed.

    Could someone convert it to work in Qt C++? or give me another solution.
    Last edited by Motaz New; 2013-04-10 at 13:20.

  2. #2
    Nokia Developer Moderator
    Join Date
    Mar 2003
    Location
    Lempäälä/Finland
    Posts
    29,170

    Re: How to Enable Power Saving Mode

    Basically as far as I know there is no other ways, unless of course you find some internal C++ API which would do the stuff.

    anyway, the code snipped you have shown works with PS keys, thus should be fairly easy to get working. And thus you might want to explain on what you have tried, and what has happened..

  3. #3
    Registered User
    Join Date
    Aug 2009
    Posts
    15

    Post Re: How to Enable Power Saving Mode

    Thank you symbianyucca, this is my work (I beginner ):

    psmmode_p.h
    Code:
    #ifndef PSMMODE_P_H
    #define PSMMODE_P_H
    
    //headers from sf-Sources
    #include <psmclientobserver.h>
    #include <psmclient.h>
    #include <psmsettings.h>
    #include <psmmode.h>
    
    #ifdef BUILD_DLL
    #define DLL_EXPORT Q_DECL_EXPORT
    #else
    #define DLL_EXPORT Q_DECL_IMPORT
    #endif
    
    class DLL_EXPORT PSMModePrivate : public MPsmClientObserver
    {
    public:
        //static PSMModePrivate* NewL(PSMMode *aPublicAPI = 0);
        PSMModePrivate();
        ~PSMModePrivate();
    
    public:
        void runPSMMode();
        void exitPSMMode();
    
    private:
        CPsmClient *iPsmClient;
    };
    
    #endif // PSMMODE_P_H
    psmmode_p.cpp
    Code:
    #include "psmmode_p.h"
    #include "psmmode.h"
    
    PSMModePrivate::PSMModePrivate()
    {
        QT_TRAP_THROWING(iPsmClient = CPsmClient::NewL( *this ));
    }
    
    PSMModePrivate::~PSMModePrivate()
    {
        delete iPsmClient;
        iPsmClient = NULL;
    }
    
    void PSMModePrivate::runPSMMode()
    {
        iPsmClient->RequestPowerSaveModeNotification();
        iPsmClient->ChangePowerSaveMode(EPsmsrvModePowerSave);
    }
    
    void PSMModePrivate::exitPSMMode()
    {
        iPsmClient->RequestPowerSaveModeNotification();
        iPsmClient->ChangePowerSaveMode(EPsmsrvModeNormal);
    }

  4. #4
    Nokia Developer Moderator
    Join Date
    Mar 2003
    Location
    Lempäälä/Finland
    Posts
    29,170

    Re: How to Enable Power Saving Mode

    And what is wrong with it ?

  5. #5
    Registered User
    Join Date
    Aug 2009
    Posts
    15

    Re: How to Enable Power Saving Mode

    My program crash when run the code!!!

  6. #6
    Nokia Developer Moderator
    Join Date
    Mar 2003
    Location
    Lempäälä/Finland
    Posts
    29,170

    Re: How to Enable Power Saving Mode

    so then you should try obtaining the panic code for the crash: http://www.developer.nokia.com/Commu...ded_panic_code it would likely help on determining what is going wrong in there. Also if you could find which line of code is causing the crash, it would also help.

  7. #7
    Registered User
    Join Date
    Aug 2009
    Posts
    15

    Re: How to Enable Power Saving Mode

    I found the line where causing the crash

    Code:
    void PSMModePrivate::runPSMMode()
    {
    ->  iPsmClient->RequestPowerSaveModeNotification();
        iPsmClient->ChangePowerSaveMode(EPsmsrvModePowerSave);
    }
    and I get a message

    ---------------------------
    Signal received
    ---------------------------
    The inferior stopped because it received a signal from the Operating System.
    Signal name : SIGSEGV
    Signal meaning :Segmentation fault
    ---------------------------
    OK
    ---------------------------

  8. #8
    Nokia Developer Moderator
    Join Date
    Mar 2003
    Location
    Lempäälä/Finland
    Posts
    29,170

    Re: How to Enable Power Saving Mode

    Firstly note that, you should not expect this to work in simulator or emulator environments. Secondly, please check the link given and get the actual panic code.

    if otehr ways fails, you could always try out the Y-Tasks:Crash monitor, the free self-signed version is enough for this use case.

  9. #9
    Registered User
    Join Date
    Aug 2009
    Posts
    15

    Post Re: How to Enable Power Saving Mode

    Firstly note that, you should not expect this to work in simulator or emulator environments.
    I tested it on Nokia 500.

    Panic code:
    Process: BatteryStatus.exe[e6fb4418]0001
    Thread: Battery Status
    Category: KERN-EXEC
    Reason: 3

  10. #10
    Nokia Developer Moderator
    Join Date
    Mar 2003
    Location
    Lempäälä/Finland
    Posts
    29,170

    Re: How to Enable Power Saving Mode

    ok, that is reasonable, and teh reason is that you never construct the iPsmClient, thus the pointer is NULL.

  11. #11
    Registered User
    Join Date
    Aug 2009
    Posts
    15

    Re: How to Enable Power Saving Mode

    ok, that is reasonable, and teh reason is that you never construct the iPsmClient, thus the pointer is NULL.
    How to fix that please?

  12. #12
    Nokia Developer Moderator
    Join Date
    Mar 2003
    Location
    Lempäälä/Finland
    Posts
    29,170

    Re: How to Enable Power Saving Mode

    remove the commenting from //static PSMModePrivate* NewL(PSMMode *aPublicAPI = 0); and implement the class, and once you do instantiate the class do call the NewL function. Also do remember to instantiate and fully construct the iPsmClient inside the implemented function.

  13. #13
    Registered User
    Join Date
    Aug 2009
    Posts
    15

    Re: How to Enable Power Saving Mode

    Quote Originally Posted by symbianyucca View Post
    remove the commenting from //static PSMModePrivate* NewL(PSMMode *aPublicAPI = 0); and implement the class, and once you do instantiate the class do call the NewL function. Also do remember to instantiate and fully construct the iPsmClient inside the implemented function.
    Thank you, but can you guide me step by step... please

  14. #14
    Nokia Developer Moderator
    Join Date
    Mar 2003
    Location
    Lempäälä/Finland
    Posts
    29,170

    Re: How to Enable Power Saving Mode

    I would suggest checking base literature on object oriented programming, anything not too theoretical and C++ related would propably be best.

    Basically if you check the original link you gave, you could see how the instance of the iPsmClient is constructed in there, and as there is full example, you could also check it to see how it actually works.

    So please try out, and once you have questions, please provide more details i.e.:
    - what have you tried
    - What it is that you expect to happen
    - What is actually observed happening and not happening

  15. #15
    Registered User
    Join Date
    Aug 2009
    Posts
    15

    Post Re: How to Enable Power Saving Mode

    Hello, I tried this:

    I Created this files
    1- psmmode.h & psmmode.cpp
    2- psmmode_p.h & psmmode_p.cpp

    But I get this error:
    psmmode.cpp:5: error: cannot allocate an object of abstract type 'PSMModePrivate'
    Last edited by Motaz New; 2013-04-14 at 21:42.

Similar Threads

  1. Question about Power Saving Mode
    By ashraf fawzy in forum Symbian
    Replies: 6
    Last Post: 2011-11-18, 06:41
  2. SIP, WLAN and power saving
    By rkalff in forum Symbian
    Replies: 1
    Last Post: 2006-12-07, 14:02
  3. How to protect against power failure while saving data in RMS
    By rushabh_it in forum Mobile Java General
    Replies: 6
    Last Post: 2006-10-31, 02:57
  4. Hot to turn off power saving mode
    By desijatt in forum Mobile Java General
    Replies: 1
    Last Post: 2006-09-13, 08:31
  5. bluetooth power saving modes(park, sniff, etc. ) in series 60?
    By a4peace in forum Bluetooth Technology
    Replies: 3
    Last Post: 2004-11-30, 11:23

Posting Permissions

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