Update contrib.
1 // Copyright (c) 2005-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 "TestGlobalEffectPlugin.h"
18 #include <ecom/ecom.h>
19 #include <ecom/implementationproxy.h>
20 #include "../src/TestGlobalEffect.hrh"
22 const TUid KUidTestGlbCustomCall = {KUidTestGlbCustomCallDefine};
23 const TInt KPresetsCount = 3;
29 CTestEffect::CTestEffect()
33 CTestEffect::~CTestEffect()
37 REComSession::DestroyedImplementation(iDestructorKey);
40 MMmfGlobalAudioImpl* CTestEffect::NewL()
42 return new (ELeave) CTestEffect;
45 void CTestEffect::Release()
47 // this is effectively delete
51 TUint CTestEffect::Capability(TBool aCurrentOnly)
53 // not totally clear what to do for testing purposes, so just return 0 or -1 depending on param
54 return aCurrentOnly ? 0xffff : 0;
57 void CTestEffect::RequestNotificationL(TUid aEventUid)
59 // for test, just remember the pass event uid and use in test GenCallbackL() call
60 iNotifyUid = aEventUid;
63 void CTestEffect::GenCallbackL()
65 iObserver->GAEEventNotificationL(iParent, iNotifyUid, KNullDesC8);
68 TBool CTestEffect::IsEnabled() const
73 void CTestEffect::SetEnabledL(TBool aBool)
78 TBool CTestEffect::IsActive() const
83 void CTestEffect::SetActive(TBool aValue)
88 TUid CTestEffect::SettingsByUidL() const
90 if (iValueState!=ESetByUid)
92 User::Leave(KErrNotSupported);
97 void CTestEffect::SetSettingsByUidL(TUid aPresetUid)
99 iSettingsUid = aPresetUid;
100 iValueState = ESetByUid;
103 HBufC8* CTestEffect::SettingsByDesL() const
105 // for test, if we've not set via Des then return default value - except for SetByValue
106 _LIT8(KDefaultDes, "1234");
107 if (iValueState==ESetByDes)
109 return iSettingsDes->AllocL();
111 else if (iValueState!=ESetByValue)
113 return KDefaultDes().AllocL();
117 User::Leave(KErrNotSupported);
122 void CTestEffect::SetSettingsByDesL(const TDesC8& aParam)
126 iSettingsDes = aParam.Alloc();
127 iValueState = ESetByDes;
130 MMmfGlobalAudioPresetList* CTestEffect::KnownPresetsL()
134 iPresetList = CPresetList::NewL();
136 // produce list of num in numeric and readable form, upto count
137 for (TInt index=0; index<KPresetsCount; index++)
141 TUid tempUid={index};
142 iPresetList->AppendL(tempUid, name);
147 void CTestEffect::ExtractValuesL(TDes8& aPackageBuf)
149 if (iValueState!=ESetByValue)
151 User::LeaveIfError(KErrNotSupported);
153 TPckgC<TInt> packageBuf(iSettingsValue);
154 aPackageBuf = packageBuf;
157 void CTestEffect::SetByValuesL(const TDesC8& aPackageBuf)
159 TPckg<TInt> packageBuf(iSettingsValue);
160 packageBuf.Copy(aPackageBuf);
161 iValueState = ESetByValue;
164 TInt CTestEffect::CreateCustomInterface(TUid aInterfaceUid)
166 if (aInterfaceUid==KUidTestGlbCustomCall)
168 // we derive from this anyway, so just return KErrNone to say supported
171 return KErrNotSupported;
175 TAny* CTestEffect::CustomInterface(TUid aInterfaceUid)
177 if (aInterfaceUid==KUidTestGlbCustomCall)
179 MTestEffectCustomIf* castedThis = this;
185 void CTestEffect::PassDestructorKey(TUid aDestructorKey)
187 iDestructorKey = aDestructorKey;
190 void CTestEffect::CompleteConstructL(CMmfGlobalAudioEffect* aParent, MMmfGlobalAudioEffectObserver* aObserver)
193 iObserver = aObserver;
199 // __________________________________________________________________________
200 // Exported proxy for instantiation method resolution
201 // Define the interface UIDs
202 const TImplementationProxy ImplementationTable[] =
204 IMPLEMENTATION_PROXY_ENTRY(KUidTestGlblPluginImpDefine, CTestEffect::NewL),
207 EXPORT_C const TImplementationProxy* ImplementationGroupProxy(TInt& aTableCount)
209 aTableCount = sizeof(ImplementationTable) / sizeof(TImplementationProxy);
211 return ImplementationTable;