|
1 // Copyright (c) 2004-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". |
|
7 // |
|
8 // Initial Contributors: |
|
9 // Nokia Corporation - initial contribution. |
|
10 // |
|
11 // Contributors: |
|
12 // |
|
13 // Description: |
|
14 // Representation of a task: |
|
15 // Includes both user-defined data (iInfo+iData) and data set by system |
|
16 // construction from stream & accessors are exported for task executors |
|
17 // |
|
18 // |
|
19 |
|
20 #if !defined(__SCHTASK_H__) |
|
21 #define __SCHTASK_H__ |
|
22 |
|
23 #if !defined(__SCHINFO_H__) |
|
24 #include <schinfo.h> |
|
25 #endif |
|
26 |
|
27 #include <s32file.h> |
|
28 |
|
29 |
|
30 |
|
31 /** |
|
32 |
|
33 When SYMBIAN_SECURE_TASK_SCHEDULER is defined, platform security |
|
34 support functionality is included in Task Scheduler. |
|
35 |
|
36 This means that: |
|
37 |
|
38 (i) Scheduled executables will be passed a shared file handle to |
|
39 the scheduled task file by the Task Scheduler. |
|
40 |
|
41 (ii) The CScheduledTask::SecurityInfo() API is availble to |
|
42 retrieve security information about the schedule creator. |
|
43 @publishedPartner |
|
44 @released |
|
45 */ |
|
46 //Only to be used internally and by Phone Manufacturers |
|
47 #ifndef SYMBIAN_SECURE_TASK_SCHEDULER |
|
48 #define SYMBIAN_SECURE_TASK_SCHEDULER |
|
49 #endif |
|
50 |
|
51 /** |
|
52 Class used by registered programs to access the scheduled task file store. |
|
53 |
|
54 When tasks are due, the Task Scheduler encapsulates task information within |
|
55 CScheduledTask objects, and externalises them to a direct file store. |
|
56 |
|
57 This file store is located in the task scheduler's private data cage and thus |
|
58 cannot be accessed directly. Instead the task scheduler passes a shared RFs and |
|
59 RFile handle to the registered program. |
|
60 |
|
61 The registered program can use the RFile::AdoptFromCreator API in conjunction |
|
62 with the APIs provided by this class to access the scheduled task file store as |
|
63 shown in the following example: |
|
64 |
|
65 @code |
|
66 RFile file; |
|
67 TInt error = file.AdoptFromCreator(TScheduledTaskFile::FsHandleIndex(), |
|
68 TScheduledTaskFile::FileHandleIndex()); |
|
69 @endcode |
|
70 @see CScheduledTask |
|
71 @see RFile::AdoptFromCreator |
|
72 @publishedAll |
|
73 @released |
|
74 */ |
|
75 class TScheduledTaskFile |
|
76 { |
|
77 public: |
|
78 IMPORT_C static TInt FsHandleIndex(); |
|
79 IMPORT_C static TInt FileHandleIndex(); |
|
80 }; |
|
81 |
|
82 /** |
|
83 The representation of a scheduled task that is passed to registered programs. |
|
84 |
|
85 When tasks are due, the Task Scheduler encapsulates task information within |
|
86 CScheduledTask objects, and externalises them to a direct file store. |
|
87 |
|
88 The root stream of the direct file store contains a 32 bit value, followed |
|
89 by the external representations of one or more CScheduledTask objects. The |
|
90 32 bit value is interpreted as a TInt32 and contains the number of CScheduledTask |
|
91 objects that follow in the stream. |
|
92 |
|
93 The registered program can create successive CScheduledTask objects from this |
|
94 stream using the static NewLC() function. |
|
95 |
|
96 @see TScheduledTaskFile |
|
97 @see RStoreReadStream |
|
98 @publishedAll |
|
99 @released |
|
100 */ |
|
101 class CScheduledTask : public CBase |
|
102 { |
|
103 public: |
|
104 IMPORT_C static CScheduledTask* NewLC(RReadStream& aStream); |
|
105 ~CScheduledTask(); |
|
106 IMPORT_C const TTaskInfo& Info() const; |
|
107 IMPORT_C const HBufC& Data() const; |
|
108 IMPORT_C const TTsTime& ValidUntil() const; |
|
109 IMPORT_C TScheduleType ScheduleType() const; |
|
110 IMPORT_C const TSecurityInfo& SecurityInfo() const; |
|
111 |
|
112 // These methods only used by task scheduler server |
|
113 CScheduledTask(TTaskInfo& aInfo, |
|
114 HBufC* aData, |
|
115 TScheduleType aScheduleType, |
|
116 const TSecurityInfo& aSecurityInfo); |
|
117 |
|
118 TBool Due() const; |
|
119 void SetDue(TBool aDue); |
|
120 void OnDue(const TTsTime& aValidUntil); |
|
121 void DecRepeat(); |
|
122 void Remove(); |
|
123 void ExternalizeL(RWriteStream& aStream) const; |
|
124 // |
|
125 TInt ScheduleId() const; |
|
126 void SetScheduleId(TInt aScheduleId); |
|
127 // |
|
128 TBool Persists() const; |
|
129 void SetPersists(); |
|
130 // |
|
131 static TInt Offset(); |
|
132 // |
|
133 private: |
|
134 CScheduledTask(); |
|
135 void InternalizeL(RReadStream& aStream); |
|
136 private: |
|
137 TPriQueLink iPLink; |
|
138 TTaskInfo iInfo; |
|
139 HBufC* iData; |
|
140 TTsTime iValidUntil; |
|
141 TBool iDue; |
|
142 TInt iScheduleId; |
|
143 TScheduleType iScheduleType; |
|
144 TSecurityInfo iSecurityInfo; |
|
145 TBool iPersists; |
|
146 }; |
|
147 |
|
148 |
|
149 #endif |