|
1 /* |
|
2 * Copyright (c) 2002-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: Implementation of the WlanWsaCommand class. |
|
15 * |
|
16 */ |
|
17 |
|
18 /* |
|
19 * %version: 25 % |
|
20 */ |
|
21 |
|
22 #include "config.h" |
|
23 #include "UmacWsaCommand.h" |
|
24 #include "UmacContextImpl.h" |
|
25 |
|
26 |
|
27 // ============================ MEMBER FUNCTIONS =============================== |
|
28 |
|
29 |
|
30 // --------------------------------------------------------------------------- |
|
31 // |
|
32 // --------------------------------------------------------------------------- |
|
33 // |
|
34 WlanWsaCommand::~WlanWsaCommand() |
|
35 { |
|
36 iMacActionHistoryState = NULL; |
|
37 } |
|
38 |
|
39 // --------------------------------------------------------------------------- |
|
40 // |
|
41 // --------------------------------------------------------------------------- |
|
42 // |
|
43 void WlanWsaCommand::Exit( WlanContextImpl& aCtxImpl ) |
|
44 { |
|
45 // mark WSA cmd inactive |
|
46 aCtxImpl.DeActivateWsaCmd(); |
|
47 } |
|
48 |
|
49 // --------------------------------------------------------------------------- |
|
50 // |
|
51 // --------------------------------------------------------------------------- |
|
52 // |
|
53 void WlanWsaCommand::ChangeState( |
|
54 WlanContextImpl& aCtxImpl, |
|
55 WlanWsaCommand& aPrevState, |
|
56 WlanMacActionState& aNewState ) const |
|
57 { |
|
58 #ifndef NDEBUG |
|
59 TUint8 length; |
|
60 const TUint8* ptr = reinterpret_cast<const TUint8*> |
|
61 (aNewState.GetStateName( length )); |
|
62 const TUint8* ptr2 = reinterpret_cast<const TUint8*> |
|
63 (aCtxImpl.iCurrentMacState->GetStateName( length )); |
|
64 |
|
65 OsTracePrint( KUmacProtocolState, |
|
66 (TUint8*)("UMAC: WlanWsaCommand::ChangeState(): previous state:") ); |
|
67 OsTracePrint( KUmacProtocolState, ptr2 ); |
|
68 OsTracePrint( KUmacProtocolState, |
|
69 (TUint8*)("UMAC: WlanWsaCommand::ChangeState(): next state:") ); |
|
70 OsTracePrint( KUmacProtocolState, ptr ); |
|
71 #endif |
|
72 |
|
73 aPrevState.Exit( aCtxImpl ); |
|
74 aCtxImpl.iCurrentMacState = &aNewState; |
|
75 aCtxImpl.iCurrentMacState->Entry( aCtxImpl ); |
|
76 } |
|
77 |
|
78 // --------------------------------------------------------------------------- |
|
79 // |
|
80 // --------------------------------------------------------------------------- |
|
81 // |
|
82 void WlanWsaCommand::TraverseToHistoryState( |
|
83 WlanContextImpl& aCtxImpl, |
|
84 WHA::TCommandId aCommandId, |
|
85 WHA::TStatus aStatus, |
|
86 const WHA::UCommandResponseParams& aCommandResponseParams ) |
|
87 { |
|
88 OsTracePrint( |
|
89 KUmacDetails, |
|
90 (TUint8*) |
|
91 ("UMAC: WlanWsaCommand::TraverseToHistoryState(): act: %d"), |
|
92 aCtxImpl.WhaCommandAct() ); |
|
93 |
|
94 History().OnWhaCommandResponse( |
|
95 aCtxImpl, |
|
96 aCommandId, |
|
97 aStatus, |
|
98 aCommandResponseParams, |
|
99 aCtxImpl.WhaCommandAct() ); |
|
100 |
|
101 ChangeState( aCtxImpl, |
|
102 *this, // previous state |
|
103 History() // recall history state (new state) |
|
104 ); |
|
105 } |
|
106 |
|
107 // --------------------------------------------------------------------------- |
|
108 // |
|
109 // --------------------------------------------------------------------------- |
|
110 // |
|
111 void WlanWsaCommand::Act( WlanContextImpl& aCtxImpl, TUint32 aAct ) const |
|
112 { |
|
113 aCtxImpl.WhaCommandAct( aAct ); |
|
114 } |
|
115 |
|
116 // from wha side |
|
117 |
|
118 // --------------------------------------------------------------------------- |
|
119 // |
|
120 // --------------------------------------------------------------------------- |
|
121 // |
|
122 void WlanWsaCommand::Indication( |
|
123 WlanContextImpl& aCtxImpl, |
|
124 WHA::TIndicationId aIndicationId, |
|
125 const WHA::UIndicationParams& aIndicationParams ) |
|
126 { |
|
127 return History().Indication( aCtxImpl, aIndicationId, aIndicationParams ); |
|
128 } |
|
129 |
|
130 // Frame receive |
|
131 |
|
132 // --------------------------------------------------------------------------- |
|
133 // |
|
134 // --------------------------------------------------------------------------- |
|
135 // |
|
136 TAny* WlanWsaCommand::RequestForBuffer( |
|
137 WlanContextImpl& aCtxImpl, |
|
138 TUint16 aLength ) |
|
139 { |
|
140 return History().RequestForBuffer( aCtxImpl, aLength ); |
|
141 } |
|
142 |
|
143 // --------------------------------------------------------------------------- |
|
144 // |
|
145 // --------------------------------------------------------------------------- |
|
146 // |
|
147 void WlanWsaCommand::ReceivePacket( |
|
148 WlanContextImpl& aCtxImpl, |
|
149 WHA::TStatus aStatus, |
|
150 const void* aFrame, |
|
151 TUint16 aLength, |
|
152 WHA::TRate aRate, |
|
153 WHA::TRcpi aRcpi, |
|
154 WHA::TChannelNumber aChannel, |
|
155 TUint8* aBuffer, |
|
156 TUint32 aFlags ) |
|
157 { |
|
158 return History().ReceivePacket( |
|
159 aCtxImpl, |
|
160 aStatus, |
|
161 aFrame, |
|
162 aLength, |
|
163 aRate, |
|
164 aRcpi, |
|
165 aChannel, |
|
166 aBuffer, |
|
167 aFlags |
|
168 ); |
|
169 } |
|
170 |
|
171 // --------------------------------------------------------------------------- |
|
172 // |
|
173 // --------------------------------------------------------------------------- |
|
174 // |
|
175 TBool WlanWsaCommand::TxData( |
|
176 WlanContextImpl& aCtxImpl, |
|
177 TDataBuffer& aDataBuffer, |
|
178 TBool aMore ) |
|
179 { |
|
180 return History().TxData( aCtxImpl, aDataBuffer, aMore ); |
|
181 } |
|
182 |
|
183 // --------------------------------------------------------------------------- |
|
184 // |
|
185 // --------------------------------------------------------------------------- |
|
186 // |
|
187 void WlanWsaCommand::TxMgmtData( |
|
188 WlanContextImpl& aCtxImpl, |
|
189 TDataBuffer& aDataBuffer ) |
|
190 { |
|
191 History().TxMgmtData( aCtxImpl, aDataBuffer ); |
|
192 } |
|
193 |
|
194 // --------------------------------------------------------------------------- |
|
195 // |
|
196 // --------------------------------------------------------------------------- |
|
197 // |
|
198 void WlanWsaCommand::OnPacketTransferComplete( |
|
199 WlanContextImpl& aCtxImpl, |
|
200 TUint32 aPacketId, |
|
201 TDataBuffer* aMetaHeader ) |
|
202 { |
|
203 History().OnPacketTransferComplete( aCtxImpl, aPacketId, aMetaHeader ); |
|
204 } |
|
205 |
|
206 // --------------------------------------------------------------------------- |
|
207 // |
|
208 // --------------------------------------------------------------------------- |
|
209 // |
|
210 void WlanWsaCommand::OnPacketSendComplete( |
|
211 WlanContextImpl& aCtxImpl, |
|
212 WHA::TStatus aStatus, |
|
213 TUint32 aPacketId, |
|
214 WHA::TRate aRate, |
|
215 TUint32 aPacketQueueDelay, |
|
216 TUint32 aMediaDelay, |
|
217 TUint aTotalTxDelay, |
|
218 TUint8 aAckFailures, |
|
219 WHA::TQueueId aQueueId, |
|
220 WHA::TRate aRequestedRate, |
|
221 TBool aMulticastData ) |
|
222 { |
|
223 History().OnPacketSendComplete( |
|
224 aCtxImpl, |
|
225 aStatus, |
|
226 aPacketId, |
|
227 aRate, |
|
228 aPacketQueueDelay, |
|
229 aMediaDelay, |
|
230 aTotalTxDelay, |
|
231 aAckFailures, |
|
232 aQueueId, |
|
233 aRequestedRate, |
|
234 aMulticastData ); |
|
235 } |
|
236 |
|
237 // --------------------------------------------------------------------------- |
|
238 // |
|
239 // --------------------------------------------------------------------------- |
|
240 // |
|
241 void WlanWsaCommand::CallPacketSchedule( |
|
242 WlanContextImpl& aCtxImpl, |
|
243 TBool aMore ) |
|
244 { |
|
245 History().CallPacketSchedule( aCtxImpl, aMore ); |
|
246 } |
|
247 |
|
248 // --------------------------------------------------------------------------- |
|
249 // |
|
250 // --------------------------------------------------------------------------- |
|
251 // |
|
252 void WlanWsaCommand::OnPacketPushPossible( |
|
253 WlanContextImpl& aCtxImpl ) |
|
254 { |
|
255 History().OnPacketPushPossible( aCtxImpl ); |
|
256 } |