convergedcallengine/csplugin/src/cspforwardprovider.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:  Contains the implementation of class CSPForwardProvider
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 #include <mccpforwardprovider.h>
       
    20 #include <mccpforwardobserver.h>
       
    21 #include <etelmm.h>
       
    22 #include <badesca.h>    // CDesC8ArrayFlat
       
    23 
       
    24 #include "cspforwardprovider.h"
       
    25 #include "csplogger.h"
       
    26 
       
    27 
       
    28 // ---------------------------------------------------------------------------
       
    29 // Two phased construction
       
    30 // ---------------------------------------------------------------------------
       
    31 //
       
    32 CSPForwardProvider* CSPForwardProvider::NewL ( )
       
    33     {
       
    34     CSPForwardProvider* self = new ( ELeave ) CSPForwardProvider( );
       
    35     CleanupStack::PushL( self );
       
    36     self->ConstructL( );
       
    37     CleanupStack::Pop( self );
       
    38     return self;    
       
    39     }
       
    40     
       
    41 // ---------------------------------------------------------------------------
       
    42 // Destructor of the object.
       
    43 // ---------------------------------------------------------------------------
       
    44 //
       
    45 CSPForwardProvider::~CSPForwardProvider()
       
    46     {
       
    47     delete iEmptyArray;
       
    48     iObservers.Close();
       
    49     }
       
    50 
       
    51 // ---------------------------------------------------------------------------
       
    52 // CSPCall::NotifyForwardEventOccurred
       
    53 // Notifies observers about call events
       
    54 // ---------------------------------------------------------------------------
       
    55 //
       
    56 void CSPForwardProvider::NotifyForwardEventOccurred( 
       
    57     MCCPForwardObserver::TCCPForwardEvent aEvent )
       
    58     {
       
    59     CSPLOGSTRING2( CSPREQOUT, 
       
    60         "CSPForwardProvider::ForwardEventOccurred: event: %d", aEvent );
       
    61 
       
    62     for ( TInt i = 0; i < iObservers.Count(); i++ )
       
    63         {
       
    64         MCCPForwardObserver *obs = iObservers[i];
       
    65         if ( obs )
       
    66             {                
       
    67             obs->ForwardEventOccurred( aEvent );
       
    68             }
       
    69         }
       
    70     }
       
    71 
       
    72 // ---------------------------------------------------------------------------
       
    73 // Forward address choice array.
       
    74 // ---------------------------------------------------------------------------
       
    75 //  
       
    76 const CDesC8Array& CSPForwardProvider::GetForwardAddressChoicesL()
       
    77     {
       
    78     return *iEmptyArray;
       
    79     }
       
    80 
       
    81 // ---------------------------------------------------------------------------
       
    82 // Forward to address. 
       
    83 // Not supported. 
       
    84 // ---------------------------------------------------------------------------
       
    85 //  
       
    86 void CSPForwardProvider::ForwardToAddressL( const TInt /*aIndex*/ )
       
    87     {
       
    88     User::Leave( KErrNotSupported );
       
    89     return;
       
    90     }
       
    91         
       
    92 // ---------------------------------------------------------------------------
       
    93 // Adds observer to array
       
    94 // ---------------------------------------------------------------------------
       
    95 //
       
    96 void CSPForwardProvider::AddObserverL( const MCCPForwardObserver& aObserver )
       
    97     {
       
    98     if ( iObservers.Find( &aObserver ) == KErrNotFound )
       
    99         {
       
   100         iObservers.Append( &aObserver );
       
   101         }
       
   102     }
       
   103 
       
   104 // ---------------------------------------------------------------------------
       
   105 // Removes observer from array
       
   106 // ---------------------------------------------------------------------------
       
   107 //
       
   108 TInt CSPForwardProvider::RemoveObserver( const MCCPForwardObserver& aObserver )
       
   109     {
       
   110     TInt found = iObservers.Find( &aObserver );
       
   111     if ( found != KErrNotFound )
       
   112         {
       
   113         iObservers.Remove( found );
       
   114         return KErrNone;
       
   115         }
       
   116     return found;
       
   117     }
       
   118 
       
   119 // ---------------------------------------------------------------------------
       
   120 // Default C++ constructor
       
   121 // ---------------------------------------------------------------------------
       
   122 //
       
   123 CSPForwardProvider::CSPForwardProvider( )
       
   124     {
       
   125     CSPLOGSTRING(CSPOBJECT, "CSPForwardProvider::CSPForwardProvider()" );
       
   126     }
       
   127 
       
   128 // ---------------------------------------------------------------------------
       
   129 // Constructing 2nd phase
       
   130 // ---------------------------------------------------------------------------
       
   131 //
       
   132 void CSPForwardProvider::ConstructL()
       
   133     {
       
   134     CSPLOGSTRING(CSPOBJECT, "CSPForwardProvider::ConstructL()" );
       
   135     iEmptyArray = new (ELeave) CDesC8ArrayFlat( 1 );
       
   136     }
       
   137