sl@0: // Copyright (c) 2004-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 the License "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: // e32test\mmu\d_export.cpp sl@0: // sl@0: // sl@0: sl@0: #include sl@0: #include "d_export.h" sl@0: sl@0: // sl@0: // Class definitions sl@0: // sl@0: sl@0: class DExportFactory : public DLogicalDevice sl@0: { sl@0: public: sl@0: ~DExportFactory(); sl@0: virtual TInt Install(); sl@0: virtual void GetCaps(TDes8& aDes) const; sl@0: virtual TInt Create(DLogicalChannelBase*& aChannel); sl@0: }; sl@0: sl@0: class DExportChannel : public DLogicalChannelBase sl@0: { sl@0: public: sl@0: DExportChannel(); sl@0: ~DExportChannel(); sl@0: virtual TInt DoCreate(TInt aUnit, const TDesC8* anInfo, const TVersion& aVer); sl@0: virtual TInt Request(TInt aFunction, TAny* a1, TAny* a2); sl@0: public: sl@0: DExportFactory* iFactory; sl@0: }; sl@0: sl@0: // sl@0: // DExportFactory sl@0: // sl@0: sl@0: TInt DExportFactory::Install() sl@0: { sl@0: return SetName(&KExportTestLddName); sl@0: } sl@0: sl@0: DExportFactory::~DExportFactory() sl@0: { sl@0: } sl@0: sl@0: void DExportFactory::GetCaps(TDes8& /*aDes*/) const sl@0: { sl@0: // Not used but required as DLogicalDevice::GetCaps is pure virtual sl@0: } sl@0: sl@0: TInt DExportFactory::Create(DLogicalChannelBase*& aChannel) sl@0: { sl@0: aChannel = NULL; sl@0: DExportChannel* channel=new DExportChannel; sl@0: if(!channel) sl@0: return KErrNoMemory; sl@0: channel->iFactory = this; sl@0: aChannel = channel; sl@0: return KErrNone; sl@0: } sl@0: sl@0: DECLARE_STANDARD_LDD() sl@0: { sl@0: return new DExportFactory; sl@0: } sl@0: sl@0: // sl@0: // DExportChannel sl@0: // sl@0: sl@0: TInt DExportChannel::DoCreate(TInt /*aUnit*/, const TDesC8* /*aInfo*/, const TVersion& /*aVer*/) sl@0: { sl@0: return KErrNone; sl@0: } sl@0: sl@0: DExportChannel::DExportChannel() sl@0: { sl@0: } sl@0: sl@0: DExportChannel::~DExportChannel() sl@0: { sl@0: } sl@0: sl@0: sl@0: TInt DExportChannel::Request(TInt aFunction, TAny* a1, TAny* a2) sl@0: { sl@0: TInt r=KErrNotSupported; sl@0: sl@0: switch(aFunction) sl@0: { sl@0: case RExportLdd::ERunExport: sl@0: r = ExportMultiplyFunction((TUint)a1, (TUint)a2); sl@0: break; sl@0: } sl@0: return r; sl@0: } sl@0: sl@0: EXPORT_C TInt ExportMultiplyFunction(TUint aNum0, TUint aNum1) sl@0: { sl@0: return aNum0 * aNum1; sl@0: }