alarmui/src/alarmcontextfwsupport.cpp
branchRCL_3
changeset 30 d68a4b5d5885
parent 0 f979ecb2b13e
child 65 12af337248b1
equal deleted inserted replaced
27:55d60436f00b 30:d68a4b5d5885
    30 #include <cfactionindication.h>
    30 #include <cfactionindication.h>
    31 
    31 
    32 // USER INCLUDE
    32 // USER INCLUDE
    33 #include "alarmcontextfwsupport.h"
    33 #include "alarmcontextfwsupport.h"
    34 #include "AlmAlarmControl.h"
    34 #include "AlmAlarmControl.h"
       
    35 #include "alarmutils.h"
    35 
    36 
    36 #include "pim_trace.h"
    37 #include "pim_trace.h"
    37 
    38 
    38 // ======== MEMBER FUNCTIONS ========
    39 // ======== MEMBER FUNCTIONS ========
    39 
    40 
    85             }
    86             }
    86         else if( contextObject.Value() == TPtrC( KAlarmUISourceCommandValues[ECommandAlarmSnooze] ) )
    87         else if( contextObject.Value() == TPtrC( KAlarmUISourceCommandValues[ECommandAlarmSnooze] ) )
    87             {
    88             {
    88             // snooze alarm
    89             // snooze alarm
    89             if(iAlarmControl->CanSnooze())
    90             if(iAlarmControl->CanSnooze())
    90 	            {
    91               iAlarmControl->ExternalSnoozeAlarm();
    91 	            iAlarmControl->ExternalSnoozeAlarm();
    92             }
    92 	            }
    93         else if( contextObject.Value() == TPtrC( KAlarmUISourceCommandValues[ECommandAlarmSilence] ) )
       
    94             {
       
    95             SilenceAlarm();
    93             }
    96             }
    94         else
    97         else
    95             {
    98             {
    96             // value didn't match
    99             // value didn't match
    97             }
   100             }
   112     TRACE_ENTRY_POINT;
   115     TRACE_ENTRY_POINT;
   113 
   116 
   114     if( aActionToExecute.Identifier() == TPtrC( KAlarmUIActions[EActionSnooze] ) )
   117     if( aActionToExecute.Identifier() == TPtrC( KAlarmUIActions[EActionSnooze] ) )
   115         {
   118         {
   116         // snooze the alarm
   119         // snooze the alarm
   117 		if(iAlarmControl->CanSnooze())
   120         if(iAlarmControl->CanSnooze())
   118         	iAlarmControl->ExternalSnoozeAlarm();
   121           iAlarmControl->ExternalSnoozeAlarm();
   119         }
   122         }
       
   123     else if( aActionToExecute.Identifier() == TPtrC( KAlarmUIActions[EActionSilence] ) )
       
   124         {
       
   125         SilenceAlarm();
       
   126         }    
   120     else if( aActionToExecute.Identifier() == TPtrC( KAlarmUIActions[EActionStop] ) )
   127     else if( aActionToExecute.Identifier() == TPtrC( KAlarmUIActions[EActionStop] ) )
   121         {
   128         {
   122         //Do not stop the alarm internally but force the user to stop the alarm manually.
   129         //Do not stop the alarm internally but force the user to stop the alarm manually.
   123         //iAlarmControl->ExternalStopAlarm();
   130         //iAlarmControl->ExternalStopAlarm();
   124         }
   131         }
   181     DefineContextL( KAlarmUISource, KAlarmUISourceCommand, KAlarmUISourceCommandSec );
   188     DefineContextL( KAlarmUISource, KAlarmUISourceCommand, KAlarmUISourceCommandSec );
   182     DefineContextL( KAlarmUISource, KAlarmUISourceResult, KAlarmUISourceResultSec  );
   189     DefineContextL( KAlarmUISource, KAlarmUISourceResult, KAlarmUISourceResultSec  );
   183 
   190 
   184     // define actions(s)
   191     // define actions(s)
   185     DefineActionL( EActionSnooze );
   192     DefineActionL( EActionSnooze );
       
   193     DefineActionL( EActionSilence );    
   186 
   194 
   187     //Stop action definition should not be defined as the alarm component should not automatically stop the alarm on observing context events
   195     //Stop action definition should not be defined as the alarm component should not automatically stop the alarm on observing context events
   188     // but continue to expire the alarm and force the user to manually stop the alarm
   196     // but continue to expire the alarm and force the user to manually stop the alarm
   189     //DefineActionL( EActionStop );  
   197     //DefineActionL( EActionStop );  
   190 
   198 
   297     // open client session(closed in StopL)
   305     // open client session(closed in StopL)
   298     OpenCFClientL();  // closed in StopL
   306     OpenCFClientL();  // closed in StopL
   299 
   307 
   300     // subscribe for action(s)
   308     // subscribe for action(s)
   301     SubscribeActionL( EActionSnooze );
   309     SubscribeActionL( EActionSnooze );
       
   310     SubscribeActionL( EActionSilence );
   302 
   311 
   303     //Subscription to stop action definition from the context events should not be defined as the alarm component should not automatically stop the alarm on observing context events
   312     //Subscription to stop action definition from the context events should not be defined as the alarm component should not automatically stop the alarm on observing context events
   304     // but continue to expire the alarm and force the user to manually stop the alarm
   313     // but continue to expire the alarm and force the user to manually stop the alarm
   305     //SubscribeActionL( EActionStop );
   314     //SubscribeActionL( EActionStop );
   306 
   315 
   449     iSubscribedContexts.Close();
   458     iSubscribedContexts.Close();
   450     
   459     
   451     TRACE_EXIT_POINT;	
   460     TRACE_EXIT_POINT;	
   452 	}
   461 	}
   453 
   462 
   454 
   463 void CAlarmContextFwSupport::SilenceAlarm()
       
   464     {
       
   465     if( iAlarmControl->AlarmUtils() )
       
   466         {
       
   467         iAlarmControl->AlarmUtils()->DoSilence();
       
   468         }
       
   469     }
   455 // End of File
   470 // End of File