|
1 /* |
|
2 * Copyright (c) 2002-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 * This class contains a collection of small static utility functions |
|
16 * needed all around the application. The class has no prefix letter |
|
17 * |
|
18 * |
|
19 */ |
|
20 |
|
21 |
|
22 #ifndef __VRUTILS_H |
|
23 #define __VRUTILS_H |
|
24 |
|
25 // INCLUDES |
|
26 #include <bldvariant.hrh> |
|
27 #include <f32file.h> |
|
28 #include <badesca.h> |
|
29 #include "VRConsts.h" |
|
30 #include "voicerecorder.hrh" |
|
31 |
|
32 // CLASS DECLARATION |
|
33 |
|
34 class TVRDriveInfo |
|
35 { |
|
36 public: |
|
37 TBool iDrivePresent; |
|
38 TBool iDriveLocked; |
|
39 TBool iDriveCorrupted; |
|
40 TBool iDriveReadOnly; |
|
41 TBool iDriveFull; |
|
42 }; |
|
43 |
|
44 class VRUtils |
|
45 { |
|
46 public: // New functions |
|
47 |
|
48 /** |
|
49 * Returns the currently effective path where to store voice memos |
|
50 * The directory is affected by the settings and the availability of MMC |
|
51 * |
|
52 * @return Returns a non-modifiable pointer descriptor containing the |
|
53 * currently effective path where to store voice memos. |
|
54 The descriptor is left on cleanup stack. |
|
55 */ |
|
56 IMPORT_C static void MemoStoreDirectoryL( TDes &aPath ); |
|
57 |
|
58 /** |
|
59 * This method sets the default memo store setting (Phone Memory / MMC) |
|
60 * |
|
61 * @param aMemory Memory to set as default store |
|
62 */ |
|
63 IMPORT_C static void SetMemoStoreL( TVRMemoStore aMemory ); |
|
64 |
|
65 /** |
|
66 * This method returns the default memo store setting |
|
67 * @return The default memo store |
|
68 */ |
|
69 IMPORT_C static TVRMemoStore MemoStoreL(); |
|
70 |
|
71 /** |
|
72 * This method returns the current status of MMC (inserted/locked/etc...) |
|
73 * @param aDriveInfo MMC status |
|
74 */ |
|
75 IMPORT_C static void GetMMCInfo( TVRDriveInfo& aDriveInfo ); |
|
76 |
|
77 /** |
|
78 * Set the default speaker |
|
79 * @param aSpeaker ESpeakerEarPiece or ESpeakerIhf |
|
80 */ |
|
81 IMPORT_C static void SetDefaultSpeakerL( const TVRSpeaker aSpeaker); |
|
82 |
|
83 /** |
|
84 * This method returns the current speaker |
|
85 * @return Default speaker, either ESpeakerEarPiece or ESpeakerIhf |
|
86 */ |
|
87 IMPORT_C static TVRSpeaker DefaultSpeakerL(); |
|
88 |
|
89 /** |
|
90 * Set the default volume setting for specified speaker |
|
91 * @param aSpeaker ESpeakerEarPiece or ESpeakerIhf |
|
92 * @param aVolume New TInt value to save |
|
93 */ |
|
94 IMPORT_C static void SetDefaultVolumeL( const TVRSpeaker aSpeaker, const TInt aVolume ); |
|
95 |
|
96 /** |
|
97 * This method returns the default volume setting for specivied speaker |
|
98 * @param aSpeaker ESpeakerEarPiece or ESpeakerIhf |
|
99 * @return The retrieved volume setting value |
|
100 */ |
|
101 IMPORT_C static TInt DefaultVolumeL( const TVRSpeaker aSpeaker ); |
|
102 |
|
103 |
|
104 /** |
|
105 * Set the default quality setting |
|
106 * @param aSpeaker EQualityMMSOptimized or EQualityHigh |
|
107 */ |
|
108 IMPORT_C static void SetQualityL( const TVRQuality aQuality ); |
|
109 |
|
110 /** |
|
111 * This method returns the current quality setting |
|
112 * @return Default quality, either EQualityMMSOptimized or EQualityHigh |
|
113 */ |
|
114 IMPORT_C static TVRQuality QualityL(); |
|
115 |
|
116 /** |
|
117 * This method shows the out-of-memory confirmation query |
|
118 * @param aMmc Shows qtn_memlo_not_enough_memory if EFalse or |
|
119 * qtn_memlo_mmc_not_enough_memory if ETrue |
|
120 */ |
|
121 IMPORT_C static void ShowMemoryFullConfirmationQuery( TBool aMmc = EFalse ); |
|
122 |
|
123 /** |
|
124 * This method checks if video or VOIP call is ongoing |
|
125 * @param aShowNote Show error note if ETrue |
|
126 * @return ETrue if unsupported call is ongoing, EFalse otherwise |
|
127 */ |
|
128 IMPORT_C static TBool UnsupportedCallTypeOngoing( TBool aShowNote = EFalse ); |
|
129 |
|
130 /** |
|
131 * This method returns the maximum length for a memo |
|
132 * @return Maximum length |
|
133 */ |
|
134 IMPORT_C static TInt MaxLengthL(); |
|
135 |
|
136 /** |
|
137 * Check if variated feature is configured on |
|
138 * @param aFeature Internal feature id |
|
139 * @return ETrue if feature is enabled |
|
140 */ |
|
141 IMPORT_C static TBool FeatureEnabled( TVRFeature aFeature ); |
|
142 |
|
143 /** |
|
144 * Generate a filename that has unique body in given path. |
|
145 * @param aFs Reference to connected file server session handle |
|
146 * @param aName Path to destination folder. On return contains |
|
147 * a unique file name with full path and extension |
|
148 * @param aType The type of file to be generated. Extension will be |
|
149 appended according to this parameter. |
|
150 */ |
|
151 IMPORT_C static void GenerateUniqueFilenameL( RFs& aFs, |
|
152 TFileName& aName, TVRFiletype aType ); |
|
153 |
|
154 /** |
|
155 * This method returns the running count of recorded memos |
|
156 * @return Count of recorded memos |
|
157 */ |
|
158 IMPORT_C static TInt MemoCount(); |
|
159 |
|
160 /** |
|
161 * This method returns the running count of recorded memos |
|
162 * @return Count of recorded memos |
|
163 */ |
|
164 IMPORT_C static void SetMemoCount( TInt aNewCount ); |
|
165 |
|
166 /** |
|
167 * This method returns the bitrate that is used when recording amr clips |
|
168 * @return Bitrate |
|
169 */ |
|
170 IMPORT_C static TUint AMRBitrateL(); |
|
171 |
|
172 |
|
173 /** |
|
174 * This method returns the bitrate that is used when recording amr clips |
|
175 * @return Bitrate |
|
176 */ |
|
177 IMPORT_C static TUint AACBitrateL(); |
|
178 |
|
179 |
|
180 /** |
|
181 * This method returns the AAC-LC sampling rate that is used when recording AAC-LC clips |
|
182 * @return Sampleing rate |
|
183 */ |
|
184 IMPORT_C static TInt AACSamplerateL(); |
|
185 |
|
186 /** |
|
187 * This method returns the audio mode that is used when recording AAC-LC clips |
|
188 * @return audio mode |
|
189 */ |
|
190 IMPORT_C static TInt AACAudioModeL(); |
|
191 |
|
192 #ifdef RD_MULTIPLE_DRIVE |
|
193 /** |
|
194 * This method sets the default memo store setting (to support multipledrives) |
|
195 * |
|
196 * @param aMemory Memory to set as default store |
|
197 */ |
|
198 IMPORT_C static void SetMemoDriveL( TDriveNumber aDrive ); |
|
199 |
|
200 /** |
|
201 * This method returns default phone memory drive |
|
202 * |
|
203 * |
|
204 */ |
|
205 IMPORT_C static TInt DefaultMemoDriveL(); |
|
206 |
|
207 /** |
|
208 * This method returns the current status of Drive (inserted/locked/etc...) |
|
209 * @param aDriveInfo MMC status |
|
210 */ |
|
211 IMPORT_C static void GetDriveInfo( TInt aDrive, TUint& aDriveInfo ); |
|
212 |
|
213 /** |
|
214 * This method returns the default memo drive setting |
|
215 * @return The default memo store |
|
216 */ |
|
217 IMPORT_C static TInt MemoDriveL(); |
|
218 #endif |
|
219 |
|
220 private: |
|
221 |
|
222 /** |
|
223 * Default constructor declared as private to prohibit construction. |
|
224 */ |
|
225 VRUtils(); |
|
226 |
|
227 /** |
|
228 * Store a setting in Central Repository |
|
229 * @param aKey The Central Repository key |
|
230 * @param aValue The value for the key |
|
231 */ |
|
232 static void SetSettingValueL( const TUint32 aKey, const TInt aValue ); |
|
233 |
|
234 /** |
|
235 * Get a setting from Central Repository |
|
236 * @param aKey The requested Central Repository key |
|
237 * @param aDefaultValue If key was not found, this is the value used |
|
238 * @return The value of the requested key |
|
239 */ |
|
240 static TInt SettingValueL( const TUint32 aKey, const TInt aValue ); |
|
241 |
|
242 /** |
|
243 * This method shows the out-of-memory confirmation query |
|
244 * @param aMmc Shows qtn_memlo_not_enough_memory if EFalse or |
|
245 * qtn_memlo_mmc_not_enough_memory if ETrue |
|
246 */ |
|
247 static void ShowMemoryFullConfirmationQueryL( TBool aMmc = EFalse ); |
|
248 |
|
249 /** |
|
250 * This method is called if video or VOIP call is ongoing and |
|
251 * information note needs to be shown |
|
252 * @param aResourceId |
|
253 */ |
|
254 static void ShowUnsupportedCallTypeNoteL( TInt aResourceId ); |
|
255 |
|
256 /** |
|
257 * This method appends the requested file type extension to filename |
|
258 * @param aName Contains full file name after completion |
|
259 * @param aType File type that defines the extension to be appended |
|
260 */ |
|
261 static void AppendExtension( TFileName& aName, TVRFiletype aType ); |
|
262 |
|
263 /** |
|
264 * This method does the full check for the parameter filename existence |
|
265 * @param aFs Reference to connected file server session handle |
|
266 * @param aName Filename to check. No Path nor extension included. |
|
267 * @return ETrue if file exists, EFalse otherwise |
|
268 */ |
|
269 static TBool DoesFileExistL( RFs& aFs, TFileName aName ); |
|
270 |
|
271 /** |
|
272 * This method checks if parameter filename exists or not |
|
273 * @param aFs Reference to connected file server session handle |
|
274 * @param aName Filename to check. Path included. Extension excluded. |
|
275 * @return ETrue if file exists, EFalse otherwise |
|
276 */ |
|
277 static TBool CheckFileExistence( RFs& aFs, TFileName aName ); |
|
278 |
|
279 }; |
|
280 |
|
281 #endif // __VRUTILS_H |
|
282 |
|
283 // End of File |