usbengines/usbotgwatcher/tsrc/UsbOtgWatcherTest/inc/mockcusbotgstateobserver.h
branchRCL_3
changeset 92 dde4619868dc
parent 86 703a2b94c06c
child 95 55a3258355ea
equal deleted inserted replaced
86:703a2b94c06c 92:dde4619868dc
     1 /*
       
     2 * Copyright (c) 2010 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:
       
    15 *
       
    16 */
       
    17 
       
    18 #ifndef C_USBOTGSTATEOBSERVER_H
       
    19 #define C_USBOTGSTATEOBSERVER_H
       
    20 
       
    21 #include <e32base.h>
       
    22 #include <usbotgdefs.h>
       
    23 
       
    24 #include <StifTestModule.h>
       
    25 #include <StifLogger.h>
       
    26 
       
    27 #include "tassertbase.h"
       
    28 
       
    29 class MUsbOtgStateObserver
       
    30     {
       
    31 public:
       
    32 
       
    33     virtual void AIdleL() = 0;
       
    34     virtual void AHostL() = 0;
       
    35     virtual void APeripheralL() = 0;
       
    36     virtual void AVBusErrorL() = 0;
       
    37     virtual void BIdleL() = 0;
       
    38     virtual void BPeripheralL() = 0;
       
    39     virtual void BHostL() = 0;
       
    40     };
       
    41 
       
    42 /**
       
    43  *  Class observes OTG State property, see usbotgdefs.h
       
    44  *
       
    45  *  @lib ?library
       
    46  *  @since S60 ?S60_version *** for example, S60 v3.0
       
    47  */
       
    48 class CUsbOtgStateObserver : public TAssertBase
       
    49     {
       
    50     friend class CtUsbOtgWatcher;
       
    51     friend class CUsbOtgWatcherTest;
       
    52 
       
    53 public:
       
    54 
       
    55     /**
       
    56      * Two-phased constructor.
       
    57      * @param ?arg1 ?description
       
    58      * @param ?arg2 ?description
       
    59      */
       
    60     //    ?IMPORT_C 
       
    61     static CUsbOtgStateObserver* NewL();
       
    62 
       
    63     /**
       
    64      * Destructor.
       
    65      */
       
    66     virtual ~CUsbOtgStateObserver();
       
    67 
       
    68     /**
       
    69      * ?description
       
    70      *
       
    71      * @since S60 ?S60_version
       
    72      * @param ?arg1 ?description
       
    73      * @param ?arg2 ?description
       
    74      * @return ?description
       
    75      */
       
    76     //    ?IMPORT_C 
       
    77     TUsbOtgState OtgState();
       
    78 
       
    79     /**
       
    80      * ?description
       
    81      *
       
    82      * @since S60 ?S60_version
       
    83      * @param ?arg1 ?description
       
    84      * @param ?arg2 ?description
       
    85      * @return ?description
       
    86      */
       
    87     void SubscribeL(MUsbOtgStateObserver&);
       
    88 
       
    89     void UnsubscribeL(MUsbOtgStateObserver&);
       
    90 
       
    91     void TriggerAIdleL();
       
    92     void TriggerAHostL();
       
    93     void TriggerAPeripheralL();
       
    94     void TriggerAVBusErrorL();
       
    95     void TriggerBIdleL();
       
    96     void TriggerBPeripheralL();
       
    97     void TriggerBHostL();
       
    98 
       
    99 private:
       
   100 
       
   101     CUsbOtgStateObserver();
       
   102 
       
   103     void ConstructL();
       
   104 
       
   105 private:
       
   106     // data
       
   107 
       
   108     // The observer reports state changes to own observers
       
   109     // Owns
       
   110     MUsbOtgStateObserver* iObserver;
       
   111 
       
   112     TInt iOtgState;
       
   113     };
       
   114 
       
   115 #endif //  C_USBOTGSTATEOBSERVER_H