williamr@2: // Copyright (c) 2002-2009 Nokia Corporation and/or its subsidiary(-ies). williamr@2: // All rights reserved. williamr@2: // This component and the accompanying materials are made available williamr@2: // under the terms of the License "Symbian Foundation License v1.0" to Symbian Foundation members and "Symbian Foundation End User License Agreement v1.0" to non-members williamr@2: // which accompanies this distribution, and is available williamr@2: // at the URL "http://www.symbianfoundation.org/legal/licencesv10.html". williamr@2: // williamr@2: // Initial Contributors: williamr@2: // Nokia Corporation - initial contribution. williamr@2: // williamr@2: // Contributors: williamr@2: // williamr@2: // Description: williamr@2: // e32\include\e32msgqueue.h williamr@2: // williamr@2: // williamr@2: williamr@2: #ifndef __E32MSGQUEUE_H__ williamr@2: #define __E32MSGQUEUE_H__ williamr@2: williamr@2: #include williamr@2: williamr@2: williamr@2: williamr@2: williamr@2: class RMsgQueueBase : public RHandleBase williamr@2: /** williamr@2: @publishedAll williamr@2: @released williamr@2: williamr@2: Provides implementation for managing an asynchronous message queue, williamr@2: and is a base class for the RMsgQueue templated class. williamr@2: williamr@2: @see RMsgQueue williamr@2: */ williamr@2: { williamr@2: public: williamr@2: /** williamr@2: The limit for the size of an individual message. williamr@2: */ williamr@2: enum {KMaxLength = 256}; williamr@2: williamr@2: public: williamr@2: williamr@2: IMPORT_C TInt CreateLocal(TInt aSize, TInt aMsgLength, TOwnerType aType=EOwnerProcess); williamr@2: IMPORT_C TInt CreateGlobal(const TDesC& aName, TInt aSize, TInt aMsgLength, TOwnerType aType=EOwnerProcess); williamr@2: IMPORT_C TInt OpenGlobal(const TDesC& aName, TOwnerType aType=EOwnerProcess); williamr@2: IMPORT_C TInt Open(RMessagePtr2 aMessage, TInt aParam, TOwnerType aType=EOwnerProcess); williamr@2: IMPORT_C TInt Open(TInt aArgumentIndex, TOwnerType aType=EOwnerProcess); williamr@2: IMPORT_C TInt Send(const TAny* aPtr, TInt aLength); williamr@2: IMPORT_C void SendBlocking(const TAny* aPtr, TInt aLength); williamr@2: IMPORT_C TInt Receive(TAny* aPtr, TInt aLength); williamr@2: IMPORT_C void ReceiveBlocking(TAny* aPtr, TInt aLength); williamr@2: IMPORT_C void NotifySpaceAvailable(TRequestStatus& aStatus); williamr@2: IMPORT_C void CancelSpaceAvailable(); williamr@2: IMPORT_C void NotifyDataAvailable(TRequestStatus& aStatus); williamr@2: IMPORT_C void CancelDataAvailable(); williamr@2: IMPORT_C TInt MessageSize(); williamr@2: }; williamr@2: williamr@2: williamr@2: williamr@2: williamr@2: /** williamr@2: @publishedAll williamr@2: @released williamr@2: williamr@2: A handle to a message queue. williamr@2: williamr@2: The templated class provides the behaviour for managing an williamr@2: asynchronous queue of messages, where the template parameter defines the williamr@2: message type. williamr@2: williamr@2: The class adds a type-checking interface to the basic message queue williamr@2: functionality provided by RMsgQueueBase. williamr@2: */ williamr@2: template williamr@2: class RMsgQueue : public RMsgQueueBase williamr@2: { williamr@2: public: williamr@2: TInt CreateLocal(TInt aSize, TOwnerType aType=EOwnerProcess); williamr@2: TInt CreateGlobal(const TDesC& aName, TInt aSize, TOwnerType aType=EOwnerProcess); williamr@2: TInt Send(const T& aMsg); williamr@2: void SendBlocking(const T& aMsg); williamr@2: TInt Receive(T& aMsg); williamr@2: void ReceiveBlocking(T& aMsg); williamr@2: }; williamr@2: williamr@2: #include williamr@2: williamr@2: #endif