|
1 // Copyright (c) 2007-2009 Nokia Corporation and/or its subsidiary(-ies). |
|
2 // All rights reserved. |
|
3 // This component and the accompanying materials are made available |
|
4 // under the terms of "Eclipse Public License v1.0" |
|
5 // which accompanies this distribution, and is available |
|
6 // at the URL "http://www.eclipse.org/legal/epl-v10.html". |
|
7 // |
|
8 // Initial Contributors: |
|
9 // Nokia Corporation - initial contribution. |
|
10 // |
|
11 // Contributors: |
|
12 // |
|
13 // Description: |
|
14 // TOwnNumbersManager implementation |
|
15 // |
|
16 // |
|
17 |
|
18 #include "townnumbersmanager.h" |
|
19 #include "rdebuglogger.h" |
|
20 |
|
21 void TOwnNumbersManager::CacheOwnNumbersL() |
|
22 { |
|
23 if(!iGotNumbers) //try retrieving numbers once only |
|
24 { |
|
25 //on demand retrieval of own numbers. This must be called on a thread other than the main server thread |
|
26 //as an exec call is made to switch opening the RPhone session to the server thread. |
|
27 RDEBUGPRINTLOGGER1(_L("TOwnNumbersManager::CacheOwnNumbersL - attempting to get Own numbers")); |
|
28 // Create an active scheduler for this thread |
|
29 CActiveScheduler* sched = new(ELeave) CActiveScheduler; |
|
30 CActiveScheduler::Install(sched); |
|
31 CleanupStack::PushL(sched); |
|
32 |
|
33 //invoking TRPSOwnNumbers::RetrieveOwnNumbersL requires Active Scheduler to be present. |
|
34 CAsyncCallBack* asyncCallBack = new (ELeave) CAsyncCallBack(CActive::EPriorityStandard); |
|
35 CleanupStack::PushL(asyncCallBack); |
|
36 |
|
37 iRetrieveError = KErrNone; |
|
38 asyncCallBack->Set(TCallBack(AsyncCallback, this)); |
|
39 asyncCallBack->CallBack(); |
|
40 CActiveScheduler::Start(); |
|
41 |
|
42 RDEBUGPRINTLOGGER2(_L("TOwnNumbersManager::CacheOwnNumbersL - own numbers completed with %d"), iRetrieveError); |
|
43 TPtrC ptr = iOwnNumbers.OwnVoiceNumber(); |
|
44 RDEBUGPRINTLOGGER2(_L("OwnVoiceNumber = %S"), &ptr); |
|
45 ptr.Set(iOwnNumbers.OwnDataNumber()); |
|
46 RDEBUGPRINTLOGGER2(_L("OwnDataNumber = %S"), &ptr); |
|
47 ptr.Set(iOwnNumbers.OwnFaxNumber()); |
|
48 RDEBUGPRINTLOGGER2(_L("OwnFaxNumber = %S"), &ptr); |
|
49 |
|
50 CleanupStack::PopAndDestroy(asyncCallBack); |
|
51 CleanupStack::PopAndDestroy(sched); |
|
52 iGotNumbers = ETrue; |
|
53 } |
|
54 } |
|
55 |
|
56 TInt TOwnNumbersManager::AsyncCallback(TAny* aTOwnNumbersManagerInstance) |
|
57 { |
|
58 static_cast<TOwnNumbersManager*>(aTOwnNumbersManagerInstance)->CacheOwnNumbersAO(); |
|
59 return KErrNone; |
|
60 } |
|
61 |
|
62 void TOwnNumbersManager::CacheOwnNumbersAO() |
|
63 { |
|
64 // Ini file is being used for own number, instead of reading it from SIM because |
|
65 // Integration test suite over trp, was crashing on H4 board while Retrieving own number |
|
66 // TRAPD(err, iOwnNumbers.RetrieveOwnNumbersL(iEtelSessMgr->GetPhoneL(KMainServer, KMainPhone))); |
|
67 // iRetrieveError = err; |
|
68 CActiveScheduler::Stop(); |
|
69 } |