| 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 <coreapplicationuisdomainpskeys.h> | |||
| 21 | #include <e32debug.h> | |||
| 22 | #include <e32property.h> | |||
| 23 | #include <f32file.h> | |||
| 24 | #include <lafshut.h> | |||
| 25 | #include <w32std.h> | |||
| 26 | ||||
| 27 | ||||
| 28 | #include "ut_oodmonitor_const.h" | |||
| 29 | #include "ut_oodmonitor_timer.h" | |||
| 30 | ||||
| Top | ||||
| 4 | 0 | 31 | Cut_OODMonitor_Timer* Cut_OODMonitor_Timer::NewLC(CLafShutdownManager* aShutdownManager, Tut_LafShutdownManager& aFriendLafShutdownManager, TTestCase aTestCase) | |
| 32 | { | |||
| 33 | Cut_OODMonitor_Timer* self=new(ELeave) Cut_OODMonitor_Timer(aShutdownManager, aFriendLafShutdownManager, aTestCase); | |||
| 34 | CleanupStack::PushL(self); | |||
| 35 | self->ConstructL(); | |||
| 36 | return self; | |||
| 37 | } | |||
| 38 | ||||
| Top | ||||
| 0 | 0 | - | 39 | Cut_OODMonitor_Timer* Cut_OODMonitor_Timer::NewL(CLafShutdownManager* aShutdownManager, Tut_LafShutdownManager& aFriendLafShutdownManager, TTestCase aTestCase) |
| 40 | { | |||
| 41 | Cut_OODMonitor_Timer* self=Cut_OODMonitor_Timer::NewLC(aShutdownManager, aFriendLafShutdownManager, aTestCase); | |||
| 42 | CleanupStack::Pop(self); | |||
| 43 | return self; | |||
| 44 | } | |||
| 45 | ||||
| Top | ||||
| 4 | 4 | 46 | Cut_OODMonitor_Timer::Cut_OODMonitor_Timer(CLafShutdownManager* aShutdownManager, Tut_LafShutdownManager& aFriendLafShutdownManager, TTestCase aTestCase): | |
| 47 | CTimer(EPriorityStandard), iFriendLafShutdownManager(aFriendLafShutdownManager), iShutdownManager(aShutdownManager), iTestCase(aTestCase), | |||
| 48 | iPhase(EPhase1) | |||
| 49 | { | |||
| 50 | ||||
| 51 | } | |||
| 52 | ||||
| Top | ||||
| 4 | 4 | 53 | Cut_OODMonitor_Timer::~Cut_OODMonitor_Timer() | |
| 54 | { | |||
| 55 | iFileNameArray->Reset(); | |||
| 56 | delete iFileNameArray; | |||
| 57 | Cancel(); | |||
| 58 | } | |||
| 59 | ||||
| Top | ||||
| 4 | 4 | 60 | void Cut_OODMonitor_Timer::ConstructL() | |
| 61 | { | |||
| 62 | iFileNameArray = new (ELeave) CDesCArrayFlat(KArraySize); | |||
| 63 | CTimer::ConstructL(); | |||
| 64 | CActiveScheduler::Add(this); | |||
| 65 | After(KTwoSecondInMicro); | |||
| 66 | } | |||
| 67 | ||||
| Top | ||||
| 14 | 14 | 68 | void Cut_OODMonitor_Timer::RunL() | |
| 69 | { | |||
| 70 | switch(iTestCase) | |||
| 71 | { | |||
| 72 | case EMMCTest: | |||
| 73 | { | |||
| 74 | switch(iPhase) | |||
| 75 | { | |||
| 76 | case EPhase1: | |||
| 77 | { | |||
| 78 | ChangeMMCStatus(); | |||
| 79 | iPhase = EPhase2; | |||
| 80 | After(KTwoSecondInMicro); | |||
| 81 | break; | |||
| 82 | } | |||
| 83 | case EPhase2: | |||
| 84 | { | |||
| 85 | ChangeMMCStatus(); | |||
| 86 | iPhase = EPhase3; | |||
| 87 | After(KTwoSecondInMicro); | |||
| 88 | break; | |||
| 89 | } | |||
| 90 | default: | |||
| 91 | { | |||
| 92 | CActiveScheduler::Stop(); | |||
| 93 | break; | |||
| 94 | } | |||
| 95 | } | |||
| 96 | break; | |||
| 97 | } // EMMCTest | |||
| 98 | case EDisplayNotes: | |||
| 99 | { | |||
| 100 | switch(iPhase) | |||
| 101 | { | |||
| 102 | case EPhase1: | |||
| 103 | { | |||
| 104 | iFriendLafShutdownManager.EatDiskL(iFileNameArray, EDriveC, ECritical); | |||
| 105 | ChangeDisplayNotes(); | |||
| 106 | iPhase = EPhase2; | |||
| 107 | After(KTwoSecondInMicro); | |||
| 108 | break; | |||
| 109 | } | |||
| 110 | case EPhase2: | |||
| 111 | { | |||
| 112 | ChangeDisplayNotes(); | |||
| 113 | iPhase = EPhase3; | |||
| 114 | After(KTwoSecondInMicro); | |||
| 115 | break; | |||
| 116 | } | |||
| 117 | case EPhase3: | |||
| 118 | { | |||
| 119 | iPhase = EPhase4; | |||
| 120 | iFriendLafShutdownManager.FreeDiskL(iFileNameArray); | |||
| 121 | iFileNameArray->Reset(); | |||
| 122 | After(KTwoSecondInMicro); | |||
| 123 | break; | |||
| 124 | } | |||
| 125 | default: | |||
| 126 | { | |||
| 127 | CActiveScheduler::Stop(); | |||
| 128 | break; | |||
| 129 | } | |||
| 130 | } | |||
| 131 | break; | |||
| 132 | } // EDisplayNotes | |||
| 133 | case EAutolock: | |||
| 134 | { | |||
| 135 | switch(iPhase) | |||
| 136 | { | |||
| 137 | case EPhase1: | |||
| 138 | { | |||
| 139 | iFriendLafShutdownManager.EatDiskL(iFileNameArray, EDriveC, EWarning); | |||
| 140 | ChangeAutoLockStatus(); | |||
| 141 | iPhase = EPhase2; | |||
| 142 | After(KTwoSecondInMicro); | |||
| 143 | break; | |||
| 144 | } | |||
| 145 | case EPhase2: | |||
| 146 | { | |||
| 147 | ChangeAutoLockStatus(); | |||
| 148 | iPhase = EPhase3; | |||
| 149 | After(KTwoSecondInMicro); | |||
| 150 | break; | |||
| 151 | } | |||
| 152 | case EPhase3: | |||
| 153 | { | |||
| 154 | iPhase = EPhase4; | |||
| 155 | iFriendLafShutdownManager.FreeDiskL(iFileNameArray); | |||
| 156 | iFileNameArray->Reset(); | |||
| 157 | After(KTwoSecondInMicro); | |||
| 158 | break; | |||
| 159 | } | |||
| 160 | default: | |||
| 161 | { | |||
| 162 | CActiveScheduler::Stop(); | |||
| 163 | break; | |||
| 164 | } | |||
| 165 | } | |||
| 166 | break; | |||
| 167 | } // EAutolock | |||
| 168 | case EOODWatcher: | |||
| 169 | { | |||
| 170 | switch(iPhase) | |||
| 171 | { | |||
| 172 | case EPhase1: | |||
| 173 | { | |||
| 174 | iFriendLafShutdownManager.EatDiskL(iFileNameArray, EDriveC, ECritical); | |||
| 175 | iPhase = EPhase2; | |||
| 176 | After(KTwoSecondInMicro); | |||
| 177 | break; | |||
| 178 | } | |||
| 179 | case EPhase2: | |||
| 180 | { | |||
| 181 | iFriendLafShutdownManager.FreeDiskL(iFileNameArray); | |||
| 182 | iFileNameArray->Reset(); | |||
| 183 | iPhase = EPhase3; | |||
| 184 | After(KTwoSecondInMicro); | |||
| 185 | break; | |||
| 186 | } | |||
| 187 | default: | |||
| 188 | { | |||
| 189 | CActiveScheduler::Stop(); | |||
| 190 | break; | |||
| 191 | } | |||
| 192 | } | |||
| 193 | break; | |||
| 194 | } // EOODWatcher | |||
| 195 | default: | |||
| 196 | { | |||
| 197 | CActiveScheduler::Stop(); | |||
| 198 | } // default | |||
| 199 | } | |||
| 200 | } | |||
| Top | ||||
| 2 | 2 | 201 | void Cut_OODMonitor_Timer::ChangeMMCStatus() | |
| 202 | { | |||
| 203 | TInt value; | |||
| 204 | ||||
| 205 | RProperty enableMMCWatchProperty = iFriendLafShutdownManager.GetEnableMMCWatchProperty(iShutdownManager); | |||
| 206 | enableMMCWatchProperty.Get(value); | |||
| 207 | ||||
| 208 | RDebug::Print(_L("CLafShutdownManager::enableMMCWatchProperty=%d"), value); | |||
| 209 | ||||
| 210 | const TInt mmcRemovedStatus = 0; | |||
| 211 | const TInt mmcInsertedStatus = 1; | |||
| 212 | ||||
| 213 | if(mmcRemovedStatus == value) | |||
| 214 | { | |||
| 215 | value = mmcInsertedStatus; | |||
| 216 | } | |||
| 217 | else | |||
| 218 | { | |||
| 219 | value = mmcRemovedStatus; | |||
| 220 | } | |||
| 221 | ||||
| 222 | enableMMCWatchProperty.Set(value); | |||
| 223 | } | |||
| 224 | ||||
| Top | ||||
| 2 | 2 | 225 | void Cut_OODMonitor_Timer::ChangeDisplayNotes() | |
| 226 | { | |||
| 227 | TInt value; | |||
| 228 | ||||
| 229 | RProperty canDisplayNotesProperty = iFriendLafShutdownManager.GetCanDisplayNotesProperty(iShutdownManager); | |||
| 230 | canDisplayNotesProperty.Get(value); | |||
| 231 | ||||
| 232 | RDebug::Print(_L("CLafShutdownManager::canDisplayNotesProperty=%d"), value); | |||
| 233 | ||||
| 234 | const TInt notShowDisplayNotes = 0; | |||
| 235 | const TInt ShowDisplayNotes = 1; | |||
| 236 | ||||
| 237 | if(notShowDisplayNotes == value) | |||
| 238 | { | |||
| 239 | value = ShowDisplayNotes; | |||
| 240 | } | |||
| 241 | else | |||
| 242 | { | |||
| 243 | value = notShowDisplayNotes; | |||
| 244 | } | |||
| 245 | ||||
| 246 | canDisplayNotesProperty.Set(value); | |||
| 247 | } | |||
| 248 | ||||
| Top | ||||
| 2 | 2 | 249 | void Cut_OODMonitor_Timer::ChangeAutoLockStatus() | |
| 250 | { | |||
| 251 | TInt value; | |||
| 252 | ||||
| 253 | RProperty autolockStatusProperty = iFriendLafShutdownManager.GetAutolockStatusProperty(iShutdownManager); | |||
| 254 | autolockStatusProperty.Get(value); | |||
| 255 | ||||
| 256 | RDebug::Print(_L("CLafShutdownManager::autolockStatusProperty=%d"), value); | |||
| 257 | ||||
| 258 | if(EAutolockOff == value) | |||
| 259 | { | |||
| 260 | value = EManualLocked; | |||
| 261 | } | |||
| 262 | else | |||
| 263 | { | |||
| 264 | value = EAutolockOff; | |||
| 265 | } | |||
| 266 | ||||
| 267 | autolockStatusProperty.Set(value); | |||
| 268 | } | |||
| ***TER 89% (8/9) of SOURCE FILE ut_oodmonitor_timer.cpp | ||||