os/security/contentmgmt/contentaccessfwfordrm/engineering/dox/HowToManageAgents.dox
author sl@SLION-WIN7.fritz.box
Fri, 15 Jun 2012 03:10:57 +0200
changeset 0 bde4ae8d615e
permissions -rw-r--r--
First public contribution.
sl@0
     1
// Copyright (c) 2006-2009 Nokia Corporation and/or its subsidiary(-ies).
sl@0
     2
// All rights reserved.
sl@0
     3
// This component and the accompanying materials are made available
sl@0
     4
// under the terms of the License "Eclipse Public License v1.0"
sl@0
     5
// which accompanies this distribution, and is available
sl@0
     6
// at the URL "http://www.eclipse.org/legal/epl-v10.html".
sl@0
     7
//
sl@0
     8
// Initial Contributors:
sl@0
     9
// Nokia Corporation - initial contribution.
sl@0
    10
//
sl@0
    11
// Contributors:
sl@0
    12
//
sl@0
    13
// Description:
sl@0
    14
// \n
sl@0
    15
// There are some operations performed on agents that do not relate directly to a particular content file. The <code>ContentAccess::CManager</code>
sl@0
    16
// interface includes some functions that allow an application to work with a particular agent.
sl@0
    17
// <hr>
sl@0
    18
// Before working with one particular agent, the client will need to find out which agents are installed on the device.
sl@0
    19
// The <code>ContentAccess::CManager::ListAgentsL()</code> function provides this list of agents. The \c F32Agent is not included in
sl@0
    20
// the list, since it does not support any management functions.
sl@0
    21
// The <code>ContentAccess::CAgent</code> objects in the list can be used to refer to the particular agent in subsequent 
sl@0
    22
// function calls.
sl@0
    23
// // Create a CManager object
sl@0
    24
// CManager* manager = CManager::NewL();
sl@0
    25
// RPointerArray <CAgent> theAgents;
sl@0
    26
// // Get the list of agents
sl@0
    27
// manager->ListAgents(theAgents);
sl@0
    28
// // Check there is at least one agent
sl@0
    29
// if(theAgents.Count() > 0)
sl@0
    30
// // Find the first agent
sl@0
    31
// CAgent& agent = theAgents[0];
sl@0
    32
// <hr>
sl@0
    33
// The management API allows applications to request that an agent display management
sl@0
    34
// information on the screen.
sl@0
    35
// The agent could present configuration settings, status or DRM rights information.
sl@0
    36
// Each agent will have unique settings so it is not possible to display one dialog to configure all agents.
sl@0
    37
// // Create a CManager object
sl@0
    38
// CManager* manager = CManager::NewL();
sl@0
    39
// RPointerArray <CAgent> theAgents;
sl@0
    40
// // Get the list of agents
sl@0
    41
// manager->ListAgents(theAgents);
sl@0
    42
// // Check there is at least one agent
sl@0
    43
// if(theAgents.Count() > 0)
sl@0
    44
// CAgent& agent = (*theAgents)[0];
sl@0
    45
// // Display the management information for the first agent
sl@0
    46
// manager->DisplayManagementInfoL(agent);
sl@0
    47
// It is possible that some agents will not support this capability and will leave with <code>KErrCANotSupported</code>. 
sl@0
    48
// Displaying DRM rights information is only relevant for agents implementing a DRM scheme. It is expected that an Agent 
sl@0
    49
// implementing DRM will provide some or all of the following functionality in the dialog:
sl@0
    50
// - Display all rights objects including state (pending, valid, expired, orphaned, etc.)
sl@0
    51
// - Display detailed information on a particular rights object (play count, validity period, the related Content object(s))
sl@0
    52
// - Allow unwanted, expired or orphaned rights to be deleted.
sl@0
    53
// <hr>
sl@0
    54
// The rights management object is only relevant for agents implementing a DRM scheme. Other agents will
sl@0
    55
// leave with <code>KErrCANotSupported</code>.
sl@0
    56
// An application can ask a particular DRM agent to create a <code>ContentAccess::CRightsManager</code> object that can be used
sl@0
    57
// to provide generic access to DRM rights within that agent. Since it is a generic interface
sl@0
    58
// used by all agents, it will not be able to present all the detailed information available.
sl@0
    59
// CRightsManager* rightsmanager;
sl@0
    60
// // Create a CManager object
sl@0
    61
// CManager* manager = CManager::NewL();
sl@0
    62
// // create the rights manager object for a particular agent
sl@0
    63
// rightsManager = manager->CreateRightsManagerL(agent);
sl@0
    64
// To manage the rights in a more comprehensive manner the application should use the 
sl@0
    65
// <code>ContentAccess::CManager::DisplayManagementInfoL()</code> function, where the agent can present 
sl@0
    66
// its own comprehensive information.
sl@0
    67
// <hr>
sl@0
    68
// This is an extension mechanism to allow a client to perform an agent-specific function. The application will need to
sl@0
    69
// know the extended commands that the agent supports and the format of the input and output buffers used in the command. All
sl@0
    70
// of this is specified by the CAF agent, not the Content Access Framework.
sl@0
    71
// The buffers allow agent specific objects to be externalized by an application, passed through CAF and internalized by the
sl@0
    72
// agent. The same principle applies for data returned from the agent to the application.
sl@0
    73
// TInt FancyApplicationFunctionL(CManager& aManager, CAgent& aAgent, CFancyAgentInputObject& aInputObject, CFancyAgentOutputObject& aOutputObject);
sl@0
    74
// // Dynamic buffer to serialize aInputObject 
sl@0
    75
// CBufFlat* inputBuffer = CBufFlat::NewL(50);
sl@0
    76
// CleanupStack::PushL(inputBuffer);
sl@0
    77
// // write aInputObject to the dynamic buffer
sl@0
    78
// RBufWriteStream streamIn(*inputBuffer);
sl@0
    79
// CleanupClosePushL(streamIn);
sl@0
    80
// aInputObject.ExternalizeL(streamIn);
sl@0
    81
// CleanupStack::PopAndDestroy(&streamIn);
sl@0
    82
// // Call the agent specific function #42
sl@0
    83
// TBuf <1000> outputBuffer;
sl@0
    84
// User::LeaveIfError(aManager.AgentSpecificCommand(aAgent, 42 ,inputBuffer->Ptr(0), outputBuffer));
sl@0
    85
// // Don't need the input buffer any longer
sl@0
    86
// CleanupStack::PopAndDestroy(inputBuffer);
sl@0
    87
// // Create a stream object to read the output buffer
sl@0
    88
// RDesReadStream streamOut(outputBuffer);
sl@0
    89
// CleanupClosePushL(streamOut);
sl@0
    90
// aOutputObject.InternalizeL(streamOut);
sl@0
    91
// CleanupStack::PopAndDestroy(&streamOut);
sl@0
    92
// <hr>
sl@0
    93
// 
sl@0
    94
//
sl@0
    95
sl@0
    96
/**
sl@0
    97
 @page CAFManageAgents Managing CAF Agents
sl@0
    98
 - @ref ListingAgents
sl@0
    99
 - @ref CAFManagementDialog
sl@0
   100
 - @ref CreatingRightsManager
sl@0
   101
 - @ref AgentSpecificCommand
sl@0
   102
 @section ListingAgents Listing the CAF Agents
sl@0
   103
 @code
sl@0
   104
 @endcode
sl@0
   105
 @section CAFManagementDialog Displaying the Agent Management Information
sl@0
   106
 @code
sl@0
   107
 @endcode
sl@0
   108
 @section CreatingRightsManager Create a DRM rights management object
sl@0
   109
 @code
sl@0
   110
 @endcode
sl@0
   111
 @section AgentSpecificCommand Agent Specific Commands
sl@0
   112
 @code
sl@0
   113
 @endcode
sl@0
   114
*/