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_USBMESSAGENOTIFICATIONOBSERVER_H |
|
19 #define C_USBMESSAGENOTIFICATIONOBSERVER_H |
|
20 |
|
21 #include <e32base.h> |
|
22 |
|
23 #include "tassertbase.h" |
|
24 |
|
25 class RUsb; |
|
26 |
|
27 class MUsbMessageNotificationObserver |
|
28 { |
|
29 public: |
|
30 |
|
31 virtual void MessageNotificationReceivedL(TInt) = 0; |
|
32 virtual void BadHubPositionL() = 0; |
|
33 virtual void VBusErrorL() = 0; |
|
34 virtual void SrpReceivedL() = 0; |
|
35 virtual void SessionRequestedL() = 0; |
|
36 }; |
|
37 |
|
38 /** |
|
39 * Class observes USB Notifications |
|
40 * |
|
41 * @lib ?library |
|
42 * @since S60 ?S60_version *** for example, S60 v3.0 |
|
43 */ |
|
44 class CUsbMessageNotificationObserver : public TAssertBase |
|
45 { |
|
46 friend class CtUsbOtgWatcher; |
|
47 friend class CUsbOtgWatcherTest; |
|
48 |
|
49 public: |
|
50 |
|
51 /** |
|
52 * Two-phased constructor. |
|
53 * @param ?arg1 ?description |
|
54 * @param ?arg2 ?description |
|
55 */ |
|
56 // ?IMPORT_C |
|
57 static CUsbMessageNotificationObserver* NewL(RUsb* aUsb); |
|
58 |
|
59 /** |
|
60 * Destructor. |
|
61 */ |
|
62 virtual ~CUsbMessageNotificationObserver(); |
|
63 |
|
64 void SubscribeL(MUsbMessageNotificationObserver&); |
|
65 |
|
66 void UnsubscribeL(MUsbMessageNotificationObserver&); |
|
67 |
|
68 void TriggerMessageNotificationReceivedL(TInt); |
|
69 void TriggerBadHubPositionL(); |
|
70 void TriggerVBusErrorL(); |
|
71 void TriggerSrpReceivedL(); |
|
72 void TriggerSessionRequestedL(); |
|
73 |
|
74 private: |
|
75 |
|
76 CUsbMessageNotificationObserver(RUsb* aUsb); |
|
77 |
|
78 void ConstructL(); |
|
79 |
|
80 private: |
|
81 // data |
|
82 |
|
83 // The observer reports to own observers |
|
84 // Owns |
|
85 MUsbMessageNotificationObserver* iObserver; |
|
86 |
|
87 // Notifications come from USB |
|
88 // Not own |
|
89 RUsb* iUsb; |
|
90 |
|
91 // Info from notification comes to this member |
|
92 TInt iMessage; |
|
93 |
|
94 }; |
|
95 |
|
96 #endif // C_USBMESSAGENOTIFICATIONOBSERVER_H |
|