|
1 /* |
|
2 * Copyright (c) 2002-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: Thread that is used by alert module to launch engine server. |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 #ifndef __NSMLTHREADSTART_H__ |
|
20 #define __NSMLTHREADSTART_H__ |
|
21 |
|
22 #include <SyncMLNotifierParams.h> |
|
23 #include <SyncMLNotifier.h> |
|
24 #include "nsmlsosserver.h" |
|
25 |
|
26 class CNSmlJob; |
|
27 class CNSmlNotifierObserver; |
|
28 class CNSmlNotifierTimeOut; |
|
29 class CNSmlSOSHandler; |
|
30 class CNSmlThreadEngine; |
|
31 class CNSmlCancelTimeOut; |
|
32 |
|
33 // CONSTANTS |
|
34 //name of DM thread |
|
35 _LIT( KNSmlJobThread, "NSmlJobThread" ); |
|
36 const TBool KNSmlWaitNotifierForEver = ETrue; |
|
37 |
|
38 |
|
39 |
|
40 /** |
|
41 * TNSmlThreadParams class |
|
42 * |
|
43 */ |
|
44 class CNSmlThreadParams : public CBase |
|
45 { |
|
46 public: |
|
47 CNSmlThreadParams( CNSmlJob& aJob, CNSmlSOSHandler* aSOSHandler) |
|
48 : iCurrentJob(aJob), iSOSHandler(aSOSHandler) { } |
|
49 |
|
50 ~CNSmlThreadParams(); |
|
51 |
|
52 CNSmlSOSHandler* iSOSHandler; |
|
53 CArrayFix<TNSmlContentSpecificSyncType>* iCSArray; |
|
54 CNSmlJob& iCurrentJob; |
|
55 TInt iSyncInit; |
|
56 HBufC8* iNotifierParams; |
|
57 CNSmlThreadEngine* iThreadEngine; |
|
58 }; |
|
59 |
|
60 |
|
61 |
|
62 /** |
|
63 * CNSmlThreadObserver class |
|
64 * |
|
65 */ |
|
66 class CNSmlThreadObserver : public CActive |
|
67 { |
|
68 public: |
|
69 CNSmlThreadObserver(TRequestStatus& aStatus); |
|
70 ~CNSmlThreadObserver(); |
|
71 void LogonToThread( RThread& aThread ); |
|
72 protected: |
|
73 void DoCancel(); |
|
74 void RunL(); |
|
75 private: |
|
76 TRequestStatus& iSosStatus; |
|
77 }; |
|
78 |
|
79 /** |
|
80 * CNSmlThreadEngine class |
|
81 * |
|
82 */ |
|
83 class CNSmlThreadEngine : public CActive |
|
84 { |
|
85 public: |
|
86 static CNSmlThreadEngine* NewL( CNSmlThreadParams& aParams ); |
|
87 |
|
88 ~CNSmlThreadEngine(); |
|
89 |
|
90 void StartJobSessionL(); |
|
91 void CancelJob(); |
|
92 TInt VerifyJobFromNotifierL(); |
|
93 |
|
94 TInt FinishedStatus() |
|
95 { |
|
96 return iStatus.Int(); |
|
97 }; |
|
98 |
|
99 CNSmlDMAgent* DMAgentL() const; |
|
100 CNSmlDSAgent* DSAgentL() const; |
|
101 |
|
102 TBool SilentModeL( const CNSmlThreadParams* aParams ); |
|
103 void SaveSessionInfoL(); |
|
104 void ForcedCertificateCheckL( TBool aForcedState ); |
|
105 protected: |
|
106 void DoCancel(); |
|
107 void RunL(); |
|
108 |
|
109 private: |
|
110 CNSmlThreadEngine( CNSmlThreadParams& aParams ); |
|
111 void ConstructL(); |
|
112 void StartDMSessionL(); |
|
113 void StartDSSessionL(); |
|
114 void WriteHistoryLogL( TInt aErrorCode ); |
|
115 TBool DoRunL(); |
|
116 private: |
|
117 CNSmlThreadParams& iThreadParams; |
|
118 TSmlUsageType iUsageType; |
|
119 |
|
120 //Data Sync contents |
|
121 CArrayFix<TNSmlContentSpecificSyncType>* iContentArray; |
|
122 |
|
123 //used for server alert initiated job |
|
124 RTimer iTimeout; |
|
125 RNotifier iNotifier; |
|
126 CNSmlNotifierObserver* iNotifierObserver; |
|
127 RLibrary iSessionLib; |
|
128 CNSmlDMAgent* iDMAgent; |
|
129 CNSmlDSAgent* iDSAgent; |
|
130 CNSmlCancelTimeOut* iCancelTimeout; |
|
131 }; |
|
132 |
|
133 |
|
134 /** |
|
135 * CNSmlNotifierTimeOut class |
|
136 * |
|
137 */ |
|
138 class CNSmlNotifierTimeOut : public CActive |
|
139 { |
|
140 public: |
|
141 CNSmlNotifierTimeOut(); |
|
142 ~CNSmlNotifierTimeOut(); |
|
143 void LaunchNotifierTimer( CNSmlNotifierObserver* aObserver ); |
|
144 protected: |
|
145 void DoCancel(); |
|
146 void RunL(); |
|
147 private: |
|
148 CNSmlNotifierObserver* iObserver; |
|
149 RTimer iTimeOutTimer; |
|
150 }; |
|
151 |
|
152 /** |
|
153 * CNSmlCancelTimeOut class |
|
154 * |
|
155 */ |
|
156 class CNSmlCancelTimeOut : public CActive |
|
157 { |
|
158 public: |
|
159 CNSmlCancelTimeOut( CNSmlDMAgent& iDMAgent, CNSmlDSAgent& iDSAgent ); |
|
160 ~CNSmlCancelTimeOut(); |
|
161 void SetJobCancelled( TSmlUsageType aUsageType ); |
|
162 protected: |
|
163 void DoCancel(); |
|
164 void RunL(); |
|
165 private: |
|
166 TSmlUsageType iUsageType; |
|
167 CNSmlDMAgent& iDMAgent; |
|
168 CNSmlDSAgent& iDSAgent; |
|
169 RTimer iTimeOutTimer; |
|
170 TBool iDoCancel; |
|
171 }; |
|
172 |
|
173 |
|
174 /** |
|
175 * CNSmlNotifierObserver class |
|
176 * |
|
177 */ |
|
178 class CNSmlNotifierObserver : public CActive |
|
179 { |
|
180 public: |
|
181 CNSmlNotifierObserver( TRequestStatus& aStatus, CNSmlThreadParams& aParams ); |
|
182 ~CNSmlNotifierObserver(); |
|
183 void ConnectToNotifierL( const TSyncMLAppLaunchNotifParams& aParam ); |
|
184 void NotifierTimeOut(); |
|
185 protected: |
|
186 void DoCancel(); |
|
187 void RunL(); |
|
188 private: |
|
189 TRequestStatus& iCallerStatus; |
|
190 |
|
191 RNotifier iNotifier; |
|
192 TSyncMLAppLaunchNotifRetValPckg iResBuf; |
|
193 |
|
194 CNSmlThreadParams& iThreadParams; |
|
195 CNSmlNotifierTimeOut iNotifierTimeOut; |
|
196 TBool iTimeOut; |
|
197 }; |
|
198 |
|
199 |
|
200 /** |
|
201 * TNSmlThreadLauncher class |
|
202 * |
|
203 */ |
|
204 class TNSmlThreadLauncher |
|
205 { |
|
206 public: |
|
207 static TInt RunJobSession( CNSmlThreadParams& aParams, CNSmlThreadObserver& aObserver ); |
|
208 }; |
|
209 |
|
210 |
|
211 #endif |