os/mm/mmlibs/mmfw/tsrc/mmfunittest/DevSoundTest/CIPlugins/src/speechencoderconfigtestdevice.cpp
1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
1.2 +++ b/os/mm/mmlibs/mmfw/tsrc/mmfunittest/DevSoundTest/CIPlugins/src/speechencoderconfigtestdevice.cpp Fri Jun 15 03:10:57 2012 +0200
1.3 @@ -0,0 +1,238 @@
1.4 +/*
1.5 +* Copyright (c) 2007 Nokia Corporation and/or its subsidiary(-ies).
1.6 +* All rights reserved.
1.7 +* This component and the accompanying materials are made available
1.8 +* under the terms of "Eclipse Public License v1.0"
1.9 +* which accompanies this distribution, and is available
1.10 +* at the URL "http://www.eclipse.org/legal/epl-v10.html".
1.11 +*
1.12 +* Initial Contributors:
1.13 +* Nokia Corporation - initial contribution.
1.14 +*
1.15 +* Contributors:
1.16 +*
1.17 +* Description:
1.18 +*
1.19 +*/
1.20 +
1.21 +
1.22 +#include <ecom/implementationproxy.h>
1.23 +#include <ecom/ecom.h>
1.24 +#include <f32file.h>
1.25 +#include "speechencoderconfigtestdevice.h"
1.26 +#include "devsoundciutestdevices.hrh"
1.27 +
1.28 +/*
1.29 +CMMFSpeechEncoderConfig implementation
1.30 +*/
1.31 +CMMFSpeechEncoderConfig* CMMFSpeechEncoderConfig::NewL()
1.32 + {
1.33 + CMMFSpeechEncoderConfig* self = new(ELeave) CMMFSpeechEncoderConfig();
1.34 + return self;
1.35 + }
1.36 +
1.37 +CMMFSpeechEncoderConfig::~CMMFSpeechEncoderConfig()
1.38 + {
1.39 + }
1.40 +
1.41 +//Actual implementation of method SetBitrate
1.42 +TInt CMMFSpeechEncoderConfig::SetBitrate(TUint aBitrate)
1.43 + {
1.44 + iBitrate = aBitrate;
1.45 + return KErrNone;
1.46 + }
1.47 +
1.48 +//Actual implementation of method GetBitrate
1.49 +TInt CMMFSpeechEncoderConfig::GetBitrate (TUint& aBitrate)
1.50 + {
1.51 + aBitrate = iBitrate;
1.52 + return KErrNone;
1.53 + }
1.54 +
1.55 +//Actual implementation of method GetSupportedBitrates
1.56 +TInt CMMFSpeechEncoderConfig::GetSupportedBitrates(RArray<TUint>& aSupportedBitrates)
1.57 + {
1.58 + aSupportedBitrates.Append(12345);
1.59 + aSupportedBitrates.Append(23456);
1.60 + aSupportedBitrates.Append(34567);
1.61 + aSupportedBitrates.Append(45678);
1.62 + aSupportedBitrates.Append(56789);
1.63 + return KErrNone;
1.64 + }
1.65 +
1.66 +//Actual implementation of method SetVadMode
1.67 +TInt CMMFSpeechEncoderConfig::SetVadMode(TBool aVadModeOn)
1.68 + {
1.69 + iVadModeOn = aVadModeOn;
1.70 + return KErrNone;
1.71 + }
1.72 +
1.73 +//Actual implementation of method GetVadMode
1.74 +TInt CMMFSpeechEncoderConfig::GetVadMode(TBool& aVadModeOn)
1.75 + {
1.76 + aVadModeOn = iVadModeOn;
1.77 + return KErrNone;
1.78 + }
1.79 +
1.80 +
1.81 +/*
1.82 +CSpeechEncoderConfigTestDevice implementation
1.83 +*/
1.84 +CMMFHwDevice* CSpeechEncoderConfigTestDevice::NewL()
1.85 + {
1.86 + CSpeechEncoderConfigTestDevice* self=new(ELeave) CSpeechEncoderConfigTestDevice();
1.87 + CleanupStack::PushL(self);
1.88 + self->ConstructL();
1.89 + CleanupStack::Pop(self);
1.90 + return self;
1.91 + }
1.92 +
1.93 +CSpeechEncoderConfigTestDevice::~CSpeechEncoderConfigTestDevice()
1.94 + {
1.95 + delete iSpeechEncoderConfig;
1.96 + }
1.97 +
1.98 +CSpeechEncoderConfigTestDevice::CSpeechEncoderConfigTestDevice()
1.99 + {
1.100 + }
1.101 +
1.102 +void CSpeechEncoderConfigTestDevice::ConstructL()
1.103 + {
1.104 + }
1.105 +
1.106 +TInt CSpeechEncoderConfigTestDevice::Start(TDeviceFunc /*aFuncCmd*/, TDeviceFlow /*aFlowCmd*/)
1.107 + {
1.108 + return 0;
1.109 + }
1.110 +
1.111 +TInt CSpeechEncoderConfigTestDevice::Stop()
1.112 + {
1.113 + return 0;
1.114 + }
1.115 +
1.116 +TInt CSpeechEncoderConfigTestDevice::Pause()
1.117 + {
1.118 + return 0;
1.119 + }
1.120 +
1.121 +TInt CSpeechEncoderConfigTestDevice::Init(THwDeviceInitParams& /*aDevInfo*/)
1.122 + {
1.123 + return 0;
1.124 + }
1.125 +
1.126 +TAny* CSpeechEncoderConfigTestDevice::CustomInterface(TUid aInterfaceId)
1.127 + {
1.128 + // Just return something non-NULL to keep the
1.129 + // DevSound initialisation process happy
1.130 + TAny* ret = static_cast<TAny*>(this);
1.131 +
1.132 + // Now for the CIs we want to test...
1.133 + if (aInterfaceId == KUidSpeechEncoderConfig)
1.134 + {
1.135 + if (!iSpeechEncoderConfig)
1.136 + {
1.137 + TRAPD(err, iSpeechEncoderConfig = CMMFSpeechEncoderConfig::NewL());
1.138 + if (err == KErrNone && iSpeechEncoderConfig)
1.139 + {
1.140 + MSpeechEncoderConfig* ptr = this;
1.141 + ret = static_cast<TAny*>(ptr);
1.142 + }
1.143 + else
1.144 + {
1.145 + ret = NULL;
1.146 + }
1.147 + }
1.148 + }
1.149 +
1.150 + return ret;
1.151 + }
1.152 +
1.153 +TInt CSpeechEncoderConfigTestDevice::ThisHwBufferFilled(CMMFBuffer& /*aFillBufferPtr*/)
1.154 + {
1.155 + return 0;
1.156 + }
1.157 +
1.158 +TInt CSpeechEncoderConfigTestDevice::ThisHwBufferEmptied(CMMFBuffer& /*aEmptyBufferPtr*/)
1.159 + {
1.160 + return 0;
1.161 + }
1.162 +
1.163 +TInt CSpeechEncoderConfigTestDevice::SetConfig(TTaskConfig& /*aConfig*/)
1.164 + {
1.165 + return 0;
1.166 + }
1.167 +
1.168 +TInt CSpeechEncoderConfigTestDevice::StopAndDeleteCodec()
1.169 + {
1.170 + return 0;
1.171 + }
1.172 +
1.173 +TInt CSpeechEncoderConfigTestDevice::DeleteCodec()
1.174 + {
1.175 + return 0;
1.176 + }
1.177 +
1.178 +CMMFSwCodec& CSpeechEncoderConfigTestDevice::Codec()
1.179 + {
1.180 + return *iCodec;
1.181 + }
1.182 +
1.183 +TInt CSpeechEncoderConfigTestDevice::SetBitrate(TUint aBitrate)
1.184 + {
1.185 + TInt result = KErrBadHandle;
1.186 +
1.187 + if (iSpeechEncoderConfig)
1.188 + {
1.189 + result = iSpeechEncoderConfig->SetBitrate(aBitrate);
1.190 + }
1.191 +
1.192 + return result;
1.193 + }
1.194 +
1.195 +TInt CSpeechEncoderConfigTestDevice::GetBitrate(TUint& aBitrate)
1.196 + {
1.197 + TInt result = KErrBadHandle;
1.198 +
1.199 + if (iSpeechEncoderConfig)
1.200 + {
1.201 + result = iSpeechEncoderConfig->GetBitrate(aBitrate);
1.202 + }
1.203 +
1.204 + return result;
1.205 + }
1.206 +
1.207 +TInt CSpeechEncoderConfigTestDevice::GetSupportedBitrates(RArray<TUint>& aSupportedBitrates)
1.208 + {
1.209 + TInt result = KErrBadHandle;
1.210 +
1.211 + if (iSpeechEncoderConfig)
1.212 + {
1.213 + result = iSpeechEncoderConfig->GetSupportedBitrates(aSupportedBitrates);
1.214 + }
1.215 +
1.216 + return result;
1.217 + }
1.218 +
1.219 +TInt CSpeechEncoderConfigTestDevice::SetVadMode(TBool aVadModeOn)
1.220 + {
1.221 + TInt result = KErrBadHandle;
1.222 +
1.223 + if (iSpeechEncoderConfig)
1.224 + {
1.225 + result = iSpeechEncoderConfig->SetVadMode(aVadModeOn);
1.226 + }
1.227 +
1.228 + return result;
1.229 + }
1.230 +
1.231 +TInt CSpeechEncoderConfigTestDevice::GetVadMode(TBool& aVadModeOn)
1.232 + {
1.233 + TInt result = KErrBadHandle;
1.234 +
1.235 + if (iSpeechEncoderConfig)
1.236 + {
1.237 + result = iSpeechEncoderConfig->GetVadMode(aVadModeOn);
1.238 + }
1.239 +
1.240 + return result;
1.241 + }