usbmgmt/usbmgrtest/usbmsapp/usbms_stub/src/usbms_stub.cpp
branchRCL_3
changeset 16 012cc2ee6408
parent 15 f92a4f87e424
equal deleted inserted replaced
15:f92a4f87e424 16:012cc2ee6408
     1 /*
     1 /*
     2 * Copyright (c) 1997-2010 Nokia Corporation and/or its subsidiary(-ies).
     2 * Copyright (c) 1997-2009 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".
    20 
    20 
    21 /**
    21 /**
    22  @file
    22  @file
    23 */
    23 */
    24 
    24 
       
    25 #include "usbms_stub.h"
    25 #include <usb_std.h>
    26 #include <usb_std.h>
    26 #include <es_ini.h>
    27 #include <es_ini.h>
    27 #include <d32usbc.h>
    28 #include <d32usbc.h>
    28 
    29 
    29 #include "usbms_stub.h"
       
    30 #include "UsbmanInternalConstants.h"
    30 #include "UsbmanInternalConstants.h"
    31 
    31 
    32 #include "OstTraceDefinitions.h"
    32 #define _USB_PANIC(CAT, CODE)	User::Panic(CAT, CODE) 
    33 #ifdef OST_TRACE_COMPILER_IN_USE
       
    34 #include "usbms_stubTraces.h"
       
    35 #endif
       
    36 
    33 
    37 // Panic category 
    34 // Panic category 
    38 _LIT( Kstub3CcPanicCategory, "UsbstubCc" );
    35 _LIT( Kstub3CcPanicCategory, "UsbstubCc" );
    39 
    36 
    40 
    37 
    81 CUsbstub3ClassController::~CUsbstub3ClassController()
    78 CUsbstub3ClassController::~CUsbstub3ClassController()
    82 	{
    79 	{
    83 	Cancel();
    80 	Cancel();
    84 
    81 
    85 	iTimer.Close();
    82 	iTimer.Close();
       
    83 
       
    84 #ifndef __WINS__	
       
    85 //	iLdd.Close();
       
    86 #endif
       
    87 
    86 	}
    88 	}
    87 
    89 
    88 
    90 
    89 
    91 
    90 /**
    92 /**
   189 /**
   191 /**
   190  * Standard active object RunL. 
   192  * Standard active object RunL. 
   191  */
   193  */
   192 void CUsbstub3ClassController::RunL()
   194 void CUsbstub3ClassController::RunL()
   193 	{
   195 	{
   194     if(iStatus != KErrNone)
   196 
   195     {
   197 	__ASSERT_DEBUG( iStatus == KErrNone, _USB_PANIC(Kstub3CcPanicCategory, EPanicUnexpectedStatus) );
   196         OstTrace1( TRACE_FATAL, CUSBSTUB3CLASSCONTROLLER_RUNL, 
       
   197                         "CUsbstub3ClassController::RunL panic with error %d", 
       
   198                         EPanicUnexpectedState);
       
   199         
       
   200         __ASSERT_DEBUG(EFalse, User::Panic(Kstub3CcPanicCategory, EPanicUnexpectedStatus));
       
   201     }
       
   202 	
       
   203 	switch (iState)
   198 	switch (iState)
   204 		{
   199 		{
   205 		case EUsbServiceStarting:
   200 		case EUsbServiceStarting:
   206 			iState = EUsbServiceStarted;
   201 			iState = EUsbServiceStarted;
   207 			break;
   202 			break;
   208 		case EUsbServiceStopping:
   203 		case EUsbServiceStopping:
   209 			iState = EUsbServiceIdle;
   204 			iState = EUsbServiceIdle;
   210 			break;
   205 			break;
   211 		default:
   206 		default:	
   212 		    OstTrace1( TRACE_FATAL, CUSBSTUB3CLASSCONTROLLER_RUNL_DUP1, 
   207 			_USB_PANIC(Kstub3CcPanicCategory, EPanicUnexpectedState);
   213 		            "CUsbstub3ClassController::RunL panic with error %d", EPanicUnexpectedState);
       
   214 		    User::Panic(Kstub3CcPanicCategory,EPanicUnexpectedState);
       
   215 		}
   208 		}
   216 	*iReportStatus = KErrNone;	
   209 	*iReportStatus = KErrNone;	
   217 	User::RequestComplete(iReportStatus, iStatus.Int());	
   210 	User::RequestComplete(iReportStatus, iStatus.Int());	
   218 	}
   211 	}
   219 
   212 
   234 			iState = EUsbServiceIdle;
   227 			iState = EUsbServiceIdle;
   235 			break;
   228 			break;
   236 		case EUsbServiceStopping:
   229 		case EUsbServiceStopping:
   237 			iState = EUsbServiceStarted;
   230 			iState = EUsbServiceStarted;
   238 			break;
   231 			break;
   239 		default:
   232 		default:	
   240 		    OstTrace1( TRACE_FATAL, CUSBSTUB3CLASSCONTROLLER_DOCANCEL, 
   233 			_USB_PANIC(Kstub3CcPanicCategory, EPanicUnexpectedState);
   241 		                                "CUsbstub3ClassController::DoCancel panic with error %d", 
       
   242 		                                EPanicUnexpectedState);
       
   243 			User::Panic(Kstub3CcPanicCategory, EPanicUnexpectedState);
       
   244 	}
   234 	}
   245 	*iReportStatus = KErrNone;		
   235 	*iReportStatus = KErrNone;		
   246 	User::RequestComplete(iReportStatus, KErrCancel);	
   236 	User::RequestComplete(iReportStatus, KErrCancel);	
   247 	}
   237 	}
   248 
   238 
   253  * @param aError The error code (unused)
   243  * @param aError The error code (unused)
   254  * @return Always KErrNone to avoid an active scheduler panic
   244  * @return Always KErrNone to avoid an active scheduler panic
   255  */
   245  */
   256 TInt CUsbstub3ClassController::RunError(TInt /*aError*/)
   246 TInt CUsbstub3ClassController::RunError(TInt /*aError*/)
   257 	{
   247 	{
   258     OstTrace1( TRACE_FATAL, CUSBSTUB3CLASSCONTROLLER_RUNERROR, 
   248 	__ASSERT_DEBUG( EFalse, _USB_PANIC(Kstub3CcPanicCategory, EUnusedFunction) );
   259                             "CUsbstub3ClassController::RunError panic with error %d", 
       
   260                             EUnusedFunction);
       
   261 	__ASSERT_DEBUG( EFalse, User::Panic(Kstub3CcPanicCategory, EUnusedFunction));
       
   262 	return KErrNone;
   249 	return KErrNone;
   263 	}
   250 	}
   264 
   251 
   265 TInt CUsbstub3ClassController::SetUpInterface()
   252 TInt CUsbstub3ClassController::SetUpInterface()
   266 /**
   253 /**
   267  * Set up the interface for use. This involves finding a "Interrupt IN" 
   254  * Set up the interface for use. This involves finding a "Interrupt IN" 
   268  * endpoint and, if found, configuring the interface.
   255  * endpoint and, if found, configuring the interface.
   269  */
   256  */
   270 	{
   257 	{
   271     return 0;
   258 return 0;
   272 	}
   259 	}
   273 
   260 
   274 	
   261 	
   275 //
   262 //
   276 // End of file
   263 // End of file