phoneengine/phonemodel/src/cpeexternaldatahandler.cpp
changeset 37 ba76fc04e6c2
child 46 bc5a64e5bc3c
equal deleted inserted replaced
36:2eacb6118286 37:ba76fc04e6c2
       
     1 /*
       
     2 * Copyright (c) 2005 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 module contains the implementation of 
       
    15 *                CPEExternalDataHandler class 
       
    16 *
       
    17 */
       
    18 
       
    19 
       
    20 // INCLUDE FILES
       
    21 #include "cpeexternaldatahandler.h"
       
    22 #include "mpephonemodelinternal.h"
       
    23 #include <accessoriescrkeys.h>
       
    24 #include <centralrepository.h>
       
    25 #include <CoreApplicationUIsSDKCRKeys.h>
       
    26 #include <ctsydomainpskeys.h>
       
    27 #include <mpedatastore.h>
       
    28 #include <pepanic.pan>
       
    29 #include <settingsinternalcrkeys.h>
       
    30 #include <talogger.h>
       
    31 #include <telephonyvariant.hrh>
       
    32 #include <telinternalcrkeys.h>
       
    33 
       
    34 CPEExternalDataHandler* CPEExternalDataHandler::NewL( MPEPhoneModelInternal& aModel )
       
    35     {
       
    36     CPEExternalDataHandler* self = new ( ELeave ) CPEExternalDataHandler( *aModel.DataStore() );
       
    37     CleanupStack::PushL( self );
       
    38     self->ConstructL( aModel );
       
    39     CleanupStack::Pop( self );
       
    40     return self;
       
    41     }
       
    42 
       
    43 // -----------------------------------------------------------------------------
       
    44 // CPEExternalDataHandler::CPEExternalDataHandler
       
    45 // C++ default constructor can NOT contain any code, that
       
    46 // might leave.
       
    47 // -----------------------------------------------------------------------------
       
    48 //
       
    49 CPEExternalDataHandler::CPEExternalDataHandler(
       
    50         MPEDataStore& aDataStore
       
    51         ) : iDataStore( aDataStore )
       
    52     {
       
    53     }
       
    54 
       
    55 // Destructor
       
    56 CPEExternalDataHandler::~CPEExternalDataHandler()
       
    57     {
       
    58     TEFLOGSTRING( KTAOBJECT, "PE CPEExternalDataHandler::~CPEExternalDataHandler" );    
       
    59 
       
    60     delete iTelephonyVariationRepository;
       
    61     delete iTelephonySettingsRepository;
       
    62     delete iProfileSettings;
       
    63     delete iNetworkRegistrationStatus;   
       
    64     delete iCallDurationDisplay;
       
    65     delete iAudioOutputPreferenceMonitor;
       
    66     delete iAccessorySettingsRepository;
       
    67     delete iAccessoryModeMonitor;
       
    68     delete iCoreApplicationRepository;
       
    69     delete iNetworkHandler;
       
    70     }
       
    71 
       
    72 // -----------------------------------------------------------------------------
       
    73 // CPEExternalDataHandler::BaseConstructL
       
    74 // Symbian 2nd phase constructor can leave.
       
    75 // -----------------------------------------------------------------------------
       
    76 //
       
    77 void CPEExternalDataHandler::ConstructL(
       
    78         MPEPhoneModelInternal& aModel )
       
    79     {
       
    80     TEFLOGSTRING( KTAOBJECT, "PE CPEExternalDataHandler::BaseConstructL" );
       
    81 
       
    82     // Instantiate monitor objects
       
    83     iAudioOutputPreferenceMonitor = CPEAudioOutputPreferenceMonitor::NewL( aModel );    
       
    84     iCallDurationDisplay = CPECallDurationDisplaySettingMonitor::NewL(); 
       
    85     iProfileSettings = CPEProfileSettingMonitor::NewL( aModel );
       
    86     
       
    87     iNetworkHandler = new PeNetworkHandler(aModel);
       
    88     //TODO
       
    89     /*
       
    90     iNetworkRegistrationStatus = CPENetworkRegistrationStatusMonitor::NewL( aModel );
       
    91     iAccessoryModeMonitor = CPEAccessoryModeMonitor::NewL(); 
       
    92 
       
    93     // Instantiate repository objects for later use
       
    94     iAccessorySettingsRepository = CRepository::NewL( KCRUidAccessorySettings );*/
       
    95     //iTelephonySettingsRepository = CRepository::NewL( KCRUidTelephonySettings );
       
    96     iTelephonyVariationRepository = CRepository::NewL( KCRUidTelVariation );
       
    97     //iCoreApplicationRepository = CRepository::NewL( KCRUidCoreApplicationUIs ); 
       
    98    
       
    99     TEFLOGSTRING( KTAOBJECT, "PE CPEExternalDataHandler::BaseConstructL 2" );
       
   100     }
       
   101 
       
   102 // -----------------------------------------------------------------------------
       
   103 // CPEExternalDataHandler::Get
       
   104 // Gets the current value of the specified setting, if the operation was successful
       
   105 // aValue contains the current valid value of the setting
       
   106 // -----------------------------------------------------------------------------
       
   107 //
       
   108 TInt CPEExternalDataHandler::Get(
       
   109         const TPEExternalDataId aSetting,
       
   110         TInt& aValue ) const
       
   111     {
       
   112     TInt errorCode( KErrNotFound );
       
   113 
       
   114     //TODO
       
   115 
       
   116     if ( EPETelephonyVariationFlags == aSetting )
       
   117         {
       
   118         errorCode = iTelephonyVariationRepository->Get( KTelVariationFlags, aValue );
       
   119         TEFLOGSTRING2( KTAINT, "CPEExternalDataHandler::Get EPETelephonyVariationFlags, error code: %d", errorCode );
       
   120         }
       
   121     else if ( EPEAudioOutputPreference == aSetting )
       
   122         {
       
   123         errorCode = iAudioOutputPreferenceMonitor->Get( aValue );
       
   124         TEFLOGSTRING2( KTAINT, "CPEExternalDataHandler::Get EPEAudioOutputPreference, error code: %d", errorCode );
       
   125         }    
       
   126     else if ( EPECallDurationDisplaySetting == aSetting )
       
   127         {
       
   128         errorCode = iCallDurationDisplay->Get( aValue );
       
   129         TEFLOGSTRING2( KTAINT, "CPEExternalDataHandler::Get EPECallDurationDisplaySetting, error code: %d", errorCode );
       
   130         }
       
   131     else
       
   132         {
       
   133         errorCode = KErrNone;
       
   134         aValue = 0;        
       
   135         }
       
   136     
       
   137     // Process Common id
       
   138     return errorCode;
       
   139     }
       
   140 
       
   141 // -----------------------------------------------------------------------------
       
   142 // CPEExternalDataHandler::Get
       
   143 // Gets the current value of the specified setting, if the operation was successful
       
   144 // aValue contains the current valid value of the setting
       
   145 // -----------------------------------------------------------------------------
       
   146 //
       
   147 TInt CPEExternalDataHandler::GetText(
       
   148         const TPEExternalDataId /*aSetting*/,
       
   149         TDesC& aValue ) const
       
   150     {
       
   151     TInt errorCode( KErrNotFound );
       
   152     //TODO
       
   153     aValue = KNullDesC;
       
   154     errorCode = KErrNone;
       
   155     return errorCode;
       
   156     }
       
   157 
       
   158 // -----------------------------------------------------------------------------
       
   159 // CPEExternalDataHandler::GetAutomaticAnswer
       
   160 // Check if automatic answer is defined for connected accessory.
       
   161 // -----------------------------------------------------------------------------
       
   162 //
       
   163 TInt CPEExternalDataHandler::GetAutomaticAnswer(
       
   164         TUint32 /*aSetting*/,
       
   165         TInt& aValue ) const
       
   166     {
       
   167     TInt errorCode( KErrNotFound );
       
   168     
       
   169     TEFLOGSTRING( KTAINT, "CPEExternalDataHandler::GetAutomaticAnswer" );
       
   170     errorCode = KErrNone;
       
   171     aValue = 0;
       
   172     return errorCode;
       
   173     }
       
   174 
       
   175 // -----------------------------------------------------------------------------
       
   176 // CPEExternalDataHandler::Set
       
   177 // Sets the value of the specified setting
       
   178 // -----------------------------------------------------------------------------
       
   179 //
       
   180 TInt CPEExternalDataHandler::Set(
       
   181         const TPEExternalDataId aSetting,
       
   182         const TInt aValue )
       
   183     {
       
   184     TInt errorCode( KErrNotFound );
       
   185 
       
   186     switch ( aSetting )
       
   187         {
       
   188         case EPEEmergencyCallInfo:
       
   189             {
       
   190             errorCode = RProperty::Set( KPSUidCtsyEmergencyCallInfo, 
       
   191                                         KCTSYEmergencyCallInfo, aValue );
       
   192             TEFLOGSTRING2( KTAERROR, 
       
   193             "PE CPEExternalDataHandler::Set KPSUidCtsyEmergencyCallInfo: %d", aValue );
       
   194             break;            
       
   195             }
       
   196         default:
       
   197             {
       
   198             TEFLOGSTRING2( KTAERROR, "PE CPEEXTERNALDATAHANDLER::SET UNKNOWN SETTING ID ! %d", aSetting );
       
   199             break;
       
   200             }
       
   201         }
       
   202     return errorCode;
       
   203     }
       
   204 
       
   205 // End of file