os/mm/mmlibs/mmfw/tsrc/mmfunittest/DevSoundTest/CIPlugins/src/audiovibracontroltestdevice.cpp
First public contribution.
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 "audiovibracontroltestdevice.h"
20 #include "devsoundciutestdevices.hrh"
24 CMMFAudioVibraControl implementation
26 CMMFAudioVibraControl* CMMFAudioVibraControl::NewL()
28 CMMFAudioVibraControl* self = new(ELeave) CMMFAudioVibraControl();
32 CMMFAudioVibraControl::~CMMFAudioVibraControl()
36 //Actual implementation of method StartVibra
37 TInt CMMFAudioVibraControl::StartVibra()
42 //Actual implementation of method StopVibra
43 TInt CMMFAudioVibraControl::StopVibra()
50 CAudioVibraControlTestDevice implementation
52 CMMFHwDevice* CAudioVibraControlTestDevice::NewL()
54 CAudioVibraControlTestDevice* self=new(ELeave) CAudioVibraControlTestDevice();
55 CleanupStack::PushL(self);
57 CleanupStack::Pop(self);
61 CAudioVibraControlTestDevice::~CAudioVibraControlTestDevice()
63 delete iAudioVibraControl;
66 CAudioVibraControlTestDevice::CAudioVibraControlTestDevice()
70 void CAudioVibraControlTestDevice::ConstructL()
74 TInt CAudioVibraControlTestDevice::Start(TDeviceFunc /*aFuncCmd*/, TDeviceFlow /*aFlowCmd*/)
79 TInt CAudioVibraControlTestDevice::Stop()
84 TInt CAudioVibraControlTestDevice::Pause()
89 TInt CAudioVibraControlTestDevice::Init(THwDeviceInitParams& /*aDevInfo*/)
94 TAny* CAudioVibraControlTestDevice::CustomInterface(TUid aInterfaceId)
96 // Just return something non-NULL to keep the
97 // DevSound initialisation process happy
98 TAny* ret = static_cast<TAny*>(this);
100 // Now for the CIs we want to test...
101 if (aInterfaceId == KUidAudioVibraControl)
103 if (!iAudioVibraControl)
105 TRAPD(err, iAudioVibraControl = CMMFAudioVibraControl::NewL());
106 if (err == KErrNone && iAudioVibraControl)
108 MAudioVibraControl* ptr = this;
109 ret = static_cast<TAny*>(ptr);
121 TInt CAudioVibraControlTestDevice::ThisHwBufferFilled(CMMFBuffer& /*aFillBufferPtr*/)
126 TInt CAudioVibraControlTestDevice::ThisHwBufferEmptied(CMMFBuffer& /*aEmptyBufferPtr*/)
131 TInt CAudioVibraControlTestDevice::SetConfig(TTaskConfig& /*aConfig*/)
136 TInt CAudioVibraControlTestDevice::StopAndDeleteCodec()
141 TInt CAudioVibraControlTestDevice::DeleteCodec()
146 CMMFSwCodec& CAudioVibraControlTestDevice::Codec()
151 TInt CAudioVibraControlTestDevice::StartVibra()
153 TInt result = KErrBadHandle;
155 if (iAudioVibraControl)
157 result = iAudioVibraControl->StartVibra();
163 TInt CAudioVibraControlTestDevice::StopVibra()
165 TInt result = KErrBadHandle;
167 if (iAudioVibraControl)
169 result = iAudioVibraControl->StopVibra();