|
1 /* |
|
2 * Copyright (c) 2006 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: Helper class for handling change notifications of |
|
15 * PubSub properties and CenRep keys. |
|
16 * |
|
17 */ |
|
18 |
|
19 |
|
20 #ifndef BTENGSETTINGSNOTIFY_H |
|
21 #define BTENGSETTINGSNOTIFY_H |
|
22 |
|
23 |
|
24 #include "btengactive.h" |
|
25 #include "btengclient.h" |
|
26 |
|
27 class MBTEngSettingsObserver; |
|
28 class CRepository; |
|
29 |
|
30 /** |
|
31 * Class CBTEngSettingsNotify |
|
32 * |
|
33 * ?more_complete_description |
|
34 * |
|
35 * @lib btengsettings.lib |
|
36 * @since S60 v3.2 |
|
37 */ |
|
38 NONSHARABLE_CLASS( CBTEngSettingsNotify ) : public CBase, |
|
39 public MBTEngActiveObserver |
|
40 { |
|
41 |
|
42 public: |
|
43 |
|
44 /** |
|
45 * Two-phase constructor |
|
46 * |
|
47 * @since S60 v3.2 |
|
48 * @param aObserver Pointer to callback interface that receives notification |
|
49 * that a setting has changed. |
|
50 * @return Pointer to the constructed CBTEngSettingsNotify object. |
|
51 */ |
|
52 static CBTEngSettingsNotify* NewL( MBTEngSettingsObserver* aObserver ); |
|
53 |
|
54 /** |
|
55 * Destructor |
|
56 */ |
|
57 virtual ~CBTEngSettingsNotify(); |
|
58 |
|
59 /** |
|
60 * Toggles the Bluetooth power state (on or off). Power will be switched on |
|
61 * for the duriation of the session. It will also be turned off (gracefully, |
|
62 * if no permanent connection exists) if this object is destroyed. |
|
63 * Note: power will only be switched off gracefully if it has also been |
|
64 * switched on through this method, otherwise KErrAccessDenied will be |
|
65 * returned. |
|
66 * |
|
67 * @since S60 v5.0 |
|
68 * @return KErrNone on success, otherwise a system wide error code. |
|
69 */ |
|
70 TInt TogglePowerTemporarily(); |
|
71 |
|
72 // from base class MBTEngActiveObserver |
|
73 |
|
74 /** |
|
75 * From MBTEngActiveObserver. |
|
76 * Handle a setting change. |
|
77 * |
|
78 * @since S60 v3.2 |
|
79 * @param ?arg1 ?description |
|
80 */ |
|
81 virtual void RequestCompletedL( CBTEngActive* aActive, TInt aId, |
|
82 TInt aStatus ); |
|
83 |
|
84 /** |
|
85 * From MBTEngActiveObserver. |
|
86 * Handle an error in the setting change handling. |
|
87 * |
|
88 * @since S60 v3.2 |
|
89 * @param ?arg1 ?description |
|
90 */ |
|
91 virtual void HandleError( CBTEngActive* aActive, TInt aId, TInt aError ); |
|
92 |
|
93 private: |
|
94 |
|
95 /** |
|
96 * C++ default constructor |
|
97 * |
|
98 * @since S60 v3.2 |
|
99 * @param aObserver Pointer to callback interface that receives notification |
|
100 * that a setting has changed. |
|
101 */ |
|
102 CBTEngSettingsNotify( MBTEngSettingsObserver* aObserver ); |
|
103 |
|
104 /** |
|
105 * Symbian 2nd-phase constructor |
|
106 * |
|
107 * @since S60 v3.2 |
|
108 */ |
|
109 void ConstructL(); |
|
110 |
|
111 private: // data |
|
112 |
|
113 /** |
|
114 * Active object for watching power mode setting changes. |
|
115 * Own. |
|
116 */ |
|
117 CBTEngActive* iPowerKeyWatcher; |
|
118 |
|
119 /** |
|
120 * Active object for watching visibility mode setting changes. |
|
121 * Own. |
|
122 */ |
|
123 CBTEngActive* iVisiKeyWatcher; |
|
124 |
|
125 /** |
|
126 * Session with the central repository for power mode setting. |
|
127 * Own. |
|
128 */ |
|
129 CRepository* iPowerKeyCenRep; |
|
130 |
|
131 /** |
|
132 * Session with the central repository for visibility mode setting. |
|
133 * Own. |
|
134 */ |
|
135 CRepository* iVisiKeyCenRep; |
|
136 |
|
137 /** |
|
138 * Client to notify of changes. |
|
139 * Not own. |
|
140 */ |
|
141 MBTEngSettingsObserver* iObserver; |
|
142 |
|
143 /** |
|
144 * Handle to BTEng server for turning Bluetooth on temporarily. |
|
145 */ |
|
146 RBTEng iBTeng; |
|
147 }; |
|
148 |
|
149 |
|
150 #endif // BTENGSETTINGSNOTIFY_H |