usbengines/usbdevcon/inc/cusbstatewatcher.h
changeset 34 7858bc6ead78
parent 31 dfdd8240f7c8
child 35 9d8b04ca6939
equal deleted inserted replaced
31:dfdd8240f7c8 34:7858bc6ead78
     1 /*
       
     2 * Copyright (c) 2007 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:  Watches USB states
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 #ifndef CUSBSTATEWATCHER_H
       
    20 #define CUSBSTATEWATCHER_H
       
    21 
       
    22 #include <e32std.h>
       
    23 #include <d32usbc.h>
       
    24 
       
    25 #include "cusbdevcon.h"
       
    26 
       
    27 /**
       
    28  *  Usb State watcher
       
    29  *  Reports Usb state changes to CUsbDevCon
       
    30  *
       
    31  *  @lib usbdevcon.lib
       
    32  *  @since S60 v.5.0 
       
    33  */
       
    34  
       
    35 class CUsbStateWatcher : public CActive
       
    36     {
       
    37 
       
    38 public:
       
    39 
       
    40     /**
       
    41      * Two-phased constructor.
       
    42      *
       
    43      * @since S60 v.5.0
       
    44      * @param aObserver Gets notifications when USB state changed
       
    45      * @param aLdd Link to LDD services
       
    46      * @return Constructed instance
       
    47      */ 
       
    48     static CUsbStateWatcher* NewL(CUsbDevCon& aObserver, RDevUsbcClient& aLdd);
       
    49     
       
    50     /**
       
    51     * Destructor.
       
    52     *
       
    53     * @since S60 v.5.0
       
    54     */
       
    55     virtual ~CUsbStateWatcher();
       
    56     
       
    57     /**
       
    58      * Activates USB states watching
       
    59      *
       
    60      * @since S60 v.5.0
       
    61      */
       
    62     void Activate();
       
    63         
       
    64 private:
       
    65     
       
    66     /**
       
    67      * Default construction
       
    68      *
       
    69      * @since S60 v.5.0
       
    70      * @param aObserver Gets notifications when USB state changed
       
    71      * @param aLdd Link to LDD services
       
    72      */
       
    73     CUsbStateWatcher(CUsbDevCon& aObserver, RDevUsbcClient& aLdd);
       
    74     
       
    75     /**
       
    76      * Two-phased constructor.
       
    77      *
       
    78      * @since S60 v.5.0
       
    79      */
       
    80     void ConstructL();
       
    81     
       
    82     // from CActive
       
    83     
       
    84     /**
       
    85      * From CActive.
       
    86      *
       
    87      */
       
    88     void RunL();
       
    89     
       
    90     /**
       
    91      * From CActive.
       
    92      *
       
    93      */ 
       
    94     void DoCancel();
       
    95     
       
    96      /**
       
    97      * From CActive.
       
    98      *
       
    99      */ 
       
   100      TInt RunError( TInt /*aError*/ );
       
   101 
       
   102 private: // data
       
   103     
       
   104     /**
       
   105      * Device state
       
   106      */
       
   107     TUint iState;
       
   108         
       
   109     /**
       
   110      * Observer
       
   111      * Not own.  
       
   112      */
       
   113     CUsbDevCon& iObserver;
       
   114     
       
   115     /**
       
   116      * LDD
       
   117      * Not own.  
       
   118      */
       
   119     RDevUsbcClient& iLdd;
       
   120     
       
   121     };
       
   122 
       
   123 #endif // CUSBSTATEWATCHER_H