diff -r 000000000000 -r a41df078684a kerneltest/e32test/examples/convert1/convert1.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/kerneltest/e32test/examples/convert1/convert1.h Mon Oct 19 15:55:17 2009 +0100 @@ -0,0 +1,336 @@ +// Copyright (c) 2005-2009 Nokia Corporation and/or its subsidiary(-ies). +// All rights reserved. +// This component and the accompanying materials are made available +// under the terms of the License "Eclipse Public License v1.0" +// which accompanies this distribution, and is available +// at the URL "http://www.eclipse.org/legal/epl-v10.html". +// +// Initial Contributors: +// Nokia Corporation - initial contribution. +// +// Contributors: +// +// Description: +// in its implementation. +// +// + +/** + @file The interface to an example data converter device driver which uses Shared Chunks + @publishedPartner + @prototype 9.1 +*/ + +#ifndef __CONVERT1_H__ +#define __CONVERT1_H__ + +#include +#include +#ifndef __KERNEL_MODE__ +#include +#endif + +/** +User interface for 'Convert1' +*/ +class RConvert1 : public RBusLogicalChannel + { +public: + /** + Structure for holding driver capabilities information + */ + class TCaps + { + public: + TVersion iVersion; + TInt iMaxChannels; /**< Maximum number of simultaneous channels supported by driver */ + }; + + /** + Structure for holding driver configuration data + */ + class TConfig + { + public: + TInt iBufferSize; /**< Size of convert buffer */ + TBool iCreateInputChunk; /**< True if driver is to create an input chunk */ + TInt iSpeed; /**< Speed of converter in bytes/second (for this example test) */ + }; + typedef TPckgBuf TConfigBuf; + +#ifndef __KERNEL_MODE__ +public: + RConvert1(); + TInt Open(); + void Close(); + TInt GetConfig(TConfigBuf& aConfig); + TInt SetConfig(const TConfigBuf& aConfig); + void Convert(const TDesC8& aInput,TRequestStatus& aStatus); + void Convert(RChunk aInputChunk,TInt aInputOffset,TInt aInputSize,TRequestStatus& aStatus); + void Convert(TInt aSize,TRequestStatus& aStatus); + inline RChunk OutChunk() const; + inline RChunk InChunk(); + inline TPtr8 InBuffer(); +private: + /** + Hide the Duplicate() method by making it private. + The purpose of hiding the method is to prevent it's use because this object also contains + chunk handles which would need special consideration. + We don't want to bother supporting Duplicate() for this particular driver because + it only supports a single client thread so normal use wouldn't require Duplicate(). + */ + TInt Duplicate(const RThread& aSrc,TOwnerType aType=EOwnerProcess); +#endif + +public: + inline static const TDesC& Name(); + inline static TVersion VersionRequired(); +private: + /** + Enumeration of Control messages. + */ + enum TControl + { + EGetConfig, + ESetConfig, + EConvertDes, + EConvertChunk, + EConvertInChunk, + }; + + /** + Enumeration of Request messages. + (None used in this example) + */ + enum TRequest + { + ENumRequests, + EAllRequests = (1<