|
1 /* |
|
2 * Copyright (c) 2007-2009 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 * |
|
16 */ |
|
17 |
|
18 |
|
19 #ifndef T_SCPSUBSERVICE_H |
|
20 #define T_SCPSUBSERVICE_H |
|
21 |
|
22 #include <e32std.h> |
|
23 #include <cchservice.h> |
|
24 |
|
25 #include "scpdefs.h" |
|
26 #include "scpsipconnectionobserver.h" |
|
27 |
|
28 class MCchServiceObserver; |
|
29 class MScpSubServiceObserver; |
|
30 class CScpServiceHandlerBase; |
|
31 class TScpSubServiceState; |
|
32 class CScpServiceStorage; |
|
33 class CScpProfileHandler; |
|
34 class CScpService; |
|
35 |
|
36 /** |
|
37 * SCP sub service. |
|
38 * @lib sipconnectionprovider.dll |
|
39 */ |
|
40 class CScpSubService : public CBase, |
|
41 public MScpConnectionObserver |
|
42 { |
|
43 public: |
|
44 |
|
45 enum TEnableState |
|
46 { |
|
47 EScpNoRequest, |
|
48 EScpEnabled, |
|
49 EScpDisabled, |
|
50 EScpRefreshed |
|
51 }; |
|
52 |
|
53 static CScpSubService* NewL( TInt aId, |
|
54 TInt aSubServiceId, |
|
55 TCCHSubserviceType aSubServiceType, |
|
56 CScpService& aService ); |
|
57 |
|
58 |
|
59 /** |
|
60 * Destructor |
|
61 */ |
|
62 ~CScpSubService(); |
|
63 |
|
64 /** |
|
65 * Enables this sub service |
|
66 */ |
|
67 void EnableL(); |
|
68 |
|
69 /** |
|
70 * Disables this sub service |
|
71 * @return Symbian error codes |
|
72 */ |
|
73 TInt Disable(); |
|
74 |
|
75 /** |
|
76 * Returns internal id of this subservice |
|
77 * @return Internal id |
|
78 */ |
|
79 TInt Id() const; |
|
80 |
|
81 /** |
|
82 * Returns service id of this subservice |
|
83 * @return Sub service id |
|
84 */ |
|
85 TInt SubServiceId() const; |
|
86 |
|
87 /** |
|
88 * Return state of the subservice |
|
89 * @return State |
|
90 */ |
|
91 TCCHSubserviceState State() const; |
|
92 |
|
93 /** |
|
94 * Returns sub service type of the subservice |
|
95 * @return Sub service type |
|
96 */ |
|
97 TCCHSubserviceType SubServiceType() const; |
|
98 |
|
99 /** |
|
100 * Returns service storage |
|
101 * @return Service storage |
|
102 */ |
|
103 CScpServiceStorage& ServiceStorage() const; |
|
104 |
|
105 /** |
|
106 * Returns profile handler |
|
107 * @return Service storage |
|
108 */ |
|
109 CScpProfileHandler& ProfileHandler() const; |
|
110 |
|
111 /** |
|
112 * Sets sip profile id for the subservice |
|
113 * @param aSipProfileId Sip profile id |
|
114 */ |
|
115 void SetSipProfileId( TInt aSipProfileId ); |
|
116 |
|
117 /** |
|
118 * Returns sip profile id of the subservice |
|
119 * @return sip profile id |
|
120 */ |
|
121 TInt SipProfileId() const; |
|
122 |
|
123 /** |
|
124 * Sets enable requested state |
|
125 * @param aEnableRequestedState State |
|
126 */ |
|
127 void SetEnableRequestedState( TEnableState aEnableRequestedState ); |
|
128 |
|
129 /** |
|
130 * Return info about if enable or disable is requested |
|
131 * @return Enable requested state |
|
132 */ |
|
133 TEnableState EnableRequestedState() const; |
|
134 |
|
135 /** |
|
136 * Raises the flag that sub service is succesfully disconnected |
|
137 * its service (e.g. unsubscribed message received from network). |
|
138 * When disconnected it's ok for this sub service to disable SIP |
|
139 * profile |
|
140 * @param aSubServiceDisconnected Sub service disconnected |
|
141 */ |
|
142 void SetSubServiceDisconnected( TBool aSubServiceDisconnected ); |
|
143 |
|
144 /** |
|
145 * Return Sub service disconnceted flag |
|
146 * @return Sub service disconnected |
|
147 */ |
|
148 TBool SubServiceDisconnected() const; |
|
149 |
|
150 /** |
|
151 * Sets access point for the sub service |
|
152 * @param aApId Access point |
|
153 */ |
|
154 void SetApId( TUint32 aApId ); |
|
155 |
|
156 /** |
|
157 * Returns access point id of the subservice |
|
158 * @return Access point id |
|
159 */ |
|
160 TUint32 ApId() const; |
|
161 |
|
162 /** |
|
163 * Sets snap id or the subservice |
|
164 * @param aSnapId Snap id |
|
165 */ |
|
166 void SetSnapId( TUint32 aSnapId ); |
|
167 |
|
168 /** |
|
169 * Returns the iap type the subservice is using |
|
170 * @return Iap type |
|
171 */ |
|
172 TScpIapType GetIapType() const; |
|
173 |
|
174 /** |
|
175 * Returns snap id id of the subservice |
|
176 * @return Snap id |
|
177 */ |
|
178 TUint32 SnapId() const; |
|
179 |
|
180 /** |
|
181 * Returns service handler |
|
182 */ |
|
183 CScpServiceHandlerBase& ServiceHandler() const; |
|
184 |
|
185 /** |
|
186 * Handle connection event. Based on event a corresponging |
|
187 * method from current state is called. |
|
188 * @param aEvent Connection event |
|
189 */ |
|
190 void HandleConnectionEvent( TScpConnectionEvent aEvent ); |
|
191 |
|
192 /** |
|
193 * Returns last reported error from a state change |
|
194 * @return Last error |
|
195 */ |
|
196 TInt LastReportedError() const; |
|
197 |
|
198 /** |
|
199 * Last reported error setter |
|
200 * @param aError error which to be set |
|
201 */ |
|
202 void SetLastReportedError( const TInt aError ); |
|
203 |
|
204 /** |
|
205 * Sets the sub service as reserved |
|
206 * @param aReserved Reserved |
|
207 */ |
|
208 void SetReserved( TBool aReserved ); |
|
209 |
|
210 /** |
|
211 * Returns reserved info of the sub service |
|
212 * @return ETrue if reserved |
|
213 */ |
|
214 TBool IsReserved() const; |
|
215 |
|
216 /** |
|
217 * Returns roaming info of the sub service |
|
218 * @return ETrue if roaming |
|
219 */ |
|
220 TBool IsRoaming() const; |
|
221 |
|
222 /** |
|
223 * Set subservice observer |
|
224 */ |
|
225 void SetSubServiceObserver( MScpSubServiceObserver* aSubServiceObserver ); |
|
226 |
|
227 /** |
|
228 * Enable counter getter. |
|
229 */ |
|
230 TInt EnableCounter(); |
|
231 |
|
232 /** |
|
233 * Reset enable counter. |
|
234 */ |
|
235 void ResetEnableCounter(); |
|
236 |
|
237 private: |
|
238 |
|
239 /** |
|
240 * Constructor |
|
241 */ |
|
242 CScpSubService( TInt aId, |
|
243 TInt aSubServiceId, |
|
244 TCCHSubserviceType aType, |
|
245 CScpService& aService ); |
|
246 |
|
247 /** |
|
248 * 2nd phase constructor |
|
249 */ |
|
250 void ConstructL(); |
|
251 |
|
252 /** |
|
253 * TScpStates use this function to change the state |
|
254 * of the subservice. |
|
255 * @param aState New state |
|
256 * @param aError CCH errors |
|
257 */ |
|
258 void ChangeState( TCCHSubserviceState aState, TInt aError ); |
|
259 |
|
260 /** |
|
261 * Adds presencehandler to voip's subserviceobserver if |
|
262 * presencesubservice exists. |
|
263 */ |
|
264 void SetPresenceToObserveVoIP(); |
|
265 |
|
266 /** |
|
267 * Enable occured. |
|
268 */ |
|
269 void EnableOccured(); |
|
270 |
|
271 private: |
|
272 |
|
273 /** |
|
274 * Internal id. |
|
275 */ |
|
276 TInt iId; |
|
277 |
|
278 /** |
|
279 * Service id. |
|
280 */ |
|
281 TInt iSubServiceId; |
|
282 |
|
283 /** |
|
284 * Subservice type. |
|
285 */ |
|
286 TCCHSubserviceType iSubServiceType; |
|
287 |
|
288 /** |
|
289 * Service that contains this sub service |
|
290 */ |
|
291 CScpService& iService; |
|
292 |
|
293 /** |
|
294 * Service handler. Owned. |
|
295 */ |
|
296 CScpServiceHandlerBase* iServiceHandler; |
|
297 |
|
298 /** |
|
299 * Protocol profile id. |
|
300 */ |
|
301 TInt iSipProfileId; |
|
302 |
|
303 /** |
|
304 * Enable requested state |
|
305 */ |
|
306 TEnableState iEnableRequestedState; |
|
307 |
|
308 /** |
|
309 * Sub service disconnected |
|
310 */ |
|
311 TBool iSubServiceDisconnected; |
|
312 |
|
313 /** |
|
314 * IAP id. |
|
315 */ |
|
316 TUint32 iApId; |
|
317 |
|
318 /** |
|
319 * Snap id. |
|
320 */ |
|
321 TUint32 iSnapId; |
|
322 |
|
323 /** |
|
324 * Last reported error |
|
325 */ |
|
326 TInt iLastReportedError; |
|
327 |
|
328 /** |
|
329 * Reserved |
|
330 */ |
|
331 TBool iReserved; |
|
332 |
|
333 /** |
|
334 * Indicates is roaming ongoing |
|
335 */ |
|
336 TBool iRoaming; |
|
337 |
|
338 /** |
|
339 * Points to current sub service state. |
|
340 */ |
|
341 TScpSubServiceState* iSubServiceState; |
|
342 |
|
343 /** |
|
344 * Sub service observer |
|
345 */ |
|
346 MScpSubServiceObserver* iSubServiceObserver; |
|
347 |
|
348 /** |
|
349 * Counting enable requests, max count is sub service specific |
|
350 */ |
|
351 TInt iEnableCounter; |
|
352 |
|
353 private: |
|
354 |
|
355 // Needs access to call the private ChangeState |
|
356 friend class TScpSubServiceState; |
|
357 |
|
358 #ifdef _DEBUG |
|
359 friend class T_CScpService; |
|
360 friend class T_CScpServiceStorage; |
|
361 friend class T_CScpServiceManager; |
|
362 friend class T_CScpVmbxHandler; |
|
363 friend class T_CScpVoipHandler; |
|
364 friend class T_CScpPresenceHandler; |
|
365 friend class T_CScpImHandler; |
|
366 #endif |
|
367 }; |
|
368 |
|
369 #endif // T_SCPDEFS_H |