connectivitylayer/isce/ismpmultiplexer_dll/inc/mux.h
changeset 0 63b37f68c1ce
child 5 8ccc39f9d787
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/connectivitylayer/isce/ismpmultiplexer_dll/inc/mux.h	Fri Nov 06 17:28:23 2009 +0000
@@ -0,0 +1,133 @@
+/*
+* Copyright (c) 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: 
+*
+*/
+
+
+
+#ifndef __MUX_H__
+#define __MUX_H__
+
+// Class declarations
+class MMuxTrxIf;
+class MMuxLinkIf;
+
+#include <MTrxMuxIf.h>      // For exported MTrxMuxIf
+
+#include "iscedefs.h"       // For EMuxAmountOfProtocols
+#include "MLinkMuxIf.h"     // For internal MLinkMuxIf
+
+/*
+* Class represents a multiplexer.
+* De-multiplexes data from one transceiver to multiple protocol links.
+* Multiplexes data from multiple protocol links to one transceiver.
+*/
+NONSHARABLE_CLASS( DMux ) : public DBase, public MTrxMuxIf, public MLinkMuxIf
+    {
+
+    public:
+
+        /*
+        * Default constructor
+        * @param aTrxId, transceivers id
+        */
+        DMux( const TUint8 aTrxId );
+
+        /*
+        * Destructor
+        */
+        ~DMux();
+
+        /*
+        * Returns unique id of the transceiver where this multiplexer is connected.
+        *@return unique transceiver id
+        */
+        TUint8 GetTrxId() const;
+
+        /*
+        * Set link with unique link
+        * @return unique transceiver id
+        */
+        void SetLink( MMuxLinkIf* aLink, const TUint8 aLinkId );
+
+        /*
+        * Set transceiver 
+        *@param pointer to transceivers interface
+        */
+        void SetTrx( MMuxTrxIf* aTrx );
+
+        // From MTrxMuxIf start
+        /*
+        * See comments from MTrxMuxIf.
+        */
+        TDes8& AllocateBlock( const TUint16 aSize );
+
+        /*
+        * See comments from MTrxMuxIf.
+        */
+        void DeallocateBlock( TDes8& aBlock );
+
+        /*
+        * See comments from MTrxMuxIf.
+        * @param aData, data to be de-multiplexed to approriate protocol link accorind to aMuxingHeader
+        * @param aMuxingHeader, 32-bit multiplexing protocol header, implementation obeys MeXe Modem-Host communication protocol L2
+        */
+        void Receive( TDes8& aData, const TUint32 aMuxingHeader );
+
+        /*
+        * See comments from MTrxMuxIf.
+        */
+        void Unregister();
+        // From MTrxMuxIf end
+
+        // From MLinkMuxIf
+
+        /*
+        * See comments from MLinkMuxIf.
+        * Multiplexer shall obey MeXe Modem-Host communication protocol L2
+        * @param aMsg, message to be multiplexed
+        * @param aMuxingHeaderProtocolId, unique multiplexing header protocol id, implementation obeys MeXe Modem-Host communication protocol L2
+        * @param aPriority, priority of the message multiplexer shall map priority from link to transceiver
+        */
+        void Send( TDes8& aMsg, const TUint8 aMuxingHeaderProtocolId, const TMessageSendPriority aPriority = EPriorityNormal );
+        // From MLinkMuxIf
+
+    private:
+
+        /*
+        * Called when transceiver is either registered or unregistered.
+        * @param aPresent, true if registered
+        */
+        void NotifyTrxStatusChangeToAllLinks( TBool aPresent );
+        
+    private:
+
+        // Added convention:
+        // Prefix "iSh" means shared member variable
+        // Prefix "gSh" means shared global variable
+
+        // Guards class shared states of this class, owned
+        NFastMutex*     iFastMutex;
+        // Each multiplexer can have 1..N protocols, not owned
+        MMuxLinkIf*     iShLinks[ EMuxAmountOfProtocols ];
+        // Each multiplexer can have 1 transceiver, not ownet
+        MMuxTrxIf*      iShTrx;
+        // Transceivers unique identifier
+        TUint8          iShTrxId;
+
+    };
+
+
+#endif /* __MUX_H__ */