diff -r 43e37759235e -r 51a74ef9ed63 Symbian3/SDK/Source/GUID-70CD9D74-8592-45F2-A91F-AD34ED93CB3D.dita --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/Symbian3/SDK/Source/GUID-70CD9D74-8592-45F2-A91F-AD34ED93CB3D.dita Wed Mar 31 11:11:55 2010 +0100 @@ -0,0 +1,47 @@ + + + + + +Adding +an Alarm +

You can add or queue an alarm to the Alarm Server either +by Synchronous or Asynchronous method:

    +
  • Synchronous method (RASCliSession::AlarmAdd) +- This method allocates a unique identifier (a TAlarmId object) +for the alarm, adds the alarm to the queue, and returns. Follow the steps +given below to add alarm synchronously:

      +
    1. Create an alarm object.

      TASShdAlarm alarm;
    2. +
    3. Set the alarm properties such as Category, Repeat Definition, Message, +Next Due Time and Sound Name. For more information on the alarm properties, +refer to Alarm Properties.

      alarm.Category() = KASCliCategoryClock; +alarm.RepeatDefinition() = EAlarmRepeatDefintionRepeatDaily; +_LIT( KAlarmTestInit, "This is an alarm message - alarm 1" ); +alarm.Message() = KAlarmTestInit;alarm.NextDueTime().HomeTime(); +alarm.NextDueTime() += TTimeIntervalMinutes( 1 ); +_LIT( KAlarmTestSoundName, "Arf Arf Woop" ); +alarm.SoundName() = KAlarmTestSoundName;
    4. +
    5. Add the alarm object to Alarm Server.

      TInt ret = TheAlarmServerSession.AlarmAdd( alarm );
    6. +
    7. Retrieve the alarm ID.

      TAlarmId alarmId = alarm.Id();
    8. +
  • +
  • Asynchronous method (RASCliSession::AlarmAddWithNotification) +- The steps are similar to the Synchronous method, except, when either the +alarm expires or is cancelled, the Alarm Server notifies the client by completing +the outstanding request, the TRequestStatus object.

  • +

When adding a new alarm to the Alarm Server, some validation is required +to ensure the integrity of the Alarm Server. Therefore, no alarm that is to +be added must be session-specific and have a repeat definition other than TAlarmRepeatDefinition::AlarmRepeatDefintionRepeatOnce. +

If an alarm is set having a repeat definition of TAlarmRepeatDefinition::EAlarmRepeatDefintionRepeatWorkday, +the system-wide (TLocale-based) work days must be defined +first. If the system-wide workdays are not defined, the alarm is added to +the Alarm Server queue with status as TAlarmStatus::EAlarmStatusDisabled. +When a change in the workday is detected (caused by a change in locale), the +alarm will be enabled.

The alarm time can be set with the accuracy +of a minute. If an alarm is set in the past, the user is notified immediately.

+
\ No newline at end of file