convergedcallengine/csplugin/src/cspvoicecall.cpp
branchRCL_3
changeset 20 987c9837762f
parent 0 ff3b6d0fd310
equal deleted inserted replaced
19:7d48bed6ce0c 20:987c9837762f
       
     1 /*
       
     2 * Copyright (c) 2007 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:  Implements class CSPVoiceCall which provides call functionality
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 #include <etelmm.h>
       
    20 #include <etel.h>
       
    21 #include <mccpcallobserver.h>
       
    22 #include <cccecallparameters.h>
       
    23 
       
    24 #include "cspvoicecall.h"
       
    25 #include "cspetelcallrequester.h"
       
    26 #include "cspetelcalleventmonitor.h"
       
    27 #include "cspetelcallstatusmonitor.h"
       
    28 #include "csplogger.h"
       
    29 #include "csppanic.pan"
       
    30 #include "cspconsts.h"
       
    31 #include "mcspcommoninfo.h"
       
    32 
       
    33 
       
    34 // ---------------------------------------------------------------------------
       
    35 // CSPVoiceCall::NewL Two phased construction.
       
    36 // ---------------------------------------------------------------------------
       
    37 //
       
    38 CSPVoiceCall* CSPVoiceCall::NewL( const TDesC& aName, 
       
    39                           RMobileLine& aLine, TBool aMobileOriginated, 
       
    40                           const CCCECallParameters& aParams,
       
    41                           MCSPCommonInfo& aCommonInfo,
       
    42                           TBool aIsEmergency )
       
    43     {
       
    44     CSPLOGSTRING(CSPOBJECT, "CSPVoiceCall::NewL <");
       
    45     
       
    46     CSPVoiceCall* self = new ( ELeave ) CSPVoiceCall( aLine, 
       
    47                                             aMobileOriginated,
       
    48                                             aName,
       
    49                                             aCommonInfo,
       
    50                                             aIsEmergency );
       
    51     CleanupStack::PushL( self );
       
    52     self->ConstructL( aParams );
       
    53     CleanupStack::Pop( self );
       
    54     CSPLOGSTRING(CSPOBJECT, "CSPVoiceCall::NewL >");
       
    55     return self;
       
    56     }
       
    57     
       
    58 // ---------------------------------------------------------------------------
       
    59 // CSPVoiceCall::~CSPVoiceCall
       
    60 // ---------------------------------------------------------------------------
       
    61 //
       
    62 CSPVoiceCall::~CSPVoiceCall()
       
    63     {
       
    64     CSPLOGSTRING(CSPOBJECT, "CSPVoiceCall::~CSPVoiceCall");
       
    65     }
       
    66 
       
    67 // ---------------------------------------------------------------------------
       
    68 // CSPVoiceCall::GoOneToOneL
       
    69 // Goes one to one from conference.
       
    70 // ---------------------------------------------------------------------------
       
    71 //
       
    72 TInt CSPVoiceCall::GoOneToOne( )
       
    73     {
       
    74     CSPLOGSTRING(CSPREQIN, "CSPVoiceCall::GoOneToOne");
       
    75     return iRequester->MakeRequest( 
       
    76         CSPEtelCallRequester::ERequestTypeGoOneToOne );
       
    77     }
       
    78     
       
    79 // ---------------------------------------------------------------------------
       
    80 // From class MCCPCSCall
       
    81 // CSPVoiceCall::Dial
       
    82 // ---------------------------------------------------------------------------
       
    83 //
       
    84 TInt CSPVoiceCall::DialFdnCond( TBool aFdnCond )
       
    85     {
       
    86     CSPLOGSTRING(CSPREQIN, "CSPVoiceCall::DialFdnCond <");
       
    87 
       
    88     if ( !iMobileOriginated )
       
    89         {
       
    90         CSPLOGSTRING(CSPINT, 
       
    91                 "CSPVoiceCall::DialFdnCond MT CALL, Dial not supported");
       
    92         return KErrNotSupported;
       
    93         }
       
    94 
       
    95     CSPLOGSTRING(CSPINT, "CSPVoiceCall::DialFdnCond making request");
       
    96 
       
    97     SetDefaultCallParameters();
       
    98     iCommonInfo.InitializeCallParameters( iCallParams );
       
    99     iCallParams.iSubAddress = iParams->SubAddress();
       
   100     iCallParams.iBearerCap1 = iParams->Bearer();
       
   101     
       
   102     if ( CCCECallParameters::ECCECallOriginSAT == iParams->Origin() )
       
   103         {
       
   104         iCallParams.iCallParamOrigin = RMobileCall::EOriginatorSIM;
       
   105         }
       
   106 
       
   107     TInt err(KErrNone);
       
   108     if ( aFdnCond )
       
   109         {
       
   110         err = iRequester->MakeDialRequest( iCallParamsPckg, iRemotePartyNumber );
       
   111         }
       
   112     else
       
   113         {
       
   114         err = iRequester->MakeDialNoFdnCheckRequest( 
       
   115                         iCallParamsPckg, iRemotePartyNumber );
       
   116         }
       
   117     CSPLOGSTRING2(CSPINT, "CSPVoiceCall::DialFdnCond > res: %d", err );
       
   118     return err;    
       
   119     }
       
   120 
       
   121 // ---------------------------------------------------------------------------
       
   122 // Make the DialEmergencyCall request to ETel ( impl. of MCCPEmergencyCall )
       
   123 // ---------------------------------------------------------------------------
       
   124 //
       
   125 TInt CSPVoiceCall::Dial( const TDesC& aEmergencyNumber )
       
   126     {    
       
   127     CSPLOGSTRING2(CSPREQIN, "CSPVoiceCall::Dial EMERGENCY %S", &aEmergencyNumber);
       
   128     iDialCompletionCode = KErrNone;
       
   129     iTerminationErrorNotified = EFalse;
       
   130     iIsEmergencyCall = ETrue;
       
   131     iEmergencyNumber.Zero(); 
       
   132     TInt emergencyNumberLength = aEmergencyNumber.Length(); 
       
   133     
       
   134     if ( emergencyNumberLength > 0 && 
       
   135         emergencyNumberLength <= RMobileENStore::KEmergencyNumberSize )
       
   136         {
       
   137         iEmergencyNumber.Append( aEmergencyNumber );
       
   138         }
       
   139     else if ( emergencyNumberLength > RMobileENStore::KEmergencyNumberSize )
       
   140         {                
       
   141         CSPLOGSTRING(CSPERROR, "CSPVoiceCall::Dial invalid argument" );
       
   142         return KErrArgument; 
       
   143         }
       
   144     
       
   145     CSPLOGSTRING2(CSPREQIN, "CSPVoiceCall::Dial using %S", &iEmergencyNumber);
       
   146     
       
   147     TInt err( iRequester->MakeDialEmergencyRequest( iEmergencyNumber ) );
       
   148 
       
   149     CSPLOGSTRING2(CSPINT, "CSPVoiceCall::Dial res %d", err );
       
   150     return err;
       
   151     }
       
   152     
       
   153 // ---------------------------------------------------------------------------
       
   154 // From class MCCPCall
       
   155 // CSPVoiceCall::Answer
       
   156 // ---------------------------------------------------------------------------
       
   157 //
       
   158 TInt CSPVoiceCall::Answer()
       
   159     {
       
   160     CSPLOGSTRING(CSPREQIN, "CSPVoiceCall::Answer");    
       
   161     return CSPCall::Answer();
       
   162     }
       
   163     
       
   164 // ---------------------------------------------------------------------------
       
   165 // From class MCCPCall
       
   166 // CSPCall::HangUp
       
   167 // ---------------------------------------------------------------------------
       
   168 //
       
   169 TInt CSPVoiceCall::HangUp()
       
   170     {
       
   171     CSPLOGSTRING(CSPREQIN, "CSPVoiceCall::HangUp");    
       
   172     return CSPCall::HangUp();   
       
   173     }
       
   174 
       
   175 // ---------------------------------------------------------------------------
       
   176 // From class MCCPCall
       
   177 // CSPVoiceCall::Cancel
       
   178 // ---------------------------------------------------------------------------
       
   179 //
       
   180 TInt CSPVoiceCall::Cancel()
       
   181     {
       
   182     CSPLOGSTRING(CSPREQIN, "CSPVoiceCall::Cancel");    
       
   183     return CSPCall::Cancel();
       
   184     }
       
   185 
       
   186 // ---------------------------------------------------------------------------
       
   187 // From class MCCPCSCall
       
   188 // CSPVoiceCall::SwitchAlternatingCall
       
   189 // ---------------------------------------------------------------------------
       
   190 //
       
   191 TInt CSPVoiceCall::SwitchAlternatingCall()
       
   192     {
       
   193     CSPLOGSTRING(CSPERROR, "CSPVoiceCall::SwitchAlternatingCall not supported!");
       
   194     return KErrNotSupported;
       
   195     }
       
   196 
       
   197 // ---------------------------------------------------------------------------
       
   198 // CSPVoiceCall::CSPVoiceCall
       
   199 // ---------------------------------------------------------------------------
       
   200 //
       
   201 CSPVoiceCall::CSPVoiceCall( RMobileLine& aLine, 
       
   202                   TBool aMobileOriginated,
       
   203                   const TDesC& aName,
       
   204                   MCSPCommonInfo& aCommonInfo,
       
   205                   TBool aIsEmergency ):CSPCall( aLine,
       
   206                      aMobileOriginated, aName, 
       
   207                      aCommonInfo, aIsEmergency ),
       
   208                      iCallParams(),
       
   209                      iCallParamsPckg (iCallParams)
       
   210                      
       
   211     {
       
   212     CSPLOGSTRING(CSPOBJECT, "CSPVoiceCall::CSPVoiceCall");
       
   213     }
       
   214 
       
   215 // ---------------------------------------------------------------------------
       
   216 // CSPVoiceCall::ConstructL
       
   217 // Constructing CSPVoiceCall for MT call.
       
   218 // ---------------------------------------------------------------------------
       
   219 //    
       
   220 void CSPVoiceCall::ConstructL( const CCCECallParameters& aParams )
       
   221     {
       
   222     CSPLOGSTRING(CSPOBJECT, "CSPVoiceCall::ConstructL <");
       
   223     CSPCall::ConstructL( aParams );
       
   224     CSPLOGSTRING(CSPOBJECT, "CSPVoiceCall::ConstructL >");
       
   225     }
       
   226 
       
   227 // ---------------------------------------------------------------------------
       
   228 // CSPVoiceCall::SetDefaultCallParameters
       
   229 // ---------------------------------------------------------------------------
       
   230 //
       
   231 void CSPVoiceCall::SetDefaultCallParameters()
       
   232     {
       
   233     CSPLOGSTRING(CSPOBJECT, "CSPVoiceCall::SetDefaultCallParameters");
       
   234     
       
   235     //Set defaults
       
   236     iCallParams.iSpeakerControl = RMobileCall::EMonitorSpeakerControlAlwaysOn;
       
   237     iCallParams.iSpeakerVolume = RMobileCall::EMonitorSpeakerVolumeMedium;
       
   238     iCallParams.iInterval = KCSPDefaultInterval;
       
   239     iCallParams.iWaitForDialTone = RMobileCall::EDialToneNoWait;
       
   240     iCallParams.iIdRestrict = RMobileCall::EIdRestrictDefault;
       
   241     iCallParams.iAutoRedial = KCSPDefaultAutoRedial;
       
   242     }
       
   243 
       
   244 // End of File