×

Discussion Board

Page 2 of 2 FirstFirst 12
Results 16 to 25 of 25
  1. #16
    Nokia Developer Moderator
    Join Date
    Mar 2003
    Location
    Lempäälä/Finland
    Posts
    29,166

    Re: How to Enable Power Saving Mode

    You already had the PSMModePrivate working earlier, so what did you do it to make it not to work ? Basically I'm not doing consultancy, so I would not want to go through big pieces of code, instead, it would be better for future if you could stay on the point.

    So basically , if you commented out the NewL, and then added the function to the cpp file, it should compile just as it did earlier. Then if you add the constructing code for the iPsmClient into that NewL fucntion, then you likely would get very different error.

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

    Re: How to Enable Power Saving Mode

    Thank you symbianyucca, Now I gave up

  3. #18
    Nokia Developer Moderator
    Join Date
    Mar 2003
    Location
    Lempäälä/Finland
    Posts
    29,166

    Re: How to Enable Power Saving Mode

    Basically we are here to help, and we can not really do all things, basically if you would follow the advises given, and try out, then you would get it working just fine. anyway, if you don't want to do, its of course upto you.

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

    Re: How to Enable Power Saving Mode

    Hi, I followed your advises symbianyucca but the program freezes when try to run the private constructor PSMModePrivate::PSMModePrivate(PSMMode *aPublicAPI)

    psmmode_p.cpp
    Code:
    #include "psmmode_p.h"
    #include "psmmode.h"
    
    PSMModePrivate* PSMModePrivate::NewL(PSMMode *aPublicAPI)
    {
        PSMModePrivate* self = new (ELeave) PSMModePrivate(aPublicAPI);
        // push onto cleanup stack in case self->ConstructL leaves
        CleanupStack::PushL(self);
        // complete construction with second phase constructor
        self->ConstructL();
        CleanupStack::Pop(self);
        return self;
    }
    
    void PSMModePrivate::ConstructL()
    {
        QT_TRAP_THROWING(iPsmClient = CPsmClient::NewL( *this ));
        emit iPsmClient->RequestPowerSaveModeNotification();
    }
    
    PSMModePrivate::PSMModePrivate(PSMMode *aPublicAPI)
     : d_ptr(aPublicAPI), CActive(CActive::EPriorityHigh)
    {
        CActiveScheduler::Add(this);
    //    QT_TRAP_THROWING(iPsmClient = CPsmClient::NewL( *this ));
    //    iPsmClient->RequestPowerSaveModeNotification();
    }
    
    PSMModePrivate::~PSMModePrivate()
    {
        Cancel();
        delete iPsmClient;
        //iPsmClient = NULL;
    }
    
    void PSMModePrivate::runPSMMode()
    {
        emit iPsmClient->RequestPowerSaveModeNotification();
        emit iPsmClient->ChangePowerSaveMode(EPsmsrvModePowerSave);
    }
    
    void PSMModePrivate::exitPSMMode()
    {
        emit iPsmClient->RequestPowerSaveModeNotification();
        emit iPsmClient->ChangePowerSaveMode(EPsmsrvModeNormal);
    }
    
    void PSMModePrivate::DoCancel()
    {
    
    }
    
    void PSMModePrivate::RunL()
    {
    
    }
    
    void PSMModePrivate::PowerSaveModeChangeError(const TInt aError)
    {
        if ( aError != KErrCancel ) // ignore error if it is due cancellation of notification request
        {
            if ( aError != KErrServerTerminated ) // new request would cause another completion with this error code (infinitely)
            {
                emit iPsmClient->RequestPowerSaveModeNotification(); // must be requested after every completion
            }
        }
    }
    
    void PSMModePrivate::PowerSaveModeChanged(const TPsmsrvMode aMode)
    {
        emit iPsmClient->RequestPowerSaveModeNotification(); // must be requested after every completion
    }

  5. #20
    Nokia Developer Moderator
    Join Date
    Mar 2003
    Location
    Lempäälä/Finland
    Posts
    29,166

    Re: How to Enable Power Saving Mode

    PSMModePrivate::PSMModePrivate(PSMMode *aPublicAPI) doe not really do anything, thus I would not see how it could freeze, thus I would suppose it is other place where it does the freezing, basically it must be other line of code.

    Also is this Normal GUI application ? basically non UI apps might in some cases be missing active schedluer and cleanup stack etc. which are needed by this code.

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

    Re: How to Enable Power Saving Mode

    Also is this Normal GUI application ?
    It's normal Qt GUI application.

  7. #22
    Nokia Developer Moderator
    Join Date
    Mar 2003
    Location
    Lempäälä/Finland
    Posts
    29,166

    Re: How to Enable Power Saving Mode

    Good, then it has Actice schedluer, & cleanup stack for symbian, so those should not be causing the problems. Then its back into the chase on where it actually hangs at.

    The line you earlier said hangs, is simply doing CActiveScheduler::Add(this); and that I have never ever seen hanging.

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

    Re: How to Enable Power Saving Mode

    You're right symbianyucca, The problem was due to a simple mistake in runPSMMode() and exitPSMMode() I used:
    iPsmClient->RequestPowerSaveModeNotification() instead of iPsmClient->CancelPowerSaveModeNotificationRequest()

    and the program work now.

    Thank you again symbianyucca for your help.

  9. #24
    Nokia Developer Moderator
    Join Date
    Mar 2003
    Location
    Lempäälä/Finland
    Posts
    29,166

    Re: How to Enable Power Saving Mode

    Quote Originally Posted by Motaz New View Post
    Thank you again symbianyucca for your help.
    Excellent, and good that you did not give up untill fixing it.

  10. #25
    Nokia Developer Champion
    Join Date
    Jun 2008
    Location
    Noida,India
    Posts
    4,025

    Re: How to Enable Power Saving Mode

    Writing a Wiki article would be a nice thing to do next

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
  •  
×