|
1 /* |
|
2 * Copyright (c) 2007-2008 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 "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 CWsfConnectActiveWrapper. |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 |
|
20 // INCLUDE FILES |
|
21 #include "wsflogger.h" |
|
22 #include "wsfmodel.h" |
|
23 #include "wsfwlaninfoarray.h" |
|
24 #include "wsfconnectactivewrapper.h" |
|
25 |
|
26 |
|
27 // -------------------------------------------------------------------------- |
|
28 // CWsfConnectActiveWrapper::CWsfConnectActiveWrapper |
|
29 // -------------------------------------------------------------------------- |
|
30 // |
|
31 CWsfConnectActiveWrapper::CWsfConnectActiveWrapper() : |
|
32 CActive(EPriorityStandard) // Standard priority |
|
33 { |
|
34 } |
|
35 |
|
36 |
|
37 // -------------------------------------------------------------------------- |
|
38 // CWsfConnectActiveWrapper::NewLC |
|
39 // -------------------------------------------------------------------------- |
|
40 // |
|
41 CWsfConnectActiveWrapper* CWsfConnectActiveWrapper::NewLC( CWsfModel* aModel ) |
|
42 { |
|
43 LOG_ENTERFN( "CWsfConnectActiveWrapper::NewLC" ); |
|
44 CWsfConnectActiveWrapper* self = |
|
45 new (ELeave) CWsfConnectActiveWrapper(); |
|
46 CleanupStack::PushL(self); |
|
47 self->ConstructL( aModel ); |
|
48 return self; |
|
49 } |
|
50 |
|
51 |
|
52 // -------------------------------------------------------------------------- |
|
53 // CWsfConnectActiveWrapper::NewL |
|
54 // -------------------------------------------------------------------------- |
|
55 // |
|
56 CWsfConnectActiveWrapper* CWsfConnectActiveWrapper::NewL( CWsfModel* aModel ) |
|
57 { |
|
58 LOG_ENTERFN( "CWsfConnectActiveWrapper::NewL" ); |
|
59 CWsfConnectActiveWrapper* self = |
|
60 CWsfConnectActiveWrapper::NewLC( aModel ); |
|
61 CleanupStack::Pop(); // self; |
|
62 return self; |
|
63 } |
|
64 |
|
65 |
|
66 // -------------------------------------------------------------------------- |
|
67 // CWsfConnectActiveWrapper::ConstructL |
|
68 // -------------------------------------------------------------------------- |
|
69 // |
|
70 void CWsfConnectActiveWrapper::ConstructL( CWsfModel* aModel ) |
|
71 { |
|
72 LOG_ENTERFN( "CWsfConnectActiveWrapper::ConstructL" ); |
|
73 CActiveScheduler::Add(this); // Add to scheduler |
|
74 iModel = aModel; |
|
75 } |
|
76 |
|
77 |
|
78 // -------------------------------------------------------------------------- |
|
79 // CWsfConnectActiveWrapper::~CWsfConnectActiveWrapper |
|
80 // -------------------------------------------------------------------------- |
|
81 // |
|
82 CWsfConnectActiveWrapper::~CWsfConnectActiveWrapper() |
|
83 { |
|
84 LOG_ENTERFN( |
|
85 "CWsfConnectActiveWrapper::~CWsfConnectActiveWrapper" ); |
|
86 Cancel(); // Cancel any request, if outstanding |
|
87 // Delete instance variables if any |
|
88 } |
|
89 |
|
90 |
|
91 // -------------------------------------------------------------------------- |
|
92 // CWsfConnectActiveWrapper::DoCancel |
|
93 // -------------------------------------------------------------------------- |
|
94 // |
|
95 void CWsfConnectActiveWrapper::DoCancel() |
|
96 { |
|
97 LOG_ENTERFN( "CWsfConnectActiveWrapper::DoCancel" ); |
|
98 TRAP_IGNORE( iModel->AbortConnectingL() ); |
|
99 } |
|
100 |
|
101 |
|
102 // -------------------------------------------------------------------------- |
|
103 // CWsfConnectActiveWrapper::StartL |
|
104 // -------------------------------------------------------------------------- |
|
105 // |
|
106 void CWsfConnectActiveWrapper::Start(TUint aIapID, TWsfIapPersistence aPersistence ) |
|
107 { |
|
108 LOG_ENTERFN( "CWsfConnectActiveWrapper::Start" ); |
|
109 Cancel(); // Cancel any request, just to be sure |
|
110 iState = EUninitialized; |
|
111 iIapID = aIapID; |
|
112 iPersistence = aPersistence; |
|
113 SetActive(); |
|
114 TRequestStatus* status = &iStatus; |
|
115 User::RequestComplete( status, KErrNone ); |
|
116 } |
|
117 |
|
118 |
|
119 // -------------------------------------------------------------------------- |
|
120 // CWsfConnectActiveWrapper::RunL |
|
121 // -------------------------------------------------------------------------- |
|
122 // |
|
123 void CWsfConnectActiveWrapper::RunL() |
|
124 { |
|
125 LOG_ENTERFN( "CWsfConnectActiveWrapper::RunL" ); |
|
126 if (iState == EUninitialized) |
|
127 { |
|
128 LOG_WRITE( "Start connect" ); |
|
129 iModel->ConnectL( iPckg, iIapID, iPersistence, iStatus ); |
|
130 iState = EInitialized; |
|
131 SetActive(); // Tell scheduler a request is active |
|
132 } |
|
133 else if (iState == EInitialized ) |
|
134 { |
|
135 LOG_WRITEF( "request result = %d", iPckg() ); |
|
136 iModel->SetConnectResultL(iPckg(), iIapID ); |
|
137 } |
|
138 else |
|
139 { |
|
140 LOG_WRITEF( "iState = %d", iState ); |
|
141 } |
|
142 } |
|
143 |
|
144 |
|
145 // -------------------------------------------------------------------------- |
|
146 // CWsfConnectActiveWrapper::RunError |
|
147 // -------------------------------------------------------------------------- |
|
148 // |
|
149 #ifdef _DEBUG |
|
150 TInt CWsfConnectActiveWrapper::RunError( TInt aError ) |
|
151 { |
|
152 LOG_ENTERFN( "CWsfConnectActiveWrapper::RunError" ); |
|
153 LOG_WRITEF( "aError = %d", aError ); |
|
154 TRAP_IGNORE( iModel->SetConnectResultL(iPckg(), iIapID ) ); |
|
155 return aError; |
|
156 } |
|
157 #else |
|
158 TInt CWsfConnectActiveWrapper::RunError( TInt /*aError*/ ) |
|
159 { |
|
160 TRAP_IGNORE( iModel->SetConnectResultL(iPckg(), iIapID ) ); |
|
161 return KErrNone; |
|
162 } |
|
163 #endif |
|
164 |
|
165 |
|
166 |