Alarm Play Tutorials

This tutorial assists the device creators in customizing the Alarm Server behavior for playing an alarm continuously.

The [[[ERROR: [NOKX000E] Unable to find definition for key reference 'TASShdAlarm']]]RASCliSession class provides functions to set and get the continuous state for a previously created alarm.

Introduction

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.

Procedure

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:

    1. Connect to the Alarm Server using [[[ERROR: [NOKX000E] Unable to find definition for key reference 'TASShdAlarm']]]RASCliSession.

    2. Add a new [[[ERROR: [NOKX000E] Unable to find definition for key reference 'TASShdAlarm']]]TASShdAlarm alarm.

    3. Use the [[[ERROR: [NOKX000E] Unable to find definition for key reference 'TASShdAlarm']]]SetContinuous() function to set the alarm as a continuous alarm.

      The [[[ERROR: [NOKX000E] Unable to find definition for key reference 'TASShdAlarm']]]EAlarmRepeatDefintionRepeatDaily value makes the alarm repeat daily.

    4. Add the alarm to the Alarm Server by using the [[[ERROR: [NOKX000E] Unable to find definition for key reference 'TASShdAlarm']]]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. [[[ERROR: [NOKX000E] Unable to find definition for key reference 'TASShdAlarm']]]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.