|
1 /* |
|
2 * Copyright (c) 2002-2007 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: A command that uses ETel RMobilePhoneStore GetInfo request |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 |
|
20 // INCLUDE FILES |
|
21 #include "CGetInfoCmd.h" |
|
22 |
|
23 #include "CStoreBase.h" |
|
24 #include "VPbkSimStoreImplError.h" |
|
25 |
|
26 // From VPbkEng |
|
27 #include <VPbkDebug.h> |
|
28 |
|
29 namespace VPbkSimStoreImpl { |
|
30 |
|
31 // ============================ MEMBER FUNCTIONS =============================== |
|
32 |
|
33 // ----------------------------------------------------------------------------- |
|
34 // CGetInfoCmd::CGetInfoCmd |
|
35 // C++ default constructor can NOT contain any code, that |
|
36 // might leave. |
|
37 // ----------------------------------------------------------------------------- |
|
38 // |
|
39 CGetInfoCmd::CGetInfoCmd( CStoreBase& aStore ) |
|
40 : CActive( EPriorityStandard ), |
|
41 iStore( aStore ) |
|
42 { |
|
43 CActiveScheduler::Add( this ); |
|
44 } |
|
45 |
|
46 // Destructor |
|
47 CGetInfoCmd::~CGetInfoCmd() |
|
48 { |
|
49 CancelCmd(); |
|
50 } |
|
51 |
|
52 // ----------------------------------------------------------------------------- |
|
53 // CGetInfoCmd::NewLC |
|
54 // ----------------------------------------------------------------------------- |
|
55 // |
|
56 CGetInfoCmd* CGetInfoCmd::NewLC( CStoreBase& aStore ) |
|
57 { |
|
58 CGetInfoCmd* self = new( ELeave ) CGetInfoCmd( aStore ); |
|
59 CleanupStack::PushL( self ); |
|
60 return self; |
|
61 } |
|
62 |
|
63 // ----------------------------------------------------------------------------- |
|
64 // CGetInfoCmd::Execute |
|
65 // ----------------------------------------------------------------------------- |
|
66 // |
|
67 void CGetInfoCmd::Execute() |
|
68 { |
|
69 __ASSERT_DEBUG( iObserver, |
|
70 VPbkSimStoreImpl::Panic( EPreCondCGetInfoCmdExecute ) ); |
|
71 |
|
72 VPBK_DEBUG_PRINT(VPBK_DEBUG_STRING( |
|
73 "VPbkSimStoreImpl: RMobilePhoneStore::GetInfo h%d request"), |
|
74 iStore.ETelStoreBase().SubSessionHandle()); |
|
75 iStore.ETelStoreBase().GetInfo( iStatus, |
|
76 iStore.ETelStoreInfoPackge() ); |
|
77 SetActive(); |
|
78 } |
|
79 |
|
80 // ----------------------------------------------------------------------------- |
|
81 // CGetInfoCmd::AddObserverL |
|
82 // ----------------------------------------------------------------------------- |
|
83 // |
|
84 void CGetInfoCmd::AddObserverL( MVPbkSimCommandObserver& aObserver ) |
|
85 { |
|
86 __ASSERT_DEBUG( !iObserver, |
|
87 VPbkSimStoreImpl::Panic( EPreCondCGetInfoCmdAddObserverL ) ); |
|
88 |
|
89 iObserver = &aObserver; |
|
90 } |
|
91 |
|
92 // ----------------------------------------------------------------------------- |
|
93 // CGetInfoCmd::CancelCmd |
|
94 // ----------------------------------------------------------------------------- |
|
95 // |
|
96 void CGetInfoCmd::CancelCmd() |
|
97 { |
|
98 CActive::Cancel(); |
|
99 } |
|
100 |
|
101 // ----------------------------------------------------------------------------- |
|
102 // CGetInfoCmd::RunL |
|
103 // ----------------------------------------------------------------------------- |
|
104 // |
|
105 void CGetInfoCmd::RunL() |
|
106 { |
|
107 VPBK_DEBUG_PRINT(VPBK_DEBUG_STRING( |
|
108 "VPbkSimStoreImpl: RMobilePhoneStore::GetInfo h%d completed %d"), |
|
109 iStore.ETelStoreBase().SubSessionHandle(), iStatus.Int() ); |
|
110 |
|
111 VPBK_DEBUG_PRINT(VPBK_DEBUG_STRING( |
|
112 "VPbkSimStoreImpl: TMobilePhoneStoreInfoV1: type %d, total %d,\ |
|
113 used %d, caps %b, name %S"), |
|
114 iStore.ETelStoreInfo().iType, |
|
115 iStore.ETelStoreInfo().iTotalEntries, |
|
116 iStore.ETelStoreInfo().iUsedEntries, |
|
117 iStore.ETelStoreInfo().iCaps, |
|
118 &iStore.ETelStoreInfo().iName ); |
|
119 |
|
120 #ifdef VPBK_ENABLE_DEBUG_PRINT |
|
121 if ( iStore.ETelStoreInfo().ExtensionId() == |
|
122 RMobilePhoneStore::KETelMobilePhonebookStoreV1 ) |
|
123 { |
|
124 RMobilePhoneBookStore::TMobilePhoneBookInfoV1& info = |
|
125 static_cast<RMobilePhoneBookStore::TMobilePhoneBookInfoV1&>( |
|
126 iStore.ETelStoreInfo()); |
|
127 |
|
128 VPBK_DEBUG_PRINT(VPBK_DEBUG_STRING( |
|
129 "VPbkSimStoreImpl: TMobilePhoneBookInfoV1: iMaxNumLength %d,\ |
|
130 iMaxTextLength %d, iLocation %d, iChangeCounter %d, iIdentity %S"), |
|
131 info.iMaxNumLength, |
|
132 info.iMaxTextLength, |
|
133 info.iLocation, |
|
134 info.iChangeCounter, |
|
135 &info.iIdentity ); |
|
136 } |
|
137 #endif // VPBK_ENABLE_DEBUG_PRINT |
|
138 |
|
139 if ( iStatus.Int() == KErrNone ) |
|
140 { |
|
141 iObserver->CommandDone( *this ); |
|
142 } |
|
143 else |
|
144 { |
|
145 iObserver->CommandError( *this, iStatus.Int() ); |
|
146 } |
|
147 } |
|
148 |
|
149 // ----------------------------------------------------------------------------- |
|
150 // CGetInfoCmd::DoCancel |
|
151 // ----------------------------------------------------------------------------- |
|
152 // |
|
153 void CGetInfoCmd::DoCancel() |
|
154 { |
|
155 VPBK_DEBUG_PRINT(VPBK_DEBUG_STRING( |
|
156 "VPbkSimStoreImpl: RMobilePhoneStore::GetInfo h%d Cancel"), |
|
157 iStore.ETelStoreBase().SubSessionHandle()); |
|
158 iStore.ETelStoreBase().CancelAsyncRequest( EMobilePhoneStoreGetInfo ); |
|
159 } |
|
160 |
|
161 } // namespace VPbkSimStoreImpl |
|
162 // End of File |