os/mm/mmlibs/mmfw/tsrc/mmfunittest/DevSoundTest/CIPlugins/src/setdrmprotectedtestdevice.cpp
Update contrib.
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 "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".
8 // Initial Contributors:
9 // Nokia Corporation - initial contribution.
17 #include <mmf/server/mmfswcodecwrappercustominterfacesuids.hrh>
18 #include "setdrmprotectedtestdevice.h"
21 /*****************************************************************************/
24 CMMFHwDevice* CSetDRMProtectedTestDevice::NewL()
26 CSetDRMProtectedTestDevice* self = new(ELeave) CSetDRMProtectedTestDevice();
27 CleanupStack::PushL(self);
29 CleanupStack::Pop(self);
33 /*****************************************************************************/
34 CSetDRMProtectedTestDevice::~CSetDRMProtectedTestDevice()
38 /*****************************************************************************/
39 CSetDRMProtectedTestDevice::CSetDRMProtectedTestDevice()
43 /*****************************************************************************/
44 void CSetDRMProtectedTestDevice::ConstructL()
48 /*****************************************************************************/
49 TInt CSetDRMProtectedTestDevice::Start(TDeviceFunc /*aFuncCmd*/, TDeviceFlow /*aFlowCmd*/)
54 /*****************************************************************************/
55 TInt CSetDRMProtectedTestDevice::Stop()
60 /*****************************************************************************/
61 TInt CSetDRMProtectedTestDevice::Pause()
66 /*****************************************************************************/
67 TInt CSetDRMProtectedTestDevice::Init(THwDeviceInitParams& /*aDevInfo*/)
72 /*****************************************************************************/
73 TAny* CSetDRMProtectedTestDevice::CustomInterface(TUid aInterfaceId)
75 MMMFSetDRMProtected* interface = NULL;
77 // DevSound initialisation requires something to be returned for both of
78 // these two uids: KMmfPlaySettingsCustomInterface, KMmfRecordSettingsCustomInterface
79 if ((aInterfaceId == KUidSetDRMProtected) || // This interface
80 (aInterfaceId.iUid == KMmfPlaySettingsCustomInterface) ||
81 (aInterfaceId.iUid == KMmfRecordSettingsCustomInterface))
89 /*****************************************************************************/
90 TInt CSetDRMProtectedTestDevice::ThisHwBufferFilled(CMMFBuffer& /*aFillBufferPtr*/)
95 /*****************************************************************************/
96 TInt CSetDRMProtectedTestDevice::ThisHwBufferEmptied(CMMFBuffer& /*aEmptyBufferPtr*/)
101 /*****************************************************************************/
102 TInt CSetDRMProtectedTestDevice::SetConfig(TTaskConfig& /*aConfig*/)
107 /*****************************************************************************/
108 TInt CSetDRMProtectedTestDevice::StopAndDeleteCodec()
113 /*****************************************************************************/
114 TInt CSetDRMProtectedTestDevice::DeleteCodec()
119 /*****************************************************************************/
120 CMMFSwCodec& CSetDRMProtectedTestDevice::Codec()
125 /*****************************************************************************/
126 TInt CSetDRMProtectedTestDevice::MmsdpMarkDataAsDRMProtected(TBool aDRMProtected)
128 TRAPD(err, DoWriteToFileL(aDRMProtected));
132 void CSetDRMProtectedTestDevice::DoWriteToFileL(TBool aFlag)
135 CleanupClosePushL(fs);
136 User::LeaveIfError(fs.Connect());
139 CleanupClosePushL(file);
141 // File doesn't yet exist
142 // It is the responsibility of the calling test function to delete the file after use
143 User::LeaveIfError(file.Create(fs, KCITestFileName, EFileWrite));
144 TBuf8<KMaxCITestFileDataLength> outputBuf;
145 outputBuf.Num(aFlag);
146 User::LeaveIfError(file.Write(outputBuf));
147 CleanupStack::PopAndDestroy(2); // fs, file