|
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_USBVBUSOBSERVER_H |
|
19 #define C_USBVBUSOBSERVER_H |
|
20 |
|
21 #include <e32base.h> |
|
22 |
|
23 #include <StifTestModule.h> |
|
24 #include <StifLogger.h> |
|
25 |
|
26 #include "tassertbase.h" |
|
27 |
|
28 class RUsb; |
|
29 |
|
30 class MUsbVBusObserver |
|
31 { |
|
32 public: |
|
33 |
|
34 void virtual VBusDownL() = 0; |
|
35 void virtual VBusUpL() = 0; |
|
36 |
|
37 }; |
|
38 |
|
39 /** |
|
40 * Class observes VBUS property |
|
41 * |
|
42 * @lib ?library |
|
43 * @since S60 ?S60_version *** for example, S60 v3.0 |
|
44 */ |
|
45 class CUsbVBusObserver : public TAssertBase |
|
46 { |
|
47 friend class CtUsbOtgWatcher; |
|
48 friend class CUsbOtgWatcherTest; |
|
49 |
|
50 public: |
|
51 enum TState |
|
52 { |
|
53 EVBusDown = 0, |
|
54 EVBusUp = 1 |
|
55 }; |
|
56 |
|
57 /** |
|
58 * Two-phased constructor. |
|
59 * @param ?arg1 ?description |
|
60 * @param ?arg2 ?description |
|
61 */ |
|
62 // ?IMPORT_C |
|
63 static CUsbVBusObserver* NewL(); |
|
64 |
|
65 /** |
|
66 * Destructor. |
|
67 */ |
|
68 virtual ~CUsbVBusObserver(); |
|
69 |
|
70 /** |
|
71 * ?description |
|
72 * |
|
73 * @since S60 ?S60_version |
|
74 * @param ?arg1 ?description |
|
75 * @param ?arg2 ?description |
|
76 * @return ?description |
|
77 */ |
|
78 // ?IMPORT_C |
|
79 TState VBus() /* const! read comment in impl*/; |
|
80 |
|
81 /** |
|
82 * ?description |
|
83 * |
|
84 * @since S60 ?S60_version |
|
85 * @param ?arg1 ?description |
|
86 * @param ?arg2 ?description |
|
87 * @return ?description |
|
88 */ |
|
89 |
|
90 void SubscribeL(MUsbVBusObserver&); |
|
91 |
|
92 void UnsubscribeL(MUsbVBusObserver&); |
|
93 |
|
94 void SetRUsb(RUsb* aRUsb); |
|
95 |
|
96 void TriggerVBusUpL(); |
|
97 |
|
98 void TriggerVBusDownL(); |
|
99 private: |
|
100 |
|
101 CUsbVBusObserver(); |
|
102 |
|
103 void ConstructL(); |
|
104 |
|
105 private: |
|
106 // data |
|
107 RUsb* iUsb; |
|
108 |
|
109 // The observer reports state changes to own observers |
|
110 // Own |
|
111 MUsbVBusObserver* iObserver; |
|
112 |
|
113 }; |
|
114 |
|
115 #endif // C_USBVBUSOBSERVER_H |