os/mm/mmlibs/mmfw/tsrc/mmfunittest/DevSoundTest/CIPlugins/src/ilbcdecoderconfigtestdevice.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.
16 #include <ecom/implementationproxy.h>
17 #include <ecom/ecom.h>
19 #include "ilbcdecoderconfigtestdevice.h"
20 #include "devsoundciutestdevices.hrh"
23 CMMFIlbcDecoderConfig implementation
25 CMMFIlbcDecoderConfig* CMMFIlbcDecoderConfig::NewL()
27 CMMFIlbcDecoderConfig* self = new(ELeave) CMMFIlbcDecoderConfig();
31 CMMFIlbcDecoderConfig::~CMMFIlbcDecoderConfig()
35 //Actual implementation of method SetDecoderMode
36 TInt CMMFIlbcDecoderConfig::SetDecoderMode(TDecodeMode aDecodeMode)
42 if ( KErrNone != (err = fs.Connect()) )
47 // this file name will be use on the testStep to compare the stored value.
48 _LIT(KFileName, "c:\\temp\\IlbcDecoderConfig.txt");
49 fs.MkDirAll(KFileName);
51 if ( KErrNone != (err = file.Replace(fs, KFileName, EFileWrite)) )
57 data.Format(_L8("%d"), aDecodeMode);
66 //Actual implementation of method SetCng
67 TInt CMMFIlbcDecoderConfig::SetComfortNoiseGeneration(TBool aCng)
73 //Actual implementation of method GetCng
74 TInt CMMFIlbcDecoderConfig::GetComfortNoiseGeneration(TBool& aCng)
82 CIlbcDecoderConfigTestDevice implementation
84 CMMFHwDevice* CIlbcDecoderConfigTestDevice::NewL()
86 CIlbcDecoderConfigTestDevice* self=new(ELeave) CIlbcDecoderConfigTestDevice();
87 CleanupStack::PushL(self);
89 CleanupStack::Pop(self);
93 CIlbcDecoderConfigTestDevice::~CIlbcDecoderConfigTestDevice()
95 delete iIlbcDecoderConfig;
98 CIlbcDecoderConfigTestDevice::CIlbcDecoderConfigTestDevice()
102 void CIlbcDecoderConfigTestDevice::ConstructL()
106 TInt CIlbcDecoderConfigTestDevice::Start(TDeviceFunc /*aFuncCmd*/, TDeviceFlow /*aFlowCmd*/)
111 TInt CIlbcDecoderConfigTestDevice::Stop()
116 TInt CIlbcDecoderConfigTestDevice::Pause()
121 TInt CIlbcDecoderConfigTestDevice::Init(THwDeviceInitParams& /*aDevInfo*/)
126 TAny* CIlbcDecoderConfigTestDevice::CustomInterface(TUid aInterfaceId)
128 // Just return something non-NULL to keep the
129 // DevSound initialisation process happy
130 TAny* ret = static_cast<TAny*>(this);
132 // Now for the CIs we want to test...
133 if (aInterfaceId == KUidIlbcDecoderIntfc)
135 if (!iIlbcDecoderConfig)
137 TRAPD(err, iIlbcDecoderConfig = CMMFIlbcDecoderConfig::NewL());
138 if (err == KErrNone && iIlbcDecoderConfig)
140 MIlbcDecoderIntfc* ptr = this;
141 ret = static_cast<TAny*>(ptr);
153 TInt CIlbcDecoderConfigTestDevice::ThisHwBufferFilled(CMMFBuffer& /*aFillBufferPtr*/)
158 TInt CIlbcDecoderConfigTestDevice::ThisHwBufferEmptied(CMMFBuffer& /*aEmptyBufferPtr*/)
163 TInt CIlbcDecoderConfigTestDevice::SetConfig(TTaskConfig& /*aConfig*/)
168 TInt CIlbcDecoderConfigTestDevice::StopAndDeleteCodec()
173 TInt CIlbcDecoderConfigTestDevice::DeleteCodec()
178 CMMFSwCodec& CIlbcDecoderConfigTestDevice::Codec()
183 TInt CIlbcDecoderConfigTestDevice::SetDecoderMode(TDecodeMode aDecodeMode)
185 TInt result = KErrBadHandle;
187 if (iIlbcDecoderConfig)
189 result = iIlbcDecoderConfig->SetDecoderMode(aDecodeMode);
195 TInt CIlbcDecoderConfigTestDevice::SetComfortNoiseGeneration(TBool aCng)
197 TInt result = KErrBadHandle;
199 if (iIlbcDecoderConfig)
201 result = iIlbcDecoderConfig->SetComfortNoiseGeneration(aCng);
207 TInt CIlbcDecoderConfigTestDevice::GetComfortNoiseGeneration(TBool& aCng)
209 TInt result = KErrBadHandle;
211 if (iIlbcDecoderConfig)
213 result = iIlbcDecoderConfig->GetComfortNoiseGeneration(aCng);