⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 statevarobserver.h

📁 基于Symbian平台下随心所欲控制屏幕的灯亮熄.在观看视频和发短信时这一点非常重要.
💻 H
字号:
/**
*
* CStateVarObserver StateVarObserver.h
* This is the CActive derived class which enables the notification
* of a change in a State Variable.
*
* Copyright (c) 2004 Nokia Corporation
* version 2.0
*/

#ifndef __STATEVAROBSERVER_H__
#define __STATEVAROBSERVER_H__

// INCLUDES

// System includes

#ifdef __SERIES60_3X__
#include <e32base.h>
#include <etel3rdparty.h>
#else
#include <saclient.h>
#endif

//Constants, see 
//http://www.forum.nokia.com/Technical_Library/FNTL/Retrieving_battery_strength_on_S60_2nd_Ed_FP2_devices.htm
const TInt KUidBatteryBarsValue = 0x100052D3;
const TUid KUidBatteryBars ={KUidBatteryBarsValue};

enum TSABatteryBars
{
ESABBars_0,
ESABBars_1,
ESABBars_2,
ESABBars_3,
ESABBars_4,
ESABBars_5,
ESABBars_6,
ESABBars_7
};


// FORWARD DECLARATIONS
class CPowerResManContainer;

// CLASS DECLARATION



class CStateVarObserver : public CActive
    {
public: // Construction and destruction.
    /**
     * Function:    NewL
     * Description: Construct a CStateVarObserver object.
     *
     * Param:      aUid. TUid value of the system agent to be observed
     * Param:      aAppContainer. Container where updates to system agent will
     *             be displayed
     * Param:      aTelephony (in 3rd edition only). A reference to CTelephony.
     * Returns:    A pointer to the created instance of CStateVarObserver
     */
    static CStateVarObserver* NewL(TUid aUid, CPowerResManContainer& aAppContainer
        #ifdef __SERIES60_3X__
        ,CTelephony &aTelePhony
        #endif
        );

    /**
     * Function:    NewL
     * Description: Construct a CStateVarObserver object.
     *
     * Param:      aUid. TUid value of the system agent to be observed
     * Param:      aAppContainer. Container where updates to system agent will
     *             be displayed
     * Param:      aTelephony (in 3rd edition only). A reference to CTelephony.
     * Returns:    A pointer to the created instance of CStateVarObserver
     *             (pointer is left on the cleanup stack)
     */
    static CStateVarObserver* NewLC(TUid aUid, CPowerResManContainer& aAppContainer
        #ifdef __SERIES60_3X__
        ,CTelephony &aTelePhony
        #endif
        );
    

    /**
     * Function:    ~CStateVarObserver
     * Description: destroys CStateVarObserver object.
     *
     */
    ~CStateVarObserver();

public: // Methods.
    /**
     * Function:    StartL
     * Description: Called when the monitoring of the state variable should begin.
     *
     */
    void StartL();

    /**
     * Function:    ProcessCurrentStateL
     * Description: Gets the current value of the state variable and informs the container
     *              Demonstrates getting current values of state variables
     *              from the System Agent
     *
     */
    void ProcessCurrentStateL();
    
private:    // Construction.
    /**
     * Function:    CStateVarObserver
     * Description: Constuctor
     *
     * Param:      aUid. TUid value of the system agent to be observed
     * Param:      aAppContainer. Container where updates to system agent will
     *             be displayed
     * Param:      aTelephony (in 3rd edition only). A reference to CTelephony.
     */
    CStateVarObserver(TUid aUid, CPowerResManContainer& aAppContainer
        #ifdef __SERIES60_3X__
        ,CTelephony &aTelePhony
        #endif
        );

    /**
     * Function:    ConstructL
     * Description: 2nd Phase Constructor
     *
     */
    void ConstructL();

private:    // From CActive.
    /**
     * Function:    RunL
     * Description: Handles request completion - called by the Active Scheduler
     *              when a change to the state variable being monitored has
     *              occurred
     *
     */
    void RunL();

    /**
     * Function:    DoCancel
     * Description: Cancel outstanding request - called by Cancel()
     *
     */
    void DoCancel();

private:    // Data
    CPowerResManContainer&  iAppContainer;

    #ifdef __SERIES60_3X__
	//Network signal strength information
	CTelephony::TSignalStrengthV1 iSigStrengthV1;
	CTelephony::TSignalStrengthV1Pckg iSigStrengthV1Pckg;

	//Battery information
	CTelephony::TBatteryInfoV1Pckg iBatteryInfoV1Pckg;
	CTelephony::TBatteryInfoV1 iBatteryInfoV1;

	//For charger information
	CTelephony::TIndicatorV1 iIndicatorV1;
   	CTelephony::TIndicatorV1Pckg iIndicatorV1Pckg;

    CTelephony& iTelephony; //For network, battery and charger information
    #else
    RSystemAgent    iSysAgent;
    TSysAgentEvent  iSysAgentEvent;
    #endif
    TUid iObservingUid; //to know what we're observing
    TInt iObservedValue; //the value of what we're observing
    
    TInt iSignal;
    TInt iBattery;
    TInt iCharger;
    };


#endif  // __STATEVAROBSERVER_H__

// End of File

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -