sl@0: // Copyright (c) 2004-2009 Nokia Corporation and/or its subsidiary(-ies). sl@0: // All rights reserved. sl@0: // This component and the accompanying materials are made available sl@0: // under the terms of "Eclipse Public License v1.0" sl@0: // which accompanies this distribution, and is available sl@0: // at the URL "http://www.eclipse.org/legal/epl-v10.html". sl@0: // sl@0: // Initial Contributors: sl@0: // Nokia Corporation - initial contribution. sl@0: // sl@0: // Contributors: sl@0: // sl@0: // Description: sl@0: // Representation of a task: sl@0: // Includes both user-defined data (iInfo+iData) and data set by system sl@0: // construction from stream & accessors are exported for task executors sl@0: // sl@0: // sl@0: sl@0: #if !defined(__SCHTASK_H__) sl@0: #define __SCHTASK_H__ sl@0: sl@0: #if !defined(__SCHINFO_H__) sl@0: #include sl@0: #endif sl@0: sl@0: #include sl@0: sl@0: sl@0: sl@0: /** sl@0: sl@0: When SYMBIAN_SECURE_TASK_SCHEDULER is defined, platform security sl@0: support functionality is included in Task Scheduler. sl@0: sl@0: This means that: sl@0: sl@0: (i) Scheduled executables will be passed a shared file handle to sl@0: the scheduled task file by the Task Scheduler. sl@0: sl@0: (ii) The CScheduledTask::SecurityInfo() API is availble to sl@0: retrieve security information about the schedule creator. sl@0: @publishedPartner sl@0: @released sl@0: */ sl@0: //Only to be used internally and by Phone Manufacturers sl@0: #ifndef SYMBIAN_SECURE_TASK_SCHEDULER sl@0: #define SYMBIAN_SECURE_TASK_SCHEDULER sl@0: #endif sl@0: sl@0: /** sl@0: Class used by registered programs to access the scheduled task file store. sl@0: sl@0: When tasks are due, the Task Scheduler encapsulates task information within sl@0: CScheduledTask objects, and externalises them to a direct file store. sl@0: sl@0: This file store is located in the task scheduler's private data cage and thus sl@0: cannot be accessed directly. Instead the task scheduler passes a shared RFs and sl@0: RFile handle to the registered program. sl@0: sl@0: The registered program can use the RFile::AdoptFromCreator API in conjunction sl@0: with the APIs provided by this class to access the scheduled task file store as sl@0: shown in the following example: sl@0: sl@0: @code sl@0: RFile file; sl@0: TInt error = file.AdoptFromCreator(TScheduledTaskFile::FsHandleIndex(), sl@0: TScheduledTaskFile::FileHandleIndex()); sl@0: @endcode sl@0: @see CScheduledTask sl@0: @see RFile::AdoptFromCreator sl@0: @publishedAll sl@0: @released sl@0: */ sl@0: class TScheduledTaskFile sl@0: { sl@0: public: sl@0: IMPORT_C static TInt FsHandleIndex(); sl@0: IMPORT_C static TInt FileHandleIndex(); sl@0: }; sl@0: sl@0: /** sl@0: The representation of a scheduled task that is passed to registered programs. sl@0: sl@0: When tasks are due, the Task Scheduler encapsulates task information within sl@0: CScheduledTask objects, and externalises them to a direct file store. sl@0: sl@0: The root stream of the direct file store contains a 32 bit value, followed sl@0: by the external representations of one or more CScheduledTask objects. The sl@0: 32 bit value is interpreted as a TInt32 and contains the number of CScheduledTask sl@0: objects that follow in the stream. sl@0: sl@0: The registered program can create successive CScheduledTask objects from this sl@0: stream using the static NewLC() function. sl@0: sl@0: @see TScheduledTaskFile sl@0: @see RStoreReadStream sl@0: @publishedAll sl@0: @released sl@0: */ sl@0: class CScheduledTask : public CBase sl@0: { sl@0: public: sl@0: IMPORT_C static CScheduledTask* NewLC(RReadStream& aStream); sl@0: ~CScheduledTask(); sl@0: IMPORT_C const TTaskInfo& Info() const; sl@0: IMPORT_C const HBufC& Data() const; sl@0: IMPORT_C const TTsTime& ValidUntil() const; sl@0: IMPORT_C TScheduleType ScheduleType() const; sl@0: IMPORT_C const TSecurityInfo& SecurityInfo() const; sl@0: sl@0: // These methods only used by task scheduler server sl@0: CScheduledTask(TTaskInfo& aInfo, sl@0: HBufC* aData, sl@0: TScheduleType aScheduleType, sl@0: const TSecurityInfo& aSecurityInfo); sl@0: sl@0: TBool Due() const; sl@0: void SetDue(TBool aDue); sl@0: void OnDue(const TTsTime& aValidUntil); sl@0: void DecRepeat(); sl@0: void Remove(); sl@0: void ExternalizeL(RWriteStream& aStream) const; sl@0: // sl@0: TInt ScheduleId() const; sl@0: void SetScheduleId(TInt aScheduleId); sl@0: // sl@0: TBool Persists() const; sl@0: void SetPersists(); sl@0: // sl@0: static TInt Offset(); sl@0: // sl@0: private: sl@0: CScheduledTask(); sl@0: void InternalizeL(RReadStream& aStream); sl@0: private: sl@0: TPriQueLink iPLink; sl@0: TTaskInfo iInfo; sl@0: HBufC* iData; sl@0: TTsTime iValidUntil; sl@0: TBool iDue; sl@0: TInt iScheduleId; sl@0: TScheduleType iScheduleType; sl@0: TSecurityInfo iSecurityInfo; sl@0: TBool iPersists; sl@0: }; sl@0: sl@0: sl@0: #endif