kerneltest/e32test/dll/d_import.cpp
changeset 0 a41df078684a
equal deleted inserted replaced
-1:000000000000 0:a41df078684a
       
     1 // Copyright (c) 2004-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 the License "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".
       
     7 //
       
     8 // Initial Contributors:
       
     9 // Nokia Corporation - initial contribution.
       
    10 //
       
    11 // Contributors:
       
    12 //
       
    13 // Description:
       
    14 // e32test\mmu\d_export.cpp
       
    15 // 
       
    16 //
       
    17 
       
    18 #include <kernel/kern_priv.h>
       
    19 #include "d_import.h"
       
    20 
       
    21 //
       
    22 // Class definitions
       
    23 //
       
    24 
       
    25 class DImportFactory : public DLogicalDevice
       
    26 	{
       
    27 public:
       
    28 	~DImportFactory();
       
    29 	virtual TInt Install();
       
    30 	virtual void GetCaps(TDes8& aDes) const;
       
    31 	virtual TInt Create(DLogicalChannelBase*& aChannel);
       
    32 	};
       
    33 
       
    34 class DImportChannel : public DLogicalChannelBase
       
    35 	{
       
    36 public:
       
    37 	DImportChannel();
       
    38 	~DImportChannel();
       
    39 	virtual TInt DoCreate(TInt aUnit, const TDesC8* anInfo, const TVersion& aVer);
       
    40 	virtual TInt Request(TInt aFunction, TAny* a1, TAny* a2);
       
    41 public:
       
    42 	DImportFactory*	iFactory;
       
    43 	};
       
    44 
       
    45 //
       
    46 // DImportFactory
       
    47 //
       
    48 
       
    49 TInt DImportFactory::Install()
       
    50 	{
       
    51 	return SetName(&KImportTestLddName);
       
    52 	}
       
    53 
       
    54 DImportFactory::~DImportFactory()
       
    55 	{
       
    56 	}
       
    57 
       
    58 void DImportFactory::GetCaps(TDes8& /*aDes*/) const
       
    59 	{
       
    60 	// Not used but required as DLogicalDevice::GetCaps is pure virtual
       
    61 	}
       
    62 
       
    63 TInt DImportFactory::Create(DLogicalChannelBase*& aChannel)
       
    64 	{
       
    65 	aChannel = NULL;
       
    66 	DImportChannel* channel=new DImportChannel;
       
    67 	if(!channel)
       
    68 		return KErrNoMemory;
       
    69 	channel->iFactory = this;
       
    70 	aChannel = channel;
       
    71 	return KErrNone;
       
    72 	}
       
    73 
       
    74 DECLARE_STANDARD_LDD()
       
    75 	{
       
    76 	return new DImportFactory;
       
    77 	}
       
    78 
       
    79 //
       
    80 // DImportChannel
       
    81 //
       
    82 
       
    83 TInt DImportChannel::DoCreate(TInt /*aUnit*/, const TDesC8* /*aInfo*/, const TVersion& /*aVer*/)
       
    84 	{
       
    85 	return KErrNone;
       
    86 	}
       
    87 
       
    88 DImportChannel::DImportChannel()
       
    89 	{
       
    90 	}
       
    91 
       
    92 DImportChannel::~DImportChannel()
       
    93 	{
       
    94 	}
       
    95 
       
    96 
       
    97 TInt DImportChannel::Request(TInt aFunction, TAny* a1, TAny* a2)
       
    98 	{
       
    99 	TInt r=KErrNotSupported;
       
   100 
       
   101 	switch(aFunction)
       
   102 		{
       
   103 		case RImportLdd::ERunImport:
       
   104 			r = ExportMultiplyFunction((TUint)a1, (TUint)a2);
       
   105 			break;
       
   106 		}
       
   107 	return r;
       
   108 	}