phoneengine/phonemodel/src/cpeexternaldatahandler.cpp
branchRCL_3
changeset 62 5266b1f337bd
parent 61 41a7f70b3818
--- a/phoneengine/phonemodel/src/cpeexternaldatahandler.cpp	Tue Aug 31 15:14:29 2010 +0300
+++ b/phoneengine/phonemodel/src/cpeexternaldatahandler.cpp	Wed Sep 01 12:30:10 2010 +0100
@@ -18,7 +18,6 @@
 
 
 // INCLUDE FILES
-#include "penetworkhandler.h"
 #include "cpeexternaldatahandler.h"
 #include "mpephonemodelinternal.h"
 #include <accessoriescrkeys.h>
@@ -32,6 +31,10 @@
 #include <telephonyvariant.hrh>
 #include <telinternalcrkeys.h>
 
+
+// CONSTANTS
+const TInt KPrefixLength = 10;
+
 CPEExternalDataHandler* CPEExternalDataHandler::NewL( MPEPhoneModelInternal& aModel )
     {
     CPEExternalDataHandler* self = new ( ELeave ) CPEExternalDataHandler( *aModel.DataStore() );
@@ -61,13 +64,14 @@
     delete iTelephonyVariationRepository;
     delete iTelephonySettingsRepository;
     delete iProfileSettings;
-    delete iNetworkRegistrationStatus;   
+    delete iNetworkRegistrationStatus;
+    delete iLoudspeakerVolumeSetting;
+    delete iEarVolumeSetting;
     delete iCallDurationDisplay;
     delete iAudioOutputPreferenceMonitor;
     delete iAccessorySettingsRepository;
     delete iAccessoryModeMonitor;
     delete iCoreApplicationRepository;
-    delete iNetworkHandler;
     }
 
 // -----------------------------------------------------------------------------
@@ -81,23 +85,19 @@
     TEFLOGSTRING( KTAOBJECT, "PE CPEExternalDataHandler::BaseConstructL" );
 
     // Instantiate monitor objects
-    iAudioOutputPreferenceMonitor = CPEAudioOutputPreferenceMonitor::NewL( aModel );    
-    iCallDurationDisplay = CPECallDurationDisplaySettingMonitor::NewL(); 
+    iAudioOutputPreferenceMonitor = CPEAudioOutputPreferenceMonitor::NewL( aModel );
+    iCallDurationDisplay = CPECallDurationDisplaySettingMonitor::NewL();
+    iEarVolumeSetting = CPEIncallEarVolumeSettingMonitor::NewL( aModel );
+    iLoudspeakerVolumeSetting = CPEIncallLoudspeakerVolumeSettingMonitor::NewL( aModel );
+    iNetworkRegistrationStatus = CPENetworkRegistrationStatusMonitor::NewL( aModel );
     iProfileSettings = CPEProfileSettingMonitor::NewL( aModel );
-    
-    iNetworkHandler = new PeNetworkHandler(aModel);
-    //TODO
-    /*
-    iNetworkRegistrationStatus = CPENetworkRegistrationStatusMonitor::NewL( aModel );
     iAccessoryModeMonitor = CPEAccessoryModeMonitor::NewL(); 
 
     // Instantiate repository objects for later use
-    iAccessorySettingsRepository = CRepository::NewL( KCRUidAccessorySettings );*/
-    //iTelephonySettingsRepository = CRepository::NewL( KCRUidTelephonySettings );
+    iAccessorySettingsRepository = CRepository::NewL( KCRUidAccessorySettings );
+    iTelephonySettingsRepository = CRepository::NewL( KCRUidTelephonySettings );
     iTelephonyVariationRepository = CRepository::NewL( KCRUidTelVariation );
     iCoreApplicationRepository = CRepository::NewL( KCRUidCoreApplicationUIs ); 
-   
-    TEFLOGSTRING( KTAOBJECT, "PE CPEExternalDataHandler::BaseConstructL 2" );
     }
 
 // -----------------------------------------------------------------------------
@@ -112,37 +112,106 @@
     {
     TInt errorCode( KErrNotFound );
 
-    //TODO
-
-    if ( EPETelephonyVariationFlags == aSetting )
-        {
-        errorCode = iTelephonyVariationRepository->Get( KTelVariationFlags, aValue );
-        TEFLOGSTRING2( KTAINT, "CPEExternalDataHandler::Get EPETelephonyVariationFlags, error code: %d", errorCode );
-        }
-    else if ( EPEAudioOutputPreference == aSetting )
-        {
-        errorCode = iAudioOutputPreferenceMonitor->Get( aValue );
-        TEFLOGSTRING2( KTAINT, "CPEExternalDataHandler::Get EPEAudioOutputPreference, error code: %d", errorCode );
-        }    
-    else if ( EPECallDurationDisplaySetting == aSetting )
+    // Process Common id
+    switch ( aSetting )
         {
-        errorCode = iCallDurationDisplay->Get( aValue );
-        TEFLOGSTRING2( KTAINT, "CPEExternalDataHandler::Get EPECallDurationDisplaySetting, error code: %d", errorCode );
-        }
-    else if ( EPENetworkConnectionAllowedSetting == aSetting )
-        {
-        // Fetches setting that indicates if network connection is allowed,
-        // i.e. is the phone in off-line mode. 
-        errorCode = iCoreApplicationRepository
+        case EPEAutomaticAnswerHeadsetSetting:
+            {
+            errorCode = GetAutomaticAnswer( KSettingsHeadsetAutomaticAnswer, aValue );
+            TEFLOGSTRING2( KTAINT, "CPEExternalDataHandler::Get EPEAutomaticAnswerHeadsetSetting, error code: %d",errorCode );
+            break;
+            }        
+        case EPEAutomaticAnswerLoopsetSetting:
+            {
+            errorCode = GetAutomaticAnswer( KSettingsLoopsetAutomaticAnswer, aValue );
+            TEFLOGSTRING2( KTAINT, "CPEExternalDataHandler::Get EPEAutomaticAnswerLoopsetSetting, error code: %d", errorCode );
+            break;
+            }        
+        case EPEAutomaticAnswerCarkitSetting:
+            {
+            errorCode = GetAutomaticAnswer( KSettingsCarKitAutomaticAnswer, aValue );
+            TEFLOGSTRING2( KTAINT, "CPEExternalDataHandler::Get EPEAutomaticAnswerCarkitSetting, error code: %d", errorCode );
+            break;
+            }        
+        case EPEAutomaticAnswerMusicStandSetting:
+            {
+            errorCode = GetAutomaticAnswer( KSettingsMusicStandAutomaticAnswer, aValue );
+            TEFLOGSTRING2( KTAINT, "CPEExternalDataHandler::Get EPEAutomaticAnswerMusicStandSetting, error code: %d", errorCode );
+            break;
+            }        
+        case EPEAutomaticAnswerWirelessCarkitSetting:
+            {
+            errorCode = GetAutomaticAnswer( KSettingsWirelessCarkitAutomaticAnswer, aValue );
+            TEFLOGSTRING2( KTAINT, "CPEExternalDataHandler::Get EPEAutomaticAnswerWirelessCarkitSetting, error code: %d", errorCode );
+            break;
+            }
+        case EPEAudioOutputPreference:
+            {
+            errorCode = iAudioOutputPreferenceMonitor->Get( aValue );
+            TEFLOGSTRING2( KTAINT, "CPEExternalDataHandler::Get EPEAudioOutputPreference, error code: %d", errorCode );
+            break;
+            }
+        case EPECallDurationDisplaySetting:
+            {
+            errorCode = iCallDurationDisplay->Get( aValue );
+            TEFLOGSTRING2( KTAINT, "CPEExternalDataHandler::Get EPECallDurationDisplaySetting, error code: %d", errorCode );
+            break;
+            }
+        case EPEDialPrefixChangeSetting:
+            {
+            errorCode = iTelephonySettingsRepository->Get( KSettingsDialPrefixChangeMode, aValue );
+            TEFLOGSTRING2( KTAINT, "CPEExternalDataHandler::Get EPEDialPrefixChangeSetting, error code: %d", errorCode );
+            break;
+            }
+        case EPEIncallEarVolumeSetting:
+            {
+            errorCode = iEarVolumeSetting->Get( aValue );
+            TEFLOGSTRING2( KTAINT, "CPEExternalDataHandler::Get EPEIncallEarVolumeSetting, error code: %d", errorCode );
+            break;
+            }
+        case EPEIncallLoudspeakerVolumeSetting:
+            {
+            errorCode = iLoudspeakerVolumeSetting->Get( aValue );
+            TEFLOGSTRING2( KTAINT, "CPEExternalDataHandler::Get EPEIncallLoudspeakerVolumeSetting, error code: %d", errorCode );
+            break;
+            }
+        case EPENetworkRegistrationStatus:
+            {
+            errorCode = iNetworkRegistrationStatus->Get( aValue );
+            TEFLOGSTRING2( KTAINT, "CPEExternalDataHandler::Get EPENetworkRegistrationStatus, error code: %d", errorCode );
+            break;
+            }
+        case EPETelephonyVariationFlags:
+            {
+            errorCode = iTelephonyVariationRepository->Get( KTelVariationFlags, aValue );
+            TEFLOGSTRING2( KTAINT, "CPEExternalDataHandler::Get EPETelephonyVariationFlags, error code: %d", errorCode );
+            break;
+            }
+        case EPEAccessoryMode:            
+            {
+            errorCode = KErrNone;
+            aValue = iAccessoryModeMonitor->AccessoryMode();
+            TEFLOGSTRING2( KTAINT, "CPEExternalDataHandler::Get EPEAccessoryMode, error code: %d", errorCode );
+            break;
+            }
+        case EPENetworkConnectionAllowedSetting:
+            {
+            // Fetches setting that indicates if network connection is allowed,
+            // i.e. is the phone in off-line mode. This method is used while
+            // attempting an emergency call, so no memory may be consumed.
+            errorCode = iCoreApplicationRepository
                 ->Get( KCoreAppUIsNetworkConnectionAllowed, aValue );
-        }
-    else
-        {
-        errorCode = KErrNone;
-        aValue = 0;        
+            TEFLOGSTRING2( KTAINT, "CPEGsmExternalDataHandler::Get EPENetworkConnectionAllowedSetting, error code: %d",errorCode );
+            break;
+            }
+        default:
+            {
+            TEFLOGSTRING2( KTAERROR, 
+                "PE CPEEXTERNALDATAHANDLER::GET UNKNOWN SETTING ID ! %d", aSetting );
+            break;
+            }
         }
 
-    // Process Common id
     return errorCode;
     }
 
@@ -153,13 +222,35 @@
 // -----------------------------------------------------------------------------
 //
 TInt CPEExternalDataHandler::GetText(
-        const TPEExternalDataId /*aSetting*/,
+        const TPEExternalDataId aSetting,
         TDesC& aValue ) const
     {
     TInt errorCode( KErrNotFound );
-    //TODO
-    aValue = KNullDesC;
-    errorCode = KErrNone;
+
+    // Process Common id
+    switch ( aSetting )
+        {
+        case EPEDialPrefixTextSetting:
+            {
+            TBuf<KPrefixLength> prefixTextSetting;
+            
+            errorCode = iTelephonySettingsRepository->Get( 
+                KSettingsDialPrefixText, 
+                prefixTextSetting );
+                
+            aValue = prefixTextSetting;
+            
+            TEFLOGSTRING2( KTAINT, "CPEExternalDataHandler::GetText EPEDialPrefixTextSetting, error code: %d", errorCode );
+            break;
+            }
+        default:
+            {
+            TEFLOGSTRING2( KTAERROR, 
+                "PE CPEEXTERNALDATAHANDLER::GETTEXT UNKNOWN SETTING ID ! %d", aSetting );
+            break;
+            }
+        }
+
     return errorCode;
     }
 
@@ -169,14 +260,15 @@
 // -----------------------------------------------------------------------------
 //
 TInt CPEExternalDataHandler::GetAutomaticAnswer(
-        TUint32 /*aSetting*/,
+        TUint32 aSetting,
         TInt& aValue ) const
     {
     TInt errorCode( KErrNotFound );
     
     TEFLOGSTRING( KTAINT, "CPEExternalDataHandler::GetAutomaticAnswer" );
-    errorCode = KErrNone;
-    aValue = 0;
+   
+    errorCode = iAccessorySettingsRepository->Get( aSetting, aValue );
+     
     return errorCode;
     }
 
@@ -193,6 +285,16 @@
 
     switch ( aSetting )
         {
+        case EPEIncallEarVolumeSetting:
+            {
+            errorCode = iEarVolumeSetting->Set( aValue );
+            break;
+            }
+        case EPEIncallLoudspeakerVolumeSetting:
+            {
+            errorCode = iLoudspeakerVolumeSetting->Set( aValue );
+            break;
+            }
         case EPEEmergencyCallInfo:
             {
             errorCode = RProperty::Set( KPSUidCtsyEmergencyCallInfo,