CTC++ Coverage Report - Execution Profile    #3/6

Directory Summary | Files Summary | Functions Summary | Execution Profile
To files: First | Previous | Next | Last | Index | No Index


File: N:\myprogram\forrrelease1\oodmonitor\tsrc\ut_oodmonitorv1\src\ut_lafshutdownmanager.cpp
Instrumentation mode: function
TER: 92 % ( 24/ 26)

Start/ End/    
True False - Line Source

  1 /*
  2 * Copyright (c) 2010 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:
  15 *
  16 */
  17 
  18 #include <barsc.h>
  19 #include <barsread.h>
  20 #include <e32debug.h>
  21 #include <e32property.h>
  22 #include <f32file.h>
  23 #include <lafshut.h>
  24 #include <systemwarninglevels.hrh>
  25 #include <w32std.h>
  26 
  27 #include "ut_lafshutdownmanager.h"
  28 #include "ut_oodmonitor_const.h"
  29 #include "ood.h"
  30 
Top
  31 Tut_LafShutdownManager::Tut_LafShutdownManager()
  32     {
  33 
  34     }
  35 
Top
  36 Tut_LafShutdownManager::~Tut_LafShutdownManager()
  37     {
  38 
  39     }
  40 
Top
  41 RProperty Tut_LafShutdownManager::GetDiskStatusProperty(CLafShutdownManager* aShutdownManager)
  42     {
  43     return aShutdownManager->iDiskStatusProperty;
  44     }
  45 
Top
  46 RProperty Tut_LafShutdownManager::GetMMCStatusProperty(CLafShutdownManager* aShutdownManager)
  47     {
  48     return aShutdownManager->iMMCStatusProperty;
  49     }
  50 
Top
  51 RProperty Tut_LafShutdownManager::GetCanDisplayNotesProperty(CLafShutdownManager* aShutdownManager)
  52     {
  53     return aShutdownManager->iCanDisplayNotesProperty;
  54     }
  55 
Top
  56 RProperty Tut_LafShutdownManager::GetAutolockStatusProperty(CLafShutdownManager* aShutdownManager)
  57     {
  58     return aShutdownManager->iAutolockStatusProperty;
  59     }
  60 
Top
  61 RProperty Tut_LafShutdownManager::GetEnableMMCWatchProperty(CLafShutdownManager* aShutdownManager)
  62     {
  63     return aShutdownManager->iEnableMMCWatchProperty;
  64     }
  65 
Top
  66 CBase* Tut_LafShutdownManager::GetDisplayNotesSubscriber(CLafShutdownManager* aShutdownManager)
  67     {
  68     return aShutdownManager->iDisplayNotesSubscriber;
  69     }
  70 
Top
  71 CBase* Tut_LafShutdownManager::GetAutolockStatusSubscriber(CLafShutdownManager* aShutdownManager)
  72     {
  73     return aShutdownManager->iAutolockStatusSubscriber;
  74     }
  75 
Top
  76 CBase* Tut_LafShutdownManager::GetMMCWatchSubscriber(CLafShutdownManager* aShutdownManager)
  77     {
  78     return aShutdownManager->iMMCWatchSubscriber;
  79     }
  80 
Top
  81 TInt Tut_LafShutdownManager::GetOODWarningThreshold(CLafShutdownManager* aShutdownManager)
  82     {
  83     return aShutdownManager->iOODWarningThreshold;
  84     }
  85 
Top
  86 TInt Tut_LafShutdownManager::GetOODCriticalThreshold(CLafShutdownManager* aShutdownManager)
  87     {
  88     return aShutdownManager->iOODCriticalThreshold;
  89     }
  90 
Top
  91 CLafShutdownManager::CGlobalQueryActive*  Tut_LafShutdownManager::GetGlobalQueryActive(CLafShutdownManager* aShutdownManager)
  92     {
  93     return aShutdownManager->iGlobalQueryActive;
  94     }
  95 
Top
  96 CActive* Tut_LafShutdownManager::GetOODWarningWatcher(CLafShutdownManager* aShutdownManager)
  97     {
  98     RDebug::Print(_L("Tut_LafShutdownManager::iOODWarningWatcher=%d"), aShutdownManager->iOOMMCWarningWatcher);
  99     return aShutdownManager->iOODWarningWatcher;
  100     }
  101 
Top
  102 CActive* Tut_LafShutdownManager::GetOODCriticalWatcher(CLafShutdownManager* aShutdownManager)
  103     {
  104     RDebug::Print(_L("Tut_LafShutdownManager::iOODCriticalWatcher=%d"), aShutdownManager->iOOMMCCriticalWatcher);
  105     return aShutdownManager->iOODCriticalWatcher;
  106     }
  107 
Top
  108 void Tut_LafShutdownManager::CallReportEventL(CLafShutdownManager* aShutdownManager, 
  109         MSaveObserver::TSaveType aAction,TBool aPowerOff)
  110     {
  111     aShutdownManager->ReportEventL(aAction, aPowerOff);
  112     }
  113 
Top
  114 void Tut_LafShutdownManager::CallGetShutdownState(CLafShutdownManager* aShutdownManager, 
  115         TBool& aPowerOff, TBool& aAllSessionsHavePendingRequest)
  116     {
  117     aShutdownManager->GetShutdownState(aPowerOff, aAllSessionsHavePendingRequest);
  118     }
  119 
Top
  120 TInt Tut_LafShutdownManager::CallGetDiskStatusL(CLafShutdownManager* aShutdownManager, 
  121         TVolumeInfo& aVolInfo,TDriveNumber aDrive)
  122     {
  123     return aShutdownManager->GetDiskStatusL(aVolInfo, aDrive);
  124     }
  125 
Top
135 135   126 void Tut_LafShutdownManager::CreateFileL(const TDesC &aFileName, TInt aSize)
  127     {   
  128     RDebug::Print(_L("CLafShutdownManager:: create filename = %S "), &aFileName);
  129     RDebug::Print(_L("CLafShutdownManager:: size = %d "), aSize);
  130     RFs fs;
  131         
  132     User::LeaveIfError(fs.Connect());
  133     CleanupClosePushL(fs);  
  134     
  135     RFile file;
  136     CleanupClosePushL(file);     
  137     User::LeaveIfError(file.Replace(fs, aFileName, EFileWrite));
  138     User::LeaveIfError(file.SetSize(aSize));
  139             
  140     CleanupStack::PopAndDestroy(2); 
  141     RDebug::Print(_L("CLafShutdownManager:: CreateFileL end")); 
  142     }
  143 
Top
135 135   144 void Tut_LafShutdownManager::DeleteFileL(const TDesC &aFileName)
  145     {   
  146     RDebug::Print(_L("CLafShutdownManager:: delete filename = %S "), &aFileName);
  147     RFs fs;       
  148     User::LeaveIfError(fs.Connect());    
  149     CleanupClosePushL(fs);     
  150     User::LeaveIfError(fs.Delete(aFileName));
  151     CleanupStack::PopAndDestroy(); 
  152     RDebug::Print(_L("CLafShutdownManager:: DeleteFileL end"));
  153     }
  154 
Top
  155 void Tut_LafShutdownManager::GetDiskInfoL(TVolumeInfo& aVolInfo, TDriveNumber aDrive)
  156     {
  157     RDebug::Print(_L("CLafShutdownManager::GetDiskInfoL"));
  158     RFs fs;       
  159     User::LeaveIfError(fs.Connect());    
  160     CleanupClosePushL(fs);  
  161 
  162     User::LeaveIfError(fs.Volume(aVolInfo,aDrive));
  163     
  164     CleanupStack::PopAndDestroy(); 
  165     }
  166 
Top
  167 void Tut_LafShutdownManager::EatDiskL(CDesCArrayFlat* aDescArray, TDriveNumber aDriver, TDiskLevel aLevel )
  168     {
  169     RDebug::Print(_L("CLafShutdownManager::EatDiskL"));
  170     TVolumeInfo volInfo;
  171     TInt err;
  172     TInt threshod;
  173     
  174     if(EWarning == aLevel)
  175         {
  176         threshod = KDRIVECWARNINGTHRESHOLD;
  177         }
  178     else if (ECritical == aLevel)
  179         {
  180         threshod = KDRIVECCRITICALTHRESHOLD;
  181         }
  182     else
  183         {
  184         threshod =0;
  185         }
  186     
  187     TRAP(err,GetDiskInfoL(volInfo, aDriver));
  188     
  189     if (KErrNone == err)
  190         {
  191         TInt leftFileSize;
  192         TInt64 freeSpace = volInfo.iFree;
  193         RDebug::Print(_L("CLafShutdownManager:: free disk size = %ld"),freeSpace);
  194         RDebug::Print(_L("CLafShutdownManager:: threshod = %d"),threshod);
  195         
  196         if((freeSpace + KOverlaySize) > threshod)
  197             {
  198             TInt fileNum = (freeSpace - threshod + KOverlaySize) / KMaxFileSize;
  199             leftFileSize = freeSpace + KOverlaySize - fileNum*KMaxFileSize - threshod;
  200             RDebug::Print(_L("CLafShutdownManager:: fileNume = %d"),fileNum);
  201             RDebug::Print(_L("CLafShutdownManager:: leftFileSize = %d"),leftFileSize);
  202             
  203             TBuf<KMaxFileNameLength> drivers;
  204             
  205             if(EDriveE == aDriver)
  206                 {
  207                 TBuf<KMaxFileNameLength> driver(KDriverE);
  208                 drivers.Append(driver);
  209                 }
  210             else if(EDriveF == aDriver)
  211                 {
  212                 TBuf<KMaxFileNameLength> driver(KDriverF);
  213                 drivers.Append(driver);
  214                 }
  215             else
  216                 {
  217                 TBuf<KMaxFileNameLength> driver(KDriverC);
  218                 drivers.Append(driver);
  219                 }
  220             TBuf<KMaxFileNameLength> fileName(KTextFileName);
  221             TBuf<KMaxFileNameLength> path;
  222             path.Append(drivers);
  223             path.Append(fileName);
  224             TRAP(err, CreateFileL(path, leftFileSize));
  225             if(KErrNone == err)
  226                 {
  227                 aDescArray->AppendL(path);            
  228                 }
  229             
  230             for(TInt i = 1; i<=fileNum; i++)
  231                 {
  232                 TBuf <KMaxFileNameLength> fileNo;
  233                 fileNo.Num(i);
  234     
  235                 TBuf<KMaxFileNameLength> newPath;
  236                 newPath.Append(drivers);
  237                 newPath.Append(fileName);
  238                 newPath.Append(fileNo);
  239                 
  240                 TRAP(err, CreateFileL(newPath, KMaxFileSize));
  241                 if(KErrNone == err)
  242                     {
  243                     aDescArray->AppendL(newPath);            
  244                     }
  245                 }
  246             }
  247         }
  248     }
  249 
Top
  250 void Tut_LafShutdownManager::FreeDiskL(CDesCArrayFlat* aDescArray)
  251     {
  252     RDebug::Print(_L("CLafShutdownManager::FreeDiskL"));
  253     TInt fileNum = aDescArray->MdcaCount();
  254     
  255     for(TInt i=0; i<fileNum; i++)
  256         {
  257         TBuf<KMaxFileNameLength> fileName=(aDescArray->MdcaPoint(i));
  258         DeleteFileL(fileName);
  259         }
  260     }
  261 
Top
  262 CLafShutdownManager::CGlobalQueryActive::CMessageInfo* Tut_LafShutdownManager::
  263         GetMessageInfoList(CLafShutdownManager::CGlobalQueryActive* aGlobalQueryActive, TInt aIndex)
  264     {
  265     return aGlobalQueryActive->iMessageInfo[aIndex];
  266     }
  267 
Top
- 268 CLafShutdownManager::CGlobalQueryActive::TMessageType Tut_LafShutdownManager::
  269         GetMessageType(CLafShutdownManager::CGlobalQueryActive* aGlobalQueryActive)
  270     {
  271     return aGlobalQueryActive->iMessageType;
  272     }
  273 
Top
- 274 void Tut_LafShutdownManager::CallFreeDiskThresholdCrossedL(CLafShutdownManager* aShutdownManager, 
  275         TDriveNumber aDrive, TBool aIsCallBack, TBool aForcedNote)
  276     {
  277     aShutdownManager->FreeDiskThresholdCrossedL(aDrive, aIsCallBack, aForcedNote);
  278     }
  279 
  280 
***TER 92% (24/26) of SOURCE FILE ut_lafshutdownmanager.cpp

Directory Summary | Files Summary | Functions Summary | Execution Profile
To files: First | Previous | Next | Last | Top | Index | No Index