|
1 /* |
|
2 * Copyright (c) 2010 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 #ifndef DRMUTILITYCONNECTION_H |
|
18 #define DRMUTILITYCONNECTION_H |
|
19 |
|
20 #include <e32base.h> // CActive |
|
21 #include <es_sock.h> // RConnection, RSocketServ |
|
22 |
|
23 namespace DRM |
|
24 { |
|
25 |
|
26 /** |
|
27 * Utility class for DRMutility dmgr wrapper related common functions |
|
28 * |
|
29 * @since S60 v9.2 |
|
30 */ |
|
31 |
|
32 |
|
33 // CLASS DECLARATION |
|
34 // Class for handling internal connectivity logic |
|
35 NONSHARABLE_CLASS( CDrmUtilityConnection ): public CActive |
|
36 { |
|
37 public: // Constructors and destructor. |
|
38 |
|
39 /** |
|
40 * |
|
41 */ |
|
42 static CDrmUtilityConnection * NewL( const TBool aAllowQueries ); |
|
43 |
|
44 /** |
|
45 * |
|
46 */ |
|
47 static CDrmUtilityConnection * NewLC( const TBool aAllowQueries ); |
|
48 |
|
49 /** |
|
50 * Destructor |
|
51 */ |
|
52 ~CDrmUtilityConnection(); |
|
53 |
|
54 public: // new methods |
|
55 |
|
56 /** |
|
57 * |
|
58 */ |
|
59 void ConnectL( TRequestStatus* aStatus ); |
|
60 |
|
61 /** |
|
62 * |
|
63 */ |
|
64 void Close(); |
|
65 |
|
66 /** |
|
67 * |
|
68 */ |
|
69 TBool HasMoreConnectionAttempts(); |
|
70 |
|
71 /** |
|
72 * |
|
73 */ |
|
74 TBool IsConnected( TUint32& aIap ); |
|
75 |
|
76 /** |
|
77 * Check if default connection has been defined |
|
78 * @see RCmManager::ReadDefConnL |
|
79 */ |
|
80 static TBool HasDefaultConnectionL(); |
|
81 |
|
82 /** |
|
83 * Check if system has access points defined |
|
84 */ |
|
85 static TBool HasAccessPointsL(); |
|
86 |
|
87 |
|
88 |
|
89 private: //enumerations |
|
90 enum TConnectionType |
|
91 { |
|
92 EAttachExisting, //0 |
|
93 EUsingDefault, //1 |
|
94 EUsingPurposeOperator, // 2 |
|
95 EUsingPurposeInternet, // 3 |
|
96 EUsingQuery, // 4 |
|
97 EFail // 5 |
|
98 }; |
|
99 |
|
100 enum TState |
|
101 { |
|
102 EInit, // 0 |
|
103 EConnecting, // 1 |
|
104 EConnected, // 2 |
|
105 EConnectFailed // 3 |
|
106 }; |
|
107 |
|
108 private: // Constructors and destructor. |
|
109 |
|
110 /** |
|
111 * Default constructor (for preventing inheritance) |
|
112 */ |
|
113 CDrmUtilityConnection( TBool aAllowQueries ); |
|
114 |
|
115 /** |
|
116 * Second phase constructor |
|
117 */ |
|
118 void ConstructL(); |
|
119 |
|
120 private: // from CActive |
|
121 |
|
122 virtual void DoCancel(); |
|
123 |
|
124 virtual void RunL(); |
|
125 |
|
126 virtual TInt RunError( TInt aError ); |
|
127 |
|
128 private: // new methods |
|
129 |
|
130 /** |
|
131 * |
|
132 */ |
|
133 void DoClose(); |
|
134 |
|
135 /** |
|
136 * |
|
137 */ |
|
138 void Done(); |
|
139 |
|
140 /** |
|
141 * |
|
142 */ |
|
143 void InitL(); |
|
144 |
|
145 /** |
|
146 * |
|
147 */ |
|
148 void AttachExistingConnectionL(); |
|
149 |
|
150 /** |
|
151 * |
|
152 */ |
|
153 void ConnectUsingDefaultL(); |
|
154 |
|
155 /** |
|
156 * |
|
157 */ |
|
158 void ConnectUsingSnapPurposeL( const TUint32 aPurpose ); |
|
159 |
|
160 /** |
|
161 * |
|
162 */ |
|
163 void ConnectUsingQueryL(); |
|
164 |
|
165 /** |
|
166 * |
|
167 */ |
|
168 void UpdateIapIdL(); |
|
169 |
|
170 /** |
|
171 * |
|
172 */ |
|
173 void CompleteSelf( TInt aError ); |
|
174 |
|
175 /** |
|
176 * |
|
177 */ |
|
178 void CompleteParent( TInt aError ); |
|
179 |
|
180 private: // data |
|
181 |
|
182 RSocketServ iSocketServ; |
|
183 RConnection iConnection; |
|
184 TState iState; |
|
185 TConnectionType iType; |
|
186 TRequestStatus* iParentStatus; |
|
187 const TBool iAllowQueries; |
|
188 TUint32 iIapId; |
|
189 }; |
|
190 } |
|
191 #endif /* DRMUTILITYCONNECTION_H */ |