epoc32/include/caf/data.h
author William Roberts <williamr@symbian.org>
Tue, 16 Mar 2010 16:12:26 +0000
branchSymbian2
changeset 2 2fe1408b6811
child 4 837f303aceeb
permissions -rw-r--r--
Final list of Symbian^2 public API header files
williamr@2
     1
/*
williamr@2
     2
* Copyright (c) 2003-2007 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@2
    23
@publishedPartner
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
 	@publishedPartner
williamr@2
    52
 	@released
williamr@2
    53
 	*/
williamr@2
    54
	class CData : public CBase
williamr@2
    55
		{
williamr@2
    56
	public:
williamr@2
    57
		/** 
williamr@2
    58
		 Creates a new CData object. 
williamr@2
    59
		 
williamr@2
    60
		 @param aVirtualPath The content object to read
williamr@2
    61
		 @param aIntent	The intended use of the content.
williamr@2
    62
		 @param aShareMode The file share mode used to open this content.
williamr@2
    63
		 @return The new CData object.
williamr@2
    64
		  
williamr@2
    65
		 @leave KErrNotFound		The content object with the given UniqueId does not exist.
williamr@2
    66
		 @leave KErrCAPendingRights The rights have not yet arrived but are expected soon.
williamr@2
    67
		 @leave KErrCANoPermission	Rights exist but the specified intent is not permitted.
williamr@2
    68
		 @leave KErrCANoRights		No rights exist for the content object.
williamr@2
    69
		 @leave KErrCANotSupported	Unable to open the object with the specified UniqueId, it may be a container object.
williamr@2
    70
		 @leave KErrPermissionDenied The agent does not allow the client to access the content object.
williamr@2
    71
		 @leave KErrAccessDenied	The content is already in use.
williamr@2
    72
		 @leave ...		One of the other CAF error codes defined in \c caferr.h  
williamr@2
    73
		 				or one of the other system-wide error codes 
williamr@2
    74
						for any other errors.
williamr@2
    75
		 */
williamr@2
    76
		IMPORT_C static CData* NewL(const TVirtualPathPtr& aVirtualPath,
williamr@2
    77
							TIntent aIntent, TContentShareMode aShareMode); 
williamr@2
    78
williamr@2
    79
		/** 
williamr@2
    80
		 Creates a new CData object. 
williamr@2
    81
		 
williamr@2
    82
		 @param aVirtualPath The content object to read.
williamr@2
    83
		 @param aShareMode The file share mode used to open this content.
williamr@2
    84
		 @return The new CData object.
williamr@2
    85
		  
williamr@2
    86
		 @leave KErrNotFound		The content object with the given UniqueId does not exist.
williamr@2
    87
		 @leave KErrCAPendingRights The rights have not yet arrived but are expected soon.
williamr@2
    88
		 @leave KErrCANoPermission	Rights exist but the specified intent is not permitted.
williamr@2
    89
		 @leave KErrCANoRights		No rights exist for the content object.
williamr@2
    90
		 @leave KErrCANotSupported	Unable to open the object with the specified UniqueId, it may be a container object.
williamr@2
    91
		 @leave KErrPermissionDenied The agent does not allow the client to access the content object.
williamr@2
    92
		 @leave KErrAccessDenied	The content is already in use.
williamr@2
    93
		 @leave ... 	One of the other CAF error codes defined in \c caferr.h  
williamr@2
    94
		 				or one of the other system-wide error codes for 
williamr@2
    95
						any other errors.		 
williamr@2
    96
		 */
williamr@2
    97
		IMPORT_C static CData* NewL(const TVirtualPathPtr& aVirtualPath,
williamr@2
    98
							TContentShareMode aShareMode); 
williamr@2
    99
		
williamr@2
   100
williamr@2
   101
		/** 
williamr@2
   102
		 Creates a new CData object 
williamr@2
   103
		 
williamr@2
   104
		 @param aVirtualPath The content object to read.
williamr@2
   105
		 @param aIntent	The intended use of the content.
williamr@2
   106
		 @param aShareMode The file share mode used to open this content.
williamr@2
   107
		 @return The new CData object.
williamr@2
   108
		  
williamr@2
   109
		 @leave KErrNotFound		The content object with the given UniqueId does not exist.
williamr@2
   110
		 @leave KErrCAPendingRights The rights have not yet arrived but are expected soon.
williamr@2
   111
		 @leave KErrCANoPermission	Rights exist but the specified intent is not permitted.
williamr@2
   112
		 @leave KErrCANoRights		No rights exist for the content object.
williamr@2
   113
		 @leave KErrCANotSupported	Unable to open the object with the specified UniqueId, it may be a container object.
williamr@2
   114
		 @leave KErrPermissionDenied The agent does not allow the client to access the content object.
williamr@2
   115
		 @leave KErrAccessDenied	The content is already in use.
williamr@2
   116
		 @leave ...		One of the other CAF error codes defined in \c caferr.h  
williamr@2
   117
		 				or one of the other system-wide error codes for 
williamr@2
   118
						any other errors.
williamr@2
   119
		 */
williamr@2
   120
		IMPORT_C static CData* NewLC(const TVirtualPathPtr& aVirtualPath,
williamr@2
   121
							TIntent aIntent, TContentShareMode aShareMode); 
williamr@2
   122
williamr@2
   123
		/** 
williamr@2
   124
		 Creates a new CData object 
williamr@2
   125
		 
williamr@2
   126
		 @param aVirtualPath The content object to read.
williamr@2
   127
		 @param aShareMode The file share mode used to open this content.
williamr@2
   128
		 @return The new CData object.
williamr@2
   129
		  
williamr@2
   130
		 @leave KErrNotFound		The content object with the given UniqueId does not exist.
williamr@2
   131
		 @leave KErrCAPendingRights The rights have not yet arrived but are expected soon.
williamr@2
   132
		 @leave KErrCANoPermission	Rights exist but the specified intent is not permitted.
williamr@2
   133
		 @leave KErrCANoRights		No rights exist for the content object.
williamr@2
   134
		 @leave KErrCANotSupported	Unable to open the object with the specified UniqueId, it may be a container object.
williamr@2
   135
		 @leave KErrPermissionDenied The agent does not allow the client to access the content object.
williamr@2
   136
		 @leave KErrAccessDenied	The content is already in use.
williamr@2
   137
		 @leave ...			One of the other CAF error codes defined in \c caferr.h  
williamr@2
   138
		 					or one of the other system-wide error codes for 
williamr@2
   139
							any other errors.
williamr@2
   140
		 */					
williamr@2
   141
		IMPORT_C static CData* NewLC(const TVirtualPathPtr& aVirtualPath,
williamr@2
   142
							TContentShareMode aShareMode); 
williamr@2
   143
williamr@2
   144
							
williamr@2
   145
		/** 
williamr@2
   146
		 Creates a new CData object. 
williamr@2
   147
		 
williamr@2
   148
		 @param aFile An open RFile handle, the agent will make a duplicate of this handle. 
williamr@2
   149
		 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
   150
		 @param aUniqueId The content object to read.
williamr@2
   151
		 @param aIntent	The intended use of the content.
williamr@2
   152
		 @return The new CData object.
williamr@2
   153
		  
williamr@2
   154
		 @leave KErrNotFound		The content object with the given UniqueId does not exist.
williamr@2
   155
		 @leave KErrCAPendingRights The rights have not yet arrived but are expected soon.
williamr@2
   156
		 @leave KErrCANoPermission	Rights exist but the specified intent is not permitted.
williamr@2
   157
		 @leave KErrCANoRights		No rights exist for the content object.
williamr@2
   158
		 @leave KErrCANotSupported	Unable to open the object with the specified UniqueId, it may be a container object.
williamr@2
   159
		 @leave KErrPermissionDenied The agent does not allow the client to access the content object.
williamr@2
   160
		 @leave KErrAccessDenied	The content is already in use.
williamr@2
   161
		 @leave ...			One of the other CAF error codes defined in \c caferr.h  
williamr@2
   162
		 					or one of the other system-wide error codes for 
williamr@2
   163
							any other errors.
williamr@2
   164
		 */
williamr@2
   165
		IMPORT_C static CData* NewL(RFile& aFile, const TDesC& aUniqueId, TIntent aIntent);
williamr@2
   166
williamr@2
   167
		/** 
williamr@2
   168
		 Creates a new CData object. 
williamr@2
   169
		 
williamr@2
   170
		 @param aFile An open RFile handle, the agent will make a duplicate of this handle. 
williamr@2
   171
		 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
   172
		 @param aUniqueId The content object to read.
williamr@2
   173
		 @return The new CData object.
williamr@2
   174
		  
williamr@2
   175
		 @leave KErrNotFound		The content object with the given UniqueId does not exist.
williamr@2
   176
		 @leave KErrCAPendingRights The rights have not yet arrived but are expected soon.
williamr@2
   177
		 @leave KErrCANoPermission	Rights exist but the specified intent is not permitted.
williamr@2
   178
		 @leave KErrCANoRights		No rights exist for the content object.
williamr@2
   179
		 @leave KErrCANotSupported	Unable to open the object with the specified UniqueId, it may be a container object.
williamr@2
   180
		 @leave KErrPermissionDenied The agent does not allow the client to access the content object.
williamr@2
   181
		 @leave KErrAccessDenied	The content is already in use.
williamr@2
   182
		 @leave ...			One of the other CAF error codes defined in \c caferr.h  
williamr@2
   183
		 					or one of the other system-wide error codes for 
williamr@2
   184
							any other errors.
williamr@2
   185
		 */
williamr@2
   186
		IMPORT_C static CData* NewL(RFile& aFile, const TDesC& aUniqueId);
williamr@2
   187
		
williamr@2
   188
		/** 
williamr@2
   189
		 Creates a new CData object. 
williamr@2
   190
		 
williamr@2
   191
		 @param aFile An open RFile handle, the agent will make a duplicate of this handle. 
williamr@2
   192
		 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
   193
		 @param aUniqueId The content object to read.
williamr@2
   194
		 @param aIntent	The intended use of the content.
williamr@2
   195
		 @return The new CData object.
williamr@2
   196
		  
williamr@2
   197
		 @leave KErrNotFound		The content object with the given UniqueId does not exist.
williamr@2
   198
		 @leave KErrCAPendingRights The rights have not yet arrived but are expected soon.
williamr@2
   199
		 @leave KErrCANoPermission	Rights exist but the specified intent is not permitted.
williamr@2
   200
		 @leave KErrCANoRights		No rights exist for the content object.
williamr@2
   201
		 @leave KErrCANotSupported	Unable to open the object with the specified UniqueId, it may be a container object.
williamr@2
   202
		 @leave KErrPermissionDenied The agent does not allow the client to access the content object.
williamr@2
   203
		 @leave KErrAccessDenied	The content is already in use.
williamr@2
   204
		 @leave ...				One of the other CAF error codes defined in \c caferr.h  
williamr@2
   205
		 						or one of the other system-wide error codes 
williamr@2
   206
								for any other errors.
williamr@2
   207
		 */
williamr@2
   208
		IMPORT_C static CData* NewLC(RFile& aFile, const TDesC& aUniqueId, TIntent aIntent);
williamr@2
   209
		
williamr@2
   210
		/** 
williamr@2
   211
		 Creates a new CData object. 
williamr@2
   212
		 
williamr@2
   213
		 @param aFile An open RFile handle, the agent will make a duplicate of this handle. 
williamr@2
   214
		 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
   215
		 @param aUniqueId The content object to read.
williamr@2
   216
		 @return The new CData object.
williamr@2
   217
		  
williamr@2
   218
		 @leave KErrNotFound		The content object with the given UniqueId does not exist.
williamr@2
   219
		 @leave KErrCAPendingRights The rights have not yet arrived but are expected soon.
williamr@2
   220
		 @leave KErrCANoPermission	Rights exist but the specified intent is not permitted.
williamr@2
   221
		 @leave KErrCANoRights		No rights exist for the content object.
williamr@2
   222
		 @leave KErrCANotSupported	Unable to open the object with the specified UniqueId, it may be a container object.
williamr@2
   223
		 @leave KErrPermissionDenied The agent does not allow the client to access the content object.
williamr@2
   224
		 @leave KErrAccessDenied	The content is already in use.
williamr@2
   225
		 @leave ...				One of the other CAF error codes defined in \c caferr.h  
williamr@2
   226
		 						or one of the other system-wide error codes 
williamr@2
   227
								for any other errors.
williamr@2
   228
		 */
williamr@2
   229
		IMPORT_C static CData* NewLC(RFile& aFile, const TDesC& aUniqueId);
williamr@2
   230
		
williamr@2
   231
		/** 
williamr@2
   232
		 Creates a new CData object. 
williamr@2
   233
		 
williamr@2
   234
		 @param aAgentUid The agent determined to support this content.
williamr@2
   235
		 @param aVirtualPath The content object to read.
williamr@2
   236
		 @param aIntent	The intended use of the content.
williamr@2
   237
		 @param aShareMode The file share mode used to open this content.
williamr@2
   238
		 @return The new CData object.
williamr@2
   239
		  
williamr@2
   240
		 @leave KErrNotFound		The content object with the given UniqueId does not exist.
williamr@2
   241
		 @leave KErrCAPendingRights The rights have not yet arrived but are expected soon.
williamr@2
   242
		 @leave KErrCANoPermission	Rights exist but the specified intent is not permitted.
williamr@2
   243
		 @leave KErrCANoRights		No rights exist for the content object.
williamr@2
   244
		 @leave KErrCANotSupported	Unable to open the object with the specified UniqueId, it may be a container object.
williamr@2
   245
		 @leave KErrPermissionDenied The agent does not allow the client to access the content object.
williamr@2
   246
		 @leave KErrAccessDenied	The content is already in use.
williamr@2
   247
		 @leave ...				One of the other CAF error codes defined in \c caferr.h  
williamr@2
   248
		 						or one of the other system-wide error codes 
williamr@2
   249
								for any other errors.
williamr@2
   250
		
williamr@2
   251
		@internalComponent
williamr@2
   252
		@released
williamr@2
   253
		 */
williamr@2
   254
		static CData* NewLC(TUid aAgentUid, const TVirtualPathPtr& aVirtualPath,
williamr@2
   255
							TIntent aIntent, TContentShareMode aShareMode); 
williamr@2
   256
		
williamr@2
   257
		/** 
williamr@2
   258
		 Creates a new CData object. 
williamr@2
   259
		 
williamr@2
   260
		 @param aAgentUid The Uid of the agent who supports this content.
williamr@2
   261
		 @param aFile An open RFile handle, the agent will make a duplicate of this handle. 
williamr@2
   262
		 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
   263
		 @param aUniqueId The content object to read.
williamr@2
   264
		 @param aIntent	The intended use of the content.
williamr@2
   265
		 @return The new CData object.
williamr@2
   266
		  
williamr@2
   267
		 @leave KErrNotFound		The content object with the given UniqueId does not exist.
williamr@2
   268
		 @leave KErrCAPendingRights The rights have not yet arrived but are expected soon.
williamr@2
   269
		 @leave KErrCANoPermission	Rights exist but the specified intent is not permitted.
williamr@2
   270
		 @leave KErrCANoRights		No rights exist for the content object.
williamr@2
   271
		 @leave KErrCANotSupported	Unable to open the object with the specified UniqueId, it may be a container object.
williamr@2
   272
		 @leave KErrPermissionDenied The agent does not allow the client to access the content object.
williamr@2
   273
		 @leave KErrAccessDenied	The content is already in use.
williamr@2
   274
		 @leave ...				One of the other CAF error codes defined in \c caferr.h  
williamr@2
   275
		 						or one of the other system-wide error codes for 
williamr@2
   276
								any other errors.
williamr@2
   277
williamr@2
   278
		@internalComponent
williamr@2
   279
		@released
williamr@2
   280
		 */
williamr@2
   281
		static CData* NewLC(TUid aAgentUid, RFile& aFile, const TDesC& aUniqueId, TIntent aIntent);
williamr@2
   282
		
williamr@2
   283
		/** destructor */
williamr@2
   284
		virtual ~CData();
williamr@2
   285
		
williamr@2
   286
		/** 
williamr@2
   287
		 Reads from a content object up to the maximum length of the
williamr@2
   288
		 descriptor or the end of the content object.
williamr@2
   289
		 	
williamr@2
   290
		 When an attempt is made to read beyond the end of the content,
williamr@2
   291
		 no error is returned. The descriptor’s length is set to the
williamr@2
   292
		 number of bytes that were read into it. Therefore, when reading
williamr@2
   293
		 through content, the end has been reached when the
williamr@2
   294
		 descriptor length (given by TDesC::Length()) is zero.
williamr@2
   295
		 
williamr@2
   296
		 @param aDes	Descriptor into which binary data is read. Any existing
williamr@2
   297
		  				contents are overwritten. On return, its length is set
williamr@2
   298
		 				to the number of bytes read.
williamr@2
   299
		 @return		KErrNone if successful.
williamr@2
   300
		 @return		One of the CAF error codes defined in \c caferr.h  or 
williamr@2
   301
		 				one of the other system-wide error codes.
williamr@2
   302
 		@capability DRM Access to DRM protected content is not permitted for processes without DRM capability. Access to unprotected content is unrestricted 
williamr@2
   303
		*/
williamr@2
   304
		IMPORT_C TInt Read(TDes8& aDes) const;
williamr@2
   305
williamr@2
   306
		/** 
williamr@2
   307
		 Reads from a content object up to the specified length of the
williamr@2
   308
		 descriptor or the end of the content object.
williamr@2
   309
		 	
williamr@2
   310
		 @see Read(TDes8& aDes)
williamr@2
   311
		 		 
williamr@2
   312
		 @param aDes	Descriptor into which binary data is read. Any existing
williamr@2
   313
		  				contents are overwritten. On return, its length is set
williamr@2
   314
		 				to the number of bytes read.
williamr@2
   315
		 @param aLength		The number of bytes to read from the file,
williamr@2
   316
		 					or to the end of the file, whichever is encountered first. 
williamr@2
   317
		 					The length of the buffer is set to the number of bytes actually read.
williamr@2
   318
		 @return		KErrNone if successful.
williamr@2
   319
		 @return		Otherwise one of the CAF error codes defined in \c caferr.h  or 
williamr@2
   320
		 				one of the other system-wide error codes.
williamr@2
   321
		@capability DRM Access to DRM protected content is not permitted for processes without DRM capability. Access to unprotected content is unrestricted 
williamr@2
   322
		*/
williamr@2
   323
		IMPORT_C TInt Read(TDes8& aDes,TInt aLength) const;
williamr@2
   324
		
williamr@2
   325
		/**
williamr@2
   326
		 Read content asynchronously up to the maximum length of the descriptor
williamr@2
   327
		 or until the end of the content object is reached.
williamr@2
   328
		 NB: It is important that the descriptor passed to 
williamr@2
   329
		 aDes remains in scope until the request has completed.		
williamr@2
   330
		 
williamr@2
   331
		 @see Read(TDes8& aDes)
williamr@2
   332
		 
williamr@2
   333
		 @param aDes 		Descriptor into which binary data is read. Any
williamr@2
   334
		  					existing contents are overwritten. On return,
williamr@2
   335
		 					its length is set to the number of bytes read.
williamr@2
   336
		 @param aStatus		Asynchronous request status. On completion this will contain one 
williamr@2
   337
		 					of the following error codes: KErrNone if the data was 
williamr@2
   338
							successfully read. Otherwise one of the CAF error codes defined in 
williamr@2
   339
							\c caferr.h  or one of the other standard system-wide
williamr@2
   340
							error codes for any other errors.
williamr@2
   341
		@capability DRM Access to DRM protected content is not permitted for processes without DRM capability. Access to unprotected content is unrestricted 
williamr@2
   342
		*/	
williamr@2
   343
		IMPORT_C void Read(TDes8& aDes, TRequestStatus& aStatus) const;
williamr@2
   344
williamr@2
   345
		/**
williamr@2
   346
		 Read content asynchronously up to the specified length 
williamr@2
   347
		 or until the end of the content object is reached.
williamr@2
   348
		 NB: It is important that the descriptor passed to 
williamr@2
   349
		 aDes remains in scope until the request has completed.		 	
williamr@2
   350
williamr@2
   351
		 @see Read(TDes8& aDes)
williamr@2
   352
		 
williamr@2
   353
		 @param aDes 		Descriptor into which binary data is read. Any
williamr@2
   354
		  					existing contents are overwritten. On return,
williamr@2
   355
		 					its length is set to the number of bytes read.
williamr@2
   356
		 @param aLength		The number of bytes to read from the file,
williamr@2
   357
		 					or to the end of the file, whichever is encountered first. 
williamr@2
   358
		 					The length of the buffer is set to the number of bytes actually read.
williamr@2
   359
		 @param aStatus		Asynchronous request status. On completion this will contain one 
williamr@2
   360
		 					of the following error codes: KErrNone if the data was 
williamr@2
   361
							successfully read. Otherwise one of the CAF error codes defined in 
williamr@2
   362
							\c caferr.h  or one of the other standard system-wide
williamr@2
   363
							error codes for any other errors.
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 void Read(TDes8& aDes, TInt aLength, TRequestStatus& aStatus) const;
williamr@2
   367
		
williamr@2
   368
		/**
williamr@2
   369
		 Cancels asynchronous read.
williamr@2
   370
		 
williamr@2
   371
		 @param aStatus		Asynchronous request status. This parameter should have been supplied earlier to
williamr@2
   372
		 					an asynchronous Read call. If it has not been previously supplied to a Read call,
williamr@2
   373
		 					this function will not have any effect.
williamr@2
   374
		 @capability DRM Access to DRM protected content is not permitted for processes without DRM capability. Access to unprotected content is unrestricted 
williamr@2
   375
		*/
williamr@2
   376
		IMPORT_C void ReadCancel(TRequestStatus &aStatus) const;		
williamr@2
   377
williamr@2
   378
		/**
williamr@2
   379
		 Reads content asynchronously. The data is read from a specified offset 
williamr@2
   380
		 up to a specified number of bytes or until the end of the content object 
williamr@2
   381
		 is reached. The data is read into the descriptor buffer supplied.
williamr@2
   382
		 NB: It is important that the descriptor passed to 
williamr@2
   383
		 aDes remains in scope until the request has completed.			
williamr@2
   384
		 
williamr@2
   385
		 @see Read(TDes8& aDes)
williamr@2
   386
		 
williamr@2
   387
		 @param aPos		Position of first byte to be read. 
williamr@2
   388
		 					This is an offset from the start of the file. 
williamr@2
   389
		 @param aDes 		Descriptor into which binary data is read. Any
williamr@2
   390
		  					existing contents are overwritten. On return,
williamr@2
   391
		 					its length is set to the number of bytes read. 
williamr@2
   392
		 @param aLength		The number of bytes to read from the file,
williamr@2
   393
		 					or to the end of the file, whichever is encountered first. 
williamr@2
   394
		 					The length of the buffer is set to the number of bytes actually read.
williamr@2
   395
		 @param aStatus		Asynchronous request status. On completion this will contain one 
williamr@2
   396
		 					of the following error codes: KErrNone if the data was 
williamr@2
   397
							successfully read. Otherwise one of the CAF error codes defined in 
williamr@2
   398
							\c caferr.h  or one of the other standard system-wide
williamr@2
   399
							error codes for any other errors.
williamr@2
   400
		 @return KErrNone if the async read request was successfully submitted.
williamr@2
   401
		 @return KErrArgument if a negative offset is supplied.
williamr@2
   402
		 @return KErrCANotSupported if the agent does not support this operation.
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 TInt Read(TInt aPos, TDes8& aDes, TInt aLength, TRequestStatus& aStatus) const;
williamr@2
   406
		
williamr@2
   407
		/**
williamr@2
   408
		 Gets the data size in bytes.
williamr@2
   409
		 
williamr@2
   410
		 @param aSize	On return this will contain the size of the plaintext data in bytes.
williamr@2
   411
		 @leave KErrCASizeNotDetermined	Size could not be determined by the managing agent.
williamr@2
   412
		 @leave ...		One of the other CAF error codes defined in \c caferr.h  or one of the 
williamr@2
   413
						system-wide error codes for any other errors.		 
williamr@2
   414
		 @capability DRM Access to DRM protected content is not permitted for processes without DRM capability. Access to unprotected content is unrestricted
williamr@2
   415
		 */
williamr@2
   416
		IMPORT_C void DataSizeL(TInt& aSize);
williamr@2
   417
williamr@2
   418
		/**
williamr@2
   419
		 Changes or retrieves the location of the file pointer within 
williamr@2
   420
		 the content object.
williamr@2
   421
		 
williamr@2
   422
 		 NOTE: Some operations may fail if the content data is sourced over a network connection.		 
williamr@2
   423
		 
williamr@2
   424
		 There are four seek modes used: 
williamr@2
   425
		 
williamr@2
   426
		 @li ESeekStart - Sets the file pointer aPos bytes from the start of the 
williamr@2
   427
		 content object.  aPos is not modified by the call to Seek()
williamr@2
   428
		 @li ESeekEnd - Sets the file pointer aPos bytes from the end of the 
williamr@2
   429
		 content object. The aPos parameter supplied should be zero or negative 
williamr@2
   430
		 when using ESeekEnd. Upon completion aPos is updated with the current 
williamr@2
   431
		 position relative to the start of the content object.
williamr@2
   432
		 @li ESeekCurrent - Moves the file pointer aPos bytes from the current 
williamr@2
   433
		 position. Upon completion aPos is updated with the new position relative 
williamr@2
   434
		 to the start of the content object. Suppling a zero value for the aPos Parameter can be
williamr@2
   435
		 used to retrieve the current file pointer location 
williamr@2
   436
		 @li ESeekAddress Sets the aPos parameter to the address of the byte 
williamr@2
   437
		 aPos bytes from the start of the content object
williamr@2
   438
williamr@2
   439
		 @see TSeek
williamr@2
   440
		 
williamr@2
   441
		 @param aMode	Seek mode - controls the destination of the
williamr@2
   442
		  				seek operation.
williamr@2
   443
		  
williamr@2
   444
		 @param aPos	Offset from either the start, end or current position depending upon 
williamr@2
   445
		 the seek mode. Negative offsets are used to seek before the current position or
williamr@2
   446
		 relative to the end of the file.
williamr@2
   447
		 
williamr@2
   448
		 @return		KErrNone if successful. 
williamr@2
   449
		 @return		Otherwise one of the CAF error codes defined in \c caferr.h  or one 
williamr@2
   450
		 				of the other system-wide error codes.
williamr@2
   451
		@capability DRM Access to DRM protected content is not permitted for processes without DRM capability. Access to unprotected content is unrestricted 
williamr@2
   452
		*/
williamr@2
   453
		IMPORT_C TInt Seek(TSeek aMode,TInt& aPos) const;
williamr@2
   454
		
williamr@2
   455
williamr@2
   456
		/** Request the agent handling this content to set a property value. If the property is set
williamr@2
   457
		it is only set for this CData session and does not impact other CAF	users.
williamr@2
   458
williamr@2
   459
		 For example setting the buffer-size to 256 bytes can be achieved as follows:
williamr@2
   460
williamr@2
   461
					@code
williamr@2
   462
		  			MyData->SetProperty(EAgentPropertyBufferSize, 256);
williamr@2
   463
		  			@endcode
williamr@2
   464
williamr@2
   465
  		@see ContentAccess::TAgentProperty
williamr@2
   466
	
williamr@2
   467
		@param aProperty The property to set.
williamr@2
   468
		@param aValue The value of the property.
williamr@2
   469
		@return Whether or not the property was set.
williamr@2
   470
		@return KErrNone if the property was set.
williamr@2
   471
		@return KErrCANotSupported if the agent does not support the property or value.
williamr@2
   472
		@return KErrAccessDenied if the agent does not permit the property to be changed.
williamr@2
   473
		@return KErrPermissionDenied if the application does not have the necessary capability to change the property.
williamr@2
   474
		@capability DRM Access to DRM protected content is not permitted for processes without DRM capability. Access to unprotected content is unrestricted.
williamr@2
   475
		*/
williamr@2
   476
		IMPORT_C TInt SetProperty(TAgentProperty aProperty, TInt aValue);
williamr@2
   477
		
williamr@2
   478
		/**
williamr@2
   479
		 Allows a client to verify that the intent is supported by the
williamr@2
   480
		 current rights for the data object. 
williamr@2
   481
		 
williamr@2
   482
		 @note Since the intent is only evaluated the agent will not decrement 
williamr@2
   483
		 any rights-state such as play counts.
williamr@2
   484
		  
williamr@2
   485
		 @see ContentAccess::TIntent
williamr@2
   486
williamr@2
   487
		 @param aIntent	The intended way the content will be used.
williamr@2
   488
		 @return Whether rights exist allowing the content to be used for this intent.
williamr@2
   489
		 @return KErrNone if the intent is permitted.
williamr@2
   490
		 @return KErrNoRights if no rights exist for the specified content object.
williamr@2
   491
		 @return KErrCANoPermission	if rights exist but the specified intent is not permitted.
williamr@2
   492
		 @return KErrCAPendingRights if the rights have not yet arrived but are expected soon.
williamr@2
   493
		 @return KErrNoPermission if rights exist but none permit the specified intent.
williamr@2
   494
		 @return KErrPermissionDenied if the client is not allowed to use this content object.
williamr@2
   495
		 @return Otherwise one of the other CAF error codes defined in \c caferr.h  or one of the
williamr@2
   496
				other system-wide error codes for any other errors.
williamr@2
   497
		 @capability DRM Access to DRM protected content is not permitted for processes without DRM capability. Access to unprotected content is unrestricted
williamr@2
   498
		 */		
williamr@2
   499
		IMPORT_C TInt EvaluateIntent(TIntent aIntent);
williamr@2
   500
		
williamr@2
   501
		/**
williamr@2
   502
		 Execute intent allows the application to signal it is about to carry out
williamr@2
   503
		 the specified intent on protected content.The agent will decrement applicable 
williamr@2
   504
		 stateful rights such as play counts where necessary.
williamr@2
   505
williamr@2
   506
  		 Applications should be very careful to use this function correctly.
williamr@2
   507
		 @li If ExecuteIntent() is never called stateful rights will never be decremented. Users will be able to use the content forever
williamr@2
   508
		 @li If ExecuteIntent() is called too often stateful rights may be consumed prematurely. 
williamr@2
   509
williamr@2
   510
		 Usually it would be best to call ExecuteIntent immediately before the content 
williamr@2
   511
		 is displayed or the instant playback begins. ExecuteIntent should not be considered a 
williamr@2
   512
		 prerequisite for calling the Read functions. It is valid for an application to read from 
williamr@2
   513
		 the file before calling ExecuteIntent. 
williamr@2
   514
williamr@2
   515
		 @note Since rights are executed here the agent will decrement any rights-state such as 
williamr@2
   516
		 play counts that apply. 
williamr@2
   517
		 
williamr@2
   518
		@param aIntent	The intent indicator.
williamr@2
   519
		@return The result of attempting executing the intent.
williamr@2
   520
		@return KErrNone if the intent is permitted and stateful rights may have been decremented.
williamr@2
   521
		@return KErrNoRights if no rights exist for the specified content object.
williamr@2
   522
		@return KErrCANoPermission	if rights exist but the specified intent is not permitted.
williamr@2
   523
		@return KErrCAPendingRights if the rights have not yet arrived but are expected soon.
williamr@2
   524
		@return KErrNoPermission if rights exist but none permit the specified intent.
williamr@2
   525
		@return KErrPermissionDenied if the client is not allowed to use this content object.
williamr@2
   526
		@return Otherwise one of the other CAF error codes defined in \c caferr.h  or one of the.
williamr@2
   527
				other system-wide error codes for any other errors.
williamr@2
   528
		@capability DRM Access to DRM protected content is not permitted for processes without DRM capability. Access to unprotected content is unrestricted 
williamr@2
   529
		*/		
williamr@2
   530
		IMPORT_C TInt ExecuteIntent(TIntent aIntent);
williamr@2
   531
		
williamr@2
   532
		/**  Get an attribute for the content object
williamr@2
   533
williamr@2
   534
		@see ContentAccess::TAttribute
williamr@2
   535
williamr@2
   536
		@code
williamr@2
   537
		CContent* content = CContent::NewL(uri);
williamr@2
   538
		CData* data = content->OpenContentL(EPlay, uniqueId);
williamr@2
   539
		delete content;
williamr@2
   540
williamr@2
   541
		TInt value = 0;
williamr@2
   542
		TInt err = data->GetAttribute(EIsProtected, value);
williamr@2
   543
		if(err == KErrNone && value)
williamr@2
   544
			{
williamr@2
   545
			DisplayPadLock();
williamr@2
   546
			}
williamr@2
   547
williamr@2
   548
		delete data;
williamr@2
   549
		@endcode
williamr@2
   550
williamr@2
   551
		@param aAttribute The attribute to query, from ContentAccess::TAttribute.
williamr@2
   552
		@param aValue Used to return the attribute value.
williamr@2
   553
		@return Whether the attribute was updated.
williamr@2
   554
		@return KErrNone if the value of the attribute was updated.
williamr@2
   555
		@return KErrCANotSupported if the requested attribute does not exist.
williamr@2
   556
		@return KErrPermissionDenied if the access to the protected content is not permitted by the CAF Agent.
williamr@2
   557
		@return Otherwise one of the other CAF error codes defined in \c caferr.h  or one of the 
williamr@2
   558
				other system-wide error codes for any other errors.
williamr@2
   559
		@capability DRM Access to DRM protected content is not permitted for processes without DRM capability. Access to unprotected content is unrestricted 
williamr@2
   560
		*/
williamr@2
   561
		IMPORT_C TInt GetAttribute(TInt aAttribute, TInt& aValue) const;
williamr@2
   562
williamr@2
   563
		/** Get a set of attributes for the content object 
williamr@2
   564
williamr@2
   565
		@see ContentAccess::TAttribute
williamr@2
   566
williamr@2
   567
		The following example determines whether the content object 
williamr@2
   568
		is protected and has rights that will enable it to be viewed by the 
williamr@2
   569
		user
williamr@2
   570
williamr@2
   571
		@code
williamr@2
   572
		// CData* data = a data object
williamr@2
   573
		
williamr@2
   574
		RAttributeSet attributeSet;
williamr@2
   575
		CleanupClosePushL(attributeSet);
williamr@2
   576
		attributeSet->AddL(EProtected);
williamr@2
   577
		attributeSet->AddL(ECanView);
williamr@2
   578
williamr@2
   579
		User::LeaveIfError(data->GetAttributeSet(attributeSet);
williamr@2
   580
williamr@2
   581
		TInt err = attributeSet.GetValue(EProtected, value);
williamr@2
   582
		if(err == KErrNone && value)
williamr@2
   583
				{
williamr@2
   584
				// file is DRM protected
williamr@2
   585
				}
williamr@2
   586
williamr@2
   587
		err = attributeSet.GetValue(ECanView, value);
williamr@2
   588
		if(err == KErrNone && value)
williamr@2
   589
				{
williamr@2
   590
				// File has rights that allow it to be displayed on screen
williamr@2
   591
				}
williamr@2
   592
		
williamr@2
   593
		// Finished
williamr@2
   594
		CleanupStack::PopAndDestroy(); 	// attributeSet.Close()
williamr@2
   595
		@endcode
williamr@2
   596
williamr@2
   597
williamr@2
   598
		@param aAttributeSet The set of attributes to query and update.
williamr@2
   599
		@return Whether the attribute set was updated.
williamr@2
   600
		@return KErrNone if the attributes were retrieved successfully.
williamr@2
   601
		@return KErrPermissionDenied if the access to the protected content is not permitted by the CAF Agent.
williamr@2
   602
		@return Otherwise one of the CAF error codes defined in \c caferr.h  or one of the 
williamr@2
   603
				other system-wide error codes for any other errors.				 
williamr@2
   604
		@capability DRM Access to DRM protected content is not permitted for processes without DRM capability. Access to unprotected content is unrestricted 
williamr@2
   605
		*/
williamr@2
   606
		IMPORT_C TInt GetAttributeSet(RAttributeSet& aAttributeSet) const;
williamr@2
   607
williamr@2
   608
williamr@2
   609
		/**  Get text string attributes or meta-data for the content object
williamr@2
   610
	
williamr@2
   611
		@see ContentAccess::TStringAttribute
williamr@2
   612
williamr@2
   613
		@code
williamr@2
   614
		CContent* content = CContent::NewLC(uri);
williamr@2
   615
		CData* data = content->OpenContentLC(EPlay, uniqueId);
williamr@2
   616
		CleanupStack::PopAndDestroy(content);
williamr@2
   617
williamr@2
   618
		TBuf <MAX_PATH> previewUri;
williamr@2
   619
		TInt err = data->GetStringAttribute(EPreviewURI, previewUri);
williamr@2
   620
		if(err == KErrNone)
williamr@2
   621
			{
williamr@2
   622
			DisplayPreview(previewUri);
williamr@2
   623
			}
williamr@2
   624
williamr@2
   625
		CleanupStack::PopAndDestroy(data);
williamr@2
   626
		@endcode
williamr@2
   627
williamr@2
   628
		@param aAttribute The attribute to query, from ContentAccess::TStringAttribute.
williamr@2
   629
		@param aValue Returns the value of the attribute.
williamr@2
   630
		@return Whether the value was updated.
williamr@2
   631
		@return KErrNone if the attribute was retrieved.
williamr@2
   632
		@return KErrOverflow if the buffer was not large enough to return the result.
williamr@2
   633
		@return KErrCANotSupported if the requested attribute does not exist.
williamr@2
   634
		@return KErrPermissionDenied if the access to the protected content is not permitted by the CAF Agent.
williamr@2
   635
		@return Otherwise one of the other CAF error codes defined in \c caferr.h  or one of the 
williamr@2
   636
				other system-wide error codes for any other errors.				 
williamr@2
   637
		@capability DRM Access to DRM protected content is not permitted for processes without DRM capability. Access to unprotected content is unrestricted 
williamr@2
   638
		*/
williamr@2
   639
		IMPORT_C TInt GetStringAttribute(TInt aAttribute, TDes& aValue) const;
williamr@2
   640
williamr@2
   641
		
williamr@2
   642
		
williamr@2
   643
		/** Obtain a set of string attributes for the content object 
williamr@2
   644
		
williamr@2
   645
		@see ContentAccess::TStringAttribute
williamr@2
   646
williamr@2
   647
		@code
williamr@2
   648
		CContent* content = CContent::NewLC(uri);
williamr@2
   649
		CData* data = content->OpenContentLC(EPlay, uniqueId);
williamr@2
   650
williamr@2
   651
		// create the attribute set, add the attributes we are interested in
williamr@2
   652
		RStringAttributeSet stringAttributeSet;
williamr@2
   653
		CleanupClosePushL(stringAttributeSet);
williamr@2
   654
		stringAttributeSet.AddL(EPreviewURI);
williamr@2
   655
		stringAttributeSet.AddL(ETitle);
williamr@2
   656
		
williamr@2
   657
		User::LeaveIfError(data->GetStringAttributeSet(stringAttributeSet));
williamr@2
   658
	
williamr@2
   659
		// Pass the value of the string attribute to DisplayPreview()
williamr@2
   660
		TFileName previewUri;
williamr@2
   661
		TInt err = stringAttributeSet.GetValue(EPreviewURI, previewUri);
williamr@2
   662
		if(err == KErrNone)
williamr@2
   663
			{
williamr@2
   664
			DisplayPreview(previewUri);
williamr@2
   665
			}
williamr@2
   666
		
williamr@2
   667
		CleanupStack::PopAndDestroy(3);	// content, data, stringAttributeSet
williamr@2
   668
		@endcode
williamr@2
   669
	
williamr@2
   670
williamr@2
   671
		@param aStringAttributeSet The set of attributes to query and update.
williamr@2
   672
		@return Whether the string attribute set was updated.
williamr@2
   673
		@return KErrNone if the attributes were retrieved successfully.
williamr@2
   674
		@return KErrNotFound if the default content object was not found.
williamr@2
   675
		@return KErrPermissionDenied if the access to the protected content is not permitted by the CAF Agent.
williamr@2
   676
		@return Otherwise one of the CAF error codes defined in \c caferr.h  or one of the 
williamr@2
   677
				other system-wide error codes for any other errors.				 
williamr@2
   678
		@capability DRM Access to DRM protected content is not permitted for processes without DRM capability. Access to unprotected content is unrestricted 
williamr@2
   679
		*/
williamr@2
   680
		IMPORT_C TInt GetStringAttributeSet(RStringAttributeSet& aStringAttributeSet) const;
williamr@2
   681
williamr@2
   682
#ifndef REMOVE_CAF1
williamr@2
   683
		/** Set Qos attribute
williamr@2
   684
		@param aQosAttr The Qos attribute to set.
williamr@2
   685
		@param aValue The value of the attribute.
williamr@2
   686
		@deprecated 
williamr@2
   687
		*/
williamr@2
   688
		IMPORT_C void SetQosL(TQosAttribute aQosAttr, TInt aValue);
williamr@2
   689
williamr@2
   690
		/** Get the mime type of the content
williamr@2
   691
		@param aMimeType Buffer to store the mime type provided by the agent.
williamr@2
   692
		@return ETrue if the mime type was retrieved successfully.
williamr@2
   693
		@deprecated 
williamr@2
   694
		*/
williamr@2
   695
		IMPORT_C TBool GetMimeTypeL(TDes8& aMimeType) const;
williamr@2
   696
#endif	// REMOVE_CAF1
williamr@2
   697
williamr@2
   698
	
williamr@2
   699
	private:
williamr@2
   700
		CData();
williamr@2
   701
		void ConstructL(RFile& aFile, const TDesC& aUniqueId, TIntent aIntent);
williamr@2
   702
		void ConstructL(const TVirtualPathPtr& aVirtualPath, TIntent aIntent, TContentShareMode aShareMode);
williamr@2
   703
		void ConstructL(TUid aAgentUid, RFile& aFile, const TDesC& aUniqueId, TIntent aIntent);
williamr@2
   704
		void ConstructL(TUid aAgentUid, const TVirtualPathPtr& aVirtualPath, TIntent aIntent, TContentShareMode aShareMode); 
williamr@2
   705
williamr@2
   706
		void ConstructL(RFile& aFile, const TDesC& aUniqueId);
williamr@2
   707
		void ConstructL(const TVirtualPathPtr& aVirtualPath, TContentShareMode aShareMode);
williamr@2
   708
		void ConstructL(TUid aAgentUid, RFile& aFile, const TDesC& aUniqueId);
williamr@2
   709
		void ConstructL(TUid aAgentUid, const TVirtualPathPtr& aVirtualPath, TContentShareMode aShareMode); 
williamr@2
   710
williamr@2
   711
williamr@2
   712
	private:
williamr@2
   713
		// The agent handling this content
williamr@2
   714
		CAgentData* iAgentData; 
williamr@2
   715
williamr@2
   716
		// Defacto ECOM session handle
williamr@2
   717
		CAgentFactory* iAgentFactory;
williamr@2
   718
williamr@2
   719
		// Uid of the agent
williamr@2
   720
		TUid iAgentUid;
williamr@2
   721
		};
williamr@2
   722
williamr@2
   723
} // namespace ContentAccess
williamr@2
   724
#endif /* __DATA_H__ */
williamr@2
   725