|
1 /* |
|
2 * ============================================================================ |
|
3 * Name : btnotifsettingstracker.h |
|
4 * Part of : BTProximity / BTProximity |
|
5 * Description : Class for tracking Bluetooth settings, and also for |
|
6 * handling notes unrelated to specific connection. |
|
7 * |
|
8 * Copyright © 2009 Nokia Corporation and/or its subsidiary(-ies). |
|
9 * All rights reserved. |
|
10 * This component and the accompanying materials are made available |
|
11 * under the terms of "Eclipse Public License v1.0" |
|
12 * which accompanies this distribution, and is available |
|
13 * at the URL "http://www.eclipse.org/legal/epl-v10.html". |
|
14 * |
|
15 * Initial Contributors: |
|
16 * Nokia Corporation - initial contribution. |
|
17 * |
|
18 * Contributors: |
|
19 * Nokia Corporation |
|
20 * ============================================================================ |
|
21 * Template version: 4.2 |
|
22 */ |
|
23 |
|
24 #ifndef BTNOTIFSETTINGSTRACKER_H |
|
25 #define BTNOTIFSETTINGSTRACKER_H |
|
26 |
|
27 |
|
28 #include <e32base.h> |
|
29 #include <btengsettings.h> |
|
30 |
|
31 #include "bluetoothnotification.h" |
|
32 |
|
33 class CBTNotifServer; |
|
34 |
|
35 /** |
|
36 * CBTNotifSettingsTracker keeps track of local device settings |
|
37 * |
|
38 * @since Symbian^4 |
|
39 */ |
|
40 NONSHARABLE_CLASS( CBTNotifSettingsTracker ) : public CBase, |
|
41 public MBTEngSettingsObserver, |
|
42 public MBTNotificationResult |
|
43 { |
|
44 |
|
45 public: |
|
46 |
|
47 /** |
|
48 * Two-phased constructor. |
|
49 * @param aServer Pointer to our parent |
|
50 */ |
|
51 static CBTNotifSettingsTracker* NewL( CBTNotifServer* aServer ); |
|
52 |
|
53 /** |
|
54 * Destructor. |
|
55 */ |
|
56 virtual ~CBTNotifSettingsTracker(); |
|
57 |
|
58 /** |
|
59 * Return the current power state |
|
60 * |
|
61 * @since Symbian^4 |
|
62 * @return The current power state. |
|
63 */ |
|
64 inline TBTPowerStateValue GetPowerState() const |
|
65 { return iPowerState; } |
|
66 |
|
67 /** |
|
68 * Processes a message from a notifier client related to settings. |
|
69 * |
|
70 * @since Symbian^4 |
|
71 * @param aMessage The message containing the details of the client request. |
|
72 */ |
|
73 void DispatchNotifierMessageL( const RMessage2& aMessage ); |
|
74 |
|
75 /** |
|
76 * Cancels an oustanding message from a notifier client related to settings. |
|
77 * |
|
78 * @since Symbian^4 |
|
79 * @param aMessage The message containing the details of the original client request. |
|
80 */ |
|
81 void CancelNotifierMessageL( const RMessage2& aMessage ); |
|
82 |
|
83 // from base class MBTEngSettingsObserver |
|
84 |
|
85 /** |
|
86 * From MBTEngSettingsObserver. |
|
87 * Provides notification of changes in the power state |
|
88 * of the Bluetooth hardware. |
|
89 * |
|
90 * @since Symbian^4 |
|
91 * @param aState EBTPowerOff if the BT hardware has been turned off, |
|
92 * EBTPowerOn if it has been turned off. |
|
93 */ |
|
94 virtual void PowerStateChanged( TBTPowerStateValue aState ); |
|
95 |
|
96 /** |
|
97 * From MBTEngSettingsObserver. |
|
98 * Provides notification of changes in the discoverability |
|
99 * mode of the Bluetooth hardware. |
|
100 * |
|
101 * @since Symbian^4 |
|
102 * @param aState EBTDiscModeHidden if the BT hardware is in hidden mode, |
|
103 * EBTDiscModeGeneral if it is in visible mode. |
|
104 */ |
|
105 virtual void VisibilityModeChanged( TBTVisibilityMode aState ); |
|
106 |
|
107 // from base class MBTNotificationResult |
|
108 |
|
109 /** |
|
110 * From MBTNotificationResult. |
|
111 * Handle an intermediate result from a user query. |
|
112 * This ffunction is called if the user query passes information |
|
113 * back before it has finished i.e. is dismissed. The final acceptance/ |
|
114 * denial of a query is passed back in MBRNotificationClosed. |
|
115 * |
|
116 * @since Symbian^4 |
|
117 * @param aData the returned data. The actual format |
|
118 * is dependent on the actual notifier. |
|
119 */ |
|
120 virtual void MBRDataReceived( CHbSymbianVariantMap& aData ); |
|
121 |
|
122 /** |
|
123 * From MBTNotificationResult. |
|
124 * The notification is finished. The resulting data (e.g. user input or |
|
125 * acceptance/denial of the query) is passed back here. |
|
126 * |
|
127 * @since Symbian^4 |
|
128 * @param aErr KErrNone or one of the system-wide error codes. |
|
129 * @param aData the returned data. The actual format |
|
130 * is dependent on the actual notifier. |
|
131 */ |
|
132 virtual void MBRNotificationClosed( TInt aError, const TDesC8& aData ); |
|
133 |
|
134 private: |
|
135 |
|
136 CBTNotifSettingsTracker( CBTNotifServer* aServer ); |
|
137 |
|
138 void ConstructL(); |
|
139 |
|
140 private: // data |
|
141 |
|
142 /** |
|
143 * Local copy of current power state. |
|
144 */ |
|
145 TBTPowerStateValue iPowerState; |
|
146 |
|
147 /** |
|
148 * Local copy of current visibility mode. |
|
149 */ |
|
150 TBTVisibilityMode iVisibilityMode; |
|
151 |
|
152 /** |
|
153 * ?description_of_pointer_member |
|
154 * Own. |
|
155 */ |
|
156 CBTEngSettings* iSettings; |
|
157 |
|
158 /** |
|
159 * Pointer to an outstanding user interaction. |
|
160 * Not own. |
|
161 */ |
|
162 CBluetoothNotification* iNotification; |
|
163 |
|
164 /** |
|
165 * Reference to our parent the server class. |
|
166 * Not own. |
|
167 */ |
|
168 CBTNotifServer* iServer; |
|
169 |
|
170 }; |
|
171 |
|
172 #endif // BTNOTIFSETTINGSTRACKER_H |