|
1 /* |
|
2 * Copyright (c) 2005-2009 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 |
|
19 |
|
20 |
|
21 #ifndef BTGPSSETTINGMANAGER_H |
|
22 #define BTGPSSETTINGMANAGER_H |
|
23 |
|
24 // INCLUDES |
|
25 |
|
26 #include <e32base.h> |
|
27 #include <e32property.h> |
|
28 #include <centralrepository.h> |
|
29 #include "BTGPSSettingsApi.h" |
|
30 #include "BtGpsPsyPrivatePSKeys.h" |
|
31 |
|
32 class TBTSockAddr; |
|
33 class MBTGPSSettingsListener; |
|
34 |
|
35 /** |
|
36 * This class manage settings stored in Central Repositary and Publish&Subsciption. |
|
37 * It reads UI settings from CR and inform listeners if there is UI settings |
|
38 * change. It also updates BT GPS PSY events to P&S if needed. |
|
39 * |
|
40 */ |
|
41 |
|
42 class CBTGPSSettingManager : |
|
43 public CActive |
|
44 { |
|
45 public: |
|
46 |
|
47 /** |
|
48 * Two phase constructor. |
|
49 */ |
|
50 static CBTGPSSettingManager* NewL(); |
|
51 |
|
52 /** |
|
53 * Destructor |
|
54 */ |
|
55 virtual ~CBTGPSSettingManager(); |
|
56 |
|
57 /** |
|
58 * Updates the BT GPS PSY status |
|
59 * @param aStatus Status of the BT GPS PSY |
|
60 * @return The error code |
|
61 */ |
|
62 TInt UpdatePsyState(const TBTGPSPSYState aStatus); |
|
63 |
|
64 /** |
|
65 * Updates the status of the BT GPS device |
|
66 * @param aBatteryLevel The battery level of BT GPS device |
|
67 * @param aExtPowerState The ext. antenna state of BT GPS device |
|
68 * @param aExtAntennaState The ext. power state of BT GPS device |
|
69 * @param aBatteryState The battery state of BT GPS device |
|
70 * @return The error code |
|
71 */ |
|
72 TInt UpdateDeviceStatus(const TInt aBatteryLevel, |
|
73 const TBTGPSExtPowerState aExtPowerState, |
|
74 const TBTGPSExtAntennaState aExtAntennaState, |
|
75 const TBTGPSBatteryState aBatteryState); |
|
76 |
|
77 /** |
|
78 * Updates the versions of the BT GPS device |
|
79 * @param aID The BT GPS device name |
|
80 * @param aBTHW The BT HW versio of BT GPS device |
|
81 * @param aBTSW The BT SW versio of BT GPS device |
|
82 * @param aGPSHW The GPS HW versio of BT GPS device |
|
83 * @param aGPSSW The GPS SW versio of BT GPS device |
|
84 * @return The error code |
|
85 */ |
|
86 TInt UpdateVersions(const TDesC8& aID, |
|
87 const TDesC8& aBTHW, |
|
88 const TDesC8& aBTSW, |
|
89 const TDesC8& aGPSHW, |
|
90 const TDesC8& aGPSSW); |
|
91 |
|
92 /** |
|
93 * Get the night mode status |
|
94 * @param aStatus Status of the night mode |
|
95 * @return The error code |
|
96 */ |
|
97 TInt GetNightModeSetting(TBTGPSSettingsApi::TNightModeState& aStatus); |
|
98 |
|
99 /** |
|
100 * Gets the BT address information |
|
101 * @param aValid Address validity information |
|
102 * @param aAddress The address of the BT device |
|
103 * @return The completion code |
|
104 */ |
|
105 TInt GetBTDeviceInfo( TInt& aValid, TBTSockAddr& aAddress ); |
|
106 |
|
107 /** |
|
108 * Sets the BT address information |
|
109 * @param aValid Address validity information. |
|
110 * @param aAddress The address of the BT device |
|
111 * @return The completion code |
|
112 */ |
|
113 TInt UpdateBTDeviceInfo(TInt aValid, const TBTSockAddr& aAddress ); |
|
114 |
|
115 /** |
|
116 * Add listener |
|
117 * @param aListener Reference to listener |
|
118 */ |
|
119 void AddListenerL(MBTGPSSettingsListener& aListener); |
|
120 |
|
121 /** |
|
122 * Remove listener |
|
123 * @param aListener Reference to listener |
|
124 */ |
|
125 void RemoveListener(MBTGPSSettingsListener& aListener); |
|
126 |
|
127 protected: |
|
128 /** |
|
129 * Derived from CActive |
|
130 */ |
|
131 void RunL(); |
|
132 |
|
133 /** |
|
134 * Derived from CActive |
|
135 */ |
|
136 void DoCancel(); |
|
137 |
|
138 private: |
|
139 |
|
140 /** |
|
141 * Second phase of the construction |
|
142 */ |
|
143 void ConstructL(); |
|
144 |
|
145 /** |
|
146 * Private constructor |
|
147 */ |
|
148 CBTGPSSettingManager(); |
|
149 |
|
150 /** |
|
151 * Handle Settings change |
|
152 */ |
|
153 void HandleSettingsChange(); |
|
154 |
|
155 /** |
|
156 * Reset the published statuses of the PSY properties trought P&S API |
|
157 */ |
|
158 void ResetEventStatuses(); |
|
159 |
|
160 private: |
|
161 |
|
162 //UI event listener |
|
163 RArray<MBTGPSSettingsListener*> iListenerArray; |
|
164 |
|
165 //CenRep Settings |
|
166 CRepository* iSettings; |
|
167 |
|
168 //UI Information |
|
169 RProperty iEvents; |
|
170 |
|
171 }; |
|
172 |
|
173 #endif |
|
174 |
|
175 // End of File |
|
176 |