|
1 /* |
|
2 * Copyright (c) 2008 - 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 the License "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: File containing Test Data at the global level (used by different test objects) |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 |
|
20 |
|
21 // INCLUDE FILES |
|
22 #include "telepathygabbletestdata.h" |
|
23 #include <StifLogger.h> |
|
24 |
|
25 //----------------------------------------------------------------------------- |
|
26 // function_name : CTestData |
|
27 // description : Constructor |
|
28 // Returns : None |
|
29 //----------------------------------------------------------------------------- |
|
30 |
|
31 CTestData::CTestData(CStifLogger *aLogger) |
|
32 : iLogger(aLogger) |
|
33 { |
|
34 } |
|
35 |
|
36 //----------------------------------------------------------------------------- |
|
37 // function_name : ConstructL |
|
38 // description : Constructor |
|
39 // Returns : None |
|
40 //----------------------------------------------------------------------------- |
|
41 |
|
42 void CTestData::ConstructL() |
|
43 { |
|
44 iConnectionState = EDISCONNECTED; //default. |
|
45 iTestType = EOther; |
|
46 //Create the mainloop and also add the callback. |
|
47 iMainLoop = g_main_loop_new (NULL, FALSE); |
|
48 iSendRecvState = EMessageNotSent; |
|
49 iAddDeleteContactStatus = EADD_FAIL; |
|
50 iSearchState = ESearchStarted; |
|
51 iSearchKeys = g_new0( gchar*, 1); |
|
52 } |
|
53 |
|
54 //----------------------------------------------------------------------------- |
|
55 // function_name : NewL |
|
56 // description : Constructor |
|
57 // Returns : None |
|
58 //----------------------------------------------------------------------------- |
|
59 CTestData* CTestData::NewL(CStifLogger *aLogger) |
|
60 { |
|
61 |
|
62 CTestData* self = new(ELeave) CTestData(aLogger); |
|
63 CleanupStack::PushL( self ); |
|
64 self->ConstructL(); |
|
65 CleanupStack::Pop(); |
|
66 return self; |
|
67 } |
|
68 |
|
69 //----------------------------------------------------------------------------- |
|
70 // function_name : ~CTestData |
|
71 // description : destructor |
|
72 // Returns : None |
|
73 //----------------------------------------------------------------------------- |
|
74 CTestData::~CTestData() |
|
75 { |
|
76 |
|
77 if( iLogger ) |
|
78 { |
|
79 iLogger->Log( _L("~CTestData in\n") ); |
|
80 } |
|
81 //Destroy the hash table for text channels |
|
82 |
|
83 if( iTextChannelHashTable ) |
|
84 { |
|
85 g_hash_table_destroy( iTextChannelHashTable ); |
|
86 iTextChannelHashTable = NULL; |
|
87 } |
|
88 |
|
89 //Dbus connection object |
|
90 if( iDBusConnection ) |
|
91 { |
|
92 dbus_g_connection_unref (iDBusConnection); |
|
93 iDBusConnection = NULL; |
|
94 } |
|
95 |
|
96 if( iTpConnMgr ) |
|
97 { |
|
98 g_object_unref (iTpConnMgr); |
|
99 iTpConnMgr = NULL; |
|
100 } |
|
101 |
|
102 //tp conn object |
|
103 if( iTpConn ) |
|
104 { |
|
105 g_object_unref (iTpConn); |
|
106 iTpConn = NULL; |
|
107 } |
|
108 |
|
109 //main loop |
|
110 if( iMainLoop ) |
|
111 { |
|
112 g_main_loop_unref ( iMainLoop ); |
|
113 iMainLoop = NULL; |
|
114 } |
|
115 |
|
116 |
|
117 if( iSearchKeys ) |
|
118 { |
|
119 for( TInt i=0; iSearchKeys[i]; i++ ) |
|
120 { |
|
121 g_free( iSearchKeys[i] ); |
|
122 iSearchKeys[i] = NULL; |
|
123 } |
|
124 g_free( iSearchKeys ); |
|
125 iSearchKeys = NULL; |
|
126 } |
|
127 |
|
128 if( iLogger ) |
|
129 { |
|
130 iLogger->Log( _L("~CTestData out\n") ); |
|
131 } |
|
132 } |
|
133 |
|
134 //----------------------------------------------------------------------------- |
|
135 // function_name : CTestData |
|
136 // description : GetStifLogger |
|
137 //----------------------------------------------------------------------------- |
|
138 |
|
139 CStifLogger* CTestData::GetStifLogger() |
|
140 { |
|
141 return iLogger; |
|
142 } |
|
143 |
|
144 |
|
145 //----------------------------------------------------------------------------- |
|
146 // function_name : CTestData |
|
147 // description : GetMainLoop |
|
148 //----------------------------------------------------------------------------- |
|
149 |
|
150 GMainLoop* CTestData::GetMainLoop() |
|
151 { |
|
152 return iMainLoop; |
|
153 } |
|
154 |
|
155 //----------------------------------------------------------------------------- |
|
156 // function_name : CTestData |
|
157 // description : GetGroupSubscribeInterface |
|
158 //----------------------------------------------------------------------------- |
|
159 |
|
160 DBusGProxy* CTestData::GetGroupSubscribeInterface() |
|
161 { |
|
162 return iGroupSubscribeInterface; |
|
163 } |
|
164 |
|
165 //----------------------------------------------------------------------------- |
|
166 // function_name : CTestData |
|
167 // description : GetGroupKnownInterface |
|
168 //----------------------------------------------------------------------------- |
|
169 |
|
170 DBusGProxy* CTestData::GetGroupKnownInterface() |
|
171 { |
|
172 return iGroupKnownInterface; |
|
173 } |
|
174 |
|
175 //----------------------------------------------------------------------------- |
|
176 // function_name : CTestData |
|
177 // description : GetGroupPublishInterface |
|
178 //----------------------------------------------------------------------------- |
|
179 |
|
180 DBusGProxy* CTestData::GetGroupPublishInterface() |
|
181 { |
|
182 return iGroupPublishInterface; |
|
183 } |
|
184 //----------------------------------------------------------------------------- |
|
185 // function_name : CTestData |
|
186 // description : GetGroupDenyInterface |
|
187 //----------------------------------------------------------------------------- |
|
188 |
|
189 DBusGProxy* CTestData::GetGroupDenyInterface() |
|
190 { |
|
191 return iGroupDenyInterface; |
|
192 } |
|
193 //----------------------------------------------------------------------------- |
|
194 // function_name : CTestData |
|
195 // description : GetTextChannelsHT |
|
196 //----------------------------------------------------------------------------- |
|
197 |
|
198 GHashTable* CTestData::GetTextChannelsHT() |
|
199 { |
|
200 return iTextChannelHashTable; |
|
201 } |
|
202 |
|
203 //----------------------------------------------------------------------------- |
|
204 // function_name : CTestData |
|
205 // description : SetGroupSubscribeInterface |
|
206 //----------------------------------------------------------------------------- |
|
207 |
|
208 void CTestData::SetGroupSubscribeInterface( DBusGProxy* aGroupSubscribeInterface ) |
|
209 { |
|
210 iGroupSubscribeInterface = aGroupSubscribeInterface; |
|
211 } |
|
212 |
|
213 //----------------------------------------------------------------------------- |
|
214 // function_name : CTestData |
|
215 // description : GetGroupKnownInterface |
|
216 //----------------------------------------------------------------------------- |
|
217 |
|
218 void CTestData::SetGroupKnownInterface( DBusGProxy* aGroupKnownInterface ) |
|
219 { |
|
220 iGroupKnownInterface = aGroupKnownInterface; |
|
221 } |
|
222 |
|
223 //----------------------------------------------------------------------------- |
|
224 // function_name : CTestData |
|
225 // description : GetGroupPublishInterface |
|
226 //----------------------------------------------------------------------------- |
|
227 |
|
228 void CTestData::SetGroupPublishInterface( DBusGProxy* aGroupPublishInterface ) |
|
229 { |
|
230 iGroupPublishInterface = aGroupPublishInterface; |
|
231 } |
|
232 //----------------------------------------------------------------------------- |
|
233 // function_name : CTestData |
|
234 // description : GetGroupDenyInterface |
|
235 //----------------------------------------------------------------------------- |
|
236 void CTestData::SetGroupDenyInterface(DBusGProxy* aGroupDenyInterface) |
|
237 { |
|
238 iGroupDenyInterface = aGroupDenyInterface; |
|
239 } |
|
240 //----------------------------------------------------------------------------- |
|
241 // function_name : CTestData |
|
242 // description : GetTextChannelsHT |
|
243 //----------------------------------------------------------------------------- |
|
244 |
|
245 void CTestData::SetTextChannelsHT( GHashTable* aTextChannelHashTable ) |
|
246 { |
|
247 iTextChannelHashTable = aTextChannelHashTable; |
|
248 } |
|
249 |
|
250 |
|
251 //----------------------------------------------------------------------------- |
|
252 // function_name : CTestData |
|
253 // description : GetDBusConnection |
|
254 //----------------------------------------------------------------------------- |
|
255 DBusGConnection* CTestData::GetDBusConnection() |
|
256 { |
|
257 return iDBusConnection; |
|
258 } |
|
259 |
|
260 //----------------------------------------------------------------------------- |
|
261 // function_name : CTestData |
|
262 // description : SetDBusConnection |
|
263 //----------------------------------------------------------------------------- |
|
264 void CTestData::SetDBusConnection( DBusGConnection* aDBusConnection ) |
|
265 { |
|
266 iDBusConnection = aDBusConnection; |
|
267 } |
|
268 |
|
269 //----------------------------------------------------------------------------- |
|
270 // function_name : CTestData |
|
271 /// description : GetTpConn |
|
272 //----------------------------------------------------------------------------- |
|
273 |
|
274 TpConn* CTestData::GetTpConn() |
|
275 { |
|
276 return iTpConn; |
|
277 } |
|
278 |
|
279 //----------------------------------------------------------------------------- |
|
280 // function_name : CTestData |
|
281 /// description : SetTpConn |
|
282 //----------------------------------------------------------------------------- |
|
283 |
|
284 void CTestData::SetTpConn(TpConn* aTpConn) |
|
285 { |
|
286 iTpConn = aTpConn; |
|
287 } |
|
288 |
|
289 //----------------------------------------------------------------------------- |
|
290 // function_name : CTestData |
|
291 /// description : SetTpConnMgr |
|
292 //----------------------------------------------------------------------------- |
|
293 |
|
294 void CTestData::SetTpConnMgr(TpConnMgr* aTpConnMgr) |
|
295 { |
|
296 iTpConnMgr = aTpConnMgr; |
|
297 } |
|
298 |
|
299 |
|
300 //----------------------------------------------------------------------------- |
|
301 // function_name : CTestData |
|
302 /// description : GetLoginCompleteFlag |
|
303 //----------------------------------------------------------------------------- |
|
304 |
|
305 TInt CTestData::GetLoginCompleteFlag() |
|
306 { |
|
307 return iLoginComplete; |
|
308 } |
|
309 |
|
310 |
|
311 //----------------------------------------------------------------------------- |
|
312 // function_name : CTestData |
|
313 /// description : IncLoginCompleteFlag |
|
314 //----------------------------------------------------------------------------- |
|
315 |
|
316 void CTestData::IncLoginCompleteFlag() |
|
317 { |
|
318 iLoginComplete++; |
|
319 } |
|
320 |
|
321 //----------------------------------------------------------------------------- |
|
322 // function_name : CTestData |
|
323 /// description : ResetLoginCompleteFlag |
|
324 //----------------------------------------------------------------------------- |
|
325 |
|
326 void CTestData::ResetLoginCompleteFlag() |
|
327 { |
|
328 iLoginComplete = 0; |
|
329 } |
|
330 |
|
331 |
|
332 //----------------------------------------------------------------------------- |
|
333 // function_name : CTestData |
|
334 /// description : GetTotalFetchCount |
|
335 //----------------------------------------------------------------------------- |
|
336 |
|
337 TInt CTestData::GetTotalFetchCount() |
|
338 { |
|
339 return iTotalFetchCount; |
|
340 } |
|
341 |
|
342 //----------------------------------------------------------------------------- |
|
343 // function_name : CTestData |
|
344 /// description : GetLastIndexInFetch |
|
345 //----------------------------------------------------------------------------- |
|
346 |
|
347 TInt CTestData::GetLastIndexInFetch() |
|
348 { |
|
349 return iLastIndex; |
|
350 } |
|
351 |
|
352 //----------------------------------------------------------------------------- |
|
353 // function_name : CTestData |
|
354 /// description : SetLastIndexInFetch |
|
355 //----------------------------------------------------------------------------- |
|
356 |
|
357 void CTestData::SetLastIndexInFetch( TInt aLastIndex ) |
|
358 { |
|
359 iLastIndex = aLastIndex; |
|
360 } |
|
361 |
|
362 //----------------------------------------------------------------------------- |
|
363 // function_name : CTestData |
|
364 /// description : SetTotalFetchCount |
|
365 //----------------------------------------------------------------------------- |
|
366 |
|
367 void CTestData::SetTotalFetchCount(TInt aValue) |
|
368 { |
|
369 iTotalFetchCount = aValue; |
|
370 } |
|
371 |
|
372 //----------------------------------------------------------------------------- |
|
373 // function_name : CTestData |
|
374 /// description : GetTotalFetchCount |
|
375 //----------------------------------------------------------------------------- |
|
376 |
|
377 CTestData::TConnectionState CTestData::GetConnectionState() |
|
378 { |
|
379 return iConnectionState; |
|
380 } |
|
381 //----------------------------------------------------------------------------- |
|
382 // function_name : CTestData |
|
383 /// description : SetTotalFetchCount |
|
384 //----------------------------------------------------------------------------- |
|
385 |
|
386 void CTestData::SetConnectionState(TConnectionState aConnectionState) |
|
387 { |
|
388 iConnectionState = aConnectionState; |
|
389 } |
|
390 |
|
391 //----------------------------------------------------------------------------- |
|
392 // function_name : CTestData |
|
393 /// description : GetTotalFetchCount |
|
394 //----------------------------------------------------------------------------- |
|
395 |
|
396 CTestData::TSendRecvState CTestData::GetSendRecvMsgState() |
|
397 { |
|
398 return iSendRecvState; |
|
399 } |
|
400 //----------------------------------------------------------------------------- |
|
401 // function_name : CTestData |
|
402 /// description : SetTotalFetchCount |
|
403 //----------------------------------------------------------------------------- |
|
404 |
|
405 void CTestData::SetSendRecvMsgState(TSendRecvState aSendRecvState) |
|
406 { |
|
407 iSendRecvState = aSendRecvState; |
|
408 } |
|
409 |
|
410 //----------------------------------------------------------------------------- |
|
411 // function_name : CTestData |
|
412 /// description : GetTotalFetchCount |
|
413 //----------------------------------------------------------------------------- |
|
414 |
|
415 CTestData::TAddDeleteContactStatus CTestData::GetAddDeleteContactStatus() |
|
416 { |
|
417 return iAddDeleteContactStatus; |
|
418 } |
|
419 //----------------------------------------------------------------------------- |
|
420 // function_name : CTestData |
|
421 /// description : SetTotalFetchCount |
|
422 //----------------------------------------------------------------------------- |
|
423 |
|
424 void CTestData::SetAddDeleteContactStatus(TAddDeleteContactStatus aAddDeleteContactStatus) |
|
425 { |
|
426 iAddDeleteContactStatus = aAddDeleteContactStatus; |
|
427 } |
|
428 |
|
429 //----------------------------------------------------------------------------- |
|
430 // function_name : CTestData |
|
431 /// description : GetSearchState |
|
432 //----------------------------------------------------------------------------- |
|
433 |
|
434 CTestData::TSearchState CTestData::GetSearchState() |
|
435 { |
|
436 return iSearchState; |
|
437 } |
|
438 //----------------------------------------------------------------------------- |
|
439 // function_name : CTestData |
|
440 /// description : SetSearchState |
|
441 //----------------------------------------------------------------------------- |
|
442 |
|
443 void CTestData::SetSearchState(TSearchState aSearchState) |
|
444 { |
|
445 iSearchState = aSearchState; |
|
446 } |
|
447 |
|
448 //----------------------------------------------------------------------------- |
|
449 // function_name : CTestData |
|
450 /// description : GetTestType |
|
451 //----------------------------------------------------------------------------- |
|
452 |
|
453 CTestData::TTestType CTestData::GetTestType( ) |
|
454 { |
|
455 return iTestType; |
|
456 } |
|
457 |
|
458 //----------------------------------------------------------------------------- |
|
459 // function_name : CTestData |
|
460 /// description : SetTestType |
|
461 //----------------------------------------------------------------------------- |
|
462 |
|
463 void CTestData::SetTestType(TTestType aTestType) |
|
464 { |
|
465 iTestType = aTestType; |
|
466 } |
|
467 //----------------------------------------------------------------------------- |
|
468 // function_name : CTestData |
|
469 /// description : SetSearchKeys |
|
470 //----------------------------------------------------------------------------- |
|
471 |
|
472 void CTestData::SetSearchKeys( gchar **aKeys ) |
|
473 { |
|
474 TInt i = 0; |
|
475 for( i=0; aKeys[i]; i++ ) |
|
476 { |
|
477 iSearchKeys[i] = g_strdup(aKeys[i]); |
|
478 } |
|
479 iSearchKeys[i] = aKeys[i]; |
|
480 } |
|
481 |
|
482 //----------------------------------------------------------------------------- |
|
483 // function_name : CTestData |
|
484 /// description : GetSearchKeys |
|
485 //----------------------------------------------------------------------------- |
|
486 |
|
487 gchar** CTestData::GetSearchKeys( ) |
|
488 { |
|
489 return iSearchKeys; |
|
490 } |
|
491 |
|
492 |
|
493 //----------------------------------------------------------------------------- |
|
494 // function_name : CTestData |
|
495 /// description : SetSearchChan |
|
496 //----------------------------------------------------------------------------- |
|
497 |
|
498 void CTestData::SetSearchChan(TpChan *aSearchChan ) |
|
499 { |
|
500 iSearchChan = aSearchChan; |
|
501 } |
|
502 |
|
503 //----------------------------------------------------------------------------- |
|
504 // function_name : CTestData |
|
505 /// description : GetSearchChan |
|
506 //----------------------------------------------------------------------------- |
|
507 |
|
508 TpChan* CTestData::GetSearchChan( ) |
|
509 { |
|
510 return iSearchChan; |
|
511 } |
|
512 |
|
513 |
|
514 //End of File |