|
1 /* |
|
2 * Copyright (c) 2002-2008 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 * Active object for getting notification when there is enough |
|
16 * free disk space to regain the original size of the reserve file. |
|
17 * |
|
18 * |
|
19 */ |
|
20 |
|
21 |
|
22 // INCLUDE FILES |
|
23 |
|
24 #include <e32std.h> |
|
25 |
|
26 #include "shareddatafilesystemnotifier.h" |
|
27 #include "dosserver.h" |
|
28 #include "dosshareddatabase.h" |
|
29 #include "dos_debug.h" |
|
30 |
|
31 // ================= MEMBER FUNCTIONS ======================= |
|
32 |
|
33 // C++ default constructor can't leave |
|
34 CSharedDataFileSystemNotifier::CSharedDataFileSystemNotifier( |
|
35 CDosServer& aServer ) : |
|
36 CActive( CActive::EPriorityLow ), |
|
37 iServer( aServer ) |
|
38 { |
|
39 COM_TRACE_( "CSharedDataFileSystemNotifier::CSharedDataFileSystemNotifier" ); |
|
40 } |
|
41 |
|
42 // Destructor |
|
43 CSharedDataFileSystemNotifier::~CSharedDataFileSystemNotifier() |
|
44 { |
|
45 COM_TRACE_( "CSharedDataFileSystemNotifier::~CSharedDataFileSystemNotifier()" ); |
|
46 } |
|
47 |
|
48 // ----------------------------------------------------------------------------- |
|
49 // CSharedDataFileSystemNotifier::New() |
|
50 // ----------------------------------------------------------------------------- |
|
51 |
|
52 CSharedDataFileSystemNotifier* CSharedDataFileSystemNotifier::NewL( |
|
53 CDosServer& aServer ) |
|
54 { |
|
55 COM_TRACE_1( "CSharedDataFileSystemNotifier* CSharedDataFileSystemNotifier::NewL(0x%x)", &aServer ); |
|
56 CSharedDataFileSystemNotifier* self = new (ELeave) |
|
57 CSharedDataFileSystemNotifier( aServer ); |
|
58 |
|
59 CActiveScheduler::Add( self ); |
|
60 return self; |
|
61 } |
|
62 |
|
63 // ---------------------------------------------------------------------------- |
|
64 // CSharedDataFileSystemNotifier::Start() |
|
65 // ---------------------------------------------------------------------------- |
|
66 |
|
67 void CSharedDataFileSystemNotifier::Start( TInt aTreshold, RFs& aFs, CDosSharedDataBase* sdBase ) |
|
68 { |
|
69 COM_TRACE_1( "SharedData: Free disk space notifier started, treshold %d", aTreshold ); |
|
70 |
|
71 // just in case |
|
72 iSDBase = sdBase; |
|
73 iFs = aFs; |
|
74 iFs.NotifyDiskSpaceCancel(); |
|
75 |
|
76 iFs.NotifyDiskSpace( aTreshold, EDriveC, iStatus ); |
|
77 SetActive(); |
|
78 } |
|
79 |
|
80 // ---------------------------------------------------------------------------- |
|
81 // CSharedDataFileSystemNotifier::RunL() |
|
82 // ---------------------------------------------------------------------------- |
|
83 |
|
84 void CSharedDataFileSystemNotifier::RunL() |
|
85 { |
|
86 COM_TRACE_1( "SharedData: Free disk space notified, status = %d", iStatus.Int() ); |
|
87 |
|
88 if ( iStatus == KErrNone && !iServer.iCurrentFreeDiskSpaceRequest ) |
|
89 { |
|
90 iSDBase->SetReserveFileSize( 0 ); |
|
91 } |
|
92 } |
|
93 |
|
94 // ---------------------------------------------------------------------------- |
|
95 // CSharedDataFileSystemNotifier::DoCancel() |
|
96 // ---------------------------------------------------------------------------- |
|
97 |
|
98 void CSharedDataFileSystemNotifier::DoCancel() |
|
99 { |
|
100 COM_TRACE_( "CSharedDataFileSystemNotifier::DoCancel()" ); |
|
101 iFs.NotifyDiskSpaceCancel(); |
|
102 } |
|
103 |
|
104 // End of File |