|
1 /* |
|
2 * Copyright (c) 2010 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: QT Bindings for TMS |
|
15 * |
|
16 */ |
|
17 |
|
18 #ifndef QTMS_FACTORY_H |
|
19 #define QTMS_FACTORY_H |
|
20 |
|
21 #include <qtms.h> |
|
22 #include <QObject> |
|
23 #include <QtCore/qglobal.h> |
|
24 #include "qtmswrapperexport.h" |
|
25 |
|
26 namespace QTMS |
|
27 { |
|
28 |
|
29 // FORWARD DECLARATIONS |
|
30 class QTMSCall; |
|
31 class QTMSFormat; |
|
32 class QTMSEffect; |
|
33 class QTMSBuffer; |
|
34 class QTMSSource; |
|
35 class QTMSSink; |
|
36 class QTMSFactoryImpl; |
|
37 class QTMSVer; // QTMS version definition |
|
38 class QTMSGlobalRouting; |
|
39 class QTMSDTMF; |
|
40 class QTMSRingTone; |
|
41 class QTMSInbandTone; |
|
42 |
|
43 /** |
|
44 * QTMSFactory class |
|
45 * |
|
46 * This class serves as a factory crating all necessary QTMS components. |
|
47 * |
|
48 * Usage: |
|
49 * <code> |
|
50 * QTMSFactory* iFactory; |
|
51 * QTMSCall* iCall; |
|
52 * gint err; |
|
53 * err = QTMSFactory::CreateFactory(iFactory); |
|
54 * err = iFactory->CreateCall(QTMS_CALL_IP, iCall); |
|
55 * ... |
|
56 * err = iFactory->DeleteCall(iCall); |
|
57 * delete iFactory; |
|
58 * ... |
|
59 * </code> |
|
60 * |
|
61 * @lib QTMSapi.lib |
|
62 * |
|
63 */ |
|
64 class QTMS_WRAPPER_DLL_EXPORT QTMSFactory : public QObject |
|
65 { |
|
66 Q_OBJECT |
|
67 public: |
|
68 /** |
|
69 * Returns pointer reference to created QTMS Factory object. The specified |
|
70 * API version will allow using different QTMS API variants. |
|
71 * |
|
72 * @param QTMSfactory |
|
73 * Created Factory object. |
|
74 * |
|
75 * @param ver |
|
76 * API version which should be used to create QTMS components. |
|
77 * |
|
78 * @return |
|
79 * QTMS_RESULT_SUCCESS if factory is created successfully. |
|
80 * QTMS_RESULT_INSUFFICIENT_MEMORY if factory creation failed due to |
|
81 * insufficient of memory. |
|
82 * QTMS_RESULT_VERSION_NOT_SUPPORTED if requested API version is not |
|
83 * supported. |
|
84 * |
|
85 */ |
|
86 static gint CreateFactory(QTMSFactory*& tmsfactory, QTMSVer& ver); |
|
87 |
|
88 /** |
|
89 * Destructor |
|
90 * |
|
91 * Deletes the QTMS Factory. |
|
92 * |
|
93 */ |
|
94 virtual ~QTMSFactory(); |
|
95 |
|
96 /** |
|
97 * Creates QTMS Call of the given type with context ID. |
|
98 * |
|
99 * @param ctype |
|
100 * Call type to be created. |
|
101 * Supported call types: |
|
102 * QTMS_CALL_CS |
|
103 * QTMS_CALL_ECS |
|
104 * QTMS_CALL_IP |
|
105 * |
|
106 * @param QTMScall |
|
107 * Created Call object. |
|
108 * |
|
109 * @param ctxid |
|
110 * The Context ID to be assigned to the call. The default is |
|
111 * DEFAULT_CALL_CONTEXT. |
|
112 * |
|
113 * @return |
|
114 * QTMS_RESULT_SUCCESS if call is created successfully. |
|
115 * QTMS_RESULT_INSUFFICIENT_MEMORY if call creation failed due to |
|
116 * insufficient memory. |
|
117 * QTMS_RESULT_CALL_TYPE_NOT_SUPPORTED if calltype is not supported. |
|
118 * QTMS_RESULT_INVALID_ARGUMENT if the context id is not valid. |
|
119 * QTMS_RESULT_FATAL_ERROR if there is any other error. |
|
120 * |
|
121 */ |
|
122 gint CreateCall(QTMSCallType ctype, QTMSCall*& QTMScall, |
|
123 guint ctxid = DEFAULT_CALL_CONTEXT); |
|
124 |
|
125 /** |
|
126 * Deletes QTMS Call. |
|
127 * |
|
128 * @param QTMSct |
|
129 * The call to be deleted. |
|
130 * |
|
131 * @return |
|
132 * QTMS_RESULT_SUCCESS if call is deleted successfully. |
|
133 * QTMS_RESULT_INVALID_ARGUMENT if the call is not valid. |
|
134 * |
|
135 */ |
|
136 gint DeleteCall(QTMSCall*& qtmsct); |
|
137 |
|
138 /** |
|
139 * Is the given calltype supported by the QTMS API. |
|
140 * |
|
141 * @param ctype |
|
142 * The call type to be validated. |
|
143 * |
|
144 * @param flag |
|
145 * Indicates wheter the call type is supported or not. |
|
146 * |
|
147 * @return |
|
148 * QTMS_RESULT_SUCCESS if operation was successful. |
|
149 * QTMS_RESULT_FATAL_ERROR if operation failed. |
|
150 * |
|
151 */ |
|
152 gint IsCallTypeSupported(QTMSCallType ctype, gboolean& flag); |
|
153 |
|
154 /** |
|
155 * Returns supported codec format types. |
|
156 * |
|
157 * @param strmtype |
|
158 * Stream type: Uplink or Downlink |
|
159 * |
|
160 * @param fmtlist |
|
161 * Format vector in which the supported formats are stored |
|
162 * |
|
163 * @return |
|
164 * QTMS_RESULT_SUCCESS if operation was successful. |
|
165 * QTMS_RESULT_FATAL_ERROR if operation failed. |
|
166 * |
|
167 */ |
|
168 gint GetSupportedFormats(const QTMSStreamType strmtype, |
|
169 FormatVector& fmtlist); |
|
170 |
|
171 /** |
|
172 * Creates Format object of the given format type. |
|
173 * |
|
174 * @param fmttype |
|
175 * Format type to be created. |
|
176 * |
|
177 * @param QTMSfmt |
|
178 * Crated Format object. |
|
179 * |
|
180 * @return |
|
181 * QTMS_RESULT_SUCCESS if format is created successfully. |
|
182 * QTMS_RESULT_INSUFFICIENT_MEMORY if format creation failed due to |
|
183 * insufficient of memory. |
|
184 * QTMS_RESULT_FORMAT_TYPE_NOT_SUPPORTED if format type is not |
|
185 * supported. |
|
186 * |
|
187 */ |
|
188 gint CreateFormat(QTMSFormatType fmttype, QTMSFormat*& qtmsfmt); |
|
189 |
|
190 /** |
|
191 * Deletes Format object. |
|
192 * |
|
193 * @param QTMSfmt |
|
194 * Format to be deleted. |
|
195 * |
|
196 * @return |
|
197 * QTMS_RESULT_SUCCESS if format is deleted successfully. |
|
198 * QTMS_RESULT_INVALID_ARGUMENT if the format is not valid. |
|
199 * |
|
200 */ |
|
201 gint DeleteFormat(QTMSFormat*& qtmsfmt); |
|
202 |
|
203 /** |
|
204 * Creates Effect object of the given type. |
|
205 * |
|
206 * @param QTMSeffecttype |
|
207 * Effect type to be created. |
|
208 * |
|
209 * @param QTMSeffect |
|
210 * Created Effect object. |
|
211 * |
|
212 * @return |
|
213 * QTMS_RESULT_SUCCESS if effect is created successfully. |
|
214 * QTMS_RESULT_INSUFFICIENT_MEMORY if effect creation failed due to |
|
215 * insufficient memory. |
|
216 * QTMS_RESULT_EFFECT_TYPE_NOT_SUPPORTED if the effect type is not |
|
217 * supported. |
|
218 * |
|
219 */ |
|
220 gint CreateEffect(QTMSEffectType QTMSeffecttype, |
|
221 QTMSEffect*& qtmseffect); |
|
222 |
|
223 /** |
|
224 * Deletes Effect object. |
|
225 * |
|
226 * @param QTMSeffect |
|
227 * Effect object to be deleted. |
|
228 * |
|
229 * @return |
|
230 * QTMS_RESULT_SUCCESS if effect is deleted successfully. |
|
231 * QTMS_RESULT_INVALID_ARGUMENT if the effect is not valid. |
|
232 */ |
|
233 gint DeleteEffect(QTMSEffect*& qtmseffect); |
|
234 |
|
235 /** |
|
236 * Creates Buffer object of the given type and size. |
|
237 * The memory is allocated on the heap. |
|
238 * |
|
239 * @param buffertype |
|
240 * Buffer type to be created. |
|
241 * |
|
242 * @param size |
|
243 * Size of the buffer to be created. |
|
244 * |
|
245 * @param QTMSbuffer |
|
246 * Created buffer object. |
|
247 * |
|
248 * @return |
|
249 * QTMS_RESULT_SUCCESS if buffer is created successfully. |
|
250 * QTMS_RESULT_INSUFFICIENT_MEMORY if buffer creation failed due to |
|
251 * insufficient memory. |
|
252 * QTMS_RESULT_BUFFER_TYPE_NOT_SUPPORTED if the buffer type is not |
|
253 * supported. |
|
254 * |
|
255 */ |
|
256 gint CreateBuffer(QTMSBufferType buffertype, guint size, |
|
257 QTMSBuffer*& qtmsbuffer); |
|
258 |
|
259 /** |
|
260 * Deletes the Buffer object. |
|
261 * |
|
262 * @param QTMSbuffer |
|
263 * Buffer to be deleted. |
|
264 * |
|
265 * @return |
|
266 * QTMS_RESULT_SUCCESS if buffer is deleted successfully. |
|
267 * QTMS_RESULT_INVALID_ARGUMENT if the buffer is not valid. |
|
268 */ |
|
269 gint DeleteBuffer(QTMSBuffer*& qtmsbuffer); |
|
270 |
|
271 /** |
|
272 * Creates the Source object of the given type. |
|
273 * |
|
274 * @param srctype |
|
275 * Source type to be created. |
|
276 * |
|
277 * @param QTMSsrc |
|
278 * Crated source object. |
|
279 * |
|
280 * @return |
|
281 * QTMS_RESULT_SUCCESS if source is created successfully. |
|
282 * QTMS_RESULT_INSUFFICIENT_MEMORY if source creation failed due to |
|
283 * lack of memory. |
|
284 * QTMS_RESULT_SOURCE_TYPE_NOT_SUPPORTED if the source type is not |
|
285 * supported. |
|
286 * |
|
287 */ |
|
288 gint CreateSource(QTMSSourceType srctype, QTMSSource*& qtmssrc); |
|
289 |
|
290 /** |
|
291 * Deletes the Source object. |
|
292 * |
|
293 * @param QTMSsrc |
|
294 * Source to be deleted. |
|
295 * |
|
296 * @return |
|
297 * QTMS_RESULT_SUCCESS if source is deleted successfully. |
|
298 * QTMS_RESULT_INVALID_ARGUMENT if the source is not valid. |
|
299 * |
|
300 */ |
|
301 gint DeleteSource(QTMSSource*& qtmssrc); |
|
302 |
|
303 /** |
|
304 * Creates the Sink object of the given QTMSSinkType. |
|
305 * |
|
306 * @param sinktype |
|
307 * Sink type to be created. |
|
308 * |
|
309 * @param QTMSsink |
|
310 * Created sink object. |
|
311 * |
|
312 * @return |
|
313 * QTMS_RESULT_SUCCESS if sink is created successfully. |
|
314 * QTMS_RESULT_INSUFFICIENT_MEMORY if sink creation failed due to |
|
315 * lack of memory. |
|
316 * QTMS_RESULT_SOURCE_TYPE_NOT_SUPPORTED if the sink type is not |
|
317 * supported. |
|
318 * |
|
319 */ |
|
320 gint CreateSink(QTMSSinkType sinktype, QTMSSink*& qtmssink); |
|
321 |
|
322 /** |
|
323 * Deletes the Sink object. |
|
324 * |
|
325 * @param QTMSsink |
|
326 * The sink to be deleted. |
|
327 * |
|
328 * @return |
|
329 * QTMS_RESULT_SUCCESS if sink is deleted successfully. |
|
330 * QTMS_RESULT_INVALID_ARGUMENT if the sink is not valid. |
|
331 */ |
|
332 gint DeleteSink(QTMSSink*& qtmssink); |
|
333 |
|
334 /** |
|
335 * Creates QTMSGlobalRouting object. |
|
336 * |
|
337 * @param globrouting |
|
338 * Created global routing object. |
|
339 * |
|
340 * @return |
|
341 * QTMS_RESULT_SUCCESS if global routing object is created successfully. |
|
342 * QTMS_RESULT_INSUFFICIENT_MEMORY if global routing creation failed |
|
343 * due to lack of memory. |
|
344 * QTMS_RESULT_SOURCE_TYPE_NOT_SUPPORTED if global routing is not |
|
345 * supported. |
|
346 * |
|
347 */ |
|
348 gint CreateGlobalRouting(QTMSGlobalRouting*& globrouting); |
|
349 |
|
350 /** |
|
351 * Deletes QTMSGlobalRouting object. |
|
352 * |
|
353 * @param globrouting |
|
354 * Global routing object to be deleted. |
|
355 * |
|
356 * @return |
|
357 * QTMS_RESULT_SUCCESS if global routing object is deleted successfully. |
|
358 * QTMS_RESULT_INVALID_ARGUMENT if the global routing object is invalid. |
|
359 */ |
|
360 gint DeleteGlobalRouting(QTMSGlobalRouting*& globrouting); |
|
361 |
|
362 /** |
|
363 * Create DTMF player object. |
|
364 * |
|
365 * @param streamtype |
|
366 * Stream ID to be used to create the DTMF player. |
|
367 * QTMS_STREAM_UPLINK |
|
368 * QTMS_STREAM_DOWNLINK |
|
369 * |
|
370 * @param dtmf |
|
371 * Created DTMF player. |
|
372 * |
|
373 * @return |
|
374 * QTMS_RESULT_SUCCESS if the operation was successful. |
|
375 * QTMS_RESULT_INSUFFICIENT_MEMORY if DTMF player creation failed due |
|
376 * to insufficient memory. |
|
377 * QTMS_RESULT_FATAL_ERROR if an error occured. |
|
378 * QTMS_REASON_EMERGENCY_CALL_ONGOING if emergency call is active. |
|
379 * QTMS_REASON_PERMISSION_DENIED if permission is denied. |
|
380 * |
|
381 */ |
|
382 gint CreateDTMF(QTMSStreamType streamtype, QTMSDTMF*& dtmf); |
|
383 |
|
384 /** |
|
385 * Delete DTMF player object. |
|
386 * |
|
387 * @param dtmf |
|
388 * DTMF player to be deleted. |
|
389 * |
|
390 * @return |
|
391 * QTMS_RESULT_SUCCESS if the operation was successful. |
|
392 * QTMS_RESULT_INVALID_ARGUMENT if the DTMF player is not valid. |
|
393 * |
|
394 */ |
|
395 gint DeleteDTMF(QTMSDTMF*& dtmf); |
|
396 |
|
397 /** |
|
398 * Creates QTMSRingTone player object for audio ring tone. |
|
399 * |
|
400 * @param rt |
|
401 * RingTone player object to be created. |
|
402 * |
|
403 * @return |
|
404 * QTMS_RESULT_SUCCESS when object is created successfully. |
|
405 * QTMS_RESULT_INSUFFICIENT_MEMORY when object creation failed due to |
|
406 * insufficient memory. |
|
407 */ |
|
408 gint CreateRingTonePlayer(QTMSRingTone*& rt); |
|
409 |
|
410 /** |
|
411 * Deletes QTMSRingTone object. |
|
412 * |
|
413 * @param rt |
|
414 * RingTone player object to be deleted. |
|
415 * |
|
416 * @return |
|
417 * QTMS_RESULT_SUCCESS when object is deleted successfully. |
|
418 * QTMS_RESULT_INVALID_ARGUMENT if RingTone player object is invalid. |
|
419 */ |
|
420 gint DeleteRingTonePlayer(QTMSRingTone*& rt); |
|
421 |
|
422 /** |
|
423 * Creates QTMSInbandTone player object. |
|
424 * |
|
425 * @param inbandtone |
|
426 * InbandTone player object to be created. |
|
427 * |
|
428 * @return |
|
429 * QTMS_RESULT_SUCCESS when object is created successfully. |
|
430 * QTMS_RESULT_INSUFFICIENT_MEMORY when object creation failed due to |
|
431 * insufficient memory. |
|
432 */ |
|
433 gint CreateInbandTonePlayer(QTMSInbandTone*& inbandtone); |
|
434 |
|
435 /** |
|
436 * Deletes QTMSInbandTone object. |
|
437 * |
|
438 * @param inbandtone |
|
439 * InbandTone player object to be deleted. |
|
440 * |
|
441 * @return |
|
442 * QTMS_RESULT_SUCCESS when object is deleted successfully. |
|
443 * QTMS_RESULT_INVALID_ARGUMENT if InbandTone player object is invalid. |
|
444 */ |
|
445 gint DeleteInbandTonePlayer(QTMSInbandTone*& inbandtone); |
|
446 |
|
447 private: |
|
448 /** |
|
449 * Constructor |
|
450 */ |
|
451 QTMSFactory(); |
|
452 |
|
453 private: |
|
454 QTMSFactoryImpl* impl; |
|
455 }; |
|
456 |
|
457 } //namespace QTMS |
|
458 |
|
459 #endif //QTMS_FACTORY_H |