mmserv/tms/tmsimpl/src/tmssinkimpl.cpp
changeset 0 71ca22bcf22a
child 10 3d8c721bf319
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 #include <tms.h>
       
    19 #include "tmsclientsinkimpl.h"
       
    20 #include "tmsutility.h"
       
    21 #include "tmssinkimpl.h"
       
    22 #include "tmsmodemsinkimpl.h"
       
    23 #include "tmsspeakersinkimpl.h"
       
    24 
       
    25 using namespace TMS;
       
    26 
       
    27 EXPORT_C gint TMSSinkImpl::Create(TMSSinkType sinktype, TMSSink*& tmssink)
       
    28     {
       
    29     gint ret(TMS_RESULT_INSUFFICIENT_MEMORY);
       
    30     TRACE_PRN_FN_ENT;
       
    31     switch (sinktype)
       
    32         {
       
    33         case TMS_SINK_CLIENT:
       
    34             ret = TMSClientSinkImpl::Create(tmssink);
       
    35             break;
       
    36         case TMS_SINK_MODEM:
       
    37             ret = TMSModemSinkImpl::Create(tmssink);
       
    38             break;
       
    39         case TMS_SINK_SPEAKER:
       
    40             ret = TMSSpeakerSinkImpl::Create(tmssink);
       
    41             break;
       
    42         default:
       
    43             ret = TMS_RESULT_SINK_TYPE_NOT_SUPPORTED;
       
    44             break;
       
    45         }
       
    46 
       
    47     TRACE_PRN_FN_EXT;
       
    48     return ret;
       
    49     }
       
    50 
       
    51 EXPORT_C gint TMSSinkImpl::Delete(TMSSink*& tmssink)
       
    52     {
       
    53     gint ret(TMS_RESULT_INVALID_ARGUMENT);
       
    54     TRACE_PRN_FN_ENT;
       
    55     TMSSinkType sinktype;
       
    56     ret = tmssink->GetType(sinktype);
       
    57     switch (sinktype)
       
    58         {
       
    59         case TMS_SINK_CLIENT:
       
    60             {
       
    61             delete (TMSClientSinkImpl*) (tmssink);
       
    62             tmssink = NULL;
       
    63             ret = TMS_RESULT_SUCCESS;
       
    64             }
       
    65             break;
       
    66         case TMS_SINK_MODEM:
       
    67             {
       
    68             delete (TMSModemSinkImpl*) (tmssink);
       
    69             tmssink = NULL;
       
    70             ret = TMS_RESULT_SUCCESS;
       
    71             }
       
    72             break;
       
    73         case TMS_SINK_SPEAKER:
       
    74             {
       
    75             delete (TMSSpeakerSinkImpl*) (tmssink);
       
    76             tmssink = NULL;
       
    77             ret = TMS_RESULT_SUCCESS;
       
    78             }
       
    79             break;
       
    80         default:
       
    81             ret = TMS_RESULT_SINK_TYPE_NOT_SUPPORTED;
       
    82             break;
       
    83         }
       
    84 
       
    85     TRACE_PRN_FN_EXT;
       
    86     return ret;
       
    87     }
       
    88 
       
    89 // End of file