This tutorial assists the device creators in customizing the Alarm Server behavior for playing an alarm continuously.
The RASCliSession class provides functions to set and get the continuous state for a previously created alarm.
It is possible to customize or disable the UI application’s control of alarm sound intervals and durations. In certain scenarios, it may be preferable for the alarm sound to have an infinite duration. For more information on intervals and durations, refer to Sound Control.
To play an alarm continuously, or to disable alarm play control, refer the following respective sections:
Playing an alarm continuously - A continuous alarm is one that does not follow the pattern of sound play defined as a series of intervals and durations in the alarmserver.rsc file. Instead, the alarm sound is played once and has an infinite interval and duration.
Follow the steps given below to create a continuous alarm:
Connect to the Alarm Server using RASCliSession.
Add a new TASShdAlarm alarm.
Use the SetContinuous() function to set the alarm as a continuous alarm.
The EAlarmRepeatDefintionRepeatDaily value makes the alarm repeat daily.
Add the alarm to the Alarm Server by using the AlarmAdd() function.
The following code snippet explains how to play an alarm continuously:
#include <ASCliSession.h> // For RASCliSession. #include <ASShdAlarm.h> // For TASShdAlarm. … // Connect to Alarm Server. RASCliSession alarmSession; User::LeaveIfError( alarmSession.Connect() ); CleanupClosePushL( alarmSession ); // Create a daily alarm that once activated is continuous. TASShdAlarm alarm; alarm.RepeatDefinition() = EAlarmRepeatDefintionRepeatDaily; alarm.SetContinuous( ETrue ); // Add the alarm to Alarm Server. User::LeaveIfError( alarmSession.AlarmAdd( alarm ) ); CleanupStack::PopAndDestroy();
Disable alarm play control - This is a special case of Alarm Play Interval configuration described in Sound Control section. Disabling the Alarm Play control requires an empty interval list as shown in the following code snippet:
RESOURCE sound_controller { // disable alarm server control of alarm intervals intervals = {}; }
This configuration cannot be overridden at runtime. RASCliSession::SetAlarmPlayIntervalsL() cannot be used to change this option, that is, the function can neither turn OFF the alarm sound control by specifying an empty sequence, nor turn ON the alarm sound control by overriding an empty sequence in the resource file.
Durations that extend into the next interval cause the whole sequence to revert to the default hard-coded values.