mmfenh/profilesettingsmonitor/src/ProfileSettingsMonitorServerImpl.cpp
branchRCL_3
changeset 45 095bea5f582e
parent 0 71ca22bcf22a
child 46 0ac9a5310753
--- a/mmfenh/profilesettingsmonitor/src/ProfileSettingsMonitorServerImpl.cpp	Thu Aug 19 10:26:11 2010 +0300
+++ b/mmfenh/profilesettingsmonitor/src/ProfileSettingsMonitorServerImpl.cpp	Tue Aug 31 15:43:02 2010 +0300
@@ -21,6 +21,7 @@
 #include <AudioClientsListPSKeys.h>
 #include <AudioClientsListPSData.h>
 #include <MediaStreamPropertiesPSKeys.h>
+#include <MProfileExtended.h>
 
 #ifdef _DEBUG
 #define DEB_TRACE0(str)             RDebug::Print(str)
@@ -53,6 +54,57 @@
 	iVibraProperty.Close();
 	RProperty::Delete(KGASPSUidGlobalAudioSettings, KGASVibra);
 	
+	iRingingTypeProperty.Close();
+	RProperty::Delete(KGASPSUidGlobalAudioSettings,KGASRingingType);
+	
+	iMessageToneNameProperty.Close();
+	RProperty::Delete(KGASPSUidGlobalAudioSettings, KGASMessageToneName);
+	
+	iEmailToneNameProperty.Close();
+	RProperty::Delete(KGASPSUidGlobalAudioSettings,KGASEmailToneName);
+	
+	iVideoCallToneNameProperty.Close();
+	RProperty::Delete(KGASPSUidGlobalAudioSettings,KGASVideoCallToneName);
+	
+	iRingingTone1NameProperty.Close();
+	RProperty::Delete(KGASPSUidGlobalAudioSettings,KGASRingingTone1Name);
+	
+	iRingingTone2NameProperty.Close();
+    RProperty::Delete(KGASPSUidGlobalAudioSettings,KGASRingingTone2Name);
+	
+	iKeypadVolumeProperty.Close();
+	RProperty::Delete(KGASPSUidGlobalAudioSettings,KGASKeypadToneVolume);
+	
+	if(iMessageToneName)
+	  {
+	  delete iMessageToneName;
+	  iMessageToneName=NULL;
+	  }
+	if(iEmailToneName)
+	  {
+	  delete iEmailToneName;
+	  iEmailToneName=NULL;
+	  }
+	if(iVideoCallToneName)
+	  {
+	  delete iVideoCallToneName;
+	  iVideoCallToneName=NULL;
+	  }
+	if(iRingingTone1Name)
+	  {
+	  delete iRingingTone1Name;
+	  iRingingTone1Name=NULL;
+	  }
+	if(iRingingTone2Name)
+	   {
+	   delete iRingingTone2Name;
+	   iRingingTone2Name=NULL;
+	   }
+	if(iProfileEngineExtended)
+	    {
+	    iProfileEngineExtended->Release();
+	    }
+	//delete iProfileEngineExtended;
 	// Release profile engine resources
 	if ( iEngine )
 	    {
@@ -92,8 +144,30 @@
     iWarningTones = settings.WarningAndGameTones();
     iMessagingTones = !( currentProfile->IsSilent() );
     iVibra = settings.VibratingAlert();
+  
+    CMapGASRingingType( settings.RingingType());
+    
     //CleanupStack::PopAndDestroy(currentProfile);
+   
+    MProEngTones& profileTones=currentProfile->ProfileTones();
     
+    iMessageToneName=profileTones.MessageAlertTone().AllocL();
+   
+    iEmailToneName=profileTones.EmailAlertTone().AllocL();
+    
+    iVideoCallToneName=profileTones.VideoCallRingingTone().AllocL();
+    
+    iRingingTone1Name=profileTones.RingingTone1().AllocL();
+    
+    iRingingTone2Name=profileTones.RingingTone2().AllocL();
+        
+  
+    CMapGASKeypadVolume(settings.KeypadVolume());
+    
+    iProfileEngineExtended =::CreateProfileEngineExtended2L();
+   
+     iSilenceMode = iProfileEngineExtended->SilenceModeL();
+     RDebug::Printf("value of silence mode %d",iSilenceMode);
     // Get PublicSilence from CenRep
     TInt featureBitmask( 0 );     
     CRepository* profileCenRep = CRepository::NewL( KCRUidProfilesLV );
@@ -182,6 +256,117 @@
                                                 KGASPSUidGlobalAudioSettings,
                                                 KGASPublicSilence,
                                                 iPublicSilence));
+    
+    
+    
+    User::LeaveIfError(RProperty::Define(
+                                    KGASPSUidGlobalAudioSettings,
+                                    KGASRingingType,
+                                    RProperty::EInt,
+                                    read,
+                                    write));
+    User::LeaveIfError(iRingingTypeProperty.Attach(
+                                              KGASPSUidGlobalAudioSettings,
+                                              KGASRingingType));
+    User::LeaveIfError(iRingingTypeProperty.Set(
+                                              KGASPSUidGlobalAudioSettings,
+                                              KGASRingingType,
+                                              iGASRingingType));
+    User::LeaveIfError(RProperty::Define(
+                                    KGASPSUidGlobalAudioSettings,
+                                    KGASMessageToneName,
+                                    RProperty::EText,
+                                    read,
+                                    write));
+    User::LeaveIfError(iMessageToneNameProperty.Attach(
+                                                KGASPSUidGlobalAudioSettings,
+                                                KGASMessageToneName));
+    User::LeaveIfError(iMessageToneNameProperty.Set(
+                                                KGASPSUidGlobalAudioSettings,
+                                                KGASMessageToneName,
+                                                *iMessageToneName));
+    
+    User::LeaveIfError(RProperty::Define(
+                                    KGASPSUidGlobalAudioSettings,
+                                    KGASEmailToneName,
+                                    RProperty::EText,
+                                    read,
+                                    write));
+    User::LeaveIfError(iEmailToneNameProperty.Attach(
+                                               KGASPSUidGlobalAudioSettings,
+                                               KGASEmailToneName));
+    User::LeaveIfError(iEmailToneNameProperty.Set(
+                                               KGASPSUidGlobalAudioSettings,
+                                               KGASEmailToneName,
+                                               *iEmailToneName));
+    User::LeaveIfError(RProperty::Define(
+                                    KGASPSUidGlobalAudioSettings,
+                                    KGASVideoCallToneName,
+                                    RProperty::EText,
+                                    read,
+                                    write));
+    User::LeaveIfError(iVideoCallToneNameProperty.Attach(
+                                               KGASPSUidGlobalAudioSettings,
+                                               KGASVideoCallToneName));
+    User::LeaveIfError(iVideoCallToneNameProperty.Set(
+                                               KGASPSUidGlobalAudioSettings,
+                                               KGASVideoCallToneName,
+                                               *iVideoCallToneName));
+        
+    User::LeaveIfError(RProperty::Define(
+                                    KGASPSUidGlobalAudioSettings,
+                                    KGASRingingTone1Name,
+                                    RProperty::EText,
+                                    read,
+                                    write));
+    User::LeaveIfError(iRingingTone1NameProperty.Attach(
+                                               KGASPSUidGlobalAudioSettings,
+                                               KGASRingingTone1Name));
+    User::LeaveIfError(iRingingTone1NameProperty.Set(
+                                               KGASPSUidGlobalAudioSettings,
+                                               KGASRingingTone1Name,
+                                               *iRingingTone1Name));
+    User::LeaveIfError(RProperty::Define(
+                                    KGASPSUidGlobalAudioSettings,
+                                    KGASRingingTone2Name,
+                                    RProperty::EText,
+                                    read,
+                                    write));
+    User::LeaveIfError(iRingingTone2NameProperty.Attach(
+                                               KGASPSUidGlobalAudioSettings,
+                                               KGASRingingTone2Name));
+    User::LeaveIfError(iRingingTone2NameProperty.Set(
+                                               KGASPSUidGlobalAudioSettings,
+                                               KGASRingingTone2Name,
+                                               *iRingingTone2Name));
+    
+    User::LeaveIfError(RProperty::Define(
+                                    KGASPSUidGlobalAudioSettings,
+                                    KGASKeypadToneVolume,
+                                    RProperty::EInt,
+                                    read,
+                                    write));
+    User::LeaveIfError(iKeypadVolumeProperty.Attach(
+                                               KGASPSUidGlobalAudioSettings,
+                                               KGASKeypadToneVolume));
+    User::LeaveIfError(iKeypadVolumeProperty.Set(
+                                               KGASPSUidGlobalAudioSettings,
+                                               KGASKeypadToneVolume,
+                                               iGASKeypadVolume));
+    
+    User::LeaveIfError(RProperty::Define(
+                                        KGASPSUidGlobalAudioSettings,
+                                        KGASSilenceMode,
+                                        RProperty::EInt,
+                                        read,
+                                        write));
+        User::LeaveIfError(iSilenceModeProperty.Attach(
+                                                   KGASPSUidGlobalAudioSettings,
+                                                   KGASSilenceMode));
+        User::LeaveIfError(iSilenceModeProperty.Set(
+                                                   KGASPSUidGlobalAudioSettings,
+                                                   KGASSilenceMode,
+                                                   iSilenceMode));
 
     //Stream Gain Control
     TInt status = RProperty::Define(
@@ -321,6 +506,84 @@
                                                 KGASVibra,
                                                 iVibra));
             }
+        if(iGASRingingType != settings.RingingType())
+            {
+            
+             CMapGASRingingType(settings.RingingType());
+            
+             User::LeaveIfError(iRingingTypeProperty.Set(
+                                                         KGASPSUidGlobalAudioSettings,
+                                                         KGASRingingType,
+                                                         iGASRingingType));
+             
+            }
+        MProEngTones &profileTones=currentProfile->ProfileTones();
+        if(iMessageToneName->Compare(profileTones.MessageAlertTone())!= 0)
+            {
+              delete iMessageToneName;
+              iMessageToneName=NULL;
+              iMessageToneName=profileTones.MessageAlertTone().AllocL();
+              User::LeaveIfError(iMessageToneNameProperty.Set(KGASPSUidGlobalAudioSettings,
+                                                              KGASMessageToneName,
+                                                              *iMessageToneName));
+            }
+        if(iEmailToneName->Compare(profileTones.EmailAlertTone())!= 0)
+            {
+              delete iEmailToneName;
+              iEmailToneName=NULL;
+              iEmailToneName=profileTones.EmailAlertTone().AllocL();
+              User::LeaveIfError(iEmailToneNameProperty.Set(KGASPSUidGlobalAudioSettings,
+                                                                            KGASEmailToneName,
+                                                                            *iEmailToneName));
+            }
+        if(iVideoCallToneName->Compare(profileTones.VideoCallRingingTone())!=0)
+            {
+              delete iVideoCallToneName;
+              iVideoCallToneName=NULL;
+              iVideoCallToneName=profileTones.VideoCallRingingTone().AllocL();
+              User::LeaveIfError(iVideoCallToneNameProperty.Set(KGASPSUidGlobalAudioSettings,
+                                                                                          KGASVideoCallToneName,
+                                                                                          *iVideoCallToneName));
+              
+            }
+        if(iRingingTone1Name->Compare(profileTones.RingingTone1())!=0)
+            {
+          delete iRingingTone1Name;
+          iRingingTone1Name=NULL;
+          iRingingTone1Name=profileTones.RingingTone1().AllocL();
+          User::LeaveIfError(iRingingTone1NameProperty.Set(KGASPSUidGlobalAudioSettings,
+                                                                                      KGASRingingTone1Name,
+                                                                                      *iRingingTone1Name));
+            }
+        if(iRingingTone2Name->Compare(profileTones.RingingTone2())!=0)
+                    {
+                   delete iRingingTone2Name;
+                  iRingingTone2Name=NULL;
+                  iRingingTone2Name=profileTones.RingingTone2().AllocL();
+                  User::LeaveIfError(iRingingTone2NameProperty.Set(KGASPSUidGlobalAudioSettings,
+                                                                                              KGASRingingTone2Name,
+                                                                                              *iRingingTone2Name));
+                    }
+        if(iGASKeypadVolume!=settings.KeypadVolume())
+            {
+              
+              CMapGASKeypadVolume(settings.KeypadVolume());
+              User::LeaveIfError(iKeypadVolumeProperty.Set(KGASPSUidGlobalAudioSettings,
+                                                                                        KGASKeypadToneVolume,
+                                                                                        iGASKeypadVolume));
+              
+              
+            }
+        if(iSilenceMode != iProfileEngineExtended->SilenceModeL())
+            {
+             RDebug::Printf("silence mode changed");
+             iSilenceMode = iProfileEngineExtended->SilenceModeL();
+             User::LeaveIfError(iSilenceModeProperty.Set(
+                                                        KGASPSUidGlobalAudioSettings,
+                                                        KGASSilenceMode,
+                                                        iSilenceMode));
+            }
+        
         CleanupStack::PopAndDestroy(currentProfile);
         }
 #ifdef _DEBUG
@@ -346,6 +609,7 @@
     CleanupReleasePushL(*currentProfile);
     
     MProEngToneSettings& settings = currentProfile->ToneSettings();
+    MProEngTones& profileTones=currentProfile->ProfileTones();
     if(iWarningTones != settings.WarningAndGameTones())
         {
         iWarningTones = settings.WarningAndGameTones();
@@ -371,6 +635,85 @@
                                             KGASVibra,
                                             iVibra));
         }
+    if(iGASRingingType != settings.RingingType())
+        {
+        
+         CMapGASRingingType(settings.RingingType());
+         
+         User::LeaveIfError(iRingingTypeProperty.Set(
+                                                     KGASPSUidGlobalAudioSettings,
+                                                     KGASRingingType,
+                                                     iGASRingingType));
+        }
+    if(iMessageToneName->Compare(profileTones.MessageAlertTone())!= 0)
+        {
+          delete iMessageToneName;
+          iMessageToneName=NULL;
+          iMessageToneName=profileTones.MessageAlertTone().AllocL();
+          
+          User::LeaveIfError(iMessageToneNameProperty.Set(KGASPSUidGlobalAudioSettings,
+                                                          KGASMessageToneName,
+                                                          *iMessageToneName));
+        }
+    
+    if(iEmailToneName->Compare(profileTones.EmailAlertTone())!= 0)
+        {
+          delete iEmailToneName;
+          iEmailToneName=NULL;
+          iEmailToneName=profileTones.EmailAlertTone().AllocL();
+          User::LeaveIfError(iEmailToneNameProperty.Set(KGASPSUidGlobalAudioSettings,
+                                                                        KGASEmailToneName,
+                                                                        *iEmailToneName));
+        }
+    if(iVideoCallToneName->Compare(profileTones.VideoCallRingingTone())!=0)
+        {
+          delete iVideoCallToneName;
+          iVideoCallToneName=NULL;
+          iVideoCallToneName=profileTones.VideoCallRingingTone().AllocL();
+          User::LeaveIfError(iVideoCallToneNameProperty.Set(KGASPSUidGlobalAudioSettings,
+                                                                                      KGASVideoCallToneName,
+                                                                                      *iVideoCallToneName));
+          
+        }
+    if(iRingingTone1Name->Compare(profileTones.RingingTone1())!=0)
+        {
+         delete iRingingTone1Name;
+         iRingingTone1Name=NULL;
+         iRingingTone1Name=profileTones.RingingTone1().AllocL();
+         User::LeaveIfError(iRingingTone1NameProperty.Set(KGASPSUidGlobalAudioSettings,
+                                                                                  KGASRingingTone1Name,
+                                                                                  *iRingingTone1Name));
+         
+        }
+    if(iRingingTone2Name->Compare(profileTones.RingingTone2())!=0)
+        {
+          delete iRingingTone2Name;
+          iRingingTone2Name=NULL;
+          iRingingTone2Name=profileTones.RingingTone2().AllocL();
+          User::LeaveIfError(iRingingTone2NameProperty.Set(KGASPSUidGlobalAudioSettings,
+                                                                                      KGASRingingTone2Name,
+                                                                                      *iRingingTone2Name));
+         
+            }
+    if(iGASKeypadVolume!=settings.KeypadVolume())
+        {
+         
+          CMapGASKeypadVolume( settings.KeypadVolume());
+          User::LeaveIfError(iKeypadVolumeProperty.Set(KGASPSUidGlobalAudioSettings,
+                                                                                                KGASKeypadToneVolume,
+                                                                                                iGASKeypadVolume));
+          
+          
+        }
+    if(iSilenceMode != iProfileEngineExtended ->SilenceModeL())
+        {
+    RDebug::Printf("silence mode changed");
+         iSilenceMode = iProfileEngineExtended ->SilenceModeL();
+         User::LeaveIfError(iSilenceModeProperty.Set(KGASPSUidGlobalAudioSettings,
+                                                                                KGASSilenceMode,
+                                                                                iSilenceMode));
+         }
+   
     CleanupStack::PopAndDestroy(currentProfile);
     }
 
@@ -378,6 +721,39 @@
     {
     DEB_TRACE0(_L("CMyProfileNameArrayObserver::HandleProfileActivationNotificationError"));
 	}
-
+void CProfileSettingsMonitorServerImpl::CMapGASRingingType(TProfileRingingType aRingingType)
+    {
+    switch(aRingingType)
+            {
+            case EProfileRingingTypeRinging :   iGASRingingType=CGlobalAudioSettings::EGASRingingTypeRinging;
+                                                 break;
+               
+            case EProfileRingingTypeAscending:iGASRingingType=CGlobalAudioSettings::EGASRingingTypeAscending;
+                                               break;
+              
+            case EProfileRingingTypeRingingOnce :iGASRingingType=CGlobalAudioSettings::EGASRingingTypeRingingOnce;
+                                                  break;
+               
+            case EProfileRingingTypeBeepOnce :iGASRingingType=CGlobalAudioSettings::EGASRingingTypeBeepOnce;
+                                              break;
+               
+            case EProfileRingingTypeSilent:iGASRingingType=CGlobalAudioSettings::EGASRingingTypeSilent;
+                                           break;
+            }
+    }
+void CProfileSettingsMonitorServerImpl::CMapGASKeypadVolume(TProfileKeypadVolume aKeypadVolume)
+    {
+     switch(aKeypadVolume)
+         {
+         case  EProfileKeypadVolumeOff  : iGASKeypadVolume=CGlobalAudioSettings::EGASKeypadVolumeOff;
+                                          break;
+         case EProfileKeypadVolumeLevel1 :iGASKeypadVolume=CGlobalAudioSettings::EGASKeypadVolumeLevel1;
+                                          break;
+         case EProfileKeypadVolumeLevel2 :iGASKeypadVolume=CGlobalAudioSettings::EGASKeypadVolumeLevel2;
+                                          break;
+         case  EProfileKeypadVolumeLevel3 :iGASKeypadVolume=CGlobalAudioSettings::EGASKeypadVolumeLevel3;
+                                           break;
+         }
+    }
 // End of file