usbengines/usbotgwatcher/inc/cusbindicatornotifier.h
changeset 35 9d8b04ca6939
child 56 f45583a69686
equal deleted inserted replaced
34:7858bc6ead78 35:9d8b04ca6939
       
     1 /*
       
     2  * Copyright (c) 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:  Blink/show Usb indicator notifier implementation
       
    15  *
       
    16  */
       
    17 
       
    18 #ifndef C_USBINDICATORNOTIFIER_H
       
    19 #define C_USBINDICATORNOTIFIER_H
       
    20 
       
    21 #include <e32base.h>
       
    22 #include <AknNotifyStd.h>       // SAknSmallIndicatorParams
       
    23 #include <AknNotifySignature.h> // SAknNotifierPackage
       
    24 #include <avkon.hrh>            // EAknIndicatorUSBConnection
       
    25 
       
    26 #include "cusbnotifier.h"
       
    27 #include "cusbvbusobserver.h"
       
    28 #include "cusbotgwatcher.h"
       
    29 
       
    30 /**
       
    31  * Class implements functionality of showing/blinking usb indicator
       
    32  * Class does not provide method to get response from the user
       
    33  */
       
    34 NONSHARABLE_CLASS( CUsbIndicatorNotifier ): public CUsbNotifier, MUsbOtgWatcherStateObserver, MUsbVBusObserver
       
    35     {
       
    36 public:
       
    37     /**
       
    38      * Two-phased constructor.
       
    39      * @param aNotifManager parent
       
    40      * @param aOtgWatcher provides VBus observer and usb otg watcher state notifications
       
    41      * @return Pointer to the new instance of CUsbIndicatorNotifier
       
    42      */
       
    43     static CUsbIndicatorNotifier* NewL(CUsbNotifManager& aNotifManager, CUsbOtgWatcher& aOtgWatcher);
       
    44 
       
    45     /**
       
    46      * Destructor.
       
    47      */
       
    48     virtual ~CUsbIndicatorNotifier();
       
    49 
       
    50     // From MUsbOtgWatcherStateObserver
       
    51     /**
       
    52      * Otg Watcher state changed call back
       
    53      * @param aState new state
       
    54      */
       
    55     virtual void OtgWatcherStateChangedL(TUsbStateIds aState);
       
    56 
       
    57     // From MUsbVBusObserver
       
    58     /**
       
    59      * VBus down event received
       
    60      */
       
    61     virtual void VBusDownL();
       
    62     /**
       
    63      * VBus up event received
       
    64      */
       
    65     virtual void VBusUpL();
       
    66     /**
       
    67      * error handler
       
    68      * @param aError error code
       
    69      */
       
    70     virtual void VBusObserverErrorL(TInt aError);
       
    71 
       
    72     // From base class CUsbNotifier
       
    73     /**
       
    74      * Start to show notifier
       
    75      */
       
    76     virtual void ShowL();
       
    77 
       
    78     /**
       
    79      * Stop showing notifier
       
    80      */
       
    81     virtual void Close();
       
    82 
       
    83 private:
       
    84 
       
    85     /**
       
    86      * Default constructor.
       
    87      * @param aNotifManger parent
       
    88      * @param aOtgWatcher Otg watcher
       
    89      */
       
    90     CUsbIndicatorNotifier(CUsbNotifManager& aNotifManager, CUsbOtgWatcher& aOtgWatcher);
       
    91 
       
    92     /**
       
    93      * 2nd phase constructor.
       
    94      */
       
    95     void ConstructL();
       
    96 
       
    97     /**
       
    98      * Set USB indicator On or Off
       
    99      * @param aState Indicator states 
       
   100      */
       
   101     void SetIndicatorStateL(const TInt aState);
       
   102 
       
   103     /**
       
   104      * Show/hide static icon of the indicator. 
       
   105      * If the indicator is blinking, stop blinking it and show/hide the static 
       
   106      * form of the indicator.
       
   107      * @param aVisible ETrue - Show the indicator, EFalse - Hide the indicator 
       
   108      */
       
   109     void ShowStaticL(TBool aVisible);
       
   110 
       
   111     /**
       
   112      * Blinks indicator
       
   113      */
       
   114     void BlinkL();
       
   115 
       
   116     /**
       
   117      * Sets indicator accordingly
       
   118      */
       
   119     void SetIndicatorL();
       
   120 
       
   121 private:
       
   122     // data
       
   123 
       
   124     /**
       
   125      * OtgWatcher
       
   126      * not own
       
   127      */
       
   128     CUsbOtgWatcher& iOtgWatcher;
       
   129 
       
   130     /**
       
   131      * Current indicator state
       
   132      */
       
   133     TInt iIndicatorState;
       
   134 
       
   135     };
       
   136 
       
   137 #endif // C_USBINDICATORNOTIFIER_H