Applications can use the ContentAccess::CRightsManager class to manage Digital Rights Management (DRM) rights within a particular DRM agent.
Rights Manager API gives simple access to the rights within a CAF agent implementing a DRM scheme. The rights are represented in a generic form using the ContentAccess::CRightsInfo class. This class holds a text description of the rights and some simple properties associated with these rights.
Rights Manager API also allows applications to determine which content files are associated with each rights object and vice versa.
Create a DRM rights management object
The ContentAccess::CRightsManagerobject is created by the ContentAccess::CManager object to look at the rights stored by a particular content access agent.
// create the CManager object CManager manager = CManager::NewL(); // Create RPointerArray to store pointers to the agents RPointerArray <CAgent> agentArray; // Get the list of agents manager->ListAgentsL(agentArray); // Create a CRightsManager for the first agent CRightsManager *rightsManager = manager->CreateRightsManagerL(agentArray[0]);
The CRightsManager::ListAllRightsL() function produces a list of all the rights stored in the given DRM agent.
// Create the array to store rights objects RStreamablePtrArray<CRightsInfo> myArray; CleanupClosePushL(myArray); // Get the rights objects from the agent rightsManager->ListAllRightsL(myArray); // count the number of rights objects TInt numRights = myArray.Count(); // clear the contents of the array myArray.ResetAndDestroy();
List the rights associated with a content file
The CRightsManager::ListRightsL() function produces a list of all the rights stored in the given DRM agent that are associated with the file at a given URI.
// Get the rights objects associated with the content rightsManager->ListRightsL(myArray, uri); // Count the number of rights objects associated with the content TInt numRights = myArray.Count(); // clear the contents of the array myArray.ResetAndDestroy();
List the rights associated with a content object
The CRightsManager::ListRightsL() function produces a list of all the rights stored in the given DRM agent that are associated with the content object at a given virtual path.
// Get the rights objects assocated with the content rightsManager->ListRightsL(myArray, virtualPath); // Count the number of rights objects associated with the content TInt numRights = myArray.Count(); // clear the contents of the array myArray->ResetAndDestroy();
List the content associated with a rights object
rightsManager->ListAllRightsL(myArray); // get the first CRightsInfo object CRightsInfo* aRightsObject = myArray[0]; RStreamablePtrArray<CVirtualPath> array; CleanupClosePushL(array); // Get the array of content objects associated with the rights rightsManager->ListContentL(array, aRightsObject); // count the number of content objects TInt numContentObjects = array.Count();
The CRightsManager::GetRightsDataL() function allows an application to retrieve a pointer to a rights object. The rights object is derived from MAgentRightsBase.
// Retrieve the full rights object // The application needs to cast it to the agent's derived Rights class before using it. MAgentRightsBase *rightsObject = rightsManager->GetRightsDataL(aRightsObject);
// Delete the rights object TInt result = rightsManager->DeleteRightsObject(aRightsObject);
It is also possible to delete all the rights associated with a particular content object.
// Delete all the rights objects associated with the given content object TInt result = rightsManager->DeleteAllRights(virtualPath);
Copyright ©2010 Nokia Corporation and/or its subsidiary(-ies).
All rights
reserved. Unless otherwise stated, these materials are provided under the terms of the Eclipse Public License
v1.0.