usbclasses/usbbasicpersonality/src/CUsbActiveBasicHandler.cpp
changeset 35 9d8b04ca6939
parent 0 1e05558e2206
equal deleted inserted replaced
34:7858bc6ead78 35:9d8b04ca6939
       
     1 /*
       
     2 * Copyright (c) 2006 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:  Basic personality implementation
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 #include <usbuinotif.h>
       
    20 #include "CUsbActiveBasicHandler.h"
       
    21 #include "cusbpersonalitynotifier.h"
       
    22 #include "debug.h"
       
    23 
       
    24 // ============================ MEMBER FUNCTIONS ==============================
       
    25 
       
    26 // ----------------------------------------------------------------------------
       
    27 // C++ default constructor can NOT contain any code, that
       
    28 // might leave.
       
    29 // ----------------------------------------------------------------------------
       
    30 //
       
    31 CUsbActiveBasicHandler::CUsbActiveBasicHandler(TUsbPersonalityParams& aPersonalityParams)
       
    32     : CUsbPersonalityPlugin(aPersonalityParams)
       
    33     {
       
    34     }
       
    35 
       
    36 // ----------------------------------------------------------------------------
       
    37 // Symbian 2nd phase constructor can leave.
       
    38 // ----------------------------------------------------------------------------
       
    39 //
       
    40 void CUsbActiveBasicHandler::ConstructL()
       
    41     {
       
    42     FLOG( _L( "[USBWATCHER]\tCUsbActiveBasicHandler: ConstructL" ) );
       
    43     }
       
    44 
       
    45 // ----------------------------------------------------------------------------
       
    46 // Two-phased constructor.
       
    47 // ----------------------------------------------------------------------------
       
    48 //
       
    49 CUsbActiveBasicHandler* CUsbActiveBasicHandler::NewL(TUsbPersonalityParams& aPersonalityParams)
       
    50     {
       
    51     CUsbActiveBasicHandler* self 
       
    52         = new ( ELeave ) CUsbActiveBasicHandler(aPersonalityParams);
       
    53     CleanupStack::PushL( self );
       
    54     self->ConstructL();
       
    55     CleanupStack::Pop(); // pop self
       
    56     return self;
       
    57     }
       
    58     
       
    59 // Destructor
       
    60 CUsbActiveBasicHandler::~CUsbActiveBasicHandler()
       
    61     {
       
    62     FLOG( _L( "[USBWATCHER]\tCUsbActiveBasicHandler::~CUsbActiveBasicHandler" ) );
       
    63     }
       
    64 
       
    65 // ----------------------------------------------------------------------------
       
    66 // This function will not be called.
       
    67 // ----------------------------------------------------------------------------
       
    68 //
       
    69 void CUsbActiveBasicHandler::RunL()
       
    70     {
       
    71     }
       
    72 
       
    73 // ----------------------------------------------------------------------------
       
    74 // Standard active object error function.
       
    75 // ----------------------------------------------------------------------------
       
    76 //
       
    77 TInt CUsbActiveBasicHandler::RunError( TInt /*aError*/ )
       
    78     {
       
    79     // Currently no leaving functions called in RunL, thus nothing should cause
       
    80     // this to be called -> return.
       
    81     return KErrNone;
       
    82     }
       
    83 
       
    84 // ----------------------------------------------------------------------------
       
    85 // This is called before personality change is done.
       
    86 // ----------------------------------------------------------------------------
       
    87 //
       
    88 void CUsbActiveBasicHandler::ConfirmPersonalityUnload(TRequestStatus& aStatus)
       
    89     {
       
    90     FLOG( _L( "[USBWATCHER]\tCUsbActiveBasicHandler::ConfirmPersonalityUnload" ) );
       
    91     iRequestStatus = &aStatus;
       
    92     aStatus = KRequestPending;
       
    93     User::RequestComplete(iRequestStatus, KErrNone);        
       
    94     }
       
    95 
       
    96 // ----------------------------------------------------------------------------
       
    97 // Called by personality handler when personality start needs to be prepared.
       
    98 // ----------------------------------------------------------------------------
       
    99 //
       
   100 void CUsbActiveBasicHandler::PreparePersonalityStart(TRequestStatus& aStatus)
       
   101     {
       
   102     FLOG( _L( "[USBWATCHER]\tCUsbActiveBasicHandler: PreparePersonalityStart" ) );
       
   103     iRequestStatus = &aStatus;
       
   104     aStatus = KRequestPending;
       
   105     User::RequestComplete(iRequestStatus, KErrNone);    
       
   106     }
       
   107 
       
   108 // ----------------------------------------------------------------------------
       
   109 // Called by personality handler when personality start needs to be finished. 
       
   110 // ----------------------------------------------------------------------------
       
   111 //
       
   112 void CUsbActiveBasicHandler::FinishPersonalityStart(TRequestStatus& aStatus)
       
   113     {
       
   114     FLOG( _L( "[USBWATCHER]\tCUsbActiveBasicHandler: FinishPersonalityStart" ) );
       
   115     iRequestStatus = &aStatus;
       
   116     aStatus = KRequestPending;    
       
   117     User::RequestComplete(iRequestStatus, KErrNone);
       
   118     }
       
   119 
       
   120 // ----------------------------------------------------------------------------
       
   121 // Called by personality handler when personality stop needs to be prepared. 
       
   122 // ----------------------------------------------------------------------------
       
   123 //
       
   124 void CUsbActiveBasicHandler::PreparePersonalityStop(TRequestStatus& aStatus)
       
   125     {
       
   126     FLOG( _L( "[USBWATCHER]\tCUsbActiveBasicHandler: PreparePersonalityStop" ) );
       
   127     iRequestStatus = &aStatus;
       
   128     aStatus = KRequestPending;
       
   129     User::RequestComplete(iRequestStatus, KErrNone);    
       
   130     }
       
   131 
       
   132 // ----------------------------------------------------------------------------
       
   133 // Called by personality handler when personality stop needs to be finished. 
       
   134 // ----------------------------------------------------------------------------
       
   135 //
       
   136 void CUsbActiveBasicHandler::FinishPersonalityStop(TRequestStatus& aStatus)
       
   137     {
       
   138     FLOG( _L( "[USBWATCHER]\tCUsbActiveBasicHandler: FinishPersonalityStop" ) );
       
   139     iRequestStatus = &aStatus;
       
   140     aStatus = KRequestPending;
       
   141     User::RequestComplete(iRequestStatus, KErrNone);
       
   142     }
       
   143 
       
   144 // ----------------------------------------------------------------------------
       
   145 // Indicates USB device state change to personality when USB is started.
       
   146 // ----------------------------------------------------------------------------
       
   147 // 
       
   148 void CUsbActiveBasicHandler::StateChangeNotify( TUsbDeviceState /*aState*/ )
       
   149     {
       
   150     FLOG( _L( "[USBWATCHER]\tCUsbActiveBasicHandler::StateChangeNotify" ) );    
       
   151     }
       
   152 
       
   153 // ----------------------------------------------------------------------------
       
   154 // Standard active object cancellation function.
       
   155 // ----------------------------------------------------------------------------
       
   156 //
       
   157 void CUsbActiveBasicHandler::DoCancel()
       
   158     {
       
   159     FLOG( _L( "[USBWATCHER]\tCUsbActiveBasicHandler::DoCancel" ) );
       
   160     }
       
   161 
       
   162 // End of file