×

Discussion Board

Results 1 to 8 of 8
  1. #1
    Regular Contributor
    Join Date
    Jul 2004
    Location
    Nanjing, China
    Posts
    74

    Question Agenda Alarm Question

    I use the following code to add an Agenda entry, and the entry was success added, but when the time that i set to alarm comes, nothing happens(no alarm, not notify window), can anybody tell me why?

    iParaFormatLayer = CParaFormatLayer::NewL();
    iCharFormatLayer = CCharFormatLayer::NewL();

    CAgnAppt* appt=CAgnAppt::NewL(iParaFormatLayer,iCharFormatLayer);
    appt->RichTextL()->InsertL(0,KTxtApptWithAlarm);
    appt->SetStartAndEndDateTime(startDateTime,endDateTime);
    appt->SetAlarm(TTimeIntervalDays(0),TTimeIntervalMinutes(917));

    iModel->AddEntryL(appt);
    delete appt;

    regards,
    vachel

  2. #2
    Registered User
    Join Date
    Jan 2005
    Posts
    1
    Hi,
    Your alarm must be added to the alarm server queue. See the "Using_the_Series_60_Calendar_APIs_v1_0.pdf" document - everything is well explained there.
    Here is part of my (tested on SX1) code:

    const TTimeIntervalMinutes KDefaultTimeForEvents(9 * 60); // 9.00 pm
    const TTimeIntervalMinutes KDefaultTimeForAnnivs(13 * 60); // 1.00 am

    RAgendaServ *iAgenServ = RAgendaServ::NewL();
    CleanupStack::PushL(iAgenServ);
    iAgenServ->Connect();
    CleanupClosePushL(*iAgenServ);

    RFs iFs;
    User::LeaveIfError(iFs.Connect());
    CleanupClosePushL(iFs);

    CAgnEntryModel *iModel = CAgnEntryModel::NewL();
    iModel->SetServer(iAgenServ);
    iModel->SetMode(CAgnEntryModel::EClient);

    TRAPD(error,(iModel->OpenL(_L("C:\\system\\data\\Calendar"), KDefaultTimeForEvents,KDefaultTimeForAnnivs,1234)));
    CleanupStack::PushL(iModel);

    iAgenServ->WaitUntilLoaded();

    CParaFormatLayer *iParaFormatLayer = CParaFormatLayer::NewL();
    CleanupStack::PushL(iParaFormatLayer);
    CCharFormatLayer *iCharFormatLayer = CCharFormatLayer::NewL();
    CleanupStack::PushL(iCharFormatLayer);

    CAgnAlarm* alarm=CAgnAlarm::NewL((CAgnModel*)iModel);
    iModel->RegisterAlarm(alarm);

    CAgnAppt* appt=CAgnAppt::NewL(iParaFormatLayer,iCharFormatLayer);
    _LIT(KDash," - ");
    TInt titleEnd=programDescr->Find(KDash);
    if (titleEnd==KErrNotFound)
    titleEnd=programDescr->Length();
    appt->RichTextL()->InsertL(0,(*KAllStations)[stationNum]);
    appt->RichTextL()->InsertL(((*KAllStations)[stationNum]).Length(),KDash);
    appt->RichTextL()->InsertL(((*KAllStations)[stationNum]).Length()+3,programDescr->Left(titleEnd));
    appt->SetStartAndEndDateTime(programStart,programStart);
    appt->SetAlarm(TTimeIntervalDays(0),TTimeIntervalMinutes(programStart.DateTime().Hour()*60+programStart.DateTime().Minute()));

    iModel->AddEntryL(appt);

    alarm->OrphanAlarm();

    delete appt;

    delete alarm;

    CleanupStack::PopAndDestroy(); //Char
    CleanupStack::PopAndDestroy(); // Para
    CleanupStack::PopAndDestroy(); //Model
    CleanupStack::PopAndDestroy(); // RFs
    CleanupStack::PopAndDestroy(); //*Agenda
    CleanupStack::PopAndDestroy(); //Agenda

    By the way: I'm not Symbian expert so if there is any error in my code (with memory handling maybe?) please correct me. This code is working and causes no panic but you may get problems with testing it on the emulator - on the SX1 emulator it doesn't fire any alarm - on the real SX1 - it does.
    Regards
    Kuba

  3. #3
    Regular Contributor
    Join Date
    Jul 2004
    Location
    Nanjing, China
    Posts
    74
    Hi, Kuba
    Thanks for your reply.
    I'd read the "Using_the_Series_60_Calendar_APIs_v1_0.pdf" and changed my code almost the same as yours, but the alarm can not work properly. when i set the alarm close with nowa time, for example, nowa is 10:00, i set the note time to 10:10 and alarm time to 10:05, the alarm did't work! But when i set the alarm after 15 miniutes or later(also the note time), it worked well.

    I am using Nokia7610. Can you tell me why? and what for the declaration of iFs?

    Regards,
    Vachel
    Last edited by vacheldai; 2005-02-01 at 01:29.

  4. #4
    Regular Contributor
    Join Date
    Jul 2004
    Location
    Nanjing, China
    Posts
    74
    Anybody else knows?

    Regards,
    Vachel

  5. #5
    Regular Contributor
    Join Date
    Jul 2004
    Location
    Nanjing, China
    Posts
    74
    I found it was that alarm can not be added to AlarmServer's queue, as the code before, anybody knows why?

    Regards,
    Vachel

  6. #6
    Regular Contributor
    Join Date
    Jul 2004
    Location
    Nanjing, China
    Posts
    74
    I have got the solution, just change
    CAgnEntryModel* model = CAgnEntryModel::NewL();
    to
    CAgnModel* model = CAgnModel::NewL(NULL);

    everything is ok. but i dont konw why it is.

    Regards,
    Vachel

  7. #7
    Registered User
    Join Date
    Jun 2004
    Location
    Novosibirsk, Russian Federation
    Posts
    24
    Hello! I'm trying to do quite the same thing. But I'm going to use my own file, I don't want to alter c:\system\calendar file. And it doesn't work on my side! Did you try to use another files? Did it works? Thanks in advance.

  8. #8
    Regular Contributor
    Join Date
    Jul 2004
    Location
    Nanjing, China
    Posts
    74
    Hi, urrg
    I just use the file "C:\\system\\data\\Calendar".

    Regards,
    Vachel

Posting Permissions

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