os/mm/mmlibs/mmfw/tsrc/mmfunittest/DevSoundTest/CIPlugins/src/setdrmprotectedtestdevice.cpp
author sl
Tue, 10 Jun 2014 14:32:02 +0200
changeset 1 260cb5ec6c19
permissions -rw-r--r--
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".
     7 //
     8 // Initial Contributors:
     9 // Nokia Corporation - initial contribution.
    10 //
    11 // Contributors:
    12 //
    13 // Description:
    14 //
    15 
    16 #include <f32file.h>
    17 #include <mmf/server/mmfswcodecwrappercustominterfacesuids.hrh>
    18 #include "setdrmprotectedtestdevice.h"
    19 #include "cidefine.h"
    20 
    21 /*****************************************************************************/
    22 // Implementation
    23 
    24 CMMFHwDevice* CSetDRMProtectedTestDevice::NewL()
    25 	{
    26 	CSetDRMProtectedTestDevice* self = new(ELeave) CSetDRMProtectedTestDevice();
    27 	CleanupStack::PushL(self);
    28 	self->ConstructL();
    29 	CleanupStack::Pop(self);
    30 	return self;
    31 	}
    32 
    33 /*****************************************************************************/
    34 CSetDRMProtectedTestDevice::~CSetDRMProtectedTestDevice()
    35 	{
    36 	}
    37 
    38 /*****************************************************************************/
    39 CSetDRMProtectedTestDevice::CSetDRMProtectedTestDevice()
    40 	{
    41 	}
    42 
    43 /*****************************************************************************/
    44 void CSetDRMProtectedTestDevice::ConstructL()
    45 	{
    46 	}
    47 	
    48 /*****************************************************************************/
    49 TInt CSetDRMProtectedTestDevice::Start(TDeviceFunc /*aFuncCmd*/, TDeviceFlow /*aFlowCmd*/) 
    50 	{
    51 	return 0;
    52 	}
    53 
    54 /*****************************************************************************/
    55 TInt CSetDRMProtectedTestDevice::Stop()
    56 	{
    57 	return 0;
    58 	}
    59 	
    60 /*****************************************************************************/
    61 TInt CSetDRMProtectedTestDevice::Pause()
    62 	{
    63 	return 0;
    64 	}
    65 
    66 /*****************************************************************************/		
    67 TInt CSetDRMProtectedTestDevice::Init(THwDeviceInitParams& /*aDevInfo*/)
    68 	{
    69 	return 0;
    70 	}
    71 	
    72 /*****************************************************************************/	
    73 TAny* CSetDRMProtectedTestDevice::CustomInterface(TUid aInterfaceId)
    74 	{
    75 	MMMFSetDRMProtected* interface = NULL;
    76 	
    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))
    82 		{
    83 		interface = this;
    84 		}
    85 		
    86 	return interface;
    87 	}
    88 
    89 /*****************************************************************************/
    90 TInt CSetDRMProtectedTestDevice::ThisHwBufferFilled(CMMFBuffer& /*aFillBufferPtr*/)
    91 	{
    92 	return 0;
    93 	}
    94 	
    95 /*****************************************************************************/	
    96 TInt CSetDRMProtectedTestDevice::ThisHwBufferEmptied(CMMFBuffer& /*aEmptyBufferPtr*/)
    97 	{
    98 	return 0;
    99 	}
   100 	
   101 /*****************************************************************************/	
   102 TInt CSetDRMProtectedTestDevice::SetConfig(TTaskConfig& /*aConfig*/)
   103 	{
   104 	return 0;
   105 	}
   106 	
   107 /*****************************************************************************/	
   108 TInt CSetDRMProtectedTestDevice::StopAndDeleteCodec()
   109 	{
   110 	return 0;
   111 	}
   112 	
   113 /*****************************************************************************/	
   114 TInt CSetDRMProtectedTestDevice::DeleteCodec()
   115 	{
   116 	return 0;
   117 	}
   118 
   119 /*****************************************************************************/
   120 CMMFSwCodec& CSetDRMProtectedTestDevice::Codec()
   121 	{
   122 	return *iCodec;
   123 	}
   124 
   125 /*****************************************************************************/
   126 TInt CSetDRMProtectedTestDevice::MmsdpMarkDataAsDRMProtected(TBool aDRMProtected)
   127 	{
   128 	TRAPD(err, DoWriteToFileL(aDRMProtected));
   129 	return err;
   130 	}
   131 
   132 void CSetDRMProtectedTestDevice::DoWriteToFileL(TBool aFlag)
   133 	{
   134 	RFs fs;
   135 	CleanupClosePushL(fs);
   136 	User::LeaveIfError(fs.Connect());
   137 	
   138 	RFile file;
   139 	CleanupClosePushL(file);
   140 	
   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
   148 	}
   149 
   150