×

Discussion Board

Results 1 to 2 of 2
  1. #1
    Registered User
    Join Date
    Jun 2003
    Posts
    6

    RAlarmServer - SetAlarmPlayIntervals & Alarm sound

    Hi, I have been encountering some strange behaviour with these
    functions. They don't seem to be affecting the alarm server in any
    way.

    For alarm sound I have tried to use the .rng files from the 3650
    ROM, and whatever I set it to be, the default ring tone is played.


    The alarm play intervals don't work either, I can verify that the
    changes have been made to the alarm server but they don't
    affect it. For example I have set the snoozes to come in 3min
    intervals, they still come in 5min intervals. Also the number of
    repetitions stays the same, no matter how many repetitions I
    would set.

    Here's my code:

    //Setting alarm intervals
    void CAlarmModel::SetSnoozeIntervalL(TInt& aNumber)
    {
    RAlarmServer almServer;

    TInt err, count;
    TTimeIntervalSeconds duration;

    CArrayFix<TAlmSoundPlay>* almIntervals = new CArrayFixFlat<TAlmSoundPlay>(20);
    CleanupStack::PushL(almIntervals);
    CArrayFix<TAlmSoundPlay>* newAlmIntervals = new CArrayFixFlat<TAlmSoundPlay>(20);
    CleanupStack::PushL(newAlmIntervals);

    almServer.Connect();
    err = almServer.GetAlarmPlayIntervalsL(*almIntervals);
    almServer.Close();

    almIntervals->Compress();
    count = almIntervals->Count();

    duration = almIntervals->At(0).iDuration;

    for(TInt i=0; i < count; i++)
    {
    TAlmSoundPlay almPlay(aNumber*i, duration);
    newAlmIntervals->InsertL(i, almPlay);
    }

    newAlmIntervals->Compress();

    almServer.Connect();
    err = almServer.SetAlarmPlayIntervals(*newAlmIntervals);
    almServer.Close();

    CleanupStack::PopAndDestroy(2);
    }

    //Set snooze repeats
    void CAlarmModel::SetSnoozeRepeatL(TInt aNumber)
    {
    RAlarmServer almServer;
    TInt err, offset;

    TTimeIntervalMinutes interval;
    TTimeIntervalSeconds duration;

    CArrayFix<TAlmSoundPlay>* almIntervals = new CArrayFixFlat<TAlmSoundPlay>(20);
    CleanupStack::PushL(almIntervals);
    CArrayFix<TAlmSoundPlay>* newAlmIntervals = new CArrayFixFlat<TAlmSoundPlay>(20);
    CleanupStack::PushL(newAlmIntervals);


    almServer.Connect();
    err = almServer.GetAlarmPlayIntervalsL(*almIntervals);
    almServer.Close();

    // Sort array by the iOffset variable of the elements
    TKeyArrayFix iKey(_FOFF(TAlmSoundPlay, iOffset),ECmpTInt);
    almIntervals->Sort(iKey);

    duration = almIntervals->At(0).iDuration;
    interval = almIntervals->At(1).iOffset;
    offset = interval.Int();

    for(TInt i=0; i <= aNumber; i++)
    {
    TAlmSoundPlay almPlay(offset*i, duration);
    newAlmIntervals->InsertL(i, almPlay);
    }

    newAlmIntervals->Compress();

    almServer.Connect();
    err = almServer.SetAlarmPlayIntervals(*newAlmIntervals);
    almServer.Close();

    CleanupStack::PopAndDestroy(2);
    }

    When I use GetAlarmPlayIntervalsL to get the set parameters,
    they show the values I have put there. However, the alarm
    server behaviour remains the default.


    //Update alarm with a new alarm sound
    void CAlarmModel::UpdateAlarmL(TInt aIndex, TTime dueTime, TAlarmMessage alarmText)
    {
    RAlarmServer almServer;
    almServer.Connect();

    // alarm sound
    TAlarmSoundName aSound=_L("Z:\\Nokia\\Sounds\\Simple\\Drill.rng");

    TAlarmClockRepeat aRepeat = EAlarmClockWeekly;


    // Update the data to RAlarmServer
    almServer.SetClockAlarm(aIndex, dueTime, alarmText, aSound, aRepeat);
    almServer.AlarmEnable(ETrue, aIndex);

    almServer.Close();
    }

    The sound file name has been verified with a File Explorer so
    the path and the filename are valid. Also the file type is what it
    is supposed to be (default ringtone is .rng too).

    Thanks for any help...

    -Pertti
    Last edited by plonnrot; 2003-08-12 at 06:27.

  2. #2
    Registered User
    Join Date
    Jun 2003
    Posts
    6
    getting desperate...

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
×