28
|
1 |
/*
|
|
2 |
* Copyright (c) 2009-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: RCSE Settings Import from DBMS
|
|
15 |
*
|
|
16 |
*/
|
|
17 |
|
|
18 |
|
|
19 |
#include "rcsedbimporter.h"
|
|
20 |
#include "rcseconstants.h"
|
|
21 |
#include "crcseprofileregistry.h"
|
|
22 |
#include "crcseaudiocodecregistry.h"
|
|
23 |
#include "rcsedefaultdbnames.h"
|
|
24 |
#include "rcselogger.h"
|
|
25 |
|
|
26 |
|
|
27 |
// ======== MEMBER FUNCTIONS ========
|
|
28 |
|
|
29 |
// ---------------------------------------------------------------------------
|
|
30 |
// Default constructor
|
|
31 |
// ---------------------------------------------------------------------------
|
|
32 |
//
|
|
33 |
CRCSEDbImporter::CRCSEDbImporter()
|
|
34 |
{
|
|
35 |
}
|
|
36 |
|
|
37 |
|
|
38 |
// ---------------------------------------------------------------------------
|
|
39 |
// ConstructL
|
|
40 |
// ---------------------------------------------------------------------------
|
|
41 |
//
|
|
42 |
void CRCSEDbImporter::ConstructL()
|
|
43 |
{
|
|
44 |
RCSELOGSTRING( "CRCSEDbImporter::ConstructL() - IN" );
|
|
45 |
User::LeaveIfError( iDbSession.Connect() );
|
|
46 |
RCSELOGSTRING( "CRCSEDbImporter::ConstructL() - OUT" );
|
|
47 |
}
|
|
48 |
|
|
49 |
|
|
50 |
// ---------------------------------------------------------------------------
|
|
51 |
// NewL
|
|
52 |
// ---------------------------------------------------------------------------
|
|
53 |
//
|
|
54 |
CRCSEDbImporter* CRCSEDbImporter::NewL()
|
|
55 |
{
|
|
56 |
CRCSEDbImporter* self = CRCSEDbImporter::NewLC();
|
|
57 |
CleanupStack::Pop( self );
|
|
58 |
return self;
|
|
59 |
}
|
|
60 |
|
|
61 |
|
|
62 |
// ---------------------------------------------------------------------------
|
|
63 |
// NewLC
|
|
64 |
// ---------------------------------------------------------------------------
|
|
65 |
//
|
|
66 |
CRCSEDbImporter* CRCSEDbImporter::NewLC()
|
|
67 |
{
|
|
68 |
CRCSEDbImporter* self = new( ELeave ) CRCSEDbImporter;
|
|
69 |
CleanupStack::PushL( self );
|
|
70 |
self->ConstructL();
|
|
71 |
return self;
|
|
72 |
}
|
|
73 |
|
|
74 |
|
|
75 |
// ---------------------------------------------------------------------------
|
|
76 |
// Destructor
|
|
77 |
// ---------------------------------------------------------------------------
|
|
78 |
//
|
|
79 |
CRCSEDbImporter::~CRCSEDbImporter()
|
|
80 |
{
|
|
81 |
ReleaseImportLock();
|
|
82 |
|
|
83 |
iDb.Close();
|
|
84 |
iDbSession.Close();
|
|
85 |
iProfiles.ResetAndDestroy();
|
|
86 |
iCodecs.ResetAndDestroy();
|
|
87 |
iCodecIds.Close();
|
|
88 |
}
|
|
89 |
|
|
90 |
// ---------------------------------------------------------------------------
|
|
91 |
// Check if imported (restored) database file exists.
|
|
92 |
// ---------------------------------------------------------------------------
|
|
93 |
//
|
|
94 |
TBool CRCSEDbImporter::ImportExists()
|
|
95 |
{
|
|
96 |
RCSELOGSTRING( "CRCSEDbImporter::ImportExists() - IN" );
|
|
97 |
|
|
98 |
TBool profileImport( EFalse );
|
|
99 |
TBool codecImport( EFalse );
|
|
100 |
|
|
101 |
RDbs dbSession;
|
|
102 |
RDbNamedDatabase db;
|
|
103 |
|
|
104 |
TInt err( dbSession.Connect() );
|
|
105 |
|
|
106 |
if ( KErrNone != err )
|
|
107 |
{
|
|
108 |
return EFalse;
|
|
109 |
}
|
|
110 |
else
|
|
111 |
{
|
|
112 |
// Check voip profiles
|
|
113 |
err = db.Open( dbSession, KDbName, KDatabaseUID );
|
|
114 |
db.Close();
|
|
115 |
|
|
116 |
if ( KErrNone == err )
|
|
117 |
{
|
|
118 |
profileImport = ETrue;
|
|
119 |
}
|
|
120 |
|
|
121 |
// Check audio codecs
|
|
122 |
err = db.Open( dbSession, KDbCodecName, KDatabaseUID );
|
|
123 |
db.Close();
|
|
124 |
|
|
125 |
if ( KErrNone == err )
|
|
126 |
{
|
|
127 |
codecImport = ETrue;
|
|
128 |
}
|
|
129 |
}
|
|
130 |
|
|
131 |
dbSession.Close();
|
|
132 |
|
|
133 |
RCSELOGSTRING2( "CRCSEDbImporter::ImportExists(%d) - OUT",
|
|
134 |
profileImport && codecImport );
|
|
135 |
|
|
136 |
// Return ETrue only when both of imports exist
|
|
137 |
return profileImport && codecImport;
|
|
138 |
}
|
|
139 |
|
|
140 |
|
|
141 |
// ---------------------------------------------------------------------------
|
|
142 |
// Check if import is already running.
|
|
143 |
// ---------------------------------------------------------------------------
|
|
144 |
//
|
|
145 |
TBool CRCSEDbImporter::IsImportRunning()
|
|
146 |
{
|
|
147 |
RCSELOGSTRING( "CRCSEDbImporter::IsImportRunning() - IN" );
|
|
148 |
|
|
149 |
TBool ret( EFalse );
|
|
150 |
|
|
151 |
RDbs dbSession;
|
|
152 |
RDbNamedDatabase db;
|
|
153 |
|
|
154 |
TInt err( dbSession.Connect() );
|
|
155 |
|
|
156 |
if ( KErrNone != err )
|
|
157 |
{
|
|
158 |
ret = EFalse;
|
|
159 |
}
|
|
160 |
else
|
|
161 |
{
|
|
162 |
// Check if temporary table exists
|
|
163 |
err = db.Open( dbSession, KDbTempName, KDatabaseUID );
|
|
164 |
db.Close();
|
|
165 |
|
|
166 |
if ( KErrNone == err )
|
|
167 |
{
|
|
168 |
ret = ETrue;
|
|
169 |
}
|
|
170 |
}
|
|
171 |
|
|
172 |
dbSession.Close();
|
|
173 |
|
|
174 |
RCSELOGSTRING2( "CRCSEDbImporter::IsImportRunning(%d) - OUT", ret );
|
|
175 |
|
|
176 |
return ret;
|
|
177 |
}
|
|
178 |
|
|
179 |
|
|
180 |
// ---------------------------------------------------------------------------
|
|
181 |
// Imports RCSE entries from db file and stores them to repository.
|
|
182 |
// ---------------------------------------------------------------------------
|
|
183 |
//
|
|
184 |
void CRCSEDbImporter::ImportAndStoreL()
|
|
185 |
{
|
|
186 |
RCSELOGSTRING( "CRCSEDbImporter::ImportL() - IN" );
|
|
187 |
|
|
188 |
SetImportLock();
|
|
189 |
|
|
190 |
// Import settings data
|
|
191 |
ImportVoIPProfilesL();
|
|
192 |
ImportAudioCodecsL();
|
|
193 |
|
|
194 |
// Store audio codecs
|
|
195 |
StoreAudioCodecsL();
|
|
196 |
|
|
197 |
// Update and store VoIP profiles
|
|
198 |
UpdatePreferredCodecs();
|
|
199 |
StoreVoIPProfilesL();
|
|
200 |
|
|
201 |
DeleteImports();
|
|
202 |
ReleaseImportLock();
|
|
203 |
|
|
204 |
RCSELOGSTRING( "CRCSEDbImporter::ImportL() - OUT" );
|
|
205 |
}
|
|
206 |
|
|
207 |
|
|
208 |
// ---------------------------------------------------------------------------
|
|
209 |
// Set locking data base file to prevent disturb during the import operation.
|
|
210 |
// ---------------------------------------------------------------------------
|
|
211 |
//
|
|
212 |
void CRCSEDbImporter::SetImportLock()
|
|
213 |
{
|
|
214 |
RCSELOGSTRING( "CRCSEDbImporter::SetImportLock() - IN" );
|
|
215 |
|
|
216 |
// Create temporary db that indicates ongoing operation
|
|
217 |
iDb.Create( iDbSession, KDbTempName, KDatabaseUID );
|
|
218 |
iDb.Close();
|
|
219 |
|
|
220 |
RCSELOGSTRING( "CRCSEDbImporter::SetImportLock() - OUT" );
|
|
221 |
}
|
|
222 |
|
|
223 |
|
|
224 |
// ---------------------------------------------------------------------------
|
|
225 |
// Release locking data base file.
|
|
226 |
// ---------------------------------------------------------------------------
|
|
227 |
//
|
|
228 |
void CRCSEDbImporter::ReleaseImportLock()
|
|
229 |
{
|
|
230 |
RCSELOGSTRING( "CRCSEDbImporter::ReleaseImportLock() - IN" );
|
|
231 |
|
|
232 |
// Delete temporary locking db
|
|
233 |
TInt err( iDb.Open( iDbSession, KDbTempName, KDatabaseUID ) );
|
|
234 |
|
|
235 |
if ( KErrNone == err )
|
|
236 |
{
|
|
237 |
iDb.Destroy();
|
|
238 |
iDb.Close();
|
|
239 |
RCSELOGSTRING( "Temporary db deleted" );
|
|
240 |
}
|
|
241 |
else
|
|
242 |
{
|
|
243 |
RCSELOGSTRING2( "Temporary db not deleted, err=%d", err );
|
|
244 |
}
|
|
245 |
|
|
246 |
RCSELOGSTRING( "CRCSEDbImporter::ReleaseImportLock() - OUT" );
|
|
247 |
}
|
|
248 |
|
|
249 |
|
|
250 |
// ---------------------------------------------------------------------------
|
|
251 |
// Import VoIP profiles from database to array.
|
|
252 |
// ---------------------------------------------------------------------------
|
|
253 |
//
|
|
254 |
void CRCSEDbImporter::ImportVoIPProfilesL()
|
|
255 |
{
|
|
256 |
RCSELOGSTRING( "CRCSEDbImporter::ImportVoIPProfilesL() - IN" );
|
|
257 |
User::LeaveIfError( iDb.Open( iDbSession, KDbName, KDatabaseUID ) );
|
|
258 |
|
|
259 |
// Create sql statement
|
|
260 |
HBufC* statement = HBufC::NewLC(
|
|
261 |
KSQLSelectAllStatement().Length() +
|
|
262 |
KProfileTableName().Length() );
|
|
263 |
|
|
264 |
statement->Des().Format(
|
|
265 |
KSQLSelectAllStatement, &KProfileTableName );
|
|
266 |
|
|
267 |
// Launch query
|
|
268 |
RDbView view;
|
|
269 |
User::LeaveIfError( view.Prepare( iDb, *statement ) );
|
|
270 |
CleanupClosePushL( view );
|
|
271 |
User::LeaveIfError( view.EvaluateAll() );
|
|
272 |
view.FirstL();
|
|
273 |
|
|
274 |
// Browse all result rows trough
|
|
275 |
while ( view.AtRow() )
|
|
276 |
{
|
|
277 |
view.GetL(); // Get the data row
|
|
278 |
const TInt cols( view.ColCount() + 1 );
|
|
279 |
|
|
280 |
CRCSEProfileEntry* entry = CRCSEProfileEntry::NewLC();
|
|
281 |
|
|
282 |
// Map the data from current row to profile entry.
|
|
283 |
for( TInt i = 1; i < cols; i++ )
|
|
284 |
{
|
|
285 |
MapColumnToEntryL( i, view, *entry );
|
|
286 |
}
|
|
287 |
|
|
288 |
iProfiles.AppendL( entry );
|
|
289 |
CleanupStack::Pop( entry );
|
|
290 |
view.NextL();
|
|
291 |
}
|
|
292 |
|
|
293 |
CleanupStack::PopAndDestroy( &view );
|
|
294 |
CleanupStack::PopAndDestroy( statement );
|
|
295 |
|
|
296 |
iDb.Close();
|
|
297 |
RCSELOGSTRING( "CRCSEDbImporter::ImportVoIPProfilesL() - OUT" );
|
|
298 |
}
|
|
299 |
|
|
300 |
// ---------------------------------------------------------------------------
|
|
301 |
// Import audio codecs from database to array.
|
|
302 |
// ---------------------------------------------------------------------------
|
|
303 |
//
|
|
304 |
void CRCSEDbImporter::ImportAudioCodecsL()
|
|
305 |
{
|
|
306 |
RCSELOGSTRING( "CRCSEDbImporter::ImportAudioCodecsL() - IN" );
|
|
307 |
|
|
308 |
User::LeaveIfError( iDb.Open( iDbSession, KDbCodecName, KDatabaseUID ) );
|
|
309 |
|
|
310 |
// Create sql statement
|
|
311 |
HBufC* statement = HBufC::NewLC(
|
|
312 |
KSQLSelectAllStatement().Length() +
|
|
313 |
KAudioCodecTableName().Length() );
|
|
314 |
|
|
315 |
statement->Des().Format(
|
|
316 |
KSQLSelectAllStatement, &KAudioCodecTableName );
|
|
317 |
|
|
318 |
// Launch query
|
|
319 |
RDbView view;
|
|
320 |
User::LeaveIfError( view.Prepare( iDb, *statement ) );
|
|
321 |
CleanupClosePushL( view );
|
|
322 |
User::LeaveIfError( view.EvaluateAll() );
|
|
323 |
view.FirstL();
|
|
324 |
|
|
325 |
// Browse all result rows trough
|
|
326 |
while ( view.AtRow() )
|
|
327 |
{
|
|
328 |
view.GetL(); // Get the data row
|
|
329 |
const TInt cols( view.ColCount() + 1 );
|
|
330 |
|
|
331 |
CRCSEAudioCodecEntry* entry = CRCSEAudioCodecEntry::NewLC();
|
|
332 |
|
|
333 |
// Map the data from current row to audio codec entry.
|
|
334 |
for( TInt i = 1; i < cols; i++ )
|
|
335 |
{
|
|
336 |
MapColumnToEntryL( i, view, *entry );
|
|
337 |
}
|
|
338 |
|
|
339 |
// Append entry and its ID
|
|
340 |
iCodecs.AppendL( entry );
|
|
341 |
|
|
342 |
TRCSEIdPair idPair;
|
|
343 |
idPair.iOldId = entry->iCodecId;
|
|
344 |
iCodecIds.Append( idPair );
|
|
345 |
|
|
346 |
CleanupStack::Pop( entry );
|
|
347 |
view.NextL();
|
|
348 |
}
|
|
349 |
|
|
350 |
CleanupStack::PopAndDestroy( &view );
|
|
351 |
CleanupStack::PopAndDestroy( statement );
|
|
352 |
|
|
353 |
iDb.Close();
|
|
354 |
|
|
355 |
RCSELOGSTRING( "CRCSEDbImporter::ImportAudioCodecsL() - OUT" );
|
|
356 |
}
|
|
357 |
|
|
358 |
|
|
359 |
// ---------------------------------------------------------------------------
|
|
360 |
// Delete imported (restored) rcse database files.
|
|
361 |
// ---------------------------------------------------------------------------
|
|
362 |
//
|
|
363 |
void CRCSEDbImporter::DeleteImports()
|
|
364 |
{
|
|
365 |
RCSELOGSTRING( "CRCSEDbImporter::DeleteImports() - IN" );
|
|
366 |
|
|
367 |
TInt err( 0 );
|
|
368 |
|
|
369 |
// Delete VoIP profile import
|
|
370 |
err = iDb.Open( iDbSession, KDbName, KDatabaseUID );
|
|
371 |
|
|
372 |
if ( KErrNone == err )
|
|
373 |
{
|
|
374 |
iDb.Destroy();
|
|
375 |
iDb.Close();
|
|
376 |
RCSELOGSTRING( "Profile import deleted" );
|
|
377 |
}
|
|
378 |
else
|
|
379 |
{
|
|
380 |
RCSELOGSTRING2( "Profile import not deleted, err=%d", err );
|
|
381 |
}
|
|
382 |
|
|
383 |
// Delete audio codec import
|
|
384 |
err = iDb.Open( iDbSession, KDbCodecName, KDatabaseUID );
|
|
385 |
|
|
386 |
if ( KErrNone == err )
|
|
387 |
{
|
|
388 |
iDb.Destroy();
|
|
389 |
iDb.Close();
|
|
390 |
RCSELOGSTRING( "Codec import deleted" );
|
|
391 |
}
|
|
392 |
else
|
|
393 |
{
|
|
394 |
RCSELOGSTRING2( "Codec import not deleted, err=%d", err );
|
|
395 |
}
|
|
396 |
|
|
397 |
RCSELOGSTRING( "CRCSEDbImporter::DeleteImports() - OUT" );
|
|
398 |
}
|
|
399 |
|
|
400 |
|
|
401 |
// ---------------------------------------------------------------------------
|
|
402 |
// Map query result from a given column to profile entry.
|
|
403 |
// -----------------------------------------------------------------------------
|
|
404 |
//
|
|
405 |
void CRCSEDbImporter::MapColumnToEntryL(
|
|
406 |
TInt aColumnIndex,
|
|
407 |
const RDbView& aView,
|
|
408 |
CRCSEProfileEntry& aEntry )
|
|
409 |
{
|
|
410 |
// Get the column definition
|
|
411 |
const TDbCol col( aView.ColDef( aColumnIndex ) );
|
|
412 |
|
|
413 |
// Maps the values using the names of columns
|
|
414 |
if ( col.iName == KProfileId )
|
|
415 |
{
|
|
416 |
aEntry.iId = aView.ColUint32( aColumnIndex );
|
|
417 |
}
|
|
418 |
else if ( col.iName == KProtocolIds )
|
|
419 |
{
|
|
420 |
const TDesC& ids = aView.ColDes( aColumnIndex );
|
|
421 |
// Extracts the numbers from ids to iIds.
|
|
422 |
GetProfileIdsFromDescriptorL( ids, aEntry.iIds );
|
|
423 |
}
|
|
424 |
else if ( col.iName == KProviderName )
|
|
425 |
{
|
|
426 |
aEntry.iProviderName.Copy( aView.ColDes( aColumnIndex ) );
|
|
427 |
}
|
|
428 |
else if ( col.iName == KSettingsName )
|
|
429 |
{
|
|
430 |
aEntry.iSettingsName.Copy( aView.ColDes( aColumnIndex ) );
|
|
431 |
}
|
|
432 |
else if ( col.iName == KAutoComplete )
|
|
433 |
{
|
|
434 |
aEntry.iAutoComplete = static_cast<CRCSEProfileEntry::TOnOff>(
|
|
435 |
aView.ColInt32( aColumnIndex ) );
|
|
436 |
}
|
|
437 |
else if ( col.iName == KEndMediaPort )
|
|
438 |
{
|
|
439 |
aEntry.iEndMediaPort = aView.ColInt32( aColumnIndex );
|
|
440 |
}
|
|
441 |
else if ( col.iName == KHoldRingBack )
|
|
442 |
{
|
|
443 |
aEntry.iHoldRingBack = aView.ColInt32( aColumnIndex );
|
|
444 |
}
|
|
445 |
else if ( col.iName == KInbandDtmf)
|
|
446 |
{
|
|
447 |
aEntry.iInbandDTMF = static_cast<CRCSEProfileEntry::TOnOff>(
|
|
448 |
aView.ColInt32( aColumnIndex ) );
|
|
449 |
}
|
|
450 |
else if ( col.iName == KMediaQOS )
|
|
451 |
{
|
|
452 |
aEntry.iMediaQOS = aView.ColInt32( aColumnIndex );
|
|
453 |
}
|
|
454 |
else if ( col.iName == KOutbandDtmf )
|
|
455 |
{
|
|
456 |
aEntry.iOutbandDTMF = static_cast<CRCSEProfileEntry::TOnOff>
|
|
457 |
( aView.ColInt32( aColumnIndex ) );
|
|
458 |
}
|
|
459 |
else if ( col.iName == KPreferredCodecs )
|
|
460 |
{
|
|
461 |
const TDesC& codecs = aView.ColDes( aColumnIndex );
|
|
462 |
// Extracts the numbers from codecs to iPreferredCodecs.
|
|
463 |
GetNumbersFromDescriptorL( codecs, aEntry.iPreferredCodecs );
|
|
464 |
}
|
|
465 |
else if ( col.iName == KSiqnalingQOS )
|
|
466 |
{
|
|
467 |
aEntry.iSiqnalingQOS = aView.ColInt32( aColumnIndex );
|
|
468 |
}
|
|
469 |
else if ( col.iName == KStartMediaPort )
|
|
470 |
{
|
|
471 |
aEntry.iStartMediaPort = aView.ColInt32( aColumnIndex );
|
|
472 |
}
|
|
473 |
else if ( col.iName == KCFNoAnswer )
|
|
474 |
{
|
|
475 |
aEntry.iCFNoAnswer = static_cast<CRCSEProfileEntry::TOnOff>
|
|
476 |
( aView.ColInt32( aColumnIndex ) );
|
|
477 |
}
|
|
478 |
else if ( col.iName == KCFBusy )
|
|
479 |
{
|
|
480 |
aEntry.iCFBusy = static_cast<CRCSEProfileEntry::TOnOff>
|
|
481 |
( aView.ColInt32( aColumnIndex ) );
|
|
482 |
}
|
|
483 |
else if ( col.iName == KCFUnconditional )
|
|
484 |
{
|
|
485 |
aEntry.iCFUnconditional = static_cast<CRCSEProfileEntry::TOnOff>(
|
|
486 |
aView.ColInt32( aColumnIndex ) );
|
|
487 |
}
|
|
488 |
else if ( col.iName == KRedundancy )
|
|
489 |
{
|
|
490 |
aEntry.iRedundancy = static_cast<CRCSEProfileEntry::TOnOff>(
|
|
491 |
aView.ColInt32( aColumnIndex ) );
|
|
492 |
}
|
|
493 |
else if ( col.iName == KSecureCallPreference )
|
|
494 |
{
|
|
495 |
aEntry.iSecureCallPreference = aView.ColUint32( aColumnIndex );
|
|
496 |
}
|
|
497 |
else if ( col.iName == KVoIPProfileLock )
|
|
498 |
{
|
|
499 |
aEntry.iVoIPProfileLock = aView.ColUint32( aColumnIndex );
|
|
500 |
}
|
|
501 |
else if ( col.iName == KAdhocAllowed )
|
|
502 |
{
|
|
503 |
aEntry.iAdhocAllowed = aView.ColUint32( aColumnIndex );
|
|
504 |
}
|
|
505 |
else if ( col.iName == KSIPServerType )
|
|
506 |
{
|
|
507 |
aEntry.iSIPServerType.Copy( aView.ColDes( aColumnIndex ) );
|
|
508 |
}
|
|
509 |
else if ( col.iName == KSBCType )
|
|
510 |
{
|
|
511 |
aEntry.iSBCType.Copy( aView.ColDes( aColumnIndex ) );
|
|
512 |
}
|
|
513 |
else if ( col.iName == KSTUNServerType )
|
|
514 |
{
|
|
515 |
aEntry.iSTUNServerType.Copy( aView.ColDes( aColumnIndex ) );
|
|
516 |
}
|
|
517 |
else if ( col.iName == KWLANAPType )
|
|
518 |
{
|
|
519 |
aEntry.iWLANAPType.Copy( aView.ColDes( aColumnIndex ) );
|
|
520 |
}
|
|
521 |
else if ( col.iName == KPSTNGatewayType )
|
|
522 |
{
|
|
523 |
aEntry.iPSTNGatewayType.Copy( aView.ColDes( aColumnIndex ) );
|
|
524 |
}
|
|
525 |
else if ( col.iName == KSecurityGatewayType )
|
|
526 |
{
|
|
527 |
aEntry.iSecurityGatewayType.Copy( aView.ColDes( aColumnIndex ) );
|
|
528 |
}
|
|
529 |
else if ( col.iName == KRTCP )
|
|
530 |
{
|
|
531 |
aEntry.iRTCP = aView.ColUint32( aColumnIndex );
|
|
532 |
}
|
|
533 |
else if ( col.iName == KSIPVoIPUAHTerminalType )
|
|
534 |
{
|
|
535 |
aEntry.iSIPVoIPUAHTerminalType = aView.ColUint32( aColumnIndex );
|
|
536 |
}
|
|
537 |
else if ( col.iName == KSIPVoIPUAHeaderWLANMAC )
|
|
538 |
{
|
|
539 |
aEntry.iSIPVoIPUAHeaderWLANMAC = aView.ColUint32( aColumnIndex );
|
|
540 |
}
|
|
541 |
else if ( col.iName == KSIPVoIPUAHeaderString )
|
|
542 |
{
|
|
543 |
aEntry.iSIPVoIPUAHeaderString.Copy( aView.ColDes( aColumnIndex ) );
|
|
544 |
}
|
|
545 |
else if ( col.iName == KProfileLockedToIAP )
|
|
546 |
{
|
|
547 |
aEntry.iProfileLockedToIAP = static_cast<CRCSEProfileEntry::TOnOff>(
|
|
548 |
aView.ColInt32( aColumnIndex ) );
|
|
549 |
}
|
|
550 |
else if ( col.iName == KVoIPPluginUID )
|
|
551 |
{
|
|
552 |
aEntry.iVoIPPluginUID = aView.ColInt32( aColumnIndex );
|
|
553 |
}
|
|
554 |
else if ( col.iName == KAllowVoIPoverWCDMA )
|
|
555 |
{
|
|
556 |
aEntry.iAllowVoIPoverWCDMA = static_cast<CRCSEProfileEntry::TOnOff>(
|
|
557 |
aView.ColInt32( aColumnIndex ) );
|
|
558 |
}
|
|
559 |
else if ( col.iName == KAllowVoIPoverBT )
|
|
560 |
{
|
|
561 |
aEntry.iAllowVoIPoverBT = static_cast<CRCSEProfileEntry::TOnOff>(
|
|
562 |
aView.ColInt32( aColumnIndex ) );
|
|
563 |
}
|
|
564 |
else if ( col.iName == KMeanCountOfVoIPDigits )
|
|
565 |
{
|
|
566 |
aEntry.iMeanCountOfVoIPDigits = aView.ColInt32( aColumnIndex );
|
|
567 |
}
|
|
568 |
else if ( col.iName == KIgnoreAddrDomainPart )
|
|
569 |
{
|
|
570 |
aEntry.iIgnoreAddrDomainPart = aView.ColInt32( aColumnIndex );
|
|
571 |
}
|
|
572 |
|
|
573 |
else if ( col.iName == KHandoverDialect )
|
|
574 |
{
|
|
575 |
aEntry.iHandoverDialect = aView.ColInt32( aColumnIndex );
|
|
576 |
}
|
|
577 |
else if ( col.iName == KPSTelephonyHOPreference )
|
|
578 |
{
|
|
579 |
aEntry.iPSTelephonyHOPreference = aView.ColInt32( aColumnIndex );
|
|
580 |
}
|
|
581 |
else if ( col.iName == KHOThresholdValueLL )
|
|
582 |
{
|
|
583 |
aEntry.iHOThresholdValueLL = aView.ColInt32( aColumnIndex );
|
|
584 |
}
|
|
585 |
else if ( col.iName == KHOThresholdValueHL )
|
|
586 |
{
|
|
587 |
aEntry.iHOThresholdValueHL = aView.ColInt32( aColumnIndex );
|
|
588 |
}
|
|
589 |
else if ( col.iName == KNumberOfMeasurementsAbove )
|
|
590 |
{
|
|
591 |
aEntry.iNumberOfMeasurementsAbove = aView.ColInt32( aColumnIndex );
|
|
592 |
}
|
|
593 |
else if ( col.iName == KNumberOfMeasurementsBelow )
|
|
594 |
{
|
|
595 |
aEntry.iNumberOfMeasurementsBelow = aView.ColInt32( aColumnIndex );
|
|
596 |
}
|
|
597 |
else if ( col.iName == KSmartScannInterParaHigh )
|
|
598 |
{
|
|
599 |
aEntry.iSmartScannInterParaHigh = aView.ColInt32( aColumnIndex );
|
|
600 |
}
|
|
601 |
else if ( col.iName == KSmartScannInterParaMedium )
|
|
602 |
{
|
|
603 |
aEntry.iSmartScannInterParaMedium = aView.ColInt32( aColumnIndex );
|
|
604 |
}
|
|
605 |
else if ( col.iName == KSmartScannInterParaLow )
|
|
606 |
{
|
|
607 |
aEntry.iSmartScannInterParaLow = aView.ColInt32( aColumnIndex );
|
|
608 |
}
|
|
609 |
else if ( col.iName == KSmartScannInterParaStatic )
|
|
610 |
{
|
|
611 |
aEntry.iSmartScannInterParaStatic = aView.ColInt32( aColumnIndex );
|
|
612 |
}
|
|
613 |
|
|
614 |
else if ( col.iName == KSmartScannDurationHighMode )
|
|
615 |
{
|
|
616 |
aEntry.iSmartScannDurationHighMode = aView.ColInt32( aColumnIndex );
|
|
617 |
}
|
|
618 |
else if ( col.iName == KSmartScannDurationMediumMode )
|
|
619 |
{
|
|
620 |
aEntry.iSmartScannDurationMediumMode = aView.ColInt32( aColumnIndex );
|
|
621 |
}
|
|
622 |
else if ( col.iName == KSmartScannDurationLowMode )
|
|
623 |
{
|
|
624 |
aEntry.iSmartScannDurationLowMode = aView.ColInt32( aColumnIndex );
|
|
625 |
}
|
|
626 |
else if ( col.iName == KHandoffNumber )
|
|
627 |
{
|
|
628 |
aEntry.iHandoffNumber = aView.ColInt32( aColumnIndex );
|
|
629 |
}
|
|
630 |
else if ( col.iName == KHandbackNumber )
|
|
631 |
{
|
|
632 |
aEntry.iHandbackNumber = aView.ColInt32( aColumnIndex );
|
|
633 |
}
|
|
634 |
else if ( col.iName == KHysterisisTimer )
|
|
635 |
{
|
|
636 |
aEntry.iHysterisisTimer = aView.ColInt32( aColumnIndex );
|
|
637 |
}
|
|
638 |
else if ( col.iName == KHandOffProcessTimer )
|
|
639 |
{
|
|
640 |
aEntry.iHandOffProcessTimer = aView.ColInt32( aColumnIndex );
|
|
641 |
}
|
|
642 |
else if ( col.iName == KDisconnectProcessTimer )
|
|
643 |
{
|
|
644 |
aEntry.iDisconnectProcessTimer = aView.ColInt32( aColumnIndex );
|
|
645 |
}
|
|
646 |
else if ( col.iName == KHandoffPrefix )
|
|
647 |
{
|
|
648 |
aEntry.iHandoffPrefix.Copy( aView.ColDes( aColumnIndex ) );
|
|
649 |
}
|
|
650 |
else if ( col.iName == KHandbackPrefix )
|
|
651 |
{
|
|
652 |
aEntry.iHandbackPrefix.Copy( aView.ColDes( aColumnIndex ) );
|
|
653 |
}
|
|
654 |
else if ( col.iName == KHandoverTones )
|
|
655 |
{
|
|
656 |
aEntry.iHandoverTones = aView.ColInt32( aColumnIndex );
|
|
657 |
}
|
|
658 |
else if ( col.iName == KSupportSMSoverWLAN )
|
|
659 |
{
|
|
660 |
aEntry.iSupportSMSoverWLAN = aView.ColInt32( aColumnIndex );
|
|
661 |
}
|
|
662 |
else if ( col.iName == KServiceProviderId )
|
|
663 |
{
|
|
664 |
aEntry.iServiceProviderId = aView.ColUint32( aColumnIndex );
|
|
665 |
}
|
|
666 |
else if ( col.iName == KUserPhoneUriParam )
|
|
667 |
{
|
|
668 |
aEntry.iUserPhoneUriParameter = static_cast<CRCSEProfileEntry::TOnOff>(
|
|
669 |
aView.ColInt32( aColumnIndex ) );
|
|
670 |
}
|
|
671 |
else if ( col.iName == KSIPConnTestAddress )
|
|
672 |
{
|
|
673 |
aEntry.iSIPConnTestAddress.Copy( aView.ColDes( aColumnIndex ) );
|
|
674 |
}
|
|
675 |
else if ( col.iName == KNATSettingsStorageId )
|
|
676 |
{
|
|
677 |
aEntry.iNATSettingsStorageId = aView.ColUint32( aColumnIndex );
|
|
678 |
}
|
|
679 |
else if ( col.iName == KSIPMinSE )
|
|
680 |
{
|
|
681 |
aEntry.iSIPMinSE = aView.ColInt32( aColumnIndex );
|
|
682 |
}
|
|
683 |
else if ( col.iName == KSIPSessionExpires )
|
|
684 |
{
|
|
685 |
aEntry.iSIPSessionExpires = aView.ColInt32( aColumnIndex );
|
|
686 |
}
|
|
687 |
else if ( col.iName == KNATProtocol )
|
|
688 |
{
|
|
689 |
aEntry.iNATProtocol = aView.ColInt32( aColumnIndex );
|
|
690 |
}
|
|
691 |
else if ( col.iName == KNewServiceTable )
|
|
692 |
{
|
|
693 |
aEntry.iNewServiceTableEntry = static_cast<CRCSEProfileEntry::TOnOff>(
|
|
694 |
aView.ColInt32( aColumnIndex ) );
|
|
695 |
}
|
|
696 |
else if ( col.iName == KSNAPId )
|
|
697 |
{
|
|
698 |
aEntry.iSNAPId = aView.ColUint32( aColumnIndex );
|
|
699 |
}
|
|
700 |
else
|
|
701 |
{
|
|
702 |
// Skip unknown column.
|
|
703 |
RCSELOGSTRING2(
|
|
704 |
"CRCSEProfileRegistry::MapColumnToEntryL() - unknown %d",
|
|
705 |
aColumnIndex );
|
|
706 |
}
|
|
707 |
|
|
708 |
}
|
|
709 |
|
|
710 |
|
|
711 |
// -----------------------------------------------------------------------------
|
|
712 |
// Map query result from a given column to audio codec entry.
|
|
713 |
// -----------------------------------------------------------------------------
|
|
714 |
//
|
|
715 |
void CRCSEDbImporter::MapColumnToEntryL(
|
|
716 |
TInt aColumnIndex,
|
|
717 |
const RDbView& aView,
|
|
718 |
CRCSEAudioCodecEntry& aCodecEntry )
|
|
719 |
{
|
|
720 |
// Get the column definition
|
|
721 |
const TDbCol col( aView.ColDef( aColumnIndex ) );
|
|
722 |
|
|
723 |
// Maps the values using the names of columns
|
|
724 |
if ( col.iName == KAudioCodecId )
|
|
725 |
{
|
|
726 |
aCodecEntry.iCodecId = aView.ColUint32( aColumnIndex );
|
|
727 |
}
|
|
728 |
else if ( col.iName == KMediaTypeName )
|
|
729 |
{
|
|
730 |
aCodecEntry.iMediaTypeName.Copy( aView.ColDes( aColumnIndex ) );
|
|
731 |
}
|
|
732 |
else if ( col.iName == KMediaSubTypeName )
|
|
733 |
{
|
|
734 |
aCodecEntry.iMediaSubTypeName.Copy( aView.ColDes( aColumnIndex ) );
|
|
735 |
}
|
|
736 |
else if ( col.iName == KJitterBufferSize )
|
|
737 |
{
|
|
738 |
aCodecEntry.iJitterBufferSize = aView.ColInt32( aColumnIndex );
|
|
739 |
}
|
|
740 |
else if ( col.iName == KOctetAlign )
|
|
741 |
{
|
|
742 |
aCodecEntry.iOctetAlign = static_cast<CRCSEAudioCodecEntry::TOnOff>(
|
|
743 |
aView.ColInt32( aColumnIndex ) );
|
|
744 |
}
|
|
745 |
else if ( col.iName == KModeSet )
|
|
746 |
{
|
|
747 |
const TDesC& modeset = aView.ColDes( aColumnIndex );
|
|
748 |
GetNumbersFromDescriptorL( modeset, aCodecEntry.iModeSet );
|
|
749 |
}
|
|
750 |
else if ( col.iName == KModeChangePeriod )
|
|
751 |
{
|
|
752 |
aCodecEntry.iModeChangePeriod = aView.ColInt32( aColumnIndex );
|
|
753 |
}
|
|
754 |
else if ( col.iName == KModeChangeNeighbor )
|
|
755 |
{
|
|
756 |
aCodecEntry.iModeChangeNeighbor = static_cast<CRCSEAudioCodecEntry::TOnOff>(
|
|
757 |
aView.ColInt32( aColumnIndex ) );
|
|
758 |
}
|
|
759 |
else if ( col.iName == KPtime )
|
|
760 |
{
|
|
761 |
aCodecEntry.iPtime = aView.ColInt32( aColumnIndex );
|
|
762 |
}
|
|
763 |
else if ( col.iName == KMaxptime )
|
|
764 |
{
|
|
765 |
aCodecEntry.iMaxptime = aView.ColInt32( aColumnIndex );
|
|
766 |
}
|
|
767 |
else if ( col.iName == KCrc )
|
|
768 |
{
|
|
769 |
aCodecEntry.iCrc = static_cast<CRCSEAudioCodecEntry::TOnOff>(
|
|
770 |
aView.ColInt32( aColumnIndex ) );
|
|
771 |
}
|
|
772 |
else if ( col.iName == KRobustSorting )
|
|
773 |
{
|
|
774 |
aCodecEntry.iRobustSorting = static_cast<CRCSEAudioCodecEntry::TOnOff>(
|
|
775 |
aView.ColInt32( aColumnIndex ) );
|
|
776 |
}
|
|
777 |
else if ( col.iName == KInterLeaving )
|
|
778 |
{
|
|
779 |
aCodecEntry.iInterLeaving = aView.ColInt32( aColumnIndex );
|
|
780 |
}
|
|
781 |
else if ( col.iName == KChannels )
|
|
782 |
{
|
|
783 |
const TDesC& channels = aView.ColDes( aColumnIndex );
|
|
784 |
GetNumbersFromDescriptorL( channels, aCodecEntry.iChannels );
|
|
785 |
}
|
|
786 |
else if ( col.iName == KVAD )
|
|
787 |
{
|
|
788 |
aCodecEntry.iVAD = static_cast<CRCSEAudioCodecEntry::TOnOff>(
|
|
789 |
aView.ColInt32( aColumnIndex ) );
|
|
790 |
}
|
|
791 |
else if ( col.iName == KDTX )
|
|
792 |
{
|
|
793 |
aCodecEntry.iDTX = static_cast<CRCSEAudioCodecEntry::TOnOff>(
|
|
794 |
aView.ColInt32( aColumnIndex ) );
|
|
795 |
}
|
|
796 |
else if ( col.iName == KSamplingRate )
|
|
797 |
{
|
|
798 |
aCodecEntry.iSamplingRate = aView.ColInt32( aColumnIndex );
|
|
799 |
}
|
|
800 |
else if ( col.iName == KAnnexb )
|
|
801 |
{
|
|
802 |
aCodecEntry.iAnnexb = static_cast<CRCSEAudioCodecEntry::TOnOff>(
|
|
803 |
aView.ColInt32( aColumnIndex) );
|
|
804 |
}
|
|
805 |
else if ( col.iName == KModeChangeCapability )
|
|
806 |
{
|
|
807 |
aCodecEntry.iModeChangeCapability = aView.ColInt32( aColumnIndex );
|
|
808 |
}
|
|
809 |
else if ( col.iName == KMaxRed )
|
|
810 |
{
|
|
811 |
aCodecEntry.iMaxRed = aView.ColInt32( aColumnIndex );
|
|
812 |
}
|
|
813 |
else
|
|
814 |
{
|
|
815 |
// Skip unknown column.
|
|
816 |
RCSELOGSTRING2(
|
|
817 |
"CRCSEAudioCodecRegistry::MapColumnToEntryL() - unknown %d",
|
|
818 |
aColumnIndex );
|
|
819 |
}
|
|
820 |
|
|
821 |
}
|
|
822 |
|
|
823 |
// -----------------------------------------------------------------------------
|
|
824 |
// Read TSettingIds structs from given descriptor to array.
|
|
825 |
// -----------------------------------------------------------------------------
|
|
826 |
//
|
|
827 |
void CRCSEDbImporter::GetProfileIdsFromDescriptorL(
|
|
828 |
const TDesC& aNumbers,
|
|
829 |
RArray<TSettingIds>& aArray )
|
|
830 |
{
|
|
831 |
CleanupClosePushL( aArray );
|
|
832 |
|
|
833 |
TLex lex( aNumbers );
|
|
834 |
|
|
835 |
TSettingIds value;
|
|
836 |
|
|
837 |
// Reset original array
|
|
838 |
aArray.Reset();
|
|
839 |
|
|
840 |
while( !lex.Eos() )
|
|
841 |
{
|
|
842 |
lex.Val( value.iProfileType );
|
|
843 |
// Skip characters to space char.
|
|
844 |
lex.SkipCharacters();
|
|
845 |
lex.Inc( 1 );
|
|
846 |
lex.Val( value.iProfileId );
|
|
847 |
lex.SkipCharacters();
|
|
848 |
lex.Inc( 1 );
|
|
849 |
lex.Val( value.iProfileSpecificSettingId );
|
|
850 |
|
|
851 |
aArray.AppendL( value );
|
|
852 |
if ( !lex.Eos() ) // Check that End of string is not next char.
|
|
853 |
{
|
|
854 |
// Go over the space character.
|
|
855 |
lex.Inc( 1 );
|
|
856 |
}
|
|
857 |
}
|
|
858 |
|
|
859 |
CleanupStack::Pop( &aArray );
|
|
860 |
}
|
|
861 |
|
|
862 |
|
|
863 |
// -----------------------------------------------------------------------------
|
|
864 |
// Read IDs from given descriptor to array.
|
|
865 |
// -----------------------------------------------------------------------------
|
|
866 |
//
|
|
867 |
template<class T>
|
|
868 |
void CRCSEDbImporter::GetNumbersFromDescriptorL(
|
|
869 |
const TDesC& aNumbers,
|
|
870 |
RArray<T>& aArray )
|
|
871 |
{
|
|
872 |
CleanupClosePushL( aArray );
|
|
873 |
TLex lex( aNumbers );
|
|
874 |
|
|
875 |
// Reset original array
|
|
876 |
aArray.Reset();
|
|
877 |
|
|
878 |
while( !lex.Eos() )
|
|
879 |
{
|
|
880 |
// Extract the number as unsigned int 32, which can be
|
|
881 |
// converted to value wanted (template)
|
|
882 |
TUint32 value;
|
|
883 |
lex.Val( value, EDecimal );
|
|
884 |
aArray.AppendL( static_cast<T>( value ) );
|
|
885 |
// Skip characters to space char.
|
|
886 |
lex.SkipCharacters();
|
|
887 |
if ( !lex.Eos() ) // Check that End of string is not next char.
|
|
888 |
{
|
|
889 |
// Go over the space character.
|
|
890 |
lex.Inc( 1 );
|
|
891 |
}
|
|
892 |
}
|
|
893 |
|
|
894 |
CleanupStack::Pop( &aArray );
|
|
895 |
}
|
|
896 |
|
|
897 |
|
|
898 |
// -----------------------------------------------------------------------------
|
|
899 |
// Update new preferred audio codec IDs to imported VoIP profiles.
|
|
900 |
// -----------------------------------------------------------------------------
|
|
901 |
//
|
|
902 |
void CRCSEDbImporter::UpdatePreferredCodecs()
|
|
903 |
{
|
|
904 |
RCSELOGSTRING( "CRCSEDbImporter::UpdatePreferredCodecs() - IN" );
|
|
905 |
|
|
906 |
// Update preferred codec IDs for each profile
|
|
907 |
const TInt count( iProfiles.Count() );
|
|
908 |
for( TInt i( 0 ); i < count; ++i )
|
|
909 |
{
|
|
910 |
// Browse preferred codecs array
|
|
911 |
const TInt codecCount( iProfiles[i]->iPreferredCodecs.Count() );
|
|
912 |
for ( TInt j( 0 ); j < codecCount; ++j )
|
|
913 |
{
|
|
914 |
// Search new codec ID from array
|
|
915 |
TUint32 oldId = iProfiles[i]->iPreferredCodecs[j];
|
|
916 |
TBool found( EFalse );
|
|
917 |
|
|
918 |
const TInt idCount( iCodecIds.Count() );
|
|
919 |
for ( TInt k( 0 ); k < idCount && !found; ++k )
|
|
920 |
{
|
|
921 |
found = ( oldId == iCodecIds[k].iOldId );
|
|
922 |
|
|
923 |
// Set new ID if it was found
|
|
924 |
if ( found )
|
|
925 |
{
|
|
926 |
iProfiles[i]->iPreferredCodecs[j] = iCodecIds[k].iNewId;
|
|
927 |
RCSELOGSTRING4(
|
|
928 |
"Match %d. Codec index %d updated for %d. profile",
|
|
929 |
k, j, i + 1 );
|
|
930 |
}
|
|
931 |
else
|
|
932 |
{
|
|
933 |
RCSELOGSTRING2( "Skip %d", k );
|
|
934 |
}
|
|
935 |
}
|
|
936 |
}
|
|
937 |
}
|
|
938 |
|
|
939 |
RCSELOGSTRING( "CRCSEDbImporter::UpdatePreferredCodecs() - OUT" );
|
|
940 |
}
|
|
941 |
|
|
942 |
|
|
943 |
|
|
944 |
// -----------------------------------------------------------------------------
|
|
945 |
// Store imported voip profiles.
|
|
946 |
// -----------------------------------------------------------------------------
|
|
947 |
//
|
|
948 |
void CRCSEDbImporter::StoreVoIPProfilesL()
|
|
949 |
{
|
|
950 |
RCSELOGSTRING( "CRCSEDbImporter::StoreVoIPProfilesL() - IN" );
|
|
951 |
|
|
952 |
CRCSEProfileRegistry* reg = CRCSEProfileRegistry::NewLC();
|
|
953 |
reg->AddL( iProfiles );
|
|
954 |
CleanupStack::PopAndDestroy( reg );
|
|
955 |
|
|
956 |
RCSELOGSTRING( "CRCSEDbImporter::StoreVoIPProfilesL() - OUT" );
|
|
957 |
}
|
|
958 |
|
|
959 |
|
|
960 |
// -----------------------------------------------------------------------------
|
|
961 |
// Store imported audio codecs.
|
|
962 |
// -----------------------------------------------------------------------------
|
|
963 |
//
|
|
964 |
void CRCSEDbImporter::StoreAudioCodecsL()
|
|
965 |
{
|
|
966 |
RCSELOGSTRING( "CRCSEDbImporter::StoreAudioCodecsL() - IN" );
|
|
967 |
|
|
968 |
CRCSEAudioCodecRegistry* reg = CRCSEAudioCodecRegistry::NewLC();
|
|
969 |
reg->AddL( iCodecs );
|
|
970 |
CleanupStack::PopAndDestroy( reg );
|
|
971 |
|
|
972 |
// Update codec ID pairs
|
|
973 |
const TInt codecCount( iCodecs.Count() );
|
|
974 |
const TInt codecIdCount( iCodecIds.Count() );
|
|
975 |
|
|
976 |
__ASSERT_ALWAYS( codecCount == codecIdCount, User::Leave( KErrCorrupt ) );
|
|
977 |
|
|
978 |
for ( TInt i( 0 ); i < codecCount; ++i )
|
|
979 |
{
|
|
980 |
iCodecIds[ i ].iNewId = iCodecs[i]->iCodecId;
|
|
981 |
}
|
|
982 |
|
|
983 |
RCSELOGSTRING( "CRCSEDbImporter::StoreAudioCodecsL() - OUT" );
|
|
984 |
}
|
|
985 |
|
|
986 |
|
|
987 |
|
|
988 |
|
|
989 |
|
|
990 |
|
|
991 |
|
|
992 |
|
|
993 |
|
|
994 |
|
|
995 |
|
|
996 |
|
|
997 |
|
|
998 |
|