equal
deleted
inserted
replaced
43 #include <QDateTime> |
43 #include <QDateTime> |
44 #include <limits.h> |
44 #include <limits.h> |
45 #include "qgeopositioninfosource_s60_p.h" |
45 #include "qgeopositioninfosource_s60_p.h" |
46 #include "qgeosatelliteinfosource_s60_p.h" |
46 #include "qgeosatelliteinfosource_s60_p.h" |
47 #include "qgeosatelliteinfosource.h" |
47 #include "qgeosatelliteinfosource.h" |
|
48 #include "qgeosatelliteinfo.h" |
48 |
49 |
49 #include <QList> |
50 #include <QList> |
50 |
51 |
51 QTM_BEGIN_NAMESPACE |
52 QTM_BEGIN_NAMESPACE |
52 |
53 |
152 |
153 |
153 if (index >= 0) { |
154 if (index >= 0) { |
154 mRegUpdateAO = temp; |
155 mRegUpdateAO = temp; |
155 mRegUpdateAO->setUpdateInterval(0); |
156 mRegUpdateAO->setUpdateInterval(0); |
156 mCurrentModuleId = mList[index].mUid; |
157 mCurrentModuleId = mList[index].mUid; |
|
158 } else { |
|
159 delete temp; |
157 } |
160 } |
158 |
161 |
159 CleanupStack::Pop(2); |
162 CleanupStack::Pop(2); |
160 } |
163 } |
161 |
164 |
210 |
213 |
211 //private function : to get the index of the positioning method with time to first fix |
214 //private function : to get the index of the positioning method with time to first fix |
212 //lesser than timeout |
215 //lesser than timeout |
213 TInt CQGeoSatelliteInfoSourceS60::getMoreAccurateMethod(TInt aTimeout, TUint8 aBits) |
216 TInt CQGeoSatelliteInfoSourceS60::getMoreAccurateMethod(TInt aTimeout, TUint8 aBits) |
214 { |
217 { |
215 TInt index = -1, temp = INT_MAX; |
218 TInt index = -1; |
|
219 double temp = -1.0; |
216 |
220 |
217 TTimeIntervalMicroSeconds microSeconds; |
221 TTimeIntervalMicroSeconds microSeconds; |
218 |
222 |
219 //convert the timeout --> micro seconds |
223 //convert the timeout --> micro seconds |
220 microSeconds = aTimeout * 1000; |
224 microSeconds = aTimeout * 1000; |
226 if (mList[i].mIsAvailable |
230 if (mList[i].mIsAvailable |
227 && (mList[i].mStatus != TPositionModuleStatus::EDeviceUnknown) |
231 && (mList[i].mStatus != TPositionModuleStatus::EDeviceUnknown) |
228 && (mList[i].mStatus != TPositionModuleStatus::EDeviceError) |
232 && (mList[i].mStatus != TPositionModuleStatus::EDeviceError) |
229 && (((aBits >> i) & 1)) |
233 && (((aBits >> i) & 1)) |
230 && (mList[i].mTimeToFirstFix < microSeconds)) { |
234 && (mList[i].mTimeToFirstFix < microSeconds)) { |
231 if (mList[i].mHorizontalAccuracy < temp) { |
235 if ((temp == -1.0) || (mList[i].mHorizontalAccuracy < temp)) { |
232 index = i; |
236 index = i; |
233 temp = mList[i].mHorizontalAccuracy; |
237 temp = mList[i].mHorizontalAccuracy; |
234 } |
238 } |
235 } |
239 } |
236 } |
240 } |
265 time_to_first_fix = quality.TimeToFirstFix(); |
269 time_to_first_fix = quality.TimeToFirstFix(); |
266 |
270 |
267 //time taken for the subsequent fix |
271 //time taken for the subsequent fix |
268 time_to_next_fix = quality.TimeToNextFix(); |
272 time_to_next_fix = quality.TimeToNextFix(); |
269 |
273 |
270 |
|
271 if ((i = checkModule(id)) == -1) { |
274 if ((i = checkModule(id)) == -1) { |
272 //update the properties of the module |
275 //update the properties of the module |
273 |
276 |
274 //TPositionModuleId of the module |
277 //TPositionModuleId of the module |
275 mList[mListSize].mUid = id; |
278 mList[mListSize].mUid = id; |
323 mList[i].mUid)); |
326 mList[i].mUid)); |
324 |
327 |
325 if ((ret == KErrNone) && (temp != NULL)) { |
328 if ((ret == KErrNone) && (temp != NULL)) { |
326 temp->setUpdateInterval(interval); |
329 temp->setUpdateInterval(interval); |
327 |
330 |
|
331 if (mRegUpdateAO) |
|
332 delete mRegUpdateAO; |
328 mRegUpdateAO = temp; |
333 mRegUpdateAO = temp; |
329 |
334 |
330 //to be uncommented when startUpdates are done |
335 //to be uncommented when startUpdates are done |
331 |
336 |
332 if (mStartUpdates) |
337 if (mStartUpdates) |
348 if (id == mCurrentModuleId) { |
353 if (id == mCurrentModuleId) { |
349 TInt interval = 0; |
354 TInt interval = 0; |
350 |
355 |
351 TUint8 bits; |
356 TUint8 bits; |
352 |
357 |
353 delete mRegUpdateAO; |
358 if (mRegUpdateAO) |
354 |
359 delete mRegUpdateAO; |
355 |
360 |
356 bits = mModuleFlags; |
361 bits = mModuleFlags; |
357 |
362 |
358 do { |
363 do { |
359 //error = Get the index of the positioning module based on |
364 //error = Get the index of the positioning module based on |
393 |
398 |
394 } |
399 } |
395 |
400 |
396 //check if device status of the request update module changed |
401 //check if device status of the request update module changed |
397 if (id == mReqModuleId) { |
402 if (id == mReqModuleId) { |
398 delete mReqUpdateAO; |
403 if (mRegUpdateAO) |
|
404 delete mReqUpdateAO; |
399 mReqUpdateAO = NULL; |
405 mReqUpdateAO = NULL; |
400 mReqModuleId = TUid::Null(); |
406 mReqModuleId = TUid::Null(); |
401 emit requestTimeout(); |
407 emit requestTimeout(); |
402 } |
408 } |
403 |
409 |
419 TUint modCount; |
425 TUint modCount; |
420 |
426 |
421 //count on the modules currently supported by the device |
427 //count on the modules currently supported by the device |
422 mPositionServer.GetNumModules(modCount); |
428 mPositionServer.GetNumModules(modCount); |
423 |
429 |
424 for (TInt i = 0; i < modCount; i++) { |
430 for (TUint i = 0; i < modCount; i++) { |
425 //get module information |
431 //get module information |
426 mPositionServer.GetModuleInfoByIndex(i, moduleInfo); |
432 mPositionServer.GetModuleInfoByIndex(i, moduleInfo); |
427 |
433 |
428 if (moduleInfo.Capabilities() & TPositionModuleInfo::ECapabilitySatellite) { |
434 if (moduleInfo.Capabilities() & TPositionModuleInfo::ECapabilitySatellite) { |
429 //get module status |
435 //get module status |
463 void CQGeoSatelliteInfoSourceS60::TPositionSatelliteInfo2QGeoSatelliteInfo( |
469 void CQGeoSatelliteInfoSourceS60::TPositionSatelliteInfo2QGeoSatelliteInfo( |
464 TPositionSatelliteInfo aSatInfo, QList<QGeoSatelliteInfo> &qListSatInView, |
470 TPositionSatelliteInfo aSatInfo, QList<QGeoSatelliteInfo> &qListSatInView, |
465 QList<QGeoSatelliteInfo> &qListSatInUse) |
471 QList<QGeoSatelliteInfo> &qListSatInUse) |
466 { |
472 { |
467 TInt satInView = aSatInfo.NumSatellitesInView(); |
473 TInt satInView = aSatInfo.NumSatellitesInView(); |
468 TInt satUsed = aSatInfo.NumSatellitesUsed(); |
|
469 TSatelliteData satData; |
474 TSatelliteData satData; |
470 QGeoSatelliteInfo qInfo; |
475 QGeoSatelliteInfo qInfo; |
471 |
476 |
472 for (TInt i = 0; i < satInView; i++) { |
477 for (TInt i = 0; i < satInView; i++) { |
473 aSatInfo.GetSatelliteData(i, satData); |
478 aSatInfo.GetSatelliteData(i, satData); |
516 void CQGeoSatelliteInfoSourceS60::requestUpdate(int aTimeout) |
521 void CQGeoSatelliteInfoSourceS60::requestUpdate(int aTimeout) |
517 { |
522 { |
518 TInt index = -1; |
523 TInt index = -1; |
519 TUint8 bits; |
524 TUint8 bits; |
520 |
525 |
521 CQMLBackendAO *temp; |
526 CQMLBackendAO *temp = NULL; |
522 |
527 |
523 //requestupdate |
528 //requestupdate |
524 //return if already a request update is pending |
529 //return if already a request update is pending |
525 if (mReqUpdateAO && mReqUpdateAO->isRequestPending()) |
530 if (mReqUpdateAO && mReqUpdateAO->isRequestPending()) |
526 return; |
531 return; |
550 |
555 |
551 TRAPD(ret, temp = CQMLBackendAO::NewL(this, OnceUpdate, mList[index].mUid)); |
556 TRAPD(ret, temp = CQMLBackendAO::NewL(this, OnceUpdate, mList[index].mUid)); |
552 |
557 |
553 if ((ret == KErrNone) && (temp != NULL)) { |
558 if ((ret == KErrNone) && (temp != NULL)) { |
554 //delete the old reqest update |
559 //delete the old reqest update |
555 delete mReqUpdateAO; |
560 if (mReqUpdateAO) |
|
561 delete mReqUpdateAO; |
556 |
562 |
557 //set the requestAO to the newly created AO |
563 //set the requestAO to the newly created AO |
558 mReqUpdateAO = temp; |
564 mReqUpdateAO = temp; |
559 |
565 |
560 //set the request module ID |
566 //set the request module ID |
571 } while (index >= 0); |
577 } while (index >= 0); |
572 |
578 |
573 //cleanup resources if the invalid requpdate is still stored |
579 //cleanup resources if the invalid requpdate is still stored |
574 if (mReqUpdateAO) { |
580 if (mReqUpdateAO) { |
575 delete mReqUpdateAO; |
581 delete mReqUpdateAO; |
|
582 mReqUpdateAO = NULL; |
576 mReqModuleId = TUid::Null(); |
583 mReqModuleId = TUid::Null(); |
577 } |
584 } |
578 |
585 |
579 } |
586 } |
580 |
587 |