|
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 #ifndef __NSMLDMCMDS_H |
|
20 #define __NSMLDMCMDS_H |
|
21 |
|
22 // INCLUDES |
|
23 #include <e32base.h> |
|
24 // FOTA |
|
25 #include <centralrepository.h> |
|
26 // FOTA end |
|
27 #include <nsmldmmodule.h> |
|
28 #include "NSmlCmdsBase.h" |
|
29 #include "nsmlagenttestdefines.h" |
|
30 #ifdef __TEST_TREEMODULE |
|
31 #include "nsmldmtestmodule.h" |
|
32 #endif |
|
33 |
|
34 |
|
35 // FORWARD DECLARATIONS |
|
36 #ifdef __TEST_TREEMODULE |
|
37 class CNSmlDmTestModule; |
|
38 #else |
|
39 class CNSmlDmModule; |
|
40 #endif |
|
41 class MSyncMLProgressObserver; |
|
42 |
|
43 |
|
44 // CLASS DECLARATION |
|
45 |
|
46 /** |
|
47 * CNSmlDMCmds implements DM specific SyncML commands handling |
|
48 * |
|
49 */ |
|
50 #ifdef __TEST_TREEMODULE |
|
51 class CNSmlDMCmds : public CNSmlCmdsBase, public MNSmlDmTestModuleCallBack |
|
52 #else |
|
53 class CNSmlDMCmds : public CNSmlCmdsBase, public MNSmlDmModuleCallBack |
|
54 #endif |
|
55 { |
|
56 public: // Constructors and destructor |
|
57 |
|
58 static CNSmlDMCmds* NewL( CNSmlAgentBase* aAgent, const TDesC8& aSessionID, const TDesC8& aVerProto, const HBufC& aSyncMLUserName, CNSmlURI* aSyncServer, const TDesC& aDMServerId, MSyncMLProgressObserver* aDMObserver ); |
|
59 ~CNSmlDMCmds(); //from CBase |
|
60 |
|
61 private: //new functions |
|
62 |
|
63 void ConstructL( CNSmlAgentBase* aAgent, const TDesC8& aSessionID, const TDesC8& aVerProto, const HBufC& aSyncMLUserName, CNSmlURI* aSyncServer, const TDesC& aDMServerId, MSyncMLProgressObserver* aDMObserver ); |
|
64 |
|
65 CNSmlDMCmds(); |
|
66 CNSmlDMCmds( const CNSmlCmdsBase& aOther ); |
|
67 CNSmlDMCmds& operator=( const CNSmlDMCmds& aOther ); |
|
68 |
|
69 void DoDevInfoItemsL( const TDesC8& aURISegment ); |
|
70 void FreeDMDevinfo(); |
|
71 TInt AlertParameter ( const SmlPcdata_t* aData, const TDesC8& aParamID ) const; |
|
72 //#ifdef RD_DM_TEXT_INPUT_ALERT //For User Input Server alert |
|
73 TInt AlertInputTypeParameter ( const SmlPcdata_t* aData, const TDesC8& aParamID ) const; |
|
74 TInt AlertEchoTypeParameter ( const SmlPcdata_t* aData, const TDesC8& aParamID ) const; |
|
75 TBool CheckDRPresence( const SmlPcdata_t* aData, const TDesC8& aParamID ) const; |
|
76 TPtrC8 AlertDefaultResponseParam ( const SmlPcdata_t* aData, const TDesC8& aParamID ) const; |
|
77 //#endif |
|
78 //singlechoice |
|
79 HBufC8* AlertChoiceItemsLC( SmlItemList_t* aItemList, HBufC8*& aLengthBuf,TInt& aNumItems ) const; |
|
80 void HandleAlertsL( SmlAlert_t* aAlert, TInt& aStatusId); |
|
81 void HandleAlertErrorL(); |
|
82 void HandleChoiceAlertsL( SmlAlert_t* aAlert, TInt& aStatusId); |
|
83 void SendMultiChoiceDataToServerL(TDes8& aData,TInt& aStatusId); |
|
84 void HandleConfirmationAlertL( SmlAlert_t* aAlert, TInt& aStatusId); |
|
85 void HandleDisplayAlertL( SmlAlert_t* aAlert, TInt& aStatusId); |
|
86 void HandleUserInputalertL( SmlAlert_t* aAlert, TInt& aStatusId); |
|
87 TInt FindMaxLength(TInt aSourceLength, TInt aDestLength); |
|
88 //singlechoice |
|
89 HBufC8* AlertDataLC( const SmlItemList_t* aItemList ) const; |
|
90 TInt InitStatusToAtomicOrSequenceL( const TDesC8& aCmd, const SmlAtomic_t* aAtomic ) const; |
|
91 |
|
92 private: // functions from base classes |
|
93 |
|
94 void DoAlertL( const TDesC8& aAlertCode, TTime* aLastSyncAnchor = NULL, TTime* aNextSyncAnchor = NULL ); //from CNSmlCmdsBase |
|
95 void DoPutL(); //from CNSmlCmdsBase |
|
96 CNSmlCmdsBase::TReturnValue DoResultsL(); //from CNSmlCmdsBase |
|
97 void DoGetL(); //from CNSmlCmdsBase |
|
98 CNSmlCmdsBase::TReturnValue DoStartSyncL(); |
|
99 void DoEndSyncL(); |
|
100 CNSmlCmdsBase::TReturnValue DoAddOrReplaceOrDeleteL(); //from CNSmlCmdsBase |
|
101 CNSmlCmdsBase::TReturnValue DoMapL(); //from CNSmlCmdsBase |
|
102 TReturnValue DoReplaceOrDeleteL(); //from CNSmlCmdsBase |
|
103 void ProcessResultsCmdL( SmlResults_t* aResults ); //from CNSmlCmdsBase |
|
104 void ProcessPutCmdL( SmlPut_t* aPut ); //from CNSmlCmdsBase |
|
105 void ProcessGetCmdL( SmlGet_t* aGet ); //from CNSmlCmdsBase |
|
106 void ProcessAlertCmdL( SmlAlert_t* aAlert, TBool aNextAlert = EFalse, TBool aServerAlert = EFalse, TBool aDisplayAlert = EFalse ); //from CNSmlCmdsBase |
|
107 void ProcessSyncL( SmlSync_t* aSync ); //from CNSmlCmdsBase |
|
108 void ProcessUpdatesL( const TDesC8& aCmd, SmlGenericCmd_t* aContent ); //from CNSmlCmdsBase |
|
109 void ProcessAtomicL( SmlAtomic_t* aAtomic ); //from CNSmlCmdsBase |
|
110 void ProcessEndAtomicL(); //from CNSmlCmdsBase |
|
111 void ProcessSequenceL( SmlSequence_t* aSequence ); //from CNSmlCmdsBase |
|
112 void ProcessEndSequence(); //from CNSmlCmdsBase |
|
113 void ProcessEndSyncL(); //from CNSmlCmdsBase |
|
114 // FOTA |
|
115 /** |
|
116 * Process the exec structure sent by the remote server. |
|
117 * @param aExec. The exec command structure, accordant with the dtd. |
|
118 */ |
|
119 void ProcessExecCmdL ( SmlExec_t* aExec ); //from CNSmlCmdsBase |
|
120 /** |
|
121 * Makes a generic alert element (or possible many of them) |
|
122 * and calls WBXML generator. |
|
123 * @param aFwMgmtUri. The uri which has been used in the exe command whose final result is |
|
124 * about to be reported. |
|
125 * @param aMetaType. Meta/Type that should be used in the alert. |
|
126 * @param aMetaFormat. Meta/Format that should be used in the alert. |
|
127 * @param aFinalResult. The final result value which is reported to remote server. |
|
128 * @param aCorrelator. Correlator value used in the original exec command. |
|
129 */ |
|
130 void DoGenericAlertL ( const TDesC8& aFwMgmtUri, const TDesC8& aMetaType, const TDesC8& aMetaFormat, TInt aFinalResult, const TDesC8& aFwCorrelator ); //from CNSmlCmdsBase |
|
131 void DoGenericAlertL ( const TDesC8& aCorrelator, const RArray<CNSmlDMAlertItem>& aItemList ); //from CNSmlCmdsBase |
|
132 /** |
|
133 * Makes a generic user alert element, if the update request is set to the |
|
134 * central repository by the FOTA UI. |
|
135 * @param aProfileId. The profile id of the current dm session. |
|
136 * @return TBool. ETrue if the alert was generated, otherwise EFalse. |
|
137 */ |
|
138 TBool DoGenericUserAlertL ( TInt aProfileId ); //from CNSmlCmdsBase |
|
139 /** |
|
140 * Resets the update request in the central repository by |
|
141 * writing '-1' value. |
|
142 */ |
|
143 void ResetGenericUserAlertL(); //from CNSmlCmdsBase |
|
144 /** |
|
145 * When the generic alerts are successfully sent to the remote |
|
146 * server, the FOTA adapter needs to be informed about this. |
|
147 * This command is chained through the DM engine. |
|
148 */ |
|
149 void MarkGenAlertsSentL(); //from CNSmlCmdsBase |
|
150 void MarkGenAlertsSentL(const TDesC8& aURI) ; |
|
151 /** |
|
152 * Closes the connections to callback server and host servers. |
|
153 * Separate function is needed, since the disconnecting cannot |
|
154 * be made after the active scheduler of the thread is stopped. |
|
155 */ |
|
156 void DisconnectFromOtherServers(); //from CNSmlCmdsBase |
|
157 // FOTA end |
|
158 void DoEndMessageL( TBool aFinal ); //from CNSmlCmdsBase |
|
159 void EndOfServerMessageL() const; //from CNSmlCmdsBase |
|
160 |
|
161 void SetResultsL( TInt aResultsRef, const CBufBase& aObject, const TDesC8& aType, const TDesC8& aFormat, TInt aTotalSize); //from MNSmlDmModuleCallBack |
|
162 void SetStatusL( TInt aStatusRef, TInt aStatusCode ); //from MNSmlDmModuleCallBack |
|
163 |
|
164 TNSmlError::TNSmlSyncMLStatusCode GetChunkL(TDesC8& aLargeUri, const SmlItem_t* aCurrentItem, const SmlPcdata_t* aMetaInCommand, CBufBase*& aBuffer, TInt& aTotSizeOfLarge ); |
|
165 |
|
166 /** |
|
167 * Updates the error code for the session,if any |
|
168 * @param aItem: pointer to sml elements |
|
169 * @param aStatusCode: holds the error code |
|
170 * @return aNone |
|
171 */ |
|
172 void UpdateErrorStatusCode(SmlItem_t* aItem,TNSmlError::TNSmlSyncMLStatusCode& aStatusCode); |
|
173 |
|
174 // |
|
175 private: // Data |
|
176 struct TDMDevInfo |
|
177 { |
|
178 SmlItemList_t** iItemListPtr; |
|
179 HBufC8* iFormat; |
|
180 HBufC8* iType; |
|
181 HBufC8* iObject; |
|
182 TBool iFirst; |
|
183 TBool iResults; |
|
184 }; |
|
185 |
|
186 // DM server ID |
|
187 HBufC* iDMServerId; |
|
188 // Atomic transaction is on. |
|
189 TBool iDMAtomic; |
|
190 // ID of Atomic command |
|
191 TInt iDMAtomicID; |
|
192 // Sequence is on |
|
193 TBool iDMSequence; |
|
194 // ID of Sequence |
|
195 TInt iDMSequenceID; |
|
196 // Atomic or Sequence is interrupted by an user |
|
197 TBool iDMNotExecuted; |
|
198 // Struct for DevInfo item |
|
199 TDMDevInfo* iDMDevInfo; |
|
200 // Switch for Callback results handling |
|
201 TBool iDMDevInfoResults; |
|
202 // Switch for Out of Disk message |
|
203 TBool iDMDeviceFullWritten; |
|
204 // used classes |
|
205 MSyncMLProgressObserver* iDMObserver; |
|
206 |
|
207 HBufC8* iLargeObjectUri; |
|
208 // TBool iMoreDataForResults; |
|
209 TInt iLargeObjectTotalSize; |
|
210 TInt iBytesSent; |
|
211 |
|
212 // FOTA |
|
213 CRepository* iRepository; |
|
214 // FOTA end |
|
215 |
|
216 // owned classes |
|
217 #ifdef __TEST_TREEMODULE |
|
218 CNSmlDmTestModule* iDMModule; |
|
219 #else |
|
220 CNSmlDmModule* iDMModule; |
|
221 #endif |
|
222 |
|
223 /** |
|
224 * Handle to chunk that is used to transfer data between client and server |
|
225 */ |
|
226 RChunk iChunk; |
|
227 |
|
228 }; |
|
229 |
|
230 #endif // __NSMLDMCMDS_H |
|
231 |
|
232 // End of File |