alarmui/src/alarmutils.cpp
branchRCL_3
changeset 43 51372538e3d3
parent 30 d68a4b5d5885
child 65 12af337248b1
equal deleted inserted replaced
42:07e82e2b738b 43:51372538e3d3
    30 #include "alarmremconeventshandler.h"
    30 #include "alarmremconeventshandler.h"
    31 #ifdef RD_ALMALERT__SENSOR_SUPPORT
    31 #ifdef RD_ALMALERT__SENSOR_SUPPORT
    32 #include "alarmcontextfwsupport.h"
    32 #include "alarmcontextfwsupport.h"
    33 #endif // RD_ALMALERT__SENSOR_SUPPORT
    33 #endif // RD_ALMALERT__SENSOR_SUPPORT
    34 
    34 
       
    35 #include <w32std.h>
    35 #include <almconst.h>
    36 #include <almconst.h>
    36 #include <eikenv.h>
    37 #include <eikenv.h>
    37 #include <AknCapServer.h>
    38 #include <AknCapServer.h>
    38 #include <e32property.h>
    39 #include <e32property.h>
    39 #include <centralrepository.h>
    40 #include <centralrepository.h>
    46 #include <clockdomaincrkeys.h>
    47 #include <clockdomaincrkeys.h>
    47 #include <CalendarInternalCRKeys.h>
    48 #include <CalendarInternalCRKeys.h>
    48 #include <wakeupalarm.h>
    49 #include <wakeupalarm.h>
    49 #include <calalarm.h> // KUidAgendaModelAlarmCategory - the alarm category id for calendar alarms
    50 #include <calalarm.h> // KUidAgendaModelAlarmCategory - the alarm category id for calendar alarms
    50 #include <AknUtils.h>
    51 #include <AknUtils.h>
       
    52 #include <hwrmpowerstatesdkpskeys.h>
    51 
    53 
    52 #ifndef SYMBIAN_CALENDAR_V2
    54 #ifndef SYMBIAN_CALENDAR_V2
    53 #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
    54 #endif // SYMBIAN_CALENDAR_V2
    56 #endif // SYMBIAN_CALENDAR_V2
    55 #include <calsession.h>
    57 #include <calsession.h>
   958 // ---------------------------------------------------------
   960 // ---------------------------------------------------------
   959 //
   961 //
   960 void CAlarmUtils::DeviceShutdown()
   962 void CAlarmUtils::DeviceShutdown()
   961     {
   963     {
   962     TRACE_ENTRY_POINT;
   964     TRACE_ENTRY_POINT;
   963     iShutdownTimer->Cancel();
   965     
   964     if( StarterConnect() )
   966     // charging state added for the err EMDN-835CW2.
   965         {
   967     TInt chargingState;
   966         iStarter.Shutdown();
   968     RProperty::Get( KPSUidHWRMPowerState, KHWRMChargingStatus , chargingState );
   967         iStarter.Close();
   969     
   968         }    
   970     if( IsDeviceInAlarmState() && ( chargingState != EChargingStatusCharging ) )
       
   971         {       
       
   972             iShutdownTimer->Cancel();
       
   973             if( StarterConnect() )
       
   974                 {
       
   975                 iStarter.Shutdown();
       
   976                 iStarter.Close();
       
   977                 }    
       
   978         }
   969     TRACE_EXIT_POINT;
   979     TRACE_EXIT_POINT;
   970     }
   980     }
   971 
   981 
   972 // ---------------------------------------------------------
   982 // ---------------------------------------------------------
   973 // 
   983 // 
  1657 TBool CAlarmUtils::IsCalendarAlarmViewer()
  1667 TBool CAlarmUtils::IsCalendarAlarmViewer()
  1658     {
  1668     {
  1659     return iCalendarAlarmViewer;
  1669     return iCalendarAlarmViewer;
  1660     }
  1670     }
  1661 
  1671 
       
  1672 // ---------------------------------------------------------
       
  1673 // Silence the notifying alarm 
       
  1674 // ---------------------------------------------------------
       
  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;     
       
  1717     }
       
  1718 
  1662 // End of File
  1719 // End of File