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