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 sl@0: #include "ilbcdecoderconfigtestdevice.h" sl@0: #include "devsoundciutestdevices.hrh" sl@0: sl@0: /* sl@0: CMMFIlbcDecoderConfig implementation sl@0: */ sl@0: CMMFIlbcDecoderConfig* CMMFIlbcDecoderConfig::NewL() sl@0: { sl@0: CMMFIlbcDecoderConfig* self = new(ELeave) CMMFIlbcDecoderConfig(); sl@0: return self; sl@0: } sl@0: sl@0: CMMFIlbcDecoderConfig::~CMMFIlbcDecoderConfig() sl@0: { sl@0: } sl@0: sl@0: //Actual implementation of method SetDecoderMode sl@0: TInt CMMFIlbcDecoderConfig::SetDecoderMode(TDecodeMode aDecodeMode) sl@0: { sl@0: RFs fs; sl@0: RFile file; sl@0: TInt err = KErrNone; sl@0: sl@0: if ( KErrNone != (err = fs.Connect()) ) sl@0: { sl@0: return err; sl@0: } sl@0: sl@0: // this file name will be use on the testStep to compare the stored value. sl@0: _LIT(KFileName, "c:\\temp\\IlbcDecoderConfig.txt"); sl@0: fs.MkDirAll(KFileName); sl@0: sl@0: if ( KErrNone != (err = file.Replace(fs, KFileName, EFileWrite)) ) sl@0: { sl@0: return err; sl@0: } sl@0: sl@0: TBuf8<4> data; sl@0: data.Format(_L8("%d"), aDecodeMode); sl@0: sl@0: file.Write(data); sl@0: file.Close(); sl@0: fs.Close(); sl@0: sl@0: return err; sl@0: } sl@0: sl@0: //Actual implementation of method SetCng sl@0: TInt CMMFIlbcDecoderConfig::SetComfortNoiseGeneration(TBool aCng) sl@0: { sl@0: iCng = aCng; sl@0: return KErrNone; sl@0: } sl@0: sl@0: //Actual implementation of method GetCng sl@0: TInt CMMFIlbcDecoderConfig::GetComfortNoiseGeneration(TBool& aCng) sl@0: { sl@0: aCng = iCng; sl@0: return KErrNone; sl@0: } sl@0: sl@0: sl@0: /* sl@0: CIlbcDecoderConfigTestDevice implementation sl@0: */ sl@0: CMMFHwDevice* CIlbcDecoderConfigTestDevice::NewL() sl@0: { sl@0: CIlbcDecoderConfigTestDevice* self=new(ELeave) CIlbcDecoderConfigTestDevice(); sl@0: CleanupStack::PushL(self); sl@0: self->ConstructL(); sl@0: CleanupStack::Pop(self); sl@0: return self; sl@0: } sl@0: sl@0: CIlbcDecoderConfigTestDevice::~CIlbcDecoderConfigTestDevice() sl@0: { sl@0: delete iIlbcDecoderConfig; sl@0: } sl@0: sl@0: CIlbcDecoderConfigTestDevice::CIlbcDecoderConfigTestDevice() sl@0: { sl@0: } sl@0: sl@0: void CIlbcDecoderConfigTestDevice::ConstructL() sl@0: { sl@0: } sl@0: sl@0: TInt CIlbcDecoderConfigTestDevice::Start(TDeviceFunc /*aFuncCmd*/, TDeviceFlow /*aFlowCmd*/) sl@0: { sl@0: return 0; sl@0: } sl@0: sl@0: TInt CIlbcDecoderConfigTestDevice::Stop() sl@0: { sl@0: return 0; sl@0: } sl@0: sl@0: TInt CIlbcDecoderConfigTestDevice::Pause() sl@0: { sl@0: return 0; sl@0: } sl@0: sl@0: TInt CIlbcDecoderConfigTestDevice::Init(THwDeviceInitParams& /*aDevInfo*/) sl@0: { sl@0: return 0; sl@0: } sl@0: sl@0: TAny* CIlbcDecoderConfigTestDevice::CustomInterface(TUid aInterfaceId) sl@0: { sl@0: // Just return something non-NULL to keep the sl@0: // DevSound initialisation process happy sl@0: TAny* ret = static_cast(this); sl@0: sl@0: // Now for the CIs we want to test... sl@0: if (aInterfaceId == KUidIlbcDecoderIntfc) sl@0: { sl@0: if (!iIlbcDecoderConfig) sl@0: { sl@0: TRAPD(err, iIlbcDecoderConfig = CMMFIlbcDecoderConfig::NewL()); sl@0: if (err == KErrNone && iIlbcDecoderConfig) sl@0: { sl@0: MIlbcDecoderIntfc* ptr = this; sl@0: ret = static_cast(ptr); sl@0: } sl@0: else sl@0: { sl@0: ret = NULL; sl@0: } sl@0: } sl@0: } sl@0: sl@0: return ret; sl@0: } sl@0: sl@0: TInt CIlbcDecoderConfigTestDevice::ThisHwBufferFilled(CMMFBuffer& /*aFillBufferPtr*/) sl@0: { sl@0: return 0; sl@0: } sl@0: sl@0: TInt CIlbcDecoderConfigTestDevice::ThisHwBufferEmptied(CMMFBuffer& /*aEmptyBufferPtr*/) sl@0: { sl@0: return 0; sl@0: } sl@0: sl@0: TInt CIlbcDecoderConfigTestDevice::SetConfig(TTaskConfig& /*aConfig*/) sl@0: { sl@0: return 0; sl@0: } sl@0: sl@0: TInt CIlbcDecoderConfigTestDevice::StopAndDeleteCodec() sl@0: { sl@0: return 0; sl@0: } sl@0: sl@0: TInt CIlbcDecoderConfigTestDevice::DeleteCodec() sl@0: { sl@0: return 0; sl@0: } sl@0: sl@0: CMMFSwCodec& CIlbcDecoderConfigTestDevice::Codec() sl@0: { sl@0: return *iCodec; sl@0: } sl@0: sl@0: TInt CIlbcDecoderConfigTestDevice::SetDecoderMode(TDecodeMode aDecodeMode) sl@0: { sl@0: TInt result = KErrBadHandle; sl@0: sl@0: if (iIlbcDecoderConfig) sl@0: { sl@0: result = iIlbcDecoderConfig->SetDecoderMode(aDecodeMode); sl@0: } sl@0: sl@0: return result; sl@0: } sl@0: sl@0: TInt CIlbcDecoderConfigTestDevice::SetComfortNoiseGeneration(TBool aCng) sl@0: { sl@0: TInt result = KErrBadHandle; sl@0: sl@0: if (iIlbcDecoderConfig) sl@0: { sl@0: result = iIlbcDecoderConfig->SetComfortNoiseGeneration(aCng); sl@0: } sl@0: sl@0: return result; sl@0: } sl@0: sl@0: TInt CIlbcDecoderConfigTestDevice::GetComfortNoiseGeneration(TBool& aCng) sl@0: { sl@0: TInt result = KErrBadHandle; sl@0: sl@0: if (iIlbcDecoderConfig) sl@0: { sl@0: result = iIlbcDecoderConfig->GetComfortNoiseGeneration(aCng); sl@0: } sl@0: sl@0: return result; sl@0: }