contentmgmt/cafstreamingsupport/test/streamingtestagent/source/shared/testagentkeystreamdecoder.cpp
branchRCL_3
changeset 43 2f10d260163b
equal deleted inserted replaced
42:eb9b28acd381 43:2f10d260163b
       
     1 // Copyright (c) 2007-2009 Nokia Corporation and/or its subsidiary(-ies).
       
     2 // All rights reserved.
       
     3 // This component and the accompanying materials are made available
       
     4 // under the terms of the License "Eclipse Public License v1.0"
       
     5 // which accompanies this distribution, and is available
       
     6 // at the URL "http://www.eclipse.org/legal/epl-v10.html".
       
     7 //
       
     8 // Initial Contributors:
       
     9 // Nokia Corporation - initial contribution.
       
    10 //
       
    11 // Contributors:
       
    12 //
       
    13 // Description:
       
    14 // Implements tthe test agent key stream decoder object.
       
    15 // 
       
    16 //
       
    17 
       
    18 #include "testagentkeystreamdecoder.h"
       
    19 
       
    20 using namespace StreamAccess;
       
    21 
       
    22 CTestAgentKeyStreamDecoder::CTestAgentKeyStreamDecoder()
       
    23 /**
       
    24  	Constructor.
       
    25  */
       
    26 	: CTestKeyStreamDecoderBase()
       
    27 	{
       
    28 	//empty
       
    29 	}
       
    30 
       
    31 CTestAgentKeyStreamDecoder::~CTestAgentKeyStreamDecoder()
       
    32 /**
       
    33  	Destructor.
       
    34  */
       
    35 	{
       
    36 	iAgentClient.Close();
       
    37 	}
       
    38 
       
    39 EXPORT_C CTestAgentKeyStreamDecoder* CTestAgentKeyStreamDecoder::NewL(const CKeyStreamSink& aKeyStreamSink,
       
    40 	    															  const CSdpMediaField& aSdpKeyStream,
       
    41 	    					    									  const CSdpDocument& aSdpDoc)
       
    42 /**
       
    43 	Factory function allocates a new instance of CTestAgentKeyStreamDecoder.
       
    44 	@return		New instance of CTestAgentKeyStreamDecoder
       
    45  */
       
    46 	{
       
    47 	//TInt count = 	aSdpKeyStream.AttributeFields().Count();
       
    48 	CTestAgentKeyStreamDecoder* self = CTestAgentKeyStreamDecoder::NewLC(aKeyStreamSink, aSdpKeyStream, aSdpDoc);
       
    49 	CleanupStack::Pop(self);
       
    50 	return self;
       
    51 	}
       
    52 
       
    53 EXPORT_C CTestAgentKeyStreamDecoder* CTestAgentKeyStreamDecoder::NewLC(const CKeyStreamSink& aKeyStreamSink,
       
    54 	    															   const CSdpMediaField& aSdpKeyStream,
       
    55 	    					    									   const CSdpDocument& aSdpDoc)
       
    56 /**
       
    57 	Factory function allocates a new instance of CTestAgentKeyStreamDecoder 
       
    58 	and places the object on the cleanup stack.
       
    59 	@return		A new instance of CTestAgentKeyStreamDecoder 
       
    60 				which is left on the cleanup stack.
       
    61  */
       
    62 	{
       
    63 	CTestAgentKeyStreamDecoder* self = new (ELeave) CTestAgentKeyStreamDecoder();
       
    64 	CleanupStack::PushL(self);
       
    65 	self->ConstructL(aKeyStreamSink, aSdpKeyStream, aSdpDoc);
       
    66 	return self;
       
    67 	}
       
    68 
       
    69 void CTestAgentKeyStreamDecoder::ConstructL(const CKeyStreamSink& aKeyStreamSink,
       
    70 											const CSdpMediaField& aSdpKeyStream,
       
    71 											const CSdpDocument& aSdpDoc)
       
    72 /**
       
    73  	Second phase constructor.
       
    74  */
       
    75 	{
       
    76 	User::LeaveIfError(iAgentClient.Connect());
       
    77 	iAgentClient.SetKeyStreamSinkL(aKeyStreamSink);
       
    78 	iAgentClient.SetSdpMediaFieldL(aSdpKeyStream);
       
    79 	iAgentClient.SetSdpDocumentL(aSdpDoc);
       
    80 	}
       
    81 
       
    82 EXPORT_C void CTestAgentKeyStreamDecoder::GetAttributeL(const TAttribute& aAttribute, TBool& aValue)
       
    83 /**
       
    84  	@see CAgentKeyStreamDecoder::GetAttributeL
       
    85  */ 	
       
    86 	{
       
    87 	iAgentClient.GetAttributeL(aAttribute, aValue);
       
    88 	}
       
    89 
       
    90 EXPORT_C HBufC* CTestAgentKeyStreamDecoder::GetStringAttributeLC(const TStringAttribute& aAttribute)
       
    91 /**
       
    92  	@see CAgentKeyStreamDecoder::GetStringAttributeL
       
    93  */
       
    94 	{
       
    95 	return iAgentClient.GetStringAttributeLC(aAttribute);
       
    96 	}
       
    97  
       
    98 EXPORT_C void CTestAgentKeyStreamDecoder::GetPostDeliveryRightsL(RFile& aFile, TDes8& aCid, TDes8& aRightsMimeType, TDes8& aContentMimeType)
       
    99 /**
       
   100  	@see CAgentKeyStreamDecoder::GetPostDeliveryRightsHandleL
       
   101  */
       
   102 	{
       
   103 	iAgentClient.GetPostDeliveryRightsL(aFile, aCid, aRightsMimeType, aContentMimeType);
       
   104 	}
       
   105 
       
   106 EXPORT_C void CTestAgentKeyStreamDecoder::SendKeyStreamL(const TDesC8& aKey) const
       
   107 /**
       
   108  	Sends an encrypted short-term key to the test agent server.
       
   109  	@param aKey An encrypted key.
       
   110  */
       
   111 	{
       
   112 	iAgentClient.SendKeyStreamL(aKey);
       
   113 	}
       
   114 
       
   115 EXPORT_C void CTestAgentKeyStreamDecoder::SendIpSecAssociationL(TInt32 aSpi, HBufC8* aEncryptionKey, HBufC8* aAuthenticationKey) const
       
   116 	{
       
   117 	iAgentClient.SendIpSecAssociationL(aSpi, aEncryptionKey, aAuthenticationKey);
       
   118 	}