usbengines/usbotgwatcher/inc/cusbstatehostdelayhandle.h
branchRCL_3
changeset 5 7068aba64af5
child 6 a15c582fbf97
equal deleted inserted replaced
4:7e15987c4500 5:7068aba64af5
       
     1 /*
       
     2 * Copyright (c) 2008-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:  Implements concrete state
       
    15  *
       
    16 */
       
    17 
       
    18 
       
    19 #ifndef C_USBSTATEHOSTDALAYHANDLE_H
       
    20 #define C_USBSTATEHOSTDELAYHANDLE_H
       
    21 
       
    22 #include "cusbotgwatcher.h"
       
    23 #include "cusbstatehosthandle.h"
       
    24 
       
    25 #ifndef STIF
       
    26 #include "cusbnotifmanager.h"
       
    27 #include "cusbtimer.h"
       
    28 #else
       
    29 #include "mockcusbnotifmanager.h"
       
    30 #include "mockcusbtimer.h"
       
    31 #endif
       
    32 
       
    33 /**
       
    34  *  This class implements behaviour when some problem needs vbus drop in a while, and mostly, user action.
       
    35  *
       
    36  */
       
    37 NONSHARABLE_CLASS( CUsbStateHostDelayHandle ) : public CUsbStateHostHandle,
       
    38       //  MWaitNotifierObserver,
       
    39         MUsbTimerObserver
       
    40 // this means only one wait notifier at a time can be shown by this state, might be redesigned
       
    41     {
       
    42     friend class CtUsbOtgWatcher;
       
    43     friend class CUsbOtgWatcher;
       
    44 
       
    45 public:
       
    46 
       
    47     /**
       
    48      * Two-phased constructor.
       
    49      * @param aWatcher owner
       
    50      */
       
    51     static CUsbStateHostDelayHandle* NewL(CUsbOtgWatcher* aWatcher);
       
    52 
       
    53     /**
       
    54      * Destructor.
       
    55      */
       
    56     virtual ~CUsbStateHostDelayHandle();
       
    57 
       
    58     // From MUsbTimerObserver
       
    59     /**
       
    60      * Call back when timer expired
       
    61      * @param aTimerId timer id
       
    62      */
       
    63     void TimerElapsedL(TUsbTimerId aTimerId);
       
    64 
       
    65     // From VBus observer
       
    66     /**
       
    67      * VBus down
       
    68      */
       
    69     void VBusUpL();
       
    70     /**
       
    71      * VBus down
       
    72      */
       
    73     void VBusDownL();
       
    74     /**
       
    75      * VBus error happened
       
    76      */
       
    77     void VBusErrorL();
       
    78 
       
    79     // From OTG state observer
       
    80     /**
       
    81      * VBus error happen
       
    82      */
       
    83     void AVBusErrorL();
       
    84 
       
    85     // From Host Event notification observer
       
    86     /**
       
    87      * Device is attached
       
    88      * @param aInfo Device event data
       
    89      */
       
    90     void DeviceAttachedL(TDeviceEventInformation aInfo);
       
    91     /**
       
    92      * Device is detached
       
    93      * @param aInfo Device event data
       
    94      */
       
    95     void DeviceDetachedL(TDeviceEventInformation aInfo);
       
    96     /**
       
    97      * Connected to hub in wrong level 
       
    98      */
       
    99     void BadHubPositionL();
       
   100 
       
   101     /**
       
   102      * SRP request received
       
   103      */
       
   104     void SrpReceivedL();
       
   105 
       
   106 //from CUsbState
       
   107     /**
       
   108      * State id
       
   109      * @return state id
       
   110      */
       
   111     TUsbStateIds Id();
       
   112 
       
   113     /**
       
   114      * This is called when switched to this state, 
       
   115      * because If all conditions for transition to another state exist, nothing will 
       
   116      * trigger it and transition will not happen. This forces the transition in such cases.
       
   117      *
       
   118      */
       
   119     void JustAdvancedToThisStateL();
       
   120 
       
   121     /**
       
   122      * This is called when leaving this state, 
       
   123      *
       
   124      */
       
   125     void JustBeforeLeavingThisStateL();
       
   126     
       
   127     /**
       
   128      * handles issue
       
   129      */
       
   130     void DoHandleL();
       
   131 
       
   132 
       
   133 private:
       
   134 
       
   135     /**
       
   136      * Default constructor
       
   137      * @param aWatcher owner
       
   138      */
       
   139     CUsbStateHostDelayHandle(CUsbOtgWatcher* aWatcher);
       
   140 
       
   141     /**
       
   142      * 2nd phase construction
       
   143      */
       
   144     void ConstructL();
       
   145 
       
   146     
       
   147 private:
       
   148     // data
       
   149 
       
   150     /** 
       
   151      * too much power timer
       
   152      * own
       
   153      */
       
   154     CUsbTimer* iTooMuchPowerTimer;
       
   155     
       
   156     /** 
       
   157      * drivers not found
       
   158      * own
       
   159      */
       
   160     CUsbTimer* iDriversNotFoundTimer;
       
   161     };
       
   162 
       
   163 #endif //  C_USBSTATEHOSTHANDLE_H