telutils/xqtelephonyservice/tsrc/unit/ut_xqcallinfo/stubs/ccallinformationimpl.cpp
branchRCL_3
changeset 20 987c9837762f
parent 19 7d48bed6ce0c
child 21 0a6dd2dc9970
equal deleted inserted replaced
19:7d48bed6ce0c 20:987c9837762f
     1 /*
       
     2 * Copyright (c) 2007-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:  Provides implementation for CCallInformation -class.
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 #include <e32base.h>
       
    20 #include <callinformation.h>    //Call Information Mediator API
       
    21 
       
    22 #include "CCallInformationImpl.h"
       
    23 #include "ccallinfoiter.h"
       
    24 #include "mcallinformationobserver.h"
       
    25 
       
    26 bool GlobalEmptyCallList;
       
    27 bool GlobalTriggerSignal;
       
    28 
       
    29 // ======== MEMBER FUNCTIONS ========
       
    30 
       
    31 // ---------------------------------------------------------------------------
       
    32 // C++ constructor.
       
    33 // ---------------------------------------------------------------------------
       
    34 //
       
    35 CCallInformationImpl::CCallInformationImpl()
       
    36     {
       
    37         
       
    38     }
       
    39 
       
    40 
       
    41 // ---------------------------------------------------------------------------
       
    42 // Two-phased constructor.
       
    43 // ---------------------------------------------------------------------------
       
    44 //
       
    45 CCallInformationImpl* CCallInformationImpl::NewL()
       
    46     {
       
    47     CCallInformationImpl* self = new (ELeave) CCallInformationImpl( );  
       
    48     return self;
       
    49     }
       
    50 
       
    51 // ---------------------------------------------------------------------------
       
    52 // Destructor
       
    53 // ---------------------------------------------------------------------------
       
    54 //
       
    55 CCallInformationImpl::~CCallInformationImpl()
       
    56     {
       
    57     delete iInfos;
       
    58     delete iCallIter;   
       
    59     
       
    60     delete iInfosInState;    
       
    61     delete iCallStateIter;   
       
    62     }
       
    63 
       
    64 
       
    65 // ---------------------------------------------------------------------------
       
    66 // Saves the observer call information changes.
       
    67 // ---------------------------------------------------------------------------
       
    68 //
       
    69 void CCallInformationImpl::NotifyCallInformationChanges(
       
    70     MCallInformationObserver& aObserver )
       
    71     {
       
    72     iObserver = &aObserver;
       
    73     return;
       
    74     }
       
    75     
       
    76 // ---------------------------------------------------------------------------
       
    77 // Removes the observer.
       
    78 // ---------------------------------------------------------------------------
       
    79 //
       
    80 void CCallInformationImpl::CancelNotification( )
       
    81     {
       
    82     iObserver = NULL;
       
    83     return;
       
    84     }
       
    85 
       
    86 
       
    87 // ---------------------------------------------------------------------------
       
    88 // Returns info about all calls. 
       
    89 // ---------------------------------------------------------------------------
       
    90 //
       
    91 CCallInfoIter& CCallInformationImpl::GetCallsL( )
       
    92     {    
       
    93     iInfos = CCallInfos::NewL();  
       
    94     
       
    95     if (!GlobalEmptyCallList)
       
    96         {
       
    97         TCallInfo callInfo;
       
    98             int index = 0;
       
    99             unsigned int serviceId = 1;
       
   100             callInfo.iIndex = index;
       
   101             callInfo.iServiceId = serviceId;
       
   102             callInfo.iDirection= CCPCall::EMobileOriginated;
       
   103             callInfo.iType = CCPCall::ECallTypeCSVoice;
       
   104             callInfo.iState = CCPCall::EStateDialling;
       
   105             iInfos->AddL(callInfo);
       
   106             
       
   107             index++;
       
   108             serviceId++;
       
   109             callInfo.iIndex = index;
       
   110             callInfo.iServiceId = serviceId;
       
   111             callInfo.iDirection= CCPCall::EMobileTerminated;
       
   112             callInfo.iType = CCPCall::ECallTypeCSVoice;
       
   113             callInfo.iState = CCPCall::EStateConnected;
       
   114             iInfos->AddL(callInfo);
       
   115         }
       
   116     
       
   117     iCallIter = CCallInfoIter::NewL( *iInfos );
       
   118                       
       
   119     return *iCallIter;            
       
   120     }
       
   121 
       
   122 // ---------------------------------------------------------------------------
       
   123 // Returns information whether call in given state exist. 
       
   124 // ---------------------------------------------------------------------------
       
   125 //
       
   126 TBool CCallInformationImpl::IsCallInState( CCPCall::TCallState aState ) const
       
   127     {
       
   128     bool value(false);
       
   129     if (aState == CCPCall::EStateConnected)
       
   130         {
       
   131         value = true;
       
   132         }
       
   133     
       
   134     if( GlobalTriggerSignal )
       
   135         {
       
   136         iObserver->CallInformationChanged();
       
   137         GlobalTriggerSignal=false;
       
   138         }
       
   139     
       
   140     return value;
       
   141     }
       
   142