|
1 /* |
|
2 * Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). |
|
3 * All rights reserved. |
|
4 * This component and the accompanying materials are made available |
|
5 * under the terms of the License "Eclipse Public License v1.0" |
|
6 * which accompanies this distribution, and is available |
|
7 * at the URL "http://www.eclipse.org/legal/epl-v10.html". |
|
8 * |
|
9 * Initial Contributors: |
|
10 * Nokia Corporation - initial contribution. |
|
11 * |
|
12 * Contributors: |
|
13 * |
|
14 * Description: |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 |
|
20 #ifndef __MUX_H__ |
|
21 #define __MUX_H__ |
|
22 |
|
23 // Class declarations |
|
24 class MMuxTrxIf; |
|
25 class MMuxLinkIf; |
|
26 |
|
27 #include <MTrxMuxIf.h> // For exported MTrxMuxIf |
|
28 |
|
29 #include "iscedefs.h" // For EMuxAmountOfProtocols |
|
30 #include "MLinkMuxIf.h" // For internal MLinkMuxIf |
|
31 |
|
32 /* |
|
33 * Class represents a multiplexer. |
|
34 * De-multiplexes data from one transceiver to multiple protocol links. |
|
35 * Multiplexes data from multiple protocol links to one transceiver. |
|
36 */ |
|
37 NONSHARABLE_CLASS( DMux ) : public DBase, public MTrxMuxIf, public MLinkMuxIf |
|
38 { |
|
39 |
|
40 public: |
|
41 |
|
42 /* |
|
43 * Default constructor |
|
44 * @param aTrxId, transceivers id |
|
45 */ |
|
46 DMux( const TUint8 aTrxId ); |
|
47 |
|
48 /* |
|
49 * Destructor |
|
50 */ |
|
51 ~DMux(); |
|
52 |
|
53 /* |
|
54 * Returns unique id of the transceiver where this multiplexer is connected. |
|
55 *@return unique transceiver id |
|
56 */ |
|
57 TUint8 GetTrxId() const; |
|
58 |
|
59 /* |
|
60 * Set link with unique link |
|
61 * @return unique transceiver id |
|
62 */ |
|
63 void SetLink( MMuxLinkIf* aLink, const TUint8 aLinkId ); |
|
64 |
|
65 /* |
|
66 * Set transceiver |
|
67 *@param pointer to transceivers interface |
|
68 */ |
|
69 void SetTrx( MMuxTrxIf* aTrx ); |
|
70 |
|
71 // From MTrxMuxIf start |
|
72 /* |
|
73 * See comments from MTrxMuxIf. |
|
74 */ |
|
75 TDes8& AllocateBlock( const TUint16 aSize ); |
|
76 |
|
77 /* |
|
78 * See comments from MTrxMuxIf. |
|
79 */ |
|
80 void DeallocateBlock( TDes8& aBlock ); |
|
81 |
|
82 /* |
|
83 * See comments from MTrxMuxIf. |
|
84 * @param aData, data to be de-multiplexed to approriate protocol link accorind to aMuxingHeader |
|
85 * @param aMuxingHeader, 32-bit multiplexing protocol header, implementation obeys MeXe Modem-Host communication protocol L2 |
|
86 */ |
|
87 void Receive( TDes8& aData, const TUint32 aMuxingHeader ); |
|
88 |
|
89 /* |
|
90 * See comments from MTrxMuxIf. |
|
91 */ |
|
92 void Unregister(); |
|
93 // From MTrxMuxIf end |
|
94 |
|
95 // From MLinkMuxIf |
|
96 |
|
97 /* |
|
98 * See comments from MLinkMuxIf. |
|
99 * Multiplexer shall obey MeXe Modem-Host communication protocol L2 |
|
100 * @param aMsg, message to be multiplexed |
|
101 * @param aMuxingHeaderProtocolId, unique multiplexing header protocol id, implementation obeys MeXe Modem-Host communication protocol L2 |
|
102 * @param aPriority, priority of the message multiplexer shall map priority from link to transceiver |
|
103 */ |
|
104 void Send( TDes8& aMsg, const TUint8 aMuxingHeaderProtocolId, const TMessageSendPriority aPriority = EPriorityNormal ); |
|
105 // From MLinkMuxIf |
|
106 |
|
107 private: |
|
108 |
|
109 /* |
|
110 * Called when transceiver is either registered or unregistered. |
|
111 * @param aPresent, true if registered |
|
112 */ |
|
113 void NotifyTrxStatusChangeToAllLinks( TBool aPresent ); |
|
114 |
|
115 private: |
|
116 |
|
117 // Added convention: |
|
118 // Prefix "iSh" means shared member variable |
|
119 // Prefix "gSh" means shared global variable |
|
120 |
|
121 // Guards class shared states of this class, owned |
|
122 NFastMutex* iFastMutex; |
|
123 // Each multiplexer can have 1..N protocols, not owned |
|
124 MMuxLinkIf* iShLinks[ EMuxAmountOfProtocols ]; |
|
125 // Each multiplexer can have 1 transceiver, not ownet |
|
126 MMuxTrxIf* iShTrx; |
|
127 // Transceivers unique identifier |
|
128 TUint8 iShTrxId; |
|
129 |
|
130 }; |
|
131 |
|
132 |
|
133 #endif /* __MUX_H__ */ |