28
|
1 |
/*
|
|
2 |
* Copyright (c) 2007 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: The new cch client api class
|
|
15 |
*
|
|
16 |
*/
|
|
17 |
|
|
18 |
|
|
19 |
|
|
20 |
#ifndef C_CCH_H
|
|
21 |
#define C_CCH_H
|
|
22 |
|
|
23 |
#include <e32base.h>
|
|
24 |
#include <ccherror.h>
|
|
25 |
#include <cchtypes.h>
|
|
26 |
#include <cchui.h>
|
|
27 |
|
|
28 |
class CCchImpl;
|
|
29 |
|
|
30 |
|
|
31 |
/**
|
|
32 |
* Class indicating the service status
|
|
33 |
*
|
|
34 |
* @lib cch
|
|
35 |
*/
|
|
36 |
class TCchServiceStatus
|
|
37 |
{
|
|
38 |
|
|
39 |
public:
|
|
40 |
|
|
41 |
/**
|
|
42 |
* Constructor.
|
|
43 |
*/
|
|
44 |
IMPORT_C TCchServiceStatus( );
|
|
45 |
|
|
46 |
/**
|
|
47 |
* Returns the service state
|
|
48 |
*
|
|
49 |
* @return State of the service
|
|
50 |
*/
|
|
51 |
IMPORT_C TCCHSubserviceState State() const;
|
|
52 |
|
|
53 |
/**
|
|
54 |
* Returns last known service error
|
|
55 |
*
|
|
56 |
* @return Error of the service
|
|
57 |
*/
|
|
58 |
IMPORT_C TInt Error() const;
|
|
59 |
|
|
60 |
/**
|
|
61 |
* Sets the service state
|
|
62 |
*
|
|
63 |
* @param aState State for the service
|
|
64 |
*/
|
|
65 |
IMPORT_C void SetState( TCCHSubserviceState aState );
|
|
66 |
|
|
67 |
/**
|
|
68 |
* Sets the service error
|
|
69 |
*
|
|
70 |
* @param aError Error for the service
|
|
71 |
*/
|
|
72 |
IMPORT_C void SetError( TInt aError );
|
|
73 |
|
|
74 |
private: // data
|
|
75 |
|
|
76 |
/**
|
|
77 |
* The state of the service
|
|
78 |
*/
|
|
79 |
TCCHSubserviceState iState;
|
|
80 |
/**
|
|
81 |
* The error of the service
|
|
82 |
*/
|
|
83 |
TInt iError;
|
|
84 |
};
|
|
85 |
|
|
86 |
/**
|
|
87 |
* Observer class for getting service status change messages
|
|
88 |
*
|
|
89 |
* @lib cch
|
|
90 |
*/
|
|
91 |
class MCchServiceStatusObserver
|
|
92 |
{
|
|
93 |
|
|
94 |
public:
|
|
95 |
/**
|
|
96 |
* Signaled when service status or error changes
|
|
97 |
*
|
|
98 |
* @param aServiceId Id of the service
|
|
99 |
* @param aType Service type
|
|
100 |
* @param aServiceStatus Service status
|
|
101 |
*/
|
|
102 |
virtual void ServiceStatusChanged( TInt aServiceId,
|
|
103 |
TCCHSubserviceType aType,
|
|
104 |
const TCchServiceStatus& aServiceStatus ) = 0;
|
|
105 |
|
|
106 |
};
|
|
107 |
|
|
108 |
/**
|
|
109 |
* Class for cch service management
|
|
110 |
*
|
|
111 |
* CCchService is used for launching various kinds of service functions
|
|
112 |
* @code
|
|
113 |
* ?good_class_usage_example(s)
|
|
114 |
* @endcode
|
|
115 |
*
|
|
116 |
* @lib ?library
|
|
117 |
*/
|
|
118 |
class CCchService : public CBase
|
|
119 |
{
|
|
120 |
|
|
121 |
public:
|
|
122 |
|
|
123 |
/**
|
|
124 |
* Launches service enable. See MCchServiceObserver for status changes.
|
|
125 |
*
|
|
126 |
* @param aType Type of service
|
|
127 |
* @return Symbian error
|
|
128 |
*/
|
|
129 |
virtual TInt Enable( TCCHSubserviceType aType ) = 0;
|
|
130 |
|
|
131 |
/**
|
|
132 |
* Launches service disable. See MCchServiceObserver for status changes.
|
|
133 |
*
|
|
134 |
* @param aType Type of service
|
|
135 |
* @return Symbian error
|
|
136 |
*/
|
|
137 |
virtual TInt Disable( TCCHSubserviceType aType ) = 0;
|
|
138 |
|
|
139 |
/**
|
|
140 |
* Returns the current service state
|
|
141 |
*
|
|
142 |
* @param aType Type of service
|
|
143 |
* @param aStatus Status of the service, return value
|
|
144 |
* @return Symbian error code
|
|
145 |
*/
|
|
146 |
virtual TInt GetStatus( TCCHSubserviceType aType,
|
|
147 |
TCchServiceStatus& aStatus ) const = 0;
|
|
148 |
|
|
149 |
/**
|
|
150 |
* Returns the connection parameters
|
|
151 |
*
|
|
152 |
* @param aType Type of service
|
|
153 |
* @param aParameter Connection parameter of the service
|
|
154 |
* @param aValue Value of the parameter
|
|
155 |
* @return Symbian error code
|
|
156 |
*/
|
|
157 |
virtual TInt GetConnectionParameter( TCCHSubserviceType aType,
|
|
158 |
TCchConnectionParameter aParameter, TInt& aValue ) const = 0;
|
|
159 |
|
|
160 |
/**
|
|
161 |
* Returns the connection parameters
|
|
162 |
*
|
|
163 |
* @param aType Type of service
|
|
164 |
* @param aParameter Connection parameter of the service
|
|
165 |
* @param aValue Value of the parameter
|
|
166 |
* @return Symbian error code
|
|
167 |
*/
|
|
168 |
virtual TInt GetConnectionParameter( TCCHSubserviceType aType,
|
|
169 |
TCchConnectionParameter aParameter, RBuf& aValue ) const = 0;
|
|
170 |
|
|
171 |
/**
|
|
172 |
* Sets the connection parameters
|
|
173 |
*
|
|
174 |
* @param aType The type of service
|
|
175 |
* @param aParameter Connection parameter of the service
|
|
176 |
* @param aValue Value of the parameter
|
|
177 |
* @return Symbian error code
|
|
178 |
*/
|
|
179 |
virtual TInt SetConnectionParameter( TCCHSubserviceType aType,
|
|
180 |
TCchConnectionParameter aParameter, TInt aValue ) = 0;
|
|
181 |
|
|
182 |
/**
|
|
183 |
* Sets the connection parameters
|
|
184 |
*
|
|
185 |
* @param aType The type of service
|
|
186 |
* @param aParameter Connection parameter of the service
|
|
187 |
* @param aValue Value of the parameter
|
|
188 |
* @return Symbian error code
|
|
189 |
*/
|
|
190 |
virtual TInt SetConnectionParameter( TCCHSubserviceType aType,
|
|
191 |
TCchConnectionParameter aParameter, const TDesC& aValue ) = 0;
|
|
192 |
|
|
193 |
/**
|
|
194 |
* Reserves the service for exclusive usage
|
|
195 |
*
|
|
196 |
* @param aType Type of service
|
|
197 |
* @return Symbian error code
|
|
198 |
*/
|
|
199 |
virtual TInt Reserve( TCCHSubserviceType aType ) = 0;
|
|
200 |
|
|
201 |
/**
|
|
202 |
* Frees the service of exclusive usage
|
|
203 |
*
|
|
204 |
* @param aType Type of service
|
|
205 |
* @return Symbian error code
|
|
206 |
*/
|
|
207 |
virtual TInt Free( TCCHSubserviceType aType ) = 0;
|
|
208 |
|
|
209 |
/**
|
|
210 |
* Is the service reserved
|
|
211 |
*
|
|
212 |
* @param aType Type of service
|
|
213 |
* @param aReserved True if the service is reserved
|
|
214 |
* @return Symbian error code
|
|
215 |
*/
|
|
216 |
virtual TInt IsReserved( TCCHSubserviceType aType, TBool& aReserved ) const = 0;
|
|
217 |
|
|
218 |
/**
|
|
219 |
* Returns the service id
|
|
220 |
*
|
|
221 |
* @return The id of the service
|
|
222 |
*/
|
|
223 |
virtual TInt ServiceId() const = 0;
|
|
224 |
|
|
225 |
/**
|
|
226 |
* @deprecated Do not use this anymore, change to AddObserver!
|
|
227 |
*
|
|
228 |
* Adds observer for listening service events
|
|
229 |
*
|
|
230 |
* @param aObserver Event observing class
|
|
231 |
*/
|
|
232 |
virtual void SetObserver( MCchServiceStatusObserver& aObserver ) = 0;
|
|
233 |
|
|
234 |
/**
|
|
235 |
* @deprecated Do not use this anymore, change to
|
|
236 |
* RemoveObserver method with paramater
|
|
237 |
*
|
|
238 |
* Removes the observer of service events
|
|
239 |
*/
|
|
240 |
virtual void RemoveObserver( ) = 0;
|
|
241 |
|
|
242 |
/**
|
|
243 |
* Adds observer for listening service events
|
|
244 |
*
|
|
245 |
* @param aObserver Event observing class
|
|
246 |
* @return KErrAlreadyExist Observer already added
|
|
247 |
* KErrNone Observer was added
|
|
248 |
*/
|
|
249 |
virtual TInt AddObserver( MCchServiceStatusObserver& aObserver ) = 0;
|
|
250 |
|
|
251 |
/**
|
|
252 |
* Removes the observer of service events
|
|
253 |
*
|
|
254 |
* @param aObserver Event observing class
|
|
255 |
* @return KErrNotFound Observer was not found
|
|
256 |
* KErrNone Observer was removed
|
|
257 |
*/
|
|
258 |
virtual TInt RemoveObserver( MCchServiceStatusObserver& aObserver ) = 0;
|
|
259 |
|
|
260 |
/**
|
|
261 |
* Checks if the type is supported
|
|
262 |
*
|
|
263 |
* @param aType Type of service
|
|
264 |
* @param aSupported True if the service type is supported
|
|
265 |
* @return Symbian error code
|
|
266 |
*/
|
|
267 |
virtual TInt IsSupported( TCCHSubserviceType aType, TBool& aSupported ) const = 0;
|
|
268 |
|
|
269 |
protected:
|
|
270 |
|
|
271 |
virtual ~CCchService() { };
|
|
272 |
};
|
|
273 |
|
|
274 |
/**
|
|
275 |
* Class for basic cch functionality, getting services
|
|
276 |
*
|
|
277 |
* @code
|
|
278 |
* ?good_class_usage_example(s)
|
|
279 |
* @endcode
|
|
280 |
*
|
|
281 |
* @lib cch
|
|
282 |
*/
|
|
283 |
class CCch : public CBase
|
|
284 |
{
|
|
285 |
|
|
286 |
public:
|
|
287 |
|
|
288 |
/**
|
|
289 |
* Two-phased constructor.
|
|
290 |
*/
|
|
291 |
IMPORT_C static CCch* NewL();
|
|
292 |
|
|
293 |
/**
|
|
294 |
* Two-phased constructor.
|
|
295 |
*/
|
|
296 |
IMPORT_C static CCch* NewLC();
|
|
297 |
|
|
298 |
/**
|
|
299 |
* Destructor.
|
|
300 |
*/
|
|
301 |
~CCch();
|
|
302 |
|
|
303 |
/**
|
|
304 |
* Returns one service
|
|
305 |
*
|
|
306 |
* @param aId Service id
|
|
307 |
* @return Service or NULL if not found. Ownership is not transferred.
|
|
308 |
*/
|
|
309 |
IMPORT_C CCchService* GetService( TInt aId );
|
|
310 |
|
|
311 |
/**
|
|
312 |
* Returns service ids of all configured services
|
|
313 |
*
|
|
314 |
* @param aIds Array of TInt to be filled with ids
|
|
315 |
* @return Symbian error code
|
|
316 |
*/
|
|
317 |
IMPORT_C TInt GetServiceIds( RArray<TInt>& aIds ) const;
|
|
318 |
|
|
319 |
/**
|
|
320 |
* Returns services fulfilling the search criteria
|
|
321 |
*
|
|
322 |
* @param aType Service type
|
|
323 |
* @param aServices Array of CCchService to be filled
|
|
324 |
* @return Symbian error code
|
|
325 |
*/
|
|
326 |
IMPORT_C TInt GetServices( TCCHSubserviceType aType,
|
|
327 |
RPointerArray<CCchService>& aServices );
|
|
328 |
|
|
329 |
/**
|
|
330 |
* Returns ETrue if connectivity dialogs are allowed in service enabling.
|
|
331 |
*
|
|
332 |
* @return ETrue if connectivity dialogs are allowed in service enabling
|
|
333 |
*/
|
|
334 |
IMPORT_C TBool ConnectivityDialogsAllowed() const;
|
|
335 |
|
|
336 |
/**
|
|
337 |
* For allowing/disallowing connectivity dialogs showing in
|
|
338 |
* service enabling.
|
|
339 |
*
|
|
340 |
* @param aConnectivityDialogsAllowed Boolean to set connectivity dialogs
|
|
341 |
* allowed/disallowed
|
|
342 |
*/
|
|
343 |
IMPORT_C void SetConnectivityDialogsAllowed(
|
|
344 |
TBool aConnectivityDialogsAllowed );
|
|
345 |
|
|
346 |
/**
|
|
347 |
* For getting cchui api.
|
|
348 |
*
|
|
349 |
* @return reference to cchui api.
|
|
350 |
*/
|
|
351 |
IMPORT_C MCchUi& CchUiApi() const;
|
|
352 |
|
|
353 |
protected:
|
|
354 |
|
|
355 |
/**
|
|
356 |
* The constructor
|
|
357 |
*/
|
|
358 |
CCch();
|
|
359 |
|
|
360 |
private:
|
|
361 |
|
|
362 |
/**
|
|
363 |
* By default Symbian 2nd phase constructor is private.
|
|
364 |
*/
|
|
365 |
void ConstructL();
|
|
366 |
|
|
367 |
private: // data
|
|
368 |
|
|
369 |
/**
|
|
370 |
* Cch client implementation
|
|
371 |
* Own.
|
|
372 |
*/
|
|
373 |
CCchImpl* iImplementation;
|
|
374 |
|
|
375 |
#ifdef CCHUI_EUNIT
|
|
376 |
friend class UT_CchUi;
|
|
377 |
#endif
|
|
378 |
};
|
|
379 |
|
|
380 |
#endif // C_CCH_H
|