devsoundextensions/globalaudiosettings/src/GlobalAudioSettingsImpl.cpp
changeset 46 ed4308a6c628
parent 43 98aa3ecc14d2
equal deleted inserted replaced
45:5accba95f577 46:ed4308a6c628
   135                                                                             iGlobalAudioSettings,
   135                                                                             iGlobalAudioSettings,
   136                                                                             iAudioSettingsObserver,
   136                                                                             iAudioSettingsObserver,
   137                                                                             iGlobalAudioSettingsData);
   137                                                                             iGlobalAudioSettingsData);
   138     iKeypadToneObserverAO->Subscribe();  
   138     iKeypadToneObserverAO->Subscribe();  
   139                 
   139                 
   140                 
   140     iSilenceModeObserverAO = CSilenceModeObserverAO::NewL(
       
   141                                                                                 iGlobalAudioSettings,
       
   142                                                                                 iAudioSettingsObserver,
       
   143                                                                                 iGlobalAudioSettingsData);
       
   144      iSilenceModeObserverAO->Subscribe();  
   141 	                    
   145 	                    
   142     RProperty publicSilenceProperty;
   146     RProperty publicSilenceProperty;
   143 	User::LeaveIfError(publicSilenceProperty.Attach(KGASPSUidGlobalAudioSettings, KGASPublicSilence));
   147 	User::LeaveIfError(publicSilenceProperty.Attach(KGASPSUidGlobalAudioSettings, KGASPublicSilence));
   144 	User::LeaveIfError(publicSilenceProperty.Get(iGlobalAudioSettingsData.iPublicSilence));
   148 	User::LeaveIfError(publicSilenceProperty.Get(iGlobalAudioSettingsData.iPublicSilence));
   145 	publicSilenceProperty.Close();
   149 	publicSilenceProperty.Close();
   161         delete iEmailToneObserverAO;
   165         delete iEmailToneObserverAO;
   162         delete iVideoCallObserverAO;
   166         delete iVideoCallObserverAO;
   163         delete iRingingTone1ObserverAO;
   167         delete iRingingTone1ObserverAO;
   164         delete iRingingTone2ObserverAO;
   168         delete iRingingTone2ObserverAO;
   165         delete iKeypadToneObserverAO;
   169         delete iKeypadToneObserverAO;
       
   170         delete iSilenceModeObserverAO;
   166         delete iCAudioClientsListManagerAO;
   171         delete iCAudioClientsListManagerAO;
   167         delete iPausedClientsListManagerAO;
   172         delete iPausedClientsListManagerAO;
   168         iAudioClientsListObserverArray.Close();
   173         iAudioClientsListObserverArray.Close();
   169     }
   174     }
   170 
   175 
   310       }
   315       }
   311  CGlobalAudioSettings::TGASKeypadVolume CGlobalAudioSettingsImpl::KeyPadToneVolume()
   316  CGlobalAudioSettings::TGASKeypadVolume CGlobalAudioSettingsImpl::KeyPadToneVolume()
   312      {
   317      {
   313      return (CGlobalAudioSettings::TGASKeypadVolume)iGlobalAudioSettingsData.iKeyPadVolume;
   318      return (CGlobalAudioSettings::TGASKeypadVolume)iGlobalAudioSettingsData.iKeyPadVolume;
   314      }
   319      }
       
   320  
       
   321  TBool CGlobalAudioSettingsImpl::IsSilenceModeEnabled()
       
   322      {
       
   323       return iGlobalAudioSettingsData.iSilenceMode;
       
   324      }
   315 // -----------------------------------------------------------------------------
   325 // -----------------------------------------------------------------------------
   316 // CGlobalAudioSettingsImpl::RegisterAudioClientsListObserver
   326 // CGlobalAudioSettingsImpl::RegisterAudioClientsListObserver
   317 // 
   327 // 
   318 // -----------------------------------------------------------------------------
   328 // -----------------------------------------------------------------------------
   319 //
   329 //
  1410 TInt CKeypadToneObserverAO::RunError(TInt /*aError*/)
  1420 TInt CKeypadToneObserverAO::RunError(TInt /*aError*/)
  1411     {
  1421     {
  1412     return KErrNone;
  1422     return KErrNone;
  1413     }
  1423     }
  1414 
  1424 
       
  1425 
       
  1426 /////////////////////////////////////////////////////////////////////
       
  1427 //  CSilenceModeObserverAO                                                //
       
  1428 //////////////////////////////////////////////////////////////////////
       
  1429 CSilenceModeObserverAO::CSilenceModeObserverAO(
       
  1430                         CGlobalAudioSettings &aGlobalAudioSettings,
       
  1431                         MAudioSettingsObserver& aAudioSettingsObserver,
       
  1432                         TGlobalAudioSettings& aGlobalAudioSettingsData)
       
  1433 :CActive(EPriorityStandard),
       
  1434  iGlobalAudioSettings(aGlobalAudioSettings),
       
  1435  iAudioSettingsObserver(aAudioSettingsObserver),
       
  1436  iGlobalAudioSettingsData(aGlobalAudioSettingsData)
       
  1437     {
       
  1438     CActiveScheduler::Add(this);
       
  1439     }
       
  1440 
       
  1441 CSilenceModeObserverAO::~CSilenceModeObserverAO()
       
  1442     {
       
  1443     Cancel();
       
  1444     iSilenceModeProperty.Close();
       
  1445     }
       
  1446 
       
  1447 CSilenceModeObserverAO* CSilenceModeObserverAO::NewL(
       
  1448                             CGlobalAudioSettings &aGlobalAudioSettings,
       
  1449                             MAudioSettingsObserver& aAudioSettingsObserver,
       
  1450                             TGlobalAudioSettings& aGlobalAudioSettingsData)
       
  1451     {
       
  1452     CSilenceModeObserverAO* self = new (ELeave) CSilenceModeObserverAO(
       
  1453                                             aGlobalAudioSettings,
       
  1454                                             aAudioSettingsObserver, 
       
  1455                                             aGlobalAudioSettingsData);
       
  1456     CleanupStack::PushL(self);
       
  1457     self->ConstructL();
       
  1458     CleanupStack::Pop();
       
  1459     return self;
       
  1460     }
       
  1461 
       
  1462 void CSilenceModeObserverAO::ConstructL()
       
  1463     {
       
  1464     
       
  1465     
       
  1466     User::LeaveIfError(iSilenceModeProperty.Attach(KGASPSUidGlobalAudioSettings, KGASSilenceMode));
       
  1467    
       
  1468     User::LeaveIfError(iSilenceModeProperty.Get(iGlobalAudioSettingsData.iSilenceMode));
       
  1469     RDebug::Printf("in constructL,silence mode %d",iGlobalAudioSettingsData.iSilenceMode);
       
  1470   
       
  1471     }
       
  1472     
       
  1473 void CSilenceModeObserverAO::Subscribe()
       
  1474     {
       
  1475     if (!IsActive())
       
  1476         {
       
  1477         SetActive();
       
  1478         
       
  1479         iSilenceModeProperty.Subscribe(iStatus);
       
  1480         }
       
  1481     }
       
  1482 
       
  1483 void CSilenceModeObserverAO::RunL()
       
  1484     {
       
  1485     TInt status(iStatus.Int());
       
  1486 #ifdef PRINT_MESSAGE
       
  1487     RDebug::Print(_L(" CSilenceModeObserverAO::RunL:iStatus[%d]"), status);
       
  1488 #endif // PRINT_MESSAGE
       
  1489     if ( status == KErrNone )
       
  1490         {
       
  1491         Subscribe();
       
  1492        
       
  1493             status=iSilenceModeProperty.Get(  iGlobalAudioSettingsData.iSilenceMode);
       
  1494             RDebug::Printf("value of silent mode :%d",iGlobalAudioSettingsData.iSilenceMode);
       
  1495         
       
  1496         
       
  1497         if( status == KErrNone)
       
  1498             {
       
  1499             MAudioSettingsObserver::TGASEventId id=MAudioSettingsObserver::EGASSilenceMode;
       
  1500             iAudioSettingsObserver.SettingsChanged(iGlobalAudioSettings, id);
       
  1501             }
       
  1502 #ifdef PRINT_MESSAGE
       
  1503         else
       
  1504             {
       
  1505             RDebug::Print(_L(" CKeypadToneObserverAO::RunL:Property.Get Error[%d]"), status);
       
  1506             }
       
  1507 #endif // PRINT_MESSAGE
       
  1508         }
       
  1509     }
       
  1510 
       
  1511 void CSilenceModeObserverAO::DoCancel()
       
  1512     {
       
  1513     iSilenceModeProperty.Cancel();
       
  1514     }
       
  1515 
       
  1516 TInt CSilenceModeObserverAO::RunError(TInt /*aError*/)
       
  1517     {
       
  1518     return KErrNone;
       
  1519     }
       
  1520 
  1415 //End of file
  1521 //End of file