1 // Copyright (c) 1999-2009 Nokia Corporation and/or its subsidiary(-ies).
2 // All rights reserved.
3 // This component and the accompanying materials are made available
4 // under the terms of "Eclipse Public License v1.0"
5 // which accompanies this distribution, and is available
6 // at the URL "http://www.eclipse.org/legal/epl-v10.html".
8 // Initial Contributors:
9 // Nokia Corporation - initial contribution.
16 #ifndef __ASSHDALARM_H__
17 #define __ASSHDALARM_H__
25 #include <asshddefs.h>
27 #ifndef SYMBIAN_ENABLE_SPLIT_HEADERS
30 * The Alarm publish and subscribe category
35 const TUid KAlarmServerPubSubCategory = { 0x101f5027 };
38 * Used for subcribing missed alarms or time zone changes
42 const TUint KMissingAlarmPubSubKey = 100;
45 * The publish and subscribe data for KMissingAlarmPubSubKey
49 struct TMissedAlarmPubSubData
52 * The value indicating the changes.
53 * 1 - Time zone has been changes but there are no missed alarms
54 * 2 - Some alarms have been missed after system time or time zone has changed.
59 * The time that system time change took place, in universal (UTC) time
61 TTime iTimeOfChangeUtc;
64 #ifdef SYMBIAN_SKIPPED_CALENDAR_ALARMS
66 * Used for subscribing to data used when searching for instances in Calendar
70 const TUint KSkippedAlarmInstancesPubSubKey = 101;
73 * The publish and subscribe data for KMissingAlarmInstancesPubSubKey
77 struct TASShdAlarmedInstanceParams
80 * The start of the time range in local time.
82 TTime iLocalStartTime;
85 * The end of the time range in local time.
90 * The alarm time types to include.
92 TASShdAlarmTimeType iTimeType;
95 #endif //SYMBIAN_SKIPPED_CALENDAR_ALARMS
96 #endif //SYMBIAN_ENABLE_SPLIT_HEADERS
99 #ifdef SYMBIAN_SYSTEM_STATE_MANAGEMENT
102 * Used for subcribing wake-up alarm set and unset notifications
103 * Belonging to the KAlarmServerPubSubCategory alarm publish and subscribe category
108 const TUint KWakeupAlarmPubSubKey = 102;
111 * Alarm server sets KWakeupAlarmPubSubKey value to EActiveWakeupAlarmSet when there is an active
112 * wakeup alarm in the alarm queue otherwise sets it to EActiveNoWakeupAlarmsSet.
113 * A wakeup alarm starts the device if it is powered off when the alarm expires. If
114 * the device is in normal mode then it works as a clock alarm.
115 * An active wakeup alarm is a wakeup alarm which has been set and has not started to alert yet.
117 * EActiveWakeupAlarmUninitialized is used to notify the listeners of 'KWakeupAlarmPubSubKey'
118 * key that the Alarm Server has just started at the device boot time and it needs to internalize
119 * Alarm Queue from backup before checking for the presence of active wake-up alarm.
124 enum TActiveWakeupAlarmStatus
126 EActiveWakeupAlarmUninitialized = 100,
127 EActiveWakeupAlarmSet,
128 EActiveNoWakeupAlarmsSet,
134 * A client-side alarm object.
136 * It contains all of the information needed to create an alarm in the Alarm Server.
145 IMPORT_C TASShdAlarm();
149 IMPORT_C void InternalizeL(RReadStream& aStream);
150 IMPORT_C void ExternalizeL(RWriteStream& aStream) const;
156 * Returns the alarm status.
158 * @return Alarm status.
160 inline TAlarmStatus Status() const { return iStatus; }
163 * Returns the alarm state.
165 * @return Alarm state.
167 inline TAlarmState State() const { return iState; }
169 IMPORT_C TBool HasAssociatedData() const;
170 IMPORT_C TBool HasOwningSession() const;
171 IMPORT_C TBool HasBecomeOrphaned() const;
175 IMPORT_C void Reset();
178 * Returns a writable version of the alarm's unique identifier.
180 * @return Reference to the unique identifier.
182 inline TAlarmId& Id() { return iAlarmId; }
185 * Return the alarm's unique identifier.
187 * @return The unique identifier.
189 inline TAlarmId Id() const { return iAlarmId; }
192 * The Secure ID is only used in the secured platform
195 // adds a SID to the alarms private field
196 inline void SetSid(const TSecureId& aSecureID) {iTASShdAlarmSID = aSecureID;}
198 // returns the SID of the alarm's creator
199 inline TSecureId GetSid() const {return iTASShdAlarmSID;}
202 * Returns a writable version of the next time the alarm is scheduled to expire.
204 * @return Next expiry time.
206 inline TTime& NextDueTime() { return iNextDueTime; }
209 * Returns the next time that the alarm is scheduled to expire.
211 * @return Next expiry time.
213 inline const TTime& NextDueTime() const { return iNextDueTime; }
216 * Returns a writable version of the alarm's original expiry time.
218 * @return Original expiry time.
220 inline TTime& OriginalExpiryTime() { return iOriginalExpiryTime; }
223 * Returns the alarm's original expiry time.
225 * The original expiry time is the same as the next due time, unless the alarm
226 * has been snoozed. In that case, the original expiry time is the time when
227 * the alarm first expired, and the next due time is when it is to re-awaken
230 * @return Original expiry time.
232 inline const TTime& OriginalExpiryTime() const { return iOriginalExpiryTime; }
235 * Returns a writable version of the alarm's category.
237 * Clients can use the category to tag each alarm with a specific code. This
238 * allows clients to identify all related alarms, such as all alarms associated
239 * with a particular application or application engine.
241 * @return Alarm category.
243 inline TAlarmCategory& Category() { return iCategory; }
246 * Return this alarm's category.
248 * @return Alarm category.
250 inline TAlarmCategory Category() const { return iCategory; }
253 * Returns a writable version of the alarm's characteristics.
255 * @return Alarm characteristics bit flags.
257 inline TAlarmCharacteristicsFlags& Characteristics() { return iCharacteristics; }
260 * Returns the alarm's characteristics
262 * @return Alarm characteristics bit flags.
264 inline TAlarmCharacteristicsFlags Characteristics() const { return iCharacteristics; }
267 * Returns a writable version of the alarm's repeat definition.
269 * The repeat definition controls the alarm's behaviour after it has expired.
270 * For example, you can set the repeat definition so that the server automatically
271 * queues the alarm to expire again in exactly 24 hours time.
273 * @return Alarm repeat definition.
275 inline TAlarmRepeatDefinition& RepeatDefinition() { return iRepeatDefinition; }
278 * Returns the repeat definition for the alarm.
280 * @return The alarm's repeat definition.
282 inline TAlarmRepeatDefinition RepeatDefinition() const { return iRepeatDefinition; }
285 * Returns a writable version of the alarm's message.
287 * The message is usually displayed in the application UI when the alarm expires.
289 * @return Reference to the alarm's associated message.
291 inline TAlarmMessage& Message() { return iMessage; }
294 * Returns the alarm's message.
296 * The message is usually displayed in the application UI when the alarm expires.
298 * @return Reference to the alarm's associated message.
300 inline const TAlarmMessage& Message() const { return iMessage; }
303 * Return a writable version of the alarm sound's filename.
305 * @return Reference to the alarm's sound filename.
307 inline TAlarmSoundName& SoundName() { return iSoundName; }
310 * Returns the alarm's sound filename.
312 * @return Sound filename.
314 inline const TAlarmSoundName& SoundName() const { return iSoundName; }
317 * Returns the alarm session type.
319 * @return Alarm session type.
321 inline TAlarmDayOrTimed DayOrTimed() const { return iDayOrTimed; }
324 * Returns a writable version of the alarm type, i.e. day, timed
326 * @return iDayOrTimed.
328 inline TAlarmDayOrTimed& DayOrTimed() { return iDayOrTimed; }
330 IMPORT_C void SetUtcNextDueTime(TTime aUtcTime);
331 IMPORT_C void SetDeQueueIfDueTimeInPast();
333 #ifdef SYMBIAN_SYSTEM_STATE_MANAGEMENT
334 IMPORT_C void SetWakeup(TBool aEnabled);
335 IMPORT_C TBool IsWakeup() const;
338 #ifdef SYMBIAN_ALARM_REPEAT_EXTENSIONS
339 IMPORT_C TInt SetAlarmDays(TUint8 aAlarmDays);
340 IMPORT_C TUint8 AlarmDays() const;
341 IMPORT_C void SetContinuous(TBool aContinuous);
342 IMPORT_C TBool Continuous();
346 // CLient Data Access
349 * Returns a writable version of the alarm's client flags.
351 * The client flags may be used for any client-specific data - the alarm server does not use them.
353 * @return Reference to the alarm's bit flags.
355 inline TBitFlags16& ClientFlags() { return iClientFlags; }
358 * Returns this alarm's client flags.
360 * @return Reference to the alarm's bit flags.
362 inline TBitFlags16 ClientFlags() const { return iClientFlags; }
365 * Returns the client data from slot 1 for this alarm.
367 * @return The first client-specific integer.
369 inline TInt ClientData1() const { return iClientData1; }
372 * Returns a writable version of the client data from slot 1 for this alarm.
374 * @return Reference to the first client-specific integer.
376 inline TInt& ClientData1() { return iClientData1; }
379 * Returns the client data from slot 2 for this alarm.
381 * @return The second client-specific integer.
383 inline TInt ClientData2() const { return iClientData2; }
386 * Returns the client data from slot 2 for this alarm.
388 * @return The second client-specific integer.
390 inline TInt& ClientData2() { return iClientData2; }
394 * Tests whether the alarm is floating.
396 * Floating alarms expire at a given wall-clock time regardless of the
397 * current locale and whether any daylight saving time rules are in force.
399 * @return True if the alarm is floating.
401 inline TBool IsFloating() const { return iCharacteristics.IsClear(EAlarmCharacteristicsIsFixed); }
406 #ifndef SYMBIAN_ENABLE_SPLIT_HEADERS
410 enum TASShdAlarmFlags
415 EASShdAlarmFlagsHasAssociatedData = 0,
420 EASShdAlarmFlagsHasOwningSession = 1,
425 EASShdAlarmFlagsHasBecomeOrphaned = 2,
428 * Set if alarm is disabled manually so that can not be enabled when locale changes.
432 EASShdAlarmFlagsPermanentDisabled = 4
437 #ifndef SYMBIAN_ENABLE_SPLIT_HEADERS
439 #ifdef SYMBIAN_SYSTEM_STATE_MANAGEMENT
443 enum TASShdAlarmFlags2
445 EASShdAlarmFlag2Wakeup = 0,
449 #ifdef SYMBIAN_ALARM_REPEAT_EXTENSIONS
453 enum TASShdAlarmFlags2AlarmRepeatExtensions
455 EASShdAlarmFlag2AlarmDayMonday = 1,
456 EASShdAlarmFlag2AlarmDayTuesday = 2,
457 EASShdAlarmFlag2AlarmDayWednesday = 3,
458 EASShdAlarmFlag2AlarmDayThursday = 4,
459 EASShdAlarmFlag2AlarmDayFriday = 5,
460 EASShdAlarmFlag2AlarmDaySaturday = 6,
461 EASShdAlarmFlag2AlarmDaySunday = 7,
462 EASShdAlarmFlag2Continuous = 8
466 #endif //SYMBIAN_ENABLE_SPLIT_HEADERS
472 * Various flags - used internally by the alarm object
477 * This represents the desired behaviour for a given alarm.
478 * The Alarm Server uses this information to control the
479 * behaviour of the alarm.
481 * @see TAlarmCharacteristics
483 TAlarmCharacteristicsFlags iCharacteristics;
486 * The unique identifier assoicated with each alarm maintained
487 * by the alarm world server.
492 * The status of this alarm (e.g. enabled, disabled)
494 TAlarmStatus iStatus;
497 * The state of this alarm (e.g. queued, notifying, notified, snoozed etc)
502 * The type of this alarm (e.g. day, timed)
504 TAlarmDayOrTimed iDayOrTimed;
507 * Controls how the alarm repeats after it has expired. Note that
508 * session alarms are not allowed to repeat (they must be "once
511 TAlarmRepeatDefinition iRepeatDefinition;
514 * This UID is supplied by the client and is used to indicate
515 * the category that this alarm is part of. The Alarm Server
516 * is category-agnostic, that is, this information is for
517 * the client's use only
519 TAlarmCategory iCategory;
522 * The date and time at which this alarm is next due. For alarms
523 * that haven't been snoozed, then this is the original due time.
525 * For alarms that have been snoozed, this is the time at which
526 * the alarm will reawaken.
531 * This attribute is only used in the instance whereby an alarm
532 * is snoozed. It represents the time at which the alarm first
535 TTime iOriginalExpiryTime;
538 * The message associated with this alarm, typically used
539 * in an application UI to inform the user as to the reason
542 TAlarmMessage iMessage;
545 * A descriptor which holds the name of the sound file which
546 * should be played when the alarm expires.
548 TAlarmSoundName iSoundName;
552 // Client Specific Data
555 * Flags for use by any particular client. These will
556 * only be relevant to a client who can interpret them.
558 TBitFlags16 iClientFlags;
561 * For arbitrary client data 1
566 * For arbitrary client data 2
571 // Binary Compatibility Proofing
572 TSecureId iTASShdAlarmSID;
574 #ifdef SYMBIAN_SYSTEM_STATE_MANAGEMENT
576 * Various flags - used internally by the alarm object
579 TUint16 iTASShdAlarm_2;
582 #ifdef SYMBIAN_ALARM_REPEAT_EXTENSIONS
584 * Various flags - used internally by the alarm object
587 TUint16 iTASShdAlarm_2;
589 TAny* iTASShdAlarm_2;
592 TAny* iTASShdAlarm_3;
595 #endif // #ifndef __ASSHDALARM_H__