|
1 /* |
|
2 * Copyright (c) 2002 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 * An active object class which takes care of reading the possible new |
|
16 * service centres from SIM and adds them to Sms Settings. |
|
17 * |
|
18 */ |
|
19 |
|
20 #ifndef __SIMSCNUMBERDETECTOR_H__ |
|
21 #define __SIMSCNUMBERDETECTOR_H__ |
|
22 |
|
23 // INCLUDES |
|
24 #include <msvapi.h> // for MsvSession |
|
25 #include <smsclnt.h> // for CSmsClientMtm |
|
26 #include <e32base.h> |
|
27 #include <smutsimparam.h> // for CSmsSimParamOperation |
|
28 |
|
29 // CONSTANTS |
|
30 const TInt KMaxNameLength = 60; |
|
31 const TInt KSmumGranularity = 4; |
|
32 const TInt KSmumRetryCount = 20; |
|
33 const TInt KSmumRetryDelay = 5000000; // 5 secs |
|
34 const TInt KSmumSMSPid = 50; |
|
35 const TInt KTestStringLength = 100; |
|
36 const TInt KDefDeliveryReport = 1; |
|
37 const TInt KDefValidityPeriod = 1440; |
|
38 const TInt KDefMessageConversion = 0; |
|
39 const TInt KDefPreferredConnection = 3; |
|
40 const TInt KDefReplyViaSameCentre = 0; |
|
41 |
|
42 // CONSTANTS |
|
43 _LIT( KSmsService, "Sms Service" ); |
|
44 _LIT( KSmscDefaultName, "New service centre"); |
|
45 _LIT( KSmscSimDefaultName, "New SIM service centre"); |
|
46 _LIT( KFmtSpec, "%S(%02d)"); |
|
47 |
|
48 // FORWARD DECLARATIONS |
|
49 class CClientMtmRegistry; |
|
50 class CStartUpMonitor; |
|
51 class CRepository; |
|
52 class COutboxObserver; |
|
53 |
|
54 /** |
|
55 * Observer to indicate when SIM operation has been completed. |
|
56 */ |
|
57 class MSimOperationObserver |
|
58 { |
|
59 public: |
|
60 virtual void CompleteOperation()=0; |
|
61 }; |
|
62 |
|
63 /** |
|
64 * CMsgSimOperation |
|
65 * Inherited from CBase, MMsvSessionObserver |
|
66 */ |
|
67 class CMsgSimOperation : public CBase, public MMsvSessionObserver |
|
68 { |
|
69 public: |
|
70 |
|
71 /** |
|
72 * Constructor. |
|
73 */ |
|
74 IMPORT_C static CMsgSimOperation* NewL(MSimOperationObserver& aObserver); |
|
75 |
|
76 /** |
|
77 * Destructor |
|
78 */ |
|
79 ~CMsgSimOperation(); |
|
80 |
|
81 public: |
|
82 |
|
83 |
|
84 /** |
|
85 * Callback function for startup state monitor object |
|
86 */ |
|
87 void HandleStartupReadyL(); |
|
88 |
|
89 private: |
|
90 |
|
91 /** |
|
92 * C++ constructor which initializes the active object with a |
|
93 * default priority and adds it to the active scheduler. |
|
94 * @param TRequestStatus& aStatus, TInt aPriority |
|
95 * @return nothing |
|
96 */ |
|
97 CMsgSimOperation(MSimOperationObserver& aObserver); |
|
98 |
|
99 /** |
|
100 * This function simulates issuing request, activates the object |
|
101 * and starts to open Msv session |
|
102 * @param none |
|
103 * @return nothing |
|
104 */ |
|
105 void StartL(); |
|
106 |
|
107 /** |
|
108 * Complete the client's active object request status |
|
109 * @param TInt aValue |
|
110 * @return nothing |
|
111 */ |
|
112 |
|
113 void CompleteClientRequest(TInt aValue); |
|
114 |
|
115 /** |
|
116 * Checks if the device has SIM when phone boots |
|
117 * @reutrn bool |
|
118 */ |
|
119 TBool IsSIMPresent(); |
|
120 |
|
121 /** |
|
122 * Checks if the SIM has been changed in the next boot |
|
123 * @reutrn bool |
|
124 */ |
|
125 TBool HasSIMChanged(); |
|
126 |
|
127 /** |
|
128 * Checks if already SMSC setting is there |
|
129 * @reutrn bool |
|
130 */ |
|
131 TBool HasNoSmscSettings(); |
|
132 |
|
133 /** |
|
134 * Gets default name for SMSC, if SIM does not have one |
|
135 */ |
|
136 void FindNameForSCL(TDes& aName, TBool aNameIsForSCentreFromSIM, |
|
137 CDesCArrayFlat* aSCNamesList); |
|
138 |
|
139 /** |
|
140 * Creates a SMS service, if not there |
|
141 */ |
|
142 TMsvId CreateSmsServiceL(); |
|
143 |
|
144 /** |
|
145 * Creates default settings for the SMS account |
|
146 */ |
|
147 void CreateDefaultSettingsL(TMsvId aServiceId); |
|
148 |
|
149 /** |
|
150 * Reads default settings from the Cenrep |
|
151 */ |
|
152 void ReadDefaultSettingsFromSharedDataL(CSmsSettings* aServiceSettings); |
|
153 |
|
154 /** |
|
155 * Gets the Service Id |
|
156 */ |
|
157 TMsvId ServiceIdL(); |
|
158 |
|
159 private: |
|
160 |
|
161 /** |
|
162 * |
|
163 */ |
|
164 enum TSimOperationPanic |
|
165 { |
|
166 ESimOperationPanicRequestAlreadyActive = 0, |
|
167 ESimOperationPanicClientsRequestAlreadyCompleted |
|
168 }; |
|
169 |
|
170 /** |
|
171 * Panic the thread |
|
172 * @param TSimOperationPanic aPanic |
|
173 * @return nothing |
|
174 */ |
|
175 static void Panic(TSimOperationPanic aPanic); |
|
176 |
|
177 private: |
|
178 |
|
179 void StartRunL(TInt aError); |
|
180 |
|
181 void DoStartRunL(); |
|
182 |
|
183 /** |
|
184 * From MMsvSessionObserver |
|
185 */ |
|
186 void HandleSessionEventL(TMsvSessionEvent aEvent, TAny* aArg1, TAny* aArg2, |
|
187 TAny* aArg3); |
|
188 |
|
189 /** |
|
190 * By default Symbian OS constructor is private. |
|
191 */ |
|
192 void ConstructL(); |
|
193 |
|
194 private: |
|
195 // Data |
|
196 CSmsSimParamOperation* iSimOperation; |
|
197 CMsvSession* iMsvSession; |
|
198 CSmsClientMtm* iSmsClientMtm; |
|
199 CClientMtmRegistry* iClientRegistry; |
|
200 TInt iRetryCount; |
|
201 CStartUpMonitor* iStartupMonitor; |
|
202 MSimOperationObserver& iObserver; |
|
203 CRepository* iCenRepSession; |
|
204 COutboxObserver* iOutBoxObserver; |
|
205 |
|
206 }; |
|
207 |
|
208 #endif // not defined __SIMSCNUMBERDETECTOR_H__ |
|
209 // End of file |