sl@0: /* 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 the License "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: * sl@0: */ sl@0: sl@0: sl@0: /** sl@0: @file sl@0: @publishedPartner sl@0: @released sl@0: */ sl@0: sl@0: sl@0: #ifndef __RIGHTSINFO_H__ sl@0: #define __RIGHTSINFO_H__ sl@0: sl@0: #include sl@0: #include sl@0: sl@0: class RWriteStream; sl@0: class RReadStream; sl@0: sl@0: namespace ContentAccess sl@0: { sl@0: sl@0: /** Rights class to store a summary description of the rights and a unique sl@0: reference to the rights object within an Agent sl@0: sl@0: */ sl@0: class CRightsInfo : public CBase sl@0: { sl@0: public: sl@0: sl@0: /** Construct a new CRightsInfo sl@0: sl@0: @param aDescription A generic text description of the rights supplied by the agent "Content XYZ Expiry date mm/dd/yy" etc sl@0: @param aUniqueId A uniqueId used to refer to this particular rights object within the agent it came from sl@0: @param aRightsTypeMask A bitmask of TRightsType entries applicable to this rights object sl@0: @param aRightsStatus The current status of this rights object sl@0: @return A CRightsInfo object sl@0: */ sl@0: IMPORT_C static CRightsInfo* NewL(const TDesC& aDescription, const TDesC& aUniqueId, TInt aRightsTypeMask, TRightsStatus aRightsStatus); sl@0: sl@0: /** Construct a new CRightsInfo from a stream */ sl@0: IMPORT_C static CRightsInfo* NewL(RReadStream& aStream); sl@0: sl@0: virtual ~CRightsInfo(); sl@0: sl@0: /** returns a string describing the rights object sl@0: @capability DRM Access to DRM rights is not permitted for processes without DRM capability. sl@0: */ sl@0: IMPORT_C const TDesC& Description() const; sl@0: sl@0: /** returns a string with a unique Id used to identify a particular rights object sl@0: @capability DRM Access to DRM rights is not permitted for processes without DRM capability. sl@0: */ sl@0: IMPORT_C const TDesC& UniqueId() const; sl@0: sl@0: /** Returns a bit mask of TRightsTypeMask flags. A rights object can be stateless and/or consumable sl@0: sl@0: @see ContentAccess::TRightsTypeMask sl@0: sl@0: @capability DRM Access to DRM rights is not permitted for processes without DRM capability. sl@0: */ sl@0: IMPORT_C TInt RightsType() const; sl@0: sl@0: /** The state of the rights sl@0: sl@0: @see ContentAccess::TRightsStatus sl@0: sl@0: @capability DRM Access to DRM rights is not permitted for processes without DRM capability. sl@0: */ sl@0: IMPORT_C TRightsStatus RightsStatus() const; sl@0: sl@0: /** Write this CRightsInfo object to a stream sl@0: sl@0: @param aStream The stream sl@0: */ sl@0: IMPORT_C void ExternalizeL(RWriteStream &aStream) const; sl@0: sl@0: private: sl@0: CRightsInfo(); sl@0: sl@0: CRightsInfo(TInt aRightsType, TRightsStatus aRightsStatus); sl@0: void ConstructL(const TDesC& aDescription, const TDesC& aUniqueId); sl@0: sl@0: void InternalizeL(RReadStream& aStream); sl@0: sl@0: private: sl@0: sl@0: HBufC* iDescription; sl@0: HBufC* iUniqueId; sl@0: sl@0: TInt iRightsType; sl@0: TRightsStatus iRightsStatus; sl@0: }; sl@0: sl@0: /** Interface used by agents as a base class for their own rights objects sl@0: sl@0: Agent derived classes will contain a complete object capable of describing sl@0: rights for content managed by that agent. sl@0: sl@0: All derived classes must implement the serialization functions InternalizeL() sl@0: and ExternalizeL() sl@0: sl@0: */ sl@0: class MAgentRightsBase sl@0: { sl@0: public: sl@0: virtual void ExternalizeL(RWriteStream& aStream) const = 0; sl@0: virtual void InternalizeL(RReadStream& aStream) = 0; sl@0: }; sl@0: } sl@0: sl@0: #endif