|
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 BTGPSNOKDEVICEHANDLER_H |
|
22 #define BTGPSNOKDEVICEHANDLER_H |
|
23 |
|
24 // INCLUDES |
|
25 #include <e32base.h> |
|
26 #include "BTGPSMessageListener.h" |
|
27 #include "BTGPSSettingsListener.h" |
|
28 #include "BTGPSDeviceListener.h" |
|
29 |
|
30 // CLASS DECLARATION |
|
31 class CBTGPSSettingManager; |
|
32 class CBTGPSConnectManager; |
|
33 class CBTGPSConstantsManager; |
|
34 class CBTGPSDeviceManager; |
|
35 class CBTGPSNokNightModeHandler; |
|
36 class TBTGPSNmeaParser; |
|
37 class CBTGPSDeviceListManager; |
|
38 |
|
39 |
|
40 /** |
|
41 * Handler for specific Nokia BT GPS device features. This class defines objects that |
|
42 * listen NMEA messages and show battery, external power and external antenna status |
|
43 * information note when specific messages received. It also monitoring night mode |
|
44 * status of the connected device. |
|
45 * |
|
46 */ |
|
47 class CBTGPSNokDeviceHandler: |
|
48 public CBase, |
|
49 private MBTGPSMessageListener, |
|
50 private MBTGPSSettingsListener, |
|
51 private MBTGPSDeviceListener |
|
52 { |
|
53 public: |
|
54 |
|
55 /** |
|
56 * Two-phase construction. |
|
57 * @param aConnectManager Reference to connect manager |
|
58 * @param aSettingManager Reference to setting manager |
|
59 * @param aConstantsManager Reference to constants manager |
|
60 * @param aDeviceManager Reference to device manager |
|
61 */ |
|
62 static CBTGPSNokDeviceHandler * NewL( |
|
63 CBTGPSConnectManager& aConnectManager, |
|
64 CBTGPSSettingManager& aSettingManager, |
|
65 CBTGPSConstantsManager& aConstantsManager, |
|
66 CBTGPSDeviceManager& aDeviceManager, |
|
67 CBTGPSDeviceListManager& aDeviceListManager); |
|
68 |
|
69 /** |
|
70 * Destructor |
|
71 */ |
|
72 virtual ~CBTGPSNokDeviceHandler(); |
|
73 |
|
74 private: |
|
75 /** |
|
76 * From MBTGPSMessageListener |
|
77 */ |
|
78 virtual void HandleMessage(const TBTGPSNmeaParser& aParser); |
|
79 |
|
80 /** |
|
81 * From MBTGPSSettingsListener |
|
82 */ |
|
83 virtual void HandleNightModeChange( |
|
84 const TBTGPSSettingsApi::TNightModeState aStatus ); |
|
85 |
|
86 /** |
|
87 * From MBTGPSDeviceListener |
|
88 */ |
|
89 virtual void BTDeviceStatusChanged( |
|
90 TInt aConnectStatus, |
|
91 TInt aDeviceType, |
|
92 TInt aErr=KErrNone); |
|
93 |
|
94 |
|
95 private: |
|
96 |
|
97 /** |
|
98 * Second phase of the construction |
|
99 */ |
|
100 void ConstructL(); |
|
101 |
|
102 /** |
|
103 * Private constructor |
|
104 */ |
|
105 CBTGPSNokDeviceHandler( |
|
106 CBTGPSConnectManager& aConnectManager, |
|
107 CBTGPSSettingManager& aSettingManager, |
|
108 CBTGPSConstantsManager& aConstantsManager, |
|
109 CBTGPSDeviceManager& aDeviceManager, |
|
110 CBTGPSDeviceListManager& aDeviceListManager); |
|
111 |
|
112 /** |
|
113 * Update device status to setting manager |
|
114 */ |
|
115 void UpdateDeviceStatus( |
|
116 TInt aBattLevel, |
|
117 TInt aBattStatus, |
|
118 TInt aExtPowStatus, |
|
119 TInt aExtAntStatus); |
|
120 |
|
121 /** |
|
122 * Handle PNOK STAT message |
|
123 */ |
|
124 void HandleStatMessage(const TBTGPSNmeaParser& aParser); |
|
125 |
|
126 /** |
|
127 * Update device version |
|
128 */ |
|
129 void UpdateDeviceVersion(const TBTGPSNmeaParser& aParser); |
|
130 |
|
131 /** |
|
132 * Check night mode status from PNOK nmea sentence |
|
133 */ |
|
134 void CheckNightModeStatus(TInt aStatus); |
|
135 |
|
136 /** |
|
137 * Update night mode on device according to setting |
|
138 */ |
|
139 void UpdateNightMode(TBTGPSSettingsApi::TNightModeState aSetting); |
|
140 |
|
141 /** |
|
142 * Update PSY state |
|
143 */ |
|
144 void UpdatePsyState( |
|
145 TInt aConnectStatus, |
|
146 TInt aDeviceType); |
|
147 |
|
148 /** |
|
149 * Update BT device info in setting |
|
150 */ |
|
151 void UpdateBtDeviceInfo( |
|
152 TInt aConnectStatus, |
|
153 TInt aDeviceType); |
|
154 |
|
155 private: |
|
156 //Connect manager |
|
157 CBTGPSConnectManager& iConnectManager; |
|
158 |
|
159 //Setting manager |
|
160 CBTGPSSettingManager& iSettingManager; |
|
161 |
|
162 //Constants manager |
|
163 CBTGPSConstantsManager& iConstantsManager; |
|
164 |
|
165 //Device manager |
|
166 CBTGPSDeviceManager& iDeviceManager; |
|
167 |
|
168 //Device List Manager |
|
169 CBTGPSDeviceListManager& iDeviceListManager; |
|
170 |
|
171 //Night mode handler |
|
172 CBTGPSNokNightModeHandler* iNightModeHandler; |
|
173 |
|
174 //Night mode status |
|
175 TInt iNightModeSetting; |
|
176 |
|
177 //Battery full or empty status |
|
178 TInt iBattStatus; |
|
179 |
|
180 //Ext power status; |
|
181 TInt iExtPowerStatus; |
|
182 |
|
183 //Ext antenna status; |
|
184 TInt iExtAntennaStatus; |
|
185 |
|
186 //Previous BT device type |
|
187 TInt iPreviousDeviceType; |
|
188 }; |
|
189 #endif |
|
190 // End of File |
|
191 |