alarmui/src/alarmutils.cpp
branchRCL_3
changeset 65 12af337248b1
parent 30 d68a4b5d5885
child 66 bd7edf625bdd
equal deleted inserted replaced
60:96907930389d 65:12af337248b1
    13 *
    13 *
    14 * Description:   
    14 * Description:   
    15 *
    15 *
    16 */
    16 */
    17 
    17 
    18 
    18 // User includes.
    19 
       
    20 // INCLUDE FILES
       
    21 #include "alarmutils.h"
    19 #include "alarmutils.h"
    22 
       
    23 #include "AlmAlertVariant.hrh"
    20 #include "AlmAlertVariant.hrh"
    24 #include "pim_trace.h"
    21 #include "pim_trace.h"
    25 
       
    26 #include "AlmAlarmPlayer.h"
    22 #include "AlmAlarmPlayer.h"
    27 #include "AlmAlarmControl.h"
    23 #include "AlmAlarmControl.h"
    28 #include "AlmAlarmInfo.h"
    24 #include "AlmAlarmInfo.h"
    29 #include "AlarmService.h"
    25 #include "AlarmService.h"
    30 #include "alarmremconeventshandler.h"
    26 #include "alarmremconeventshandler.h"
    31 #ifdef RD_ALMALERT__SENSOR_SUPPORT
    27 #ifdef RD_ALMALERT__SENSOR_SUPPORT
    32 #include "alarmcontextfwsupport.h"
    28 #include "alarmcontextfwsupport.h"
    33 #endif // RD_ALMALERT__SENSOR_SUPPORT
    29 #endif // RD_ALMALERT__SENSOR_SUPPORT
    34 
    30 #include "alarmalertwrapper.h"
    35 #include <w32std.h>
    31 
    36 #include <almconst.h>
    32 // System includes.
       
    33 // #include <almconst.h>
    37 #include <eikenv.h>
    34 #include <eikenv.h>
    38 #include <AknCapServer.h>
    35 #include <AknCapServer.h>
    39 #include <e32property.h>
    36 #include <e32property.h>
    40 #include <centralrepository.h>
    37 #include <centralrepository.h>
    41 #include <MProfileEngine.h>
    38 #include <MProfileEngine.h>
    42 #include <MProfile.h>
    39 #include <MProfile.h>
    43 #include <MProfileTones.h>
    40 #include <MProfileTones.h>
    44 #include <ProfileEngineDomainConstants.h>
    41 #include <ProfileEngineDomainConstants.h>
    45 #include <sbdefs.h>
    42 #include <sbdefs.h>
    46 #include <coreapplicationuisdomainpskeys.h>
    43 #include <coreapplicationuisdomainpskeys.h>
    47 #include <clockdomaincrkeys.h>
       
    48 #include <CalendarInternalCRKeys.h>
       
    49 #include <wakeupalarm.h>
    44 #include <wakeupalarm.h>
    50 #include <calalarm.h> // KUidAgendaModelAlarmCategory - the alarm category id for calendar alarms
    45 #include <calalarm.h> // KUidAgendaModelAlarmCategory - the alarm category id for calendar alarms
    51 #include <AknUtils.h>
    46 #include <AknUtils.h>
    52 #include <hwrmpowerstatesdkpskeys.h>
       
    53 
       
    54 #ifndef SYMBIAN_CALENDAR_V2
    47 #ifndef SYMBIAN_CALENDAR_V2
    55 #include <agmalarm.h> // deprecated, use CalAlarm.h when SYMBIAN_CALENDAR_V2 flag is enabled
    48 #include <agmalarm.h> // deprecated, use CalAlarm.h when SYMBIAN_CALENDAR_V2 flag is enabled
    56 #endif // SYMBIAN_CALENDAR_V2
    49 #endif // SYMBIAN_CALENDAR_V2
    57 #include <calsession.h>
    50 #include <calsession.h>
    58 #include <calentryview.h>
    51 #include <calentryview.h>
    59 #include <calenlauncher.h>  // for launching calendar entry view
    52 #include <clockdomaincrkeys.h>
    60 
    53 #include <calendardomaincrkeys.h>
    61 
    54 
    62 
    55 // Constants
    63 // CONSTANTS AND MACROS
       
    64 const TInt KAlmAlertMinSnooze( 100 );
    56 const TInt KAlmAlertMinSnooze( 100 );
    65 const TInt KAlmAlertMaxSnooze( 104 );
    57 const TInt KAlmAlertMaxSnooze( 104 );
    66 
    58 const TInt KDefaultSnoozeTime( 5 ); 
    67 const TInt KDefaultSnoozeTime( 5 ); // 5 minutes
    59 const TUint KAlarmAutoHide( 60000000 );
    68 
    60 const TUint KAlarmAutoHideCalendar( 30000000 );
    69 const TUint KAlarmAutoHide( 60000000 );  // 60 s
    61 const TUint KKeyBlockTime( 500000 );
    70 const TUint KAlarmAutoHideCalendar( 30000000 );  // 30 s
    62 const TUint KShutdownTime( 1500000 );
    71 const TUint KKeyBlockTime( 500000 );  // 0.5 s
    63 const TUint KAlarmDelayTime( 1000000 );
    72 const TUint KShutdownTime( 1500000 ); // 1.5 s
    64 const TUint KInactivityResetInterval( 1000000 );
    73 const TUint KAlarmDelayTime( 1000000 ); // 1.0 s
       
    74 const TUint KInactivityResetInterval( 1000000 ); // 1.0 s
       
    75 
       
    76 const TInt KMaxProfileVolume( 10 );
    65 const TInt KMaxProfileVolume( 10 );
    77 const TInt KVolumeRampPeriod( 3000000 );  // 3 seconds
    66 const TInt KNoVolume(0);
       
    67 const TInt KVolumeRampPeriod( 3000000 );
       
    68 const TUid KAlarmClockOne = { 0x101F793A };
       
    69 const TUid KCRUidProfileEngine = {0x101F8798};
       
    70 //const TUint32 KProEngActiveReminderTone     = 0x7E00001C;
       
    71 const TUint32 KProEngActiveClockAlarmTone  = 0x7E00001D;
       
    72 //const TUint32 KProEngActiveAlertVibra           = 0x7E00001E;
       
    73 const TUint32 KProEngSilenceMode = {0x80000202};
       
    74 const TUint32 KProEngActiveRingingType = {0x7E000002};
       
    75 const TUint32 KProEngActiveRingingVolume = {0x7E000008};
       
    76 
       
    77 // Literals
    78 _LIT( KRngMimeType, "application/vnd.nokia.ringing-tone" );
    78 _LIT( KRngMimeType, "application/vnd.nokia.ringing-tone" );
    79 
       
    80 
    79 
    81 // ==========================================================
    80 // ==========================================================
    82 // ================= MEMBER FUNCTIONS =======================
    81 // ================= MEMBER FUNCTIONS =======================
    83 
    82 
    84 
    83 
   108     User::LeaveIfError( iApaSession.Connect() );
   107     User::LeaveIfError( iApaSession.Connect() );
   109 
   108 
   110     iAlarmInfo = new( ELeave )CAlmAlarmInfo( this );
   109     iAlarmInfo = new( ELeave )CAlmAlarmInfo( this );
   111 
   110 
   112     // we can still work without profile engine
   111     // we can still work without profile engine
   113     PIM_TRAPD_ASSERT( iProfileEng = CreateProfileEngineL(); )
   112     // PIM_TRAPD_ASSERT( iProfileEng = CreateProfileEngineL(); )
   114 
   113 
   115     iNotifierDialogController = ((CAknCapServer*)CEikonEnv::Static()->AppServer())->GlobalNoteControllerL();
   114     // iNotifierDialogController = ((CAknCapServer*)CEikonEnv::Static()->AppServer())->GlobalNoteControllerL();
   116     iNotifierDialogController->SetNoteObserver( iAlarmControl );
   115     // iNotifierDialogController->SetNoteObserver( iAlarmControl );
       
   116     iAlarmAlert = new AlarmAlert(iAlarmControl);
   117 
   117 
   118     // create timers
   118     // create timers
   119     iShutdownTimer   = CPeriodic::NewL( CActive::EPriorityStandard );
   119     iShutdownTimer   = CPeriodic::NewL( CActive::EPriorityStandard );
   120     iAutoSnoozeTimer = CPeriodic::NewL( CActive::EPriorityStandard );
   120     iAutoSnoozeTimer = CPeriodic::NewL( CActive::EPriorityStandard );
   121     iKeyBlockTimer   = CPeriodic::NewL( CActive::EPriorityStandard );
   121     iKeyBlockTimer   = CPeriodic::NewL( CActive::EPriorityStandard );
   153 // ---------------------------------------------------------
   153 // ---------------------------------------------------------
   154 //
   154 //
   155 CAlarmUtils::~CAlarmUtils()
   155 CAlarmUtils::~CAlarmUtils()
   156     {
   156     {
   157     TRACE_ENTRY_POINT;
   157     TRACE_ENTRY_POINT;
   158     if( iNotifierDialogController )
   158     /*if( iNotifierDialogController )
   159         {
   159         {
   160         iNotifierDialogController->SetNoteObserver( NULL );
   160         iNotifierDialogController->SetNoteObserver( NULL );
       
   161         }*/
       
   162     if( iAlarmAlert )
       
   163         {
       
   164         delete iAlarmAlert;
       
   165         iAlarmAlert = NULL;
   161         }
   166         }
   162 
   167 
   163     if( iShutdownTimer )
   168     if( iShutdownTimer )
   164         {
   169         {
   165         iShutdownTimer->Cancel();
   170         iShutdownTimer->Cancel();
   253 void CAlarmUtils::PlayAlarmSound()
   258 void CAlarmUtils::PlayAlarmSound()
   254     {
   259     {
   255     TRACE_ENTRY_POINT;
   260     TRACE_ENTRY_POINT;
   256     StopAlarmSound();
   261     StopAlarmSound();
   257     PIM_TRAPD_ASSERT( iAlarmPlayer = CAlmAlarmPlayer::NewL( this ); )
   262     PIM_TRAPD_ASSERT( iAlarmPlayer = CAlmAlarmPlayer::NewL( this ); )
   258     SetBackLight( ETrue );
   263     //SetBackLight( ETrue );
   259     TRACE_EXIT_POINT;
   264     TRACE_EXIT_POINT;
   260     }
   265     }
   261 
   266 
   262 // ---------------------------------------------------------
   267 // ---------------------------------------------------------
   263 // Stop the alarm player.
   268 // Stop the alarm player.
   274         PIM_TRAPD_ASSERT( iCFSupport->PublishAlarmResultL( EResultAlarmSilenced ); )
   279         PIM_TRAPD_ASSERT( iCFSupport->PublishAlarmResultL( EResultAlarmSilenced ); )
   275         }
   280         }
   276     #endif // RD_ALMALERT__SENSOR_SUPPORT
   281     #endif // RD_ALMALERT__SENSOR_SUPPORT
   277     delete iAlarmPlayer;
   282     delete iAlarmPlayer;
   278     iAlarmPlayer = NULL;
   283     iAlarmPlayer = NULL;
   279     SetBackLight( EFalse );
   284     //SetBackLight( EFalse );
   280     TRACE_EXIT_POINT;
   285     TRACE_EXIT_POINT;
   281     }
   286     }
   282 
   287 
   283 // ---------------------------------------------------------
   288 // ---------------------------------------------------------
   284 // Backlight on/off
   289 // Backlight on/off
   356 TBool CAlarmUtils::IsRingingTypeSilent() const
   361 TBool CAlarmUtils::IsRingingTypeSilent() const
   357     {
   362     {
   358     TRACE_ENTRY_POINT;
   363     TRACE_ENTRY_POINT;
   359     TBool isSilent( EFalse );
   364     TBool isSilent( EFalse );
   360 
   365 
   361     if( iProfileEng )
   366     /*if( iProfileEng )
   362         {
   367         {
   363         MProfile* profile = NULL;
   368         MProfile* profile = NULL;
   364         PIM_TRAPD_ASSERT( profile = iProfileEng->ActiveProfileL(); )
   369         PIM_TRAPD_ASSERT( profile = iProfileEng->ActiveProfileL(); )
   365 
   370 
   366         if( profile )
   371         if( profile )
   371                 isSilent = ETrue;  // Ringing Type = Silent or BeepOnce
   376                 isSilent = ETrue;  // Ringing Type = Silent or BeepOnce
   372                 }
   377                 }
   373             profile->Release();
   378             profile->Release();
   374             }
   379             }
   375         }
   380         }
   376     TRACE_EXIT_POINT;
   381     TRACE_EXIT_POINT;*/
   377     return isSilent;
   382     return isSilent;
   378     }
   383     }
   379 
   384 
   380 // ---------------------------------------------------------
   385 // ---------------------------------------------------------
   381 // Check if the used alarm tone is an "off" tone.
   386 // Check if the used alarm tone is an "off" tone.
   409 // -----------------------------------------------------------------------------
   414 // -----------------------------------------------------------------------------
   410 // Read alarm sound filenames from central repository.
   415 // Read alarm sound filenames from central repository.
   411 // -----------------------------------------------------------------------------
   416 // -----------------------------------------------------------------------------
   412 //
   417 //
   413 void CAlarmUtils::GetAlarmSoundFilenames()
   418 void CAlarmUtils::GetAlarmSoundFilenames()
   414     {
   419 {
   415     TRACE_ENTRY_POINT;
   420 	TRACE_ENTRY_POINT;
   416     CRepository* repository = NULL;
   421 	CRepository* profileRepository = NULL;
   417 
   422 	CRepository* repository = NULL;
   418     if( IsClockAlarm() )
   423 
   419         {
   424 	if( IsClockAlarm() )
   420         PIM_TRAPD_ASSERT( repository = CRepository::NewL( KCRUidClockApp ); )
   425 	{
   421 
   426 		PIM_TRAPD_ASSERT( repository = CRepository::NewL( TUid::Uid(KCRUidClockApp) ); ) 
   422         if( repository )
   427 		PIM_TRAPD_ASSERT( profileRepository = CRepository::NewL( 
   423             {
   428 														KCRUidProfileEngine ); )
   424             PIM_ASSERT( repository->Get( KClockAppSoundFile, iAlarmData.iAlarmTone ); )
   429 
   425             PIM_ASSERT( repository->Get( KClockAppDefaultSoundFile, iAlarmData.iDefaultAlarmTone ); )
   430 		if( repository )
   426             }
   431 		{
   427         }
   432 			PIM_ASSERT( repository->Get( KClockAppDefaultSoundFile, 
   428     else
   433 											iAlarmData.iDefaultAlarmTone ); )
   429         {
   434 		}
   430         PIM_TRAPD_ASSERT( repository = CRepository::NewL( KCRUidCalendar ); )
   435 		if( profileRepository )
   431 
   436 		{
   432         if( repository )
   437 			// TODO: Need to use KProEngActiveClockAlarmTone once its released
   433             {
   438 			//PIM_ASSERT( profileRepository->Get( KProEngActiveClockAlarmTone , iAlarmData.iAlarmTone); )
   434             PIM_ASSERT( repository->Get( KCalendarSoundFile, iAlarmData.iAlarmTone ); )
   439 			PIM_ASSERT( repository->Get( KClockAppDefaultSoundFile, 
   435             PIM_ASSERT( repository->Get( KCalendarDefaultSoundFile, iAlarmData.iDefaultAlarmTone ); )
   440 													iAlarmData.iAlarmTone ); )
   436             }
   441 		}
   437         }
   442 	}
   438     delete repository;
   443 	else
   439     TRACE_EXIT_POINT;
   444 	{
   440     }
   445 		PIM_TRAPD_ASSERT( repository =
       
   446 				CRepository::NewL( TUid::Uid(KCRUidCalendar) ); )
       
   447 		PIM_TRAPD_ASSERT( profileRepository =
       
   448 				CRepository::NewL( KCRUidProfileEngine ); )
       
   449 
       
   450 		if( repository )
       
   451 		{
       
   452 			PIM_ASSERT( repository->Get( KCalendarDefaultSoundFile, 
       
   453 											iAlarmData.iDefaultAlarmTone ); )
       
   454 		}
       
   455 		if( profileRepository )
       
   456 		{
       
   457 			PIM_ASSERT( profileRepository->Get( KProEngActiveClockAlarmTone, iAlarmData.iAlarmTone ); )
       
   458 		}
       
   459 	}
       
   460 	delete repository;
       
   461 	delete profileRepository;
       
   462 	TRACE_EXIT_POINT;
       
   463 }
   441 
   464 
   442 // -----------------------------------------------------------------------------
   465 // -----------------------------------------------------------------------------
   443 // Check if the alarm sound file is a KRngMimeType file.
   466 // Check if the alarm sound file is a KRngMimeType file.
   444 // -----------------------------------------------------------------------------
   467 // -----------------------------------------------------------------------------
   445 //
   468 //
   484     iAlarmData.iRepeatValue = KMdaAudioToneRepeatForever; // KMdaRepeatForever
   507     iAlarmData.iRepeatValue = KMdaAudioToneRepeatForever; // KMdaRepeatForever
   485     iAlarmData.iVolume = KMaxProfileVolume; // clock alarms always ramp to maximum volume
   508     iAlarmData.iVolume = KMaxProfileVolume; // clock alarms always ramp to maximum volume
   486     iAlarmData.iVolumeRampTime = iAlarmData.iVolume * KVolumeRampPeriod; // volume ramp only for clock alarms
   509     iAlarmData.iVolumeRampTime = iAlarmData.iVolume * KVolumeRampPeriod; // volume ramp only for clock alarms
   487 
   510 
   488     if( !IsClockAlarm() )
   511     if( !IsClockAlarm() )
   489         {
   512     {
   490         if( iProfileEng )
   513         CRepository* repository = NULL;
   491             {
   514         PIM_TRAPD_ASSERT( repository = CRepository::NewL( KCRUidProfileEngine ); )
   492             MProfile* profile = NULL;
   515     	
   493             PIM_TRAPD_ASSERT( profile = iProfileEng->ActiveProfileL(); )
   516     	TInt ringType;
   494 
   517     	repository->Get( KProEngActiveRingingType , ringType);
   495             if( profile )
   518     	iAlarmData.iRingType = static_cast< TProfileRingingType >( ringType );
   496                 {
   519     	
   497                 const TProfileToneSettings& setting = profile->ProfileTones().ToneSettings();
   520     	TBool silentMode;
   498                 iAlarmData.iRingType = setting.iRingingType;
   521     	TInt ringingVolume;
   499 
   522     	repository->Get( KProEngSilenceMode, silentMode);
   500                 // calendar alarms: if profile is "silent" -> set volume to zero
   523     	if(silentMode)
   501                 iAlarmData.iVolume = (iAlarmData.iRingType == EProfileRingingTypeSilent ? 0 : setting.iRingingVolume);
   524     	    {
   502 
   525     	    ringingVolume = KNoVolume;
   503                 profile->Release();
   526     	    }
   504                 }
   527     	else
   505             }
   528     	    {
   506 
   529 			// It seems the wrong key has been associated with calendar alarm tone
   507         if( iAlarmData.iRingType == EProfileRingingTypeRingingOnce )
   530 			// settings. It would be changed once it's rectified by profile team.
   508             {
   531     	    repository->Get( KProEngActiveRingingVolume , ringingVolume );
   509             iAlarmData.iRepeatValue = 1;
   532     	    }
   510             }
   533     	
   511         iAlarmData.iVolumeRampTime = 0;
   534     	iAlarmData.iVolume = ringingVolume;
   512         }
   535     	
       
   536     	iAlarmData.iVolumeRampTime = 0;
       
   537     } else {
       
   538     	TInt volumeOn = iAlarmData.iAlarm.ClientData2();
       
   539     	if (!volumeOn) {
       
   540     		iAlarmData.iRingType = EProfileRingingTypeSilent;
       
   541     		iAlarmData.iVolume = KNoVolume;
       
   542     	}
       
   543     }
   513     TRACE_EXIT_POINT;
   544     TRACE_EXIT_POINT;
   514     }
   545     }
   515 
   546 
   516 // -----------------------------------------------------------------------------
   547 // -----------------------------------------------------------------------------
   517 // 
   548 // 
   621     switch( iAlarmData.iAlarmType )
   652     switch( iAlarmData.iAlarmType )
   622         {
   653         {
   623         case EAlarmTypeClock:
   654         case EAlarmTypeClock:
   624             {
   655             {
   625             CRepository* repository = NULL;
   656             CRepository* repository = NULL;
   626             PIM_TRAPD_ASSERT( repository = CRepository::NewL( KCRUidClockApp ); )
   657             PIM_TRAPD_ASSERT( repository = CRepository::NewL( TUid::Uid(KCRUidClockApp) ); )
   627 
   658 
   628             if( repository )
   659             if( repository )
   629                 {
   660                 {
   630                 repository->Get( KClockAppSnoozeTime, iAlarmData.iSnoozeTime );
   661                 repository->Get( KClockAppSnoozeTime, iAlarmData.iSnoozeTime );
   631                 delete repository;
   662                 delete repository;
   634             }
   665             }
   635 
   666 
   636         case EAlarmTypeCalendar:
   667         case EAlarmTypeCalendar:
   637             {
   668             {
   638             CRepository* repository = NULL;
   669             CRepository* repository = NULL;
   639             PIM_TRAPD_ASSERT( repository = CRepository::NewL( KCRUidCalendar ); )
   670             PIM_TRAPD_ASSERT( repository =
       
   671             		CRepository::NewL( TUid::Uid(KCRUidCalendar) ); )
   640 
   672 
   641             if( repository )
   673             if( repository )
   642                 {
   674                 {
   643                 repository->Get( KCalendarSnoozeTime, iAlarmData.iSnoozeTime );
   675                 repository->Get( KCalendarSnoozeTime, iAlarmData.iSnoozeTime );
   644                 delete repository;
   676                 delete repository;
   728 
   760 
   729 // -----------------------------------------------------------------------------
   761 // -----------------------------------------------------------------------------
   730 // 
   762 // 
   731 // -----------------------------------------------------------------------------
   763 // -----------------------------------------------------------------------------
   732 //
   764 //
   733 CNotifierDialogController* CAlarmUtils::NotifierDialogController()
   765 AlarmAlert* CAlarmUtils::NotifierDialogController()
   734     {
   766     {
   735     TRACE_ENTRY_POINT;
   767     TRACE_ENTRY_POINT;
   736     TRACE_EXIT_POINT;
   768     TRACE_EXIT_POINT;
   737     return iNotifierDialogController;
   769     // return iNotifierDialogController;
       
   770     return iAlarmAlert;
   738     }
   771     }
   739 
   772 
   740 // ---------------------------------------------------------
   773 // ---------------------------------------------------------
   741 // Checks if the alarm server has more expired alarms ready 
   774 // Checks if the alarm server has more expired alarms ready 
   742 // to be shown.
   775 // to be shown.
   960 // ---------------------------------------------------------
   993 // ---------------------------------------------------------
   961 //
   994 //
   962 void CAlarmUtils::DeviceShutdown()
   995 void CAlarmUtils::DeviceShutdown()
   963     {
   996     {
   964     TRACE_ENTRY_POINT;
   997     TRACE_ENTRY_POINT;
   965     
   998     iShutdownTimer->Cancel();
   966     // charging state added for the err EMDN-835CW2.
   999     if( StarterConnect() )
   967     TInt chargingState;
  1000         {
   968     RProperty::Get( KPSUidHWRMPowerState, KHWRMChargingStatus , chargingState );
  1001         iStarter.Shutdown();
   969     
  1002         iStarter.Close();
   970     if( IsDeviceInAlarmState() && ( chargingState != EChargingStatusCharging ) )
  1003         }    
   971         {       
       
   972             iShutdownTimer->Cancel();
       
   973             if( StarterConnect() )
       
   974                 {
       
   975                 iStarter.Shutdown();
       
   976                 iStarter.Close();
       
   977                 }    
       
   978         }
       
   979     TRACE_EXIT_POINT;
  1004     TRACE_EXIT_POINT;
   980     }
  1005     }
   981 
  1006 
   982 // ---------------------------------------------------------
  1007 // ---------------------------------------------------------
   983 // 
  1008 // 
  1121 // ---------------------------------------------------------
  1146 // ---------------------------------------------------------
  1122 //
  1147 //
  1123 void CAlarmUtils::StartAccessoryObserver()
  1148 void CAlarmUtils::StartAccessoryObserver()
  1124     {
  1149     {
  1125     TRACE_ENTRY_POINT;    
  1150     TRACE_ENTRY_POINT;    
  1126     PIM_TRAPD_ASSERT( iRemConHandler->StartL(); )    
  1151     // PIM_TRAPD_ASSERT( iRemConHandler->StartL(); )    
  1127     TRACE_EXIT_POINT;
  1152     TRACE_EXIT_POINT;
  1128     }
  1153     }
  1129 
  1154 
  1130 // ---------------------------------------------------------
  1155 // ---------------------------------------------------------
  1131 // 
  1156 // 
  1254 
  1279 
  1255 // ---------------------------------------------------------
  1280 // ---------------------------------------------------------
  1256 // Callback function for the auto snooze timer
  1281 // Callback function for the auto snooze timer
  1257 // ---------------------------------------------------------
  1282 // ---------------------------------------------------------
  1258 //
  1283 //
  1259 TInt CAlarmUtils::SnoozeInfoCallBack(TAny* aPtr)
  1284 TInt CAlarmUtils::SnoozeInfoCallBack(TAny* /*aPtr*/)
  1260     {
  1285     {
  1261     TRACE_ENTRY_POINT;
  1286     TRACE_ENTRY_POINT;
  1262     PIM_TRAPD_ASSERT( static_cast<CAlmAlarmControl*>( aPtr )->ShowSnoozeInfoNoteL(); )
  1287     // PIM_TRAPD_ASSERT( static_cast<CAlmAlarmControl*>( aPtr )->ShowSnoozeInfoNoteL(); )
  1263     TRACE_EXIT_POINT;
  1288     TRACE_EXIT_POINT;
  1264     return 0;
  1289     return 0;
  1265     }
  1290     }
  1266 
  1291 
  1267 // ---------------------------------------------------------
  1292 // ---------------------------------------------------------
  1622 void CAlarmUtils::StartCalendarL()
  1647 void CAlarmUtils::StartCalendarL()
  1623     {
  1648     {
  1624     TRACE_ENTRY_POINT;
  1649     TRACE_ENTRY_POINT;
  1625     
  1650     
  1626     iCalendarAlarmViewer = ETrue;
  1651     iCalendarAlarmViewer = ETrue;
  1627     
  1652     /*
  1628     CalenLauncher::ViewEntryL( iAlarmData.iLocalUid,
  1653     CalenLauncher::ViewEntryL( iAlarmData.iLocalUid,
  1629                                iAlarmData.iInstanceTime, iAlarmData.iCalFileName,
  1654                                iAlarmData.iInstanceTime, iAlarmData.iCalFileName,
  1630                                CanSnooze() ? CalenLauncher::EAlarmViewer : 
  1655                                CanSnooze() ? CalenLauncher::EAlarmViewer : 
  1631                                              CalenLauncher::EAlarmViewerNoSnooze );
  1656                                              CalenLauncher::EAlarmViewerNoSnooze );
       
  1657 											 */
  1632     TRACE_EXIT_POINT;
  1658     TRACE_EXIT_POINT;
  1633     }
  1659     }
  1634 
  1660 
  1635 // ---------------------------------------------------------
  1661 // ---------------------------------------------------------
  1636 // Check if the security lock is active.
  1662 // Check if the security lock is active.
  1667 TBool CAlarmUtils::IsCalendarAlarmViewer()
  1693 TBool CAlarmUtils::IsCalendarAlarmViewer()
  1668     {
  1694     {
  1669     return iCalendarAlarmViewer;
  1695     return iCalendarAlarmViewer;
  1670     }
  1696     }
  1671 
  1697 
  1672 // ---------------------------------------------------------
  1698 SAlarmInfo* CAlarmUtils::GetAlarmInfo()
  1673 // Silence the notifying alarm 
  1699     {
  1674 // ---------------------------------------------------------
  1700     return iAlarmInfo->GetAlarmInfo(iAlarmData.iAlarm,
  1675 //
  1701                                     iAlarmData.iAlarmType);
  1676 void CAlarmUtils::DoSilence()
       
  1677     {
       
  1678     TRACE_ENTRY_POINT;
       
  1679     
       
  1680     // silence only if snoozing is possible
       
  1681     // this way user must hear the last "call"
       
  1682     if( CanSnooze() )
       
  1683         {
       
  1684         delete iAlarmPlayer;
       
  1685         iAlarmPlayer = NULL;
       
  1686         SetBackLight( EFalse );
       
  1687         
       
  1688         if( IsCalendarAlarm() )
       
  1689             {
       
  1690     
       
  1691             // calendar alarm needs extra handling due to having stop - silence
       
  1692             //simulate right softkey pressing
       
  1693             RWsSession wsSession=CCoeEnv::Static()->WsSession();
       
  1694             TKeyEvent keyEvent;
       
  1695             keyEvent.iCode = EKeyCBA2;  
       
  1696             keyEvent.iScanCode = EStdKeyDevice1;
       
  1697             keyEvent.iModifiers = 0;
       
  1698             keyEvent.iRepeats = 0;
       
  1699             wsSession.SimulateKeyEvent( keyEvent );
       
  1700             wsSession.Flush();
       
  1701             }
       
  1702         // clockalarm
       
  1703         else
       
  1704             {
       
  1705             StartAutoSnoozeTimer();
       
  1706             }
       
  1707     
       
  1708         #if defined( RD_ALMALERT__SENSOR_SUPPORT )
       
  1709         // notify the result through the context framework
       
  1710         if( iCFSupport )
       
  1711             {
       
  1712             PIM_TRAPD_ASSERT( iCFSupport->PublishAlarmResultL( EResultAlarmSilenced ); )
       
  1713             }
       
  1714         #endif // RD_ALMALERT__SENSOR_SUPPORT
       
  1715         }
       
  1716     TRACE_EXIT_POINT;     
       
  1717     }
  1702     }
  1718 
  1703 
  1719 // End of File
  1704 // End of File