193 */ |
242 */ |
194 IMPORT_C void SetObserver( MLocationTrailObserver* aObserver ); |
243 IMPORT_C void SetObserver( MLocationTrailObserver* aObserver ); |
195 |
244 |
196 /** |
245 /** |
197 * Set observer (TrackLog) for notifying new locations in location trail |
246 * Set observer (TrackLog) for notifying new locations in location trail |
|
247 * @param aObserver, An observer for location changes |
198 */ |
248 */ |
199 IMPORT_C void SetAddObserver( MLocationAddObserver* aObserver ); |
249 IMPORT_C void SetAddObserver( MLocationAddObserver* aObserver ); |
200 |
250 |
|
251 |
|
252 /** |
|
253 * Update network information |
|
254 * |
|
255 */ |
201 static TInt UpdateNetworkInfo( TAny* aAny ); |
256 static TInt UpdateNetworkInfo( TAny* aAny ); |
|
257 |
|
258 /* |
|
259 * creates a location object from the given location data and objectId |
|
260 * @param aLocationData the location data |
|
261 * @param aObjectId the object Id |
|
262 */ |
202 |
263 |
203 IMPORT_C void CreateLocationObjectL( const TLocationData& aLocationData, |
264 IMPORT_C void CreateLocationObjectL( const TLocationData& aLocationData, |
204 const TUint& aObjectId ); |
265 const TUint& aObjectId ); |
205 |
266 |
|
267 |
|
268 /** |
|
269 * Handle the photos taken by phone camera. |
|
270 * @param aObjectId Object id |
|
271 */ |
206 IMPORT_C void LocationSnapshotL( const TUint& aObjectId ); |
272 IMPORT_C void LocationSnapshotL( const TUint& aObjectId ); |
207 |
273 |
|
274 /** |
|
275 * Creates a location object with given location data |
|
276 * @param aLocationData The location data |
|
277 * @return The locationId |
|
278 */ |
208 TItemId DoCreateLocationL( const TLocationData& aLocationData ); |
279 TItemId DoCreateLocationL( const TLocationData& aLocationData ); |
209 |
280 |
|
281 /** |
|
282 * Creates a "contains" relation for the given ObjectId and LocationId and adds it to the iMdeSession |
|
283 * @param aObjectId Object id |
|
284 * @param aLocationId location id |
|
285 * @return item id |
|
286 */ |
210 TItemId CreateRelationL( const TUint& aObjectId, const TUint& aLocationId ); |
287 TItemId CreateRelationL( const TUint& aObjectId, const TUint& aLocationId ); |
211 |
288 /** |
|
289 * Sets the CMdESession for tagcreation |
|
290 * @param aSession The CMdESession object |
|
291 */ |
212 IMPORT_C void SetMdeSession( CMdESession* aSession ); |
292 IMPORT_C void SetMdeSession( CMdESession* aSession ); |
213 |
293 |
|
294 /** |
|
295 * Sets the current location trail state to Stop |
|
296 */ |
214 IMPORT_C void SetStateToStopping(); |
297 IMPORT_C void SetStateToStopping(); |
215 |
298 |
|
299 /** |
|
300 * returns the timevalue of the CMdEObject corresponding to a given ObjectId |
|
301 * @param aObjectId the objectId |
|
302 * @return the timevalue associated with given object |
|
303 */ |
216 TTime GetMdeObjectTimeL( TItemId aObjectId ); |
304 TTime GetMdeObjectTimeL( TItemId aObjectId ); |
217 |
305 |
|
306 /** |
|
307 * Checks if Remapping is needed |
|
308 * @return Boolean to indicate if remapping is needed or not |
|
309 */ |
218 IMPORT_C TBool RemappingNeeded(); |
310 IMPORT_C TBool RemappingNeeded(); |
219 |
311 |
|
312 |
220 IMPORT_C TBool IsLowBattery(); |
313 IMPORT_C TBool IsLowBattery(); |
221 |
314 |
|
315 /** |
|
316 * Checks if geotagging is in progress |
|
317 * @return Boolean to indicate if geotagging is in progress |
|
318 */ |
|
319 IMPORT_C TBool TaggingInProgress(); |
|
320 |
|
321 |
|
322 /** |
|
323 * Initiates geotagging |
|
324 * @param aConnectionOption connection option,silent or not |
|
325 * @return Etrue if geotagging is started |
|
326 */ |
|
327 IMPORT_C TBool StartGeoTagging(const TConnectionOption aConnectionOption); |
|
328 |
|
329 /** |
|
330 * Cancels the geotagging |
|
331 */ |
|
332 IMPORT_C void CancelGeoTagging(); |
|
333 |
222 public: // from MNetworkInfoObserver. |
334 public: // from MNetworkInfoObserver. |
223 /** |
335 /** |
224 * |
336 * |
225 * @since S60 3.1 |
337 * NetworkInfo |
226 * @param |
338 * This method is used for setting the network cell id to the |
227 * @return |
339 * @since S60 3.1 |
|
340 * @param aNetworkInfo N/W info |
|
341 * @param aError Error code |
228 */ |
342 */ |
229 void NetworkInfo( const CTelephony::TNetworkInfoV1 &aNetworkInfo, TInt aError ); |
343 void NetworkInfo( const CTelephony::TNetworkInfoV1 &aNetworkInfo, TInt aError ); |
|
344 |
|
345 /** |
|
346 * Get mobile phone object for network info object |
|
347 * @return mobile phone object |
|
348 */ |
|
349 RMobilePhone& GetMobilePhone4NwInfo(); |
230 |
350 |
231 public: // from MPositionInfoObserver |
351 public: // from MPositionInfoObserver |
232 /** |
352 /** |
233 * |
353 * This method is used for setting the position info to the |
234 * @since S60 3.1 |
354 * location trail. |
235 * @param |
355 * @since S60 3.1 |
236 * @return |
356 * @param aPositionInfo the position information |
|
357 * @param aError Captures the errcode if any |
237 */ |
358 */ |
238 void Position( const TPositionInfo& aPositionInfo, const TInt aError ); |
359 void Position( const TPositionInfo& aPositionInfo, const TInt aError ); |
239 |
360 |
240 |
361 |
241 public: // From MMdEQueryObserver |
362 public: // From MMdEQueryObserver |
242 |
363 |
|
364 /** |
|
365 * Handle query new results |
|
366 * @param aQuery Query object |
|
367 * @param aFirstNewItemIndex new item index |
|
368 * @param aNewItemCount item count |
|
369 */ |
243 void HandleQueryNewResults(CMdEQuery& aQuery, TInt aFirstNewItemIndex, |
370 void HandleQueryNewResults(CMdEQuery& aQuery, TInt aFirstNewItemIndex, |
244 TInt aNewItemCount); |
371 TInt aNewItemCount); |
245 |
372 |
|
373 |
|
374 /* |
|
375 * This method is called when any of the location/image/tag query is completed |
|
376 * @param aQuery The Query type |
|
377 * @param aError Indicates if the query was completed successfully or with any err |
|
378 * |
|
379 */ |
246 void HandleQueryCompleted(CMdEQuery& aQuery, TInt aError); |
380 void HandleQueryCompleted(CMdEQuery& aQuery, TInt aError); |
247 |
381 |
248 private: |
382 #ifdef LOC_GEOTAGGING_CELLID |
|
383 public: // MGeoConverterObserver |
|
384 /** |
|
385 * This method is used for notifying completion of geotagging |
|
386 * @param aError error code |
|
387 * @param aPosition position (lat/lon) for the correcponding n/w info |
|
388 */ |
|
389 void ConversionCompletedL( const TInt aError, TLocality& aPosition ); |
|
390 |
|
391 /** |
|
392 * This method is used to handle the conversion error |
|
393 * @param aError the error code |
|
394 */ |
|
395 void HandleConversionError(TInt aError); |
|
396 |
|
397 #endif |
|
398 public: |
|
399 |
|
400 /* |
|
401 * Get registrer network country code |
|
402 * |
|
403 * @return current register n/w info |
|
404 */ |
|
405 IMPORT_C RMobilePhone::TMobilePhoneNetworkInfoV2& GetCurrentRegisteredNw(); |
|
406 |
|
407 |
|
408 private: |
249 /** |
409 /** |
250 * Stores the location info into the array. |
410 * Stores the location info into the array. |
251 */ |
411 * @param aSatelliteInfo Satellite information |
252 void StoreLocation( /*const TPosition& aPosition, const TCourse& aCourse,*/ |
412 */ |
253 const TPositionSatelliteInfo& aSatelliteInfo ); |
413 void StoreLocation( const TPositionSatelliteInfo& aSatelliteInfo ); |
254 |
414 |
255 /** |
415 /** |
256 * Changes the current state. New state is published in P&S and |
416 * Changes the current state. New state is published in P&S and |
257 * possible observer is notified. |
417 * possible observer is notified. |
|
418 * @param aState The location trail state that is to be set |
258 */ |
419 */ |
259 void SetCurrentState( TLocTrailState aState ); |
420 void SetCurrentState( TLocTrailState aState ); |
260 |
421 |
261 /** |
422 /** |
262 * Returns the requested location via callback method, if the location |
423 * Returns the requested location via callback method, if the location |
263 * is valid. Otherwise new location value is requested until the value |
424 * is valid. Otherwise new location value is requested until the value |
264 * is succesful, or the time out limit has been reached. |
425 * is succesful, or the time out limit has been reached. |
|
426 * @param aSatelliteInfo The satelliteInfo object |
|
427 * @param aError Indicates any error in handling the location request |
265 * |
428 * |
266 */ |
429 */ |
267 void HandleLocationRequest( const TPositionSatelliteInfo& aSatelliteInfo /*TLocality& aPosition*/, |
430 void HandleLocationRequest( const TPositionSatelliteInfo& aSatelliteInfo /*TLocality& aPosition*/, |
268 const TInt aError ); |
431 const TInt aError ); |
269 /** |
432 /** |
270 * C++ constructor. |
433 * C++ constructor. |
|
434 * @param aGeoTaggerObserver The observer that is to be notified when geotagging completes |
271 */ |
435 */ |
272 CLocationRecord(); |
436 CLocationRecord(MGeoTaggerObserver& aGeoTaggerObserver, RMobilePhone& aPhone); |
273 |
437 |
274 /** |
438 /** |
275 * 2nd phase constructor. |
439 * 2nd phase constructor. |
276 */ |
440 */ |
277 void ConstructL(); |
441 void ConstructL(); |
278 |
442 |
280 * Read interval value from Central repository |
444 * Read interval value from Central repository |
281 * @param aKey, Key to item |
445 * @param aKey, Key to item |
282 * @param aValue, Read value |
446 * @param aValue, Read value |
283 */ |
447 */ |
284 void ReadCenRepValueL(TInt aKey, TInt& aValue); |
448 void ReadCenRepValueL(TInt aKey, TInt& aValue); |
285 |
449 |
|
450 /** |
|
451 * Validates the lat lon values recieved |
|
452 * @param aSatelliteInfo The satelliteInfo object |
|
453 * @return ETrue if the lat=lon are valid |
|
454 */ |
286 TBool CheckGPSFix( const TPositionSatelliteInfo& aSatelliteInfo ); |
455 TBool CheckGPSFix( const TPositionSatelliteInfo& aSatelliteInfo ); |
287 |
456 |
|
457 |
|
458 /** |
|
459 * Starts the network info timer |
|
460 */ |
288 void StartTimerL(); |
461 void StartTimerL(); |
289 |
462 |
|
463 |
|
464 /** |
|
465 * Fetches the location info from the db |
|
466 */ |
|
467 |
|
468 void FindLocationFromDBL(); |
|
469 |
|
470 |
|
471 /** |
|
472 * Find location entry |
|
473 * @param aQuery query type for the tag |
|
474 * @param aLocationId Location Id |
|
475 */ |
|
476 void FindAnyLocationMatchesL( CMdEQuery& aQuery, TUint& aLocationId ); |
|
477 |
|
478 /** |
|
479 * Remaps the location objects when GPS is available |
|
480 * @param aGPSInfoAvailable Boolean value to indicate if GPS is available |
|
481 */ |
|
482 void RemapObjectsL( TBool aGPSInfoAvailable ); |
|
483 |
|
484 /** |
|
485 * Check any location object already exists with same network info |
|
486 */ |
|
487 void FindLocationWithSameNetInfoL(); |
|
488 |
|
489 /** |
|
490 * Initialises the location object definitions |
|
491 */ |
|
492 void InitialiseL(); |
|
493 |
|
494 /** |
|
495 * handle network location related query on complete |
|
496 * @param aQuery the query type |
|
497 */ |
|
498 void HandleNetLocationQueryL( CMdEQuery& aQuery ); |
|
499 |
|
500 |
|
501 /** |
|
502 * handle the location query on location query complete |
|
503 * @param aQuery the query type |
|
504 */ |
|
505 void HandleLocationQueryL( CMdEQuery& aQuery ); |
|
506 |
|
507 /** |
|
508 * Callback method on geotagging complete |
|
509 */ |
|
510 void GeoTaggingCompleted(); |
|
511 |
|
512 #ifdef LOC_REVERSEGEOCODE |
|
513 /** |
|
514 * Get any imagefor this location object |
|
515 * @param aLocID, location object Id |
|
516 */ |
|
517 void GetRelatedImageL( TItemId aLocID ); |
|
518 |
|
519 /** |
|
520 * Get tags for this image |
|
521 * @param aImageID, image object Id |
|
522 */ |
|
523 void GetTagsL( TItemId aImageID ); |
|
524 |
|
525 /** |
|
526 * handle the tag query on complete |
|
527 * @param aQuery the query type |
|
528 */ |
|
529 void HandleTagQueryL( CMdEQuery& aQuery ); |
|
530 |
|
531 |
|
532 // MReverseGeocodeObserver |
|
533 //from reverse-geocode observer |
|
534 /* |
|
535 * Call back method from reverse geo coder with address details like country, city.. |
|
536 * @param aErrorcode Indicates any error in Reverse geocoding |
|
537 * aAddressInfo address info |
|
538 */ |
|
539 void ReverseGeocodeComplete( TInt& aErrorcode, MAddressInfo& aAddressInfo ); |
|
540 |
|
541 /* |
|
542 * Get registrer network country code |
|
543 * |
|
544 * @return current register n/w info |
|
545 */ |
|
546 RMobilePhone::TMobilePhoneNetworkInfoV2& GetCurrentRegisterNw(); |
|
547 |
|
548 /* |
|
549 * UE is registered to home network? |
|
550 * |
|
551 * @return ETrue if UE is registered at home network else EFalse |
|
552 */ |
|
553 TBool IsRegisteredAtHomeNetwork(); |
|
554 |
|
555 |
|
556 /* |
|
557 * Get home network country code |
|
558 * @param aHomeNwInfoAvailableFlag ETrue if home n/w info available else EFalse |
|
559 * @return user home n/w info |
|
560 */ |
|
561 const RMobilePhone::TMobilePhoneNetworkInfoV1& |
|
562 GetHomeNetworkInfo(TBool& aHomeNwInfoAvailableFlag); |
|
563 |
|
564 /** |
|
565 * Find country & city tags id |
|
566 * @param aQuery query type for the tag |
|
567 * @param aCountryTagId country tag Id |
|
568 * @param aCityTagId city tag Id |
|
569 */ |
|
570 void FindCountryAndCityTagL( CMdEQuery& aQuery, TItemId& aCountryTagId, TItemId& aCityTagId ); |
|
571 |
|
572 #endif // LOC_REVERSEGEOCODE |
|
573 |
|
574 /** |
|
575 * Handle n/w related information on taken photograph |
|
576 * |
|
577 */ |
|
578 void NetworkInfoSnapshotL(); |
|
579 |
|
580 /** |
|
581 * Find location from DB within the non leaving method |
|
582 */ |
|
583 void HandleFindLocationFromDB(); |
|
584 |
|
585 /** |
|
586 * handle MDS query failure sceenario |
|
587 */ |
|
588 void HandleQueryFailure(); |
|
589 |
|
590 |
290 private: |
591 private: |
|
592 enum TRemapState |
|
593 { |
|
594 ERemapProgressNone = 0x00, |
|
595 ERemapRevGeoCodeInProgress, |
|
596 ERemapRevGeoCodePending, |
|
597 ERemapNwGeoConverterInProgress, |
|
598 ERemapNwGeoConverterPending |
|
599 }; |
291 /** |
600 /** |
292 * A session to Metadata Engine for creating and manipulating location objects. |
601 * A session to Metadata Engine for creating and manipulating location objects. |
293 */ |
602 */ |
294 CMdESession* iMdeSession; |
603 CMdESession* iMdeSession; |
295 |
604 |
355 TInt iInterval; |
664 TInt iInterval; |
356 |
665 |
357 TBool iRequestCurrentLoc; |
666 TBool iRequestCurrentLoc; |
358 TBool iTrailStarted; |
667 TBool iTrailStarted; |
359 |
668 |
360 TUint iLastNumberOfSatellitesUsed; |
|
361 TReal32 iLastHDOP; |
|
362 TReal32 iLastVDOP; |
|
363 TBool iLastGPSFixState; |
669 TBool iLastGPSFixState; |
364 |
670 |
365 TInt iLocationDelta; |
671 TInt iLocationDelta; |
366 TLocationData iLastLocation; |
672 TLocationData iLastLocation; |
367 TItemId iLastLocationId; |
|
368 |
673 |
369 TItemId iObjectId; |
674 TItemId iObjectId; |
370 TLocationData iLocationData; |
675 TLocationData iLocationData; |
371 |
676 |
372 /** |
677 /** |
373 * This query object is used to find existing locations |
678 * This query object is used to find existing locations |
374 */ |
679 */ |
375 CMdEObjectQuery* iLocationQuery; |
680 CMdEObjectQuery* iLocationQuery; |
|
681 |
|
682 |
|
683 /** |
|
684 * Net location query |
|
685 */ |
|
686 CMdEObjectQuery* iNetLocationQuery; |
|
687 |
|
688 |
|
689 TRemapState iRemapState; |
|
690 |
|
691 |
|
692 /** |
|
693 * Database definitions. |
|
694 */ |
|
695 CMdENamespaceDef* iNamespaceDef; |
|
696 CMdEObjectDef* iLocationObjectDef; |
|
697 CMdEPropertyDef* iLatitudeDef; |
|
698 CMdEPropertyDef* iLongitudeDef; |
|
699 CMdEPropertyDef* iAltitudeDef; |
|
700 |
|
701 /** |
|
702 * An array to collect downloaded object |
|
703 * and its location details. |
|
704 */ |
|
705 RPointerArray<TLocationSnapshotItem> iMediaItems; |
|
706 |
|
707 TLocationSnapshotItem iLastMediaItem; |
|
708 |
|
709 TInt iMediaHandlingFlag; |
|
710 RMobilePhone& iPhone; |
|
711 |
|
712 /* |
|
713 * Flag to track GPS data availability to update camera location icon. |
|
714 */ |
|
715 TBool iGpsDataAvailableFlag; |
|
716 |
|
717 MGeoTaggerObserver& iGeoTaggerObserver; |
|
718 |
|
719 #ifdef LOC_GEOTAGGING_CELLID |
|
720 /* |
|
721 * Geo converter |
|
722 */ |
|
723 CGeoConverter* iGeoConverter; |
|
724 TBool iConvertRetry; |
|
725 #endif |
|
726 |
|
727 #ifdef LOC_REVERSEGEOCODE |
|
728 |
|
729 TConnectionOption iConnectionOption; |
|
730 |
|
731 /** |
|
732 * query object for getting an image/video object |
|
733 */ |
|
734 CMdERelationQuery* iImageQuery; |
|
735 /** |
|
736 * query object for getting country and city tags |
|
737 */ |
|
738 CMdERelationQuery* iTagQuery; |
|
739 TLocationSnapshotItem iLastLocationItem; |
|
740 RPointerArray<TLocationSnapshotItem> iLocationItems; |
|
741 /** |
|
742 * to create/attach tags |
|
743 */ |
|
744 CTagCreator *iTagCreator; |
|
745 /* |
|
746 * Flag to track last reverse geocode failure sceenario |
|
747 */ |
|
748 TBool iLastReverseGeocodeFails; |
|
749 |
|
750 /* |
|
751 * Reverse geo coder plugin object |
|
752 */ |
|
753 CReverseGeoCoderPlugin* iRevGeocoderPlugin; |
|
754 TUid iDtorKey; |
|
755 |
|
756 #endif |
|
757 |
376 }; |
758 }; |
377 |
759 |
378 #endif // C_CLOCATIONRECORD_H |
760 #endif // C_CLOCATIONRECORD_H |
379 |
761 |
380 // End of file. |
762 // End of file. |