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