1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
1.2 +++ b/os/ossrv/genericservices/taskscheduler/INC/SCHINFO.H Fri Jun 15 03:10:57 2012 +0200
1.3 @@ -0,0 +1,430 @@
1.4 +// Copyright (c) 2004-2009 Nokia Corporation and/or its subsidiary(-ies).
1.5 +// All rights reserved.
1.6 +// This component and the accompanying materials are made available
1.7 +// under the terms of "Eclipse Public License v1.0"
1.8 +// which accompanies this distribution, and is available
1.9 +// at the URL "http://www.eclipse.org/legal/epl-v10.html".
1.10 +//
1.11 +// Initial Contributors:
1.12 +// Nokia Corporation - initial contribution.
1.13 +//
1.14 +// Contributors:
1.15 +//
1.16 +// Description:
1.17 +// Various T-classes for client input to scheduler, scheduler output to client
1.18 +// These classes comprise part of the interface (the rest is defined in RScheduler)
1.19 +//
1.20 +//
1.21 +
1.22 +#if !defined (__SCHINFO_H__)
1.23 +#define __SCHINFO_H__
1.24 +
1.25 +#if !defined (__SCHTIME_H__)
1.26 +#include <schtime.h>
1.27 +#endif
1.28 +
1.29 +#if !defined(__E32BASE_H__)
1.30 +#include <e32base.h>
1.31 +#endif
1.32 +
1.33 +#include <s32strm.h>
1.34 +
1.35 +
1.36 +
1.37 +/**
1.38 +Contains detailed information for a single task.
1.39 +
1.40 +A schedule can have any number of tasks. An object of this type is passed
1.41 +to RScheduler::ScheduleTask(). Objects of this type are also returned by functions
1.42 +within RScheduler that retrieve information about tasks.
1.43 +
1.44 +@see RScheduler::ScheduleTask()
1.45 +@see RScheduler::GetScheduleL()
1.46 +@see RScheduler::GetTaskInfoL()
1.47 +@publishedAll
1.48 +@released
1.49 +*/
1.50 +class TTaskInfo
1.51 + {
1.52 +public:
1.53 + //ctors
1.54 + IMPORT_C TTaskInfo (TInt aTaskId, TName& aName, TInt aPriority, TInt aRepeat);
1.55 + IMPORT_C TTaskInfo();//
1.56 + //assignment
1.57 + IMPORT_C TTaskInfo& operator=(const TTaskInfo& aTaskInfo);
1.58 + IMPORT_C void ExternalizeL(RWriteStream& aStream) const;
1.59 + IMPORT_C void InternalizeL(RReadStream& aStream);
1.60 + //needs a copy ctor
1.61 + //TTaskInfo (TTaskInfo& aTaskInfo);
1.62 +
1.63 + //data
1.64 + /** Specifies how often the task is to be repeated.
1.65 +
1.66 + This is defined by the client.
1.67 +
1.68 + A value of 1 means once, a value of 2 means twice etc.
1.69 +
1.70 + Note that zero is interpreted to mean once, and a negative value is interpreted
1.71 + to mean that the task will be repeated until it is explicitly deleted. */
1.72 + TInt iRepeat;
1.73 +
1.74 + /** The unique Id for the task.
1.75 +
1.76 + This is generated by the Task Scheduler. Clients should use the generated
1.77 + Id to refer to the task in future transactions. */
1.78 + TInt iTaskId;
1.79 +
1.80 + /** The name of the task.
1.81 +
1.82 + This is defined by the client.
1.83 +
1.84 + @see TName */
1.85 + TName iName;
1.86 +
1.87 + /** The priority of the task.
1.88 +
1.89 + This is defined by the client.
1.90 +
1.91 + Determines the order in which a client's tasks are executed. Where a client
1.92 + has two tasks with different priorities, the task with the higher priority
1.93 + will be executed first. */
1.94 + TInt iPriority;
1.95 + };
1.96 +
1.97 +/**
1.98 +Defines a filter to be used when listing tasks scheduled in a call to RScheduler::GetTaskRefsL().
1.99 +
1.100 +@see RScheduler::GetTaskRefsL()
1.101 +@publishedAll
1.102 +@released
1.103 +*/
1.104 +enum TTaskFilter
1.105 + {
1.106 + /** Indicates that all tasks are to be selected. */
1.107 + EAllTasks,
1.108 + /** Indicates those tasks associated with the executing program with which the
1.109 + calling client is associated, are to be selected. */
1.110 + EMyTasks
1.111 + };
1.112 +
1.113 +
1.114 +/**
1.115 +Defines a filter to be used when listing schedules in a call to RScheduler::GetScheduleRefsL(),
1.116 +and when listing tasks in a call to RScheduler::GetTaskRefsL().
1.117 +
1.118 +@see RScheduler::GetScheduleRefsL()
1.119 +@see RScheduler::GetTaskRefsL()
1.120 +@publishedAll
1.121 +@released
1.122 +*/
1.123 +enum TScheduleFilter
1.124 + {
1.125 + /** Indicates that all schedules are to be selected. */
1.126 + EAllSchedules,
1.127 + /** Indicates that only pending schedules are to be selected.
1.128 +
1.129 + Note that pending schedules are those that are enabled and have tasks associated
1.130 + with them. */
1.131 + EPendingSchedules
1.132 + };
1.133 +
1.134 +/**
1.135 +Defines the type of interval used by a schedule entry.
1.136 +
1.137 +@see TScheduleEntryInfo
1.138 +@publishedAll
1.139 +@released
1.140 +*/
1.141 +enum TIntervalType
1.142 + {
1.143 + /** The interval is based on hours. */
1.144 + EHourly,
1.145 + /** The interval is based on days. */
1.146 + EDaily,
1.147 + /** The interval is based on months. */
1.148 + EMonthly,
1.149 + /** The interval is based on years. */
1.150 + EYearly
1.151 + };
1.152 +
1.153 +
1.154 +/**
1.155 +Defines the types of schedules supported by the task scheduler API
1.156 +@internalAll
1.157 +*/
1.158 +// Not for Client use , only to be used internally
1.159 +enum TScheduleType
1.160 + {
1.161 + /** Indicates a time based schedule. */
1.162 + ETimeSchedule,
1.163 + /** Indicates a conditon based schedule. */
1.164 + EConditionSchedule
1.165 + };
1.166 +
1.167 +
1.168 +/**
1.169 +Defines, and uniquely identifies a schedule.
1.170 +
1.171 +@see RScheduler::CreatePersistentSchedule()
1.172 +@see RScheduler::ScheduleTask()
1.173 +@see RScheduler::GetScheduleRefsL()
1.174 +@see RScheduler::GetTaskRefsL()
1.175 +@see RScheduler::GetTaskInfoL()
1.176 +@publishedAll
1.177 +@released
1.178 +*/
1.179 +class TSchedulerItemRef
1.180 + {
1.181 +public:
1.182 + /** The unique Id for the schedule.
1.183 +
1.184 + This is generated by the Task Scheduler when the schedule is created. Clients
1.185 + should use this Id to refer to the schedule in future transactions. */
1.186 + TInt iHandle;
1.187 +
1.188 + /** The name of the schedule.
1.189 +
1.190 + This is defined by the client. */
1.191 + TName iName;
1.192 + };
1.193 +
1.194 +/**
1.195 +Contains detailed information for a single schedule entry.
1.196 +
1.197 +A schedule can have any number of schedule entries. A client passes one or
1.198 +more of these objects, contained within an array, to the RScheduler functions
1.199 +that create or amend a schedule.
1.200 +
1.201 +@see RScheduler::CreatePersistentSchedule()
1.202 +@see RScheduler::EditSchedule()
1.203 +@see RScheduler::ScheduleTask()
1.204 +@see RScheduler::GetScheduleL()
1.205 +@publishedAll
1.206 +@deprecated and replaced by TScheduleEntryInfo2
1.207 +*/
1.208 +class TScheduleEntryInfo
1.209 + {
1.210 +public:
1.211 + void ExternalizeL(RWriteStream& aStream) const;
1.212 + void InternalizeL(RReadStream& aStream);
1.213 +
1.214 + /** Defines the type of time-frame relative to which execution of tasks is timed;
1.215 + for example, EHourly implies relative to the current hour, EDaily implies
1.216 + relative to the current day.
1.217 +
1.218 + @see TIntervalType */
1.219 + TIntervalType iIntervalType;
1.220 +
1.221 + /** The first time that the entry will cause execution of tasks. */
1.222 + TTime iStartTime;
1.223 +
1.224 + /** The interval between execution of tasks.
1.225 +
1.226 + The way that this value is interpreted depends on the value of iIntervalType.
1.227 + For example, if the interval is 2 and iIntervalType has a value of EMonthly,
1.228 + then the interval is 2 months.
1.229 +
1.230 + The interval must have a minimum value of 1.
1.231 +
1.232 + @see TIntervalType
1.233 + @see iIntervalType */
1.234 + TInt iInterval;
1.235 +
1.236 + /** The period for which the entry is valid.
1.237 +
1.238 + After the validity period has expired, tasks associated with the entry will
1.239 + not be eligible for execution.
1.240 +
1.241 + @see TTimeIntervalMinutes */
1.242 + TTimeIntervalMinutes iValidityPeriod;
1.243 + };
1.244 +
1.245 +
1.246 +
1.247 +/**
1.248 +Contains detailed information for a single schedule entry.
1.249 +
1.250 +A schedule can have any number of schedule entries. A client passes one or
1.251 +more of these objects, contained within an array, to the RScheduler functions
1.252 +that create or amend a schedule.
1.253 +
1.254 +@see RScheduler::CreatePersistentSchedule()
1.255 +@see RScheduler::EditSchedule()
1.256 +@see RScheduler::ScheduleTask()
1.257 +@see RScheduler::GetScheduleL()
1.258 +@publishedAll
1.259 +@released
1.260 +*/
1.261 +class TScheduleEntryInfo2
1.262 + {
1.263 +public:
1.264 + //constructors
1.265 + IMPORT_C TScheduleEntryInfo2();
1.266 + IMPORT_C TScheduleEntryInfo2(const TScheduleEntryInfo2& aEntryInfo);
1.267 + IMPORT_C TScheduleEntryInfo2(const TTsTime& aStartTime, TIntervalType aIntervalType, TInt aInterval, TTimeIntervalMinutes aValidityPeriod);
1.268 +
1.269 + //utility Get and Set methods
1.270 + IMPORT_C TIntervalType IntervalType() const;
1.271 + IMPORT_C void SetIntervalType(TIntervalType aIntervalType);
1.272 +
1.273 + IMPORT_C const TTsTime& StartTime() const;
1.274 + IMPORT_C void SetStartTime(const TTsTime& aStartTime);
1.275 +
1.276 + IMPORT_C TInt Interval() const;
1.277 + IMPORT_C void SetInterval(TInt aInterval);
1.278 +
1.279 + IMPORT_C TTimeIntervalMinutes ValidityPeriod() const;
1.280 + IMPORT_C void SetValidityPeriod(TTimeIntervalMinutes aValidityPeriod);
1.281 +
1.282 + //assignment operator
1.283 + IMPORT_C TScheduleEntryInfo2& operator=(const TScheduleEntryInfo2& aEntryInfo);
1.284 +
1.285 +
1.286 +public:
1.287 + // APIs for use within the Task Scheduler server
1.288 + TScheduleEntryInfo2(const TScheduleEntryInfo& aEntryInfo);
1.289 + void ProcessOffsetEvent();
1.290 +
1.291 + void ExternalizeL(RWriteStream& aStream) const;
1.292 + void InternalizeL(RReadStream& aStream);
1.293 +
1.294 +private:
1.295 + /** The interval between execution of tasks.
1.296 + The way that this value is interpreted depends on the value of iIntervalType.
1.297 + For example, if the interval is 2 and iIntervalType has a value of EMonthly,
1.298 + then the interval is 2 months.
1.299 + The interval must have a minimum value of 1.
1.300 + */
1.301 + TInt iInterval;
1.302 +
1.303 + /** Defines the type of interval between the execution of tasks.
1.304 + May be EHourly, EDaily, EMonthly or EYearly.
1.305 + */
1.306 + TIntervalType iIntervalType;
1.307 +
1.308 + /** The first time that the entry will cause execution of tasks. */
1.309 + TTsTime iStartTime;
1.310 +
1.311 + /** The period for which the entry is valid.
1.312 + After the validity period has expired, tasks associated with the entry will
1.313 + not be eligible for execution.
1.314 + */
1.315 + TTimeIntervalMinutes iValidityPeriod;
1.316 +
1.317 + /** For future use
1.318 + */
1.319 + TAny* iReserved;
1.320 +
1.321 + // Declare the test accessor as a friend
1.322 + friend class TScheduleEntryInfo2_StateAccessor;
1.323 + };
1.324 +
1.325 +
1.326 +/**
1.327 +Defines the state of a schedule.
1.328 +
1.329 +An object of this type is passed to, and populated by, a call to RScheduler::GetScheduleL().
1.330 +
1.331 +@see RScheduler::GetScheduleL()
1.332 +@publishedAll
1.333 +@released
1.334 +*/
1.335 +class TScheduleState2
1.336 + {
1.337 +public:
1.338 +
1.339 + //constructors
1.340 + IMPORT_C TScheduleState2();
1.341 + IMPORT_C TScheduleState2(const TScheduleState2& aScheduleState);
1.342 + IMPORT_C TScheduleState2(const TName& aName, const TTsTime& aDueTime, TBool aPersists, TBool aEnabled);
1.343 +
1.344 + //get, set methods
1.345 + IMPORT_C const TName& Name() const;
1.346 + IMPORT_C void SetName(const TName& aName);
1.347 +
1.348 + IMPORT_C const TTsTime& DueTime() const;
1.349 + IMPORT_C void SetDueTime(const TTsTime& aDueTime);
1.350 +
1.351 + IMPORT_C TBool Persists() const;
1.352 + IMPORT_C void SetPersists(TBool aPersists);
1.353 +
1.354 + IMPORT_C TBool Enabled() const;
1.355 + IMPORT_C void SetEnabled(TBool aEnabled);
1.356 +
1.357 + IMPORT_C TScheduleState2& operator=(const TScheduleState2& aScheduleState);
1.358 +
1.359 +private:
1.360 + /** The name of the schedule. */
1.361 + TName iName;
1.362 +
1.363 + /** The time when the schedule is next due.
1.364 + This only has meaning if the schedule is pending, i.e. it is enabled and has
1.365 + tasks associated with it. */
1.366 + TTsTime iDueTime;
1.367 +
1.368 + /** Flags used to indicate:
1.369 + 1. Whether the schedule is enabled or not. (bit 0)
1.370 + 2. Whether the schedule is persistent or not. (bit 1)
1.371 + If a schedule is persistent, its lifetime is not limited to the lifetime of
1.372 + the tasks associated with it .
1.373 + If a schedule is transient, it is created together with a new scheduled task,
1.374 + and is destroyed when the task is destroyed.
1.375 +
1.376 + Bits 2-31 reserved for future use
1.377 + */
1.378 + TUint32 iFlags;
1.379 +
1.380 + /** For future use
1.381 + */
1.382 + TAny* iReserved;
1.383 +
1.384 + // Declare the test accessor as a friend
1.385 + friend class TScheduleState2_StateAccessor;
1.386 + };
1.387 +
1.388 +/**
1.389 +Defines the state of a schedule.
1.390 +
1.391 +An object of this type is passed to, and populated by, a call to RScheduler::GetScheduleL().
1.392 +
1.393 +@see RScheduler::GetScheduleL()
1.394 +@publishedAll
1.395 +@deprecated and replaced by TScheduleState2.
1.396 +*/
1.397 +class TScheduleState
1.398 + {
1.399 +public:
1.400 + //constructor for use with the deprecated APIs
1.401 + TScheduleState(const TScheduleState2& aScheduleState2);
1.402 + TScheduleState()
1.403 + {
1.404 + }
1.405 +
1.406 + /** The name of the schedule. */
1.407 + TName iName;
1.408 +
1.409 + /** The time when the schedule is next due.
1.410 +
1.411 + This only has meaning if the schedule is pending, i.e. it is enabled and has
1.412 + tasks associated with it. */
1.413 + TTime iDueTime;
1.414 +
1.415 + /** Indicates whether the schedule is persistent or not.
1.416 +
1.417 + If a schedule is persistent, its lifetime is not limited to the lifetime of
1.418 + the tasks associated with it .
1.419 +
1.420 + If a schedule is transient, it is created together with a new scheduled task,
1.421 + and is destroyed when the task is destroyed. */
1.422 + TBool iPersists;
1.423 +
1.424 + /** Indicates whether the schedule is enabled or not. */
1.425 + TBool iEnabled;
1.426 + };
1.427 +
1.428 +#ifndef SYMBIAN_ENABLE_SPLIT_HEADERS
1.429 +#include <schinfointernal.h>
1.430 +
1.431 +#endif
1.432 +
1.433 +#endif