|
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_USBHOSTEVENTNOTIFICATIONOBSERVER_H |
|
19 #define C_USBHOSTEVENTNOTIFICATIONOBSERVER_H |
|
20 |
|
21 #include <e32base.h> |
|
22 #include <usbhostdefs.h> |
|
23 |
|
24 #include <StifTestModule.h> |
|
25 #include <StifLogger.h> |
|
26 |
|
27 #include "tassertbase.h" |
|
28 |
|
29 class RUsb; |
|
30 |
|
31 class MUsbHostEventNotificationObserver |
|
32 { |
|
33 public: |
|
34 |
|
35 virtual void DeviceAttachedL(TDeviceEventInformation) = 0; |
|
36 virtual void DeviceDetachedL(TDeviceEventInformation) = 0; |
|
37 virtual void DriverLoadSuccessL(TDeviceEventInformation) = 0; |
|
38 virtual void DriverLoadPartialSuccessL(TDeviceEventInformation) = 0; |
|
39 virtual void DriverLoadFailureL(TDeviceEventInformation) = 0; |
|
40 |
|
41 }; |
|
42 |
|
43 /** |
|
44 * Class observes USB Notifications |
|
45 * |
|
46 * @lib ?library |
|
47 * @since S60 ?S60_version *** for example, S60 v3.0 |
|
48 */ |
|
49 class CUsbHostEventNotificationObserver : public TAssertBase |
|
50 { |
|
51 friend class CtUsbOtgWatcher; |
|
52 friend class CUsbOtgWatcherTest; |
|
53 |
|
54 public: |
|
55 |
|
56 /** |
|
57 * Two-phased constructor. |
|
58 * @param ?arg1 ?description |
|
59 * @param ?arg2 ?description |
|
60 */ |
|
61 // ?IMPORT_C |
|
62 static CUsbHostEventNotificationObserver* NewL(RUsb* aUsb); |
|
63 |
|
64 /** |
|
65 * Destructor. |
|
66 */ |
|
67 virtual ~CUsbHostEventNotificationObserver(); |
|
68 |
|
69 void SubscribeL(MUsbHostEventNotificationObserver&); |
|
70 |
|
71 void UnsubscribeL(MUsbHostEventNotificationObserver&); |
|
72 |
|
73 void TriggerDeviceAttachedL(TDeviceEventInformation eventInfo); |
|
74 void TriggerDeviceDetachedL(TDeviceEventInformation eventInfo); |
|
75 void TriggerDriverLoadSuccessL(TDeviceEventInformation eventInfo); |
|
76 void TriggerDriverLoadPartialSuccessL(TDeviceEventInformation eventInfo); |
|
77 void TriggerDriverLoadFailureL(TDeviceEventInformation eventInfo); |
|
78 |
|
79 private: |
|
80 |
|
81 CUsbHostEventNotificationObserver(RUsb* aUsb); |
|
82 |
|
83 void ConstructL(); |
|
84 |
|
85 private: |
|
86 // data |
|
87 |
|
88 // The observer reports changes to own observers |
|
89 // Owns |
|
90 MUsbHostEventNotificationObserver* iObserver; |
|
91 |
|
92 // Notifications come from USB |
|
93 // Not own |
|
94 RUsb* iUsb; |
|
95 }; |
|
96 |
|
97 #endif // C_USBHOSTEVENTNOTIFICATIONOBSERVER_H |