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