|
1 /* |
|
2 * Copyright (c) 2002-2007 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 WlanWsaJoin class |
|
15 * |
|
16 */ |
|
17 |
|
18 /* |
|
19 * %version: 14 % |
|
20 */ |
|
21 |
|
22 #include "config.h" |
|
23 #include "UmacWsaJoin.h" |
|
24 #include "UmacContextImpl.h" |
|
25 |
|
26 #ifndef NDEBUG |
|
27 const TInt8 WlanWsaJoin::iName[] = "wsa-join"; |
|
28 #endif |
|
29 |
|
30 // ======== MEMBER FUNCTIONS ======== |
|
31 |
|
32 // --------------------------------------------------------------------------- |
|
33 // |
|
34 // --------------------------------------------------------------------------- |
|
35 // |
|
36 WlanWsaJoin::WlanWsaJoin() : |
|
37 iMode( static_cast<WHA::TOperationMode>(0) ), |
|
38 iBSSID ( WHA::KZeroMacAddr), iBand( 0 ), |
|
39 iChannel( 0 ), iBeaconInterval( 0 ), |
|
40 iBasicRateSet( 0 ), iAtimWindow( 0 ), |
|
41 iPreambleType( static_cast<WHA::TPreamble>(0) ), |
|
42 iProbeForJoin( EFalse ) |
|
43 { |
|
44 iSSID.iSSIDLength = 0; |
|
45 os_memset( &iSSID.iSSID, 0, sizeof( iSSID.iSSID ) ); |
|
46 } |
|
47 |
|
48 // --------------------------------------------------------------------------- |
|
49 // |
|
50 // --------------------------------------------------------------------------- |
|
51 // |
|
52 void WlanWsaJoin::Entry( WlanContextImpl& aCtxImpl ) |
|
53 { |
|
54 // mark WSA cmd active |
|
55 aCtxImpl.ActivateWsaCmd(); |
|
56 |
|
57 #ifndef NDEBUG |
|
58 OsTracePrint( KWsaCmdStateDetails, (TUint8*) |
|
59 ("UMAC: WlanWsaJoin::Entry") ); |
|
60 OsTracePrint( KWsaCmdStateDetails, (TUint8*) |
|
61 ("UMAC: WlanWsaJoin::Entry: iMode: %d"), |
|
62 iMode ); |
|
63 |
|
64 OsTracePrint( KWsaCmdStateDetails, |
|
65 (TUint8*)("UMAC: WlanWsaJoin::Entry(): BSSID:"), |
|
66 reinterpret_cast<const ::TMacAddress&>(iBSSID) ); |
|
67 |
|
68 OsTracePrint( KWsaCmdStateDetails, |
|
69 (TUint8*)("UMAC: WlanWsaJoin::Entry: SSID:") ); |
|
70 TUint8 ssidTraceBuf[KMaxSSIDLength + 1]; // + 1 for NULL termination |
|
71 os_memset( ssidTraceBuf, 0, sizeof( ssidTraceBuf ) ); |
|
72 os_memcpy( ssidTraceBuf, iSSID.iSSID, iSSID.iSSIDLength ); |
|
73 OsTracePrint( KWsaCmdStateDetails, ssidTraceBuf ); |
|
74 |
|
75 OsTracePrint( KWsaCmdStateDetails, (TUint8*) |
|
76 ("UMAC: WlanWsaJoin::Entry: iChannel: %d"), |
|
77 iChannel ); |
|
78 OsTracePrint( KWsaCmdStateDetails, (TUint8*) |
|
79 ("UMAC: WlanWsaJoin::Entry: iBeaconInterval: %d"), |
|
80 iBeaconInterval ); |
|
81 OsTracePrint( KWsaCmdStateDetails, (TUint8*) |
|
82 ("UMAC: WlanWsaJoin::Entry: iBasicRateSet: 0x%08x"), |
|
83 iBasicRateSet ); |
|
84 OsTracePrint( KWsaCmdStateDetails, (TUint8*) |
|
85 ("UMAC: WlanWsaJoin::Entry: iAtimWindow: %d"), |
|
86 iAtimWindow ); |
|
87 OsTracePrint( KWsaCmdStateDetails, (TUint8*) |
|
88 ("UMAC: WlanWsaJoin::Entry: iPreambleType: %d"), |
|
89 iPreambleType ); |
|
90 OsTracePrint( KWsaCmdStateDetails, (TUint8*)("UMAC: WlanWsaJoin::Entry(): iProbeForJoin: %d"), |
|
91 iProbeForJoin ); |
|
92 |
|
93 OsTracePrint( KWsaCmdState, (TUint8*) |
|
94 ("UMAC: WHA-CMD-Join") ); |
|
95 #endif // !NDEBUG |
|
96 |
|
97 // execute the command |
|
98 aCtxImpl.Wha().Join( |
|
99 iMode, iBSSID, iSSID, iBand, iChannel, |
|
100 iBeaconInterval, iBasicRateSet, iAtimWindow, |
|
101 iPreambleType, iProbeForJoin ); |
|
102 } |
|
103 |
|
104 // --------------------------------------------------------------------------- |
|
105 // |
|
106 // --------------------------------------------------------------------------- |
|
107 // |
|
108 void WlanWsaJoin::Set( |
|
109 WlanContextImpl& /*aCtxImpl*/, |
|
110 WHA::TOperationMode aMode, |
|
111 WHA::TMacAddress& aBSSID, |
|
112 WHA::TBand aBand, |
|
113 WHA::SSSID& aSSID, |
|
114 WHA::TChannelNumber aChannel, |
|
115 TUint32 aBeaconInterval, |
|
116 WHA::TRate aBasicRateSet, |
|
117 TUint16 aAtimWindow, |
|
118 WHA::TPreamble aPreambleType, |
|
119 TBool aProbeForJoin ) |
|
120 { |
|
121 iMode = aMode; |
|
122 iBSSID = aBSSID; |
|
123 iSSID = aSSID; |
|
124 iBand = aBand; |
|
125 iChannel = aChannel; |
|
126 iBeaconInterval = aBeaconInterval; |
|
127 iBasicRateSet = aBasicRateSet; |
|
128 iAtimWindow = aAtimWindow; |
|
129 iPreambleType = aPreambleType; |
|
130 iProbeForJoin = aProbeForJoin; |
|
131 } |
|
132 |
|
133 // --------------------------------------------------------------------------- |
|
134 // |
|
135 // --------------------------------------------------------------------------- |
|
136 // |
|
137 void WlanWsaJoin::CommandResponse( |
|
138 WlanContextImpl& aCtxImpl, |
|
139 WHA::TCommandId aCommandId, |
|
140 WHA::TStatus aStatus, |
|
141 const WHA::UCommandResponseParams& aCommandResponseParams ) |
|
142 { |
|
143 OsTracePrint( KWsaCmdState, (TUint8*) |
|
144 ("UMAC: WlanWsaJoin::CommandResponse") ); |
|
145 |
|
146 if ( aCommandId == WHA::EJoinResponse ) |
|
147 { |
|
148 TraverseToHistoryState( aCtxImpl, |
|
149 aCommandId, aStatus, aCommandResponseParams ); |
|
150 } |
|
151 else |
|
152 { |
|
153 OsTracePrint( KErrorLevel, |
|
154 (TUint8*)("UMAC: aCommandId: %d"), aCommandId ); |
|
155 OsAssert( (TUint8*)("UMAC: panic"), (TUint8*)(WLAN_FILE), __LINE__ ); |
|
156 } |
|
157 } |
|
158 |
|
159 // --------------------------------------------------------------------------- |
|
160 // |
|
161 // --------------------------------------------------------------------------- |
|
162 // |
|
163 #ifndef NDEBUG |
|
164 const TInt8* WlanWsaJoin::GetStateName( TUint8& aLength ) const |
|
165 { |
|
166 aLength = sizeof( iName ); |
|
167 return iName; |
|
168 } |
|
169 #endif |