equal
deleted
inserted
replaced
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". |
105 |
105 |
106 // --------------------------------------------------------------------------- |
106 // --------------------------------------------------------------------------- |
107 // Stops listening |
107 // Stops listening |
108 // --------------------------------------------------------------------------- |
108 // --------------------------------------------------------------------------- |
109 // |
109 // |
110 TInt CDunUsbListen::Stop() |
110 void CDunUsbListen::Stop() |
111 { |
111 { |
112 FTRACE(FPrint( _L( "CDunUsbListen::Stop()" ) )); |
112 FTRACE(FPrint( _L( "CDunUsbListen::Stop()" ) )); |
113 if ( iListenState != EUsbListenStateListening ) |
|
114 { |
|
115 FTRACE(FPrint( _L( "CDunUsbListen::Stop() (not ready) complete" ) )); |
|
116 return KErrNotReady; |
|
117 } |
|
118 iUsbServer.DeviceStateNotificationCancel(); |
|
119 Cancel(); |
113 Cancel(); |
120 iListenState = EUsbListenStateIdle; |
|
121 iDeviceState = EUsbDeviceStateUndefined; |
114 iDeviceState = EUsbDeviceStateUndefined; |
122 iDeviceStatePrev = EUsbDeviceStateUndefined; |
115 iDeviceStatePrev = EUsbDeviceStateUndefined; |
123 FTRACE(FPrint( _L( "CDunUsbListen::Stop() complete" ) )); |
116 FTRACE(FPrint( _L( "CDunUsbListen::Stop() complete" ) )); |
124 return KErrNone; |
|
125 } |
117 } |
126 |
118 |
127 // --------------------------------------------------------------------------- |
119 // --------------------------------------------------------------------------- |
128 // CDunUsbListen::CDunUsbListen |
120 // CDunUsbListen::CDunUsbListen |
129 // --------------------------------------------------------------------------- |
121 // --------------------------------------------------------------------------- |
173 // |
165 // |
174 TInt CDunUsbListen::Activate() |
166 TInt CDunUsbListen::Activate() |
175 { |
167 { |
176 FTRACE(FPrint( _L( "CDunUsbListen::Activate()" ) )); |
168 FTRACE(FPrint( _L( "CDunUsbListen::Activate()" ) )); |
177 |
169 |
178 if ( iListenState != EUsbListenStateIdle ) |
170 if ( IsActive() ) |
179 { |
171 { |
180 FTRACE(FPrint( _L( "CDunUsbListen::Activate() (not ready) complete" ) )); |
172 FTRACE(FPrint( _L( "CDunUsbListen::Activate() (not ready) complete" ) )); |
181 return KErrNotReady; |
173 return KErrNotReady; |
182 } |
174 } |
183 iDeviceStatePrev = iDeviceState; |
175 iDeviceStatePrev = iDeviceState; |
184 iStatus = KRequestPending; |
|
185 iListenState = EUsbListenStateListening; |
|
186 iUsbServer.DeviceStateNotification( KDunUsbDeviceStateMask, |
176 iUsbServer.DeviceStateNotification( KDunUsbDeviceStateMask, |
187 iDeviceState, |
177 iDeviceState, |
188 iStatus ); |
178 iStatus ); |
189 SetActive(); |
179 SetActive(); |
190 FTRACE(FPrint( _L( "CDunUsbListen::Activate() complete" ) )); |
180 FTRACE(FPrint( _L( "CDunUsbListen::Activate() complete" ) )); |
197 // --------------------------------------------------------------------------- |
187 // --------------------------------------------------------------------------- |
198 // |
188 // |
199 void CDunUsbListen::RunL() |
189 void CDunUsbListen::RunL() |
200 { |
190 { |
201 FTRACE(FPrint( _L( "CDunUsbListen::RunL() iStatus=%d"), iStatus.Int() )); |
191 FTRACE(FPrint( _L( "CDunUsbListen::RunL() iStatus=%d"), iStatus.Int() )); |
202 iListenState = EUsbListenStateIdle; |
|
203 |
192 |
204 if ( iStatus.Int() != KErrNone ) |
193 if ( iStatus.Int() != KErrNone ) |
205 { |
194 { |
206 FTRACE(FPrint( _L( "CDunUsbListen::RunL() (ERROR) complete" ))); |
195 FTRACE(FPrint( _L( "CDunUsbListen::RunL() (ERROR) complete" ))); |
207 iServer->NotifyPluginCloseRequest( KDunUsbPluginUid, ETrue ); |
196 iServer->NotifyPluginCloseRequest( KDunUsbPluginUid, ETrue ); |
254 // Cancel current activity. |
243 // Cancel current activity. |
255 // --------------------------------------------------------------------------- |
244 // --------------------------------------------------------------------------- |
256 // |
245 // |
257 void CDunUsbListen::DoCancel() |
246 void CDunUsbListen::DoCancel() |
258 { |
247 { |
259 } |
248 FTRACE(FPrint( _L( "CDunUsbListen::DoCancel()" ))); |
|
249 iUsbServer.DeviceStateNotificationCancel(); |
|
250 FTRACE(FPrint( _L( "CDunUsbListen::DoCancel() complete" ))); |
|
251 } |