|
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: Implementation of the WlanDot11InfrastructureNormalMode |
|
15 * class. |
|
16 * |
|
17 */ |
|
18 |
|
19 /* |
|
20 * %version: 14 % |
|
21 */ |
|
22 |
|
23 #include "config.h" |
|
24 #include "umacdot11infrastructurenormalmode.h" |
|
25 #include "UmacContextImpl.h" |
|
26 #include "umacoidmsg.h" |
|
27 |
|
28 #ifndef NDEBUG |
|
29 const TInt8 WlanDot11InfrastructureNormalMode::iName[] |
|
30 = "dot11infrastructure::dot11-normalmode"; |
|
31 #endif |
|
32 |
|
33 |
|
34 // ============================ MEMBER FUNCTIONS =============================== |
|
35 |
|
36 // --------------------------------------------------------------------------- |
|
37 // |
|
38 // --------------------------------------------------------------------------- |
|
39 // |
|
40 TBool WlanDot11InfrastructureNormalMode::ChangePowerMgmtMode( |
|
41 WlanContextImpl& aCtxImpl ) |
|
42 { |
|
43 // initialize the counter which we use to determine if we should |
|
44 // indicate BSS lost if we continuously are unsuccessful in changing the |
|
45 // power mgmt mode |
|
46 aCtxImpl.InitializeSetPsModeCount(); |
|
47 |
|
48 ChangeState( aCtxImpl, |
|
49 *this, // prev state |
|
50 aCtxImpl.iStates.iPwrMgmtTransitionMode // next state |
|
51 ); |
|
52 return ETrue; // signal caller that a state change occurred |
|
53 } |
|
54 |
|
55 // --------------------------------------------------------------------------- |
|
56 // |
|
57 // --------------------------------------------------------------------------- |
|
58 // |
|
59 TBool WlanDot11InfrastructureNormalMode::OnActiveToLightPsTimerTimeout( |
|
60 WlanContextImpl& aCtxImpl ) |
|
61 { |
|
62 TBool statechange( EFalse ); |
|
63 |
|
64 if ( aCtxImpl.OnActiveToLightPsTimerTimeout() ) |
|
65 { |
|
66 // change to Light PS mode desired |
|
67 |
|
68 aCtxImpl.DesiredDot11PwrMgmtMode( WHA::KPsEnable ); |
|
69 aCtxImpl.SetDesiredPsModeConfig( |
|
70 aCtxImpl.ClientLightPsModeConfig() ); |
|
71 |
|
72 // proceed with the mode change |
|
73 statechange = ChangePowerMgmtMode( aCtxImpl ); |
|
74 } |
|
75 |
|
76 return statechange; |
|
77 } |
|
78 |
|
79 // --------------------------------------------------------------------------- |
|
80 // |
|
81 // --------------------------------------------------------------------------- |
|
82 // |
|
83 TBool WlanDot11InfrastructureNormalMode::OnLightPsToActiveTimerTimeout( |
|
84 WlanContextImpl& aCtxImpl ) |
|
85 { |
|
86 TBool statechange( EFalse ); |
|
87 |
|
88 if ( aCtxImpl.OnLightPsToActiveTimerTimeout() ) |
|
89 { |
|
90 // change to Active mode desired |
|
91 |
|
92 aCtxImpl.DesiredDot11PwrMgmtMode( WHA::KPsDisable ); |
|
93 |
|
94 // proceed with the mode change |
|
95 statechange = ChangePowerMgmtMode( aCtxImpl ); |
|
96 } |
|
97 |
|
98 return statechange; |
|
99 } |
|
100 |
|
101 // --------------------------------------------------------------------------- |
|
102 // |
|
103 // --------------------------------------------------------------------------- |
|
104 // |
|
105 TBool WlanDot11InfrastructureNormalMode::OnLightPsToDeepPsTimerTimeout( |
|
106 WlanContextImpl& aCtxImpl ) |
|
107 { |
|
108 TBool statechange( EFalse ); |
|
109 |
|
110 if ( aCtxImpl.OnLightPsToDeepPsTimerTimeout() ) |
|
111 { |
|
112 // change to Deep PS mode desired |
|
113 |
|
114 aCtxImpl.DesiredDot11PwrMgmtMode( WHA::KPsEnable ); |
|
115 aCtxImpl.SetDesiredPsModeConfig( |
|
116 aCtxImpl.ClientDeepPsModeConfig() ); |
|
117 |
|
118 // proceed with the mode change |
|
119 statechange = ChangePowerMgmtMode( aCtxImpl ); |
|
120 } |
|
121 |
|
122 return statechange; |
|
123 } |
|
124 |
|
125 // --------------------------------------------------------------------------- |
|
126 // |
|
127 // --------------------------------------------------------------------------- |
|
128 // |
|
129 void WlanDot11InfrastructureNormalMode::Entry( |
|
130 WlanContextImpl& aCtxImpl ) |
|
131 { |
|
132 if ( ( aCtxImpl.ClientDot11PwrMgmtMode() == WHA::KPsEnable ) && |
|
133 ( !aCtxImpl.DisassociatedByAp() ) && |
|
134 ( !aCtxImpl.DynamicPwrModeMgtDisabled() ) ) |
|
135 { |
|
136 // activate dynamic power mode management |
|
137 aCtxImpl.StartPowerModeManagement(); |
|
138 } |
|
139 |
|
140 // dispatch an event that might be pending as we |
|
141 // can come here from dot11-pwrmgmttransitionmode state |
|
142 // which has enabled oid deferring to eventdispatcher |
|
143 aCtxImpl.DispatchEvent(); |
|
144 } |
|
145 |
|
146 // --------------------------------------------------------------------------- |
|
147 // |
|
148 // --------------------------------------------------------------------------- |
|
149 // |
|
150 void WlanDot11InfrastructureNormalMode::Exit( |
|
151 WlanContextImpl& aCtxImpl) |
|
152 { |
|
153 // deactivate dynamic power mode management |
|
154 aCtxImpl.StopPowerModeManagement(); |
|
155 } |
|
156 |
|
157 // --------------------------------------------------------------------------- |
|
158 // |
|
159 // --------------------------------------------------------------------------- |
|
160 // |
|
161 #ifndef NDEBUG |
|
162 const TInt8* WlanDot11InfrastructureNormalMode::GetStateName( |
|
163 TUint8& aLength ) const |
|
164 { |
|
165 aLength = sizeof( iName ); |
|
166 return iName; |
|
167 } |
|
168 #endif |
|
169 |
|
170 // --------------------------------------------------------------------------- |
|
171 // |
|
172 // --------------------------------------------------------------------------- |
|
173 // |
|
174 TBool WlanDot11InfrastructureNormalMode::OnDot11PwrMgmtTransitRequired( |
|
175 WlanContextImpl& aCtxImpl ) |
|
176 { |
|
177 // initialize the counter which we use to determine if we should |
|
178 // indicate BSS lost if we continuously are unsuccessful in changing the |
|
179 // power mgmt mode |
|
180 aCtxImpl.InitializeSetPsModeCount(); |
|
181 |
|
182 ChangeState( aCtxImpl, |
|
183 *this, // prev state |
|
184 aCtxImpl.iStates.iPwrMgmtTransitionMode // next state |
|
185 ); |
|
186 |
|
187 OnOidComplete( aCtxImpl ); |
|
188 // global statemachine transition will occur |
|
189 return ETrue; |
|
190 } |