|
1 /** |
|
2 * Copyright (c) 2010 Sasken Communication Technologies Ltd. |
|
3 * All rights reserved. |
|
4 * This component and the accompanying materials are made available |
|
5 * under the terms of the "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 * Chandradeep Gandhi, Sasken Communication Technologies Ltd - Initial contribution |
|
11 * |
|
12 * Contributors: |
|
13 * Manasij Roy, Nalina Hariharan |
|
14 * |
|
15 * Description: |
|
16 * The SmfClient class provides a set of APIs to get list of service provider |
|
17 * who implement the given interface. Calling GetServices of the instance of this |
|
18 * class is mandatory before using any other interface. |
|
19 * |
|
20 */ |
|
21 |
|
22 #include <qdebug.h> |
|
23 |
|
24 #include "smfclient.h" |
|
25 #include "smfclient_p.h" |
|
26 |
|
27 SmfClient::SmfClient() |
|
28 { |
|
29 qDebug()<<"Inside SmfClient::SmfClient()"; |
|
30 |
|
31 //Create instance of the private wrapper |
|
32 m_private = new SmfClientPrivate(this); |
|
33 m_providerList = NULL; |
|
34 } |
|
35 |
|
36 SmfClient::~SmfClient() |
|
37 { |
|
38 if(m_private) |
|
39 { |
|
40 delete m_private; |
|
41 m_private = NULL; |
|
42 } |
|
43 } |
|
44 |
|
45 QList<SmfProvider>* SmfClient::GetServices(const QString& serviceName) |
|
46 { |
|
47 qDebug()<<"Inside SmfClient::GetServices()"; |
|
48 |
|
49 if(m_providerList) |
|
50 { |
|
51 delete m_providerList; |
|
52 m_providerList = NULL; |
|
53 } |
|
54 qDebug()<<"Before m_private->GetServices"; |
|
55 |
|
56 //Getting the data synchronously |
|
57 m_providerList = m_private->GetServices(serviceName); |
|
58 qDebug()<<"After m_private->GetServices"; |
|
59 |
|
60 return m_providerList; |
|
61 } |
|
62 |
|
63 |
|
64 /** |
|
65 * This method returns the error message for the mentioned argument error code |
|
66 * @param aErrorCode The SmfError code for which the error string is required |
|
67 * @returns a QString object containing the required error message |
|
68 */ |
|
69 QString SmfClient::errorString ( const SmfError &aErrorCode ) const |
|
70 { |
|
71 QString str; |
|
72 str.clear(); |
|
73 |
|
74 switch(aErrorCode) |
|
75 { |
|
76 case SmfNoError: //0 |
|
77 str.append("No Error"); |
|
78 break; |
|
79 |
|
80 case SmfInvalidInterface: //1 |
|
81 str.append("Smf Error : Invalid interface name"); |
|
82 break; |
|
83 |
|
84 case SmfNoAuthorizedPlugin: //2 |
|
85 str.append("Smf Error : No Authorised plugins are available"); |
|
86 break; |
|
87 |
|
88 case SmfClientAuthFailed: //3 |
|
89 str.append("Smf Error : Smf Client authorisation failed"); |
|
90 break; |
|
91 |
|
92 case SmfPMPluginNotFound: //4 |
|
93 str.append("Smf Error : Plugin not found"); |
|
94 break; |
|
95 |
|
96 case SmfPMPluginNotLoaded: //5 |
|
97 str.append("Smf Error : Plugin could not be loaded"); |
|
98 break; |
|
99 |
|
100 case SmfPMPluginLoadError: //6 |
|
101 str.append("Smf Error : Plugin Load failed"); |
|
102 break; |
|
103 |
|
104 case SmfPMPluginNotAuthorised: //7 |
|
105 str.append("Smf Error : Plugin not authorised"); |
|
106 break; |
|
107 |
|
108 case SmfPMPluginRequestCreationFailed: //8 |
|
109 str.append("Smf Error : Plugin request creation failed"); |
|
110 break; |
|
111 |
|
112 case SmfPMPluginUnknownPluginService: //9 |
|
113 str.append("Smf Error : Requested Plugin service not supported"); |
|
114 break; |
|
115 |
|
116 case SmfPMPluginUnknownHttpService: //10 |
|
117 str.append("Smf Error : Unknown http service requested by plugin"); |
|
118 break; |
|
119 |
|
120 case SmfPMPluginRequestSendingFailed: //11 |
|
121 str.append("Smf Error : Request created by plugin could not be send"); |
|
122 break; |
|
123 |
|
124 case SmfPMPluginSOPCheckFailed: //12 |
|
125 str.append("Smf Error : Same Origin Policy violation by plugin"); |
|
126 break; |
|
127 |
|
128 case SmfPMPluginSendRequestAgain: //13 |
|
129 str.append("Smf Error : Send request again"); |
|
130 break; |
|
131 |
|
132 case SmfPluginErrorTooManyRequest: //14 |
|
133 str.append("Plugin Error: Too many requests"); |
|
134 break; |
|
135 |
|
136 case SmfPluginErrorRequestQuotaExceeded: //15 |
|
137 str.append("Plugin Error: Request Quota Exceeded"); |
|
138 break; |
|
139 |
|
140 case SmfPluginErrorInvalidRequest: //16 |
|
141 str.append("Plugin Error: Invalid Request"); |
|
142 break; |
|
143 |
|
144 case SmfPluginErrorUserNotLoggedIn: //17 |
|
145 str.append("Plugin Error: User not logged in"); |
|
146 break; |
|
147 |
|
148 case SmfPluginErrorAuthenticationExpired: //18 |
|
149 str.append("Plugin Error: Authentication Expired"); |
|
150 break; |
|
151 |
|
152 case SmfPluginErrorPermissionDenied: //19 |
|
153 str.append("Plugin Error: Permission denied"); |
|
154 break; |
|
155 |
|
156 case SmfPluginErrorInvalidApplication: //20 |
|
157 str.append("Plugin Error: Request Quota Exceeded"); |
|
158 break; |
|
159 |
|
160 case SmfPluginErrorServiceUnavailable: //21 |
|
161 str.append("Plugin Error: Service unavailable"); |
|
162 break; |
|
163 |
|
164 case SmfPluginErrorServiceTemporaryUnavailable: //22 |
|
165 str.append("Plugin Error: Service temporarily unavailable"); |
|
166 break; |
|
167 |
|
168 case SmfPluginErrorFormatNotSupported: //23 |
|
169 str.append("Plugin Error: Format not supported"); |
|
170 break; |
|
171 |
|
172 case SmfPluginErrorDataSizeExceeded : //24 |
|
173 str.append("Plugin Error: Data Size exceeded"); |
|
174 break; |
|
175 |
|
176 case SmfPluginErrorInvalidArguments: //25 |
|
177 str.append("Plugin Error: Invalid request arguments"); |
|
178 break; |
|
179 |
|
180 case SmfPluginErrorParsingFailed: //26 |
|
181 str.append("Plugin Error: Parsing failed"); |
|
182 break; |
|
183 |
|
184 case SmfPluginErrorNetworkError: //27 |
|
185 str.append("Plugin Error: Network Error"); |
|
186 break; |
|
187 |
|
188 case SmfPluginErrorCancelComplete: //28 |
|
189 str.append("Smf : Operation Cancelled"); |
|
190 break; |
|
191 |
|
192 case SmfTMConnectionRefusedError: //29 |
|
193 str.append("Network Error: Connection Refused"); |
|
194 break; |
|
195 |
|
196 case SmfTMRemoteHostClosedError: //30 |
|
197 str.append("Network Error: Remote Host Closed"); |
|
198 break; |
|
199 |
|
200 case SmfTMHostNotFoundError: //31 |
|
201 str.append("Network Error: Host Not Found"); |
|
202 break; |
|
203 |
|
204 case SmfTMTimeoutError: //32 |
|
205 str.append("Network Error: Time Out"); |
|
206 break; |
|
207 |
|
208 case SmfTMOperationCanceledError: //33 |
|
209 str.append("Network Error: Operation cancelled"); |
|
210 break; |
|
211 |
|
212 case SmfTMSslHandshakeFailedError: //34 |
|
213 str.append("Network Error: Handshake Failed"); |
|
214 break; |
|
215 |
|
216 case SmfTMProxyConnectionRefusedError: //35 |
|
217 str.append("Network Error: Proxy Connection Refused"); |
|
218 break; |
|
219 |
|
220 case SmfTMProxyConnectionClosedError: //36 |
|
221 str.append("Network Error: Proxy Connection Closed"); |
|
222 break; |
|
223 |
|
224 case SmfTMProxyNotFoundError: //37 |
|
225 str.append("Network Error: Proxy Not Found"); |
|
226 break; |
|
227 |
|
228 case SmfTMProxyTimeoutError: //38 |
|
229 str.append("Network Error: Proxy Timeout"); |
|
230 break; |
|
231 |
|
232 case SmfTMProxyAuthenticationRequiredError: //39 |
|
233 str.append("Network Error: Proxy Authentication Required"); |
|
234 break; |
|
235 |
|
236 case SmfTMContentAccessDenied: //40 |
|
237 str.append("Network Error: Content Access Denied"); |
|
238 break; |
|
239 |
|
240 case SmfTMContentOperationNotPermittedError: //41 |
|
241 str.append("Network Error: Content Operation Not Permitted"); |
|
242 break; |
|
243 |
|
244 case SmfTMContentNotFoundError: //42 |
|
245 str.append("Network Error: Content Not Found"); |
|
246 break; |
|
247 |
|
248 case SmfTMAuthenticationRequiredError: //43 |
|
249 str.append("Network Error: Remote Server Required Authentication"); |
|
250 break; |
|
251 |
|
252 case SmfTMContentReSendError: //44 |
|
253 str.append("Network Error: Content Resend Error"); |
|
254 break; |
|
255 |
|
256 case SmfTMProtocolUnknownError: //45 |
|
257 str.append("Network Error: Protocol Unknown"); |
|
258 break; |
|
259 |
|
260 case SmfTMProtocolInvalidOperationError: //46 |
|
261 str.append("Network Error: Protocol Invalid Operation"); |
|
262 break; |
|
263 |
|
264 case SmfTMUnknownNetworkError: //47 |
|
265 str.append("Network Error: Unknown Network Error"); |
|
266 break; |
|
267 |
|
268 case SmfTMUnknownProxyError: //48 |
|
269 str.append("Network Error: Unknown Proxy Error"); |
|
270 break; |
|
271 |
|
272 case SmfTMUnknownContentError: //49 |
|
273 str.append("Network Error: Unknown Content Error"); |
|
274 break; |
|
275 |
|
276 case SmfTMProtocolFailure: //50 |
|
277 str.append("Network Error: Protocol Failure"); |
|
278 break; |
|
279 |
|
280 case SmfTMUnknownError: //51 |
|
281 str.append("Network Error: Unknown Error"); |
|
282 break; |
|
283 |
|
284 case SmfTMIAPChanged: //52 |
|
285 str.append("Network Error: IAP Changed"); |
|
286 break; |
|
287 |
|
288 case SmfTMCancelled: //53 |
|
289 str.append("Network Error: Cancelled"); |
|
290 break; |
|
291 |
|
292 case SmfTMUnsupportedContentEncodingFormat: //54 |
|
293 str.append("Smf Error: Unsupported Content Encoding Format"); |
|
294 break; |
|
295 |
|
296 case SmfTMInitNetworkNotAvailable : //55 |
|
297 str.append("Smf Error: Network Not Available"); |
|
298 break; |
|
299 |
|
300 case SmfTMInitRoamingNetworkUsageNotEnabled: //56 |
|
301 str.append("Smf Error: Network Usage While Roaming is Disabled"); |
|
302 break; |
|
303 |
|
304 case SmfTMGzipMemoryError: //57 |
|
305 str.append("Smf Error: Gzip Memory Error"); |
|
306 break; |
|
307 |
|
308 case SmfTMGzipStreamError: //58 |
|
309 str.append("Smf Error: Gzip Stream Error"); |
|
310 break; |
|
311 |
|
312 case SmfTMGzipDataError: //59 |
|
313 str.append("Smf Error: Gzip Data Error"); |
|
314 break; |
|
315 |
|
316 case SmfMemoryAllocationFailure: //60 |
|
317 str.append("Smf Error: Memory failed"); |
|
318 break; |
|
319 |
|
320 case SmfDbOpeningError: //61 |
|
321 str.append("Smf Database Error: Opening Error"); |
|
322 break; |
|
323 |
|
324 case SmfDbQueryExecutonError: //61 |
|
325 str.append("Smf Database Error: Query Error"); |
|
326 break; |
|
327 |
|
328 case SmfDbContactNotExist: //63 |
|
329 str.append("Smf Database Error: No contacts in Database"); |
|
330 break; |
|
331 |
|
332 case SmfErrItemNotInRelation: //64 |
|
333 str.append("Smf Error: Item not in relation"); |
|
334 break; |
|
335 |
|
336 case SmfErrInvalidRelation: //65 |
|
337 str.append("Smf Error: Invalid relation"); |
|
338 break; |
|
339 |
|
340 case SmfUnknownError: //66 |
|
341 default: |
|
342 str.append("Smf Error: Unknown Error"); |
|
343 } |
|
344 |
|
345 return str; |
|
346 } |
|
347 |