This is an extension mechanism to allow a client to perform an agent-specific function. The application needs to know the extended commands that the agent supports and the format of the input and output buffers used in the command. All of this is specified by the CAF agent, not the Content Access Framework.
The manager object must be created using the CManager::NewL() function.
TInt FancyApplicationFunction(CManager& aManager, CAgent& aAgent, CFancyAgentInputObject& aInputObject, CFancyAgentOutputObject& aOutputObject)
{
// Buffer large enough to hold the expected output object
TBuf <1000> outputBuffer;
// Dynamic buffer to serialize aInputObject
CBufFlat* inputBuffer = CBufFlat::NewL(50);
CleanupStack::PushL(inputBuffer);
RBufWriteStream streamIn(*inputBuffer);
CleanupClosePushL(streamIn);
// write aInputObject to the dynamic buffer
aInputObject.ExternalizeL(streamIn);
CleanupStack::PopAndDestroy(&streamIn);
// Call the agent specific function #42
aManager.AgentSpecificCommand(aAgent, 42 ,inputBuffer->Ptr(0), outputBuffer);
// Don't need the input buffer any longer
delete *inputBuffer;
inputBuffer = NULL;
// Create a stream object to read the output buffer
RDesReadStream streamOut(outputBuffer);
// Build the output object from the output stream
aOutputBuffer.InternalizeL(streamOut);
}
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.