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