phoneengine/callhandling/src/cpesinglecall.cpp
changeset 37 ba76fc04e6c2
child 51 f39ed5e045e0
child 65 2a5d4ab426d3
equal deleted inserted replaced
36:2eacb6118286 37:ba76fc04e6c2
       
     1 /*
       
     2 * Copyright (c) 2003-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 file contains the implementation of CPESingleCall class 
       
    15 *                member functions.
       
    16 *
       
    17 */
       
    18 
       
    19 
       
    20 // INCLUDE FILES
       
    21 #include <pepanic.pan>
       
    22 #include <talogger.h>
       
    23 
       
    24 #include "cpesinglecall.h"
       
    25 #include "mpecallowner.h"
       
    26 #include "cpevideocallhandling.h"
       
    27 
       
    28 
       
    29 // ================= MEMBER FUNCTIONS =======================
       
    30 // Destructor
       
    31 //
       
    32 CPESingleCall::~CPESingleCall()
       
    33     {
       
    34     TEFLOGSTRING( KTAOBJECT, "CALL CPESingleCall::~CPESingleCall: Start." );
       
    35     TEFLOGSTRING( KTAOBJECT, "CALL CPESingleCall::~CPESingleCall: Complete." );
       
    36     }
       
    37 
       
    38 // -----------------------------------------------------------------------------
       
    39 // CPESingleCall::CPESingleCall
       
    40 // C++ default constructor can NOT contain any code, that
       
    41 // might leave.
       
    42 // -----------------------------------------------------------------------------
       
    43 //
       
    44 CPESingleCall::CPESingleCall( 
       
    45         MPEMessageSender& aOwner
       
    46         ) : CPESingleCallObserver( aOwner ),
       
    47             iMissedCall( EFalse)
       
    48     {
       
    49     TEFLOGSTRING( KTAOBJECT, "CALL CPESingleCall::CPESingleCall start." );
       
    50     TEFLOGSTRING( KTAOBJECT, "CALL CPESingleCall::CPESingleCall complete." );
       
    51     }
       
    52 
       
    53 // -----------------------------------------------------------------------------
       
    54 // CPEGsmVoiceCall::ConstructL
       
    55 // Symbian 2nd phase constructor can leave.
       
    56 // -----------------------------------------------------------------------------
       
    57 //
       
    58 void CPESingleCall::ConstructL()
       
    59     {
       
    60     TEFLOGSTRING( KTAOBJECT, "CALL CPESingleCall:::ConstructL start." );
       
    61     TEFLOGSTRING( KTAOBJECT, "CALL CPESingleCall::ConstructL complete." );
       
    62     }
       
    63 
       
    64 // -----------------------------------------------------------------------------
       
    65 // CPEGsmVoiceCall::NewL
       
    66 // Two-phased constructor.
       
    67 // -----------------------------------------------------------------------------
       
    68 //
       
    69 CPESingleCall* CPESingleCall::NewL( 
       
    70         MPEMessageSender& aOwner )
       
    71     {
       
    72     TEFLOGSTRING( KTAOBJECT, "CALL CPESingleCall::NewL start." );
       
    73     CPESingleCall* self = new ( ELeave ) CPESingleCall( aOwner );
       
    74     CleanupStack::PushL(self);
       
    75     self->ConstructL( );
       
    76     CleanupStack::Pop( self );
       
    77 
       
    78     TEFLOGSTRING( KTAOBJECT, "CALL CPESingleCall::NewL complete." );
       
    79     return self;
       
    80     }
       
    81 
       
    82 // -----------------------------------------------------------------------------
       
    83 // CPESingleCall::SendMessage
       
    84 // Method reroutes messages from other modules to the CPEPhoneData-object
       
    85 // Note that it does not use base class SendMessage.
       
    86 // -----------------------------------------------------------------------------
       
    87 //
       
    88 void CPESingleCall::SendMessage( 
       
    89         const MEngineMonitor::TPEMessagesFromPhoneEngine aMessage )
       
    90     {
       
    91     iErrorCode = KErrNone;
       
    92     if( aMessage == MEngineMonitor::EPEMessageIdle )
       
    93         {
       
    94         // Get the call duration before the call object is closed.
       
    95         iDuration = Call().CallDuration();
       
    96         TEFLOGSTRING2( 
       
    97             KTAREQEND, 
       
    98             "CALL CPESingleCall::SendMessage: MCCECall::GetCallDuration() called, Duration: %d", 
       
    99             iDuration.Int() );
       
   100         }
       
   101    
       
   102     if ( aMessage != MEngineMonitor::EPEMessageUnknown )
       
   103         {
       
   104         CPECall::SendMessage( aMessage );
       
   105         }
       
   106         
       
   107     }
       
   108 
       
   109 // -----------------------------------------------------------------------------
       
   110 // CPESingleCall::Answer
       
   111 // Method Answers the incoming call.
       
   112 // Method creates iCallInfo parameter package and
       
   113 // makes answer request to CPECallCommand-parameter.
       
   114 // -----------------------------------------------------------------------------
       
   115 //
       
   116 TInt CPESingleCall::Answer()
       
   117     {
       
   118     SetMissedCall( EFalse );
       
   119     return Call().Answer();    
       
   120     }
       
   121 
       
   122 // -----------------------------------------------------------------------------
       
   123 // CPESingleCall::Dial
       
   124 // creates dial request to the CPECallCommand object.
       
   125 // Method opens the line for the new call.
       
   126 // If error occurs the method returns error value.
       
   127 // Method makes call parameter package and
       
   128 // starts monitoring call statuses and call events and
       
   129 // makes a dial request to the CPECallCommand object.
       
   130 // -----------------------------------------------------------------------------
       
   131 //
       
   132 TInt CPESingleCall::Dial( 
       
   133         const RMobileCall::TTelNumberC& aNumber )
       
   134     {
       
   135     TInt errorCode( KErrNone );
       
   136     iDialledNumber = aNumber;
       
   137     
       
   138     TEFLOGSTRING( KTAINT, "CALL CPESingleCall::Dial");
       
   139     errorCode = Call().Dial(KNullDesC8);
       
   140     
       
   141     return errorCode;
       
   142     }
       
   143 
       
   144 // -----------------------------------------------------------------------------
       
   145 // CPESingleCall::DialEmergency
       
   146 // creates emergency dial request to the CPECallCommand object
       
   147 // -----------------------------------------------------------------------------
       
   148 //
       
   149 void CPESingleCall::DialEmergency(
       
   150         const TPEPhoneNumber& aEmergencyNumber )
       
   151     {
       
   152     TEFLOGSTRING( KTAINT, "CALL CPESingleCall::DialEmergency" );
       
   153     iCall->DialEmergencyCall( aEmergencyNumber );
       
   154     }
       
   155 
       
   156 // -----------------------------------------------------------------------------
       
   157 // CPESingleCall::DisableFDNCheck
       
   158 // Disables FDN checking for SIM ATK originated calls
       
   159 // -----------------------------------------------------------------------------
       
   160 //
       
   161 void CPESingleCall::DisableFDNCheck()
       
   162     {
       
   163     TEFLOGSTRING( KTAINT, "CALL CPESingleCall::DisableFDNCheck UNSUPPORTED" );
       
   164     
       
   165     // NOTE! Currently disabled due to incomplete TSY implementation
       
   166     // Remove comments after this task is completed
       
   167     
       
   168     //iCall->NoFDNCheck();
       
   169     }
       
   170         
       
   171 // -----------------------------------------------------------------------------
       
   172 // CPESingleCall::Hold
       
   173 // creates hold request to the CPECallCommand object
       
   174 // -----------------------------------------------------------------------------
       
   175 //
       
   176 TInt CPESingleCall::Hold()
       
   177     {
       
   178     TEFLOGSTRING( KTAINT, "CALL CPESingleCall::Hold" );
       
   179     return iCall->Hold();
       
   180     }
       
   181 
       
   182 // -----------------------------------------------------------------------------
       
   183 // CPESingleCall::Resume
       
   184 // Method resumes held call
       
   185 // -----------------------------------------------------------------------------
       
   186 //
       
   187 TInt CPESingleCall::Resume()
       
   188     {
       
   189     TEFLOGSTRING( KTAINT, "CALL CPESingleCall::Resume" );
       
   190     return iCall->Resume();
       
   191     }
       
   192 
       
   193 // -----------------------------------------------------------------------------
       
   194 // CPESingleCall::Swap
       
   195 // Method swaps active and held call
       
   196 // -----------------------------------------------------------------------------
       
   197 //
       
   198 TInt CPESingleCall::Swap()
       
   199     {
       
   200     TEFLOGSTRING( KTAINT, "CALL CPESingleCall::Swap" );
       
   201     return iCall->Swap();
       
   202     }
       
   203 
       
   204 // -----------------------------------------------------------------------------
       
   205 // CPESingleCall::Transfer
       
   206 // Method Transfers the active and the held call.
       
   207 // -----------------------------------------------------------------------------
       
   208 //
       
   209 void CPESingleCall::Transfer( const TDesC& aTransferTarget )
       
   210     {
       
   211     TEFLOGSTRING( KTAINT, "CALL CPESingleCall::Transfer" );
       
   212     iCall->AttendedTransfer( aTransferTarget );
       
   213     }
       
   214 
       
   215 // -----------------------------------------------------------------------------
       
   216 // CPESingleCall::Tone
       
   217 // Returns the inband tone needed to play in state transition
       
   218 // -----------------------------------------------------------------------------
       
   219 //
       
   220 TCCPTone CPESingleCall::Tone()
       
   221     {
       
   222     TEFLOGSTRING( KTAINT, "CALL CPESingleCall::Tone" );
       
   223     return iCall->Tone();
       
   224     }
       
   225 
       
   226 // -----------------------------------------------------------------------------
       
   227 // CPESingleCall::HangUp
       
   228 // 
       
   229 // -----------------------------------------------------------------------------
       
   230 //
       
   231 TInt CPESingleCall::HangUp()
       
   232     {
       
   233     TEFLOGSTRING( KTAREQOUT, "CALL CPESingleCall::HangUp" );
       
   234     SetMissedCall( EFalse );
       
   235     return iCall->HangUp();
       
   236     }
       
   237 
       
   238 // -----------------------------------------------------------------------------
       
   239 // CPESingleCall::GetCallInfo
       
   240 // Method returns call information.
       
   241 // -----------------------------------------------------------------------------
       
   242 //
       
   243 TInt CPESingleCall::GetCallInfo(
       
   244         RMobileCall::TMobileCallInfoV3& aCallInfo )
       
   245     {
       
   246     TEFLOGSTRING( KTAREQOUT, 
       
   247             "CALL CPESingleCall::GetCallInfo > RMobileCall::GetMobileCallInfo()" );
       
   248     RMobileCall::TMobileCallInfoV3Pckg callInfoPckg( iCallInfo );
       
   249     Call().GetMobileCallInfo( callInfoPckg );
       
   250 
       
   251     iCallInfo = callInfoPckg();
       
   252    
       
   253     aCallInfo = iCallInfo;
       
   254     return KErrNone;
       
   255     }
       
   256 
       
   257 // -----------------------------------------------------------------------------
       
   258 // CPESingleCall::SetMissedCall
       
   259 // Set the missed call indicator = ETrue, if the current call
       
   260 // was hanged up on state ringing by remote party.
       
   261 // -----------------------------------------------------------------------------
       
   262 //
       
   263 void CPESingleCall::SetMissedCall( TBool aMissed )
       
   264     {
       
   265     TEFLOGSTRING2( KTAINT, "CALL CPESingleCall::SetMissedCall: Call Missed. %d", aMissed );
       
   266     iMissedCall = aMissed; 
       
   267     }
       
   268 
       
   269 // -----------------------------------------------------------------------------
       
   270 // CPESingleCall::GetMissedCall
       
   271 // Returns the missed data call indicator.
       
   272 // -----------------------------------------------------------------------------
       
   273 //
       
   274 TInt CPESingleCall::GetMissedCall(
       
   275         TBool& aMissedCall) const
       
   276     {
       
   277     aMissedCall = iMissedCall;
       
   278     return KErrNone;
       
   279     }
       
   280 
       
   281 // -----------------------------------------------------------------------------
       
   282 // CPESingleCall::IsSecureCall
       
   283 // -----------------------------------------------------------------------------
       
   284 //
       
   285 TBool CPESingleCall::IsSecureCall() const
       
   286     {
       
   287     TEFLOGSTRING( KTAINT, "CALL CPESingleCall::IsSecureCall" );
       
   288     return iCall->IsSecured();
       
   289     }
       
   290 
       
   291 // -----------------------------------------------------------------------------
       
   292 // CPESingleCall::SecureSpecified
       
   293 // -----------------------------------------------------------------------------
       
   294 //
       
   295 TBool CPESingleCall::SecureSpecified() const
       
   296     {
       
   297     TEFLOGSTRING( KTAINT, "CALL CPESingleCall::SecureSpecified" );
       
   298     return iCall->SecureSpecified(); 
       
   299     }
       
   300 
       
   301 // -----------------------------------------------------------------------------
       
   302 // CPESingleCall::AcceptUnattendedTransfer
       
   303 // -----------------------------------------------------------------------------
       
   304 //
       
   305 TInt CPESingleCall::AcceptUnattendedTransfer()
       
   306     {
       
   307     TEFLOGSTRING( KTAINT, "CALL CPESingleCall::AcceptUnattendedTransfer" );
       
   308     
       
   309     return iCall->AcceptTransfer( ETrue );
       
   310     }
       
   311 
       
   312 
       
   313 // -----------------------------------------------------------------------------
       
   314 // CPESingleCall::RejectUnattendedTransfer
       
   315 // -----------------------------------------------------------------------------
       
   316 //
       
   317 TInt CPESingleCall::RejectUnattendedTransfer()
       
   318     {
       
   319     TEFLOGSTRING( KTAINT, "CALL CPESingleCall::RejectUnattendedTransfer" );
       
   320     
       
   321     return iCall->AcceptTransfer( EFalse );
       
   322     }
       
   323 
       
   324 // -----------------------------------------------------------------------------
       
   325 // CPESingleCall::UnattendedTransfer
       
   326 // -----------------------------------------------------------------------------
       
   327 //
       
   328 TInt CPESingleCall::UnattendedTransfer( const TDesC& aTransferTo ) const
       
   329     {
       
   330     TEFLOGSTRING( KTAINT, "CALL CPESingleCall::UnattendedTransfer" );
       
   331 
       
   332     return iCall->UnattendedTransfer( aTransferTo );
       
   333     }
       
   334 
       
   335 // -----------------------------------------------------------------------------
       
   336 // CPESingleCall::ForwardCallToAddress
       
   337 // -----------------------------------------------------------------------------
       
   338 //
       
   339 TInt CPESingleCall::ForwardCallToAddress( TInt aIndex )
       
   340     {
       
   341     TEFLOGSTRING( KTAINT, "CALL CPESingleCall::ForwardToAddress" );
       
   342     TRAPD( err, iCall->ForwardToAddressL( aIndex ) );
       
   343     return err;
       
   344     }
       
   345     
       
   346 // End of File