|
1 /* |
|
2 * Copyright (c) 2005 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: SyncML DM command handling |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 |
|
20 #ifndef __NSMLDMAGENT_H |
|
21 #define __NSMLDMAGENT_H |
|
22 |
|
23 // INCLUDES |
|
24 #include <e32base.h> |
|
25 #include "NSmlAgentBase.h" |
|
26 |
|
27 #include "SyncMLNotifierParams.h" |
|
28 #include "NSmlPrivateAPI.h" |
|
29 #include <DevManInternalCRKeys.h> |
|
30 |
|
31 // FORWARD DECLARATIONS |
|
32 class MSyncMLProgressObserver; |
|
33 class CNSmlDmModule; |
|
34 class CSyncMLHistoryJob; |
|
35 class CNSmlURI; |
|
36 // FOTA |
|
37 class CNSmlDMGenericAlert; |
|
38 // FOTA end |
|
39 class CNSmlAgentNotifierObserver; |
|
40 |
|
41 |
|
42 // CLASS DECLARATION |
|
43 |
|
44 /** |
|
45 * CNSmlDMAgent implements DM session flow logic |
|
46 * |
|
47 */ |
|
48 class CNSmlDMAgent:public CNSmlAgentBase |
|
49 { |
|
50 public: // Constructors and destructor |
|
51 |
|
52 static CNSmlDMAgent* NewL( MSyncMLProgressObserver* aObserver = NULL ); |
|
53 virtual ~CNSmlDMAgent(); //from CBase |
|
54 |
|
55 public: // New functions |
|
56 |
|
57 virtual void Configure( TRequestStatus& aStatus, TInt aSettingsID,TInt aTransportId, TNSmlSyncInitiation aSyncInitiation=EClientInitiated, TInt aIapId=KErrNotFound ); |
|
58 // FOTA |
|
59 /** |
|
60 * Appends a Generic Alert to the internal list. |
|
61 * The alert itself is sent in the later phase of the dm session. |
|
62 * @param aFwMgmtUri. The uri which has been used in the exe command whose final result is |
|
63 * about to be reported. |
|
64 * @param aMetaType. Meta/Type that should be used in the alert. |
|
65 * @param aMetaFormat. Meta/Format that should be used in the alert. |
|
66 * @param aFinalResult. The final result value which is reported to remote server. |
|
67 * @param aCorrelator. Correlator value used in the original exec command. |
|
68 */ |
|
69 virtual void SetGenericAlertL ( const TDesC8& aFwMgmtUri, const TDesC8& aMetaType, const TDesC8& aMetaFormat, TInt aFinalResult, const TDesC8& aFwCorrelator ); |
|
70 // FOTA end |
|
71 virtual void SetGenericAlertL ( const TDesC8& aCorrelator, const RArray<CNSmlDMAlertItem>& aItemList ); |
|
72 |
|
73 private: // new functions |
|
74 |
|
75 CNSmlDMAgent(); |
|
76 CNSmlDMAgent( const CNSmlDMAgent& aOther ); |
|
77 CNSmlDMAgent& operator=( const CNSmlDMAgent& aOther ); |
|
78 void ConstructL( MSyncMLProgressObserver* aObserver ); |
|
79 TBool SupportedAlert( const TDesC8& aAlertCode ) const; |
|
80 void ServerModificationsStateL(); |
|
81 void ServerModGetCmdStateL( SmlGet_t* aContent ); |
|
82 void ServerModStartAtomicStateL( SmlAtomic_t* aContent ); |
|
83 void ServerModEndAtomicStateL(); |
|
84 void ServerModStartSequenceStateL( SmlSequence_t* aContent ); |
|
85 void ServerModEndSequenceStateL(); |
|
86 // Finishing state functions |
|
87 void FinishingStateL(); |
|
88 // Trigger message parsing |
|
89 // Read SyncML DM settings |
|
90 void ReadSettingsL(); |
|
91 // Sync Log Initiation |
|
92 void InitSyncLogL(); |
|
93 // Read/Update session ID |
|
94 TInt GetSessionIDL(); |
|
95 void UpdateSessionIDL( TInt aSessionIDL ); |
|
96 // Finish |
|
97 void FinishL(); |
|
98 // |
|
99 TBool InterruptedImmediately(); |
|
100 // |
|
101 |
|
102 private: // Functions from base classes |
|
103 // |
|
104 // Parser callbacks |
|
105 // |
|
106 Ret_t smlAlertCmdFuncL( SmlAlertPtr_t aContent); //from MWBXMLSyncMLCallbacks |
|
107 Ret_t smlExecCmdFuncL( SmlExecPtr_t aContent ); |
|
108 Ret_t smlCopyCmdFuncL( SmlCopyPtr_t aContent ); |
|
109 Ret_t smlGetCmdFuncL( SmlGetPtr_t aContent ); //from MWBXMLSyncMLCallbacks |
|
110 Ret_t smlPutCmdFuncL( SmlPutPtr_t aContent ); //from MWBXMLSyncMLCallbacks |
|
111 Ret_t smlResultsCmdFuncL( SmlResultsPtr_t aContent ); //from MWBXMLSyncMLCallbacks |
|
112 Ret_t smlStatusCmdFuncL( SmlStatusPtr_t aContent ); //from MWBXMLSyncMLCallbacks |
|
113 Ret_t smlStartMessageFuncL( SmlSyncHdrPtr_t aContent ); //from MWBXMLSyncMLCallbacks |
|
114 Ret_t smlEndMessageFuncL( Boolean_t final ); //from MWBXMLSyncMLCallbacks |
|
115 Ret_t smlStartSyncFuncL( SmlSyncPtr_t aContent ); //from MWBXMLSyncMLCallbacks |
|
116 Ret_t smlEndSyncFuncL(); //from MWBXMLSyncMLCallbacks |
|
117 Ret_t smlStartAtomicFuncL( SmlAtomicPtr_t aContent ); //from MWBXMLSyncMLCallbacks |
|
118 Ret_t smlEndAtomicFuncL(); //from MWBXMLSyncMLCallbacks |
|
119 Ret_t smlStartSequenceFuncL( SmlSequencePtr_t aContent ); //from MWBXMLSyncMLCallbacks |
|
120 Ret_t smlEndSequenceFuncL(); //from MWBXMLSyncMLCallbacks |
|
121 // |
|
122 // Main state functions |
|
123 // |
|
124 void NavigateMainStateL(); //from CNSmlAgentBase |
|
125 void NextMainStateL(); //from CNSmlAgentBase |
|
126 void InitialiseSubStates(); //from CNSmlAgentBase |
|
127 // |
|
128 // Beginning state functions |
|
129 // |
|
130 void BeginStateL(); //from CNSmlAgentBase |
|
131 // |
|
132 // Client Initialisation state functions |
|
133 // |
|
134 void InitStartingMessageStateL(); //from CNSmlAgentBase |
|
135 void InitAlertingStateL(); //from CNSmlAgentBase |
|
136 void InitDeviceInfoStateL(); //from CNSmlAgentBase |
|
137 |
|
138 // |
|
139 // Server Modifications state functions |
|
140 // |
|
141 void ServerModUpdatesStateL( const TDesC8& aCmd, SmlGenericCmd_t* aContent ); //from CNSmlAgentBase |
|
142 // FOTA |
|
143 /** |
|
144 * Issues a process request for the arrived exec command. |
|
145 * @param aContent. The exec command structure, accordant with the dtd. |
|
146 */ |
|
147 void ServerModUpdatesStateL( SmlExec_t* aContent ); |
|
148 // FOTA end |
|
149 |
|
150 // |
|
151 // Data Update Status state functions |
|
152 // |
|
153 void DataUpdateStatusStartingMessageStateL(); //from CNSmlAgentBase |
|
154 void DataUpdateStatusMakingResultsStateL(); //from CNSmlAgentBase |
|
155 // |
|
156 // Nonce functions |
|
157 // |
|
158 HBufC* NonceL() const; //from CNSmlAgentBase |
|
159 void SetNonceL( const TDesC& aNonce ) const; //from CNSmlAgentBase |
|
160 // Server authentication functions |
|
161 TPtrC ServerUserName() const; //from CNSmlAgentBase |
|
162 TPtrC ServerPassword() const; //from CNSmlAgentBase |
|
163 HBufC* ServerNonceAllocL()const; //from CNSmlAgentBase |
|
164 void SetServerNonceL( const TDesC& aNonce ) const; //from CNSmlAgentBase |
|
165 // |
|
166 // Sync Log functions |
|
167 // |
|
168 void FinalizeSyncLog(); //from CNSmlAgentBase |
|
169 void FinalizeSyncLogL(); |
|
170 |
|
171 // |
|
172 void CreateSyncmlCmdsInstanceL(); //from CNSmlAgentBase |
|
173 // |
|
174 void CheckCommandsAreReceivedL(); //from CNSmlAgentBase |
|
175 // |
|
176 // Authentication type |
|
177 // |
|
178 void SetAuthTypeL( CNSmlAgentBase::TAuthenticationType aAuthType ) const; //from CNSmlAgentBase |
|
179 CNSmlAgentBase::TAuthenticationType AuthTypeL() const; //from CNSmlAgentBase |
|
180 |
|
181 TBool CheckCertificateL(); |
|
182 void UserConfirmateConnectionL(); |
|
183 void CheckForcedCertificateCheckStateL(); |
|
184 |
|
185 // |
|
186 // Free resources |
|
187 // |
|
188 void FreeResources(); //from CNSmlAgentBase |
|
189 |
|
190 // |
|
191 // Error Handling functions |
|
192 // |
|
193 void FinaliseWhenErrorL(); //from CNSmlAgentBase |
|
194 TBool Interrupted(); //from CNSmlAgentBase |
|
195 void Interrupt( TInt aErrorCode, TBool aImmediatelyInterruption, TBool aStatusError ); //from CNSmlAgentBase |
|
196 void InterruptL( TInt appIndex, TInt aErrorCode, TBool aImmediatelyInterruption, TBool aStatusError ); //from CNSmlAgentBase |
|
197 void WriteWarningL( TNSmlError::TNSmlAgentErrorCode aWarningCode ); //from CNSmlAgentBase |
|
198 void WriteWarningL( TInt appIndex, TNSmlError::TNSmlAgentErrorCode aWarningCode ); //from CNSmlAgentBase |
|
199 void WriteWarningL( TInt appIndex, TNSmlError::TNSmlSyncMLStatusCode aWarningCode ); //from CNSmlAgentBase |
|
200 void CheckServerStatusCodeL( TInt aEntryID ); //from CNSmlAgentBase |
|
201 |
|
202 public: |
|
203 |
|
204 |
|
205 void SaveProfileInfoL(); |
|
206 |
|
207 |
|
208 private: // Data |
|
209 TBool iForcedCertificateCheck; |
|
210 CNSmlAgentNotifierObserver * iNotifierObserver; |
|
211 HBufC8* iDMTriggerMessage; |
|
212 HBufC* iDMServerId; |
|
213 HBufC* iDMServerPassword; |
|
214 TInt iDMServerSessionId; |
|
215 HBufC8* iDMServerDigest; |
|
216 TBool iDMInterrupted; |
|
217 TBool iDMImmediatelyInterruption; |
|
218 // FOTA |
|
219 RPointerArray<CNSmlDMGenericAlert> iGenAlerts; |
|
220 TBool iResetGenAlerts; |
|
221 TBool iResetUserInitAlert; |
|
222 // FOTA end |
|
223 // |
|
224 // Used classes |
|
225 // |
|
226 MSyncMLProgressObserver* iDMObserver; |
|
227 // |
|
228 // Owned classes |
|
229 // |
|
230 //IapId sent by sosserver if client wants this iap for this dm session |
|
231 TInt iNewIapId; |
|
232 }; |
|
233 |
|
234 |
|
235 IMPORT_C CNSmlDMAgent* CreateDMAgentL( MSyncMLProgressObserver* aDMObserver ); |
|
236 typedef CNSmlDMAgent* (*TNSmlCreateDMAgentFunc) ( MSyncMLProgressObserver* aDMObserver ); |
|
237 |
|
238 /** |
|
239 * CNSmlNotifierTimeOut class |
|
240 * |
|
241 */ |
|
242 |
|
243 class CNSmlAgentNotifierTimeOut : public CActive |
|
244 { |
|
245 public: |
|
246 CNSmlAgentNotifierTimeOut(); |
|
247 ~CNSmlAgentNotifierTimeOut(); |
|
248 void LaunchNotifierTimer( CNSmlAgentNotifierObserver* aObserver ); |
|
249 protected: |
|
250 void DoCancel(); |
|
251 void RunL(); |
|
252 private: |
|
253 CNSmlAgentNotifierObserver* iObserver; |
|
254 RTimer iTimeOutTimer; |
|
255 }; |
|
256 |
|
257 /** |
|
258 * CNSmlNotifierObserver class |
|
259 * |
|
260 */ |
|
261 class CNSmlAgentNotifierObserver : public CActive |
|
262 { |
|
263 public: |
|
264 CNSmlAgentNotifierObserver( TRequestStatus& aStatus, TInt aCreatorId ); |
|
265 ~CNSmlAgentNotifierObserver(); |
|
266 void ConnectToNotifierL( CNSmlAgentBase * aNSmlAgentBase); |
|
267 void NotifierTimeOut(); |
|
268 protected: |
|
269 void DoCancel(); |
|
270 void RunL(); |
|
271 private: |
|
272 TRequestStatus& iCallerStatus; |
|
273 |
|
274 RNotifier iNotifier; |
|
275 TSyncMLAppLaunchNotifRetValPckg iResBuf; |
|
276 |
|
277 TInt& iCreatorId; |
|
278 CNSmlAgentNotifierTimeOut iNotifierTimeOut; |
|
279 TBool iTimeOut; |
|
280 CNSmlAgentBase * iNSmlAgentBase; |
|
281 }; |
|
282 |
|
283 |
|
284 #endif // __NSMLDMAGENT_H |
|
285 |
|
286 // End of File |