usbengines/usbotgwatcher/inc/cusbstate.h
branchRCL_3
changeset 20 a15c582fbf97
parent 13 7068aba64af5
child 21 ff9df6630274
equal deleted inserted replaced
13:7068aba64af5 20:a15c582fbf97
     1 /*
     1 /*
     2 * Copyright (c) 2008-2009 Nokia Corporation and/or its subsidiary(-ies).
     2  * Copyright (c) 2008-2009 Nokia Corporation and/or its subsidiary(-ies).
     3 * All rights reserved.
     3  * All rights reserved.
     4 * This component and the accompanying materials are made available
     4  * This component and the accompanying materials are made available
     5 * under the terms of "Eclipse Public License v1.0"
     5  * under the terms of "Eclipse Public License v1.0"
     6 * which accompanies this distribution, and is available
     6  * which accompanies this distribution, and is available
     7 * at the URL "http://www.eclipse.org/legal/epl-v10.html".
     7  * at the URL "http://www.eclipse.org/legal/epl-v10.html".
     8 *
     8  *
     9 * Initial Contributors:
     9  * Initial Contributors:
    10 * Nokia Corporation - initial contribution.
    10  * Nokia Corporation - initial contribution.
    11 *
    11  *
    12 * Contributors:
    12  * Contributors:
    13 *
    13  *
    14 * Description:  Base class for states in state machine
    14  * Description:  Base class for states in state machine
    15  *
    15  *
    16 */
    16  */
    17 
       
    18 
    17 
    19 #ifndef C_USBSTATE_H
    18 #ifndef C_USBSTATE_H
    20 #define C_USBSTATE_H
    19 #define C_USBSTATE_H
    21 
    20 
    22 #include <e32base.h>
    21 #include <e32base.h>
    68     /**
    67     /**
    69      * This function is needed to find a real state by id
    68      * This function is needed to find a real state by id
    70      * This might be used in switching states in watcher. New state object searched by its id
    69      * This might be used in switching states in watcher. New state object searched by its id
    71      * @return Id
    70      * @return Id
    72      */
    71      */
    73     virtual TUsbStateIds Id();
    72     virtual TUsbStateIds Id() = 0;
    74     
    73 
    75     /**
    74     /**
    76      * Destruction
    75      * Destruction
    77      */
    76      */
    78     virtual ~CUsbState();
    77     virtual ~CUsbState();
    79     
    78 
    80     /**
    79     /**
    81      * Two-phased constructor.
    80      * Two-phased constructor.
    82      * @param aWatcher owner
    81      * @param aWatcher owner
    83      */
    82      */
    84     static CUsbState* NewL(CUsbOtgWatcher* aWatcher);
    83     //static CUsbState* NewL(CUsbOtgWatcher& aWatcher);
    85 
    84 
    86 protected:
    85 protected:
    87     /**
    86     /**
    88      * default constructor is protected to be able to be inherited be child classes
    87      * default constructor is protected to be able to be inherited be child classes
    89      * @param aOwner owner of the state
    88      * @param aOwner owner of the state
    90      */
    89      */
    91     CUsbState(CUsbOtgWatcher* aOwner);
    90     CUsbState(CUsbOtgWatcher& aOwner);
    92 
    91 
    93     /* *
    92     /* *
    94      * Changes state in Device state machine
    93      * Changes state in Device state machine
    95      * @param aNewStateId new state id
    94      * @param aNewStateId new state id
    96      */
    95      */
    99     /**
    98     /**
   100      * Changes state in host state machine
    99      * Changes state in host state machine
   101      * @param aNewStateId new host state
   100      * @param aNewStateId new host state
   102      */
   101      */
   103     void ChangeHostStateL(TUsbStateIds aNewStateId);
   102     void ChangeHostStateL(TUsbStateIds aNewStateId);
   104     
   103 
   105     /**
   104     /**
   106      * Handles special situation (error, or something else)
   105      * Handles special situation (error, or something else)
   107      * @param aWhat to hande (id)
   106      * @param aWhat to hande (id)
       
   107      * @param aWhereTohandle state id where to handle
   108      */
   108      */
   109     virtual void HandleL(TInt aWhat, TUsbStateIds aWhereTohandle);
   109     virtual void HandleL(TInt aWhat, TUsbStateIds aWhereTohandle);
   110 
       
   111 private:
       
   112     
       
   113     /**
       
   114      * 2nd phase construction
       
   115      */
       
   116     void ConstructL();
       
   117 
   110 
   118     /**
   111     /**
   119      * State machine calls this, state object to perform any initial  
   112      * State machine calls this, state object to perform any initial  
   120      * activity, once just entered this state
   113      * activity, once just entered this state
   121      *
   114      *
   133      * Following virtual functions are called by UsbOtgWatcher
   126      * Following virtual functions are called by UsbOtgWatcher
   134      * on getting accodring event. Those are implemented in concret states.
   127      * on getting accodring event. Those are implemented in concret states.
   135      */
   128      */
   136 
   129 
   137     /**
   130     /**
       
   131      * 2nd phase construction
       
   132      */
       
   133     void ConstructL();
       
   134 
       
   135     /**
   138      * Sets personality
   136      * Sets personality
   139      */
   137      */
   140     virtual void SetPersonalityL();
   138     virtual void SetPersonalityL();
   141 
   139 
   142     /**
   140     /**
   275 
   273 
   276     /**
   274     /**
   277      * Owner
   275      * Owner
   278      * Not own.  
   276      * Not own.  
   279      */
   277      */
   280     CUsbOtgWatcher* iWatcher;
   278     CUsbOtgWatcher& iWatcher;
   281 
   279 
   282     };
   280     };
   283 
   281 
   284 #endif // C_USBSTATE_H
   282 #endif // C_USBSTATE_H