|
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: Inline methods of CWlmServer |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 #include "am_debug.h" |
|
20 |
|
21 // --------------------------------------------------------- |
|
22 // CWLMServer::GetScanType |
|
23 // --------------------------------------------------------- |
|
24 // |
|
25 inline TWLMScanType CWlmServer::GetScanType() |
|
26 { |
|
27 DEBUG( "CWlmServer::GetScanType()" ); |
|
28 return iPlatform->GetScanType(); |
|
29 } |
|
30 |
|
31 // --------------------------------------------------------- |
|
32 // CWLMServer::SetIconState |
|
33 // --------------------------------------------------------- |
|
34 // |
|
35 inline TInt CWlmServer::SetIconState( TWlmIconStatus aStatus ) |
|
36 { |
|
37 DEBUG1( "CWlmServer::SetIconState( %u )", aStatus ); |
|
38 return iPlatform->SetIconState( aStatus ); |
|
39 } |
|
40 |
|
41 // --------------------------------------------------------- |
|
42 // CWLMServer::UpdateAvailability |
|
43 // --------------------------------------------------------- |
|
44 // |
|
45 inline void CWlmServer::UpdateAvailability( |
|
46 TBool /*aAvailability*/, |
|
47 TBool aNewNetworksDetected, |
|
48 TBool aOldNetworksLost ) |
|
49 { |
|
50 TBuf8<1> tmp; |
|
51 if( aNewNetworksDetected ) |
|
52 { |
|
53 // Notify subscribees |
|
54 for( TInt i = 0; i < iNotificationArray.Count(); i++ ) |
|
55 { |
|
56 iNotificationArray[i]->AddNotification( EWlmNotifyNewNetworksDetected, tmp ); |
|
57 } |
|
58 } |
|
59 if( aOldNetworksLost ) |
|
60 { |
|
61 // Notify subscribees |
|
62 for( TInt i = 0; i < iNotificationArray.Count(); i++ ) |
|
63 { |
|
64 iNotificationArray[i]->AddNotification( EWlmNotifyOldNetworksLost, tmp ); |
|
65 } |
|
66 } |
|
67 } |
|
68 |
|
69 // --------------------------------------------------------- |
|
70 // CWlmServer::ReleaseRequest |
|
71 // --------------------------------------------------------- |
|
72 // |
|
73 inline void CWlmServer::ReleaseRequest() |
|
74 { |
|
75 DEBUG( "CWlmServer::ReleaseRequest()" ); |
|
76 if( GetCurrentState() != EWlanStateNotConnected ) |
|
77 { |
|
78 // create data for state change notification |
|
79 TBuf8<1> state; |
|
80 state.SetLength( 1 ); |
|
81 state[0] = static_cast<TInt8>( EWlanStateNotConnected ); |
|
82 |
|
83 // create notification for all observing clients |
|
84 for ( TInt i = 0; i < iNotificationArray.Count(); i++ ) |
|
85 { |
|
86 iNotificationArray[i]->AddNotification( EWlmNotifyConnectionStateChanged, state ); |
|
87 } |
|
88 } |
|
89 else // state == not connected |
|
90 { |
|
91 if( iPlatform->IsWlanDisabled() ) |
|
92 { |
|
93 // KWlanIntCmdNull means not expecting completion for this request |
|
94 iCoreServer->disable_wlan( KWlanIntCmdNull ); |
|
95 } |
|
96 } |
|
97 } |
|
98 |
|
99 // --------------------------------------------------------- |
|
100 // CWlmServer::EnableWlan |
|
101 // --------------------------------------------------------- |
|
102 // |
|
103 inline void CWlmServer::EnableWlan() |
|
104 { |
|
105 // KWlanIntCmdNull means not expecting completion for this request |
|
106 iCoreServer->enable_wlan( KWlanIntCmdNull ); |
|
107 } |
|
108 |
|
109 // --------------------------------------------------------- |
|
110 // CWlmServer::IsRoaming |
|
111 // --------------------------------------------------------- |
|
112 // |
|
113 inline TBool CWlmServer::IsRoaming() const |
|
114 { |
|
115 return iIsRoaming; |
|
116 } |
|
117 |
|
118 // --------------------------------------------------------- |
|
119 // CWlmServer::IsSessionActive |
|
120 // --------------------------------------------------------- |
|
121 // |
|
122 inline TBool CWlmServer::IsSessionActive( |
|
123 const SRequestMapEntry& aEntry ) const |
|
124 { |
|
125 return ( aEntry.iSessionId != 0); |
|
126 } |
|
127 |
|
128 // --------------------------------------------------------- |
|
129 // CWlmServer::CalculateScanStartTime |
|
130 // --------------------------------------------------------- |
|
131 // |
|
132 inline TTime CWlmServer::CalculateScanStartTime( |
|
133 const TInt aDelay ) const |
|
134 { |
|
135 TTime scanTime; |
|
136 scanTime.UniversalTime(); |
|
137 TTimeIntervalSeconds delay( aDelay ); |
|
138 scanTime += delay; |
|
139 |
|
140 return scanTime; |
|
141 } |
|
142 |
|
143 // --------------------------------------------------------- |
|
144 // CWlmServer::FindRequestIndex |
|
145 // --------------------------------------------------------- |
|
146 // |
|
147 inline TUint CWlmServer::FindRequestIndex( |
|
148 const TInt aRequestId ) const |
|
149 { |
|
150 TInt i(0); |
|
151 for( i=0; i < iRequestMap.Count(); i++ ) |
|
152 { |
|
153 if( iRequestMap[i].iRequestId == aRequestId ) |
|
154 { |
|
155 return i; |
|
156 } |
|
157 } |
|
158 return i; |
|
159 } |
|
160 |
|
161 // --------------------------------------------------------- |
|
162 // CWlmServer::IsPendingTimedScanRequest |
|
163 // --------------------------------------------------------- |
|
164 // |
|
165 inline TBool CWlmServer::IsPendingTimedScanRequest( |
|
166 const TInt aIndex ) const |
|
167 { |
|
168 return ( iRequestMap[aIndex].iTime != NULL ) && IsPendingScanRequest( aIndex ); |
|
169 } |
|
170 |
|
171 // --------------------------------------------------------- |
|
172 // CWlmServer::IsPendingScanRequest |
|
173 // --------------------------------------------------------- |
|
174 // |
|
175 inline TBool CWlmServer::IsPendingScanRequest( |
|
176 const TInt aIndex ) const |
|
177 { |
|
178 if( iRequestMap[aIndex].iRequestId == KWlanIntCmdBackgroundScan ) |
|
179 { |
|
180 return ETrue; |
|
181 } |
|
182 else if( iRequestMap[aIndex].iRequestId >= KWlanExtCmdBase && |
|
183 iRequestMap[aIndex].iFunction == EGetAvailableIaps ) |
|
184 { |
|
185 return ETrue; |
|
186 } |
|
187 else if( iRequestMap[aIndex].iRequestId >= KWlanExtCmdBase && |
|
188 iRequestMap[aIndex].iFunction == EGetScanResults ) |
|
189 { |
|
190 return ETrue; |
|
191 } |
|
192 else |
|
193 { |
|
194 return EFalse; |
|
195 } |
|
196 |
|
197 } |
|
198 |
|
199 // End of File |