Symbian Developer Library

SYMBIAN OS V6.1 EDITION FOR C++

[Index] [Glossary] [Previous] [Next]



Location: agmalarm.h
Link against: agnmodel.lib

Class CAgnAlarm

CAgnAlarm

Support

Supported from 5.0

Description

Represents the interface between the agenda model and the alarm server.

A session with the alarm server is created in the NewL() function. The agenda model's next due alarm is retrieved and set as the session alarm (using FindAndQueueNextAlarmL()). This is added to the alarm server's pending alarm queue and is handled by the alarm server when its due time is reached. At ER5.1, a new function FindAndQueueNextFewAlarmsL() was added. This allows the queuing of several alarms with the alarm server.

If the session with the alarm server is disconnected, the session alarm is cancelled. If you want the alarm to run after the session has been disconnected, the alarm must be orphaned.

Optionally, a callback may be passed to the object on construction. This callback defines a single function AlarmServerTerminated(). This function is called if notification is requested (using RequestServerTerminationNotification()) when the session is disconnected from the alarm server.

After disconnection occurs, an attempt may be made to reconnect to the server using Connect(). Once a connection has been re-established you should call RestartL() to re-queue the agenda model's next outstanding alarm with the alarm server.

Derivation

CAgnAlarmRepresents the interface between the agenda model and the alarm server
CBaseBase class for all classes to be instantiated on the heap

Defined in CAgnAlarm:
CancelServerTerminationNotification(), Connect(), DefaultTitle(), FindAndQueueNextAlarmL(), FindAndQueueNextFewAlarmsL(), NewL(), OrphanAlarm(), RequestServerTerminationNotification(), SetDefaultTitleL(), SetModel(), ~CAgnAlarm()

Inherited from CBase:
operator new()


Construction and destruction


NewL()

static CAgnAlarm* NewL(CAgnModel* aModel,MAgnAlarmServerTerminationCallBack* aCallBack=NULL);

Description

Allocates and constructs a CAgnAlarm object with an agenda model and a callback. Makes a connection to the alarm server.

Parameters

CAgnModel* aModel

Pointer to the agenda model object the alarm server connection is being set up for.

MAgnAlarmServerTerminationCallBack* aCallBack=NULL

The alarm server termination callback routine. May be NULL if no notification is required.

Return value

CAgnAlarm*

Pointer to the newly created alarm server interface object.


~CAgnAlarm()

virtual ~CAgnAlarm();

Description

The destructor frees all resources owned by the object, prior to its destruction, and ends the session with the alarm server.

[Top]


Alarm server and model


Connect()

TInt Connect();

Description

Re-connects to the alarm server. Note that a connection is made to the alarm server in the NewL(). The return value indicates the success or failure of the connection. After calling this function to re-establish the connection to the alarm server, you should call RestartL() to re-queue the next outstanding alarm with the alarm server.

Return value

TInt

KErrNone if connection is successful, otherwise one of the system error codes.


FindAndQueueNextAlarmL()

void FindAndQueueNextAlarmL();

Description

Finds the agenda model's next due alarm. If a due alarm is found, it is set as the session alarm and queued with the alarm server.


FindAndQueueNextFewAlarmsL()

void FindAndQueueNextFewAlarmsL(const TInt aMaxNumberOfAlarms=10,const TInt aMaxNumberOfDays=31);

Support

Supported from 5.1

Description

Finds the agenda model's next few alarms. If one or more due alarms are found, they are set as session alarms and queued with the alarm server.

Parameters

aMaxNumberOfAlarms

The maximum number of alarms to be queued. The default value is 10.

aMaxNumberOfDays

The maximum number of days to be scanned for alarms. The default value is 31.


OrphanAlarm()

void OrphanAlarm();

Description

Orphans the session alarm. This allows the alarm to be serviced after the session is closed. This function should be called by the user of the model before a currently open agenda file is closed.


SetModel()

void SetModel(CAgnModel* aModel);

Description

Sets the agenda model. Note that the model is set in the NewL().

Parameters

CAgnModel* aModel

Pointer to the agenda model object.

[Top]


Notification of disconnection


RequestServerTerminationNotification()

void RequestServerTerminationNotification(TRequestStatus& aStatus);

Description

Requests notification using the callback object specified in the NewL() when the alarm server terminates. A panic is raised (with a value of EAgnErrAlarmRequestWithCallbackSet) if no callback object was specified in the NewL().

Parameters

TRequestStatus& aStatus

On return, contains the completion status.


CancelServerTerminationNotification()

void CancelServerTerminationNotification();

Description

Cancels an outstanding asynchronous RequestServerTerminationNotification() request.

[Top]


Default title


SetDefaultTitleL()

void SetDefaultTitleL(const TDesC& aDefaultTitle);

Description

Sets the default text message which is associated with the session alarm. This text string is used if the entry which contains the alarm has no text.

Parameters

const TDesC& aDefaultTitle

The default text message which is associated with the session alarm.


DefaultTitle()

TPtrC DefaultTitle() const;

Description

Gets the text message which is associated with the session alarm, as set by SetDefaultTitleL().

Return value

TPtrC

The text message which is associated with the session alarm.