|
1 /* |
|
2 * Copyright (c) 2005-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: Declaration of the WlanDot11PwrMgmtTransitionMode class |
|
15 * |
|
16 */ |
|
17 |
|
18 /* |
|
19 * %version: 12 % |
|
20 */ |
|
21 |
|
22 #ifndef C_WLANDOT11PWRMGMTTRANSITIONMODE_H |
|
23 #define C_WLANDOT11PWRMGMTTRANSITIONMODE_H |
|
24 |
|
25 #include "UmacDot11InfrastructureMode.h" |
|
26 |
|
27 /** |
|
28 * State for performing a change between CAM and PS power management states. |
|
29 * |
|
30 * @lib wlanumac.lib |
|
31 * @since S60 v3.1 |
|
32 */ |
|
33 class WlanDot11PwrMgmtTransitionMode : public WlanDot11InfrastructureMode |
|
34 { |
|
35 |
|
36 public: |
|
37 |
|
38 /** Types for the FSM */ |
|
39 |
|
40 /** events for the FSM */ |
|
41 enum TEvent |
|
42 { |
|
43 ESTATEENTRY, // state entry action to be executed |
|
44 ETXCOMPLETE, // underlying sw layer tx delivery complete event |
|
45 // dot11 power management transition complete event |
|
46 EPWRMGMTTRANSITCOMPLETE, |
|
47 EABORT, // abort execution event |
|
48 EEVENTMAX // defined as an upper bound |
|
49 }; |
|
50 |
|
51 /** states of the FSM */ |
|
52 enum TState |
|
53 { |
|
54 EINIT, // start state of the state machine |
|
55 ESETAWAKEMODE, // set dot11 power management awake mode |
|
56 ESETWAKEUPINTERVAL, // set wlanwakeupinterval mib |
|
57 ESETPSMODE, // set dot11 power management ps mode |
|
58 // wait state for dot11 power management transition complete event |
|
59 EWAIT4PWRMGMTTRANSITCOMPLETE, |
|
60 ECONTINUEDOT11TRAVERSE, // continue dot11 state traversal |
|
61 ESTATEMAX // defined as an upper bound |
|
62 }; |
|
63 |
|
64 WlanDot11PwrMgmtTransitionMode() : iState( EINIT ), iFlags( 0 ) {}; |
|
65 |
|
66 |
|
67 virtual ~WlanDot11PwrMgmtTransitionMode() {}; |
|
68 |
|
69 |
|
70 |
|
71 |
|
72 private: |
|
73 |
|
74 // Prohibit copy constructor. |
|
75 WlanDot11PwrMgmtTransitionMode( const WlanDot11PwrMgmtTransitionMode& ); |
|
76 // Prohibit assigment operator. |
|
77 WlanDot11PwrMgmtTransitionMode& operator= ( |
|
78 const WlanDot11PwrMgmtTransitionMode& ); |
|
79 |
|
80 /** |
|
81 * Internal state transition method |
|
82 * |
|
83 * @since S60 3.1 |
|
84 * @param aCtxImpl global statemachine context |
|
85 * @param aNewState new internal state |
|
86 */ |
|
87 void ChangeInternalState( WlanContextImpl& aCtxImpl, TState aNewState ); |
|
88 |
|
89 /** |
|
90 * Feeds an event to internal fsm |
|
91 * |
|
92 * @since S60 3.1 |
|
93 * @param aCtxImpl global statemachine context |
|
94 * @param aEvent fsm event |
|
95 */ |
|
96 void Fsm( WlanContextImpl& aCtxImpl, TEvent aEvent ); |
|
97 |
|
98 /** |
|
99 * |
|
100 * @since S60 3.1 |
|
101 * @param aCtxImpl global statemachine context |
|
102 */ |
|
103 void OnStateEntryEvent( WlanContextImpl& aCtxImpl ); |
|
104 |
|
105 /** |
|
106 * |
|
107 * @since S60 3.1 |
|
108 * @param aCtxImpl global statemachine context |
|
109 */ |
|
110 void OnTxCompleteEvent( WlanContextImpl& aCtxImpl ); |
|
111 |
|
112 /** |
|
113 * |
|
114 * @since S60 3.1 |
|
115 * @param aCtxImpl global statemachine context |
|
116 */ |
|
117 void OnPwrMgmtTransitCompleteEvent( WlanContextImpl& aCtxImpl ); |
|
118 |
|
119 /** |
|
120 * |
|
121 * @since S60 3.1 |
|
122 * @param aCtxImpl global statemachine context |
|
123 */ |
|
124 void OnAbortEvent( WlanContextImpl& aCtxImpl ); |
|
125 |
|
126 /** |
|
127 * |
|
128 * @since S60 3.1 |
|
129 * @param aCtxImpl global statemachine context |
|
130 */ |
|
131 void ActivateDot11AwakeMode( WlanContextImpl& aCtxImpl ); |
|
132 |
|
133 /** |
|
134 * |
|
135 * @since S60 3.1 |
|
136 * @param aCtxImpl global statemachine context |
|
137 */ |
|
138 void SetWakeUpInterval( WlanContextImpl& aCtxImpl ); |
|
139 |
|
140 /** |
|
141 * |
|
142 * @since S60 3.1 |
|
143 * @param aCtxImpl global statemachine context |
|
144 */ |
|
145 void ActivateDot11PsMode( WlanContextImpl& aCtxImpl ); |
|
146 |
|
147 /** |
|
148 * |
|
149 * @since S60 3.1 |
|
150 * @param aCtxImpl global statemachine context |
|
151 */ |
|
152 void ContinueDot11StateTraversal( WlanContextImpl& aCtxImpl ); |
|
153 |
|
154 // from base class WlanMacState |
|
155 |
|
156 /** |
|
157 * From WlanMacState. |
|
158 * ?description |
|
159 * |
|
160 * @since S60 3.1 |
|
161 * @param ?arg1 ?description |
|
162 */ |
|
163 virtual void Entry( WlanContextImpl& aCtxImpl ); |
|
164 |
|
165 /** |
|
166 * From WlanMacState. |
|
167 * ?description |
|
168 * |
|
169 * @since S60 3.1 |
|
170 * @param ?arg1 ?description |
|
171 */ |
|
172 virtual void Exit( WlanContextImpl& aCtxImpl); |
|
173 |
|
174 /** |
|
175 * From WlanMacState. |
|
176 * ?description |
|
177 * |
|
178 * @since S60 3.1 |
|
179 * @param ?arg1 ?description |
|
180 */ |
|
181 #ifndef NDEBUG |
|
182 virtual const TInt8* GetStateName( TUint8& aLength ) const; |
|
183 #endif // !NDEBUG |
|
184 |
|
185 // from base class MWlanWsaEvent |
|
186 |
|
187 /** |
|
188 * From MWlanWsaEvent. |
|
189 * ?description |
|
190 * |
|
191 * @since S60 3.1 |
|
192 * @param ?arg1 ?description |
|
193 */ |
|
194 virtual TBool CommandComplete( |
|
195 WlanContextImpl& aCtxImpl, |
|
196 WHA::TCompleteCommandId aCompleteCommandId, |
|
197 WHA::TStatus aStatus, |
|
198 const WHA::UCommandCompletionParams& |
|
199 aCommandCompletionParams ); |
|
200 |
|
201 // from base class WlanMacState |
|
202 |
|
203 /** |
|
204 * From WlanMacState. |
|
205 * Set 802.11 power mgmt mode in infrastructure networks. |
|
206 * @param aCtxImpl statemachine context |
|
207 * @param aPowerMode desired power mode |
|
208 * @param aDisableDynamicPowerModeManagement If ETrue, disables the dynamic |
|
209 * power mode management handling. Relevant only when aPowerMode |
|
210 * is EPowerModePs |
|
211 * @param aWakeupModeInLightPs WLAN wake-up mode in Light PS mode |
|
212 * @param aListenIntervalInLightPs specifies the value of N for wake-up |
|
213 * modes 2 and 3 in Light PS mode. |
|
214 * @param aWakeupModeInDeepPs WLAN wake-up mode in Deep PS mode |
|
215 * @param aListenIntervalInDeepPs specifies the value of N for wake-up |
|
216 * modes 2 and 3 in Deep PS mode |
|
217 * @return ETrue if a state transition occurred |
|
218 * EFalse otherwise |
|
219 */ |
|
220 virtual TBool SetPowerMode( |
|
221 WlanContextImpl& aCtxImpl, |
|
222 TPowerMode aPowerMode, |
|
223 TBool aDisableDynamicPowerModeManagement, |
|
224 TWlanWakeUpInterval aWakeupModeInLightPs, |
|
225 TUint8 aListenIntervalInLightPs, |
|
226 TWlanWakeUpInterval aWakeupModeInDeepPs, |
|
227 TUint8 aListenIntervalInDeepPs ); |
|
228 |
|
229 private: // data |
|
230 |
|
231 #ifndef NDEBUG |
|
232 /** max length of state name for tracing */ |
|
233 enum { KMaxStateStringLength = 50 }; |
|
234 |
|
235 /** max length of event name for tracing */ |
|
236 enum { KMaxEventStringLength = KMaxStateStringLength }; |
|
237 |
|
238 /** |
|
239 * state names for tracing |
|
240 */ |
|
241 static const TUint8 iStateName[ESTATEMAX][KMaxStateStringLength]; |
|
242 |
|
243 /** |
|
244 * event names for tracing |
|
245 */ |
|
246 static const TUint8 iEventName[EEVENTMAX][KMaxEventStringLength]; |
|
247 /** |
|
248 * name of the state |
|
249 */ |
|
250 static const TInt8 iName[]; |
|
251 #endif |
|
252 |
|
253 /** |
|
254 * state of the fsm |
|
255 */ |
|
256 TState iState; |
|
257 |
|
258 /** |
|
259 * internal flags |
|
260 */ |
|
261 TUint32 iFlags; |
|
262 }; |
|
263 |
|
264 #endif // C_WLANDOT11PWRMGMTTRANSITIONMODE_H |
|
265 |