ContentAccess::CData Class Reference

class ContentAccess::CData : public CBase

Allows clients to read data from a content object.

This class is initialised with an agent implementation that is responsible for this content object.

Inherits from

  • ContentAccess::CData
Public Member Functions
~CData()
IMPORT_C voidDataSizeL(TInt &)
IMPORT_C TIntEvaluateIntent(TIntent)
IMPORT_C TIntExecuteIntent(TIntent)
IMPORT_C TIntGetAttribute(TInt, TInt &)
IMPORT_C TIntGetAttributeSet(RAttributeSet &)
IMPORT_C TBoolGetMimeTypeL(TDes8 &)
IMPORT_C TIntGetStringAttribute(TInt, TDes &)
IMPORT_C TIntGetStringAttributeSet(RStringAttributeSet &)
IMPORT_C CData *NewL(const TVirtualPathPtr &, TIntent, TContentShareMode)
IMPORT_C CData *NewL(const TVirtualPathPtr &, TContentShareMode)
IMPORT_C CData *NewL(RFile &, const TDesC &, TIntent)
IMPORT_C CData *NewL(RFile &, const TDesC &)
IMPORT_C CData *NewLC(const TVirtualPathPtr &, TIntent, TContentShareMode)
IMPORT_C CData *NewLC(const TVirtualPathPtr &, TContentShareMode)
IMPORT_C CData *NewLC(RFile &, const TDesC &, TIntent)
IMPORT_C CData *NewLC(RFile &, const TDesC &)
CData *NewLC(TUid, const TVirtualPathPtr &, TIntent, TContentShareMode)
CData *NewLC(TUid, RFile &, const TDesC &, TIntent)
IMPORT_C TIntRead(TDes8 &)
IMPORT_C TIntRead(TDes8 &, TInt)
IMPORT_C voidRead(TDes8 &, TRequestStatus &)
IMPORT_C voidRead(TDes8 &, TInt, TRequestStatus &)
IMPORT_C TIntRead(TInt, TDes8 &, TInt, TRequestStatus &)
IMPORT_C voidReadCancel(TRequestStatus &)
IMPORT_C TIntSeek(TSeek, TInt &)
IMPORT_C TIntSetProperty(TAgentProperty, TInt)
IMPORT_C voidSetQosL(TQosAttribute, TInt)
Private Member Functions
CData()
voidConstructL(RFile &, const TDesC &, TIntent)
voidConstructL(const TVirtualPathPtr &, TIntent, TContentShareMode)
voidConstructL(TUid, RFile &, const TDesC &, TIntent)
voidConstructL(TUid, const TVirtualPathPtr &, TIntent, TContentShareMode)
voidConstructL(RFile &, const TDesC &)
voidConstructL(const TVirtualPathPtr &, TContentShareMode)
voidConstructL(TUid, RFile &, const TDesC &)
voidConstructL(TUid, const TVirtualPathPtr &, TContentShareMode)
Inherited Functions
CBase::CBase()
CBase::Delete(CBase *)
CBase::Extension_(TUint,TAny *&,TAny *)
CBase::operator new(TUint)
CBase::operator new(TUint,TAny *)
CBase::operator new(TUint,TLeave)
CBase::operator new(TUint,TLeave,TUint)
CBase::operator new(TUint,TUint)
CBase::~CBase()
Private Attributes
CAgentData *iAgentData
CAgentFactory *iAgentFactory
TUid iAgentUid

Constructor & Destructor Documentation

CData()

CData()[private]

~CData()

~CData()[virtual]

destructor

Member Functions Documentation

ConstructL(RFile &, const TDesC &, TIntent)

voidConstructL(RFile &aFile,
const TDesC &aUniqueId,
TIntentaIntent
)[private]

Parameters

RFile & aFile
const TDesC & aUniqueId
TIntent aIntent

ConstructL(const TVirtualPathPtr &, TIntent, TContentShareMode)

voidConstructL(const TVirtualPathPtr &aVirtualPath,
TIntentaIntent,
TContentShareModeaShareMode
)[private]

Parameters

const TVirtualPathPtr & aVirtualPath
TIntent aIntent
TContentShareMode aShareMode

ConstructL(TUid, RFile &, const TDesC &, TIntent)

voidConstructL(TUidaAgentUid,
RFile &aFile,
const TDesC &aUniqueId,
TIntentaIntent
)[private]

Parameters

TUid aAgentUid
RFile & aFile
const TDesC & aUniqueId
TIntent aIntent

ConstructL(TUid, const TVirtualPathPtr &, TIntent, TContentShareMode)

voidConstructL(TUidaAgentUid,
const TVirtualPathPtr &aVirtualPath,
TIntentaIntent,
TContentShareModeaShareMode
)[private]

Parameters

TUid aAgentUid
const TVirtualPathPtr & aVirtualPath
TIntent aIntent
TContentShareMode aShareMode

ConstructL(RFile &, const TDesC &)

voidConstructL(RFile &aFile,
const TDesC &aUniqueId
)[private]

Parameters

RFile & aFile
const TDesC & aUniqueId

ConstructL(const TVirtualPathPtr &, TContentShareMode)

voidConstructL(const TVirtualPathPtr &aVirtualPath,
TContentShareModeaShareMode
)[private]

Parameters

const TVirtualPathPtr & aVirtualPath
TContentShareMode aShareMode

ConstructL(TUid, RFile &, const TDesC &)

voidConstructL(TUidaAgentUid,
RFile &aFile,
const TDesC &aUniqueId
)[private]

Parameters

TUid aAgentUid
RFile & aFile
const TDesC & aUniqueId

ConstructL(TUid, const TVirtualPathPtr &, TContentShareMode)

voidConstructL(TUidaAgentUid,
const TVirtualPathPtr &aVirtualPath,
TContentShareModeaShareMode
)[private]

Parameters

TUid aAgentUid
const TVirtualPathPtr & aVirtualPath
TContentShareMode aShareMode

DataSizeL(TInt &)

IMPORT_C voidDataSizeL(TInt &aSize)

Gets the data size in bytes.

leave

KErrCASizeNotDetermined Size could not be determined by the managing agent.

leave

... One of the other CAF error codes defined in caferr.h or one of the system-wide error codes for any other errors.

capability

DRM Access to DRM protected content is not permitted for processes without DRM capability. Access to unprotected content is unrestricted

Parameters

TInt & aSizeOn return this will contain the size of the plaintext data in bytes.

EvaluateIntent(TIntent)

IMPORT_C TIntEvaluateIntent(TIntentaIntent)

Allows a client to verify that the intent is supported by the current rights for the data object.

Note:

Since the intent is only evaluated the agent will not decrement any rights-state such as play counts.

ContentAccess::TIntent

Whether rights exist allowing the content to be used for this intent.

KErrNone if the intent is permitted.

KErrNoRights if no rights exist for the specified content object.

KErrCANoPermission if rights exist but the specified intent is not permitted.

KErrCAPendingRights if the rights have not yet arrived but are expected soon.

KErrNoPermission if rights exist but none permit the specified intent.

KErrPermissionDenied if the client is not allowed to use this content object.

Otherwise one of the other CAF error codes defined in caferr.h or one of the other system-wide error codes for any other errors.

capability

DRM Access to DRM protected content is not permitted for processes without DRM capability. Access to unprotected content is unrestricted

Parameters

TIntent aIntentThe intended way the content will be used.

ExecuteIntent(TIntent)

IMPORT_C TIntExecuteIntent(TIntentaIntent)

Execute intent allows the application to signal it is about to carry out the specified intent on protected content.The agent will decrement applicable stateful rights such as play counts where necessary.

Applications should be very careful to use this function correctly.
  • If ExecuteIntent() is never called stateful rights will never be decremented. Users will be able to use the content forever

  • If ExecuteIntent() is called too often stateful rights may be consumed prematurely.

Usually it would be best to call ExecuteIntent immediately before the content is displayed or the instant playback begins. ExecuteIntent should not be considered a prerequisite for calling the Read functions. It is valid for an application to read from the file before calling ExecuteIntent.
Note:

Since rights are executed here the agent will decrement any rights-state such as play counts that apply.

The result of attempting executing the intent.

KErrNone if the intent is permitted and stateful rights may have been decremented.

KErrNoRights if no rights exist for the specified content object.

KErrCANoPermission if rights exist but the specified intent is not permitted.

KErrCAPendingRights if the rights have not yet arrived but are expected soon.

KErrNoPermission if rights exist but none permit the specified intent.

KErrPermissionDenied if the client is not allowed to use this content object.

Otherwise one of the other CAF error codes defined in caferr.h or one of the. other system-wide error codes for any other errors.

capability

DRM Access to DRM protected content is not permitted for processes without DRM capability. Access to unprotected content is unrestricted

Parameters

TIntent aIntentThe intent indicator.

GetAttribute(TInt, TInt &)

IMPORT_C TIntGetAttribute(TIntaAttribute,
TInt &aValue
)const

Get an attribute for the content object

ContentAccess::TAttribute

		CContent* content = CContent::NewL(uri);
		CData* data = content->OpenContentL(EPlay, uniqueId);
		delete content;

		TInt value = 0;
		TInt err = data->GetAttribute(EIsProtected, value);
		if(err == KErrNone && value)
			{
			DisplayPadLock();
			}

		delete data;

Whether the attribute was updated.

KErrNone if the value of the attribute was updated.

KErrCANotSupported if the requested attribute does not exist.

KErrPermissionDenied if the access to the protected content is not permitted by the CAF Agent.

Otherwise one of the other CAF error codes defined in caferr.h or one of the other system-wide error codes for any other errors.

capability

DRM Access to DRM protected content is not permitted for processes without DRM capability. Access to unprotected content is unrestricted

Parameters

TInt aAttributeThe attribute to query, from ContentAccess::TAttribute.
TInt & aValueUsed to return the attribute value.

GetAttributeSet(RAttributeSet &)

IMPORT_C TIntGetAttributeSet(RAttributeSet &aAttributeSet)const

Get a set of attributes for the content object

ContentAccess::TAttribute

The following example determines whether the content object is protected and has rights that will enable it to be viewed by the user

		// CData* data = a data object
		
		RAttributeSet attributeSet;
		CleanupClosePushL(attributeSet);
		attributeSet->AddL(EProtected);
		attributeSet->AddL(ECanView);

		User::LeaveIfError(data->GetAttributeSet(attributeSet);

		TInt err = attributeSet.GetValue(EProtected, value);
		if(err == KErrNone && value)
				{
				// file is DRM protected
				}

		err = attributeSet.GetValue(ECanView, value);
		if(err == KErrNone && value)
				{
				// File has rights that allow it to be displayed on screen
				}
		
		// Finished
		CleanupStack::PopAndDestroy(); 	// attributeSet.Close()

Whether the attribute set was updated.

KErrNone if the attributes were retrieved successfully.

KErrPermissionDenied if the access to the protected content is not permitted by the CAF Agent.

Otherwise one of the CAF error codes defined in caferr.h or one of the other system-wide error codes for any other errors.

capability

DRM Access to DRM protected content is not permitted for processes without DRM capability. Access to unprotected content is unrestricted

Parameters

RAttributeSet & aAttributeSetThe set of attributes to query and update.

GetMimeTypeL(TDes8 &)

IMPORT_C TBoolGetMimeTypeL(TDes8 &aMimeType)const

Get the mime type of the content ETrue if the mime type was retrieved successfully.

Parameters

TDes8 & aMimeTypeBuffer to store the mime type provided by the agent.

GetStringAttribute(TInt, TDes &)

IMPORT_C TIntGetStringAttribute(TIntaAttribute,
TDes &aValue
)const

Get text string attributes or meta-data for the content object

ContentAccess::TStringAttribute

		CContent* content = CContent::NewLC(uri);
		CData* data = content->OpenContentLC(EPlay, uniqueId);
		CleanupStack::PopAndDestroy(content);

		TBuf <MAX_PATH> previewUri;
		TInt err = data->GetStringAttribute(EPreviewURI, previewUri);
		if(err == KErrNone)
			{
			DisplayPreview(previewUri);
			}

		CleanupStack::PopAndDestroy(data);

Whether the value was updated.

KErrNone if the attribute was retrieved.

KErrOverflow if the buffer was not large enough to return the result.

KErrCANotSupported if the requested attribute does not exist.

KErrPermissionDenied if the access to the protected content is not permitted by the CAF Agent.

Otherwise one of the other CAF error codes defined in caferr.h or one of the other system-wide error codes for any other errors.

capability

DRM Access to DRM protected content is not permitted for processes without DRM capability. Access to unprotected content is unrestricted

Parameters

TInt aAttributeThe attribute to query, from ContentAccess::TStringAttribute.
TDes & aValueReturns the value of the attribute.

GetStringAttributeSet(RStringAttributeSet &)

IMPORT_C TIntGetStringAttributeSet(RStringAttributeSet &aStringAttributeSet)const

Obtain a set of string attributes for the content object

ContentAccess::TStringAttribute

		CContent* content = CContent::NewLC(uri);
		CData* data = content->OpenContentLC(EPlay, uniqueId);

		// create the attribute set, add the attributes we are interested in
		RStringAttributeSet stringAttributeSet;
		CleanupClosePushL(stringAttributeSet);
		stringAttributeSet.AddL(EPreviewURI);
		stringAttributeSet.AddL(ETitle);
		
		User::LeaveIfError(data->GetStringAttributeSet(stringAttributeSet));
	
		// Pass the value of the string attribute to DisplayPreview()
		TFileName previewUri;
		TInt err = stringAttributeSet.GetValue(EPreviewURI, previewUri);
		if(err == KErrNone)
			{
			DisplayPreview(previewUri);
			}
		
		CleanupStack::PopAndDestroy(3);	// content, data, stringAttributeSet

Whether the string attribute set was updated.

KErrNone if the attributes were retrieved successfully.

KErrNotFound if the default content object was not found.

KErrPermissionDenied if the access to the protected content is not permitted by the CAF Agent.

Otherwise one of the CAF error codes defined in caferr.h or one of the other system-wide error codes for any other errors.

capability

DRM Access to DRM protected content is not permitted for processes without DRM capability. Access to unprotected content is unrestricted

Parameters

RStringAttributeSet & aStringAttributeSetThe set of attributes to query and update.

NewL(const TVirtualPathPtr &, TIntent, TContentShareMode)

IMPORT_C CData *NewL(const TVirtualPathPtr &aVirtualPath,
TIntentaIntent,
TContentShareModeaShareMode
)[static]

Creates a new CData object.

The new CData object.

leave

KErrNotFound The content object with the given UniqueId does not exist.

leave

KErrCAPendingRights The rights have not yet arrived but are expected soon.

leave

KErrCANoPermission Rights exist but the specified intent is not permitted.

leave

KErrCANoRights No rights exist for the content object.

leave

KErrCANotSupported Unable to open the object with the specified UniqueId, it may be a container object.

leave

KErrPermissionDenied The agent does not allow the client to access the content object.

leave

KErrAccessDenied The content is already in use.

leave

... One of the other CAF error codes defined in caferr.h or one of the other system-wide error codes for any other errors.

Parameters

const TVirtualPathPtr & aVirtualPathThe content object to read
TIntent aIntentThe intended use of the content.
TContentShareMode aShareModeThe file share mode used to open this content.

NewL(const TVirtualPathPtr &, TContentShareMode)

IMPORT_C CData *NewL(const TVirtualPathPtr &aVirtualPath,
TContentShareModeaShareMode
)[static]

Creates a new CData object.

The new CData object.

leave

KErrNotFound The content object with the given UniqueId does not exist.

leave

KErrCAPendingRights The rights have not yet arrived but are expected soon.

leave

KErrCANoPermission Rights exist but the specified intent is not permitted.

leave

KErrCANoRights No rights exist for the content object.

leave

KErrCANotSupported Unable to open the object with the specified UniqueId, it may be a container object.

leave

KErrPermissionDenied The agent does not allow the client to access the content object.

leave

KErrAccessDenied The content is already in use.

leave

... One of the other CAF error codes defined in caferr.h or one of the other system-wide error codes for any other errors.

Parameters

const TVirtualPathPtr & aVirtualPathThe content object to read.
TContentShareMode aShareModeThe file share mode used to open this content.

NewL(RFile &, const TDesC &, TIntent)

IMPORT_C CData *NewL(RFile &aFile,
const TDesC &aUniqueId,
TIntentaIntent
)[static]

Creates a new CData object.

The new CData object.

leave

KErrNotFound The content object with the given UniqueId does not exist.

leave

KErrCAPendingRights The rights have not yet arrived but are expected soon.

leave

KErrCANoPermission Rights exist but the specified intent is not permitted.

leave

KErrCANoRights No rights exist for the content object.

leave

KErrCANotSupported Unable to open the object with the specified UniqueId, it may be a container object.

leave

KErrPermissionDenied The agent does not allow the client to access the content object.

leave

KErrAccessDenied The content is already in use.

leave

... One of the other CAF error codes defined in caferr.h or one of the other system-wide error codes for any other errors.

Parameters

RFile & aFileAn open RFile handle, the agent will make a duplicate of this handle. 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.
const TDesC & aUniqueIdThe content object to read.
TIntent aIntentThe intended use of the content.

NewL(RFile &, const TDesC &)

IMPORT_C CData *NewL(RFile &aFile,
const TDesC &aUniqueId
)[static]

Creates a new CData object.

The new CData object.

leave

KErrNotFound The content object with the given UniqueId does not exist.

leave

KErrCAPendingRights The rights have not yet arrived but are expected soon.

leave

KErrCANoPermission Rights exist but the specified intent is not permitted.

leave

KErrCANoRights No rights exist for the content object.

leave

KErrCANotSupported Unable to open the object with the specified UniqueId, it may be a container object.

leave

KErrPermissionDenied The agent does not allow the client to access the content object.

leave

KErrAccessDenied The content is already in use.

leave

... One of the other CAF error codes defined in caferr.h or one of the other system-wide error codes for any other errors.

Parameters

RFile & aFileAn open RFile handle, the agent will make a duplicate of this handle. 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.
const TDesC & aUniqueIdThe content object to read.

NewLC(const TVirtualPathPtr &, TIntent, TContentShareMode)

IMPORT_C CData *NewLC(const TVirtualPathPtr &aVirtualPath,
TIntentaIntent,
TContentShareModeaShareMode
)[static]

Creates a new CData object

The new CData object.

leave

KErrNotFound The content object with the given UniqueId does not exist.

leave

KErrCAPendingRights The rights have not yet arrived but are expected soon.

leave

KErrCANoPermission Rights exist but the specified intent is not permitted.

leave

KErrCANoRights No rights exist for the content object.

leave

KErrCANotSupported Unable to open the object with the specified UniqueId, it may be a container object.

leave

KErrPermissionDenied The agent does not allow the client to access the content object.

leave

KErrAccessDenied The content is already in use.

leave

... One of the other CAF error codes defined in caferr.h or one of the other system-wide error codes for any other errors.

Parameters

const TVirtualPathPtr & aVirtualPathThe content object to read.
TIntent aIntentThe intended use of the content.
TContentShareMode aShareModeThe file share mode used to open this content.

NewLC(const TVirtualPathPtr &, TContentShareMode)

IMPORT_C CData *NewLC(const TVirtualPathPtr &aVirtualPath,
TContentShareModeaShareMode
)[static]

Creates a new CData object

The new CData object.

leave

KErrNotFound The content object with the given UniqueId does not exist.

leave

KErrCAPendingRights The rights have not yet arrived but are expected soon.

leave

KErrCANoPermission Rights exist but the specified intent is not permitted.

leave

KErrCANoRights No rights exist for the content object.

leave

KErrCANotSupported Unable to open the object with the specified UniqueId, it may be a container object.

leave

KErrPermissionDenied The agent does not allow the client to access the content object.

leave

KErrAccessDenied The content is already in use.

leave

... One of the other CAF error codes defined in caferr.h or one of the other system-wide error codes for any other errors.

Parameters

const TVirtualPathPtr & aVirtualPathThe content object to read.
TContentShareMode aShareModeThe file share mode used to open this content.

NewLC(RFile &, const TDesC &, TIntent)

IMPORT_C CData *NewLC(RFile &aFile,
const TDesC &aUniqueId,
TIntentaIntent
)[static]

Creates a new CData object.

The new CData object.

leave

KErrNotFound The content object with the given UniqueId does not exist.

leave

KErrCAPendingRights The rights have not yet arrived but are expected soon.

leave

KErrCANoPermission Rights exist but the specified intent is not permitted.

leave

KErrCANoRights No rights exist for the content object.

leave

KErrCANotSupported Unable to open the object with the specified UniqueId, it may be a container object.

leave

KErrPermissionDenied The agent does not allow the client to access the content object.

leave

KErrAccessDenied The content is already in use.

leave

... One of the other CAF error codes defined in caferr.h or one of the other system-wide error codes for any other errors.

Parameters

RFile & aFileAn open RFile handle, the agent will make a duplicate of this handle. 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.
const TDesC & aUniqueIdThe content object to read.
TIntent aIntentThe intended use of the content.

NewLC(RFile &, const TDesC &)

IMPORT_C CData *NewLC(RFile &aFile,
const TDesC &aUniqueId
)[static]

Creates a new CData object.

The new CData object.

leave

KErrNotFound The content object with the given UniqueId does not exist.

leave

KErrCAPendingRights The rights have not yet arrived but are expected soon.

leave

KErrCANoPermission Rights exist but the specified intent is not permitted.

leave

KErrCANoRights No rights exist for the content object.

leave

KErrCANotSupported Unable to open the object with the specified UniqueId, it may be a container object.

leave

KErrPermissionDenied The agent does not allow the client to access the content object.

leave

KErrAccessDenied The content is already in use.

leave

... One of the other CAF error codes defined in caferr.h or one of the other system-wide error codes for any other errors.

Parameters

RFile & aFileAn open RFile handle, the agent will make a duplicate of this handle. 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.
const TDesC & aUniqueIdThe content object to read.

NewLC(TUid, const TVirtualPathPtr &, TIntent, TContentShareMode)

CData *NewLC(TUidaAgentUid,
const TVirtualPathPtr &aVirtualPath,
TIntentaIntent,
TContentShareModeaShareMode
)[static]

Creates a new CData object.

The new CData object.

leave

KErrNotFound The content object with the given UniqueId does not exist.

leave

KErrCAPendingRights The rights have not yet arrived but are expected soon.

leave

KErrCANoPermission Rights exist but the specified intent is not permitted.

leave

KErrCANoRights No rights exist for the content object.

leave

KErrCANotSupported Unable to open the object with the specified UniqueId, it may be a container object.

leave

KErrPermissionDenied The agent does not allow the client to access the content object.

leave

KErrAccessDenied The content is already in use.

leave

... One of the other CAF error codes defined in caferr.h or one of the other system-wide error codes for any other errors.

Parameters

TUid aAgentUidThe agent determined to support this content.
const TVirtualPathPtr & aVirtualPathThe content object to read.
TIntent aIntentThe intended use of the content.
TContentShareMode aShareModeThe file share mode used to open this content.

NewLC(TUid, RFile &, const TDesC &, TIntent)

CData *NewLC(TUidaAgentUid,
RFile &aFile,
const TDesC &aUniqueId,
TIntentaIntent
)[static]

Creates a new CData object.

The new CData object.

leave

KErrNotFound The content object with the given UniqueId does not exist.

leave

KErrCAPendingRights The rights have not yet arrived but are expected soon.

leave

KErrCANoPermission Rights exist but the specified intent is not permitted.

leave

KErrCANoRights No rights exist for the content object.

leave

KErrCANotSupported Unable to open the object with the specified UniqueId, it may be a container object.

leave

KErrPermissionDenied The agent does not allow the client to access the content object.

leave

KErrAccessDenied The content is already in use.

leave

... One of the other CAF error codes defined in caferr.h or one of the other system-wide error codes for any other errors.

Parameters

TUid aAgentUidThe Uid of the agent who supports this content.
RFile & aFileAn open RFile handle, the agent will make a duplicate of this handle. 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.
const TDesC & aUniqueIdThe content object to read.
TIntent aIntentThe intended use of the content.

Read(TDes8 &)

IMPORT_C TIntRead(TDes8 &aDes)const

Reads from a content object up to the maximum length of the descriptor or the end of the content object.

When an attempt is made to read beyond the end of the content, no error is returned. The descriptor s length is set to the number of bytes that were read into it. Therefore, when reading through content, the end has been reached when the descriptor length (given by TDesC::Length()) is zero.

KErrNone if successful.

One of the CAF error codes defined in caferr.h or one of the other system-wide error codes.

capability

DRM Access to DRM protected content is not permitted for processes without DRM capability. Access to unprotected content is unrestricted

Parameters

TDes8 & aDesDescriptor into which binary data is read. Any existing contents are overwritten. On return, its length is set to the number of bytes read.

Read(TDes8 &, TInt)

IMPORT_C TIntRead(TDes8 &aDes,
TIntaLength
)const

Reads from a content object up to the specified length of the descriptor or the end of the content object.

Read(TDes8& aDes)

KErrNone if successful.

Otherwise one of the CAF error codes defined in caferr.h or one of the other system-wide error codes.

capability

DRM Access to DRM protected content is not permitted for processes without DRM capability. Access to unprotected content is unrestricted

Parameters

TDes8 & aDesDescriptor into which binary data is read. Any existing contents are overwritten. On return, its length is set to the number of bytes read.
TInt aLengthThe number of bytes to read from the file, or to the end of the file, whichever is encountered first. The length of the buffer is set to the number of bytes actually read.

Read(TDes8 &, TRequestStatus &)

IMPORT_C voidRead(TDes8 &aDes,
TRequestStatus &aStatus
)const

Read content asynchronously up to the maximum length of the descriptor or until the end of the content object is reached. NB: It is important that the descriptor passed to aDes remains in scope until the request has completed.

Read(TDes8& aDes)

capability

DRM Access to DRM protected content is not permitted for processes without DRM capability. Access to unprotected content is unrestricted

Parameters

TDes8 & aDesDescriptor into which binary data is read. Any existing contents are overwritten. On return, its length is set to the number of bytes read.
TRequestStatus & aStatusAsynchronous request status. On completion this will contain one of the following error codes: KErrNone if the data was successfully read. Otherwise one of the CAF error codes defined in caferr.h or one of the other standard system-wide error codes for any other errors.

Read(TDes8 &, TInt, TRequestStatus &)

IMPORT_C voidRead(TDes8 &aDes,
TIntaLength,
TRequestStatus &aStatus
)const

Read content asynchronously up to the specified length or until the end of the content object is reached. NB: It is important that the descriptor passed to aDes remains in scope until the request has completed.

Read(TDes8& aDes)

capability

DRM Access to DRM protected content is not permitted for processes without DRM capability. Access to unprotected content is unrestricted

Parameters

TDes8 & aDesDescriptor into which binary data is read. Any existing contents are overwritten. On return, its length is set to the number of bytes read.
TInt aLengthThe number of bytes to read from the file, or to the end of the file, whichever is encountered first. The length of the buffer is set to the number of bytes actually read.
TRequestStatus & aStatusAsynchronous request status. On completion this will contain one of the following error codes: KErrNone if the data was successfully read. Otherwise one of the CAF error codes defined in caferr.h or one of the other standard system-wide error codes for any other errors.

Read(TInt, TDes8 &, TInt, TRequestStatus &)

IMPORT_C TIntRead(TIntaPos,
TDes8 &aDes,
TIntaLength,
TRequestStatus &aStatus
)const

Reads content asynchronously. The data is read from a specified offset up to a specified number of bytes or until the end of the content object is reached. The data is read into the descriptor buffer supplied.

Read(TDes8& aDes)

KErrNone if the async read request was successfully submitted.

KErrArgument if a negative offset is supplied.

KErrCANotSupported if the agent does not support this operation.

capability

DRM Access to DRM protected content is not permitted for processes without DRM capability. Access to unprotected content is unrestricted

Parameters

TInt aPosPosition of first byte to be read. This is an offset from the start of the file.
TDes8 & aDesDescriptor into which binary data is read. Any existing contents are overwritten. On return, its length is set to the number of bytes read.
TInt aLengthThe number of bytes to read from the file, or to the end of the file, whichever is encountered first. The length of the buffer is set to the number of bytes actually read.
TRequestStatus & aStatusAsynchronous request status. On completion this will contain one of the following error codes: KErrNone if the data was successfully read. Otherwise one of the CAF error codes defined in caferr.h or one of the other standard system-wide error codes for any other errors.

ReadCancel(TRequestStatus &)

IMPORT_C voidReadCancel(TRequestStatus &aStatus)const

Cancels asynchronous read.

capability

DRM Access to DRM protected content is not permitted for processes without DRM capability. Access to unprotected content is unrestricted

Parameters

TRequestStatus & aStatusAsynchronous request status. This parameter should have been supplied earlier to an asynchronous Read call. If it has not been previously supplied to a Read call, this function will not have any effect.

Seek(TSeek, TInt &)

IMPORT_C TIntSeek(TSeekaMode,
TInt &aPos
)const

Changes or retrieves the location of the file pointer within the content object.

NOTE: Some operations may fail if the content data is sourced over a network connection.

There are four seek modes used:

  • ESeekStart - Sets the file pointer aPos bytes from the start of the content object. aPos is not modified by the call to Seek()

  • ESeekEnd - Sets the file pointer aPos bytes from the end of the content object. The aPos parameter supplied should be zero or negative when using ESeekEnd. Upon completion aPos is updated with the current position relative to the start of the content object.

  • ESeekCurrent - Moves the file pointer aPos bytes from the current position. Upon completion aPos is updated with the new position relative to the start of the content object. Suppling a zero value for the aPos Parameter can be used to retrieve the current file pointer location

  • ESeekAddress Sets the aPos parameter to the address of the byte aPos bytes from the start of the content object

TSeek

KErrNone if successful.

Otherwise one of the CAF error codes defined in caferr.h or one of the other system-wide error codes.

capability

DRM Access to DRM protected content is not permitted for processes without DRM capability. Access to unprotected content is unrestricted

Parameters

TSeek aModeSeek mode - controls the destination of the seek operation.
TInt & aPosOffset from either the start, end or current position depending upon the seek mode. Negative offsets are used to seek before the current position or relative to the end of the file.

SetProperty(TAgentProperty, TInt)

IMPORT_C TIntSetProperty(TAgentPropertyaProperty,
TIntaValue
)

Request the agent handling this content to set a property value. If the property is set it is only set for this CData session and does not impact other CAF users.

For example setting the buffer-size to 256 bytes can be achieved as follows:

		  			MyData->SetProperty(EAgentPropertyBufferSize, 256);

ContentAccess::TAgentProperty

Whether or not the property was set.

KErrNone if the property was set.

KErrCANotSupported if the agent does not support the property or value.

KErrAccessDenied if the agent does not permit the property to be changed.

KErrPermissionDenied if the application does not have the necessary capability to change the property.

capability

DRM Access to DRM protected content is not permitted for processes without DRM capability. Access to unprotected content is unrestricted.

Parameters

TAgentProperty aPropertyThe property to set.
TInt aValueThe value of the property.

SetQosL(TQosAttribute, TInt)

IMPORT_C voidSetQosL(TQosAttributeaQosAttr,
TIntaValue
)

Set Qos attribute

Parameters

TQosAttribute aQosAttrThe Qos attribute to set.
TInt aValueThe value of the attribute.

Member Data Documentation

CAgentData * iAgentData

CAgentData *iAgentData[private]

CAgentFactory * iAgentFactory

CAgentFactory *iAgentFactory[private]

TUid iAgentUid

TUid iAgentUid[private]