equal
deleted
inserted
replaced
132 QString CSubscriberInfo::imsi() const |
132 QString CSubscriberInfo::imsi() const |
133 { |
133 { |
134 return m_imsi; |
134 return m_imsi; |
135 } |
135 } |
136 |
136 |
137 /* |
|
138 CIndicatorInfo::CIndicatorInfo(CTelephony &telephony) : CTelephonyInfo(telephony), |
|
139 m_batteryInfoV1Pckg(m_batteryInfoV1) |
|
140 { |
|
141 } |
|
142 |
|
143 void CIndicatorInfo::DoCancel() |
|
144 { |
|
145 m_telephony.CancelAsync(CTelephony::EGetIndicatorCancel); |
|
146 } |
|
147 |
|
148 bool CIndicatorInfo::isBatteryCharging() const |
|
149 { |
|
150 m_telephony.GetIndicator(iStatus,iIndicatorV1Pckg); |
|
151 makeRequest(); |
|
152 |
|
153 if (iIndicatorV1.iIndicator & CTelephony::KIndChargerConnected) { |
|
154 chargeStatus = true; |
|
155 } |
|
156 return chargeStatus; |
|
157 } |
|
158 */ |
|
159 |
|
160 CBatteryInfo::CBatteryInfo(CTelephony &telephony) : CTelephonyInfo(telephony), |
137 CBatteryInfo::CBatteryInfo(CTelephony &telephony) : CTelephonyInfo(telephony), |
161 m_initializing(true), m_batteryInfoV1Pckg(m_batteryInfoV1) |
138 m_initializing(true), m_batteryInfoV1Pckg(m_batteryInfoV1) |
162 { |
139 { |
163 m_telephony.GetBatteryInfo(iStatus, m_batteryInfoV1Pckg); |
140 m_telephony.GetBatteryInfo(iStatus, m_batteryInfoV1Pckg); |
164 makeRequest(); |
141 makeRequest(); |
165 |
142 |
166 m_batteryLevel = m_batteryInfoV1.iChargeLevel; |
143 m_batteryLevel = m_batteryInfoV1.iChargeLevel; |
167 m_previousBatteryLevel = m_batteryLevel; |
144 m_previousBatteryLevel = m_batteryLevel; |
168 |
145 |
169 m_powerState = m_batteryInfoV1.iStatus; |
|
170 m_previousPowerState = m_powerState; |
|
171 |
|
172 m_initializing = false; |
146 m_initializing = false; |
173 |
147 |
174 startMonitoring(); |
148 startMonitoring(); |
175 } |
149 } |
176 |
150 |
178 { |
152 { |
179 if (m_initializing) { |
153 if (m_initializing) { |
180 CTelephonyInfo::RunL(); |
154 CTelephonyInfo::RunL(); |
181 } else { |
155 } else { |
182 m_batteryLevel = m_batteryInfoV1.iChargeLevel; |
156 m_batteryLevel = m_batteryInfoV1.iChargeLevel; |
183 m_powerState = m_batteryInfoV1.iStatus; |
|
184 |
157 |
185 foreach (MTelephonyInfoObserver *observer, m_observers) { |
158 foreach (MTelephonyInfoObserver *observer, m_observers) { |
186 if (m_batteryLevel != m_previousBatteryLevel) { |
159 if (m_batteryLevel != m_previousBatteryLevel) { |
187 observer->batteryLevelChanged(); |
160 observer->batteryLevelChanged(); |
188 } |
161 } |
189 if (m_powerState != m_previousPowerState) { |
|
190 observer->powerStateChanged(); |
|
191 } |
|
192 } |
162 } |
193 m_previousBatteryLevel = m_batteryLevel; |
163 m_previousBatteryLevel = m_batteryLevel; |
194 m_previousPowerState = m_powerState; |
|
195 startMonitoring(); |
164 startMonitoring(); |
196 } |
165 } |
197 } |
166 } |
198 |
167 |
199 void CBatteryInfo::DoCancel() |
168 void CBatteryInfo::DoCancel() |
206 } |
175 } |
207 |
176 |
208 int CBatteryInfo::batteryLevel() const |
177 int CBatteryInfo::batteryLevel() const |
209 { |
178 { |
210 return m_batteryLevel; |
179 return m_batteryLevel; |
211 } |
|
212 |
|
213 CTelephony::TBatteryStatus CBatteryInfo::powerState() const |
|
214 { |
|
215 return m_powerState; |
|
216 } |
180 } |
217 |
181 |
218 void CBatteryInfo::startMonitoring() |
182 void CBatteryInfo::startMonitoring() |
219 { |
183 { |
220 m_telephony.NotifyChange(iStatus, CTelephony::EBatteryInfoChange, m_batteryInfoV1Pckg); |
184 m_telephony.NotifyChange(iStatus, CTelephony::EBatteryInfoChange, m_batteryInfoV1Pckg); |
235 m_previousNetworkId = m_networkId; |
199 m_previousNetworkId = m_networkId; |
236 |
200 |
237 TBuf<CTelephony::KNetworkCountryCodeSize> countryCode = m_networkInfoV1.iCountryCode; |
201 TBuf<CTelephony::KNetworkCountryCodeSize> countryCode = m_networkInfoV1.iCountryCode; |
238 m_countryCode = QString::fromUtf16(countryCode.Ptr(), countryCode.Length()); |
202 m_countryCode = QString::fromUtf16(countryCode.Ptr(), countryCode.Length()); |
239 m_previousCountryCode = m_countryCode; |
203 m_previousCountryCode = m_countryCode; |
240 |
204 TBuf<CTelephony::KNetworkLongNameSize> longName = m_networkInfoV1.iLongName; |
241 TBuf<CTelephony::KNetworkLongNameSize> networkName = m_networkInfoV1.iLongName; |
205 if (longName.Length() > 0) { |
242 m_networkName = QString::fromUtf16(networkName.Ptr(), networkName.Length()); |
206 m_networkName = QString::fromUtf16(longName.Ptr(), longName.Length()); |
|
207 } else { |
|
208 TBuf<CTelephony::KNetworkDisplayTagSize> displayTag = m_networkInfoV1.iDisplayTag; |
|
209 m_networkName = QString::fromUtf16(displayTag.Ptr(), displayTag.Length()); |
|
210 } |
243 m_previousNetworkName = m_networkName; |
211 m_previousNetworkName = m_networkName; |
244 |
212 |
245 m_networkMode = m_networkInfoV1.iMode; |
213 m_networkMode = m_networkInfoV1.iMode; |
246 m_previousNetworkMode = m_networkMode; |
214 m_previousNetworkMode = m_networkMode; |
247 |
215 |
262 m_networkId = QString::fromUtf16(networkId.Ptr(), networkId.Length()); |
230 m_networkId = QString::fromUtf16(networkId.Ptr(), networkId.Length()); |
263 |
231 |
264 TBuf<CTelephony::KNetworkCountryCodeSize> countryCode = m_networkInfoV1.iCountryCode; |
232 TBuf<CTelephony::KNetworkCountryCodeSize> countryCode = m_networkInfoV1.iCountryCode; |
265 m_countryCode = QString::fromUtf16(countryCode.Ptr(), countryCode.Length()); |
233 m_countryCode = QString::fromUtf16(countryCode.Ptr(), countryCode.Length()); |
266 |
234 |
267 TBuf<CTelephony::KNetworkLongNameSize> networkName = m_networkInfoV1.iLongName; |
235 TBuf<CTelephony::KNetworkLongNameSize> longName = m_networkInfoV1.iLongName; |
268 m_networkName = QString::fromUtf16(networkName.Ptr(), |
236 if (longName.Length() > 0) { |
269 networkName.Length()); |
237 m_networkName = QString::fromUtf16(longName.Ptr(), longName.Length()); |
|
238 } else { |
|
239 TBuf<CTelephony::KNetworkDisplayTagSize> displayTag = m_networkInfoV1.iDisplayTag; |
|
240 m_networkName = QString::fromUtf16(displayTag.Ptr(), displayTag.Length()); |
|
241 } |
270 |
242 |
271 m_networkMode = m_networkInfoV1.iMode; |
243 m_networkMode = m_networkInfoV1.iMode; |
272 |
244 |
273 foreach (MTelephonyInfoObserver *observer, m_observers) { |
245 foreach (MTelephonyInfoObserver *observer, m_observers) { |
274 if (m_networkId != m_previousNetworkId) { |
246 if (m_networkId != m_previousNetworkId) { |