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: test utility for having the global data |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 |
|
20 #ifndef __TELEPATHYGABBLETESTDATA_H__ |
|
21 #define __TELEPATHYGABBLETESTDATA_H__ |
|
22 |
|
23 #ifndef DBUS_API_SUBJECT_TO_CHANGE |
|
24 #define DBUS_API_SUBJECT_TO_CHANGE |
|
25 #endif |
|
26 |
|
27 |
|
28 |
|
29 //Include files |
|
30 #include <e32err.h> |
|
31 #include <e32const.h> |
|
32 #include <e32base.h> |
|
33 |
|
34 #include <stdio.h> |
|
35 #include <stdlib.h> |
|
36 #include <string.h> |
|
37 #include <signal.h> |
|
38 |
|
39 #include <dbus/dbus-glib.h> |
|
40 #include <glib.h> |
|
41 |
|
42 #include <unistd.h> |
|
43 |
|
44 #include "tp-conn.h" |
|
45 #include "tp-connmgr.h" |
|
46 #include "tp-chan.h" |
|
47 #include "tp-chan-gen.h" |
|
48 #include "tp-ch-gen.h" |
|
49 #include "tp-chan-iface-group-gen.h" |
|
50 #include "tp-chan-type-text-gen.h" |
|
51 #include "tp-chan-type-streamed-media-gen.h" |
|
52 #include "tp-props-iface.h" |
|
53 #include "tp-constants.h" |
|
54 #include "tp-interfaces.h" |
|
55 |
|
56 |
|
57 |
|
58 |
|
59 #include <pthread.h> |
|
60 |
|
61 #define VERBOSE |
|
62 |
|
63 |
|
64 #define CONNMGR_NAME "telepathy-gabble" |
|
65 #define CONNMGR_BUS "org.freedesktop.Telepathy.ConnectionManager.gabble" |
|
66 #define CONNMGR_PATH "/org/freedesktop/Telepathy/ConnectionManager/gabble" |
|
67 #define CHANNEL_BUS "org.freedesktop.Telepathy.Channel.Type.Text" |
|
68 #define CHANNEL_PATH "/org/freedesktop/Telepathy/Channel/Type/Text" |
|
69 #define PROTOCOL "jabber" |
|
70 |
|
71 class CStifLogger; |
|
72 |
|
73 class CTestData : public CBase |
|
74 { |
|
75 public: |
|
76 enum TConnectionState |
|
77 { |
|
78 ECONNECTED =0, |
|
79 EDISCONNECTED, |
|
80 ECONNECTING, |
|
81 }; |
|
82 enum TTestType |
|
83 { |
|
84 ELogin = 0, |
|
85 ECancel, |
|
86 ESend, |
|
87 ESendErr, |
|
88 EReceive, |
|
89 ERecvBlank, |
|
90 EGetSearchKeys, |
|
91 ESearch, |
|
92 EOther |
|
93 }; |
|
94 enum TSendRecvState |
|
95 { |
|
96 EMessageNotSent =0, |
|
97 EMessageSent, |
|
98 EMessageRecvd, |
|
99 EMessageRecvErr, |
|
100 EMessageSendErr |
|
101 }; |
|
102 |
|
103 enum TAddDeleteContactStatus |
|
104 { |
|
105 EADD_SUCCESS =0, |
|
106 EADD_FAIL , |
|
107 EDELETE_SUCCESS, |
|
108 EDELETE_FAIL |
|
109 }; |
|
110 |
|
111 |
|
112 enum TSearchState |
|
113 { |
|
114 ESearchStarted =0, |
|
115 ESearchError , |
|
116 ESearchCompleted, |
|
117 ESearchKeysFound |
|
118 }; |
|
119 |
|
120 private: |
|
121 /** |
|
122 * C++ default constructor. |
|
123 */ |
|
124 |
|
125 CTestData( CStifLogger* aLogger ); |
|
126 |
|
127 /** |
|
128 * By default Symbian 2nd phase constructor is private. |
|
129 */ |
|
130 void ConstructL(); |
|
131 |
|
132 public: // Constructors and destructor |
|
133 /** |
|
134 * Two-phased constructor. |
|
135 */ |
|
136 static CTestData* NewL( CStifLogger* aLogger ); |
|
137 |
|
138 /** |
|
139 * Destructor. |
|
140 */ |
|
141 ~CTestData(); |
|
142 |
|
143 |
|
144 |
|
145 public://Set funtions |
|
146 |
|
147 DBusGProxy* GetGroupSubscribeInterface(); |
|
148 DBusGProxy* GetGroupPublishInterface(); |
|
149 DBusGProxy* GetGroupKnownInterface(); |
|
150 DBusGProxy* GetGroupDenyInterface(); |
|
151 GMainLoop* GetMainLoop(); |
|
152 GHashTable* GetTextChannelsHT(); |
|
153 DBusGConnection* GetDBusConnection(); |
|
154 TpConn* GetTpConn(); |
|
155 TTestType GetTestType(); |
|
156 TInt GetLoginCompleteFlag(); |
|
157 TInt GetTotalFetchCount(); |
|
158 TInt GetLastIndexInFetch(); |
|
159 TConnectionState GetConnectionState(); |
|
160 TSendRecvState GetSendRecvMsgState(); |
|
161 TAddDeleteContactStatus GetAddDeleteContactStatus(); |
|
162 CStifLogger* GetStifLogger(); |
|
163 TSearchState GetSearchState(); |
|
164 |
|
165 void SetGroupSubscribeInterface( DBusGProxy* aGroupSubscribeInterface ); |
|
166 void SetGroupPublishInterface( DBusGProxy* aGroupPublishInterface ); |
|
167 void SetGroupKnownInterface( DBusGProxy* aGroupKnownInterface ); |
|
168 void SetGroupDenyInterface( DBusGProxy* aGroupDenyInterface ); |
|
169 void SetTextChannelsHT( GHashTable* aTextChannelHashTable ); |
|
170 void IncLoginCompleteFlag(); |
|
171 void ResetLoginCompleteFlag(); |
|
172 void SetTotalFetchCount( TInt aValue ); |
|
173 void SetLastIndexInFetch( TInt aLastIndex ); |
|
174 void SetConnectionState( TConnectionState aloginState ); |
|
175 void SetTestType( TTestType aTestType ); |
|
176 void SetSendRecvMsgState( TSendRecvState aSendRecvState ); |
|
177 void SetAddDeleteContactStatus(TAddDeleteContactStatus aAddDeleteContactStatus); |
|
178 void SetTpConn(TpConn* aTpConn); |
|
179 void SetTpConnMgr(TpConnMgr* aTpConnMgr); |
|
180 void SetDBusConnection( DBusGConnection* aDBusConnection ); |
|
181 void SetSearchState(TSearchState aSearchState); |
|
182 void SetSearchKeys( gchar **aKeys ); |
|
183 gchar** GetSearchKeys( ); |
|
184 void SetSearchChan(TpChan* aSearchChan ); |
|
185 TpChan* GetSearchChan( ); |
|
186 |
|
187 private://Data members |
|
188 |
|
189 GMainLoop *iMainLoop; |
|
190 |
|
191 //Hash Table for the text channels. |
|
192 GHashTable *iTextChannelHashTable; |
|
193 |
|
194 TpConn *iTpConn; |
|
195 |
|
196 TpConnMgr *iTpConnMgr; |
|
197 |
|
198 //Global dbus-connection object |
|
199 DBusGConnection *iDBusConnection; |
|
200 |
|
201 |
|
202 DBusGProxy *iGroupSubscribeInterface; //used for adding a contact |
|
203 DBusGProxy *iGroupKnownInterface; //used for removing a contact |
|
204 DBusGProxy *iGroupPublishInterface; //gives local pending members |
|
205 DBusGProxy *iGroupDenyInterface; //used to deny the contacts. |
|
206 |
|
207 TInt iLoginComplete; |
|
208 TInt iTotalFetchCount; |
|
209 TConnectionState iConnectionState; |
|
210 TSendRecvState iSendRecvState; |
|
211 TAddDeleteContactStatus iAddDeleteContactStatus; |
|
212 TSearchState iSearchState; |
|
213 TTestType iTestType; |
|
214 |
|
215 CStifLogger *iLogger; |
|
216 |
|
217 //Used in Fetch Contacts Test Case |
|
218 TInt iLastIndex; |
|
219 gchar** iSearchKeys; |
|
220 |
|
221 TpChan* iSearchChan; |
|
222 };//End of class |
|
223 |
|
224 #endif //__TELEPATHYGABBLETESTDATA_H__ |
|
225 |
|