os/ossrv/genericservices/taskscheduler/INC/SCHINFO.H
author sl
Tue, 10 Jun 2014 14:32:02 +0200
changeset 1 260cb5ec6c19
permissions -rw-r--r--
Update contrib.
sl@0
     1
// Copyright (c) 2004-2009 Nokia Corporation and/or its subsidiary(-ies).
sl@0
     2
// All rights reserved.
sl@0
     3
// This component and the accompanying materials are made available
sl@0
     4
// under the terms of "Eclipse Public License v1.0"
sl@0
     5
// which accompanies this distribution, and is available
sl@0
     6
// at the URL "http://www.eclipse.org/legal/epl-v10.html".
sl@0
     7
//
sl@0
     8
// Initial Contributors:
sl@0
     9
// Nokia Corporation - initial contribution.
sl@0
    10
//
sl@0
    11
// Contributors:
sl@0
    12
//
sl@0
    13
// Description:
sl@0
    14
// Various T-classes for client input to scheduler, scheduler output to client	
sl@0
    15
// These classes comprise part of the interface (the rest is defined in RScheduler)
sl@0
    16
// 
sl@0
    17
//
sl@0
    18
sl@0
    19
#if !defined (__SCHINFO_H__)
sl@0
    20
#define __SCHINFO_H__
sl@0
    21
sl@0
    22
#if !defined (__SCHTIME_H__)
sl@0
    23
#include <schtime.h>
sl@0
    24
#endif
sl@0
    25
sl@0
    26
#if !defined(__E32BASE_H__)
sl@0
    27
#include <e32base.h>
sl@0
    28
#endif
sl@0
    29
sl@0
    30
#include <s32strm.h>
sl@0
    31
sl@0
    32
sl@0
    33
sl@0
    34
/** 
sl@0
    35
Contains detailed information for a single task.
sl@0
    36
sl@0
    37
A schedule can have any number of tasks. An object of this type is passed 
sl@0
    38
to RScheduler::ScheduleTask(). Objects of this type are also returned by functions 
sl@0
    39
within RScheduler that retrieve information about tasks.
sl@0
    40
sl@0
    41
@see RScheduler::ScheduleTask()
sl@0
    42
@see RScheduler::GetScheduleL()
sl@0
    43
@see RScheduler::GetTaskInfoL() 
sl@0
    44
@publishedAll
sl@0
    45
@released
sl@0
    46
*/
sl@0
    47
class TTaskInfo
sl@0
    48
	{
sl@0
    49
public:
sl@0
    50
	//ctors
sl@0
    51
	IMPORT_C TTaskInfo (TInt aTaskId, TName& aName, TInt aPriority, TInt aRepeat);
sl@0
    52
	IMPORT_C TTaskInfo();//
sl@0
    53
	//assignment
sl@0
    54
	IMPORT_C TTaskInfo& operator=(const TTaskInfo& aTaskInfo);
sl@0
    55
	IMPORT_C void ExternalizeL(RWriteStream& aStream) const;
sl@0
    56
	IMPORT_C void InternalizeL(RReadStream& aStream);
sl@0
    57
	//needs a copy ctor
sl@0
    58
	//TTaskInfo (TTaskInfo& aTaskInfo);
sl@0
    59
	
sl@0
    60
	//data
sl@0
    61
	/** Specifies how often the task is to be repeated.
sl@0
    62
	
sl@0
    63
	This is defined by the client.
sl@0
    64
	
sl@0
    65
	A value of 1 means once, a value of 2 means twice etc.
sl@0
    66
	
sl@0
    67
	Note that zero is interpreted to mean once, and a negative value is interpreted 
sl@0
    68
	to mean that the task will be repeated until it is explicitly deleted. */
sl@0
    69
	TInt iRepeat;
sl@0
    70
	
sl@0
    71
	/** The unique Id for the task.
sl@0
    72
	
sl@0
    73
	This is generated by the Task Scheduler. Clients should use the generated 
sl@0
    74
	Id to refer to the task in future transactions. */
sl@0
    75
	TInt iTaskId;
sl@0
    76
	
sl@0
    77
	/** The name of the task.
sl@0
    78
	
sl@0
    79
	This is defined by the client.
sl@0
    80
	
sl@0
    81
	@see TName */
sl@0
    82
	TName iName;
sl@0
    83
	
sl@0
    84
	/** The priority of the task.
sl@0
    85
	
sl@0
    86
	This is defined by the client.
sl@0
    87
	
sl@0
    88
	Determines the order in which a client's tasks are executed. Where a client 
sl@0
    89
	has two tasks with different priorities, the task with the higher priority 
sl@0
    90
	will be executed first. */
sl@0
    91
	TInt iPriority;
sl@0
    92
	};
sl@0
    93
sl@0
    94
/** 
sl@0
    95
Defines a filter to be used when listing tasks scheduled in a call to RScheduler::GetTaskRefsL().
sl@0
    96
sl@0
    97
@see RScheduler::GetTaskRefsL()
sl@0
    98
@publishedAll
sl@0
    99
@released
sl@0
   100
*/
sl@0
   101
enum TTaskFilter
sl@0
   102
	{
sl@0
   103
	/** Indicates that all tasks are to be selected. */
sl@0
   104
	EAllTasks,
sl@0
   105
	/** Indicates those tasks associated with the executing program with which the 
sl@0
   106
	calling client is associated, are to be selected. */
sl@0
   107
	EMyTasks
sl@0
   108
	};
sl@0
   109
sl@0
   110
sl@0
   111
/** 
sl@0
   112
Defines a filter to be used when listing schedules in a call to RScheduler::GetScheduleRefsL(), 
sl@0
   113
and when listing tasks in a call to RScheduler::GetTaskRefsL().
sl@0
   114
sl@0
   115
@see RScheduler::GetScheduleRefsL()
sl@0
   116
@see RScheduler::GetTaskRefsL() 
sl@0
   117
@publishedAll
sl@0
   118
@released
sl@0
   119
*/
sl@0
   120
enum TScheduleFilter
sl@0
   121
	{
sl@0
   122
	/** Indicates that all schedules are to be selected. */
sl@0
   123
	EAllSchedules,
sl@0
   124
	/** Indicates that only pending schedules are to be selected.
sl@0
   125
	
sl@0
   126
	Note that pending schedules are those that are enabled and have tasks associated 
sl@0
   127
	with them. */
sl@0
   128
	EPendingSchedules
sl@0
   129
	};
sl@0
   130
sl@0
   131
/** 
sl@0
   132
Defines the type of interval used by a schedule entry.
sl@0
   133
sl@0
   134
@see TScheduleEntryInfo
sl@0
   135
@publishedAll
sl@0
   136
@released
sl@0
   137
*/
sl@0
   138
enum TIntervalType
sl@0
   139
	{
sl@0
   140
	/** The interval is based on hours. */
sl@0
   141
	EHourly,
sl@0
   142
	/** The interval is based on days. */
sl@0
   143
	EDaily,
sl@0
   144
	/** The interval is based on months. */
sl@0
   145
	EMonthly,
sl@0
   146
	/** The interval is based on years. */
sl@0
   147
	EYearly
sl@0
   148
	};
sl@0
   149
sl@0
   150
sl@0
   151
/**
sl@0
   152
Defines the types of schedules supported by the task scheduler API
sl@0
   153
@internalAll
sl@0
   154
*/
sl@0
   155
// Not for Client use , only to be used internally 
sl@0
   156
enum TScheduleType
sl@0
   157
	{
sl@0
   158
	/** Indicates a time based schedule. */
sl@0
   159
	ETimeSchedule,
sl@0
   160
	/** Indicates a conditon based schedule. */
sl@0
   161
	EConditionSchedule
sl@0
   162
	};
sl@0
   163
sl@0
   164
	
sl@0
   165
/** 
sl@0
   166
Defines, and uniquely identifies a schedule.
sl@0
   167
sl@0
   168
@see RScheduler::CreatePersistentSchedule()
sl@0
   169
@see RScheduler::ScheduleTask()
sl@0
   170
@see RScheduler::GetScheduleRefsL()
sl@0
   171
@see RScheduler::GetTaskRefsL()
sl@0
   172
@see RScheduler::GetTaskInfoL()
sl@0
   173
@publishedAll
sl@0
   174
@released
sl@0
   175
*/
sl@0
   176
class TSchedulerItemRef
sl@0
   177
	{
sl@0
   178
public:
sl@0
   179
	/** The unique Id for the schedule.
sl@0
   180
	
sl@0
   181
	This is generated by the Task Scheduler when the schedule is created. Clients 
sl@0
   182
	should use this Id to refer to the schedule in future transactions. */
sl@0
   183
	TInt iHandle;
sl@0
   184
	
sl@0
   185
	/** The name of the schedule.
sl@0
   186
	
sl@0
   187
	This is defined by the client. */
sl@0
   188
	TName iName;
sl@0
   189
	};
sl@0
   190
sl@0
   191
/** 
sl@0
   192
Contains detailed information for a single schedule entry.
sl@0
   193
sl@0
   194
A schedule can have any number of schedule entries. A client passes one or 
sl@0
   195
more of these objects, contained within an array, to the RScheduler functions 
sl@0
   196
that create or amend a schedule.
sl@0
   197
sl@0
   198
@see RScheduler::CreatePersistentSchedule()
sl@0
   199
@see RScheduler::EditSchedule()
sl@0
   200
@see RScheduler::ScheduleTask()
sl@0
   201
@see RScheduler::GetScheduleL() 
sl@0
   202
@publishedAll
sl@0
   203
@deprecated and replaced by TScheduleEntryInfo2
sl@0
   204
*/
sl@0
   205
class TScheduleEntryInfo
sl@0
   206
	{
sl@0
   207
public:
sl@0
   208
	void ExternalizeL(RWriteStream& aStream) const;
sl@0
   209
	void InternalizeL(RReadStream& aStream);
sl@0
   210
sl@0
   211
	/** Defines the type of time-frame relative to which execution of tasks is timed; 
sl@0
   212
	for example, EHourly implies relative to the current hour, EDaily implies 
sl@0
   213
	relative to the current day.
sl@0
   214
	
sl@0
   215
	@see TIntervalType */
sl@0
   216
	TIntervalType iIntervalType;
sl@0
   217
	
sl@0
   218
	/** The first time that the entry will cause execution of tasks. */
sl@0
   219
	TTime iStartTime;
sl@0
   220
	
sl@0
   221
	/** The interval between execution of tasks.
sl@0
   222
	
sl@0
   223
	The way that this value is interpreted depends on the value of iIntervalType. 
sl@0
   224
	For example, if the interval is 2 and iIntervalType has a value of EMonthly, 
sl@0
   225
	then the interval is 2 months.
sl@0
   226
	
sl@0
   227
	The interval must have a minimum value of 1.
sl@0
   228
	
sl@0
   229
	@see TIntervalType
sl@0
   230
	@see iIntervalType */
sl@0
   231
	TInt iInterval;
sl@0
   232
	
sl@0
   233
	/** The period for which the entry is valid.
sl@0
   234
	
sl@0
   235
	After the validity period has expired, tasks associated with the entry will 
sl@0
   236
	not be eligible for execution.
sl@0
   237
	
sl@0
   238
	@see TTimeIntervalMinutes */
sl@0
   239
	TTimeIntervalMinutes iValidityPeriod;
sl@0
   240
	};
sl@0
   241
	
sl@0
   242
	
sl@0
   243
	
sl@0
   244
/** 
sl@0
   245
Contains detailed information for a single schedule entry.
sl@0
   246
sl@0
   247
A schedule can have any number of schedule entries. A client passes one or 
sl@0
   248
more of these objects, contained within an array, to the RScheduler functions 
sl@0
   249
that create or amend a schedule.
sl@0
   250
sl@0
   251
@see RScheduler::CreatePersistentSchedule()
sl@0
   252
@see RScheduler::EditSchedule()
sl@0
   253
@see RScheduler::ScheduleTask()
sl@0
   254
@see RScheduler::GetScheduleL() 
sl@0
   255
@publishedAll
sl@0
   256
@released
sl@0
   257
*/
sl@0
   258
class TScheduleEntryInfo2
sl@0
   259
	{
sl@0
   260
public:
sl@0
   261
	//constructors
sl@0
   262
	IMPORT_C TScheduleEntryInfo2();
sl@0
   263
	IMPORT_C TScheduleEntryInfo2(const TScheduleEntryInfo2& aEntryInfo);
sl@0
   264
	IMPORT_C TScheduleEntryInfo2(const TTsTime& aStartTime, TIntervalType aIntervalType, TInt aInterval, TTimeIntervalMinutes aValidityPeriod);
sl@0
   265
	 
sl@0
   266
	//utility Get and Set methods
sl@0
   267
	IMPORT_C TIntervalType IntervalType() const;
sl@0
   268
	IMPORT_C void SetIntervalType(TIntervalType aIntervalType);
sl@0
   269
sl@0
   270
	IMPORT_C const TTsTime& StartTime() const;
sl@0
   271
	IMPORT_C void SetStartTime(const TTsTime& aStartTime);
sl@0
   272
sl@0
   273
	IMPORT_C TInt Interval() const;
sl@0
   274
	IMPORT_C void SetInterval(TInt aInterval);
sl@0
   275
sl@0
   276
	IMPORT_C TTimeIntervalMinutes ValidityPeriod() const;
sl@0
   277
	IMPORT_C void SetValidityPeriod(TTimeIntervalMinutes aValidityPeriod);
sl@0
   278
sl@0
   279
	//assignment operator	
sl@0
   280
	IMPORT_C TScheduleEntryInfo2& operator=(const TScheduleEntryInfo2& aEntryInfo);
sl@0
   281
sl@0
   282
sl@0
   283
public:
sl@0
   284
	// APIs for use within the Task Scheduler server
sl@0
   285
	TScheduleEntryInfo2(const TScheduleEntryInfo& aEntryInfo);
sl@0
   286
	void ProcessOffsetEvent();
sl@0
   287
sl@0
   288
	void ExternalizeL(RWriteStream& aStream) const;
sl@0
   289
	void InternalizeL(RReadStream& aStream);
sl@0
   290
sl@0
   291
private:
sl@0
   292
	/** The interval between execution of tasks.
sl@0
   293
	The way that this value is interpreted depends on the value of iIntervalType. 
sl@0
   294
	For example, if the interval is 2 and iIntervalType has a value of EMonthly, 
sl@0
   295
	then the interval is 2 months.
sl@0
   296
	The interval must have a minimum value of 1.
sl@0
   297
	 */
sl@0
   298
	TInt iInterval;
sl@0
   299
	
sl@0
   300
	/** Defines the type of interval between the execution of tasks. 
sl@0
   301
	May be EHourly, EDaily, EMonthly or EYearly.
sl@0
   302
	 */
sl@0
   303
	TIntervalType iIntervalType;
sl@0
   304
	
sl@0
   305
	/** The first time that the entry will cause execution of tasks. */
sl@0
   306
	TTsTime iStartTime;
sl@0
   307
	
sl@0
   308
	/** The period for which the entry is valid.
sl@0
   309
	After the validity period has expired, tasks associated with the entry will 
sl@0
   310
	not be eligible for execution.
sl@0
   311
	*/
sl@0
   312
	TTimeIntervalMinutes iValidityPeriod;
sl@0
   313
sl@0
   314
	/** For future use
sl@0
   315
	*/
sl@0
   316
	TAny* iReserved;	
sl@0
   317
	
sl@0
   318
	// Declare the test accessor as a friend
sl@0
   319
	friend class TScheduleEntryInfo2_StateAccessor;
sl@0
   320
	};
sl@0
   321
sl@0
   322
sl@0
   323
/** 
sl@0
   324
Defines the state of a schedule.
sl@0
   325
sl@0
   326
An object of this type is passed to, and populated by, a call to RScheduler::GetScheduleL().
sl@0
   327
sl@0
   328
@see RScheduler::GetScheduleL()
sl@0
   329
@publishedAll
sl@0
   330
@released
sl@0
   331
*/
sl@0
   332
class TScheduleState2
sl@0
   333
	{
sl@0
   334
public:
sl@0
   335
sl@0
   336
	//constructors
sl@0
   337
	IMPORT_C TScheduleState2();
sl@0
   338
	IMPORT_C TScheduleState2(const TScheduleState2& aScheduleState);
sl@0
   339
	IMPORT_C TScheduleState2(const TName& aName, const TTsTime& aDueTime, TBool aPersists, TBool aEnabled);
sl@0
   340
		
sl@0
   341
	//get, set methods
sl@0
   342
	IMPORT_C const TName& Name() const;
sl@0
   343
	IMPORT_C void SetName(const TName& aName);
sl@0
   344
sl@0
   345
	IMPORT_C const TTsTime& DueTime() const;
sl@0
   346
	IMPORT_C void SetDueTime(const TTsTime& aDueTime);
sl@0
   347
sl@0
   348
	IMPORT_C TBool Persists() const;
sl@0
   349
	IMPORT_C void SetPersists(TBool aPersists);
sl@0
   350
sl@0
   351
	IMPORT_C TBool Enabled() const;
sl@0
   352
	IMPORT_C void SetEnabled(TBool aEnabled);
sl@0
   353
	
sl@0
   354
	IMPORT_C TScheduleState2& operator=(const TScheduleState2& aScheduleState);
sl@0
   355
sl@0
   356
private:
sl@0
   357
	/** The name of the schedule. */
sl@0
   358
	TName iName;
sl@0
   359
	
sl@0
   360
	/** The time when the schedule is next due.
sl@0
   361
	This only has meaning if the schedule is pending, i.e. it is enabled and has 
sl@0
   362
	tasks associated with it. */
sl@0
   363
	TTsTime iDueTime;
sl@0
   364
	
sl@0
   365
	/** Flags used to indicate:
sl@0
   366
	1.  Whether the schedule is enabled or not. (bit 0)
sl@0
   367
	2.	Whether the schedule is persistent or not. (bit 1)
sl@0
   368
		If a schedule is persistent, its lifetime is not limited to the lifetime of 
sl@0
   369
		the tasks associated with it .
sl@0
   370
		If a schedule is transient, it is created together with a new scheduled task, 
sl@0
   371
		and is destroyed when the task is destroyed.
sl@0
   372
		
sl@0
   373
		Bits 2-31 reserved for future use
sl@0
   374
	*/
sl@0
   375
	TUint32 iFlags;
sl@0
   376
	
sl@0
   377
	/** For future use
sl@0
   378
	*/
sl@0
   379
	TAny* iReserved;
sl@0
   380
	
sl@0
   381
	// Declare the test accessor as a friend
sl@0
   382
	friend class TScheduleState2_StateAccessor;
sl@0
   383
	};
sl@0
   384
sl@0
   385
/** 
sl@0
   386
Defines the state of a schedule.
sl@0
   387
sl@0
   388
An object of this type is passed to, and populated by, a call to RScheduler::GetScheduleL().
sl@0
   389
sl@0
   390
@see RScheduler::GetScheduleL()
sl@0
   391
@publishedAll
sl@0
   392
@deprecated and replaced by TScheduleState2.
sl@0
   393
*/
sl@0
   394
class TScheduleState
sl@0
   395
	{
sl@0
   396
public:
sl@0
   397
	//constructor for use with the deprecated APIs
sl@0
   398
	TScheduleState(const TScheduleState2& aScheduleState2);
sl@0
   399
	TScheduleState()
sl@0
   400
		{		
sl@0
   401
		}
sl@0
   402
	
sl@0
   403
	/** The name of the schedule. */
sl@0
   404
	TName iName;
sl@0
   405
	
sl@0
   406
	/** The time when the schedule is next due.
sl@0
   407
	
sl@0
   408
	This only has meaning if the schedule is pending, i.e. it is enabled and has 
sl@0
   409
	tasks associated with it. */
sl@0
   410
	TTime iDueTime;
sl@0
   411
	
sl@0
   412
	/** Indicates whether the schedule is persistent or not.
sl@0
   413
	
sl@0
   414
	If a schedule is persistent, its lifetime is not limited to the lifetime of 
sl@0
   415
	the tasks associated with it .
sl@0
   416
	
sl@0
   417
	If a schedule is transient, it is created together with a new scheduled task, 
sl@0
   418
	and is destroyed when the task is destroyed. */
sl@0
   419
	TBool iPersists;
sl@0
   420
	
sl@0
   421
	/** Indicates whether the schedule is enabled or not. */
sl@0
   422
	TBool iEnabled;
sl@0
   423
	};
sl@0
   424
sl@0
   425
#ifndef SYMBIAN_ENABLE_SPLIT_HEADERS
sl@0
   426
#include <schinfointernal.h>
sl@0
   427
sl@0
   428
#endif
sl@0
   429
sl@0
   430
#endif