1 /* |
|
2 * 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.cpp |
|
15 * |
|
16 */ |
|
17 |
|
18 // EXTERNAL INCLUDES |
|
19 |
|
20 #include <cch.h> |
|
21 #include <cchtypes.h> |
|
22 #include <spentry.h> |
|
23 #include <spsettings.h> |
|
24 #include <spproperty.h> |
|
25 #include "s_cch.h" |
|
26 |
|
27 CCchService* myService = NULL; |
|
28 |
|
29 |
|
30 |
|
31 TInt CreateSpEntryL( TInt aServiceId ) |
|
32 { |
|
33 CSPSettings* myCSPSettings = CSPSettings::NewL(); |
|
34 CSPEntry* entry = CSPEntry::NewLC(); |
|
35 entry->SetServiceId( aServiceId ); |
|
36 User::LeaveIfError( entry->SetServiceName( KTestServiceName ) ); |
|
37 CSPProperty* property = NULL; |
|
38 // set voip enabled property |
|
39 property = CSPProperty::NewLC(); |
|
40 property->SetName( ESubPropertyVoIPEnabled ); |
|
41 property->SetValue( EOn ); |
|
42 entry->AddPropertyL( *property ); |
|
43 CleanupStack::PopAndDestroy( property ); |
|
44 |
|
45 // set presence settings id property |
|
46 property = CSPProperty::NewLC(); |
|
47 property->SetName( ESubPropertyPresenceSettingsId ); |
|
48 property->SetValue( 1 ); |
|
49 entry->AddPropertyL( *property ); |
|
50 CleanupStack::PopAndDestroy( property ); |
|
51 |
|
52 // set im settings id property |
|
53 property = CSPProperty::NewLC(); |
|
54 property->SetName( ESubPropertyIMSettingsId ); |
|
55 property->SetValue( 1 ); |
|
56 entry->AddPropertyL( *property ); |
|
57 CleanupStack::PopAndDestroy( property ); |
|
58 |
|
59 // set Presence FW PSC plugin UID |
|
60 property = CSPProperty::NewLC(); |
|
61 property->SetName( EPropertyPCSPluginId ); |
|
62 property->SetValue( 0x20007B6D ); |
|
63 entry->AddPropertyL( *property ); |
|
64 CleanupStack::PopAndDestroy( property ); |
|
65 |
|
66 property = CSPProperty::NewLC(); |
|
67 property->SetName( EPropertyContactViewPluginId ); |
|
68 property->SetValue( KMECOIMPLEMENTATIONUID ); |
|
69 entry->AddPropertyL( *property ); |
|
70 CleanupStack::PopAndDestroy( property ); |
|
71 |
|
72 |
|
73 myCSPSettings->AddEntryL( *entry ); |
|
74 TInt createdServiceId = entry->GetServiceId(); |
|
75 CleanupStack::PopAndDestroy( entry ); |
|
76 |
|
77 return createdServiceId; |
|
78 } |
|
79 |
|
80 |
|
81 /*************** Stubs ****************/ |
|
82 CCchService* CCch::GetService( TInt /*aServiceId*/ ) |
|
83 { |
|
84 if( !myService ) |
|
85 { |
|
86 myService = new ( ELeave ) MyCchService(); |
|
87 return myService; |
|
88 } |
|
89 return myService; |
|
90 } |
|
91 /*************** Stubs ****************/ |
|
92 |
|
93 CCch::CCch() |
|
94 { |
|
95 |
|
96 } |
|
97 |
|
98 CCch::~CCch() |
|
99 { |
|
100 if(myService) |
|
101 { |
|
102 myService = NULL; |
|
103 } |
|
104 |
|
105 } |
|
106 // --------------------------------------------------------------------------- |
|
107 // CCch::NewL |
|
108 // Two-phased constructor. |
|
109 // --------------------------------------------------------------------------- |
|
110 // |
|
111 CCch* CCch::NewL( ) |
|
112 { |
|
113 CCch* self = CCch::NewLC( ); |
|
114 CleanupStack::Pop( self ); |
|
115 return self; |
|
116 } |
|
117 // --------------------------------------------------------------------------- |
|
118 // CCch::ConstructL |
|
119 // Symbian 2nd phase constructor can leave. |
|
120 // --------------------------------------------------------------------------- |
|
121 // |
|
122 void CCch::ConstructL() |
|
123 { |
|
124 //iImplementation = CCchImpl::NewL( this ); |
|
125 |
|
126 } |
|
127 // --------------------------------------------------------------------------- |
|
128 // CCch::NewLC |
|
129 // Two-phased constructor. |
|
130 // --------------------------------------------------------------------------- |
|
131 // |
|
132 CCch* CCch::NewLC( ) |
|
133 { |
|
134 CCch* self = new (ELeave) CCch( ); |
|
135 CleanupStack::PushL( self ); |
|
136 self->ConstructL(); |
|
137 return self; |
|
138 } |
|
139 |
|
140 // --------------------------------------------------------------------------- |
|
141 // CCchUIHandler::GetServiceIds |
|
142 // --------------------------------------------------------------------------- |
|
143 // |
|
144 TInt CCch::GetServiceIds( RArray<TInt>& aIds ) const |
|
145 { |
|
146 |
|
147 } |
|
148 |
|
149 // --------------------------------------------------------------------------- |
|
150 // CCchUIHandler::GetServiceIds |
|
151 // --------------------------------------------------------------------------- |
|
152 // |
|
153 TInt CCch::GetServices( TCCHSubserviceType aType, |
|
154 RPointerArray<CCchService>& aServices ) |
|
155 { |
|
156 |
|
157 } |
|
158 |
|
159 // --------------------------------------------------------------------------- |
|
160 // CCchUIHandler::ConnectivityDialogsAllowed |
|
161 // --------------------------------------------------------------------------- |
|
162 // |
|
163 TBool CCch::ConnectivityDialogsAllowed() const |
|
164 { |
|
165 |
|
166 } |
|
167 |
|
168 // --------------------------------------------------------------------------- |
|
169 // CCchUIHandler::SetConnectivityDialogsAllowed |
|
170 // --------------------------------------------------------------------------- |
|
171 // |
|
172 void CCch::SetConnectivityDialogsAllowed( |
|
173 TBool aConnectivityDialogsAllowed ) |
|
174 { |
|
175 } |
|
176 // ========================== OTHER EXPORTED FUNCTIONS ========================= |
|
177 // -------------------------------------------------------------------------- |
|
178 // TCchServiceStatus::TCchServiceStatus |
|
179 // -------------------------------------------------------------------------- |
|
180 // |
|
181 TCchServiceStatus::TCchServiceStatus() |
|
182 : iState( ECCHUninitialized ) |
|
183 , iError( KErrNone ) |
|
184 { |
|
185 } |
|
186 |
|
187 // -------------------------------------------------------------------------- |
|
188 // TCchServiceStatus::State |
|
189 // -------------------------------------------------------------------------- |
|
190 // |
|
191 TCCHSubserviceState TCchServiceStatus::State() const |
|
192 { |
|
193 return iState; |
|
194 } |
|
195 |
|
196 // -------------------------------------------------------------------------- |
|
197 // TCchServiceStatus::Error |
|
198 // -------------------------------------------------------------------------- |
|
199 // |
|
200 TInt TCchServiceStatus::Error() const |
|
201 { |
|
202 return iError; |
|
203 } |
|
204 |
|
205 // -------------------------------------------------------------------------- |
|
206 // TCchServiceStatus::SetState |
|
207 // -------------------------------------------------------------------------- |
|
208 // |
|
209 void TCchServiceStatus::SetState( TCCHSubserviceState aState ) |
|
210 { |
|
211 iState = aState; |
|
212 } |
|
213 |
|
214 // -------------------------------------------------------------------------- |
|
215 // TCchServiceStatus::SetError |
|
216 // -------------------------------------------------------------------------- |
|
217 // |
|
218 void TCchServiceStatus::SetError( TInt aError ) |
|
219 { |
|
220 iError = aError; |
|
221 } |
|
222 // End of File |
|
223 |
|
224 /************* End of Stubs ************/ |
|
225 |
|
226 |
|
227 |
|
228 TInt MyCchService::Enable( TCCHSubserviceType aType ) |
|
229 { |
|
230 return KErrNone; |
|
231 } |
|
232 |
|
233 /** |
|
234 * Launches service disable. See MCchServiceObserver for status changes. |
|
235 * |
|
236 * @param aType Type of service |
|
237 * @return Symbian error |
|
238 */ |
|
239 TInt MyCchService::Disable( TCCHSubserviceType /*aType*/ ){ return KErrNone; } |
|
240 |
|
241 /** |
|
242 * Returns the current service state |
|
243 * |
|
244 * @param aType Type of service |
|
245 * @param aStatus Status of the service, return value |
|
246 * @return Symbian error code |
|
247 */ |
|
248 TInt MyCchService::GetStatus( TCCHSubserviceType aType, |
|
249 TCchServiceStatus& aStatus ) const |
|
250 |
|
251 { |
|
252 if ( (ECCHIMSub == aType) ) |
|
253 { |
|
254 aStatus.SetState(ECCHEnabled); |
|
255 aStatus.SetError(KErrNone); |
|
256 return KErrNone; |
|
257 } |
|
258 |
|
259 return KErrNotFound ; |
|
260 |
|
261 } |
|
262 |
|
263 /** |
|
264 * Returns the connection parameters |
|
265 * |
|
266 * @param aType Type of service |
|
267 * @param aParameter Connection parameter of the service |
|
268 * @param aValue Value of the parameter |
|
269 * @return Symbian error code |
|
270 */ |
|
271 TInt MyCchService::GetConnectionParameter( TCCHSubserviceType /*aType*/, |
|
272 TCchConnectionParameter /*aParameter*/, TInt& /*aValue*/ ) const{ return KErrNone;} |
|
273 |
|
274 /** |
|
275 * Returns the connection parameters |
|
276 * |
|
277 * @param aType Type of service |
|
278 * @param aParameter Connection parameter of the service |
|
279 * @param aValue Value of the parameter |
|
280 * @return Symbian error code |
|
281 */ |
|
282 TInt MyCchService::GetConnectionParameter( TCCHSubserviceType /*aType*/, |
|
283 TCchConnectionParameter aParameter, RBuf& aValue ) const |
|
284 |
|
285 { |
|
286 if (aParameter == ECchUsername) |
|
287 { |
|
288 TBuf<512> username; |
|
289 username = KTestUserName; |
|
290 aValue.Copy(username); |
|
291 return KErrNone; |
|
292 } |
|
293 |
|
294 return KErrNotFound; |
|
295 } |
|
296 |
|
297 /** |
|
298 * Sets the connection parameters |
|
299 * |
|
300 * @param aType The type of service |
|
301 * @param aParameter Connection parameter of the service |
|
302 * @param aValue Value of the parameter |
|
303 * @return Symbian error code |
|
304 */ |
|
305 TInt MyCchService::SetConnectionParameter( TCCHSubserviceType /*aType*/, |
|
306 TCchConnectionParameter /*aParameter*/, TInt /*aValue*/ ) |
|
307 |
|
308 { |
|
309 return KErrNone; |
|
310 } |
|
311 |
|
312 /** |
|
313 * Sets the connection parameters |
|
314 * |
|
315 * @param aType The type of service |
|
316 * @param aParameter Connection parameter of the service |
|
317 * @param aValue Value of the parameter |
|
318 * @return Symbian error code |
|
319 */ |
|
320 TInt MyCchService::SetConnectionParameter( TCCHSubserviceType /*aType*/, |
|
321 TCchConnectionParameter /*aParameter*/, const TDesC& /*aValue*/ ) |
|
322 { |
|
323 return KErrNone; |
|
324 } |
|
325 |
|
326 /** |
|
327 * Reserves the service for exclusive usage |
|
328 * |
|
329 * @param aType Type of service |
|
330 * @return Symbian error code |
|
331 */ |
|
332 TInt MyCchService::Reserve( TCCHSubserviceType /*aType*/ ){ return KErrNone; } |
|
333 |
|
334 /** |
|
335 * Frees the service of exclusive usage |
|
336 * |
|
337 * @param aType Type of service |
|
338 * @return Symbian error code |
|
339 */ |
|
340 TInt MyCchService::Free( TCCHSubserviceType /*aType*/ ){ return KErrNone; } |
|
341 |
|
342 /** |
|
343 * Is the service reserved |
|
344 * |
|
345 * @param aType Type of service |
|
346 * @param aReserved True if the service is reserved |
|
347 * @return Symbian error code |
|
348 */ |
|
349 TInt MyCchService::IsReserved( TCCHSubserviceType /*aType*/, TBool& /*aReserved*/ ) const{ return KErrNone; } |
|
350 |
|
351 /** |
|
352 * Returns the service id |
|
353 * |
|
354 * @return The id of the service |
|
355 */ |
|
356 TInt MyCchService::ServiceId() const{ return KErrNone; } |
|
357 |
|
358 /** |
|
359 * @deprecated Do not use this anymore, change to AddObserver! |
|
360 * |
|
361 * Adds observer for listening service events |
|
362 * |
|
363 * @param aObserver Event observing class |
|
364 */ |
|
365 void MyCchService::SetObserver( MCchServiceStatusObserver& aObserver ) |
|
366 { |
|
367 iObserver = &aObserver; |
|
368 } |
|
369 |
|
370 /** |
|
371 * @deprecated Do not use this anymore, change to |
|
372 * RemoveObserver method with paramater |
|
373 * |
|
374 * Removes the observer of service events |
|
375 */ |
|
376 void MyCchService::RemoveObserver( ) |
|
377 { |
|
378 iObserver = NULL; |
|
379 } |
|
380 |
|
381 |
|
382 /** |
|
383 * Adds observer for listening service events |
|
384 * |
|
385 * @param aObserver Event observing class |
|
386 * @return KErrAlreadyExist Observer already added |
|
387 * KErrNone Observer was added |
|
388 */ |
|
389 TInt MyCchService::AddObserver( MCchServiceStatusObserver& /*aObserver*/ ){ return KErrNone; } |
|
390 |
|
391 /** |
|
392 * Removes the observer of service events |
|
393 * |
|
394 * @param aObserver Event observing class |
|
395 * @return KErrNotFound Observer was not found |
|
396 * KErrNone Observer was removed |
|
397 */ |
|
398 TInt MyCchService::RemoveObserver( MCchServiceStatusObserver& /*aObserver*/ ){ return KErrNone; } |
|
399 |
|
400 /** |
|
401 * Checks if the type is supported |
|
402 * |
|
403 * @param aType Type of service |
|
404 * @param aSupported True if the service type is supported |
|
405 * @return Symbian error code |
|
406 */ |
|
407 TInt MyCchService::IsSupported( TCCHSubserviceType /*aType*/, TBool& /*aSupported*/ ) const{ return KErrNone; } |
|
408 |
|
409 |
|
410 //end of file |
|
411 |
|
412 |
|
413 |
|