|
1 /* |
|
2 * Copyright (c) 2003-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 * Provides set of static functions, e.g. for creating particular task handler. |
|
16 * |
|
17 */ |
|
18 |
|
19 |
|
20 |
|
21 #include "taskhandlercreator.h" |
|
22 #include "protocolversiongetter.h" |
|
23 #include "realiapconnobserver.h" |
|
24 #include "vpnconncloser.h" |
|
25 #include "vpnconnstarter.h" |
|
26 |
|
27 CTaskHandler* TaskHandlerCreator::CreateTaskHandlerL(MTaskHandlerManager* aManager, |
|
28 const TTaskArrivedEventData& aEventSpec) |
|
29 { |
|
30 CTaskHandler* taskHandler = NULL; |
|
31 |
|
32 switch (aEventSpec.iEventType) |
|
33 { |
|
34 case EGetProtocolVersionEvent: |
|
35 taskHandler = CProtocolVersionGetter::NewL(aManager, aEventSpec); |
|
36 break; |
|
37 |
|
38 case EStartVpnConnEvent: |
|
39 taskHandler = CVpnConnStarter::NewL(aManager, aEventSpec); |
|
40 break; |
|
41 |
|
42 case ECloseVpnConnEvent: |
|
43 taskHandler = CVpnConnCloser::NewL(aManager, aEventSpec); |
|
44 break; |
|
45 |
|
46 case EObserveRealIapConnEvent: |
|
47 taskHandler = CRealIapConnObserver::NewL(aManager, aEventSpec); |
|
48 break; |
|
49 |
|
50 default: |
|
51 break; |
|
52 } |
|
53 |
|
54 return taskHandler; |
|
55 } |
|
56 |
|
57 TBool TaskHandlerCreator::EventRequiresSit(TEventType aEventType) |
|
58 { |
|
59 TBool eventRequiresSit = EFalse; |
|
60 |
|
61 switch (aEventType) |
|
62 { |
|
63 case EGetProtocolVersionEvent: |
|
64 case EStartVpnConnEvent: |
|
65 case ECloseVpnConnEvent: |
|
66 case EObserveRealIapConnEvent: |
|
67 eventRequiresSit = ETrue; |
|
68 break; |
|
69 |
|
70 default: |
|
71 break; |
|
72 } |
|
73 |
|
74 return eventRequiresSit; |
|
75 } |
|
76 |
|
77 TEventType TaskHandlerCreator::FindTaskRequestEventType(TEventType aCancelEventType) |
|
78 { |
|
79 TEventType taskRequestEventType = EUnfoundEvent; |
|
80 |
|
81 switch (aCancelEventType) |
|
82 { |
|
83 case EGetProtocolVersionCancelEvent: |
|
84 taskRequestEventType = EGetProtocolVersionEvent; |
|
85 break; |
|
86 |
|
87 case EStartVpnConnCancelEvent: |
|
88 taskRequestEventType = EStartVpnConnEvent; |
|
89 break; |
|
90 |
|
91 case ECloseVpnConnCancelEvent: |
|
92 taskRequestEventType = ECloseVpnConnEvent; |
|
93 break; |
|
94 |
|
95 case EObserveRealIapConnCancelEvent: |
|
96 taskRequestEventType = EObserveRealIapConnEvent; |
|
97 break; |
|
98 |
|
99 default: |
|
100 break; |
|
101 } |
|
102 |
|
103 return taskRequestEventType; |
|
104 } |
|
105 |
|
106 TEventType TaskHandlerCreator::FindCancelEventType(TEventType aTaskRequestEventType) |
|
107 { |
|
108 TEventType cancelEventType = EUnfoundEvent; |
|
109 |
|
110 switch (aTaskRequestEventType) |
|
111 { |
|
112 case EGetProtocolVersionEvent: |
|
113 cancelEventType = EGetProtocolVersionCancelEvent; |
|
114 break; |
|
115 |
|
116 case EStartVpnConnEvent: |
|
117 cancelEventType = EStartVpnConnCancelEvent; |
|
118 break; |
|
119 |
|
120 case ECloseVpnConnEvent: |
|
121 cancelEventType = ECloseVpnConnCancelEvent; |
|
122 break; |
|
123 |
|
124 case EObserveRealIapConnEvent: |
|
125 cancelEventType = EObserveRealIapConnCancelEvent; |
|
126 break; |
|
127 |
|
128 default: |
|
129 break; |
|
130 } |
|
131 |
|
132 return cancelEventType; |
|
133 } |
|
134 |
|
135 TBool TaskHandlerCreator::IsTaskCancellationObservationRequest(TEventType aEventType) |
|
136 { |
|
137 TBool isTaskCancellationObservationRequest = EFalse; |
|
138 |
|
139 switch (aEventType) |
|
140 { |
|
141 case EGetProtocolVersionCancelEvent: |
|
142 case EStartVpnConnCancelEvent: |
|
143 case ECloseVpnConnCancelEvent: |
|
144 case EStartRealIapConnCancelEvent: |
|
145 case EObserveRealIapConnCancelEvent: |
|
146 isTaskCancellationObservationRequest = ETrue; |
|
147 break; |
|
148 |
|
149 default: |
|
150 break; |
|
151 } |
|
152 |
|
153 return isTaskCancellationObservationRequest; |
|
154 } |