os/ossrv/genericservices/taskscheduler/INC/SCHTASK.H
changeset 0 bde4ae8d615e
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/os/ossrv/genericservices/taskscheduler/INC/SCHTASK.H	Fri Jun 15 03:10:57 2012 +0200
     1.3 @@ -0,0 +1,149 @@
     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 +// Representation of a task: 
    1.18 +// Includes both user-defined data (iInfo+iData) and data set by system
    1.19 +// construction from stream & accessors are exported for task executors
    1.20 +// 
    1.21 +//
    1.22 +
    1.23 +#if !defined(__SCHTASK_H__)
    1.24 +#define __SCHTASK_H__
    1.25 +
    1.26 +#if !defined(__SCHINFO_H__)
    1.27 +#include <schinfo.h>
    1.28 +#endif 
    1.29 +
    1.30 +#include <s32file.h>
    1.31 +
    1.32 +
    1.33 +
    1.34 +/**
    1.35 +
    1.36 +When SYMBIAN_SECURE_TASK_SCHEDULER is defined, platform security
    1.37 +support functionality is included in Task Scheduler.
    1.38 +
    1.39 +This means that:
    1.40 +
    1.41 +(i) Scheduled executables will be passed a shared file handle to
    1.42 +the scheduled task file by the Task Scheduler.
    1.43 +
    1.44 +(ii) The CScheduledTask::SecurityInfo() API is availble to
    1.45 +retrieve security information about the schedule creator.
    1.46 +@publishedPartner
    1.47 +@released
    1.48 +*/
    1.49 +//Only to be used internally and by Phone Manufacturers
    1.50 +#ifndef SYMBIAN_SECURE_TASK_SCHEDULER
    1.51 +#define SYMBIAN_SECURE_TASK_SCHEDULER
    1.52 +#endif
    1.53 +
    1.54 +/**
    1.55 +Class used by registered programs to access the scheduled task file store.
    1.56 +
    1.57 +When tasks are due, the Task Scheduler encapsulates task information within 
    1.58 +CScheduledTask objects, and externalises them to a direct file store.
    1.59 +
    1.60 +This file store is located in the task scheduler's private data cage and thus
    1.61 +cannot be accessed directly.  Instead the task scheduler passes a shared RFs and
    1.62 +RFile handle to the registered program.
    1.63 +
    1.64 +The registered program can use the RFile::AdoptFromCreator API in conjunction
    1.65 +with the APIs provided by this class to access the scheduled task file store as
    1.66 +shown in the following example:
    1.67 +
    1.68 +@code
    1.69 +	RFile file;
    1.70 +	TInt error = file.AdoptFromCreator(TScheduledTaskFile::FsHandleIndex(),
    1.71 +											TScheduledTaskFile::FileHandleIndex());
    1.72 +@endcode
    1.73 +@see CScheduledTask
    1.74 +@see RFile::AdoptFromCreator
    1.75 +@publishedAll
    1.76 +@released
    1.77 +*/
    1.78 +class TScheduledTaskFile
    1.79 +	{
    1.80 +public:
    1.81 +	IMPORT_C static TInt FsHandleIndex();
    1.82 +	IMPORT_C static TInt FileHandleIndex();
    1.83 +	};
    1.84 +
    1.85 +/** 
    1.86 +The representation of a scheduled task that is passed to registered programs.
    1.87 +
    1.88 +When tasks are due, the Task Scheduler encapsulates task information within 
    1.89 +CScheduledTask objects, and externalises them to a direct file store.
    1.90 +
    1.91 +The root stream of the direct file store contains a 32 bit value, followed 
    1.92 +by the external representations of one or more CScheduledTask objects. The 
    1.93 +32 bit value is interpreted as a TInt32 and contains the number of CScheduledTask 
    1.94 +objects that follow in the stream.
    1.95 +
    1.96 +The registered program can create successive CScheduledTask objects from this 
    1.97 +stream using the static NewLC() function.
    1.98 + 
    1.99 +@see TScheduledTaskFile
   1.100 +@see RStoreReadStream 
   1.101 +@publishedAll
   1.102 +@released
   1.103 +*/
   1.104 +class CScheduledTask : public CBase
   1.105 +	{
   1.106 +public:
   1.107 +	IMPORT_C static CScheduledTask* NewLC(RReadStream& aStream);
   1.108 +	~CScheduledTask();
   1.109 +	IMPORT_C const TTaskInfo& Info() const;
   1.110 +	IMPORT_C const HBufC& Data() const;
   1.111 +	IMPORT_C const TTsTime& ValidUntil() const;
   1.112 +	IMPORT_C TScheduleType ScheduleType() const;
   1.113 +	IMPORT_C const TSecurityInfo& SecurityInfo() const;
   1.114 +	
   1.115 +	// These methods only used by task scheduler server
   1.116 +	CScheduledTask(TTaskInfo& aInfo, 
   1.117 +					HBufC* aData, 
   1.118 +					TScheduleType aScheduleType,
   1.119 +					const TSecurityInfo& aSecurityInfo);
   1.120 +
   1.121 +	TBool Due() const;
   1.122 +	void SetDue(TBool aDue);
   1.123 +	void OnDue(const TTsTime& aValidUntil);
   1.124 +	void DecRepeat();
   1.125 +	void Remove();
   1.126 +	void ExternalizeL(RWriteStream& aStream) const;
   1.127 +	//
   1.128 +	TInt ScheduleId() const;
   1.129 +	void SetScheduleId(TInt aScheduleId);	
   1.130 +	//
   1.131 +	TBool Persists() const;
   1.132 +	void SetPersists();
   1.133 +	//
   1.134 +	static TInt Offset();
   1.135 +	//
   1.136 +private:
   1.137 +	CScheduledTask();	
   1.138 +	void InternalizeL(RReadStream& aStream);
   1.139 +private:
   1.140 +	TPriQueLink iPLink;
   1.141 +	TTaskInfo iInfo;
   1.142 +	HBufC* iData;
   1.143 +	TTsTime iValidUntil;
   1.144 +	TBool iDue;
   1.145 +	TInt iScheduleId;
   1.146 +	TScheduleType iScheduleType;
   1.147 +	TSecurityInfo iSecurityInfo;
   1.148 +	TBool iPersists;
   1.149 +	};
   1.150 +	
   1.151 +
   1.152 +#endif