21 |
21 |
22 #include <e32base.h> |
22 #include <e32base.h> |
23 #include <AknNotifyStd.h> // SAknSmallIndicatorParams |
23 #include <AknNotifyStd.h> // SAknSmallIndicatorParams |
24 #include <AknNotifySignature.h> // SAknNotifierPackage |
24 #include <AknNotifySignature.h> // SAknNotifierPackage |
25 #include <avkon.hrh> // EAknIndicatorUSBConnection |
25 #include <avkon.hrh> // EAknIndicatorUSBConnection |
|
26 |
26 #include "cusbtimer.h" |
27 #include "cusbtimer.h" |
27 #include "cusbnotifier.h" |
28 #include "cusbnotifier.h" |
|
29 #include "cusbvbusobserver.h" |
|
30 #include "cusbotgwatcher.h" |
28 |
31 |
29 |
32 |
30 /** |
33 /** |
31 * Class implements functionality of showing/blinking usb indicator |
34 * Class implements functionality of showing/blinking usb indicator |
32 * Class does not provide method to get response from the user |
35 * Class does not provide method to get response from the user |
33 */ |
36 */ |
34 NONSHARABLE_CLASS( CUsbIndicatorNotifier ): public CUsbNotifier, MUsbTimerObserver |
37 NONSHARABLE_CLASS( CUsbIndicatorNotifier ): public CUsbNotifier, MUsbTimerObserver, MUsbOtgWatcherStateObserver, MUsbVBusObserver |
35 { |
38 { |
36 public: |
39 public: |
37 /** |
40 /** |
38 * Two-phased constructor. |
41 * Two-phased constructor. |
39 * @param aNotifManager Owner of the class, will destroy the object when needed |
42 * @param aNotifManager parent |
|
43 * @param aOtgWatcher provides VBus observer and usb otg watcher state notifications |
40 * @return Pointer to the new instance of CUsbIndicatorNotifier |
44 * @return Pointer to the new instance of CUsbIndicatorNotifier |
41 */ |
45 */ |
42 static CUsbIndicatorNotifier* NewL(CUsbNotifManager* aNotifManager); |
46 static CUsbIndicatorNotifier* NewL(CUsbNotifManager* aNotifManager, CUsbOtgWatcher* aOtgWatcher); |
43 |
47 |
44 /** |
48 /** |
45 * Destructor. |
49 * Destructor. |
46 */ |
50 */ |
47 virtual ~CUsbIndicatorNotifier(); |
51 virtual ~CUsbIndicatorNotifier(); |
48 |
52 |
|
53 // From MUsbOtgWatcherStateObserver |
49 /** |
54 /** |
50 * Show/hide static icon of the indicator. |
55 * Otg Watcher state changed call back |
51 * If the indicator is blinking, stop blinking it and show/hide the static |
56 * @param aState new state |
52 * form of the indicator. |
|
53 * @param aVisible ETrue - Show the indicator, EFalse - Hide the indicator |
|
54 */ |
57 */ |
55 void ShowIndicatorL(TBool aVisible); |
58 virtual void OtgWatcherStateChangedL(TUsbStateIds aState); |
56 |
59 |
|
60 // From MUsbVBusObserver |
|
61 /** |
|
62 * VBus down event received |
|
63 */ |
|
64 virtual void VBusDownL(); |
|
65 /** |
|
66 * VBus up event received |
|
67 */ |
|
68 virtual void VBusUpL(); |
|
69 /** |
|
70 * error handler |
|
71 * @param aError error code |
|
72 */ |
|
73 virtual void VBusObserverErrorL(TInt aError); |
|
74 |
|
75 |
57 // From base class CUsbNotifier |
76 // From base class CUsbNotifier |
58 /** |
77 /** |
59 * Start to show notifier |
78 * Start to show notifier |
60 */ |
79 */ |
61 virtual void ShowL(); |
80 virtual void ShowL(); |
89 * Set USB indicator On or Off |
109 * Set USB indicator On or Off |
90 * @param aState Indicator states |
110 * @param aState Indicator states |
91 */ |
111 */ |
92 void SetIndicatorStateL(const TInt aState); |
112 void SetIndicatorStateL(const TInt aState); |
93 |
113 |
|
114 /** |
|
115 * Show/hide static icon of the indicator. |
|
116 * If the indicator is blinking, stop blinking it and show/hide the static |
|
117 * form of the indicator. |
|
118 * @param aVisible ETrue - Show the indicator, EFalse - Hide the indicator |
|
119 */ |
|
120 void ShowStaticL(TBool aVisible); |
|
121 |
|
122 /** |
|
123 * Blinks indicator |
|
124 */ |
|
125 void BlinkL(); |
|
126 |
|
127 /** |
|
128 * Sets indicator accordingly |
|
129 */ |
|
130 void SetIndicatorL(); |
|
131 |
94 private: |
132 private: |
95 // data |
133 // data |
96 |
134 |
|
135 /** |
|
136 * OtgWatcher |
|
137 * not own |
|
138 */ |
|
139 CUsbOtgWatcher* iOtgWatcher; |
|
140 |
97 /** |
141 /** |
98 * Switch timer for showing/hiding the usb indicator interleavingly for |
142 * Switch timer for showing/hiding the usb indicator interleavingly for |
99 * animating the indicator. |
143 * animating the indicator. |
100 * Own |
144 * Own |
101 */ |
145 */ |