williamr@2: /* williamr@2: * Copyright (c) 2003, 2004 Nokia Corporation and/or its subsidiary(-ies). williamr@2: * All rights reserved. williamr@2: * This component and the accompanying materials are made available williamr@4: * under the terms of "Eclipse Public License v1.0" williamr@2: * which accompanies this distribution, and is available williamr@4: * at the URL "http://www.eclipse.org/legal/epl-v10.html". williamr@2: * williamr@2: * Initial Contributors: williamr@2: * Nokia Corporation - initial contribution. williamr@2: * williamr@2: * Contributors: williamr@2: * williamr@2: * Description: Class to show miscellaneous DRM related error notes and williamr@2: * details about rights williamr@2: * williamr@2: */ williamr@2: williamr@2: williamr@2: williamr@2: #ifndef __DRMHELPER_H__ williamr@2: #define __DRMHELPER_H__ williamr@2: williamr@2: // INCLUDES williamr@2: #include williamr@2: #include williamr@2: #include williamr@2: #include williamr@2: #include williamr@2: #include williamr@2: #include williamr@2: #include williamr@2: #include williamr@2: williamr@2: using namespace ContentAccess; williamr@2: williamr@2: // CONSTANTS williamr@2: const TInt KDRMHelperDefaultCountThreshold = 3; williamr@2: const TInt KDRMHelperDefaultTimeThreshold = 7; williamr@2: const TInt KDRMHelperDefaultPercentageThreshold = 10; williamr@2: const TInt KDRMHelperNoteMaxSize ( 256 ); williamr@2: williamr@2: // MACROS williamr@2: williamr@2: // DATA TYPES williamr@2: enum TDRMHelperPreviewMediaType williamr@2: { williamr@2: EPreviewTypeAudio, williamr@2: EPreviewTypeVideo williamr@2: }; williamr@2: // FUNCTION PROTOTYPES williamr@2: williamr@2: // FORWARD DECLARATIONS williamr@2: class DRMCommon; williamr@2: class CDRMRightsConstraints; williamr@2: class CDRMRights; williamr@2: class CStringResourceReader; williamr@2: class TDataType; williamr@2: class CCoeEnv; williamr@2: class CConsumeData; williamr@2: class CDRMPermission; williamr@2: class CDRMConstraint; williamr@2: class CAknGlobalNote; williamr@2: class CAknWaitDialog; williamr@2: class CDRMHelperInfoNoteWrapper; williamr@2: class CSchemeHandler; williamr@2: class CMediatorEventProvider; williamr@2: williamr@2: // CLASS DECLARATION williamr@2: williamr@2: /** williamr@2: * Helper class for wrapping CDRMRightsConstraints. williamr@2: * williamr@2: * @lib drmhelper.lib williamr@2: * @since Series 60 2.1 williamr@2: */ williamr@2: class CDRMHelperRightsConstraints : public CBase williamr@2: { williamr@2: public: // Constructors and destructor williamr@2: williamr@2: /** williamr@2: * Two-phased constructor. williamr@2: */ williamr@2: static CDRMHelperRightsConstraints* NewL( williamr@2: CDRMRightsConstraints* aConstraints ); williamr@2: static CDRMHelperRightsConstraints* NewLC( williamr@2: CDRMRightsConstraints* aConstraints ); williamr@2: williamr@2: /** williamr@2: * Destructor. williamr@2: */ williamr@2: IMPORT_C ~CDRMHelperRightsConstraints(); williamr@2: williamr@2: public: // New functions williamr@2: williamr@2: /** williamr@2: * checks if the object contains any restrictions williamr@2: * or if usage is unconstrained. williamr@2: * @return ETrue if usage is unconstrained williamr@2: */ williamr@2: IMPORT_C TBool FullRights(); williamr@2: williamr@2: /** williamr@2: * checks if the object contains only preview rights williamr@2: * @return ETrue if object contains only preview rights williamr@2: */ williamr@2: IMPORT_C TBool IsPreview(); williamr@2: williamr@2: /** williamr@2: * Gets number of counts left and number of original counts. williamr@2: * Leaves with KErrNotFound if object doesn't have count based rights. williamr@2: * @param aCounter: (out) counts left williamr@2: * @param aOriginalCounter: (out) number of counts when stored to williamr@2: * rights db williamr@2: * @return - williamr@2: */ williamr@2: IMPORT_C void GetCountersL( TUint32& aCounter, williamr@2: TUint32& aOriginalCounter ); williamr@2: williamr@2: /** williamr@2: * Gets start time of time based rights. williamr@2: * Leaves with KErrNotFound if object doesn't have time based rights. williamr@2: * @param aStartTime: (out) start time williamr@2: * @return - williamr@2: */ williamr@2: IMPORT_C void GetStartTimeL( TTime& aStartTime ); williamr@2: williamr@2: /** williamr@2: * Gets end time of time based rights. williamr@2: * Leaves with KErrNotFound if object doesn't have time based rights. williamr@2: * @param aEndTime: (out) start time williamr@2: * @return - williamr@2: */ williamr@2: IMPORT_C void GetEndTimeL( TTime& aEndTime ); williamr@2: williamr@2: /** williamr@2: * Gets interval time constraint. williamr@2: * Leaves with KErrNotFound if object doesn't have interval constraint. williamr@2: * @param aInterval: (out) interval williamr@2: * @return - williamr@2: */ williamr@2: IMPORT_C void GetIntervalL( TTimeIntervalSeconds& aInterval ); williamr@2: williamr@2: /** williamr@2: * Gets start time of activated interval constraint. williamr@2: * Leaves with KErrNotFound if interval has not been started yet. williamr@2: * @param aStartTime: (out) start time of activated interval williamr@2: * @return - williamr@2: */ williamr@2: williamr@2: IMPORT_C void GetIntervalStartL( TTime& aStartTime ); williamr@2: /** williamr@2: * Gets number of counts left, number of original counts and timer williamr@2: * value for timed-count constraint. williamr@2: * Leaves with KErrNotFound if object doesn't have timed-count williamr@2: * constraint. williamr@2: * @param aCounter: (out) counts left williamr@2: * @param aOriginalCounter: Invalid, value returned same as aCounter williamr@2: * @param aTimer: (out) timer value williamr@2: * @return - williamr@2: * @since Series 60 3.0 williamr@2: */ williamr@2: IMPORT_C void GetTimedCountL( TUint32& aCounter, williamr@2: TUint32& aOriginalCounter, TTimeIntervalSeconds& aTimer ); williamr@2: williamr@2: /** williamr@2: * Gets accumulated time left. williamr@2: * Leaves with KErrNotFound if object doesn't have accumulated time williamr@2: * constraint. williamr@2: * @param aAccumulatedTime: (out) accumulated time left williamr@2: * @return - williamr@2: * @since Series 60 3.0 williamr@2: */ williamr@2: IMPORT_C void GetAccumulatedTimeL( TTimeIntervalSeconds& aAccumulatedTime ); williamr@2: williamr@2: private: williamr@2: williamr@2: /** williamr@2: * C++ default constructor. williamr@2: */ williamr@2: CDRMHelperRightsConstraints( CDRMRightsConstraints* aConstrains ); williamr@2: williamr@2: /** williamr@2: * By default Symbian 2nd phase constructor is private. williamr@2: */ williamr@2: void ConstructL(); williamr@2: williamr@2: private: // Data williamr@2: // pointer to CDRMRightsConstraints object williamr@2: CDRMRightsConstraints* iConstraints; williamr@2: }; williamr@2: williamr@2: williamr@2: /** williamr@2: * Handles some error situations DRM-aware applications may encounter. williamr@2: * williamr@2: * @lib drmhelper.lib williamr@2: * @since Series 60 2.1 williamr@2: */ williamr@2: class CDRMHelper : public CBase, public MAknServerAppExitObserver williamr@2: { williamr@2: public: // Data williamr@2: williamr@2: enum TDRMHelperNotificationID williamr@2: { williamr@2: ETActivateTextId = 1, williamr@2: ETCountBasedErrorTextId = 2 , williamr@2: ETCountUsageReduceId = 3, williamr@2: ETCountUsageReduceMediaId = 4 williamr@2: }; williamr@2: williamr@2: enum TDRMHelperConsumeAction williamr@2: { williamr@2: EStart, williamr@2: EFinish, williamr@2: EPause, williamr@2: EContinue williamr@2: }; williamr@2: williamr@2: enum TDRMHelperOMALevel williamr@2: { williamr@2: EOMA_None, williamr@2: EOMA_1_0, williamr@2: EOMA_2_0 williamr@2: }; williamr@2: williamr@2: enum TDRMHelperPreviewType williamr@2: { williamr@2: ENoPreview, williamr@2: EEmbeddedPreview, williamr@2: EPreviewRights williamr@2: }; williamr@2: williamr@2: enum TDRMHelperAutomatedType williamr@2: { williamr@2: EAutomatedTypeRingingTone, williamr@2: EAutomatedTypeMessageAlert, williamr@2: EAutomatedTypeEmailAlert, williamr@2: EAutomatedTypeIMAlert, williamr@2: EAutomatedTypeCalendarAlarm, williamr@2: EAutomatedTypeScreenSaver, williamr@2: EAutomatedTypeWallpaper, williamr@2: EAutomatedTypeTheme, williamr@2: EAutomatedTypeClockAlarm, williamr@2: EAutomatedTypeOther = KMaxTUint8 williamr@2: }; williamr@2: williamr@2: enum TDRMHelperDRMMethods williamr@2: { williamr@2: EForwardLock = 0x0001, williamr@2: ECombinedDelivery = 0x0002, williamr@2: ESeparateDelivery = 0x0004, williamr@2: ESuperDistribution = 0x0008 williamr@2: }; williamr@2: williamr@2: public: // Constructors and destructor williamr@2: williamr@2: /** williamr@2: * Two-phased constructor. williamr@2: */ williamr@2: IMPORT_C static CDRMHelper* NewL( CCoeEnv& aCoeEnv ); williamr@2: IMPORT_C static CDRMHelper* NewLC( CCoeEnv& aCoeEnv ); williamr@2: williamr@2: /** williamr@2: * Two-phased constructor. williamr@2: * @since Series 60 2.6 williamr@2: */ williamr@2: IMPORT_C static CDRMHelper* NewL(); williamr@2: IMPORT_C static CDRMHelper* NewLC(); williamr@2: williamr@2: /** williamr@2: * Two-phased constructor. williamr@2: * @since Series 60 3.0 williamr@2: */ williamr@2: IMPORT_C static CDRMHelper* NewL( CCoeEnv& aCoeEnv, RFs& aFs ); williamr@2: IMPORT_C static CDRMHelper* NewLC( CCoeEnv& aCoeEnv, RFs& aFs ); williamr@2: williamr@2: /** williamr@2: * Two-phased constructor. williamr@2: * @since Series 60 3.0 williamr@2: */ williamr@2: IMPORT_C static CDRMHelper* NewL( RFs& aFs ); williamr@2: IMPORT_C static CDRMHelper* NewLC( RFs& aFs ); williamr@2: williamr@2: /** williamr@2: * Destructor. williamr@2: */ williamr@2: IMPORT_C ~CDRMHelper(); williamr@2: williamr@2: williamr@2: public: williamr@2: williamr@2: /** williamr@2: * Displays appropriate error note depending on error code. williamr@2: * @param aError: error code returned by DRM engine williamr@2: * @param aURI: URI of the file williamr@2: * @return williamr@2: * - Button code, if user selected "buy rights" or "launch rights williamr@2: * manager" in query. williamr@2: * - 0 if user selected "No", "Back" or "Cancel" (or whatever which williamr@2: * just dismiss the query) williamr@2: * - 0 if just a simple error note is displayed williamr@2: */ williamr@2: IMPORT_C TInt HandleErrorL( TInt aError, williamr@2: const TDesC8& aURI ); williamr@2: williamr@2: williamr@2: /** williamr@2: * Displays: williamr@2: * Handles error situations 'rights expired', 'no rights' and williamr@2: * 'rights database corrupted'. williamr@2: * @param aError: error code returned by DRM engine williamr@2: * @param aFileName: full path to file williamr@2: * @return williamr@2: * - Button code, if user selected "buy rights" or "launch rights williamr@2: * manager" in query. williamr@2: * - 0 if user selected "No", "Back" or "Cancel" (or whatever which williamr@2: * just dismiss the query) williamr@2: * - 0 if just a simple error note is displayed williamr@2: */ williamr@2: IMPORT_C TInt HandleErrorL( TInt aError, williamr@2: const TDesC& aFileName ); williamr@2: williamr@2: williamr@2: /** williamr@2: * Displays: williamr@2: * Handles error situations 'rights expired', 'no rights' and williamr@2: * 'rights database corrupted'. williamr@2: * @param aError: error code returned by DRM engine williamr@2: * @param aFileHandle: file handle to the file williamr@2: * @return williamr@2: * - Button code, if user selected "buy rights" or "launch rights williamr@2: * manager" in query. williamr@2: * - 0 if user selected "No", "Back" or "Cancel" (or anything that williamr@2: * just dismisses the query) williamr@2: * - 0 if just a simple error note is displayed williamr@2: * @since 3.0 williamr@2: */ williamr@2: IMPORT_C TInt HandleErrorL( TInt aError, williamr@2: RFile& aFileHandle ); williamr@2: williamr@2: /** williamr@2: * Handles DRM-specific error situations. Should be called instead of williamr@2: * HandleErrorL if user should be asked to play embedded preview or get williamr@2: * preview/silent rights if there is no valid rights and either embedded preview or williamr@2: * preview rights are available. williamr@2: * @param aError: error code to be handled. williamr@2: * @param aFile: handle of file for which error was received. williamr@2: * @param aEmbeddedPreviewUri: contain URI of embedded preview part williamr@2: * upon return if caller should play the embedded preview. If embedded williamr@2: * preview should not be played this is NULL. Must be freed by caller. williamr@2: * @return KErrNone if the content is now usable (e.g. silent rights or preview rights were gotten). If williamr@2: * the return code is KErrNone and the aEmbeddedPreviewUri parameter is not NULL, williamr@2: * the player should use embedded preview williamr@2: * KErrCancel if the user cancelled any of the actions within the function williamr@2: * KErrCANoRights and KErrCANoPermission if after the function call, still no rights exist williamr@2: * KErrCompletion if the user did launch the browser, but it is not clear whether the content williamr@2: * was activated williamr@2: * @since S60 3.1 williamr@2: */ williamr@2: IMPORT_C TInt HandleErrorOrPreviewL( williamr@2: TInt aError, williamr@2: RFile& aFile, williamr@2: HBufC8*& aEmbeddedPreviewUri ); williamr@2: williamr@2: /** williamr@2: * Handles DRM specific error situations. Should be called instead of williamr@2: * HandleErrorL if user should be asked to play embedded preview or get williamr@2: * preview/silent rights if there is no valid rights and either embedded preview or williamr@2: * preview rights are available. williamr@2: * @param aError: error code to be handled. williamr@2: * @param aFileName: name of file for which error was received. williamr@2: * @param aEmbeddedPreviewUri: contain URI of embedded preview part williamr@2: * upon return if caller should play the embedded preview. If embedded williamr@2: * preview should not be played this is NULL. Must be freed by caller. williamr@2: * @return KErrNone if the content is now usable (e.g. silent rights or preview rights were gotten). If williamr@2: * the return code is KErrNone and the aEmbeddedPreviewUri parameter is not NULL, williamr@2: * the player should use embedded preview williamr@2: * KErrCancel if the user cancelled any of the actions within the function williamr@2: * KErrCANoRights and KErrCANoPermission if after the function call, still no rights exist williamr@2: * KErrCompletion if the user did launch the browser, but it is not clear whether the content williamr@2: * was activated williamr@2: * @since S60 3.1 williamr@2: */ williamr@2: IMPORT_C TInt HandleErrorOrPreviewL( williamr@2: TInt aError, williamr@2: const TDesC& aFileName, williamr@2: HBufC8*& aEmbeddedPreviewUri ); williamr@2: williamr@2: /** williamr@2: * Check rights for the content. If there is less than given amount williamr@2: * of usage time/count left, appropriate note is displayed williamr@2: * depending on situation. williamr@2: * @param aURI: URI of the file williamr@2: * @return Button code williamr@2: */ williamr@2: // causes conflict with other CheckRightsAmount method, removed for now... williamr@2: // IMPORT_C TInt CheckRightsAmountL( const TDesC8& aURI ); williamr@2: williamr@2: williamr@2: /** williamr@2: * Check rights for the file. If there is less than given amount williamr@2: * of usage time/count/percentage left, appropriate note is displayed williamr@2: * depending on situation. williamr@2: * @param aFileName: Full path to file williamr@2: * @return Button code williamr@2: */ williamr@2: // causes conflict with other CheckRightsAmount method, removed for now... williamr@2: // IMPORT_C TInt CheckRightsAmountL( const TDesC& aFileName ); williamr@2: williamr@2: williamr@2: /** williamr@2: * Check rights for the file. If there is less than given amount williamr@2: * of usage time/count/percentage left, appropriate note is displayed williamr@2: * depending on situation. williamr@2: * @param aFileHandle: file handle to the file williamr@2: * @return Button code williamr@2: * @since 3.0 williamr@2: */ williamr@2: // causes conflict with other CheckRightsAmount method, removed for now... williamr@2: // IMPORT_C TInt CheckRightsAmountL( RFile& aFileHandle ); williamr@2: williamr@2: williamr@2: /** williamr@2: * Check rights for the file. If there is less than given amount williamr@2: * of usage time/count left, one of the following note is displayed williamr@2: * depending on situation: williamr@2: * 'Usage rights about to expire. View details?' williamr@2: * 'Usage rights about to expire. %N days left. View details?' williamr@2: * 'Usage rights about to expire. 1 day left. View details?' williamr@2: * 'Usage rights about to expire. %N counts left. View details?' williamr@2: * 'Usage rights about to expire. 1 count left. View details?' williamr@2: * It also checks that rights are valid and displays appropriate note, williamr@2: * if they are not. williamr@2: * @param aFileName: Full path to file williamr@2: * @param aCount: Threshold value for count limit williamr@2: * @param aDays: Threshold value for time limit in days williamr@2: * @return Button code williamr@2: */ williamr@2: IMPORT_C TInt CheckRightsAmountL( const TDesC& aFileName, williamr@2: TInt aCount = KDRMHelperDefaultCountThreshold, williamr@2: TInt aDays = KDRMHelperDefaultTimeThreshold ); williamr@2: williamr@2: williamr@2: /** williamr@2: * Check rights for the file. If there is less than given amount williamr@2: * of usage time/count left, one of the following note is displayed williamr@2: * depending on situation: williamr@2: * 'Usage rights about to expire. View details?' williamr@2: * 'Usage rights about to expire. %N days left. View details?' williamr@2: * 'Usage rights about to expire. 1 day left. View details?' williamr@2: * 'Usage rights about to expire. %N counts left. View details?' williamr@2: * 'Usage rights about to expire. 1 count left. View details?' williamr@2: * It also checks that rights are valid and displays appropriate note, williamr@2: * if they are not. williamr@2: * @param aFileHandle: file handle to the file williamr@2: * @param aCount: Threshold value for count limit williamr@2: * @param aDays: Threshold value for time limit in days williamr@2: * @return Button code williamr@2: * @since 3.0 williamr@2: */ williamr@2: IMPORT_C TInt CheckRightsAmountL( RFile& aFileHandle, williamr@2: TInt aCount = KDRMHelperDefaultCountThreshold, williamr@2: TInt aDays = KDRMHelperDefaultTimeThreshold ); williamr@2: williamr@2: williamr@2: /** williamr@2: * Check rights for the file. If there is less than given amount williamr@2: * of usage time/count left, one of the following note is displayed williamr@2: * depending on situation: williamr@2: * 'Usage rights about to expire. View details?' williamr@2: * 'Usage rights about to expire. %N days left. View details?' williamr@2: * 'Usage rights about to expire. 1 day left. View details?' williamr@2: * 'Usage rights about to expire. %N counts left. View details?' williamr@2: * 'Usage rights about to expire. 1 count left. View details?' williamr@2: * It also checks that rights are valid and displays appropriate note, williamr@2: * if they are not. williamr@2: * @param aUri: Content URI williamr@2: * @param aCount: Threshold value for count limit williamr@2: * @param aDays: Threshold value for time limit in days williamr@2: * @return Button code williamr@2: */ williamr@2: IMPORT_C TInt CheckRightsAmountL( const TDesC8& aUri, williamr@2: TInt aCount = KDRMHelperDefaultCountThreshold, williamr@2: TInt aDays = KDRMHelperDefaultTimeThreshold ); williamr@2: williamr@2: williamr@2: /** williamr@2: * Check rights for the file. If there is less than aThreshold percent williamr@2: * of usage time/count left, one of the following note is displayed williamr@2: * depending on situation: williamr@2: * 'Usage rights about to expire. View details?' williamr@2: * 'Usage rights about to expire. %N days left. View details?' williamr@2: * 'Usage rights about to expire. 1 day left. View details?' williamr@2: * 'Usage rights about to expire. %N counts left. View details?' williamr@2: * 'Usage rights about to expire. 1 count left. View details?' williamr@2: * It also checks that rights are valid and displays appropriate note, williamr@2: * if they are not. williamr@2: * @param aFileName: Full path to file williamr@2: * @param aThreshold: Threshold value in percents for displaying the note williamr@2: * @return Button code williamr@2: */ williamr@2: IMPORT_C TInt CheckRightsPercentL( const TDesC& aFileName, williamr@2: TInt aThreshold = KDRMHelperDefaultPercentageThreshold ); williamr@2: williamr@2: williamr@2: /** williamr@2: * Check rights for the file. If there is less than aThreshold percent williamr@2: * of usage time/count left, one of the following note is displayed williamr@2: * depending on situation: williamr@2: * 'Usage rights about to expire. View details?' williamr@2: * 'Usage rights about to expire. %N days left. View details?' williamr@2: * 'Usage rights about to expire. 1 day left. View details?' williamr@2: * 'Usage rights about to expire. %N counts left. View details?' williamr@2: * 'Usage rights about to expire. 1 count left. View details?' williamr@2: * It also checks that rights are valid and displays appropriate note, williamr@2: * if they are not. williamr@2: * @param aFileHandle: file handle to the file williamr@2: * @param aThreshold: Threshold value in percents for displaying the note williamr@2: * @return Button code williamr@2: * @since 3.0 williamr@2: */ williamr@2: IMPORT_C TInt CheckRightsPercentL( RFile& aFileHandle, williamr@2: TInt aThreshold = KDRMHelperDefaultPercentageThreshold ); williamr@2: williamr@2: williamr@2: /** williamr@2: * Launches DRM Rights Manager UI embedded with details view related williamr@2: * to given content. williamr@2: * @param aURI: URI of the file williamr@2: * @return - williamr@2: */ williamr@2: IMPORT_C void LaunchDetailsViewEmbeddedL( williamr@2: const TDesC8& aURI ); williamr@2: williamr@2: williamr@2: /** williamr@2: * Launches DRM Rights Manager UI embedded with details view related williamr@2: * to given file. williamr@2: * @param aFileName: Full path to file williamr@2: * @return - williamr@2: */ williamr@2: IMPORT_C void LaunchDetailsViewEmbeddedL( williamr@2: const TDesC& aFileName ); williamr@2: williamr@2: williamr@2: /** williamr@2: * Launches DRM Rights Manager UI embedded with details view related williamr@2: * to given file. williamr@2: * @param aFileHandle: file handle to the file williamr@2: * @return - williamr@2: * @since 3.0 williamr@2: */ williamr@2: IMPORT_C void LaunchDetailsViewEmbeddedL( williamr@2: RFile& aFileHandle ); williamr@2: williamr@2: williamr@2: /** williamr@2: * Launches DRM Rights Manager UI embedded with details view related williamr@2: * to given content. williamr@2: * @param aContentURI: URI of the content williamr@2: * @return - williamr@2: */ williamr@2: IMPORT_C void LaunchDetailsViewEmbeddedL( williamr@2: const HBufC8* aContentURI ); williamr@2: williamr@2: williamr@2: /** williamr@2: * Gets details of rights object associated of given file. williamr@2: * williamr@2: * @param[in] aFileName Full path to file williamr@2: * @param[in] aIntent ContentAccess::EPlay, ContentAccess::EView, williamr@2: * ContentAccess::EPrint or ContentAccess::EExecute williamr@2: * @param[out] aExpired ETrue if rights are not valid. If this is ETrue williamr@2: * and some constraints are returned, rights will become valid in future williamr@2: * @param[out] aSendingAllowed ETrue if content can be sent williamr@2: * @param[out] aPlay play constraints, must be deleted by caller williamr@2: * @param[out] aDisplay display constraints, must be deleted by caller williamr@2: * @param[out] aExecute execute constraints, must be deleted by caller williamr@2: * @param[out] aPrint print constraints, must be deleted by caller williamr@2: * williamr@2: * @leave KErrArgument file is not DRM-protected. williamr@2: * @leave KErrCANoRights no rights williamr@2: * @see caferr.h williamr@2: * @see caftypes.h williamr@2: */ williamr@2: IMPORT_C void GetRightsDetailsL( const TDesC& aFileName, williamr@2: TUint32 aIntent, TBool& aExpired, TBool& aSendingAllowed, williamr@2: CDRMHelperRightsConstraints*& aPlay, williamr@2: CDRMHelperRightsConstraints*& aDisplay, williamr@2: CDRMHelperRightsConstraints*& aExecute, williamr@2: CDRMHelperRightsConstraints*& aPrint ); williamr@2: williamr@2: williamr@2: /** williamr@2: * Gets details of rights object associated of given file. williamr@2: * williamr@2: * @param[in] aFileHandle file handle to the file williamr@2: * @param[in] aIntent ContentAccess::EPlay, ContentAccess::EView, williamr@2: * ContentAccess::EPrint or ContentAccess::EExecute williamr@2: * @param[out] aExpired ETrue if rights are not valid. If this is ETrue williamr@2: * and some constraints are returned, rights will become valid in future williamr@2: * @param[out] aSendingAllowed ETrue if content can be sent williamr@2: * @param[out] aPlay play constraints, must be deleted by caller williamr@2: * @param[out] aDisplay display constraints, must be deleted by caller williamr@2: * @param[out] aExecute execute constraints, must be deleted by caller williamr@2: * @param[out] aPrint print constraints, must be deleted by caller williamr@2: * williamr@2: * @leave KErrArgument file is not DRM-protected. williamr@2: * @leave KErrCANoRights no rights williamr@2: * @see caferr.h williamr@2: * @see caftypes.h williamr@2: * williamr@2: * @since 3.0 williamr@2: */ williamr@2: IMPORT_C void GetRightsDetailsL( RFile& aFileHandle, williamr@2: TUint32 aIntent, TBool& aExpired, TBool& aSendingAllowed, williamr@2: CDRMHelperRightsConstraints*& aPlay, williamr@2: CDRMHelperRightsConstraints*& aDisplay, williamr@2: CDRMHelperRightsConstraints*& aExecute, williamr@2: CDRMHelperRightsConstraints*& aPrint ); williamr@2: williamr@2: williamr@2: /** williamr@2: * Gets details of rights object associated of given file. williamr@2: * williamr@2: * @param[in] aFileName Full path to file williamr@2: * @param[in] aIntent ContentAccess::EPlay, ContentAccess::EView, williamr@2: * ContentAccess::EPrint or ContentAccess::EExecute williamr@2: * @param[out] aExpired ETrue if rights are not valid. If this is ETrue williamr@2: * and some constraints are returned, rights will become valid in future williamr@2: * @param[out] aSendingAllowed ETrue if content can be sent williamr@2: * @param[out] aPlay play constraints, must be deleted by caller williamr@2: * @param[out] aDisplay display constraints, must be deleted by caller williamr@2: * @param[out] aExecute execute constraints, must be deleted by caller williamr@2: * @param[out] aPrint print constraints, must be deleted by caller williamr@2: * williamr@2: * @leave KErrArgument file is not DRM-protected. williamr@2: * @leave KErrCANoRights no rights williamr@2: * @see caferr.h williamr@2: * @see caftypes.h williamr@2: */ williamr@2: IMPORT_C void GetRightsDetailsL( const TDesC& aFileName, williamr@2: TUint32 aIntent, TBool& aExpired, TBool& aSendingAllowed, williamr@2: CDRMRightsConstraints*& aPlay, williamr@2: CDRMRightsConstraints*& aDisplay, williamr@2: CDRMRightsConstraints*& aExecute, williamr@2: CDRMRightsConstraints*& aPrint ); williamr@2: williamr@2: williamr@2: /** williamr@2: * Gets details of rights object associated of given file. williamr@2: * williamr@2: * @param[in] aFileHandle file handle to the file williamr@2: * @param[in] aIntent ContentAccess::EPlay, ContentAccess::EView, williamr@2: * ContentAccess::EPrint or ContentAccess::EExecute williamr@2: * @param[out] aExpired ETrue if rights are not valid. If this is ETrue williamr@2: * and some constraints are returned, rights will become valid in future williamr@2: * @param[out] aSendingAllowed ETrue if content can be sent williamr@2: * @param[out] aPlay play constraints, must be deleted by caller williamr@2: * @param[out] aDisplay display constraints, must be deleted by caller williamr@2: * @param[out] aExecute execute constraints, must be deleted by caller williamr@2: * @param[out] aPrint print constraints, must be deleted by caller williamr@2: * williamr@2: * @leave KErrArgument file is not DRM-protected. williamr@2: * @leave KErrCANoRights no rights williamr@2: * @see caferr.h williamr@2: * @see caftypes.h williamr@2: * williamr@2: * @since 3.0 williamr@2: */ williamr@2: IMPORT_C void GetRightsDetailsL( RFile& aFileHandle, williamr@2: TUint32 aIntent, TBool& aExpired, TBool& aSendingAllowed, williamr@2: CDRMRightsConstraints*& aPlay, williamr@2: CDRMRightsConstraints*& aDisplay, williamr@2: CDRMRightsConstraints*& aExecute, williamr@2: CDRMRightsConstraints*& aPrint ); williamr@2: williamr@2: williamr@2: /** williamr@2: * Registers given content to be used as an automated content. This williamr@2: * function is used when registering application listens expiry williamr@2: * notifications itself williamr@2: * @param aURI: content URI williamr@2: * @return System wide error code (KErrCancel if user pressed no to williamr@2: * query). williamr@2: * @since Series 60 2.6 williamr@2: */ williamr@2: IMPORT_C TInt SetAutomated( const TDesC8& aURI ); williamr@2: williamr@2: williamr@2: /** williamr@2: * Registers given content to be used as an automated content. This williamr@2: * function is used when registering application listens expiry williamr@2: * notifications itself. williamr@2: * @param aFileName: Full path to file williamr@2: * @return System wide error code (KErrCancel if user pressed no to williamr@2: * query). williamr@2: * @since Series 60 2.6 williamr@2: */ williamr@2: IMPORT_C TInt SetAutomated( const TDesC& aFilename ); williamr@2: williamr@2: williamr@2: /** williamr@2: * Registers given content to be used as an automated content. This williamr@2: * function is used when registering application listens expiry williamr@2: * @param aFileHandle: file handle to the file williamr@2: * @return System wide error code (KErrCancel if user pressed no to williamr@2: * query). williamr@2: * @since 3.0 williamr@2: */ williamr@2: IMPORT_C TInt SetAutomated( RFile& aFileHandle ); williamr@2: williamr@2: williamr@2: /** williamr@2: * Displays the confirmation query about setting given content as an williamr@2: * automated content. Note that this function does not actually williamr@2: * register content, just displays the note williamr@2: * @param aURI: content URI williamr@2: * @return System wide error code (KErrCancel if user pressed no to williamr@2: * query). williamr@2: * @since Series 60 2.6 williamr@2: */ williamr@2: IMPORT_C TInt ShowAutomatedNote( const TDesC8& aURI ); williamr@2: williamr@2: williamr@2: /** williamr@2: * Displays the confirmation query about setting given content as an williamr@2: * automated content. Note that this function does not actually williamr@2: * register content, just displays the note williamr@2: * @param aFileName: Full path to file williamr@2: * @return System wide error code (KErrCancel if user pressed no to williamr@2: * query). williamr@2: * @since Series 60 2.6 williamr@2: */ williamr@2: IMPORT_C TInt ShowAutomatedNote( const TDesC& aFilename ); williamr@2: williamr@2: williamr@2: /** williamr@2: * Displays the confirmation query about setting given content as an williamr@2: * automated content. Note that this function does not actually williamr@2: * register content, just displays the note williamr@2: * @param aFileHandle: file handle to the file williamr@2: * @return System wide error code (KErrCancel if user pressed no to williamr@2: * query). williamr@2: * @since 3.0 williamr@2: */ williamr@2: IMPORT_C TInt ShowAutomatedNote( RFile& aFileHandle ); williamr@2: williamr@2: williamr@2: /** williamr@2: * Registers given content to be used as an automated content. This williamr@2: * function is used when phone application listens to expiry notifications. williamr@2: * @param aURI: content URI williamr@2: * @return System wide error code (KErrCancel if user pressed no to williamr@2: * query). williamr@2: * @since Series 60 2.6 williamr@2: */ williamr@2: IMPORT_C TInt SetAutomatedPassive( const TDesC8& aURI ); williamr@2: williamr@2: williamr@2: /** williamr@2: * Registers given content to be used as an automated content. This williamr@2: * function is used when phone application listens to expiry notifications. williamr@2: * @param aFileName: Full path to file williamr@2: * @return System wide error code (KErrCancel if user pressed no to williamr@2: * query). williamr@2: * @since Series 60 2.6 williamr@2: */ williamr@2: IMPORT_C TInt SetAutomatedPassive( const TDesC& aFilename ); williamr@2: williamr@2: williamr@2: /** williamr@2: * Registers given content to be used as an automated content. This williamr@2: * function is used when phone application listens to expiry notifications. williamr@2: * @param aFileHandle: file handle to the file williamr@2: * @return System wide error code (KErrCancel if user pressed no to williamr@2: * query). williamr@2: * @since 3.0 williamr@2: */ williamr@2: IMPORT_C TInt SetAutomatedPassive( RFile& aFileHandle ); williamr@2: williamr@2: williamr@2: /** williamr@2: * Registers given content to be used as an automated content without williamr@2: * confirmation query. williamr@2: * @param aURI: content URI williamr@2: * @param aActive: ETrue if registering application itself listens williamr@2: * expiry notifications williamr@2: * @return System wide error code (KErrCancel if user pressed no to williamr@2: * query). williamr@2: * @since Series 60 2.6 williamr@2: */ williamr@2: IMPORT_C TInt SetAutomatedSilent( const TDesC8& aURI, TBool aActive ); williamr@2: williamr@2: williamr@2: /** williamr@2: * Registers given content to be used as an automated content without williamr@2: * confirmation query. williamr@2: * @param aFileName: Full path to file williamr@2: * @param aActive: ETrue if registering application itself listens williamr@2: * expiry notifications williamr@2: * @return System wide error code (KErrCancel if user pressed no to williamr@2: * query). williamr@2: * @since Series 60 2.6 williamr@2: */ williamr@2: IMPORT_C TInt SetAutomatedSilent( const TDesC& aFilename, williamr@2: TBool aActive ); williamr@2: williamr@2: williamr@2: /** williamr@2: * Registers given content to be used as an automated content without williamr@2: * confirmation query. williamr@2: * @param aFileHandle: file handle to the file williamr@2: * @param aActive: ETrue if registering application itself listens williamr@2: * expiry notifications williamr@2: * @return System wide error code (KErrCancel if user pressed no to williamr@2: * query). williamr@2: * @since 3.0 williamr@2: */ williamr@2: IMPORT_C TInt SetAutomatedSilent( RFile& aFileHandle, williamr@2: TBool aActive ); williamr@2: williamr@2: williamr@2: /** williamr@2: * Unregisters given content to be used as an automated content. williamr@2: * @param aURI: content URI williamr@2: * @return System wide error code. williamr@2: * @since Series 60 2.6 williamr@2: */ williamr@2: IMPORT_C TInt RemoveAutomated( const TDesC8& aURI ); williamr@2: williamr@2: williamr@2: /** williamr@2: * Unregisters given content to be used as an automated content. williamr@2: * @param aFileName: Full path to file williamr@2: * @return System wide error code. williamr@2: * @since Series 60 2.6 williamr@2: */ williamr@2: IMPORT_C TInt RemoveAutomated( const TDesC& aFilename ); williamr@2: williamr@2: williamr@2: /** williamr@2: * Unregisters given content to be used as an automated content. williamr@2: * @param aFileHandle: file handle to the file williamr@2: * @return System wide error code. williamr@2: * @since 3.0 williamr@2: */ williamr@2: IMPORT_C TInt RemoveAutomated( RFile& aFileHandle ); williamr@2: williamr@2: williamr@2: /** williamr@2: * Unregisters given content to be used as an automated content. williamr@2: * This function must be used when content was registered using williamr@2: * SetAutomatedPassive. williamr@2: * @param aURI: content URI williamr@2: * @return System wide error code. williamr@2: * @since Series 60 2.6 williamr@2: */ williamr@2: IMPORT_C TInt RemoveAutomatedPassive( const TDesC8& aURI ); williamr@2: williamr@2: williamr@2: /** williamr@2: * Unregisters given content to be used as an automated content. williamr@2: * This function must be used when content was registered using williamr@2: * SetAutomatedPassive. williamr@2: * @param aFileName: Full path to file williamr@2: * @return System wide error code. williamr@2: * @since Series 60 2.6 williamr@2: */ williamr@2: IMPORT_C TInt RemoveAutomatedPassive( const TDesC& aFilename ); williamr@2: williamr@2: williamr@2: /** williamr@2: * Unregisters given content to be used as an automated content. williamr@2: * This function must be used when content was registered using williamr@2: * SetAutomatedPassive. williamr@2: * @param aFileHandle: file handle to the file williamr@2: * @return System wide error code. williamr@2: * @since 3.0 williamr@2: */ williamr@2: IMPORT_C TInt RemoveAutomatedPassive( RFile& aFileHandle ); williamr@2: williamr@2: williamr@2: /** williamr@2: * Checks if given content can be set as an automated content. williamr@2: * @param aURI: content URI williamr@2: * @param aValue: ETrue if content can be set as automated. williamr@2: * @return System wide or DRM specific error code. williamr@2: * @since Series 60 2.6 williamr@2: */ williamr@2: IMPORT_C TInt CanSetAutomated( const TDesC8& aURI, williamr@2: TBool& aValue ); williamr@2: williamr@2: williamr@2: /** williamr@2: * Checks if given content can be set as an automated content. williamr@2: * @param aFileName: Full path to file williamr@2: * @param aValue: ETrue if content can be set as automated. williamr@2: * @return System wide or DRM specific error code. williamr@2: * @since Series 60 2.6 williamr@2: */ williamr@2: IMPORT_C TInt CanSetAutomated( const TDesC& aFilename, williamr@2: TBool& aValue ); williamr@2: williamr@2: williamr@2: /** williamr@2: * Checks if given content can be set as an automated content. williamr@2: * @param aFileHandle: file handle to the file williamr@2: * @param aValue: ETrue if content can be set as automated. williamr@2: * @return System wide or DRM specific error code. williamr@2: * @since 3.0 williamr@2: */ williamr@2: IMPORT_C TInt CanSetAutomated( RFile& aFileHandle, williamr@2: TBool& aValue ); williamr@2: williamr@2: williamr@2: /** williamr@2: * Informs DRMHelper that idle-screen has been activated. williamr@2: * @return - williamr@2: * @since Series 60 2.6 williamr@2: */ williamr@2: IMPORT_C void IndicateIdle(); williamr@2: williamr@2: /** williamr@2: * Handle the general UI based error notes williamr@2: * @since 3.0 williamr@2: * @param aTextId The code for DRM general notification note. williamr@2: * @param aURI The DRM files URI, that caused the DRM error. williamr@2: * @return KErrnone if everything went ok, else wide scale of Symbian errors williamr@2: */ williamr@2: IMPORT_C TInt ShowDRMUINotification2L( TDRMHelperNotificationID aTextId, williamr@2: const TDesC8& aURI ); williamr@2: williamr@2: williamr@2: /** williamr@2: * Handle the general UI based error notes williamr@2: * @since 3.0 williamr@2: * @param aTextId The code for DRM general notification note. williamr@2: * @param aFileName The DRM file's name and path, that caused the DRM error. williamr@2: * @return KErrnone if everything went ok, else wide scale of Symbian errors williamr@2: */ williamr@2: IMPORT_C TInt ShowDRMUINotification2L( TDRMHelperNotificationID aTextId, williamr@2: const TDesC& aFileName ); williamr@2: williamr@2: williamr@2: /** williamr@2: * Set count limit for CheckRightsAmountL williamr@2: * @param aCounts: new count limit for displaying the note. williamr@2: * @return - williamr@2: */ williamr@2: IMPORT_C void SetCountLimitL( TUint aCounts ); williamr@2: williamr@2: williamr@2: /** williamr@2: * Set time limit in days for CheckRightsAmountL williamr@2: * @param aDays: new time limit for displaying the note. williamr@2: * @return - williamr@2: */ williamr@2: IMPORT_C void SetTimeLimitL( TUint aDays ); williamr@2: williamr@2: williamr@2: /** williamr@2: * Set percentage limit for CheckRightsAmountL. Applies to both counts and time. williamr@2: * @param aPercentage: new limit for displaying the note. williamr@2: * @return - williamr@2: */ williamr@2: IMPORT_C void SetPercentageLimitL( TUint aPercentage ); williamr@2: williamr@2: williamr@2: /** williamr@2: * GetContentURIList williamr@2: * williamr@2: * Returns a list of all content URIs that have rights in the rights williamr@2: * database. williamr@2: * williamr@2: * @since 2.5 williamr@2: * @param aURIList: Out parameter for the URI list. williamr@2: * @return Ok if the URI list could be retreived. williamr@2: */ williamr@2: IMPORT_C TInt GetContentURIList( williamr@2: RPointerArray*& aURIList); williamr@2: williamr@2: williamr@2: /** williamr@2: * DataTypesCount williamr@2: * williamr@2: * Returns the number of previously registered datatypes which are williamr@2: * supported by the DRM system and associated applications. williamr@2: * williamr@2: * @since 2.0 williamr@2: * @param aCount: Out parameter for the datatype count williamr@2: * @return EOk if the number of datatypes has been returned correctly williamr@2: */ williamr@2: IMPORT_C TInt DataTypesCount( williamr@2: TInt& aCount); williamr@2: williamr@2: williamr@2: /** williamr@2: * SupportedDataType williamr@2: * williamr@2: * Returns a specific datatype which has been registered before by giving an index williamr@2: * williamr@2: * @since 2.0 williamr@2: * @param aIndex: Number of the datatype to return williamr@2: * @param aDataType: Out parameter for the datatype williamr@2: * @return EOk if the datatype was returned correctly williamr@2: */ williamr@2: IMPORT_C TInt SupportedDataType( williamr@2: const TInt aIndex, TDataType& aDataType); williamr@2: williamr@2: williamr@2: /** williamr@2: * RegisterDataType williamr@2: * williamr@2: * Registers a datatype as a supported datatype. williamr@2: * williamr@2: * @since 2.0 williamr@2: * @param aDataType: Datatype to register williamr@2: * @return EOk if the datatype has been registered williamr@2: */ williamr@2: IMPORT_C TInt RegisterDataType( williamr@2: const TDataType& aDataType); williamr@2: williamr@2: williamr@2: /** williamr@2: * UnRegisterDataType williamr@2: * williamr@2: * Unregisters a datatype via its index. williamr@2: * williamr@2: * @since 2.5 williamr@2: * @param aIndex: Number of the datatype to unregister williamr@2: * @return EOk if the datatype has been unregistered williamr@2: */ williamr@2: IMPORT_C TInt UnRegisterDataType( williamr@2: const TInt aIndex); williamr@2: williamr@2: williamr@2: /** williamr@2: * SupportedDRMMethods williamr@2: * williamr@2: * Returns the supported DRM protection methods and the OMA compliance williamr@2: * level of the DRM engine williamr@2: * williamr@2: * @since 2.0 williamr@2: * @param aDRMMethod: Out parameter, bit mask containing any williamr@2: * combination of EForwardLock, ECombinedDelivery, williamr@2: * ESeparateDelivery etc. williamr@2: * @param aOMALevel: OMA compliance of the DRM engine williamr@2: * @return DRMCommon error code williamr@2: */ williamr@2: williamr@2: IMPORT_C TInt SupportedDRMMethods2( williamr@2: TInt& aDRMMethod, TDRMHelperOMALevel& aOMALevel); williamr@2: williamr@2: williamr@2: /** williamr@2: * Consume2 williamr@2: * williamr@2: * Overrides any rights consumption. This function must only be used by williamr@2: * applications with user interaction and not by intermediate components. williamr@2: * The main use cases are signalling that content is to be installed williamr@2: * (including thumbnail generation), or that content is to be consumed. williamr@2: * They are characterized as calls to this function with the correct williamr@2: * intent (i.e. EPlay or EInstall) and the corresponding action (i.e. williamr@2: * telling whether the indicated intent is started or finished). williamr@2: * Calls to this function must be the result of a user interaction or williamr@2: * otherwise high level event. williamr@2: * williamr@2: * @since 3.0 williamr@2: * @param aContentURI: URI of the content which will be consumed williamr@2: * @param aRightsSpec: the consumption intent (EPlay, EDisplay, EPrint, williamr@2: * EExecute or EInstall) williamr@2: * @param anAction: the consumption action, telling whether the williamr@2: * content consumption starts or finishes. williamr@2: * @return EOk if consume action was successfully signalled to the engine. williamr@2: */ williamr@2: IMPORT_C TInt Consume2( williamr@2: const TDesC8& aContentURI, williamr@2: TUint32 aRightsSpec, williamr@2: TDRMHelperConsumeAction anAction); williamr@2: williamr@2: williamr@2: /** williamr@2: * ConsumeFile2 williamr@2: * williamr@2: * Overrides any rights consumption. This function must only be used by williamr@2: * applications with user interaction and not by intermediate components. williamr@2: * The main use cases are signalling that content is to be installed williamr@2: * (including thumbnail generation), or that content is to be consumed. williamr@2: * They are characterized as calls to this function with the correct williamr@2: * intent (i.e. EPlay or EInstall) and the corresponding action (i.e. williamr@2: * telling whether the indicated intent is started or finished). williamr@2: * Calls to this function must be the result of a user interaction or williamr@2: * otherwise high level event. williamr@2: * williamr@2: * @since 3.0 williamr@2: * @param williamr@2: * @param aRightsSpec: the consumption intent (EPlay, EDisplay, EPrint, williamr@2: * EExecute or EInstall) williamr@2: * @param anAction: the consumption action, telling whether the williamr@2: * content consumption starts or finishes. williamr@2: * @return EOk if consume action was successfully signalled to the engine. williamr@2: */ williamr@2: IMPORT_C TInt ConsumeFile2( williamr@2: const TDesC& aFileName, williamr@2: TUint32 aRightsSpec, williamr@2: TDRMHelperConsumeAction anAction); williamr@2: williamr@2: williamr@2: /** williamr@2: * ConsumeFile2 williamr@2: * williamr@2: * Overrides any rights consumption. This function must only be used by williamr@2: * applications with user interaction and not by intermediate components. williamr@2: * The main use cases are signalling that content is to be installed williamr@2: * (including thumbnail generation), or that content is to be consumed. williamr@2: * They are characterized as calls to this function with the correct williamr@2: * intent (i.e. EPlay or EInstall) and the corresponding action (i.e. williamr@2: * telling whether the indicated intent is started or finished). williamr@2: * Calls to this function must be the result of a user interaction or williamr@2: * otherwise high level event. williamr@2: * williamr@2: * @since 3.0 williamr@2: * @param aFileHandle: file handle to the file williamr@2: * @param aRightsSpec: the consumption intent (EPlay, EDisplay, EPrint, williamr@2: * EExecute or EInstall) williamr@2: * @param anAction: the consumption action, telling whether the williamr@2: * content consumption starts or finishes. williamr@2: * @return EOk if consume action was successfully signalled to the engine. williamr@2: */ williamr@2: IMPORT_C TInt ConsumeFile2( williamr@2: RFile& aFileHandle, williamr@2: TUint32 aRightsSpec, williamr@2: TDRMHelperConsumeAction anAction); williamr@2: williamr@2: /** williamr@2: * Acquires rights for given content if rights have been expired or rights are missing. williamr@2: * If content already has valid or future rights, does nothing. williamr@2: * This function should be called when user selects activate from options menu. williamr@2: * Leaves with system-wide error code in case of error. williamr@2: * @param aContent: Content object williamr@2: */ williamr@2: IMPORT_C void ActivateContentL(CData& aContent); williamr@2: williamr@2: /** williamr@2: * Acquires rights for given content if rights have been expired or rights are missing. williamr@2: * If content already has valid or future rights, does nothing. williamr@2: * This function should be called when user selects activate from options menu. williamr@2: * Leaves with system-wide error code in case of error. williamr@2: * @param aFileName: Full path to file williamr@2: */ williamr@2: IMPORT_C void ActivateContentL(TDesC& aFileName); williamr@2: williamr@2: /** williamr@2: * Checks if given content has embedded preview or if it is possible to get preview rights for it. williamr@2: * Leaves with system-wide error code in case of error. williamr@2: * @param aContent: Content object williamr@2: * @param aPreviewUri: Out: URI of the embedded preview or PreviewRights URL. Must be freed by caller williamr@2: * @return preview type williamr@2: */ williamr@2: IMPORT_C TDRMHelperPreviewType HasPreviewL(CData& aContent, HBufC8*& aPreviewUri); williamr@2: williamr@2: /** williamr@2: * Checks if given content has embedded preview or if it is possible to get preview rights for it. williamr@2: * Leaves with system-wide error code in case of error. williamr@2: * @param aFileName: Full path to file. williamr@2: * @param aPreviewUri: Out: URI of the embedded preview or PreviewRights URL. Must be freed by caller williamr@2: * @return preview type williamr@2: */ williamr@2: IMPORT_C TDRMHelperPreviewType HasPreviewL(TDesC& aFileName, HBufC8*& aPreviewUri); williamr@2: williamr@2: /** williamr@2: * Acquires preview rights for given content. williamr@2: * Leaves with system-wide error code in case of error. williamr@2: * @param aContent: Content object williamr@2: */ williamr@2: IMPORT_C void GetPreviewRightsL(CData& aContent); williamr@2: williamr@2: /** williamr@2: * Acquires preview rights for given content. williamr@2: * Leaves with system-wide error code in case of error. williamr@2: * @param aFileName: Full path to file. williamr@2: */ williamr@2: IMPORT_C void GetPreviewRightsL(TDesC& aFileName); williamr@2: williamr@2: /** williamr@2: * This method should be called after embedded preview has been played. williamr@2: * It asks from user if he/she wants to buy rights and acquires those if user agrees. williamr@2: * Leaves with system-wide error code in case of error. williamr@2: * @param aContent: Content object. williamr@2: * @return ETrue if user selects to buy rights. williamr@2: */ williamr@2: IMPORT_C TBool EmbeddedPreviewCompletedL(CData& aContent); williamr@2: williamr@2: /** williamr@2: * This method should be called after embedded preview has been played. williamr@2: * It asks from user if he/she wants to buy rights and acquires those if user agrees. williamr@2: * Leaves with system-wide error code in case of error. williamr@2: * @param aFileName: Full path to file. williamr@2: * @return ETrue if user selects to buy rights. williamr@2: */ williamr@2: IMPORT_C TBool EmbeddedPreviewCompletedL(TDesC& aFileName); williamr@2: williamr@2: /** williamr@2: * Checks if given content has InfoUrl. williamr@2: * Leaves with system-wide error code in case of error. williamr@2: * @param aContent: Content object. williamr@2: * @param aInfoUrl: Out: InfoUrl. Must be freed by caller. williamr@2: * @return ETrue if content has InfoUrl. williamr@2: */ williamr@2: IMPORT_C TBool HasInfoUrlL(CData& aContent, HBufC8*& aInfoUrl); williamr@2: williamr@2: /** williamr@2: * Checks if given content has InfoUrl. williamr@2: * Leaves with system-wide error code in case of error. williamr@2: * @param aFileName: Full path to file. williamr@2: * @param aInfoUrl: Out: InfoUrl. Must be freed by caller. williamr@2: * @return ETrue if content has InfoUrl. williamr@2: */ williamr@2: IMPORT_C TBool HasInfoUrlL(TDesC& aFileName, HBufC8*& aInfoUrl); williamr@2: williamr@2: /** williamr@2: * Opens browser with InfoUrl of the content. williamr@2: * Leaves with system-wide error code in case of error. williamr@2: * @param aContent: Content object. williamr@2: */ williamr@2: IMPORT_C void OpenInfoUrlL(CData& aContent); williamr@2: williamr@2: /** williamr@2: * Opens browser with InfoUrl of the content. williamr@2: * Leaves with system-wide error code in case of error. williamr@2: * @param aFileName: Full path to file. williamr@2: */ williamr@2: IMPORT_C void OpenInfoUrlL(TDesC& aFileName); williamr@2: williamr@2: /** williamr@2: * Sets the type of automated content to be registered. This method williamr@2: * should be called before calling any of SetAutomated* methods. williamr@2: * @param aAutomatedType: type of automated content williamr@2: * @return System wide error code williamr@2: * @since Series 60 3.0 williamr@2: */ williamr@2: IMPORT_C TInt SetAutomatedType( TDRMHelperAutomatedType aAutomatedType ); williamr@2: williamr@2: /** williamr@2: * Sets media type of content for preview. Should be called prior to williamr@2: * calling HandleErrorOrPreviewL or EmbeddedPreviewCompletedL. williamr@2: * @param aMediaType: media type of content. williamr@2: * @return System wide error code williamr@2: * @since S60 3.1u williamr@2: */ williamr@2: IMPORT_C TInt SetPreviewMediaType( williamr@2: TDRMHelperPreviewMediaType aMediaType ); williamr@2: williamr@2: protected: // New functions williamr@2: williamr@2: /** williamr@2: * ?member_description. williamr@2: * @since ?Series60_version williamr@2: * @param ?arg1 ?description williamr@2: * @return ?description williamr@2: */ williamr@2: //?type ?member_function( ?type ?arg1 ); williamr@2: williamr@2: protected: // Functions from base classes williamr@2: williamr@2: /** williamr@2: * From ?base_class ?member_description williamr@2: */ williamr@2: //?type ?member_function(); williamr@2: williamr@2: williamr@2: private: williamr@2: williamr@2: /** williamr@2: * C++ default constructor. williamr@2: */ williamr@2: CDRMHelper( CCoeEnv& aCoeEnv ); williamr@2: CDRMHelper(); williamr@2: williamr@2: /** williamr@2: * By default Symbian 2nd phase constructor is private. williamr@2: */ williamr@2: void ConstructL( RFs* aFs ); williamr@2: williamr@2: // Prohibit copy constructor if not deriving from CBase. williamr@2: // ?classname( const ?classname& ); williamr@2: // Prohibit assigment operator if not deriving from CBase. williamr@2: // ?classname& operator=( const ?classname& ); williamr@2: williamr@2: /** williamr@2: * Display query dialog williamr@2: */ williamr@2: TInt DisplayQueryWithIdL( TInt aTextResourceId, TInt aQueryResourceId ); williamr@2: TInt DisplayQueryWithIdValueL( TInt aTextResourceId, TInt aQueryResourceId, williamr@2: const TDesC& aString ); williamr@2: TInt DisplayQueryL( TInt aTextResourceId, TInt aValue ); williamr@2: TInt DisplayQueryL( TInt aTextResourceId, const TDesC& aString ); williamr@2: TInt DisplayQueryL( williamr@2: TInt aTextResourceId, williamr@2: const TDesC& aString, williamr@2: TInt aValue, williamr@2: TInt aStringPos = -1, williamr@2: TInt aValuePos = -1 ); williamr@2: TInt DisplayQueryL( TDesC& aPromptText, TInt aQueryResourceId ); williamr@2: williamr@2: /** williamr@2: * Display information note williamr@2: */ williamr@2: void DisplayInfoNoteL( TInt aTextResourceId ); williamr@2: void DisplayInfoNoteL( TInt aTextResourceId, const TDesC& aString ); williamr@2: void DisplayInfoNoteL( TInt aTextResourceId, TInt aValue ); williamr@2: void DisplayInfoNoteL( TDesC& aPromptText, TInt aResourceId, williamr@2: const TDesC& aString = KNullDesC, TInt aValue = -1 ); williamr@2: williamr@2: /** williamr@2: * Launch browser embedded williamr@2: */ williamr@2: void LaunchBrowserL( HBufC8* aUrl ); williamr@2: void LaunchBrowserL( HBufC* aUrl ); williamr@2: williamr@2: /** williamr@2: * Get rights-issuer URI from DCF file williamr@2: */ williamr@2: void GetRightsIssuerL( const CData& aContent, HBufC*& aIssuer ); williamr@2: williamr@2: /** williamr@2: * Get time and count based constraints williamr@2: */ williamr@2: TInt GetCounts( CDRMRightsConstraints* aConstraint, williamr@2: TUint32& aOriginalCount, TTimeIntervalDays& aDuration ); williamr@2: williamr@2: TInt GetCounts( CDRMRightsConstraints* aConstraint, williamr@2: TUint32& aCountLeft, TTime& aEndTime ); williamr@2: williamr@2: TInt GetCounts( CDRMConstraint* aConstraint, williamr@2: TUint32& aOriginalCount, TTimeIntervalDays& aDuration ); williamr@2: williamr@2: TInt GetCounts( CDRMConstraint* aConstraint, williamr@2: TUint32& aCountLeft, TTime& aEndTime ); williamr@2: williamr@2: /** williamr@2: * Launch rights manager UI williamr@2: */ williamr@2: void LaunchRightsManagerUiL( const TDesC& aParam16 ); williamr@2: williamr@2: /** williamr@2: * Form string needed to launch rights manager UI embedded. williamr@2: */ williamr@2: void CreateLaunchParamL( TUint32 aLocalId, const HBufC8* aUrl, williamr@2: HBufC*& aLaunchParam ); williamr@2: williamr@2: /** williamr@2: * Strip path and extension from given filename. williamr@2: * Caller is responsible for freeing returned buffer williamr@2: */ williamr@2: TPtrC StripPathAndExtension( const TDesC& aFileName ); williamr@2: williamr@2: /** williamr@2: * Get expiration details of file. williamr@2: * Returns DRMCommon::ENoRights if no rights object found or williamr@2: * CDRMRights::TExpiration value williamr@2: */ williamr@2: TInt GetExpirationDetails( HBufC8* aContentUri, TInt aIntent, williamr@2: CDRMRights*& aRightsObject ); williamr@2: williamr@2: /** williamr@2: * Get expiration time of given rights object williamr@2: */ williamr@2: TInt CalculateEndTime( CDRMRights* aRights, TInt aIntent, williamr@2: TTime& aEndTime, TBool& aInactive ); williamr@2: williamr@2: /** williamr@2: * Get end time of given constraint williamr@2: */ williamr@2: TInt GetEndTime( CDRMRightsConstraints* aConstraint, williamr@2: TTime& aEndTime, TBool& aInactive ); williamr@2: williamr@2: /** williamr@2: * Register content as automated williamr@2: */ williamr@2: TInt PerformSetAutomatedL( const CData& aContent, TBool aActive ); williamr@2: TInt DoSetAutomatedL( const TDesC8& aURI, TBool aActive, williamr@2: const HBufC* aMimeType ); williamr@2: williamr@2: /** williamr@2: * Display confirmation query about setting as automated. Does not williamr@2: * actually register. williamr@2: */ williamr@2: TInt PerformShowAutomatedNoteL( const CData& aContent ); williamr@2: TInt DoShowAutomatedNoteL( const TDesC8& aURI, williamr@2: const HBufC* aMimeType ); williamr@2: williamr@2: /** williamr@2: * Register content as automated without showing any queries williamr@2: */ williamr@2: TInt PerformSetAutomatedSilentL( const CData& aContent, TBool aActive ); williamr@2: TInt DoSetAutomatedSilent( const TDesC8& aURI, TBool aActive, TInt aIntent ); williamr@2: williamr@2: /** williamr@2: * Returns default intent for the mimetype williamr@2: */ williamr@2: TInt Intent( const HBufC* aMimeType ); williamr@2: williamr@2: /** williamr@2: * Checks if content can be used as automated content williamr@2: */ williamr@2: TInt PerformCanSetAutomatedL( const CData& aContent,TBool& aValue ); williamr@2: TInt DoCanSetAutomated( const TDesC8& aURI, const HBufC* aMimeType, williamr@2: TBool& aValue ); williamr@2: TBool DoCheckSkinCanSetAutomated(CDRMRights* aRights); williamr@2: williamr@2: /** williamr@2: * Gets mimetype based on content URI williamr@2: */ williamr@2: HBufC* MimeTypeFromURIL( const TDesC8& aURI ); williamr@2: williamr@2: /** williamr@2: * Gets corresponding filename (including full path) based on content williamr@2: * URI williamr@2: */ williamr@2: TInt GetFileHandleFromURIL( const TDesC8& aURI, RFile& aFileHandle ); williamr@2: williamr@2: /** williamr@2: * Get start time of given rights object williamr@2: */ williamr@2: TInt GetStartTime( CDRMRights* aRights, TInt aIntent, williamr@2: TTime& aStartTime ); williamr@2: williamr@2: /** williamr@2: * Displays info note of rights that are not yet valid williamr@2: */ williamr@2: TInt ShowFutureNoteL( const HBufC* aMimeType, CDRMRights* aRightsObject ); williamr@2: williamr@2: /** williamr@2: * Handles error by displaying appropriate note to user. williamr@2: */ williamr@2: TInt DoHandleErrorL( TInt aError, HBufC8* aContentUri, HBufC* aMimeType, williamr@2: HBufC* aRIUrl, HBufC* aDomainRoUrl, HBufC* aEta, HBufC8* aRiId8, williamr@2: HBufC8* aDomainId8, const TDesC& aFileName ); williamr@2: williamr@2: /** williamr@2: * Checks if rights are about to expire. williamr@2: */ williamr@2: TInt DoCheckRightsPercentL( HBufC8* aContentUri, HBufC* aMimeType, williamr@2: HBufC* aRIUrl, const TDesC& aFileName, TInt aThreshold ); williamr@2: williamr@2: TInt DoCheckRightsAmountL( HBufC8* aContentUri, HBufC* aMimeType, williamr@2: HBufC* aRIUrl, const TDesC& aFileName, TInt aCount, TInt aDays ); williamr@2: williamr@2: /** williamr@2: * Gets rights details. williamr@2: */ williamr@2: void DoGetRightsDetailsL( HBufC8* aContentUri, TUint32 aIntent, williamr@2: TBool& aExpired, CDRMHelperRightsConstraints*& aPlay, williamr@2: CDRMHelperRightsConstraints*& aDisplay, williamr@2: CDRMHelperRightsConstraints*& aExecute, williamr@2: CDRMHelperRightsConstraints*& aPrint ); williamr@2: williamr@2: void DoGetRightsDetailsL( CData* aContent, TUint32 aIntent, williamr@2: TBool& aExpired, TBool& aSendingAllowed, CDRMRightsConstraints*& aPlay, williamr@2: CDRMRightsConstraints*& aDisplay, williamr@2: CDRMRightsConstraints*& aExecute, williamr@2: CDRMRightsConstraints*& aPrint ); williamr@2: williamr@2: /** williamr@2: * Get constraints for given rights williamr@2: */ williamr@2: void GetConstraintsL( williamr@2: CDRMRights& aRights, williamr@2: CDRMHelperRightsConstraints*& aPlay, williamr@2: CDRMHelperRightsConstraints*& aDisplay, williamr@2: CDRMHelperRightsConstraints*& aExecute, williamr@2: CDRMHelperRightsConstraints*& aPrint ); williamr@2: williamr@2: /** williamr@2: * Unregisters automated content. williamr@2: */ williamr@2: TInt PerformRemoveAutomatedL( const CData& aContent, TBool aActive ); williamr@2: williamr@2: void HandleServerAppExit(TInt aReason); williamr@2: williamr@2: void CheckPreviewUriL( williamr@2: const CData* aContent, williamr@2: HBufC*& aEmbeddedPreviewUri, williamr@2: TInt& aPreviewType ); williamr@2: williamr@2: TInt DisplayPopupWindowsForPreviewL(TInt aPreviewType); williamr@2: williamr@2: /** williamr@2: * Returns correct resource id for automated content notes. williamr@2: * If aExpired is ETrue, aSecondParameter indicates if RI URL exists williamr@2: * If aExpired is EFalse, aSecondParameter indicates if there is one day left williamr@2: * aRejectReason tells the constraints which are invalid. williamr@2: */ williamr@2: TInt AutomatedResIdL( TBool aExpired, TBool aSecondParameter, TUint32 aRejectReason ); williamr@2: williamr@2: /** williamr@2: * Returns the correct resource id for expired and no rights notes williamr@2: */ williamr@2: TInt ErrorResIdL( const TDesC8& aContentUri, TInt aIntent, williamr@2: TBool aRightsIssuer, TBool aExpired ); williamr@2: williamr@2: /** williamr@2: * Returns the constraints which are invalid williamr@2: */ williamr@2: TUint32 RejectReasonL( TInt aIntent, const TDesC8& aContentUri ); williamr@2: williamr@2: /** williamr@2: * Prepares secondary display for DRM notes williamr@2: */ williamr@2: void PrepareSecondaryDisplayL( CEikDialog& aDialog, TInt aResourceId, williamr@2: const TDesC& aString = KNullDesC, TInt aValue = -1 ); williamr@2: williamr@2: /** williamr@2: * Cancels secondary display for DRM notes williamr@2: */ williamr@2: void CancelSecondaryDisplayL( TInt aResourceId ); williamr@2: williamr@2: /** williamr@2: * Check whether a file as a silent rights URL which can be used, i.e the URL is valid williamr@2: * and on the white list. williamr@2: */ williamr@2: HBufC8* HasSilentRightsUrlL( CData* aContent ); williamr@2: williamr@2: /** williamr@2: * Get rights silently williamr@2: */ williamr@2: TInt GetSilentRightsL( const TDesC8& aUrl ); williamr@2: williamr@2: /** williamr@2: * Check if the user has allowed silent rights williamr@2: */ williamr@2: TBool SilentRightsAllowedL(); williamr@2: williamr@2: /** williamr@2: * Check if browser AP has been defined williamr@2: */ williamr@2: TBool BrowserAPDefinedL(); williamr@2: williamr@2: protected: // Data williamr@2: // ?one_line_short_description_of_data williamr@2: //?data_declaration; williamr@2: williamr@2: private: // Data williamr@2: CCoeEnv* iCoeEnv; williamr@2: williamr@2: // DRM engine williamr@2: DRMCommon* iDRMCommon; williamr@2: williamr@2: // used to make launching rights manager ui synchronous williamr@2: CActiveSchedulerWait iWait; williamr@2: williamr@2: RDRMHelper iHelperServer; williamr@2: williamr@2: // is CoeEnv used williamr@2: TBool iUseCoeEnv; williamr@2: williamr@2: // Used to read resources when CoeEnv is not available williamr@2: CStringResourceReader* iStringResourceReader; williamr@2: williamr@2: TBool iOma2; williamr@2: williamr@2: RPointerArray iConsumeList; williamr@2: williamr@2: TInt iAutomatedType; williamr@2: williamr@2: RFs iFs; williamr@2: williamr@2: TBool iFsOwned; williamr@2: williamr@2: TInt iPreviewMediaType; williamr@2: williamr@2: // Used to queue up global notes williamr@2: RPointerArray iNoteList; williamr@2: williamr@2: CSchemeHandler* iSchemeHandler; williamr@2: williamr@2: TBool iReturnCancel; williamr@2: williamr@2: // Used to send cancel events to cover ui williamr@2: CMediatorEventProvider* iEventProvider; williamr@2: williamr@2: public: // Friend classes williamr@2: protected: // Friend classes williamr@2: private: // Friend classes williamr@2: williamr@2: }; williamr@2: williamr@2: #endif // __DRMHELPER_H__ williamr@2: williamr@2: // End of File williamr@2: