usbengines/usbwatcher/inc/cusbactivestate.h
changeset 35 9d8b04ca6939
parent 0 1e05558e2206
equal deleted inserted replaced
34:7858bc6ead78 35:9d8b04ca6939
       
     1 /*
       
     2 * Copyright (c) 2002-2009 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:  Header file for class CUsbActiveState
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 #ifndef CUSBACTIVESTATE_H
       
    20 #define CUSBACTIVESTATE_H
       
    21 
       
    22 // INCLUDE FILES
       
    23 #include <e32base.h>
       
    24 
       
    25 // FORWARD DECLARATION
       
    26 class CUsbWatcher;
       
    27 
       
    28 // CLASS DECLARATION
       
    29 
       
    30 /**
       
    31 *  Class to handle USB state changes.
       
    32 *
       
    33 *  @lib euser.lib usbman.lib
       
    34 *  @since Series 60 2.?
       
    35 */
       
    36 NONSHARABLE_CLASS( CUsbActiveState ) : public CActive
       
    37     {
       
    38     public:  // Constructors and destructor
       
    39         
       
    40         /**
       
    41         * Two-phased constructor.
       
    42         * @param aUsbMan Reference to usb manager.
       
    43         * @param aParent Reference to UsbMediaWatcher.
       
    44         * @return Pointer to created object.
       
    45         */
       
    46         static CUsbActiveState* NewL( RUsb& aUsbMan, CUsbWatcher& aOwner );
       
    47         
       
    48         /**
       
    49         * Destructor.
       
    50         */
       
    51         virtual ~CUsbActiveState();
       
    52 
       
    53     public: // from base class CActive
       
    54 
       
    55         /**
       
    56         * From CActive.
       
    57         * This method is called when device state has changed.
       
    58         * New request is issued and device state is given to owner class.
       
    59         *
       
    60         * @since Series 60 2.?
       
    61         */
       
    62         void RunL();
       
    63 
       
    64         /**
       
    65         * From CActive
       
    66         * If there is outstanding request pending when Cancel() is called then
       
    67         * this method must cancel request.
       
    68         *
       
    69         * @since Series 60 2.?
       
    70         */
       
    71         void DoCancel();
       
    72 
       
    73     public: // new methods
       
    74 
       
    75         /**
       
    76         * Get the current device state
       
    77         * @return the current device state
       
    78         *
       
    79         * @since Series 60 3.2
       
    80         */
       
    81         TUsbDeviceState CurrentState();
       
    82 
       
    83         /**
       
    84         * Get previous device state
       
    85         * @return previous device state
       
    86         *
       
    87         * @since Series 60 5.1
       
    88         */
       
    89         TUsbDeviceState PreviousState();
       
    90 
       
    91     
       
    92     private:
       
    93 
       
    94         /**
       
    95         * Constructor is prohibited.
       
    96         * @param aUsbMan Reference to Usb manager.
       
    97         * @param aParent Reference to CUsbMediaWatcher.
       
    98         */
       
    99         CUsbActiveState( RUsb& aUsbMan, CUsbWatcher& aOwner );
       
   100 
       
   101         /**
       
   102         * C++ default constructor (no implementation provided).
       
   103         */
       
   104         CUsbActiveState();
       
   105 
       
   106         /**
       
   107         * By default Symbian 2nd phase constructor is private.
       
   108         */
       
   109         void ConstructL();
       
   110         
       
   111         // Prohibit copy constructor when not deriving from CBase.
       
   112         CUsbActiveState( const CUsbActiveState& );
       
   113         // Prohibit assigment operator when not deriving from CBase.
       
   114         CUsbActiveState& operator=( const CUsbActiveState& );
       
   115 
       
   116     private: // Data
       
   117         /**
       
   118          * Handle to Usb Manager
       
   119          */
       
   120         RUsb iUsbMan;
       
   121         
       
   122         /**
       
   123          * Refernce to owner class
       
   124          */
       
   125         CUsbWatcher& iOwner;
       
   126 
       
   127         /**
       
   128          * Current device state
       
   129          */
       
   130         TUsbDeviceState iCurrentState;
       
   131 
       
   132         /**
       
   133          * Previous device state
       
   134          */
       
   135         TUsbDeviceState iPreviousState;        
       
   136 
       
   137     };
       
   138 
       
   139 #endif   // CUSBACTIVESTATE_H
       
   140 
       
   141 // End of File