1 /* |
1 /* |
2 * Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). |
2 * Copyright (c) 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 * |
|
9 * Initial Contributors: |
|
10 * Nokia Corporation - initial contribution. |
|
11 * |
|
12 * Contributors: |
|
13 * |
|
14 * Description: Blink/show Usb indicator notifier implementation |
|
15 * |
8 * |
16 */ |
9 * Initial Contributors: |
17 |
10 * Nokia Corporation - initial contribution. |
|
11 * |
|
12 * Contributors: |
|
13 * |
|
14 * Description: Blink/show Usb indicator notifier implementation |
|
15 * |
|
16 */ |
18 |
17 |
19 #ifndef C_USBINDICATORNOTIFIER_H |
18 #ifndef C_USBINDICATORNOTIFIER_H |
20 #define C_USBINDICATORNOTIFIER_H |
19 #define C_USBINDICATORNOTIFIER_H |
21 |
20 |
22 #include <e32base.h> |
21 #include <e32base.h> |
23 #include <AknNotifyStd.h> // SAknSmallIndicatorParams |
22 #include <AknNotifyStd.h> // SAknSmallIndicatorParams |
24 #include <AknNotifySignature.h> // SAknNotifierPackage |
23 #include <AknNotifySignature.h> // SAknNotifierPackage |
25 #include <avkon.hrh> // EAknIndicatorUSBConnection |
24 #include <avkon.hrh> // EAknIndicatorUSBConnection |
26 |
|
27 #include "cusbtimer.h" |
25 #include "cusbtimer.h" |
28 #include "cusbnotifier.h" |
26 #include "cusbnotifier.h" |
29 #include "cusbvbusobserver.h" |
27 #include "cusbvbusobserver.h" |
30 #include "cusbotgwatcher.h" |
28 #include "cusbotgwatcher.h" |
31 |
|
32 |
29 |
33 /** |
30 /** |
34 * Class implements functionality of showing/blinking usb indicator |
31 * Class implements functionality of showing/blinking usb indicator |
35 * Class does not provide method to get response from the user |
32 * Class does not provide method to get response from the user |
36 */ |
33 */ |
41 * Two-phased constructor. |
38 * Two-phased constructor. |
42 * @param aNotifManager parent |
39 * @param aNotifManager parent |
43 * @param aOtgWatcher provides VBus observer and usb otg watcher state notifications |
40 * @param aOtgWatcher provides VBus observer and usb otg watcher state notifications |
44 * @return Pointer to the new instance of CUsbIndicatorNotifier |
41 * @return Pointer to the new instance of CUsbIndicatorNotifier |
45 */ |
42 */ |
46 static CUsbIndicatorNotifier* NewL(CUsbNotifManager* aNotifManager, CUsbOtgWatcher* aOtgWatcher); |
43 static CUsbIndicatorNotifier* NewL(CUsbNotifManager& aNotifManager, CUsbOtgWatcher& aOtgWatcher); |
47 |
44 |
48 /** |
45 /** |
49 * Destructor. |
46 * Destructor. |
50 */ |
47 */ |
51 virtual ~CUsbIndicatorNotifier(); |
48 virtual ~CUsbIndicatorNotifier(); |
54 /** |
51 /** |
55 * Otg Watcher state changed call back |
52 * Otg Watcher state changed call back |
56 * @param aState new state |
53 * @param aState new state |
57 */ |
54 */ |
58 virtual void OtgWatcherStateChangedL(TUsbStateIds aState); |
55 virtual void OtgWatcherStateChangedL(TUsbStateIds aState); |
59 |
56 |
60 // From MUsbVBusObserver |
57 // From MUsbVBusObserver |
61 /** |
58 /** |
62 * VBus down event received |
59 * VBus down event received |
63 */ |
60 */ |
64 virtual void VBusDownL(); |
61 virtual void VBusDownL(); |
67 */ |
64 */ |
68 virtual void VBusUpL(); |
65 virtual void VBusUpL(); |
69 /** |
66 /** |
70 * error handler |
67 * error handler |
71 * @param aError error code |
68 * @param aError error code |
72 */ |
69 */ |
73 virtual void VBusObserverErrorL(TInt aError); |
70 virtual void VBusObserverErrorL(TInt aError); |
74 |
71 |
75 |
|
76 // From base class CUsbNotifier |
72 // From base class CUsbNotifier |
77 /** |
73 /** |
78 * Start to show notifier |
74 * Start to show notifier |
79 */ |
75 */ |
80 virtual void ShowL(); |
76 virtual void ShowL(); |
96 /** |
92 /** |
97 * Default constructor. |
93 * Default constructor. |
98 * @param aNotifManger parent |
94 * @param aNotifManger parent |
99 * @param aOtgWatcher Otg watcher |
95 * @param aOtgWatcher Otg watcher |
100 */ |
96 */ |
101 CUsbIndicatorNotifier(CUsbNotifManager* aNotifManager, CUsbOtgWatcher* aOtgWatcher); |
97 CUsbIndicatorNotifier(CUsbNotifManager& aNotifManager, CUsbOtgWatcher& aOtgWatcher); |
102 |
98 |
103 /** |
99 /** |
104 * 2nd phase constructor. |
100 * 2nd phase constructor. |
105 */ |
101 */ |
106 void ConstructL(); |
102 void ConstructL(); |
108 /** |
104 /** |
109 * Set USB indicator On or Off |
105 * Set USB indicator On or Off |
110 * @param aState Indicator states |
106 * @param aState Indicator states |
111 */ |
107 */ |
112 void SetIndicatorStateL(const TInt aState); |
108 void SetIndicatorStateL(const TInt aState); |
113 |
109 |
114 /** |
110 /** |
115 * Show/hide static icon of the indicator. |
111 * Show/hide static icon of the indicator. |
116 * If the indicator is blinking, stop blinking it and show/hide the static |
112 * If the indicator is blinking, stop blinking it and show/hide the static |
117 * form of the indicator. |
113 * form of the indicator. |
118 * @param aVisible ETrue - Show the indicator, EFalse - Hide the indicator |
114 * @param aVisible ETrue - Show the indicator, EFalse - Hide the indicator |
119 */ |
115 */ |
120 void ShowStaticL(TBool aVisible); |
116 void ShowStaticL(TBool aVisible); |
121 |
117 |
122 /** |
118 /** |
123 * Blinks indicator |
119 * Blinks indicator |
124 */ |
120 */ |
125 void BlinkL(); |
121 void BlinkL(); |
126 |
122 |
127 /** |
123 /** |
128 * Sets indicator accordingly |
124 * Sets indicator accordingly |
129 */ |
125 */ |
130 void SetIndicatorL(); |
126 void SetIndicatorL(); |
131 |
127 |
132 private: |
128 private: |
133 // data |
129 // data |
134 |
130 |
135 /** |
131 /** |
136 * OtgWatcher |
132 * OtgWatcher |
137 * not own |
133 * not own |
138 */ |
134 */ |
139 CUsbOtgWatcher* iOtgWatcher; |
135 CUsbOtgWatcher& iOtgWatcher; |
140 |
136 |
141 /** |
137 /** |
142 * Switch timer for showing/hiding the usb indicator interleavingly for |
138 * Switch timer for showing/hiding the usb indicator interleavingly for |
143 * animating the indicator. |
139 * animating the indicator. |
144 * Own |
140 * Own |
145 */ |
141 */ |