os/kernelhwsrv/kerneltest/e32test/dll/d_export.cpp
author sl@SLION-WIN7.fritz.box
Fri, 15 Jun 2012 03:10:57 +0200
changeset 0 bde4ae8d615e
permissions -rw-r--r--
First public contribution.
     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_export.h"
    20 
    21 //
    22 // Class definitions
    23 //
    24 
    25 class DExportFactory : public DLogicalDevice
    26 	{
    27 public:
    28 	~DExportFactory();
    29 	virtual TInt Install();
    30 	virtual void GetCaps(TDes8& aDes) const;
    31 	virtual TInt Create(DLogicalChannelBase*& aChannel);
    32 	};
    33 
    34 class DExportChannel : public DLogicalChannelBase
    35 	{
    36 public:
    37 	DExportChannel();
    38 	~DExportChannel();
    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 	DExportFactory*	iFactory;
    43 	};
    44 
    45 //
    46 // DExportFactory
    47 //
    48 
    49 TInt DExportFactory::Install()
    50 	{
    51 	return SetName(&KExportTestLddName);
    52 	}
    53 
    54 DExportFactory::~DExportFactory()
    55 	{
    56 	}
    57 
    58 void DExportFactory::GetCaps(TDes8& /*aDes*/) const
    59 	{
    60 	// Not used but required as DLogicalDevice::GetCaps is pure virtual
    61 	}
    62 
    63 TInt DExportFactory::Create(DLogicalChannelBase*& aChannel)
    64 	{
    65 	aChannel = NULL;
    66 	DExportChannel* channel=new DExportChannel;
    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 DExportFactory;
    77 	}
    78 
    79 //
    80 // DExportChannel
    81 //
    82 
    83 TInt DExportChannel::DoCreate(TInt /*aUnit*/, const TDesC8* /*aInfo*/, const TVersion& /*aVer*/)
    84 	{
    85 	return KErrNone;
    86 	}
    87 
    88 DExportChannel::DExportChannel()
    89 	{
    90 	}
    91 
    92 DExportChannel::~DExportChannel()
    93 	{
    94 	}
    95 
    96 
    97 TInt DExportChannel::Request(TInt aFunction, TAny* a1, TAny* a2)
    98 	{
    99 	TInt r=KErrNotSupported;
   100 
   101 	switch(aFunction)
   102 		{
   103 		case RExportLdd::ERunExport:
   104 			r = ExportMultiplyFunction((TUint)a1, (TUint)a2);
   105 			break;
   106 		}
   107 	return r;
   108 	}
   109 
   110 EXPORT_C TInt ExportMultiplyFunction(TUint aNum0, TUint aNum1)
   111 	{
   112 	return aNum0 * aNum1;
   113 	}