epoc32/include/caf/data.h
author William Roberts <williamr@symbian.org>
Wed, 31 Mar 2010 12:33:34 +0100
branchSymbian3
changeset 4 837f303aceeb
parent 2 2fe1408b6811
permissions -rw-r--r--
Current Symbian^3 public API header files (from PDK 3.0.h)
This is the epoc32/include tree with the "platform" subtrees removed, and
all but a selected few mbg and rsg files removed.
williamr@2
     1
/*
williamr@4
     2
* Copyright (c) 2003-2008 Nokia Corporation and/or its subsidiary(-ies).
williamr@2
     3
* All rights reserved.
williamr@2
     4
* This component and the accompanying materials are made available
williamr@2
     5
* under the terms of the License "Eclipse Public License v1.0"
williamr@2
     6
* which accompanies this distribution, and is available
williamr@2
     7
* at the URL "http://www.eclipse.org/legal/epl-v10.html".
williamr@2
     8
*
williamr@2
     9
* Initial Contributors:
williamr@2
    10
* Nokia Corporation - initial contribution.
williamr@2
    11
*
williamr@2
    12
* Contributors:
williamr@2
    13
*
williamr@2
    14
* Description: 
williamr@2
    15
*
williamr@2
    16
*/
williamr@2
    17
williamr@2
    18
williamr@2
    19
williamr@2
    20
/** 
williamr@2
    21
@file
williamr@2
    22
williamr@4
    23
@publishedAll
williamr@2
    24
@released
williamr@2
    25
*/
williamr@2
    26
williamr@2
    27
williamr@2
    28
#ifndef __DATA_H__
williamr@2
    29
#define __DATA_H__
williamr@2
    30
williamr@2
    31
#include <e32base.h>
williamr@2
    32
#include <f32file.h>
williamr@2
    33
#include <caf/caftypes.h>
williamr@2
    34
williamr@2
    35
namespace ContentAccess
williamr@2
    36
{
williamr@2
    37
	class CAgentFactory;
williamr@2
    38
	class CAgentInfo;
williamr@2
    39
	class TVirtualPathPtr;
williamr@2
    40
	class CAgentData;
williamr@2
    41
	class RAttributeSet;
williamr@2
    42
	class RStringAttributeSet;
williamr@2
    43
	
williamr@2
    44
williamr@2
    45
	/**
williamr@2
    46
 	Allows clients to read data from a content object. 
williamr@2
    47
	 
williamr@2
    48
 	This class is initialised with an agent implementation that is
williamr@2
    49
 	responsible for this content object.
williamr@2
    50
 
williamr@2
    51
 	*/
williamr@2
    52
	class CData : public CBase
williamr@2
    53
		{
williamr@2
    54
	public:
williamr@2
    55
		/** 
williamr@2
    56
		 Creates a new CData object. 
williamr@2
    57
		 
williamr@2
    58
		 @param aVirtualPath The content object to read
williamr@2
    59
		 @param aIntent	The intended use of the content.
williamr@2
    60
		 @param aShareMode The file share mode used to open this content.
williamr@2
    61
		 @return The new CData object.
williamr@2
    62
		  
williamr@2
    63
		 @leave KErrNotFound		The content object with the given UniqueId does not exist.
williamr@2
    64
		 @leave KErrCAPendingRights The rights have not yet arrived but are expected soon.
williamr@2
    65
		 @leave KErrCANoPermission	Rights exist but the specified intent is not permitted.
williamr@2
    66
		 @leave KErrCANoRights		No rights exist for the content object.
williamr@2
    67
		 @leave KErrCANotSupported	Unable to open the object with the specified UniqueId, it may be a container object.
williamr@2
    68
		 @leave KErrPermissionDenied The agent does not allow the client to access the content object.
williamr@2
    69
		 @leave KErrAccessDenied	The content is already in use.
williamr@2
    70
		 @leave ...		One of the other CAF error codes defined in \c caferr.h  
williamr@2
    71
		 				or one of the other system-wide error codes 
williamr@2
    72
						for any other errors.
williamr@2
    73
		 */
williamr@2
    74
		IMPORT_C static CData* NewL(const TVirtualPathPtr& aVirtualPath,
williamr@2
    75
							TIntent aIntent, TContentShareMode aShareMode); 
williamr@2
    76
williamr@2
    77
		/** 
williamr@2
    78
		 Creates a new CData object. 
williamr@2
    79
		 
williamr@2
    80
		 @param aVirtualPath The content object to read.
williamr@2
    81
		 @param aShareMode The file share mode used to open this content.
williamr@2
    82
		 @return The new CData object.
williamr@2
    83
		  
williamr@2
    84
		 @leave KErrNotFound		The content object with the given UniqueId does not exist.
williamr@2
    85
		 @leave KErrCAPendingRights The rights have not yet arrived but are expected soon.
williamr@2
    86
		 @leave KErrCANoPermission	Rights exist but the specified intent is not permitted.
williamr@2
    87
		 @leave KErrCANoRights		No rights exist for the content object.
williamr@2
    88
		 @leave KErrCANotSupported	Unable to open the object with the specified UniqueId, it may be a container object.
williamr@2
    89
		 @leave KErrPermissionDenied The agent does not allow the client to access the content object.
williamr@2
    90
		 @leave KErrAccessDenied	The content is already in use.
williamr@2
    91
		 @leave ... 	One of the other CAF error codes defined in \c caferr.h  
williamr@2
    92
		 				or one of the other system-wide error codes for 
williamr@2
    93
						any other errors.		 
williamr@2
    94
		 */
williamr@2
    95
		IMPORT_C static CData* NewL(const TVirtualPathPtr& aVirtualPath,
williamr@2
    96
							TContentShareMode aShareMode); 
williamr@2
    97
		
williamr@2
    98
williamr@2
    99
		/** 
williamr@2
   100
		 Creates a new CData object 
williamr@2
   101
		 
williamr@2
   102
		 @param aVirtualPath The content object to read.
williamr@2
   103
		 @param aIntent	The intended use of the content.
williamr@2
   104
		 @param aShareMode The file share mode used to open this content.
williamr@2
   105
		 @return The new CData object.
williamr@2
   106
		  
williamr@2
   107
		 @leave KErrNotFound		The content object with the given UniqueId does not exist.
williamr@2
   108
		 @leave KErrCAPendingRights The rights have not yet arrived but are expected soon.
williamr@2
   109
		 @leave KErrCANoPermission	Rights exist but the specified intent is not permitted.
williamr@2
   110
		 @leave KErrCANoRights		No rights exist for the content object.
williamr@2
   111
		 @leave KErrCANotSupported	Unable to open the object with the specified UniqueId, it may be a container object.
williamr@2
   112
		 @leave KErrPermissionDenied The agent does not allow the client to access the content object.
williamr@2
   113
		 @leave KErrAccessDenied	The content is already in use.
williamr@2
   114
		 @leave ...		One of the other CAF error codes defined in \c caferr.h  
williamr@2
   115
		 				or one of the other system-wide error codes for 
williamr@2
   116
						any other errors.
williamr@2
   117
		 */
williamr@2
   118
		IMPORT_C static CData* NewLC(const TVirtualPathPtr& aVirtualPath,
williamr@2
   119
							TIntent aIntent, TContentShareMode aShareMode); 
williamr@2
   120
williamr@2
   121
		/** 
williamr@2
   122
		 Creates a new CData object 
williamr@2
   123
		 
williamr@2
   124
		 @param aVirtualPath The content object to read.
williamr@2
   125
		 @param aShareMode The file share mode used to open this content.
williamr@2
   126
		 @return The new CData object.
williamr@2
   127
		  
williamr@2
   128
		 @leave KErrNotFound		The content object with the given UniqueId does not exist.
williamr@2
   129
		 @leave KErrCAPendingRights The rights have not yet arrived but are expected soon.
williamr@2
   130
		 @leave KErrCANoPermission	Rights exist but the specified intent is not permitted.
williamr@2
   131
		 @leave KErrCANoRights		No rights exist for the content object.
williamr@2
   132
		 @leave KErrCANotSupported	Unable to open the object with the specified UniqueId, it may be a container object.
williamr@2
   133
		 @leave KErrPermissionDenied The agent does not allow the client to access the content object.
williamr@2
   134
		 @leave KErrAccessDenied	The content is already in use.
williamr@2
   135
		 @leave ...			One of the other CAF error codes defined in \c caferr.h  
williamr@2
   136
		 					or one of the other system-wide error codes for 
williamr@2
   137
							any other errors.
williamr@2
   138
		 */					
williamr@2
   139
		IMPORT_C static CData* NewLC(const TVirtualPathPtr& aVirtualPath,
williamr@2
   140
							TContentShareMode aShareMode); 
williamr@2
   141
williamr@2
   142
							
williamr@2
   143
		/** 
williamr@2
   144
		 Creates a new CData object. 
williamr@2
   145
		 
williamr@2
   146
		 @param aFile An open RFile handle, the agent will make a duplicate of this handle. 
williamr@2
   147
		 The underlying RFs session should be shared for transfer to other processes using RFs::ShareProtected(), since the agent may use transfer this handle to its own or one of the system servers.
williamr@2
   148
		 @param aUniqueId The content object to read.
williamr@2
   149
		 @param aIntent	The intended use of the content.
williamr@2
   150
		 @return The new CData object.
williamr@2
   151
		  
williamr@2
   152
		 @leave KErrNotFound		The content object with the given UniqueId does not exist.
williamr@2
   153
		 @leave KErrCAPendingRights The rights have not yet arrived but are expected soon.
williamr@2
   154
		 @leave KErrCANoPermission	Rights exist but the specified intent is not permitted.
williamr@2
   155
		 @leave KErrCANoRights		No rights exist for the content object.
williamr@2
   156
		 @leave KErrCANotSupported	Unable to open the object with the specified UniqueId, it may be a container object.
williamr@2
   157
		 @leave KErrPermissionDenied The agent does not allow the client to access the content object.
williamr@2
   158
		 @leave KErrAccessDenied	The content is already in use.
williamr@2
   159
		 @leave ...			One of the other CAF error codes defined in \c caferr.h  
williamr@2
   160
		 					or one of the other system-wide error codes for 
williamr@2
   161
							any other errors.
williamr@2
   162
		 */
williamr@2
   163
		IMPORT_C static CData* NewL(RFile& aFile, const TDesC& aUniqueId, TIntent aIntent);
williamr@2
   164
williamr@2
   165
		/** 
williamr@2
   166
		 Creates a new CData object. 
williamr@2
   167
		 
williamr@2
   168
		 @param aFile An open RFile handle, the agent will make a duplicate of this handle. 
williamr@2
   169
		 The underlying RFs session should be shared for transfer to other processes using RFs::ShareProtected(), since the agent may use transfer this handle to its own or one of the system servers.
williamr@2
   170
		 @param aUniqueId The content object to read.
williamr@2
   171
		 @return The new CData object.
williamr@2
   172
		  
williamr@2
   173
		 @leave KErrNotFound		The content object with the given UniqueId does not exist.
williamr@2
   174
		 @leave KErrCAPendingRights The rights have not yet arrived but are expected soon.
williamr@2
   175
		 @leave KErrCANoPermission	Rights exist but the specified intent is not permitted.
williamr@2
   176
		 @leave KErrCANoRights		No rights exist for the content object.
williamr@2
   177
		 @leave KErrCANotSupported	Unable to open the object with the specified UniqueId, it may be a container object.
williamr@2
   178
		 @leave KErrPermissionDenied The agent does not allow the client to access the content object.
williamr@2
   179
		 @leave KErrAccessDenied	The content is already in use.
williamr@2
   180
		 @leave ...			One of the other CAF error codes defined in \c caferr.h  
williamr@2
   181
		 					or one of the other system-wide error codes for 
williamr@2
   182
							any other errors.
williamr@2
   183
		 */
williamr@2
   184
		IMPORT_C static CData* NewL(RFile& aFile, const TDesC& aUniqueId);
williamr@2
   185
		
williamr@2
   186
		/** 
williamr@2
   187
		 Creates a new CData object. 
williamr@2
   188
		 
williamr@2
   189
		 @param aFile An open RFile handle, the agent will make a duplicate of this handle. 
williamr@2
   190
		 The underlying RFs session should be shared for transfer to other processes using RFs::ShareProtected(), since the agent may use transfer this handle to its own or one of the system servers.
williamr@2
   191
		 @param aUniqueId The content object to read.
williamr@2
   192
		 @param aIntent	The intended use of the content.
williamr@2
   193
		 @return The new CData object.
williamr@2
   194
		  
williamr@2
   195
		 @leave KErrNotFound		The content object with the given UniqueId does not exist.
williamr@2
   196
		 @leave KErrCAPendingRights The rights have not yet arrived but are expected soon.
williamr@2
   197
		 @leave KErrCANoPermission	Rights exist but the specified intent is not permitted.
williamr@2
   198
		 @leave KErrCANoRights		No rights exist for the content object.
williamr@2
   199
		 @leave KErrCANotSupported	Unable to open the object with the specified UniqueId, it may be a container object.
williamr@2
   200
		 @leave KErrPermissionDenied The agent does not allow the client to access the content object.
williamr@2
   201
		 @leave KErrAccessDenied	The content is already in use.
williamr@2
   202
		 @leave ...				One of the other CAF error codes defined in \c caferr.h  
williamr@2
   203
		 						or one of the other system-wide error codes 
williamr@2
   204
								for any other errors.
williamr@2
   205
		 */
williamr@2
   206
		IMPORT_C static CData* NewLC(RFile& aFile, const TDesC& aUniqueId, TIntent aIntent);
williamr@2
   207
		
williamr@2
   208
		/** 
williamr@2
   209
		 Creates a new CData object. 
williamr@2
   210
		 
williamr@2
   211
		 @param aFile An open RFile handle, the agent will make a duplicate of this handle. 
williamr@2
   212
		 The underlying RFs session should be shared for transfer to other processes using RFs::ShareProtected(), since the agent may use transfer this handle to its own or one of the system servers.
williamr@2
   213
		 @param aUniqueId The content object to read.
williamr@2
   214
		 @return The new CData object.
williamr@2
   215
		  
williamr@2
   216
		 @leave KErrNotFound		The content object with the given UniqueId does not exist.
williamr@2
   217
		 @leave KErrCAPendingRights The rights have not yet arrived but are expected soon.
williamr@2
   218
		 @leave KErrCANoPermission	Rights exist but the specified intent is not permitted.
williamr@2
   219
		 @leave KErrCANoRights		No rights exist for the content object.
williamr@2
   220
		 @leave KErrCANotSupported	Unable to open the object with the specified UniqueId, it may be a container object.
williamr@2
   221
		 @leave KErrPermissionDenied The agent does not allow the client to access the content object.
williamr@2
   222
		 @leave KErrAccessDenied	The content is already in use.
williamr@2
   223
		 @leave ...				One of the other CAF error codes defined in \c caferr.h  
williamr@2
   224
		 						or one of the other system-wide error codes 
williamr@2
   225
								for any other errors.
williamr@2
   226
		 */
williamr@2
   227
		IMPORT_C static CData* NewLC(RFile& aFile, const TDesC& aUniqueId);
williamr@2
   228
		
williamr@2
   229
		/** 
williamr@2
   230
		 Creates a new CData object. 
williamr@2
   231
		 
williamr@2
   232
		 @param aAgentUid The agent determined to support this content.
williamr@2
   233
		 @param aVirtualPath The content object to read.
williamr@2
   234
		 @param aIntent	The intended use of the content.
williamr@2
   235
		 @param aShareMode The file share mode used to open this content.
williamr@2
   236
		 @return The new CData object.
williamr@2
   237
		  
williamr@2
   238
		 @leave KErrNotFound		The content object with the given UniqueId does not exist.
williamr@2
   239
		 @leave KErrCAPendingRights The rights have not yet arrived but are expected soon.
williamr@2
   240
		 @leave KErrCANoPermission	Rights exist but the specified intent is not permitted.
williamr@2
   241
		 @leave KErrCANoRights		No rights exist for the content object.
williamr@2
   242
		 @leave KErrCANotSupported	Unable to open the object with the specified UniqueId, it may be a container object.
williamr@2
   243
		 @leave KErrPermissionDenied The agent does not allow the client to access the content object.
williamr@2
   244
		 @leave KErrAccessDenied	The content is already in use.
williamr@2
   245
		 @leave ...				One of the other CAF error codes defined in \c caferr.h  
williamr@2
   246
		 						or one of the other system-wide error codes 
williamr@2
   247
								for any other errors.
williamr@2
   248
		 */
williamr@2
   249
		static CData* NewLC(TUid aAgentUid, const TVirtualPathPtr& aVirtualPath,
williamr@2
   250
							TIntent aIntent, TContentShareMode aShareMode); 
williamr@2
   251
		
williamr@2
   252
		/** 
williamr@2
   253
		 Creates a new CData object. 
williamr@2
   254
		 
williamr@2
   255
		 @param aAgentUid The Uid of the agent who supports this content.
williamr@2
   256
		 @param aFile An open RFile handle, the agent will make a duplicate of this handle. 
williamr@2
   257
		 The underlying RFs session should be shared for transfer to other processes using RFs::ShareProtected(), since the agent may use transfer this handle to its own or one of the system servers.
williamr@2
   258
		 @param aUniqueId The content object to read.
williamr@2
   259
		 @param aIntent	The intended use of the content.
williamr@2
   260
		 @return The new CData object.
williamr@2
   261
		  
williamr@2
   262
		 @leave KErrNotFound		The content object with the given UniqueId does not exist.
williamr@2
   263
		 @leave KErrCAPendingRights The rights have not yet arrived but are expected soon.
williamr@2
   264
		 @leave KErrCANoPermission	Rights exist but the specified intent is not permitted.
williamr@2
   265
		 @leave KErrCANoRights		No rights exist for the content object.
williamr@2
   266
		 @leave KErrCANotSupported	Unable to open the object with the specified UniqueId, it may be a container object.
williamr@2
   267
		 @leave KErrPermissionDenied The agent does not allow the client to access the content object.
williamr@2
   268
		 @leave KErrAccessDenied	The content is already in use.
williamr@2
   269
		 @leave ...				One of the other CAF error codes defined in \c caferr.h  
williamr@2
   270
		 						or one of the other system-wide error codes for 
williamr@2
   271
								any other errors.
williamr@2
   272
williamr@2
   273
		 */
williamr@2
   274
		static CData* NewLC(TUid aAgentUid, RFile& aFile, const TDesC& aUniqueId, TIntent aIntent);
williamr@4
   275
williamr@4
   276
#ifdef SYMBIAN_ENABLE_SDP_WMDRM_SUPPORT
williamr@2
   277
		
williamr@4
   278
		/** 
williamr@4
   279
		 Creates a new CData object. 
williamr@4
   280
		 @param aHeaderData				Header data of WMDRM file/stream content. 
williamr@4
   281
		 @return 						CData object.
williamr@4
   282
		 @leave							One of the CAF error codes defined in caferr.h or one of the 
williamr@4
   283
										system-wide error for any other errors.
williamr@4
   284
		 @capability 					DRM Access to DRM protected content is not permitted for processes without DRM capability.
williamr@4
   285
										Access to unprotected content is unrestricted.
williamr@4
   286
		*/
williamr@4
   287
			
williamr@4
   288
		IMPORT_C static CData* NewL(const TDesC8& aHeaderData);
williamr@4
   289
		
williamr@4
   290
		/** 
williamr@4
   291
		 Creates a new CData object. 
williamr@4
   292
		 @param aHeaderData				Header data of WMDRM file/stream content.
williamr@4
   293
		 @param aIntent					The intended use of the content.
williamr@4
   294
		 @return 						CData object.
williamr@4
   295
		 @leave							One of the CAF error codes defined in caferr.h or one of the 
williamr@4
   296
										system-wide error for any other errors.
williamr@4
   297
		 @capability 					DRM Access to DRM protected content is not permitted for processes without DRM capability.
williamr@4
   298
										Access to unprotected content is unrestricted.
williamr@4
   299
		*/		
williamr@4
   300
		
williamr@4
   301
		IMPORT_C static CData* NewL(const TDesC8& aHeaderData, TIntent aIntent);
williamr@4
   302
		
williamr@4
   303
		/** 
williamr@4
   304
		 Creates a new CData object. 
williamr@4
   305
		 @param aHeaderData				Header data of WMDRM file/stream content. 
williamr@4
   306
		 @return 						CData object.
williamr@4
   307
		 @leave							One of the CAF error codes defined in caferr.h or one of the 
williamr@4
   308
										system-wide error for any other errors.
williamr@4
   309
		 @capability 					DRM Access to DRM protected content is not permitted for processes without DRM capability.
williamr@4
   310
										Access to unprotected content is unrestricted.
williamr@4
   311
		*/
williamr@4
   312
		
williamr@4
   313
		IMPORT_C static CData* NewLC(const TDesC8& aHeaderData);
williamr@4
   314
		
williamr@4
   315
		/** 
williamr@4
   316
		 Creates a new CData object. 
williamr@4
   317
		 @param aHeaderData				Header data of WMDRM file/stream content.
williamr@4
   318
		 @param aIntent					The intended use of the content. 
williamr@4
   319
		 @return 						CData object.
williamr@4
   320
		 @leave							One of the CAF error codes defined in caferr.h or one of the 
williamr@4
   321
										system-wide error for any other errors.
williamr@4
   322
		 @capability 					DRM Access to DRM protected content is not permitted for processes without DRM capability.
williamr@4
   323
										Access to unprotected content is unrestricted.
williamr@4
   324
		*/
williamr@4
   325
		
williamr@4
   326
		IMPORT_C static CData* NewLC(const TDesC8& aHeaderData, TIntent aIntent);
williamr@4
   327
		
williamr@4
   328
		/** 
williamr@4
   329
		 Creates a new CData object.
williamr@4
   330
		 @param	aAgentUid				UID of an agent which supports this content. 
williamr@4
   331
		 @param aHeaderData				Header data of WMDRM file/stream content.
williamr@4
   332
		 @param aIntent					The intended use of the content.
williamr@4
   333
		 @return 						CData object.
williamr@4
   334
		 @leave							One of the CAF error codes defined in caferr.h or one of the 
williamr@4
   335
										system-wide error for any other errors.
williamr@4
   336
		 @capability 					DRM Access to DRM protected content is not permitted for processes without DRM capability.
williamr@4
   337
										Access to unprotected content is unrestricted.
williamr@4
   338
		 
williamr@4
   339
		*/
williamr@4
   340
		
williamr@4
   341
		static CData* NewLC(TUid aAgentUid, const TDesC8& aHeaderData, TIntent aIntent);
williamr@4
   342
		
williamr@4
   343
#endif //SYMBIAN_ENABLE_SDP_WMDRM_SUPPORT
williamr@4
   344
williamr@2
   345
		/** destructor */
williamr@2
   346
		virtual ~CData();
williamr@2
   347
		
williamr@2
   348
		/** 
williamr@2
   349
		 Reads from a content object up to the maximum length of the
williamr@2
   350
		 descriptor or the end of the content object.
williamr@2
   351
		 	
williamr@2
   352
		 When an attempt is made to read beyond the end of the content,
williamr@2
   353
		 no error is returned. The descriptor’s length is set to the
williamr@2
   354
		 number of bytes that were read into it. Therefore, when reading
williamr@2
   355
		 through content, the end has been reached when the
williamr@2
   356
		 descriptor length (given by TDesC::Length()) is zero.
williamr@2
   357
		 
williamr@2
   358
		 @param aDes	Descriptor into which binary data is read. Any existing
williamr@2
   359
		  				contents are overwritten. On return, its length is set
williamr@2
   360
		 				to the number of bytes read.
williamr@2
   361
		 @return		KErrNone if successful.
williamr@2
   362
		 @return		One of the CAF error codes defined in \c caferr.h  or 
williamr@2
   363
		 				one of the other system-wide error codes.
williamr@2
   364
 		@capability DRM Access to DRM protected content is not permitted for processes without DRM capability. Access to unprotected content is unrestricted 
williamr@2
   365
		*/
williamr@2
   366
		IMPORT_C TInt Read(TDes8& aDes) const;
williamr@2
   367
williamr@2
   368
		/** 
williamr@2
   369
		 Reads from a content object up to the specified length of the
williamr@2
   370
		 descriptor or the end of the content object.
williamr@2
   371
		 	
williamr@2
   372
		 @see Read(TDes8& aDes)
williamr@2
   373
		 		 
williamr@2
   374
		 @param aDes	Descriptor into which binary data is read. Any existing
williamr@2
   375
		  				contents are overwritten. On return, its length is set
williamr@2
   376
		 				to the number of bytes read.
williamr@2
   377
		 @param aLength		The number of bytes to read from the file,
williamr@2
   378
		 					or to the end of the file, whichever is encountered first. 
williamr@2
   379
		 					The length of the buffer is set to the number of bytes actually read.
williamr@2
   380
		 @return		KErrNone if successful.
williamr@2
   381
		 @return		Otherwise one of the CAF error codes defined in \c caferr.h  or 
williamr@2
   382
		 				one of the other system-wide error codes.
williamr@2
   383
		@capability DRM Access to DRM protected content is not permitted for processes without DRM capability. Access to unprotected content is unrestricted 
williamr@2
   384
		*/
williamr@2
   385
		IMPORT_C TInt Read(TDes8& aDes,TInt aLength) const;
williamr@2
   386
		
williamr@2
   387
		/**
williamr@2
   388
		 Read content asynchronously up to the maximum length of the descriptor
williamr@2
   389
		 or until the end of the content object is reached.
williamr@2
   390
		 NB: It is important that the descriptor passed to 
williamr@2
   391
		 aDes remains in scope until the request has completed.		
williamr@2
   392
		 
williamr@2
   393
		 @see Read(TDes8& aDes)
williamr@2
   394
		 
williamr@2
   395
		 @param aDes 		Descriptor into which binary data is read. Any
williamr@2
   396
		  					existing contents are overwritten. On return,
williamr@2
   397
		 					its length is set to the number of bytes read.
williamr@2
   398
		 @param aStatus		Asynchronous request status. On completion this will contain one 
williamr@2
   399
		 					of the following error codes: KErrNone if the data was 
williamr@2
   400
							successfully read. Otherwise one of the CAF error codes defined in 
williamr@2
   401
							\c caferr.h  or one of the other standard system-wide
williamr@2
   402
							error codes for any other errors.
williamr@2
   403
		@capability DRM Access to DRM protected content is not permitted for processes without DRM capability. Access to unprotected content is unrestricted 
williamr@2
   404
		*/	
williamr@2
   405
		IMPORT_C void Read(TDes8& aDes, TRequestStatus& aStatus) const;
williamr@2
   406
williamr@2
   407
		/**
williamr@2
   408
		 Read content asynchronously up to the specified length 
williamr@2
   409
		 or until the end of the content object is reached.
williamr@2
   410
		 NB: It is important that the descriptor passed to 
williamr@2
   411
		 aDes remains in scope until the request has completed.		 	
williamr@2
   412
williamr@2
   413
		 @see Read(TDes8& aDes)
williamr@2
   414
		 
williamr@2
   415
		 @param aDes 		Descriptor into which binary data is read. Any
williamr@2
   416
		  					existing contents are overwritten. On return,
williamr@2
   417
		 					its length is set to the number of bytes read.
williamr@2
   418
		 @param aLength		The number of bytes to read from the file,
williamr@2
   419
		 					or to the end of the file, whichever is encountered first. 
williamr@2
   420
		 					The length of the buffer is set to the number of bytes actually read.
williamr@2
   421
		 @param aStatus		Asynchronous request status. On completion this will contain one 
williamr@2
   422
		 					of the following error codes: KErrNone if the data was 
williamr@2
   423
							successfully read. Otherwise one of the CAF error codes defined in 
williamr@2
   424
							\c caferr.h  or one of the other standard system-wide
williamr@2
   425
							error codes for any other errors.
williamr@2
   426
		@capability DRM Access to DRM protected content is not permitted for processes without DRM capability. Access to unprotected content is unrestricted 
williamr@2
   427
		*/
williamr@2
   428
		IMPORT_C void Read(TDes8& aDes, TInt aLength, TRequestStatus& aStatus) const;
williamr@2
   429
		
williamr@2
   430
		/**
williamr@2
   431
		 Cancels asynchronous read.
williamr@2
   432
		 
williamr@2
   433
		 @param aStatus		Asynchronous request status. This parameter should have been supplied earlier to
williamr@2
   434
		 					an asynchronous Read call. If it has not been previously supplied to a Read call,
williamr@2
   435
		 					this function will not have any effect.
williamr@2
   436
		 @capability DRM Access to DRM protected content is not permitted for processes without DRM capability. Access to unprotected content is unrestricted 
williamr@2
   437
		*/
williamr@2
   438
		IMPORT_C void ReadCancel(TRequestStatus &aStatus) const;		
williamr@2
   439
williamr@4
   440
#ifdef SYMBIAN_ENABLE_64_BIT_FILE_SERVER_API
williamr@2
   441
		/**
williamr@2
   442
		 Reads content asynchronously. The data is read from a specified offset 
williamr@2
   443
		 up to a specified number of bytes or until the end of the content object 
williamr@2
   444
		 is reached. The data is read into the descriptor buffer supplied.
williamr@2
   445
		 NB: It is important that the descriptor passed to 
williamr@4
   446
		 aDes remains in scope until the request has completed.
williamr@4
   447
		 If agent does not support 64bit, fallback to 32bit Read is provided automatically by CAF			
williamr@4
   448
				 
williamr@2
   449
		 @see Read(TDes8& aDes)
williamr@4
   450
				 
williamr@2
   451
		 @param aPos		Position of first byte to be read. 
williamr@4
   452
							This is an offset from the start of the file. 
williamr@2
   453
		 @param aDes 		Descriptor into which binary data is read. Any
williamr@2
   454
		  					existing contents are overwritten. On return,
williamr@2
   455
		 					its length is set to the number of bytes read. 
williamr@2
   456
		 @param aLength		The number of bytes to read from the file,
williamr@2
   457
		 					or to the end of the file, whichever is encountered first. 
williamr@2
   458
		 					The length of the buffer is set to the number of bytes actually read.
williamr@2
   459
		 @param aStatus		Asynchronous request status. On completion this will contain one 
williamr@2
   460
		 					of the following error codes: KErrNone if the data was 
williamr@2
   461
							successfully read. Otherwise one of the CAF error codes defined in 
williamr@2
   462
							\c caferr.h  or one of the other standard system-wide
williamr@2
   463
							error codes for any other errors.
williamr@2
   464
		 @return KErrNone if the async read request was successfully submitted.
williamr@2
   465
		 @return KErrArgument if a negative offset is supplied.
williamr@2
   466
		 @return KErrCANotSupported if the agent does not support this operation.
williamr@2
   467
		 @capability DRM Access to DRM protected content is not permitted for processes without DRM capability. Access to unprotected content is unrestricted 
williamr@4
   468
		*/
williamr@4
   469
		IMPORT_C TInt Read(TInt64 aPos, TDes8& aDes, TInt aLength, TRequestStatus& aStatus) const;
williamr@4
   470
#else
williamr@4
   471
			/**
williamr@4
   472
		 Reads content asynchronously. The data is read from a specified offset 
williamr@4
   473
		 up to a specified number of bytes or until the end of the content object 
williamr@4
   474
		 is reached. The data is read into the descriptor buffer supplied.
williamr@4
   475
				 
williamr@4
   476
		 @see Read(TDes8& aDes)
williamr@4
   477
				 
williamr@4
   478
		 @param aPos		Position of first byte to be read. 
williamr@4
   479
							This is an offset from the start of the file. 
williamr@4
   480
		 @param aDes 		Descriptor into which binary data is read. Any
williamr@4
   481
		  					existing contents are overwritten. On return,
williamr@4
   482
		 					its length is set to the number of bytes read. 
williamr@4
   483
		 @param aLength		The number of bytes to read from the file,
williamr@4
   484
		 					or to the end of the file, whichever is encountered first. 
williamr@4
   485
		 					The length of the buffer is set to the number of bytes actually read.
williamr@4
   486
		 @param aStatus		Asynchronous request status. On completion this will contain one 
williamr@4
   487
		 					of the following error codes: KErrNone if the data was 
williamr@4
   488
							successfully read. Otherwise one of the CAF error codes defined in 
williamr@4
   489
							\c caferr.h  or one of the other standard system-wide
williamr@4
   490
							error codes for any other errors.
williamr@4
   491
		 @return KErrNone if the async read request was successfully submitted.
williamr@4
   492
		 @return KErrArgument if a negative offset is supplied.
williamr@4
   493
		 @return KErrCANotSupported if the agent does not support this operation.
williamr@4
   494
		 @capability DRM Access to DRM protected content is not permitted for processes without DRM capability. Access to unprotected content is unrestricted 
williamr@4
   495
		*/
williamr@2
   496
		IMPORT_C TInt Read(TInt aPos, TDes8& aDes, TInt aLength, TRequestStatus& aStatus) const;
williamr@4
   497
#endif //SYMBIAN_ENABLE_64_BIT_FILE_SERVER_API
williamr@4
   498
williamr@2
   499
		/**
williamr@2
   500
		 Gets the data size in bytes.
williamr@2
   501
		 
williamr@2
   502
		 @param aSize	On return this will contain the size of the plaintext data in bytes.
williamr@2
   503
		 @leave KErrCASizeNotDetermined	Size could not be determined by the managing agent.
williamr@2
   504
		 @leave ...		One of the other CAF error codes defined in \c caferr.h  or one of the 
williamr@2
   505
						system-wide error codes for any other errors.		 
williamr@2
   506
		 @capability DRM Access to DRM protected content is not permitted for processes without DRM capability. Access to unprotected content is unrestricted
williamr@2
   507
		 */
williamr@2
   508
		IMPORT_C void DataSizeL(TInt& aSize);
williamr@2
   509
williamr@4
   510
#ifdef SYMBIAN_ENABLE_64_BIT_FILE_SERVER_API
williamr@4
   511
		/**
williamr@4
   512
		 This is the 64bit version of CData::DataSizeL
williamr@4
   513
		 Client can call this function instead of CData::DataSizeL. If it's not implemented by the agent,
williamr@4
   514
		 fallback to 32bit counterpart will be provided automatically
williamr@4
   515
		 
williamr@4
   516
		 @see DataSizeL(TInt& aSize)
williamr@4
   517
		*/
williamr@4
   518
		IMPORT_C void DataSize64L(TInt64& aSize);
williamr@4
   519
#endif //SYMBIAN_ENABLE_64_BIT_FILE_SERVER_API
williamr@4
   520
				
williamr@2
   521
		/**
williamr@2
   522
		 Changes or retrieves the location of the file pointer within 
williamr@2
   523
		 the content object.
williamr@2
   524
		 
williamr@2
   525
 		 NOTE: Some operations may fail if the content data is sourced over a network connection.		 
williamr@2
   526
		 
williamr@2
   527
		 There are four seek modes used: 
williamr@2
   528
		 
williamr@2
   529
		 @li ESeekStart - Sets the file pointer aPos bytes from the start of the 
williamr@2
   530
		 content object.  aPos is not modified by the call to Seek()
williamr@2
   531
		 @li ESeekEnd - Sets the file pointer aPos bytes from the end of the 
williamr@2
   532
		 content object. The aPos parameter supplied should be zero or negative 
williamr@2
   533
		 when using ESeekEnd. Upon completion aPos is updated with the current 
williamr@2
   534
		 position relative to the start of the content object.
williamr@2
   535
		 @li ESeekCurrent - Moves the file pointer aPos bytes from the current 
williamr@2
   536
		 position. Upon completion aPos is updated with the new position relative 
williamr@2
   537
		 to the start of the content object. Suppling a zero value for the aPos Parameter can be
williamr@2
   538
		 used to retrieve the current file pointer location 
williamr@2
   539
		 @li ESeekAddress Sets the aPos parameter to the address of the byte 
williamr@2
   540
		 aPos bytes from the start of the content object
williamr@2
   541
williamr@2
   542
		 @see TSeek
williamr@2
   543
		 
williamr@2
   544
		 @param aMode	Seek mode - controls the destination of the
williamr@2
   545
		  				seek operation.
williamr@2
   546
		  
williamr@2
   547
		 @param aPos	Offset from either the start, end or current position depending upon 
williamr@2
   548
		 the seek mode. Negative offsets are used to seek before the current position or
williamr@2
   549
		 relative to the end of the file.
williamr@2
   550
		 
williamr@2
   551
		 @return		KErrNone if successful. 
williamr@2
   552
		 @return		Otherwise one of the CAF error codes defined in \c caferr.h  or one 
williamr@2
   553
		 				of the other system-wide error codes.
williamr@2
   554
		@capability DRM Access to DRM protected content is not permitted for processes without DRM capability. Access to unprotected content is unrestricted 
williamr@2
   555
		*/
williamr@2
   556
		IMPORT_C TInt Seek(TSeek aMode,TInt& aPos) const;
williamr@2
   557
		
williamr@4
   558
#ifdef SYMBIAN_ENABLE_64_BIT_FILE_SERVER_API
williamr@4
   559
		/**
williamr@4
   560
		 This is the 64bit version of CData::Seek
williamr@4
   561
		 Client can call this function instead of CData::Seek. If it's not implemented by the agent,
williamr@4
   562
		 fallback to 32bit counterpart will be provided automatically
williamr@4
   563
		 
williamr@4
   564
		 @see Seek(TSeek aMode,TInt& aPos)
williamr@4
   565
		*/
williamr@4
   566
		IMPORT_C TInt Seek64(TSeek aMode,TInt64& aPos) const;
williamr@4
   567
#endif //SYMBIAN_ENABLE_64_BIT_FILE_SERVER_API
williamr@2
   568
williamr@2
   569
		/** Request the agent handling this content to set a property value. If the property is set
williamr@2
   570
		it is only set for this CData session and does not impact other CAF	users.
williamr@2
   571
williamr@2
   572
		 For example setting the buffer-size to 256 bytes can be achieved as follows:
williamr@2
   573
williamr@2
   574
					@code
williamr@2
   575
		  			MyData->SetProperty(EAgentPropertyBufferSize, 256);
williamr@2
   576
		  			@endcode
williamr@2
   577
williamr@2
   578
  		@see ContentAccess::TAgentProperty
williamr@2
   579
	
williamr@2
   580
		@param aProperty The property to set.
williamr@2
   581
		@param aValue The value of the property.
williamr@2
   582
		@return Whether or not the property was set.
williamr@2
   583
		@return KErrNone if the property was set.
williamr@2
   584
		@return KErrCANotSupported if the agent does not support the property or value.
williamr@2
   585
		@return KErrAccessDenied if the agent does not permit the property to be changed.
williamr@2
   586
		@return KErrPermissionDenied if the application does not have the necessary capability to change the property.
williamr@2
   587
		@capability DRM Access to DRM protected content is not permitted for processes without DRM capability. Access to unprotected content is unrestricted.
williamr@2
   588
		*/
williamr@2
   589
		IMPORT_C TInt SetProperty(TAgentProperty aProperty, TInt aValue);
williamr@2
   590
		
williamr@2
   591
		/**
williamr@2
   592
		 Allows a client to verify that the intent is supported by the
williamr@2
   593
		 current rights for the data object. 
williamr@2
   594
		 
williamr@2
   595
		 @note Since the intent is only evaluated the agent will not decrement 
williamr@2
   596
		 any rights-state such as play counts.
williamr@2
   597
		  
williamr@2
   598
		 @see ContentAccess::TIntent
williamr@2
   599
williamr@2
   600
		 @param aIntent	The intended way the content will be used.
williamr@2
   601
		 @return Whether rights exist allowing the content to be used for this intent.
williamr@2
   602
		 @return KErrNone if the intent is permitted.
williamr@2
   603
		 @return KErrNoRights if no rights exist for the specified content object.
williamr@2
   604
		 @return KErrCANoPermission	if rights exist but the specified intent is not permitted.
williamr@2
   605
		 @return KErrCAPendingRights if the rights have not yet arrived but are expected soon.
williamr@2
   606
		 @return KErrNoPermission if rights exist but none permit the specified intent.
williamr@2
   607
		 @return KErrPermissionDenied if the client is not allowed to use this content object.
williamr@2
   608
		 @return Otherwise one of the other CAF error codes defined in \c caferr.h  or one of the
williamr@2
   609
				other system-wide error codes for any other errors.
williamr@2
   610
		 @capability DRM Access to DRM protected content is not permitted for processes without DRM capability. Access to unprotected content is unrestricted
williamr@2
   611
		 */		
williamr@2
   612
		IMPORT_C TInt EvaluateIntent(TIntent aIntent);
williamr@2
   613
		
williamr@2
   614
		/**
williamr@2
   615
		 Execute intent allows the application to signal it is about to carry out
williamr@2
   616
		 the specified intent on protected content.The agent will decrement applicable 
williamr@2
   617
		 stateful rights such as play counts where necessary.
williamr@2
   618
williamr@2
   619
  		 Applications should be very careful to use this function correctly.
williamr@2
   620
		 @li If ExecuteIntent() is never called stateful rights will never be decremented. Users will be able to use the content forever
williamr@2
   621
		 @li If ExecuteIntent() is called too often stateful rights may be consumed prematurely. 
williamr@2
   622
williamr@2
   623
		 Usually it would be best to call ExecuteIntent immediately before the content 
williamr@2
   624
		 is displayed or the instant playback begins. ExecuteIntent should not be considered a 
williamr@2
   625
		 prerequisite for calling the Read functions. It is valid for an application to read from 
williamr@2
   626
		 the file before calling ExecuteIntent. 
williamr@2
   627
williamr@2
   628
		 @note Since rights are executed here the agent will decrement any rights-state such as 
williamr@2
   629
		 play counts that apply. 
williamr@2
   630
		 
williamr@2
   631
		@param aIntent	The intent indicator.
williamr@2
   632
		@return The result of attempting executing the intent.
williamr@2
   633
		@return KErrNone if the intent is permitted and stateful rights may have been decremented.
williamr@2
   634
		@return KErrNoRights if no rights exist for the specified content object.
williamr@2
   635
		@return KErrCANoPermission	if rights exist but the specified intent is not permitted.
williamr@2
   636
		@return KErrCAPendingRights if the rights have not yet arrived but are expected soon.
williamr@2
   637
		@return KErrNoPermission if rights exist but none permit the specified intent.
williamr@2
   638
		@return KErrPermissionDenied if the client is not allowed to use this content object.
williamr@2
   639
		@return Otherwise one of the other CAF error codes defined in \c caferr.h  or one of the.
williamr@2
   640
				other system-wide error codes for any other errors.
williamr@2
   641
		@capability DRM Access to DRM protected content is not permitted for processes without DRM capability. Access to unprotected content is unrestricted 
williamr@2
   642
		*/		
williamr@2
   643
		IMPORT_C TInt ExecuteIntent(TIntent aIntent);
williamr@2
   644
		
williamr@2
   645
		/**  Get an attribute for the content object
williamr@2
   646
williamr@2
   647
		@see ContentAccess::TAttribute
williamr@2
   648
williamr@2
   649
		@code
williamr@2
   650
		CContent* content = CContent::NewL(uri);
williamr@2
   651
		CData* data = content->OpenContentL(EPlay, uniqueId);
williamr@2
   652
		delete content;
williamr@2
   653
williamr@2
   654
		TInt value = 0;
williamr@2
   655
		TInt err = data->GetAttribute(EIsProtected, value);
williamr@2
   656
		if(err == KErrNone && value)
williamr@2
   657
			{
williamr@2
   658
			DisplayPadLock();
williamr@2
   659
			}
williamr@2
   660
williamr@2
   661
		delete data;
williamr@2
   662
		@endcode
williamr@2
   663
williamr@2
   664
		@param aAttribute The attribute to query, from ContentAccess::TAttribute.
williamr@2
   665
		@param aValue Used to return the attribute value.
williamr@2
   666
		@return Whether the attribute was updated.
williamr@2
   667
		@return KErrNone if the value of the attribute was updated.
williamr@2
   668
		@return KErrCANotSupported if the requested attribute does not exist.
williamr@2
   669
		@return KErrPermissionDenied if the access to the protected content is not permitted by the CAF Agent.
williamr@2
   670
		@return Otherwise one of the other CAF error codes defined in \c caferr.h  or one of the 
williamr@2
   671
				other system-wide error codes for any other errors.
williamr@2
   672
		@capability DRM Access to DRM protected content is not permitted for processes without DRM capability. Access to unprotected content is unrestricted 
williamr@2
   673
		*/
williamr@2
   674
		IMPORT_C TInt GetAttribute(TInt aAttribute, TInt& aValue) const;
williamr@2
   675
williamr@2
   676
		/** Get a set of attributes for the content object 
williamr@2
   677
williamr@2
   678
		@see ContentAccess::TAttribute
williamr@2
   679
williamr@2
   680
		The following example determines whether the content object 
williamr@2
   681
		is protected and has rights that will enable it to be viewed by the 
williamr@2
   682
		user
williamr@2
   683
williamr@2
   684
		@code
williamr@2
   685
		// CData* data = a data object
williamr@2
   686
		
williamr@2
   687
		RAttributeSet attributeSet;
williamr@2
   688
		CleanupClosePushL(attributeSet);
williamr@2
   689
		attributeSet->AddL(EProtected);
williamr@2
   690
		attributeSet->AddL(ECanView);
williamr@2
   691
williamr@2
   692
		User::LeaveIfError(data->GetAttributeSet(attributeSet);
williamr@2
   693
williamr@2
   694
		TInt err = attributeSet.GetValue(EProtected, value);
williamr@2
   695
		if(err == KErrNone && value)
williamr@2
   696
				{
williamr@2
   697
				// file is DRM protected
williamr@2
   698
				}
williamr@2
   699
williamr@2
   700
		err = attributeSet.GetValue(ECanView, value);
williamr@2
   701
		if(err == KErrNone && value)
williamr@2
   702
				{
williamr@2
   703
				// File has rights that allow it to be displayed on screen
williamr@2
   704
				}
williamr@2
   705
		
williamr@2
   706
		// Finished
williamr@2
   707
		CleanupStack::PopAndDestroy(); 	// attributeSet.Close()
williamr@2
   708
		@endcode
williamr@2
   709
williamr@2
   710
williamr@2
   711
		@param aAttributeSet The set of attributes to query and update.
williamr@2
   712
		@return Whether the attribute set was updated.
williamr@2
   713
		@return KErrNone if the attributes were retrieved successfully.
williamr@2
   714
		@return KErrPermissionDenied if the access to the protected content is not permitted by the CAF Agent.
williamr@2
   715
		@return Otherwise one of the CAF error codes defined in \c caferr.h  or one of the 
williamr@2
   716
				other system-wide error codes for any other errors.				 
williamr@2
   717
		@capability DRM Access to DRM protected content is not permitted for processes without DRM capability. Access to unprotected content is unrestricted 
williamr@2
   718
		*/
williamr@2
   719
		IMPORT_C TInt GetAttributeSet(RAttributeSet& aAttributeSet) const;
williamr@2
   720
williamr@2
   721
williamr@2
   722
		/**  Get text string attributes or meta-data for the content object
williamr@2
   723
	
williamr@2
   724
		@see ContentAccess::TStringAttribute
williamr@2
   725
williamr@2
   726
		@code
williamr@2
   727
		CContent* content = CContent::NewLC(uri);
williamr@2
   728
		CData* data = content->OpenContentLC(EPlay, uniqueId);
williamr@2
   729
		CleanupStack::PopAndDestroy(content);
williamr@2
   730
williamr@2
   731
		TBuf <MAX_PATH> previewUri;
williamr@2
   732
		TInt err = data->GetStringAttribute(EPreviewURI, previewUri);
williamr@2
   733
		if(err == KErrNone)
williamr@2
   734
			{
williamr@2
   735
			DisplayPreview(previewUri);
williamr@2
   736
			}
williamr@2
   737
williamr@2
   738
		CleanupStack::PopAndDestroy(data);
williamr@2
   739
		@endcode
williamr@2
   740
williamr@2
   741
		@param aAttribute The attribute to query, from ContentAccess::TStringAttribute.
williamr@2
   742
		@param aValue Returns the value of the attribute.
williamr@2
   743
		@return Whether the value was updated.
williamr@2
   744
		@return KErrNone if the attribute was retrieved.
williamr@2
   745
		@return KErrOverflow if the buffer was not large enough to return the result.
williamr@2
   746
		@return KErrCANotSupported if the requested attribute does not exist.
williamr@2
   747
		@return KErrPermissionDenied if the access to the protected content is not permitted by the CAF Agent.
williamr@2
   748
		@return Otherwise one of the other CAF error codes defined in \c caferr.h  or one of the 
williamr@2
   749
				other system-wide error codes for any other errors.				 
williamr@2
   750
		@capability DRM Access to DRM protected content is not permitted for processes without DRM capability. Access to unprotected content is unrestricted 
williamr@2
   751
		*/
williamr@2
   752
		IMPORT_C TInt GetStringAttribute(TInt aAttribute, TDes& aValue) const;
williamr@2
   753
williamr@2
   754
		
williamr@2
   755
		
williamr@2
   756
		/** Obtain a set of string attributes for the content object 
williamr@2
   757
		
williamr@2
   758
		@see ContentAccess::TStringAttribute
williamr@2
   759
williamr@2
   760
		@code
williamr@2
   761
		CContent* content = CContent::NewLC(uri);
williamr@2
   762
		CData* data = content->OpenContentLC(EPlay, uniqueId);
williamr@2
   763
williamr@2
   764
		// create the attribute set, add the attributes we are interested in
williamr@2
   765
		RStringAttributeSet stringAttributeSet;
williamr@2
   766
		CleanupClosePushL(stringAttributeSet);
williamr@2
   767
		stringAttributeSet.AddL(EPreviewURI);
williamr@2
   768
		stringAttributeSet.AddL(ETitle);
williamr@2
   769
		
williamr@2
   770
		User::LeaveIfError(data->GetStringAttributeSet(stringAttributeSet));
williamr@2
   771
	
williamr@2
   772
		// Pass the value of the string attribute to DisplayPreview()
williamr@2
   773
		TFileName previewUri;
williamr@2
   774
		TInt err = stringAttributeSet.GetValue(EPreviewURI, previewUri);
williamr@2
   775
		if(err == KErrNone)
williamr@2
   776
			{
williamr@2
   777
			DisplayPreview(previewUri);
williamr@2
   778
			}
williamr@2
   779
		
williamr@2
   780
		CleanupStack::PopAndDestroy(3);	// content, data, stringAttributeSet
williamr@2
   781
		@endcode
williamr@2
   782
	
williamr@2
   783
williamr@2
   784
		@param aStringAttributeSet The set of attributes to query and update.
williamr@2
   785
		@return Whether the string attribute set was updated.
williamr@2
   786
		@return KErrNone if the attributes were retrieved successfully.
williamr@2
   787
		@return KErrNotFound if the default content object was not found.
williamr@2
   788
		@return KErrPermissionDenied if the access to the protected content is not permitted by the CAF Agent.
williamr@2
   789
		@return Otherwise one of the CAF error codes defined in \c caferr.h  or one of the 
williamr@2
   790
				other system-wide error codes for any other errors.				 
williamr@2
   791
		@capability DRM Access to DRM protected content is not permitted for processes without DRM capability. Access to unprotected content is unrestricted 
williamr@2
   792
		*/
williamr@2
   793
		IMPORT_C TInt GetStringAttributeSet(RStringAttributeSet& aStringAttributeSet) const;
williamr@4
   794
				
williamr@4
   795
				
williamr@2
   796
#ifndef REMOVE_CAF1
williamr@2
   797
		/** Set Qos attribute
williamr@2
   798
		@param aQosAttr The Qos attribute to set.
williamr@2
   799
		@param aValue The value of the attribute.
williamr@2
   800
		@deprecated 
williamr@2
   801
		*/
williamr@2
   802
		IMPORT_C void SetQosL(TQosAttribute aQosAttr, TInt aValue);
williamr@2
   803
williamr@2
   804
		/** Get the mime type of the content
williamr@2
   805
		@param aMimeType Buffer to store the mime type provided by the agent.
williamr@2
   806
		@return ETrue if the mime type was retrieved successfully.
williamr@2
   807
		@deprecated 
williamr@2
   808
		*/
williamr@2
   809
		IMPORT_C TBool GetMimeTypeL(TDes8& aMimeType) const;
williamr@2
   810
#endif	// REMOVE_CAF1
williamr@2
   811
williamr@4
   812
#ifdef SYMBIAN_ENABLE_SDP_WMDRM_SUPPORT
williamr@4
   813
		/**
williamr@4
   814
		Decrypts the encrypted input data packet.
williamr@4
   815
		
williamr@4
   816
		@param aEncryptedInputDataPacket	Buffer descriptor containing the encrypted data packet supplied by client application. 
williamr@4
   817
		@param aDecryptedOutputDataPacket	Buffer descriptor supplied by the client application into which the decrypted data is written.
williamr@4
   818
											The length of this descriptor must be equal to or greater than the input packet.
williamr@4
   819
		@return								KErrNone if successful.KErrInsufficientDataPacketLength if a part of input packet is provided,
williamr@4
   820
											otherwise one of the CAF error codes defined in \c caferr.h  or 
williamr@4
   821
		 									one of the other system-wide error codes.
williamr@4
   822
		@capability 						DRM Access to DRM protected content is not permitted for processes without DRM capability.
williamr@4
   823
											Access to unprotected content is unrestricted.
williamr@4
   824
		*/
williamr@4
   825
williamr@4
   826
		IMPORT_C TInt Read(const TDesC8& aEncryptedInputDataPacket, TDes8& aDecryptedOutputDataPacket) const;
williamr@4
   827
		
williamr@4
   828
		/**
williamr@4
   829
		Decrypts the encrypted input data packet asynchronously.
williamr@4
   830
		@param aEncryptedInputDataPacket	Buffer descriptor containing the encrypted data packet supplied by client application. 
williamr@4
   831
		@param aDecryptedOutputDataPacket	Buffer descriptor supplied by the client application into which the decrypted data is written.
williamr@4
   832
											The length of this descriptor must be equal to or greater than the input packet.
williamr@4
   833
		@param aStatus						Asynchronous request status. On completion this will contain one of the following error codes:
williamr@4
   834
											KErrNone if the data packet was successfully decrypted.KErrInsufficientDataPacketLength if a 
williamr@4
   835
											part of input packet is provided, otherwise one of the CAF error codes defined in \c caferr.h or 
williamr@4
   836
		 									one of the other system-wide error codes.
williamr@4
   837
		@capability 						DRM Access to DRM protected content is not permitted for processes without DRM capability.
williamr@4
   838
										    Access to unprotected content is unrestricted. 
williamr@4
   839
		*/
williamr@4
   840
		IMPORT_C void Read(const TDesC8& aEncryptedInputDataPacket, TDes8& aDecryptedOutputDataPacket, TRequestStatus& aStatus) const;
williamr@4
   841
williamr@4
   842
#endif //#ifdef SYMBIAN_ENABLE_SDP_WMDRM_SUPPORT
williamr@2
   843
	
williamr@2
   844
	private:
williamr@2
   845
		CData();
williamr@2
   846
		void ConstructL(RFile& aFile, const TDesC& aUniqueId, TIntent aIntent);
williamr@2
   847
		void ConstructL(const TVirtualPathPtr& aVirtualPath, TIntent aIntent, TContentShareMode aShareMode);
williamr@2
   848
		void ConstructL(TUid aAgentUid, RFile& aFile, const TDesC& aUniqueId, TIntent aIntent);
williamr@2
   849
		void ConstructL(TUid aAgentUid, const TVirtualPathPtr& aVirtualPath, TIntent aIntent, TContentShareMode aShareMode); 
williamr@2
   850
williamr@2
   851
		void ConstructL(RFile& aFile, const TDesC& aUniqueId);
williamr@2
   852
		void ConstructL(const TVirtualPathPtr& aVirtualPath, TContentShareMode aShareMode);
williamr@2
   853
		void ConstructL(TUid aAgentUid, RFile& aFile, const TDesC& aUniqueId);
williamr@2
   854
		void ConstructL(TUid aAgentUid, const TVirtualPathPtr& aVirtualPath, TContentShareMode aShareMode); 
williamr@2
   855
williamr@4
   856
#ifdef SYMBIAN_ENABLE_SDP_WMDRM_SUPPORT
williamr@4
   857
		
williamr@4
   858
		void ConstructL(TUid aAgentUid, const TDesC8& aHeaderData, TIntent aIntent);
williamr@4
   859
		void ConstructL(const TDesC8& aHeaderData);
williamr@4
   860
		void ConstructL(const TDesC8& aHeaderData, TIntent aIntent);
williamr@4
   861
		void ConstructL(TUid aAgentUid, const TDesC8& aHeaderData);
williamr@4
   862
		
williamr@4
   863
#endif //#ifdef SYMBIAN_ENABLE_SDP_WMDRM_SUPPORT
williamr@4
   864
williamr@4
   865
#ifdef SYMBIAN_ENABLE_64_BIT_FILE_SERVER_API
williamr@4
   866
		/*
williamr@4
   867
		 * This is the obselete 32bit Read and replaced by its 64bit counterpart
williamr@4
   868
		 * TInt Read(TInt64 aPos, TDes8& aDes, TInt aLength, TRequestStatus& aStatus) const
williamr@4
   869
		 * However, this function still exits at its original ordinal to avoid BC break. 
williamr@4
   870
		 * Upgrade to 64bit Read is done automatically upon recompling the client code which uses CAF interfaces 
williamr@4
   871
		*/
williamr@4
   872
		IMPORT_C TInt Read_Unused(TInt aPos, TDes8& aDes, TInt aLength, TRequestStatus& aStatus) const;
williamr@4
   873
#endif //SYMBIAN_ENABLE_64_BIT_FILE_SERVER_API
williamr@2
   874
williamr@2
   875
	private:
williamr@2
   876
		// The agent handling this content
williamr@2
   877
		CAgentData* iAgentData; 
williamr@2
   878
williamr@2
   879
		// Defacto ECOM session handle
williamr@2
   880
		CAgentFactory* iAgentFactory;
williamr@2
   881
williamr@2
   882
		// Uid of the agent
williamr@2
   883
		TUid iAgentUid;
williamr@2
   884
		};
williamr@2
   885
williamr@2
   886
} // namespace ContentAccess
williamr@2
   887
#endif /* __DATA_H__ */
williamr@2
   888