sysresmonitoring/oodmonitor/inc/Ood.h
changeset 0 2e3d3ce01487
child 21 c4cbaa4fb734
equal deleted inserted replaced
-1:000000000000 0:2e3d3ce01487
       
     1 /*
       
     2 * Copyright (c) 2007 Nokia Corporation and/or its subsidiary(-ies). 
       
     3 * All rights reserved.
       
     4 * This component and the accompanying materials are made available
       
     5 * under the terms of "Eclipse Public License v1.0"
       
     6 * which accompanies this distribution, and is available
       
     7 * at the URL "http://www.eclipse.org/legal/epl-v10.html".
       
     8 *
       
     9 * Initial Contributors:
       
    10 * Nokia Corporation - initial contribution.
       
    11 *
       
    12 * Contributors:
       
    13 *
       
    14 * Description:  Includes some common defines used in the OOD monitor app
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 #ifndef LAFSHUT_H
       
    20 #define LAFSHUT_H
       
    21 
       
    22 // SYSTEM INCLUDES
       
    23 
       
    24 // USER INCLUDES
       
    25 
       
    26 // CONSTANTS
       
    27 _LIT(KDriveZ, "z:");
       
    28 _LIT(KOOMWatcherResourceFileName, "lafmemorywatcher.rsc");
       
    29 const TInt KAlphaStartPoint = 65;
       
    30 const TInt KBreatheTime = 5000000;
       
    31 #ifdef _DEBUG
       
    32 _LIT(KCriticalMode, "%c: CRITICAL");
       
    33 _LIT(KWarningMode, "%c: WARNING");
       
    34 _LIT(KNormalMode, "%c: Normal");
       
    35 const TInt KMaxMsgSize = 256;
       
    36 #endif // _DEBUG
       
    37 
       
    38 // ---------------------------------------------------------
       
    39 //
       
    40 // ---------------------------------------------------------
       
    41 //
       
    42 NONSHARABLE_CLASS(CLafShutdownManager) : public CLafShutdownManagerBase
       
    43     {  // There are friends defined at end of this class definition.
       
    44 public:
       
    45     static CLafShutdownManager* NewL(MShutdownEventObserver& aObserver);
       
    46     ~CLafShutdownManager();
       
    47 
       
    48 private:
       
    49 
       
    50     // ======================================================================
       
    51     // Out of disk watcher
       
    52     // ======================================================================
       
    53     NONSHARABLE_CLASS(COutOfDiskWatcher) : public CActive // friend of CLafShutdownManager
       
    54         {
       
    55     public:
       
    56         static COutOfDiskWatcher* NewL(CLafShutdownManager& aLafShutdown,
       
    57                                        TInt64 aThreshold,
       
    58                                        TDriveNumber aDrive,
       
    59                                        RFs& aFs);
       
    60         ~COutOfDiskWatcher();
       
    61         void Start();
       
    62     private:
       
    63         COutOfDiskWatcher(CLafShutdownManager& aLafShutdown,
       
    64                           TInt64 aThreshold,
       
    65                           TDriveNumber aDrive,
       
    66                           RFs& aFs);
       
    67         void ConstructL();
       
    68     private: // from CActive
       
    69         void DoCancel();
       
    70         void RunL();
       
    71     private: // data
       
    72         RFs& iFs;
       
    73         CLafShutdownManager& iLafShutdown;
       
    74         TInt64 iThreshold;
       
    75         TDriveNumber iDrive;
       
    76         };
       
    77 
       
    78     NONSHARABLE_CLASS(CGlobalQueryActive) : public CBase
       
    79         {
       
    80         public:
       
    81             enum TMessageType{
       
    82                 ENone          = -1,
       
    83                 ECritical      =  0,
       
    84                 EWarning       =  1,
       
    85                 EWarningMMC    =  2,
       
    86                 ECriticalMMC   =  3,
       
    87                 ECallBack      =  4,
       
    88 
       
    89                 EClearNotesC   = 10,
       
    90                 EClearNotesMMC = 11
       
    91                 };
       
    92 
       
    93         public:
       
    94             static CGlobalQueryActive* NewL(RResourceFile& aResFile, TResourceReader& aResReader);
       
    95             ~CGlobalQueryActive();
       
    96 
       
    97             void DisplayL(TMessageType aType, TBool aForcedNote);
       
    98 
       
    99         private:
       
   100             CGlobalQueryActive();
       
   101             void ConstructL(RResourceFile& aResFile, TResourceReader& aResReader);
       
   102             void CleanupL(TBool aCancel = ETrue);
       
   103 
       
   104         private:
       
   105             class CMessageInfo : public CBase
       
   106                 {
       
   107                 public:
       
   108                     CMessageInfo(HBufC* aMessage):
       
   109                         iMessage(aMessage), iNoteId(KErrNotFound){};
       
   110                     ~CMessageInfo() { delete iMessage; };
       
   111                 public:
       
   112                     HBufC* iMessage;
       
   113                     TInt   iNoteId;
       
   114                 };
       
   115 
       
   116         private:
       
   117             TMessageType    iMessageType;
       
   118             CMessageInfo*   iMessageInfo[4];
       
   119             CAknGlobalNote* iQuery;
       
   120         };
       
   121 
       
   122     // ======================================================================
       
   123 
       
   124     NONSHARABLE_CLASS(CSubscriber) : public CActive
       
   125         {
       
   126         public:
       
   127             CSubscriber(TCallBack aCallBack, RProperty& aProperty);
       
   128             ~CSubscriber();
       
   129 
       
   130         public: // New functions
       
   131             void SubscribeL();
       
   132             void StopSubscribe();
       
   133 
       
   134         private: // from CActive
       
   135             void RunL();
       
   136             void DoCancel();
       
   137 
       
   138         private:
       
   139             TCallBack   iCallBack;
       
   140             RProperty&  iProperty;
       
   141         };
       
   142 
       
   143 private:
       
   144     CLafShutdownManager(MShutdownEventObserver& aObserver);
       
   145     void ConstructL();
       
   146     void ReportEventL(MSaveObserver::TSaveType aAction,TBool aPowerOff);
       
   147     void GetShutdownState(TBool& aPowerOff, TBool& aAllSessionsHavePendingRequest);
       
   148     void FreeDiskThresholdCrossedL(TDriveNumber aDrive, TBool aIsCallBack = EFalse, TBool aForcedNote = EFalse);
       
   149     void ShowGlobalQueryL(const CGlobalQueryActive::TMessageType& aMessageType, TBool aForcedNote);
       
   150     TInt GetDiskStatusL(TVolumeInfo& aVolInfo,TDriveNumber aDrive);
       
   151     static TInt DisplayNotesCallBackL(TAny* aPtr);
       
   152     void HandleDisplayNotesCallBackL();
       
   153     static TInt AutolockStatusCallBackL(TAny* aPtr);
       
   154     void HandleAutolockStatusCallBackL();
       
   155     void HandleMMCCallBackL();
       
   156     static TInt MMCStatusChanged(TAny* aPtr);
       
   157 
       
   158 private:
       
   159 
       
   160     RWsSession              iWs;
       
   161     RFs                     iFs;
       
   162     COutOfDiskWatcher*      iOODWarningWatcher;
       
   163     COutOfDiskWatcher*      iOODCriticalWatcher;
       
   164     TUint                   iOODWarningThreshold;
       
   165     TUint                   iOODCriticalThreshold;
       
   166     RProperty               iDiskStatusProperty;
       
   167     RProperty               iMMCStatusProperty;
       
   168     RProperty               iCanDisplayNotesProperty;
       
   169     RProperty               iAutolockStatusProperty;
       
   170     RProperty               iEnableMMCWatchProperty;
       
   171     RProperty               iWatchdogStatusProperty;
       
   172     CSubscriber*            iDisplayNotesSubscriber;
       
   173     CSubscriber*            iAutolockStatusSubscriber;
       
   174     CSubscriber*            iMMCWatchSubscriber;
       
   175     CSubscriber*            iWatchdogStatusSubscriber;
       
   176     CGlobalQueryActive*     iGlobalQueryActive;
       
   177     COutOfDiskWatcher*      iOOMMCWarningWatcher;
       
   178     COutOfDiskWatcher*      iOOMMCCriticalWatcher;
       
   179     TInt                    iAutolockStatus;
       
   180 
       
   181 private:
       
   182     friend class CLafShutdownManager::COutOfDiskWatcher;
       
   183     };
       
   184 
       
   185 #endif LAFSHUT_H