os/mm/mmlibs/mmfw/tsrc/mmfunittest/DevSoundTest/CIPlugins/src/setdrmprotectedtestdevice.cpp
changeset 0 bde4ae8d615e
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/os/mm/mmlibs/mmfw/tsrc/mmfunittest/DevSoundTest/CIPlugins/src/setdrmprotectedtestdevice.cpp	Fri Jun 15 03:10:57 2012 +0200
     1.3 @@ -0,0 +1,150 @@
     1.4 +// Copyright (c) 2007-2009 Nokia Corporation and/or its subsidiary(-ies).
     1.5 +// All rights reserved.
     1.6 +// This component and the accompanying materials are made available
     1.7 +// under the terms of "Eclipse Public License v1.0"
     1.8 +// which accompanies this distribution, and is available
     1.9 +// at the URL "http://www.eclipse.org/legal/epl-v10.html".
    1.10 +//
    1.11 +// Initial Contributors:
    1.12 +// Nokia Corporation - initial contribution.
    1.13 +//
    1.14 +// Contributors:
    1.15 +//
    1.16 +// Description:
    1.17 +//
    1.18 +
    1.19 +#include <f32file.h>
    1.20 +#include <mmf/server/mmfswcodecwrappercustominterfacesuids.hrh>
    1.21 +#include "setdrmprotectedtestdevice.h"
    1.22 +#include "cidefine.h"
    1.23 +
    1.24 +/*****************************************************************************/
    1.25 +// Implementation
    1.26 +
    1.27 +CMMFHwDevice* CSetDRMProtectedTestDevice::NewL()
    1.28 +	{
    1.29 +	CSetDRMProtectedTestDevice* self = new(ELeave) CSetDRMProtectedTestDevice();
    1.30 +	CleanupStack::PushL(self);
    1.31 +	self->ConstructL();
    1.32 +	CleanupStack::Pop(self);
    1.33 +	return self;
    1.34 +	}
    1.35 +
    1.36 +/*****************************************************************************/
    1.37 +CSetDRMProtectedTestDevice::~CSetDRMProtectedTestDevice()
    1.38 +	{
    1.39 +	}
    1.40 +
    1.41 +/*****************************************************************************/
    1.42 +CSetDRMProtectedTestDevice::CSetDRMProtectedTestDevice()
    1.43 +	{
    1.44 +	}
    1.45 +
    1.46 +/*****************************************************************************/
    1.47 +void CSetDRMProtectedTestDevice::ConstructL()
    1.48 +	{
    1.49 +	}
    1.50 +	
    1.51 +/*****************************************************************************/
    1.52 +TInt CSetDRMProtectedTestDevice::Start(TDeviceFunc /*aFuncCmd*/, TDeviceFlow /*aFlowCmd*/) 
    1.53 +	{
    1.54 +	return 0;
    1.55 +	}
    1.56 +
    1.57 +/*****************************************************************************/
    1.58 +TInt CSetDRMProtectedTestDevice::Stop()
    1.59 +	{
    1.60 +	return 0;
    1.61 +	}
    1.62 +	
    1.63 +/*****************************************************************************/
    1.64 +TInt CSetDRMProtectedTestDevice::Pause()
    1.65 +	{
    1.66 +	return 0;
    1.67 +	}
    1.68 +
    1.69 +/*****************************************************************************/		
    1.70 +TInt CSetDRMProtectedTestDevice::Init(THwDeviceInitParams& /*aDevInfo*/)
    1.71 +	{
    1.72 +	return 0;
    1.73 +	}
    1.74 +	
    1.75 +/*****************************************************************************/	
    1.76 +TAny* CSetDRMProtectedTestDevice::CustomInterface(TUid aInterfaceId)
    1.77 +	{
    1.78 +	MMMFSetDRMProtected* interface = NULL;
    1.79 +	
    1.80 +	// DevSound initialisation requires something to be returned for both of
    1.81 +	// these two uids: KMmfPlaySettingsCustomInterface, KMmfRecordSettingsCustomInterface
    1.82 +	if ((aInterfaceId == KUidSetDRMProtected) || // This interface
    1.83 +		(aInterfaceId.iUid == KMmfPlaySettingsCustomInterface) ||
    1.84 +		(aInterfaceId.iUid == KMmfRecordSettingsCustomInterface))
    1.85 +		{
    1.86 +		interface = this;
    1.87 +		}
    1.88 +		
    1.89 +	return interface;
    1.90 +	}
    1.91 +
    1.92 +/*****************************************************************************/
    1.93 +TInt CSetDRMProtectedTestDevice::ThisHwBufferFilled(CMMFBuffer& /*aFillBufferPtr*/)
    1.94 +	{
    1.95 +	return 0;
    1.96 +	}
    1.97 +	
    1.98 +/*****************************************************************************/	
    1.99 +TInt CSetDRMProtectedTestDevice::ThisHwBufferEmptied(CMMFBuffer& /*aEmptyBufferPtr*/)
   1.100 +	{
   1.101 +	return 0;
   1.102 +	}
   1.103 +	
   1.104 +/*****************************************************************************/	
   1.105 +TInt CSetDRMProtectedTestDevice::SetConfig(TTaskConfig& /*aConfig*/)
   1.106 +	{
   1.107 +	return 0;
   1.108 +	}
   1.109 +	
   1.110 +/*****************************************************************************/	
   1.111 +TInt CSetDRMProtectedTestDevice::StopAndDeleteCodec()
   1.112 +	{
   1.113 +	return 0;
   1.114 +	}
   1.115 +	
   1.116 +/*****************************************************************************/	
   1.117 +TInt CSetDRMProtectedTestDevice::DeleteCodec()
   1.118 +	{
   1.119 +	return 0;
   1.120 +	}
   1.121 +
   1.122 +/*****************************************************************************/
   1.123 +CMMFSwCodec& CSetDRMProtectedTestDevice::Codec()
   1.124 +	{
   1.125 +	return *iCodec;
   1.126 +	}
   1.127 +
   1.128 +/*****************************************************************************/
   1.129 +TInt CSetDRMProtectedTestDevice::MmsdpMarkDataAsDRMProtected(TBool aDRMProtected)
   1.130 +	{
   1.131 +	TRAPD(err, DoWriteToFileL(aDRMProtected));
   1.132 +	return err;
   1.133 +	}
   1.134 +
   1.135 +void CSetDRMProtectedTestDevice::DoWriteToFileL(TBool aFlag)
   1.136 +	{
   1.137 +	RFs fs;
   1.138 +	CleanupClosePushL(fs);
   1.139 +	User::LeaveIfError(fs.Connect());
   1.140 +	
   1.141 +	RFile file;
   1.142 +	CleanupClosePushL(file);
   1.143 +	
   1.144 +	// File doesn't yet exist
   1.145 +	// It is the responsibility of the calling test function to delete the file after use
   1.146 +	User::LeaveIfError(file.Create(fs, KCITestFileName, EFileWrite));
   1.147 +	TBuf8<KMaxCITestFileDataLength> outputBuf;
   1.148 +	outputBuf.Num(aFlag);
   1.149 +	User::LeaveIfError(file.Write(outputBuf));
   1.150 +	CleanupStack::PopAndDestroy(2); // fs, file
   1.151 +	}
   1.152 +
   1.153 +