phoneuis/TelephonyDeviceMode/src/CTelDMHandlerImpl.cpp
changeset 50 377c906a8701
parent 46 bc5a64e5bc3c
child 52 a49bfe5190e4
equal deleted inserted replaced
46:bc5a64e5bc3c 50:377c906a8701
     1 /*
       
     2 * Copyright (c) 2005-2006 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:  Implementation of the CTelDMFactoryImpl class.
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 
       
    20 // INCLUDE FILES
       
    21 #include    <featmgr.h>
       
    22 #include    <mphonedevicemodeobserver.h>
       
    23 #include    <telinternalpskeys.h>
       
    24 #include    "cteldmhandlerimpl.h"
       
    25 #include    "cteldmgriphandler.h"
       
    26 #include    "cteldmcommandhandler.h"
       
    27 #include    "cteldmcallstatelistener.h"
       
    28 #include    "cteldmaudioaccessorylistener.h"
       
    29 #include    "cteldmdebug.h"
       
    30  
       
    31 // MODULE DATA STRUCTURES
       
    32 
       
    33 // ============================ MEMBER FUNCTIONS ===============================
       
    34 
       
    35 // -----------------------------------------------------------------------------
       
    36 // CTelDMHandlerImpl
       
    37 // 
       
    38 // Creates instance of telephony device mode factory.
       
    39 // -----------------------------------------------------------------------------
       
    40 //
       
    41 EXPORT_C CTelDMHandler* CTelDMHandlerCreateL()
       
    42     {
       
    43     return CTelDMHandlerImpl::NewL();
       
    44     }
       
    45 
       
    46 // -----------------------------------------------------------------------------
       
    47 // CTelDMHandlerImpl::CTelDMHandlerImpl
       
    48 // C++ default constructor can NOT contain any code, that
       
    49 // might leave.
       
    50 // -----------------------------------------------------------------------------
       
    51 //
       
    52 CTelDMHandlerImpl::CTelDMHandlerImpl()
       
    53     {
       
    54     }
       
    55 
       
    56 // -----------------------------------------------------------------------------
       
    57 // CTelDMHandlerImpl::~CTelDMHandlerImpl
       
    58 // -----------------------------------------------------------------------------
       
    59 //    
       
    60 CTelDMHandlerImpl::~CTelDMHandlerImpl()
       
    61     {
       
    62     delete iCallStateListener;
       
    63     delete iAccessory;
       
    64     delete iCommandHandler;
       
    65     delete iGrip;
       
    66     FLOG( _L( "CTelDMHandlerImpl::~CTelDMHandlerImpl()" ) )
       
    67     }
       
    68 
       
    69 // -----------------------------------------------------------------------------
       
    70 // CTelDMHandlerImpl::NewL
       
    71 // 
       
    72 // -----------------------------------------------------------------------------
       
    73 //
       
    74 CTelDMHandlerImpl* CTelDMHandlerImpl::NewL()
       
    75     {
       
    76     CTelDMHandlerImpl* self = new( ELeave ) CTelDMHandlerImpl;
       
    77     return self;
       
    78     }
       
    79 
       
    80 // -----------------------------------------------------------------------------
       
    81 // CTelDMHandlerImpl::SetObserverL
       
    82 // 
       
    83 // -----------------------------------------------------------------------------
       
    84 //
       
    85 void CTelDMHandlerImpl::SetObserverL( MPhoneDeviceModeObserver* aCallHandler )
       
    86     {
       
    87     // Default
       
    88     RProperty::Set( 
       
    89         KPSUidTelAudioPreference,
       
    90         KTelAudioOutput,
       
    91         EPSAudioPrivate );                
       
    92                         
       
    93     if ( !FeatureManager::FeatureSupported( KFeatureIdKeypadNoSlider ) )
       
    94         {
       
    95         iCallStateListener = CTelDMCallStateListener::NewL();
       
    96         iAccessory = CTelDMAudioAccessoryListener::NewL();
       
    97         // Disconnects and answers to calls 
       
    98         iCommandHandler = CTelDMCommandHandler::NewL( 
       
    99                                             *aCallHandler, 
       
   100                                             *iAccessory );
       
   101 
       
   102         iCallStateListener->AddObserverL( *iCommandHandler );
       
   103         
       
   104         iGrip = CTelDMGripHandler::NewL( *iCommandHandler );
       
   105 
       
   106         }
       
   107     }
       
   108 
       
   109 //  End of File
       
   110 
       
   111