46
|
1 |
/*
|
|
2 |
* Copyright (c) 2001-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 CWiFiProtActiveResp class
|
|
15 |
*
|
|
16 |
*/
|
|
17 |
|
|
18 |
/*
|
|
19 |
* %version: tr1cfwln#9 %
|
|
20 |
*/
|
|
21 |
|
|
22 |
// INCLUDE FILES
|
|
23 |
#include "wifiprotactiveresp.h"
|
|
24 |
#include "wifiprotlogger.h"
|
|
25 |
|
|
26 |
//CONSTS
|
|
27 |
_LIT( KActiveRespPanic , "WPS Active Resp");
|
|
28 |
// ================= MEMBER FUNCTIONS =======================
|
|
29 |
|
|
30 |
|
|
31 |
// --------------------------------------------------------------------------
|
|
32 |
// CWiFiProtActiveResp::NewL
|
|
33 |
// --------------------------------------------------------------------------
|
|
34 |
//
|
|
35 |
CWiFiProtActiveResp* CWiFiProtActiveResp::NewL( const TWlanSsid& aSSid,
|
|
36 |
TBool aConnectionNeeded,
|
|
37 |
RArray<TUint32>& aUidsReturned,
|
|
38 |
WiFiProt::TWiFiReturn&
|
|
39 |
aReturnValue )
|
|
40 |
{
|
|
41 |
CLOG_ENTERFN( "CWiFiProtActiveResp::NewL" );
|
|
42 |
CWiFiProtActiveResp* self =
|
|
43 |
new( ELeave )CWiFiProtActiveResp( aSSid , aConnectionNeeded,
|
|
44 |
aUidsReturned,
|
|
45 |
aReturnValue );
|
|
46 |
CleanupStack::PushL( self );
|
|
47 |
self->ConstructL();
|
|
48 |
CleanupStack::Pop( self );
|
|
49 |
|
|
50 |
CLOG_LEAVEFN( "CWiFiProtActiveResp::NewL" );
|
|
51 |
return self;
|
|
52 |
}
|
|
53 |
|
|
54 |
// --------------------------------------------------------------------------
|
|
55 |
// CWiFiProtActiveResp::NewL
|
|
56 |
// --------------------------------------------------------------------------
|
|
57 |
//
|
|
58 |
CWiFiProtActiveResp* CWiFiProtActiveResp::NewL( const TWlanSsid& aSSid,
|
|
59 |
TWlanProtectedSetupCredentialAttribute&
|
|
60 |
aNetworkSettings,
|
|
61 |
WiFiProt::TWiFiReturn&
|
|
62 |
aReturnValue )
|
|
63 |
{
|
|
64 |
CLOG_ENTERFN( "CWiFiProtActiveResp::NewL" );
|
|
65 |
CWiFiProtActiveResp* self =
|
|
66 |
new( ELeave )CWiFiProtActiveResp( aSSid ,
|
|
67 |
aNetworkSettings,
|
|
68 |
aReturnValue );
|
|
69 |
CleanupStack::PushL( self );
|
|
70 |
self->ConstructL();
|
|
71 |
CleanupStack::Pop( self );
|
|
72 |
|
|
73 |
CLOG_LEAVEFN( "CWiFiProtActiveResp::NewL" );
|
|
74 |
return self;
|
|
75 |
}
|
|
76 |
|
|
77 |
// ----------------------------------------------------
|
|
78 |
// CWiFiProtActiveResp::~CWiFiProtActiveResp()
|
|
79 |
// ----------------------------------------------------
|
|
80 |
//
|
|
81 |
CWiFiProtActiveResp::~CWiFiProtActiveResp()
|
|
82 |
{
|
|
83 |
CLOG_ENTERFN( "CWiFiProtActiveResp::~CWiFiProtActiveResp" );
|
|
84 |
Cancel();
|
|
85 |
CLOG_LEAVEFN( "CWiFiProtActiveResp::~CWiFiProtActiveResp" );
|
|
86 |
}
|
|
87 |
|
|
88 |
// --------------------------------------------------------------------------
|
|
89 |
// CWiFiProtActiveResp::RunL
|
|
90 |
// --------------------------------------------------------------------------
|
|
91 |
//
|
|
92 |
void CWiFiProtActiveResp::RunL()
|
|
93 |
{
|
|
94 |
CLOG_ENTERFN( "CWiFiProtActiveResp::RunL");
|
|
95 |
|
|
96 |
if ( iWiFiInputParams().iConnectionNeeded )
|
|
97 |
{
|
|
98 |
*iNetworkSettings = iWiFiConnOutputParams().iNetworkSettings;
|
|
99 |
iReturnValue = iWiFiConnOutputParams().iReturn;
|
|
100 |
}
|
|
101 |
else
|
|
102 |
{
|
|
103 |
if ( iStatus.Int() == KErrNone )
|
|
104 |
{
|
|
105 |
//CM creation mode (WPS phase 1), return iap id array
|
|
106 |
const TInt elementSize = sizeof( TUint32 );
|
|
107 |
const TInt elementCount = iWiFiOutputParams().iIapIds.Length()
|
|
108 |
/ elementSize;
|
|
109 |
const TUint8* ptr = iWiFiOutputParams().iIapIds.Ptr();
|
|
110 |
|
|
111 |
for ( TInt i = 0; i < elementCount; i++)
|
|
112 |
{
|
|
113 |
iIapIds->Append( *( (TUint32*) &( ptr[elementSize*i] ) ) );
|
|
114 |
}
|
|
115 |
}
|
|
116 |
iReturnValue = iWiFiOutputParams().iReturn;
|
|
117 |
}
|
|
118 |
|
|
119 |
TRequestStatus* pS = iRequestStatus;
|
|
120 |
User::RequestComplete( pS, iStatus.Int() );
|
|
121 |
|
|
122 |
CLOG_LEAVEFN( "CWiFiProtActiveResp::RunL");
|
|
123 |
}
|
|
124 |
|
|
125 |
// --------------------------------------------------------------------------
|
|
126 |
// CWiFiProtActiveResp::DoCancel
|
|
127 |
// --------------------------------------------------------------------------
|
|
128 |
//
|
|
129 |
void CWiFiProtActiveResp::DoCancel()
|
|
130 |
{
|
|
131 |
CLOG_ENTERFN( "CWiFiProtActiveResp:DoCancel");
|
|
132 |
TRequestStatus* pS = iRequestStatus;
|
|
133 |
User::RequestComplete( pS, KErrCancel );
|
|
134 |
CLOG_LEAVEFN( "CWiFiProtActiveResp::DoCancel");
|
|
135 |
}
|
|
136 |
|
|
137 |
// --------------------------------------------------------------------------
|
|
138 |
// CWiFiProtActiveResp::Observe
|
|
139 |
// --------------------------------------------------------------------------
|
|
140 |
//
|
|
141 |
void CWiFiProtActiveResp::Observe( TRequestStatus &aStatus )
|
|
142 |
{
|
|
143 |
CLOG_ENTERFN( "CWiFiProtActiveResp::Observe");
|
|
144 |
CActiveScheduler::Add( this );
|
|
145 |
|
|
146 |
iRequestStatus = &aStatus;
|
|
147 |
*iRequestStatus = KRequestPending;
|
|
148 |
|
|
149 |
SetActive();
|
|
150 |
CLOG_LEAVEFN( "CWiFiProtActiveResp::Observe");
|
|
151 |
}
|
|
152 |
|
|
153 |
// --------------------------------------------------------------------------
|
|
154 |
// CWiFiProtActiveResp::InputBuffer
|
|
155 |
// --------------------------------------------------------------------------
|
|
156 |
//
|
|
157 |
TPckgBuf<WiFiProt::TWiFiInputParams>* CWiFiProtActiveResp::InputBuffer()
|
|
158 |
{
|
|
159 |
return &iWiFiInputParams;
|
|
160 |
}
|
|
161 |
|
|
162 |
// --------------------------------------------------------------------------
|
|
163 |
// CWiFiProtActiveResp::OutputBuffer
|
|
164 |
// --------------------------------------------------------------------------
|
|
165 |
//
|
|
166 |
TPckgBuf<WiFiProt::TWiFiOutputParams>* CWiFiProtActiveResp::OutputBuffer()
|
|
167 |
{
|
|
168 |
if ( iWiFiInputParams().iConnectionNeeded )
|
|
169 |
{
|
|
170 |
// Should use ConnOutputBuffer() if configuring a connection!
|
|
171 |
User::Panic( KActiveRespPanic , KErrNotSupported);
|
|
172 |
}
|
|
173 |
return &iWiFiOutputParams;
|
|
174 |
}
|
|
175 |
|
|
176 |
// --------------------------------------------------------------------------
|
|
177 |
// CWiFiProtActiveResp::ConnOutputBuffer
|
|
178 |
// --------------------------------------------------------------------------
|
|
179 |
//
|
|
180 |
TPckgBuf<WiFiProt::TWiFiConnOutputParams>* CWiFiProtActiveResp::ConnOutputBuffer()
|
|
181 |
{
|
|
182 |
if ( !(iWiFiInputParams().iConnectionNeeded) )
|
|
183 |
{
|
|
184 |
// Should use OutputBuffer() if not configuring a connection!
|
|
185 |
User::Panic( KActiveRespPanic , KErrNotSupported);
|
|
186 |
}
|
|
187 |
return &iWiFiConnOutputParams;
|
|
188 |
}
|
|
189 |
|
|
190 |
// --------------------------------------------------------------------------
|
|
191 |
// CWiFiProtActiveResp::CWiFiProtActiveResp
|
|
192 |
// --------------------------------------------------------------------------
|
|
193 |
//
|
|
194 |
CWiFiProtActiveResp::CWiFiProtActiveResp(
|
|
195 |
const TWlanSsid& aSSid, TBool aConnectionNeeded,
|
|
196 |
RArray<TUint32>& aUidsReturned,
|
|
197 |
WiFiProt::TWiFiReturn& aReturnValue )
|
|
198 |
: CActive( CActive::EPriorityUserInput ),
|
|
199 |
iIapIds( &aUidsReturned ),
|
|
200 |
iReturnValue( aReturnValue ),
|
|
201 |
iWiFiOutputParams( KNullDesC8() ),
|
|
202 |
iWiFiInputParams( TPckgBuf<WiFiProt::TWiFiInputParams>
|
|
203 |
( WiFiProt::TWiFiInputParams( aSSid,
|
|
204 |
aConnectionNeeded ) ) ),
|
|
205 |
iWiFiConnOutputParams(TPckgBuf<WiFiProt::TWiFiConnOutputParams>
|
|
206 |
( WiFiProt::TWiFiConnOutputParams(
|
|
207 |
TWlanProtectedSetupCredentialAttribute() ) ) )
|
|
208 |
{
|
|
209 |
}
|
|
210 |
|
|
211 |
// --------------------------------------------------------------------------
|
|
212 |
// CWiFiProtActiveResp::CWiFiProtActiveResp
|
|
213 |
// --------------------------------------------------------------------------
|
|
214 |
//
|
|
215 |
CWiFiProtActiveResp::CWiFiProtActiveResp(
|
|
216 |
const TWlanSsid& aSSid,
|
|
217 |
TWlanProtectedSetupCredentialAttribute&
|
|
218 |
aNetworkSettings,
|
|
219 |
WiFiProt::TWiFiReturn& aReturnValue )
|
|
220 |
: CActive( CActive::EPriorityUserInput ),
|
|
221 |
iIapIds( NULL ),
|
|
222 |
iReturnValue( aReturnValue ),
|
|
223 |
iWiFiOutputParams( KNullDesC8() ),
|
|
224 |
iWiFiInputParams( TPckgBuf<WiFiProt::TWiFiInputParams>
|
|
225 |
( WiFiProt::TWiFiInputParams( aSSid,
|
|
226 |
ETrue ) ) ),
|
|
227 |
iWiFiConnOutputParams(TPckgBuf<WiFiProt::TWiFiConnOutputParams>
|
|
228 |
( WiFiProt::TWiFiConnOutputParams(
|
|
229 |
TWlanProtectedSetupCredentialAttribute() ) ) ),
|
|
230 |
iNetworkSettings( &aNetworkSettings )
|
|
231 |
|
|
232 |
{
|
|
233 |
}
|
|
234 |
|
|
235 |
// --------------------------------------------------------------------------
|
|
236 |
// CWiFiProtActiveResp::ConstructL
|
|
237 |
// --------------------------------------------------------------------------
|
|
238 |
//
|
|
239 |
void CWiFiProtActiveResp::ConstructL()
|
|
240 |
{
|
|
241 |
}
|
|
242 |
|
|
243 |
// End of File
|