1 // Copyright (c) 1999-2009 Nokia Corporation and/or its subsidiary(-ies). |
1 // Copyright (c) 1999-2010 Nokia Corporation and/or its subsidiary(-ies). |
2 // All rights reserved. |
2 // All rights reserved. |
3 // This component and the accompanying materials are made available |
3 // This component and the accompanying materials are made available |
4 // under the terms of "Eclipse Public License v1.0" |
4 // under the terms of "Eclipse Public License v1.0" |
5 // which accompanies this distribution, and is available |
5 // which accompanies this distribution, and is available |
6 // at the URL "http://www.eclipse.org/legal/epl-v10.html". |
6 // at the URL "http://www.eclipse.org/legal/epl-v10.html". |
66 * |
72 * |
67 * @return a newly created CSmsMonitorDiskSpace object. |
73 * @return a newly created CSmsMonitorDiskSpace object. |
68 */ |
74 */ |
69 CSmsMonitorDiskSpace* CSmsMonitorDiskSpace::NewL(MSmsComm& aSmsComm, RMobileSmsMessaging& aSmsMessaging,RFs& aFs) |
75 CSmsMonitorDiskSpace* CSmsMonitorDiskSpace::NewL(MSmsComm& aSmsComm, RMobileSmsMessaging& aSmsMessaging,RFs& aFs) |
70 { |
76 { |
71 LOGSMSPROT1("CSmsMonitorDiskSpace::NewL()"); |
77 OstTraceDef0(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CSMSMONITORDISKSPACE_NEWL_1, "CSmsMonitorDiskSpace::NewL()"); |
72 |
78 |
73 CSmsMonitorDiskSpace* self = new(ELeave) CSmsMonitorDiskSpace(aSmsComm, aSmsMessaging, aFs); |
79 CSmsMonitorDiskSpace* self = new(ELeave) CSmsMonitorDiskSpace(aSmsComm, aSmsMessaging, aFs); |
74 CleanupStack::PushL(self); |
80 CleanupStack::PushL(self); |
75 self->ConstructL(); |
81 self->ConstructL(); |
76 CleanupStack::Pop(); |
82 CleanupStack::Pop(); |
155 #endif |
161 #endif |
156 |
162 |
157 // |
163 // |
158 // Log the filename in use and whether it is ROM based... |
164 // Log the filename in use and whether it is ROM based... |
159 // |
165 // |
160 #ifdef _SMS_LOGGING_ENABLED |
166 OstTraceDefExt1(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CSMSMONITORDISKSPACE_CONSTRUCTL_1, "CSmsMonitorDiskSpace::ConstructL(): fileName=\"%S\"", fileName); |
161 TBuf8<KMaxFileName> buf8; |
167 |
162 buf8.Copy(fileName); |
|
163 LOGSMSPROT2("CSmsMonitorDiskSpace::ConstructL(): fileName=\"%S\"", &buf8); |
|
164 #endif |
|
165 |
168 |
166 if (iFs.IsFileInRom(fileName) == NULL) |
169 if (iFs.IsFileInRom(fileName) == NULL) |
167 { |
170 { |
168 LOGSMSPROT1("CSmsMonitorDiskSpace::ConstructL(): Smsu.rsc not in ROM"); |
171 OstTraceDef0(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CSMSMONITORDISKSPACE_CONSTRUCTL_2, "CSmsMonitorDiskSpace::ConstructL(): Smsu.rsc not in ROM"); |
169 } |
172 } |
170 |
173 |
171 // |
174 // |
172 // Read the low and high limits... |
175 // Read the low and high limits... |
173 // |
176 // |
197 iInOODTesting = ETrue; |
200 iInOODTesting = ETrue; |
198 |
201 |
199 TInt ret = iFreeDiskSpaceProperty.Attach(KUidPSSMSStackCategory, KUidPSSMSStackFreeDiskSpaceKey); |
202 TInt ret = iFreeDiskSpaceProperty.Attach(KUidPSSMSStackCategory, KUidPSSMSStackFreeDiskSpaceKey); |
200 if (ret != KErrNone) |
203 if (ret != KErrNone) |
201 { |
204 { |
202 LOGSMSPROT2("iFreeDiskSpaceProperty.Attach(): error=%d", ret); |
205 OstTraceDef1(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CSMSMONITORDISKSPACE_CONSTRUCTL_3, "iFreeDiskSpaceProperty.Attach(): error=%d", ret); |
203 User::Leave(ret); |
206 User::Leave(ret); |
204 } |
207 } |
205 } |
208 } |
206 #endif |
209 #endif |
207 |
210 |
208 LOGSMSPROT3("CSmsMonitorDiskSpace::ConstructL(): iLowLimit=%d, iHighLimit=%d", |
211 OstTraceDefExt2(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CSMSMONITORDISKSPACE_CONSTRUCTL_4, "CSmsMonitorDiskSpace::ConstructL(): iLowLimit=%u, iHighLimit=%u",iLowLimit, iHighLimit); |
209 iLowLimit, iHighLimit); |
|
210 } // CSmsMonitorDiskSpace::ConstructL |
212 } // CSmsMonitorDiskSpace::ConstructL |
211 |
213 |
212 |
214 |
213 /** |
215 /** |
214 * Handles a completed disk monitor or resume request. |
216 * Handles a completed disk monitor or resume request. |
215 */ |
217 */ |
216 void CSmsMonitorDiskSpace::RunL() |
218 void CSmsMonitorDiskSpace::RunL() |
217 { |
219 { |
218 LOGSMSPROT3("CSmsMonitorDiskSpace:RunL(): iStatus=%d, iState=%d", |
220 OstTraceDefExt2(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CSMSMONITORDISKSPACE_RUNL_1, "CSmsMonitorDiskSpace:RunL(): iStatus=%d, iState=%d",iStatus.Int(), iState ); |
219 iStatus.Int(), iState ); |
|
220 |
221 |
221 switch (iState) |
222 switch (iState) |
222 { |
223 { |
223 case ESmsMonitorDiskSpaceMonitorLowLimit: |
224 case ESmsMonitorDiskSpaceMonitorLowLimit: |
224 { |
225 { |
298 /** |
299 /** |
299 * Handles a request to cancel the current state machine operation. |
300 * Handles a request to cancel the current state machine operation. |
300 */ |
301 */ |
301 void CSmsMonitorDiskSpace::DoCancel() |
302 void CSmsMonitorDiskSpace::DoCancel() |
302 { |
303 { |
303 LOGSMSPROT2("CSmsMonitorDiskSpace::DoCancel(): iState=%d", iState); |
304 OstTraceDef1(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CSMSMONITORDISKSPACE_DOCANCEL_1, "CSmsMonitorDiskSpace::DoCancel(): iState=%d", iState); |
304 |
305 |
305 switch (iState) |
306 switch (iState) |
306 { |
307 { |
307 case ESmsMonitorDiskSpaceIdle: |
308 case ESmsMonitorDiskSpaceIdle: |
308 { |
309 { |
346 /** |
347 /** |
347 * Checks for enough disk space, and starts monitoring disk space if needed. |
348 * Checks for enough disk space, and starts monitoring disk space if needed. |
348 */ |
349 */ |
349 void CSmsMonitorDiskSpace::CheckDiskSpaceForPDUL(TBool aPDUIsClass0) |
350 void CSmsMonitorDiskSpace::CheckDiskSpaceForPDUL(TBool aPDUIsClass0) |
350 { |
351 { |
351 LOGSMSPROT2("CSmsMonitorDiskSpace::CheckDiskSpaceForPDUL(): aPDUIsClass0=%d", |
352 OstTraceDef1(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CSMSMONITORDISKSPACE_CHECKDISKSPACEFORPDUL_1, "CSmsMonitorDiskSpace::CheckDiskSpaceForPDUL(): aPDUIsClass0=%d",aPDUIsClass0); |
352 aPDUIsClass0); |
|
353 |
353 |
354 // |
354 // |
355 // First check the actual disk space before working out what to do. |
355 // First check the actual disk space before working out what to do. |
356 // |
356 // |
357 // If enough space exists, then we don't need to do anything else (even if |
357 // If enough space exists, then we don't need to do anything else (even if |
436 * @param aState State to transition to when this request is made. |
436 * @param aState State to transition to when this request is made. |
437 */ |
437 */ |
438 void CSmsMonitorDiskSpace::NotifyDiskSpace(TInt aLimit, |
438 void CSmsMonitorDiskSpace::NotifyDiskSpace(TInt aLimit, |
439 TSmsMonitorDiskSpaceState aState) |
439 TSmsMonitorDiskSpaceState aState) |
440 { |
440 { |
441 LOGSMSPROT3("CSmsMonitorDiskSpace::NotifyDiskSpace(): aLimit=%d, aState=%d", |
441 OstTraceDefExt2(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CSMSMONITORDISKSPACE_NOTIFYDISKSPACE_1, "CSmsMonitorDiskSpace::NotifyDiskSpace(): aLimit=%d, aState=%d",aLimit, aState); |
442 aLimit, aState); |
|
443 |
442 |
444 // |
443 // |
445 // Cancel any previously outstanding requests... |
444 // Cancel any previously outstanding requests... |
446 // |
445 // |
447 if (iState != ESmsMonitorDiskSpaceIdle) |
446 if (iState != ESmsMonitorDiskSpaceIdle) |
511 * SMS may attempt to be delivered, but monitoring will restart as |
510 * SMS may attempt to be delivered, but monitoring will restart as |
512 * before. So again no problem. |
511 * before. So again no problem. |
513 */ |
512 */ |
514 void CSmsMonitorDiskSpace::ResumeSmsReception() |
513 void CSmsMonitorDiskSpace::ResumeSmsReception() |
515 { |
514 { |
516 LOGSMSPROT1("CSmsMonitorDiskSpace::ResumeSmsReception"); |
515 OstTraceDef0(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CSMSMONITORDISKSPACE_RESUMESMSRECEPTION_1, "CSmsMonitorDiskSpace::ResumeSmsReception"); |
517 |
516 |
518 // |
517 // |
519 // Cancel any previously outstanding requests... |
518 // Cancel any previously outstanding requests... |
520 // |
519 // |
521 if (iState != ESmsMonitorDiskSpaceIdle) |
520 if (iState != ESmsMonitorDiskSpaceIdle) |