21
|
1 |
/*
|
|
2 |
* Copyright (c) 2006 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 |
* The actual "engine".
|
|
16 |
*
|
|
17 |
*/
|
|
18 |
|
|
19 |
|
|
20 |
#ifndef CMSENG_H
|
|
21 |
#define CMSENG_H
|
|
22 |
|
|
23 |
|
|
24 |
// SYSTEM INCLUDES
|
|
25 |
#include <data_caging_path_literals.hrh>
|
|
26 |
#include <badesca.h> // descriptor arrays
|
|
27 |
#include <f32file.h> // enum TDriveNumber
|
|
28 |
#include <stringresourcereader.h>
|
|
29 |
#include <barsc2.h> // CResourceFile
|
|
30 |
#include <barsread2.h> // RResourceReader
|
|
31 |
|
|
32 |
|
|
33 |
// USER INCLUDES
|
|
34 |
#include "msenguihandler.h"
|
|
35 |
|
|
36 |
|
|
37 |
// FORWARD DECLARATIOS
|
|
38 |
class CMsengScanner;
|
|
39 |
class RFs;
|
|
40 |
class MMsengUIHandler;
|
|
41 |
|
|
42 |
|
|
43 |
// CONSTANTS
|
|
44 |
|
|
45 |
// Resource file path
|
|
46 |
_LIT(KMsengRscFilePath,"Z:mseng.rsc");
|
|
47 |
|
|
48 |
|
|
49 |
// DATA TYPES
|
|
50 |
|
|
51 |
/**
|
|
52 |
* Type definition to handle arrays of integers
|
|
53 |
* more conveniently
|
|
54 |
*/
|
|
55 |
typedef CArrayFixFlat<TInt> CIntArray;
|
|
56 |
|
|
57 |
|
|
58 |
// CLASS DECLARATION
|
|
59 |
|
|
60 |
/**
|
|
61 |
* The actual "engine".
|
|
62 |
* This is the class which the UI instantiates.
|
|
63 |
*/
|
|
64 |
class CMseng :public CBase
|
|
65 |
{
|
|
66 |
public: // Constructors and destructor
|
|
67 |
/**
|
|
68 |
* Two-phased constructor.
|
|
69 |
* @param aUIHandler Reference to a class implementing MMsengUIHandler interface
|
|
70 |
*/
|
|
71 |
IMPORT_C static CMseng* NewL(MMsengUIHandler& aUIHandler);
|
|
72 |
/**
|
|
73 |
* Destructor.
|
|
74 |
*/
|
|
75 |
IMPORT_C ~CMseng();
|
|
76 |
|
|
77 |
public: // New functions
|
|
78 |
|
|
79 |
/**
|
|
80 |
* Get the data groups.
|
|
81 |
* @return CDesCArray* containing the names of the data groups.
|
|
82 |
*/
|
|
83 |
IMPORT_C CDesCArray* DataGroupsL() const;
|
|
84 |
|
|
85 |
/**
|
|
86 |
* Get the scan result. This array contains exacly one
|
|
87 |
* integer per data group.
|
|
88 |
* @return Array of integers.
|
|
89 |
*/
|
|
90 |
IMPORT_C CArrayFix<TInt64>* ScanResultL() const;
|
|
91 |
|
|
92 |
/**
|
|
93 |
* Is there scanning going on?
|
|
94 |
* @return ETrue if there is scanning going on, otherwise EFalse.
|
|
95 |
*/
|
|
96 |
IMPORT_C TBool ScanInProgress() const;
|
|
97 |
|
|
98 |
/**
|
|
99 |
* Get the amount of total and free space on a disk
|
|
100 |
* @param aTotal Amount of total space in bytes in substituted here.
|
|
101 |
* @param aFree Amount of free space in bytes in substituted here.
|
|
102 |
* @param aVolume Disk identifier, e.g. 'C'
|
|
103 |
*/
|
|
104 |
IMPORT_C void DiskInfoL(TInt64& aTotal, TInt64& aFree, const TDriveNumber aVolume) const;
|
|
105 |
|
|
106 |
/**
|
|
107 |
* Get the amount of total and free RAM.
|
|
108 |
* @param aTotal Amount of total RAM in bytes in substituted here.
|
|
109 |
* @param aTotal Amount of free RAM in bytes in substituted here.
|
|
110 |
*/
|
|
111 |
IMPORT_C static void MemInfoL(TInt64& aTotal, TInt64& aFree);
|
|
112 |
|
|
113 |
/**
|
|
114 |
* Start scanning memory.
|
|
115 |
* This means starting the actual work of the engine. Starts scanning,
|
|
116 |
* which runs until finished.
|
|
117 |
*
|
|
118 |
* The scanning is only supported for drives C and E, otherwise
|
|
119 |
* leave occurs with error KErrNotSupported.
|
|
120 |
*
|
|
121 |
* NOTE: the support for scanning E drive is not properly tested.
|
|
122 |
* It is assumed to have the same directory structure than in C.
|
|
123 |
*
|
|
124 |
* @param aDrive the drive to be scanned
|
|
125 |
*/
|
|
126 |
IMPORT_C void ScanL(TDriveNumber aDrive);
|
|
127 |
|
|
128 |
/**
|
|
129 |
* Cancel ongoing scanning operation.
|
|
130 |
*/
|
|
131 |
IMPORT_C void Cancel();
|
|
132 |
|
|
133 |
/**
|
|
134 |
* Check whether internal drive.
|
|
135 |
* @param aDrv Drive to be checked.
|
|
136 |
* @return ETrue if internal drive, otherwise EFalse.
|
|
137 |
*/
|
|
138 |
static TBool IsInternalDrive( RFs& aFs, const TInt aDrv );
|
|
139 |
|
|
140 |
/**
|
|
141 |
* Check whether removable drive.
|
|
142 |
* @param aDrv Drive to be checked.
|
|
143 |
* @return ETrue if internal drive, otherwise EFalse.
|
|
144 |
*/
|
|
145 |
static TBool IsRemovableDrive( RFs& aFs, const TInt aDrv );
|
|
146 |
|
|
147 |
/**
|
|
148 |
* Check whether mass storage drive.
|
|
149 |
* @param aDrv Drive to be checked.
|
|
150 |
* @return ETrue if mass storage drive, otherwise EFalse.
|
|
151 |
*/
|
|
152 |
static TBool IsMassStorageDrive( RFs& aFs, const TInt aDrv );
|
|
153 |
|
|
154 |
private:
|
|
155 |
|
|
156 |
/**
|
|
157 |
* C++ default constructor is prohibited.
|
|
158 |
*/
|
|
159 |
CMseng(MMsengUIHandler& aUIHandler);
|
|
160 |
|
|
161 |
/**
|
|
162 |
* By default Symbian OS constructor is private.
|
|
163 |
*
|
|
164 |
* Initialize iResultArray by reading the the data group
|
|
165 |
* names from resource file and setting all result values to zero.
|
|
166 |
* Initialize iDataGroupUidArray and iDataGroupExtArray
|
|
167 |
* from resource file.
|
|
168 |
*/
|
|
169 |
void ConstructL();
|
|
170 |
|
|
171 |
|
|
172 |
// Prohibit copy constructor if not deriving from CBase.
|
|
173 |
CMseng( const CMseng& );
|
|
174 |
// Prohibit assigment operator if not deriving from CBase.
|
|
175 |
CMseng& operator= ( const CMseng& );
|
|
176 |
|
|
177 |
|
|
178 |
private: // Data members
|
|
179 |
|
|
180 |
MMsengUIHandler& iUIHandler;
|
|
181 |
CMsengScanner* iScanner;
|
|
182 |
|
|
183 |
// Number of data groups
|
|
184 |
TInt iNumberOfDataGroups;
|
|
185 |
|
|
186 |
// These arrays are needed to when calculating the result.
|
|
187 |
// They are indexed using values from enum TDataGroups.
|
|
188 |
// This creates the mapping between data groups and the
|
|
189 |
// UIDs and extensions belonging to a particular data group
|
|
190 |
CArrayPtrFlat<CIntArray>* iDataGroupUidArray;
|
|
191 |
CArrayPtrFlat<CIntArray>* iDataGroupExtArray;
|
|
192 |
|
|
193 |
RFs iFsSession;
|
|
194 |
CResourceFile* iResFile;
|
|
195 |
mutable TInt64 iFreeMemory;
|
|
196 |
|
|
197 |
};
|
|
198 |
|
|
199 |
#endif // CMSENG_H
|
|
200 |
|
|
201 |
// End of File
|