|
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: cch client api implementation class |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 |
|
20 #ifndef C_CCHIMPL_H |
|
21 #define C_CCHIMPL_H |
|
22 |
|
23 #include <e32base.h> |
|
24 #include <ccherror.h> |
|
25 #include <cchtypes.h> |
|
26 #include "cch.h" |
|
27 #include "cchclient.h" |
|
28 #include "cchuiprivateapi.h" |
|
29 #include "cchuicommon.hrh" |
|
30 |
|
31 class CCchService; |
|
32 class CCchServiceImpl; |
|
33 |
|
34 // flag cchui support on. This is temporary fix until cchui is integrated into builds. |
|
35 #define CCHAPI_USE_CCHUI |
|
36 |
|
37 #ifdef CCHAPI_USE_CCHUI |
|
38 class CCchUiPrivateApi; |
|
39 #else |
|
40 #define CCchUiPrivateApi TInt |
|
41 #endif |
|
42 |
|
43 // DATA TYPES |
|
44 typedef RPointerArray<CCchServiceImpl> RServiceImplArray; |
|
45 |
|
46 /** |
|
47 * Class for basic cch functionality, getting services |
|
48 * |
|
49 * @code |
|
50 * ?good_class_usage_example(s) |
|
51 * @endcode |
|
52 * |
|
53 * @lib cch |
|
54 */ |
|
55 class CCchImpl : public CActive |
|
56 { |
|
57 |
|
58 public: |
|
59 |
|
60 /** |
|
61 * Two-phased constructor. |
|
62 */ |
|
63 static CCchImpl* NewL( CCch& aCch ); |
|
64 |
|
65 /** |
|
66 * Two-phased constructor. |
|
67 */ |
|
68 static CCchImpl* NewLC( CCch& aCch ); |
|
69 |
|
70 /** |
|
71 * Destructor. |
|
72 */ |
|
73 ~CCchImpl(); |
|
74 |
|
75 /** |
|
76 * Returns the RCCHClient |
|
77 * |
|
78 * @return The used client |
|
79 */ |
|
80 RCCHClient& CchClient(); |
|
81 |
|
82 /** |
|
83 * Returns one service |
|
84 * |
|
85 * @param aId Service id |
|
86 * @return Cch service or NULL if service not found |
|
87 */ |
|
88 CCchService* GetService( TInt aId ); |
|
89 |
|
90 /** |
|
91 * Returns service ids of all configured services |
|
92 * |
|
93 * @param aIds Array of TInt to be filled with service ids |
|
94 * @return Symbian error code |
|
95 */ |
|
96 TInt GetServiceIds( RArray<TInt>& aIds ); |
|
97 |
|
98 /** |
|
99 * Returns services fulfilling the search criteria |
|
100 * |
|
101 * @param aType Service type |
|
102 * @param aServices Array of CCchService to be filled |
|
103 * @return Symbian error code |
|
104 */ |
|
105 TInt GetServices( TCCHSubserviceType aType, |
|
106 RPointerArray<CCchService>& aServices ); |
|
107 |
|
108 |
|
109 /** |
|
110 * Returns ETrue if connectivity dialogs are allowed in service enabling. |
|
111 * |
|
112 * @return ETrue if connectivity dialogs are allowed in service enabling |
|
113 */ |
|
114 TBool ConnectivityDialogsAllowed() const; |
|
115 |
|
116 |
|
117 /** |
|
118 * For allowing/disallowing connectivity dialogs showing in |
|
119 * service enabling. |
|
120 * |
|
121 * @param aConnectivityDialogsAllowed Boolean to set connectivity dialogs |
|
122 * allowed/disallowed |
|
123 */ |
|
124 void SetConnectivityDialogsAllowed( TBool aConnectivityDialogsAllowed ); |
|
125 |
|
126 |
|
127 /** |
|
128 * For getting cchui api. |
|
129 * |
|
130 * @return reference to cchui api. |
|
131 */ |
|
132 MCchUi& CchUiApi() const; |
|
133 |
|
134 |
|
135 /** |
|
136 * Finds out if corresponding Cch service exists already |
|
137 * |
|
138 * @param aServiceId Service Id |
|
139 * @return Index of the service or KErrNotFound if does not exist |
|
140 */ |
|
141 TInt FindService( TInt aServiceId ) const; |
|
142 |
|
143 private: //from CActive |
|
144 |
|
145 /** |
|
146 * @see CActive. |
|
147 */ |
|
148 void RunL(); |
|
149 |
|
150 /** |
|
151 * @see CActive. |
|
152 */ |
|
153 void DoCancel(); |
|
154 |
|
155 /** |
|
156 * @see CActive |
|
157 */ |
|
158 TInt RunError(TInt aError); |
|
159 |
|
160 private: |
|
161 |
|
162 /** |
|
163 * The constructor |
|
164 */ |
|
165 CCchImpl(); |
|
166 |
|
167 /** |
|
168 * By default Symbian 2nd phase constructor is private. |
|
169 */ |
|
170 void ConstructL( CCch& aCch ); |
|
171 |
|
172 /** |
|
173 * Queries the services from CCH client. |
|
174 * |
|
175 * @param aType Type of the service |
|
176 * @param aServices Array of CCchServices to be filled |
|
177 */ |
|
178 void GetServicesL( TCCHSubserviceType aType, |
|
179 RPointerArray<CCchService>& aServices ); |
|
180 |
|
181 /** |
|
182 * Queries the services from CCH client. |
|
183 * |
|
184 * @param aServiceId If of the service |
|
185 * @param aType Type of the service |
|
186 * @param aServices Array of CCchServices to be filled |
|
187 * @return Symbian error |
|
188 */ |
|
189 TInt GetCchServicesL( TInt aServiceId, TCCHSubserviceType aType, |
|
190 CArrayFixFlat<TCCHService>& aServices ); |
|
191 |
|
192 /** |
|
193 * Queries a service from CCH Client by id. |
|
194 * @param aId The id of the queried service |
|
195 * @return Pointer to the queried service |
|
196 */ |
|
197 CCchServiceImpl* GetServiceL( TInt aId ); |
|
198 |
|
199 |
|
200 /** |
|
201 * Returns service ids of all configured services, leave function |
|
202 * |
|
203 * @param aIds Array of TInt to be filled with service ids |
|
204 */ |
|
205 void GetServiceIdsL( RArray<TInt>& aIds ); |
|
206 |
|
207 private: // data |
|
208 |
|
209 /** |
|
210 * Own: CCH Server |
|
211 */ |
|
212 RCCHServer iCchServer; |
|
213 |
|
214 /** |
|
215 * Own: CCH Client |
|
216 */ |
|
217 RCCHClient iCchClient; |
|
218 |
|
219 /** |
|
220 * array the for new cch services |
|
221 */ |
|
222 RServiceImplArray iCchServiceImpls; |
|
223 |
|
224 /** |
|
225 * Own: Cch UI handling interface |
|
226 */ |
|
227 CCchUiPrivateApi* iCchUi; |
|
228 |
|
229 /** |
|
230 * Flag which indicates if cchui connectivity dialogs are used when |
|
231 * enabling service. |
|
232 */ |
|
233 TBool iConnectivityDialogsAllowed; |
|
234 |
|
235 CCHUI_UNIT_TEST( UT_CchUi ) |
|
236 }; |
|
237 |
|
238 #endif // C_CCHIMPL_H |