os/mm/devsoundextensions/globalaudiosettings/src/GlobalAudioSettingsImpl.cpp
changeset 0 bde4ae8d615e
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/os/mm/devsoundextensions/globalaudiosettings/src/GlobalAudioSettingsImpl.cpp	Fri Jun 15 03:10:57 2012 +0200
     1.3 @@ -0,0 +1,1521 @@
     1.4 +/*
     1.5 +* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies). 
     1.6 +* All rights reserved.
     1.7 +* This component and the accompanying materials are made available
     1.8 +* under the terms of "Eclipse Public License v1.0"
     1.9 +* which accompanies this distribution, and is available
    1.10 +* at the URL "http://www.eclipse.org/legal/epl-v10.html".
    1.11 +*
    1.12 +* Initial Contributors:
    1.13 +* Nokia Corporation - initial contribution.
    1.14 +*
    1.15 +* Contributors:
    1.16 +*
    1.17 +* Description:   Implementation of the Phone Profile Settings API
    1.18 +*
    1.19 +*/
    1.20 +
    1.21 +
    1.22 +
    1.23 +
    1.24 +// INCLUDE FILES
    1.25 +#include "GlobalAudioSettingsImpl.h"
    1.26 +#include <e32std.h>
    1.27 +#include <GlobalAudioSettingsPSKeys.h>
    1.28 +#include <MGlobalAudioSettingsObserver.h>
    1.29 +#include <centralrepository.h>
    1.30 +#include "AudioClientsListManagerAO.h"
    1.31 +#include <AudioClientsListPSKeys.h>
    1.32 +
    1.33 +#ifdef _DEBUG
    1.34 +#define PRINT_MESSAGE
    1.35 +#endif // _DEBUG
    1.36 +
    1.37 +const TInt KMaxLength=256;
    1.38 +_LIT( KNoSound, "z:\\resource\\No_Sound.wav" );
    1.39 +// ============================ MEMBER FUNCTIONS ===============================
    1.40 +
    1.41 +// -----------------------------------------------------------------------------
    1.42 +// CGlobalAudioSettingsImpl::NewL();
    1.43 +// 
    1.44 +// -----------------------------------------------------------------------------
    1.45 +//
    1.46 +CGlobalAudioSettingsImpl::CGlobalAudioSettingsImpl(
    1.47 +                            CGlobalAudioSettings &aGlobalAudioSettings,
    1.48 +                            MAudioSettingsObserver& aAudioSettingsObserver)
    1.49 +:iGlobalAudioSettings(aGlobalAudioSettings),
    1.50 + iAudioSettingsObserver(aAudioSettingsObserver)
    1.51 +	{
    1.52 +	}
    1.53 +	
    1.54 +// -----------------------------------------------------------------------------
    1.55 +// CGlobalAudioSettingsImpl::NewL();
    1.56 +// 
    1.57 +// -----------------------------------------------------------------------------
    1.58 +//
    1.59 +CGlobalAudioSettingsImpl* CGlobalAudioSettingsImpl::NewL(
    1.60 +                                        CGlobalAudioSettings &aGlobalAudioSettings,
    1.61 +                                        MAudioSettingsObserver& aAudioSettingsObserver)
    1.62 +	{
    1.63 +	CGlobalAudioSettingsImpl* self = new (ELeave) CGlobalAudioSettingsImpl(
    1.64 +	                                    aGlobalAudioSettings,aAudioSettingsObserver);
    1.65 +    CleanupStack::PushL( self );
    1.66 +    self->ConstructL();
    1.67 +    CleanupStack::Pop( self );
    1.68 +    return self;
    1.69 +	}
    1.70 +	
    1.71 +// -----------------------------------------------------------------------------
    1.72 +// CGlobalAudioSettingsImpl::ConstructL();
    1.73 +// 
    1.74 +// -----------------------------------------------------------------------------
    1.75 +//
    1.76 +void CGlobalAudioSettingsImpl::ConstructL()
    1.77 +	{
    1.78 +	iWarningTonesObserverAO = CWarningTonesObserverAO::NewL(
    1.79 +                	                                        iGlobalAudioSettings,
    1.80 +                	                                        iAudioSettingsObserver,
    1.81 +                	                                        iGlobalAudioSettingsData);
    1.82 +	iWarningTonesObserverAO->Subscribe();
    1.83 +	
    1.84 +	iMessagingTonesObserverAO = CMessagingTonesObserverAO::NewL(
    1.85 +                                        	                iGlobalAudioSettings,
    1.86 +                                        	                iAudioSettingsObserver,
    1.87 +                                        	                iGlobalAudioSettingsData);
    1.88 +	iMessagingTonesObserverAO->Subscribe();
    1.89 +
    1.90 +	iSilentProfileObserverAO = CSilentProfileObserverAO::NewL(
    1.91 +                                        	                iGlobalAudioSettings,
    1.92 +                                        	                iAudioSettingsObserver,
    1.93 +                                        	                iGlobalAudioSettingsData);
    1.94 +	iSilentProfileObserverAO->Subscribe();
    1.95 +
    1.96 +	iVibraObserverAO = CVibraObserverAO::NewL(
    1.97 +                        	                iGlobalAudioSettings,
    1.98 +                        	                iAudioSettingsObserver,
    1.99 +                        	                iGlobalAudioSettingsData);
   1.100 +	iVibraObserverAO->Subscribe();
   1.101 +	iRingingTypeObserverAO = CRingingTypeObserverAO::NewL(
   1.102 +	                                            iGlobalAudioSettings,
   1.103 +	                                            iAudioSettingsObserver,
   1.104 +	                                            iGlobalAudioSettingsData);
   1.105 +    iRingingTypeObserverAO->Subscribe();
   1.106 +     
   1.107 +	iMessageToneObserverAO = CMessageToneObserverAO::NewL(
   1.108 +	                                            iGlobalAudioSettings,
   1.109 +	                                            iAudioSettingsObserver,
   1.110 +	                                            iGlobalAudioSettingsData);
   1.111 +	iMessageToneObserverAO->Subscribe();
   1.112 +	iEmailToneObserverAO = CEmailToneObserverAO::NewL(
   1.113 +	                                                iGlobalAudioSettings,
   1.114 +	                                                iAudioSettingsObserver,
   1.115 +	                                                iGlobalAudioSettingsData);
   1.116 +	iEmailToneObserverAO->Subscribe();   
   1.117 +	
   1.118 +	
   1.119 +    iVideoCallObserverAO = CVideoCallToneObserverAO::NewL(
   1.120 +                                                            iGlobalAudioSettings,
   1.121 +                                                            iAudioSettingsObserver,
   1.122 +                                                            iGlobalAudioSettingsData);
   1.123 +    iVideoCallObserverAO->Subscribe();  
   1.124 +        
   1.125 +    iRingingTone1ObserverAO = CRingingTone1ObserverAO::NewL(
   1.126 +                                                                    iGlobalAudioSettings,
   1.127 +                                                                    iAudioSettingsObserver,
   1.128 +                                                                    iGlobalAudioSettingsData);
   1.129 +    iRingingTone1ObserverAO->Subscribe();
   1.130 +	
   1.131 +    iRingingTone2ObserverAO = CRingingTone2ObserverAO::NewL(
   1.132 +                                                                            iGlobalAudioSettings,
   1.133 +                                                                            iAudioSettingsObserver,
   1.134 +                                                                            iGlobalAudioSettingsData);
   1.135 +    iRingingTone2ObserverAO->Subscribe();  
   1.136 +	
   1.137 +    iKeypadToneObserverAO = CKeypadToneObserverAO::NewL(
   1.138 +                                                                            iGlobalAudioSettings,
   1.139 +                                                                            iAudioSettingsObserver,
   1.140 +                                                                            iGlobalAudioSettingsData);
   1.141 +    iKeypadToneObserverAO->Subscribe();  
   1.142 +                
   1.143 +    iSilenceModeObserverAO = CSilenceModeObserverAO::NewL(
   1.144 +                                                                                iGlobalAudioSettings,
   1.145 +                                                                                iAudioSettingsObserver,
   1.146 +                                                                                iGlobalAudioSettingsData);
   1.147 +     iSilenceModeObserverAO->Subscribe();  
   1.148 +	                    
   1.149 +    RProperty publicSilenceProperty;
   1.150 +	User::LeaveIfError(publicSilenceProperty.Attach(KGASPSUidGlobalAudioSettings, KGASPublicSilence));
   1.151 +	User::LeaveIfError(publicSilenceProperty.Get(iGlobalAudioSettingsData.iPublicSilence));
   1.152 +	publicSilenceProperty.Close();
   1.153 +
   1.154 +    iCAudioClientsListManagerAO = CAudioClientsListManagerAO::NewL( iGlobalAudioSettings,iAudioClientsListObserverArray,KAudioPolicyAudioClients);
   1.155 +            
   1.156 +    iPausedClientsListManagerAO = CAudioClientsListManagerAO::NewL( iGlobalAudioSettings,iAudioClientsListObserverArray,KAudioPolicyApplicationAudioStatePaused );
   1.157 +    }
   1.158 +    
   1.159 +// Destructor
   1.160 +CGlobalAudioSettingsImpl::~CGlobalAudioSettingsImpl()
   1.161 +    {
   1.162 +        delete iWarningTonesObserverAO;
   1.163 +        delete iMessagingTonesObserverAO;
   1.164 +        delete iSilentProfileObserverAO;
   1.165 +        delete iVibraObserverAO;
   1.166 +        delete iRingingTypeObserverAO;
   1.167 +        delete iMessageToneObserverAO;
   1.168 +        delete iEmailToneObserverAO;
   1.169 +        delete iVideoCallObserverAO;
   1.170 +        delete iRingingTone1ObserverAO;
   1.171 +        delete iRingingTone2ObserverAO;
   1.172 +        delete iKeypadToneObserverAO;
   1.173 +        delete iSilenceModeObserverAO;
   1.174 +        delete iCAudioClientsListManagerAO;
   1.175 +        delete iPausedClientsListManagerAO;
   1.176 +        iAudioClientsListObserverArray.Close();
   1.177 +    }
   1.178 +
   1.179 +// -----------------------------------------------------------------------------
   1.180 +// CGlobalAudioSettingsImpl::NewL
   1.181 +// Static function for creating an instance of the EnvironmentalReverb object.
   1.182 +// -----------------------------------------------------------------------------
   1.183 +//
   1.184 + TBool CGlobalAudioSettingsImpl::IsWarningTonesEnabled()
   1.185 +	{
   1.186 +	if(iGlobalAudioSettingsData.iWarningTones)
   1.187 +	    return(ETrue);
   1.188 +	else
   1.189 +	    return(EFalse);
   1.190 +	}
   1.191 +
   1.192 +// -----------------------------------------------------------------------------
   1.193 +// CGlobalAudioSettingsImpl::IsMessageTonesEnabled
   1.194 +// 
   1.195 +// -----------------------------------------------------------------------------
   1.196 +//
   1.197 +TBool CGlobalAudioSettingsImpl::IsMessageTonesEnabled()
   1.198 +	{
   1.199 +	if(iGlobalAudioSettingsData.iMessageTones)
   1.200 +	    return(ETrue);
   1.201 +	else
   1.202 +	    return(EFalse);
   1.203 +	}
   1.204 +
   1.205 +// -----------------------------------------------------------------------------
   1.206 +// CGlobalAudioSettingsImpl::IsSilentProfileEnabled
   1.207 +// 
   1.208 +// -----------------------------------------------------------------------------
   1.209 +//
   1.210 +TBool CGlobalAudioSettingsImpl::IsSilentProfileEnabled()
   1.211 +	{
   1.212 +	if(iGlobalAudioSettingsData.iSilentProfile)
   1.213 +	    return(ETrue);
   1.214 +	else
   1.215 +	    return(EFalse);
   1.216 +	}
   1.217 +
   1.218 +// -----------------------------------------------------------------------------
   1.219 +// CGlobalAudioSettingsImpl::IsVibraEnabled
   1.220 +// 
   1.221 +// -----------------------------------------------------------------------------
   1.222 +//
   1.223 + TBool CGlobalAudioSettingsImpl::IsVibraEnabled()
   1.224 +	{
   1.225 +	if(iGlobalAudioSettingsData.iVibra)
   1.226 +	    return(ETrue);
   1.227 +	else
   1.228 +	    return(EFalse);
   1.229 +	}
   1.230 +
   1.231 +// -----------------------------------------------------------------------------
   1.232 +// CGlobalAudioSettingsImpl::IsPublicSilenceEnabled
   1.233 +// 
   1.234 +// -----------------------------------------------------------------------------
   1.235 +//
   1.236 +TBool CGlobalAudioSettingsImpl::IsPublicSilenceEnabled()
   1.237 +	{
   1.238 +	if(iGlobalAudioSettingsData.iPublicSilence)
   1.239 +	    return(ETrue);
   1.240 +	else
   1.241 +	    return(EFalse);
   1.242 +	}
   1.243 +
   1.244 +
   1.245 +
   1.246 +
   1.247 +TDesC& CGlobalAudioSettingsImpl::MessageAlertTone()
   1.248 +    {
   1.249 +     return *iGlobalAudioSettingsData.iMessageToneName;
   1.250 +    
   1.251 +    }
   1.252 +
   1.253 +TBool CGlobalAudioSettingsImpl::IsMessageAlertToneEnabled()
   1.254 +    {
   1.255 +     if(iGlobalAudioSettingsData.iMessageToneName->CompareF(KNoSound)==0)
   1.256 +         return EFalse;
   1.257 +     else
   1.258 +         return ETrue;
   1.259 +    
   1.260 +    }
   1.261 + TDesC& CGlobalAudioSettingsImpl::EmailAlertTone()
   1.262 +    {
   1.263 +    return *iGlobalAudioSettingsData.iEmailToneName;
   1.264 +        
   1.265 +    }
   1.266 + TBool CGlobalAudioSettingsImpl::IsEmailAlertToneEnabled()
   1.267 +     {
   1.268 +      if(iGlobalAudioSettingsData.iEmailToneName->CompareF(KNoSound)==0)
   1.269 +          return EFalse;
   1.270 +      else
   1.271 +          return ETrue;
   1.272 +     
   1.273 +     }
   1.274 +  CGlobalAudioSettings::TGASRingingType CGlobalAudioSettingsImpl::RingingType()
   1.275 +    {
   1.276 +    CGlobalAudioSettings::TGASRingingType type;
   1.277 +   type= ( CGlobalAudioSettings::TGASRingingType)iGlobalAudioSettingsData.iRingingType;
   1.278 + 
   1.279 +      return type;
   1.280 +    }
   1.281 +  
   1.282 +  TDesC& CGlobalAudioSettingsImpl::VideoCallAlertTone()
   1.283 +      {
   1.284 +      return *iGlobalAudioSettingsData.iVideoCallToneName;
   1.285 +      }
   1.286 +  TBool CGlobalAudioSettingsImpl::IsVideoCallAlertToneEnabled()
   1.287 +      {
   1.288 +       if(iGlobalAudioSettingsData.iVideoCallToneName->CompareF(KNoSound)==0)
   1.289 +           return EFalse;
   1.290 +       else
   1.291 +           return ETrue;
   1.292 +      
   1.293 +      }
   1.294 +  TDesC& CGlobalAudioSettingsImpl::RingingAlertTone1()
   1.295 +     {
   1.296 +     return *iGlobalAudioSettingsData.iRingingTone1Name;
   1.297 +     }
   1.298 +  TBool CGlobalAudioSettingsImpl::IsRingingAlertTone1Enabled()
   1.299 +      {
   1.300 +       if(iGlobalAudioSettingsData.iRingingTone1Name->CompareF(KNoSound)==0)
   1.301 +           return EFalse;
   1.302 +       else
   1.303 +           return ETrue;
   1.304 +      
   1.305 +      }
   1.306 +  TDesC& CGlobalAudioSettingsImpl::RingingAlertTone2()
   1.307 +     {
   1.308 +     return *iGlobalAudioSettingsData.iRingingTone2Name;
   1.309 +     }
   1.310 +  
   1.311 +  TBool CGlobalAudioSettingsImpl::IsRingingAlertTone2Enabled()
   1.312 +      {
   1.313 +       if(iGlobalAudioSettingsData.iRingingTone2Name->CompareF(KNoSound)==0)
   1.314 +           return EFalse;
   1.315 +       else
   1.316 +           return ETrue;
   1.317 +      
   1.318 +      }
   1.319 + CGlobalAudioSettings::TGASKeypadVolume CGlobalAudioSettingsImpl::KeyPadToneVolume()
   1.320 +     {
   1.321 +     return (CGlobalAudioSettings::TGASKeypadVolume)iGlobalAudioSettingsData.iKeyPadVolume;
   1.322 +     }
   1.323 + 
   1.324 + TBool CGlobalAudioSettingsImpl::IsSilenceModeEnabled()
   1.325 +     {
   1.326 +      return iGlobalAudioSettingsData.iSilenceMode;
   1.327 +     }
   1.328 +// -----------------------------------------------------------------------------
   1.329 +// CGlobalAudioSettingsImpl::RegisterAudioClientsListObserver
   1.330 +// 
   1.331 +// -----------------------------------------------------------------------------
   1.332 +//
   1.333 +TInt CGlobalAudioSettingsImpl::RegisterAudioClientsListObserver(
   1.334 +                            MAudioClientsListObserver& aObserver )
   1.335 +	{
   1.336 +	TInt status(KErrAlreadyExists);
   1.337 +	if ( iAudioClientsListObserverArray.Find( &aObserver ) == KErrNotFound )
   1.338 +	    {
   1.339 +	    status = iAudioClientsListObserverArray.Append( &aObserver);
   1.340 +	    if ( ( status == KErrNone ) && (iAudioClientsListObserverArray.Count() == 1 ) )
   1.341 +	        {  	       
   1.342 +	 	    iCAudioClientsListManagerAO->MonitorStart();
   1.343 +	        iPausedClientsListManagerAO->MonitorStart();
   1.344 +	        }
   1.345 +	    }
   1.346 +	return status;
   1.347 +	}
   1.348 +        
   1.349 +// -----------------------------------------------------------------------------
   1.350 +// CGlobalAudioSettingsImpl::UnregisterAudioClientsListObserver
   1.351 +// 
   1.352 +// -----------------------------------------------------------------------------
   1.353 +//
   1.354 +TInt CGlobalAudioSettingsImpl::UnregisterAudioClientsListObserver(
   1.355 +                            MAudioClientsListObserver& aObserver)
   1.356 +	{
   1.357 +	TInt status(KErrNone);
   1.358 +	status = iAudioClientsListObserverArray.Find( &aObserver );
   1.359 +	if ( status != KErrNotFound )
   1.360 +	    {
   1.361 +	    iAudioClientsListObserverArray.Remove( status );
   1.362 +	    if ( iAudioClientsListObserverArray.Count() == 0 )
   1.363 +	        {
   1.364 +	        iCAudioClientsListManagerAO->MonitorStop();
   1.365 +	        iPausedClientsListManagerAO->MonitorStop();	
   1.366 +	        }
   1.367 +	    }
   1.368 +	return status;
   1.369 +	}
   1.370 +
   1.371 +// -----------------------------------------------------------------------------
   1.372 +// CGlobalAudioSettingsImpl::GetAudioClientsList
   1.373 +// 
   1.374 +// -----------------------------------------------------------------------------
   1.375 +//
   1.376 +TInt CGlobalAudioSettingsImpl::GetAudioClientsList(
   1.377 +                        CGlobalAudioSettings::TAudioClientListType aType,
   1.378 +                        RArray<TProcessId>& aList )
   1.379 +	{
   1.380 +	TInt status(KErrNone);
   1.381 +	
   1.382 +	switch(aType)
   1.383 +		{
   1.384 +		case CGlobalAudioSettings::EActiveAudioClients:
   1.385 +			{
   1.386 +			status = iCAudioClientsListManagerAO->GetAudioClientsList( aType, aList );	
   1.387 +			}
   1.388 +			break;
   1.389 +        case CGlobalAudioSettings::EPausedAudioClients:
   1.390 +        	{
   1.391 +        	status = iPausedClientsListManagerAO->GetAudioClientsList( aType, aList );     	
   1.392 +        	}
   1.393 +        	break;
   1.394 +		default:		
   1.395 +			break;
   1.396 +			
   1.397 +		}
   1.398 +	 return status;
   1.399 +	
   1.400 +
   1.401 +	}
   1.402 +
   1.403 +//////////////////////////////////////////////////////////////////////
   1.404 +//	CWarningTonesObserverAO											//
   1.405 +//////////////////////////////////////////////////////////////////////
   1.406 +CWarningTonesObserverAO::CWarningTonesObserverAO(
   1.407 +                            CGlobalAudioSettings &aGlobalAudioSettings,
   1.408 +                            MAudioSettingsObserver& aAudioSettingsObserver,
   1.409 +                            TGlobalAudioSettings& aGlobalAudioSettingsData)
   1.410 +:CActive(EPriorityStandard),
   1.411 + iGlobalAudioSettings(aGlobalAudioSettings),
   1.412 + iAudioSettingsObserver(aAudioSettingsObserver),
   1.413 + iGlobalAudioSettingsData(aGlobalAudioSettingsData)
   1.414 +	{
   1.415 +	CActiveScheduler::Add(this);
   1.416 +	}
   1.417 +
   1.418 +CWarningTonesObserverAO::~CWarningTonesObserverAO()
   1.419 +	{
   1.420 +	Cancel();
   1.421 +	iWarningTonesProperty.Close();
   1.422 +	}
   1.423 +
   1.424 +CWarningTonesObserverAO* CWarningTonesObserverAO::NewL(
   1.425 +                        CGlobalAudioSettings &aGlobalAudioSettings,
   1.426 +                        MAudioSettingsObserver& aAudioSettingsObserver,
   1.427 +                        TGlobalAudioSettings& aGlobalAudioSettingsData)
   1.428 +	{
   1.429 +	CWarningTonesObserverAO* self = new (ELeave) CWarningTonesObserverAO(
   1.430 +	                                                    aGlobalAudioSettings, 
   1.431 +	                                                    aAudioSettingsObserver,
   1.432 +	                                                    aGlobalAudioSettingsData);
   1.433 +	CleanupStack::PushL(self);
   1.434 +	self->ConstructL();
   1.435 +	CleanupStack::Pop();
   1.436 +	return self;
   1.437 +	}
   1.438 +
   1.439 +void CWarningTonesObserverAO::ConstructL()
   1.440 +	{
   1.441 +	User::LeaveIfError(iWarningTonesProperty.Attach(KGASPSUidGlobalAudioSettings, KGASWarningTones));
   1.442 +    User::LeaveIfError(iWarningTonesProperty.Get(iGlobalAudioSettingsData.iWarningTones));
   1.443 +	}
   1.444 +	
   1.445 +void CWarningTonesObserverAO::Subscribe()
   1.446 +	{
   1.447 +	if (!IsActive())
   1.448 +	    {
   1.449 +    	SetActive();
   1.450 +    	iWarningTonesProperty.Subscribe(iStatus);
   1.451 +	    }
   1.452 +	}
   1.453 +
   1.454 +void CWarningTonesObserverAO::RunL()
   1.455 +	{
   1.456 +	TInt status(iStatus.Int());
   1.457 +#ifdef PRINT_MESSAGE
   1.458 +    RDebug::Print(_L(" CWarningTonesObserverAO::RunL:iStatus[%d]"), status);
   1.459 +#endif // PRINT_MESSAGE
   1.460 +    if ( status == KErrNone )
   1.461 +        {
   1.462 +        Subscribe();
   1.463 +        status = iWarningTonesProperty.Get(iGlobalAudioSettingsData.iWarningTones);
   1.464 +        if(status == KErrNone)
   1.465 +            {
   1.466 +        MAudioSettingsObserver::TGASEventId id=MAudioSettingsObserver::EGASWarningTones;
   1.467 +            iAudioSettingsObserver.SettingsChanged(iGlobalAudioSettings, id);
   1.468 +            }
   1.469 +#ifdef PRINT_MESSAGE
   1.470 +        else
   1.471 +            {
   1.472 +            RDebug::Print(_L(" CWarningTonesObserverAO::RunL:Property.Get Error[%d]"), status);            
   1.473 +            }
   1.474 +#endif // PRINT_MESSAGE
   1.475 +        }
   1.476 +	}
   1.477 +
   1.478 +void CWarningTonesObserverAO::DoCancel()
   1.479 +	{
   1.480 +	iWarningTonesProperty.Cancel();
   1.481 +	}
   1.482 +
   1.483 +TInt CWarningTonesObserverAO::RunError(TInt /*aError*/)
   1.484 +	{
   1.485 +	return KErrNone;
   1.486 +	}
   1.487 +
   1.488 +//////////////////////////////////////////////////////////////////////
   1.489 +//	CMessagingTonesObserverAO											//
   1.490 +//////////////////////////////////////////////////////////////////////
   1.491 +CMessagingTonesObserverAO::CMessagingTonesObserverAO(
   1.492 +                                CGlobalAudioSettings &aGlobalAudioSettings,
   1.493 +                                MAudioSettingsObserver& aAudioSettingsObserver,
   1.494 +                                TGlobalAudioSettings& aGlobalAudioSettingsData)
   1.495 +:CActive(EPriorityStandard),
   1.496 + iGlobalAudioSettings(aGlobalAudioSettings),
   1.497 + iAudioSettingsObserver(aAudioSettingsObserver),
   1.498 + iGlobalAudioSettingsData(aGlobalAudioSettingsData)
   1.499 +	{
   1.500 +	CActiveScheduler::Add(this);
   1.501 +	}
   1.502 +
   1.503 +CMessagingTonesObserverAO::~CMessagingTonesObserverAO()
   1.504 +	{
   1.505 +	Cancel();
   1.506 +	iMessagingTonesProperty.Close();
   1.507 +	}
   1.508 +
   1.509 +CMessagingTonesObserverAO* CMessagingTonesObserverAO::NewL(
   1.510 +                                               CGlobalAudioSettings &aGlobalAudioSettings,
   1.511 +                                               MAudioSettingsObserver& aAudioSettingsObserver,
   1.512 +                                               TGlobalAudioSettings& aGlobalAudioSettingsData)
   1.513 +	{
   1.514 +	CMessagingTonesObserverAO* self = new (ELeave) CMessagingTonesObserverAO(
   1.515 +                    	                        aGlobalAudioSettings, aAudioSettingsObserver, 
   1.516 +                    	                        aGlobalAudioSettingsData);
   1.517 +	CleanupStack::PushL(self);
   1.518 +	self->ConstructL();
   1.519 +	CleanupStack::Pop();
   1.520 +	return self;
   1.521 +	}
   1.522 +
   1.523 +void CMessagingTonesObserverAO::ConstructL()
   1.524 +	{
   1.525 +	User::LeaveIfError(iMessagingTonesProperty.Attach(KGASPSUidGlobalAudioSettings, KGASMessageTones));
   1.526 +	User::LeaveIfError(iMessagingTonesProperty.Get(iGlobalAudioSettingsData.iMessageTones));
   1.527 +	}
   1.528 +	
   1.529 +void CMessagingTonesObserverAO::Subscribe()
   1.530 +	{
   1.531 +	if (!IsActive())
   1.532 +	    {
   1.533 +    	SetActive();
   1.534 +    	iMessagingTonesProperty.Subscribe(iStatus);
   1.535 +	    }
   1.536 +	}
   1.537 +
   1.538 +void CMessagingTonesObserverAO::RunL()
   1.539 +	{
   1.540 +	TInt status(iStatus.Int());
   1.541 +#ifdef PRINT_MESSAGE
   1.542 +    RDebug::Print(_L(" CMessagingTonesObserverAO::RunL:iStatus[%d]"), status);
   1.543 +#endif // PRINT_MESSAGE
   1.544 +    if ( status == KErrNone )
   1.545 +        {
   1.546 +        Subscribe();
   1.547 +        status = iMessagingTonesProperty.Get(iGlobalAudioSettingsData.iMessageTones);
   1.548 +        if(status == KErrNone)
   1.549 +            {
   1.550 +        MAudioSettingsObserver::TGASEventId id=MAudioSettingsObserver::EGASMessageTones;
   1.551 +            iAudioSettingsObserver.SettingsChanged(iGlobalAudioSettings, id);
   1.552 +            }
   1.553 +#ifdef PRINT_MESSAGE
   1.554 +        else
   1.555 +            {
   1.556 +            RDebug::Print(_L(" CMessagingTonesObserverAO::RunL:Property.Get Error[%d]"), status);
   1.557 +            }
   1.558 +#endif // PRINT_MESSAGE
   1.559 +        }
   1.560 +	}
   1.561 +
   1.562 +void CMessagingTonesObserverAO::DoCancel()
   1.563 +	{
   1.564 +	iMessagingTonesProperty.Cancel();
   1.565 +	}
   1.566 +
   1.567 +TInt CMessagingTonesObserverAO::RunError(TInt /*aError*/)
   1.568 +	{
   1.569 +	return KErrNone;
   1.570 +	}
   1.571 +	
   1.572 +//////////////////////////////////////////////////////////////////////
   1.573 +//	CSilentProfileObserverAO											//
   1.574 +//////////////////////////////////////////////////////////////////////
   1.575 +CSilentProfileObserverAO::CSilentProfileObserverAO(
   1.576 +                                CGlobalAudioSettings &aGlobalAudioSettings,
   1.577 +                                MAudioSettingsObserver& aAudioSettingsObserver,
   1.578 +                                TGlobalAudioSettings& aGlobalAudioSettingsData)
   1.579 +:CActive(EPriorityStandard),
   1.580 + iGlobalAudioSettings(aGlobalAudioSettings),
   1.581 + iAudioSettingsObserver(aAudioSettingsObserver),
   1.582 + iGlobalAudioSettingsData(aGlobalAudioSettingsData)
   1.583 +	{
   1.584 +	CActiveScheduler::Add(this);
   1.585 +	}
   1.586 +
   1.587 +CSilentProfileObserverAO::~CSilentProfileObserverAO()
   1.588 +	{
   1.589 +	Cancel();
   1.590 +	iSilentProfileProperty.Close();
   1.591 +	}
   1.592 +
   1.593 +CSilentProfileObserverAO* CSilentProfileObserverAO::NewL(
   1.594 +                                        CGlobalAudioSettings &aGlobalAudioSettings,
   1.595 +                                        MAudioSettingsObserver& aAudioSettingsObserver,
   1.596 +                                        TGlobalAudioSettings& aGlobalAudioSettingsData)
   1.597 +	{
   1.598 +	CSilentProfileObserverAO* self = new (ELeave) CSilentProfileObserverAO(
   1.599 +                    	                        aGlobalAudioSettings, aAudioSettingsObserver, 
   1.600 +                    	                        aGlobalAudioSettingsData);
   1.601 +	CleanupStack::PushL(self);
   1.602 +	self->ConstructL();
   1.603 +	CleanupStack::Pop();
   1.604 +	return self;
   1.605 +	}
   1.606 +
   1.607 +void CSilentProfileObserverAO::ConstructL()
   1.608 +	{
   1.609 +	User::LeaveIfError(iSilentProfileProperty.Attach(KGASPSUidGlobalAudioSettings, KGASSilentProfile));
   1.610 +	User::LeaveIfError(iSilentProfileProperty.Get(iGlobalAudioSettingsData.iSilentProfile));
   1.611 +	}
   1.612 +	
   1.613 +void CSilentProfileObserverAO::Subscribe()
   1.614 +	{
   1.615 +	if (!IsActive())
   1.616 +	    {
   1.617 +    	SetActive();
   1.618 +    	iSilentProfileProperty.Subscribe(iStatus);
   1.619 +	    }
   1.620 +	}
   1.621 +
   1.622 +void CSilentProfileObserverAO::RunL()
   1.623 +	{
   1.624 +	TInt status(iStatus.Int());
   1.625 +#ifdef PRINT_MESSAGE
   1.626 +    RDebug::Print(_L(" CSilentProfileObserverAO::RunL:iStatus[%d]"), status);
   1.627 +#endif // PRINT_MESSAGE
   1.628 +    if ( status == KErrNone )
   1.629 +        {
   1.630 +        Subscribe();
   1.631 +        status = iSilentProfileProperty.Get(iGlobalAudioSettingsData.iSilentProfile);
   1.632 +        if(status == KErrNone)
   1.633 +            {
   1.634 +        MAudioSettingsObserver::TGASEventId id=MAudioSettingsObserver::EGASSilentProfile;
   1.635 +            iAudioSettingsObserver.SettingsChanged(iGlobalAudioSettings, id);
   1.636 +            }
   1.637 +#ifdef PRINT_MESSAGE
   1.638 +        else
   1.639 +            {
   1.640 +            RDebug::Print(_L(" CSilentProfileObserverAO::RunL:Property.Get Error[%d]"), status);
   1.641 +            }
   1.642 +#endif // PRINT_MESSAGE
   1.643 +        }
   1.644 +	}
   1.645 +
   1.646 +void CSilentProfileObserverAO::DoCancel()
   1.647 +	{
   1.648 +	iSilentProfileProperty.Cancel();
   1.649 +	}
   1.650 +
   1.651 +TInt CSilentProfileObserverAO::RunError(TInt /*aError*/)
   1.652 +	{
   1.653 +	return KErrNone;
   1.654 +	}
   1.655 +	
   1.656 +//////////////////////////////////////////////////////////////////////
   1.657 +//	CVibraObserverAO											    //
   1.658 +//////////////////////////////////////////////////////////////////////
   1.659 +CVibraObserverAO::CVibraObserverAO(
   1.660 +                        CGlobalAudioSettings &aGlobalAudioSettings,
   1.661 +                        MAudioSettingsObserver& aAudioSettingsObserver,
   1.662 +                        TGlobalAudioSettings& aGlobalAudioSettingsData)
   1.663 +:CActive(EPriorityStandard),
   1.664 + iGlobalAudioSettings(aGlobalAudioSettings),
   1.665 + iAudioSettingsObserver(aAudioSettingsObserver),
   1.666 + iGlobalAudioSettingsData(aGlobalAudioSettingsData)
   1.667 +	{
   1.668 +	CActiveScheduler::Add(this);
   1.669 +	}
   1.670 +
   1.671 +CVibraObserverAO::~CVibraObserverAO()
   1.672 +	{
   1.673 +	Cancel();
   1.674 +	iVibraProperty.Close();
   1.675 +	}
   1.676 +
   1.677 +CVibraObserverAO* CVibraObserverAO::NewL(
   1.678 +                            CGlobalAudioSettings &aGlobalAudioSettings,
   1.679 +                            MAudioSettingsObserver& aAudioSettingsObserver,
   1.680 +                            TGlobalAudioSettings& aGlobalAudioSettingsData)
   1.681 +	{
   1.682 +	CVibraObserverAO* self = new (ELeave) CVibraObserverAO(
   1.683 +                	                        aGlobalAudioSettings,
   1.684 +                	                        aAudioSettingsObserver, 
   1.685 +                	                        aGlobalAudioSettingsData);
   1.686 +	CleanupStack::PushL(self);
   1.687 +	self->ConstructL();
   1.688 +	CleanupStack::Pop();
   1.689 +	return self;
   1.690 +	}
   1.691 +
   1.692 +void CVibraObserverAO::ConstructL()
   1.693 +	{
   1.694 +	User::LeaveIfError(iVibraProperty.Attach(KGASPSUidGlobalAudioSettings, KGASVibra));
   1.695 +	User::LeaveIfError(iVibraProperty.Get(iGlobalAudioSettingsData.iVibra));
   1.696 +	}
   1.697 +	
   1.698 +void CVibraObserverAO::Subscribe()
   1.699 +	{
   1.700 +	if (!IsActive())
   1.701 +	    {
   1.702 +    	SetActive();
   1.703 +    	iVibraProperty.Subscribe(iStatus);
   1.704 +	    }
   1.705 +	}
   1.706 +
   1.707 +void CVibraObserverAO::RunL()
   1.708 +	{
   1.709 +	TInt status(iStatus.Int());
   1.710 +#ifdef PRINT_MESSAGE
   1.711 +    RDebug::Print(_L(" CVibraObserverAO::RunL:iStatus[%d]"), status);
   1.712 +#endif // PRINT_MESSAGE
   1.713 +    if ( status == KErrNone )
   1.714 +        {
   1.715 +        Subscribe();
   1.716 +        status = iVibraProperty.Get(iGlobalAudioSettingsData.iVibra);
   1.717 +        if( status == KErrNone)
   1.718 +            {
   1.719 +        MAudioSettingsObserver::TGASEventId id=MAudioSettingsObserver::EGASVibra;
   1.720 +            iAudioSettingsObserver.SettingsChanged(iGlobalAudioSettings,id);
   1.721 +            }
   1.722 +#ifdef PRINT_MESSAGE
   1.723 +        else
   1.724 +            {
   1.725 +            RDebug::Print(_L(" CVibraObserverAO::RunL:Property.Get Error[%d]"), status);
   1.726 +            }
   1.727 +#endif // PRINT_MESSAGE
   1.728 +        }
   1.729 +	}
   1.730 +
   1.731 +void CVibraObserverAO::DoCancel()
   1.732 +	{
   1.733 +	iVibraProperty.Cancel();
   1.734 +	}
   1.735 +
   1.736 +TInt CVibraObserverAO::RunError(TInt /*aError*/)
   1.737 +	{
   1.738 +	return KErrNone;
   1.739 +	}
   1.740 +
   1.741 +//////////////////////////////////////////////////////////////////////
   1.742 +//  CRingingTypeObserverAO                                                //
   1.743 +//////////////////////////////////////////////////////////////////////
   1.744 +CRingingTypeObserverAO::CRingingTypeObserverAO(
   1.745 +                        CGlobalAudioSettings &aGlobalAudioSettings,
   1.746 +                        MAudioSettingsObserver& aAudioSettingsObserver,
   1.747 +                        TGlobalAudioSettings& aGlobalAudioSettingsData)
   1.748 +:CActive(EPriorityStandard),
   1.749 + iGlobalAudioSettings(aGlobalAudioSettings),
   1.750 + iAudioSettingsObserver(aAudioSettingsObserver),
   1.751 + iGlobalAudioSettingsData(aGlobalAudioSettingsData)
   1.752 +    {
   1.753 +    CActiveScheduler::Add(this);
   1.754 +    }
   1.755 +
   1.756 +CRingingTypeObserverAO::~CRingingTypeObserverAO()
   1.757 +    {
   1.758 +    Cancel();
   1.759 +    iRingingTypeProperty.Close();
   1.760 +    }
   1.761 +
   1.762 +CRingingTypeObserverAO* CRingingTypeObserverAO::NewL(
   1.763 +                            CGlobalAudioSettings &aGlobalAudioSettings,
   1.764 +                            MAudioSettingsObserver& aAudioSettingsObserver,
   1.765 +                            TGlobalAudioSettings& aGlobalAudioSettingsData)
   1.766 +    {
   1.767 +    CRingingTypeObserverAO* self = new (ELeave) CRingingTypeObserverAO(
   1.768 +                                            aGlobalAudioSettings,
   1.769 +                                            aAudioSettingsObserver, 
   1.770 +                                            aGlobalAudioSettingsData);
   1.771 +    CleanupStack::PushL(self);
   1.772 +    self->ConstructL();
   1.773 +    CleanupStack::Pop();
   1.774 +    return self;
   1.775 +    }
   1.776 +
   1.777 +void CRingingTypeObserverAO::ConstructL()
   1.778 +    {
   1.779 +    User::LeaveIfError(iRingingTypeProperty.Attach(KGASPSUidGlobalAudioSettings, KGASRingingType));
   1.780 +    TInt value=KErrNone;
   1.781 +    User::LeaveIfError(iRingingTypeProperty.Get(value));
   1.782 +    iGlobalAudioSettingsData.iRingingType=(CGlobalAudioSettings::TGASRingingType)value;
   1.783 +    
   1.784 +    }
   1.785 +    
   1.786 +void CRingingTypeObserverAO::Subscribe()
   1.787 +    {
   1.788 +    if (!IsActive())
   1.789 +        {
   1.790 +        SetActive();
   1.791 +        
   1.792 +        iRingingTypeProperty.Subscribe(iStatus);
   1.793 +        }
   1.794 +    }
   1.795 +
   1.796 +void CRingingTypeObserverAO::RunL()
   1.797 +    {
   1.798 +    TInt status(iStatus.Int());
   1.799 +#ifdef PRINT_MESSAGE
   1.800 +    RDebug::Print(_L(" CRingingTypeObserverAO::RunL:iStatus[%d]"), status);
   1.801 +#endif // PRINT_MESSAGE
   1.802 +    if ( status == KErrNone )
   1.803 +        {
   1.804 +        Subscribe();
   1.805 +        TInt value=KErrNone;
   1.806 +        status=(iRingingTypeProperty.Get(value));
   1.807 +        iGlobalAudioSettingsData.iRingingType=(CGlobalAudioSettings::TGASRingingType)value;
   1.808 +        if( status == KErrNone)
   1.809 +            {
   1.810 +        MAudioSettingsObserver::TGASEventId id=MAudioSettingsObserver::EGASRingingType;
   1.811 +            iAudioSettingsObserver.SettingsChanged(iGlobalAudioSettings, id);
   1.812 +            }
   1.813 +#ifdef PRINT_MESSAGE
   1.814 +        else
   1.815 +            {
   1.816 +            RDebug::Print(_L(" CRingingTypeObserverAO::RunL:Property.Get Error[%d]"), status);
   1.817 +            }
   1.818 +#endif // PRINT_MESSAGE
   1.819 +        }
   1.820 +    }
   1.821 +
   1.822 +void CRingingTypeObserverAO::DoCancel()
   1.823 +    {
   1.824 +    iRingingTypeProperty.Cancel();
   1.825 +    }
   1.826 +
   1.827 +TInt CRingingTypeObserverAO::RunError(TInt /*aError*/)
   1.828 +    {
   1.829 +    return KErrNone;
   1.830 +    }
   1.831 +
   1.832 +//////////////////////////////////////////////////////////////////////
   1.833 +//  CMessageToneObserverAO                                                //
   1.834 +//////////////////////////////////////////////////////////////////////
   1.835 +CMessageToneObserverAO::CMessageToneObserverAO(
   1.836 +                        CGlobalAudioSettings &aGlobalAudioSettings,
   1.837 +                        MAudioSettingsObserver& aAudioSettingsObserver,
   1.838 +                        TGlobalAudioSettings& aGlobalAudioSettingsData)
   1.839 +:CActive(EPriorityStandard),
   1.840 + iGlobalAudioSettings(aGlobalAudioSettings),
   1.841 + iAudioSettingsObserver(aAudioSettingsObserver),
   1.842 + iGlobalAudioSettingsData(aGlobalAudioSettingsData)
   1.843 +    {
   1.844 +    CActiveScheduler::Add(this);
   1.845 +    }
   1.846 +
   1.847 +CMessageToneObserverAO::~CMessageToneObserverAO()
   1.848 +    {
   1.849 +    Cancel();
   1.850 +    iMessageToneNameProperty.Close();
   1.851 +    if( iGlobalAudioSettingsData.iMessageToneName)
   1.852 +        {
   1.853 +          delete  iGlobalAudioSettingsData.iMessageToneName;
   1.854 +          iGlobalAudioSettingsData.iMessageToneName=NULL;
   1.855 +        }
   1.856 +    }
   1.857 +
   1.858 +CMessageToneObserverAO* CMessageToneObserverAO::NewL(
   1.859 +                            CGlobalAudioSettings &aGlobalAudioSettings,
   1.860 +                            MAudioSettingsObserver& aAudioSettingsObserver,
   1.861 +                            TGlobalAudioSettings& aGlobalAudioSettingsData)
   1.862 +    {
   1.863 +    CMessageToneObserverAO* self = new (ELeave) CMessageToneObserverAO(
   1.864 +                                            aGlobalAudioSettings,
   1.865 +                                            aAudioSettingsObserver, 
   1.866 +                                            aGlobalAudioSettingsData);
   1.867 +    CleanupStack::PushL(self);
   1.868 +    self->ConstructL();
   1.869 +    CleanupStack::Pop();
   1.870 +    return self;
   1.871 +    }
   1.872 +
   1.873 +void CMessageToneObserverAO::ConstructL()
   1.874 +    {
   1.875 +    iGlobalAudioSettingsData.iMessageToneName=HBufC::NewL(KMaxLength);
   1.876 +    User::LeaveIfError(iMessageToneNameProperty.Attach(KGASPSUidGlobalAudioSettings, KGASMessageToneName));
   1.877 +    TPtr16 ptr=iGlobalAudioSettingsData.iMessageToneName->Des();
   1.878 +    User::LeaveIfError(iMessageToneNameProperty.Get(ptr));
   1.879 +    
   1.880 +    }
   1.881 +    
   1.882 +void CMessageToneObserverAO::Subscribe()
   1.883 +    {
   1.884 +    if (!IsActive())
   1.885 +        {
   1.886 +        SetActive();
   1.887 +        
   1.888 +        iMessageToneNameProperty.Subscribe(iStatus);
   1.889 +        }
   1.890 +    }
   1.891 +
   1.892 +void CMessageToneObserverAO::RunL()
   1.893 +    {
   1.894 +    TInt status(iStatus.Int());
   1.895 +#ifdef PRINT_MESSAGE
   1.896 +    RDebug::Print(_L(" CMessageToneObserverAO::RunL:iStatus[%d]"), status);
   1.897 +#endif // PRINT_MESSAGE
   1.898 +    if ( status == KErrNone )
   1.899 +        {
   1.900 +        Subscribe();
   1.901 +        delete iGlobalAudioSettingsData.iMessageToneName;
   1.902 +        iGlobalAudioSettingsData.iMessageToneName=NULL;
   1.903 +        iGlobalAudioSettingsData.iMessageToneName=HBufC::NewL(KMaxLength);
   1.904 +        TPtr16 ptr=iGlobalAudioSettingsData.iMessageToneName->Des();
   1.905 +        status = iMessageToneNameProperty.Get(ptr);
   1.906 +        if( status == KErrNone)
   1.907 +            {
   1.908 +            MAudioSettingsObserver::TGASEventId id=MAudioSettingsObserver::EGASMessageToneName;
   1.909 +            iAudioSettingsObserver.SettingsChanged(iGlobalAudioSettings, id);
   1.910 +            }
   1.911 +#ifdef PRINT_MESSAGE
   1.912 +        else
   1.913 +            {
   1.914 +            RDebug::Print(_L(" CMessageToneObserverAO::RunL:Property.Get Error[%d]"), status);
   1.915 +            }
   1.916 +#endif // PRINT_MESSAGE
   1.917 +        }
   1.918 +    }
   1.919 +
   1.920 +void CMessageToneObserverAO::DoCancel()
   1.921 +    {
   1.922 +    iMessageToneNameProperty.Cancel();
   1.923 +    }
   1.924 +
   1.925 +TInt CMessageToneObserverAO::RunError(TInt /*aError*/)
   1.926 +    {
   1.927 +    return KErrNone;
   1.928 +    }
   1.929 +
   1.930 +
   1.931 +/////////////////////////////////////////////////////////////////////
   1.932 +//  CEmailToneObserverAO                                                //
   1.933 +//////////////////////////////////////////////////////////////////////
   1.934 +CEmailToneObserverAO::CEmailToneObserverAO(
   1.935 +                        CGlobalAudioSettings &aGlobalAudioSettings,
   1.936 +                        MAudioSettingsObserver& aAudioSettingsObserver,
   1.937 +                        TGlobalAudioSettings& aGlobalAudioSettingsData)
   1.938 +:CActive(EPriorityStandard),
   1.939 + iGlobalAudioSettings(aGlobalAudioSettings),
   1.940 + iAudioSettingsObserver(aAudioSettingsObserver),
   1.941 + iGlobalAudioSettingsData(aGlobalAudioSettingsData)
   1.942 +    {
   1.943 +    CActiveScheduler::Add(this);
   1.944 +    }
   1.945 +
   1.946 +CEmailToneObserverAO::~CEmailToneObserverAO()
   1.947 +    {
   1.948 +    Cancel();
   1.949 +    iEmailToneNameProperty.Close();
   1.950 +    
   1.951 +    if(iGlobalAudioSettingsData.iEmailToneName)
   1.952 +        {
   1.953 +        delete  iGlobalAudioSettingsData.iEmailToneName;
   1.954 +        iGlobalAudioSettingsData.iEmailToneName=NULL;
   1.955 +        }
   1.956 +   
   1.957 +    }
   1.958 +
   1.959 +CEmailToneObserverAO* CEmailToneObserverAO::NewL(
   1.960 +                            CGlobalAudioSettings &aGlobalAudioSettings,
   1.961 +                            MAudioSettingsObserver& aAudioSettingsObserver,
   1.962 +                            TGlobalAudioSettings& aGlobalAudioSettingsData)
   1.963 +    {
   1.964 +    CEmailToneObserverAO* self = new (ELeave) CEmailToneObserverAO(
   1.965 +                                            aGlobalAudioSettings,
   1.966 +                                            aAudioSettingsObserver, 
   1.967 +                                            aGlobalAudioSettingsData);
   1.968 +    CleanupStack::PushL(self);
   1.969 +    self->ConstructL();
   1.970 +    CleanupStack::Pop();
   1.971 +    return self;
   1.972 +    }
   1.973 +
   1.974 +void CEmailToneObserverAO::ConstructL()
   1.975 +    {
   1.976 +    
   1.977 +    iGlobalAudioSettingsData.iEmailToneName=HBufC::NewL(KMaxLength);
   1.978 +    User::LeaveIfError(iEmailToneNameProperty.Attach(KGASPSUidGlobalAudioSettings, KGASEmailToneName));
   1.979 +    TPtr16 ptr=iGlobalAudioSettingsData.iEmailToneName->Des();
   1.980 +    User::LeaveIfError(iEmailToneNameProperty.Get(ptr));
   1.981 +    
   1.982 +    }
   1.983 +    
   1.984 +void CEmailToneObserverAO::Subscribe()
   1.985 +    {
   1.986 +    if (!IsActive())
   1.987 +        {
   1.988 +        SetActive();
   1.989 +        
   1.990 +        iEmailToneNameProperty.Subscribe(iStatus);
   1.991 +        }
   1.992 +    }
   1.993 +
   1.994 +void CEmailToneObserverAO::RunL()
   1.995 +    {
   1.996 +    TInt status(iStatus.Int());
   1.997 +#ifdef PRINT_MESSAGE
   1.998 +    RDebug::Print(_L(" CEmailToneObserverAO::RunL:iStatus[%d]"), status);
   1.999 +#endif // PRINT_MESSAGE
  1.1000 +    if ( status == KErrNone )
  1.1001 +        {
  1.1002 +        Subscribe();
  1.1003 +        delete iGlobalAudioSettingsData.iEmailToneName;
  1.1004 +        iGlobalAudioSettingsData.iEmailToneName=NULL;
  1.1005 +        iGlobalAudioSettingsData.iEmailToneName=HBufC::NewL(KMaxLength);
  1.1006 +        TPtr16 ptr=iGlobalAudioSettingsData.iEmailToneName->Des();
  1.1007 +        status = iEmailToneNameProperty.Get(ptr);
  1.1008 +        if( status == KErrNone)
  1.1009 +            {
  1.1010 +            MAudioSettingsObserver::TGASEventId id=MAudioSettingsObserver::EGASEmailToneName;
  1.1011 +            iAudioSettingsObserver.SettingsChanged(iGlobalAudioSettings, id);
  1.1012 +            }
  1.1013 +#ifdef PRINT_MESSAGE
  1.1014 +        else
  1.1015 +            {
  1.1016 +            RDebug::Print(_L(" CEmailToneObserverAO::RunL:Property.Get Error[%d]"), status);
  1.1017 +            }
  1.1018 +#endif // PRINT_MESSAGE
  1.1019 +        }
  1.1020 +    }
  1.1021 +
  1.1022 +void CEmailToneObserverAO::DoCancel()
  1.1023 +    {
  1.1024 +    iEmailToneNameProperty.Cancel();
  1.1025 +    }
  1.1026 +
  1.1027 +TInt CEmailToneObserverAO::RunError(TInt /*aError*/)
  1.1028 +    {
  1.1029 +    return KErrNone;
  1.1030 +    }
  1.1031 +
  1.1032 +
  1.1033 +/////////////////////////////////////////////////////////////////////
  1.1034 +//  CVideoCallToneObserverAO                                                //
  1.1035 +//////////////////////////////////////////////////////////////////////
  1.1036 +CVideoCallToneObserverAO::CVideoCallToneObserverAO(
  1.1037 +                        CGlobalAudioSettings &aGlobalAudioSettings,
  1.1038 +                        MAudioSettingsObserver& aAudioSettingsObserver,
  1.1039 +                        TGlobalAudioSettings& aGlobalAudioSettingsData)
  1.1040 +:CActive(EPriorityStandard),
  1.1041 + iGlobalAudioSettings(aGlobalAudioSettings),
  1.1042 + iAudioSettingsObserver(aAudioSettingsObserver),
  1.1043 + iGlobalAudioSettingsData(aGlobalAudioSettingsData)
  1.1044 +    {
  1.1045 +    CActiveScheduler::Add(this);
  1.1046 +    }
  1.1047 +
  1.1048 +CVideoCallToneObserverAO::~CVideoCallToneObserverAO()
  1.1049 +    {
  1.1050 +    Cancel();
  1.1051 +    iVideoCallToneNameProperty.Close();
  1.1052 +    if( iGlobalAudioSettingsData.iVideoCallToneName)
  1.1053 +        {
  1.1054 +    delete  iGlobalAudioSettingsData.iVideoCallToneName;
  1.1055 +    iGlobalAudioSettingsData.iVideoCallToneName=NULL;
  1.1056 +        }
  1.1057 +     
  1.1058 +    
  1.1059 +    }
  1.1060 +
  1.1061 +CVideoCallToneObserverAO* CVideoCallToneObserverAO::NewL(
  1.1062 +                            CGlobalAudioSettings &aGlobalAudioSettings,
  1.1063 +                            MAudioSettingsObserver& aAudioSettingsObserver,
  1.1064 +                            TGlobalAudioSettings& aGlobalAudioSettingsData)
  1.1065 +    {
  1.1066 +    CVideoCallToneObserverAO* self = new (ELeave) CVideoCallToneObserverAO(
  1.1067 +                                            aGlobalAudioSettings,
  1.1068 +                                            aAudioSettingsObserver, 
  1.1069 +                                            aGlobalAudioSettingsData);
  1.1070 +    CleanupStack::PushL(self);
  1.1071 +    self->ConstructL();
  1.1072 +    CleanupStack::Pop();
  1.1073 +    return self;
  1.1074 +    }
  1.1075 +
  1.1076 +void CVideoCallToneObserverAO::ConstructL()
  1.1077 +    {
  1.1078 +    
  1.1079 +    iGlobalAudioSettingsData.iVideoCallToneName=HBufC::NewL(KMaxLength);
  1.1080 +    User::LeaveIfError(iVideoCallToneNameProperty.Attach(KGASPSUidGlobalAudioSettings, KGASVideoCallToneName));
  1.1081 +    TPtr16 ptr=iGlobalAudioSettingsData.iVideoCallToneName->Des();
  1.1082 +    User::LeaveIfError(iVideoCallToneNameProperty.Get(ptr));
  1.1083 +    
  1.1084 +    }
  1.1085 +    
  1.1086 +void CVideoCallToneObserverAO::Subscribe()
  1.1087 +    {
  1.1088 +    if (!IsActive())
  1.1089 +        {
  1.1090 +        SetActive();
  1.1091 +        
  1.1092 +        iVideoCallToneNameProperty.Subscribe(iStatus);
  1.1093 +        }
  1.1094 +    }
  1.1095 +
  1.1096 +void CVideoCallToneObserverAO::RunL()
  1.1097 +    {
  1.1098 +    TInt status(iStatus.Int());
  1.1099 +#ifdef PRINT_MESSAGE
  1.1100 +    RDebug::Print(_L(" CVideocallToneObserverAO::RunL:iStatus[%d]"), status);
  1.1101 +#endif // PRINT_MESSAGE
  1.1102 +    if ( status == KErrNone )
  1.1103 +        {
  1.1104 +        Subscribe();
  1.1105 +        delete iGlobalAudioSettingsData.iVideoCallToneName;
  1.1106 +        iGlobalAudioSettingsData.iVideoCallToneName=NULL;
  1.1107 +        iGlobalAudioSettingsData.iVideoCallToneName=HBufC::NewL(KMaxLength);
  1.1108 +        TPtr16 ptr=iGlobalAudioSettingsData.iVideoCallToneName->Des();
  1.1109 +        status = iVideoCallToneNameProperty.Get(ptr);
  1.1110 +        if( status == KErrNone)
  1.1111 +            {
  1.1112 +        MAudioSettingsObserver::TGASEventId id=MAudioSettingsObserver::EGASVideoCallToneName;
  1.1113 +            iAudioSettingsObserver.SettingsChanged(iGlobalAudioSettings, id);
  1.1114 +            }
  1.1115 +#ifdef PRINT_MESSAGE
  1.1116 +        else
  1.1117 +            {
  1.1118 +            RDebug::Print(_L(" CVideoCallToneObserverAO::RunL:Property.Get Error[%d]"), status);
  1.1119 +            }
  1.1120 +#endif // PRINT_MESSAGE
  1.1121 +        }
  1.1122 +    }
  1.1123 +
  1.1124 +void CVideoCallToneObserverAO::DoCancel()
  1.1125 +    {
  1.1126 +    iVideoCallToneNameProperty.Cancel();
  1.1127 +    }
  1.1128 +
  1.1129 +TInt CVideoCallToneObserverAO::RunError(TInt /*aError*/)
  1.1130 +    {
  1.1131 +    return KErrNone;
  1.1132 +    }
  1.1133 +
  1.1134 +/////////////////////////////////////////////////////////////////////
  1.1135 +//  CRingingToneObserverAO                                                //
  1.1136 +//////////////////////////////////////////////////////////////////////
  1.1137 +CRingingTone1ObserverAO::CRingingTone1ObserverAO(
  1.1138 +                        CGlobalAudioSettings &aGlobalAudioSettings,
  1.1139 +                        MAudioSettingsObserver& aAudioSettingsObserver,
  1.1140 +                        TGlobalAudioSettings& aGlobalAudioSettingsData)
  1.1141 +:CActive(EPriorityStandard),
  1.1142 + iGlobalAudioSettings(aGlobalAudioSettings),
  1.1143 + iAudioSettingsObserver(aAudioSettingsObserver),
  1.1144 + iGlobalAudioSettingsData(aGlobalAudioSettingsData)
  1.1145 +    {
  1.1146 +    CActiveScheduler::Add(this);
  1.1147 +    }
  1.1148 +
  1.1149 +CRingingTone1ObserverAO::~CRingingTone1ObserverAO()
  1.1150 +    {
  1.1151 +    Cancel();
  1.1152 +    iRingingTone1NameProperty.Close();
  1.1153 +    if( iGlobalAudioSettingsData.iRingingTone1Name)
  1.1154 +        {
  1.1155 +        delete  iGlobalAudioSettingsData.iRingingTone1Name;
  1.1156 +        iGlobalAudioSettingsData.iRingingTone1Name=NULL;
  1.1157 +        }
  1.1158 +    }
  1.1159 +
  1.1160 +CRingingTone1ObserverAO* CRingingTone1ObserverAO::NewL(
  1.1161 +                            CGlobalAudioSettings &aGlobalAudioSettings,
  1.1162 +                            MAudioSettingsObserver& aAudioSettingsObserver,
  1.1163 +                            TGlobalAudioSettings& aGlobalAudioSettingsData)
  1.1164 +    {
  1.1165 +    CRingingTone1ObserverAO* self = new (ELeave) CRingingTone1ObserverAO(
  1.1166 +                                            aGlobalAudioSettings,
  1.1167 +                                            aAudioSettingsObserver, 
  1.1168 +                                            aGlobalAudioSettingsData);
  1.1169 +    CleanupStack::PushL(self);
  1.1170 +    self->ConstructL();
  1.1171 +    CleanupStack::Pop();
  1.1172 +    return self;
  1.1173 +    }
  1.1174 +
  1.1175 +void CRingingTone1ObserverAO::ConstructL()
  1.1176 +    {
  1.1177 +    
  1.1178 +    iGlobalAudioSettingsData.iRingingTone1Name=HBufC::NewL(KMaxLength);
  1.1179 +    User::LeaveIfError(iRingingTone1NameProperty.Attach(KGASPSUidGlobalAudioSettings, KGASRingingTone1Name));
  1.1180 +    TPtr16 ptr=iGlobalAudioSettingsData.iRingingTone1Name->Des();
  1.1181 +    User::LeaveIfError(iRingingTone1NameProperty.Get(ptr));
  1.1182 +    
  1.1183 +    }
  1.1184 +    
  1.1185 +void CRingingTone1ObserverAO::Subscribe()
  1.1186 +    {
  1.1187 +    if (!IsActive())
  1.1188 +        {
  1.1189 +        SetActive();
  1.1190 +        
  1.1191 +        iRingingTone1NameProperty.Subscribe(iStatus);
  1.1192 +        }
  1.1193 +    }
  1.1194 +
  1.1195 +void CRingingTone1ObserverAO::RunL()
  1.1196 +    {
  1.1197 +    TInt status(iStatus.Int());
  1.1198 +#ifdef PRINT_MESSAGE
  1.1199 +    RDebug::Print(_L(" CRingingTone1ObserverAO::RunL:iStatus[%d]"), status);
  1.1200 +#endif // PRINT_MESSAGE
  1.1201 +    if ( status == KErrNone )
  1.1202 +        {
  1.1203 +        Subscribe();
  1.1204 +        delete iGlobalAudioSettingsData.iRingingTone1Name;
  1.1205 +        iGlobalAudioSettingsData.iRingingTone1Name=NULL;
  1.1206 +        iGlobalAudioSettingsData.iRingingTone1Name=HBufC::NewL(KMaxLength);
  1.1207 +        TPtr16 ptr=iGlobalAudioSettingsData.iRingingTone1Name->Des();
  1.1208 +        status = iRingingTone1NameProperty.Get(ptr);
  1.1209 +        if( status == KErrNone)
  1.1210 +            {
  1.1211 +            MAudioSettingsObserver::TGASEventId id=MAudioSettingsObserver::EGASRingingTone1Name;
  1.1212 +            iAudioSettingsObserver.SettingsChanged(iGlobalAudioSettings, id);
  1.1213 +            }
  1.1214 +#ifdef PRINT_MESSAGE
  1.1215 +        else
  1.1216 +            {
  1.1217 +            RDebug::Print(_L(" CRingingToneObserverAO::RunL:Property.Get Error[%d]"), status);
  1.1218 +            }
  1.1219 +#endif // PRINT_MESSAGE
  1.1220 +        }
  1.1221 +    }
  1.1222 +
  1.1223 +void CRingingTone1ObserverAO::DoCancel()
  1.1224 +    {
  1.1225 +    iRingingTone1NameProperty.Cancel();
  1.1226 +    }
  1.1227 +
  1.1228 +TInt CRingingTone1ObserverAO::RunError(TInt /*aError*/)
  1.1229 +    {
  1.1230 +    return KErrNone;
  1.1231 +    }
  1.1232 +
  1.1233 +////////////////////////////////////////////////////////////////////
  1.1234 +//  CRingingToneObserverAO                                                //
  1.1235 +//////////////////////////////////////////////////////////////////////
  1.1236 +CRingingTone2ObserverAO::CRingingTone2ObserverAO(
  1.1237 +                        CGlobalAudioSettings &aGlobalAudioSettings,
  1.1238 +                        MAudioSettingsObserver& aAudioSettingsObserver,
  1.1239 +                        TGlobalAudioSettings& aGlobalAudioSettingsData)
  1.1240 +:CActive(EPriorityStandard),
  1.1241 + iGlobalAudioSettings(aGlobalAudioSettings),
  1.1242 + iAudioSettingsObserver(aAudioSettingsObserver),
  1.1243 + iGlobalAudioSettingsData(aGlobalAudioSettingsData)
  1.1244 +    {
  1.1245 +    CActiveScheduler::Add(this);
  1.1246 +    }
  1.1247 +
  1.1248 +CRingingTone2ObserverAO::~CRingingTone2ObserverAO()
  1.1249 +    {
  1.1250 +    Cancel();
  1.1251 +    iRingingTone2NameProperty.Close();
  1.1252 +    if(iGlobalAudioSettingsData.iRingingTone2Name)
  1.1253 +        {
  1.1254 +    delete iGlobalAudioSettingsData.iRingingTone2Name;
  1.1255 +    iGlobalAudioSettingsData.iRingingTone2Name=NULL;
  1.1256 +        }
  1.1257 +     
  1.1258 +    
  1.1259 +    }
  1.1260 +
  1.1261 +CRingingTone2ObserverAO* CRingingTone2ObserverAO::NewL(
  1.1262 +                            CGlobalAudioSettings &aGlobalAudioSettings,
  1.1263 +                            MAudioSettingsObserver& aAudioSettingsObserver,
  1.1264 +                            TGlobalAudioSettings& aGlobalAudioSettingsData)
  1.1265 +    {
  1.1266 +    CRingingTone2ObserverAO* self = new (ELeave) CRingingTone2ObserverAO(
  1.1267 +                                            aGlobalAudioSettings,
  1.1268 +                                            aAudioSettingsObserver, 
  1.1269 +                                            aGlobalAudioSettingsData);
  1.1270 +    CleanupStack::PushL(self);
  1.1271 +    self->ConstructL();
  1.1272 +    CleanupStack::Pop();
  1.1273 +    return self;
  1.1274 +    }
  1.1275 +
  1.1276 +void CRingingTone2ObserverAO::ConstructL()
  1.1277 +    {
  1.1278 +    
  1.1279 +    iGlobalAudioSettingsData.iRingingTone2Name=HBufC::NewL(KMaxLength);
  1.1280 +    User::LeaveIfError(iRingingTone2NameProperty.Attach(KGASPSUidGlobalAudioSettings, KGASRingingTone2Name));
  1.1281 +    TPtr16 ptr=iGlobalAudioSettingsData.iRingingTone2Name->Des();
  1.1282 +    User::LeaveIfError(iRingingTone2NameProperty.Get(ptr));
  1.1283 +    
  1.1284 +    }
  1.1285 +    
  1.1286 +void CRingingTone2ObserverAO::Subscribe()
  1.1287 +    {
  1.1288 +    if (!IsActive())
  1.1289 +        {
  1.1290 +        SetActive();
  1.1291 +        
  1.1292 +        iRingingTone2NameProperty.Subscribe(iStatus);
  1.1293 +        }
  1.1294 +    }
  1.1295 +
  1.1296 +void CRingingTone2ObserverAO::RunL()
  1.1297 +    {
  1.1298 +    TInt status(iStatus.Int());
  1.1299 +#ifdef PRINT_MESSAGE
  1.1300 +    RDebug::Print(_L(" CRingingTone2ObserverAO::RunL:iStatus[%d]"), status);
  1.1301 +#endif // PRINT_MESSAGE
  1.1302 +    if ( status == KErrNone )
  1.1303 +        {
  1.1304 +        Subscribe();
  1.1305 +        delete iGlobalAudioSettingsData.iRingingTone2Name;
  1.1306 +        iGlobalAudioSettingsData.iRingingTone2Name=NULL;
  1.1307 +        iGlobalAudioSettingsData.iRingingTone2Name=HBufC::NewL(KMaxLength);
  1.1308 +        TPtr16 ptr=iGlobalAudioSettingsData.iRingingTone2Name->Des();
  1.1309 +        status = iRingingTone2NameProperty.Get(ptr);
  1.1310 +        if( status == KErrNone)
  1.1311 +            {
  1.1312 +        MAudioSettingsObserver::TGASEventId id=MAudioSettingsObserver::EGASRingingTone2Name;
  1.1313 +            iAudioSettingsObserver.SettingsChanged(iGlobalAudioSettings, id);
  1.1314 +            }
  1.1315 +#ifdef PRINT_MESSAGE
  1.1316 +        else
  1.1317 +            {
  1.1318 +            RDebug::Print(_L(" CRingingToneObserverAO::RunL:Property.Get Error[%d]"), status);
  1.1319 +            }
  1.1320 +#endif // PRINT_MESSAGE
  1.1321 +        }
  1.1322 +    }
  1.1323 +
  1.1324 +void CRingingTone2ObserverAO::DoCancel()
  1.1325 +    {
  1.1326 +    iRingingTone2NameProperty.Cancel();
  1.1327 +    }
  1.1328 +
  1.1329 +TInt CRingingTone2ObserverAO::RunError(TInt /*aError*/)
  1.1330 +    {
  1.1331 +    return KErrNone;
  1.1332 +    }
  1.1333 +
  1.1334 +/////////////////////////////////////////////////////////////////////
  1.1335 +//  CKeypadToneObserverAO                                                //
  1.1336 +//////////////////////////////////////////////////////////////////////
  1.1337 +CKeypadToneObserverAO::CKeypadToneObserverAO(
  1.1338 +                        CGlobalAudioSettings &aGlobalAudioSettings,
  1.1339 +                        MAudioSettingsObserver& aAudioSettingsObserver,
  1.1340 +                        TGlobalAudioSettings& aGlobalAudioSettingsData)
  1.1341 +:CActive(EPriorityStandard),
  1.1342 + iGlobalAudioSettings(aGlobalAudioSettings),
  1.1343 + iAudioSettingsObserver(aAudioSettingsObserver),
  1.1344 + iGlobalAudioSettingsData(aGlobalAudioSettingsData)
  1.1345 +    {
  1.1346 +    CActiveScheduler::Add(this);
  1.1347 +    }
  1.1348 +
  1.1349 +CKeypadToneObserverAO::~CKeypadToneObserverAO()
  1.1350 +    {
  1.1351 +    Cancel();
  1.1352 +    iKeypadToneVolumeProperty.Close();
  1.1353 +    }
  1.1354 +
  1.1355 +CKeypadToneObserverAO* CKeypadToneObserverAO::NewL(
  1.1356 +                            CGlobalAudioSettings &aGlobalAudioSettings,
  1.1357 +                            MAudioSettingsObserver& aAudioSettingsObserver,
  1.1358 +                            TGlobalAudioSettings& aGlobalAudioSettingsData)
  1.1359 +    {
  1.1360 +    CKeypadToneObserverAO* self = new (ELeave) CKeypadToneObserverAO(
  1.1361 +                                            aGlobalAudioSettings,
  1.1362 +                                            aAudioSettingsObserver, 
  1.1363 +                                            aGlobalAudioSettingsData);
  1.1364 +    CleanupStack::PushL(self);
  1.1365 +    self->ConstructL();
  1.1366 +    CleanupStack::Pop();
  1.1367 +    return self;
  1.1368 +    }
  1.1369 +
  1.1370 +void CKeypadToneObserverAO::ConstructL()
  1.1371 +    {
  1.1372 +    
  1.1373 +    
  1.1374 +    User::LeaveIfError(iKeypadToneVolumeProperty.Attach(KGASPSUidGlobalAudioSettings, KGASKeypadToneVolume));
  1.1375 +    TInt value=KErrNone;
  1.1376 +    User::LeaveIfError(iKeypadToneVolumeProperty.Get(value));
  1.1377 +    iGlobalAudioSettingsData.iKeyPadVolume=(CGlobalAudioSettings::TGASKeypadVolume)value;
  1.1378 +    }
  1.1379 +    
  1.1380 +void CKeypadToneObserverAO::Subscribe()
  1.1381 +    {
  1.1382 +    if (!IsActive())
  1.1383 +        {
  1.1384 +        SetActive();
  1.1385 +        
  1.1386 +        iKeypadToneVolumeProperty.Subscribe(iStatus);
  1.1387 +        }
  1.1388 +    }
  1.1389 +
  1.1390 +void CKeypadToneObserverAO::RunL()
  1.1391 +    {
  1.1392 +    TInt status(iStatus.Int());
  1.1393 +#ifdef PRINT_MESSAGE
  1.1394 +    RDebug::Print(_L(" CKeypadToneObserverAO::RunL:iStatus[%d]"), status);
  1.1395 +#endif // PRINT_MESSAGE
  1.1396 +    if ( status == KErrNone )
  1.1397 +        {
  1.1398 +        Subscribe();
  1.1399 +        TInt value=KErrNone;
  1.1400 +            status=iKeypadToneVolumeProperty.Get(value);
  1.1401 +            iGlobalAudioSettingsData.iKeyPadVolume=(CGlobalAudioSettings::TGASKeypadVolume)value;
  1.1402 +        
  1.1403 +        
  1.1404 +        if( status == KErrNone)
  1.1405 +            {
  1.1406 +            MAudioSettingsObserver::TGASEventId id=MAudioSettingsObserver::EGASKeyPadVolume;
  1.1407 +            iAudioSettingsObserver.SettingsChanged(iGlobalAudioSettings, id);
  1.1408 +            }
  1.1409 +#ifdef PRINT_MESSAGE
  1.1410 +        else
  1.1411 +            {
  1.1412 +            RDebug::Print(_L(" CKeypadToneObserverAO::RunL:Property.Get Error[%d]"), status);
  1.1413 +            }
  1.1414 +#endif // PRINT_MESSAGE
  1.1415 +        }
  1.1416 +    }
  1.1417 +
  1.1418 +void CKeypadToneObserverAO::DoCancel()
  1.1419 +    {
  1.1420 +    iKeypadToneVolumeProperty.Cancel();
  1.1421 +    }
  1.1422 +
  1.1423 +TInt CKeypadToneObserverAO::RunError(TInt /*aError*/)
  1.1424 +    {
  1.1425 +    return KErrNone;
  1.1426 +    }
  1.1427 +
  1.1428 +
  1.1429 +/////////////////////////////////////////////////////////////////////
  1.1430 +//  CSilenceModeObserverAO                                                //
  1.1431 +//////////////////////////////////////////////////////////////////////
  1.1432 +CSilenceModeObserverAO::CSilenceModeObserverAO(
  1.1433 +                        CGlobalAudioSettings &aGlobalAudioSettings,
  1.1434 +                        MAudioSettingsObserver& aAudioSettingsObserver,
  1.1435 +                        TGlobalAudioSettings& aGlobalAudioSettingsData)
  1.1436 +:CActive(EPriorityStandard),
  1.1437 + iGlobalAudioSettings(aGlobalAudioSettings),
  1.1438 + iAudioSettingsObserver(aAudioSettingsObserver),
  1.1439 + iGlobalAudioSettingsData(aGlobalAudioSettingsData)
  1.1440 +    {
  1.1441 +    CActiveScheduler::Add(this);
  1.1442 +    }
  1.1443 +
  1.1444 +CSilenceModeObserverAO::~CSilenceModeObserverAO()
  1.1445 +    {
  1.1446 +    Cancel();
  1.1447 +    iSilenceModeProperty.Close();
  1.1448 +    }
  1.1449 +
  1.1450 +CSilenceModeObserverAO* CSilenceModeObserverAO::NewL(
  1.1451 +                            CGlobalAudioSettings &aGlobalAudioSettings,
  1.1452 +                            MAudioSettingsObserver& aAudioSettingsObserver,
  1.1453 +                            TGlobalAudioSettings& aGlobalAudioSettingsData)
  1.1454 +    {
  1.1455 +    CSilenceModeObserverAO* self = new (ELeave) CSilenceModeObserverAO(
  1.1456 +                                            aGlobalAudioSettings,
  1.1457 +                                            aAudioSettingsObserver, 
  1.1458 +                                            aGlobalAudioSettingsData);
  1.1459 +    CleanupStack::PushL(self);
  1.1460 +    self->ConstructL();
  1.1461 +    CleanupStack::Pop();
  1.1462 +    return self;
  1.1463 +    }
  1.1464 +
  1.1465 +void CSilenceModeObserverAO::ConstructL()
  1.1466 +    {
  1.1467 +    
  1.1468 +    
  1.1469 +    User::LeaveIfError(iSilenceModeProperty.Attach(KGASPSUidGlobalAudioSettings, KGASSilenceMode));
  1.1470 +   
  1.1471 +    User::LeaveIfError(iSilenceModeProperty.Get(iGlobalAudioSettingsData.iSilenceMode));
  1.1472 +    RDebug::Printf("in constructL,silence mode %d",iGlobalAudioSettingsData.iSilenceMode);
  1.1473 +  
  1.1474 +    }
  1.1475 +    
  1.1476 +void CSilenceModeObserverAO::Subscribe()
  1.1477 +    {
  1.1478 +    if (!IsActive())
  1.1479 +        {
  1.1480 +        SetActive();
  1.1481 +        
  1.1482 +        iSilenceModeProperty.Subscribe(iStatus);
  1.1483 +        }
  1.1484 +    }
  1.1485 +
  1.1486 +void CSilenceModeObserverAO::RunL()
  1.1487 +    {
  1.1488 +    TInt status(iStatus.Int());
  1.1489 +#ifdef PRINT_MESSAGE
  1.1490 +    RDebug::Print(_L(" CSilenceModeObserverAO::RunL:iStatus[%d]"), status);
  1.1491 +#endif // PRINT_MESSAGE
  1.1492 +    if ( status == KErrNone )
  1.1493 +        {
  1.1494 +        Subscribe();
  1.1495 +       
  1.1496 +            status=iSilenceModeProperty.Get(  iGlobalAudioSettingsData.iSilenceMode);
  1.1497 +            RDebug::Printf("value of silent mode :%d",iGlobalAudioSettingsData.iSilenceMode);
  1.1498 +        
  1.1499 +        
  1.1500 +        if( status == KErrNone)
  1.1501 +            {
  1.1502 +            MAudioSettingsObserver::TGASEventId id=MAudioSettingsObserver::EGASSilenceMode;
  1.1503 +            iAudioSettingsObserver.SettingsChanged(iGlobalAudioSettings, id);
  1.1504 +            }
  1.1505 +#ifdef PRINT_MESSAGE
  1.1506 +        else
  1.1507 +            {
  1.1508 +            RDebug::Print(_L(" CKeypadToneObserverAO::RunL:Property.Get Error[%d]"), status);
  1.1509 +            }
  1.1510 +#endif // PRINT_MESSAGE
  1.1511 +        }
  1.1512 +    }
  1.1513 +
  1.1514 +void CSilenceModeObserverAO::DoCancel()
  1.1515 +    {
  1.1516 +    iSilenceModeProperty.Cancel();
  1.1517 +    }
  1.1518 +
  1.1519 +TInt CSilenceModeObserverAO::RunError(TInt /*aError*/)
  1.1520 +    {
  1.1521 +    return KErrNone;
  1.1522 +    }
  1.1523 +
  1.1524 +//End of file