author | mikaruus <mika.a.ruuskanen@nokia.com> |
Wed, 17 Feb 2010 13:58:55 +0200 | |
changeset 7 | fa67e03b87df |
parent 5 | 8ccc39f9d787 |
child 9 | 8486d82aef45 |
permissions | -rw-r--r-- |
0 | 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 INC_DROUTER_H |
|
21 |
#define INC_DROUTER_H |
|
22 |
||
23 |
#include <e32def.h> // For TUint16 |
|
24 |
#include <e32cmn.h> // For TDesC8 |
|
25 |
#include "internalapi.h" // For MIAD2ChannelApi |
|
26 |
//ISCE #include "mist2iadapi.h" // For TIADConnectionStatus, MIST2IADApi |
|
27 |
#include "iadinternaldefinitions.h" // For TIADConnectionStatus |
|
28 |
#include "iadnokiadefinitions.h" // For EIADSizeOfChannels |
|
29 |
//ISCE |
|
30 |
#include "isirouterlinkifs.h" // For MLinkRouterIf |
|
31 |
//ISCE |
|
5
8ccc39f9d787
New release based on our 2010wk02 release
mikaruus <mika.a.ruuskanen@nokia.com>
parents:
0
diff
changeset
|
32 |
#ifdef NCP_COMMON_BRIDGE_FAMILY_PIPE_SUPPORT |
0 | 33 |
class DPipeHandler; |
34 |
#endif |
|
35 |
//ISCE class MIAD2ISTApi; |
|
36 |
class DRouter; |
|
37 |
class MIAD2ChannelApi; |
|
38 |
class DQueue; |
|
39 |
||
40 |
static DObject* iThreadPtr = NULL; |
|
41 |
const TUint8 KIADEventSubscriptionObjId( 0xfc ); |
|
42 |
||
43 |
// TODO: own API for indicationhandler (and pipehandler allocate, deallocate, sendmessage ?) |
|
44 |
||
45 |
// - stores UL (APE destinated) message to receive queue |
|
46 |
// |
|
47 |
// add DL (CMT destinated) message to IST's appropriate send queue IS THIS |
|
48 |
// NEEDED OR FROM HANDLERS? |
|
49 |
// |
|
50 |
// route UL message from receive queue to appropriate handler |
|
51 |
// |
|
52 |
// receive DL message from LDD |
|
53 |
// |
|
54 |
// route DL message to appropriate handler |
|
55 |
NONSHARABLE_CLASS( DRouter ) : public MChannel2IADApi, |
|
56 |
// ISCE |
|
57 |
public MISILinkRouterIf |
|
58 |
// ISCE |
|
59 |
||
60 |
{ |
|
61 |
||
62 |
public: |
|
63 |
||
64 |
DRouter(); |
|
65 |
||
66 |
~DRouter(); |
|
67 |
||
68 |
// From MChannel2IADApi start |
|
69 |
IMPORT_C TDes8& AllocateBlock( const TUint16 aSize ); |
|
70 |
||
71 |
// Increases length of the returned descriptor to aSize + pipe header (11). |
|
72 |
IMPORT_C TDes8& AllocateDataBlock( const TUint16 aSize ); |
|
73 |
||
74 |
IMPORT_C void Close( const TUint16 aChannel ); |
|
75 |
||
76 |
IMPORT_C void DeAllocateBlock( TDes8& aBlock ); |
|
77 |
||
78 |
IMPORT_C TInt GetConnectionStatus(); |
|
79 |
||
80 |
IMPORT_C TInt GetFlowControlStatus(); |
|
81 |
||
82 |
IMPORT_C TInt GetMaxDataSize(); |
|
83 |
||
84 |
IMPORT_C void Open( const TUint16 aChannel, const TUint16 aRequest, MIAD2ChannelApi* aCallback ); |
|
85 |
||
86 |
IMPORT_C void Open( const TUint16 aChannel, const TUint16 aRequest, const TDesC8& aOpenInfo, MIAD2ChannelApi* aCallback ); |
|
87 |
||
88 |
IMPORT_C TInt OrderIndication( TDes8& anOrder, const TUint16 aCh, const TBool a32Bit = EFalse ); |
|
89 |
||
90 |
IMPORT_C TInt SendMessage( TDes8& aMessage, const TUint16 aCh ); |
|
91 |
||
92 |
IMPORT_C TInt SendIndication( TDes8& aMessage, const TUint16 aCh ); |
|
93 |
||
94 |
// From MChannel2IADApi end |
|
95 |
||
96 |
// For Router and it's handler DPipeHandler and DIndicationHandler |
|
97 |
TInt SendMsg( TDes8& aMsg ); |
|
98 |
||
99 |
// For PipeHandler |
|
100 |
MIAD2ChannelApi* GetChannel( const TUint16 aChannel ); |
|
101 |
// For PipeHandler |
|
102 |
// ISCE |
|
103 |
// TODO: DEF files!!! |
|
104 |
// From MISILinkRouterIf start |
|
105 |
/* |
|
106 |
* See comments from MISILinkRouterIf. |
|
107 |
*/ |
|
108 |
void NotifyTrxPresenceEnqueDfc( TBool aPresent ); |
|
109 |
||
110 |
/* |
|
111 |
* See comments from MISILinkRouterIf. |
|
112 |
*/ |
|
113 |
void Receive( TDes8& aMsg ); |
|
114 |
// From MISILinkRouterIf end |
|
115 |
IMPORT_C void DummyDoNothing(); |
|
116 |
||
117 |
IMPORT_C void DummyDoNothing2(); |
|
118 |
||
119 |
// ISCE |
|
120 |
||
121 |
// For internal receiving. |
|
122 |
void DRouter::MessageReceived( TDes8& aMsg ); |
|
123 |
||
124 |
#if (NCP_COMMON_SOS_VERSION_SUPPORT >= SOS_VERSION_95) |
|
125 |
EXPORT_C TInt Loan( const TUint16 aChannel, const TUint16 aRequest, |
|
126 |
MIAD2ChannelApi* aCallback ); |
|
127 |
EXPORT_C TInt ReturnLoan( const TUint16 aChannel, const TUint16 aRequest, |
|
128 |
MIAD2ChannelApi* aCallback ); |
|
129 |
#endif |
|
130 |
||
131 |
private: |
|
132 |
||
133 |
enum TRoutingRule |
|
134 |
{ |
|
135 |
EIsiMsg = 1, |
|
136 |
EPipeMsg, |
|
137 |
EMediaMsg, |
|
138 |
EIndicationMsg, |
|
139 |
ENotKnownMsg, |
|
5
8ccc39f9d787
New release based on our 2010wk02 release
mikaruus <mika.a.ruuskanen@nokia.com>
parents:
0
diff
changeset
|
140 |
EUsbPhonetMsg |
0 | 141 |
}; |
142 |
||
143 |
enum TWaitingType |
|
144 |
{ |
|
145 |
ENormalOpen = 1, |
|
146 |
#if (NCP_COMMON_SOS_VERSION_SUPPORT >= SOS_VERSION_95) |
|
5
8ccc39f9d787
New release based on our 2010wk02 release
mikaruus <mika.a.ruuskanen@nokia.com>
parents:
0
diff
changeset
|
147 |
ELoan |
0 | 148 |
#endif |
149 |
}; |
|
150 |
||
151 |
void HandleIsiMessage( TDes8& aMsg ); |
|
152 |
||
153 |
void HandlePipeMessage( TDes8& aMsg ); |
|
154 |
||
155 |
void HandleMediaMessage( TDes8& aMsg ); |
|
156 |
||
157 |
||
158 |
void SendCommIsaEntityNotReachableResp( const TDesC8& aMsg ); |
|
159 |
||
160 |
static void CheckDfc(); |
|
161 |
||
162 |
TInt ValiDateIsiMessage( TDes8& aMsg ); |
|
163 |
||
164 |
public: |
|
165 |
static void CheckRouting( DRouter& aTmp, TDes8& aMsg ); |
|
166 |
||
5
8ccc39f9d787
New release based on our 2010wk02 release
mikaruus <mika.a.ruuskanen@nokia.com>
parents:
0
diff
changeset
|
167 |
static DRouter* iThisPtr; |
8ccc39f9d787
New release based on our 2010wk02 release
mikaruus <mika.a.ruuskanen@nokia.com>
parents:
0
diff
changeset
|
168 |
MISIRouterObjectIf* iNameService; |
8ccc39f9d787
New release based on our 2010wk02 release
mikaruus <mika.a.ruuskanen@nokia.com>
parents:
0
diff
changeset
|
169 |
MISIRouterObjectIf* iCommunicationManager; |
7
fa67e03b87df
New release based on our 2010wk08 release
mikaruus <mika.a.ruuskanen@nokia.com>
parents:
5
diff
changeset
|
170 |
/* |
fa67e03b87df
New release based on our 2010wk08 release
mikaruus <mika.a.ruuskanen@nokia.com>
parents:
5
diff
changeset
|
171 |
* See comments from MISIChannelRouterIf |
fa67e03b87df
New release based on our 2010wk08 release
mikaruus <mika.a.ruuskanen@nokia.com>
parents:
5
diff
changeset
|
172 |
*/ |
fa67e03b87df
New release based on our 2010wk08 release
mikaruus <mika.a.ruuskanen@nokia.com>
parents:
5
diff
changeset
|
173 |
TDfcQue* GetDfcThread( const TISIDfcQThreadType aType ); |
5
8ccc39f9d787
New release based on our 2010wk02 release
mikaruus <mika.a.ruuskanen@nokia.com>
parents:
0
diff
changeset
|
174 |
|
7
fa67e03b87df
New release based on our 2010wk08 release
mikaruus <mika.a.ruuskanen@nokia.com>
parents:
5
diff
changeset
|
175 |
void FreeDfcThread( TDfcQue* aThread ); |
fa67e03b87df
New release based on our 2010wk08 release
mikaruus <mika.a.ruuskanen@nokia.com>
parents:
5
diff
changeset
|
176 |
|
fa67e03b87df
New release based on our 2010wk08 release
mikaruus <mika.a.ruuskanen@nokia.com>
parents:
5
diff
changeset
|
177 |
|
0 | 178 |
private: |
179 |
static void CommonRxDfc( TAny* aPtr ); |
|
180 |
||
181 |
static void InitCmtDfc( TAny* aPtr ); |
|
5
8ccc39f9d787
New release based on our 2010wk02 release
mikaruus <mika.a.ruuskanen@nokia.com>
parents:
0
diff
changeset
|
182 |
|
0 | 183 |
void InitConnectionOk(); |
184 |
||
185 |
static void NotifyObjLayerConnStatDfc( TAny* aPtr ); |
|
186 |
||
187 |
void NotifyObjLayerConnStat( const TIADConnectionStatus aStatus ); |
|
188 |
||
189 |
void SetSenderInfo( TDes8& aMessage, const TUint16 aCh ); |
|
190 |
||
5
8ccc39f9d787
New release based on our 2010wk02 release
mikaruus <mika.a.ruuskanen@nokia.com>
parents:
0
diff
changeset
|
191 |
//From objectapi |
8ccc39f9d787
New release based on our 2010wk02 release
mikaruus <mika.a.ruuskanen@nokia.com>
parents:
0
diff
changeset
|
192 |
TInt Send( TDes8& aMessage, const TUint8 aObjId ); |
8ccc39f9d787
New release based on our 2010wk02 release
mikaruus <mika.a.ruuskanen@nokia.com>
parents:
0
diff
changeset
|
193 |
|
0 | 194 |
// Member data |
195 |
private: |
|
196 |
||
197 |
void CheckSameThreadContext(); |
|
198 |
||
199 |
// TODO |
|
200 |
// Needed due to opening that are waiting a response from cmt side. |
|
201 |
// Use iWaitingChannel to store a channel pointer then and when resp |
|
202 |
// received from cmt set iChannel = iWaitingChannel and complete request |
|
203 |
// Used also when initializing physical and datalink layers. |
|
204 |
class TIADChannel |
|
205 |
{ |
|
206 |
public: |
|
207 |
||
208 |
MIAD2ChannelApi* iChannel; |
|
209 |
MIAD2ChannelApi* iWaitingChannel; |
|
210 |
TWaitingType iType; |
|
211 |
}; |
|
212 |
||
213 |
// ISCE |
|
214 |
TUint8 MapMediaToLinkId( const TUint8 aMedia ); |
|
215 |
||
216 |
enum TISIMedias |
|
217 |
{ |
|
218 |
EISIMediaHostSSI = 0x00, |
|
219 |
EISIAmountOfMedias |
|
220 |
}; |
|
221 |
// ISCE |
|
222 |
||
223 |
// owned |
|
224 |
// APE <-> CMT connection status ok/nok. |
|
225 |
TIADConnectionStatus iConnectionStatus; |
|
5
8ccc39f9d787
New release based on our 2010wk02 release
mikaruus <mika.a.ruuskanen@nokia.com>
parents:
0
diff
changeset
|
226 |
#ifdef NCP_COMMON_BRIDGE_FAMILY_PIPE_SUPPORT |
0 | 227 |
DPipeHandler* iPipeHandler; |
228 |
#endif |
|
229 |
DQueue* iCommonRxQueue; |
|
230 |
TIADChannel iChannelTable[ EIADSizeOfChannels ]; |
|
231 |
//static TDfc* iConnStatusBcDfc; |
|
232 |
TDfc* iCommonRxDfc; |
|
233 |
TDfc* iInitCmtDfc; |
|
234 |
TDfc* iConnStatDfc; |
|
235 |
// Maximum size of isi/data messages to be send. |
|
236 |
TUint16 iMaxFrameSize; |
|
237 |
// not owned, just using |
|
238 |
// When registered !NULL when unregistered NULL. API towards IST. |
|
239 |
// ISCE RArray<TUint> iArray; |
|
240 |
TBool iBootDone; |
|
241 |
||
242 |
// ISCE |
|
243 |
MISIRouterLinkIf** iLinksArray; |
|
244 |
// ISCE |
|
245 |
||
246 |
||
247 |
}; |
|
248 |
||
249 |
||
250 |
||
251 |
#endif /* INC_DROUTER_H */ |