os/mm/devsoundextensions/globalaudiosettings/src/GlobalAudioSettingsImpl.cpp
author sl
Tue, 10 Jun 2014 14:32:02 +0200
changeset 1 260cb5ec6c19
permissions -rw-r--r--
Update contrib.
sl@0
     1
/*
sl@0
     2
* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies). 
sl@0
     3
* All rights reserved.
sl@0
     4
* This component and the accompanying materials are made available
sl@0
     5
* under the terms of "Eclipse Public License v1.0"
sl@0
     6
* which accompanies this distribution, and is available
sl@0
     7
* at the URL "http://www.eclipse.org/legal/epl-v10.html".
sl@0
     8
*
sl@0
     9
* Initial Contributors:
sl@0
    10
* Nokia Corporation - initial contribution.
sl@0
    11
*
sl@0
    12
* Contributors:
sl@0
    13
*
sl@0
    14
* Description:   Implementation of the Phone Profile Settings API
sl@0
    15
*
sl@0
    16
*/
sl@0
    17
sl@0
    18
sl@0
    19
sl@0
    20
sl@0
    21
// INCLUDE FILES
sl@0
    22
#include "GlobalAudioSettingsImpl.h"
sl@0
    23
#include <e32std.h>
sl@0
    24
#include <GlobalAudioSettingsPSKeys.h>
sl@0
    25
#include <MGlobalAudioSettingsObserver.h>
sl@0
    26
#include <centralrepository.h>
sl@0
    27
#include "AudioClientsListManagerAO.h"
sl@0
    28
#include <AudioClientsListPSKeys.h>
sl@0
    29
sl@0
    30
#ifdef _DEBUG
sl@0
    31
#define PRINT_MESSAGE
sl@0
    32
#endif // _DEBUG
sl@0
    33
sl@0
    34
const TInt KMaxLength=256;
sl@0
    35
_LIT( KNoSound, "z:\\resource\\No_Sound.wav" );
sl@0
    36
// ============================ MEMBER FUNCTIONS ===============================
sl@0
    37
sl@0
    38
// -----------------------------------------------------------------------------
sl@0
    39
// CGlobalAudioSettingsImpl::NewL();
sl@0
    40
// 
sl@0
    41
// -----------------------------------------------------------------------------
sl@0
    42
//
sl@0
    43
CGlobalAudioSettingsImpl::CGlobalAudioSettingsImpl(
sl@0
    44
                            CGlobalAudioSettings &aGlobalAudioSettings,
sl@0
    45
                            MAudioSettingsObserver& aAudioSettingsObserver)
sl@0
    46
:iGlobalAudioSettings(aGlobalAudioSettings),
sl@0
    47
 iAudioSettingsObserver(aAudioSettingsObserver)
sl@0
    48
	{
sl@0
    49
	}
sl@0
    50
	
sl@0
    51
// -----------------------------------------------------------------------------
sl@0
    52
// CGlobalAudioSettingsImpl::NewL();
sl@0
    53
// 
sl@0
    54
// -----------------------------------------------------------------------------
sl@0
    55
//
sl@0
    56
CGlobalAudioSettingsImpl* CGlobalAudioSettingsImpl::NewL(
sl@0
    57
                                        CGlobalAudioSettings &aGlobalAudioSettings,
sl@0
    58
                                        MAudioSettingsObserver& aAudioSettingsObserver)
sl@0
    59
	{
sl@0
    60
	CGlobalAudioSettingsImpl* self = new (ELeave) CGlobalAudioSettingsImpl(
sl@0
    61
	                                    aGlobalAudioSettings,aAudioSettingsObserver);
sl@0
    62
    CleanupStack::PushL( self );
sl@0
    63
    self->ConstructL();
sl@0
    64
    CleanupStack::Pop( self );
sl@0
    65
    return self;
sl@0
    66
	}
sl@0
    67
	
sl@0
    68
// -----------------------------------------------------------------------------
sl@0
    69
// CGlobalAudioSettingsImpl::ConstructL();
sl@0
    70
// 
sl@0
    71
// -----------------------------------------------------------------------------
sl@0
    72
//
sl@0
    73
void CGlobalAudioSettingsImpl::ConstructL()
sl@0
    74
	{
sl@0
    75
	iWarningTonesObserverAO = CWarningTonesObserverAO::NewL(
sl@0
    76
                	                                        iGlobalAudioSettings,
sl@0
    77
                	                                        iAudioSettingsObserver,
sl@0
    78
                	                                        iGlobalAudioSettingsData);
sl@0
    79
	iWarningTonesObserverAO->Subscribe();
sl@0
    80
	
sl@0
    81
	iMessagingTonesObserverAO = CMessagingTonesObserverAO::NewL(
sl@0
    82
                                        	                iGlobalAudioSettings,
sl@0
    83
                                        	                iAudioSettingsObserver,
sl@0
    84
                                        	                iGlobalAudioSettingsData);
sl@0
    85
	iMessagingTonesObserverAO->Subscribe();
sl@0
    86
sl@0
    87
	iSilentProfileObserverAO = CSilentProfileObserverAO::NewL(
sl@0
    88
                                        	                iGlobalAudioSettings,
sl@0
    89
                                        	                iAudioSettingsObserver,
sl@0
    90
                                        	                iGlobalAudioSettingsData);
sl@0
    91
	iSilentProfileObserverAO->Subscribe();
sl@0
    92
sl@0
    93
	iVibraObserverAO = CVibraObserverAO::NewL(
sl@0
    94
                        	                iGlobalAudioSettings,
sl@0
    95
                        	                iAudioSettingsObserver,
sl@0
    96
                        	                iGlobalAudioSettingsData);
sl@0
    97
	iVibraObserverAO->Subscribe();
sl@0
    98
	iRingingTypeObserverAO = CRingingTypeObserverAO::NewL(
sl@0
    99
	                                            iGlobalAudioSettings,
sl@0
   100
	                                            iAudioSettingsObserver,
sl@0
   101
	                                            iGlobalAudioSettingsData);
sl@0
   102
    iRingingTypeObserverAO->Subscribe();
sl@0
   103
     
sl@0
   104
	iMessageToneObserverAO = CMessageToneObserverAO::NewL(
sl@0
   105
	                                            iGlobalAudioSettings,
sl@0
   106
	                                            iAudioSettingsObserver,
sl@0
   107
	                                            iGlobalAudioSettingsData);
sl@0
   108
	iMessageToneObserverAO->Subscribe();
sl@0
   109
	iEmailToneObserverAO = CEmailToneObserverAO::NewL(
sl@0
   110
	                                                iGlobalAudioSettings,
sl@0
   111
	                                                iAudioSettingsObserver,
sl@0
   112
	                                                iGlobalAudioSettingsData);
sl@0
   113
	iEmailToneObserverAO->Subscribe();   
sl@0
   114
	
sl@0
   115
	
sl@0
   116
    iVideoCallObserverAO = CVideoCallToneObserverAO::NewL(
sl@0
   117
                                                            iGlobalAudioSettings,
sl@0
   118
                                                            iAudioSettingsObserver,
sl@0
   119
                                                            iGlobalAudioSettingsData);
sl@0
   120
    iVideoCallObserverAO->Subscribe();  
sl@0
   121
        
sl@0
   122
    iRingingTone1ObserverAO = CRingingTone1ObserverAO::NewL(
sl@0
   123
                                                                    iGlobalAudioSettings,
sl@0
   124
                                                                    iAudioSettingsObserver,
sl@0
   125
                                                                    iGlobalAudioSettingsData);
sl@0
   126
    iRingingTone1ObserverAO->Subscribe();
sl@0
   127
	
sl@0
   128
    iRingingTone2ObserverAO = CRingingTone2ObserverAO::NewL(
sl@0
   129
                                                                            iGlobalAudioSettings,
sl@0
   130
                                                                            iAudioSettingsObserver,
sl@0
   131
                                                                            iGlobalAudioSettingsData);
sl@0
   132
    iRingingTone2ObserverAO->Subscribe();  
sl@0
   133
	
sl@0
   134
    iKeypadToneObserverAO = CKeypadToneObserverAO::NewL(
sl@0
   135
                                                                            iGlobalAudioSettings,
sl@0
   136
                                                                            iAudioSettingsObserver,
sl@0
   137
                                                                            iGlobalAudioSettingsData);
sl@0
   138
    iKeypadToneObserverAO->Subscribe();  
sl@0
   139
                
sl@0
   140
    iSilenceModeObserverAO = CSilenceModeObserverAO::NewL(
sl@0
   141
                                                                                iGlobalAudioSettings,
sl@0
   142
                                                                                iAudioSettingsObserver,
sl@0
   143
                                                                                iGlobalAudioSettingsData);
sl@0
   144
     iSilenceModeObserverAO->Subscribe();  
sl@0
   145
	                    
sl@0
   146
    RProperty publicSilenceProperty;
sl@0
   147
	User::LeaveIfError(publicSilenceProperty.Attach(KGASPSUidGlobalAudioSettings, KGASPublicSilence));
sl@0
   148
	User::LeaveIfError(publicSilenceProperty.Get(iGlobalAudioSettingsData.iPublicSilence));
sl@0
   149
	publicSilenceProperty.Close();
sl@0
   150
sl@0
   151
    iCAudioClientsListManagerAO = CAudioClientsListManagerAO::NewL( iGlobalAudioSettings,iAudioClientsListObserverArray,KAudioPolicyAudioClients);
sl@0
   152
            
sl@0
   153
    iPausedClientsListManagerAO = CAudioClientsListManagerAO::NewL( iGlobalAudioSettings,iAudioClientsListObserverArray,KAudioPolicyApplicationAudioStatePaused );
sl@0
   154
    }
sl@0
   155
    
sl@0
   156
// Destructor
sl@0
   157
CGlobalAudioSettingsImpl::~CGlobalAudioSettingsImpl()
sl@0
   158
    {
sl@0
   159
        delete iWarningTonesObserverAO;
sl@0
   160
        delete iMessagingTonesObserverAO;
sl@0
   161
        delete iSilentProfileObserverAO;
sl@0
   162
        delete iVibraObserverAO;
sl@0
   163
        delete iRingingTypeObserverAO;
sl@0
   164
        delete iMessageToneObserverAO;
sl@0
   165
        delete iEmailToneObserverAO;
sl@0
   166
        delete iVideoCallObserverAO;
sl@0
   167
        delete iRingingTone1ObserverAO;
sl@0
   168
        delete iRingingTone2ObserverAO;
sl@0
   169
        delete iKeypadToneObserverAO;
sl@0
   170
        delete iSilenceModeObserverAO;
sl@0
   171
        delete iCAudioClientsListManagerAO;
sl@0
   172
        delete iPausedClientsListManagerAO;
sl@0
   173
        iAudioClientsListObserverArray.Close();
sl@0
   174
    }
sl@0
   175
sl@0
   176
// -----------------------------------------------------------------------------
sl@0
   177
// CGlobalAudioSettingsImpl::NewL
sl@0
   178
// Static function for creating an instance of the EnvironmentalReverb object.
sl@0
   179
// -----------------------------------------------------------------------------
sl@0
   180
//
sl@0
   181
 TBool CGlobalAudioSettingsImpl::IsWarningTonesEnabled()
sl@0
   182
	{
sl@0
   183
	if(iGlobalAudioSettingsData.iWarningTones)
sl@0
   184
	    return(ETrue);
sl@0
   185
	else
sl@0
   186
	    return(EFalse);
sl@0
   187
	}
sl@0
   188
sl@0
   189
// -----------------------------------------------------------------------------
sl@0
   190
// CGlobalAudioSettingsImpl::IsMessageTonesEnabled
sl@0
   191
// 
sl@0
   192
// -----------------------------------------------------------------------------
sl@0
   193
//
sl@0
   194
TBool CGlobalAudioSettingsImpl::IsMessageTonesEnabled()
sl@0
   195
	{
sl@0
   196
	if(iGlobalAudioSettingsData.iMessageTones)
sl@0
   197
	    return(ETrue);
sl@0
   198
	else
sl@0
   199
	    return(EFalse);
sl@0
   200
	}
sl@0
   201
sl@0
   202
// -----------------------------------------------------------------------------
sl@0
   203
// CGlobalAudioSettingsImpl::IsSilentProfileEnabled
sl@0
   204
// 
sl@0
   205
// -----------------------------------------------------------------------------
sl@0
   206
//
sl@0
   207
TBool CGlobalAudioSettingsImpl::IsSilentProfileEnabled()
sl@0
   208
	{
sl@0
   209
	if(iGlobalAudioSettingsData.iSilentProfile)
sl@0
   210
	    return(ETrue);
sl@0
   211
	else
sl@0
   212
	    return(EFalse);
sl@0
   213
	}
sl@0
   214
sl@0
   215
// -----------------------------------------------------------------------------
sl@0
   216
// CGlobalAudioSettingsImpl::IsVibraEnabled
sl@0
   217
// 
sl@0
   218
// -----------------------------------------------------------------------------
sl@0
   219
//
sl@0
   220
 TBool CGlobalAudioSettingsImpl::IsVibraEnabled()
sl@0
   221
	{
sl@0
   222
	if(iGlobalAudioSettingsData.iVibra)
sl@0
   223
	    return(ETrue);
sl@0
   224
	else
sl@0
   225
	    return(EFalse);
sl@0
   226
	}
sl@0
   227
sl@0
   228
// -----------------------------------------------------------------------------
sl@0
   229
// CGlobalAudioSettingsImpl::IsPublicSilenceEnabled
sl@0
   230
// 
sl@0
   231
// -----------------------------------------------------------------------------
sl@0
   232
//
sl@0
   233
TBool CGlobalAudioSettingsImpl::IsPublicSilenceEnabled()
sl@0
   234
	{
sl@0
   235
	if(iGlobalAudioSettingsData.iPublicSilence)
sl@0
   236
	    return(ETrue);
sl@0
   237
	else
sl@0
   238
	    return(EFalse);
sl@0
   239
	}
sl@0
   240
sl@0
   241
sl@0
   242
sl@0
   243
sl@0
   244
TDesC& CGlobalAudioSettingsImpl::MessageAlertTone()
sl@0
   245
    {
sl@0
   246
     return *iGlobalAudioSettingsData.iMessageToneName;
sl@0
   247
    
sl@0
   248
    }
sl@0
   249
sl@0
   250
TBool CGlobalAudioSettingsImpl::IsMessageAlertToneEnabled()
sl@0
   251
    {
sl@0
   252
     if(iGlobalAudioSettingsData.iMessageToneName->CompareF(KNoSound)==0)
sl@0
   253
         return EFalse;
sl@0
   254
     else
sl@0
   255
         return ETrue;
sl@0
   256
    
sl@0
   257
    }
sl@0
   258
 TDesC& CGlobalAudioSettingsImpl::EmailAlertTone()
sl@0
   259
    {
sl@0
   260
    return *iGlobalAudioSettingsData.iEmailToneName;
sl@0
   261
        
sl@0
   262
    }
sl@0
   263
 TBool CGlobalAudioSettingsImpl::IsEmailAlertToneEnabled()
sl@0
   264
     {
sl@0
   265
      if(iGlobalAudioSettingsData.iEmailToneName->CompareF(KNoSound)==0)
sl@0
   266
          return EFalse;
sl@0
   267
      else
sl@0
   268
          return ETrue;
sl@0
   269
     
sl@0
   270
     }
sl@0
   271
  CGlobalAudioSettings::TGASRingingType CGlobalAudioSettingsImpl::RingingType()
sl@0
   272
    {
sl@0
   273
    CGlobalAudioSettings::TGASRingingType type;
sl@0
   274
   type= ( CGlobalAudioSettings::TGASRingingType)iGlobalAudioSettingsData.iRingingType;
sl@0
   275
 
sl@0
   276
      return type;
sl@0
   277
    }
sl@0
   278
  
sl@0
   279
  TDesC& CGlobalAudioSettingsImpl::VideoCallAlertTone()
sl@0
   280
      {
sl@0
   281
      return *iGlobalAudioSettingsData.iVideoCallToneName;
sl@0
   282
      }
sl@0
   283
  TBool CGlobalAudioSettingsImpl::IsVideoCallAlertToneEnabled()
sl@0
   284
      {
sl@0
   285
       if(iGlobalAudioSettingsData.iVideoCallToneName->CompareF(KNoSound)==0)
sl@0
   286
           return EFalse;
sl@0
   287
       else
sl@0
   288
           return ETrue;
sl@0
   289
      
sl@0
   290
      }
sl@0
   291
  TDesC& CGlobalAudioSettingsImpl::RingingAlertTone1()
sl@0
   292
     {
sl@0
   293
     return *iGlobalAudioSettingsData.iRingingTone1Name;
sl@0
   294
     }
sl@0
   295
  TBool CGlobalAudioSettingsImpl::IsRingingAlertTone1Enabled()
sl@0
   296
      {
sl@0
   297
       if(iGlobalAudioSettingsData.iRingingTone1Name->CompareF(KNoSound)==0)
sl@0
   298
           return EFalse;
sl@0
   299
       else
sl@0
   300
           return ETrue;
sl@0
   301
      
sl@0
   302
      }
sl@0
   303
  TDesC& CGlobalAudioSettingsImpl::RingingAlertTone2()
sl@0
   304
     {
sl@0
   305
     return *iGlobalAudioSettingsData.iRingingTone2Name;
sl@0
   306
     }
sl@0
   307
  
sl@0
   308
  TBool CGlobalAudioSettingsImpl::IsRingingAlertTone2Enabled()
sl@0
   309
      {
sl@0
   310
       if(iGlobalAudioSettingsData.iRingingTone2Name->CompareF(KNoSound)==0)
sl@0
   311
           return EFalse;
sl@0
   312
       else
sl@0
   313
           return ETrue;
sl@0
   314
      
sl@0
   315
      }
sl@0
   316
 CGlobalAudioSettings::TGASKeypadVolume CGlobalAudioSettingsImpl::KeyPadToneVolume()
sl@0
   317
     {
sl@0
   318
     return (CGlobalAudioSettings::TGASKeypadVolume)iGlobalAudioSettingsData.iKeyPadVolume;
sl@0
   319
     }
sl@0
   320
 
sl@0
   321
 TBool CGlobalAudioSettingsImpl::IsSilenceModeEnabled()
sl@0
   322
     {
sl@0
   323
      return iGlobalAudioSettingsData.iSilenceMode;
sl@0
   324
     }
sl@0
   325
// -----------------------------------------------------------------------------
sl@0
   326
// CGlobalAudioSettingsImpl::RegisterAudioClientsListObserver
sl@0
   327
// 
sl@0
   328
// -----------------------------------------------------------------------------
sl@0
   329
//
sl@0
   330
TInt CGlobalAudioSettingsImpl::RegisterAudioClientsListObserver(
sl@0
   331
                            MAudioClientsListObserver& aObserver )
sl@0
   332
	{
sl@0
   333
	TInt status(KErrAlreadyExists);
sl@0
   334
	if ( iAudioClientsListObserverArray.Find( &aObserver ) == KErrNotFound )
sl@0
   335
	    {
sl@0
   336
	    status = iAudioClientsListObserverArray.Append( &aObserver);
sl@0
   337
	    if ( ( status == KErrNone ) && (iAudioClientsListObserverArray.Count() == 1 ) )
sl@0
   338
	        {  	       
sl@0
   339
	 	    iCAudioClientsListManagerAO->MonitorStart();
sl@0
   340
	        iPausedClientsListManagerAO->MonitorStart();
sl@0
   341
	        }
sl@0
   342
	    }
sl@0
   343
	return status;
sl@0
   344
	}
sl@0
   345
        
sl@0
   346
// -----------------------------------------------------------------------------
sl@0
   347
// CGlobalAudioSettingsImpl::UnregisterAudioClientsListObserver
sl@0
   348
// 
sl@0
   349
// -----------------------------------------------------------------------------
sl@0
   350
//
sl@0
   351
TInt CGlobalAudioSettingsImpl::UnregisterAudioClientsListObserver(
sl@0
   352
                            MAudioClientsListObserver& aObserver)
sl@0
   353
	{
sl@0
   354
	TInt status(KErrNone);
sl@0
   355
	status = iAudioClientsListObserverArray.Find( &aObserver );
sl@0
   356
	if ( status != KErrNotFound )
sl@0
   357
	    {
sl@0
   358
	    iAudioClientsListObserverArray.Remove( status );
sl@0
   359
	    if ( iAudioClientsListObserverArray.Count() == 0 )
sl@0
   360
	        {
sl@0
   361
	        iCAudioClientsListManagerAO->MonitorStop();
sl@0
   362
	        iPausedClientsListManagerAO->MonitorStop();	
sl@0
   363
	        }
sl@0
   364
	    }
sl@0
   365
	return status;
sl@0
   366
	}
sl@0
   367
sl@0
   368
// -----------------------------------------------------------------------------
sl@0
   369
// CGlobalAudioSettingsImpl::GetAudioClientsList
sl@0
   370
// 
sl@0
   371
// -----------------------------------------------------------------------------
sl@0
   372
//
sl@0
   373
TInt CGlobalAudioSettingsImpl::GetAudioClientsList(
sl@0
   374
                        CGlobalAudioSettings::TAudioClientListType aType,
sl@0
   375
                        RArray<TProcessId>& aList )
sl@0
   376
	{
sl@0
   377
	TInt status(KErrNone);
sl@0
   378
	
sl@0
   379
	switch(aType)
sl@0
   380
		{
sl@0
   381
		case CGlobalAudioSettings::EActiveAudioClients:
sl@0
   382
			{
sl@0
   383
			status = iCAudioClientsListManagerAO->GetAudioClientsList( aType, aList );	
sl@0
   384
			}
sl@0
   385
			break;
sl@0
   386
        case CGlobalAudioSettings::EPausedAudioClients:
sl@0
   387
        	{
sl@0
   388
        	status = iPausedClientsListManagerAO->GetAudioClientsList( aType, aList );     	
sl@0
   389
        	}
sl@0
   390
        	break;
sl@0
   391
		default:		
sl@0
   392
			break;
sl@0
   393
			
sl@0
   394
		}
sl@0
   395
	 return status;
sl@0
   396
	
sl@0
   397
sl@0
   398
	}
sl@0
   399
sl@0
   400
//////////////////////////////////////////////////////////////////////
sl@0
   401
//	CWarningTonesObserverAO											//
sl@0
   402
//////////////////////////////////////////////////////////////////////
sl@0
   403
CWarningTonesObserverAO::CWarningTonesObserverAO(
sl@0
   404
                            CGlobalAudioSettings &aGlobalAudioSettings,
sl@0
   405
                            MAudioSettingsObserver& aAudioSettingsObserver,
sl@0
   406
                            TGlobalAudioSettings& aGlobalAudioSettingsData)
sl@0
   407
:CActive(EPriorityStandard),
sl@0
   408
 iGlobalAudioSettings(aGlobalAudioSettings),
sl@0
   409
 iAudioSettingsObserver(aAudioSettingsObserver),
sl@0
   410
 iGlobalAudioSettingsData(aGlobalAudioSettingsData)
sl@0
   411
	{
sl@0
   412
	CActiveScheduler::Add(this);
sl@0
   413
	}
sl@0
   414
sl@0
   415
CWarningTonesObserverAO::~CWarningTonesObserverAO()
sl@0
   416
	{
sl@0
   417
	Cancel();
sl@0
   418
	iWarningTonesProperty.Close();
sl@0
   419
	}
sl@0
   420
sl@0
   421
CWarningTonesObserverAO* CWarningTonesObserverAO::NewL(
sl@0
   422
                        CGlobalAudioSettings &aGlobalAudioSettings,
sl@0
   423
                        MAudioSettingsObserver& aAudioSettingsObserver,
sl@0
   424
                        TGlobalAudioSettings& aGlobalAudioSettingsData)
sl@0
   425
	{
sl@0
   426
	CWarningTonesObserverAO* self = new (ELeave) CWarningTonesObserverAO(
sl@0
   427
	                                                    aGlobalAudioSettings, 
sl@0
   428
	                                                    aAudioSettingsObserver,
sl@0
   429
	                                                    aGlobalAudioSettingsData);
sl@0
   430
	CleanupStack::PushL(self);
sl@0
   431
	self->ConstructL();
sl@0
   432
	CleanupStack::Pop();
sl@0
   433
	return self;
sl@0
   434
	}
sl@0
   435
sl@0
   436
void CWarningTonesObserverAO::ConstructL()
sl@0
   437
	{
sl@0
   438
	User::LeaveIfError(iWarningTonesProperty.Attach(KGASPSUidGlobalAudioSettings, KGASWarningTones));
sl@0
   439
    User::LeaveIfError(iWarningTonesProperty.Get(iGlobalAudioSettingsData.iWarningTones));
sl@0
   440
	}
sl@0
   441
	
sl@0
   442
void CWarningTonesObserverAO::Subscribe()
sl@0
   443
	{
sl@0
   444
	if (!IsActive())
sl@0
   445
	    {
sl@0
   446
    	SetActive();
sl@0
   447
    	iWarningTonesProperty.Subscribe(iStatus);
sl@0
   448
	    }
sl@0
   449
	}
sl@0
   450
sl@0
   451
void CWarningTonesObserverAO::RunL()
sl@0
   452
	{
sl@0
   453
	TInt status(iStatus.Int());
sl@0
   454
#ifdef PRINT_MESSAGE
sl@0
   455
    RDebug::Print(_L(" CWarningTonesObserverAO::RunL:iStatus[%d]"), status);
sl@0
   456
#endif // PRINT_MESSAGE
sl@0
   457
    if ( status == KErrNone )
sl@0
   458
        {
sl@0
   459
        Subscribe();
sl@0
   460
        status = iWarningTonesProperty.Get(iGlobalAudioSettingsData.iWarningTones);
sl@0
   461
        if(status == KErrNone)
sl@0
   462
            {
sl@0
   463
        MAudioSettingsObserver::TGASEventId id=MAudioSettingsObserver::EGASWarningTones;
sl@0
   464
            iAudioSettingsObserver.SettingsChanged(iGlobalAudioSettings, id);
sl@0
   465
            }
sl@0
   466
#ifdef PRINT_MESSAGE
sl@0
   467
        else
sl@0
   468
            {
sl@0
   469
            RDebug::Print(_L(" CWarningTonesObserverAO::RunL:Property.Get Error[%d]"), status);            
sl@0
   470
            }
sl@0
   471
#endif // PRINT_MESSAGE
sl@0
   472
        }
sl@0
   473
	}
sl@0
   474
sl@0
   475
void CWarningTonesObserverAO::DoCancel()
sl@0
   476
	{
sl@0
   477
	iWarningTonesProperty.Cancel();
sl@0
   478
	}
sl@0
   479
sl@0
   480
TInt CWarningTonesObserverAO::RunError(TInt /*aError*/)
sl@0
   481
	{
sl@0
   482
	return KErrNone;
sl@0
   483
	}
sl@0
   484
sl@0
   485
//////////////////////////////////////////////////////////////////////
sl@0
   486
//	CMessagingTonesObserverAO											//
sl@0
   487
//////////////////////////////////////////////////////////////////////
sl@0
   488
CMessagingTonesObserverAO::CMessagingTonesObserverAO(
sl@0
   489
                                CGlobalAudioSettings &aGlobalAudioSettings,
sl@0
   490
                                MAudioSettingsObserver& aAudioSettingsObserver,
sl@0
   491
                                TGlobalAudioSettings& aGlobalAudioSettingsData)
sl@0
   492
:CActive(EPriorityStandard),
sl@0
   493
 iGlobalAudioSettings(aGlobalAudioSettings),
sl@0
   494
 iAudioSettingsObserver(aAudioSettingsObserver),
sl@0
   495
 iGlobalAudioSettingsData(aGlobalAudioSettingsData)
sl@0
   496
	{
sl@0
   497
	CActiveScheduler::Add(this);
sl@0
   498
	}
sl@0
   499
sl@0
   500
CMessagingTonesObserverAO::~CMessagingTonesObserverAO()
sl@0
   501
	{
sl@0
   502
	Cancel();
sl@0
   503
	iMessagingTonesProperty.Close();
sl@0
   504
	}
sl@0
   505
sl@0
   506
CMessagingTonesObserverAO* CMessagingTonesObserverAO::NewL(
sl@0
   507
                                               CGlobalAudioSettings &aGlobalAudioSettings,
sl@0
   508
                                               MAudioSettingsObserver& aAudioSettingsObserver,
sl@0
   509
                                               TGlobalAudioSettings& aGlobalAudioSettingsData)
sl@0
   510
	{
sl@0
   511
	CMessagingTonesObserverAO* self = new (ELeave) CMessagingTonesObserverAO(
sl@0
   512
                    	                        aGlobalAudioSettings, aAudioSettingsObserver, 
sl@0
   513
                    	                        aGlobalAudioSettingsData);
sl@0
   514
	CleanupStack::PushL(self);
sl@0
   515
	self->ConstructL();
sl@0
   516
	CleanupStack::Pop();
sl@0
   517
	return self;
sl@0
   518
	}
sl@0
   519
sl@0
   520
void CMessagingTonesObserverAO::ConstructL()
sl@0
   521
	{
sl@0
   522
	User::LeaveIfError(iMessagingTonesProperty.Attach(KGASPSUidGlobalAudioSettings, KGASMessageTones));
sl@0
   523
	User::LeaveIfError(iMessagingTonesProperty.Get(iGlobalAudioSettingsData.iMessageTones));
sl@0
   524
	}
sl@0
   525
	
sl@0
   526
void CMessagingTonesObserverAO::Subscribe()
sl@0
   527
	{
sl@0
   528
	if (!IsActive())
sl@0
   529
	    {
sl@0
   530
    	SetActive();
sl@0
   531
    	iMessagingTonesProperty.Subscribe(iStatus);
sl@0
   532
	    }
sl@0
   533
	}
sl@0
   534
sl@0
   535
void CMessagingTonesObserverAO::RunL()
sl@0
   536
	{
sl@0
   537
	TInt status(iStatus.Int());
sl@0
   538
#ifdef PRINT_MESSAGE
sl@0
   539
    RDebug::Print(_L(" CMessagingTonesObserverAO::RunL:iStatus[%d]"), status);
sl@0
   540
#endif // PRINT_MESSAGE
sl@0
   541
    if ( status == KErrNone )
sl@0
   542
        {
sl@0
   543
        Subscribe();
sl@0
   544
        status = iMessagingTonesProperty.Get(iGlobalAudioSettingsData.iMessageTones);
sl@0
   545
        if(status == KErrNone)
sl@0
   546
            {
sl@0
   547
        MAudioSettingsObserver::TGASEventId id=MAudioSettingsObserver::EGASMessageTones;
sl@0
   548
            iAudioSettingsObserver.SettingsChanged(iGlobalAudioSettings, id);
sl@0
   549
            }
sl@0
   550
#ifdef PRINT_MESSAGE
sl@0
   551
        else
sl@0
   552
            {
sl@0
   553
            RDebug::Print(_L(" CMessagingTonesObserverAO::RunL:Property.Get Error[%d]"), status);
sl@0
   554
            }
sl@0
   555
#endif // PRINT_MESSAGE
sl@0
   556
        }
sl@0
   557
	}
sl@0
   558
sl@0
   559
void CMessagingTonesObserverAO::DoCancel()
sl@0
   560
	{
sl@0
   561
	iMessagingTonesProperty.Cancel();
sl@0
   562
	}
sl@0
   563
sl@0
   564
TInt CMessagingTonesObserverAO::RunError(TInt /*aError*/)
sl@0
   565
	{
sl@0
   566
	return KErrNone;
sl@0
   567
	}
sl@0
   568
	
sl@0
   569
//////////////////////////////////////////////////////////////////////
sl@0
   570
//	CSilentProfileObserverAO											//
sl@0
   571
//////////////////////////////////////////////////////////////////////
sl@0
   572
CSilentProfileObserverAO::CSilentProfileObserverAO(
sl@0
   573
                                CGlobalAudioSettings &aGlobalAudioSettings,
sl@0
   574
                                MAudioSettingsObserver& aAudioSettingsObserver,
sl@0
   575
                                TGlobalAudioSettings& aGlobalAudioSettingsData)
sl@0
   576
:CActive(EPriorityStandard),
sl@0
   577
 iGlobalAudioSettings(aGlobalAudioSettings),
sl@0
   578
 iAudioSettingsObserver(aAudioSettingsObserver),
sl@0
   579
 iGlobalAudioSettingsData(aGlobalAudioSettingsData)
sl@0
   580
	{
sl@0
   581
	CActiveScheduler::Add(this);
sl@0
   582
	}
sl@0
   583
sl@0
   584
CSilentProfileObserverAO::~CSilentProfileObserverAO()
sl@0
   585
	{
sl@0
   586
	Cancel();
sl@0
   587
	iSilentProfileProperty.Close();
sl@0
   588
	}
sl@0
   589
sl@0
   590
CSilentProfileObserverAO* CSilentProfileObserverAO::NewL(
sl@0
   591
                                        CGlobalAudioSettings &aGlobalAudioSettings,
sl@0
   592
                                        MAudioSettingsObserver& aAudioSettingsObserver,
sl@0
   593
                                        TGlobalAudioSettings& aGlobalAudioSettingsData)
sl@0
   594
	{
sl@0
   595
	CSilentProfileObserverAO* self = new (ELeave) CSilentProfileObserverAO(
sl@0
   596
                    	                        aGlobalAudioSettings, aAudioSettingsObserver, 
sl@0
   597
                    	                        aGlobalAudioSettingsData);
sl@0
   598
	CleanupStack::PushL(self);
sl@0
   599
	self->ConstructL();
sl@0
   600
	CleanupStack::Pop();
sl@0
   601
	return self;
sl@0
   602
	}
sl@0
   603
sl@0
   604
void CSilentProfileObserverAO::ConstructL()
sl@0
   605
	{
sl@0
   606
	User::LeaveIfError(iSilentProfileProperty.Attach(KGASPSUidGlobalAudioSettings, KGASSilentProfile));
sl@0
   607
	User::LeaveIfError(iSilentProfileProperty.Get(iGlobalAudioSettingsData.iSilentProfile));
sl@0
   608
	}
sl@0
   609
	
sl@0
   610
void CSilentProfileObserverAO::Subscribe()
sl@0
   611
	{
sl@0
   612
	if (!IsActive())
sl@0
   613
	    {
sl@0
   614
    	SetActive();
sl@0
   615
    	iSilentProfileProperty.Subscribe(iStatus);
sl@0
   616
	    }
sl@0
   617
	}
sl@0
   618
sl@0
   619
void CSilentProfileObserverAO::RunL()
sl@0
   620
	{
sl@0
   621
	TInt status(iStatus.Int());
sl@0
   622
#ifdef PRINT_MESSAGE
sl@0
   623
    RDebug::Print(_L(" CSilentProfileObserverAO::RunL:iStatus[%d]"), status);
sl@0
   624
#endif // PRINT_MESSAGE
sl@0
   625
    if ( status == KErrNone )
sl@0
   626
        {
sl@0
   627
        Subscribe();
sl@0
   628
        status = iSilentProfileProperty.Get(iGlobalAudioSettingsData.iSilentProfile);
sl@0
   629
        if(status == KErrNone)
sl@0
   630
            {
sl@0
   631
        MAudioSettingsObserver::TGASEventId id=MAudioSettingsObserver::EGASSilentProfile;
sl@0
   632
            iAudioSettingsObserver.SettingsChanged(iGlobalAudioSettings, id);
sl@0
   633
            }
sl@0
   634
#ifdef PRINT_MESSAGE
sl@0
   635
        else
sl@0
   636
            {
sl@0
   637
            RDebug::Print(_L(" CSilentProfileObserverAO::RunL:Property.Get Error[%d]"), status);
sl@0
   638
            }
sl@0
   639
#endif // PRINT_MESSAGE
sl@0
   640
        }
sl@0
   641
	}
sl@0
   642
sl@0
   643
void CSilentProfileObserverAO::DoCancel()
sl@0
   644
	{
sl@0
   645
	iSilentProfileProperty.Cancel();
sl@0
   646
	}
sl@0
   647
sl@0
   648
TInt CSilentProfileObserverAO::RunError(TInt /*aError*/)
sl@0
   649
	{
sl@0
   650
	return KErrNone;
sl@0
   651
	}
sl@0
   652
	
sl@0
   653
//////////////////////////////////////////////////////////////////////
sl@0
   654
//	CVibraObserverAO											    //
sl@0
   655
//////////////////////////////////////////////////////////////////////
sl@0
   656
CVibraObserverAO::CVibraObserverAO(
sl@0
   657
                        CGlobalAudioSettings &aGlobalAudioSettings,
sl@0
   658
                        MAudioSettingsObserver& aAudioSettingsObserver,
sl@0
   659
                        TGlobalAudioSettings& aGlobalAudioSettingsData)
sl@0
   660
:CActive(EPriorityStandard),
sl@0
   661
 iGlobalAudioSettings(aGlobalAudioSettings),
sl@0
   662
 iAudioSettingsObserver(aAudioSettingsObserver),
sl@0
   663
 iGlobalAudioSettingsData(aGlobalAudioSettingsData)
sl@0
   664
	{
sl@0
   665
	CActiveScheduler::Add(this);
sl@0
   666
	}
sl@0
   667
sl@0
   668
CVibraObserverAO::~CVibraObserverAO()
sl@0
   669
	{
sl@0
   670
	Cancel();
sl@0
   671
	iVibraProperty.Close();
sl@0
   672
	}
sl@0
   673
sl@0
   674
CVibraObserverAO* CVibraObserverAO::NewL(
sl@0
   675
                            CGlobalAudioSettings &aGlobalAudioSettings,
sl@0
   676
                            MAudioSettingsObserver& aAudioSettingsObserver,
sl@0
   677
                            TGlobalAudioSettings& aGlobalAudioSettingsData)
sl@0
   678
	{
sl@0
   679
	CVibraObserverAO* self = new (ELeave) CVibraObserverAO(
sl@0
   680
                	                        aGlobalAudioSettings,
sl@0
   681
                	                        aAudioSettingsObserver, 
sl@0
   682
                	                        aGlobalAudioSettingsData);
sl@0
   683
	CleanupStack::PushL(self);
sl@0
   684
	self->ConstructL();
sl@0
   685
	CleanupStack::Pop();
sl@0
   686
	return self;
sl@0
   687
	}
sl@0
   688
sl@0
   689
void CVibraObserverAO::ConstructL()
sl@0
   690
	{
sl@0
   691
	User::LeaveIfError(iVibraProperty.Attach(KGASPSUidGlobalAudioSettings, KGASVibra));
sl@0
   692
	User::LeaveIfError(iVibraProperty.Get(iGlobalAudioSettingsData.iVibra));
sl@0
   693
	}
sl@0
   694
	
sl@0
   695
void CVibraObserverAO::Subscribe()
sl@0
   696
	{
sl@0
   697
	if (!IsActive())
sl@0
   698
	    {
sl@0
   699
    	SetActive();
sl@0
   700
    	iVibraProperty.Subscribe(iStatus);
sl@0
   701
	    }
sl@0
   702
	}
sl@0
   703
sl@0
   704
void CVibraObserverAO::RunL()
sl@0
   705
	{
sl@0
   706
	TInt status(iStatus.Int());
sl@0
   707
#ifdef PRINT_MESSAGE
sl@0
   708
    RDebug::Print(_L(" CVibraObserverAO::RunL:iStatus[%d]"), status);
sl@0
   709
#endif // PRINT_MESSAGE
sl@0
   710
    if ( status == KErrNone )
sl@0
   711
        {
sl@0
   712
        Subscribe();
sl@0
   713
        status = iVibraProperty.Get(iGlobalAudioSettingsData.iVibra);
sl@0
   714
        if( status == KErrNone)
sl@0
   715
            {
sl@0
   716
        MAudioSettingsObserver::TGASEventId id=MAudioSettingsObserver::EGASVibra;
sl@0
   717
            iAudioSettingsObserver.SettingsChanged(iGlobalAudioSettings,id);
sl@0
   718
            }
sl@0
   719
#ifdef PRINT_MESSAGE
sl@0
   720
        else
sl@0
   721
            {
sl@0
   722
            RDebug::Print(_L(" CVibraObserverAO::RunL:Property.Get Error[%d]"), status);
sl@0
   723
            }
sl@0
   724
#endif // PRINT_MESSAGE
sl@0
   725
        }
sl@0
   726
	}
sl@0
   727
sl@0
   728
void CVibraObserverAO::DoCancel()
sl@0
   729
	{
sl@0
   730
	iVibraProperty.Cancel();
sl@0
   731
	}
sl@0
   732
sl@0
   733
TInt CVibraObserverAO::RunError(TInt /*aError*/)
sl@0
   734
	{
sl@0
   735
	return KErrNone;
sl@0
   736
	}
sl@0
   737
sl@0
   738
//////////////////////////////////////////////////////////////////////
sl@0
   739
//  CRingingTypeObserverAO                                                //
sl@0
   740
//////////////////////////////////////////////////////////////////////
sl@0
   741
CRingingTypeObserverAO::CRingingTypeObserverAO(
sl@0
   742
                        CGlobalAudioSettings &aGlobalAudioSettings,
sl@0
   743
                        MAudioSettingsObserver& aAudioSettingsObserver,
sl@0
   744
                        TGlobalAudioSettings& aGlobalAudioSettingsData)
sl@0
   745
:CActive(EPriorityStandard),
sl@0
   746
 iGlobalAudioSettings(aGlobalAudioSettings),
sl@0
   747
 iAudioSettingsObserver(aAudioSettingsObserver),
sl@0
   748
 iGlobalAudioSettingsData(aGlobalAudioSettingsData)
sl@0
   749
    {
sl@0
   750
    CActiveScheduler::Add(this);
sl@0
   751
    }
sl@0
   752
sl@0
   753
CRingingTypeObserverAO::~CRingingTypeObserverAO()
sl@0
   754
    {
sl@0
   755
    Cancel();
sl@0
   756
    iRingingTypeProperty.Close();
sl@0
   757
    }
sl@0
   758
sl@0
   759
CRingingTypeObserverAO* CRingingTypeObserverAO::NewL(
sl@0
   760
                            CGlobalAudioSettings &aGlobalAudioSettings,
sl@0
   761
                            MAudioSettingsObserver& aAudioSettingsObserver,
sl@0
   762
                            TGlobalAudioSettings& aGlobalAudioSettingsData)
sl@0
   763
    {
sl@0
   764
    CRingingTypeObserverAO* self = new (ELeave) CRingingTypeObserverAO(
sl@0
   765
                                            aGlobalAudioSettings,
sl@0
   766
                                            aAudioSettingsObserver, 
sl@0
   767
                                            aGlobalAudioSettingsData);
sl@0
   768
    CleanupStack::PushL(self);
sl@0
   769
    self->ConstructL();
sl@0
   770
    CleanupStack::Pop();
sl@0
   771
    return self;
sl@0
   772
    }
sl@0
   773
sl@0
   774
void CRingingTypeObserverAO::ConstructL()
sl@0
   775
    {
sl@0
   776
    User::LeaveIfError(iRingingTypeProperty.Attach(KGASPSUidGlobalAudioSettings, KGASRingingType));
sl@0
   777
    TInt value=KErrNone;
sl@0
   778
    User::LeaveIfError(iRingingTypeProperty.Get(value));
sl@0
   779
    iGlobalAudioSettingsData.iRingingType=(CGlobalAudioSettings::TGASRingingType)value;
sl@0
   780
    
sl@0
   781
    }
sl@0
   782
    
sl@0
   783
void CRingingTypeObserverAO::Subscribe()
sl@0
   784
    {
sl@0
   785
    if (!IsActive())
sl@0
   786
        {
sl@0
   787
        SetActive();
sl@0
   788
        
sl@0
   789
        iRingingTypeProperty.Subscribe(iStatus);
sl@0
   790
        }
sl@0
   791
    }
sl@0
   792
sl@0
   793
void CRingingTypeObserverAO::RunL()
sl@0
   794
    {
sl@0
   795
    TInt status(iStatus.Int());
sl@0
   796
#ifdef PRINT_MESSAGE
sl@0
   797
    RDebug::Print(_L(" CRingingTypeObserverAO::RunL:iStatus[%d]"), status);
sl@0
   798
#endif // PRINT_MESSAGE
sl@0
   799
    if ( status == KErrNone )
sl@0
   800
        {
sl@0
   801
        Subscribe();
sl@0
   802
        TInt value=KErrNone;
sl@0
   803
        status=(iRingingTypeProperty.Get(value));
sl@0
   804
        iGlobalAudioSettingsData.iRingingType=(CGlobalAudioSettings::TGASRingingType)value;
sl@0
   805
        if( status == KErrNone)
sl@0
   806
            {
sl@0
   807
        MAudioSettingsObserver::TGASEventId id=MAudioSettingsObserver::EGASRingingType;
sl@0
   808
            iAudioSettingsObserver.SettingsChanged(iGlobalAudioSettings, id);
sl@0
   809
            }
sl@0
   810
#ifdef PRINT_MESSAGE
sl@0
   811
        else
sl@0
   812
            {
sl@0
   813
            RDebug::Print(_L(" CRingingTypeObserverAO::RunL:Property.Get Error[%d]"), status);
sl@0
   814
            }
sl@0
   815
#endif // PRINT_MESSAGE
sl@0
   816
        }
sl@0
   817
    }
sl@0
   818
sl@0
   819
void CRingingTypeObserverAO::DoCancel()
sl@0
   820
    {
sl@0
   821
    iRingingTypeProperty.Cancel();
sl@0
   822
    }
sl@0
   823
sl@0
   824
TInt CRingingTypeObserverAO::RunError(TInt /*aError*/)
sl@0
   825
    {
sl@0
   826
    return KErrNone;
sl@0
   827
    }
sl@0
   828
sl@0
   829
//////////////////////////////////////////////////////////////////////
sl@0
   830
//  CMessageToneObserverAO                                                //
sl@0
   831
//////////////////////////////////////////////////////////////////////
sl@0
   832
CMessageToneObserverAO::CMessageToneObserverAO(
sl@0
   833
                        CGlobalAudioSettings &aGlobalAudioSettings,
sl@0
   834
                        MAudioSettingsObserver& aAudioSettingsObserver,
sl@0
   835
                        TGlobalAudioSettings& aGlobalAudioSettingsData)
sl@0
   836
:CActive(EPriorityStandard),
sl@0
   837
 iGlobalAudioSettings(aGlobalAudioSettings),
sl@0
   838
 iAudioSettingsObserver(aAudioSettingsObserver),
sl@0
   839
 iGlobalAudioSettingsData(aGlobalAudioSettingsData)
sl@0
   840
    {
sl@0
   841
    CActiveScheduler::Add(this);
sl@0
   842
    }
sl@0
   843
sl@0
   844
CMessageToneObserverAO::~CMessageToneObserverAO()
sl@0
   845
    {
sl@0
   846
    Cancel();
sl@0
   847
    iMessageToneNameProperty.Close();
sl@0
   848
    if( iGlobalAudioSettingsData.iMessageToneName)
sl@0
   849
        {
sl@0
   850
          delete  iGlobalAudioSettingsData.iMessageToneName;
sl@0
   851
          iGlobalAudioSettingsData.iMessageToneName=NULL;
sl@0
   852
        }
sl@0
   853
    }
sl@0
   854
sl@0
   855
CMessageToneObserverAO* CMessageToneObserverAO::NewL(
sl@0
   856
                            CGlobalAudioSettings &aGlobalAudioSettings,
sl@0
   857
                            MAudioSettingsObserver& aAudioSettingsObserver,
sl@0
   858
                            TGlobalAudioSettings& aGlobalAudioSettingsData)
sl@0
   859
    {
sl@0
   860
    CMessageToneObserverAO* self = new (ELeave) CMessageToneObserverAO(
sl@0
   861
                                            aGlobalAudioSettings,
sl@0
   862
                                            aAudioSettingsObserver, 
sl@0
   863
                                            aGlobalAudioSettingsData);
sl@0
   864
    CleanupStack::PushL(self);
sl@0
   865
    self->ConstructL();
sl@0
   866
    CleanupStack::Pop();
sl@0
   867
    return self;
sl@0
   868
    }
sl@0
   869
sl@0
   870
void CMessageToneObserverAO::ConstructL()
sl@0
   871
    {
sl@0
   872
    iGlobalAudioSettingsData.iMessageToneName=HBufC::NewL(KMaxLength);
sl@0
   873
    User::LeaveIfError(iMessageToneNameProperty.Attach(KGASPSUidGlobalAudioSettings, KGASMessageToneName));
sl@0
   874
    TPtr16 ptr=iGlobalAudioSettingsData.iMessageToneName->Des();
sl@0
   875
    User::LeaveIfError(iMessageToneNameProperty.Get(ptr));
sl@0
   876
    
sl@0
   877
    }
sl@0
   878
    
sl@0
   879
void CMessageToneObserverAO::Subscribe()
sl@0
   880
    {
sl@0
   881
    if (!IsActive())
sl@0
   882
        {
sl@0
   883
        SetActive();
sl@0
   884
        
sl@0
   885
        iMessageToneNameProperty.Subscribe(iStatus);
sl@0
   886
        }
sl@0
   887
    }
sl@0
   888
sl@0
   889
void CMessageToneObserverAO::RunL()
sl@0
   890
    {
sl@0
   891
    TInt status(iStatus.Int());
sl@0
   892
#ifdef PRINT_MESSAGE
sl@0
   893
    RDebug::Print(_L(" CMessageToneObserverAO::RunL:iStatus[%d]"), status);
sl@0
   894
#endif // PRINT_MESSAGE
sl@0
   895
    if ( status == KErrNone )
sl@0
   896
        {
sl@0
   897
        Subscribe();
sl@0
   898
        delete iGlobalAudioSettingsData.iMessageToneName;
sl@0
   899
        iGlobalAudioSettingsData.iMessageToneName=NULL;
sl@0
   900
        iGlobalAudioSettingsData.iMessageToneName=HBufC::NewL(KMaxLength);
sl@0
   901
        TPtr16 ptr=iGlobalAudioSettingsData.iMessageToneName->Des();
sl@0
   902
        status = iMessageToneNameProperty.Get(ptr);
sl@0
   903
        if( status == KErrNone)
sl@0
   904
            {
sl@0
   905
            MAudioSettingsObserver::TGASEventId id=MAudioSettingsObserver::EGASMessageToneName;
sl@0
   906
            iAudioSettingsObserver.SettingsChanged(iGlobalAudioSettings, id);
sl@0
   907
            }
sl@0
   908
#ifdef PRINT_MESSAGE
sl@0
   909
        else
sl@0
   910
            {
sl@0
   911
            RDebug::Print(_L(" CMessageToneObserverAO::RunL:Property.Get Error[%d]"), status);
sl@0
   912
            }
sl@0
   913
#endif // PRINT_MESSAGE
sl@0
   914
        }
sl@0
   915
    }
sl@0
   916
sl@0
   917
void CMessageToneObserverAO::DoCancel()
sl@0
   918
    {
sl@0
   919
    iMessageToneNameProperty.Cancel();
sl@0
   920
    }
sl@0
   921
sl@0
   922
TInt CMessageToneObserverAO::RunError(TInt /*aError*/)
sl@0
   923
    {
sl@0
   924
    return KErrNone;
sl@0
   925
    }
sl@0
   926
sl@0
   927
sl@0
   928
/////////////////////////////////////////////////////////////////////
sl@0
   929
//  CEmailToneObserverAO                                                //
sl@0
   930
//////////////////////////////////////////////////////////////////////
sl@0
   931
CEmailToneObserverAO::CEmailToneObserverAO(
sl@0
   932
                        CGlobalAudioSettings &aGlobalAudioSettings,
sl@0
   933
                        MAudioSettingsObserver& aAudioSettingsObserver,
sl@0
   934
                        TGlobalAudioSettings& aGlobalAudioSettingsData)
sl@0
   935
:CActive(EPriorityStandard),
sl@0
   936
 iGlobalAudioSettings(aGlobalAudioSettings),
sl@0
   937
 iAudioSettingsObserver(aAudioSettingsObserver),
sl@0
   938
 iGlobalAudioSettingsData(aGlobalAudioSettingsData)
sl@0
   939
    {
sl@0
   940
    CActiveScheduler::Add(this);
sl@0
   941
    }
sl@0
   942
sl@0
   943
CEmailToneObserverAO::~CEmailToneObserverAO()
sl@0
   944
    {
sl@0
   945
    Cancel();
sl@0
   946
    iEmailToneNameProperty.Close();
sl@0
   947
    
sl@0
   948
    if(iGlobalAudioSettingsData.iEmailToneName)
sl@0
   949
        {
sl@0
   950
        delete  iGlobalAudioSettingsData.iEmailToneName;
sl@0
   951
        iGlobalAudioSettingsData.iEmailToneName=NULL;
sl@0
   952
        }
sl@0
   953
   
sl@0
   954
    }
sl@0
   955
sl@0
   956
CEmailToneObserverAO* CEmailToneObserverAO::NewL(
sl@0
   957
                            CGlobalAudioSettings &aGlobalAudioSettings,
sl@0
   958
                            MAudioSettingsObserver& aAudioSettingsObserver,
sl@0
   959
                            TGlobalAudioSettings& aGlobalAudioSettingsData)
sl@0
   960
    {
sl@0
   961
    CEmailToneObserverAO* self = new (ELeave) CEmailToneObserverAO(
sl@0
   962
                                            aGlobalAudioSettings,
sl@0
   963
                                            aAudioSettingsObserver, 
sl@0
   964
                                            aGlobalAudioSettingsData);
sl@0
   965
    CleanupStack::PushL(self);
sl@0
   966
    self->ConstructL();
sl@0
   967
    CleanupStack::Pop();
sl@0
   968
    return self;
sl@0
   969
    }
sl@0
   970
sl@0
   971
void CEmailToneObserverAO::ConstructL()
sl@0
   972
    {
sl@0
   973
    
sl@0
   974
    iGlobalAudioSettingsData.iEmailToneName=HBufC::NewL(KMaxLength);
sl@0
   975
    User::LeaveIfError(iEmailToneNameProperty.Attach(KGASPSUidGlobalAudioSettings, KGASEmailToneName));
sl@0
   976
    TPtr16 ptr=iGlobalAudioSettingsData.iEmailToneName->Des();
sl@0
   977
    User::LeaveIfError(iEmailToneNameProperty.Get(ptr));
sl@0
   978
    
sl@0
   979
    }
sl@0
   980
    
sl@0
   981
void CEmailToneObserverAO::Subscribe()
sl@0
   982
    {
sl@0
   983
    if (!IsActive())
sl@0
   984
        {
sl@0
   985
        SetActive();
sl@0
   986
        
sl@0
   987
        iEmailToneNameProperty.Subscribe(iStatus);
sl@0
   988
        }
sl@0
   989
    }
sl@0
   990
sl@0
   991
void CEmailToneObserverAO::RunL()
sl@0
   992
    {
sl@0
   993
    TInt status(iStatus.Int());
sl@0
   994
#ifdef PRINT_MESSAGE
sl@0
   995
    RDebug::Print(_L(" CEmailToneObserverAO::RunL:iStatus[%d]"), status);
sl@0
   996
#endif // PRINT_MESSAGE
sl@0
   997
    if ( status == KErrNone )
sl@0
   998
        {
sl@0
   999
        Subscribe();
sl@0
  1000
        delete iGlobalAudioSettingsData.iEmailToneName;
sl@0
  1001
        iGlobalAudioSettingsData.iEmailToneName=NULL;
sl@0
  1002
        iGlobalAudioSettingsData.iEmailToneName=HBufC::NewL(KMaxLength);
sl@0
  1003
        TPtr16 ptr=iGlobalAudioSettingsData.iEmailToneName->Des();
sl@0
  1004
        status = iEmailToneNameProperty.Get(ptr);
sl@0
  1005
        if( status == KErrNone)
sl@0
  1006
            {
sl@0
  1007
            MAudioSettingsObserver::TGASEventId id=MAudioSettingsObserver::EGASEmailToneName;
sl@0
  1008
            iAudioSettingsObserver.SettingsChanged(iGlobalAudioSettings, id);
sl@0
  1009
            }
sl@0
  1010
#ifdef PRINT_MESSAGE
sl@0
  1011
        else
sl@0
  1012
            {
sl@0
  1013
            RDebug::Print(_L(" CEmailToneObserverAO::RunL:Property.Get Error[%d]"), status);
sl@0
  1014
            }
sl@0
  1015
#endif // PRINT_MESSAGE
sl@0
  1016
        }
sl@0
  1017
    }
sl@0
  1018
sl@0
  1019
void CEmailToneObserverAO::DoCancel()
sl@0
  1020
    {
sl@0
  1021
    iEmailToneNameProperty.Cancel();
sl@0
  1022
    }
sl@0
  1023
sl@0
  1024
TInt CEmailToneObserverAO::RunError(TInt /*aError*/)
sl@0
  1025
    {
sl@0
  1026
    return KErrNone;
sl@0
  1027
    }
sl@0
  1028
sl@0
  1029
sl@0
  1030
/////////////////////////////////////////////////////////////////////
sl@0
  1031
//  CVideoCallToneObserverAO                                                //
sl@0
  1032
//////////////////////////////////////////////////////////////////////
sl@0
  1033
CVideoCallToneObserverAO::CVideoCallToneObserverAO(
sl@0
  1034
                        CGlobalAudioSettings &aGlobalAudioSettings,
sl@0
  1035
                        MAudioSettingsObserver& aAudioSettingsObserver,
sl@0
  1036
                        TGlobalAudioSettings& aGlobalAudioSettingsData)
sl@0
  1037
:CActive(EPriorityStandard),
sl@0
  1038
 iGlobalAudioSettings(aGlobalAudioSettings),
sl@0
  1039
 iAudioSettingsObserver(aAudioSettingsObserver),
sl@0
  1040
 iGlobalAudioSettingsData(aGlobalAudioSettingsData)
sl@0
  1041
    {
sl@0
  1042
    CActiveScheduler::Add(this);
sl@0
  1043
    }
sl@0
  1044
sl@0
  1045
CVideoCallToneObserverAO::~CVideoCallToneObserverAO()
sl@0
  1046
    {
sl@0
  1047
    Cancel();
sl@0
  1048
    iVideoCallToneNameProperty.Close();
sl@0
  1049
    if( iGlobalAudioSettingsData.iVideoCallToneName)
sl@0
  1050
        {
sl@0
  1051
    delete  iGlobalAudioSettingsData.iVideoCallToneName;
sl@0
  1052
    iGlobalAudioSettingsData.iVideoCallToneName=NULL;
sl@0
  1053
        }
sl@0
  1054
     
sl@0
  1055
    
sl@0
  1056
    }
sl@0
  1057
sl@0
  1058
CVideoCallToneObserverAO* CVideoCallToneObserverAO::NewL(
sl@0
  1059
                            CGlobalAudioSettings &aGlobalAudioSettings,
sl@0
  1060
                            MAudioSettingsObserver& aAudioSettingsObserver,
sl@0
  1061
                            TGlobalAudioSettings& aGlobalAudioSettingsData)
sl@0
  1062
    {
sl@0
  1063
    CVideoCallToneObserverAO* self = new (ELeave) CVideoCallToneObserverAO(
sl@0
  1064
                                            aGlobalAudioSettings,
sl@0
  1065
                                            aAudioSettingsObserver, 
sl@0
  1066
                                            aGlobalAudioSettingsData);
sl@0
  1067
    CleanupStack::PushL(self);
sl@0
  1068
    self->ConstructL();
sl@0
  1069
    CleanupStack::Pop();
sl@0
  1070
    return self;
sl@0
  1071
    }
sl@0
  1072
sl@0
  1073
void CVideoCallToneObserverAO::ConstructL()
sl@0
  1074
    {
sl@0
  1075
    
sl@0
  1076
    iGlobalAudioSettingsData.iVideoCallToneName=HBufC::NewL(KMaxLength);
sl@0
  1077
    User::LeaveIfError(iVideoCallToneNameProperty.Attach(KGASPSUidGlobalAudioSettings, KGASVideoCallToneName));
sl@0
  1078
    TPtr16 ptr=iGlobalAudioSettingsData.iVideoCallToneName->Des();
sl@0
  1079
    User::LeaveIfError(iVideoCallToneNameProperty.Get(ptr));
sl@0
  1080
    
sl@0
  1081
    }
sl@0
  1082
    
sl@0
  1083
void CVideoCallToneObserverAO::Subscribe()
sl@0
  1084
    {
sl@0
  1085
    if (!IsActive())
sl@0
  1086
        {
sl@0
  1087
        SetActive();
sl@0
  1088
        
sl@0
  1089
        iVideoCallToneNameProperty.Subscribe(iStatus);
sl@0
  1090
        }
sl@0
  1091
    }
sl@0
  1092
sl@0
  1093
void CVideoCallToneObserverAO::RunL()
sl@0
  1094
    {
sl@0
  1095
    TInt status(iStatus.Int());
sl@0
  1096
#ifdef PRINT_MESSAGE
sl@0
  1097
    RDebug::Print(_L(" CVideocallToneObserverAO::RunL:iStatus[%d]"), status);
sl@0
  1098
#endif // PRINT_MESSAGE
sl@0
  1099
    if ( status == KErrNone )
sl@0
  1100
        {
sl@0
  1101
        Subscribe();
sl@0
  1102
        delete iGlobalAudioSettingsData.iVideoCallToneName;
sl@0
  1103
        iGlobalAudioSettingsData.iVideoCallToneName=NULL;
sl@0
  1104
        iGlobalAudioSettingsData.iVideoCallToneName=HBufC::NewL(KMaxLength);
sl@0
  1105
        TPtr16 ptr=iGlobalAudioSettingsData.iVideoCallToneName->Des();
sl@0
  1106
        status = iVideoCallToneNameProperty.Get(ptr);
sl@0
  1107
        if( status == KErrNone)
sl@0
  1108
            {
sl@0
  1109
        MAudioSettingsObserver::TGASEventId id=MAudioSettingsObserver::EGASVideoCallToneName;
sl@0
  1110
            iAudioSettingsObserver.SettingsChanged(iGlobalAudioSettings, id);
sl@0
  1111
            }
sl@0
  1112
#ifdef PRINT_MESSAGE
sl@0
  1113
        else
sl@0
  1114
            {
sl@0
  1115
            RDebug::Print(_L(" CVideoCallToneObserverAO::RunL:Property.Get Error[%d]"), status);
sl@0
  1116
            }
sl@0
  1117
#endif // PRINT_MESSAGE
sl@0
  1118
        }
sl@0
  1119
    }
sl@0
  1120
sl@0
  1121
void CVideoCallToneObserverAO::DoCancel()
sl@0
  1122
    {
sl@0
  1123
    iVideoCallToneNameProperty.Cancel();
sl@0
  1124
    }
sl@0
  1125
sl@0
  1126
TInt CVideoCallToneObserverAO::RunError(TInt /*aError*/)
sl@0
  1127
    {
sl@0
  1128
    return KErrNone;
sl@0
  1129
    }
sl@0
  1130
sl@0
  1131
/////////////////////////////////////////////////////////////////////
sl@0
  1132
//  CRingingToneObserverAO                                                //
sl@0
  1133
//////////////////////////////////////////////////////////////////////
sl@0
  1134
CRingingTone1ObserverAO::CRingingTone1ObserverAO(
sl@0
  1135
                        CGlobalAudioSettings &aGlobalAudioSettings,
sl@0
  1136
                        MAudioSettingsObserver& aAudioSettingsObserver,
sl@0
  1137
                        TGlobalAudioSettings& aGlobalAudioSettingsData)
sl@0
  1138
:CActive(EPriorityStandard),
sl@0
  1139
 iGlobalAudioSettings(aGlobalAudioSettings),
sl@0
  1140
 iAudioSettingsObserver(aAudioSettingsObserver),
sl@0
  1141
 iGlobalAudioSettingsData(aGlobalAudioSettingsData)
sl@0
  1142
    {
sl@0
  1143
    CActiveScheduler::Add(this);
sl@0
  1144
    }
sl@0
  1145
sl@0
  1146
CRingingTone1ObserverAO::~CRingingTone1ObserverAO()
sl@0
  1147
    {
sl@0
  1148
    Cancel();
sl@0
  1149
    iRingingTone1NameProperty.Close();
sl@0
  1150
    if( iGlobalAudioSettingsData.iRingingTone1Name)
sl@0
  1151
        {
sl@0
  1152
        delete  iGlobalAudioSettingsData.iRingingTone1Name;
sl@0
  1153
        iGlobalAudioSettingsData.iRingingTone1Name=NULL;
sl@0
  1154
        }
sl@0
  1155
    }
sl@0
  1156
sl@0
  1157
CRingingTone1ObserverAO* CRingingTone1ObserverAO::NewL(
sl@0
  1158
                            CGlobalAudioSettings &aGlobalAudioSettings,
sl@0
  1159
                            MAudioSettingsObserver& aAudioSettingsObserver,
sl@0
  1160
                            TGlobalAudioSettings& aGlobalAudioSettingsData)
sl@0
  1161
    {
sl@0
  1162
    CRingingTone1ObserverAO* self = new (ELeave) CRingingTone1ObserverAO(
sl@0
  1163
                                            aGlobalAudioSettings,
sl@0
  1164
                                            aAudioSettingsObserver, 
sl@0
  1165
                                            aGlobalAudioSettingsData);
sl@0
  1166
    CleanupStack::PushL(self);
sl@0
  1167
    self->ConstructL();
sl@0
  1168
    CleanupStack::Pop();
sl@0
  1169
    return self;
sl@0
  1170
    }
sl@0
  1171
sl@0
  1172
void CRingingTone1ObserverAO::ConstructL()
sl@0
  1173
    {
sl@0
  1174
    
sl@0
  1175
    iGlobalAudioSettingsData.iRingingTone1Name=HBufC::NewL(KMaxLength);
sl@0
  1176
    User::LeaveIfError(iRingingTone1NameProperty.Attach(KGASPSUidGlobalAudioSettings, KGASRingingTone1Name));
sl@0
  1177
    TPtr16 ptr=iGlobalAudioSettingsData.iRingingTone1Name->Des();
sl@0
  1178
    User::LeaveIfError(iRingingTone1NameProperty.Get(ptr));
sl@0
  1179
    
sl@0
  1180
    }
sl@0
  1181
    
sl@0
  1182
void CRingingTone1ObserverAO::Subscribe()
sl@0
  1183
    {
sl@0
  1184
    if (!IsActive())
sl@0
  1185
        {
sl@0
  1186
        SetActive();
sl@0
  1187
        
sl@0
  1188
        iRingingTone1NameProperty.Subscribe(iStatus);
sl@0
  1189
        }
sl@0
  1190
    }
sl@0
  1191
sl@0
  1192
void CRingingTone1ObserverAO::RunL()
sl@0
  1193
    {
sl@0
  1194
    TInt status(iStatus.Int());
sl@0
  1195
#ifdef PRINT_MESSAGE
sl@0
  1196
    RDebug::Print(_L(" CRingingTone1ObserverAO::RunL:iStatus[%d]"), status);
sl@0
  1197
#endif // PRINT_MESSAGE
sl@0
  1198
    if ( status == KErrNone )
sl@0
  1199
        {
sl@0
  1200
        Subscribe();
sl@0
  1201
        delete iGlobalAudioSettingsData.iRingingTone1Name;
sl@0
  1202
        iGlobalAudioSettingsData.iRingingTone1Name=NULL;
sl@0
  1203
        iGlobalAudioSettingsData.iRingingTone1Name=HBufC::NewL(KMaxLength);
sl@0
  1204
        TPtr16 ptr=iGlobalAudioSettingsData.iRingingTone1Name->Des();
sl@0
  1205
        status = iRingingTone1NameProperty.Get(ptr);
sl@0
  1206
        if( status == KErrNone)
sl@0
  1207
            {
sl@0
  1208
            MAudioSettingsObserver::TGASEventId id=MAudioSettingsObserver::EGASRingingTone1Name;
sl@0
  1209
            iAudioSettingsObserver.SettingsChanged(iGlobalAudioSettings, id);
sl@0
  1210
            }
sl@0
  1211
#ifdef PRINT_MESSAGE
sl@0
  1212
        else
sl@0
  1213
            {
sl@0
  1214
            RDebug::Print(_L(" CRingingToneObserverAO::RunL:Property.Get Error[%d]"), status);
sl@0
  1215
            }
sl@0
  1216
#endif // PRINT_MESSAGE
sl@0
  1217
        }
sl@0
  1218
    }
sl@0
  1219
sl@0
  1220
void CRingingTone1ObserverAO::DoCancel()
sl@0
  1221
    {
sl@0
  1222
    iRingingTone1NameProperty.Cancel();
sl@0
  1223
    }
sl@0
  1224
sl@0
  1225
TInt CRingingTone1ObserverAO::RunError(TInt /*aError*/)
sl@0
  1226
    {
sl@0
  1227
    return KErrNone;
sl@0
  1228
    }
sl@0
  1229
sl@0
  1230
////////////////////////////////////////////////////////////////////
sl@0
  1231
//  CRingingToneObserverAO                                                //
sl@0
  1232
//////////////////////////////////////////////////////////////////////
sl@0
  1233
CRingingTone2ObserverAO::CRingingTone2ObserverAO(
sl@0
  1234
                        CGlobalAudioSettings &aGlobalAudioSettings,
sl@0
  1235
                        MAudioSettingsObserver& aAudioSettingsObserver,
sl@0
  1236
                        TGlobalAudioSettings& aGlobalAudioSettingsData)
sl@0
  1237
:CActive(EPriorityStandard),
sl@0
  1238
 iGlobalAudioSettings(aGlobalAudioSettings),
sl@0
  1239
 iAudioSettingsObserver(aAudioSettingsObserver),
sl@0
  1240
 iGlobalAudioSettingsData(aGlobalAudioSettingsData)
sl@0
  1241
    {
sl@0
  1242
    CActiveScheduler::Add(this);
sl@0
  1243
    }
sl@0
  1244
sl@0
  1245
CRingingTone2ObserverAO::~CRingingTone2ObserverAO()
sl@0
  1246
    {
sl@0
  1247
    Cancel();
sl@0
  1248
    iRingingTone2NameProperty.Close();
sl@0
  1249
    if(iGlobalAudioSettingsData.iRingingTone2Name)
sl@0
  1250
        {
sl@0
  1251
    delete iGlobalAudioSettingsData.iRingingTone2Name;
sl@0
  1252
    iGlobalAudioSettingsData.iRingingTone2Name=NULL;
sl@0
  1253
        }
sl@0
  1254
     
sl@0
  1255
    
sl@0
  1256
    }
sl@0
  1257
sl@0
  1258
CRingingTone2ObserverAO* CRingingTone2ObserverAO::NewL(
sl@0
  1259
                            CGlobalAudioSettings &aGlobalAudioSettings,
sl@0
  1260
                            MAudioSettingsObserver& aAudioSettingsObserver,
sl@0
  1261
                            TGlobalAudioSettings& aGlobalAudioSettingsData)
sl@0
  1262
    {
sl@0
  1263
    CRingingTone2ObserverAO* self = new (ELeave) CRingingTone2ObserverAO(
sl@0
  1264
                                            aGlobalAudioSettings,
sl@0
  1265
                                            aAudioSettingsObserver, 
sl@0
  1266
                                            aGlobalAudioSettingsData);
sl@0
  1267
    CleanupStack::PushL(self);
sl@0
  1268
    self->ConstructL();
sl@0
  1269
    CleanupStack::Pop();
sl@0
  1270
    return self;
sl@0
  1271
    }
sl@0
  1272
sl@0
  1273
void CRingingTone2ObserverAO::ConstructL()
sl@0
  1274
    {
sl@0
  1275
    
sl@0
  1276
    iGlobalAudioSettingsData.iRingingTone2Name=HBufC::NewL(KMaxLength);
sl@0
  1277
    User::LeaveIfError(iRingingTone2NameProperty.Attach(KGASPSUidGlobalAudioSettings, KGASRingingTone2Name));
sl@0
  1278
    TPtr16 ptr=iGlobalAudioSettingsData.iRingingTone2Name->Des();
sl@0
  1279
    User::LeaveIfError(iRingingTone2NameProperty.Get(ptr));
sl@0
  1280
    
sl@0
  1281
    }
sl@0
  1282
    
sl@0
  1283
void CRingingTone2ObserverAO::Subscribe()
sl@0
  1284
    {
sl@0
  1285
    if (!IsActive())
sl@0
  1286
        {
sl@0
  1287
        SetActive();
sl@0
  1288
        
sl@0
  1289
        iRingingTone2NameProperty.Subscribe(iStatus);
sl@0
  1290
        }
sl@0
  1291
    }
sl@0
  1292
sl@0
  1293
void CRingingTone2ObserverAO::RunL()
sl@0
  1294
    {
sl@0
  1295
    TInt status(iStatus.Int());
sl@0
  1296
#ifdef PRINT_MESSAGE
sl@0
  1297
    RDebug::Print(_L(" CRingingTone2ObserverAO::RunL:iStatus[%d]"), status);
sl@0
  1298
#endif // PRINT_MESSAGE
sl@0
  1299
    if ( status == KErrNone )
sl@0
  1300
        {
sl@0
  1301
        Subscribe();
sl@0
  1302
        delete iGlobalAudioSettingsData.iRingingTone2Name;
sl@0
  1303
        iGlobalAudioSettingsData.iRingingTone2Name=NULL;
sl@0
  1304
        iGlobalAudioSettingsData.iRingingTone2Name=HBufC::NewL(KMaxLength);
sl@0
  1305
        TPtr16 ptr=iGlobalAudioSettingsData.iRingingTone2Name->Des();
sl@0
  1306
        status = iRingingTone2NameProperty.Get(ptr);
sl@0
  1307
        if( status == KErrNone)
sl@0
  1308
            {
sl@0
  1309
        MAudioSettingsObserver::TGASEventId id=MAudioSettingsObserver::EGASRingingTone2Name;
sl@0
  1310
            iAudioSettingsObserver.SettingsChanged(iGlobalAudioSettings, id);
sl@0
  1311
            }
sl@0
  1312
#ifdef PRINT_MESSAGE
sl@0
  1313
        else
sl@0
  1314
            {
sl@0
  1315
            RDebug::Print(_L(" CRingingToneObserverAO::RunL:Property.Get Error[%d]"), status);
sl@0
  1316
            }
sl@0
  1317
#endif // PRINT_MESSAGE
sl@0
  1318
        }
sl@0
  1319
    }
sl@0
  1320
sl@0
  1321
void CRingingTone2ObserverAO::DoCancel()
sl@0
  1322
    {
sl@0
  1323
    iRingingTone2NameProperty.Cancel();
sl@0
  1324
    }
sl@0
  1325
sl@0
  1326
TInt CRingingTone2ObserverAO::RunError(TInt /*aError*/)
sl@0
  1327
    {
sl@0
  1328
    return KErrNone;
sl@0
  1329
    }
sl@0
  1330
sl@0
  1331
/////////////////////////////////////////////////////////////////////
sl@0
  1332
//  CKeypadToneObserverAO                                                //
sl@0
  1333
//////////////////////////////////////////////////////////////////////
sl@0
  1334
CKeypadToneObserverAO::CKeypadToneObserverAO(
sl@0
  1335
                        CGlobalAudioSettings &aGlobalAudioSettings,
sl@0
  1336
                        MAudioSettingsObserver& aAudioSettingsObserver,
sl@0
  1337
                        TGlobalAudioSettings& aGlobalAudioSettingsData)
sl@0
  1338
:CActive(EPriorityStandard),
sl@0
  1339
 iGlobalAudioSettings(aGlobalAudioSettings),
sl@0
  1340
 iAudioSettingsObserver(aAudioSettingsObserver),
sl@0
  1341
 iGlobalAudioSettingsData(aGlobalAudioSettingsData)
sl@0
  1342
    {
sl@0
  1343
    CActiveScheduler::Add(this);
sl@0
  1344
    }
sl@0
  1345
sl@0
  1346
CKeypadToneObserverAO::~CKeypadToneObserverAO()
sl@0
  1347
    {
sl@0
  1348
    Cancel();
sl@0
  1349
    iKeypadToneVolumeProperty.Close();
sl@0
  1350
    }
sl@0
  1351
sl@0
  1352
CKeypadToneObserverAO* CKeypadToneObserverAO::NewL(
sl@0
  1353
                            CGlobalAudioSettings &aGlobalAudioSettings,
sl@0
  1354
                            MAudioSettingsObserver& aAudioSettingsObserver,
sl@0
  1355
                            TGlobalAudioSettings& aGlobalAudioSettingsData)
sl@0
  1356
    {
sl@0
  1357
    CKeypadToneObserverAO* self = new (ELeave) CKeypadToneObserverAO(
sl@0
  1358
                                            aGlobalAudioSettings,
sl@0
  1359
                                            aAudioSettingsObserver, 
sl@0
  1360
                                            aGlobalAudioSettingsData);
sl@0
  1361
    CleanupStack::PushL(self);
sl@0
  1362
    self->ConstructL();
sl@0
  1363
    CleanupStack::Pop();
sl@0
  1364
    return self;
sl@0
  1365
    }
sl@0
  1366
sl@0
  1367
void CKeypadToneObserverAO::ConstructL()
sl@0
  1368
    {
sl@0
  1369
    
sl@0
  1370
    
sl@0
  1371
    User::LeaveIfError(iKeypadToneVolumeProperty.Attach(KGASPSUidGlobalAudioSettings, KGASKeypadToneVolume));
sl@0
  1372
    TInt value=KErrNone;
sl@0
  1373
    User::LeaveIfError(iKeypadToneVolumeProperty.Get(value));
sl@0
  1374
    iGlobalAudioSettingsData.iKeyPadVolume=(CGlobalAudioSettings::TGASKeypadVolume)value;
sl@0
  1375
    }
sl@0
  1376
    
sl@0
  1377
void CKeypadToneObserverAO::Subscribe()
sl@0
  1378
    {
sl@0
  1379
    if (!IsActive())
sl@0
  1380
        {
sl@0
  1381
        SetActive();
sl@0
  1382
        
sl@0
  1383
        iKeypadToneVolumeProperty.Subscribe(iStatus);
sl@0
  1384
        }
sl@0
  1385
    }
sl@0
  1386
sl@0
  1387
void CKeypadToneObserverAO::RunL()
sl@0
  1388
    {
sl@0
  1389
    TInt status(iStatus.Int());
sl@0
  1390
#ifdef PRINT_MESSAGE
sl@0
  1391
    RDebug::Print(_L(" CKeypadToneObserverAO::RunL:iStatus[%d]"), status);
sl@0
  1392
#endif // PRINT_MESSAGE
sl@0
  1393
    if ( status == KErrNone )
sl@0
  1394
        {
sl@0
  1395
        Subscribe();
sl@0
  1396
        TInt value=KErrNone;
sl@0
  1397
            status=iKeypadToneVolumeProperty.Get(value);
sl@0
  1398
            iGlobalAudioSettingsData.iKeyPadVolume=(CGlobalAudioSettings::TGASKeypadVolume)value;
sl@0
  1399
        
sl@0
  1400
        
sl@0
  1401
        if( status == KErrNone)
sl@0
  1402
            {
sl@0
  1403
            MAudioSettingsObserver::TGASEventId id=MAudioSettingsObserver::EGASKeyPadVolume;
sl@0
  1404
            iAudioSettingsObserver.SettingsChanged(iGlobalAudioSettings, id);
sl@0
  1405
            }
sl@0
  1406
#ifdef PRINT_MESSAGE
sl@0
  1407
        else
sl@0
  1408
            {
sl@0
  1409
            RDebug::Print(_L(" CKeypadToneObserverAO::RunL:Property.Get Error[%d]"), status);
sl@0
  1410
            }
sl@0
  1411
#endif // PRINT_MESSAGE
sl@0
  1412
        }
sl@0
  1413
    }
sl@0
  1414
sl@0
  1415
void CKeypadToneObserverAO::DoCancel()
sl@0
  1416
    {
sl@0
  1417
    iKeypadToneVolumeProperty.Cancel();
sl@0
  1418
    }
sl@0
  1419
sl@0
  1420
TInt CKeypadToneObserverAO::RunError(TInt /*aError*/)
sl@0
  1421
    {
sl@0
  1422
    return KErrNone;
sl@0
  1423
    }
sl@0
  1424
sl@0
  1425
sl@0
  1426
/////////////////////////////////////////////////////////////////////
sl@0
  1427
//  CSilenceModeObserverAO                                                //
sl@0
  1428
//////////////////////////////////////////////////////////////////////
sl@0
  1429
CSilenceModeObserverAO::CSilenceModeObserverAO(
sl@0
  1430
                        CGlobalAudioSettings &aGlobalAudioSettings,
sl@0
  1431
                        MAudioSettingsObserver& aAudioSettingsObserver,
sl@0
  1432
                        TGlobalAudioSettings& aGlobalAudioSettingsData)
sl@0
  1433
:CActive(EPriorityStandard),
sl@0
  1434
 iGlobalAudioSettings(aGlobalAudioSettings),
sl@0
  1435
 iAudioSettingsObserver(aAudioSettingsObserver),
sl@0
  1436
 iGlobalAudioSettingsData(aGlobalAudioSettingsData)
sl@0
  1437
    {
sl@0
  1438
    CActiveScheduler::Add(this);
sl@0
  1439
    }
sl@0
  1440
sl@0
  1441
CSilenceModeObserverAO::~CSilenceModeObserverAO()
sl@0
  1442
    {
sl@0
  1443
    Cancel();
sl@0
  1444
    iSilenceModeProperty.Close();
sl@0
  1445
    }
sl@0
  1446
sl@0
  1447
CSilenceModeObserverAO* CSilenceModeObserverAO::NewL(
sl@0
  1448
                            CGlobalAudioSettings &aGlobalAudioSettings,
sl@0
  1449
                            MAudioSettingsObserver& aAudioSettingsObserver,
sl@0
  1450
                            TGlobalAudioSettings& aGlobalAudioSettingsData)
sl@0
  1451
    {
sl@0
  1452
    CSilenceModeObserverAO* self = new (ELeave) CSilenceModeObserverAO(
sl@0
  1453
                                            aGlobalAudioSettings,
sl@0
  1454
                                            aAudioSettingsObserver, 
sl@0
  1455
                                            aGlobalAudioSettingsData);
sl@0
  1456
    CleanupStack::PushL(self);
sl@0
  1457
    self->ConstructL();
sl@0
  1458
    CleanupStack::Pop();
sl@0
  1459
    return self;
sl@0
  1460
    }
sl@0
  1461
sl@0
  1462
void CSilenceModeObserverAO::ConstructL()
sl@0
  1463
    {
sl@0
  1464
    
sl@0
  1465
    
sl@0
  1466
    User::LeaveIfError(iSilenceModeProperty.Attach(KGASPSUidGlobalAudioSettings, KGASSilenceMode));
sl@0
  1467
   
sl@0
  1468
    User::LeaveIfError(iSilenceModeProperty.Get(iGlobalAudioSettingsData.iSilenceMode));
sl@0
  1469
    RDebug::Printf("in constructL,silence mode %d",iGlobalAudioSettingsData.iSilenceMode);
sl@0
  1470
  
sl@0
  1471
    }
sl@0
  1472
    
sl@0
  1473
void CSilenceModeObserverAO::Subscribe()
sl@0
  1474
    {
sl@0
  1475
    if (!IsActive())
sl@0
  1476
        {
sl@0
  1477
        SetActive();
sl@0
  1478
        
sl@0
  1479
        iSilenceModeProperty.Subscribe(iStatus);
sl@0
  1480
        }
sl@0
  1481
    }
sl@0
  1482
sl@0
  1483
void CSilenceModeObserverAO::RunL()
sl@0
  1484
    {
sl@0
  1485
    TInt status(iStatus.Int());
sl@0
  1486
#ifdef PRINT_MESSAGE
sl@0
  1487
    RDebug::Print(_L(" CSilenceModeObserverAO::RunL:iStatus[%d]"), status);
sl@0
  1488
#endif // PRINT_MESSAGE
sl@0
  1489
    if ( status == KErrNone )
sl@0
  1490
        {
sl@0
  1491
        Subscribe();
sl@0
  1492
       
sl@0
  1493
            status=iSilenceModeProperty.Get(  iGlobalAudioSettingsData.iSilenceMode);
sl@0
  1494
            RDebug::Printf("value of silent mode :%d",iGlobalAudioSettingsData.iSilenceMode);
sl@0
  1495
        
sl@0
  1496
        
sl@0
  1497
        if( status == KErrNone)
sl@0
  1498
            {
sl@0
  1499
            MAudioSettingsObserver::TGASEventId id=MAudioSettingsObserver::EGASSilenceMode;
sl@0
  1500
            iAudioSettingsObserver.SettingsChanged(iGlobalAudioSettings, id);
sl@0
  1501
            }
sl@0
  1502
#ifdef PRINT_MESSAGE
sl@0
  1503
        else
sl@0
  1504
            {
sl@0
  1505
            RDebug::Print(_L(" CKeypadToneObserverAO::RunL:Property.Get Error[%d]"), status);
sl@0
  1506
            }
sl@0
  1507
#endif // PRINT_MESSAGE
sl@0
  1508
        }
sl@0
  1509
    }
sl@0
  1510
sl@0
  1511
void CSilenceModeObserverAO::DoCancel()
sl@0
  1512
    {
sl@0
  1513
    iSilenceModeProperty.Cancel();
sl@0
  1514
    }
sl@0
  1515
sl@0
  1516
TInt CSilenceModeObserverAO::RunError(TInt /*aError*/)
sl@0
  1517
    {
sl@0
  1518
    return KErrNone;
sl@0
  1519
    }
sl@0
  1520
sl@0
  1521
//End of file