1 /* |
1 /* |
2 * Copyright (c) 2006-2008 Nokia Corporation and/or its subsidiary(-ies). |
2 * Copyright (c) 2006-2010 Nokia Corporation and/or its subsidiary(-ies). |
3 * All rights reserved. |
3 * All rights reserved. |
4 * This component and the accompanying materials are made available |
4 * This component and the accompanying materials are made available |
5 * under the terms of "Eclipse Public License v1.0" |
5 * under the terms of "Eclipse Public License v1.0" |
6 * which accompanies this distribution, and is available |
6 * which accompanies this distribution, and is available |
7 * at the URL "http://www.eclipse.org/legal/epl-v10.html". |
7 * at the URL "http://www.eclipse.org/legal/epl-v10.html". |
69 // --------------------------------------------------------------------------- |
69 // --------------------------------------------------------------------------- |
70 // |
70 // |
71 TInt CDunUsbConfig::GetConfigValidityByIndex( TInt aIndex, TBool& aValidity ) |
71 TInt CDunUsbConfig::GetConfigValidityByIndex( TInt aIndex, TBool& aValidity ) |
72 { |
72 { |
73 FTRACE(FPrint( _L("CDunUsbConfig::GetConfigValidityByIndex()" ))); |
73 FTRACE(FPrint( _L("CDunUsbConfig::GetConfigValidityByIndex()" ))); |
74 if ( iConfigState != EUsbConfigStateIdle ) |
74 if ( IsActive() ) |
75 { |
75 { |
76 FTRACE(FPrint( _L("CDunUsbConfig::GetConfigValidityByIndex() (not ready) complete" ))); |
76 FTRACE(FPrint( _L("CDunUsbConfig::GetConfigValidityByIndex() (not ready) complete" ))); |
77 return KErrNotReady; |
77 return KErrNotReady; |
78 } |
78 } |
79 if ( !iConfigExist ) |
79 if ( !iConfigExist ) |
109 // --------------------------------------------------------------------------- |
109 // --------------------------------------------------------------------------- |
110 // |
110 // |
111 TInt CDunUsbConfig::IssueRequest() |
111 TInt CDunUsbConfig::IssueRequest() |
112 { |
112 { |
113 FTRACE(FPrint( _L("CDunUsbConfig::IssueRequest()" ))); |
113 FTRACE(FPrint( _L("CDunUsbConfig::IssueRequest()" ))); |
114 if ( iConfigState != EUsbConfigStateIdle ) |
114 if ( IsActive() ) |
115 { |
115 { |
116 FTRACE(FPrint( _L("CDunUsbConfig::IssueRequest() (not ready) complete" ))); |
116 FTRACE(FPrint( _L("CDunUsbConfig::IssueRequest() (not ready) complete" ))); |
117 return KErrNotReady; |
117 return KErrNotReady; |
118 } |
118 } |
119 iStatus = KRequestPending; |
|
120 iConfigState = EUsbConfigStateWaiting; |
|
121 iAcmProperty.Subscribe( iStatus ); |
119 iAcmProperty.Subscribe( iStatus ); |
122 SetActive(); |
120 SetActive(); |
123 FTRACE(FPrint( _L("CDunUsbConfig::IssueRequest() complete" ))); |
121 FTRACE(FPrint( _L("CDunUsbConfig::IssueRequest() complete" ))); |
124 return KErrNone; |
122 return KErrNone; |
125 } |
123 } |
126 |
124 |
127 // --------------------------------------------------------------------------- |
125 // --------------------------------------------------------------------------- |
128 // Stops listening for ACM configuration changes |
126 // Stops listening for ACM configuration changes |
129 // --------------------------------------------------------------------------- |
127 // --------------------------------------------------------------------------- |
130 // |
128 // |
131 TInt CDunUsbConfig::Stop() |
129 void CDunUsbConfig::Stop() |
132 { |
130 { |
133 FTRACE(FPrint( _L("CDunUsbConfig::Stop()" ))); |
131 FTRACE(FPrint( _L("CDunUsbConfig::Stop()" ))); |
134 if ( iConfigState != EUsbConfigStateWaiting ) |
|
135 { |
|
136 FTRACE(FPrint( _L("CDunUsbConfig::Stop() (not ready) complete" ))); |
|
137 return KErrNotReady; |
|
138 } |
|
139 iAcmProperty.Cancel(); |
|
140 Cancel(); |
132 Cancel(); |
141 iConfigState = EUsbConfigStateIdle; |
|
142 FTRACE(FPrint( _L("CDunUsbConfig::Stop() complete" ))); |
133 FTRACE(FPrint( _L("CDunUsbConfig::Stop() complete" ))); |
143 return KErrNone; |
|
144 } |
134 } |
145 |
135 |
146 // --------------------------------------------------------------------------- |
136 // --------------------------------------------------------------------------- |
147 // CDunUsbConfig::CDunUsbConfig |
137 // CDunUsbConfig::CDunUsbConfig |
148 // --------------------------------------------------------------------------- |
138 // --------------------------------------------------------------------------- |
180 // |
170 // |
181 void CDunUsbConfig::Initialize() |
171 void CDunUsbConfig::Initialize() |
182 { |
172 { |
183 // Don't initialize iCallback here (it is set through NewL) |
173 // Don't initialize iCallback here (it is set through NewL) |
184 // Don't initialize iProtocol here (it is set through NewL) |
174 // Don't initialize iProtocol here (it is set through NewL) |
185 iConfigState = EUsbConfigStateIdle; |
|
186 iConfig.iAcmConfigVersion = 0; |
175 iConfig.iAcmConfigVersion = 0; |
187 iConfig.iAcmCount = 0; |
176 iConfig.iAcmCount = 0; |
188 iConfigExist = EFalse; |
177 iConfigExist = EFalse; |
189 } |
178 } |
190 |
179 |
226 // --------------------------------------------------------------------------- |
215 // --------------------------------------------------------------------------- |
227 // |
216 // |
228 void CDunUsbConfig::RunL() |
217 void CDunUsbConfig::RunL() |
229 { |
218 { |
230 FTRACE(FPrint( _L("CDunUsbConfig::RunL()" ))); |
219 FTRACE(FPrint( _L("CDunUsbConfig::RunL()" ))); |
231 iConfigState = EUsbConfigStateIdle; |
|
232 |
220 |
233 TPublishedAcmConfigs newConfig; |
221 TPublishedAcmConfigs newConfig; |
234 TInt retTemp = GetConfiguration( newConfig ); |
222 TInt retTemp = GetConfiguration( newConfig ); |
235 if ( retTemp != KErrNone ) |
223 if ( retTemp != KErrNone ) |
236 { |
224 { |
287 // Gets called on cancel |
275 // Gets called on cancel |
288 // --------------------------------------------------------------------------- |
276 // --------------------------------------------------------------------------- |
289 // |
277 // |
290 void CDunUsbConfig::DoCancel() |
278 void CDunUsbConfig::DoCancel() |
291 { |
279 { |
292 } |
280 FTRACE(FPrint( _L("CDunUsbConfig::DoCancel()" ))); |
|
281 iAcmProperty.Cancel(); |
|
282 FTRACE(FPrint( _L("CDunUsbConfig::DoCancel() complete" ))); |
|
283 } |