sl@0
|
1 |
/*
|
sl@0
|
2 |
* Copyright (c) 2004-2009 Nokia Corporation and/or its subsidiary(-ies).
|
sl@0
|
3 |
* All rights reserved.
|
sl@0
|
4 |
* This component and the accompanying materials are made available
|
sl@0
|
5 |
* under the terms of the License "Eclipse Public License v1.0"
|
sl@0
|
6 |
* which accompanies this distribution, and is available
|
sl@0
|
7 |
* at the URL "http://www.eclipse.org/legal/epl-v10.html".
|
sl@0
|
8 |
*
|
sl@0
|
9 |
* Initial Contributors:
|
sl@0
|
10 |
* Nokia Corporation - initial contribution.
|
sl@0
|
11 |
*
|
sl@0
|
12 |
* Contributors:
|
sl@0
|
13 |
*
|
sl@0
|
14 |
* Description:
|
sl@0
|
15 |
*
|
sl@0
|
16 |
*/
|
sl@0
|
17 |
|
sl@0
|
18 |
|
sl@0
|
19 |
/**
|
sl@0
|
20 |
@file
|
sl@0
|
21 |
@publishedPartner
|
sl@0
|
22 |
@released
|
sl@0
|
23 |
*/
|
sl@0
|
24 |
|
sl@0
|
25 |
|
sl@0
|
26 |
#ifndef __RIGHTSINFO_H__
|
sl@0
|
27 |
#define __RIGHTSINFO_H__
|
sl@0
|
28 |
|
sl@0
|
29 |
#include <e32base.h>
|
sl@0
|
30 |
#include <caf/caftypes.h>
|
sl@0
|
31 |
|
sl@0
|
32 |
class RWriteStream;
|
sl@0
|
33 |
class RReadStream;
|
sl@0
|
34 |
|
sl@0
|
35 |
namespace ContentAccess
|
sl@0
|
36 |
{
|
sl@0
|
37 |
|
sl@0
|
38 |
/** Rights class to store a summary description of the rights and a unique
|
sl@0
|
39 |
reference to the rights object within an Agent
|
sl@0
|
40 |
|
sl@0
|
41 |
*/
|
sl@0
|
42 |
class CRightsInfo : public CBase
|
sl@0
|
43 |
{
|
sl@0
|
44 |
public:
|
sl@0
|
45 |
|
sl@0
|
46 |
/** Construct a new CRightsInfo
|
sl@0
|
47 |
|
sl@0
|
48 |
@param aDescription A generic text description of the rights supplied by the agent "Content XYZ Expiry date mm/dd/yy" etc
|
sl@0
|
49 |
@param aUniqueId A uniqueId used to refer to this particular rights object within the agent it came from
|
sl@0
|
50 |
@param aRightsTypeMask A bitmask of TRightsType entries applicable to this rights object
|
sl@0
|
51 |
@param aRightsStatus The current status of this rights object
|
sl@0
|
52 |
@return A CRightsInfo object
|
sl@0
|
53 |
*/
|
sl@0
|
54 |
IMPORT_C static CRightsInfo* NewL(const TDesC& aDescription, const TDesC& aUniqueId, TInt aRightsTypeMask, TRightsStatus aRightsStatus);
|
sl@0
|
55 |
|
sl@0
|
56 |
/** Construct a new CRightsInfo from a stream */
|
sl@0
|
57 |
IMPORT_C static CRightsInfo* NewL(RReadStream& aStream);
|
sl@0
|
58 |
|
sl@0
|
59 |
virtual ~CRightsInfo();
|
sl@0
|
60 |
|
sl@0
|
61 |
/** returns a string describing the rights object
|
sl@0
|
62 |
@capability DRM Access to DRM rights is not permitted for processes without DRM capability.
|
sl@0
|
63 |
*/
|
sl@0
|
64 |
IMPORT_C const TDesC& Description() const;
|
sl@0
|
65 |
|
sl@0
|
66 |
/** returns a string with a unique Id used to identify a particular rights object
|
sl@0
|
67 |
@capability DRM Access to DRM rights is not permitted for processes without DRM capability.
|
sl@0
|
68 |
*/
|
sl@0
|
69 |
IMPORT_C const TDesC& UniqueId() const;
|
sl@0
|
70 |
|
sl@0
|
71 |
/** Returns a bit mask of TRightsTypeMask flags. A rights object can be stateless and/or consumable
|
sl@0
|
72 |
|
sl@0
|
73 |
@see ContentAccess::TRightsTypeMask
|
sl@0
|
74 |
|
sl@0
|
75 |
@capability DRM Access to DRM rights is not permitted for processes without DRM capability.
|
sl@0
|
76 |
*/
|
sl@0
|
77 |
IMPORT_C TInt RightsType() const;
|
sl@0
|
78 |
|
sl@0
|
79 |
/** The state of the rights
|
sl@0
|
80 |
|
sl@0
|
81 |
@see ContentAccess::TRightsStatus
|
sl@0
|
82 |
|
sl@0
|
83 |
@capability DRM Access to DRM rights is not permitted for processes without DRM capability.
|
sl@0
|
84 |
*/
|
sl@0
|
85 |
IMPORT_C TRightsStatus RightsStatus() const;
|
sl@0
|
86 |
|
sl@0
|
87 |
/** Write this CRightsInfo object to a stream
|
sl@0
|
88 |
|
sl@0
|
89 |
@param aStream The stream
|
sl@0
|
90 |
*/
|
sl@0
|
91 |
IMPORT_C void ExternalizeL(RWriteStream &aStream) const;
|
sl@0
|
92 |
|
sl@0
|
93 |
private:
|
sl@0
|
94 |
CRightsInfo();
|
sl@0
|
95 |
|
sl@0
|
96 |
CRightsInfo(TInt aRightsType, TRightsStatus aRightsStatus);
|
sl@0
|
97 |
void ConstructL(const TDesC& aDescription, const TDesC& aUniqueId);
|
sl@0
|
98 |
|
sl@0
|
99 |
void InternalizeL(RReadStream& aStream);
|
sl@0
|
100 |
|
sl@0
|
101 |
private:
|
sl@0
|
102 |
|
sl@0
|
103 |
HBufC* iDescription;
|
sl@0
|
104 |
HBufC* iUniqueId;
|
sl@0
|
105 |
|
sl@0
|
106 |
TInt iRightsType;
|
sl@0
|
107 |
TRightsStatus iRightsStatus;
|
sl@0
|
108 |
};
|
sl@0
|
109 |
|
sl@0
|
110 |
/** Interface used by agents as a base class for their own rights objects
|
sl@0
|
111 |
|
sl@0
|
112 |
Agent derived classes will contain a complete object capable of describing
|
sl@0
|
113 |
rights for content managed by that agent.
|
sl@0
|
114 |
|
sl@0
|
115 |
All derived classes must implement the serialization functions InternalizeL()
|
sl@0
|
116 |
and ExternalizeL()
|
sl@0
|
117 |
|
sl@0
|
118 |
*/
|
sl@0
|
119 |
class MAgentRightsBase
|
sl@0
|
120 |
{
|
sl@0
|
121 |
public:
|
sl@0
|
122 |
virtual void ExternalizeL(RWriteStream& aStream) const = 0;
|
sl@0
|
123 |
virtual void InternalizeL(RReadStream& aStream) = 0;
|
sl@0
|
124 |
};
|
sl@0
|
125 |
}
|
sl@0
|
126 |
|
sl@0
|
127 |
#endif
|