sl@0: // Copyright (c) 2007-2009 Nokia Corporation and/or its subsidiary(-ies). sl@0: // All rights reserved. sl@0: // This component and the accompanying materials are made available sl@0: // under the terms of "Eclipse Public License v1.0" sl@0: // which accompanies this distribution, and is available sl@0: // at the URL "http://www.eclipse.org/legal/epl-v10.html". sl@0: // sl@0: // Initial Contributors: sl@0: // Nokia Corporation - initial contribution. sl@0: // sl@0: // Contributors: sl@0: // sl@0: // Description: sl@0: // sl@0: sl@0: #include sl@0: #include sl@0: #include "setdrmprotectedtestdevice.h" sl@0: #include "cidefine.h" sl@0: sl@0: /*****************************************************************************/ sl@0: // Implementation sl@0: sl@0: CMMFHwDevice* CSetDRMProtectedTestDevice::NewL() sl@0: { sl@0: CSetDRMProtectedTestDevice* self = new(ELeave) CSetDRMProtectedTestDevice(); sl@0: CleanupStack::PushL(self); sl@0: self->ConstructL(); sl@0: CleanupStack::Pop(self); sl@0: return self; sl@0: } sl@0: sl@0: /*****************************************************************************/ sl@0: CSetDRMProtectedTestDevice::~CSetDRMProtectedTestDevice() sl@0: { sl@0: } sl@0: sl@0: /*****************************************************************************/ sl@0: CSetDRMProtectedTestDevice::CSetDRMProtectedTestDevice() sl@0: { sl@0: } sl@0: sl@0: /*****************************************************************************/ sl@0: void CSetDRMProtectedTestDevice::ConstructL() sl@0: { sl@0: } sl@0: sl@0: /*****************************************************************************/ sl@0: TInt CSetDRMProtectedTestDevice::Start(TDeviceFunc /*aFuncCmd*/, TDeviceFlow /*aFlowCmd*/) sl@0: { sl@0: return 0; sl@0: } sl@0: sl@0: /*****************************************************************************/ sl@0: TInt CSetDRMProtectedTestDevice::Stop() sl@0: { sl@0: return 0; sl@0: } sl@0: sl@0: /*****************************************************************************/ sl@0: TInt CSetDRMProtectedTestDevice::Pause() sl@0: { sl@0: return 0; sl@0: } sl@0: sl@0: /*****************************************************************************/ sl@0: TInt CSetDRMProtectedTestDevice::Init(THwDeviceInitParams& /*aDevInfo*/) sl@0: { sl@0: return 0; sl@0: } sl@0: sl@0: /*****************************************************************************/ sl@0: TAny* CSetDRMProtectedTestDevice::CustomInterface(TUid aInterfaceId) sl@0: { sl@0: MMMFSetDRMProtected* interface = NULL; sl@0: sl@0: // DevSound initialisation requires something to be returned for both of sl@0: // these two uids: KMmfPlaySettingsCustomInterface, KMmfRecordSettingsCustomInterface sl@0: if ((aInterfaceId == KUidSetDRMProtected) || // This interface sl@0: (aInterfaceId.iUid == KMmfPlaySettingsCustomInterface) || sl@0: (aInterfaceId.iUid == KMmfRecordSettingsCustomInterface)) sl@0: { sl@0: interface = this; sl@0: } sl@0: sl@0: return interface; sl@0: } sl@0: sl@0: /*****************************************************************************/ sl@0: TInt CSetDRMProtectedTestDevice::ThisHwBufferFilled(CMMFBuffer& /*aFillBufferPtr*/) sl@0: { sl@0: return 0; sl@0: } sl@0: sl@0: /*****************************************************************************/ sl@0: TInt CSetDRMProtectedTestDevice::ThisHwBufferEmptied(CMMFBuffer& /*aEmptyBufferPtr*/) sl@0: { sl@0: return 0; sl@0: } sl@0: sl@0: /*****************************************************************************/ sl@0: TInt CSetDRMProtectedTestDevice::SetConfig(TTaskConfig& /*aConfig*/) sl@0: { sl@0: return 0; sl@0: } sl@0: sl@0: /*****************************************************************************/ sl@0: TInt CSetDRMProtectedTestDevice::StopAndDeleteCodec() sl@0: { sl@0: return 0; sl@0: } sl@0: sl@0: /*****************************************************************************/ sl@0: TInt CSetDRMProtectedTestDevice::DeleteCodec() sl@0: { sl@0: return 0; sl@0: } sl@0: sl@0: /*****************************************************************************/ sl@0: CMMFSwCodec& CSetDRMProtectedTestDevice::Codec() sl@0: { sl@0: return *iCodec; sl@0: } sl@0: sl@0: /*****************************************************************************/ sl@0: TInt CSetDRMProtectedTestDevice::MmsdpMarkDataAsDRMProtected(TBool aDRMProtected) sl@0: { sl@0: TRAPD(err, DoWriteToFileL(aDRMProtected)); sl@0: return err; sl@0: } sl@0: sl@0: void CSetDRMProtectedTestDevice::DoWriteToFileL(TBool aFlag) sl@0: { sl@0: RFs fs; sl@0: CleanupClosePushL(fs); sl@0: User::LeaveIfError(fs.Connect()); sl@0: sl@0: RFile file; sl@0: CleanupClosePushL(file); sl@0: sl@0: // File doesn't yet exist sl@0: // It is the responsibility of the calling test function to delete the file after use sl@0: User::LeaveIfError(file.Create(fs, KCITestFileName, EFileWrite)); sl@0: TBuf8 outputBuf; sl@0: outputBuf.Num(aFlag); sl@0: User::LeaveIfError(file.Write(outputBuf)); sl@0: CleanupStack::PopAndDestroy(2); // fs, file sl@0: } sl@0: sl@0: