usbengines/usbotgwatcher/inc/cusbstatehostainitiate.h
changeset 35 9d8b04ca6939
child 63 ef2686f7597e
equal deleted inserted replaced
34:7858bc6ead78 35:9d8b04ca6939
       
     1 /*
       
     2  * Copyright (c) 2008 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:  Implementation of the concret state
       
    15  *
       
    16  */
       
    17 
       
    18 #ifndef C_USBSTATEHOSTAINITIATE_H
       
    19 #define C_USBSTATEHOSTAINITIATE_H
       
    20 
       
    21 #include "cusbstatehostabase.h"
       
    22 
       
    23 #ifndef STIF
       
    24 #include "cusbtimer.h"
       
    25 #else
       
    26 #include "mockcusbtimer.h"
       
    27 #endif
       
    28 
       
    29 class CUsbOtgWatcher;
       
    30 
       
    31 /**
       
    32  *  This class implements behaviour when Id pin just detected (initiating host role, loading drivers)
       
    33  *
       
    34  */
       
    35 NONSHARABLE_CLASS( CUsbStateHostAInitiate ) : public CUsbStateHostABase,
       
    36 MUsbTimerObserver
       
    37     {
       
    38     friend class CtUsbOtgWatcher;
       
    39 
       
    40 public:
       
    41 
       
    42     /**
       
    43      * Two-phased constructor.
       
    44      * @param aWatcher owner
       
    45      */
       
    46     static CUsbStateHostAInitiate* NewL(CUsbOtgWatcher& aWatcher);
       
    47 
       
    48     /**
       
    49      * Destructor.
       
    50      */
       
    51     virtual ~CUsbStateHostAInitiate();
       
    52 
       
    53 private:
       
    54 
       
    55     // From MUsbTimerObserver
       
    56     /**
       
    57      * timer expired call back
       
    58      * @param aTimerId timer id
       
    59      */
       
    60     void TimerElapsedL(TUsbTimerId aTimerId);
       
    61 
       
    62     /**
       
    63      * default construction
       
    64      * @param aWatcher owner
       
    65      */
       
    66     CUsbStateHostAInitiate(CUsbOtgWatcher& aWatcher);
       
    67 
       
    68     /**
       
    69      * 2nd phase construction
       
    70      */
       
    71     void ConstructL();
       
    72 
       
    73     //from CUsbState
       
    74     /**
       
    75      * state id
       
    76      * @return state id
       
    77      */
       
    78     TUsbStateIds Id();
       
    79 
       
    80     /**
       
    81      * This is called when switched to this state, 
       
    82      * because If all conditions for transition to another state exist, nothing will 
       
    83      * trigger it and transition will not happen. This forces the transition in such cases.
       
    84      *
       
    85      */
       
    86     void JustAdvancedToThisStateL();
       
    87 
       
    88     /**
       
    89      * This is called when switched to this state, 
       
    90      * because If all conditions for transition to another state exist, nothing will 
       
    91      * trigger it and transition will not happen. This forces the transition in such cases.
       
    92      *
       
    93      */
       
    94     void JustBeforeLeavingThisStateL();
       
    95 
       
    96     // From VBus observer
       
    97     /**
       
    98      * VBus up
       
    99      */
       
   100     void VBusUpL();
       
   101 
       
   102     // From Host Event notification observer
       
   103     /**
       
   104      * Device is attached
       
   105      * @param aInfo Device event data
       
   106      */
       
   107     void DeviceAttachedL(TDeviceEventInformation aInfo);
       
   108     
       
   109     /**
       
   110      * Device is detached
       
   111      * @param aInfo Device event data
       
   112      */
       
   113     void DeviceDetachedL(TDeviceEventInformation aInfo);
       
   114 
       
   115     /**
       
   116      * Device is detached
       
   117      * @param aInfo Device event data
       
   118      */
       
   119     void DriverLoadSuccessL(TDeviceEventInformation aInfo);
       
   120 
       
   121     /**
       
   122      * Drivers loaded partially
       
   123      * @param aInfo Device event data
       
   124      */
       
   125     void DriverLoadPartialSuccessL(TDeviceEventInformation aInfo);
       
   126 
       
   127     /**
       
   128      * Drivers loading failed
       
   129      * @param aInfo Device event data
       
   130      */
       
   131     void DriverLoadFailureL(TDeviceEventInformation aInfo);
       
   132 
       
   133 private:
       
   134     // data
       
   135 
       
   136     /*
       
   137      * attachment timer
       
   138      * own
       
   139      */
       
   140     CUsbTimer* iAttachmentTimer;
       
   141 
       
   142     /*
       
   143      * attachment attribute
       
   144      */
       
   145     TBool iDeviceAttached;
       
   146     };
       
   147 
       
   148 #endif //  C_USBSTATEHOSTINITIATE_H