epoc32/include/schtask.h
author William Roberts <williamr@symbian.org>
Tue, 16 Mar 2010 16:12:26 +0000 (2010-03-16)
branchSymbian2
changeset 2 2fe1408b6811
parent 0 061f57f2323e
child 4 837f303aceeb
permissions -rw-r--r--
Final list of Symbian^2 public API header files
williamr@2
     1
// Copyright (c) 2004-2009 Nokia Corporation and/or its subsidiary(-ies).
williamr@2
     2
// All rights reserved.
williamr@2
     3
// This component and the accompanying materials are made available
williamr@2
     4
// under the terms of the License "Symbian Foundation License v1.0" to Symbian Foundation members and "Symbian Foundation End User License Agreement v1.0" to non-members
williamr@2
     5
// which accompanies this distribution, and is available
williamr@2
     6
// at the URL "http://www.symbianfoundation.org/legal/licencesv10.html".
williamr@2
     7
//
williamr@2
     8
// Initial Contributors:
williamr@2
     9
// Nokia Corporation - initial contribution.
williamr@2
    10
//
williamr@2
    11
// Contributors:
williamr@2
    12
//
williamr@2
    13
// Description:
williamr@2
    14
// Representation of a task: 
williamr@2
    15
// Includes both user-defined data (iInfo+iData) and data set by system
williamr@2
    16
// construction from stream & accessors are exported for task executors
williamr@2
    17
// 
williamr@2
    18
//
williamr@2
    19
williamr@2
    20
#if !defined(__SCHTASK_H__)
williamr@2
    21
#define __SCHTASK_H__
williamr@2
    22
williamr@2
    23
#if !defined(__SCHINFO_H__)
williamr@2
    24
#include <schinfo.h>
williamr@2
    25
#endif 
williamr@2
    26
williamr@2
    27
#include <s32file.h>
williamr@2
    28
williamr@2
    29
williamr@2
    30
/**
williamr@2
    31
@publishedPartner
williamr@2
    32
williamr@2
    33
When SYMBIAN_SECURE_TASK_SCHEDULER is defined, platform security
williamr@2
    34
support functionality is included in Task Scheduler.
williamr@2
    35
williamr@2
    36
This means that:
williamr@2
    37
williamr@2
    38
(i) Scheduled executables will be passed a shared file handle to
williamr@2
    39
the scheduled task file by the Task Scheduler.
williamr@2
    40
williamr@2
    41
(ii) The CScheduledTask::SecurityInfo() API is availble to
williamr@2
    42
retrieve security information about the schedule creator.
williamr@2
    43
*/
williamr@2
    44
#ifndef SYMBIAN_SECURE_TASK_SCHEDULER
williamr@2
    45
#define SYMBIAN_SECURE_TASK_SCHEDULER
williamr@2
    46
#endif
williamr@2
    47
williamr@2
    48
/**
williamr@2
    49
Class used by registered programs to access the scheduled task file store.
williamr@2
    50
williamr@2
    51
When tasks are due, the Task Scheduler encapsulates task information within 
williamr@2
    52
CScheduledTask objects, and externalises them to a direct file store.
williamr@2
    53
williamr@2
    54
This file store is located in the task scheduler's private data cage and thus
williamr@2
    55
cannot be accessed directly.  Instead the task scheduler passes a shared RFs and
williamr@2
    56
RFile handle to the registered program.
williamr@2
    57
williamr@2
    58
The registered program can use the RFile::AdoptFromCreator API in conjunction
williamr@2
    59
with the APIs provided by this class to access the scheduled task file store as
williamr@2
    60
shown in the following example:
williamr@2
    61
williamr@2
    62
@code
williamr@2
    63
	RFile file;
williamr@2
    64
	TInt error = file.AdoptFromCreator(TScheduledTaskFile::FsHandleIndex(),
williamr@2
    65
											TScheduledTaskFile::FileHandleIndex());
williamr@2
    66
@endcode
williamr@2
    67
@see CScheduledTask
williamr@2
    68
@see RFile::AdoptFromCreator
williamr@2
    69
@publishedAll
williamr@2
    70
@released
williamr@2
    71
*/
williamr@2
    72
class TScheduledTaskFile
williamr@2
    73
	{
williamr@2
    74
public:
williamr@2
    75
	IMPORT_C static TInt FsHandleIndex();
williamr@2
    76
	IMPORT_C static TInt FileHandleIndex();
williamr@2
    77
	};
williamr@2
    78
williamr@2
    79
/** 
williamr@2
    80
The representation of a scheduled task that is passed to registered programs.
williamr@2
    81
williamr@2
    82
When tasks are due, the Task Scheduler encapsulates task information within 
williamr@2
    83
CScheduledTask objects, and externalises them to a direct file store.
williamr@2
    84
williamr@2
    85
The root stream of the direct file store contains a 32 bit value, followed 
williamr@2
    86
by the external representations of one or more CScheduledTask objects. The 
williamr@2
    87
32 bit value is interpreted as a TInt32 and contains the number of CScheduledTask 
williamr@2
    88
objects that follow in the stream.
williamr@2
    89
williamr@2
    90
The registered program can create successive CScheduledTask objects from this 
williamr@2
    91
stream using the static NewLC() function.
williamr@2
    92
 
williamr@2
    93
@see TScheduledTaskFile
williamr@2
    94
@see RStoreReadStream 
williamr@2
    95
@publishedAll
williamr@2
    96
@released
williamr@2
    97
*/
williamr@2
    98
class CScheduledTask : public CBase
williamr@2
    99
	{
williamr@2
   100
public:
williamr@2
   101
	IMPORT_C static CScheduledTask* NewLC(RReadStream& aStream);
williamr@2
   102
	~CScheduledTask();
williamr@2
   103
	IMPORT_C const TTaskInfo& Info() const;
williamr@2
   104
	IMPORT_C const HBufC& Data() const;
williamr@2
   105
	IMPORT_C const TTsTime& ValidUntil() const;
williamr@2
   106
	IMPORT_C TScheduleType ScheduleType() const;
williamr@2
   107
	IMPORT_C const TSecurityInfo& SecurityInfo() const;
williamr@2
   108
	
williamr@2
   109
	// These methods only used by task scheduler server
williamr@2
   110
	CScheduledTask(TTaskInfo& aInfo, 
williamr@2
   111
					HBufC* aData, 
williamr@2
   112
					TScheduleType aScheduleType,
williamr@2
   113
					const TSecurityInfo& aSecurityInfo);
williamr@2
   114
williamr@2
   115
	TBool Due() const;
williamr@2
   116
	void SetDue(TBool aDue);
williamr@2
   117
	void OnDue(const TTsTime& aValidUntil);
williamr@2
   118
	void DecRepeat();
williamr@2
   119
	void Remove();
williamr@2
   120
	void ExternalizeL(RWriteStream& aStream) const;
williamr@2
   121
	//
williamr@2
   122
	TInt ScheduleId() const;
williamr@2
   123
	void SetScheduleId(TInt aScheduleId);	
williamr@2
   124
	//
williamr@2
   125
	TBool Persists() const;
williamr@2
   126
	void SetPersists();
williamr@2
   127
	//
williamr@2
   128
	static TInt Offset();
williamr@2
   129
	//
williamr@2
   130
private:
williamr@2
   131
	CScheduledTask();	
williamr@2
   132
	void InternalizeL(RReadStream& aStream);
williamr@2
   133
private:
williamr@2
   134
	TPriQueLink iPLink;
williamr@2
   135
	TTaskInfo iInfo;
williamr@2
   136
	HBufC* iData;
williamr@2
   137
	TTsTime iValidUntil;
williamr@2
   138
	TBool iDue;
williamr@2
   139
	TInt iScheduleId;
williamr@2
   140
	TScheduleType iScheduleType;
williamr@2
   141
	TSecurityInfo iSecurityInfo;
williamr@2
   142
	TBool iPersists;
williamr@2
   143
	};
williamr@2
   144
	
williamr@2
   145
/**
williamr@2
   146
Streaming operators for TSecurityInfo
williamr@2
   147
@internalComponent
williamr@2
   148
*/	
williamr@2
   149
RWriteStream& operator<<(RWriteStream& aWriteStream, 
williamr@2
   150
						const TSecurityInfo& aSecurityInfo);
williamr@2
   151
williamr@2
   152
/**
williamr@2
   153
Streaming operators for TSecurityInfo
williamr@2
   154
@internalComponent
williamr@2
   155
*/	
williamr@2
   156
RReadStream& operator>>(RReadStream& aReadStream,
williamr@2
   157
						TSecurityInfo& aSecurityInfo);
williamr@2
   158
williamr@2
   159
#endif