2 * Copyright (c) 2004-2009 Nokia Corporation and/or its subsidiary(-ies).
4 * This component and the accompanying materials are made available
5 * under the terms of the License "Eclipse Public License v1.0"
6 * which accompanies this distribution, and is available
7 * at the URL "http://www.eclipse.org/legal/epl-v10.html".
9 * Initial Contributors:
10 * Nokia Corporation - initial contribution.
28 #ifndef __RIGHTSINFO_H__
29 #define __RIGHTSINFO_H__
32 #include <caf/caftypes.h>
37 namespace ContentAccess
40 /** Rights class to store a summary description of the rights and a unique
41 reference to the rights object within an Agent
46 class CRightsInfo : public CBase
50 /** Construct a new CRightsInfo
52 @param aDescription A generic text description of the rights supplied by the agent "Content XYZ Expiry date mm/dd/yy" etc
53 @param aUniqueId A uniqueId used to refer to this particular rights object within the agent it came from
54 @param aRightsTypeMask A bitmask of TRightsType entries applicable to this rights object
55 @param aRightsStatus The current status of this rights object
56 @return A CRightsInfo object
58 IMPORT_C static CRightsInfo* NewL(const TDesC& aDescription, const TDesC& aUniqueId, TInt aRightsTypeMask, TRightsStatus aRightsStatus);
60 /** Construct a new CRightsInfo from a stream */
61 IMPORT_C static CRightsInfo* NewL(RReadStream& aStream);
63 virtual ~CRightsInfo();
65 /** returns a string describing the rights object
66 @capability DRM Access to DRM rights is not permitted for processes without DRM capability.
68 IMPORT_C const TDesC& Description() const;
70 /** returns a string with a unique Id used to identify a particular rights object
71 @capability DRM Access to DRM rights is not permitted for processes without DRM capability.
73 IMPORT_C const TDesC& UniqueId() const;
75 /** Returns a bit mask of TRightsTypeMask flags. A rights object can be stateless and/or consumable
77 @see ContentAccess::TRightsTypeMask
79 @capability DRM Access to DRM rights is not permitted for processes without DRM capability.
81 IMPORT_C TInt RightsType() const;
83 /** The state of the rights
85 @see ContentAccess::TRightsStatus
87 @capability DRM Access to DRM rights is not permitted for processes without DRM capability.
89 IMPORT_C TRightsStatus RightsStatus() const;
91 /** Write this CRightsInfo object to a stream
93 @param aStream The stream
95 IMPORT_C void ExternalizeL(RWriteStream &aStream) const;
100 CRightsInfo(TInt aRightsType, TRightsStatus aRightsStatus);
101 void ConstructL(const TDesC& aDescription, const TDesC& aUniqueId);
103 void InternalizeL(RReadStream& aStream);
111 TRightsStatus iRightsStatus;
114 /** Interface used by agents as a base class for their own rights objects
116 Agent derived classes will contain a complete object capable of describing
117 rights for content managed by that agent.
119 All derived classes must implement the serialization functions InternalizeL()
125 class MAgentRightsBase
128 virtual void ExternalizeL(RWriteStream& aStream) const = 0;
129 virtual void InternalizeL(RReadStream& aStream) = 0;