convergedcallengine/serviceselector/src/cconvergedserviceselector.cpp
changeset 51 12bc758d6a02
parent 48 78df25012fda
child 53 25b8d29b7c59
equal deleted inserted replaced
48:78df25012fda 51:12bc758d6a02
     1 /*
       
     2 * Copyright (c) 2008 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:  This module contains the implementation of 
       
    15 *              : CConvergedServiceSelector class.
       
    16 *
       
    17 */
       
    18 
       
    19 
       
    20 //  INCLUDE FILES
       
    21 #include "cconvergedserviceselector.h"
       
    22 #include "cservicehandler.h"
       
    23 #include "cssserviceutilities.h"
       
    24 #include "csslogger.h"
       
    25 
       
    26 // ================= MEMBER FUNCTIONS =======================================
       
    27 
       
    28 // -----------------------------------------------------------------------------
       
    29 // CConvergedServiceSelector::CConvergedServiceSelector
       
    30 // C++ constructor can NOT contain any code, that
       
    31 // might leave.
       
    32 // -----------------------------------------------------------------------------
       
    33 //
       
    34 CConvergedServiceSelector::CConvergedServiceSelector
       
    35         ( 
       
    36         // None.
       
    37         )
       
    38     {
       
    39     }
       
    40 
       
    41 // -----------------------------------------------------------------------------
       
    42 // CConvergedServiceSelector::NewL
       
    43 // Two-phased constructor.
       
    44 // -----------------------------------------------------------------------------
       
    45 //
       
    46 EXPORT_C CConvergedServiceSelector* CConvergedServiceSelector::NewL
       
    47         ( 
       
    48         // None.
       
    49         )
       
    50     {
       
    51     CConvergedServiceSelector* self = new ( ELeave ) CConvergedServiceSelector();
       
    52     return self;
       
    53     }
       
    54 
       
    55 // Destructor
       
    56 EXPORT_C CConvergedServiceSelector::~CConvergedServiceSelector
       
    57         (
       
    58         // None.
       
    59         )
       
    60     {
       
    61     CancelSelection();
       
    62     }
       
    63 
       
    64 // -----------------------------------------------------------------------------
       
    65 // CConvergedServiceSelector::GetCallingServiceByCallType
       
    66 // Gets the calling service by current call type and service id.
       
    67 // -----------------------------------------------------------------------------
       
    68 //
       
    69 EXPORT_C TInt CConvergedServiceSelector::GetCallingServiceByCallType
       
    70         (
       
    71         TSsResult& aResult, 
       
    72         TSsCallType aCallType,
       
    73         TUint aServiceId,
       
    74         TBool aSendKey,
       
    75         const TDesC& aString
       
    76         )
       
    77     { 
       
    78     CSSLOGSTRING4("CSSelector: calltype:%d ,serviceId:%d ,sendkey:%d",
       
    79                 (TInt)aCallType,
       
    80                 (TInt)aServiceId,
       
    81                 (TInt)aSendKey);
       
    82     
       
    83     if ( iHandler )
       
    84         {
       
    85         // Selection currently ongoing, return error.
       
    86         return KErrNotReady;
       
    87         }
       
    88     
       
    89     
       
    90     TRAPD( ret, DoGetCallingServiceByCallTypeL( aResult,
       
    91                                                 aCallType,
       
    92                                                 aServiceId,
       
    93                                                 aSendKey,
       
    94                                                 aString ) );
       
    95     
       
    96     
       
    97     // Free resources
       
    98     CancelSelection();
       
    99     
       
   100     CSSLOGSTRING2("CSSelector error:%d", ret);
       
   101     CSSLOGSTRING4("CSSelector result: calltype:%d ,serviceId:%d ,enabled:%d",
       
   102                 (TInt)aResult.iCallType,
       
   103                 (TInt)aResult.iServiceId,
       
   104                 (TInt)aResult.iServiceEnabled);
       
   105     
       
   106     return ret;
       
   107     }
       
   108 
       
   109 // -----------------------------------------------------------------------------
       
   110 // CConvergedServiceSelector::GetCallingServiceByCallType
       
   111 // Cancels selection.
       
   112 // -----------------------------------------------------------------------------
       
   113 //
       
   114 EXPORT_C void CConvergedServiceSelector::CancelSelection
       
   115         (
       
   116         // None
       
   117         )
       
   118     { 
       
   119     CSSLOGSTRING("CSSelector::CancelSelection");    
       
   120     // Free memory
       
   121     delete iHandler;
       
   122     iHandler = NULL;    
       
   123     }
       
   124 
       
   125 // -----------------------------------------------------------------------------
       
   126 // CConvergedServiceSelector::DoGetCallingServiceByCallTypeL
       
   127 // Gets the calling service by current call type and service id.
       
   128 // -----------------------------------------------------------------------------
       
   129 //
       
   130 void CConvergedServiceSelector::DoGetCallingServiceByCallTypeL
       
   131         (
       
   132         TSsResult& aResult, 
       
   133         TSsCallType aCallType,
       
   134         TUint aServiceId,
       
   135         TBool aSendKey,
       
   136         const TDesC& aString
       
   137         )
       
   138 
       
   139     {  
       
   140     // Get handler by calltype
       
   141     iHandler = SsServiceUtilities::ServiceHandlerByCallTypeL( 
       
   142                                     aCallType,
       
   143                                     aSendKey );
       
   144     
       
   145     
       
   146     // Execute handler.                                
       
   147     iHandler->ExecuteServiceSelectionL( aResult,
       
   148                                         aCallType,
       
   149                                         aServiceId,
       
   150                                         aSendKey,
       
   151                                         aString );
       
   152 
       
   153     }
       
   154 
       
   155 // ================= OTHER EXPORTED FUNCTIONS ===============================
       
   156 
       
   157 //  End of File