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