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