1 /* |
|
2 * s_cch.h :Copyright (c) 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: s_cch.h |
|
15 * |
|
16 */ |
|
17 |
|
18 #ifndef MyCchServiceH |
|
19 #define MyCchServiceH |
|
20 |
|
21 // EXTERNAL INCLUDES |
|
22 #include <CEUnitTestSuiteClass.h> |
|
23 #include <cch.h> |
|
24 |
|
25 |
|
26 _LIT(KTestUserName, "hi123"); |
|
27 _LIT(KOwnUserNameMatch,"gizmo:Sharath"); // dont change this value |
|
28 _LIT(KTestPassword, "password"); |
|
29 _LIT(KTestDescription, "error"); |
|
30 |
|
31 class MyCCch : public CCch |
|
32 { |
|
33 |
|
34 public: |
|
35 |
|
36 /** |
|
37 * Two-phased constructor. |
|
38 */ |
|
39 static CCch* NewL(); |
|
40 |
|
41 /** |
|
42 * Two-phased constructor. |
|
43 */ |
|
44 static CCch* NewLC(); |
|
45 |
|
46 /** |
|
47 * Destructor. |
|
48 */ |
|
49 // ~CCch(); |
|
50 |
|
51 /** |
|
52 * Returns one service |
|
53 * |
|
54 * @param aId Service id |
|
55 * @return Service or NULL if not found. Ownership is not transferred. |
|
56 */ |
|
57 // CCchService* GetService( TInt aId ); |
|
58 |
|
59 /** |
|
60 * Returns service ids of all configured services |
|
61 * |
|
62 * @param aIds Array of TInt to be filled with ids |
|
63 * @return Symbian error code |
|
64 */ |
|
65 // TInt GetServiceIds( RArray<TInt>& aIds ) const; |
|
66 |
|
67 /** |
|
68 * Returns services fulfilling the search criteria |
|
69 * |
|
70 * @param aType Service type |
|
71 * @param aServices Array of CCchService to be filled |
|
72 * @return Symbian error code |
|
73 */ |
|
74 // TInt GetServices( TCCHSubserviceType aType, |
|
75 // RPointerArray<CCchService>& aServices ); |
|
76 |
|
77 /** |
|
78 * Returns ETrue if connectivity dialogs are allowed in service enabling. |
|
79 * |
|
80 * @return ETrue if connectivity dialogs are allowed in service enabling |
|
81 */ |
|
82 // TBool ConnectivityDialogsAllowed() const; |
|
83 |
|
84 /** |
|
85 * For allowing/disallowing connectivity dialogs showing in |
|
86 * service enabling. |
|
87 * |
|
88 * @param aConnectivityDialogsAllowed Boolean to set connectivity dialogs |
|
89 * allowed/disallowed |
|
90 */ |
|
91 //void SetConnectivityDialogsAllowed( |
|
92 //TBool aConnectivityDialogsAllowed ); |
|
93 |
|
94 /** |
|
95 * For getting cchui api. |
|
96 * |
|
97 * @return reference to cchui api. |
|
98 */ |
|
99 // MCchUi& CchUiApi() const; |
|
100 |
|
101 |
|
102 |
|
103 /** |
|
104 * The constructor |
|
105 */ |
|
106 // void CCch(); |
|
107 |
|
108 |
|
109 |
|
110 /** |
|
111 * By default Symbian 2nd phase constructor is private. |
|
112 */ |
|
113 // void ConstructL(); |
|
114 |
|
115 private: // data |
|
116 |
|
117 /** |
|
118 * Cch client implementation |
|
119 * Own. |
|
120 */ |
|
121 //CCchImpl* iImplementation; |
|
122 |
|
123 #ifdef _DEBUG |
|
124 // friend class UT_CchUi; |
|
125 #endif |
|
126 }; |
|
127 |
|
128 class MyCchService : public CCchService |
|
129 { |
|
130 TInt Enable( TCCHSubserviceType aType ); |
|
131 |
|
132 /** |
|
133 * Launches service disable. See MCchServiceObserver for status changes. |
|
134 * |
|
135 * @param aType Type of service |
|
136 * @return Symbian error |
|
137 */ |
|
138 TInt Disable( TCCHSubserviceType aType ); |
|
139 |
|
140 /** |
|
141 * Returns the current service state |
|
142 * |
|
143 * @param aType Type of service |
|
144 * @param aStatus Status of the service, return value |
|
145 * @return Symbian error code |
|
146 */ |
|
147 TInt GetStatus( TCCHSubserviceType aType, |
|
148 TCchServiceStatus& aStatus ) const ; |
|
149 |
|
150 /** |
|
151 * Returns the connection parameters |
|
152 * |
|
153 * @param aType Type of service |
|
154 * @param aParameter Connection parameter of the service |
|
155 * @param aValue Value of the parameter |
|
156 * @return Symbian error code |
|
157 */ |
|
158 TInt GetConnectionParameter( TCCHSubserviceType aType, |
|
159 TCchConnectionParameter aParameter, TInt& aValue ) const; |
|
160 |
|
161 /** |
|
162 * Returns the connection parameters |
|
163 * |
|
164 * @param aType Type of service |
|
165 * @param aParameter Connection parameter of the service |
|
166 * @param aValue Value of the parameter |
|
167 * @return Symbian error code |
|
168 */ |
|
169 TInt GetConnectionParameter( TCCHSubserviceType aType, |
|
170 TCchConnectionParameter aParameter, RBuf& aValue ) const; |
|
171 |
|
172 /** |
|
173 * Sets the connection parameters |
|
174 * |
|
175 * @param aType The type of service |
|
176 * @param aParameter Connection parameter of the service |
|
177 * @param aValue Value of the parameter |
|
178 * @return Symbian error code |
|
179 */ |
|
180 TInt SetConnectionParameter( TCCHSubserviceType aType, |
|
181 TCchConnectionParameter aParameter, TInt aValue ); |
|
182 |
|
183 /** |
|
184 * Sets the connection parameters |
|
185 * |
|
186 * @param aType The type of service |
|
187 * @param aParameter Connection parameter of the service |
|
188 * @param aValue Value of the parameter |
|
189 * @return Symbian error code |
|
190 */ |
|
191 TInt SetConnectionParameter( TCCHSubserviceType aType, |
|
192 TCchConnectionParameter aParameter, const TDesC& aValue ); |
|
193 |
|
194 /** |
|
195 * Reserves the service for exclusive usage |
|
196 * |
|
197 * @param aType Type of service |
|
198 * @return Symbian error code |
|
199 */ |
|
200 TInt Reserve( TCCHSubserviceType aType ); |
|
201 |
|
202 /** |
|
203 * Frees the service of exclusive usage |
|
204 * |
|
205 * @param aType Type of service |
|
206 * @return Symbian error code |
|
207 */ |
|
208 TInt Free( TCCHSubserviceType aType ); |
|
209 |
|
210 /** |
|
211 * Is the service reserved |
|
212 * |
|
213 * @param aType Type of service |
|
214 * @param aReserved True if the service is reserved |
|
215 * @return Symbian error code |
|
216 */ |
|
217 TInt IsReserved( TCCHSubserviceType aType, TBool& aReserved ) const; |
|
218 |
|
219 /** |
|
220 * Returns the service id |
|
221 * |
|
222 * @return The id of the service |
|
223 */ |
|
224 TInt ServiceId() const; |
|
225 |
|
226 /** |
|
227 * @deprecated Do not use this anymore, change to AddObserver! |
|
228 * |
|
229 * Adds observer for listening service events |
|
230 * |
|
231 * @param aObserver Event observing class |
|
232 */ |
|
233 void SetObserver( MCchServiceStatusObserver& aObserver ); |
|
234 |
|
235 /** |
|
236 * @deprecated Do not use this anymore, change to |
|
237 * RemoveObserver method with paramater |
|
238 * |
|
239 * Removes the observer of service events |
|
240 */ |
|
241 void RemoveObserver( ); |
|
242 |
|
243 /** |
|
244 * Adds observer for listening service events |
|
245 * |
|
246 * @param aObserver Event observing class |
|
247 * @return KErrAlreadyExist Observer already added |
|
248 * KErrNone Observer was added |
|
249 */ |
|
250 TInt AddObserver( MCchServiceStatusObserver& aObserver ); |
|
251 |
|
252 /** |
|
253 * Removes the observer of service events |
|
254 * |
|
255 * @param aObserver Event observing class |
|
256 * @return KErrNotFound Observer was not found |
|
257 * KErrNone Observer was removed |
|
258 */ |
|
259 TInt RemoveObserver( MCchServiceStatusObserver& aObserver ); |
|
260 |
|
261 /** |
|
262 * Checks if the type is supported |
|
263 * |
|
264 * @param aType Type of service |
|
265 * @param aSupported True if the service type is supported |
|
266 * @return Symbian error code |
|
267 */ |
|
268 TInt IsSupported( TCCHSubserviceType aType, TBool& aSupported ) const; |
|
269 |
|
270 private: |
|
271 MCchServiceStatusObserver* iObserver; |
|
272 |
|
273 }; |
|
274 |
|
275 |
|
276 #endif //MyCchService |
|
277 |
|
278 |
|
279 |
|
280 |
|