|
1 /* |
|
2 * Copyright (c) 2008 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: Usb observer definition for fmtx watcher plugin. |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 #ifndef HWRMFMTXUSBOBSERVER_H |
|
20 #define HWRMFMTXUSBOBSERVER_H |
|
21 |
|
22 #include <usbman.h> |
|
23 #include "hwrmfmtxwatcherplugin.h" |
|
24 #include "hwrmfmtxconnobserver.h" |
|
25 |
|
26 /** |
|
27 * Active object for obtaining notification of changes in USB connections. |
|
28 * |
|
29 * @since S60 3.2 |
|
30 * @lib hwrmfmtxwatcherplugin.lib |
|
31 */ |
|
32 NONSHARABLE_CLASS(CHWRMFmtxUsbObserver) : public CActive, |
|
33 public MHWRMFmtxConnObserver |
|
34 { |
|
35 public: |
|
36 |
|
37 /** |
|
38 * This is a two-phase constructor method that is used to create a new |
|
39 * instance for listening to the changes in USB connections. |
|
40 * |
|
41 * @param aObserver A reference to an observer instance. |
|
42 * @return A pointer to a new instance of the CHWRMFmtxUsbObserver class. |
|
43 * |
|
44 * @leave One of the Symbian OS error codes. |
|
45 */ |
|
46 static CHWRMFmtxUsbObserver* NewL( MHWRMFmtxConnObserverCallback& aObserver ); |
|
47 |
|
48 /** |
|
49 * Destructor. |
|
50 */ |
|
51 ~CHWRMFmtxUsbObserver(); |
|
52 |
|
53 // From MHWRMFmtxConnObserver |
|
54 TBool GetStatusL(); |
|
55 void StartObservingL(); |
|
56 void StopObserving(); |
|
57 |
|
58 private: |
|
59 |
|
60 /** |
|
61 * Constructor. |
|
62 * |
|
63 * @param aObserver A reference to an observer instance. |
|
64 */ |
|
65 CHWRMFmtxUsbObserver( MHWRMFmtxConnObserverCallback& aObserver ); |
|
66 |
|
67 /** |
|
68 * By default Symbian OS constructor is private. |
|
69 */ |
|
70 void ConstructL(); |
|
71 |
|
72 /** |
|
73 * Orders USB notification. |
|
74 */ |
|
75 void OrderUsbNotification(); |
|
76 |
|
77 protected: |
|
78 |
|
79 // from CActive |
|
80 void RunL(); |
|
81 void DoCancel(); |
|
82 |
|
83 private: |
|
84 |
|
85 /** |
|
86 * Handle to usbman. |
|
87 */ |
|
88 RUsb iUsbMan; |
|
89 |
|
90 /** |
|
91 * Storage for USB device state. |
|
92 * Updated upon completion of USB notification. |
|
93 */ |
|
94 TUsbDeviceState iDeviceState; |
|
95 |
|
96 /** |
|
97 * Response callback pointer. |
|
98 */ |
|
99 MHWRMFmtxConnObserverCallback& iCallback; |
|
100 |
|
101 /** |
|
102 * Stores USB connection status, ETrue if connected. |
|
103 * Used for filtering out excess USB configuration change notifications. |
|
104 */ |
|
105 TBool iConnected; |
|
106 }; |
|
107 |
|
108 |
|
109 #endif // HWRMFMTXUSBOBSERVER_H |
|
110 |
|
111 // End of File |